mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
test(cli): Fix TestTemplatePush/UseWorkingDir bad use of chdir (#7160)
This commit is contained in:
committed by
GitHub
parent
53f521aaf9
commit
51841e9e11
@ -159,6 +159,8 @@ func TestTemplatePush(t *testing.T) {
|
||||
// This test modifies the working directory.
|
||||
//nolint:paralleltest
|
||||
t.Run("UseWorkingDir", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip(`On Windows this test flakes with: "The process cannot access the file because it is being used by another process"`)
|
||||
}
|
||||
@ -179,15 +181,9 @@ func TestTemplatePush(t *testing.T) {
|
||||
r.Name = filepath.Base(source)
|
||||
})
|
||||
|
||||
oldDir, err := os.Getwd()
|
||||
require.NoError(t, err)
|
||||
|
||||
os.Chdir(source)
|
||||
defer os.Chdir(oldDir)
|
||||
|
||||
// Don't pass the name of the template, it should use the
|
||||
// directory of the source.
|
||||
inv, root := clitest.New(t, "templates", "push", "--test.provisioner", string(database.ProvisionerTypeEcho))
|
||||
inv, root := clitest.New(t, "templates", "push", "--test.provisioner", string(database.ProvisionerTypeEcho), "--test.workdir", source)
|
||||
clitest.SetupConfig(t, client, root)
|
||||
pty := ptytest.New(t).Attach(inv)
|
||||
|
||||
|
Reference in New Issue
Block a user