Skip to content

Commit 1812a88

Browse files
committed
fix session creation in e2e test suite
Signed-off-by: Pankaj Walke <[email protected]>
1 parent cac740b commit 1812a88

File tree

3 files changed

+4
-33
lines changed

3 files changed

+4
-33
lines changed

test/e2e/shared/aws.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -368,25 +368,6 @@ func (i *AWSInfrastructure) DeleteInfrastructure() {
368368
}
369369
}
370370

371-
func NewAWSConfig(ctx context.Context) awsv2.Config {
372-
By("Getting an AWS config using SDK v2 - from environment")
373-
374-
region, err := credentials.ResolveRegion("")
375-
Expect(err).NotTo(HaveOccurred())
376-
377-
cfg, err := config.LoadDefaultConfig(ctx,
378-
config.WithRegion(region),
379-
config.WithClientLogMode(awsv2.LogSigning),
380-
config.WithSharedConfigProfile(""),
381-
)
382-
Expect(err).NotTo(HaveOccurred())
383-
384-
_, err = cfg.Credentials.Retrieve(ctx)
385-
Expect(err).NotTo(HaveOccurred())
386-
387-
return cfg
388-
}
389-
390371
func NewAWSSession() client.ConfigProvider {
391372
By("Getting an AWS IAM session - from environment")
392373
region, err := credentials.ResolveRegion("")

test/e2e/shared/context.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ type E2EContext struct {
6969
AWSSessionV2 *awsv2.Config
7070
// BootstrapUserAWSSession is the AWS session for the bootstrap user.
7171
BootstrapUserAWSSession client.ConfigProvider
72-
// BootstrapUserAWSSessionV2 is the AWS SDK V2 session for the bootstrap user.
72+
// BootstrapUserAWSSessionV2 is the AWS SDK V2 session for the bootstrap user. This is until the V2 migration is done.
7373
BootstrapUserAWSSessionV2 *awsv2.Config
74-
// IsManaged indicates that this is for the managed part of the provider. This is until the V2 migration is done.
74+
// IsManaged indicates that this is for the managed part of the provider.
7575
IsManaged bool
7676
// CloudFormationTemplate is the rendered template created for the test.
7777
CloudFormationTemplate *cloudformation.Template

test/e2e/shared/suite.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,7 @@ func Node1BeforeSuite(e2eCtx *E2EContext) []byte {
157157
ensureSSHKeyPair(e2eCtx.AWSSession, DefaultSSHKeyPairName)
158158
e2eCtx.Environment.BootstrapAccessKey = newUserAccessKey(context.TODO(), e2eCtx.AWSSessionV2, bootstrapTemplate.Spec.BootstrapUser.UserName)
159159
e2eCtx.BootstrapUserAWSSession = NewAWSSessionWithKey(e2eCtx.Environment.BootstrapAccessKey)
160-
//TODO: v2AccessKey can be removed after AWS SDK V2 Migration
161-
v2AccessKey := &iamtypes.AccessKey{
162-
AccessKeyId: e2eCtx.Environment.BootstrapAccessKey.AccessKeyId,
163-
SecretAccessKey: e2eCtx.Environment.BootstrapAccessKey.SecretAccessKey,
164-
}
165-
e2eCtx.BootstrapUserAWSSessionV2 = NewAWSSessionWithKeyV2(v2AccessKey)
160+
e2eCtx.BootstrapUserAWSSessionV2 = NewAWSSessionWithKeyV2(e2eCtx.Environment.BootstrapAccessKey)
166161
Expect(ensureTestImageUploaded(e2eCtx)).NotTo(HaveOccurred())
167162

168163
// Image ID is needed when using a CI Kubernetes version. This is used in conformance test and upgrade to main test.
@@ -231,12 +226,7 @@ func AllNodesBeforeSuite(e2eCtx *E2EContext, data []byte) {
231226
e2eCtx.Environment.BootstrapClusterProxy = framework.NewClusterProxy("bootstrap", conf.KubeconfigPath, e2eCtx.Environment.Scheme)
232227
e2eCtx.E2EConfig = &conf.E2EConfig
233228
e2eCtx.BootstrapUserAWSSession = NewAWSSessionWithKey(conf.BootstrapAccessKey)
234-
//TODO: v2AccessKey can be removed after AWS SDK V2 Migration
235-
v2AccessKey := &iamtypes.AccessKey{
236-
AccessKeyId: e2eCtx.Environment.BootstrapAccessKey.AccessKeyId,
237-
SecretAccessKey: e2eCtx.Environment.BootstrapAccessKey.SecretAccessKey,
238-
}
239-
e2eCtx.BootstrapUserAWSSessionV2 = NewAWSSessionWithKeyV2(v2AccessKey)
229+
e2eCtx.BootstrapUserAWSSessionV2 = NewAWSSessionWithKeyV2(conf.BootstrapAccessKey)
240230
e2eCtx.Settings.FileLock = flock.New(ResourceQuotaFilePath)
241231
e2eCtx.Settings.KubetestConfigFilePath = conf.KubetestConfigFilePath
242232
e2eCtx.Settings.UseCIArtifacts = conf.UseCIArtifacts

0 commit comments

Comments
 (0)