-
Notifications
You must be signed in to change notification settings - Fork 25
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
allow tests to run back to back #372
Conversation
Codecov Report
@@ Coverage Diff @@
## main #372 +/- ##
==========================================
+ Coverage 83.04% 83.23% +0.19%
==========================================
Files 27 27
Lines 1032 1032
==========================================
+ Hits 857 859 +2
+ Misses 147 146 -1
+ Partials 28 27 -1
Continue to review full report at Codecov.
|
QQ: shouldn't we actually do cleanup after test, eg delete deployments, instead of manually resetting state? |
hi @embano1 , are you suggesting that the As far as I can tell, the vcsim deployment isn't applied as part of the test. You have to deploy it manually before running the e2e, and therefore, delete it manually too if you want to rerun |
Well, IMHO that would fix your problem and avoid sharing state between runs.
True, this repo still sets it up outside of the Go test framework. Two solutions:
|
okay great, that sounds good then.
|
* it seems like when running the test, the events are being sent to vcsim before the vsphere source is ready. This means the source misses the events, and the test fails * apparently, there is a default checkpoint window of 5 mins. However, that doesn't seem to be applying. This may need separate investigation * creating a checkpoint configmap ourselves allows us to guarantee the source will ask vcsim for events from the past N minutes
d520e6a
to
a5461c7
Compare
* when the tests run, there are two lefover pods for the listener job and the govc job. * this commit cleans those up, so upon finishing the test, all resources are cleaned up from the cluster
* now that e2e tests create and manage vcsim and secret, setup doesn't need to do 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.
While reviewing this PR I saw that RunJobListener()
calls pkgtest.CleanupOnInterrupt
twice in the function. IMHO this is a bug if you look at how pkgtest.CleanupOnInterrupt
works internally. Can you PTAL?
And in general I think the way we use pkgtest.CleanupOnInterrupt
across the tests might not achieve the goal since multiple goroutines are registered, blocking for a signal
and then racing to call os.Exit(1)
Spec: corev1.PodSpec{ | ||
Containers: []corev1.Container{{ | ||
Name: vcsim, | ||
Image: "vmware/vcsim:latest", |
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.
non-blocking: if we see docker.io
429
s we can always fall back to using ko:
to build vcsim
since it's already a vendored dependency.
@embano1 I addressed the nits, hopefully to what you were expecting :) Also, with regard to this comment...
The way I'm reading it, it seems like calling it multiple times is okay. It looks like Initially I got hung up on the I tested it out here: https://gist.github.com/KauzClay/abf3fe664e6867bca90dc16c8a11f594
|
4b5d52d
to
5d77413
Compare
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.
LGTM, thx mate!
And regarding CleanupOnInterrupt: I don't know which code I looked at when I wrote this. Just checked src again and it definitely does not call exit more than once. All good 👍
Let me know if this is ready to review al lgtm :) |
* add helper for creating vcsim * create vcsim in source test * manually create checkpoint * it seems like when running the test, the events are being sent to vcsim before the vsphere source is ready. This means the source misses the events, and the test fails * apparently, there is a default checkpoint window of 5 mins. However, that doesn't seem to be applying. This may need separate investigation * creating a checkpoint configmap ourselves allows us to guarantee the source will ask vcsim for events from the past N minutes * remove dead code * create vcsim in all tests * clean up job pods * when the tests run, there are two lefover pods for the listener job and the govc job. * this commit cleans those up, so upon finishing the test, all resources are cleaned up from the cluster * run update-codegen.sh * update git workflow * now that e2e tests create and manage vcsim and secret, setup doesn't need to do it * refactor: address nits * refactor: make context a variable
* add helper for creating vcsim * create vcsim in source test * manually create checkpoint * it seems like when running the test, the events are being sent to vcsim before the vsphere source is ready. This means the source misses the events, and the test fails * apparently, there is a default checkpoint window of 5 mins. However, that doesn't seem to be applying. This may need separate investigation * creating a checkpoint configmap ourselves allows us to guarantee the source will ask vcsim for events from the past N minutes * remove dead code * create vcsim in all tests * clean up job pods * when the tests run, there are two lefover pods for the listener job and the govc job. * this commit cleans those up, so upon finishing the test, all resources are cleaned up from the cluster * run update-codegen.sh * update git workflow * now that e2e tests create and manage vcsim and secret, setup doesn't need to do it * refactor: address nits * refactor: make context a variable
Fixes #371
I would like to be able to run the e2e tests multiple times without cleaning everything up. Particularly, I don't want to have to recreate the vcsim.
From what I have seen, vcsim will remember the state of things. So if in the source test, we power off two vms, when we run again and try to power off those same vms, nothing will happen. No events will be sent, and the test will fail.
Same thing happens for the TestBindingGOVC. The tag and category will already exist, so those commands won't prompt any new events.
Proposed Changes
Pre-review Checklist
Release Note