Remove tmp directories created by builder/parallels/common tests

This commit is contained in:
DanHam 2018-04-25 14:59:44 +01:00
parent 5642f8cb01
commit 475b3978d2
No known key found for this signature in database
GPG Key ID: 58E79AEDD6AA987E
2 changed files with 5 additions and 2 deletions

View File

@ -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(`
<ExampleParallelsConfig>

View File

@ -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 {