Skip to content

Commit

Permalink
Remove VPC from tags test matrix (#3296)
Browse files Browse the repository at this point in the history
Nothing that the TestRandomTagsCombinationsGo test periodically flakes
up, as in #3292 on testing VPC
resources. I've not established the root cause but it appears to be that
the VPCs allocated by independent test instances collide. This is
probably just not a good resource to test tag correctness on and I think
we're not losing much coverage by simply removing it. Buckets tests
still test the SDKv2 based resources.
  • Loading branch information
t0yv0 authored Jan 23, 2024
1 parent 221d7ca commit 2e71692
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 65 deletions.
44 changes: 1 addition & 43 deletions examples/examples_go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (

"github.com/aws/aws-sdk-go/aws/session"
appconfigsdk "github.com/aws/aws-sdk-go/service/appconfig"
ec2sdk "github.com/aws/aws-sdk-go/service/ec2"
s3sdk "github.com/aws/aws-sdk-go/service/s3"
"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -185,11 +184,10 @@ func (st tagsState) validateStateResult(phase int) func(
return func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
legacyBucketTags := fetchBucketTags(t, stack.Outputs["legacy-bucket-name"].(string))
actualBucketTags := fetchBucketTags(t, stack.Outputs["bucket-name"].(string))
actualVpcTags := fetchVpcTags(t, stack.Outputs["vpc-id"].(string))
appTags := fetchAppConfigTags(t, stack.Outputs["appconfig-app-arn"].(string))
for k, v := range stack.Outputs {
switch k {
case "bucket-name", "legacy-bucket-name", "vpc-id", "appconfig-app-arn":
case "bucket-name", "legacy-bucket-name", "appconfig-app-arn":
continue
}

Expand All @@ -208,9 +206,6 @@ func (st tagsState) validateStateResult(phase int) func(
if k == "legacy-bucket" {
require.Equalf(t, st.expectedTags(), legacyBucketTags, "bad legacy bucket tags")
}
if k == "vpc" {
require.Equalf(t, st.expectedTags(), actualVpcTags, "bad vpc tags")
}
if k == "appconfig-app" {
require.Equalf(t, st.expectedTags(), appTags, "bad appconfig app tags")
}
Expand Down Expand Up @@ -243,43 +238,6 @@ func fetchBucketTags(t *testing.T, awsBucket string) map[string]string {
return tags
}

func fetchVpcTags(t *testing.T, vpc string) map[string]string {
ptr := func(x string) *string {
return &x
}

sess := session.Must(session.NewSessionWithOptions(session.Options{
SharedConfigState: session.SharedConfigEnable,
}))

client := ec2sdk.New(sess)

tagsOut, err := client.DescribeTags(&ec2sdk.DescribeTagsInput{
Filters: []*ec2sdk.Filter{
{
Name: ptr("resource-type"),
Values: []*string{
ptr("vpc"),
},
},
{
Name: ptr("resource-id"),
Values: []*string{
ptr(vpc),
},
},
},
})
require.NoError(t, err)

res := map[string]string{}
for _, tag := range tagsOut.Tags {
res[*tag.Key] = *tag.Value
}

return res
}

func fetchAppConfigTags(t *testing.T, arn string) map[string]string {
sess := session.Must(session.NewSessionWithOptions(session.Options{
SharedConfigState: session.SharedConfigEnable,
Expand Down
11 changes: 0 additions & 11 deletions examples/tags-combinations-go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appconfig"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
Expand Down Expand Up @@ -49,14 +48,6 @@ func main() {
return err
}

vpc, err := ec2.NewVpc(ctx, "mainvpc", &ec2.VpcArgs{
CidrBlock: pulumi.String("10.0.0.0/16"),
Tags: tagsMap,
}, pulumi.Provider(p))
if err != nil {
return err
}

bucket, err := s3.NewBucketV2(ctx, "bucketv2", &s3.BucketV2Args{
Tags: tagsMap,
}, pulumi.Provider(p))
Expand All @@ -79,8 +70,6 @@ func main() {
return err
}

ctx.Export("vpc", exportTags(vpc.Tags))
ctx.Export("vpc-id", vpc.ID())
ctx.Export("bucket", exportTags(bucket.Tags))
ctx.Export("legacy-bucket", exportTags(legacyBucket.Tags))
ctx.Export("bucket-name", bucket.Bucket)
Expand Down
11 changes: 0 additions & 11 deletions examples/tags-combinations-go/step1/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appconfig"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
Expand Down Expand Up @@ -49,14 +48,6 @@ func main() {
return err
}

vpc, err := ec2.NewVpc(ctx, "mainvpc", &ec2.VpcArgs{
CidrBlock: pulumi.String("10.0.0.0/16"),
Tags: tagsMap,
}, pulumi.Provider(p))
if err != nil {
return err
}

bucket, err := s3.NewBucketV2(ctx, "bucketv2", &s3.BucketV2Args{
Tags: tagsMap,
}, pulumi.Provider(p))
Expand All @@ -79,8 +70,6 @@ func main() {
return err
}

ctx.Export("vpc", exportTags(vpc.Tags))
ctx.Export("vpc-id", vpc.ID())
ctx.Export("bucket", exportTags(bucket.Tags))
ctx.Export("legacy-bucket", exportTags(legacyBucket.Tags))
ctx.Export("bucket-name", bucket.Bucket)
Expand Down

0 comments on commit 2e71692

Please sign in to comment.