Skip to content

Rewrite tests using testutil.NewBase to use nerdtest.Setup (Tigron) #4613

@AkihiroSuda

Description

@AkihiroSuda

All the tests using testutil.NewBase should be rewritten to use nerdtest.Setup (i.e., Tigron framework)

https://github.com/search?q=repo%3Acontainerd%2Fnerdctl%20testutil.NewBase&type=code
https://github.com/search?q=repo%3Acontainerd%2Fnerdctl+nerdtest.Setup&type=code

Example occurrence:

// https://github.com/containerd/nerdctl/issues/2598
func TestContainerListWithFormatLabel(t *testing.T) {
t.Parallel()
base := testutil.NewBase(t)
tID := testutil.Identifier(t)
cID := tID
labelK := "label-key-" + tID
labelV := "label-value-" + tID
base.Cmd("run", "-d",
"--name", cID,
"--label", labelK+"="+labelV,
testutil.CommonImage, "sleep", nerdtest.Infinity).AssertOK()
defer base.Cmd("rm", "-f", cID).AssertOK()
base.Cmd("ps", "-a",
"--filter", "label="+labelK,
"--format", fmt.Sprintf("{{.Label %q}}", labelK)).AssertOutExactly(labelV + "\n")
}
func TestContainerListWithJsonFormatLabel(t *testing.T) {
t.Parallel()
base := testutil.NewBase(t)
tID := testutil.Identifier(t)
cID := tID
labelK := "label-key-" + tID
labelV := "label-value-" + tID
base.Cmd("run", "-d",
"--name", cID,
"--label", labelK+"="+labelV,
testutil.CommonImage, "sleep", nerdtest.Infinity).AssertOK()
defer base.Cmd("rm", "-f", cID).AssertOK()
base.Cmd("ps", "-a",
"--filter", "label="+labelK,
"--format", "json").AssertOutContains(fmt.Sprintf("%s=%s", labelK, labelV))
}

Example PR:

This is a "good first issue", but needs a bunch of PRs.


Files (46)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions