fix missed test
Signed-off-by: Daniel Morsing <dmo@jetstack.io>
This commit is contained in:
parent
b0a9b8276c
commit
336e9e353a
@ -40,7 +40,6 @@ func TestCheck(t *testing.T) {
|
|||||||
reachabilityTest reachabilityTest
|
reachabilityTest reachabilityTest
|
||||||
challenge *v1alpha1.Challenge
|
challenge *v1alpha1.Challenge
|
||||||
expectedErr bool
|
expectedErr bool
|
||||||
expectedOk bool
|
|
||||||
}
|
}
|
||||||
tests := []testT{
|
tests := []testT{
|
||||||
{
|
{
|
||||||
@ -48,14 +47,14 @@ func TestCheck(t *testing.T) {
|
|||||||
reachabilityTest: func(context.Context, *url.URL, string) error {
|
reachabilityTest: func(context.Context, *url.URL, string) error {
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
expectedOk: true,
|
expectedErr: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "should error",
|
name: "should error",
|
||||||
reachabilityTest: func(context.Context, *url.URL, string) error {
|
reachabilityTest: func(context.Context, *url.URL, string) error {
|
||||||
return fmt.Errorf("failed")
|
return fmt.Errorf("failed")
|
||||||
},
|
},
|
||||||
expectedErr: false,
|
expectedErr: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +71,7 @@ func TestCheck(t *testing.T) {
|
|||||||
requiredPasses: requiredCallsForPass,
|
requiredPasses: requiredCallsForPass,
|
||||||
}
|
}
|
||||||
|
|
||||||
ok, err := s.Check(context.Background(), nil, test.challenge)
|
err := s.Check(context.Background(), nil, test.challenge)
|
||||||
if err != nil && !test.expectedErr {
|
if err != nil && !test.expectedErr {
|
||||||
t.Errorf("Expected Check to return non-nil error, but got %v", err)
|
t.Errorf("Expected Check to return non-nil error, but got %v", err)
|
||||||
return
|
return
|
||||||
@ -81,10 +80,7 @@ func TestCheck(t *testing.T) {
|
|||||||
t.Errorf("Expected error from Check, but got none")
|
t.Errorf("Expected error from Check, but got none")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if test.expectedOk != ok {
|
if !test.expectedErr && calls != requiredCallsForPass {
|
||||||
t.Errorf("Expected ok=%t but got ok=%t", test.expectedOk, ok)
|
|
||||||
}
|
|
||||||
if test.expectedOk && calls != requiredCallsForPass {
|
|
||||||
t.Errorf("Expected Wait to verify reachability test passes %d times, but only checked %d", requiredCallsForPass, calls)
|
t.Errorf("Expected Wait to verify reachability test passes %d times, but only checked %d", requiredCallsForPass, calls)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user