Commit ca24c664 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

test: file provisioner tests pass

parent 318ced95
{
"builders": [{
"type": "amazon-ebs",
"ami_name": "packer-test {{timestamp}}",
"instance_type": "m1.small",
"region": "us-east-1",
"ssh_username": "ubuntu",
"source_ami": "ami-0568456c",
"tags": {
"packer-test": "true"
}
}],
"provisioners": [{
"type": "file",
"source": "dir",
"destination": "/tmp"
}, {
"type": "shell",
"inline": ["cat /tmp/dir/file.txt"]
}]
}
{
"builders": [{
"type": "amazon-ebs",
"ami_name": "packer-test {{timestamp}}",
"instance_type": "m1.small",
"region": "us-east-1",
"ssh_username": "ubuntu",
"source_ami": "ami-0568456c",
"tags": {
"packer-test": "true"
}
}],
"provisioners": [{
"type": "file",
"source": "dir/",
"destination": "/tmp"
}, {
"type": "shell",
"inline": ["cat /tmp/file.txt"]
}]
}
{
"builders": [{
"type": "amazon-ebs",
"ami_name": "packer-test {{timestamp}}",
"instance_type": "m1.small",
"region": "us-east-1",
"ssh_username": "ubuntu",
"source_ami": "ami-0568456c",
"tags": {
"packer-test": "true"
}
}],
"provisioners": [{
"type": "file",
"source": "file.txt",
"destination": "/tmp/file.txt"
}, {
"type": "shell",
"inline": ["cat /tmp/file.txt"]
}]
}
#!/usr/bin/env bats
#
# This tests the amazon-ebs builder. The teardown function will automatically
# delete any AMIs with a tag of `packer-test` being equal to "true" so
# be sure any test cases set this.
load test_helper
fixtures provisioner-file
setup() {
cd $FIXTURE_ROOT
}
teardown() {
aws_ami_cleanup
}
@test "file provisioner: single file" {
run packer build $FIXTURE_ROOT/file.json
[ "$status" -eq 0 ]
[[ "$output" == *"24901 miles"* ]]
}
@test "file provisioner: directory (no trailing slash)" {
run packer build $FIXTURE_ROOT/dir_no_trailing.json
[ "$status" -eq 0 ]
[[ "$output" == *"337 miles"* ]]
}
@test "file provisioner: directory (with trailing slash)" {
run packer build $FIXTURE_ROOT/dir_with_trailing.json
[ "$status" -eq 0 ]
[[ "$output" == *"337 miles"* ]]
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment