diff --git a/va/va_test.go b/va/va_test.go index 705ca7d5372..8a5c07776a2 100644 --- a/va/va_test.go +++ b/va/va_test.go @@ -605,14 +605,29 @@ func TestMultiVALogging(t *testing.T) { test.AssertNotError(t, err, "performing validation") // We do not log perspective or RIR for the local VAs. + // We expect these log lines to be available immediately. test.Assert(t, len(vaLog.GetAllMatching(`"Perspective"`)) == 0, "expected no logged perspective for primary") test.Assert(t, len(vaLog.GetAllMatching(`"RIR"`)) == 0, "expected no logged RIR for primary") // We do log perspective and RIR for the remote VAs. - test.Assert(t, len(rva1Log.GetAllMatching(`"Perspective":"dev-arin"`)) == 1, "expected perspective of VA to be dev-arin") - test.Assert(t, len(rva1Log.GetAllMatching(`"RIR":"ARIN"`)) == 1, "expected perspective of VA to be ARIN") - test.Assert(t, len(rva2Log.GetAllMatching(`"Perspective":"dev-ripe"`)) == 1, "expected perspective of VA to be dev-ripe") - test.Assert(t, len(rva2Log.GetAllMatching(`"RIR":"RIPE"`)) == 1, "expected perspective of VA to be RIPE") + // + // Because the remote VAs are operating on different goroutines, we aren't guaranteed their + // log lines have arrived yet. Give it a few tries. + for i := 0; i < 10; i++ { + if len(rva1Log.GetAllMatching(`"Perspective":"dev-arin"`)) >= 1 && + len(rva1Log.GetAllMatching(`"RIR":"ARIN"`)) >= 1 && + len(rva2Log.GetAllMatching(`"Perspective":"dev-ripe"`)) >= 1 && + len(rva2Log.GetAllMatching(`"RIR":"RIPE"`)) >= 1 { + break + } + if i == 9 { + t.Logf("VA:\n%s\n", strings.Join(vaLog.GetAll(), "\n")) + t.Logf("RVA 1:\n%s\n", strings.Join(rva1Log.GetAll(), "\n")) + t.Logf("RVA 2:\n%s\n", strings.Join(rva2Log.GetAll(), "\n")) + t.Errorf("expected perspective and RIR logs for remote VAs, but they never arrived") + } + time.Sleep(100 * time.Millisecond) + } } func TestDetailedError(t *testing.T) {