Remove tmp directories created by builder/vmware/common tests
This commit is contained in:
parent
13b7078cb0
commit
25dd27a164
|
@ -30,6 +30,8 @@ func TestStepOutputDir(t *testing.T) {
|
||||||
step := new(StepOutputDir)
|
step := new(StepOutputDir)
|
||||||
|
|
||||||
dir := testOutputDir(t)
|
dir := testOutputDir(t)
|
||||||
|
// Delete the test output directory when done
|
||||||
|
defer os.RemoveAll(dir.dir)
|
||||||
state.Put("dir", dir)
|
state.Put("dir", dir)
|
||||||
|
|
||||||
// Test the run
|
// Test the run
|
||||||
|
@ -61,6 +63,7 @@ func TestStepOutputDir_existsNoForce(t *testing.T) {
|
||||||
if err := os.MkdirAll(dir.dir, 0755); err != nil {
|
if err := os.MkdirAll(dir.dir, 0755); err != nil {
|
||||||
t.Fatalf("err: %s", err)
|
t.Fatalf("err: %s", err)
|
||||||
}
|
}
|
||||||
|
defer os.RemoveAll(dir.dir)
|
||||||
|
|
||||||
// Test the run
|
// Test the run
|
||||||
if action := step.Run(context.Background(), state); action != multistep.ActionHalt {
|
if action := step.Run(context.Background(), state); action != multistep.ActionHalt {
|
||||||
|
@ -89,6 +92,7 @@ func TestStepOutputDir_existsForce(t *testing.T) {
|
||||||
if err := os.MkdirAll(dir.dir, 0755); err != nil {
|
if err := os.MkdirAll(dir.dir, 0755); err != nil {
|
||||||
t.Fatalf("err: %s", err)
|
t.Fatalf("err: %s", err)
|
||||||
}
|
}
|
||||||
|
defer os.RemoveAll(dir.dir)
|
||||||
|
|
||||||
// Test the run
|
// Test the run
|
||||||
if action := step.Run(context.Background(), state); action != multistep.ActionContinue {
|
if action := step.Run(context.Background(), state); action != multistep.ActionContinue {
|
||||||
|
|
|
@ -85,6 +85,12 @@ func TestStepShutdown_command(t *testing.T) {
|
||||||
if comm.StartCmd.Command != "foo" {
|
if comm.StartCmd.Command != "foo" {
|
||||||
t.Fatalf("bad: %#v", comm.StartCmd.Command)
|
t.Fatalf("bad: %#v", comm.StartCmd.Command)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clean up the created test output directory
|
||||||
|
dir := state.Get("dir").(*LocalOutputDir)
|
||||||
|
if err := dir.RemoveAll(); err != nil {
|
||||||
|
t.Fatalf("Error cleaning up directory: %s", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStepShutdown_noCommand(t *testing.T) {
|
func TestStepShutdown_noCommand(t *testing.T) {
|
||||||
|
@ -113,6 +119,12 @@ func TestStepShutdown_noCommand(t *testing.T) {
|
||||||
if comm.StartCalled {
|
if comm.StartCalled {
|
||||||
t.Fatal("start should not be called")
|
t.Fatal("start should not be called")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clean up the created test output directory
|
||||||
|
dir := state.Get("dir").(*LocalOutputDir)
|
||||||
|
if err := dir.RemoveAll(); err != nil {
|
||||||
|
t.Fatalf("Error cleaning up directory: %s", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStepShutdown_locks(t *testing.T) {
|
func TestStepShutdown_locks(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue