Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access Log Policy Test Cleanup Robustness #581

Merged
merged 1 commit into from
Jan 8, 2024
Merged

Conversation

xWink
Copy link
Member

@xWink xWink commented Jan 4, 2024

What type of PR is this?

cleanup

Which issue does this PR fix:
N/A

What does this PR do / Why do we need it:

  • Removes requirement for Cluster VPC Association to Gateway Service Network to be tagged with "ManagedBy"
    • Controller no longer manages this association, so the tag should not be expected to be there
  • Changes the logic of resource naming in Access Log Policy e2e tests such that all AWS resources are created with a partially pseudo-random name
    • Prevents previously leaked resources from interfering with new test runs due to name conflicts
  • Changes the logic of Access Log Policy e2e tests to tag all AWS resources with TestSuite=access-log-policy and then to clean up all AWS resources with that tag in the AfterAll block
    • Subsequent test runs can clean up resources missed in previously interrupted runs
  • Adds new parameter to TestFramework.NewTestTags function to accept the test suite name
    • Allows for individual test suites to manage their own resource cleanup without interfering with each other when running in parallel
    • Makes it clear which test created a specific resource (e.g. in the event of a bug causing leaks)

If an issue # is not available please add repro steps and logs from aws-gateway-controller showing the issue:
N/A

Testing done on this change:

Ran 13 of 61 Specs in 545.028 seconds
SUCCESS! -- 13 Passed | 0 Failed | 0 Pending | 48 Skipped
--- PASS: TestIntegration (545.03s)
PASS
ok      github.com/aws/aws-application-networking-k8s/test/suites/integration   545.761s

Automation added to e2e:

Improved test cleanup.

Will this PR introduce any new dependencies?:

No.

Will this break upgrades or downgrades. Has updating a running cluster been tested?:
No.

Does this PR introduce any user-facing change?:

No.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…e tag, which is used for cleanup. Also removed requirement for Cluster VPC Association to be tagged with ManagedBy
@xWink xWink changed the title Access Log Policy Test Cleanup Robustness + General Test Improvements Access Log Policy Test Cleanup Robustness Jan 4, 2024

// Tag S3 Bucket
tagging := &s3.Tagging{
TagSet: make([]*s3.Tag, 0),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: redundant statement, you can append to "nil" list

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oddly, I was getting NPE panic until I fixed this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting, works here https://go.dev/play/p/0HsPyjkjI7X

Comment on lines +107 to +110
tagging.TagSet = append(tagging.TagSet, &s3.Tag{
Key: aws.String(key),
Value: value,
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aws sdk is annoying with it's duplicated Tag types...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A universal tag type would be great

@xWink xWink merged commit bcf7185 into aws:main Jan 8, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants