Skip to content

chore(agent/agentcontainers): skip TestDockerCLIContainerLister by default #16502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 10, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions agent/agentcontainers/containers_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package agentcontainers

import (
"fmt"
"os/exec"
"runtime"
"os"
"strconv"
"strings"
"testing"
Expand All @@ -27,15 +26,14 @@ import (
// dockerCLIContainerLister.List method. It starts a container with a known
// label, lists the containers, and verifies that the expected container is
// returned. The container is deleted after the test is complete.
// As this test creates containers, it is skipped by default.
// It can be run manually as follows:
//
// CODER_TEST_USE_DOCKER=1 go test ./agent/agentcontainers -run TestDockerCLIContainerLister
func TestDockerCLIContainerLister(t *testing.T) {
t.Parallel()
if runtime.GOOS != "linux" {
t.Skip("creating containers on non-linux runners is slow and flaky")
}

// Conditionally skip if Docker is not available.
if _, err := exec.LookPath("docker"); err != nil {
t.Skip("docker not found in PATH")
if ctud, ok := os.LookupEnv("CODER_TEST_USE_DOCKER"); !ok || ctud != "1" {
t.Skip("Set CODER_TEST_USE_DOCKER=1 to run this test")
}

pool, err := dockertest.NewPool("")
Expand Down
Loading