@@ -2,7 +2,7 @@ package agentcontainers
2
2
3
3
import (
4
4
"fmt"
5
- "runtime "
5
+ "os "
6
6
"strconv"
7
7
"strings"
8
8
"testing"
@@ -29,10 +29,14 @@ import (
29
29
// label, lists the containers, and verifies that the expected container is
30
30
// returned. It also executes a sample command inside the container.
31
31
// 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
32
36
func TestIntegrationDocker (t * testing.T ) {
33
37
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 " )
36
40
}
37
41
38
42
pool , err := dockertest .NewPool ("" )
@@ -419,10 +423,16 @@ func TestConvertDockerVolume(t *testing.T) {
419
423
}
420
424
}
421
425
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
422
432
func TestDockerEnvInfoer (t * testing.T ) {
423
433
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 " )
426
436
}
427
437
428
438
pool , err := dockertest .NewPool ("" )
0 commit comments