Skip to content

Commit

Permalink
Merge pull request #3685 from nickanderson/mergedata-json-strings/master
Browse files Browse the repository at this point in the history
Add simple mergedata test for merging plain JSON strings
  • Loading branch information
vpodzime authored Jul 4, 2019
2 parents 3c4d046 + 71b4f66 commit 678b737
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/acceptance/01_vars/02_functions/mergedata-json-strings.cf
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)");
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"one": "1",
"two": "2"
}

0 comments on commit 678b737

Please sign in to comment.