CLOUDP-332943: Refactor unit test execution #288
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR simplifies unit tests execution to allow a simple
go test ./...
to always correctly execute all golang unit tests without running community e2e tests.Changes
go test ./...
correctly identifies all go files. The last one from init-ops-manager was removed in this PR, and another one from kubectl plugin was removed recently in [CLOUDP-332196] Movekubectl-mongodb
plugin tocmd
dir for atomic releases #271.community_e2e
tag, so we don't need to run tests with a filtered package list anymore.go get -tool gotest.tools/gotestsum@latest
.go tool <tool>
) and is not resulting in adding dependencies into the operators binary, it is still cluttering dependency list (inrequire
section). We might consider removing it from go mod and installing it as a separate step.How to run tests now
Essentially as before:
Which is executing gotestsum as:
go tool gotestsum --junitfile golang-unit-result.xml --format-icons hivis -- -v ${USE_RACE_SWITCH} -coverprofile cover.out ./...
But thanks to the simplifications you can use whatever suits you:
$ go test ./...
Use other test runner/viewers. I recommend to look into gotestsum options.
Also there is
tparse
which also has very nice summary table:tparse is not supporting xunit output thus it's not used here as a default.
Proof of Work
Golang unit tests with remove locks to trigger race test error: link
Python unit test with injected error: evg link
Passing tests: evg link