Skip to content

Commit 9fde835

Browse files
authored
test(agent/agentcontainers): add is a test ignore label to integration tests (#18570)
1 parent 434b546 commit 9fde835

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

agent/agent_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,7 +2130,7 @@ func TestAgent_DevcontainerAutostart(t *testing.T) {
21302130
"name": "mywork",
21312131
"image": "ubuntu:latest",
21322132
"cmd": ["sleep", "infinity"],
2133-
"runArgs": ["--network=host"]
2133+
"runArgs": ["--network=host", "--label=`+agentcontainers.DevcontainerIsTestRunLabel+`=true"]
21342134
}`), 0o600)
21352135
require.NoError(t, err, "write devcontainer.json")
21362136

@@ -2167,6 +2167,7 @@ func TestAgent_DevcontainerAutostart(t *testing.T) {
21672167
// Only match this specific dev container.
21682168
agentcontainers.WithClock(mClock),
21692169
agentcontainers.WithContainerLabelIncludeFilter("devcontainer.local_folder", tempWorkspaceFolder),
2170+
agentcontainers.WithContainerLabelIncludeFilter(agentcontainers.DevcontainerIsTestRunLabel, "true"),
21702171
agentcontainers.WithSubAgentURL(srv.URL),
21712172
// The agent will copy "itself", but in the case of this test, the
21722173
// agent is actually this test binary. So we'll tell the test binary
@@ -2288,7 +2289,8 @@ func TestAgent_DevcontainerRecreate(t *testing.T) {
22882289
err = os.WriteFile(devcontainerFile, []byte(`{
22892290
"name": "mywork",
22902291
"image": "busybox:latest",
2291-
"cmd": ["sleep", "infinity"]
2292+
"cmd": ["sleep", "infinity"],
2293+
"runArgs": ["--label=`+agentcontainers.DevcontainerIsTestRunLabel+`=true"]
22922294
}`), 0o600)
22932295
require.NoError(t, err, "write devcontainer.json")
22942296

@@ -2315,6 +2317,7 @@ func TestAgent_DevcontainerRecreate(t *testing.T) {
23152317
o.Devcontainers = true
23162318
o.DevcontainerAPIOptions = append(o.DevcontainerAPIOptions,
23172319
agentcontainers.WithContainerLabelIncludeFilter("devcontainer.local_folder", workspaceFolder),
2320+
agentcontainers.WithContainerLabelIncludeFilter(agentcontainers.DevcontainerIsTestRunLabel, "true"),
23182321
)
23192322
})
23202323

agent/agentcontainers/devcontainercli_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ func setupDevcontainerWorkspace(t *testing.T, workspaceFolder string) string {
586586
"containerEnv": {
587587
"TEST_CONTAINER": "true"
588588
},
589-
"runArgs": ["--label", "com.coder.test=devcontainercli"]
589+
"runArgs": ["--label=com.coder.test=devcontainercli", "--label=` + agentcontainers.DevcontainerIsTestRunLabel + `=true"]
590590
}`
591591
err = os.WriteFile(configPath, []byte(content), 0o600)
592592
require.NoError(t, err, "create devcontainer.json file")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy