From 68fbb17b9c252869be38b9b87447b51b240cdeb0 Mon Sep 17 00:00:00 2001 From: Steven Clark Date: Tue, 21 Nov 2023 10:58:44 -0500 Subject: [PATCH] TestTransitImport: Generate Transit wrapping key with a longer context (#24212) - Instead of relying on the initial call to import to generate the wrapping key, generate it within the test setup with a longer dedicated timeout. - This hopefully is enough of a timeout for the 32 bit nightly runner --- command/transit_import_key_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/command/transit_import_key_test.go b/command/transit_import_key_test.go index 6bcf0237df..21884c0799 100644 --- a/command/transit_import_key_test.go +++ b/command/transit_import_key_test.go @@ -5,11 +5,13 @@ package command import ( "bytes" + "context" "crypto/rand" "crypto/rsa" "crypto/x509" "encoding/base64" "testing" + "time" "github.com/hashicorp/vault/api" @@ -29,6 +31,15 @@ func TestTransitImport(t *testing.T) { t.Fatalf("transit mount error: %#v", err) } + // Force the generation of the Transit wrapping key now with a longer context + // to help the 32bit nightly tests. This creates a 4096-bit RSA key which can take + // a while on an overloaded system + genWrappingKeyCtx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + if _, err := client.Logical().ReadWithContext(genWrappingKeyCtx, "transit/wrapping_key"); err != nil { + t.Fatalf("transit failed generating wrapping key: %#v", err) + } + rsa1, rsa2, aes128, aes256 := generateKeys(t) type testCase struct {