Fix flake in TestMultiVA (#6141)

Fix a race condition in one of the TestMultiVA test cases.

There are many other possible flakes in these tests, because
they use real HTTP to talk to a fake remote VA on localhost,
but we can at least trivially remove this race condition.

Fixes #6119
This commit is contained in:
Aaron Gable 2022-05-25 14:25:41 -07:00 committed by GitHub
parent cf9e250735
commit 8227c8fcb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -420,8 +420,9 @@ func TestMultiVA(t *testing.T) {
},
AllowedUAs: allowedUAs,
Features: noEnforceMultiVA,
// The real failure cause should be logged
ExpectedLog: expectedInternalErrLine,
// Like above, the real failure cause will be logged eventually, but that
// will happen asynchronously. It's not guaranteed to happen before the
// test case exits, so we don't check for it here.
},
{
// With only one working remote VA there should *not* be a validation
@ -514,7 +515,9 @@ func TestMultiVA(t *testing.T) {
if tc.ExpectedLog != "" {
lines := mockLog.GetAllMatching(tc.ExpectedLog)
test.AssertEquals(t, len(lines), 1)
if len(lines) != 1 {
t.Fatalf("Got log %v; expected %q", mockLog.GetAll(), tc.ExpectedLog)
}
}
})
}