test(cubemaster): add race and docker-backed test gates, de-flake unit tests - #1491
test(cubemaster): add race and docker-backed test gates, de-flake unit tests#1491fslongjin wants to merge 1 commit into
Conversation
…t tests - CI: expand CubeMaster test matrix with Race and Docker jobs, introducing root_make / cubemaster_builder / cubemaster_host run modes - Makefile: add test-race and test-docker targets; test-docker fails fast when no Docker daemon is reachable - queueworker, recov: replace time.Sleep polling with channel-based synchronization in tests to remove flakes - tests/unittest: gate the new race sweep and docker-backed db tests Signed-off-by: jinlong <jinlong@tencent.com>
| @command -v docker >/dev/null 2>&1 || { echo "error: docker is not installed"; exit 1; } | ||
| @docker info >/dev/null 2>&1 || { echo "error: docker daemon is not reachable"; exit 1; } | ||
| $(Q)CI=true CUBEMASTER_REQUIRE_DOCKER_TESTS=1 go test -v -count=1 \ | ||
| -gcflags=all=-l -timeout=20m -run '$(DOCKER_TEST_PATTERN)' \ |
There was a problem hiding this comment.
The Docker gate can silently pass with zero tests executed. go test -run exits 0 with "no tests to run" when the regex matches nothing, so if any of the six hardcoded test names is renamed/split or this regex drifts, the gate goes green without exercising anything — defeating the purpose of a hard docker-backed gate. Consider asserting the expected tests actually ran (e.g. fail when a package reports zero matching tests, or parse go test -v/-json output for each expected test name).
| $(call msg,Run race-enabled unit tests) | ||
| $(Q)go clean -testcache | ||
| @( for pkg in ${COVERAGE_PACKAGES}; do \ | ||
| CI=true CGO_ENABLED=1 go test -short -v -race -count=1 \ |
There was a problem hiding this comment.
This race sweep covers ./pkg/templatecenter, whose gomonkey-based tests the existing test target already documents as needing -gcflags=all=-l because "a stub intermittently fails to take effect." gomonkey patches a function's entry instructions; the race detector instruments function prologues with tsan calls, changing the instruction layout gomonkey rewrites. This combination is a known source of intermittent "stub did not take effect" failures — worth validating this gate is stable across several CI runs before relying on it. If it flakes, scoping -race to packages that don't use gomonkey would reduce noise.
Review: test(cubemaster) — add race and docker-backed test gates, de-flake unit testsAI-generated review of PR #1491 (base branch What the PR does
What's good
Findings1. [Medium] The Docker gate can silently pass with zero tests executed. 2. [Medium] 3. [Low] CI cost roughly triples for CubeMaster. 4. [Low] Latent footgun: Notes
|
Summary
Add race and Docker-backed test gates for CubeMaster unit tests, and replace
time.Sleeppolling with channel-based synchronization to remove flakiness.root_make,cubemaster_builder, andcubemaster_hosttest-raceandtest-dockertargets;test-dockerfails fast when the Docker daemon is unreachable instead of skippingtime.Sleeppolling with channel-based synchronization to avoid intermittent failuresTesting
-race -count=1)-shortsuite is unaffected