From 96bdf17d2ecc2a04803fce79190f681306017225 Mon Sep 17 00:00:00 2001 From: Ali Rizvi-Santiago Date: Mon, 3 Dec 2018 18:03:02 -0600 Subject: [PATCH] Added knowledge of the "temporaryDevices" statebag to the StepCleanVMX tests for the VMware builders. --- builder/vmware/common/step_clean_vmx_test.go | 12 ++++++++++++ builder/vmware/common/step_test.go | 1 + 2 files changed, 13 insertions(+) diff --git a/builder/vmware/common/step_clean_vmx_test.go b/builder/vmware/common/step_clean_vmx_test.go index 0f4df3df2..3987fb2c4 100644 --- a/builder/vmware/common/step_clean_vmx_test.go +++ b/builder/vmware/common/step_clean_vmx_test.go @@ -40,8 +40,12 @@ func TestStepCleanVMX_floppyPath(t *testing.T) { t.Fatalf("err: %s", err) } + // Set the path to the temporary vmx state.Put("vmx_path", vmxPath) + // Add the floppy device to the list of temporary build devices + state.Put("temporaryDevices", []string{"floppy0"}) + // Test the run if action := step.Run(context.Background(), state); action != multistep.ActionContinue { t.Fatalf("bad action: %#v", action) @@ -89,8 +93,12 @@ func TestStepCleanVMX_isoPath(t *testing.T) { t.Fatalf("err: %s", err) } + // Set the path to the temporary vmx state.Put("vmx_path", vmxPath) + // Add the cdrom device to the list of temporary build devices + state.Put("temporaryDevices", []string{"ide0:0"}) + // Test the run if action := step.Run(context.Background(), state); action != multistep.ActionContinue { t.Fatalf("bad action: %#v", action) @@ -141,8 +149,12 @@ func TestStepCleanVMX_ethernet(t *testing.T) { t.Fatalf("err: %s", err) } + // Set the path to the temporary vmx state.Put("vmx_path", vmxPath) + // TODO: Add the ethernet devices to the list of temporary build devices + // state.Put("temporaryDevices", []string{"ethernet0", "ethernet1"}) + // Test the run if action := step.Run(context.Background(), state); action != multistep.ActionContinue { t.Fatalf("bad action: %#v", action) diff --git a/builder/vmware/common/step_test.go b/builder/vmware/common/step_test.go index c8a12abb6..d1daffab5 100644 --- a/builder/vmware/common/step_test.go +++ b/builder/vmware/common/step_test.go @@ -15,5 +15,6 @@ func testState(t *testing.T) multistep.StateBag { Reader: new(bytes.Buffer), Writer: new(bytes.Buffer), }) + state.Put("temporaryDevices", []string{}) return state }