refactor: migrate multi_platform_linux_test.go to nerdtest.Setup#4897
refactor: migrate multi_platform_linux_test.go to nerdtest.Setup#4897ogulcanaydogan wants to merge 6 commits into
Conversation
8e7b2bf to
3fed4ad
Compare
| return helpers.Command("push", "--platform=amd64,arm64,linux/arm/v7", imageName) | ||
| } | ||
|
|
||
| testCase.Expected = test.Expects(0, nil, nil) |
There was a problem hiding this comment.
use exit code conatnts from Tigron framework and there are others as well
| var reg *registry.Server | ||
|
|
||
| testCase.Setup = func(data test.Data, helpers test.Helpers) { | ||
| reg = nerdtest.RegistryWithNoAuth(data, helpers, 0, false) |
There was a problem hiding this comment.
better to explain or use a variable for 0 constant for readbility
|
Thanks for the review. Replaced all hardcoded exit code literals in test.Expects() calls with expect.ExitCodeSuccess. |
|
Addressed. Added |
|
https://github.com/containerd/nerdctl/actions/runs/25974269421/job/78060013893?pr=4897 |
|
@AkihiroSuda thanks for the catch. Root cause was Tigron's SubTests path calling subT.Parallel() (mod/tigron/test/case.go:184), which made the docker driver run the three platform invocations concurrently and step on each other. Pushed e10045d: dropped the SubTests map and run assertMultiPlatformRun sequentially from the Setup callback (same pattern for all five testcases in the file). On the new run, in-host / docker < linux skips TestMultiPlatformRun cleanly at the requireMultiPlatformExec gate (binfmt not present in that runner). The three remaining failures in that job (TestImagesFilterDangling, TestRunSeccompCapSysPtrace) don't touch this file. |
|
Still constantly failing Can you try rebasing? |
Replace testutil.NewBase with nerdtest.Setup throughout multi_platform_linux_test.go, following the Tigron framework pattern (containerd#4641). Changes: - Use nerdtest.RegistryWithNoAuth instead of testregistry.NewWithNoAuth - Use data.Temp().Save() for Dockerfiles and compose files - Convert testMultiPlatformRun helper to use test.Helpers - Use SubTests in TestMultiPlatformRun for per-platform isolation - Register builder cache cleanup in Cleanup callbacks - Add requireMultiPlatformExec requirement using platformutil Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@hotmail.com>
nerdtest.RegistryWithNoAuth returns a Server struct with Setup/Cleanup closures but does not start the registry container automatically. Add reg.Setup(data, helpers) in each test's Setup callback to start the registry before pushing, and reg.Cleanup(data, helpers) in the Cleanup callback to remove the container after the test. Affected: TestMultiPlatformBuildPush, TestMultiPlatformBuildPushNoRun, TestMultiPlatformPullPushAllPlatforms. Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@hotmail.com>
…m tests Replace hardcoded 0 literals passed to test.Expects() with expect.ExitCodeSuccess for consistency with the rest of the test suite. Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@hotmail.com>
The third argument 0 means "let the OS pick any available port". Add an inline comment to make this clear at the call sites. Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@hotmail.com>
Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@hotmail.com>
SubTests run via t.Parallel() in Tigron, which caused concurrent docker runs across platforms to fail in the in-host/docker CI job. The original test iterated platforms sequentially; use the existing assertMultiPlatformRun helper inside Setup to preserve that behavior. Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@hotmail.com>
e10045d to
5ee828b
Compare
|
@AkihiroSuda rebased onto latest main. The docker < linux job you linked is green now, so TestImagesFilterDangling and TestRunSeccompCapSysPtrace pass - they were failing on the old base, not from this PR (the diff is a single file, multi_platform_linux_test.go). The 5 red checks are all in other jobs hitting unrelated tests: almalinux-8 rootless and FreeBSD / 14 are the labeled flakes (#3988), rootful canary is TestIPFSAddrWithKubo (IPFS daemon), rootful old-ubuntu is TestUpdateRestartPolicy, and gomodjail failed at the "register QEMU (binfmt)" setup step. None of them touch the file this PR changes. |
| testCase := nerdtest.Setup() | ||
|
|
||
| testCase.Require = require.All( | ||
| require.Not(nerdtest.Docker), |
There was a problem hiding this comment.
Please keep the comment line to explain the reason
| testCase := nerdtest.Setup() | ||
|
|
||
| testCase.Require = require.All( | ||
| require.Not(nerdtest.Docker), |
There was a problem hiding this comment.
Please keep the comment line to explain the reason
Part of #4613.
Migrates
cmd/nerdctl/container/multi_platform_linux_test.gofromtestutil.NewBaseto the Tigronnerdtest.Setupframework, following the pattern established in #4641.Changes:
testutil.RequireExecPlatformreplaced with a customrequireMultiPlatformExecrequirement backed byplatformutil.CanExecProbablytestregistry.NewWithNoAuthreplaced withnerdtest.RegistryWithNoAuthdata.Temp().Save()TestMultiPlatformRunconverted to useSubTestsfor per-platform isolationtestMultiPlatformRunhelper updated to usetest.HelpersCleanupcallbackstestutil.DockerIncompatiblereplaced withrequire.Not(nerdtest.Docker)testutil.RequiresBuildreplaced withnerdtest.Build