Review: inline test; compute result.Combined() only once
@@ -322,10 +322,7 @@ func TestExternalFilesWithRegistry(t *testing.T) {
r := startRegistry(t)
defer r.Stop(t)
registry := r.GetAddress(t)
- t.Run("externalFiles", testExternalFiles(registry))
-}
-func testExternalFiles(registry string) func(*testing.T) {
- return func(t *testing.T) {
+
dir := fs.NewDir(t, "testexternalfiles",
fs.WithDir("externalfiles.dockerapp", fs.FromDir("testdata/externalfiles.dockerapp")),
)
@@ -335,11 +332,12 @@ func testExternalFiles(registry string) func(*testing.T) {
// inspect will run the core pull code too
result := icmd.RunCommand(dockerApp, "inspect", registry+"/acmecorp/externalfiles.dockerapp:0.1.0")
result.Assert(t, icmd.Success)
- assert.Assert(t, strings.Contains(result.Combined(), "config.cfg"))
+ resultOutput := result.Combined()
+ assert.Assert(t, strings.Contains(resultOutput, "config.cfg"))
nestedpath := filepath.Join("nesteddir", "config2.cfg")
- assert.Assert(t, strings.Contains(result.Combined(), nestedpath))
+ assert.Assert(t, strings.Contains(resultOutput, nestedpath))
deepnestedpath := filepath.Join("nesteddir", "nested2", "nested3", "config3.cfg")
- assert.Assert(t, strings.Contains(result.Combined(), deepnestedpath))
+ assert.Assert(t, strings.Contains(resultOutput, deepnestedpath))
// Test forking with external files
tempDir := fs.NewDir(t, "dockerapptest")
@@ -353,4 +351,3 @@ func testExternalFiles(registry string) func(*testing.T) {
nestedExternalFile := golden.Get(t, tempDir.Join("externalfiles.dockerapp", "nesteddir", "config2.cfg"))
assert.Assert(t, golden.Bytes(nestedExternalFile, filepath.Join("externalfiles.dockerapp", "nesteddir", "config2.cfg")))
}
-}
