-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3685 from nickanderson/mergedata-json-strings/master
Add simple mergedata test for merging plain JSON strings
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
tests/acceptance/01_vars/02_functions/mergedata-json-strings.cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/var/cfengine/bin/cf-agent -f- | ||
body common control | ||
{ | ||
inputs => { | ||
"../../default.cf.sub" | ||
}; | ||
bundlesequence => { default("$(this.promise_filename)") }; | ||
} | ||
|
||
bundle agent test | ||
{ | ||
meta: | ||
"description" | ||
string => "Test that plain json strings can be merged"; | ||
|
||
vars: | ||
"merged" data => mergedata( '[]', '{ "one": "1" }', '{ "two":"2"}' ); | ||
|
||
files: | ||
"$(G.testfile)" | ||
create => "true", | ||
edit_template_string => "{{%-top-}}", | ||
template_method => "inline_mustache", | ||
template_data => @(merged); | ||
} | ||
|
||
bundle agent check | ||
{ | ||
methods: | ||
"PASS/FAIL" | ||
usebundle => dcs_check_diff("$(G.testfile)", | ||
"$(this.promise_filename).expected", | ||
"$(this.promise_filename)"); | ||
} | ||
|
4 changes: 4 additions & 0 deletions
4
tests/acceptance/01_vars/02_functions/mergedata-json-strings.cf.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"one": "1", | ||
"two": "2" | ||
} |