Skip to content

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 3 times, most recently from f3cd1b8 to 80c4de1 Compare July 29, 2025 11:38
Copy link

github-actions bot commented Jul 29, 2025

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

MCK 1.3.0 Release Notes

Bug Fixes

  • This change fixes the current complex and difficult-to-maintain architecture for stateful set containers, which relies on an "agent matrix" to map operator and agent versions which led to a sheer amount of images.
  • We solve this by shifting to a 3-container setup. This new design eliminates the need for the operator-version/agent-version matrix by adding one additional container containing all required binaries. This architecture maps to what we already do with the mongodb-database container.
  • Fixed an issue where the readiness probe reported the node as ready even when its authentication mechanism was not in sync with the other nodes, potentially causing premature restarts.

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.
  • We have deliberately not published the container images for OpsManager versions 7.0.16, 8.0.8, 8.0.9 and 8.0.10 due to a bug in the OpsManager which prevents MCK customers to upgrade their OpsManager deployments to those versions.

@lsierant lsierant force-pushed the lsierant/unit-test-parse branch from d3f907a to f4e132b Compare August 23, 2025 21:20
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