Resolve TestAkamaiPurgerDrainQueueFails race (#6844)

Fixes https://github.com/letsencrypt/boulder/issues/6837
This commit is contained in:
Aaron Gable 2023-04-26 08:30:09 -07:00 committed by GitHub
parent 97aa50977f
commit 25cae29f70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 57 additions and 35 deletions

View File

@ -77,21 +77,31 @@ func TestAkamaiPurgerDrainQueueFails(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
// We know that the purger is configured to only process two items per batch,
// so submitting 10 items should give it enough of a backlog to guarantee
// that our SIGTERM reaches the process before it's fully cleared the queue.
for i := 0; i < 10; i++ {
_, err = purgerClient.Purge(context.Background(), &akamaipb.PurgeRequest{ _, err = purgerClient.Purge(context.Background(), &akamaipb.PurgeRequest{
Urls: []string{"http://example.com/"}, Urls: []string{fmt.Sprintf("http://example%d.com/", i)},
}) })
if err != nil { if err != nil {
// Don't use t.Fatal here because we need to get as far as the SIGTERM or // Don't use t.Fatal here because we need to get as far as the SIGTERM or
// we'll hang on exit. // we'll hang on exit.
t.Error(err) t.Error(err)
} }
}
purgerCmd.Process.Signal(syscall.SIGTERM) purgerCmd.Process.Signal(syscall.SIGTERM)
err = purgerCmd.Wait() err = purgerCmd.Wait()
if err == nil { if err == nil {
t.Error("expected error shutting down akamai-purger that could not reach backend") t.Error("expected error shutting down akamai-purger that could not reach backend")
} }
test.AssertContains(t, outputBuffer.String(), "failed to purge OCSP responses for 1 certificates before exit: all attempts to submit purge request failed")
// Use two asserts because we're not sure what integer (10? 8?) will come in
// the middle of the error message.
test.AssertContains(t, outputBuffer.String(), "failed to purge OCSP responses for")
test.AssertContains(t, outputBuffer.String(), "certificates before exit: all attempts to submit purge request failed")
} }
func TestAkamaiPurgerDrainQueueSucceeds(t *testing.T) { func TestAkamaiPurgerDrainQueueSucceeds(t *testing.T) {

View File

@ -3,6 +3,10 @@
"debugAddr": ":9766", "debugAddr": ":9766",
"purgeRetries": 10, "purgeRetries": 10,
"purgeRetryBackoff": "50ms", "purgeRetryBackoff": "50ms",
"throughput": {
"queueEntriesPerBatch": 2,
"purgeBatchInterval": "32ms"
},
"baseURL": "http://localhost:6889", "baseURL": "http://localhost:6889",
"clientToken": "its-a-token", "clientToken": "its-a-token",
"clientSecret": "its-a-secret", "clientSecret": "its-a-secret",
@ -15,15 +19,23 @@
}, },
"grpc": { "grpc": {
"address": ":9199", "address": ":9199",
"maxConnectionAge": "30s",
"services": {
"akamai.AkamaiPurger": {
"clientNames": [ "clientNames": [
"health-checker.boulder",
"ra.boulder" "ra.boulder"
] ]
},
"grpc.health.v1.Health": {
"clientNames": [
"health-checker.boulder"
]
}
}
} }
}, },
"syslog": { "syslog": {
"stdoutlevel": 6, "stdoutlevel": 6,
"sysloglevel": 6 "sysloglevel": -1
} }
} }