|
5 | 5 | "io/ioutil" |
6 | 6 | "os" |
7 | 7 | "path/filepath" |
| 8 | + "strings" |
8 | 9 | "testing" |
9 | 10 |
|
10 | 11 | "github.com/docker/app/internal" |
@@ -260,8 +261,8 @@ func TestSplitMerge(t *testing.T) { |
260 | 261 | result = icmd.RunCommand(dockerApp, "inspect", "remerged").Assert(t, icmd.Success) |
261 | 262 | assert.Assert(t, golden.String(result.Combined(), "envvariables-inspect.golden")) |
262 | 263 | // test inplace |
263 | | - icmd.RunCommand(dockerApp, "merge", "split") |
264 | | - icmd.RunCommand(dockerApp, "split", "split") |
| 264 | + icmd.RunCommand(dockerApp, "merge", "split").Assert(t, icmd.Success) |
| 265 | + icmd.RunCommand(dockerApp, "split", "split").Assert(t, icmd.Success) |
265 | 266 | } |
266 | 267 |
|
267 | 268 | func TestURL(t *testing.T) { |
@@ -316,3 +317,38 @@ func testFork(registry string) func(*testing.T) { |
316 | 317 | assert.Assert(t, golden.Bytes(metadata2, "expected-fork-metadata-no-rename.golden")) |
317 | 318 | } |
318 | 319 | } |
| 320 | + |
| 321 | +func TestAttachmentsWithRegistry(t *testing.T) { |
| 322 | + r := startRegistry(t) |
| 323 | + defer r.Stop(t) |
| 324 | + registry := r.GetAddress(t) |
| 325 | + |
| 326 | + dir := fs.NewDir(t, "testattachments", |
| 327 | + fs.WithDir("attachments.dockerapp", fs.FromDir("testdata/attachments.dockerapp")), |
| 328 | + ) |
| 329 | + defer dir.Remove() |
| 330 | + |
| 331 | + icmd.RunCommand(dockerApp, "push", "--namespace", registry+"/acmecorp", dir.Join("attachments.dockerapp")).Assert(t, icmd.Success) |
| 332 | + |
| 333 | + // inspect will run the core pull code too |
| 334 | + result := icmd.RunCommand(dockerApp, "inspect", registry+"/acmecorp/attachments.dockerapp:0.1.0") |
| 335 | + |
| 336 | + result.Assert(t, icmd.Success) |
| 337 | + resultOutput := result.Combined() |
| 338 | + |
| 339 | + assert.Assert(t, strings.Contains(resultOutput, "config.cfg")) |
| 340 | + assert.Assert(t, strings.Contains(resultOutput, "nesteddir/config2.cfg")) |
| 341 | + assert.Assert(t, strings.Contains(resultOutput, "nesteddir/nested2/nested3/config3.cfg")) |
| 342 | + |
| 343 | + // Test forking with external files |
| 344 | + tempDir := fs.NewDir(t, "dockerapptest") |
| 345 | + defer tempDir.Remove() |
| 346 | + |
| 347 | + icmd.RunCommand(dockerApp, "fork", registry+"/acmecorp/attachments.dockerapp:0.1.0", |
| 348 | + "-p", tempDir.Path()).Assert(t, icmd.Success) |
| 349 | + externalFile := golden.Get(t, tempDir.Join("attachments.dockerapp", "config.cfg")) |
| 350 | + assert.Assert(t, golden.Bytes(externalFile, filepath.Join("attachments.dockerapp", "config.cfg"))) |
| 351 | + |
| 352 | + nestedAttachment := golden.Get(t, tempDir.Join("attachments.dockerapp", "nesteddir", "config2.cfg")) |
| 353 | + assert.Assert(t, golden.Bytes(nestedAttachment, filepath.Join("attachments.dockerapp", "nesteddir", "config2.cfg"))) |
| 354 | +} |
0 commit comments