fix tests; clean up ip file after build
This commit is contained in:
parent
e9d5a1d272
commit
04b57b3e32
|
@ -11,6 +11,7 @@ import (
|
||||||
"github.com/Telmate/proxmox-api-go/proxmox"
|
"github.com/Telmate/proxmox-api-go/proxmox"
|
||||||
"github.com/hashicorp/packer/common"
|
"github.com/hashicorp/packer/common"
|
||||||
"github.com/hashicorp/packer/common/bootcommand"
|
"github.com/hashicorp/packer/common/bootcommand"
|
||||||
|
commonhelper "github.com/hashicorp/packer/helper/common"
|
||||||
"github.com/hashicorp/packer/helper/multistep"
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
"github.com/hashicorp/packer/template/interpolate"
|
"github.com/hashicorp/packer/template/interpolate"
|
||||||
|
@ -96,7 +97,9 @@ func (s *stepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag)
|
||||||
return multistep.ActionContinue
|
return multistep.ActionContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*stepTypeBootCommand) Cleanup(multistep.StateBag) {}
|
func (*stepTypeBootCommand) Cleanup(multistep.StateBag) {
|
||||||
|
commonhelper.RemoveSharedStateFile("ip", "")
|
||||||
|
}
|
||||||
|
|
||||||
func hostIP() (string, error) {
|
func hostIP() (string, error) {
|
||||||
addrs, err := net.InterfaceAddrs()
|
addrs, err := net.InterfaceAddrs()
|
||||||
|
|
|
@ -115,6 +115,8 @@ func TestTypeBootCommand(t *testing.T) {
|
||||||
c.builderConfig.ctx,
|
c.builderConfig.ctx,
|
||||||
}
|
}
|
||||||
action := step.Run(context.TODO(), state)
|
action := step.Run(context.TODO(), state)
|
||||||
|
step.Cleanup(state)
|
||||||
|
|
||||||
if action != c.expectedAction {
|
if action != c.expectedAction {
|
||||||
t.Errorf("Expected action to be %v, got %v", c.expectedAction, action)
|
t.Errorf("Expected action to be %v, got %v", c.expectedAction, action)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue