Merge pull request #9962 from hashicorp/azr-test-hcl2-json
[HCL2] add an hcl2-json test
This commit is contained in:
commit
7eb5c3ecf9
|
@ -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 {
|
||||
|
|
|
@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue