Merge pull request #4907 from WeatherGod/invalid_json_test
test that parsing fails on a certain kind of malformed JSON
This commit is contained in:
commit
932c4715e7
@ -359,6 +359,7 @@ func TestParse_bad(t *testing.T) {
|
||||
{"error-beginning.json", "line 1, column 1 (offset 1)"},
|
||||
{"error-middle.json", "line 5, column 6 (offset 50)"},
|
||||
{"error-end.json", "line 1, column 30 (offset 30)"},
|
||||
{"malformed.json", "line 16, column 3 (offset 433)"},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
_, err := ParseFile(fixtureDir(tc.File))
|
||||
|
25
template/test-fixtures/malformed.json
Normal file
25
template/test-fixtures/malformed.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"variables": {
|
||||
"access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
|
||||
"secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}"
|
||||
},
|
||||
"builders": [{
|
||||
"type": "amazon-ebs",
|
||||
"access_key": "{{user `access_key`}}",
|
||||
"secret_key": "{{user `secret_key`}}",
|
||||
"region": "us-east-1",
|
||||
"source_ami": "ami-fce3c696,",
|
||||
"instance_type": "t2.micro",
|
||||
"ssh_username": "ubuntu",
|
||||
"ami_name": "packer-example {{timestamp}}"
|
||||
}]
|
||||
}]
|
||||
|
||||
"provisioners": [{
|
||||
"type": "shell",
|
||||
"inline": [
|
||||
"sleep 15",
|
||||
"sudo yum update -y"
|
||||
]
|
||||
}]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user