From 3ae6c52e8a64ab55b29896bc10f4156962b5ee7e Mon Sep 17 00:00:00 2001 From: Milas Bowman Date: Thu, 16 Jun 2022 09:37:06 -0400 Subject: [PATCH] e2e: add extra tools needed for ddev test Signed-off-by: Milas Bowman --- pkg/e2e/ddev_test.go | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/pkg/e2e/ddev_test.go b/pkg/e2e/ddev_test.go index 63217f95c..e4f447106 100644 --- a/pkg/e2e/ddev_test.go +++ b/pkg/e2e/ddev_test.go @@ -42,15 +42,17 @@ func TestComposeRunDdev(t *testing.T) { // ddev shells out to `docker` and `docker-compose` (standalone), so a // temporary directory is created with symlinks to system Docker and the // locally-built standalone Compose binary to use as PATH + requiredTools := []string{ + findToolInPath(t, DockerExecutableName), + ComposeStandalonePath(t), + findToolInPath(t, "tar"), + findToolInPath(t, "gzip"), + } pathDir := t.TempDir() - dockerBin, err := exec.LookPath(DockerExecutableName) - require.NoError(t, err, "Could not find %q in path", DockerExecutableName) - require.NoError(t, os.Symlink(dockerBin, filepath.Join(pathDir, DockerExecutableName)), - "Could not create %q symlink", DockerExecutableName) - - composeBin := ComposeStandalonePath(t) - require.NoError(t, os.Symlink(composeBin, filepath.Join(pathDir, DockerComposeExecutableName)), - "Could not create %q symlink", DockerComposeExecutableName) + for _, tool := range requiredTools { + require.NoError(t, os.Symlink(tool, filepath.Join(pathDir, filepath.Base(tool))), + "Could not create symlink for %q", tool) + } c := NewCLI(t, WithEnv( "DDEV_DEBUG=true", @@ -97,3 +99,10 @@ func TestComposeRunDdev(t *testing.T) { fmt.Println(out) assert.Assert(t, strings.Contains(out, "ddev is working"), "Could not start project") } + +func findToolInPath(t testing.TB, name string) string { + t.Helper() + binPath, err := exec.LookPath(name) + require.NoError(t, err, "Could not find %q in path", name) + return binPath +}