Merge pull request #3686 from ricardclau/test_ansible_verbose_output

Adding a functional test with an Ansible message very long
This commit is contained in:
Chris Bednarski 2016-07-06 23:23:30 -07:00 committed by GitHub
commit eb8a3dc663
2 changed files with 38 additions and 0 deletions

View File

@ -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)
}

View File

@ -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) }}"