Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9753283

Browse files
committed
update test to depend on path expansion
1 parent6ec33aa commit9753283

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

‎agent/agent_test.go

Lines changed: 10 additions & 6 deletions
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
funcTestAgent_DevcontainerAutostart(t*testing.T) {
2002-
t.Parallel()
20032003
ifos.Getenv("CODER_TEST_USE_DOCKER")!="1" {
20042004
t.Skip("Set CODER_TEST_USE_DOCKER=1 to run this test")
20052005
}
@@ -2012,9 +2012,12 @@ func TestAgent_DevcontainerAutostart(t *testing.T) {
20122012

20132013
// Prepare temporary devcontainer for test (mywork).
20142014
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")
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)

[8]ページ先頭

©2009-2025 Movatter.jp