Skip to content

Commit

Permalink
Add error case into TestAWSRegionCheckLatencyHTTP
Browse files Browse the repository at this point in the history
  • Loading branch information
ekalinin committed Nov 18, 2021
1 parent def6ef2 commit 0c793ab
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ func TestAWSRegionCheckLatencyHTTP(t *testing.T) {
if got < want || got > want+2 {
t.Errorf("failed:\ngot=%f\nwant=%f", got, want)
}

// check "error"
errTxt := "something bad"
regions[0].Request = &testRequest{err: errors.New(errTxt)}

wg.Add(1)
regions[0].CheckLatency(&wg)

if regions[0].Error == nil {
t.Errorf("failed: error should not be empty")
}

if regions[0].Error.Error() != errTxt {
t.Errorf("failed: error should be empty=%s", errTxt)
}
}

type testRequest struct {
Expand Down

0 comments on commit 0c793ab

Please sign in to comment.