mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 02:28:09 +00:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -5,11 +5,13 @@ package command | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"bytes" | 	"bytes" | ||||||
|  | 	"context" | ||||||
| 	"crypto/rand" | 	"crypto/rand" | ||||||
| 	"crypto/rsa" | 	"crypto/rsa" | ||||||
| 	"crypto/x509" | 	"crypto/x509" | ||||||
| 	"encoding/base64" | 	"encoding/base64" | ||||||
| 	"testing" | 	"testing" | ||||||
|  | 	"time" | ||||||
|  |  | ||||||
| 	"github.com/hashicorp/vault/api" | 	"github.com/hashicorp/vault/api" | ||||||
|  |  | ||||||
| @@ -29,6 +31,15 @@ func TestTransitImport(t *testing.T) { | |||||||
| 		t.Fatalf("transit mount error: %#v", err) | 		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) | 	rsa1, rsa2, aes128, aes256 := generateKeys(t) | ||||||
|  |  | ||||||
| 	type testCase struct { | 	type testCase struct { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Steven Clark
					Steven Clark