Make a new dir per test to work around windows failures

This commit is contained in:
Caleb Brose 2022-06-29 11:48:23 -05:00
parent b5348f661e
commit 4eac4fbf4c

View file

@ -26,12 +26,6 @@ func TestPendingOperationDisallowsSSH(t *testing.T) {
}
func TestAutomaticSSHKeyPairs(t *testing.T) {
dir := t.TempDir()
sshContext := ssh.Context{
ConfigDir: dir,
}
tests := []struct {
// These files exist when calling setupAutomaticSSHKeys
existingFiles []string
@ -71,15 +65,14 @@ func TestAutomaticSSHKeyPairs(t *testing.T) {
}
for _, tt := range tests {
err := os.RemoveAll(dir)
if err != nil {
t.Errorf("Failed to clean test directory: %v", err)
}
err = os.MkdirAll(dir, 0711)
if err != nil {
t.Errorf("Failed to set up test directory: %v", err)
dir := t.TempDir()
sshContext := ssh.Context{
ConfigDir: dir,
}
defer os.RemoveAll(dir)
for _, file := range tt.existingFiles {
if _, err := os.Create(filepath.Join(dir, file)); err != nil {
t.Errorf("Failed to setup test files: %v", err)