Skip to content

running normal go test without verbose, only log if failing #286

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nammn
Copy link
Collaborator

@nammn nammn commented Jul 22, 2025

Summary

This pull request includes a minor update to the scripts/evergreen/unit-tests.sh file. The change removes the verbose (-v) flag from the go test command, simplifying the test output.

  • scripts/evergreen/unit-tests.sh: Removed the -v flag from the go test command in both race-enabled and non-race-enabled test configurations.
  • this should elevate output in logs and only log on failure cases

Proof of Work

  • passing ci
  • local run without -v and -race
make test
go fmt ./...
go vet ./...
scripts/evergreen/unit-tests.sh
/Users/nam.nguyen/projects/mongodb-kubernetes/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
running go test   -coverprofile cover.out $(go list ./... | grep -v "mongodb-community-operator/test/e2e")
        github.com/mongodb/mongodb-kubernetes           coverage: 0.0% of statements
        github.com/mongodb/mongodb-kubernetes/api/v1            coverage: 0.0% of statements
# copy the CRDs to the public folder
cp config/crd/bases/* helm_chart/crds/
cat "helm_chart/crds/"* > public/crds.yaml
ok      github.com/mongodb/mongodb-kubernetes/api/v1/mdb        0.795s  coverage: 42.4% of statements
ok      github.com/mongodb/mongodb-kubernetes/api/v1/mdbmulti   1.472s  coverage: 22.1% of statements
ok      github.com/mongodb/mongodb-kubernetes/api/v1/om 1.839s  coverage: 30.6% of statements
        github.com/mongodb/mongodb-kubernetes/api/v1/role               coverage: 0.0% of statements
  • the one used by ci:
(venv) ~/projects/mongodb-kubernetes git:[refactor-unit-test-logging-2]
make golang-tests-race
VERBOSE=true USE_RACE=true scripts/evergreen/unit-tests.sh
testing .
running go test -v -race -coverprofile cover.out $(go list ./... | grep -v "mongodb-community-operator/test/e2e")
  • example failure output
[2025/07/23 17:34:26.110] ok  	github.com/mongodb/mongodb-kubernetes/pkg/util/versionutil	0.004s	coverage: 29.7% of statements
[2025/07/23 17:34:26.110] 	github.com/mongodb/mongodb-kubernetes/pkg/vault		coverage: 0.0% of statements
[2025/07/23 17:34:26.110] 	github.com/mongodb/mongodb-kubernetes/pkg/vault/vaultwatcher		coverage: 0.0% of statements
[2025/07/23 17:34:26.110] 	github.com/mongodb/mongodb-kubernetes/pkg/webhook		coverage: 0.0% of statements
[2025/07/23 17:34:26.376] 	github.com/mongodb/mongodb-kubernetes/scripts/dev		coverage: 0.0% of statements
[2025/07/23 17:34:26.376] FAIL
[2025/07/23 17:34:26.440] =========================================
[2025/07/23 17:34:26.440] TEST SUMMARY
[2025/07/23 17:34:26.440] =========================================
[2025/07/23 17:34:26.481] FAILED TEST MODULES:
[2025/07/23 17:34:26.481]   - .
[2025/07/23 17:34:26.481]     Failed tests:
[2025/07/23 17:34:26.482]       --- FAIL: TestTryConfigureMonitoringInOpsManagerWithCustomTemplate (0.00s)
[2025/07/23 17:34:26.483] Total modules with failures: 1
[2025/07/23 17:34:26.483] =========================================
[2025/07/23 17:34:26.483] Finished command 'shell.exec' in function 'test_golang_unit' (step 1.1 of 1) in 3m37.730328729s.
[2025/07/23 17:34:26.483] Running command 'gotest.parse_files' in function 'test_golang_unit' (step 1.2 of 1).
[2025/07/23 17:34:27.008] Posting test logs...
[2025/07/23 17:34:27.614] Finished posting test logs.
[2025/07/23 17:34:27.614] Attaching test results...
[2025/07/23 17:34:27.973] Successfully attached results.
[2025/07/23 17:34:27.973] Finished command 'gotest.parse_files' in function 'test_golang_unit' (step 1.2 of 1) in 1.490164313s.
[2025/07/23 17:34:27.973] Finished running task commands in 3m39.220724977s.
[2025/07/23 17:34:27.974] Task completed - SUCCESS.
[2025/07/23 17:34:27.999] Test results contain at least one failure. Overall task status changed to FAILED.

Checklist

  • Have you linked a jira ticket and/or is the ticket in the title?
  • Have you checked whether your jira ticket required DOCSP changes?
  • Have you checked for release_note changes?

@nammn nammn requested a review from a team as a code owner July 22, 2025 14:14
@nammn nammn added the skip-changelog Use this label in Pull Request to not require new changelog entry file label Jul 22, 2025
@nammn nammn marked this pull request as draft July 23, 2025 08:08
@nammn nammn marked this pull request as ready for review July 24, 2025 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog Use this label in Pull Request to not require new changelog entry file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants