Because the new functionality makes the ```waitForRestart()``` function run commands it modifies the value of ```comm.StartCmd.Command``` that is being checked, we need to implement the same workaround that is being used for the ```waitForCommunicator()``` function. This should make the test work again and retain functionality.
This commit is contained in:
parent
08359e409a
commit
8bd3e62853
|
@ -100,6 +100,10 @@ func TestProvisionerProvision_Success(t *testing.T) {
|
|||
waitForCommunicator = func(p *Provisioner) error {
|
||||
return nil
|
||||
}
|
||||
waitForRestartOld := waitForRestart
|
||||
waitForRestart = func(p *Provisioner, comm packer.Communicator) error {
|
||||
return nil
|
||||
}
|
||||
err := p.Provision(ui, comm)
|
||||
if err != nil {
|
||||
t.Fatal("should not have error")
|
||||
|
@ -113,6 +117,7 @@ func TestProvisionerProvision_Success(t *testing.T) {
|
|||
}
|
||||
// Set this back!
|
||||
waitForCommunicator = waitForCommunicatorOld
|
||||
waitForRestart = waitForRestartOld
|
||||
}
|
||||
|
||||
func TestProvisionerProvision_CustomCommand(t *testing.T) {
|
||||
|
@ -131,6 +136,10 @@ func TestProvisionerProvision_CustomCommand(t *testing.T) {
|
|||
waitForCommunicator = func(p *Provisioner) error {
|
||||
return nil
|
||||
}
|
||||
waitForRestartOld := waitForRestart
|
||||
waitForRestart = func(p *Provisioner, comm packer.Communicator) error {
|
||||
return nil
|
||||
}
|
||||
err := p.Provision(ui, comm)
|
||||
if err != nil {
|
||||
t.Fatal("should not have error")
|
||||
|
@ -142,6 +151,7 @@ func TestProvisionerProvision_CustomCommand(t *testing.T) {
|
|||
}
|
||||
// Set this back!
|
||||
waitForCommunicator = waitForCommunicatorOld
|
||||
waitForRestart = waitForRestartOld
|
||||
}
|
||||
|
||||
func TestProvisionerProvision_RestartCommandFail(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue