@@ -234,8 +234,12 @@ CMD ["cat", "/mnt/initial_file"]
234234 volName := data .Identifier ("vol" )
235235 helpers .Ensure ("volume" , "create" , volName )
236236
237+ noCopyVolName := data .Identifier ("nocopy-vol" )
238+ helpers .Ensure ("volume" , "create" , noCopyVolName )
239+
237240 data .Labels ().Set ("img" , imgName )
238241 data .Labels ().Set ("vol" , volName )
242+ data .Labels ().Set ("nocopy-vol" , noCopyVolName )
239243 }
240244
241245 testCase .SubTests = []* test.Case {
@@ -263,12 +267,22 @@ CMD ["cat", "/mnt/initial_file"]
263267 },
264268 Expected : test .Expects (expect .ExitCodeSuccess , nil , expect .Equals ("hi\n " )),
265269 },
270+ {
271+ Description : "with volume-nocopy" ,
272+ NoParallel : true ,
273+ Command : func (data test.Data , helpers test.Helpers ) test.TestableCommand {
274+ mount := fmt .Sprintf ("type=volume,source=%s,target=/mnt,volume-nocopy" , data .Labels ().Get ("nocopy-vol" ))
275+ return helpers .Command ("run" , "--rm" , "--mount" , mount , data .Labels ().Get ("img" ), "sh" , "-c" , "test ! -e /mnt/initial_file" )
276+ },
277+ Expected : test .Expects (expect .ExitCodeSuccess , nil , nil ),
278+ },
266279 }
267280
268281 testCase .Cleanup = func (data test.Data , helpers test.Helpers ) {
269282 helpers .Anyhow ("volume" , "rm" , data .Labels ().Get ("vol" ))
270283 helpers .Anyhow ("rmi" , data .Labels ().Get ("img" ))
271284 helpers .Anyhow ("builder" , "prune" , "--all" , "--force" )
285+ helpers .Anyhow ("volume" , "rm" , data .Labels ().Get ("nocopy-vol" ))
272286 }
273287
274288 testCase .Run (t )
0 commit comments