@@ -207,19 +207,20 @@ func TestBuildMultiStageParentConfig(t *testing.T) {
207207 defer source .Close ()
208208
209209 apiclient := testEnv .APIClient ()
210+ imgName := strings .ToLower (t .Name ())
210211 resp , err := apiclient .ImageBuild (ctx ,
211212 source .AsTarReader (t ),
212213 types.ImageBuildOptions {
213214 Remove : true ,
214215 ForceRemove : true ,
215- Tags : []string {"build1" },
216+ Tags : []string {imgName },
216217 })
217218 assert .NilError (t , err )
218219 _ , err = io .Copy (ioutil .Discard , resp .Body )
219220 resp .Body .Close ()
220221 assert .NilError (t , err )
221222
222- image , _ , err := apiclient .ImageInspectWithRaw (ctx , "build1" )
223+ image , _ , err := apiclient .ImageInspectWithRaw (ctx , imgName )
223224 assert .NilError (t , err )
224225
225226 expected := "/foo/sub2"
@@ -234,7 +235,7 @@ func TestBuildMultiStageParentConfig(t *testing.T) {
234235func TestBuildLabelWithTargets (t * testing.T ) {
235236 skip .If (t , versions .LessThan (testEnv .DaemonAPIVersion (), "1.38" ), "test added after 1.38" )
236237 skip .If (t , testEnv .DaemonInfo .OSType == "windows" , "FIXME" )
237- bldName := "build -a"
238+ imgName := strings . ToLower ( t . Name () + " -a")
238239 testLabels := map [string ]string {
239240 "foo" : "bar" ,
240241 "dead" : "beef" ,
@@ -260,7 +261,7 @@ func TestBuildLabelWithTargets(t *testing.T) {
260261 types.ImageBuildOptions {
261262 Remove : true ,
262263 ForceRemove : true ,
263- Tags : []string {bldName },
264+ Tags : []string {imgName },
264265 Labels : testLabels ,
265266 Target : "target-a" ,
266267 })
@@ -269,7 +270,7 @@ func TestBuildLabelWithTargets(t *testing.T) {
269270 resp .Body .Close ()
270271 assert .NilError (t , err )
271272
272- image , _ , err := apiclient .ImageInspectWithRaw (ctx , bldName )
273+ image , _ , err := apiclient .ImageInspectWithRaw (ctx , imgName )
273274 assert .NilError (t , err )
274275
275276 testLabels ["label-a" ] = "inline-a"
@@ -280,14 +281,14 @@ func TestBuildLabelWithTargets(t *testing.T) {
280281 }
281282
282283 // For `target-b` build
283- bldName = "build -b"
284+ imgName = strings . ToLower ( t . Name () + " -b")
284285 delete (testLabels , "label-a" )
285286 resp , err = apiclient .ImageBuild (ctx ,
286287 source .AsTarReader (t ),
287288 types.ImageBuildOptions {
288289 Remove : true ,
289290 ForceRemove : true ,
290- Tags : []string {bldName },
291+ Tags : []string {imgName },
291292 Labels : testLabels ,
292293 Target : "target-b" ,
293294 })
@@ -296,7 +297,7 @@ func TestBuildLabelWithTargets(t *testing.T) {
296297 resp .Body .Close ()
297298 assert .NilError (t , err )
298299
299- image , _ , err = apiclient .ImageInspectWithRaw (ctx , bldName )
300+ image , _ , err = apiclient .ImageInspectWithRaw (ctx , imgName )
300301 assert .NilError (t , err )
301302
302303 testLabels ["label-b" ] = "inline-b"
@@ -581,7 +582,7 @@ func TestBuildPreserveOwnership(t *testing.T) {
581582
582583 ctx := context .Background ()
583584
584- dockerfile , err := ioutil .ReadFile ("testdata/Dockerfile.testBuildPreserveOwnership" )
585+ dockerfile , err := ioutil .ReadFile ("testdata/Dockerfile." + t . Name () )
585586 assert .NilError (t , err )
586587
587588 source := fakecontext .New (t , "" , fakecontext .WithDockerfile (string (dockerfile )))
0 commit comments