From a37e6704ea5258605c219f2249ac21cc8c745bd2 Mon Sep 17 00:00:00 2001 From: nithyatsu Date: Thu, 5 Dec 2024 15:43:42 -0800 Subject: [PATCH] wip --- .github/workflows/functional-test-cloud.yaml | 1 + test/functional-portable/ucp/cloud/aws_test.go | 15 +++++++++++++-- test/rp/rptest.go | 16 +++++++++------- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/functional-test-cloud.yaml b/.github/workflows/functional-test-cloud.yaml index 42e16e762c..9a99b4b240 100644 --- a/.github/workflows/functional-test-cloud.yaml +++ b/.github/workflows/functional-test-cloud.yaml @@ -560,6 +560,7 @@ jobs: # aws-region: ${{ env.AWS_REGION }} # create kind cluster with OIDC provider. + - name: Create KinD cluster run: | curl -sSLo "kind" "https://github.com/kubernetes-sigs/kind/releases/download/${{ env.KIND_VER }}/kind-linux-amd64" diff --git a/test/functional-portable/ucp/cloud/aws_test.go b/test/functional-portable/ucp/cloud/aws_test.go index 6640751a9c..2c3f48df3c 100644 --- a/test/functional-portable/ucp/cloud/aws_test.go +++ b/test/functional-portable/ucp/cloud/aws_test.go @@ -29,10 +29,14 @@ import ( awsgo "github.com/aws/aws-sdk-go-v2/aws" awsconfig "github.com/aws/aws-sdk-go-v2/config" + "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" "github.com/google/uuid" "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" "github.com/radius-project/radius/pkg/ucp/aws" + + ucp_aws "github.com/radius-project/radius/pkg/ucp/aws" "github.com/radius-project/radius/pkg/ucp/frontend/controller/awsproxy" test "github.com/radius-project/radius/test/ucp" "github.com/radius-project/radius/test/validation" @@ -148,7 +152,14 @@ func setupTestAWSResource(t *testing.T, ctx context.Context, resourceName string // Test setup - Create AWS resource using AWS APIs cfg, err := awsconfig.LoadDefaultConfig(ctx) require.NoError(t, err) - var awsClient aws.AWSCloudControlClient = cloudcontrol.NewFromConfig(cfg) + //var awsClient ucp_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 = awsgo.NewCredentialsCache(creds) + var awsClient ucp_aws.AWSCloudControlClient = cloudcontrol.NewFromConfig(cfg) + desiredState := map[string]any{ "BucketName": resourceName, "AccessControl": "Private", @@ -188,7 +199,7 @@ func setupTestAWSResource(t *testing.T, ctx context.Context, resourceName string // End of test setup } -func waitForSuccess(t *testing.T, ctx context.Context, awsClient aws.AWSCloudControlClient, requestToken *string) { +func waitForSuccess(t *testing.T, ctx context.Context, awsClient ucp_aws.AWSCloudControlClient, requestToken *string) { // Wait till the create is complete maxWaitTime := 300 * time.Second waiter := cloudcontrol.NewResourceRequestSuccessWaiter(awsClient) diff --git a/test/rp/rptest.go b/test/rp/rptest.go index f8a728b03a..4cf1eab81f 100644 --- a/test/rp/rptest.go +++ b/test/rp/rptest.go @@ -25,7 +25,10 @@ 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" @@ -185,15 +188,14 @@ func NewRPTestOptions(t *testing.T) RPTestOptions { cfg, err := awsconfig.LoadDefaultConfig(ctx) require.NoError(t, err) + //var awsClient ucp_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) - /* - 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), Workspace: workspace,