Skip to content

Commit

Permalink
e2e: support AWS Session Token in real provider test (envoyproxy#299)
Browse files Browse the repository at this point in the history
**Commit Message**
Allow setting AWS session token in the AWS credential file when using
AWS temporary credentials to test AWS Bedrock.

**Related Issues/PRs (if applicable)**

**Special notes for reviewers (if applicable)**
TEST_AWS_SESSION_TOKEN is optional if using static AWS credential.

Signed-off-by: Dan Sun <dsun20@bloomberg.net>
Signed-off-by: Erica Hughberg <erica.sundberg.90@gmail.com>
  • Loading branch information
yuzisun authored and missBerg committed Feb 9, 2025
1 parent b255396 commit 8bced8b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/extproc/real_providers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@ func TestWithRealProviders(t *testing.T) {
// Set up credential file for AWS.
awsAccessKeyID := getEnvVarOrSkip(t, "TEST_AWS_ACCESS_KEY_ID")
awsSecretAccessKey := getEnvVarOrSkip(t, "TEST_AWS_SECRET_ACCESS_KEY")
awsCredentialsBody := fmt.Sprintf("[default]\nAWS_ACCESS_KEY_ID=%s\nAWS_SECRET_ACCESS_KEY=%s\n", awsAccessKeyID, awsSecretAccessKey)
awsSessionToken := os.Getenv("TEST_AWS_SESSION_TOKEN")
var awsCredentialsBody string
if awsSessionToken != "" {
awsCredentialsBody = fmt.Sprintf("[default]\nAWS_ACCESS_KEY_ID=%s\nAWS_SECRET_ACCESS_KEY=%s\nTEST_AWS_SESSION_TOKEN=%s\n",
awsAccessKeyID, awsSecretAccessKey, awsSessionToken)
} else {
awsCredentialsBody = fmt.Sprintf("[default]\nAWS_ACCESS_KEY_ID=%s\nAWS_SECRET_ACCESS_KEY=%s\n",
awsAccessKeyID, awsSecretAccessKey)
}

// Test with AWS Credential File.
awsFilePath := t.TempDir() + "/aws-credential-file"
Expand Down

0 comments on commit 8bced8b

Please sign in to comment.