Skip to content

Fix unparallel tests packages list in Makefile #39250

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

Conversation

pippolo84
Copy link
Member

@pippolo84 pippolo84 commented Apr 30, 2025

pkg/datapath/linux/node_linux_test.go has been tagged as unparallel in #38172. Therefore, we need to update the packages list for the unparallel tests in the Makefile, otherwise the tests-privileged target will skip the whole file:

TESTPKGS ?= ./...
UNPARALLELTESTPKGS ?= ./pkg/datapath/linux/ipsec/...

...

tests-privileged: ## Run Go tests including ones that require elevated privileges.
	@$(ECHO_CHECK) running privileged tests...
	## We split tests into two parts: one that can be run in parallel
	## and tests that cannot be run in parallel with other packages
	## One drawback of this approach is that
	## if first set of tests fails, second one is not run
	{ PRIVILEGED_TESTS=true PATH=$(PATH):$(ROOT_DIR)/bpf $(GO_TEST) $(TEST_LDFLAGS) \
		$(TESTPKGS) $(GOTEST_BASE) $(GOTEST_COVER_OPTS) \
	&& PRIVILEGED_TESTS=true PATH=$(PATH):$(ROOT_DIR)/bpf $(GO_TEST) $(TEST_LDFLAGS) \
		$(UNPARALLELTESTPKGS) $(GOTEST_BASE) -json -covermode=count -coverprofile=coverage2.out -p 1 --tags=unparallel; } | $(GOTEST_FORMATTER)
	tail -n+2 coverage2.out >> coverage.out
	rm coverage2.out
	$(MAKE) generate-cov

To fix this, the UNPARALLELTESTPKGS variable is updated to include the whole pkg/datapath/linux package instead of the sole ipsec subpackage.

See this run of ci-runtime against the main branch to verify that privileged tests in node_linux_test.go are not executed at all.
After this change, ci-runtime is correctly picking up the priviliged tests in node_linux_test.go again, see this run.

Also, the TestBackendNeighborSync test is updated to filter out goroutines leaked in previous tests, in order to avoid unrelated failures.

Related: #38172

Waiting for #39272 to be merged first, in order to fix the linux node tests that are currently broken.

@pippolo84 pippolo84 added area/CI Continuous Integration testing issue or flake release-note/ci This PR makes changes to the CI. labels Apr 30, 2025
@pippolo84
Copy link
Member Author

/ci-runtime

@pippolo84 pippolo84 force-pushed the pr/pippolo84/fix-unparallel-tests-trigger branch from 7a65beb to ac2dde5 Compare April 30, 2025 15:51
@pippolo84
Copy link
Member Author

/ci-runtime

@pippolo84 pippolo84 force-pushed the pr/pippolo84/fix-unparallel-tests-trigger branch from ac2dde5 to fa06f40 Compare April 30, 2025 17:54
@pippolo84
Copy link
Member Author

/ci-runtime

@pippolo84 pippolo84 force-pushed the pr/pippolo84/fix-unparallel-tests-trigger branch from fa06f40 to c12053b Compare April 30, 2025 22:25
@pippolo84 pippolo84 added kind/bug/CI This is a bug in the testing code. dont-merge/blocked Another PR must be merged before this one. labels Apr 30, 2025
pippolo84 added 2 commits May 5, 2025 15:48
Filter out goroutines leaked by previous tests in
TestBackendNeighborSync.

Specifically, this is needed to avoid failures when this test is run
after the linuxNodeHandler.registerIpsecMetricOnce is called in all the
other node tests that run with EnableIPSec set to true.

Here is an example of such a failure:

    backend_neighbors_test.go:51: found unexpected goroutines:
        [Goroutine 265 in state sync.Cond.Wait, 1 minutes, with sync.runtime_notifyListWait on top of the stack:
        sync.runtime_notifyListWait(0xc000249990, 0x22)
        	/root/sdk/go1.24.2/src/runtime/sema.go:597 +0x159
        sync.(*Cond).Wait(0x3edc768?)
        	/root/sdk/go1.24.2/src/sync/cond.go:71 +0x85
        github.com/cilium/cilium/pkg/promise.(*promise[...]).Await(0x3eb1e80, {0x3edc768, 0x68c3760})
        	/host/pkg/promise/promise.go:106 +0x12b
        github.com/cilium/cilium/pkg/metrics.withRegistry.func1()
        	/host/pkg/metrics/metrics.go:1594 +0x39
        created by github.com/cilium/cilium/pkg/metrics.withRegistry in goroutine 294
        	/host/pkg/metrics/metrics.go:1593 +0x9f
	...
        ]

Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
Since node_linux_test.go in pkg/datapath/linux is now tagged as
unparallel, we need to update the packages considered for unparallel
tests in the Makefile, otherwise ci-conformance-runtime does not run the
linux node tests.

Fixes: 91df013 ("pkg: Mark node_linux_test.go as unparallel")

Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
@pippolo84 pippolo84 force-pushed the pr/pippolo84/fix-unparallel-tests-trigger branch from c12053b to 82a772d Compare May 5, 2025 13:48
@pippolo84 pippolo84 marked this pull request as ready for review May 5, 2025 13:48
@pippolo84 pippolo84 requested review from a team as code owners May 5, 2025 13:48
@pippolo84 pippolo84 requested a review from gentoo-root May 5, 2025 13:48
@pippolo84 pippolo84 removed the dont-merge/blocked Another PR must be merged before this one. label May 5, 2025
@pippolo84
Copy link
Member Author

/test

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label May 5, 2025
@julianwiedmann julianwiedmann added this pull request to the merge queue May 6, 2025
Merged via the queue into cilium:main with commit 3f016ba May 6, 2025
72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/CI Continuous Integration testing issue or flake kind/bug/CI This is a bug in the testing code. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/ci This PR makes changes to the CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants