From 475b3978d25fe1feacd504ce317bc4cc17fb33f1 Mon Sep 17 00:00:00 2001 From: DanHam Date: Wed, 25 Apr 2018 14:59:44 +0100 Subject: [PATCH] Remove tmp directories created by builder/parallels/common tests --- builder/parallels/common/driver_9_test.go | 5 +++-- builder/parallels/common/step_output_dir_test.go | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/builder/parallels/common/driver_9_test.go b/builder/parallels/common/driver_9_test.go index 32d7c6662..bc9d3eb42 100644 --- a/builder/parallels/common/driver_9_test.go +++ b/builder/parallels/common/driver_9_test.go @@ -16,6 +16,7 @@ func TestIPAddress(t *testing.T) { t.Fatalf("err: %s", err) } defer os.Remove(tf.Name()) + defer tf.Close() d := Parallels9Driver{ dhcpLeaseFile: tf.Name(), @@ -62,9 +63,9 @@ func TestIPAddress(t *testing.T) { func TestXMLParseConfig(t *testing.T) { td, err := ioutil.TempDir("", "configpvs") if err != nil { - t.Fatalf("Error creating temp file: %s", err) + t.Fatalf("Error creating temp dir: %s", err) } - defer os.Remove(td) + defer os.RemoveAll(td) config := []byte(` diff --git a/builder/parallels/common/step_output_dir_test.go b/builder/parallels/common/step_output_dir_test.go index 17d441457..53c1d885c 100644 --- a/builder/parallels/common/step_output_dir_test.go +++ b/builder/parallels/common/step_output_dir_test.go @@ -28,6 +28,8 @@ func TestStepOutputDir_impl(t *testing.T) { func TestStepOutputDir(t *testing.T) { state := testState(t) step := testStepOutputDir(t) + // Delete the test output directory when done + defer os.RemoveAll(step.Path) // Test the run if action := step.Run(context.Background(), state); action != multistep.ActionContinue {