From 2bb67f2700de3af67ea592ce40b965d2a8d1b588 Mon Sep 17 00:00:00 2001 From: Guillaume Lours <705411+glours@users.noreply.github.com> Date: Wed, 13 Nov 2024 12:13:23 +0100 Subject: [PATCH] remove ddev e2e tests Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com> --- pkg/e2e/ddev_test.go | 106 ------------------------------------------- 1 file changed, 106 deletions(-) delete mode 100644 pkg/e2e/ddev_test.go diff --git a/pkg/e2e/ddev_test.go b/pkg/e2e/ddev_test.go deleted file mode 100644 index faffb311cbf..00000000000 --- a/pkg/e2e/ddev_test.go +++ /dev/null @@ -1,106 +0,0 @@ -/* - Copyright 2020 Docker Compose CLI authors - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package e2e - -import ( - "fmt" - "os" - "os/exec" - "path/filepath" - "runtime" - "strings" - "testing" - - "github.com/stretchr/testify/require" - "gotest.tools/v3/assert" -) - -const ddevVersion = "v1.21.1" - -func TestComposeRunDdev(t *testing.T) { - if !composeStandaloneMode { - t.Skip("Not running in plugin mode - ddev only supports invoking standalone `docker-compose`") - } - if runtime.GOOS == "windows" { - t.Skip("Running on Windows. Skipping...") - } - - // 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() - 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", - fmt.Sprintf("PATH=%s", pathDir), - )) - - ddevDir := t.TempDir() - siteName := filepath.Base(ddevDir) - - t.Cleanup(func() { - _ = c.RunCmdInDir(t, ddevDir, "./ddev", "delete", "-Oy") - _ = c.RunCmdInDir(t, ddevDir, "./ddev", "poweroff") - }) - - osName := "linux" - if runtime.GOOS == "darwin" { - osName = "macos" - } - - compressedFilename := fmt.Sprintf("ddev_%s-%s.%s.tar.gz", osName, runtime.GOARCH, ddevVersion) - c.RunCmdInDir(t, ddevDir, "curl", "-LO", fmt.Sprintf("https://github.com/ddev/ddev/releases/download/%s/%s", - ddevVersion, - compressedFilename)) - - c.RunCmdInDir(t, ddevDir, "tar", "-xzf", compressedFilename) - - // Create a simple index.php we can test against. - c.RunCmdInDir(t, ddevDir, "sh", "-c", "echo 'index.php") - - c.RunCmdInDir(t, ddevDir, "./ddev", "config", "--auto") - c.RunCmdInDir(t, ddevDir, "./ddev", "config", "global", "--use-docker-compose-from-path") - vRes := c.RunCmdInDir(t, ddevDir, "./ddev", "version") - out := vRes.Stdout() - fmt.Printf("ddev version: %s\n", out) - - c.RunCmdInDir(t, ddevDir, "./ddev", "poweroff") - - c.RunCmdInDir(t, ddevDir, "./ddev", "start", "-y") - - curlRes := c.RunCmdInDir(t, ddevDir, "curl", "-sSL", fmt.Sprintf("http://%s.ddev.site", siteName)) - out = curlRes.Stdout() - 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 -}