Skip to content

Commit d659d97

Browse files
committed
test: improve TestComposeMultiplePorts setup and parallel handling
Signed-off-by: Hajime Ogi <robertcal900@gmail.com>
1 parent 477a1e4 commit d659d97

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

cmd/nerdctl/compose/compose_port_linux_test.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,12 @@ services:
172172
// TestComposeMultiplePorts tests whether it is possible to allocate a large
173173
// number of ports. (https://github.com/containerd/nerdctl/issues/4027)
174174
func TestComposeMultiplePorts(t *testing.T) {
175-
var dockerComposeYAML = fmt.Sprintf(`
175+
testCase := nerdtest.Setup()
176+
177+
testCase.NoParallel = true
178+
179+
testCase.Setup = func(data test.Data, helpers test.Helpers) {
180+
dockerComposeYAML := fmt.Sprintf(`
176181
services:
177182
svc0:
178183
image: %s
@@ -181,11 +186,10 @@ services:
181186
- '32000-32060:32000-32060'
182187
`, testutil.AlpineImage)
183188

184-
testCase := nerdtest.Setup()
185-
186-
testCase.Setup = func(data test.Data, helpers test.Helpers) {
187189
compYamlPath := data.Temp().Save(dockerComposeYAML, "compose.yaml")
188190
data.Labels().Set("composeYaml", compYamlPath)
191+
projectName := filepath.Base(filepath.Dir(compYamlPath))
192+
t.Logf("projectName=%q", projectName)
189193

190194
helpers.Ensure("compose", "-f", compYamlPath, "up", "-d")
191195
}
@@ -197,7 +201,6 @@ services:
197201
testCase.SubTests = []*test.Case{
198202
{
199203
Description: "Issue #4027 - Allocate a large number of ports.",
200-
NoParallel: true,
201204
Command: func(data test.Data, helpers test.Helpers) test.TestableCommand {
202205
return helpers.Command("compose", "-f", data.Labels().Get("composeYaml"), "port", "svc0", "32000")
203206
},

0 commit comments

Comments
 (0)