From 67f1ad7db0cf24e92b5511353b8837a9ec7173d6 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 26 Dec 2025 18:07:24 -0800 Subject: [PATCH] Fix S3 client credentials to use environment variables The test was using hardcoded credentials "any"/"any" but the Makefile sets AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY to "some_access_key1"/ "some_secret_key1". Updated getS3Client() to read from environment variables with fallback to "any"/"any" for manual testing. --- test/s3/sse/s3_volume_encryption_test.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/s3/sse/s3_volume_encryption_test.go b/test/s3/sse/s3_volume_encryption_test.go index 182783797..df23c011b 100644 --- a/test/s3/sse/s3_volume_encryption_test.go +++ b/test/s3/sse/s3_volume_encryption_test.go @@ -8,6 +8,7 @@ import ( "context" "fmt" "io" + "os" "strings" "testing" "time" @@ -399,12 +400,23 @@ func TestS3VolumeEncryptionCopy(t *testing.T) { // Helper functions func getS3Client(t *testing.T) *s3.S3 { + // Use credentials from environment if available, otherwise use defaults + // This allows tests to work with the Makefile which sets AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY + accessKey := "any" + secretKey := "any" + if envAccessKey := os.Getenv("AWS_ACCESS_KEY_ID"); envAccessKey != "" { + accessKey = envAccessKey + } + if envSecretKey := os.Getenv("AWS_SECRET_ACCESS_KEY"); envSecretKey != "" { + secretKey = envSecretKey + } + sess, err := session.NewSession(&aws.Config{ Region: aws.String("us-east-1"), Endpoint: aws.String("http://localhost:8333"), DisableSSL: aws.Bool(true), S3ForcePathStyle: aws.Bool(true), - Credentials: credentials.NewStaticCredentials("any", "any", ""), + Credentials: credentials.NewStaticCredentials(accessKey, secretKey, ""), }) if err != nil { t.Fatalf("Failed to create session: %v", err)