refactor: migrate multi_platform_linux_test.go to nerdtest.Setup#4897
Open
ogulcanaydogan wants to merge 3 commits into
Open
refactor: migrate multi_platform_linux_test.go to nerdtest.Setup#4897ogulcanaydogan wants to merge 3 commits into
ogulcanaydogan wants to merge 3 commits into
Conversation
46 tasks
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>
sathiraumesh
suggested changes
May 15, 2026
| return helpers.Command("push", "--platform=amd64,arm64,linux/arm/v7", imageName) | ||
| } | ||
|
|
||
| testCase.Expected = test.Expects(0, nil, nil) |
Contributor
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) |
Contributor
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>
Contributor
Author
|
Thanks for the review. Replaced all hardcoded exit code literals in test.Expects() calls with expect.ExitCodeSuccess. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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