@@ -177,6 +177,23 @@ func TestInspectApp(t *testing.T) {
177
177
})
178
178
}
179
179
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
+
180
197
func TestDockerAppLifecycle (t * testing.T ) {
181
198
t .Run ("withBindMounts" , func (t * testing.T ) {
182
199
testDockerAppLifecycle (t , true )
@@ -189,18 +206,21 @@ func TestDockerAppLifecycle(t *testing.T) {
189
206
func testDockerAppLifecycle (t * testing.T , useBindMount bool ) {
190
207
cmd , cleanup := dockerCli .createTestCmd ()
191
208
defer cleanup ()
192
- appName := strings .Replace (t .Name (), "/" , "_" , 1 )
209
+ appName := strings .ToLower ( strings . Replace (t .Name (), "/" , "_" , 1 ) )
193
210
tmpDir := fs .NewDir (t , appName )
194
211
defer tmpDir .Remove ()
195
212
// Running a swarm using docker in docker to install the application
196
213
// 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=" )
199
216
defer swarm .Stop (t )
200
217
initializeDockerAppEnvironment (t , & cmd , tmpDir , swarm , useBindMount )
201
218
219
+ cmd .Command = dockerCli .Command ("app" , "build" , "--tag" , appName , "testdata/simple" )
220
+ icmd .RunCmd (cmd ).Assert (t , icmd .Success )
221
+
202
222
// 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 )
204
224
icmd .RunCmd (cmd ).Assert (t , icmd.Expected {
205
225
ExitCode : 1 ,
206
226
Err : "error decoding 'Ports': Invalid hostPort: -1" ,
@@ -222,7 +242,7 @@ func testDockerAppLifecycle(t *testing.T, useBindMount bool) {
222
242
})
223
243
224
244
// 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 )
226
246
checkContains (t , icmd .RunCmd (cmd ).Assert (t , icmd .Success ).Combined (),
227
247
[]string {
228
248
fmt .Sprintf ("WARNING: installing over previously failed installation %q" , appName ),
@@ -243,7 +263,7 @@ func testDockerAppLifecycle(t *testing.T, useBindMount bool) {
243
263
})
244
264
245
265
// 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 )
247
267
icmd .RunCmd (cmd ).Assert (t , icmd.Expected {
248
268
ExitCode : 1 ,
249
269
Err : fmt .Sprintf ("Installation %q already exists, use 'docker app update' instead" , appName ),
@@ -315,7 +335,8 @@ func TestCredentials(t *testing.T) {
315
335
"--credential" , "secret1=foo" ,
316
336
// secret2 deliberately omitted.
317
337
"--credential" , "secret3=baz" ,
318
- "--name" , "missing" , bundle ,
338
+ "--name" , "missing" ,
339
+ "--cnab-bundle-json" , bundle ,
319
340
)
320
341
result := icmd .RunCmd (cmd ).Assert (t , icmd.Expected {
321
342
ExitCode : 1 ,
@@ -330,7 +351,8 @@ func TestCredentials(t *testing.T) {
330
351
"--credential" , "secret1=foo" ,
331
352
"--credential" , "secret2=bar" ,
332
353
"--credential" , "secret3=baz" ,
333
- "--name" , "full" , bundle ,
354
+ "--name" , "full" ,
355
+ "--cnab-bundle-json" , bundle ,
334
356
)
335
357
result := icmd .RunCmd (cmd ).Assert (t , icmd .Success )
336
358
golden .Assert (t , result .Stdout (), "credential-install-full.golden" )
@@ -341,7 +363,8 @@ func TestCredentials(t *testing.T) {
341
363
"app" , "run" ,
342
364
"--credential-set" , "test-creds" ,
343
365
"--credential" , "secret3=xyzzy" ,
344
- "--name" , "mixed-credstore" , bundle ,
366
+ "--name" , "mixed-credstore" ,
367
+ "--cnab-bundle-json" , bundle ,
345
368
)
346
369
result := icmd .RunCmd (cmd ).Assert (t , icmd .Success )
347
370
golden .Assert (t , result .Stdout (), "credential-install-mixed-credstore.golden" )
@@ -352,7 +375,8 @@ func TestCredentials(t *testing.T) {
352
375
"app" , "run" ,
353
376
"--credential-set" , tmpDir .Join ("local" , "test-creds.yaml" ),
354
377
"--credential" , "secret3=xyzzy" ,
355
- "--name" , "mixed-local-cred" , bundle ,
378
+ "--name" , "mixed-local-cred" ,
379
+ "--cnab-bundle-json" , bundle ,
356
380
)
357
381
result := icmd .RunCmd (cmd ).Assert (t , icmd .Success )
358
382
golden .Assert (t , result .Stdout (), "credential-install-mixed-local-cred.golden" )
@@ -364,7 +388,8 @@ func TestCredentials(t *testing.T) {
364
388
"--credential-set" , "test-creds" ,
365
389
"--credential" , "secret1=overload" ,
366
390
"--credential" , "secret3=xyzzy" ,
367
- "--name" , "overload" , bundle ,
391
+ "--name" , "overload" ,
392
+ "--cnab-bundle-json" , bundle ,
368
393
)
369
394
result := icmd .RunCmd (cmd ).Assert (t , icmd.Expected {
370
395
ExitCode : 1 ,
0 commit comments