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

Improved assertions & resource clean-up for E2E tests #311

Merged
merged 3 commits into from
Aug 4, 2023

Conversation

rlymbur
Copy link
Contributor

@rlymbur rlymbur commented Aug 4, 2023

What type of PR is this?
Bug

Which issue does this PR fix:
This addresses E2E reliability by improving assertions and clean-up of resources that may leak during E2E test executions. It also addresses Amazon VPC Lattice throttling exceptions by introducing a retry strategy for the VPC Lattice client.

What does this PR do / Why do we need it:
This improves the reliability of existing E2E tests.

Testing done on this change:

FOCUS="" make e2etest

...

------------------------------

Ran 11 of 11 Specs in 4656.643 seconds
SUCCESS! -- 11 Passed | 0 Failed | 0 Pending | 0 Skipped
--- PASS: TestIntegration (4656.81s)
PASS

Automation added to e2e:
N/A

Will this PR introduce any new dependencies?:
No.

Will this break upgrades or downgrades. Has updating a running cluster been tested?:
This will not break upgrades or downgrades. These changes were tested on the latest v0.0.15 release.

Does this PR introduce any user-facing change?:
No.

This addresses E2E reliability by improving assertions, adding a VPC Lattice client retry strategy, and enhanced clean-up of resources that may leak during E2E test executions.

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

retrievedTargets, err := testFramework.LatticeClient.ListTargetsAsList(ctx, &vpclattice.ListTargetsInput{
TargetGroupIdentifier: targetGroup.Id,
})
Expect(err).ToNot(HaveOccurred())
Copy link
Contributor

Choose a reason for hiding this comment

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

We could actually remove the whole:

testFramework.ExpectDeleted(ctx, service)
		Eventually(func(g Gomega) {
			log.Println("Verifying Targets are only craeted for the port defined in Port Annotaion in ServiceExport")
			targets := testFramework.GetTargets(ctx, targetGroup, deployment)
			Expect(len(targets) == 0)
		}).WithTimeout(5*time.Minute + 30*time.Second)

This test case intend to test "Verifying Targets are only created for the port defined in Port Annotation in ServiceExport", and the delete k8sService and verify 0 targets don't need to be part of this test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, I have removed it now

Logger(ctx).Infof("Target group %s no longer has targets registered. Deleting now.", *tgId)
Eventually(func() bool {
_, err := env.LatticeClient.DeleteTargetGroup(&vpclattice.DeleteTargetGroupInput{
TargetGroupIdentifier: tgId,
Copy link
Contributor

Choose a reason for hiding this comment

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

This part looks good

Copy link
Contributor

@zijun726911 zijun726911 left a comment

Choose a reason for hiding this comment

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

LGTM

@coveralls
Copy link

coveralls commented Aug 4, 2023

Pull Request Test Coverage Report for Build 5764738532

  • 0 of 1 (0.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 33.212%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/aws/services/vpclattice.go 0 1 0.0%
Totals Coverage Status
Change from base Build 5741968604: 0.0%
Covered Lines: 3472
Relevant Lines: 10454

💛 - Coveralls

@zijun726911 zijun726911 merged commit 3927a6e into aws:main Aug 4, 2023
@@ -35,7 +34,7 @@ func NewDefaultLattice(sess *session.Session, region string) *defaultLattice {
endpoint = latticeEndpoint
}

latticeSess = vpclattice.New(sess, aws.NewConfig().WithRegion(region).WithEndpoint(endpoint))
latticeSess = vpclattice.New(sess, aws.NewConfig().WithRegion(region).WithEndpoint(endpoint).WithMaxRetries(20))
Copy link
Contributor

Choose a reason for hiding this comment

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

why 20 retries?

Copy link
Contributor

Choose a reason for hiding this comment

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

VPC lattice cp api have pretty low per account throttling setting, controller and e2etest code can quite easily get "Too Many Request" error if we use default max retry

Copy link
Contributor

Choose a reason for hiding this comment

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

are these retries with exponential backoff? or whats the retry strategy?

@mikhail-aws
Copy link
Contributor

overall looks good

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.

4 participants