@@ -78,7 +78,7 @@ func testRenderApp(appPath string, env ...string) func(*testing.T) {
7878}
7979
8080func TestRenderFormatters (t * testing.T ) {
81- appPath := filepath .Join ("testdata" , "fork " , "simple.dockerapp" )
81+ appPath := filepath .Join ("testdata" , "simple " , "simple.dockerapp" )
8282 result := icmd .RunCommand (dockerApp , "render" , "--formatter" , "json" , appPath ).Assert (t , icmd .Success )
8383 assert .Assert (t , golden .String (result .Stdout (), "expected-json-render.golden" ))
8484
@@ -234,47 +234,21 @@ func TestWithRegistry(t *testing.T) {
234234 r := startRegistry (t )
235235 defer r .Stop (t )
236236 registry := r .GetAddress (t )
237- t .Run ("image" , testImage (registry ))
238- t .Run ("fork" , testFork (registry ))
239- }
240-
241- func testImage (registry string ) func (* testing.T ) {
242- return func (t * testing.T ) {
243- // push to a registry
244- icmd .RunCommand (dockerApp , "push" , "--namespace" , registry + "/myuser" , "testdata/render/envvariables/my.dockerapp" ).Assert (t , icmd .Success )
245- icmd .RunCommand (dockerApp , "push" , "--namespace" , registry + "/myuser" , "-t" , "latest" , "testdata/render/envvariables/my.dockerapp" ).Assert (t , icmd .Success )
246- icmd .RunCommand (dockerApp , "inspect" , registry + "/myuser/my.dockerapp:0.1.0" ).Assert (t , icmd .Success )
247- icmd .RunCommand (dockerApp , "inspect" , registry + "/myuser/my.dockerapp" ).Assert (t , icmd .Success )
248- icmd .RunCommand (dockerApp , "inspect" , registry + "/myuser/my" ).Assert (t , icmd .Success )
249- icmd .RunCommand (dockerApp , "inspect" , registry + "/myuser/my:0.1.0" ).Assert (t , icmd .Success )
250- // push a single-file app to a registry
251- dir := fs .NewDir (t , "save-prepare-build" , fs .WithFile ("my.dockerapp" , singleFileApp ))
252- defer dir .Remove ()
253- icmd .RunCommand (dockerApp , "push" , "--namespace" , registry + "/myuser" , dir .Join ("my.dockerapp" )).Assert (t , icmd .Success )
254-
255- // push with custom repo name
256- icmd .RunCommand (dockerApp , "push" , "-t" , "marshmallows" , "--namespace" , registry + "/rainbows" , "--repo" , "unicorns" , "testdata/render/envvariables/my.dockerapp" ).Assert (t , icmd .Success )
257- icmd .RunCommand (dockerApp , "inspect" , registry + "/rainbows/unicorns:marshmallows" ).Assert (t , icmd .Success )
258- }
259- }
260-
261- func testFork (registry string ) func (* testing.T ) {
262- return func (t * testing.T ) {
263- icmd .RunCommand (dockerApp , "push" , "--namespace" , registry + "/acmecorp" , "testdata/fork/simple" ).Assert (t , icmd .Success )
264-
265- tempDir := fs .NewDir (t , "dockerapptest" )
266- defer tempDir .Remove ()
267-
268- icmd .RunCommand (dockerApp , "fork" , registry + "/acmecorp/simple.dockerapp:1.1.0-beta1" , "acmecorp/scarlet.devil" ,
269- "-p" , tempDir .Path (), "-m" , "Remilia Scarlet:remilia@acmecorp.cool" ).Assert (t , icmd .Success )
270- metadata := golden .Get (t , tempDir .Join ("scarlet.devil.dockerapp" , "metadata.yml" ))
271- assert .Assert (t , golden .Bytes (metadata , "expected-fork-metadata.golden" ))
237+ // push to a registry
238+ icmd .RunCommand (dockerApp , "push" , "--namespace" , registry + "/myuser" , "testdata/render/envvariables/my.dockerapp" ).Assert (t , icmd .Success )
239+ icmd .RunCommand (dockerApp , "push" , "--namespace" , registry + "/myuser" , "-t" , "latest" , "testdata/render/envvariables/my.dockerapp" ).Assert (t , icmd .Success )
240+ icmd .RunCommand (dockerApp , "inspect" , registry + "/myuser/my.dockerapp:0.1.0" ).Assert (t , icmd .Success )
241+ icmd .RunCommand (dockerApp , "inspect" , registry + "/myuser/my.dockerapp" ).Assert (t , icmd .Success )
242+ icmd .RunCommand (dockerApp , "inspect" , registry + "/myuser/my" ).Assert (t , icmd .Success )
243+ icmd .RunCommand (dockerApp , "inspect" , registry + "/myuser/my:0.1.0" ).Assert (t , icmd .Success )
244+ // push a single-file app to a registry
245+ dir := fs .NewDir (t , "save-prepare-build" , fs .WithFile ("my.dockerapp" , singleFileApp ))
246+ defer dir .Remove ()
247+ icmd .RunCommand (dockerApp , "push" , "--namespace" , registry + "/myuser" , dir .Join ("my.dockerapp" )).Assert (t , icmd .Success )
272248
273- icmd .RunCommand (dockerApp , "fork" , registry + "/acmecorp/simple.dockerapp:1.1.0-beta1" ,
274- "-p" , tempDir .Path (), "-m" , "Remilia Scarlet:remilia@acmecorp.cool" ).Assert (t , icmd .Success )
275- metadata2 := golden .Get (t , tempDir .Join ("simple.dockerapp" , "metadata.yml" ))
276- assert .Assert (t , golden .Bytes (metadata2 , "expected-fork-metadata-no-rename.golden" ))
277- }
249+ // push with custom repo name
250+ icmd .RunCommand (dockerApp , "push" , "-t" , "marshmallows" , "--namespace" , registry + "/rainbows" , "--repo" , "unicorns" , "testdata/render/envvariables/my.dockerapp" ).Assert (t , icmd .Success )
251+ icmd .RunCommand (dockerApp , "inspect" , registry + "/rainbows/unicorns:marshmallows" ).Assert (t , icmd .Success )
278252}
279253
280254func TestAttachmentsWithRegistry (t * testing.T ) {
@@ -298,16 +272,4 @@ func TestAttachmentsWithRegistry(t *testing.T) {
298272 assert .Assert (t , strings .Contains (resultOutput , "config.cfg" ))
299273 assert .Assert (t , strings .Contains (resultOutput , "nesteddir/config2.cfg" ))
300274 assert .Assert (t , strings .Contains (resultOutput , "nesteddir/nested2/nested3/config3.cfg" ))
301-
302- // Test forking with external files
303- tempDir := fs .NewDir (t , "dockerapptest" )
304- defer tempDir .Remove ()
305-
306- icmd .RunCommand (dockerApp , "fork" , registry + "/acmecorp/attachments.dockerapp:0.1.0" ,
307- "-p" , tempDir .Path ()).Assert (t , icmd .Success )
308- externalFile := golden .Get (t , tempDir .Join ("attachments.dockerapp" , "config.cfg" ))
309- assert .Assert (t , golden .Bytes (externalFile , filepath .Join ("attachments.dockerapp" , "config.cfg" )))
310-
311- nestedAttachment := golden .Get (t , tempDir .Join ("attachments.dockerapp" , "nesteddir" , "config2.cfg" ))
312- assert .Assert (t , golden .Bytes (nestedAttachment , filepath .Join ("attachments.dockerapp" , "nesteddir" , "config2.cfg" )))
313275}
0 commit comments