@@ -1998,8 +1998,8 @@ func TestAgent_ReconnectingPTYContainer(t *testing.T) {
1998
1998
// You can run it manually as follows:
1999
1999
//
2000
2000
// CODER_TEST_USE_DOCKER=1 go test -count=1 ./agent -run TestAgent_DevcontainerAutostart
2001
+ // nolint: paralleltest // This test sets an environment variable.
2001
2002
func TestAgent_DevcontainerAutostart (t * testing.T ) {
2002
- t .Parallel ()
2003
2003
if os .Getenv ("CODER_TEST_USE_DOCKER" ) != "1" {
2004
2004
t .Skip ("Set CODER_TEST_USE_DOCKER=1 to run this test" )
2005
2005
}
@@ -2012,9 +2012,12 @@ func TestAgent_DevcontainerAutostart(t *testing.T) {
2012
2012
2013
2013
// Prepare temporary devcontainer for test (mywork).
2014
2014
devcontainerID := uuid .New ()
2015
- tempWorkspaceFolder := t .TempDir ()
2016
- tempWorkspaceFolder = filepath .Join (tempWorkspaceFolder , "mywork" )
2015
+ tmpdir := t .TempDir ()
2016
+ t .Setenv ("HOME" , tmpdir )
2017
+ tempWorkspaceFolder := filepath .Join (tmpdir , "mywork" )
2018
+ unexpandedWorkspaceFolder := filepath .Join ("~" , "mywork" )
2017
2019
t .Logf ("Workspace folder: %s" , tempWorkspaceFolder )
2020
+ t .Logf ("Unexpanded workspace folder: %s" , unexpandedWorkspaceFolder )
2018
2021
devcontainerPath := filepath .Join (tempWorkspaceFolder , ".devcontainer" )
2019
2022
err = os .MkdirAll (devcontainerPath , 0o755 )
2020
2023
require .NoError (t , err , "create devcontainer directory" )
@@ -2031,9 +2034,10 @@ func TestAgent_DevcontainerAutostart(t *testing.T) {
2031
2034
// is expected to be prepared by the provisioner normally.
2032
2035
Devcontainers : []codersdk.WorkspaceAgentDevcontainer {
2033
2036
{
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 ,
2037
2041
},
2038
2042
},
2039
2043
Scripts : []codersdk.WorkspaceAgentScript {
0 commit comments