Skip to content

machine: fix non-deterministic TestTopologyOnSystemZ - #3977

Closed
kcrane wants to merge 1 commit into
google:masterfrom
kcrane:fix-flaky-topology-systemz
Closed

kcrane wants to merge 1 commit into
google:masterfrom
kcrane:fix-flaky-topology-systemz

Conversation

@kcrane

@kcrane kcrane commented Nov 25, 2026

Copy link
Copy Markdown

getCPUTopology appends nodes while ranging over cpusByPhysicalPackageID, so the returned slice is in randomized map order. TestTopologyOnSystemZ indexes topology[0]/topology[1] against fixed expected values without sorting first, and fails whenever the two nodes come back transposed.

TestTopologyWithoutNodes reaches the same fallback via empty nodesPaths and already sorts by Id before asserting. This applies the same guard. (Same symptom as #2557.)

Measured on RHEL 9.8 / s390x, 20 runs of go test -count=1 -run TestTopologyOnSystemZ ./machine/: 17 pass / 3 fail before, 20 pass / 0 fail after.

--- FAIL: TestTopologyOnSystemZ (0.00s)
    topology_test.go:536:
        Error:  Not equal:
        expected: ... "core_id":0, "socket_id":0, "thread_ids":[0, 2], "node_id":0
        actual  : ... "core_id":1, "socket_id":1, "thread_ids":[1, 3], "node_id":1

Full make test passes with this change on RHEL 8.10, 9.6, 9.8, 10.0, 10.2; SLES 15 SP7, 16; Ubuntu 22.04, 24.04.

GetNodesInfo falls back to getCPUTopology when no NUMA node directories are
present, and that function builds its result by ranging over a map, so nodes
are appended in randomized order.

TestTopologyOnSystemZ compares topology[0] and topology[1] against fixed
expected values without ordering the slice first, so it fails intermittently.
TestTopologyWithoutNodes exercises the same fallback and already sorts before
asserting; this applies the same guard.

Measured on RHEL 9.8 / s390x over 20 runs: 17 pass / 3 fail before, 20 pass /
0 fail after.
@google-cla

google-cla Bot commented Nov 25, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@kcrane kcrane closed this Nov 25, 2026
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