fix(agent/agentcontainers): use correct env for execer commands (#18508)

This commit is contained in:
Mathias Fredriksson
2025-06-24 12:56:54 +03:00
committed by GitHub
parent 7c40f86a6a
commit 3fb5d0b52d
7 changed files with 251 additions and 35 deletions

View File

@ -87,6 +87,8 @@ func TestExpRpty(t *testing.T) {
t.Skip("Skipping test on non-Linux platform")
}
wantLabel := "coder.devcontainers.TestExpRpty.Container"
client, workspace, agentToken := setupWorkspaceForAgent(t)
ctx := testutil.Context(t, testutil.WaitLong)
pool, err := dockertest.NewPool("")
@ -94,7 +96,10 @@ func TestExpRpty(t *testing.T) {
ct, err := pool.RunWithOptions(&dockertest.RunOptions{
Repository: "busybox",
Tag: "latest",
Cmd: []string{"sleep", "infnity"},
Cmd: []string{"sleep", "infinity"},
Labels: map[string]string{
wantLabel: "true",
},
}, func(config *docker.HostConfig) {
config.AutoRemove = true
config.RestartPolicy = docker.RestartPolicy{Name: "no"}
@ -113,7 +118,7 @@ func TestExpRpty(t *testing.T) {
_ = agenttest.New(t, client.URL, agentToken, func(o *agent.Options) {
o.ExperimentalDevcontainersEnabled = true
o.ContainerAPIOptions = append(o.ContainerAPIOptions,
agentcontainers.WithContainerLabelIncludeFilter("this.label.does.not.exist.ignore.devcontainers", "true"),
agentcontainers.WithContainerLabelIncludeFilter(wantLabel, "true"),
)
})
_ = coderdtest.NewWorkspaceAgentWaiter(t, client, workspace.ID).Wait()