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
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>
8e7b2bf to
3fed4ad
Compare
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>
| 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
…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>
|
Thanks for the review. Replaced all hardcoded exit code literals in test.Expects() calls with expect.ExitCodeSuccess. |
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>
|
Addressed. Added |
Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@hotmail.com>
|
https://github.com/containerd/nerdctl/actions/runs/25974269421/job/78060013893?pr=4897 |
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>
|
@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. |
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