From 2420240e9ffd92705948e3ef1bc28572236ad356 Mon Sep 17 00:00:00 2001 From: Derek Nola Date: Thu, 12 Dec 2024 15:01:50 -0800 Subject: [PATCH 1/6] Migrate conformance docker test Switch to hydrophone from sonobuoy Support serial conformance Signed-off-by: Derek Nola --- tests/docker/conformance/conformance_test.go | 98 ++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 tests/docker/conformance/conformance_test.go diff --git a/tests/docker/conformance/conformance_test.go b/tests/docker/conformance/conformance_test.go new file mode 100644 index 000000000000..6c0d3397cd46 --- /dev/null +++ b/tests/docker/conformance/conformance_test.go @@ -0,0 +1,98 @@ +package main + +import ( + "flag" + "fmt" + "os" + "path/filepath" + "runtime" + "testing" + + "github.com/k3s-io/k3s/tests" + tester "github.com/k3s-io/k3s/tests/docker" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +var k3sImage = flag.String("k3sImage", "", "The k3s image used to provision containers") +var serial = flag.Bool("serial", false, "Run the Serial Conformance Tests") +var config *tester.TestConfig + +func Test_DockerConformance(t *testing.T) { + flag.Parse() + RegisterFailHandler(Fail) + RunSpecs(t, "Conformance Docker Test Suite") +} + +var _ = Describe("Conformance Tests", Ordered, func() { + + Context("Setup Cluster", func() { + It("should provision servers and agents", func() { + var err error + config, err = tester.NewTestConfig(*k3sImage) + Expect(err).NotTo(HaveOccurred()) + Expect(config.ProvisionServers(1)).To(Succeed()) + Expect(config.ProvisionAgents(1)).To(Succeed()) + Eventually(func() error { + return tests.CheckDefaultDeployments(config.KubeconfigFile) + }, "90s", "5s").Should(Succeed()) + Eventually(func() error { + return tests.NodesReady(config.KubeconfigFile, config.GetNodeNames()) + }, "40s", "5s").Should(Succeed()) + }) + }) + Context("Run Hydrophone Conformance tests", func() { + It("should download hydrophone", func() { + hydrophoneVersion := "v0.6.0" + hydrophoneArch := runtime.GOARCH + if hydrophoneArch == "amd64" { + hydrophoneArch = "x86_64" + } + hydrophoneURL := fmt.Sprintf("https://github.com/kubernetes-sigs/hydrophone/releases/download/%s/hydrophone_Linux_%s.tar.gz", + hydrophoneVersion, hydrophoneArch) + cmd := fmt.Sprintf("curl -L %s | tar -xzf - -C %s", hydrophoneURL, config.TestDir) + _, err := tester.RunCommand(cmd) + Expect(err).NotTo(HaveOccurred()) + Expect(os.Chmod(filepath.Join(config.TestDir, "hydrophone"), 0755)).To(Succeed()) + }) + // Takes about 15min to run, so expect nothing to happen for a while + It("should run parallel conformance tests", func() { + if *serial { + Skip("Skipping parallel conformance tests") + } + cmd := fmt.Sprintf("%s --focus=\"Conformance\" --skip=\"Serial|Flaky\" -p %d --extra-ginkgo-args=\"%s\" --kubeconfig %s", + filepath.Join(config.TestDir, "hydrophone"), + runtime.NumCPU()/2, + "--poll-progress-after=60s,--poll-progress-interval=30s", + config.KubeconfigFile) + By("Hydrophone: " + cmd) + res, err := tester.RunCommand(cmd) + Expect(err).NotTo(HaveOccurred(), res) + }) + It("should run serial conformance tests", func() { + if !*serial { + Skip("Skipping serial conformance tests") + } + cmd := fmt.Sprintf("%s -o %s --focus=\"Serial\" --skip=\"Flaky\" --extra-ginkgo-args=\"%s\" --kubeconfig %s", + filepath.Join(config.TestDir, "hydrophone"), + filepath.Join(config.TestDir, "logs"), + "--poll-progress-after=60s,--poll-progress-interval=30s", + config.KubeconfigFile) + By("Hydrophone: " + cmd) + res, err := tester.RunCommand(cmd) + Expect(err).NotTo(HaveOccurred(), res) + }) + }) + +}) + +var failed bool +var _ = AfterEach(func() { + failed = failed || CurrentSpecReport().Failed() +}) + +var _ = AfterSuite(func() { + if config != nil && !failed { + config.Cleanup() + } +}) From c4ca94b57107ee46f16d29058f405cbff71e5df2 Mon Sep 17 00:00:00 2001 From: Derek Nola Date: Tue, 21 Jan 2025 15:09:48 -0800 Subject: [PATCH 2/6] Replace docker tests with go version on arm32 Drone pipeline Signed-off-by: Derek Nola --- scripts/test | 34 ++++++++++++++++------------ tests/docker/upgrade/upgrade_test.go | 1 + 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/scripts/test b/scripts/test index 7e364a53f258..9bd2ee4cbd66 100755 --- a/scripts/test +++ b/scripts/test @@ -19,32 +19,34 @@ mkdir -p $artifacts docker ps +export K3S_IMAGE="rancher/k3s:${VERSION_TAG}${SUFFIX}" + # --- # Only run PR tests on arm arch, we use GitHub Actions for amd64 and arm64 # Run all tests on tag events, as we want test failures to block the release if [ "$ARCH" == 'arm' ] || [ "$DRONE_BUILD_EVENT" = 'tag' ]; then - export K3S_IMAGE="rancher/k3s:${VERSION_TAG}${SUFFIX}" go test ./tests/docker/basics/basics_test.go -k3sImage="$K3S_IMAGE" echo "Did go test basics $?" - . ./tests/docker/test-run-basics - echo "Did test-run-basics $?" + # Extract v1.XX minor version for skew and upgrade tests + minor_version=$(echo $VERSION_K8S | cut -d '.' -f1,2) - . ./tests/docker/test-run-cacerts - echo "Did test-run-cacerts $?" + go test ./tests/docker/cacerts/cacerts_test.go -k3sImage="$K3S_IMAGE" + echo "Did go test cacerts $?" - . ./tests/docker/test-run-compat - echo "Did test-run-compat $?" + go test ./tests/docker/skew/skew_test.go -k3sImage="$K3S_IMAGE" -channel="$minor_version" + echo "Did go test skew $?" - . ./tests/docker/test-run-bootstraptoken - echo "Did test-run-bootstraptoken $?" + go test ./tests/docker/bootstraptoken/bootstraptoken_test.go -k3sImage="$K3S_IMAGE" + echo "Did go test bootstraptoken $?" - . ./tests/docker/test-run-upgrade - echo "Did test-run-upgrade $?" + go test ./tests/docker/upgrade/upgrade_test.go -k3sImage="$K3S_IMAGE" -channel="$minor_version" + echo "Did go test upgrade $?" + + go test ./tests/docker/lazypull/lazypull_test.go -k3sImage="$K3S_IMAGE" + echo "Did go test lazypull $?" - . ./tests/docker/test-run-lazypull - echo "Did test-run-lazypull $?" fi @@ -72,7 +74,8 @@ if [ "$DRONE_BUILD_EVENT" = 'cron' ]; then E2E_OUTPUT=$artifacts test-run-sonobuoy serial echo "Did test-run-sonobuoy serial $?" test-run-sonobuoy etcd serial - echo "Did test-run-sonobuoy-etcd serial $?" + go test ./test/docker/conformance/conformance_test.go -k3sImage="$K3S_IMAGE" -serial + echo "Did go conformance etcd serial $?" test-run-sonobuoy mysql serial echo "Did test-run-sonobuoy-mysqk serial $?" test-run-sonobuoy postgres serial @@ -89,7 +92,8 @@ if [ "$DRONE_BUILD_EVENT" = 'cron' ]; then E2E_OUTPUT=$artifacts test-run-sonobuoy parallel echo "Did test-run-sonobuoy parallel $?" - test-run-sonobuoy etcd parallel + go test ./test/docker/conformance/conformance_test.go -k3sImage="$K3S_IMAGE" + echo "Did go conformance etcd parallel $?" echo "Did test-run-sonobuoy-etcd parallel $?" test-run-sonobuoy mysql parallel echo "Did test-run-sonobuoy-mysql parallel $?" diff --git a/tests/docker/upgrade/upgrade_test.go b/tests/docker/upgrade/upgrade_test.go index fa6250d2b5dd..7f2d20e12ca4 100644 --- a/tests/docker/upgrade/upgrade_test.go +++ b/tests/docker/upgrade/upgrade_test.go @@ -126,6 +126,7 @@ var _ = Describe("Upgrade Tests", Ordered, func() { cVersion := strings.Split(*k3sImage, ":")[1] cVersion = strings.Replace(cVersion, "-amd64", "", 1) cVersion = strings.Replace(cVersion, "-arm64", "", 1) + cVersion = strings.Replace(cVersion, "-arm", "", 1) cVersion = strings.Replace(cVersion, "-", "+", 1) Expect(out).To(ContainSubstring(cVersion)) } From 9f6ef74169d36d5f5497adec81bd969e0114a0a2 Mon Sep 17 00:00:00 2001 From: Derek Nola Date: Thu, 30 Jan 2025 12:26:07 -0800 Subject: [PATCH 3/6] Support multiple DB, push hydrophone logs to test output Signed-off-by: Derek Nola --- tests/docker/conformance/conformance_test.go | 63 ++++++++++++--- tests/docker/test-helpers.go | 81 +++++++++++++++++--- 2 files changed, 123 insertions(+), 21 deletions(-) diff --git a/tests/docker/conformance/conformance_test.go b/tests/docker/conformance/conformance_test.go index 6c0d3397cd46..b6a5bb24353c 100644 --- a/tests/docker/conformance/conformance_test.go +++ b/tests/docker/conformance/conformance_test.go @@ -4,9 +4,12 @@ import ( "flag" "fmt" "os" + "os/exec" "path/filepath" "runtime" + "strings" "testing" + "time" "github.com/k3s-io/k3s/tests" tester "github.com/k3s-io/k3s/tests/docker" @@ -15,6 +18,7 @@ import ( ) var k3sImage = flag.String("k3sImage", "", "The k3s image used to provision containers") +var db = flag.String("db", "", "The database to use for the tests (sqlite, etcd, mysql, postgres)") var serial = flag.Bool("serial", false, "Run the Serial Conformance Tests") var config *tester.TestConfig @@ -31,6 +35,7 @@ var _ = Describe("Conformance Tests", Ordered, func() { var err error config, err = tester.NewTestConfig(*k3sImage) Expect(err).NotTo(HaveOccurred()) + config.DBType = *db Expect(config.ProvisionServers(1)).To(Succeed()) Expect(config.ProvisionAgents(1)).To(Succeed()) Eventually(func() error { @@ -60,30 +65,56 @@ var _ = Describe("Conformance Tests", Ordered, func() { if *serial { Skip("Skipping parallel conformance tests") } - cmd := fmt.Sprintf("%s --focus=\"Conformance\" --skip=\"Serial|Flaky\" -p %d --extra-ginkgo-args=\"%s\" --kubeconfig %s", + cmd := fmt.Sprintf("%s --focus=\"Conformance\" --skip=\"Serial|Flaky\" -v 2 -p %d --kubeconfig %s", filepath.Join(config.TestDir, "hydrophone"), runtime.NumCPU()/2, - "--poll-progress-after=60s,--poll-progress-interval=30s", config.KubeconfigFile) By("Hydrophone: " + cmd) - res, err := tester.RunCommand(cmd) - Expect(err).NotTo(HaveOccurred(), res) + hc, err := StartCmd(cmd) + Expect(err).NotTo(HaveOccurred()) + // Periodically check the number of tests that have run, since the hydrophone output does not support a progress status + // Taken from https://github.com/kubernetes-sigs/hydrophone/issues/223#issuecomment-2547174722 + go func() { + cmd := fmt.Sprintf("kubectl exec -n=conformance e2e-conformance-test -c output-container --kubeconfig=%s -- cat /tmp/results/e2e.log | grep -o \"•\" | wc -l", + config.KubeconfigFile) + for i := 1; ; i++ { + time.Sleep(120 * time.Second) + if hc.ProcessState != nil { + break + } + res, _ := tester.RunCommand(cmd) + res = strings.TrimSpace(res) + fmt.Printf("Status Report %d: %s tests complete\n", i, res) + } + }() + Expect(hc.Wait()).To(Succeed()) }) It("should run serial conformance tests", func() { if !*serial { Skip("Skipping serial conformance tests") } - cmd := fmt.Sprintf("%s -o %s --focus=\"Serial\" --skip=\"Flaky\" --extra-ginkgo-args=\"%s\" --kubeconfig %s", + cmd := fmt.Sprintf("%s --focus=\"Serial\" --skip=\"Flaky\" -v 2 --kubeconfig %s", filepath.Join(config.TestDir, "hydrophone"), - filepath.Join(config.TestDir, "logs"), - "--poll-progress-after=60s,--poll-progress-interval=30s", config.KubeconfigFile) By("Hydrophone: " + cmd) - res, err := tester.RunCommand(cmd) - Expect(err).NotTo(HaveOccurred(), res) + hc, err := StartCmd(cmd) + Expect(err).NotTo(HaveOccurred()) + go func() { + cmd := fmt.Sprintf("kubectl exec -n=conformance e2e-conformance-test -c output-container --kubeconfig=%s -- cat /tmp/results/e2e.log | grep -o \"•\" | wc -l", + config.KubeconfigFile) + for i := 1; ; i++ { + time.Sleep(120 * time.Second) + if hc.ProcessState != nil { + break + } + res, _ := tester.RunCommand(cmd) + res = strings.TrimSpace(res) + fmt.Printf("Status Report %d: %s tests complete\n", i, res) + } + }() + Expect(hc.Wait()).To(Succeed()) }) }) - }) var failed bool @@ -96,3 +127,15 @@ var _ = AfterSuite(func() { config.Cleanup() } }) + +// StartCmd starts a command and pipes its output to +// the ginkgo Writr, with the expectation to poll the progress of the command +func StartCmd(cmd string) (*exec.Cmd, error) { + c := exec.Command("sh", "-c", cmd) + c.Stdout = GinkgoWriter + c.Stderr = GinkgoWriter + if err := c.Start(); err != nil { + return c, err + } + return c, nil +} diff --git a/tests/docker/test-helpers.go b/tests/docker/test-helpers.go index 287cbdbad9e9..cf966b676f3d 100644 --- a/tests/docker/test-helpers.go +++ b/tests/docker/test-helpers.go @@ -21,6 +21,7 @@ type TestConfig struct { KubeconfigFile string Token string K3sImage string + DBType string Servers []Server Agents []DockerNode ServerYaml string @@ -115,16 +116,28 @@ func (config *TestConfig) ProvisionServers(numOfServers int) error { yamlMount = fmt.Sprintf("--mount type=bind,src=%s,dst=/etc/rancher/k3s/config.yaml", filepath.Join(config.TestDir, fmt.Sprintf("server-%d.yaml", i))) } - var joinOrStart string - if numOfServers > 0 { - if i == 0 { - joinOrStart = "--cluster-init" - } else { - if config.Servers[0].URL == "" { - return fmt.Errorf("first server URL is empty") - } - joinOrStart = fmt.Sprintf("--server %s", config.Servers[0].URL) + var joinServer string + var dbConnect string + var err error + if config.DBType == "" && numOfServers > 1 { + config.DBType = "etcd" + } else if config.DBType == "" { + config.DBType = "sqlite" + } + if i == 0 { + dbConnect, err = config.setupDatabase(true) + if err != nil { + return err } + } else { + dbConnect, err = config.setupDatabase(false) + if err != nil { + return err + } + if config.Servers[0].URL == "" { + return fmt.Errorf("first server URL is empty") + } + joinServer = fmt.Sprintf("--server %s", config.Servers[0].URL) } newServer := Server{ DockerNode: DockerNode{ @@ -163,7 +176,7 @@ func (config *TestConfig) ProvisionServers(numOfServers int) error { } // The pipe requires that we use sh -c with "" to run the command cmd = fmt.Sprintf("/bin/sh -c \"curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC='%s' INSTALL_K3S_SKIP_DOWNLOAD=true sh -\"", - joinOrStart+" "+os.Getenv(fmt.Sprintf("SERVER_%d_ARGS", i))) + dbConnect+" "+joinServer+" "+os.Getenv(fmt.Sprintf("SERVER_%d_ARGS", i))) if out, err := newServer.RunCmdOnNode(cmd); err != nil { return fmt.Errorf("failed to start server: %s: %v", out, err) } @@ -183,7 +196,7 @@ func (config *TestConfig) ProvisionServers(numOfServers int) error { os.Getenv("REGISTRY_CLUSTER_ARGS"), yamlMount, config.K3sImage, - "server", joinOrStart, os.Getenv(fmt.Sprintf("SERVER_%d_ARGS", i))}, " ") + "server", dbConnect, joinServer, os.Getenv(fmt.Sprintf("SERVER_%d_ARGS", i))}, " ") if out, err := RunCommand(dRun); err != nil { return fmt.Errorf("failed to run server container: %s: %v", out, err) } @@ -214,6 +227,40 @@ func (config *TestConfig) ProvisionServers(numOfServers int) error { return copyAndModifyKubeconfig(config) } +// setupDatabase will start the configured database if startDB is true, +// and return the correct flag to join the configured database +func (config *TestConfig) setupDatabase(startDB bool) (string, error) { + + joinFlag := "" + startCmd := "" + switch config.DBType { + case "mysql": + startCmd = "docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=docker -p 3306:3306 mysql:8.4" + joinFlag = "--datastore-endpoint='mysql://root:docker@tcp(172.17.0.1:3306)/k3s'" + case "postgres": + startCmd = "docker run -d --name postgres -e POSTGRES_PASSWORD=docker -p 5432:5432 postgres:16-alpine" + joinFlag = "--datastore-endpoint='postgres://postgres:docker@tcp(172.17.0.1:5432)/k3s'" + case "etcd": + if startDB { + joinFlag = "--cluster-init" + } + case "sqlite": + break + default: + return "", fmt.Errorf("unsupported database type: %s", config.DBType) + } + + if startDB && startCmd != "" { + if out, err := RunCommand(startCmd); err != nil { + return "", fmt.Errorf("failed to start %s container: %s: %v", config.DBType, out, err) + } + // Wait for DB to start + time.Sleep(10 * time.Second) + } + return joinFlag, nil + +} + func (config *TestConfig) ProvisionAgents(numOfAgents int) error { if err := checkVersionSkew(config); err != nil { return err @@ -340,6 +387,18 @@ func (config *TestConfig) Cleanup() error { } } + // Stop DB if it was started + if config.DBType != "etcd" { + cmd := fmt.Sprintf("docker stop %s", config.DBType) + if _, err := RunCommand(cmd); err != nil { + errs = append(errs, fmt.Errorf("failed to stop %s: %v", config.DBType, err)) + } + cmd = fmt.Sprintf("docker rm %s", config.DBType) + if _, err := RunCommand(cmd); err != nil { + errs = append(errs, fmt.Errorf("failed to remove %s: %v", config.DBType, err)) + } + } + // Error out if we hit any issues if len(errs) > 0 { return fmt.Errorf("cleanup failed: %v", errs) From 48df4aa051d8cad5af2dee91130bc50e56b00d76 Mon Sep 17 00:00:00 2001 From: Derek Nola Date: Wed, 5 Feb 2025 09:48:12 -0800 Subject: [PATCH 4/6] Replace etcd and sqlite conformance tests with golang versions Signed-off-by: Derek Nola --- scripts/test | 14 +++++++------- tests/docker/test-helpers | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/scripts/test b/scripts/test index 9bd2ee4cbd66..f5585690d373 100755 --- a/scripts/test +++ b/scripts/test @@ -71,10 +71,9 @@ fi # --- if [ "$DRONE_BUILD_EVENT" = 'cron' ]; then - E2E_OUTPUT=$artifacts test-run-sonobuoy serial - echo "Did test-run-sonobuoy serial $?" - test-run-sonobuoy etcd serial - go test ./test/docker/conformance/conformance_test.go -k3sImage="$K3S_IMAGE" -serial + run-go-test ./test/docker/conformance/conformance_test.go -k3sImage="$K3S_IMAGE" -db sqlite -serial -ginkgo.v + echo "Did go conformance sqlite serial $?" + run-go-test ./test/docker/conformance/conformance_test.go -k3sImage="$K3S_IMAGE" -db etcd -serial -ginkgo.v echo "Did go conformance etcd serial $?" test-run-sonobuoy mysql serial echo "Did test-run-sonobuoy-mysqk serial $?" @@ -92,9 +91,10 @@ if [ "$DRONE_BUILD_EVENT" = 'cron' ]; then E2E_OUTPUT=$artifacts test-run-sonobuoy parallel echo "Did test-run-sonobuoy parallel $?" - go test ./test/docker/conformance/conformance_test.go -k3sImage="$K3S_IMAGE" - echo "Did go conformance etcd parallel $?" - echo "Did test-run-sonobuoy-etcd parallel $?" + run-go-test ./test/docker/conformance/conformance_test.go -k3sImage="$K3S_IMAGE" -db sqlite -ginkgo.v + echo "Did go conformance sqlite parallel $?" + run-go-test ./test/docker/conformance/conformance_test.go -k3sImage="$K3S_IMAGE" -db etcd -ginkgo.v + echo "Did go test conformance etcd parallel $?" test-run-sonobuoy mysql parallel echo "Did test-run-sonobuoy-mysql parallel $?" test-run-sonobuoy postgres parallel diff --git a/tests/docker/test-helpers b/tests/docker/test-helpers index 6a5335689557..61bbfa2031c9 100755 --- a/tests/docker/test-helpers +++ b/tests/docker/test-helpers @@ -525,6 +525,20 @@ run-test() { } export -f run-test +run-go-test() { + local delay=15 + ( + set +x + while [ $(count-running-tests) -ge ${MAX_CONCURRENT_TESTS:-3} ]; do + sleep $delay + done + ) + + go test -timeout=45m -v "$@" & + pids+=($!) +} +export -f run-go-test + # --- cleanup-test-env(){ From 2fa8995b485f83f3dced24923d8f8fb24a635a90 Mon Sep 17 00:00:00 2001 From: Derek Nola Date: Wed, 5 Feb 2025 11:46:16 -0800 Subject: [PATCH 5/6] Retry on flaky btrfs section Signed-off-by: Derek Nola --- tests/e2e/btrfs/btrfs_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/e2e/btrfs/btrfs_test.go b/tests/e2e/btrfs/btrfs_test.go index 716227b22e26..4b7b07855780 100644 --- a/tests/e2e/btrfs/btrfs_test.go +++ b/tests/e2e/btrfs/btrfs_test.go @@ -61,10 +61,12 @@ var _ = Describe("Verify that btrfs based servers work", Ordered, func() { }) It("Checks that btrfs snapshots exist", func() { cmd := "btrfs subvolume list /var/lib/rancher/k3s/agent/containerd/io.containerd.snapshotter.v1.btrfs" - res, err := tc.Servers[0].RunCmdOnNode(cmd) - Expect(err).NotTo(HaveOccurred()) - Expect(res).To(MatchRegexp("agent/containerd/io.containerd.snapshotter.v1.btrfs/active/\\d+")) - Expect(res).To(MatchRegexp("agent/containerd/io.containerd.snapshotter.v1.btrfs/snapshots/\\d+")) + Eventually(func(g Gomega) { + res, err := tc.Servers[0].RunCmdOnNode(cmd) + g.Expect(err).NotTo(HaveOccurred()) + g.Expect(res).To(MatchRegexp("agent/containerd/io.containerd.snapshotter.v1.btrfs/active/\\d+")) + g.Expect(res).To(MatchRegexp("agent/containerd/io.containerd.snapshotter.v1.btrfs/snapshots/\\d+")) + }, "30s", "5s").Should(Succeed()) }) }) }) From 0b0e4bc4c5f16b352c73689834bb80ee319e2220 Mon Sep 17 00:00:00 2001 From: Derek Nola Date: Wed, 5 Feb 2025 12:19:42 -0800 Subject: [PATCH 6/6] Fix db cleanup for sqlite, be explicit on the dbtype Signed-off-by: Derek Nola --- tests/docker/test-helpers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/docker/test-helpers.go b/tests/docker/test-helpers.go index cf966b676f3d..bc5baacf1464 100644 --- a/tests/docker/test-helpers.go +++ b/tests/docker/test-helpers.go @@ -388,7 +388,7 @@ func (config *TestConfig) Cleanup() error { } // Stop DB if it was started - if config.DBType != "etcd" { + if config.DBType == "mysql" || config.DBType == "postgres" { cmd := fmt.Sprintf("docker stop %s", config.DBType) if _, err := RunCommand(cmd); err != nil { errs = append(errs, fmt.Errorf("failed to stop %s: %v", config.DBType, err))