Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fcce2be

Browse files
committed
chore(agent/agentcontainers): skip TestDockerCLIContainerLister by default
1 parent 31b1ff7 commit fcce2be

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

agent/agentcontainers/containers_internal_test.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ package agentcontainers
22

33
import (
44
"fmt"
5-
"os/exec"
6-
"runtime"
5+
"os"
76
"strconv"
87
"strings"
98
"testing"
@@ -27,15 +26,14 @@ import (
2726
// dockerCLIContainerLister.List method. It starts a container with a known
2827
// label, lists the containers, and verifies that the expected container is
2928
// returned. The container is deleted after the test is complete.
29+
// As this test creates containers, it is skipped by default.
30+
// It can be run manually as follows:
31+
//
32+
// CODER_TEST_USE_DOCKER=1 go test ./agent/agentcontainers -run TestDockerCLIContainerLister
3033
func TestDockerCLIContainerLister(t *testing.T) {
3134
t.Parallel()
32-
if runtime.GOOS != "linux" {
33-
t.Skip("creating containers on non-linux runners is slow and flaky")
34-
}
35-
36-
// Conditionally skip if Docker is not available.
37-
if _, err := exec.LookPath("docker"); err != nil {
38-
t.Skip("docker not found in PATH")
35+
if ctud, ok := os.LookupEnv("CODER_TEST_USE_DOCKER"); !ok || ctud != "1" {
36+
t.Skip("Set CODER_TEST_USE_DOCKER=1 to run this test")
3937
}
4038

4139
pool, err := dockertest.NewPool("")

0 commit comments

Comments
 (0)