From 403ec320b3c6921e8bc47c6b3299ee9210ec6f8f Mon Sep 17 00:00:00 2001 From: nithyatsu Date: Thu, 5 Dec 2024 13:20:47 -0800 Subject: [PATCH] wip --- test/rp/rptest.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/rp/rptest.go b/test/rp/rptest.go index 21dc72d435..4137a5f845 100644 --- a/test/rp/rptest.go +++ b/test/rp/rptest.go @@ -25,7 +25,11 @@ import ( "testing" "time" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/credentials/stscreds" "github.com/aws/aws-sdk-go-v2/service/cloudcontrol" + "github.com/aws/aws-sdk-go-v2/service/sts" + ucp_aws "github.com/radius-project/radius/pkg/ucp/aws" "github.com/stretchr/testify/require" apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -43,7 +47,6 @@ import ( "github.com/radius-project/radius/pkg/cli/kubernetes" "github.com/radius-project/radius/pkg/cli/workspaces" "github.com/radius-project/radius/pkg/sdk" - "github.com/radius-project/radius/pkg/ucp/aws" "github.com/radius-project/radius/test" "github.com/radius-project/radius/test/radcli" "github.com/radius-project/radius/test/step" @@ -105,7 +108,7 @@ type RPTestOptions struct { CustomAction *clientv2.CustomActionClient ManagementClient clients.ApplicationsManagementClient - AWSClient aws.AWSCloudControlClient + AWSClient ucp_aws.AWSCloudControlClient // Connection gets access to the Radius connection which can be used to create API clients. Connection sdk.Connection @@ -185,7 +188,12 @@ func NewRPTestOptions(t *testing.T) RPTestOptions { cfg, err := awsconfig.LoadDefaultConfig(ctx) require.NoError(t, err) - var awsClient aws.AWSCloudControlClient = cloudcontrol.NewFromConfig(cfg) + + stsClient := sts.NewFromConfig(cfg) + roleARN := "arn:aws:iam::179022619019:role/radius_func_test" + creds := stscreds.NewAssumeRoleProvider(stsClient, roleARN) + cfg.Credentials = aws.NewCredentialsCache(creds) + var awsClient ucp_aws.AWSCloudControlClient = cloudcontrol.NewFromConfig(cfg) return RPTestOptions{ TestOptions: test.NewTestOptions(t),