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

Unity integration testing and remove Travis #949

Merged
merged 1 commit into from
Oct 10, 2019
Merged

Unity integration testing and remove Travis #949

merged 1 commit into from
Oct 10, 2019

Conversation

johnSchnake
Copy link
Contributor

What this PR does / why we need it:

  • 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

Which issue(s) this PR fixes
Ref #926

Special notes for your reviewer:

Release note:

NONE

@johnSchnake
Copy link
Contributor Author

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.

@johnSchnake
Copy link
Contributor Author

invalid cross-device link when trying to move the tarball via golang. I'll probably just have to shell out and call mv which is what it was doing before.

go.sum Outdated Show resolved Hide resolved
func getNamespace(t *testing.T) (string, func()) {
ns := "sonobuoy-" + strings.ToLower(t.Name())
return ns, func() { cleanup(t, ns) }
}
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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.

@johnSchnake johnSchnake marked this pull request as ready for review October 10, 2019 15:44
Copy link
Contributor

@zubron zubron left a 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:
Copy link
Contributor

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.

Copy link
Contributor Author

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.

test/integration/sonobuoy_integration_test.go Outdated Show resolved Hide resolved
test/integration/sonobuoy_integration_test.go Outdated Show resolved Hide resolved
test/integration/sonobuoy_integration_test.go Outdated Show resolved Hide resolved
test/integration/sonobuoy_integration_test.go Outdated Show resolved Hide resolved
 - 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>
@johnSchnake
Copy link
Contributor Author

Waiting to go green again then we'll commit this and update circleci to be the default/required checks and disable travis.

@johnSchnake johnSchnake merged commit a673ac1 into vmware-tanzu:master Oct 10, 2019
@johnSchnake johnSchnake deleted the singleIntegrationSuite branch October 10, 2019 17:24
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.

2 participants