@@ -177,6 +177,23 @@ func TestInspectApp(t *testing.T) {
177177 })
178178}
179179
180+ func TestRunOnlyOne (t * testing.T ) {
181+ cmd , cleanup := dockerCli .createTestCmd ()
182+ defer cleanup ()
183+
184+ cmd .Command = dockerCli .Command ("app" , "run" )
185+ icmd .RunCmd (cmd ).Assert (t , icmd.Expected {
186+ ExitCode : 1 ,
187+ Err : `"docker app run" requires exactly 1 argument.` ,
188+ })
189+
190+ cmd .Command = dockerCli .Command ("app" , "run" , "--cnab-bundle-json" , "bundle.json" , "myapp" )
191+ icmd .RunCmd (cmd ).Assert (t , icmd.Expected {
192+ ExitCode : 1 ,
193+ Err : `"docker app run" cannot run a bundle and an app image` ,
194+ })
195+ }
196+
180197func TestDockerAppLifecycle (t * testing.T ) {
181198 t .Run ("withBindMounts" , func (t * testing.T ) {
182199 testDockerAppLifecycle (t , true )
@@ -189,18 +206,21 @@ func TestDockerAppLifecycle(t *testing.T) {
189206func testDockerAppLifecycle (t * testing.T , useBindMount bool ) {
190207 cmd , cleanup := dockerCli .createTestCmd ()
191208 defer cleanup ()
192- appName := strings .Replace (t .Name (), "/" , "_" , 1 )
209+ appName := strings .ToLower ( strings . Replace (t .Name (), "/" , "_" , 1 ) )
193210 tmpDir := fs .NewDir (t , appName )
194211 defer tmpDir .Remove ()
195212 // Running a swarm using docker in docker to install the application
196213 // and run the invocation image
197- swarm := NewContainer ("docker:18.09 -dind" , 2375 )
198- swarm .Start (t )
214+ swarm := NewContainer ("docker:19.03.3 -dind" , 2375 )
215+ swarm .Start (t , "-e" , "DOCKER_TLS_CERTDIR=" )
199216 defer swarm .Stop (t )
200217 initializeDockerAppEnvironment (t , & cmd , tmpDir , swarm , useBindMount )
201218
219+ cmd .Command = dockerCli .Command ("app" , "build" , "--tag" , appName , "testdata/simple" )
220+ icmd .RunCmd (cmd ).Assert (t , icmd .Success )
221+
202222 // Install an illformed Docker Application Package
203- cmd .Command = dockerCli .Command ("app" , "run" , "testdata/simple/simple.dockerapp" , "--set" , "web_port=-1" , "--name" , appName )
223+ cmd .Command = dockerCli .Command ("app" , "run" , appName , "--set" , "web_port=-1" , "--name" , appName )
204224 icmd .RunCmd (cmd ).Assert (t , icmd.Expected {
205225 ExitCode : 1 ,
206226 Err : "error decoding 'Ports': Invalid hostPort: -1" ,
@@ -222,7 +242,7 @@ func testDockerAppLifecycle(t *testing.T, useBindMount bool) {
222242 })
223243
224244 // Install a Docker Application Package with an existing failed installation is fine
225- cmd .Command = dockerCli .Command ("app" , "run" , "testdata/simple/simple.dockerapp" , "--name" , appName )
245+ cmd .Command = dockerCli .Command ("app" , "run" , appName , "--name" , appName )
226246 checkContains (t , icmd .RunCmd (cmd ).Assert (t , icmd .Success ).Combined (),
227247 []string {
228248 fmt .Sprintf ("WARNING: installing over previously failed installation %q" , appName ),
@@ -243,7 +263,7 @@ func testDockerAppLifecycle(t *testing.T, useBindMount bool) {
243263 })
244264
245265 // Installing again the same application is forbidden
246- cmd .Command = dockerCli .Command ("app" , "run" , "testdata/simple/simple.dockerapp" , "--name" , appName )
266+ cmd .Command = dockerCli .Command ("app" , "run" , appName , "--name" , appName )
247267 icmd .RunCmd (cmd ).Assert (t , icmd.Expected {
248268 ExitCode : 1 ,
249269 Err : fmt .Sprintf ("Installation %q already exists, use 'docker app update' instead" , appName ),
@@ -315,7 +335,8 @@ func TestCredentials(t *testing.T) {
315335 "--credential" , "secret1=foo" ,
316336 // secret2 deliberately omitted.
317337 "--credential" , "secret3=baz" ,
318- "--name" , "missing" , bundle ,
338+ "--name" , "missing" ,
339+ "--cnab-bundle-json" , bundle ,
319340 )
320341 result := icmd .RunCmd (cmd ).Assert (t , icmd.Expected {
321342 ExitCode : 1 ,
@@ -330,7 +351,8 @@ func TestCredentials(t *testing.T) {
330351 "--credential" , "secret1=foo" ,
331352 "--credential" , "secret2=bar" ,
332353 "--credential" , "secret3=baz" ,
333- "--name" , "full" , bundle ,
354+ "--name" , "full" ,
355+ "--cnab-bundle-json" , bundle ,
334356 )
335357 result := icmd .RunCmd (cmd ).Assert (t , icmd .Success )
336358 golden .Assert (t , result .Stdout (), "credential-install-full.golden" )
@@ -341,7 +363,8 @@ func TestCredentials(t *testing.T) {
341363 "app" , "run" ,
342364 "--credential-set" , "test-creds" ,
343365 "--credential" , "secret3=xyzzy" ,
344- "--name" , "mixed-credstore" , bundle ,
366+ "--name" , "mixed-credstore" ,
367+ "--cnab-bundle-json" , bundle ,
345368 )
346369 result := icmd .RunCmd (cmd ).Assert (t , icmd .Success )
347370 golden .Assert (t , result .Stdout (), "credential-install-mixed-credstore.golden" )
@@ -352,7 +375,8 @@ func TestCredentials(t *testing.T) {
352375 "app" , "run" ,
353376 "--credential-set" , tmpDir .Join ("local" , "test-creds.yaml" ),
354377 "--credential" , "secret3=xyzzy" ,
355- "--name" , "mixed-local-cred" , bundle ,
378+ "--name" , "mixed-local-cred" ,
379+ "--cnab-bundle-json" , bundle ,
356380 )
357381 result := icmd .RunCmd (cmd ).Assert (t , icmd .Success )
358382 golden .Assert (t , result .Stdout (), "credential-install-mixed-local-cred.golden" )
@@ -364,7 +388,8 @@ func TestCredentials(t *testing.T) {
364388 "--credential-set" , "test-creds" ,
365389 "--credential" , "secret1=overload" ,
366390 "--credential" , "secret3=xyzzy" ,
367- "--name" , "overload" , bundle ,
391+ "--name" , "overload" ,
392+ "--cnab-bundle-json" , bundle ,
368393 )
369394 result := icmd .RunCmd (cmd ).Assert (t , icmd.Expected {
370395 ExitCode : 1 ,
0 commit comments