mirror of
https://github.com/hashicorp/packer.git
synced 2026-06-09 00:32:09 -04:00
add mock so we can test full provision flow
This commit is contained in:
parent
6c756a7b31
commit
e155d2a1c8
1 changed files with 31 additions and 0 deletions
31
provisioner/ansible/mock_ansible.go
Normal file
31
provisioner/ansible/mock_ansible.go
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// +build !windows
|
||||
|
||||
package ansible
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/packer/packer"
|
||||
)
|
||||
|
||||
type provisionLogicTracker struct {
|
||||
setupAdapterCalled bool
|
||||
executeAnsibleCalled bool
|
||||
happyPath bool
|
||||
}
|
||||
|
||||
func (l *provisionLogicTracker) setupAdapter(ui packer.Ui, comm packer.Communicator) (string, error) {
|
||||
l.setupAdapterCalled = true
|
||||
if l.happyPath {
|
||||
return "fakeKeyString", nil
|
||||
}
|
||||
return "", fmt.Errorf("chose sadpath")
|
||||
}
|
||||
|
||||
func (l *provisionLogicTracker) executeAnsible(ui packer.Ui, comm packer.Communicator, privKeyFile string) error {
|
||||
l.executeAnsibleCalled = true
|
||||
if l.happyPath {
|
||||
return fmt.Errorf("Chose sadpath")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Loading…
Reference in a new issue