mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
fix: Remove hardcoded /tmp path in test (#3168)
This commit is contained in:
committed by
GitHub
parent
2c67a2f30b
commit
ad2b29a571
@ -32,6 +32,7 @@ func TestWorkspaceAgent(t *testing.T) {
|
|||||||
})
|
})
|
||||||
user := coderdtest.CreateFirstUser(t, client)
|
user := coderdtest.CreateFirstUser(t, client)
|
||||||
authToken := uuid.NewString()
|
authToken := uuid.NewString()
|
||||||
|
tmpDir := t.TempDir()
|
||||||
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
|
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
|
||||||
Parse: echo.ParseComplete,
|
Parse: echo.ParseComplete,
|
||||||
ProvisionDryRun: echo.ProvisionComplete,
|
ProvisionDryRun: echo.ProvisionComplete,
|
||||||
@ -43,7 +44,7 @@ func TestWorkspaceAgent(t *testing.T) {
|
|||||||
Type: "aws_instance",
|
Type: "aws_instance",
|
||||||
Agents: []*proto.Agent{{
|
Agents: []*proto.Agent{{
|
||||||
Id: uuid.NewString(),
|
Id: uuid.NewString(),
|
||||||
Directory: "/tmp",
|
Directory: tmpDir,
|
||||||
Auth: &proto.Agent_Token{
|
Auth: &proto.Agent_Token{
|
||||||
Token: authToken,
|
Token: authToken,
|
||||||
},
|
},
|
||||||
@ -60,7 +61,7 @@ func TestWorkspaceAgent(t *testing.T) {
|
|||||||
|
|
||||||
resources, err := client.WorkspaceResourcesByBuild(context.Background(), workspace.LatestBuild.ID)
|
resources, err := client.WorkspaceResourcesByBuild(context.Background(), workspace.LatestBuild.ID)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, "/tmp", resources[0].Agents[0].Directory)
|
require.Equal(t, tmpDir, resources[0].Agents[0].Directory)
|
||||||
_, err = client.WorkspaceAgent(context.Background(), resources[0].Agents[0].ID)
|
_, err = client.WorkspaceAgent(context.Background(), resources[0].Agents[0].ID)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user