From 04b57b3e322ec0cbf1b3d046999a3d1a7bba5f5a Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Thu, 4 Apr 2019 16:57:42 -0700 Subject: [PATCH] fix tests; clean up ip file after build --- builder/proxmox/step_type_boot_command.go | 5 ++++- builder/proxmox/step_type_boot_command_test.go | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/builder/proxmox/step_type_boot_command.go b/builder/proxmox/step_type_boot_command.go index 2e87cb7e5..89d50fb0d 100644 --- a/builder/proxmox/step_type_boot_command.go +++ b/builder/proxmox/step_type_boot_command.go @@ -11,6 +11,7 @@ import ( "github.com/Telmate/proxmox-api-go/proxmox" "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/common/bootcommand" + commonhelper "github.com/hashicorp/packer/helper/common" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" @@ -96,7 +97,9 @@ func (s *stepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag) return multistep.ActionContinue } -func (*stepTypeBootCommand) Cleanup(multistep.StateBag) {} +func (*stepTypeBootCommand) Cleanup(multistep.StateBag) { + commonhelper.RemoveSharedStateFile("ip", "") +} func hostIP() (string, error) { addrs, err := net.InterfaceAddrs() diff --git a/builder/proxmox/step_type_boot_command_test.go b/builder/proxmox/step_type_boot_command_test.go index b2f285c04..c51b57d73 100644 --- a/builder/proxmox/step_type_boot_command_test.go +++ b/builder/proxmox/step_type_boot_command_test.go @@ -115,6 +115,8 @@ func TestTypeBootCommand(t *testing.T) { c.builderConfig.ctx, } action := step.Run(context.TODO(), state) + step.Cleanup(state) + if action != c.expectedAction { t.Errorf("Expected action to be %v, got %v", c.expectedAction, action) }