Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit edc0731

Browse files
committed
update test to depend on path expansion
1 parent 6ec33aa commit edc0731

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

agent/agent_test.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -1998,8 +1998,8 @@ func TestAgent_ReconnectingPTYContainer(t *testing.T) {
19981998
// You can run it manually as follows:
19991999
//
20002000
// CODER_TEST_USE_DOCKER=1 go test -count=1 ./agent -run TestAgent_DevcontainerAutostart
2001+
// nolint: paralleltest // This test sets an environment variable.
20012002
func TestAgent_DevcontainerAutostart(t *testing.T) {
2002-
t.Parallel()
20032003
if os.Getenv("CODER_TEST_USE_DOCKER") != "1" {
20042004
t.Skip("Set CODER_TEST_USE_DOCKER=1 to run this test")
20052005
}
@@ -2014,7 +2014,10 @@ func TestAgent_DevcontainerAutostart(t *testing.T) {
20142014
devcontainerID := uuid.New()
20152015
tempWorkspaceFolder := t.TempDir()
20162016
tempWorkspaceFolder = filepath.Join(tempWorkspaceFolder, "mywork")
2017+
t.Setenv("TEMP_WORKSPACE_FOLDER", tempWorkspaceFolder)
2018+
unexpandedWorkspaceFolder := filepath.Join("${TEMP_WORKSPACE_FOLDER}")
20172019
t.Logf("Workspace folder: %s", tempWorkspaceFolder)
2020+
t.Logf("Unexpanded workspace folder: %s", unexpandedWorkspaceFolder)
20182021
devcontainerPath := filepath.Join(tempWorkspaceFolder, ".devcontainer")
20192022
err = os.MkdirAll(devcontainerPath, 0o755)
20202023
require.NoError(t, err, "create devcontainer directory")
@@ -2031,9 +2034,10 @@ func TestAgent_DevcontainerAutostart(t *testing.T) {
20312034
// is expected to be prepared by the provisioner normally.
20322035
Devcontainers: []codersdk.WorkspaceAgentDevcontainer{
20332036
{
2034-
ID: devcontainerID,
2035-
Name: "test",
2036-
WorkspaceFolder: tempWorkspaceFolder,
2037+
ID: devcontainerID,
2038+
Name: "test",
2039+
// Use an unexpanded path to test the expansion.
2040+
WorkspaceFolder: unexpandedWorkspaceFolder,
20372041
},
20382042
},
20392043
Scripts: []codersdk.WorkspaceAgentScript{

0 commit comments

Comments
 (0)