Merge pull request #3686 from ricardclau/test_ansible_verbose_output

Adding a functional test with an Ansible message very long
pull/3690/head
Chris Bednarski 10 years ago committed by GitHub
commit eb8a3dc663

@ -1,6 +1,7 @@
package ansible
import (
"bytes"
"crypto/rand"
"fmt"
"io"
@ -243,3 +244,32 @@ func TestProvisionerPrepare_LocalPort(t *testing.T) {
t.Fatalf("err: %s", err)
}
}
func TestAnsibleGetVersion(t *testing.T) {
if os.Getenv("PACKER_ACC") == "" {
t.Skip("This test is only run with PACKER_ACC=1 and it requires Ansible to be installed")
}
var p Provisioner
p.config.Command = "ansible-playbook"
p.getVersion()
}
func TestAnsibleLongMessages(t *testing.T) {
if os.Getenv("PACKER_ACC") == "" {
t.Skip("This test is only run with PACKER_ACC=1 and it requires Ansible to be installed")
}
var p Provisioner
p.config.Command = "ansible-playbook"
p.config.PlaybookFile = "./test-fixtures/long-debug-message.yml"
p.Prepare()
comm := &packer.MockCommunicator{}
ui := &packer.BasicUi{
Reader: new(bytes.Buffer),
Writer: new(bytes.Buffer),
}
p.Provision(ui, comm)
}

@ -0,0 +1,8 @@
- name: Stub for Packer testing long Ansible messages
hosts: localhost
connection: local
tasks:
- name: Very long Ansible output (>65535 chars) (Issue https://github.com/mitchellh/packer/issues/3268)
debug:
msg: "{{ lipsum(n=300, html=false) }}"
Loading…
Cancel
Save