Skip to content

Commit

Permalink
Merge pull request #3964 from apostasie/ci-kill-pull-noise
Browse files Browse the repository at this point in the history
--quiet image pulls in tests
  • Loading branch information
AkihiroSuda authored Mar 6, 2025
2 parents 2f9a4f6 + 678822a commit 47f1b9e
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 48 deletions.
2 changes: 1 addition & 1 deletion cmd/nerdctl/container/container_list_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type psTestContainer struct {
func preparePsTestContainer(t *testing.T, identity string, keepAlive bool) (*testutil.Base, psTestContainer) {
base := testutil.NewBase(t)

base.Cmd("pull", testutil.CommonImage).AssertOK()
base.Cmd("pull", "--quiet", testutil.CommonImage).AssertOK()

testContainerName := testutil.Identifier(t) + identity
rwVolName := testContainerName + "-rw"
Expand Down
2 changes: 1 addition & 1 deletion cmd/nerdctl/container/container_list_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type psTestContainer struct {
func preparePsTestContainer(t *testing.T, identity string, restart bool, hyperv bool) (*testutil.Base, psTestContainer) {
base := testutil.NewBase(t)

base.Cmd("pull", testutil.NginxAlpineImage).AssertOK()
base.Cmd("pull", "--quiet", testutil.NginxAlpineImage).AssertOK()

testContainerName := testutil.Identifier(t) + identity
t.Cleanup(func() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/nerdctl/container/container_run_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestRunCustomRootfs(t *testing.T) {
}

func prepareCustomRootfs(base *testutil.Base, imageName string) string {
base.Cmd("pull", imageName).AssertOK()
base.Cmd("pull", "--quiet", imageName).AssertOK()
tmpDir, err := os.MkdirTemp(base.T.TempDir(), "test-save")
assert.NilError(base.T, err)
defer os.RemoveAll(tmpDir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func runSyslogTest(t *testing.T, networks []string, syslogFacilities map[string]
}

base := testutil.NewBase(t)
base.Cmd("pull", testutil.CommonImage).AssertOK()
base.Cmd("pull", "--quiet", testutil.CommonImage).AssertOK()
hostname, err := os.Hostname()
if err != nil {
t.Fatalf("Error retrieving hostname")
Expand Down
2 changes: 1 addition & 1 deletion cmd/nerdctl/container/container_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ func TestRunAddHostRemainsWhenAnotherContainerCreated(t *testing.T) {
// https://github.com/containerd/nerdctl/issues/2726
func TestRunRmTime(t *testing.T) {
base := testutil.NewBase(t)
base.Cmd("pull", testutil.CommonImage)
base.Cmd("pull", "--quiet", testutil.CommonImage)
t0 := time.Now()
base.Cmd("run", "--rm", testutil.CommonImage, "true").AssertOK()
t1 := time.Now()
Expand Down
2 changes: 1 addition & 1 deletion cmd/nerdctl/container/container_run_user_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func TestRunAddGroup_CVE_2023_25173(t *testing.T) {
},
}

base.Cmd("pull", testutil.BusyboxImage).AssertOK()
base.Cmd("pull", "--quiet", testutil.BusyboxImage).AssertOK()
for _, testCase := range testCases {
cmd := []string{"run", "--rm"}
if testCase.user != "" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/nerdctl/container/multi_platform_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestMultiPlatformPullPushAllPlatforms(t *testing.T) {
pushImageName := fmt.Sprintf("localhost:%d/%s:latest", reg.Port, tID)
defer base.Cmd("rmi", pushImageName).Run()

base.Cmd("pull", "--all-platforms", testutil.AlpineImage).AssertOK()
base.Cmd("pull", "--quiet", "--all-platforms", testutil.AlpineImage).AssertOK()
base.Cmd("tag", testutil.AlpineImage, pushImageName).AssertOK()
base.Cmd("push", "--all-platforms", pushImageName).AssertOK()
testMultiPlatformRun(base, pushImageName)
Expand Down
2 changes: 1 addition & 1 deletion cmd/nerdctl/image/image_inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestImageInspectSimpleCases(t *testing.T) {

testCase := &test.Case{
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("pull", testutil.CommonImage)
helpers.Ensure("pull", "--quiet", testutil.CommonImage)
},
SubTests: []*test.Case{
{
Expand Down
2 changes: 1 addition & 1 deletion cmd/nerdctl/image/image_load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func TestLoadQuiet(t *testing.T) {
Description: "TestLoadQuiet",
Setup: func(data test.Data, helpers test.Helpers) {
identifier := data.Identifier()
helpers.Ensure("pull", testutil.CommonImage)
helpers.Ensure("pull", "--quiet", testutil.CommonImage)
helpers.Ensure("tag", testutil.CommonImage, identifier)
helpers.Ensure("save", identifier, "-o", filepath.Join(data.TempDir(), "common.tar"))
helpers.Ensure("rmi", "-f", identifier)
Expand Down
4 changes: 2 additions & 2 deletions cmd/nerdctl/image/image_pull_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ CMD ["echo", "nerdctl-build-test-string"]
{
Description: "Pull with the correct key",
Command: func(data test.Data, helpers test.Helpers) test.TestableCommand {
return helpers.Command("pull", "--verify=cosign", "--cosign-key="+keyPair.PublicKey, data.Get("imageref")+":one")
return helpers.Command("pull", "--quiet", "--verify=cosign", "--cosign-key="+keyPair.PublicKey, data.Get("imageref")+":one")
},
Expected: test.Expects(0, nil, nil),
},
Expand All @@ -97,7 +97,7 @@ CMD ["echo", "nerdctl-build-test-string"]
},
Command: func(data test.Data, helpers test.Helpers) test.TestableCommand {
newKeyPair := testhelpers.NewCosignKeyPair(t, "cosign-key-pair-test", "2")
return helpers.Command("pull", "--verify=cosign", "--cosign-key="+newKeyPair.PublicKey, data.Get("imageref")+":two")
return helpers.Command("pull", "--quiet", "--verify=cosign", "--cosign-key="+newKeyPair.PublicKey, data.Get("imageref")+":two")
},
Expected: test.Expects(12, nil, nil),
},
Expand Down
34 changes: 17 additions & 17 deletions cmd/nerdctl/image/image_remove_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestRemove(t *testing.T) {
require.Not(nerdtest.Docker),
),
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("run", "--pull", "always", "--name", data.Identifier(), testutil.CommonImage)
helpers.Ensure("run", "--quiet", "--pull", "always", "--name", data.Identifier(), testutil.CommonImage)
},
Cleanup: func(data test.Data, helpers test.Helpers) {
helpers.Anyhow("rm", "-f", data.Identifier())
Expand All @@ -75,7 +75,7 @@ func TestRemove(t *testing.T) {
Description: "Remove image with stopped container - with -f",
NoParallel: true,
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("run", "--pull", "always", "--name", data.Identifier(), testutil.CommonImage)
helpers.Ensure("run", "--quiet", "--pull", "always", "--name", data.Identifier(), testutil.CommonImage)
},
Cleanup: func(data test.Data, helpers test.Helpers) {
helpers.Anyhow("rm", "-f", data.Identifier())
Expand All @@ -98,7 +98,7 @@ func TestRemove(t *testing.T) {
require.Not(nerdtest.Docker),
),
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("run", "--pull", "always", "-d", "--name", data.Identifier(), testutil.CommonImage, "sleep", nerdtest.Infinity)
helpers.Ensure("run", "--quiet", "--pull", "always", "-d", "--name", data.Identifier(), testutil.CommonImage, "sleep", nerdtest.Infinity)
},
Cleanup: func(data test.Data, helpers test.Helpers) {
helpers.Anyhow("rm", "-f", data.Identifier())
Expand All @@ -123,7 +123,7 @@ func TestRemove(t *testing.T) {
require.Not(nerdtest.Docker),
),
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("run", "--pull", "always", "-d", "--name", data.Identifier(), testutil.CommonImage, "sleep", nerdtest.Infinity)
helpers.Ensure("run", "--quiet", "--pull", "always", "-d", "--name", data.Identifier(), testutil.CommonImage, "sleep", nerdtest.Infinity)

img := nerdtest.InspectImage(helpers, testutil.CommonImage)
repoName, _ := imgutil.ParseRepoTag(testutil.CommonImage)
Expand Down Expand Up @@ -152,7 +152,7 @@ func TestRemove(t *testing.T) {
Description: "Remove image with created container - without -f",
NoParallel: true,
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("create", "--pull", "always", "--name", data.Identifier(), testutil.CommonImage, "sleep", nerdtest.Infinity)
helpers.Ensure("create", "--quiet", "--pull", "always", "--name", data.Identifier(), testutil.CommonImage, "sleep", nerdtest.Infinity)
},
Cleanup: func(data test.Data, helpers test.Helpers) {
helpers.Anyhow("rm", "-f", data.Identifier())
Expand All @@ -175,7 +175,7 @@ func TestRemove(t *testing.T) {
NoParallel: true,
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("pull", "--quiet", testutil.NginxAlpineImage)
helpers.Ensure("create", "--pull", "always", "--name", data.Identifier(), testutil.CommonImage, "sleep", nerdtest.Infinity)
helpers.Ensure("create", "--quiet", "--pull", "always", "--name", data.Identifier(), testutil.CommonImage, "sleep", nerdtest.Infinity)
helpers.Ensure("rmi", testutil.NginxAlpineImage)
},
Cleanup: func(data test.Data, helpers test.Helpers) {
Expand Down Expand Up @@ -204,7 +204,7 @@ func TestRemove(t *testing.T) {
nerdtest.CGroup,
),
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("run", "--pull", "always", "-d", "--name", data.Identifier(), testutil.CommonImage, "sleep", nerdtest.Infinity)
helpers.Ensure("run", "--quiet", "--pull", "always", "-d", "--name", data.Identifier(), testutil.CommonImage, "sleep", nerdtest.Infinity)
helpers.Ensure("pause", data.Identifier())
},
Cleanup: func(data test.Data, helpers test.Helpers) {
Expand All @@ -231,7 +231,7 @@ func TestRemove(t *testing.T) {
require.Not(nerdtest.Docker),
),
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("run", "--pull", "always", "-d", "--name", data.Identifier(), testutil.CommonImage, "sleep", nerdtest.Infinity)
helpers.Ensure("run", "--quiet", "--pull", "always", "-d", "--name", data.Identifier(), testutil.CommonImage, "sleep", nerdtest.Infinity)
helpers.Ensure("pause", data.Identifier())

img := nerdtest.InspectImage(helpers, testutil.CommonImage)
Expand Down Expand Up @@ -264,7 +264,7 @@ func TestRemove(t *testing.T) {
require.Not(nerdtest.Docker),
),
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("run", "--pull", "always", "-d", "--name", data.Identifier(), testutil.CommonImage, "sleep", nerdtest.Infinity)
helpers.Ensure("run", "--quiet", "--pull", "always", "-d", "--name", data.Identifier(), testutil.CommonImage, "sleep", nerdtest.Infinity)
helpers.Ensure("kill", data.Identifier())
},
Cleanup: func(data test.Data, helpers test.Helpers) {
Expand All @@ -287,7 +287,7 @@ func TestRemove(t *testing.T) {
Description: "Remove image with killed container - with -f",
NoParallel: true,
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("run", "--pull", "always", "-d", "--name", data.Identifier(), testutil.CommonImage, "sleep", nerdtest.Infinity)
helpers.Ensure("run", "--quiet", "--pull", "always", "-d", "--name", data.Identifier(), testutil.CommonImage, "sleep", nerdtest.Infinity)
helpers.Ensure("kill", data.Identifier())
},
Cleanup: func(data test.Data, helpers test.Helpers) {
Expand Down Expand Up @@ -321,8 +321,8 @@ func TestIssue3016(t *testing.T) {
{
Description: "Issue #3016 - Tags created using the short digest ids of container images cannot be deleted using the nerdctl rmi command.",
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("pull", testutil.CommonImage)
helpers.Ensure("pull", testutil.NginxAlpineImage)
helpers.Ensure("pull", "--quiet", testutil.CommonImage)
helpers.Ensure("pull", "--quiet", testutil.NginxAlpineImage)

img := nerdtest.InspectImage(helpers, testutil.NginxAlpineImage)
repoName, _ := imgutil.ParseRepoTag(testutil.NginxAlpineImage)
Expand Down Expand Up @@ -374,7 +374,7 @@ func TestRemoveKubeWithKubeHideDupe(t *testing.T) {
Description: "After removing the tag without kube-hide-dupe, repodigest is shown as <none>",
NoParallel: true,
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("pull", testutil.BusyboxImage)
helpers.Ensure("pull", "--quiet", testutil.BusyboxImage)
},
Command: test.Command("rmi", "-f", testutil.BusyboxImage),
Expected: func(data test.Data, helpers test.Helpers) *test.Expected {
Expand Down Expand Up @@ -405,7 +405,7 @@ func TestRemoveKubeWithKubeHideDupe(t *testing.T) {
helpers.Anyhow("--kube-hide-dupe", "rmi", data.Identifier())
},
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("pull", testutil.BusyboxImage)
helpers.Ensure("pull", "--quiet", testutil.BusyboxImage)
helpers.Ensure("tag", testutil.BusyboxImage, data.Identifier())
},
Command: test.Command("--kube-hide-dupe", "rmi", testutil.BusyboxImage),
Expand Down Expand Up @@ -434,7 +434,7 @@ func TestRemoveKubeWithKubeHideDupe(t *testing.T) {
Description: "After deleting all repo:tag entries, all repodigests will be cleaned up",
NoParallel: true,
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("pull", testutil.BusyboxImage)
helpers.Ensure("pull", "--quiet", testutil.BusyboxImage)
helpers.Ensure("tag", testutil.BusyboxImage, data.Identifier())
},
Command: func(data test.Data, helpers test.Helpers) test.TestableCommand {
Expand Down Expand Up @@ -464,7 +464,7 @@ func TestRemoveKubeWithKubeHideDupe(t *testing.T) {
Description: "Test multiple IDs found with provided prefix and force with shortID",
NoParallel: true,
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("pull", testutil.BusyboxImage)
helpers.Ensure("pull", "--quiet", testutil.BusyboxImage)
helpers.Ensure("tag", testutil.BusyboxImage, data.Identifier())
},
Command: func(data test.Data, helpers test.Helpers) test.TestableCommand {
Expand Down Expand Up @@ -494,7 +494,7 @@ func TestRemoveKubeWithKubeHideDupe(t *testing.T) {
Description: "Test remove image with digestID",
NoParallel: true,
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("pull", testutil.BusyboxImage)
helpers.Ensure("pull", "--quiet", testutil.BusyboxImage)
helpers.Ensure("tag", testutil.BusyboxImage, data.Identifier())
},
Command: func(data test.Data, helpers test.Helpers) test.TestableCommand {
Expand Down
4 changes: 2 additions & 2 deletions cmd/nerdctl/ipfs/ipfs_kubo_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestIPFSAddrWithKubo(t *testing.T) {
NoParallel: true,
Setup: func(data test.Data, helpers test.Helpers) {
ipfsCID := pushToIPFS(helpers, testutil.CommonImage, fmt.Sprintf("--ipfs-address=%s", data.Get(ipfsAddrKey)))
helpers.Ensure("pull", "--ipfs-address", data.Get(ipfsAddrKey), "ipfs://"+ipfsCID)
helpers.Ensure("pull", "--quiet", "--ipfs-address", data.Get(ipfsAddrKey), "ipfs://"+ipfsCID)
data.Set(mainImageCIDKey, ipfsCID)
},
Cleanup: func(data test.Data, helpers test.Helpers) {
Expand All @@ -89,7 +89,7 @@ func TestIPFSAddrWithKubo(t *testing.T) {
),
Setup: func(data test.Data, helpers test.Helpers) {
ipfsCID := pushToIPFS(helpers, testutil.CommonImage, fmt.Sprintf("--ipfs-address=%s", data.Get(ipfsAddrKey)), "--estargz")
helpers.Ensure("pull", "--ipfs-address", data.Get(ipfsAddrKey), "ipfs://"+ipfsCID)
helpers.Ensure("pull", "--quiet", "--ipfs-address", data.Get(ipfsAddrKey), "ipfs://"+ipfsCID)
data.Set(mainImageCIDKey, ipfsCID)
},
Cleanup: func(data test.Data, helpers test.Helpers) {
Expand Down
16 changes: 8 additions & 8 deletions cmd/nerdctl/ipfs/ipfs_simple_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestIPFSSimple(t *testing.T) {
NoParallel: true,
Setup: func(data test.Data, helpers test.Helpers) {
data.Set(mainImageCIDKey, pushToIPFS(helpers, testutil.CommonImage))
helpers.Ensure("pull", "ipfs://"+data.Get(mainImageCIDKey))
helpers.Ensure("pull", "--quiet", "ipfs://"+data.Get(mainImageCIDKey))
},
Cleanup: func(data test.Data, helpers test.Helpers) {
if data.Get(mainImageCIDKey) != "" {
Expand All @@ -75,7 +75,7 @@ func TestIPFSSimple(t *testing.T) {
),
Setup: func(data test.Data, helpers test.Helpers) {
data.Set(mainImageCIDKey, pushToIPFS(helpers, testutil.CommonImage, "--estargz"))
helpers.Ensure("pull", "ipfs://"+data.Get(mainImageCIDKey))
helpers.Ensure("pull", "--quiet", "ipfs://"+data.Get(mainImageCIDKey))
},
Cleanup: func(data test.Data, helpers test.Helpers) {
if data.Get(mainImageCIDKey) != "" {
Expand All @@ -92,7 +92,7 @@ func TestIPFSSimple(t *testing.T) {
NoParallel: true,
Setup: func(data test.Data, helpers test.Helpers) {
data.Set(mainImageCIDKey, pushToIPFS(helpers, testutil.CommonImage))
helpers.Ensure("pull", "ipfs://"+data.Get(mainImageCIDKey))
helpers.Ensure("pull", "--quiet", "ipfs://"+data.Get(mainImageCIDKey))

// Run a container that does modify something, then commit and push it
helpers.Ensure("run", "--name", data.Identifier("commit-container"), data.Get(mainImageCIDKey), "sh", "-c", "--", "echo hello > /hello")
Expand All @@ -104,7 +104,7 @@ func TestIPFSSimple(t *testing.T) {
helpers.Ensure("rmi", data.Identifier("commit-image"))

// Pull back the committed image
helpers.Ensure("pull", "ipfs://"+data.Get(transformedImageCIDKey))
helpers.Ensure("pull", "--quiet", "ipfs://"+data.Get(transformedImageCIDKey))
},
Cleanup: func(data test.Data, helpers test.Helpers) {
helpers.Anyhow("rm", "-f", data.Identifier("commit-container"))
Expand All @@ -130,7 +130,7 @@ func TestIPFSSimple(t *testing.T) {
),
Setup: func(data test.Data, helpers test.Helpers) {
data.Set(mainImageCIDKey, pushToIPFS(helpers, testutil.CommonImage, "--estargz"))
helpers.Ensure("pull", "ipfs://"+data.Get(mainImageCIDKey))
helpers.Ensure("pull", "--quiet", "ipfs://"+data.Get(mainImageCIDKey))

// Run a container that does modify something, then commit and push it
helpers.Ensure("run", "--name", data.Identifier("commit-container"), data.Get(mainImageCIDKey), "sh", "-c", "--", "echo hello > /hello")
Expand All @@ -142,7 +142,7 @@ func TestIPFSSimple(t *testing.T) {
helpers.Ensure("rmi", data.Identifier("commit-image"))

// Pull back the image
helpers.Ensure("pull", "ipfs://"+data.Get(transformedImageCIDKey))
helpers.Ensure("pull", "--quiet", "ipfs://"+data.Get(transformedImageCIDKey))
},
Cleanup: func(data test.Data, helpers test.Helpers) {
helpers.Anyhow("rm", "-f", data.Identifier("commit-container"))
Expand All @@ -165,7 +165,7 @@ func TestIPFSSimple(t *testing.T) {
Require: require.Binary("openssl"),
Setup: func(data test.Data, helpers test.Helpers) {
data.Set(mainImageCIDKey, pushToIPFS(helpers, testutil.CommonImage))
helpers.Ensure("pull", "ipfs://"+data.Get(mainImageCIDKey))
helpers.Ensure("pull", "--quiet", "ipfs://"+data.Get(mainImageCIDKey))

// Prep a key pair
keyPair := testhelpers.NewJWEKeyPair(t)
Expand Down Expand Up @@ -193,7 +193,7 @@ func TestIPFSSimple(t *testing.T) {
helpers.Ensure("rmi", "-f", data.Get(transformedImageCIDKey))

// Pull back without unpacking
helpers.Ensure("pull", "--unpack=false", "ipfs://"+data.Get(transformedImageCIDKey))
helpers.Ensure("pull", "--quiet", "--unpack=false", "ipfs://"+data.Get(transformedImageCIDKey))
},
Cleanup: func(data test.Data, helpers test.Helpers) {
if data.Get(mainImageCIDKey) != "" {
Expand Down
Loading

0 comments on commit 47f1b9e

Please sign in to comment.