-
Notifications
You must be signed in to change notification settings - Fork 46
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
Cleantool #234
Cleantool #234
Conversation
Move the flags out of the test file to the e2e package, and export flag variables and parseFlagsOrDie.
Relocate and export FallbackCleanup function.
90ad9d2
to
decefc6
Compare
friendly ping @bowei @kl52752 @AwesomePatrol |
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.
Thanks for adding a simple way to clean up any leftover resources. I run it myself and it works flawlessly.
Aside from theCloud
->TheCloud
change, LGTM
cmd/e2e-cleaner/main.go
Outdated
} | ||
|
||
func eMain() error { | ||
//klog.InitFlags(nil) |
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.
nit: this comment is not needed
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.
removed
cmd/e2e-cleaner/main.go
Outdated
} | ||
|
||
func main() { | ||
if err := eMain(); err != nil { |
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.
eMain
doesn't seem to remove any errors. Please consider consolidating the two
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.
combined with eMain
e2e/testmain_test.go
Outdated
"google.golang.org/api/googleapi" | ||
"google.golang.org/api/impersonate" | ||
"google.golang.org/api/option" | ||
) | ||
|
||
var ( | ||
// theCloud is a global to be used in the e2e tests. | ||
theCloud cloud.Cloud |
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.
nit: it seems it is unused
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.
I'm unsure what action this is suggesting
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.
as you reverted from TheCloud
to theCloud
now there is a duplicate declaration of global variable with this name. Declaration here can be removed
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.
Thanks for calling this out, it's been a while, and I forgot that go build
doesn't build tests for some reason =/
e2e/cleanup.go
Outdated
log.Printf("FallbackCleanup: TheCloud.TcpRoutes().List(ctx, _): %v\n", err) | ||
return | ||
} | ||
log.Printf("Listed %d tcproutes", len(tcprs)) |
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.
nit: this looks like a debug log I think we can get rid of it
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.
removed
e2e/addresses_test.go
Outdated
@@ -42,16 +42,16 @@ func TestAddresses(t *testing.T) { | |||
|
|||
t.Logf("addr1 = %s", fmt.Sprint(addr1)) | |||
|
|||
t.Cleanup(func() { theCloud.Addresses().Delete(context.Background(), addr1Key) }) | |||
t.Cleanup(func() { TheCloud.Addresses().Delete(context.Background(), addr1Key) }) |
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.
Please consider not changing the variable name. It doesn't seem needed (I run sed
and the code still worked). It would make PR diff much smaller
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.
reverted to theCloud
decefc6
to
ef9bbae
Compare
/lgtm |
* Fix a bug in resource cleanup where tcproutes and meshes were not being cleaned up due to sending invalid URL. * Adjust cleanup matching to clean resources from all tests when RunID is empty.
ef9bbae
to
8aadc2d
Compare
/lgtm |
/approve |
da81e2a
into
GoogleCloudPlatform:master
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AwesomePatrol, bowei, briantkennedy, kl52752 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Adds a tool to help manually clean up orphaned test resources.
Fixes #232