@@ -206,14 +206,16 @@ func TestIssue2993(t *testing.T) {
206
206
testCase := & test.Group {
207
207
{
208
208
Description : "Issue #2993 - nerdctl no longer leaks containers and etchosts directories and files when container creation fails." ,
209
- Require : nerdtest .Private ,
210
209
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" )
212
213
213
- dataRoot := string (data .ReadConfig (nerdtest .DataRoot ))
214
214
h := getAddrHash (defaults .DefaultAddress )
215
215
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"
217
219
218
220
containersPath := filepath .Join (dataStore , "containers" , namespace )
219
221
containersDirs , err := os .ReadDir (containersPath )
@@ -229,10 +231,10 @@ func TestIssue2993(t *testing.T) {
229
231
data .Set (etchostsPathKey , etchostsPath )
230
232
},
231
233
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 ())
233
235
},
234
236
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" )
236
238
},
237
239
Expected : func (data test.Data , helpers test.Helpers ) * test.Expected {
238
240
return & test.Expected {
@@ -252,14 +254,16 @@ func TestIssue2993(t *testing.T) {
252
254
},
253
255
{
254
256
Description : "Issue #2993 - nerdctl no longer leaks containers and etchosts directories and files when containers are removed." ,
255
- Require : nerdtest .Private ,
256
257
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" )
258
261
259
- dataRoot := string (data .ReadConfig (nerdtest .DataRoot ))
260
262
h := getAddrHash (defaults .DefaultAddress )
261
263
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"
263
267
264
268
containersPath := filepath .Join (dataStore , "containers" , namespace )
265
269
containersDirs , err := os .ReadDir (containersPath )
@@ -275,10 +279,10 @@ func TestIssue2993(t *testing.T) {
275
279
data .Set (etchostsPathKey , etchostsPath )
276
280
},
277
281
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 ())
279
283
},
280
284
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 ())
282
286
},
283
287
Expected : func (data test.Data , helpers test.Helpers ) * test.Expected {
284
288
return & test.Expected {
0 commit comments