Skip to content

Commit e76af04

Browse files
committed
ctud
1 parent 8c357b4 commit e76af04

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

agent/agentcontainers/containers_internal_test.go

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

33
import (
44
"fmt"
5-
"runtime"
5+
"os"
66
"strconv"
77
"strings"
88
"testing"
@@ -29,10 +29,14 @@ import (
2929
// label, lists the containers, and verifies that the expected container is
3030
// returned. It also executes a sample command inside the container.
3131
// The container is deleted after the test is complete.
32+
// As this test creates containers, it is skipped by default.
33+
// It can be run manually as follows:
34+
//
35+
// CODER_TEST_USE_DOCKER=1 go test ./agent/agentcontainers -run TestDockerCLIContainerLister
3236
func TestIntegrationDocker(t *testing.T) {
3337
t.Parallel()
34-
if runtime.GOOS != "linux" {
35-
t.Skip("This test creates containers, which can be flaky in non-Linux CI environments.")
38+
if ctud, ok := os.LookupEnv("CODER_TEST_USE_DOCKER"); !ok || ctud != "1" {
39+
t.Skip("Set CODER_TEST_USE_DOCKER=1 to run this test")
3640
}
3741

3842
pool, err := dockertest.NewPool("")
@@ -419,10 +423,16 @@ func TestConvertDockerVolume(t *testing.T) {
419423
}
420424
}
421425

426+
// TestDockerEnvInfoer tests the ability of EnvInfo to extract information from
427+
// running containers. Containers are deleted after the test is complete.
428+
// As this test creates containers, it is skipped by default.
429+
// It can be run manually as follows:
430+
//
431+
// CODER_TEST_USE_DOCKER=1 go test ./agent/agentcontainers -run TestDockerEnvInfoer
422432
func TestDockerEnvInfoer(t *testing.T) {
423433
t.Parallel()
424-
if runtime.GOOS != "linux" {
425-
t.Skip("This test creates containers, which can be flaky in non-Linux CI environments.")
434+
if ctud, ok := os.LookupEnv("CODER_TEST_USE_DOCKER"); !ok || ctud != "1" {
435+
t.Skip("Set CODER_TEST_USE_DOCKER=1 to run this test")
426436
}
427437

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

0 commit comments

Comments
 (0)