mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
test(agent/agentcontainers): add is a test ignore label to integration tests (#18570)
This commit is contained in:
committed by
GitHub
parent
434b54657a
commit
9fde8353ad
@ -2130,7 +2130,7 @@ func TestAgent_DevcontainerAutostart(t *testing.T) {
|
|||||||
"name": "mywork",
|
"name": "mywork",
|
||||||
"image": "ubuntu:latest",
|
"image": "ubuntu:latest",
|
||||||
"cmd": ["sleep", "infinity"],
|
"cmd": ["sleep", "infinity"],
|
||||||
"runArgs": ["--network=host"]
|
"runArgs": ["--network=host", "--label=`+agentcontainers.DevcontainerIsTestRunLabel+`=true"]
|
||||||
}`), 0o600)
|
}`), 0o600)
|
||||||
require.NoError(t, err, "write devcontainer.json")
|
require.NoError(t, err, "write devcontainer.json")
|
||||||
|
|
||||||
@ -2167,6 +2167,7 @@ func TestAgent_DevcontainerAutostart(t *testing.T) {
|
|||||||
// Only match this specific dev container.
|
// Only match this specific dev container.
|
||||||
agentcontainers.WithClock(mClock),
|
agentcontainers.WithClock(mClock),
|
||||||
agentcontainers.WithContainerLabelIncludeFilter("devcontainer.local_folder", tempWorkspaceFolder),
|
agentcontainers.WithContainerLabelIncludeFilter("devcontainer.local_folder", tempWorkspaceFolder),
|
||||||
|
agentcontainers.WithContainerLabelIncludeFilter(agentcontainers.DevcontainerIsTestRunLabel, "true"),
|
||||||
agentcontainers.WithSubAgentURL(srv.URL),
|
agentcontainers.WithSubAgentURL(srv.URL),
|
||||||
// The agent will copy "itself", but in the case of this test, the
|
// The agent will copy "itself", but in the case of this test, the
|
||||||
// agent is actually this test binary. So we'll tell the test binary
|
// agent is actually this test binary. So we'll tell the test binary
|
||||||
@ -2288,7 +2289,8 @@ func TestAgent_DevcontainerRecreate(t *testing.T) {
|
|||||||
err = os.WriteFile(devcontainerFile, []byte(`{
|
err = os.WriteFile(devcontainerFile, []byte(`{
|
||||||
"name": "mywork",
|
"name": "mywork",
|
||||||
"image": "busybox:latest",
|
"image": "busybox:latest",
|
||||||
"cmd": ["sleep", "infinity"]
|
"cmd": ["sleep", "infinity"],
|
||||||
|
"runArgs": ["--label=`+agentcontainers.DevcontainerIsTestRunLabel+`=true"]
|
||||||
}`), 0o600)
|
}`), 0o600)
|
||||||
require.NoError(t, err, "write devcontainer.json")
|
require.NoError(t, err, "write devcontainer.json")
|
||||||
|
|
||||||
@ -2315,6 +2317,7 @@ func TestAgent_DevcontainerRecreate(t *testing.T) {
|
|||||||
o.Devcontainers = true
|
o.Devcontainers = true
|
||||||
o.DevcontainerAPIOptions = append(o.DevcontainerAPIOptions,
|
o.DevcontainerAPIOptions = append(o.DevcontainerAPIOptions,
|
||||||
agentcontainers.WithContainerLabelIncludeFilter("devcontainer.local_folder", workspaceFolder),
|
agentcontainers.WithContainerLabelIncludeFilter("devcontainer.local_folder", workspaceFolder),
|
||||||
|
agentcontainers.WithContainerLabelIncludeFilter(agentcontainers.DevcontainerIsTestRunLabel, "true"),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -586,7 +586,7 @@ func setupDevcontainerWorkspace(t *testing.T, workspaceFolder string) string {
|
|||||||
"containerEnv": {
|
"containerEnv": {
|
||||||
"TEST_CONTAINER": "true"
|
"TEST_CONTAINER": "true"
|
||||||
},
|
},
|
||||||
"runArgs": ["--label", "com.coder.test=devcontainercli"]
|
"runArgs": ["--label=com.coder.test=devcontainercli", "--label=` + agentcontainers.DevcontainerIsTestRunLabel + `=true"]
|
||||||
}`
|
}`
|
||||||
err = os.WriteFile(configPath, []byte(content), 0o600)
|
err = os.WriteFile(configPath, []byte(content), 0o600)
|
||||||
require.NoError(t, err, "create devcontainer.json file")
|
require.NoError(t, err, "create devcontainer.json file")
|
||||||
|
Reference in New Issue
Block a user