-
Notifications
You must be signed in to change notification settings - Fork 343
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
Unity integration testing and remove Travis #949
Unity integration testing and remove Travis #949
Conversation
Green right now and shaved 1-2m off the execution time but it has a bug regarding the artifact uploading. Will figure it out this morning and should be ready to merge. |
|
func getNamespace(t *testing.T) (string, func()) { | ||
ns := "sonobuoy-" + strings.ToLower(t.Name()) | ||
return ns, func() { cleanup(t, ns) } | ||
} |
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.
Expanded the helper; cleanup was being used throughout but the boilerplate for each test was a bit verbose. This simplifies the calls.
|
||
// mustRunSonobuoyCommandWithContext runs the Sonobuoy CLI with the given context and arguments. | ||
// It returns stdout and fails the test immediately if there are any errors. | ||
func mustRunSonobuoyCommandWithContext(ctx context.Context, t *testing.T, args string) bytes.Buffer { |
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.
Helper added since we already were repeatedly calling sonobuoy functions and erroring/logging on failure. This just makes the tests easier to read/write if we want to just be able to code along the happy path.
Unhappy path testing is still supported via the original methods.
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! 🎉
@@ -36,6 +36,9 @@ jobs: | |||
curl -L https://github.com/kubernetes-sigs/kind/releases/download/v0.5.1/kind-linux-amd64 --output kind | |||
chmod +x ./kind | |||
sudo mv ./kind /usr/local/bin | |||
curl -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 --output jq | |||
chmod +x ./jq | |||
sudo mv ./jq /usr/local/bin | |||
- run: |
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.
If you wanted, this step could be removed as we can create the cluster within the integration test script. Not necessary though, just an idea.
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'd rather create it sooner and leave it as is for now. We can see if it doesnt work well that way.
The proximity of this comment to the jq
lines made me realize I wasn't using jq
yet though. I do think having that tool will make some future tests easier so I'm inclined to just leave it for now so we dont have to re-add those later.
- Removes travis scripts - Uses a single kind cluster - Removes the integration test that originally existed, running just a quick mode run - Adds the functionality from the above test into an integration test - Changes the integration suite to use the 'kind' cluster - Modifies/adds various test methods to run commands with less boilerplate code - Adds a test method to move artifacts to a desired location for saving in CircleCI Signed-off-by: John Schnake <jschnake@vmware.com>
Waiting to go green again then we'll commit this and update circleci to be the default/required checks and disable travis. |
What this PR does / why we need it:
just a quick mode run
test
boilerplate code
saving in CircleCI
Which issue(s) this PR fixes
Ref #926
Special notes for your reviewer:
Release note: