-
Notifications
You must be signed in to change notification settings - Fork 67
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
Ensure resource cleanup and add integration test for invalid credentials #449
Conversation
@EmoinLanyu Thank you for your contribution. |
@EmoinLanyu You need rebase this pull request with latest master branch. Please check. |
/test |
Testrun: e2e-wqmgf +---------------------+---------------------+--------+----------+ | NAME | STEP | PHASE | DURATION | +---------------------+---------------------+--------+----------+ | infrastructure-test | infrastructure-test | Failed | 3m59s | +---------------------+---------------------+--------+----------+ |
332f7f5
to
dc57060
Compare
/test |
Testrun: e2e-vbx4p +---------------------+---------------------+--------+----------+ | NAME | STEP | PHASE | DURATION | +---------------------+---------------------+--------+----------+ | infrastructure-test | infrastructure-test | Failed | 11m45s | +---------------------+---------------------+--------+----------+ |
/test |
Testrun: e2e-v7d7j +---------------------+---------------------+-----------+----------+ | NAME | STEP | PHASE | DURATION | +---------------------+---------------------+-----------+----------+ | infrastructure-test | infrastructure-test | Succeeded | 11m37s | +---------------------+---------------------+-----------+----------+ |
please run |
/squash |
/test |
Testrun: e2e-tjcsh +---------------------+---------------------+-----------+----------+ | NAME | STEP | PHASE | DURATION | +---------------------+---------------------+-----------+----------+ | infrastructure-test | infrastructure-test | Succeeded | 11m55s | +---------------------+---------------------+-----------+----------+ |
@@ -127,17 +131,15 @@ var _ = AfterSuite(func() { | |||
mgrCancel() | |||
}() | |||
|
|||
By("running cleanup actions") | |||
framework.RunCleanupActions() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it mean all namespaces generated during testing are only be cleaned at the end of testing? Is it expected behavior?
@@ -535,6 +624,7 @@ func prepareVPC(ctx context.Context, clientFactory alicloudclient.ClientFactory, | |||
vpcClient, err := clientFactory.NewVPCClient(region, *accessKeyID, *accessKeySecret) | |||
Expect(err).NotTo(HaveOccurred()) | |||
createVpcReq := vpc.CreateCreateVpcRequest() | |||
createVpcReq.VpcName = "provider-alicloud-infra-test" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what will happen if there are several testing running in parallel? will this name cause any conflict?
No it won't. VPC name is not required to be unique. So there is no problem here. |
Yes the clean up actions are carried out at the end of the testing. The clean up actions will still be done should any tests fail. |
How to categorize this PR?
/area usability
/kind test
/platform alicloud
What this PR does / why we need it:
This PR tests gardener/terraformer#93 and gardener/gardener#3950 by adding an integration test case for invalid credentials.
It creates an infrastructure resource but uses invalid credentials and ensures that the ERR_INFRA_UNAUTHENTICATED is correctly detected from the termination message and that the infrastructure can still be deleted afterwards (as it's a no-op).
Before this PR, the destroy logic and testing was executed as part of a cleanup action, while the destroy logic should be part of the actual test and not just cleanup. Also, this could lead to resource leakage on AliCloud and on the test-machinery cluster, because if one cleanup action fails (e.g. the destroy logic) no further cleanup actions are executed.
Now, the destroy logic is executed as a deferred function to ensure that the cleanup actions are still run, even if the test itself fails.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Ref:
Release note: