@@ -276,7 +276,15 @@ func TestBundle(t *testing.T) {
276276 assert .Assert (t , fs .Equal (tmpDir .Join ("simple.dockerapp" ), manifest ))
277277}
278278
279- func TestDockerAppLifecycle (t * testing.T ) {
279+ func TestDockerAppLifecycleWithBindMounts (t * testing.T ) {
280+ testDockerAppLifecycle (t , true )
281+ }
282+
283+ func TestDockerAppLifecycleWithoutBindMounts (t * testing.T ) {
284+ testDockerAppLifecycle (t , false )
285+ }
286+
287+ func testDockerAppLifecycle (t * testing.T , useBindMount bool ) {
280288 cmd , cleanup := dockerCli .createTestCmd ()
281289 defer cleanup ()
282290
@@ -301,13 +309,18 @@ func TestDockerAppLifecycle(t *testing.T) {
301309 cmd .Command = dockerCli .Command ("context" , "create" , "swarm-context" , "--docker" , fmt .Sprintf (`"host=tcp://%s"` , swarm .GetAddress (t )), "--default-stack-orchestrator" , "swarm" )
302310 icmd .RunCmd (cmd ).Assert (t , icmd .Success )
303311
304- // When creating a context on a Windows host we cannot use
305- // the unix socket but it's needed inside the invocation image.
306- // The workaround is to create a context with an empty host.
307- // This host will default to the unix socket inside the
308- // invocation image
309- cmd .Command = dockerCli .Command ("context" , "create" , "swarm-target-context" , "--docker" , "host=" , "--default-stack-orchestrator" , "swarm" )
310- icmd .RunCmd (cmd ).Assert (t , icmd .Success )
312+ if useBindMount {
313+ // When creating a context on a Windows host we cannot use
314+ // the unix socket but it's needed inside the invocation image.
315+ // The workaround is to create a context with an empty host.
316+ // This host will default to the unix socket inside the
317+ // invocation image
318+ cmd .Command = dockerCli .Command ("context" , "create" , "swarm-target-context" , "--docker" , "host=" , "--default-stack-orchestrator" , "swarm" )
319+ icmd .RunCmd (cmd ).Assert (t , icmd .Success )
320+ } else {
321+ cmd .Command = dockerCli .Command ("context" , "create" , "swarm-target-context" , "--docker" , fmt .Sprintf (`"host=tcp://%s"` , swarm .GetPrivateAddress (t )), "--default-stack-orchestrator" , "swarm" )
322+ icmd .RunCmd (cmd ).Assert (t , icmd .Success )
323+ }
311324
312325 // Initialize the swarm
313326 cmd .Env = append (cmd .Env , "DOCKER_CONTEXT=swarm-context" )
0 commit comments