Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 3092d1a

Browse files
authored
Merge pull request #75 from mnottale/e2e-test-pack
e2e: Test pack/unpack.
2 parents 5e6150e + b284841 commit 3092d1a

File tree

5 files changed

+358
-1
lines changed

5 files changed

+358
-1
lines changed

Gopkg.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/binary_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414

1515
"github.com/gotestyourself/gotestyourself/assert"
1616
"github.com/gotestyourself/gotestyourself/fs"
17+
"github.com/gotestyourself/gotestyourself/icmd"
1718

1819
"github.com/docker/lunchbox/utils"
1920
)
@@ -31,6 +32,9 @@ func getBinary(t *testing.T) (string, bool) {
3132
if binName == "" {
3233
t.Error("cannot locate docker-app binary")
3334
}
35+
var err error
36+
binName, err = filepath.Abs(binName)
37+
assert.NilError(t, err, "failed to convert dockerApp path to absolute")
3438
cmd := exec.Command(binName, "version")
3539
output, err := cmd.CombinedOutput()
3640
assert.NilError(t, err, "failed to execute %s", binName)
@@ -140,3 +144,35 @@ func TestInitBinary(t *testing.T) {
140144

141145
assert.Assert(t, fs.Equal(dirName, manifest))
142146
}
147+
148+
func TestPackBinary(t *testing.T) {
149+
dockerApp, hasExperimental := getBinary(t)
150+
if !hasExperimental {
151+
t.Skip("experimental mode needed for this test")
152+
}
153+
tempDir, err := ioutil.TempDir("", "dockerapp")
154+
assert.NilError(t, err)
155+
defer os.RemoveAll(tempDir)
156+
result := icmd.RunCommand(dockerApp, "pack", "helm", "-o", filepath.Join(tempDir, "test.dockerapp"))
157+
result.Assert(t, icmd.Success)
158+
// check that our commands run on the packed version
159+
result = icmd.RunCommand(dockerApp, "inspect", filepath.Join(tempDir, "test"))
160+
result.Assert(t, icmd.Success)
161+
assert.Assert(t, strings.Contains(result.Stdout(), "name: helm"))
162+
result = icmd.RunCommand(dockerApp, "render", filepath.Join(tempDir, "test"))
163+
result.Assert(t, icmd.Success)
164+
assert.Assert(t, strings.Contains(result.Stdout(), "nginx"))
165+
cwd, err := os.Getwd()
166+
assert.NilError(t, err)
167+
os.Chdir(tempDir)
168+
result = icmd.RunCommand(dockerApp, "helm", "test")
169+
result.Assert(t, icmd.Success)
170+
_, err = os.Stat("test.chart/Chart.yaml")
171+
assert.NilError(t, err)
172+
os.Mkdir("output", 0755)
173+
result = icmd.RunCommand(dockerApp, "unpack", "test", "-o", "output")
174+
result.Assert(t, icmd.Success)
175+
_, err = os.Stat("output/test.dockerapp/docker-compose.yml")
176+
assert.NilError(t, err)
177+
os.Chdir(cwd)
178+
}

vendor/github.com/gotestyourself/gotestyourself/icmd/command.go

Lines changed: 284 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/gotestyourself/gotestyourself/icmd/exitcode.go

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/gotestyourself/gotestyourself/icmd/ops.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)