@@ -244,15 +244,15 @@ func generateRandomUID() string {
244244// getDefaultHostConfig creates a HostConfig and populates it with the defaults used in testing
245245func getDefaultHostConfig (t * testing.T , cli ce.ContainerInterface ) * ce.ContainerHostConfig {
246246 hostConfig := ce.ContainerHostConfig {
247- Binds : []string {
248- coverageBind (t ),
249- },
250247 PortBindings : []ce.PortBinding {},
251248 CapDrop : []string {
252249 "ALL" ,
253250 },
254251 Privileged : false ,
255252 }
253+ if coverage () {
254+ hostConfig .Binds = append (hostConfig .Binds , coverageBind (t ))
255+ }
256256 if devImage (t , cli ) {
257257 // Only needed for a RHEL-based image
258258 if baseImage (t , cli ) != "ubuntu" {
@@ -274,9 +274,10 @@ func runContainerWithHostConfig(t *testing.T, cli ce.ContainerInterface, contain
274274 if containerConfig .User == "" {
275275 containerConfig .User = generateRandomUID ()
276276 }
277- // if coverage
278- containerConfig .Env = append (containerConfig .Env , "COVERAGE_FILE=" + t .Name ()+ ".cov" )
279- containerConfig .Env = append (containerConfig .Env , "EXIT_CODE_FILE=" + getExitCodeFilename (t ))
277+ if coverage () {
278+ containerConfig .Env = append (containerConfig .Env , "COVERAGE_FILE=" + t .Name ()+ ".cov" )
279+ containerConfig .Env = append (containerConfig .Env , "EXIT_CODE_FILE=" + getExitCodeFilename (t ))
280+ }
280281 networkingConfig := ce.ContainerNetworkSettings {}
281282 t .Logf ("Running container (%s)" , containerConfig .Image )
282283 ID , err := cli .ContainerCreate (containerConfig , hostConfig , & networkingConfig , t .Name ())
@@ -300,9 +301,10 @@ func runContainerWithAllConfig(t *testing.T, cli ce.ContainerInterface, containe
300301 if containerConfig .User == "" {
301302 containerConfig .User = generateRandomUID ()
302303 }
303- // if coverage
304- containerConfig .Env = append (containerConfig .Env , "COVERAGE_FILE=" + t .Name ()+ ".cov" )
305- containerConfig .Env = append (containerConfig .Env , "EXIT_CODE_FILE=" + getExitCodeFilename (t ))
304+ if coverage () {
305+ containerConfig .Env = append (containerConfig .Env , "COVERAGE_FILE=" + t .Name ()+ ".cov" )
306+ containerConfig .Env = append (containerConfig .Env , "EXIT_CODE_FILE=" + getExitCodeFilename (t ))
307+ }
306308 t .Logf ("Running container (%s)" , containerConfig .Image )
307309 ID , err := cli .ContainerCreate (containerConfig , hostConfig , networkingConfig , containerName )
308310 if err != nil {
@@ -432,37 +434,35 @@ func getHostConfig(t *testing.T, mounts int, qmsharedlogs string, qmshareddata s
432434 case 1 :
433435 hostConfig = ce.ContainerHostConfig {
434436 Binds : []string {
435- coverageBind (t ),
436437 qmdata + ":/mnt/mqm" ,
437438 },
438439 }
439440 case 2 :
440441 hostConfig = ce.ContainerHostConfig {
441442 Binds : []string {
442- coverageBind (t ),
443443 qmdata + ":/mnt/mqm" ,
444444 qmshareddata + ":/mnt/mqm-data" ,
445445 },
446446 }
447447 case 3 :
448448 hostConfig = ce.ContainerHostConfig {
449449 Binds : []string {
450- coverageBind (t ),
451450 qmdata + ":/mnt/mqm" ,
452451 qmsharedlogs + ":/mnt/mqm-log" ,
453452 },
454453 }
455454 case 4 :
456455 hostConfig = ce.ContainerHostConfig {
457456 Binds : []string {
458- coverageBind (t ),
459457 qmdata + ":/mnt/mqm" ,
460458 qmsharedlogs + ":/mnt/mqm-log" ,
461459 qmshareddata + ":/mnt/mqm-data" ,
462460 },
463461 }
464462 }
465-
463+ if coverage () {
464+ hostConfig .Binds = append (hostConfig .Binds , coverageBind (t ))
465+ }
466466 return hostConfig
467467}
468468
@@ -625,7 +625,7 @@ func inspectTextLogs(t *testing.T, cli ce.ContainerInterface, ID string) string
625625 if strings .HasPrefix (text , "{" ) {
626626 var e map [string ]interface {}
627627 json .Unmarshal ([]byte (text ), & e )
628- fmt .Fprintf (buf , "{\" message\" : \" %v\" }\n " , e ["message" ])
628+ fmt .Fprintf (buf , "{\" message\" : \" %v\" , ... }\n " , e ["message" ])
629629 } else {
630630 fmt .Fprintln (buf , text )
631631 }
@@ -790,9 +790,10 @@ func runContainerWithAllConfigError(t *testing.T, cli ce.ContainerInterface, con
790790 if containerConfig .User == "" {
791791 containerConfig .User = generateRandomUID ()
792792 }
793- // if coverage
794- containerConfig .Env = append (containerConfig .Env , "COVERAGE_FILE=" + t .Name ()+ ".cov" )
795- containerConfig .Env = append (containerConfig .Env , "EXIT_CODE_FILE=" + getExitCodeFilename (t ))
793+ if coverage () {
794+ containerConfig .Env = append (containerConfig .Env , "COVERAGE_FILE=" + t .Name ()+ ".cov" )
795+ containerConfig .Env = append (containerConfig .Env , "EXIT_CODE_FILE=" + getExitCodeFilename (t ))
796+ }
796797 t .Logf ("Running container (%s)" , containerConfig .Image )
797798 ID , err := cli .ContainerCreate (containerConfig , hostConfig , networkingConfig , containerName )
798799 if err != nil {
0 commit comments