Merge pull request #9962 from hashicorp/azr-test-hcl2-json

[HCL2] add an hcl2-json test
This commit is contained in:
Megan Marsh 2020-09-18 10:42:42 -07:00 committed by GitHub
commit 7eb5c3ecf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 94 additions and 0 deletions

View File

@ -560,6 +560,17 @@ func TestBuildExceptFileCommaFlags(t *testing.T) {
buildNotExpectedFiles: []string{"chocolate.txt", "vanilla.txt", "tomato.txt", "unnamed.txt"},
postProcNotExpectedFiles: []string{"pear.txt, banana.txt"},
},
{
name: "HCL2-JSON: except build and post-processor",
args: []string{
"-parallel-builds=1",
"-except=file.chocolate,file.vanilla,tomato",
filepath.Join(testFixture("build-only"), "template.pkr.json"),
},
expectedFiles: []string{"apple.txt", "cherry.txt", "peach.txt"},
buildNotExpectedFiles: []string{"chocolate.txt", "vanilla.txt", "tomato.txt", "unnamed.txt"},
postProcNotExpectedFiles: []string{"pear.txt, banana.txt"},
},
}
for _, tt := range tc {

View File

@ -0,0 +1,83 @@
{
"source": {
"file": {
"chocolate": {
"content": "chocolate",
"target": "chocolate.txt"
}
},
"file": {
"vanilla": {
"content": "vanilla",
"target": "vanilla.txt"
}
},
"file": {
"cherry": {
"content": "cherry",
"target": "cherry.txt"
}
}
},
"build": {
"sources": [
"sources.file.chocolate",
"sources.file.vanilla",
"sources.file.cherry"
],
"provisioner": [
{
"shell-local": {
"name": "apple",
"inline": [
"echo apple > apple.txt"
]
}
}
],
"post-processor": [
{
"shell-local": {
"name": "peach",
"inline": [
"echo peach > peach.txt"
]
}
},
{
"shell-local": {
"name": "pear",
"inline": [
"echo pear > pear.txt"
]
}
},
{
"shell-local": {
"name": "banana",
"inline": [
"echo banana > banana.txt"
]
}
},
{
"shell-local": {
"name": "tomato",
"inline": [
"echo tomato > tomato.txt"
]
}
},
{
"shell-local": {
"only": [
"sources.file.chocolate"
],
"inline": [
"echo unnamed > unnamed.txt"
]
}
}
]
}
}