Skip to content

Commit

Permalink
Move to linux
Browse files Browse the repository at this point in the history
  • Loading branch information
manugupt1 committed Dec 10, 2024
1 parent 91cc980 commit 86ffb91
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
35 changes: 35 additions & 0 deletions cmd/nerdctl/compose/compose_up_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,3 +579,38 @@ services:
}
c.Assert(expected)
}

func TestComposeUpPull(t *testing.T) {
base := testutil.NewBase(t)

var dockerComposeYAML = fmt.Sprintf(`
services:
test:
image: %s
command: sh -euxc "echo hi"
`, testutil.CommonImage)

comp := testutil.NewComposeDir(t, dockerComposeYAML)
defer comp.CleanUp()

// Cases where pull is required
for _, pull := range []string{"missing", "always"} {
t.Run(fmt.Sprintf("pull=%s", pull), func(t *testing.T) {
base.Cmd("rmi", "-f", testutil.CommonImage).Run()
base.Cmd("images").AssertOutNotContains(testutil.CommonImage)
t.Cleanup(func() {
base.ComposeCmd("-f", comp.YAMLFullPath(), "down").AssertOK()
})
base.ComposeCmd("-f", comp.YAMLFullPath(), "up", "--pull", pull).AssertOutContains("hi")
})
}

t.Run("pull=never, no pull", func(t *testing.T) {
base.Cmd("rmi", "-f", testutil.CommonImage).Run()
base.Cmd("images").AssertOutNotContains(testutil.CommonImage)
t.Cleanup(func() {
base.ComposeCmd("-f", comp.YAMLFullPath(), "down").AssertOK()
})
base.ComposeCmd("-f", comp.YAMLFullPath(), "up", "--pull", "never").AssertExitCode(1)
})
}
35 changes: 0 additions & 35 deletions cmd/nerdctl/compose/compose_up_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,38 +83,3 @@ services:
assert.NilError(t, err)
assert.Equal(t, "hi\n", string(testB))
}

func TestComposeUpPull(t *testing.T) {
base := testutil.NewBase(t)

var dockerComposeYAML = fmt.Sprintf(`
services:
test:
image: %s
command: sh -euxc "echo hi"
`, testutil.CommonImage)

comp := testutil.NewComposeDir(t, dockerComposeYAML)
defer comp.CleanUp()

// Cases where pull is required
for _, pull := range []string{"missing", "always"} {
t.Run(fmt.Sprintf("pull=%s", pull), func(t *testing.T) {
base.Cmd("rmi", "-f", testutil.CommonImage).Run()
base.Cmd("images").AssertOutNotContains(testutil.CommonImage)
t.Cleanup(func() {
base.ComposeCmd("-f", comp.YAMLFullPath(), "down").AssertOK()
})
base.ComposeCmd("-f", comp.YAMLFullPath(), "up", "--pull", pull).AssertOutContains("hi")
})
}

t.Run("pull=never, no pull", func(t *testing.T) {
base.Cmd("rmi", "-f", testutil.CommonImage).Run()
base.Cmd("images").AssertOutNotContains(testutil.CommonImage)
t.Cleanup(func() {
base.ComposeCmd("-f", comp.YAMLFullPath(), "down").AssertOK()
})
base.ComposeCmd("-f", comp.YAMLFullPath(), "up", "--pull", "never").AssertExitCode(1)
})
}

0 comments on commit 86ffb91

Please sign in to comment.