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,13 +77,19 @@ func TestAkamaiPurgerDrainQueueFails(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
_, err = purgerClient.Purge(context.Background(), &akamaipb.PurgeRequest{
Urls: []string{"http://example.com/"}, // 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
if err != nil { // that our SIGTERM reaches the process before it's fully cleared the queue.
// Don't use t.Fatal here because we need to get as far as the SIGTERM or for i := 0; i < 10; i++ {
// we'll hang on exit. _, err = purgerClient.Purge(context.Background(), &akamaipb.PurgeRequest{
t.Error(err) Urls: []string{fmt.Sprintf("http://example%d.com/", i)},
})
if err != nil {
// Don't use t.Fatal here because we need to get as far as the SIGTERM or
// we'll hang on exit.
t.Error(err)
}
} }
purgerCmd.Process.Signal(syscall.SIGTERM) purgerCmd.Process.Signal(syscall.SIGTERM)
@ -91,7 +97,11 @@ func TestAkamaiPurgerDrainQueueFails(t *testing.T) {
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

@ -1,29 +1,41 @@
{ {
"akamaiPurger": { "akamaiPurger": {
"debugAddr": ":9766", "debugAddr": ":9766",
"purgeRetries": 10, "purgeRetries": 10,
"purgeRetryBackoff": "50ms", "purgeRetryBackoff": "50ms",
"baseURL": "http://localhost:6889", "throughput": {
"clientToken": "its-a-token", "queueEntriesPerBatch": 2,
"clientSecret": "its-a-secret", "purgeBatchInterval": "32ms"
"accessToken": "idk-how-this-is-different-from-client-token-but-okay", },
"v3Network": "staging", "baseURL": "http://localhost:6889",
"tls": { "clientToken": "its-a-token",
"caCertfile": "test/grpc-creds/minica.pem", "clientSecret": "its-a-secret",
"certFile": "test/grpc-creds/akamai-purger.boulder/cert.pem", "accessToken": "idk-how-this-is-different-from-client-token-but-okay",
"keyFile": "test/grpc-creds/akamai-purger.boulder/key.pem" "v3Network": "staging",
}, "tls": {
"grpc": { "caCertfile": "test/grpc-creds/minica.pem",
"address": ":9199", "certFile": "test/grpc-creds/akamai-purger.boulder/cert.pem",
"clientNames": [ "keyFile": "test/grpc-creds/akamai-purger.boulder/key.pem"
"health-checker.boulder", },
"ra.boulder" "grpc": {
] "address": ":9199",
} "maxConnectionAge": "30s",
}, "services": {
"akamai.AkamaiPurger": {
"syslog": { "clientNames": [
"stdoutlevel": 6, "ra.boulder"
"sysloglevel": 6 ]
} },
"grpc.health.v1.Health": {
"clientNames": [
"health-checker.boulder"
]
}
}
}
},
"syslog": {
"stdoutlevel": 6,
"sysloglevel": -1
}
} }