Skip to content

Commit 2c1a5b8

Browse files
committed
Fix tests broken by tooling update
Signed-off-by: apostasie <[email protected]>
1 parent 5ce1e4b commit 2c1a5b8

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

cmd/nerdctl/container/container_create_linux_test.go

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,16 @@ func TestIssue2993(t *testing.T) {
206206
testCase := &test.Group{
207207
{
208208
Description: "Issue #2993 - nerdctl no longer leaks containers and etchosts directories and files when container creation fails.",
209-
Require: nerdtest.Private,
210209
Setup: func(data test.Data, helpers test.Helpers) {
211-
helpers.Ensure("run", "--name", data.Identifier(), "-d", testutil.AlpineImage, "sleep", "infinity")
210+
dataRoot := data.TempDir()
211+
212+
helpers.Ensure("run", "--data-root", dataRoot, "--name", data.Identifier(), "-d", testutil.AlpineImage, "sleep", "infinity")
212213

213-
dataRoot := string(data.ReadConfig(nerdtest.DataRoot))
214214
h := getAddrHash(defaults.DefaultAddress)
215215
dataStore := filepath.Join(dataRoot, h)
216-
namespace := data.Identifier()
216+
217+
// FIXME: update with next tooling iteration to retrieve from the command
218+
namespace := "nerdctl-test"
217219

218220
containersPath := filepath.Join(dataStore, "containers", namespace)
219221
containersDirs, err := os.ReadDir(containersPath)
@@ -229,10 +231,10 @@ func TestIssue2993(t *testing.T) {
229231
data.Set(etchostsPathKey, etchostsPath)
230232
},
231233
Cleanup: func(data test.Data, helpers test.Helpers) {
232-
helpers.Anyhow("rm", "-f", data.Identifier())
234+
helpers.Anyhow("rm", "--data-root", data.TempDir(), "-f", data.Identifier())
233235
},
234236
Command: func(data test.Data, helpers test.Helpers) test.Command {
235-
return helpers.Command("run", "--name", data.Identifier(), "-d", testutil.AlpineImage, "sleep", "infinity")
237+
return helpers.Command("run", "--data-root", data.TempDir(), "--name", data.Identifier(), "-d", testutil.AlpineImage, "sleep", "infinity")
236238
},
237239
Expected: func(data test.Data, helpers test.Helpers) *test.Expected {
238240
return &test.Expected{
@@ -252,14 +254,16 @@ func TestIssue2993(t *testing.T) {
252254
},
253255
{
254256
Description: "Issue #2993 - nerdctl no longer leaks containers and etchosts directories and files when containers are removed.",
255-
Require: nerdtest.Private,
256257
Setup: func(data test.Data, helpers test.Helpers) {
257-
helpers.Ensure("run", "--name", data.Identifier(), "-d", testutil.AlpineImage, "sleep", "infinity")
258+
dataRoot := data.TempDir()
259+
260+
helpers.Ensure("run", "--data-root", dataRoot, "--name", data.Identifier(), "-d", testutil.AlpineImage, "sleep", "infinity")
258261

259-
dataRoot := string(data.ReadConfig(nerdtest.DataRoot))
260262
h := getAddrHash(defaults.DefaultAddress)
261263
dataStore := filepath.Join(dataRoot, h)
262-
namespace := data.Identifier()
264+
265+
// FIXME: update with next tooling iteration to retrieve from the command
266+
namespace := "nerdctl-test"
263267

264268
containersPath := filepath.Join(dataStore, "containers", namespace)
265269
containersDirs, err := os.ReadDir(containersPath)
@@ -275,10 +279,10 @@ func TestIssue2993(t *testing.T) {
275279
data.Set(etchostsPathKey, etchostsPath)
276280
},
277281
Cleanup: func(data test.Data, helpers test.Helpers) {
278-
helpers.Anyhow("rm", "-f", data.Identifier())
282+
helpers.Anyhow("--data-root", data.TempDir(), "rm", "-f", data.Identifier())
279283
},
280284
Command: func(data test.Data, helpers test.Helpers) test.Command {
281-
return helpers.Command("rm", "-f", data.Identifier())
285+
return helpers.Command("--data-root", data.TempDir(), "rm", "-f", data.Identifier())
282286
},
283287
Expected: func(data test.Data, helpers test.Helpers) *test.Expected {
284288
return &test.Expected{

0 commit comments

Comments
 (0)