Skip to content

CLOUDP-332943: Refactor unit test execution #288

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

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

Conversation

lsierant
Copy link
Contributor

@lsierant lsierant commented Jul 23, 2025

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

  • There is only one, unified go.mod in the repo now, so running 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] Move kubectl-mongodb plugin to cmd dir for atomic releases #271.
  • All community e2e tests were marked with community_e2e tag, so we don't need to run tests with a filtered package list anymore.
  • gotestsum test runner is used to execute unit tests giving more readable output
  • gotestsum has been added as a tool in go.mod by running go get -tool gotest.tools/gotestsum@latest.
    • While using go.mod's tool directive allows for easy tool access (by go tool <tool>) and is not resulting in adding dependencies into the operators binary, it is still cluttering dependency list (in require section). We might consider removing it from go mod and installing it as a separate step.
  • All test (python and golang) are reporting results as xml and are all gathered by evg. Test output is gathered in the teardown_task section now.
  • Enabled back golang race tests - those were mistakenly disabled during operator merge to MCK (diff unit-tests.sh)

How to run tests now

Essentially as before:

$ make golang-tests

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:

  1. Use gotestsum
$ go tool gotestsum
  1. Use plain go test
$ go test ./...
  1. Use other test runner/viewers. I recommend to look into gotestsum options.

  2. Also there is tparse which also has very nice summary table:

go get -tool github.com/mfridman/tparse@latest
go test -v ./... -json | go tool tparse

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

@lsierant lsierant self-assigned this Jul 23, 2025
@lsierant lsierant changed the title tparse Refactor unit test execution Jul 23, 2025
@lsierant lsierant changed the title Refactor unit test execution CLOUDP-332943: Refactor unit test execution Jul 23, 2025
@lsierant lsierant force-pushed the lsierant/unit-test-parse branch 2 times, most recently from e5bce4d to f3cd1b8 Compare July 24, 2025 12:13
@lsierant lsierant force-pushed the lsierant/unit-test-parse branch from f3cd1b8 to 80c4de1 Compare July 29, 2025 11:38
Copy link

⚠️ (this preview might not be accurate if the PR is not rebased on current master branch)

MCK 1.2.1 Release Notes

Other Changes

  • Optional permissions for PersistentVolumeClaim moved to a separate role. When managing the operator with Helm it is possible to disable permissions for PersistentVolumeClaim resources by setting operator.enablePVCResize value to false (true by default). When enabled, previously these permissions were part of the primary operator role. With this change, permissions have a separate role.
  • subresourceEnabled Helm value was removed. This setting used to be true by default and made it possible to exclude subresource permissions from the operator role by specifying false as the value. We are removing this configuration option, making the operator roles always have subresource permissions. This setting was introduced as a temporary solution for this OpenShift issue. The issue has since been resolved and the setting is no longer needed.

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.

1 participant