diff --git a/tests/acceptance/00_basics/01_compiler/001.cf b/tests/acceptance/00_basics/01_compiler/001.cf index 40d0430d57..776da29755 100644 --- a/tests/acceptance/00_basics/01_compiler/001.cf +++ b/tests/acceptance/00_basics/01_compiler/001.cf @@ -5,61 +5,58 @@ ##################################################### body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile).SOURCE" - create => "true"; + "$(G.testfile)" delete => init_delete; + "$(G.testfile).SOURCE" create => "true"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" move_obstructions => "true", link_from => test_link; - meta: - "test_suppress_fail" string => "windows", - meta => { "redmine4608" }; + meta: + "test_suppress_fail" + string => "windows", + meta => { "redmine4608" }; } body link_from test_link { - source => "$(G.testfile).SOURCE"; - link_type => "hardlink"; + source => "$(G.testfile).SOURCE"; + link_type => "hardlink"; } ####################################################### - bundle agent check { classes: - "ok" expression => fileexists("$(G.testfile)"); + "ok" expression => fileexists("$(G.testfile)"); reports: DEBUG:: "This test should pass as a precursor to a bunch of related failures"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/01_compiler/007.cf b/tests/acceptance/00_basics/01_compiler/007.cf index 39117618e8..c7d6fc1e97 100644 --- a/tests/acceptance/00_basics/01_compiler/007.cf +++ b/tests/acceptance/00_basics/01_compiler/007.cf @@ -5,53 +5,51 @@ ##################################################### body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", action => test_action; } body action test_action { - log_level => "verbose"; + log_level => "verbose"; } ####################################################### - bundle agent check { classes: - "ok" expression => fileexists("$(G.testfile)"); + "ok" expression => fileexists("$(G.testfile)"); reports: DEBUG:: "This test should pass as a precursor to a bunch of related failures"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/01_compiler/013.cf b/tests/acceptance/00_basics/01_compiler/013.cf index 3abf326527..8365bc4d0c 100644 --- a/tests/acceptance/00_basics/01_compiler/013.cf +++ b/tests/acceptance/00_basics/01_compiler/013.cf @@ -5,53 +5,51 @@ ##################################################### body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", action => test_action; } body action test_action { - log_priority => "alert"; + log_priority => "alert"; } ####################################################### - bundle agent check { classes: - "ok" expression => fileexists("$(G.testfile)"); + "ok" expression => fileexists("$(G.testfile)"); reports: DEBUG:: "This test should pass as a precursor to a bunch of related failures"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/01_compiler/019.cf b/tests/acceptance/00_basics/01_compiler/019.cf index 33d42bc722..38246f797f 100644 --- a/tests/acceptance/00_basics/01_compiler/019.cf +++ b/tests/acceptance/00_basics/01_compiler/019.cf @@ -5,54 +5,52 @@ ##################################################### body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", action => test_action; } body action test_action { - action_policy => "warn"; + action_policy => "warn"; } ####################################################### - bundle agent check { classes: - "ok" expression => fileexists("$(G.testfile)"); + "ok" expression => fileexists("$(G.testfile)"); reports: DEBUG:: "This test should pass as a precursor to a bunch of related failures"; "This test should not create $(G.testfile)"; + ok:: "$(this.promise_filename) FAIL"; + !ok:: "$(this.promise_filename) Pass"; } diff --git a/tests/acceptance/00_basics/01_compiler/025.cf b/tests/acceptance/00_basics/01_compiler/025.cf index 979bd6deef..43d2c1fe35 100644 --- a/tests/acceptance/00_basics/01_compiler/025.cf +++ b/tests/acceptance/00_basics/01_compiler/025.cf @@ -5,53 +5,51 @@ ##################################################### body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", action => test_action; } body action test_action { - report_level => "verbose"; + report_level => "verbose"; } ####################################################### - bundle agent check { classes: - "ok" expression => fileexists("$(G.testfile)"); + "ok" expression => fileexists("$(G.testfile)"); reports: DEBUG:: "This test should pass as a precursor to a bunch of related failures"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/01_compiler/031.cf b/tests/acceptance/00_basics/01_compiler/031.cf index 20ae9b60b6..054848e894 100644 --- a/tests/acceptance/00_basics/01_compiler/031.cf +++ b/tests/acceptance/00_basics/01_compiler/031.cf @@ -5,47 +5,44 @@ ##################################################### body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } ####################################################### - bundle agent check { classes: - "ok" expression => fileexists("$(G.testfile)"); + "ok" expression => fileexists("$(G.testfile)"); reports: DEBUG:: "This test should pass as a precursor to a bunch of related failures"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/01_compiler/037.cf b/tests/acceptance/00_basics/01_compiler/037.cf index 4af0dfb41c..4fc2191906 100644 --- a/tests/acceptance/00_basics/01_compiler/037.cf +++ b/tests/acceptance/00_basics/01_compiler/037.cf @@ -5,51 +5,49 @@ ##################################################### body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", classes => test_action; } body classes test_action { - promise_repaired => { "ok" }; - persist_time => "10"; + promise_repaired => { "ok" }; + persist_time => "10"; } ####################################################### - bundle agent check { reports: DEBUG:: "This test should pass as a precursor to a bunch of related failures"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/01_compiler/100.cf b/tests/acceptance/00_basics/01_compiler/100.cf index 671847c011..a0db0679b2 100644 --- a/tests/acceptance/00_basics/01_compiler/100.cf +++ b/tests/acceptance/00_basics/01_compiler/100.cf @@ -3,47 +3,49 @@ # Test that ${this.promiser} is expanded in comments (Issue 691) # ##################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "subout" string => execresult("$(sys.cf_agent) -Kvf $(this.promise_filename).sub | grep Comment", "useshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -Kvf $(this.promise_filename).sub | grep Comment", + "useshell" + ); + meta: - "test_skip_needs_work" string => "windows"; + "test_skip_needs_work" string => "windows"; } ####################################################### - bundle agent check { classes: - "ok1" not => regcmp(".*this\.promiser.*", "$(test.subout)"); - "ok2" expression => regcmp(".*foobar.*", "$(test.subout)"); - - "ok" and => { "ok1", "ok2" }; + "ok1" not => regcmp(".*this\.promiser.*", "$(test.subout)"); + "ok2" expression => regcmp(".*foobar.*", "$(test.subout)"); + "ok" and => { "ok1", "ok2" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + DEBUG:: "$(test.subout)"; } diff --git a/tests/acceptance/00_basics/01_compiler/101.cf b/tests/acceptance/00_basics/01_compiler/101.cf index 2c494d7690..d5a2466b44 100644 --- a/tests/acceptance/00_basics/01_compiler/101.cf +++ b/tests/acceptance/00_basics/01_compiler/101.cf @@ -3,43 +3,41 @@ # Test that \ expands correctly by eating newline (Issue 696) # ##################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "mystring" string => "some\ + "mystring" string => "some\ thing"; } ####################################################### - bundle agent check { classes: - "ok" expression => strcmp("$(test.mystring)", "something"); + "ok" expression => strcmp("$(test.mystring)", "something"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + DEBUG:: "$(test.subout)"; } diff --git a/tests/acceptance/00_basics/01_compiler/103.cf b/tests/acceptance/00_basics/01_compiler/103.cf index 0bca26017b..b3a3b4f98f 100644 --- a/tests/acceptance/00_basics/01_compiler/103.cf +++ b/tests/acceptance/00_basics/01_compiler/103.cf @@ -1,16 +1,15 @@ # Check that empty input lists work - body common control { - inputs => { @(g.inputs) }; - bundlesequence => { check }; - version => "1.0"; + inputs => { @(g.inputs) }; + bundlesequence => { check }; + version => "1.0"; } bundle common g { vars: - "inputs" slist => { }; + "inputs" slist => {}; } bundle agent check @@ -18,6 +17,7 @@ bundle agent check reports: DEBUG:: "This test should pass as a precursor to a bunch of related failures"; + any:: "$(this.promise_filename) Pass"; } diff --git a/tests/acceptance/00_basics/01_compiler/104.cf b/tests/acceptance/00_basics/01_compiler/104.cf index e8aead81a2..57f88d3b81 100644 --- a/tests/acceptance/00_basics/01_compiler/104.cf +++ b/tests/acceptance/00_basics/01_compiler/104.cf @@ -1,16 +1,15 @@ # Check that it's OK to have an empty list in inputs - body common control { - inputs => { @(g.inputs) }; - bundlesequence => { check }; - version => "1.0"; + inputs => { @(g.inputs) }; + bundlesequence => { check }; + version => "1.0"; } bundle common g { vars: - "inputs" slist => { }; + "inputs" slist => {}; } bundle agent check @@ -18,6 +17,7 @@ bundle agent check reports: DEBUG:: "This test should pass as a precursor to a bunch of related failures"; + any:: "$(this.promise_filename) Pass"; } diff --git a/tests/acceptance/00_basics/01_compiler/105.cf b/tests/acceptance/00_basics/01_compiler/105.cf index 18d50d576c..e6e74da7a9 100644 --- a/tests/acceptance/00_basics/01_compiler/105.cf +++ b/tests/acceptance/00_basics/01_compiler/105.cf @@ -1,10 +1,9 @@ # Check that empty bundles work (Redmine #2411) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -18,5 +17,5 @@ bundle agent test bundle agent check { reports: - "$(this.promise_filename) Pass"; + "$(this.promise_filename) Pass"; } diff --git a/tests/acceptance/00_basics/01_compiler/800.cf b/tests/acceptance/00_basics/01_compiler/800.cf index a1158333ea..887455fe62 100644 --- a/tests/acceptance/00_basics/01_compiler/800.cf +++ b/tests/acceptance/00_basics/01_compiler/800.cf @@ -4,12 +4,11 @@ # (Acceptance test for redmine #2988) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -17,31 +16,37 @@ bundle agent init } ####################################################### - bundle agent test { vars: debian:: - "myflavor" string => execresult("/bin/grep Debian.*GNU /etc/issue | /usr/bin/cut -d' ' -f3 | cut -d. -f1 | cut -d/ -f1", "useshell"); + "myflavor" + string => execresult( + "/bin/grep Debian.*GNU /etc/issue | /usr/bin/cut -d' ' -f3 | cut -d. -f1 | cut -d/ -f1", + "useshell" + ); } ####################################################### - bundle agent check { classes: debian.!ubuntu:: "ok" expression => strcmp("$(sys.flavor)", "debian_$(test.myflavor)"); + ubuntu:: "ok" expression => "any"; + !debian:: "ok" expression => "any"; reports: DEBUG:: "Compared $(sys.flavor) to debian_$(test.myflavor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/01_compiler/cf-promises-99999999999.cf b/tests/acceptance/00_basics/01_compiler/cf-promises-99999999999.cf index b54b001c03..5810bf3cb3 100644 --- a/tests/acceptance/00_basics/01_compiler/cf-promises-99999999999.cf +++ b/tests/acceptance/00_basics/01_compiler/cf-promises-99999999999.cf @@ -9,54 +9,63 @@ # it will be truncated to LONG_MAX. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - # With this body we're making sure cf-promises won't bail out on # this. This is exactly the body that cf-promises was rejecting before # the fix. body classes u_always_forever(theclass) { - persist_time => 99999999999; + persist_time => 99999999999; } ####################################################### - bundle agent init { vars: - # truncation will happen on 32-bit architectures - "x" int => "99999999999"; - "y" int => "-99999999999"; + # truncation will happen on 32-bit architectures + "x" int => "99999999999"; + "y" int => "-99999999999"; } bundle agent test { classes: - "x_ok" or => { strcmp("$(init.x)", "99999999999"), # 64-bit arch - strcmp("$(init.x)", "2147483647") # 32-bit arch - }, scope => "namespace"; - "y_ok" or => { strcmp("$(init.y)", "-99999999999"), # 64-bit arch - strcmp("$(init.y)", "-2147483648") # 32-bit arch - }, scope => "namespace"; + "x_ok" + or => { + strcmp("$(init.x)", "99999999999"), + # 64-bit arch + strcmp("$(init.x)", "2147483647"), + # 32-bit arch + }, + scope => "namespace"; + + "y_ok" + or => { + strcmp("$(init.y)", "-99999999999"), + # 64-bit arch + strcmp("$(init.y)", "-2147483648"), + # 32-bit arch + }, + scope => "namespace"; } bundle agent check { reports: - DEBUG:: "x is $(init.x), should be 99999999999 or LONG_MAX"; "y is $(init.y), should be -99999999999 or LONG_MIN"; + x_ok.y_ok:: "$(this.promise_filename) Pass"; + !x_ok|!y_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/01_compiler/cf-promises-common-bundles-only.cf b/tests/acceptance/00_basics/01_compiler/cf-promises-common-bundles-only.cf index 092d26a689..d6129e2739 100644 --- a/tests/acceptance/00_basics/01_compiler/cf-promises-common-bundles-only.cf +++ b/tests/acceptance/00_basics/01_compiler/cf-promises-common-bundles-only.cf @@ -4,7 +4,6 @@ # NOTE: changed to if --eval-functions=no # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; @@ -14,29 +13,32 @@ body common control bundle agent init { - } - bundle agent test { -vars: - "subout" string => execresult("$(sys.cf_promises) --eval-functions=no -v -f $(this.promise_filename).sub | $(G.grep) PURPLE", "useshell"); + vars: + "subout" + string => execresult( + "$(sys.cf_promises) --eval-functions=no -v -f $(this.promise_filename).sub | $(G.grep) PURPLE", + "useshell" + ); } bundle agent check { -# If the output contains the string, we fail -classes: - "ok1" not => regcmp(".*PURPLE_DINOSAUR.*", "$(test.subout)"); - "ok" and => { "ok1" }; + # If the output contains the string, we fail + classes: + "ok1" not => regcmp(".*PURPLE_DINOSAUR.*", "$(test.subout)"); + "ok" and => { "ok1" }; + + reports: + DEBUG:: + "PURPLE TEST: $(test.subout)"; -reports: - DEBUG:: - "PURPLE TEST: $(test.subout)"; + ok:: + "$(this.promise_filename) Pass"; - ok:: - "$(this.promise_filename) Pass"; - !ok:: - "$(this.promise_filename) FAIL"; + !ok:: + "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/01_compiler/cf-promises-json-long-strings.cf b/tests/acceptance/00_basics/01_compiler/cf-promises-json-long-strings.cf index 1894dab224..539def9b03 100644 --- a/tests/acceptance/00_basics/01_compiler/cf-promises-json-long-strings.cf +++ b/tests/acceptance/00_basics/01_compiler/cf-promises-json-long-strings.cf @@ -1,35 +1,33 @@ # Test that cf-promises doesn't fail if ppkeys are missing - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "2.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "2.0"; } bundle agent test { meta: - - "description" -> { "CFE-2383", "CFE-2310" } - string => "Test that json representation of policy is not truncated."; + "description" -> { "CFE-2383", "CFE-2310" } + string => "Test that json representation of policy is not truncated."; vars: - "output" - string => execresult( "$(sys.cf_promises) -p json -f $(this.promise_filename).sub", "noshell" ); - + "output" + string => execresult( + "$(sys.cf_promises) -p json -f $(this.promise_filename).sub", "noshell" + ); } bundle agent check { classes: - - "validated_ok" expression => regcmp( ".*endflag.*", $(test.output) ); + "validated_ok" expression => regcmp(".*endflag.*", $(test.output)); reports: - validated_ok:: "$(this.promise_filename) Pass"; + !validated_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/01_compiler/cf-promises-without-ppkeys.cf b/tests/acceptance/00_basics/01_compiler/cf-promises-without-ppkeys.cf index d44b260802..755a147531 100644 --- a/tests/acceptance/00_basics/01_compiler/cf-promises-without-ppkeys.cf +++ b/tests/acceptance/00_basics/01_compiler/cf-promises-without-ppkeys.cf @@ -1,22 +1,21 @@ # Test that cf-promises doesn't fail if ppkeys are missing - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { methods: - "clear ppkeys" usebundle => dcs_fini("$(sys.workdir)/ppkeys"); + "clear ppkeys" usebundle => dcs_fini("$(sys.workdir)/ppkeys"); } bundle agent test { commands: - "$(sys.cf_promises) -f $(this.promise_filename)" + "$(sys.cf_promises) -f $(this.promise_filename)" classes => scoped_classes_generic("namespace", "validated"); } @@ -25,6 +24,7 @@ bundle agent check reports: validated_ok:: "$(this.promise_filename) Pass"; + validated_not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/01_compiler/classes_without_constraints.cf b/tests/acceptance/00_basics/01_compiler/classes_without_constraints.cf index 05a0bf0a70..410911fc22 100644 --- a/tests/acceptance/00_basics/01_compiler/classes_without_constraints.cf +++ b/tests/acceptance/00_basics/01_compiler/classes_without_constraints.cf @@ -1,24 +1,21 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - - "description" -> { "CFE-2000" } - string => "Test that classes can be defined without any + "description" -> { "CFE-2000" } + string => "Test that classes can be defined without any constraints/attributes"; classes: - - "supercalifragilisticexpialidocious"; + "supercalifragilisticexpialidocious"; reports: - supercalifragilisticexpialidocious:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/00_basics/01_compiler/depends_on.cf b/tests/acceptance/00_basics/01_compiler/depends_on.cf index 4dbee8e829..84e946b2c8 100644 --- a/tests/acceptance/00_basics/01_compiler/depends_on.cf +++ b/tests/acceptance/00_basics/01_compiler/depends_on.cf @@ -1,10 +1,9 @@ # Test depends_on - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -14,79 +13,93 @@ bundle agent init bundle agent test { vars: - "expandit" slist => { "hc2" }; + "expandit" slist => { "hc2" }; methods: - "zebra" usebundle => zebra:zebra; + "zebra" usebundle => zebra:zebra; classes: - "c1" expression => "any", + "c1" + expression => "any", scope => "namespace", handle => "hc1", - depends_on => { }; + depends_on => {}; - "c2" expression => "any", + "c2" + expression => "any", scope => "namespace", handle => "hc2", depends_on => { "hc1", "me2" }; - "c3" expression => "any", + "c3" + expression => "any", scope => "namespace", handle => "hc3", depends_on => { "$(expandit)" }; - "c4" expression => "any", + "c4" + expression => "any", scope => "namespace", handle => "hc4", depends_on => { "nosuchhandle" }; - "c5" expression => "any", + "c5" + expression => "any", scope => "namespace", handle => "hc5", depends_on => { "zebra.zebra" }; - "c6" expression => "any", + "c6" + expression => "any", scope => "namespace", handle => "hc6", depends_on => { "zebra:zebra" }; reports: - "me too" handle => "me2"; + "me too" handle => "me2"; } bundle agent check { classes: - "ok" and => { "c1", "c2", "c3", "!c4", "!c5", "!c6", }; + "ok" and => { "c1", "c2", "c3", "!c4", "!c5", "!c6" }; reports: DEBUG.!c1:: "bad: c1 was NOT defined"; + DEBUG.!c2:: "bad: c2 was NOT defined"; + DEBUG.!c3:: "bad: c3 was NOT defined"; + DEBUG.c4:: "bad: c4 WAS defined"; + DEBUG.c5:: "bad: c5 WAS defined"; + DEBUG.c6:: "bad: c6 WAS defined"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } body file control { - namespace => "zebra"; + namespace => "zebra"; } bundle agent zebra { classes: - "zebra" expression => "any", + "zebra" + expression => "any", scope => "namespace", handle => "zebra"; } diff --git a/tests/acceptance/00_basics/01_compiler/depends_on_canonify.cf b/tests/acceptance/00_basics/01_compiler/depends_on_canonify.cf index 9b3e53f1ba..fc58d7899c 100644 --- a/tests/acceptance/00_basics/01_compiler/depends_on_canonify.cf +++ b/tests/acceptance/00_basics/01_compiler/depends_on_canonify.cf @@ -1,10 +1,9 @@ # Test depends_on with a canonify() function call - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -14,24 +13,26 @@ bundle agent init bundle agent test { classes: - # this works - "foo1" expression => "any", + # this works + "foo1" + expression => "any", depends_on => { canonify($(G.testfile)) }; methods: - "" usebundle => test2($(G.testfile)); + "" usebundle => test2($(G.testfile)); } bundle agent test2(file) { classes: - # this fails - "foo2" expression => "any", + # this fails + "foo2" + expression => "any", depends_on => { canonify($(file)) }; } bundle agent check { reports: - "$(this.promise_filename) Pass"; + "$(this.promise_filename) Pass"; } diff --git a/tests/acceptance/00_basics/01_compiler/no_error_when_key_contains_space.cf b/tests/acceptance/00_basics/01_compiler/no_error_when_key_contains_space.cf index 1678bd2e5c..3305a917e6 100644 --- a/tests/acceptance/00_basics/01_compiler/no_error_when_key_contains_space.cf +++ b/tests/acceptance/00_basics/01_compiler/no_error_when_key_contains_space.cf @@ -1,22 +1,21 @@ # This test should be renamed from .x.cf to .cf when the bug is fixed. - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "description" -> { "CFE-3320" } + "description" -> { "CFE-3320" } string => "Test that data container keys can contain spaces"; vars: - "d" data => '{ + "d" + data => '{ "thing s": [ { "Title": "ExpectedPick", @@ -25,16 +24,16 @@ bundle agent test ] }'; - "selected" - string => "$(d[thing s][0][Title])", - if => "$(d[thing s][0][classexpr])"; - # Note: wrapping with concat or classify prevents the error - # if => concat("$(d[thing s][$(di)][classexpr])"); - # if => classify("$(d[thing s][$(di)][classexpr])"); + "selected" + string => "$(d[thing s][0][Title])", + if => "$(d[thing s][0][classexpr])"; - "sanity_check" - string => "You are sane", - if => "$(sys.class)"; + # Note: wrapping with concat or classify prevents the error + # if => concat("$(d[thing s][$(di)][classexpr])"); + # if => classify("$(d[thing s][$(di)][classexpr])"); + "sanity_check" + string => "You are sane", + if => "$(sys.class)"; reports: EXTRA|DEBUG:: @@ -46,15 +45,14 @@ bundle agent test } ####################################################### - bundle agent check { vars: - "expected_selection" string => "ExpectedPick"; + "expected_selection" string => "ExpectedPick"; methods: - "Pass/Fail" - usebundle => dcs_check_strcmp($(expected_selection), $(test.selected), - $(this.promise_filename), "no"); - + "Pass/Fail" + usebundle => dcs_check_strcmp( + $(expected_selection), $(test.selected), $(this.promise_filename), "no" + ); } diff --git a/tests/acceptance/00_basics/01_compiler/staging/043.cf b/tests/acceptance/00_basics/01_compiler/staging/043.cf index e3a6fbba24..22990e4986 100644 --- a/tests/acceptance/00_basics/01_compiler/staging/043.cf +++ b/tests/acceptance/00_basics/01_compiler/staging/043.cf @@ -5,49 +5,48 @@ ##################################################### body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { guest_environments: - "host1" + "host1" environment_host => "test", classes => whatever("ok"); } body classes whatever(c) { - promise_kept => { "$(c)" }; - promise_repaired => { "$(c)" }; + promise_kept => { "$(c)" }; + promise_repaired => { "$(c)" }; } ####################################################### - bundle agent check { reports: DEBUG:: "This test should pass as a precursor to a bunch of related failures"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/01_compiler/string_contexts.cf b/tests/acceptance/00_basics/01_compiler/string_contexts.cf index 98e53612b7..0bf5503ac2 100644 --- a/tests/acceptance/00_basics/01_compiler/string_contexts.cf +++ b/tests/acceptance/00_basics/01_compiler/string_contexts.cf @@ -1,54 +1,63 @@ # fixes https://dev.cfengine.com/issues/2504 # using variables in string contexts - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { defaults: - "s1" string => "1"; - "s2" string => "2"; - "s3" string => "3"; - "s4" string => "4"; - "s5" string => "5"; - "s6" string => "6"; - "s7" string => "7"; - "s8" string => "8"; + "s1" string => "1"; + "s2" string => "2"; + "s3" string => "3"; + "s4" string => "4"; + "s5" string => "5"; + "s6" string => "6"; + "s7" string => "7"; + "s8" string => "8"; classes: - "$(mylist)" expression => "any"; + "$(mylist)" expression => "any"; vars: - "mylist" slist => { "a", "b", "c" }; - "myvar" string => "me"; - "myclass" string => "any"; - "s1" string => "hello, this is $(myvar)", + "mylist" slist => { "a", "b", "c" }; + "myvar" string => "me"; + "myclass" string => "any"; + + "s1" + string => "hello, this is $(myvar)", if => "$(myclass)"; + any:: "s2" string => "any hello"; + 'any':: "s3" string => "string hello"; + "$(myclass)":: "s4" string => "variable context hello!!!"; "s4_2" string => "variable context hello!!!"; + "$(myclass).any":: "s5" string => "compound variable context hello!!!"; + "not$(myclass)":: "s6" string => "BAD variable context hello!!!"; + "$(myclass)":: - "s7" string => "augmented variable context hello!!!", - if => "any"; + "s7" + string => "augmented variable context hello!!!", + if => "any"; "$(myclass)":: - "s8" string => "BAD augmented variable context hello!!!", - if => "nonesuch"; + "s8" + string => "BAD augmented variable context hello!!!", + if => "nonesuch"; + "$(mylist).cfengine":: "iterated_$(mylist)" string => "iteration class $(mylist)"; @@ -56,31 +65,38 @@ bundle agent test "whitespace1" string => "$(this.promiser): quoted with spaces"; myclass . cfengine | any:: - "whitespace2" string => "$(this.promiser): unquoted with spaces, starts with valid class"; + "whitespace2" + string => "$(this.promiser): unquoted with spaces, starts with valid class"; nosuchclass . any:: - "whitespace3" string => "$(this.promiser): unquoted with spaces, should be missing"; + "whitespace3" + string => "$(this.promiser): unquoted with spaces, should be missing"; nosuchclass | any:: - "whitespace4" string => "$(this.promiser): unquoted with spaces, starts with missing class but is true"; + "whitespace4" + string => "$(this.promiser): unquoted with spaces, starts with missing class but is true"; any | ( cfengine | linux ):: - "whitespace5" string => "$(this.promiser): remove spaces and tabs from an expression"; + "whitespace5" + string => "$(this.promiser): remove spaces and tabs from an expression"; any . ( nosuchclass . any ):: - "whitespace6" string => "$(this.promiser): remove spaces and tabs from an expression that is false in the end, should be missing"; + "whitespace6" + string => "$(this.promiser): remove spaces and tabs from an expression that is false in the end, should be missing"; "cf engine":: - "whitespace7" string => "$(this.promiser): quoted with spaces but no operators, should be missing with an error"; - + "whitespace7" + string => "$(this.promiser): quoted with spaces but no operators, should be missing with an error"; } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/01_compiler/string_contexts_rval.cf b/tests/acceptance/00_basics/01_compiler/string_contexts_rval.cf index 4b71e48ec4..932e1f2939 100644 --- a/tests/acceptance/00_basics/01_compiler/string_contexts_rval.cf +++ b/tests/acceptance/00_basics/01_compiler/string_contexts_rval.cf @@ -1,11 +1,10 @@ # fixes https://dev.cfengine.com/issues/2504 using variables in string # contexts when a promise has a previous if *with a FnCall* - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test @@ -16,6 +15,5 @@ bundle agent check { reports: "any":: - "$(this.promise_filename) Pass" - if => and("any"); + "$(this.promise_filename) Pass" if => and("any"); } diff --git a/tests/acceptance/00_basics/01_compiler/trailing_comma_args.cf b/tests/acceptance/00_basics/01_compiler/trailing_comma_args.cf index d0cbc19ffc..df005a60f8 100644 --- a/tests/acceptance/00_basics/01_compiler/trailing_comma_args.cf +++ b/tests/acceptance/00_basics/01_compiler/trailing_comma_args.cf @@ -8,12 +8,12 @@ bundle agent test classes: # Testing function call "exists" expression => fileexists($(this.promise_filename)); - "exists_trailing" expression => fileexists($(this.promise_filename), ); + "exists_trailing" expression => fileexists($(this.promise_filename)); methods: # Testing bundle call "check" usebundle => check("a", "b", "c"); - "check_trailing" usebundle => check("d", "e", "f", ); + "check_trailing" usebundle => check("d", "e", "f"); reports: exists.exists_trailing.abc.def:: @@ -26,6 +26,5 @@ bundle agent test bundle agent check(a, b, c) { classes: - "$(a)$(b)$(c)" - scope => "namespace"; + "$(a)$(b)$(c)" scope => "namespace"; } diff --git a/tests/acceptance/00_basics/01_compiler/trailing_comma_paramlist.cf b/tests/acceptance/00_basics/01_compiler/trailing_comma_paramlist.cf index ee419aac13..6ab05e8dcf 100644 --- a/tests/acceptance/00_basics/01_compiler/trailing_comma_paramlist.cf +++ b/tests/acceptance/00_basics/01_compiler/trailing_comma_paramlist.cf @@ -6,12 +6,11 @@ body common control bundle agent test { methods: - "check" - usebundle => check("a", "b", "c"); + "check" usebundle => check("a", "b", "c"); } -bundle agent check(a, b, c,) +bundle agent check(a, b, c) { reports: - "$(this.promise_filename) Pass"; + "$(this.promise_filename) Pass"; } diff --git a/tests/acceptance/00_basics/01_compiler/with_iteration.cf b/tests/acceptance/00_basics/01_compiler/with_iteration.cf index de8da1a20e..27fb4c3989 100644 --- a/tests/acceptance/00_basics/01_compiler/with_iteration.cf +++ b/tests/acceptance/00_basics/01_compiler/with_iteration.cf @@ -3,39 +3,69 @@ # Test the "with" promise attribute # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent test { vars: - "probe" string => "0"; - "iter" slist => { "1", "2", "3" }; - "A$(with)" string => "promiser addition = $(with)", with => canonify(concat("promiser ", canonify("addition"))); - "B$(with)" string => "clean = $(with)", with => canonify("clean"); - "C$(with)" string => "my name is = $(with)", with => canonify("my name is canonified"); - "D1$(with)" string => "iter1 = $(with)", with => $(iter); - "D2$(with)" string => "iter2 = $(with)", with => $(iter); - "E$(with)" string => "probe = $(with)", with => $(probe); - "F$(with)" string => "iter = $(with)", with => concat("iter_canon_", canonify($(iter))); - "G1$(with)" string => "iter = $(with)", with => concat("iter_canon_", canonify($(iter))); - "G2$(with)" string => "iter = $(with)", with => canonify($(iter)); - "H" string => "$(with)", with => format("%S", iter); + "probe" string => "0"; + "iter" slist => { "1", "2", "3" }; + + "A$(with)" + string => "promiser addition = $(with)", + with => canonify(concat("promiser ", canonify("addition"))); + + "B$(with)" + string => "clean = $(with)", + with => canonify("clean"); + + "C$(with)" + string => "my name is = $(with)", + with => canonify("my name is canonified"); + + "D1$(with)" + string => "iter1 = $(with)", + with => $(iter); + + "D2$(with)" + string => "iter2 = $(with)", + with => $(iter); + + "E$(with)" + string => "probe = $(with)", + with => $(probe); + + "F$(with)" + string => "iter = $(with)", + with => concat("iter_canon_", canonify($(iter))); + + "G1$(with)" + string => "iter = $(with)", + with => concat("iter_canon_", canonify($(iter))); + + "G2$(with)" + string => "iter = $(with)", + with => canonify($(iter)); + + "H" + string => "$(with)", + with => format("%S", iter); } ########################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/02_switches/001.cf b/tests/acceptance/00_basics/02_switches/001.cf index b8cbd6d7e9..398aac65f1 100644 --- a/tests/acceptance/00_basics/02_switches/001.cf +++ b/tests/acceptance/00_basics/02_switches/001.cf @@ -3,24 +3,22 @@ # This is a special test - it exercises runtime switches # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { test }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { test }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "cmd" string => - "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,ok"; + "cmd" + string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,ok"; commands: - "$(cmd)"; + "$(cmd)"; reports: DEBUG:: diff --git a/tests/acceptance/00_basics/02_switches/002.cf b/tests/acceptance/00_basics/02_switches/002.cf index d1a2cf7109..a0d09f8d19 100644 --- a/tests/acceptance/00_basics/02_switches/002.cf +++ b/tests/acceptance/00_basics/02_switches/002.cf @@ -3,24 +3,22 @@ # This is a special test - it exercises runtime switches # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { test }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { test }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "cmd" string => - "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,ok,"; + "cmd" + string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,ok,"; commands: - "$(cmd)"; + "$(cmd)"; reports: DEBUG:: diff --git a/tests/acceptance/00_basics/02_switches/003.cf b/tests/acceptance/00_basics/02_switches/003.cf index 17a5c6c87c..c553370429 100644 --- a/tests/acceptance/00_basics/02_switches/003.cf +++ b/tests/acceptance/00_basics/02_switches/003.cf @@ -3,24 +3,22 @@ # This is a special test - it exercises runtime switches # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { test }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { test }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "cmd" string => - "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,ok_"; + "cmd" + string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,ok_"; commands: - "$(cmd)"; + "$(cmd)"; reports: DEBUG:: diff --git a/tests/acceptance/00_basics/02_switches/004.cf b/tests/acceptance/00_basics/02_switches/004.cf index a6294dc847..b2c5144c96 100644 --- a/tests/acceptance/00_basics/02_switches/004.cf +++ b/tests/acceptance/00_basics/02_switches/004.cf @@ -3,24 +3,22 @@ # This is a special test - it exercises runtime switches # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { test }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { test }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "cmd" string => - "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,ok."; + "cmd" + string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,ok."; commands: - "$(cmd)"; + "$(cmd)"; reports: DEBUG:: diff --git a/tests/acceptance/00_basics/02_switches/005.cf b/tests/acceptance/00_basics/02_switches/005.cf index 070ebda893..c8cf77f8ea 100644 --- a/tests/acceptance/00_basics/02_switches/005.cf +++ b/tests/acceptance/00_basics/02_switches/005.cf @@ -3,24 +3,22 @@ # This is a special test - it exercises runtime switches # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { test }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { test }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "cmd" string => - "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO -N ok"; + "cmd" + string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO -N ok"; commands: - "$(cmd)"; + "$(cmd)"; reports: DEBUG:: diff --git a/tests/acceptance/00_basics/02_switches/006.cf b/tests/acceptance/00_basics/02_switches/006.cf index 964e91f74a..4f4a44125c 100644 --- a/tests/acceptance/00_basics/02_switches/006.cf +++ b/tests/acceptance/00_basics/02_switches/006.cf @@ -3,24 +3,22 @@ # This is a special test - it exercises runtime switches # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { test }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { test }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "cmd" string => - "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,MAIN -N ok"; + "cmd" + string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,MAIN -N ok"; commands: - "$(cmd)"; + "$(cmd)"; reports: DEBUG:: diff --git a/tests/acceptance/00_basics/02_switches/008.cf b/tests/acceptance/00_basics/02_switches/008.cf index 6c507d82d8..bc7ad65857 100644 --- a/tests/acceptance/00_basics/02_switches/008.cf +++ b/tests/acceptance/00_basics/02_switches/008.cf @@ -3,24 +3,22 @@ # This is a special test - it exercises runtime switches # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { test }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { test }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "cmd" string => - "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,MAIN -N ok,foo"; + "cmd" + string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,MAIN -N ok,foo"; commands: - "$(cmd)"; + "$(cmd)"; reports: DEBUG:: diff --git a/tests/acceptance/00_basics/02_switches/010.cf b/tests/acceptance/00_basics/02_switches/010.cf index 2ab267ae3d..ffdc555e18 100644 --- a/tests/acceptance/00_basics/02_switches/010.cf +++ b/tests/acceptance/00_basics/02_switches/010.cf @@ -3,27 +3,26 @@ # This is a special test - it exercises runtime switches # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { test }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { test }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "cmd1" string => - "$(sys.cf_agent) -Kf $(this.promise_filename).sub1 -D AUTO -N bingo"; - "cmd2" string => - "$(sys.cf_agent) -Kf $(this.promise_filename).sub2 -D AUTO"; + "cmd1" + string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub1 -D AUTO -N bingo"; + + "cmd2" + string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub2 -D AUTO"; commands: - "$(cmd1)"; - "$(cmd2)"; + "$(cmd1)"; + "$(cmd2)"; reports: DEBUG:: diff --git a/tests/acceptance/00_basics/02_switches/dry_run_perms_doesnt_lie.cf b/tests/acceptance/00_basics/02_switches/dry_run_perms_doesnt_lie.cf index caa05dc640..5b0dbcb3a9 100644 --- a/tests/acceptance/00_basics/02_switches/dry_run_perms_doesnt_lie.cf +++ b/tests/acceptance/00_basics/02_switches/dry_run_perms_doesnt_lie.cf @@ -1,15 +1,14 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testdir)/." - create => "true"; + "$(G.testdir)/." create => "true"; "$(G.testdir)/redmine_7082" create => "true", @@ -22,21 +21,25 @@ bundle agent init bundle agent test { meta: - "test_soft_fail" string => "windows", + "test_soft_fail" + string => "windows", meta => { "ENT-10217" }; } bundle agent check { vars: - "command" string => "$(sys.cf_agent) -Knf $(this.promise_filename).sub -I -b test"; + "command" + string => "$(sys.cf_agent) -Knf $(this.promise_filename).sub -I -b test"; methods: # Since the agent is run with dry-run (-n) there should be no statement of permissions changing. # In fact, permissions are not changed, the agent only says they are, so it is only the false statement that needs to be checked. "test_agent_output" - usebundle => dcs_passif_output(".*Should change permissions of .* from 0777 to 0700.*", - ".*had permissions 0777, changed it to 0700.*", - $(command), $(this.promise_filename)); - + usebundle => dcs_passif_output( + ".*Should change permissions of .* from 0777 to 0700.*", + ".*had permissions 0777, changed it to 0700.*", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/02_switches/show-evaluated-vars.cf b/tests/acceptance/00_basics/02_switches/show-evaluated-vars.cf index 86ba31c56f..c12f5c00c2 100644 --- a/tests/acceptance/00_basics/02_switches/show-evaluated-vars.cf +++ b/tests/acceptance/00_basics/02_switches/show-evaluated-vars.cf @@ -3,35 +3,34 @@ # This is a special test - it exercises runtime switches # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "description" -> { "ENT-7724", "ENT-7678" } - string => "Test --show-evaluated-vars does not crash the agent when there are vars defined by the module protocol that do not have explicit tags defined."; + "description" -> { "ENT-7724", "ENT-7678" } + string => "Test --show-evaluated-vars does not crash the agent when there are vars defined by the module protocol that do not have explicit tags defined."; - "test_skip_unsupported" - string => "windows", - comment => "The subtest policy uses /bin/echo"; + "test_skip_unsupported" + string => "windows", + comment => "The subtest policy uses /bin/echo"; commands: - "$(sys.cf_agent) -Kf $(this.promise_filename).sub --show-evaluated-vars" - classes => results( "namespace", "sub_agent" ); + "$(sys.cf_agent) -Kf $(this.promise_filename).sub --show-evaluated-vars" + classes => results("namespace", "sub_agent"); } + bundle agent check { methods: - - "Pass/Fail" - usebundle => dcs_passif_expected( "sub_agent_repaired", "sub_agent_not_kept", - "$(this.promise_filename)"); + "Pass/Fail" + usebundle => dcs_passif_expected( + "sub_agent_repaired", "sub_agent_not_kept", "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/00_basics/02_switches/staging/007.cf b/tests/acceptance/00_basics/02_switches/staging/007.cf index 964e91f74a..4f4a44125c 100644 --- a/tests/acceptance/00_basics/02_switches/staging/007.cf +++ b/tests/acceptance/00_basics/02_switches/staging/007.cf @@ -3,24 +3,22 @@ # This is a special test - it exercises runtime switches # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { test }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { test }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "cmd" string => - "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,MAIN -N ok"; + "cmd" + string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,MAIN -N ok"; commands: - "$(cmd)"; + "$(cmd)"; reports: DEBUG:: diff --git a/tests/acceptance/00_basics/02_switches/staging/009.cf b/tests/acceptance/00_basics/02_switches/staging/009.cf index 6c507d82d8..bc7ad65857 100644 --- a/tests/acceptance/00_basics/02_switches/staging/009.cf +++ b/tests/acceptance/00_basics/02_switches/staging/009.cf @@ -3,24 +3,22 @@ # This is a special test - it exercises runtime switches # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { test }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { test }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "cmd" string => - "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,MAIN -N ok,foo"; + "cmd" + string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,MAIN -N ok,foo"; commands: - "$(cmd)"; + "$(cmd)"; reports: DEBUG:: diff --git a/tests/acceptance/00_basics/02_switches/staging/negate_hard_class.cf b/tests/acceptance/00_basics/02_switches/staging/negate_hard_class.cf index 9209edc4c7..5fb373ee64 100644 --- a/tests/acceptance/00_basics/02_switches/staging/negate_hard_class.cf +++ b/tests/acceptance/00_basics/02_switches/staging/negate_hard_class.cf @@ -3,38 +3,39 @@ # Test hard class negation with -N # ####################################################### - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle common test { classes: - "rejected" not => returnszero("$(sys.cf_agent) -Kf $(this.promise_filename).sub -Ncfengine", "noshell"); + "rejected" + not => returnszero( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub -Ncfengine", + "noshell" + ); } ####################################################### - bundle agent check { -classes: + classes: "ok" and => { "rejected" }; -reports: + reports: ok:: - "$(this.promise_filename) Pass"; + "$(this.promise_filename) Pass"; + !ok:: - "$(this.promise_filename) FAIL"; + "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/001.cf b/tests/acceptance/00_basics/03_bodies/001.cf index 3486e14bf3..6b841777b4 100644 --- a/tests/acceptance/00_basics/03_bodies/001.cf +++ b/tests/acceptance/00_basics/03_bodies/001.cf @@ -1,30 +1,29 @@ # Test that log_failed without log_kept does not segfault (Mantis #1107) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { files: - "$(G.testdir)/foo.txt" + "$(G.testdir)/foo.txt" create => "true", action => log; } body action log { - log_failed => "stdout"; - log_string => ""; + log_failed => "stdout"; + log_string => ""; } bundle agent check diff --git a/tests/acceptance/00_basics/03_bodies/002.cf b/tests/acceptance/00_basics/03_bodies/002.cf index ee7c969102..3b26fbd4bb 100644 --- a/tests/acceptance/00_basics/03_bodies/002.cf +++ b/tests/acceptance/00_basics/03_bodies/002.cf @@ -1,40 +1,37 @@ # Test that log_failed and log_kept set to the same value do not cause stack overflow (Redmine #2317) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile).src" - create => "yes"; - "$(G.testfile).dest" - create => "yes"; + "$(G.testfile).src" create => "yes"; + "$(G.testfile).dest" create => "yes"; } bundle agent test { files: - "$(G.testfile).dest" + "$(G.testfile).dest" link_from => hard("$(G.testfile).src"), action => log; } body action log { - log_failed => "$(G.testfile).action.log"; - log_kept => "$(G.testfile).action.log"; - log_string => ""; + log_failed => "$(G.testfile).action.log"; + log_kept => "$(G.testfile).action.log"; + log_string => ""; } body link_from hard(from) { - source => "$(from)"; - link_type => "hardlink"; + source => "$(from)"; + link_type => "hardlink"; } bundle agent check diff --git a/tests/acceptance/00_basics/03_bodies/003.cf b/tests/acceptance/00_basics/03_bodies/003.cf index 9f7bf80c4c..478d73e8f9 100644 --- a/tests/acceptance/00_basics/03_bodies/003.cf +++ b/tests/acceptance/00_basics/03_bodies/003.cf @@ -1,31 +1,29 @@ # Test that log_failed and log_kept set to the same value do not cause stack overflow (Redmine #2317) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { commands: - "$(G.true)" - action => log; + "$(G.true)" action => log; } body action log { - log_repaired => "$(G.testfile).action.log"; - log_failed => "$(G.testfile).action.log"; - log_kept => "$(G.testfile).action.log"; - log_string => ""; + log_repaired => "$(G.testfile).action.log"; + log_failed => "$(G.testfile).action.log"; + log_kept => "$(G.testfile).action.log"; + log_string => ""; } bundle agent check diff --git a/tests/acceptance/00_basics/03_bodies/101.cf b/tests/acceptance/00_basics/03_bodies/101.cf index 7e17381503..c27a5fd66c 100644 --- a/tests/acceptance/00_basics/03_bodies/101.cf +++ b/tests/acceptance/00_basics/03_bodies/101.cf @@ -6,31 +6,29 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "G", "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "G", "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { - # These must be global classes so they can be tested in another bundle - # We set them here, so they can be (possibly) cleared later + # These must be global classes so they can be tested in another bundle + # We set them here, so they can be (possibly) cleared later classes: - "cancel_kept" expression => "any"; - "cancel_repaired" expression => "any"; - "cancel_notkept" expression => "any"; + "cancel_kept" expression => "any"; + "cancel_repaired" expression => "any"; + "cancel_notkept" expression => "any"; } ####################################################### - bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -38,7 +36,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty, @@ -48,95 +46,98 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/102.cf b/tests/acceptance/00_basics/03_bodies/102.cf index 086c7a536d..b4d4b32efb 100644 --- a/tests/acceptance/00_basics/03_bodies/102.cf +++ b/tests/acceptance/00_basics/03_bodies/102.cf @@ -6,31 +6,29 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { - # These must be global classes so they can be tested in another bundle - # We set them here, so they can be (possibly) cleared later + # These must be global classes so they can be tested in another bundle + # We set them here, so they can be (possibly) cleared later classes: - "cancel_kept" expression => "any"; - "cancel_repaired" expression => "any"; - "cancel_notkept" expression => "any"; + "cancel_kept" expression => "any"; + "cancel_repaired" expression => "any"; + "cancel_notkept" expression => "any"; } ####################################################### - bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -38,7 +36,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty, @@ -48,97 +46,100 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_repaired => { "promise_repaired", "p2_repaired" }; - cancel_repaired => { "cancel_repaired", "cancel_kept", "cancel_notkept" }; + promise_repaired => { "promise_repaired", "p2_repaired" }; + cancel_repaired => { "cancel_repaired", "cancel_kept", "cancel_notkept" }; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => "ON"; - "expect[p2_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => ""; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => ""; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "p2_repaired", - "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => "ON"; + "expect[p2_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => ""; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => ""; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "p2_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + MAIN.ok:: - "$(this.promise_filename) Pass" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) Pass" report_to_file => "$(G.logfile)"; + !ok:: "$(this.promise_filename) FAIL"; + MAIN.!ok:: - "$(this.promise_filename) FAIL" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) FAIL" report_to_file => "$(G.logfile)"; } diff --git a/tests/acceptance/00_basics/03_bodies/103.cf b/tests/acceptance/00_basics/03_bodies/103.cf index 5428b720ba..ab99216c83 100644 --- a/tests/acceptance/00_basics/03_bodies/103.cf +++ b/tests/acceptance/00_basics/03_bodies/103.cf @@ -6,31 +6,29 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { - # These must be global classes so they can be tested in another bundle - # We set them here, so they can be (possibly) cleared later + # These must be global classes so they can be tested in another bundle + # We set them here, so they can be (possibly) cleared later classes: - "cancel_kept" expression => "any"; - "cancel_repaired" expression => "any"; - "cancel_notkept" expression => "any"; + "cancel_kept" expression => "any"; + "cancel_repaired" expression => "any"; + "cancel_notkept" expression => "any"; } ####################################################### - bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -38,7 +36,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -47,102 +45,104 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)" - classes => all_classes; + "$(str)" classes => all_classes; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + MAIN.ok:: - "$(this.promise_filename) Pass" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) Pass" report_to_file => "$(G.logfile)"; + !ok:: "$(this.promise_filename) FAIL"; + MAIN.!ok:: - "$(this.promise_filename) FAIL" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) FAIL" report_to_file => "$(G.logfile)"; } diff --git a/tests/acceptance/00_basics/03_bodies/104.cf b/tests/acceptance/00_basics/03_bodies/104.cf index 894e938765..6428eade41 100644 --- a/tests/acceptance/00_basics/03_bodies/104.cf +++ b/tests/acceptance/00_basics/03_bodies/104.cf @@ -6,31 +6,29 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { - # These must be global classes so they can be tested in another bundle - # We set them here, so they can be (possibly) cleared later + # These must be global classes so they can be tested in another bundle + # We set them here, so they can be (possibly) cleared later classes: - "cancel_kept" expression => "any"; - "cancel_repaired" expression => "any"; - "cancel_notkept" expression => "any"; + "cancel_kept" expression => "any"; + "cancel_repaired" expression => "any"; + "cancel_notkept" expression => "any"; } ####################################################### - bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -38,7 +36,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"); } @@ -46,104 +44,107 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" edit_line => init_insert("$(init.body)"), edit_defaults => init_empty, classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => "ON"; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => ""; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => "ON"; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => ""; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + MAIN.ok:: - "$(this.promise_filename) Pass" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) Pass" report_to_file => "$(G.logfile)"; + !ok:: "$(this.promise_filename) FAIL"; + MAIN.!ok:: - "$(this.promise_filename) FAIL" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) FAIL" report_to_file => "$(G.logfile)"; } diff --git a/tests/acceptance/00_basics/03_bodies/109.cf b/tests/acceptance/00_basics/03_bodies/109.cf index 419e3d7219..aa567a22c8 100644 --- a/tests/acceptance/00_basics/03_bodies/109.cf +++ b/tests/acceptance/00_basics/03_bodies/109.cf @@ -8,46 +8,43 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { - # These must be global classes so they can be tested in another bundle - # We set them here, so they can be (possibly) cleared later + # These must be global classes so they can be tested in another bundle + # We set them here, so they can be (possibly) cleared later classes: - "cancel_kept" expression => "any"; - "cancel_repaired" expression => "any"; - "cancel_notkept" expression => "any"; + "cancel_kept" expression => "any"; + "cancel_repaired" expression => "any"; + "cancel_notkept" expression => "any"; } ####################################################### - bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes Four END"; - "body2" string => - "BEGIN + "body2" string => "BEGIN One potato Three potatoes Four END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"); } @@ -55,34 +52,32 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)" - classes => all_classes; + "$(str)" classes => all_classes; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => test_insert; } @@ -90,80 +85,83 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(init.body2)" - classes => all_classes; + "$(init.body2)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it - # is mentioned in init and we call test_insert from test, the promises are - # the same, and are only executed ONCE, so it only sets the repaired - # promises. - "expect[promise_kept]" string => "ON"; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => ""; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it + # is mentioned in init and we call test_insert from test, the promises are + # the same, and are only executed ONCE, so it only sets the repaired + # promises. + "expect[promise_kept]" string => "ON"; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => ""; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + MAIN.ok:: - "$(this.promise_filename) Pass" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) Pass" report_to_file => "$(G.logfile)"; + !ok:: "$(this.promise_filename) FAIL"; + MAIN.!ok:: - "$(this.promise_filename) FAIL" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) FAIL" report_to_file => "$(G.logfile)"; } diff --git a/tests/acceptance/00_basics/03_bodies/112.cf b/tests/acceptance/00_basics/03_bodies/112.cf index d62c3d602e..8f56592ac9 100644 --- a/tests/acceptance/00_basics/03_bodies/112.cf +++ b/tests/acceptance/00_basics/03_bodies/112.cf @@ -6,31 +6,29 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { - # These must be global classes so they can be tested in another bundle - # We set them here, so they can be (possibly) cleared later + # These must be global classes so they can be tested in another bundle + # We set them here, so they can be (possibly) cleared later classes: - "cancel_kept" expression => "any"; - "cancel_repaired" expression => "any"; - "cancel_notkept" expression => "any"; + "cancel_kept" expression => "any"; + "cancel_repaired" expression => "any"; + "cancel_notkept" expression => "any"; } ####################################################### - bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -38,7 +36,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" # create => "true", # file will not exist! edit_line => init_insert("$(body)"), edit_defaults => init_empty, @@ -48,101 +46,104 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => "ON"; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => ""; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => "ON"; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => ""; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + MAIN.ok:: - "$(this.promise_filename) Pass" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) Pass" report_to_file => "$(G.logfile)"; + !ok:: "$(this.promise_filename) FAIL"; + MAIN.!ok:: - "$(this.promise_filename) FAIL" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) FAIL" report_to_file => "$(G.logfile)"; } diff --git a/tests/acceptance/00_basics/03_bodies/113.cf b/tests/acceptance/00_basics/03_bodies/113.cf index 14c34e248a..b197285b7f 100644 --- a/tests/acceptance/00_basics/03_bodies/113.cf +++ b/tests/acceptance/00_basics/03_bodies/113.cf @@ -6,31 +6,29 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { - # These must be global classes so they can be tested in another bundle - # We set them here, so they can be (possibly) cleared later + # These must be global classes so they can be tested in another bundle + # We set them here, so they can be (possibly) cleared later classes: - "cancel_kept" expression => "any"; - "cancel_repaired" expression => "any"; - "cancel_notkept" expression => "any"; + "cancel_kept" expression => "any"; + "cancel_repaired" expression => "any"; + "cancel_notkept" expression => "any"; } ####################################################### - bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -38,7 +36,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" # create => "true", # file will not exist! edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -47,103 +45,106 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)" + "$(str)" # Promise never executed, so classes not set! classes => all_classes; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + MAIN.ok:: - "$(this.promise_filename) Pass" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) Pass" report_to_file => "$(G.logfile)"; + !ok:: "$(this.promise_filename) FAIL"; + MAIN.!ok:: - "$(this.promise_filename) FAIL" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) FAIL" report_to_file => "$(G.logfile)"; } diff --git a/tests/acceptance/00_basics/03_bodies/114.cf b/tests/acceptance/00_basics/03_bodies/114.cf index c862c94b1f..bbf86f53bb 100644 --- a/tests/acceptance/00_basics/03_bodies/114.cf +++ b/tests/acceptance/00_basics/03_bodies/114.cf @@ -6,140 +6,143 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { - # These must be global classes so they can be tested in another bundle - # We set them here, so they can be (possibly) cleared later + # These must be global classes so they can be tested in another bundle + # We set them here, so they can be (possibly) cleared later classes: - "cancel_kept" expression => "any"; - "cancel_repaired" expression => "any"; - "cancel_notkept" expression => "any"; + "cancel_kept" expression => "any"; + "cancel_repaired" expression => "any"; + "cancel_notkept" expression => "any"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile)" + "$(G.testfile)" copy_from => local("$(G.etc_group)"), perms => mode("666"); } body copy_from local(f) { - source => "$(f)"; + source => "$(f)"; } body perms mode(m) { - mode => "$(m)"; + mode => "$(m)"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { meta: - "test_skip_needs_work" string => "windows"; + "test_skip_needs_work" string => "windows"; files: - "$(G.testfile)" - copy_from => local("$(G.etc_group)"), # Same file - perms => mode("644"), # Different mode + "$(G.testfile)" + copy_from => local("$(G.etc_group)"), + # Same file + perms => mode("644"), + # Different mode classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => "ON"; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => ""; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => "ON"; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => ""; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + MAIN.ok:: - "$(this.promise_filename) Pass" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) Pass" report_to_file => "$(G.logfile)"; + !ok:: "$(this.promise_filename) FAIL"; + MAIN.!ok:: - "$(this.promise_filename) FAIL" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) FAIL" report_to_file => "$(G.logfile)"; } diff --git a/tests/acceptance/00_basics/03_bodies/115.cf b/tests/acceptance/00_basics/03_bodies/115.cf index abc78558e6..fb25654224 100644 --- a/tests/acceptance/00_basics/03_bodies/115.cf +++ b/tests/acceptance/00_basics/03_bodies/115.cf @@ -4,32 +4,31 @@ # Insert lines to a file, the grep for a line which is there # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { - # These must be global classes so they can be tested in another bundle - # We set them here, so they can be (possibly) cleared later + # These must be global classes so they can be tested in another bundle + # We set them here, so they can be (possibly) cleared later classes: - "cancel_kept" expression => "any"; - "cancel_repaired" expression => "any"; - "cancel_notkept" expression => "any"; + "cancel_kept" expression => "any"; + "cancel_repaired" expression => "any"; + "cancel_notkept" expression => "any"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; - "body" string => - "BEGIN + "dummy" string => "dummy"; + + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -37,7 +36,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -45,103 +44,105 @@ END"; body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { commands: - "$(G.grep) BEGIN $(G.testfile)" - classes => all_classes; + "$(G.grep) BEGIN $(G.testfile)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + MAIN.ok:: - "$(this.promise_filename) Pass" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) Pass" report_to_file => "$(G.logfile)"; + !ok:: "$(this.promise_filename) FAIL"; + MAIN.!ok:: - "$(this.promise_filename) FAIL" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) FAIL" report_to_file => "$(G.logfile)"; } diff --git a/tests/acceptance/00_basics/03_bodies/116.cf b/tests/acceptance/00_basics/03_bodies/116.cf index 4bf1104fb8..f906dc6fbb 100644 --- a/tests/acceptance/00_basics/03_bodies/116.cf +++ b/tests/acceptance/00_basics/03_bodies/116.cf @@ -4,32 +4,31 @@ # Insert lines to a file, the grep for a line which is there # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { - # These must be global classes so they can be tested in another bundle - # We set them here, so they can be (possibly) cleared later + # These must be global classes so they can be tested in another bundle + # We set them here, so they can be (possibly) cleared later classes: - "cancel_kept" expression => "any"; - "cancel_repaired" expression => "any"; - "cancel_notkept" expression => "any"; + "cancel_kept" expression => "any"; + "cancel_repaired" expression => "any"; + "cancel_notkept" expression => "any"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; - "body" string => - "BEGIN + "dummy" string => "dummy"; + + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -37,7 +36,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -45,106 +44,108 @@ END"; body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; - kept_returncodes => { "0" }; - repaired_returncodes => { "1" }; - failed_returncodes => { "2" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; + kept_returncodes => { "0" }; + repaired_returncodes => { "1" }; + failed_returncodes => { "2" }; } ####################################################### - bundle agent test { commands: - "$(G.grep) BEGIN $(G.testfile)" - classes => all_classes; + "$(G.grep) BEGIN $(G.testfile)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => "ON"; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => ""; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => "ON"; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => ""; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + MAIN.ok:: - "$(this.promise_filename) Pass" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) Pass" report_to_file => "$(G.logfile)"; + !ok:: "$(this.promise_filename) FAIL"; + MAIN.!ok:: - "$(this.promise_filename) FAIL" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) FAIL" report_to_file => "$(G.logfile)"; } diff --git a/tests/acceptance/00_basics/03_bodies/117.cf b/tests/acceptance/00_basics/03_bodies/117.cf index 922e31d315..edcea1924f 100644 --- a/tests/acceptance/00_basics/03_bodies/117.cf +++ b/tests/acceptance/00_basics/03_bodies/117.cf @@ -4,32 +4,31 @@ # Insert lines to a file, the grep for a line which is there # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { - # These must be global classes so they can be tested in another bundle - # We set them here, so they can be (possibly) cleared later + # These must be global classes so they can be tested in another bundle + # We set them here, so they can be (possibly) cleared later classes: - "cancel_kept" expression => "any"; - "cancel_repaired" expression => "any"; - "cancel_notkept" expression => "any"; + "cancel_kept" expression => "any"; + "cancel_repaired" expression => "any"; + "cancel_notkept" expression => "any"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; - "body" string => - "BEGIN + "dummy" string => "dummy"; + + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -37,7 +36,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -45,106 +44,108 @@ END"; body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; - kept_returncodes => { "0" }; - repaired_returncodes => { "1" }; - failed_returncodes => { "2" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; + kept_returncodes => { "0" }; + repaired_returncodes => { "1" }; + failed_returncodes => { "2" }; } ####################################################### - bundle agent test { commands: - "$(G.grep) linenotfound $(G.testfile)" - classes => all_classes; + "$(G.grep) linenotfound $(G.testfile)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + MAIN.ok:: - "$(this.promise_filename) Pass" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) Pass" report_to_file => "$(G.logfile)"; + !ok:: "$(this.promise_filename) FAIL"; + MAIN.!ok:: - "$(this.promise_filename) FAIL" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) FAIL" report_to_file => "$(G.logfile)"; } diff --git a/tests/acceptance/00_basics/03_bodies/118.cf b/tests/acceptance/00_basics/03_bodies/118.cf index a996f5bbaf..9117977510 100644 --- a/tests/acceptance/00_basics/03_bodies/118.cf +++ b/tests/acceptance/00_basics/03_bodies/118.cf @@ -4,32 +4,31 @@ # Insert lines to a file, the grep for a line which is there # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { - # These must be global classes so they can be tested in another bundle - # We set them here, so they can be (possibly) cleared later + # These must be global classes so they can be tested in another bundle + # We set them here, so they can be (possibly) cleared later classes: - "cancel_kept" expression => "any"; - "cancel_repaired" expression => "any"; - "cancel_notkept" expression => "any"; + "cancel_kept" expression => "any"; + "cancel_repaired" expression => "any"; + "cancel_notkept" expression => "any"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; - "body" string => - "BEGIN + "dummy" string => "dummy"; + + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -37,7 +36,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -45,106 +44,108 @@ END"; body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; - kept_returncodes => { "0" }; - repaired_returncodes => { "1" }; - failed_returncodes => { "2" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; + kept_returncodes => { "0" }; + repaired_returncodes => { "1" }; + failed_returncodes => { "2" }; } ####################################################### - bundle agent test { commands: - "$(G.grep) BEGIN $(G.testfile).missing" - classes => all_classes; + "$(G.grep) BEGIN $(G.testfile).missing" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => "ON"; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => ""; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => "ON"; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => ""; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + MAIN.ok:: - "$(this.promise_filename) Pass" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) Pass" report_to_file => "$(G.logfile)"; + !ok:: "$(this.promise_filename) FAIL"; + MAIN.!ok:: - "$(this.promise_filename) FAIL" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) FAIL" report_to_file => "$(G.logfile)"; } diff --git a/tests/acceptance/00_basics/03_bodies/119.cf b/tests/acceptance/00_basics/03_bodies/119.cf index 4edaef07dd..d00723dc21 100644 --- a/tests/acceptance/00_basics/03_bodies/119.cf +++ b/tests/acceptance/00_basics/03_bodies/119.cf @@ -4,32 +4,31 @@ # Insert lines to a file, the grep for a line which is there # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { - # These must be global classes so they can be tested in another bundle - # We set them here, so they can be (possibly) cleared later + # These must be global classes so they can be tested in another bundle + # We set them here, so they can be (possibly) cleared later classes: - "cancel_kept" expression => "any"; - "cancel_repaired" expression => "any"; - "cancel_notkept" expression => "any"; + "cancel_kept" expression => "any"; + "cancel_repaired" expression => "any"; + "cancel_notkept" expression => "any"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; - "body" string => - "BEGIN + "dummy" string => "dummy"; + + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -37,7 +36,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -45,106 +44,108 @@ END"; body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; - kept_returncodes => { "1" }; - repaired_returncodes => { "2" }; - failed_returncodes => { "3" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; + kept_returncodes => { "1" }; + repaired_returncodes => { "2" }; + failed_returncodes => { "3" }; } ####################################################### - bundle agent test { commands: - "$(G.grep) BEGIN $(G.testfile)" - classes => all_classes; + "$(G.grep) BEGIN $(G.testfile)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => "ON"; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => ""; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => "ON"; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => ""; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + MAIN.ok:: - "$(this.promise_filename) Pass" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) Pass" report_to_file => "$(G.logfile)"; + !ok:: "$(this.promise_filename) FAIL"; + MAIN.!ok:: - "$(this.promise_filename) FAIL" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) FAIL" report_to_file => "$(G.logfile)"; } diff --git a/tests/acceptance/00_basics/03_bodies/120.cf b/tests/acceptance/00_basics/03_bodies/120.cf index 75d1059620..222e53ebee 100644 --- a/tests/acceptance/00_basics/03_bodies/120.cf +++ b/tests/acceptance/00_basics/03_bodies/120.cf @@ -4,32 +4,31 @@ # Insert lines to a file, the grep for a line which is there # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { - # These must be global classes so they can be tested in another bundle - # We set them here, so they can be (possibly) cleared later + # These must be global classes so they can be tested in another bundle + # We set them here, so they can be (possibly) cleared later classes: - "cancel_kept" expression => "any"; - "cancel_repaired" expression => "any"; - "cancel_notkept" expression => "any"; + "cancel_kept" expression => "any"; + "cancel_repaired" expression => "any"; + "cancel_notkept" expression => "any"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; - "body" string => - "BEGIN + "dummy" string => "dummy"; + + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -37,7 +36,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -45,106 +44,108 @@ END"; body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; - kept_returncodes => { "0", "1" }; - repaired_returncodes => { "1" }; - failed_returncodes => { "1", "2" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; + kept_returncodes => { "0", "1" }; + repaired_returncodes => { "1" }; + failed_returncodes => { "1", "2" }; } ####################################################### - bundle agent test { commands: - "$(G.grep) linenotfound $(G.testfile)" - classes => all_classes; + "$(G.grep) linenotfound $(G.testfile)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => "ON"; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => "ON"; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => ""; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => ""; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => "ON"; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => "ON"; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => ""; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => ""; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + MAIN.ok:: - "$(this.promise_filename) Pass" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) Pass" report_to_file => "$(G.logfile)"; + !ok:: "$(this.promise_filename) FAIL"; + MAIN.!ok:: - "$(this.promise_filename) FAIL" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) FAIL" report_to_file => "$(G.logfile)"; } diff --git a/tests/acceptance/00_basics/03_bodies/121.cf b/tests/acceptance/00_basics/03_bodies/121.cf index 98e93ba92c..0665848ed2 100644 --- a/tests/acceptance/00_basics/03_bodies/121.cf +++ b/tests/acceptance/00_basics/03_bodies/121.cf @@ -4,32 +4,31 @@ # Insert lines to a file, the grep for a line which is there # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { - # These must be global classes so they can be tested in another bundle - # We set them here, so they can be (possibly) cleared later + # These must be global classes so they can be tested in another bundle + # We set them here, so they can be (possibly) cleared later classes: - "cancel_kept" expression => "any"; - "cancel_repaired" expression => "any"; - "cancel_notkept" expression => "any"; + "cancel_kept" expression => "any"; + "cancel_repaired" expression => "any"; + "cancel_notkept" expression => "any"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; - "body" string => - "BEGIN + "dummy" string => "dummy"; + + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -37,7 +36,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -45,106 +44,108 @@ END"; body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; - kept_returncodes => { "10", "11" }; - repaired_returncodes => { "11" }; - failed_returncodes => { "11", "12" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; + kept_returncodes => { "10", "11" }; + repaired_returncodes => { "11" }; + failed_returncodes => { "11", "12" }; } ####################################################### - bundle agent test { commands: - "$(G.grep) linenotfound $(G.testfile)" - classes => all_classes; + "$(G.grep) linenotfound $(G.testfile)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => "ON"; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => ""; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => "ON"; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => ""; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + MAIN.ok:: - "$(this.promise_filename) Pass" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) Pass" report_to_file => "$(G.logfile)"; + !ok:: "$(this.promise_filename) FAIL"; + MAIN.!ok:: - "$(this.promise_filename) FAIL" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) FAIL" report_to_file => "$(G.logfile)"; } diff --git a/tests/acceptance/00_basics/03_bodies/123.cf b/tests/acceptance/00_basics/03_bodies/123.cf index b05742a414..230de4790b 100644 --- a/tests/acceptance/00_basics/03_bodies/123.cf +++ b/tests/acceptance/00_basics/03_bodies/123.cf @@ -1,40 +1,37 @@ # Test a context defined in body classes with scope => bundle - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { processes: any:: - "$(G.true)" - classes => bundle_class; + "$(G.true)" classes => bundle_class; bundle_context:: - "$(G.true)" - classes => namespace_class; + "$(G.true)" classes => namespace_class; } body classes namespace_class { - # default to namespace scoping - promise_kept => { "namespace_context" }; + # default to namespace scoping + promise_kept => { "namespace_context" }; } body classes bundle_class { - scope => "bundle"; - promise_kept => { "bundle_context" }; + scope => "bundle"; + promise_kept => { "bundle_context" }; } bundle agent check @@ -42,6 +39,7 @@ bundle agent check reports: namespace_context.!bundle_context:: "$(this.promise_filename) Pass"; + bundle_context:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/124.cf b/tests/acceptance/00_basics/03_bodies/124.cf index 27dc9fd5b3..3bc9c99828 100644 --- a/tests/acceptance/00_basics/03_bodies/124.cf +++ b/tests/acceptance/00_basics/03_bodies/124.cf @@ -1,55 +1,49 @@ # Test a context defined in body classes with scope => bundle, # check that the bundle context goes away after the bundle is done - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { methods: !pass_one:: - "whatever" - usebundle => set_context("yes"); + "whatever" usebundle => set_context("yes"); + pass_one:: - "whatever2" - usebundle => set_context("no"); + "whatever2" usebundle => set_context("no"); } bundle agent set_context(doit) { classes: - "set_bundle_class" expression => strcmp(${doit}, "yes"); + "set_bundle_class" expression => strcmp(${doit}, "yes"); processes: set_bundle_class:: - "$(G.true)" - classes => bundle_class; - - "$(G.true)" - classes => namespace_class; + "$(G.true)" classes => bundle_class; + "$(G.true)" classes => namespace_class; } - body classes namespace_class { - scope => "namespace"; - promise_kept => { "pass_one" }; + scope => "namespace"; + promise_kept => { "pass_one" }; } body classes bundle_class { - scope => "bundle"; - promise_kept => { "bundle_context" }; + scope => "bundle"; + promise_kept => { "bundle_context" }; } bundle agent check @@ -57,6 +51,7 @@ bundle agent check reports: !bundle_context:: "$(this.promise_filename) Pass"; + bundle_context:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/125.cf b/tests/acceptance/00_basics/03_bodies/125.cf index 3f1d6a3932..0001c8189c 100644 --- a/tests/acceptance/00_basics/03_bodies/125.cf +++ b/tests/acceptance/00_basics/03_bodies/125.cf @@ -1,42 +1,39 @@ # Test a context defined in body classes with scope => bundle, # cancelling a namespace class using a bundle class - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; processes: any:: - "$(G.true)" - classes => set_cancel_this; + "$(G.true)" classes => set_cancel_this; } bundle agent test { processes: any:: - "$(G.true)" - classes => bundle_class; + "$(G.true)" classes => bundle_class; } body classes set_cancel_this { - promise_kept => { "cancel_this" }; + promise_kept => { "cancel_this" }; } body classes bundle_class { - scope => "bundle"; - promise_kept => { "bundle_class" }; - cancel_kept => { "cancel_this" }; + scope => "bundle"; + promise_kept => { "bundle_class" }; + cancel_kept => { "cancel_this" }; } bundle agent check @@ -44,6 +41,7 @@ bundle agent check reports: !cancel_this:: "$(this.promise_filename) Pass"; + cancel_this|bundle_class:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/CFE-1780/body-common-control-inputs/test.cf b/tests/acceptance/00_basics/03_bodies/CFE-1780/body-common-control-inputs/test.cf index 58ee06bd93..df6656906c 100644 --- a/tests/acceptance/00_basics/03_bodies/CFE-1780/body-common-control-inputs/test.cf +++ b/tests/acceptance/00_basics/03_bodies/CFE-1780/body-common-control-inputs/test.cf @@ -3,34 +3,30 @@ # Redmine#3315: Test dynamic inputs and bundlesequence # ####################################################### - body common control { - inputs => { - "../../../../default.sub.cf", - }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - - "description" -> { "CFE-1780" } - string => "Test that dynamic inputs from classic array structures can be loaded and used via body file control."; + "description" -> { "CFE-1780" } + string => "Test that dynamic inputs from classic array structures can be loaded and used via body file control."; } bundle agent check { methods: - - "Check Agent Output" - usebundle => dcs_passif_output1(".*R: app00_zero + "Check Agent Output" + usebundle => dcs_passif_output1( + ".*R: app00_zero R: app_one R: app_two.*", - "$(sys.cf_agent) -Kf $(this.promise_filename).sub", - $(this.promise_filename)); + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/03_bodies/CFE-1780/body-file-control-inputs/test.cf b/tests/acceptance/00_basics/03_bodies/CFE-1780/body-file-control-inputs/test.cf index 7dc0061925..dcaa673b45 100644 --- a/tests/acceptance/00_basics/03_bodies/CFE-1780/body-file-control-inputs/test.cf +++ b/tests/acceptance/00_basics/03_bodies/CFE-1780/body-file-control-inputs/test.cf @@ -3,34 +3,30 @@ # Redmine#3315: Test dynamic inputs and bundlesequence # ####################################################### - body common control { - inputs => { - "../../../../default.sub.cf", - }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - - "description" -> { "CFE-1780" } - string => "Test that dynamic inputs from classic array structures can be loaded and used."; + "description" -> { "CFE-1780" } + string => "Test that dynamic inputs from classic array structures can be loaded and used."; } bundle agent check { methods: - - "Check Agent Output" - usebundle => dcs_passif_output1(".*R: app00_zero + "Check Agent Output" + usebundle => dcs_passif_output1( + ".*R: app00_zero R: app_one R: app_two.*", - "$(sys.cf_agent) -Kf $(this.promise_filename).sub", - $(this.promise_filename)); + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/03_bodies/cf_null_in_bundlesequence.cf b/tests/acceptance/00_basics/03_bodies/cf_null_in_bundlesequence.cf index fedeaca0f8..62d37873cd 100644 --- a/tests/acceptance/00_basics/03_bodies/cf_null_in_bundlesequence.cf +++ b/tests/acceptance/00_basics/03_bodies/cf_null_in_bundlesequence.cf @@ -1,24 +1,24 @@ # cf_null now is just another string, bundles names as such should be # executed like every other bundle - - -body common control { - bundlesequence => { "cf_null", "test" }; +body common control +{ + bundlesequence => { "cf_null", "test" }; } bundle agent cf_null { classes: - "ok" expression => "any", - scope => "namespace"; + "ok" + expression => "any", + scope => "namespace"; } bundle agent test - { +{ reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } - diff --git a/tests/acceptance/00_basics/03_bodies/control-body-fncall.cf b/tests/acceptance/00_basics/03_bodies/control-body-fncall.cf index 340046b2b8..b7e88863b1 100644 --- a/tests/acceptance/00_basics/03_bodies/control-body-fncall.cf +++ b/tests/acceptance/00_basics/03_bodies/control-body-fncall.cf @@ -1,18 +1,17 @@ # Test that functions may be called from control bodies - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } body agent control { -# this is just to trigger the desired behavior. here ifelse is evaluated -# without any caller promise. If it was a non-control body, the caller -# would have been the promise inlining the body. here there is no caller. - default_repository => ifelse("x", "false", "y", "false", "false"); + # this is just to trigger the desired behavior. here ifelse is evaluated + # without any caller promise. If it was a non-control body, the caller + # would have been the promise inlining the body. here there is no caller. + default_repository => ifelse("x", "false", "y", "false", "false"); } bundle agent init diff --git a/tests/acceptance/00_basics/03_bodies/default_files_action.cf b/tests/acceptance/00_basics/03_bodies/default_files_action.cf index ce2be7fa0b..a96bec040d 100644 --- a/tests/acceptance/00_basics/03_bodies/default_files_action.cf +++ b/tests/acceptance/00_basics/03_bodies/default_files_action.cf @@ -3,62 +3,55 @@ # Test default body action and overriding with specific action # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - body file control { - namespace => "bodydefault"; + namespace => "bodydefault"; } body action files_action { - action_policy => "warn"; + action_policy => "warn"; } body file control { - namespace => "default"; + namespace => "default"; } body action specific { - action_policy => "fix"; + action_policy => "fix"; } ####################################################### - bundle agent test_specified_action { files: - "$(G.testdir)/specified" - create => "true", - action => specific; + "$(G.testdir)/specified" + create => "true", + action => specific; } bundle agent test_default_action { files: - "$(G.testdir)/default" - create => "true"; + "$(G.testdir)/default" create => "true"; } ####################################################### - bundle agent test { methods: - "specified" - usebundle => test_specified_action; - "default" - usebundle => test_default_action; + "specified" usebundle => test_specified_action; + "default" usebundle => test_default_action; } bundle agent check @@ -68,9 +61,10 @@ bundle agent check "specified_created" expression => fileexists("$(G.testdir)/specified"); "ok" expression => "specified_created.!default_created"; - reports: + reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/dynamic_inputs_findfiles.cf b/tests/acceptance/00_basics/03_bodies/dynamic_inputs_findfiles.cf index a344e28033..9e8e7c2d52 100644 --- a/tests/acceptance/00_basics/03_bodies/dynamic_inputs_findfiles.cf +++ b/tests/acceptance/00_basics/03_bodies/dynamic_inputs_findfiles.cf @@ -3,27 +3,22 @@ # Redmine#3315: Test dynamic inputs and bundlesequence # ####################################################### - body common control { - inputs => { - "../../default.sub.cf", - @(dynamic.inputs), - }; - bundlesequence => { dynamic, default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", @(dynamic.inputs) }; + bundlesequence => { dynamic, default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent dynamic { vars: - "todo" slist => bundlesmatching(".*included"); - "inputs" slist => findfiles("$(this.promise_filename).[s][u][b]"); + "todo" slist => bundlesmatching(".*included"); + "inputs" slist => findfiles("$(this.promise_filename).[s][u][b]"); methods: - "run" usebundle => $(todo); + "run" usebundle => $(todo); reports: DEBUG:: @@ -41,11 +36,12 @@ bundle agent test bundle agent check { classes: - "ok" expression => "class_defined_from_included_bundle"; + "ok" expression => "class_defined_from_included_bundle"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/dynamic_inputs_maplist.cf b/tests/acceptance/00_basics/03_bodies/dynamic_inputs_maplist.cf index 05faa39932..5e401720ea 100644 --- a/tests/acceptance/00_basics/03_bodies/dynamic_inputs_maplist.cf +++ b/tests/acceptance/00_basics/03_bodies/dynamic_inputs_maplist.cf @@ -3,28 +3,23 @@ # Redmine#3315: Test dynamic inputs and bundlesequence using maplist # ####################################################### - body common control { - inputs => { - "../../default.sub.cf", - @(dynamic.inputs), - }; - bundlesequence => { dynamic, default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", @(dynamic.inputs) }; + bundlesequence => { dynamic, default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent dynamic { vars: - "todo" slist => bundlesmatching(".*included"); - "dynamic_input_names" slist => {"$(this.promise_filename).sub"}; - "inputs" slist => maplist("$(this)", "dynamic_input_names"); + "todo" slist => bundlesmatching(".*included"); + "dynamic_input_names" slist => { "$(this.promise_filename).sub" }; + "inputs" slist => maplist("$(this)", "dynamic_input_names"); methods: - "run" usebundle => $(todo); + "run" usebundle => $(todo); reports: DEBUG:: @@ -42,11 +37,12 @@ bundle agent test bundle agent check { classes: - "ok" expression => "class_defined_from_included_bundle"; + "ok" expression => "class_defined_from_included_bundle"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/evaluation-should-respect-ifvarclass.cf b/tests/acceptance/00_basics/03_bodies/evaluation-should-respect-ifvarclass.cf index eadb0baa01..19a592a1ec 100644 --- a/tests/acceptance/00_basics/03_bodies/evaluation-should-respect-ifvarclass.cf +++ b/tests/acceptance/00_basics/03_bodies/evaluation-should-respect-ifvarclass.cf @@ -3,64 +3,68 @@ # Redmine #3577: evaluation should respect ifvarclass # ############################################################################## - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { methods: - "rm" usebundle => dcs_fini("$(G.testfile).z"); - "rm" usebundle => dcs_fini("$(G.testfile).z2"); + "rm" usebundle => dcs_fini("$(G.testfile).z"); + "rm" usebundle => dcs_fini("$(G.testfile).z2"); } - bundle agent test { classes: - "zclass" expression => returnszero("$(G.echo) xyz > $(G.testfile).z", - "useshell"), + "zclass" + expression => returnszero("$(G.echo) xyz > $(G.testfile).z", "useshell"), ifvarclass => not("any"); - "zclass" expression => returnszero("$(G.echo) xyz > $(G.testfile).z", - "useshell"), - depends_on => { "this_handle_does_not_exist" }; + "zclass" + expression => returnszero("$(G.echo) xyz > $(G.testfile).z", "useshell"), + depends_on => { "this_handle_does_not_exist" }; !any:: - "z2class" expression => returnszero("$(G.echo) xyz > $(G.testfile).z2", - "useshell"); + "z2class" + expression => returnszero( + "$(G.echo) xyz > $(G.testfile).z2", "useshell" + ); vars: - "x" string => concat("a", "b"), + "x" + string => concat("a", "b"), ifvarclass => "!any"; - "x_not" string => concat("a", "b"), + "x_not" + string => concat("a", "b"), ifvarclass => not("any"); !any:: "y" string => concat("c", "d"); } - bundle agent check { - # If the output contains the string, we fail + # If the output contains the string, we fail classes: - "eval_x" expression => strcmp("ab", "$(test.x)"); - "eval_x_not" expression => strcmp("ab", "$(test.x_not)"); - "eval_y" expression => strcmp("cd", "$(test.y)"); - "eval_z" expression => "zclass"; - "zfile_created" expression => fileexists("$(G.testfile).z"); - "z2file_created" expression => fileexists("$(G.testfile).z2"); + "eval_x" expression => strcmp("ab", "$(test.x)"); + "eval_x_not" expression => strcmp("ab", "$(test.x_not)"); + "eval_y" expression => strcmp("cd", "$(test.y)"); + "eval_z" expression => "zclass"; + "zfile_created" expression => fileexists("$(G.testfile).z"); + "z2file_created" expression => fileexists("$(G.testfile).z2"); methods: - "" usebundle => dcs_passif_expected("", - "eval_x,eval_x_not,eval_y,zclass,zfile_created,z2file_created", - $(this.promise_filename)), + "" + usebundle => dcs_passif_expected( + "", + "eval_x,eval_x_not,eval_y,zclass,zfile_created,z2file_created", + $(this.promise_filename) + ), inherit => "true"; reports: diff --git a/tests/acceptance/00_basics/03_bodies/file-select-Y2038.cf b/tests/acceptance/00_basics/03_bodies/file-select-Y2038.cf index 52b9bbd517..b3c55662db 100644 --- a/tests/acceptance/00_basics/03_bodies/file-select-Y2038.cf +++ b/tests/acceptance/00_basics/03_bodies/file-select-Y2038.cf @@ -1,34 +1,38 @@ body common control { - inputs => { - "../../default.sub.cf", - }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { commands: - # Ensure there is a file with a date in the future beyond 2038 - "/usr/bin/touch -t 204201010000 $(this.promise_filename).sub.file-with-mtime-after-2038"; + # Ensure there is a file with a date in the future beyond 2038 + "/usr/bin/touch -t 204201010000 $(this.promise_filename).sub.file-with-mtime-after-2038"; } bundle agent test { meta: - "description" string => "Test that the agent does not crash on dates after 2038."; - + "description" + string => "Test that the agent does not crash on dates after 2038."; } bundle agent check { meta: - "test_skip_unsupported" string => "!64_bit"; + "test_skip_unsupported" string => "!64_bit"; classes: - "ok" expression => "class_defined_from_included_bundle"; - methods: - "" usebundle => dcs_passif_output(".*Pass.*", "", "$(sys.cf_agent) -Kf $(this.promise_filename).sub", $(this.promise_filename)); + "ok" expression => "class_defined_from_included_bundle"; + methods: + "" + usebundle => dcs_passif_output( + ".*Pass.*", + "", + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/03_bodies/if-unless.cf b/tests/acceptance/00_basics/03_bodies/if-unless.cf index 520c71eee5..9a241561f1 100644 --- a/tests/acceptance/00_basics/03_bodies/if-unless.cf +++ b/tests/acceptance/00_basics/03_bodies/if-unless.cf @@ -3,45 +3,53 @@ # Redmine #6179: if and unless # ############################################################################## - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { classes: - "check1" expression => "any", scope => "namespace"; - "check2" expression => "any", scope => "namespace"; + "check1" + expression => "any", + scope => "namespace"; + + "check2" + expression => "any", + scope => "namespace"; } bundle agent test { methods: - "" usebundle => file_make("$(G.testfile).present", ""), + "" + usebundle => file_make("$(G.testfile).present", ""), if => "check1"; - "" usebundle => file_make("$(G.testfile).absent", ""), + "" + usebundle => file_make("$(G.testfile).absent", ""), unless => "check2"; - "" usebundle => file_make("$(G.testfile).absent", ""), + "" + usebundle => file_make("$(G.testfile).absent", ""), if => "check1", unless => "check2"; } bundle agent check { - # If the output contains the string, we fail + # If the output contains the string, we fail classes: - "if_ok" expression => fileexists("$(G.testfile).present"); - "unless_ok" not => fileexists("$(G.testfile).absent"); + "if_ok" expression => fileexists("$(G.testfile).present"); + "unless_ok" not => fileexists("$(G.testfile).absent"); methods: - "" usebundle => dcs_passif_expected("if_ok,unless_ok", - "", - $(this.promise_filename)), + "" + usebundle => dcs_passif_expected( + "if_ok,unless_ok", "", $(this.promise_filename) + ), inherit => "true"; } diff --git a/tests/acceptance/00_basics/03_bodies/ifvarclass-with-function.cf b/tests/acceptance/00_basics/03_bodies/ifvarclass-with-function.cf index d36a2ce3ff..5a7c1d59c7 100644 --- a/tests/acceptance/00_basics/03_bodies/ifvarclass-with-function.cf +++ b/tests/acceptance/00_basics/03_bodies/ifvarclass-with-function.cf @@ -1,57 +1,72 @@ # Verify that functions returns are interpreted correctly in ifvarclass # Redmine 6327 - body common control { + AUTO:: + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; -AUTO:: - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; -!AUTO:: - bundlesequence => { "init", "check" }; + !AUTO:: + bundlesequence => { "init", "check" }; } bundle agent init { -vars: - "always" string => "any"; - "never" string => "!any"; + vars: + "always" string => "any"; + "never" string => "!any"; } bundle agent check { -classes: - # yes - "variable_with_set_class" expression => "any", - ifvarclass => canonify("$(init.always)"); - - # no - "variable_with_unset_class" expression => "any", - ifvarclass => canonify("$(init.never)"); - "just_a_class" expression => "any", - ifvarclass => not("any"); - "undefined_variable" expression => "any", - ifvarclass => canonify("$(init.unknown)"); - "undefined_bundle" expression => "any", - ifvarclass => canonify("$(never.never)"); - "invalid_function" expression => "any", - ifvarclass => now(); - - "fail" expression => "variable_with_unset_class|just_a_class|undefined_variable|undefined_bundle|invalid_function"; - "ok" and => { "variable_with_set_class", "!fail" }; - -reports: - ok:: - "$(this.promise_filename) Pass"; - !ok:: - "$(this.promise_filename) FAIL"; - - DEBUG.just_a_class:: - "just_a_class"; - DEBUG.undefined_variable:: - "undefined_variable"; - DEBUG.undefined_bundle:: - "undefined_bundle"; - DEBUG.invalid_function:: - "invalid_function"; + classes: + # yes + "variable_with_set_class" + expression => "any", + ifvarclass => canonify("$(init.always)"); + + # no + "variable_with_unset_class" + expression => "any", + ifvarclass => canonify("$(init.never)"); + + "just_a_class" + expression => "any", + ifvarclass => not("any"); + + "undefined_variable" + expression => "any", + ifvarclass => canonify("$(init.unknown)"); + + "undefined_bundle" + expression => "any", + ifvarclass => canonify("$(never.never)"); + + "invalid_function" + expression => "any", + ifvarclass => now(); + + "fail" + expression => "variable_with_unset_class|just_a_class|undefined_variable|undefined_bundle|invalid_function"; + + "ok" and => { "variable_with_set_class", "!fail" }; + + reports: + ok:: + "$(this.promise_filename) Pass"; + + !ok:: + "$(this.promise_filename) FAIL"; + + DEBUG.just_a_class:: + "just_a_class"; + + DEBUG.undefined_variable:: + "undefined_variable"; + + DEBUG.undefined_bundle:: + "undefined_bundle"; + + DEBUG.invalid_function:: + "invalid_function"; } diff --git a/tests/acceptance/00_basics/03_bodies/inherit_from.cf b/tests/acceptance/00_basics/03_bodies/inherit_from.cf index d674dcdd9e..2ce413aeaa 100644 --- a/tests/acceptance/00_basics/03_bodies/inherit_from.cf +++ b/tests/acceptance/00_basics/03_bodies/inherit_from.cf @@ -3,12 +3,11 @@ # Redmine #4309: body inheritance with inherit_from # ############################################################################## - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -18,37 +17,75 @@ bundle agent init bundle common test { reports: - "test_inherit" classes => classes_generic_inherit("test_inherit"); - "test_nonesuch" classes => classes_generic_nonesuch("test_nonesuch"); - "test_overwrite" classes => classes_generic_overwrite("test_overwrite"); + "test_inherit" classes => classes_generic_inherit("test_inherit"); + "test_nonesuch" classes => classes_generic_nonesuch("test_nonesuch"); + "test_overwrite" classes => classes_generic_overwrite("test_overwrite"); } body classes classes_generic_inherit(x) { - inherit_from => classes_generic($(x)); + inherit_from => classes_generic($(x)); } body classes classes_generic_nonesuch(x) { - inherit_from => classes_generic_missing_body; + inherit_from => classes_generic_missing_body; } # the parent uses $(x) so this tests that inheritance goes from parent to child body classes classes_generic_overwrite(overwrite_x) { - inherit_from => classes_generic($(overwrite_x)); - promise_repaired => { "promise_repaired_$(overwrite_x)", "$(overwrite_x)_repaired", "$(overwrite_x)_ok", "$(overwrite_x)_reached" }; - repair_failed => { "repair_failed_$(overwrite_x)", "$(overwrite_x)_failed", "$(overwrite_x)_not_ok", "$(overwrite_x)_error", "$(overwrite_x)_not_kept", "$(overwrite_x)_not_repaired", "$(overwrite_x)_reached" }; - repair_denied => { "repair_denied_$(overwrite_x)", "$(overwrite_x)_denied", "$(overwrite_x)_not_ok", "$(overwrite_x)_error", "$(overwrite_x)_not_kept", "$(overwrite_x)_not_repaired", "$(overwrite_x)_reached" }; - repair_timeout => { "repair_timeout_$(overwrite_x)", "$(overwrite_x)_timeout", "$(overwrite_x)_not_ok", "$(overwrite_x)_error", "$(overwrite_x)_not_kept", "$(overwrite_x)_not_repaired", "$(overwrite_x)_reached" }; - promise_kept => { "promise_kept_$(overwrite_x)", "$(overwrite_x)_kept", "$(overwrite_x)_ok", "$(overwrite_x)_not_repaired", "$(overwrite_x)_reached" }; + inherit_from => classes_generic($(overwrite_x)); + promise_repaired => { + "promise_repaired_$(overwrite_x)", + "$(overwrite_x)_repaired", + "$(overwrite_x)_ok", + "$(overwrite_x)_reached", + }; + repair_failed => { + "repair_failed_$(overwrite_x)", + "$(overwrite_x)_failed", + "$(overwrite_x)_not_ok", + "$(overwrite_x)_error", + "$(overwrite_x)_not_kept", + "$(overwrite_x)_not_repaired", + "$(overwrite_x)_reached", + }; + repair_denied => { + "repair_denied_$(overwrite_x)", + "$(overwrite_x)_denied", + "$(overwrite_x)_not_ok", + "$(overwrite_x)_error", + "$(overwrite_x)_not_kept", + "$(overwrite_x)_not_repaired", + "$(overwrite_x)_reached", + }; + repair_timeout => { + "repair_timeout_$(overwrite_x)", + "$(overwrite_x)_timeout", + "$(overwrite_x)_not_ok", + "$(overwrite_x)_error", + "$(overwrite_x)_not_kept", + "$(overwrite_x)_not_repaired", + "$(overwrite_x)_reached", + }; + promise_kept => { + "promise_kept_$(overwrite_x)", + "$(overwrite_x)_kept", + "$(overwrite_x)_ok", + "$(overwrite_x)_not_repaired", + "$(overwrite_x)_reached", + }; } bundle agent check { methods: - "" usebundle => dcs_passif_expected("test_inherit_ok,test_overwrite_ok", - "test_nonesuch_ok", - $(this.promise_filename)), + "" + usebundle => dcs_passif_expected( + "test_inherit_ok,test_overwrite_ok", + "test_nonesuch_ok", + $(this.promise_filename) + ), inherit => "true"; } diff --git a/tests/acceptance/00_basics/03_bodies/inherit_from_parameters.cf b/tests/acceptance/00_basics/03_bodies/inherit_from_parameters.cf index 6ddfd6ab01..86e5f7ba9b 100644 --- a/tests/acceptance/00_basics/03_bodies/inherit_from_parameters.cf +++ b/tests/acceptance/00_basics/03_bodies/inherit_from_parameters.cf @@ -3,12 +3,11 @@ # Redmine #4309: parameterized body inheritance with inherit_from # ############################################################################## - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -18,31 +17,38 @@ bundle agent init bundle common test { reports: - "test_inherit1" classes => scoped_classes_generic_inherit("namespace", "test_inherit"); - "test_inherit2" classes => scoped_classes_generic_some_inherit("test_inherit_some"); - "test_inherit3" classes => scoped_classes_generic_none_inherit; + "test_inherit1" + classes => scoped_classes_generic_inherit("namespace", "test_inherit"); + + "test_inherit2" + classes => scoped_classes_generic_some_inherit("test_inherit_some"); + + "test_inherit3" classes => scoped_classes_generic_none_inherit; } body classes scoped_classes_generic_inherit(myscope, myx) { - inherit_from => scoped_classes_generic($(myscope), $(myx)); + inherit_from => scoped_classes_generic($(myscope), $(myx)); } body classes scoped_classes_generic_some_inherit(somex) { - inherit_from => scoped_classes_generic("namespace", $(somex)); + inherit_from => scoped_classes_generic("namespace", $(somex)); } body classes scoped_classes_generic_none_inherit { - inherit_from => scoped_classes_generic("namespace", "test_inherit_none"); + inherit_from => scoped_classes_generic("namespace", "test_inherit_none"); } bundle agent check { methods: - "" usebundle => dcs_passif_expected("test_inherit_ok,test_inherit_some_ok,test_inherit_none_ok", - "", - $(this.promise_filename)), + "" + usebundle => dcs_passif_expected( + "test_inherit_ok,test_inherit_some_ok,test_inherit_none_ok", + "", + $(this.promise_filename) + ), inherit => "true"; } diff --git a/tests/acceptance/00_basics/03_bodies/inherit_from_with_global_var.cf b/tests/acceptance/00_basics/03_bodies/inherit_from_with_global_var.cf index 64a8a7c763..f25791565d 100644 --- a/tests/acceptance/00_basics/03_bodies/inherit_from_with_global_var.cf +++ b/tests/acceptance/00_basics/03_bodies/inherit_from_with_global_var.cf @@ -3,51 +3,48 @@ # Test that bodies can inherit attributes containing global variables # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - - bundle agent init { vars: - "class" string => "_pass"; + "class" string => "_pass"; } ####################################################### - body classes parent(p) { - promise_kept => { "${init.class}" }; + promise_kept => { "${init.class}" }; } body classes static(p) { - inherit_from => parent(p); + inherit_from => parent(p); } -bundle agent test { +bundle agent test +{ meta: "description" -> { "CFE-4254" } string => "Test that bodies can inherit attributes containing global variables"; vars: - "test" string => "test", - classes => static("placeholder"); + "test" + string => "test", + classes => static("placeholder"); } ####################################################### - bundle agent check { methods: - _pass:: + _pass:: "pass" usebundle => dcs_pass("$(this.promise_filename)"); !_pass:: diff --git a/tests/acceptance/00_basics/03_bodies/log_file_permissions.cf b/tests/acceptance/00_basics/03_bodies/log_file_permissions.cf index 0af5a1db4c..c7cd34da1b 100644 --- a/tests/acceptance/00_basics/03_bodies/log_file_permissions.cf +++ b/tests/acceptance/00_basics/03_bodies/log_file_permissions.cf @@ -1,48 +1,49 @@ # Test that log_failed and log_kept set to the same value do not cause stack overflow (Redmine #2317) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; commands: - "$(G.true)" - action => log; + "$(G.true)" action => log; } body action log { - log_repaired => "$(G.testfile).action.log"; - log_failed => "$(G.testfile).action.log"; - log_kept => "$(G.testfile).action.log"; - log_string => "ignore me"; + log_repaired => "$(G.testfile).action.log"; + log_failed => "$(G.testfile).action.log"; + log_kept => "$(G.testfile).action.log"; + log_string => "ignore me"; } bundle agent check { vars: - "perms" string => filestat("$(G.testfile).action.log", "permoct"); + "perms" string => filestat("$(G.testfile).action.log", "permoct"); + classes: - "ok" expression => strcmp("600", $(perms)); + "ok" expression => strcmp("600", $(perms)); reports: DEBUG:: "Log file $(G.testfile).action.log had permissions $(perms)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/multilevel_inherit_from_parameters.cf b/tests/acceptance/00_basics/03_bodies/multilevel_inherit_from_parameters.cf index 833e32a851..0eae5aa0e2 100644 --- a/tests/acceptance/00_basics/03_bodies/multilevel_inherit_from_parameters.cf +++ b/tests/acceptance/00_basics/03_bodies/multilevel_inherit_from_parameters.cf @@ -3,12 +3,11 @@ # Redmine #4309: parameterized 2-level body inheritance with inherit_from # ############################################################################## - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -18,24 +17,25 @@ bundle agent init bundle common test { reports: - "test_inherit" classes => scoped_classes_generic_none2_inherit(); + "test_inherit" classes => scoped_classes_generic_none2_inherit(); } body classes scoped_classes_generic_none_inherit { - inherit_from => scoped_classes_generic("namespace", "test_inherit_none"); + inherit_from => scoped_classes_generic("namespace", "test_inherit_none"); } body classes scoped_classes_generic_none2_inherit { - inherit_from => scoped_classes_generic_none_inherit; + inherit_from => scoped_classes_generic_none_inherit; } bundle agent check { methods: - "" usebundle => dcs_passif_expected("test_inherit_none_ok", - "", - $(this.promise_filename)), + "" + usebundle => dcs_passif_expected( + "test_inherit_none_ok", "", $(this.promise_filename) + ), inherit => "true"; } diff --git a/tests/acceptance/00_basics/03_bodies/report_error_when_body_missing.cf b/tests/acceptance/00_basics/03_bodies/report_error_when_body_missing.cf index f3ab2d8cb9..91cfa22dad 100644 --- a/tests/acceptance/00_basics/03_bodies/report_error_when_body_missing.cf +++ b/tests/acceptance/00_basics/03_bodies/report_error_when_body_missing.cf @@ -1,24 +1,28 @@ body common control { - inputs => { - "../../default.sub.cf", - }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "description" string => "Test that a sensible error message is emitted when a body is undefined."; - + "description" + string => "Test that a sensible error message is emitted when a body is undefined."; } bundle agent check { classes: - "ok" expression => "class_defined_from_included_bundle"; - methods: - "" usebundle => dcs_passif_output(".*Undefined body my_undefined_body.*", "", "$(sys.cf_agent) -Kf $(this.promise_filename).sub", $(this.promise_filename)); + "ok" expression => "class_defined_from_included_bundle"; + methods: + "" + usebundle => dcs_passif_output( + ".*Undefined body my_undefined_body.*", + "", + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/03_bodies/staging/201.cf b/tests/acceptance/00_basics/03_bodies/staging/201.cf index 855e9a7cba..b509795f23 100644 --- a/tests/acceptance/00_basics/03_bodies/staging/201.cf +++ b/tests/acceptance/00_basics/03_bodies/staging/201.cf @@ -6,19 +6,18 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -26,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty, @@ -36,96 +35,98 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; - + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/staging/203.cf b/tests/acceptance/00_basics/03_bodies/staging/203.cf index 26675bb028..4f817c9188 100644 --- a/tests/acceptance/00_basics/03_bodies/staging/203.cf +++ b/tests/acceptance/00_basics/03_bodies/staging/203.cf @@ -6,19 +6,18 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -26,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -35,97 +34,98 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)" - classes => all_classes; + "$(str)" classes => all_classes; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; - + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/staging/204.cf b/tests/acceptance/00_basics/03_bodies/staging/204.cf index fb87a50a6d..ea32ba7096 100644 --- a/tests/acceptance/00_basics/03_bodies/staging/204.cf +++ b/tests/acceptance/00_basics/03_bodies/staging/204.cf @@ -6,19 +6,18 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -26,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"); } @@ -34,99 +33,101 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" edit_line => init_insert("$(init.body)"), edit_defaults => init_empty, classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => "ON"; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => ""; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => "ON"; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => ""; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; - + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/staging/209.cf b/tests/acceptance/00_basics/03_bodies/staging/209.cf index 927dd97c06..685d0237c2 100644 --- a/tests/acceptance/00_basics/03_bodies/staging/209.cf +++ b/tests/acceptance/00_basics/03_bodies/staging/209.cf @@ -8,34 +8,32 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes Four END"; - "body2" string => - "BEGIN + "body2" string => "BEGIN One potato Three potatoes Four END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"); } @@ -43,34 +41,32 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)" - classes => all_classes; + "$(str)" classes => all_classes; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => test_insert; } @@ -78,75 +74,77 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(init.body2)" - classes => all_classes; + "$(init.body2)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it - # is mentioned in init and we call test_insert from test, the promises are - # the same, and are only executed ONCE, so it only sets the repaired - # promises. - "expect[promise_kept]" string => "ON"; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => ""; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it + # is mentioned in init and we call test_insert from test, the promises are + # the same, and are only executed ONCE, so it only sets the repaired + # promises. + "expect[promise_kept]" string => "ON"; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => ""; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; - + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/staging/212.cf b/tests/acceptance/00_basics/03_bodies/staging/212.cf index 2dde5891f8..25d9bafe78 100644 --- a/tests/acceptance/00_basics/03_bodies/staging/212.cf +++ b/tests/acceptance/00_basics/03_bodies/staging/212.cf @@ -6,19 +6,18 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -26,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" # create => "true", # file will not exist! edit_line => init_insert("$(body)"), edit_defaults => init_empty, @@ -36,96 +35,98 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => "ON"; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => ""; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => "ON"; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => ""; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; - + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/staging/213.cf b/tests/acceptance/00_basics/03_bodies/staging/213.cf index d924fd95a5..4cb570f765 100644 --- a/tests/acceptance/00_basics/03_bodies/staging/213.cf +++ b/tests/acceptance/00_basics/03_bodies/staging/213.cf @@ -6,19 +6,18 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -26,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" # create => "true", # file will not exist! edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -35,98 +34,100 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)", + "$(str)", # Promise never executed, so classes not set! classes => all_classes; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; - + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/staging/214.cf b/tests/acceptance/00_basics/03_bodies/staging/214.cf index cfae1139a4..98244a80b0 100644 --- a/tests/acceptance/00_basics/03_bodies/staging/214.cf +++ b/tests/acceptance/00_basics/03_bodies/staging/214.cf @@ -6,122 +6,124 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile)" + "$(G.testfile)" copy_from => local("$(G.etc_group)"), perms => mode("666"); } body copy_from local(f) { - source => "$(f)"; + source => "$(f)"; } body perms mode(m) { - mode => "$(m)"; + mode => "$(m)"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" - copy_from => local("$(G.etc_group)"), # Same file - perms => mode("644"), # Different mode + "$(G.testfile)" + copy_from => local("$(G.etc_group)"), + # Same file + perms => mode("644"), + # Different mode classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => "ON"; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => ""; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => "ON"; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => ""; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; - + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/staging/215.cf b/tests/acceptance/00_basics/03_bodies/staging/215.cf index ce28a60e10..5a92d140aa 100644 --- a/tests/acceptance/00_basics/03_bodies/staging/215.cf +++ b/tests/acceptance/00_basics/03_bodies/staging/215.cf @@ -4,20 +4,20 @@ # Insert lines to a file, the grep for a line which is there # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; - "body" string => - "BEGIN + "dummy" string => "dummy"; + + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -25,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -33,98 +33,99 @@ END"; body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { commands: - "$(G.grep) BEGIN $(G.testfile)" - classes => all_classes; + "$(G.grep) BEGIN $(G.testfile)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; - + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/staging/216.cf b/tests/acceptance/00_basics/03_bodies/staging/216.cf index 4bd72f874e..a0ca7c7174 100644 --- a/tests/acceptance/00_basics/03_bodies/staging/216.cf +++ b/tests/acceptance/00_basics/03_bodies/staging/216.cf @@ -4,20 +4,20 @@ # Insert lines to a file, the grep for a line which is there # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; - "body" string => - "BEGIN + "dummy" string => "dummy"; + + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -25,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -33,101 +33,102 @@ END"; body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; - kept_returncodes => { "0" }; - repaired_returncodes => { "1" }; - failed_returncodes => { "2" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; + kept_returncodes => { "0" }; + repaired_returncodes => { "1" }; + failed_returncodes => { "2" }; } ####################################################### - bundle agent test { commands: - "$(G.grep) BEGIN $(G.testfile)" - classes => all_classes; + "$(G.grep) BEGIN $(G.testfile)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => "ON"; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => ""; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => "ON"; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => ""; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; - + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/staging/217.cf b/tests/acceptance/00_basics/03_bodies/staging/217.cf index cd477d5ba1..0215a84e2c 100644 --- a/tests/acceptance/00_basics/03_bodies/staging/217.cf +++ b/tests/acceptance/00_basics/03_bodies/staging/217.cf @@ -4,20 +4,20 @@ # Insert lines to a file, the grep for a line which is there # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; - "body" string => - "BEGIN + "dummy" string => "dummy"; + + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -25,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -33,102 +33,102 @@ END"; body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; - kept_returncodes => { "0" }; - repaired_returncodes => { "1" }; - failed_returncodes => { "2" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; + kept_returncodes => { "0" }; + repaired_returncodes => { "1" }; + failed_returncodes => { "2" }; } ####################################################### - bundle agent test { commands: - "$(G.grep) linenotfound $(G.testfile)" - classes => all_classes; + "$(G.grep) linenotfound $(G.testfile)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; - + !ok:: "$(this.promise_filename) FAIL"; - } diff --git a/tests/acceptance/00_basics/03_bodies/staging/218.cf b/tests/acceptance/00_basics/03_bodies/staging/218.cf index 890ce116e1..8ba1edb2f3 100644 --- a/tests/acceptance/00_basics/03_bodies/staging/218.cf +++ b/tests/acceptance/00_basics/03_bodies/staging/218.cf @@ -4,20 +4,20 @@ # Insert lines to a file, the grep for a line which is there # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; - "body" string => - "BEGIN + "dummy" string => "dummy"; + + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -25,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -33,100 +33,102 @@ END"; body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; - kept_returncodes => { "0" }; - repaired_returncodes => { "1" }; - failed_returncodes => { "2" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; + kept_returncodes => { "0" }; + repaired_returncodes => { "1" }; + failed_returncodes => { "2" }; } ####################################################### - bundle agent test { commands: - "$(G.grep) BEGIN $(G.testfile).missing" - classes => all_classes; + "$(G.grep) BEGIN $(G.testfile).missing" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => "ON"; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => ""; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => "ON"; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => ""; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/staging/219.cf b/tests/acceptance/00_basics/03_bodies/staging/219.cf index 44a34c52c1..c6f8c9d5e9 100644 --- a/tests/acceptance/00_basics/03_bodies/staging/219.cf +++ b/tests/acceptance/00_basics/03_bodies/staging/219.cf @@ -4,20 +4,20 @@ # Insert lines to a file, the grep for a line which is there # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; - "body" string => - "BEGIN + "dummy" string => "dummy"; + + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -25,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -33,100 +33,102 @@ END"; body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; - kept_returncodes => { "1" }; - repaired_returncodes => { "2" }; - failed_returncodes => { "3" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; + kept_returncodes => { "1" }; + repaired_returncodes => { "2" }; + failed_returncodes => { "3" }; } ####################################################### - bundle agent test { commands: - "$(G.grep) BEGIN $(G.testfile)" - classes => all_classes; + "$(G.grep) BEGIN $(G.testfile)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/staging/221.cf b/tests/acceptance/00_basics/03_bodies/staging/221.cf index 633b09ec86..2dc4d70254 100644 --- a/tests/acceptance/00_basics/03_bodies/staging/221.cf +++ b/tests/acceptance/00_basics/03_bodies/staging/221.cf @@ -4,20 +4,20 @@ # Insert lines to a file, the grep for a line which is there # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; - "body" string => - "BEGIN + "dummy" string => "dummy"; + + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -25,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -33,100 +33,102 @@ END"; body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; - kept_returncodes => { "10", "11" }; - repaired_returncodes => { "11" }; - failed_returncodes => { "11", "12" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; + kept_returncodes => { "10", "11" }; + repaired_returncodes => { "11" }; + failed_returncodes => { "11", "12" }; } ####################################################### - bundle agent test { commands: - "$(G.grep) linenotfound $(G.testfile)" - classes => all_classes; + "$(G.grep) linenotfound $(G.testfile)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/03_bodies/staging/225.cf b/tests/acceptance/00_basics/03_bodies/staging/225.cf index 53651ab2a2..c65ff389a2 100644 --- a/tests/acceptance/00_basics/03_bodies/staging/225.cf +++ b/tests/acceptance/00_basics/03_bodies/staging/225.cf @@ -4,32 +4,31 @@ # Insert lines to a file, the grep for a line which is there # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { - # These must be global classes so they can be tested in another bundle - # We set them here, so they can be (possibly) cleared later + # These must be global classes so they can be tested in another bundle + # We set them here, so they can be (possibly) cleared later classes: - "cancel_kept" expression => "any"; - "cancel_repaired" expression => "any"; - "cancel_notkept" expression => "any"; + "cancel_kept" expression => "any"; + "cancel_repaired" expression => "any"; + "cancel_notkept" expression => "any"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; - "body" string => - "BEGIN + "dummy" string => "dummy"; + + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -37,7 +36,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -45,106 +44,110 @@ END"; body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; - kept_returncodes => { "11", "13" }; - repaired_returncodes => { "12" }; - failed_returncodes => { " 1", "12" }; # Spaces in number should be ok + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; + kept_returncodes => { "11", "13" }; + repaired_returncodes => { "12" }; + failed_returncodes => { " 1", "12" }; + + # Spaces in number should be ok } ####################################################### - bundle agent test { commands: - "$(G.grep) linenotfound $(G.testfile)" - classes => all_classes; + "$(G.grep) linenotfound $(G.testfile)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + MAIN.ok:: - "$(this.promise_filename) Pass" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) Pass" report_to_file => "$(G.logfile)"; + !ok:: "$(this.promise_filename) FAIL"; + MAIN.!ok:: - "$(this.promise_filename) FAIL" - report_to_file => "$(G.logfile)"; + "$(this.promise_filename) FAIL" report_to_file => "$(G.logfile)"; } diff --git a/tests/acceptance/00_basics/04_bundles/agent-bundle-class-bundle-scope-default-perspective.cf b/tests/acceptance/00_basics/04_bundles/agent-bundle-class-bundle-scope-default-perspective.cf index f8304cd920..f1921d2271 100755 --- a/tests/acceptance/00_basics/04_bundles/agent-bundle-class-bundle-scope-default-perspective.cf +++ b/tests/acceptance/00_basics/04_bundles/agent-bundle-class-bundle-scope-default-perspective.cf @@ -1,24 +1,35 @@ #!/var/cfengine/bin/cf-agent -f- body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { - default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -body file control { namespace => "test"; } + +body file control +{ + namespace => "test"; +} + bundle agent example { classes: "TRIGGERED" expression => "any", - scope => "bundle"; # Bundle scoped classes are NOT visible from other bundles + scope => "bundle"; + + # Bundle scoped classes are NOT visible from other bundles } -body file control { namespace => "default"; } + +body file control +{ + namespace => "default"; +} + bundle agent test { meta: - "description" -> {"ENT-4681" } + "description" -> { "ENT-4681" } string => "Test that bundle scoped classes defined from namespaced agent bundles are properly scoped. Specifically from the default namespace."; @@ -30,43 +41,43 @@ bundle agent test methods: "test:example"; } + bundle agent check { classes: # Expectation, default:TRIGGERED is NOT defined - "default_TRIGGERED_OK" - expression => "!default:TRIGGERED"; + "default_TRIGGERED_OK" expression => "!default:TRIGGERED"; # Expectation, test:TRIGGERED is NOT defined (not visable since it's a bundle scoped class) - "namespaced_TRIGGERED_OK" - expression => "!test:TRIGGERED"; + "namespaced_TRIGGERED_OK" expression => "!test:TRIGGERED"; # Expectation, TRIGGERED is NOT defined, we are now in the default namespace, the TRIGGERED class was defined in the test namespace with a bundle scope - "TRIGGERED_OK" - expression => "!TRIGGERED"; + "TRIGGERED_OK" expression => "!TRIGGERED"; + "pass" + and => { + "default_TRIGGERED_OK", "namespaced_TRIGGERED_OK", "TRIGGERED_OK", + }; - "pass" and => { - "default_TRIGGERED_OK", - "namespaced_TRIGGERED_OK", - "TRIGGERED_OK", - }; reports: pass:: - "Pass $(this.promise_filename)"; + "Pass $(this.promise_filename)"; + !pass:: - "FAIL $(this.promise_filename)"; + "FAIL $(this.promise_filename)"; + !default_TRIGGERED_OK:: - "Expected 'default:TRIGGERED' to not be seen as defined, but expression '!default:TRIGGERED' resulted in true"; + "Expected 'default:TRIGGERED' to not be seen as defined, but expression '!default:TRIGGERED' resulted in true"; + !namespaced_TRIGGERED_OK:: - "Expected 'test:TRIGGERED' to NOT be seen as defined, but expression '!test:TRIGGERED' resulted in false"; - !TRIGGERED_OK:: - "Expected 'TRIGGERED' to NOT be seen as defined, but expression 'TRIGGERED' resulted in true even without specify the test namespace"; + "Expected 'test:TRIGGERED' to NOT be seen as defined, but expression '!test:TRIGGERED' resulted in false"; + !TRIGGERED_OK:: + "Expected 'TRIGGERED' to NOT be seen as defined, but expression 'TRIGGERED' resulted in true even without specify the test namespace"; } + bundle agent __main__ { - methods: "test:example"; "check"; diff --git a/tests/acceptance/00_basics/04_bundles/agent-bundle-class-bundle-scope-namespace-perspective.cf b/tests/acceptance/00_basics/04_bundles/agent-bundle-class-bundle-scope-namespace-perspective.cf index b13dc734f0..e4e1af1621 100755 --- a/tests/acceptance/00_basics/04_bundles/agent-bundle-class-bundle-scope-namespace-perspective.cf +++ b/tests/acceptance/00_basics/04_bundles/agent-bundle-class-bundle-scope-namespace-perspective.cf @@ -1,64 +1,73 @@ #!/var/cfengine/bin/cf-agent -f- body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { - default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -body file control { namespace => "test"; } + +body file control +{ + namespace => "test"; +} + bundle agent example { classes: "TRIGGERED" expression => "any", - scope => "bundle"; # Namespace scoped classes are visible from other bundles + scope => "bundle"; + + # Namespace scoped classes are visible from other bundles } + bundle agent check { classes: # Expectation, default:TRIGGERED is NOT defined - "default_TRIGGERED_OK" - expression => "!default:TRIGGERED"; + "default_TRIGGERED_OK" expression => "!default:TRIGGERED"; # Expectation, test:TRIGGERED is NOT defined (not visable since it's a bundle scoped class) - "namespaced_TRIGGERED_OK" - expression => "!test:TRIGGERED"; + "namespaced_TRIGGERED_OK" expression => "!test:TRIGGERED"; # Expectation, TRIGGERED is NOT defined, we are now in the test namespace where the TRIGGERED class was defined, but it was bundle scoped, so not visable from another bundle - "TRIGGERED_OK" - expression => "!TRIGGERED"; + "TRIGGERED_OK" expression => "!TRIGGERED"; + "pass" + and => { + "default_TRIGGERED_OK", "namespaced_TRIGGERED_OK", "TRIGGERED_OK", + }; - "pass" and => { - "default_TRIGGERED_OK", - "namespaced_TRIGGERED_OK", - "TRIGGERED_OK", - }; reports: pass:: - "Pass $(this.promise_filename)"; + "Pass $(this.promise_filename)"; + !pass:: - "FAIL $(this.promise_filename)"; + "FAIL $(this.promise_filename)"; + !default_TRIGGERED_OK:: - "Expected 'default:TRIGGERED' to not be seen as defined, but expression '!default:TRIGGERED' resulted in true"; + "Expected 'default:TRIGGERED' to not be seen as defined, but expression '!default:TRIGGERED' resulted in true"; + !namespaced_TRIGGERED_OK:: - "Expected 'test:TRIGGERED' to NOT be seen as defined, but expression '!test:TRIGGERED' resulted in false"; + "Expected 'test:TRIGGERED' to NOT be seen as defined, but expression '!test:TRIGGERED' resulted in false"; + !TRIGGERED_OK:: - "Expected 'TRIGGERED' to NOT be seen as defined, but expression '!TRIGGERED' resulted in false"; + "Expected 'TRIGGERED' to NOT be seen as defined, but expression '!TRIGGERED' resulted in false"; +} +body file control +{ + namespace => "default"; } -body file control { namespace => "default"; } + bundle agent test { meta: - "description" -> {"ENT-4681" } - + "description" -> { "ENT-4681" } string => "Test that bundle scoped classes defined from namespaced agent bundles are properly scoped. Specifically from the perspective of the non-default namespace itself."; - "test_soft_fail" string => "any", meta => { "ENT-4681" }; @@ -66,14 +75,15 @@ bundle agent test methods: "test:example"; } + bundle agent check { methods: "test:check"; } + bundle agent __main__ { - methods: "test"; "check"; diff --git a/tests/acceptance/00_basics/04_bundles/agent-bundle-namespaced-class-default-perspective.cf b/tests/acceptance/00_basics/04_bundles/agent-bundle-namespaced-class-default-perspective.cf index 76c2ad49c2..d688ff1d55 100755 --- a/tests/acceptance/00_basics/04_bundles/agent-bundle-namespaced-class-default-perspective.cf +++ b/tests/acceptance/00_basics/04_bundles/agent-bundle-namespaced-class-default-perspective.cf @@ -1,19 +1,24 @@ #!/var/cfengine/bin/cf-agent -f- body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { - default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -body file control { namespace => "test"; } + +body file control +{ + namespace => "test"; +} + bundle agent example { classes: "TRIGGERED" expression => "any", - scope => "namespace"; # Namespace scoped classes are visible from other bundles + scope => "namespace"; + # Namespace scoped classes are visible from other bundles reports: TRIGGERED:: "TRIGGERED is defined within $(this.namespace).$(this.bundle)"; @@ -24,11 +29,16 @@ bundle agent example test:TRIGGERED:: "$(this.namespace):TRIGGERED is defined within $(this.namespace).$(this.bundle)"; } -body file control { namespace => "default"; } + +body file control +{ + namespace => "default"; +} + bundle agent test { meta: - "description" -> {"ENT-4681" } + "description" -> { "ENT-4681" } string => "Test that namespace scoped classes defined from namespaced agent bundles are properly scoped. Specifically from the default namespace."; @@ -40,43 +50,43 @@ bundle agent test methods: "test:example"; } + bundle agent check { classes: # Expectation, default:TRIGGERED is NOT defined - "default_TRIGGERED_OK" - expression => "!default:TRIGGERED"; + "default_TRIGGERED_OK" expression => "!default:TRIGGERED"; # Expectation, test:TRIGGERED is defined (visable since it's a namespace scoped class) - "namespaced_TRIGGERED_OK" - expression => "test:TRIGGERED"; + "namespaced_TRIGGERED_OK" expression => "test:TRIGGERED"; # Expectation, TRIGGERED is NOT defined, we are now in the default namespace, the TRIGGERED class was defined in the test namespace and should not be seen without explicitly using it's namespace - "TRIGGERED_OK" - expression => "!TRIGGERED"; + "TRIGGERED_OK" expression => "!TRIGGERED"; + "pass" + and => { + "default_TRIGGERED_OK", "namespaced_TRIGGERED_OK", "TRIGGERED_OK", + }; - "pass" and => { - "default_TRIGGERED_OK", - "namespaced_TRIGGERED_OK", - "TRIGGERED_OK", - }; reports: pass:: - "Pass $(this.promise_filename)"; + "Pass $(this.promise_filename)"; + !pass:: - "FAIL $(this.promise_filename)"; + "FAIL $(this.promise_filename)"; + !default_TRIGGERED_OK:: - "Expected 'default:TRIGGERED' to not be seen as defined, but expression '!default:TRIGGERED' resulted in true"; + "Expected 'default:TRIGGERED' to not be seen as defined, but expression '!default:TRIGGERED' resulted in true"; + !namespaced_TRIGGERED_OK:: - "Expected 'test:TRIGGERED' to be seen as defined, but expression 'test:TRIGGERED' resulted in false"; - !TRIGGERED_OK:: - "Expected 'TRIGGERED' to NOT be seen as defined, but expression 'TRIGGERED' resulted in true even without specify the test namespace"; + "Expected 'test:TRIGGERED' to be seen as defined, but expression 'test:TRIGGERED' resulted in false"; + !TRIGGERED_OK:: + "Expected 'TRIGGERED' to NOT be seen as defined, but expression 'TRIGGERED' resulted in true even without specify the test namespace"; } + bundle agent __main__ { - methods: "test:example"; "check"; diff --git a/tests/acceptance/00_basics/04_bundles/agent-bundle-namespaced-class-namespace-perspective.cf b/tests/acceptance/00_basics/04_bundles/agent-bundle-namespaced-class-namespace-perspective.cf index 96b9383cae..af2c45535e 100755 --- a/tests/acceptance/00_basics/04_bundles/agent-bundle-namespaced-class-namespace-perspective.cf +++ b/tests/acceptance/00_basics/04_bundles/agent-bundle-namespaced-class-namespace-perspective.cf @@ -1,64 +1,73 @@ #!/var/cfengine/bin/cf-agent -f- body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { - default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -body file control { namespace => "test"; } + +body file control +{ + namespace => "test"; +} + bundle agent example { classes: "TRIGGERED" expression => "any", - scope => "namespace"; # Namespace scoped classes are visible from other bundles + scope => "namespace"; + + # Namespace scoped classes are visible from other bundles } + bundle agent check { classes: # Expectation, default:TRIGGERED is NOT defined - "default_TRIGGERED_OK" - expression => "!default:TRIGGERED"; + "default_TRIGGERED_OK" expression => "!default:TRIGGERED"; # Expectation, test:TRIGGERED is defined (visable since it's a namespace scoped class) - "namespaced_TRIGGERED_OK" - expression => "test:TRIGGERED"; + "namespaced_TRIGGERED_OK" expression => "test:TRIGGERED"; # Expectation, TRIGGERED is defined, we are now in the test namespace where the TRIGGERED class was defined. We should be able to reference classes defined in our current namespace without being explicit - "TRIGGERED_OK" - expression => "TRIGGERED"; + "TRIGGERED_OK" expression => "TRIGGERED"; + "pass" + and => { + "default_TRIGGERED_OK", "namespaced_TRIGGERED_OK", "TRIGGERED_OK", + }; - "pass" and => { - "default_TRIGGERED_OK", - "namespaced_TRIGGERED_OK", - "TRIGGERED_OK", - }; reports: pass:: - "Pass $(this.promise_filename)"; + "Pass $(this.promise_filename)"; + !pass:: - "FAIL $(this.promise_filename)"; + "FAIL $(this.promise_filename)"; + !default_TRIGGERED_OK:: - "Expected 'default:TRIGGERED' to not be seen as defined, but expression '!default:TRIGGERED' resulted in true"; + "Expected 'default:TRIGGERED' to not be seen as defined, but expression '!default:TRIGGERED' resulted in true"; + !namespaced_TRIGGERED_OK:: - "Expected 'test:TRIGGERED' to be seen as defined, but expression 'test:TRIGGERED' resulted in false"; + "Expected 'test:TRIGGERED' to be seen as defined, but expression 'test:TRIGGERED' resulted in false"; + !TRIGGERED_OK:: - "Expected 'TRIGGERED' to be seen as defined, but expression 'TRIGGERED' resulted in false"; + "Expected 'TRIGGERED' to be seen as defined, but expression 'TRIGGERED' resulted in false"; +} +body file control +{ + namespace => "default"; } -body file control { namespace => "default"; } + bundle agent test { meta: - "description" -> {"ENT-4681" } - + "description" -> { "ENT-4681" } string => "Test that namespace scoped classes defined from namespaced agent bundles are properly scoped. Specifically from the perspective of the non-default namespace itself."; - "test_soft_fail" string => "any", meta => { "ENT-4681" }; @@ -66,14 +75,15 @@ bundle agent test methods: "test:example"; } + bundle agent check { methods: "test:check"; } + bundle agent __main__ { - methods: "test"; "check"; diff --git a/tests/acceptance/00_basics/04_bundles/bundle-iteration.cf b/tests/acceptance/00_basics/04_bundles/bundle-iteration.cf index a5487a4533..05de27b34a 100644 --- a/tests/acceptance/00_basics/04_bundles/bundle-iteration.cf +++ b/tests/acceptance/00_basics/04_bundles/bundle-iteration.cf @@ -1,9 +1,8 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { - default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -13,34 +12,43 @@ bundle agent init bundle agent test { vars: - "bundles" slist => { "a", "b" }; - "values" slist => { "x", "y" }; + "bundles" slist => { "a", "b" }; + "values" slist => { "x", "y" }; methods: - "b" usebundle => $(bundles)("z"); # runs 2x - "bv" usebundle => $(bundles)($(values)); # runs 4x + "b" usebundle => $(bundles)("z"); + + # runs 2x + "bv" usebundle => $(bundles)($(values)); + + # runs 4x } bundle agent a(var) { classes: - "a_$(var)" expression => "any", scope => "namespace"; + "a_$(var)" + expression => "any", + scope => "namespace"; } bundle agent b(var) { classes: - "b_$(var)" expression => "any", scope => "namespace"; + "b_$(var)" + expression => "any", + scope => "namespace"; } bundle agent check { classes: - "ok" and => { "a_x", "b_x", "a_y", "b_y", "a_z", "b_z" }; + "ok" and => { "a_x", "b_x", "a_y", "b_y", "a_z", "b_z" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/04_bundles/call_namespaced_bundle_from_namespace_without_specifying_namespace.cf b/tests/acceptance/00_basics/04_bundles/call_namespaced_bundle_from_namespace_without_specifying_namespace.cf index 29bb4eec4a..b658f0c399 100644 --- a/tests/acceptance/00_basics/04_bundles/call_namespaced_bundle_from_namespace_without_specifying_namespace.cf +++ b/tests/acceptance/00_basics/04_bundles/call_namespaced_bundle_from_namespace_without_specifying_namespace.cf @@ -1,12 +1,11 @@ # Test that namespaced bundles that call other namespaced bundles can do so # without specifying their own namespace # Redmine:4289 (https://cfengine.com/dev/issues/4289) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -16,25 +15,28 @@ bundle agent init bundle agent test { vars: - "agent_output" - string => execresult("$(sys.cf_agent) -KIf $(this.promise_filename).sub -b testing:one", "noshell"); - + "agent_output" + string => execresult( + "$(sys.cf_agent) -KIf $(this.promise_filename).sub -b testing:one", + "noshell" + ); } bundle agent check { classes: - "OK_non_specified_namespace" expression => regcmp(".*OKI DOKI.*", $(test.agent_output)); - "OK_specified_namespace" expression => regcmp(".*artichokie.*", $(test.agent_output)); + "OK_non_specified_namespace" + expression => regcmp(".*OKI DOKI.*", $(test.agent_output)); - "ok" and => { - "OK_non_specified_namespace", - "OK_specified_namespace", - }; + "OK_specified_namespace" + expression => regcmp(".*artichokie.*", $(test.agent_output)); + + "ok" and => { "OK_non_specified_namespace", "OK_specified_namespace" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; diff --git a/tests/acceptance/00_basics/04_bundles/common-bundle-normal-ordering.cf b/tests/acceptance/00_basics/04_bundles/common-bundle-normal-ordering.cf index 0ce685c9fc..747a59d3ba 100644 --- a/tests/acceptance/00_basics/04_bundles/common-bundle-normal-ordering.cf +++ b/tests/acceptance/00_basics/04_bundles/common-bundle-normal-ordering.cf @@ -1,15 +1,12 @@ # Tests that normal ordering (classes before vars) is adhered to in commmon # bundles, leading to correct resolution regardless of policy order. - # This check tests that # 1. Common bundles are converged before other bundles. # 2. Common bundles promises follow normal ordering - body common control { - - bundlesequence => { check }; - version => "1.0"; + bundlesequence => { check }; + version => "1.0"; } bundle agent check @@ -24,16 +21,14 @@ bundle agent check # It is critical that the common bundle is declared after the agent bundles bundle common g_stuff { - # promise type ordering here is critical + # promise type ordering here is critical vars: trigger:: - "one" string => "Pas"; + "one" string => "Pas"; any:: "two" slist => { "$(one)s" }; classes: - "trigger" expression => "any"; - + "trigger" expression => "any"; } - diff --git a/tests/acceptance/00_basics/04_bundles/duplicate_promise_handles.cf b/tests/acceptance/00_basics/04_bundles/duplicate_promise_handles.cf index 57721eed47..3cc5dc3051 100644 --- a/tests/acceptance/00_basics/04_bundles/duplicate_promise_handles.cf +++ b/tests/acceptance/00_basics/04_bundles/duplicate_promise_handles.cf @@ -1,12 +1,11 @@ # Test that we don't get errors about duplicate handles when using variables in # handle name that do not expand identically # Redmine:4682 (https://cfengine.com/dev/issues/4682) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -24,24 +23,26 @@ bundle agent test handle => "$(this.handle)_$(this.promiser)", string => "bar"; - # Two promises with equal handle but different classes is allowed reports: - debian:: - "this is debian" handle => "os_handle"; - redhat:: - "this is redhat" handle => "os_handle"; + debian:: + "this is debian" handle => "os_handle"; + + redhat:: + "this is redhat" handle => "os_handle"; } bundle agent check { classes: - "ok" and => { "any" }, - comment => "Policy validation failing will cause us to never reach this if the test fails"; + "ok" + and => { "any" }, + comment => "Policy validation failing will cause us to never reach this if the test fails"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/app_based_inputs.cf b/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/app_based_inputs.cf index b34736045d..9c44b4000d 100644 --- a/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/app_based_inputs.cf +++ b/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/app_based_inputs.cf @@ -7,12 +7,11 @@ # include only app files neaded based on list built from array # Lexicly sorted bundles activated with methods promise ####################################################### - body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -21,12 +20,10 @@ bundle agent init "template_target" string => "$(G.testfile)"; files: - "$(template_target)" - create => "true"; + "$(template_target)" create => "true"; } ####################################################### - bundle agent check { vars: @@ -35,10 +32,14 @@ bundle agent check methods: "check" usebundle => dcs_passif_output( -".*R: HEY I activated app00_zero + ".*R: HEY I activated app00_zero R: HEY I activated app_one -R: HEY I activated app_zero.*", ".*FAIL.*", $(command), $(this.promise_filename)); - +R: HEY I activated app_zero.*", + ".*FAIL.*", + $(command), + $(this.promise_filename) + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/classification_bundles_not_in_sequence.cf b/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/classification_bundles_not_in_sequence.cf index 3bccf18563..40a890ba49 100644 --- a/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/classification_bundles_not_in_sequence.cf +++ b/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/classification_bundles_not_in_sequence.cf @@ -6,12 +6,11 @@ # Bundle list built from array # Lexicly sorted bundles activated with methods promise ####################################################### - body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -20,12 +19,10 @@ bundle agent init "template_target" string => "$(G.testfile)"; files: - "$(template_target)" - create => "true"; + "$(template_target)" create => "true"; } ####################################################### - bundle agent check { vars: @@ -34,10 +31,14 @@ bundle agent check methods: "check" usebundle => dcs_passif_output( -".*R: HEY I activated app00_zero + ".*R: HEY I activated app00_zero R: HEY I activated app_one -R: HEY I activated app_zero.*", ".*FAIL.*", $(command), $(this.promise_filename)); - +R: HEY I activated app_zero.*", + ".*FAIL.*", + $(command), + $(this.promise_filename) + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/classification_bundles_not_in_sequence2.cf b/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/classification_bundles_not_in_sequence2.cf index 7bf4601b30..4be039b59f 100644 --- a/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/classification_bundles_not_in_sequence2.cf +++ b/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/classification_bundles_not_in_sequence2.cf @@ -5,12 +5,11 @@ # Bundle list built from array # Lexicly sorted bundles activated with methods promise ####################################################### - body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -19,12 +18,10 @@ bundle agent init "template_target" string => "$(G.testfile)"; files: - "$(template_target)" - create => "true"; + "$(template_target)" create => "true"; } ####################################################### - bundle agent check { vars: @@ -33,10 +30,14 @@ bundle agent check methods: "check" usebundle => dcs_passif_output( -".*R: HEY I activated app00_zero + ".*R: HEY I activated app00_zero R: HEY I activated app_one -R: HEY I activated app_zero.*", ".*FAIL.*", $(command), $(this.promise_filename)); - +R: HEY I activated app_zero.*", + ".*FAIL.*", + $(command), + $(this.promise_filename) + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/classification_bundles_not_in_sequence3.cf b/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/classification_bundles_not_in_sequence3.cf index 5d88425595..fe5f0da22d 100644 --- a/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/classification_bundles_not_in_sequence3.cf +++ b/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/classification_bundles_not_in_sequence3.cf @@ -6,12 +6,11 @@ # Bundle list built from array # Lexicly sorted bundles activated from bundlesequence ####################################################### - body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -20,12 +19,10 @@ bundle agent init "template_target" string => "$(G.testfile)"; files: - "$(template_target)" - create => "true"; + "$(template_target)" create => "true"; } ####################################################### - bundle agent check { vars: @@ -34,10 +31,14 @@ bundle agent check methods: "check" usebundle => dcs_passif_output( -".*R: HEY I activated app00_zero + ".*R: HEY I activated app00_zero R: HEY I activated app_one -R: HEY I activated app_zero.*", ".*FAIL.*", $(command), $(this.promise_filename)); - +R: HEY I activated app_zero.*", + ".*FAIL.*", + $(command), + $(this.promise_filename) + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/dynamic_inputs_based_on_class_set_using_variable_file_control_extends_inputs.cf b/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/dynamic_inputs_based_on_class_set_using_variable_file_control_extends_inputs.cf index 94699e542b..4d376a056c 100644 --- a/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/dynamic_inputs_based_on_class_set_using_variable_file_control_extends_inputs.cf +++ b/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/dynamic_inputs_based_on_class_set_using_variable_file_control_extends_inputs.cf @@ -7,12 +7,11 @@ # include only app files neaded based on list built from array # Lexicly sorted bundles activated with methods promise ####################################################### - body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -21,17 +20,14 @@ bundle agent init "template_target" string => "$(G.testfile)"; files: - "$(template_target)" - create => "true"; + "$(template_target)" create => "true"; } ####################################################### - bundle agent check { meta: - "tags" - slist => { "redmine#6867", "zendesk#1600" }; + "tags" slist => { "redmine#6867", "zendesk#1600" }; vars: "command" string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub"; @@ -39,10 +35,14 @@ bundle agent check methods: "check" usebundle => dcs_passif_output( -".*R: HEY I activated app00_zero + ".*R: HEY I activated app00_zero R: HEY I activated app_one -R: HEY I activated app_zero.*", ".*FAIL.*", $(command), $(this.promise_filename)); - +R: HEY I activated app_zero.*", + ".*FAIL.*", + $(command), + $(this.promise_filename) + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/dynamic_inputs_based_on_list_variable_dependent_on_class.cf b/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/dynamic_inputs_based_on_list_variable_dependent_on_class.cf index 24a5516ed8..45eca083cb 100644 --- a/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/dynamic_inputs_based_on_list_variable_dependent_on_class.cf +++ b/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/dynamic_inputs_based_on_list_variable_dependent_on_class.cf @@ -1,33 +1,35 @@ body common control { - inputs => { @(inventory.inputs) }; - bundlesequence => { @(inventory.bundles) }; + inputs => { @(inventory.inputs) }; + bundlesequence => { @(inventory.bundles) }; } bundle common inventory { - classes: - "this_is_true" expression => "any"; + classes: + "this_is_true" expression => "any"; - vars: - !this_is_true:: - "inputs" slist => { }; - "bundles" slist => { "bad" }; - this_is_true.!windows:: - "inputs" slist => { "$(this.promise_filename).sub" }; - "bundles" slist => { "good" }; - windows:: - "bundles" slist => { "skip" }; + vars: + !this_is_true:: + "inputs" slist => {}; + "bundles" slist => { "bad" }; + + this_is_true.!windows:: + "inputs" slist => { "$(this.promise_filename).sub" }; + "bundles" slist => { "good" }; + + windows:: + "bundles" slist => { "skip" }; } bundle agent bad { - reports: - "$(this.promise_filename) FAIL"; + reports: + "$(this.promise_filename) FAIL"; } bundle agent skip { - reports: - "$(this.promise_filename) Skip/unsupported"; + reports: + "$(this.promise_filename) Skip/unsupported"; } diff --git a/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/simple.cf b/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/simple.cf index 7bf4601b30..4be039b59f 100644 --- a/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/simple.cf +++ b/tests/acceptance/00_basics/04_bundles/dynamic_bundlesequence/simple.cf @@ -5,12 +5,11 @@ # Bundle list built from array # Lexicly sorted bundles activated with methods promise ####################################################### - body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -19,12 +18,10 @@ bundle agent init "template_target" string => "$(G.testfile)"; files: - "$(template_target)" - create => "true"; + "$(template_target)" create => "true"; } ####################################################### - bundle agent check { vars: @@ -33,10 +30,14 @@ bundle agent check methods: "check" usebundle => dcs_passif_output( -".*R: HEY I activated app00_zero + ".*R: HEY I activated app00_zero R: HEY I activated app_one -R: HEY I activated app_zero.*", ".*FAIL.*", $(command), $(this.promise_filename)); - +R: HEY I activated app_zero.*", + ".*FAIL.*", + $(command), + $(this.promise_filename) + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/00_basics/04_bundles/empty_list_or_datacontainer_should_not_error_bundlesequence/bundlesequence_iterate_over_data_container.cf b/tests/acceptance/00_basics/04_bundles/empty_list_or_datacontainer_should_not_error_bundlesequence/bundlesequence_iterate_over_data_container.cf index 758aaa17d6..6985a8782c 100644 --- a/tests/acceptance/00_basics/04_bundles/empty_list_or_datacontainer_should_not_error_bundlesequence/bundlesequence_iterate_over_data_container.cf +++ b/tests/acceptance/00_basics/04_bundles/empty_list_or_datacontainer_should_not_error_bundlesequence/bundlesequence_iterate_over_data_container.cf @@ -1,20 +1,22 @@ body common control { inputs => { "../../../default.sub.cf" }; - bundlesequence => { collect_stories_metadata, test_precheck, def, test, @(def.container), check }; + bundlesequence => { + collect_stories_metadata, test_precheck, def, test, @(def.container), check + }; } bundle common def { vars: "v" slist => variablesmatching("default\:def.*"); - "m" data => mergedata( "def.missing" ); + "m" data => mergedata("def.missing"); "values" slist => getvalues(m); "indices" slist => getindices(m); "container" data => parsejson('[ "one", "two" ]'); -# "list" slist => { "one", "two" }; -# "container" data => mergedata(list); + # "list" slist => { "one", "two" }; + # "container" data => mergedata(list); reports: DEBUG:: "Def Varaiable: $(v)"; @@ -24,31 +26,37 @@ bundle common def bundle agent one { classes: - # We check for this class in bundle agent check - "actuated_bundle_agent_$(this.bundle)" expression => "any", scope => "namespace"; + # We check for this class in bundle agent check + "actuated_bundle_agent_$(this.bundle)" + expression => "any", + scope => "namespace"; - reports: "one"; + reports: + "one"; } bundle agent two { classes: - # We check for this class in bundle agent check - "actuated_bundle_agent_$(this.bundle)" expression => "any", scope => "namespace"; + # We check for this class in bundle agent check + "actuated_bundle_agent_$(this.bundle)" + expression => "any", + scope => "namespace"; - reports: "two"; + reports: + "two"; } - bundle agent test { meta: - "description" string => "Test that bundlesequence in body common control can iterate over a data container."; + "description" + string => "Test that bundlesequence in body common control can iterate over a data container."; - # This was working in 3.7.4 but has regressed. - "test_soft_fail" - string => "!cfengine_3_7", - meta => { "CFE-2460"}; + # This was working in 3.7.4 but has regressed. + "test_soft_fail" + string => "!cfengine_3_7", + meta => { "CFE-2460" }; } bundle agent check diff --git a/tests/acceptance/00_basics/04_bundles/empty_list_or_datacontainer_should_not_error_bundlesequence/empty_data_container_does_not_trigger_undefined_bundle.cf b/tests/acceptance/00_basics/04_bundles/empty_list_or_datacontainer_should_not_error_bundlesequence/empty_data_container_does_not_trigger_undefined_bundle.cf index ef54e34b37..7107869a43 100644 --- a/tests/acceptance/00_basics/04_bundles/empty_list_or_datacontainer_should_not_error_bundlesequence/empty_data_container_does_not_trigger_undefined_bundle.cf +++ b/tests/acceptance/00_basics/04_bundles/empty_list_or_datacontainer_should_not_error_bundlesequence/empty_data_container_does_not_trigger_undefined_bundle.cf @@ -17,10 +17,11 @@ bundle common def bundle agent test { meta: - "description" string => "Test that an empty data container does not trigger an undefined bundle error"; + "description" + string => "Test that an empty data container does not trigger an undefined bundle error"; } -bundle agent check +bundle agent check { reports: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/00_basics/04_bundles/empty_list_or_datacontainer_should_not_error_bundlesequence/empty_list_does_not_trigger_undefined_bundle.cf b/tests/acceptance/00_basics/04_bundles/empty_list_or_datacontainer_should_not_error_bundlesequence/empty_list_does_not_trigger_undefined_bundle.cf index f56ee61024..d7db5cb122 100644 --- a/tests/acceptance/00_basics/04_bundles/empty_list_or_datacontainer_should_not_error_bundlesequence/empty_list_does_not_trigger_undefined_bundle.cf +++ b/tests/acceptance/00_basics/04_bundles/empty_list_or_datacontainer_should_not_error_bundlesequence/empty_list_does_not_trigger_undefined_bundle.cf @@ -7,7 +7,7 @@ bundle common def { vars: "v" slist => variablesmatching("default\:def.*"); - "bundlesequnece_end" slist => { }; + "bundlesequnece_end" slist => {}; reports: DEBUG:: @@ -17,7 +17,8 @@ bundle common def bundle agent test { meta: - "description" string => "Test that an empty list does not trigger an undefined bundle error"; + "description" + string => "Test that an empty list does not trigger an undefined bundle error"; } bundle agent check diff --git a/tests/acceptance/00_basics/04_bundles/getindices-vars-need-secondpass.cf b/tests/acceptance/00_basics/04_bundles/getindices-vars-need-secondpass.cf index a0ae00d0b4..ba230c1134 100644 --- a/tests/acceptance/00_basics/04_bundles/getindices-vars-need-secondpass.cf +++ b/tests/acceptance/00_basics/04_bundles/getindices-vars-need-secondpass.cf @@ -1,9 +1,8 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { - default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -13,15 +12,13 @@ bundle agent init bundle agent test { vars: - "x" slist => { "PARAM1", "PARAM2" }; - - "conf[internal1]" string => "internalvalue1"; - "conf[internal2]" string => "internalvalue2"; - "conf[$(x)]" string => "$(x)"; - - "keys_unsorted" slist => getindices("conf"); - "keys" slist => sort(keys_unsorted, "lex"); - "keys_str" string => format("%S", keys); + "x" slist => { "PARAM1", "PARAM2" }; + "conf[internal1]" string => "internalvalue1"; + "conf[internal2]" string => "internalvalue2"; + "conf[$(x)]" string => "$(x)"; + "keys_unsorted" slist => getindices("conf"); + "keys" slist => sort(keys_unsorted, "lex"); + "keys_str" string => format("%S", keys); reports: DEBUG:: @@ -31,15 +28,15 @@ bundle agent test bundle agent check { vars: - "expected" string => '{ "PARAM1", "PARAM2", "internal1", "internal2" }'; + "expected" string => '{ "PARAM1", "PARAM2", "internal1", "internal2" }'; classes: - "ok" expression => strcmp($(test.keys_str), - $(expected)); + "ok" expression => strcmp($(test.keys_str), $(expected)); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; diff --git a/tests/acceptance/00_basics/04_bundles/main_entry_point.cf b/tests/acceptance/00_basics/04_bundles/main_entry_point.cf index b56a082310..2008f4faa8 100644 --- a/tests/acceptance/00_basics/04_bundles/main_entry_point.cf +++ b/tests/acceptance/00_basics/04_bundles/main_entry_point.cf @@ -1,12 +1,13 @@ body file control { - inputs => { "main_entry_point.cf.sub" }; + inputs => { "main_entry_point.cf.sub" }; } bundle agent __main__ { - methods: - "imported" usebundle => imported(); - reports: - "$(this.promise_filename) Pass"; + methods: + "imported" usebundle => imported(); + + reports: + "$(this.promise_filename) Pass"; } diff --git a/tests/acceptance/00_basics/04_bundles/main_rename.cf b/tests/acceptance/00_basics/04_bundles/main_rename.cf index b7889d5bc2..e37b046764 100644 --- a/tests/acceptance/00_basics/04_bundles/main_rename.cf +++ b/tests/acceptance/00_basics/04_bundles/main_rename.cf @@ -1,10 +1,10 @@ body common control { - bundlesequence => { "main" }; + bundlesequence => { "main" }; } bundle agent __main__ { - reports: - "$(this.promise_filename) Pass"; + reports: + "$(this.promise_filename) Pass"; } diff --git a/tests/acceptance/00_basics/04_bundles/namespaced.cf b/tests/acceptance/00_basics/04_bundles/namespaced.cf index 8db5442bc2..5073086f94 100644 --- a/tests/acceptance/00_basics/04_bundles/namespaced.cf +++ b/tests/acceptance/00_basics/04_bundles/namespaced.cf @@ -1,13 +1,11 @@ # Redmine#4025 - body common control { - inputs => { "../../default.sub.cf", "namespaced.cf.sub" }; - bundlesequence => { - ns1:mytest("x"), - ns2:mytest("x", "y"), - default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "namespaced.cf.sub" }; + bundlesequence => { + ns1:mytest("x"), ns2:mytest("x", "y"), default("$(this.promise_filename)") + }; + version => "1.0"; } bundle agent init @@ -17,43 +15,69 @@ bundle agent init bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; } bundle agent check { vars: - "checks" slist => { "ns1:ns1global", "ns2:ns2global", "ns1:ns1global_from_ppkeys", "ns1:ns1global_from_ppkeys_explicit", - "ns1global", "ns2global", - "ok_ns1string", "ok_ns2string", "ok_ns2string2", + "checks" + slist => { + "ns1:ns1global", + "ns2:ns2global", + "ns1:ns1global_from_ppkeys", + "ns1:ns1global_from_ppkeys_explicit", + "ns1global", + "ns2global", + "ok_ns1string", + "ok_ns2string", + "ok_ns2string2", }; classes: - "ok_ns1string" expression => strcmp($(ns1:mytest.ns1string), $(this.promise_dirname)); - "ok_ns2string" expression => strcmp($(ns2:mytest.ns2string), $(sys.fqhost)); - "ok_ns2string2" expression => strcmp($(ns2:mytest.ns2string2), $(const.t)); + "ok_ns1string" + expression => strcmp($(ns1:mytest.ns1string), $(this.promise_dirname)); + + "ok_ns2string" expression => strcmp($(ns2:mytest.ns2string), $(sys.fqhost)); + "ok_ns2string2" expression => strcmp($(ns2:mytest.ns2string2), $(const.t)); - "ok" and => { "ns1:ns1global", "ns2:ns2global", "ns1:ns1global_from_ppkeys", "ns1:ns1ppkeys", - "!ns1global", "!ns2global", - "ok_ns1string", "ok_ns2string", "ok_ns2string2", + "ok" + and => { + "ns1:ns1global", + "ns2:ns2global", + "ns1:ns1global_from_ppkeys", + "ns1:ns1ppkeys", + "!ns1global", + "!ns2global", + "ok_ns1string", + "ok_ns2string", + "ok_ns2string2", }; reports: EXTRA:: "class $(checks) is ON" if => $(checks); + EXTRA:: "class $(checks) is OFF" if => "!$(checks)"; + DEBUG.ns1:ns1global_from_ppkeys:: "ns1:ns1global_from_ppkeys is on as expected"; + DEBUG.ns1:ns1global_from_ppkeys_explicit:: "ns1:ns1global_from_ppkeys_explicit is on as expected"; + DEBUG.!ns1:ns1global_from_ppkeys:: "ns1:ns1global_from_ppkeys is NOT on as expected"; + DEBUG.!ns1:ns1global_from_ppkeys_explicit:: "ns1:ns1global_from_ppkeys_explicit is NOT on as expected"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/04_bundles/non_default_def.cf b/tests/acceptance/00_basics/04_bundles/non_default_def.cf index 6a737d1d26..b46b53cd66 100644 --- a/tests/acceptance/00_basics/04_bundles/non_default_def.cf +++ b/tests/acceptance/00_basics/04_bundles/non_default_def.cf @@ -1,25 +1,24 @@ # Test that 'def' bundle in a non-default namespace works - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } body file control { - namespace => "my_ns"; + namespace => "my_ns"; } bundle common def { vars: - "some_var" string => "some value"; + "some_var" string => "some value"; } body file control { - namespace => "default"; + namespace => "default"; } bundle agent init @@ -33,13 +32,15 @@ bundle agent test bundle agent check { classes: - "ok" expression => strcmp("$(my_ns:def.some_var)", "some value"); + "ok" expression => strcmp("$(my_ns:def.some_var)", "some value"); reports: ok:: "$(this.promise_filename) Pass"; + !ok.DEBUG:: "my_ns:def.some_var: $(my_ns:def.some_var)"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/04_bundles/passing-vars.cf b/tests/acceptance/00_basics/04_bundles/passing-vars.cf index 411cf54165..d2c9b62e19 100644 --- a/tests/acceptance/00_basics/04_bundles/passing-vars.cf +++ b/tests/acceptance/00_basics/04_bundles/passing-vars.cf @@ -1,10 +1,9 @@ # Test that variables can be passed across bundles and namespaces - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -14,23 +13,24 @@ bundle agent init bundle agent test { vars: - "x" string => "datax"; - "y" slist => { "datay1", "datay2" }; - "z" data => parsejson('{ "hello": "there" }'); + "x" string => "datax"; + "y" slist => { "datay1", "datay2" }; + "z" data => parsejson('{ "hello": "there" }'); meta: - "test_skip_needs_work" string => "windows"; + "test_skip_needs_work" string => "windows"; methods: - "x" usebundle => see_scalar($(x)); - "y" usebundle => see_slist(@(test.y)); - "z" usebundle => see_data(@(z)); + "x" usebundle => see_scalar($(x)); + "y" usebundle => see_slist(@(test.y)); + "z" usebundle => see_data(@(z)); } bundle agent see_scalar(svar) { classes: - "saw_scalar" scope => "namespace", + "saw_scalar" + scope => "namespace", expression => strcmp($(svar), "datax"); reports: @@ -41,10 +41,11 @@ bundle agent see_scalar(svar) bundle agent see_slist(lvar) { vars: - "concat" string => join(",", lvar); + "concat" string => join(",", lvar); classes: - "saw_slist" scope => "namespace", + "saw_slist" + scope => "namespace", expression => strcmp($(concat), "datay1,datay2"); reports: @@ -55,16 +56,16 @@ bundle agent see_slist(lvar) bundle agent see_data(cvar_passed) { vars: - "concat_passed" string => storejson(cvar_passed); - - "cvar_local" data => parsejson('{ "hello": "there" }'); - "concat_local" string => storejson(cvar_local); + "concat_passed" string => storejson(cvar_passed); + "cvar_local" data => parsejson('{ "hello": "there" }'); + "concat_local" string => storejson(cvar_local); - # generates a warning about "can't find container named cvar_passed" - "dummy" data => mergedata(cvar_local, cvar_passed); + # generates a warning about "can't find container named cvar_passed" + "dummy" data => mergedata(cvar_local, cvar_passed); classes: - "saw_data" scope => "namespace", + "saw_data" + scope => "namespace", expression => strcmp($(concat_passed), '{ "hello": "there" }'); @@ -78,17 +79,21 @@ bundle agent see_data(cvar_passed) bundle agent check { classes: - "ok" and => { "saw_scalar", "saw_slist", "saw_data" }; + "ok" and => { "saw_scalar", "saw_slist", "saw_data" }; reports: DEBUG.!saw_scalar:: "The scalar passing didn't work"; + DEBUG.!saw_slist:: "The slist passing didn't work"; + DEBUG.!saw_data:: "The data passing didn't work"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/04_bundles/unless.cf b/tests/acceptance/00_basics/04_bundles/unless.cf index 681af026cd..93feb0cfb2 100644 --- a/tests/acceptance/00_basics/04_bundles/unless.cf +++ b/tests/acceptance/00_basics/04_bundles/unless.cf @@ -1,21 +1,17 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; } bundle agent test { - meta: - - "description" -> { "CFE-2698" } - string => "This test ensures changes to unless are compatible with previous behavior"; + "description" -> { "CFE-2698" } + string => "This test ensures changes to unless are compatible with previous behavior"; vars: - any:: - # Simple expressions - unless is equivalent to if not: "defined_variable_unless" string => "value", @@ -53,22 +49,26 @@ bundle agent test # If and unless precedence (skipping takes precedence): "skipped_variable_precedence_if" string => "value", - if => "!any", # Causes the promise to be skipped + if => "!any", + # Causes the promise to be skipped unless => "!any"; "skipped_variable_precedence_unless" string => "value", if => "any", - unless => "any"; # Causes the promise to be skipped + unless => "any"; + # Causes the promise to be skipped "skipped_variable_precedence_unexpanded_variable_if" string => "value", - if => "$(undefined_var)", # Causes the promise to be skipped + if => "$(undefined_var)", + # Causes the promise to be skipped unless => "$(undefined_var)"; "skipped_variable_precedence_unresolved_function_call_if" string => "value", - if => not("$(undefined_var)"), # Causes the promise to be skipped + if => not("$(undefined_var)"), + # Causes the promise to be skipped unless => not("$(undefined_var)"); # Edge case - unresolved function calls: @@ -90,7 +90,6 @@ bundle agent test if => not("$(no_such_var)"); no_such_class:: - # Let's just test that unless doesn't bypass class guards: "skipped_variable_class_guard_unless" string => "value", @@ -101,9 +100,7 @@ bundle agent test if => not("!any"); classes: - any:: - # Simple expressions - unless is equivalent to if not: "defined_class_unless" expression => "any", @@ -150,25 +147,29 @@ bundle agent test "skipped_class_precedence_if" expression => "any", scope => "namespace", - if => "!any", # Causes the promise to be skipped + if => "!any", + # Causes the promise to be skipped unless => "!any"; "skipped_class_precedence_unless" expression => "any", scope => "namespace", if => "any", - unless => "any"; # Causes the promise to be skipped + unless => "any"; + # Causes the promise to be skipped "skipped_class_precedence_unexpanded_variable_if" expression => "any", scope => "namespace", - if => "$(undefined_var)", # Causes the promise to be skipped + if => "$(undefined_var)", + # Causes the promise to be skipped unless => "$(undefined_var)"; "skipped_class_precedence_unresolved_function_call_if" expression => "any", scope => "namespace", - if => not("$(undefined_var)"), # Causes the promise to be skipped + if => not("$(undefined_var)"), + # Causes the promise to be skipped unless => not("$(undefined_var)"); # Edge case - unresolved function calls: @@ -194,7 +195,6 @@ bundle agent test if => not("$(no_such_var)"); no_such_class:: - # Let's just test that if/unless doesn't bypass class guards: "skipped_class_class_guard_unless" expression => "any", @@ -205,67 +205,72 @@ bundle agent test expression => "any", scope => "namespace", if => not("!any"); - } bundle agent check { classes: - any:: - - "positives" # Fail if any of these are not defined: + "positives" + # Fail if any of these are not defined: and => { - isvariable("test.defined_variable_unless"), - isvariable("test.defined_variable_if_not"), - isvariable("test.defined_variable_function_call_unless"), - isvariable("test.defined_variable_function_call_if_not"), - isvariable("test.defined_variable_unresolved_function_call_unless"), - isvariable("test.defined_variable_unresolved_variable_unless"), - "defined_class_unless", - "defined_class_if_not", - "defined_class_function_call_unless", - "defined_class_function_call_if_not", - "defined_class_unresolved_function_call_unless", - "defined_class_unresolved_variable_unless", + isvariable("test.defined_variable_unless"), + isvariable("test.defined_variable_if_not"), + isvariable("test.defined_variable_function_call_unless"), + isvariable("test.defined_variable_function_call_if_not"), + isvariable("test.defined_variable_unresolved_function_call_unless"), + isvariable("test.defined_variable_unresolved_variable_unless"), + "defined_class_unless", + "defined_class_if_not", + "defined_class_function_call_unless", + "defined_class_function_call_if_not", + "defined_class_unresolved_function_call_unless", + "defined_class_unresolved_variable_unless", }; - "negatives" # Fail if any of these are defined: + "negatives" + # Fail if any of these are defined: or => { - isvariable("test.skipped_variable_unless"), - isvariable("test.skipped_variable_if_not"), - isvariable("test.skipped_variable_function_call_unless"), - isvariable("test.skipped_variable_function_call_if_not"), - isvariable("test.skipped_variable_precedence_if"), - isvariable("test.skipped_variable_precedence_unless"), - isvariable("test.skipped_variable_precedence_unexpanded_variable_if"), - isvariable("test.skipped_variable_precedence_unresolved_function_call_if"), - isvariable("test.skipped_variable_unresolved_function_call_if"), - isvariable("test.skipped_variable_unresolved_variable_if_not"), - isvariable("test.skipped_variable_class_guard_unless"), - isvariable("test.skipped_variable_class_guard_if_not"), - "skipped_class_unless", - "skipped_class_if_not", - "skipped_class_function_call_unless", - "skipped_class_function_call_if_not", - "skipped_class_precedence_if", - "skipped_class_precedence_unless", - "skipped_class_precedence_unexpanded_variable_if", - "skipped_class_precedence_unresolved_function_call_if", - "skipped_class_unresolved_function_call_if", - "skipped_class_unresolved_variable_if_not", - "skipped_class_class_guard_unless", - "skipped_class_class_guard_if_not", + isvariable("test.skipped_variable_unless"), + isvariable("test.skipped_variable_if_not"), + isvariable("test.skipped_variable_function_call_unless"), + isvariable("test.skipped_variable_function_call_if_not"), + isvariable("test.skipped_variable_precedence_if"), + isvariable("test.skipped_variable_precedence_unless"), + isvariable( + "test.skipped_variable_precedence_unexpanded_variable_if" + ), + isvariable( + "test.skipped_variable_precedence_unresolved_function_call_if" + ), + isvariable("test.skipped_variable_unresolved_function_call_if"), + isvariable("test.skipped_variable_unresolved_variable_if_not"), + isvariable("test.skipped_variable_class_guard_unless"), + isvariable("test.skipped_variable_class_guard_if_not"), + "skipped_class_unless", + "skipped_class_if_not", + "skipped_class_function_call_unless", + "skipped_class_function_call_if_not", + "skipped_class_precedence_if", + "skipped_class_precedence_unless", + "skipped_class_precedence_unexpanded_variable_if", + "skipped_class_precedence_unresolved_function_call_if", + "skipped_class_unresolved_function_call_if", + "skipped_class_unresolved_variable_if_not", + "skipped_class_class_guard_unless", + "skipped_class_class_guard_if_not", }; reports: - !positives:: "Some classes/vars were unexpectedly skipped"; + negatives:: "Some classes/vars were unexpectedly evaluated"; + positives.!negatives:: "$(this.promise_filename) Pass"; + !positives|negatives:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/04_bundles/unless_vars_order.cf b/tests/acceptance/00_basics/04_bundles/unless_vars_order.cf index 4a2da0e866..ee3fb5efff 100644 --- a/tests/acceptance/00_basics/04_bundles/unless_vars_order.cf +++ b/tests/acceptance/00_basics/04_bundles/unless_vars_order.cf @@ -1,7 +1,7 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; } bundle agent test @@ -13,15 +13,13 @@ bundle agent test vars: any:: - "target_variable" - string => "value"; + "target_variable" string => "value"; "vars_promise_which_should_be_skipped" string => "value", - unless => isvariable( $(variable_defined_later) ); + unless => isvariable($(variable_defined_later)); - "variable_defined_later" - string => "target_variable"; + "variable_defined_later" string => "target_variable"; } bundle agent check @@ -29,13 +27,12 @@ bundle agent check classes: any:: "not_ok" - or => { - isvariable("test.vars_promise_which_should_be_skipped"), - }; + or => { isvariable("test.vars_promise_which_should_be_skipped") }; reports: !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/04_bundles/wrong-bundle-type.cf b/tests/acceptance/00_basics/04_bundles/wrong-bundle-type.cf index 891fec99e5..db2641cbe6 100644 --- a/tests/acceptance/00_basics/04_bundles/wrong-bundle-type.cf +++ b/tests/acceptance/00_basics/04_bundles/wrong-bundle-type.cf @@ -1,34 +1,39 @@ # Test that wrong bundle type is detected (Redmine #XXXX) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { vars: - "subout" string => execresult("${sys.cf_agent} -Kf $(this.promise_dirname)/wrong-bundle-type.sub.x.cf", "noshell"); + "subout" + string => execresult( + "${sys.cf_agent} -Kf $(this.promise_dirname)/wrong-bundle-type.sub.x.cf", + "noshell" + ); } bundle agent check { classes: - "ok" expression => regcmp(".*Unknown bundle type.*", "${test.subout}"); + "ok" expression => regcmp(".*Unknown bundle type.*", "${test.subout}"); reports: DEBUG:: "$(test.subout)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/05_licenses/001.cf b/tests/acceptance/00_basics/05_licenses/001.cf index 9a19457b1d..12e354e2fa 100644 --- a/tests/acceptance/00_basics/05_licenses/001.cf +++ b/tests/acceptance/00_basics/05_licenses/001.cf @@ -3,43 +3,49 @@ # Test that we do not complain about license. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "agent" string => execresult("$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO 2>&1", "useshell"); + "agent" + string => execresult( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO 2>&1", + "useshell" + ); } ####################################################### - bundle agent check { classes: - "fail" expression => regcmp(".*Your configuration promises no host_licenses_paid in common control.*", $(test.agent)); + "fail" + expression => regcmp( + ".*Your configuration promises no host_licenses_paid in common control.*", + $(test.agent) + ); reports: DEBUG:: "This should only pass if $(this.promise_filename).sub does not output anything about license"; "Output from $(this.promise_filename).sub: $(test.agent)"; + !fail:: "$(this.promise_filename) Pass"; + fail:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/06_host_specific_data/01-vars.cf b/tests/acceptance/00_basics/06_host_specific_data/01-vars.cf index 06b7ceedc7..2b1a09c160 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/01-vars.cf +++ b/tests/acceptance/00_basics/06_host_specific_data/01-vars.cf @@ -1,55 +1,63 @@ # basic test of the host_specific.json functionality: 'vars' object body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." - create => "true", - perms => mog("0700", "$(sys.user_data[username])", "$(sys.user_data[username])"); + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." + create => "true", + perms => mog( + "0700", "$(sys.user_data[username])", "$(sys.user_data[username])" + ); methods: - "prepare_host_specific_data" - usebundle => file_copy("$(this.promise_filename).json", - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json"), - handle => "prepare_host_specific_data"; - + "prepare_host_specific_data" + usebundle => file_copy( + "$(this.promise_filename).json", + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json" + ), + handle => "prepare_host_specific_data"; } ####################################################### - bundle agent test { vars: - "result" - data => execresult_as_data("$(sys.cf_agent) -Kf $(this.promise_filename).sub", - "noshell", "both"), - depends_on => { "prepare_host_specific_data" }; # ensure the sub-agent execution doesn't happen too early + "result" + data => execresult_as_data( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell", "both" + ), + depends_on => { "prepare_host_specific_data" }; + + # ensure the sub-agent execution doesn't happen too early } ####################################################### - bundle agent check { classes: - "exit_code_ok" expression => strcmp("$(test.result[exit_code])", "0"); - "output_ok" expression => strcmp("$(test.result[output])", -'R: 4hfcattz2607yfksllzpf73eg7nmqprl + "exit_code_ok" expression => strcmp("$(test.result[exit_code])", "0"); + + "output_ok" + expression => strcmp( + "$(test.result[output])", + 'R: 4hfcattz2607yfksllzpf73eg7nmqprl R: { "496btq4wxqs6rf07anbx95cj74ftdyhy" } -R: {"key":"tiyl4z5nybvlp8npd2faso4ctxhknpvk"}'); +R: {"key":"tiyl4z5nybvlp8npd2faso4ctxhknpvk"}' + ); - "ok" and => {"exit_code_ok", "output_ok"}; + "ok" and => { "exit_code_ok", "output_ok" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; diff --git a/tests/acceptance/00_basics/06_host_specific_data/01-vars.cf.json b/tests/acceptance/00_basics/06_host_specific_data/01-vars.cf.json index ee780c1e37..a49662d8e6 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/01-vars.cf.json +++ b/tests/acceptance/00_basics/06_host_specific_data/01-vars.cf.json @@ -1,7 +1,7 @@ { - "vars" : { - "test_variable": "4hfcattz2607yfksllzpf73eg7nmqprl", - "scope1.test_variable": ["496btq4wxqs6rf07anbx95cj74ftdyhy"], - "ns1:scope1.test_variable": { "key" : "tiyl4z5nybvlp8npd2faso4ctxhknpvk" } - } + "vars": { + "test_variable": "4hfcattz2607yfksllzpf73eg7nmqprl", + "scope1.test_variable": ["496btq4wxqs6rf07anbx95cj74ftdyhy"], + "ns1:scope1.test_variable": { "key": "tiyl4z5nybvlp8npd2faso4ctxhknpvk" } + } } diff --git a/tests/acceptance/00_basics/06_host_specific_data/02-variables.cf b/tests/acceptance/00_basics/06_host_specific_data/02-variables.cf index 1843165612..d9a383f1e5 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/02-variables.cf +++ b/tests/acceptance/00_basics/06_host_specific_data/02-variables.cf @@ -1,54 +1,62 @@ # basic test of the host_specific.json functionality: 'variables' object body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." - create => "true", - perms => mog("0700", "$(sys.user_data[username])", "$(sys.user_data[username])"); + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." + create => "true", + perms => mog( + "0700", "$(sys.user_data[username])", "$(sys.user_data[username])" + ); methods: - "prepare_host_specific_data" - usebundle => file_copy("$(this.promise_filename).json", - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json"), - handle => "prepare_host_specific_data"; - + "prepare_host_specific_data" + usebundle => file_copy( + "$(this.promise_filename).json", + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json" + ), + handle => "prepare_host_specific_data"; } ####################################################### - bundle agent test { vars: - "result" - data => execresult_as_data("$(sys.cf_agent) -Kf $(this.promise_filename).sub", - "noshell", "both"), - depends_on => { "prepare_host_specific_data" }; # ensure the sub-agent execution doesn't happen too early + "result" + data => execresult_as_data( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell", "both" + ), + depends_on => { "prepare_host_specific_data" }; + + # ensure the sub-agent execution doesn't happen too early } ####################################################### - bundle agent check { classes: - "exit_code_ok" expression => strcmp("$(test.result[exit_code])", "0"); - "output_ok" expression => strcmp("$(test.result[output])", -'R: 4hfcattz2607yfksllzpf73eg7nmqprl -R: { "496btq4wxqs6rf07anbx95cj74ftdyhy" }'); + "exit_code_ok" expression => strcmp("$(test.result[exit_code])", "0"); + + "output_ok" + expression => strcmp( + "$(test.result[output])", + 'R: 4hfcattz2607yfksllzpf73eg7nmqprl +R: { "496btq4wxqs6rf07anbx95cj74ftdyhy" }' + ); - "ok" and => {"exit_code_ok", "output_ok"}; + "ok" and => { "exit_code_ok", "output_ok" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; diff --git a/tests/acceptance/00_basics/06_host_specific_data/02-variables.cf.json b/tests/acceptance/00_basics/06_host_specific_data/02-variables.cf.json index 14ba3b5e36..20b11cdcfc 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/02-variables.cf.json +++ b/tests/acceptance/00_basics/06_host_specific_data/02-variables.cf.json @@ -1,6 +1,6 @@ { - "variables" : { - "test_variable": "4hfcattz2607yfksllzpf73eg7nmqprl", - "scope1.test_variable": ["496btq4wxqs6rf07anbx95cj74ftdyhy"] - } + "variables": { + "test_variable": "4hfcattz2607yfksllzpf73eg7nmqprl", + "scope1.test_variable": ["496btq4wxqs6rf07anbx95cj74ftdyhy"] + } } diff --git a/tests/acceptance/00_basics/06_host_specific_data/03-variables-value.cf b/tests/acceptance/00_basics/06_host_specific_data/03-variables-value.cf index d75887d71a..2095f6cade 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/03-variables-value.cf +++ b/tests/acceptance/00_basics/06_host_specific_data/03-variables-value.cf @@ -1,55 +1,63 @@ # basic test of the host_specific.json functionality: 'variables' object with the 'value' field body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." - create => "true", - perms => mog("0700", "$(sys.user_data[username])", "$(sys.user_data[username])"); + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." + create => "true", + perms => mog( + "0700", "$(sys.user_data[username])", "$(sys.user_data[username])" + ); methods: - "prepare_host_specific_data" - usebundle => file_copy("$(this.promise_filename).json", - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json"), - handle => "prepare_host_specific_data"; - + "prepare_host_specific_data" + usebundle => file_copy( + "$(this.promise_filename).json", + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json" + ), + handle => "prepare_host_specific_data"; } ####################################################### - bundle agent test { vars: - "result" - data => execresult_as_data("$(sys.cf_agent) -Kf $(this.promise_filename).sub", - "noshell", "both"), - depends_on => { "prepare_host_specific_data" }; # ensure the sub-agent execution doesn't happen too early + "result" + data => execresult_as_data( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell", "both" + ), + depends_on => { "prepare_host_specific_data" }; + + # ensure the sub-agent execution doesn't happen too early } ####################################################### - bundle agent check { classes: - "exit_code_ok" expression => strcmp("$(test.result[exit_code])", "0"); - "output_ok" expression => strcmp("$(test.result[output])", -'R: 4hfcattz2607yfksllzpf73eg7nmqprl + "exit_code_ok" expression => strcmp("$(test.result[exit_code])", "0"); + + "output_ok" + expression => strcmp( + "$(test.result[output])", + 'R: 4hfcattz2607yfksllzpf73eg7nmqprl R: { "496btq4wxqs6rf07anbx95cj74ftdyhy" } -R: {"key":"tiyl4z5nybvlp8npd2faso4ctxhknpvk"}'); +R: {"key":"tiyl4z5nybvlp8npd2faso4ctxhknpvk"}' + ); - "ok" and => {"exit_code_ok", "output_ok"}; + "ok" and => { "exit_code_ok", "output_ok" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; diff --git a/tests/acceptance/00_basics/06_host_specific_data/03-variables-value.cf.json b/tests/acceptance/00_basics/06_host_specific_data/03-variables-value.cf.json index e5a9b89678..ab8bec44dc 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/03-variables-value.cf.json +++ b/tests/acceptance/00_basics/06_host_specific_data/03-variables-value.cf.json @@ -1,7 +1,9 @@ { - "variables" : { - "test_variable": { "value": "4hfcattz2607yfksllzpf73eg7nmqprl" }, - "scope1.test_variable": { "value": ["496btq4wxqs6rf07anbx95cj74ftdyhy"] }, - "ns1:scope1.test_variable": { "value": { "key" : "tiyl4z5nybvlp8npd2faso4ctxhknpvk" } } + "variables": { + "test_variable": { "value": "4hfcattz2607yfksllzpf73eg7nmqprl" }, + "scope1.test_variable": { "value": ["496btq4wxqs6rf07anbx95cj74ftdyhy"] }, + "ns1:scope1.test_variable": { + "value": { "key": "tiyl4z5nybvlp8npd2faso4ctxhknpvk" } } + } } diff --git a/tests/acceptance/00_basics/06_host_specific_data/04-classes.cf b/tests/acceptance/00_basics/06_host_specific_data/04-classes.cf index 421a5af2fc..12b33c2c70 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/04-classes.cf +++ b/tests/acceptance/00_basics/06_host_specific_data/04-classes.cf @@ -1,60 +1,68 @@ # basic test of the host_specific.json functionality: 'classes' object body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." - create => "true", - perms => mog("0700", "$(sys.user_data[username])", "$(sys.user_data[username])"); + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." + create => "true", + perms => mog( + "0700", "$(sys.user_data[username])", "$(sys.user_data[username])" + ); methods: - "prepare_host_specific_data" - usebundle => file_copy("$(this.promise_filename).json", - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json"), - handle => "prepare_host_specific_data"; - + "prepare_host_specific_data" + usebundle => file_copy( + "$(this.promise_filename).json", + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json" + ), + handle => "prepare_host_specific_data"; } ####################################################### - bundle agent test { vars: - "result" - data => execresult_as_data("$(sys.cf_agent) -Kf $(this.promise_filename).sub", - "noshell", "both"), - depends_on => { "prepare_host_specific_data" }; # ensure the sub-agent execution doesn't happen too early + "result" + data => execresult_as_data( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell", "both" + ), + depends_on => { "prepare_host_specific_data" }; + + # ensure the sub-agent execution doesn't happen too early } ####################################################### - bundle agent check { classes: - "exit_code_ok" expression => strcmp("$(test.result[exit_code])", "0"); - "output_ok" expression => strcmp("$(test.result[output])", -'R: test_class1 defined as expected + "exit_code_ok" expression => strcmp("$(test.result[exit_code])", "0"); + + "output_ok" + expression => strcmp( + "$(test.result[output])", + 'R: test_class1 defined as expected R: test_class2 defined as expected R: test_class3 defined as expected R: test_class4 defined as expected R: test_class5 defined as expected R: test_class6 defined as expected R: test_class7 defined as expected -R: test_class8 defined as expected'); +R: test_class8 defined as expected' + ); - "ok" and => {"exit_code_ok", "output_ok"}; + "ok" and => { "exit_code_ok", "output_ok" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; diff --git a/tests/acceptance/00_basics/06_host_specific_data/04-classes.cf.json b/tests/acceptance/00_basics/06_host_specific_data/04-classes.cf.json index 96efb56d64..f8e34db541 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/04-classes.cf.json +++ b/tests/acceptance/00_basics/06_host_specific_data/04-classes.cf.json @@ -1,12 +1,12 @@ { - "classes" : { - "test_class1": "any::", - "test_class2": ["any::"], - "ns1:test_class3": "any::", - "ns2:test_class4" : { "class_expressions": ["any::"] }, - "ns2:test_class5" : { "regular_expressions": ["any"] }, - "ns3:test_class6" : { "class_expressions": [] }, - "ns3:test_class7" : { "regular_expressions": [] }, - "test_class8" : {} - } + "classes": { + "test_class1": "any::", + "test_class2": ["any::"], + "ns1:test_class3": "any::", + "ns2:test_class4": { "class_expressions": ["any::"] }, + "ns2:test_class5": { "regular_expressions": ["any"] }, + "ns3:test_class6": { "class_expressions": [] }, + "ns3:test_class7": { "regular_expressions": [] }, + "test_class8": {} + } } diff --git a/tests/acceptance/00_basics/06_host_specific_data/05-variables-tag-comment.cf b/tests/acceptance/00_basics/06_host_specific_data/05-variables-tag-comment.cf index b9c0591d9f..9f683a118a 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/05-variables-tag-comment.cf +++ b/tests/acceptance/00_basics/06_host_specific_data/05-variables-tag-comment.cf @@ -1,38 +1,46 @@ # basic test of the host_specific.json functionality: 'variables' object with a tag and a comment body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." - create => "true", - perms => mog("0700", "$(sys.user_data[username])", "$(sys.user_data[username])"); + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." + create => "true", + perms => mog( + "0700", "$(sys.user_data[username])", "$(sys.user_data[username])" + ); methods: - "prepare_host_specific_data" - usebundle => file_copy("$(this.promise_filename).json", - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json"), - handle => "prepare_host_specific_data"; + "prepare_host_specific_data" + usebundle => file_copy( + "$(this.promise_filename).json", + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json" + ), + handle => "prepare_host_specific_data"; - "empty_promises_cf" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + "empty_promises_cf" + usebundle => file_make("$(sys.inputdir)/promises.cf", ''); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf | $(G.grep) test_variable"; + "command" + string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf | $(G.grep) test_variable"; methods: - "" usebundle => dcs_passif_output("data:variables.test_variable\s+4hfcattz2607yfksllzpf73eg7nmqprl\s+test_tag,source=cmdb\s+comment1", - "", - $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "data:variables.test_variable\s+4hfcattz2607yfksllzpf73eg7nmqprl\s+test_tag,source=cmdb\s+comment1", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/06_host_specific_data/05-variables-tag-comment.cf.json b/tests/acceptance/00_basics/06_host_specific_data/05-variables-tag-comment.cf.json index 7315c83e7e..f08d40d752 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/05-variables-tag-comment.cf.json +++ b/tests/acceptance/00_basics/06_host_specific_data/05-variables-tag-comment.cf.json @@ -1,9 +1,9 @@ { - "variables" : { - "test_variable": { - "value" : "4hfcattz2607yfksllzpf73eg7nmqprl", - "comment" : "comment1", - "tags" : ["test_tag"] - } + "variables": { + "test_variable": { + "value": "4hfcattz2607yfksllzpf73eg7nmqprl", + "comment": "comment1", + "tags": ["test_tag"] } + } } diff --git a/tests/acceptance/00_basics/06_host_specific_data/06-classes-tag-comment.cf b/tests/acceptance/00_basics/06_host_specific_data/06-classes-tag-comment.cf index 2f989a3f73..e08532e490 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/06-classes-tag-comment.cf +++ b/tests/acceptance/00_basics/06_host_specific_data/06-classes-tag-comment.cf @@ -1,38 +1,46 @@ # basic test of the host_specific.json functionality: 'classes' object with a tag and a comment body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." - create => "true", - perms => mog("0700", "$(sys.user_data[username])", "$(sys.user_data[username])"); + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." + create => "true", + perms => mog( + "0700", "$(sys.user_data[username])", "$(sys.user_data[username])" + ); methods: - "prepare_host_specific_data" - usebundle => file_copy("$(this.promise_filename).json", - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json"), - handle => "prepare_host_specific_data"; + "prepare_host_specific_data" + usebundle => file_copy( + "$(this.promise_filename).json", + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json" + ), + handle => "prepare_host_specific_data"; - "empty_promises_cf" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + "empty_promises_cf" + usebundle => file_make("$(sys.inputdir)/promises.cf", ''); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf|$(G.grep) test_class"; + "command" + string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf|$(G.grep) test_class"; methods: - "" usebundle => dcs_passif_output("ns1:test_class\s+test_tag,source=cmdb\s+comment1.*ns2:test_class2\s+test_tag2,source=cmdb\s+comment2", - "", - $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "ns1:test_class\s+test_tag,source=cmdb\s+comment1.*ns2:test_class2\s+test_tag2,source=cmdb\s+comment2", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/06_host_specific_data/06-classes-tag-comment.cf.json b/tests/acceptance/00_basics/06_host_specific_data/06-classes-tag-comment.cf.json index 732144be97..203771db35 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/06-classes-tag-comment.cf.json +++ b/tests/acceptance/00_basics/06_host_specific_data/06-classes-tag-comment.cf.json @@ -1,13 +1,10 @@ { - "classes" : { - "ns1:test_class": { - "class_expressions" : [], - "tags": ["test_tag"], - "comment" : "comment1" - }, - "ns2:test_class2": { - "tags": ["test_tag2"], - "comment" : "comment2" - } - } + "classes": { + "ns1:test_class": { + "class_expressions": [], + "tags": ["test_tag"], + "comment": "comment1" + }, + "ns2:test_class2": { "tags": ["test_tag2"], "comment": "comment2" } + } } diff --git a/tests/acceptance/00_basics/06_host_specific_data/07-invalid-data.cf b/tests/acceptance/00_basics/06_host_specific_data/07-invalid-data.cf index b7d4f94f8b..c7ef877b72 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/07-invalid-data.cf +++ b/tests/acceptance/00_basics/06_host_specific_data/07-invalid-data.cf @@ -1,38 +1,46 @@ # basic test of the host_specific.json functionality: 'classes' object with a tag and a comment body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." - create => "true", - perms => mog("0700", "$(sys.user_data[username])", "$(sys.user_data[username])"); + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." + create => "true", + perms => mog( + "0700", "$(sys.user_data[username])", "$(sys.user_data[username])" + ); methods: - "prepare_host_specific_data" - usebundle => file_copy("$(this.promise_filename).json", - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json"), - handle => "prepare_host_specific_data"; + "prepare_host_specific_data" + usebundle => file_copy( + "$(this.promise_filename).json", + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json" + ), + handle => "prepare_host_specific_data"; - "empty_promises_cf" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + "empty_promises_cf" + usebundle => file_make("$(sys.inputdir)/promises.cf", ''); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf"; + "command" + string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf"; methods: - "" usebundle => dcs_passif_output("\s*warning: Invalid key 'clses'.*\s+ns1:test_class\s+.*", - "", - $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "\s*warning: Invalid key 'clses'.*\s+ns1:test_class\s+.*", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/06_host_specific_data/07-invalid-data.cf.json b/tests/acceptance/00_basics/06_host_specific_data/07-invalid-data.cf.json index d91e28903b..0ef6cffa72 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/07-invalid-data.cf.json +++ b/tests/acceptance/00_basics/06_host_specific_data/07-invalid-data.cf.json @@ -1,16 +1,16 @@ { - "clses" : { - "ns1:test_class": { - "class_expressions" : [], - "tags": ["test_tag"], - "comment" : "comment1" - } - }, - "classes" : { - "ns1:test_class": { - "class_expressions" : [], - "tags": ["test_tag"], - "comment" : "comment1" - } + "clses": { + "ns1:test_class": { + "class_expressions": [], + "tags": ["test_tag"], + "comment": "comment1" } + }, + "classes": { + "ns1:test_class": { + "class_expressions": [], + "tags": ["test_tag"], + "comment": "comment1" + } + } } diff --git a/tests/acceptance/00_basics/06_host_specific_data/08-class-expression.cf b/tests/acceptance/00_basics/06_host_specific_data/08-class-expression.cf index e2df4797ff..afe07efbb0 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/08-class-expression.cf +++ b/tests/acceptance/00_basics/06_host_specific_data/08-class-expression.cf @@ -1,38 +1,46 @@ # basic test of the host_specific.json functionality: 'classes' object with a tag and a comment body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." - create => "true", - perms => mog("0700", "$(sys.user_data[username])", "$(sys.user_data[username])"); + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." + create => "true", + perms => mog( + "0700", "$(sys.user_data[username])", "$(sys.user_data[username])" + ); methods: - "prepare_host_specific_data" - usebundle => file_copy("$(this.promise_filename).json", - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json"), - handle => "prepare_host_specific_data"; + "prepare_host_specific_data" + usebundle => file_copy( + "$(this.promise_filename).json", + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json" + ), + handle => "prepare_host_specific_data"; - "empty_promises_cf" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + "empty_promises_cf" + usebundle => file_make("$(sys.inputdir)/promises.cf", ''); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf"; + "command" + string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf"; methods: - "" usebundle => dcs_passif_output("\s*error: Invalid class expression rules for class 'ns1:test_class1'.*\s+ns2:test_class2\s+.*", - "", - $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "\s*error: Invalid class expression rules for class 'ns1:test_class1'.*\s+ns2:test_class2\s+.*", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/06_host_specific_data/08-class-expression.cf.json b/tests/acceptance/00_basics/06_host_specific_data/08-class-expression.cf.json index cb8aa18345..f3f9d244dc 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/08-class-expression.cf.json +++ b/tests/acceptance/00_basics/06_host_specific_data/08-class-expression.cf.json @@ -1,14 +1,14 @@ { - "classes" : { - "ns1:test_class1": { - "class_expressions" : ["cfengine"], - "tags": ["test_tag"], - "comment" : "comment1" - }, - "ns2:test_class2": { - "class_expressions" : [], - "tags": ["test_tag"], - "comment" : "comment1" - } + "classes": { + "ns1:test_class1": { + "class_expressions": ["cfengine"], + "tags": ["test_tag"], + "comment": "comment1" + }, + "ns2:test_class2": { + "class_expressions": [], + "tags": ["test_tag"], + "comment": "comment1" } + } } diff --git a/tests/acceptance/00_basics/06_host_specific_data/09-class-reg-expression.cf b/tests/acceptance/00_basics/06_host_specific_data/09-class-reg-expression.cf index 52635d641f..8d056ca50c 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/09-class-reg-expression.cf +++ b/tests/acceptance/00_basics/06_host_specific_data/09-class-reg-expression.cf @@ -1,38 +1,46 @@ # basic test of the host_specific.json functionality: 'classes' object with a tag and a comment body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." - create => "true", - perms => mog("0700", "$(sys.user_data[username])", "$(sys.user_data[username])"); + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." + create => "true", + perms => mog( + "0700", "$(sys.user_data[username])", "$(sys.user_data[username])" + ); methods: - "prepare_host_specific_data" - usebundle => file_copy("$(this.promise_filename).json", - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json"), - handle => "prepare_host_specific_data"; + "prepare_host_specific_data" + usebundle => file_copy( + "$(this.promise_filename).json", + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json" + ), + handle => "prepare_host_specific_data"; - "empty_promises_cf" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + "empty_promises_cf" + usebundle => file_make("$(sys.inputdir)/promises.cf", ''); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf"; + "command" + string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf"; methods: - "" usebundle => dcs_passif_output("\s*error: Invalid regular expression rules for class 'ns1:test_class1'.*\s+ns2:test_class2\s+.*", - "", - $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "\s*error: Invalid regular expression rules for class 'ns1:test_class1'.*\s+ns2:test_class2\s+.*", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/06_host_specific_data/09-class-reg-expression.cf.json b/tests/acceptance/00_basics/06_host_specific_data/09-class-reg-expression.cf.json index 1490652d45..34ddb0fde1 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/09-class-reg-expression.cf.json +++ b/tests/acceptance/00_basics/06_host_specific_data/09-class-reg-expression.cf.json @@ -1,14 +1,14 @@ { - "classes" : { - "ns1:test_class1": { - "regular_expressions" : ["cfengine"], - "tags": ["test_tag"], - "comment" : "comment1" - }, - "ns2:test_class2": { - "class_expressions" : [], - "tags": ["test_tag"], - "comment" : "comment1" - } + "classes": { + "ns1:test_class1": { + "regular_expressions": ["cfengine"], + "tags": ["test_tag"], + "comment": "comment1" + }, + "ns2:test_class2": { + "class_expressions": [], + "tags": ["test_tag"], + "comment": "comment1" } + } } diff --git a/tests/acceptance/00_basics/06_host_specific_data/10-variable-references.cf b/tests/acceptance/00_basics/06_host_specific_data/10-variable-references.cf index 1da6cc1d3f..64dde9bf4d 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/10-variable-references.cf +++ b/tests/acceptance/00_basics/06_host_specific_data/10-variable-references.cf @@ -1,38 +1,46 @@ # basic test of the host_specific.json functionality: 'classes' object with a tag and a comment body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." - create => "true", - perms => mog("0700", "$(sys.user_data[username])", "$(sys.user_data[username])"); + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." + create => "true", + perms => mog( + "0700", "$(sys.user_data[username])", "$(sys.user_data[username])" + ); methods: - "prepare_host_specific_data" - usebundle => file_copy("$(this.promise_filename).json", - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json"), - handle => "prepare_host_specific_data"; + "prepare_host_specific_data" + usebundle => file_copy( + "$(this.promise_filename).json", + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json" + ), + handle => "prepare_host_specific_data"; - "empty_promises_cf" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + "empty_promises_cf" + usebundle => file_make("$(sys.inputdir)/promises.cf", ''); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf"; + "command" + string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf"; methods: - "" usebundle => dcs_passif_output("\s*error: Invalid 'variables' CMDB data.*", - "test_variable2?", - $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "\s*error: Invalid 'variables' CMDB data.*", + "test_variable2?", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/06_host_specific_data/10-variable-references.cf.json b/tests/acceptance/00_basics/06_host_specific_data/10-variable-references.cf.json index 5175c6c326..968c8b8435 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/10-variable-references.cf.json +++ b/tests/acceptance/00_basics/06_host_specific_data/10-variable-references.cf.json @@ -1,14 +1,14 @@ { - "variables" : { - "test_variable": { - "value" : "$(sys.uptime)", - "comment" : "comment1", - "tags" : ["test_tag"] - }, - "test_variable2": { - "value" : "4hfcattz2607yfksllzpf73eg7nmqprl", - "comment" : "comment2", - "tags" : ["test_tag2"] - } + "variables": { + "test_variable": { + "value": "$(sys.uptime)", + "comment": "comment1", + "tags": ["test_tag"] + }, + "test_variable2": { + "value": "4hfcattz2607yfksllzpf73eg7nmqprl", + "comment": "comment2", + "tags": ["test_tag2"] } + } } diff --git a/tests/acceptance/00_basics/06_host_specific_data/11-augments-no-override.cf b/tests/acceptance/00_basics/06_host_specific_data/11-augments-no-override.cf index 79e3d2bbb9..5dee9a71d9 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/11-augments-no-override.cf +++ b/tests/acceptance/00_basics/06_host_specific_data/11-augments-no-override.cf @@ -1,41 +1,54 @@ # basic test of the host_specific.json functionality: 'variables' object with a tag and a comment body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." - create => "true", - perms => mog("0700", "$(sys.user_data[username])", "$(sys.user_data[username])"); + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)." + create => "true", + perms => mog( + "0700", "$(sys.user_data[username])", "$(sys.user_data[username])" + ); methods: - "prepare_host_specific_data" - usebundle => file_copy("$(this.promise_filename).json", - "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json"), - handle => "prepare_host_specific_data"; - - "def_json" usebundle => file_copy("$(this.promise_filename).def.json", "$(sys.inputdir)/def.json"); - - "empty_promises_cf" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + "prepare_host_specific_data" + usebundle => file_copy( + "$(this.promise_filename).json", + "$(sys.workdir)$(const.dirsep)data$(const.dirsep)host_specific.json" + ), + handle => "prepare_host_specific_data"; + + "def_json" + usebundle => file_copy( + "$(this.promise_filename).def.json", "$(sys.inputdir)/def.json" + ); + + "empty_promises_cf" + usebundle => file_make("$(sys.inputdir)/promises.cf", ''); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --verbose --show-vars -f $(sys.inputdir)/promises.cf | $(G.grep) test_variable"; + "command" + string => "$(sys.cf_promises) --verbose --show-vars -f $(sys.inputdir)/promises.cf | $(G.grep) test_variable"; methods: - "" usebundle => dcs_passif_output(concat(".*Cannot set variable ns1:scope1.test_variable from augments, already defined from host-specific data", - ".*ns1:scope1.test_variable\s+4hfcattz2607yfksllzpf73eg7nmqprl\s+test_tag,source=cmdb\s+comment1.*"), - "override_value", - $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + concat( + ".*Cannot set variable ns1:scope1.test_variable from augments, already defined from host-specific data", + ".*ns1:scope1.test_variable\s+4hfcattz2607yfksllzpf73eg7nmqprl\s+test_tag,source=cmdb\s+comment1.*" + ), + "override_value", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/06_host_specific_data/11-augments-no-override.cf.def.json b/tests/acceptance/00_basics/06_host_specific_data/11-augments-no-override.cf.def.json index cd8df3e2de..4fcc9978e0 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/11-augments-no-override.cf.def.json +++ b/tests/acceptance/00_basics/06_host_specific_data/11-augments-no-override.cf.def.json @@ -1,9 +1,9 @@ { - "variables" : { - "ns1:scope1.test_variable": { - "value" : "override_value", - "comment" : "comment2", - "tags" : ["test_tag2"] - } + "variables": { + "ns1:scope1.test_variable": { + "value": "override_value", + "comment": "comment2", + "tags": ["test_tag2"] } + } } diff --git a/tests/acceptance/00_basics/06_host_specific_data/11-augments-no-override.cf.json b/tests/acceptance/00_basics/06_host_specific_data/11-augments-no-override.cf.json index 8bcfc82555..b1b25e7522 100644 --- a/tests/acceptance/00_basics/06_host_specific_data/11-augments-no-override.cf.json +++ b/tests/acceptance/00_basics/06_host_specific_data/11-augments-no-override.cf.json @@ -1,9 +1,9 @@ { - "variables" : { - "ns1:scope1.test_variable": { - "value" : "4hfcattz2607yfksllzpf73eg7nmqprl", - "comment" : "comment1", - "tags" : ["test_tag"] - } + "variables": { + "ns1:scope1.test_variable": { + "value": "4hfcattz2607yfksllzpf73eg7nmqprl", + "comment": "comment1", + "tags": ["test_tag"] } + } } diff --git a/tests/acceptance/00_basics/CFE-1886.cf b/tests/acceptance/00_basics/CFE-1886.cf index af9805e69b..bc91186af8 100644 --- a/tests/acceptance/00_basics/CFE-1886.cf +++ b/tests/acceptance/00_basics/CFE-1886.cf @@ -5,13 +5,12 @@ ##################################################### body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: @@ -23,5 +22,6 @@ bundle agent check { reports: "$(this.promise_filename) Pass"; + #"IP16lvcMb19Rg2BNQW1USktx7RzBZbyyGsZCgixY5TL0ynV4u0Cm1xKfta8n3ZQgovDEoPJp6FpbVhnhkJB4ILV3ubrnIKCKUlan7Msg4EN2o2qA6tYRDIBjQtlhXUqpnYznHHuvWeIVXhHTBo8uVoZEiWJuQkscjr74tOBcEhfXBMOc7dGNqsWjZIVV7hSwWWIb27DitY69KIYHGp9EsRS9ZIrL0xF48HMeFL83vZGnbm41PwQSzjLSZDd7CqmyERVfE0rQsneVjtSjZiQngMIRejfvWeWMU8aVjJeyIEg0YSYQAxBbxDxi4o537QbH8sDxArS0RL9Un69Ki3bvwtX3BA8piOIOwF6PZmEIeaydUP1I2w1PswQXdmb3wWIRrQhTqq46W0ZrfYsLKcT6UbWi8IAuxBVodrMxuoEM9KtUYzwbYHa1WwTEhs5GXgo8Jq47cuwleboqUOc8wjhOIb5ZL5DWfI65kJavC8gWXN3FAM3e7UhMUYolhXN9zxkYczfUiJEUUz3W7KJkB4bSBmZtUyL15cdO9efBsPXG4WqqCgWTZ6DUHIBKIu0SfBKIj9Vm6qffMK6eYN1RCmiHsEvbqSnAobZGGdby1amoyPC9crw8ocANLOm8gg1FGlmsEwaKvF3BH6AMQUr7d2YGfOc2BouiFW31nh1qizqHt0qcVOAUtQU83bLecp78GvNqW7HlaqT79gUk5dNQu6iUsMIkJi2DsvxTrS6D5NScwtvi48arYtLledM0iAuKLfJnG4mCEz9L2s7V40KlcvfQkfk1hYkzdYytjdXi1kx903k8R2rXQjpzdm1JwaAlQGaYIUdTjEcHw7unVPPwpQsoLErSVcgiw86KAPIi6KNzSBDfFSzl9Fi4mvucJF7ahkFxrII7HizOpM6h47cSopjfglw07e3hFacMbh2f7CMS3JBokYSLVHb2TDUL86FMbvfiFOWrTcdlSZJ9oWbzNQ3YY43Gx4YYXSFGQ8MZnMgV6Y2zubKVncbSWu9OPEKdwQ6D51g5086uCh5gxe20sSKGuHDjCBSks6KeBUix0J0dIvJGHGeNBSAxkYK3xgvo5OKDs9aWp367sxTM2YjCvCeaGIW3jM2fsVP7TPYNGCMu3zH3AUnOC8NfjXtS3a9kW1FjkO60OT05yMDgoFT4Xxou7Wn449YxEd6V2I6kdVCkngvHBxcboykuU1rIdONqKP1OifHngU1JXK5cRP4TwB7nmZ5PiB44MpaOL21JCkAUwh0sydaAEeFpGFDgSZjWwNaVYlUjquLV8YoyvZPnNAbWoH3sZrJuT0gqtPLpFVQ637K5XGrs0ezW58YeuN2JvxCrLzG6w1sc9sGeY6ITOVUKZw2KiPPdvj9p5QSFjtxkhzyuWQkhcBkURY6O2pv59ssG4LHrwM9z0hMoWkHQa4u9HxySJiJh6z5p7QIJQAiQ4ytn43p0BpJCiiWtmvy1CvD5tcDPvlASVywdENF1WqR0ycJWGIkw08HmLXPuBHsSl1mYLeJymTBMfbMfVxcrCuH0ETzTtE2HALpgwAfnjMd6g1Tq7rXPGIDaeHjOFoIzauNy098bChJuZQW53EE0EtxHeJNlr9rJMBHWcKBOILF6tBOgwAMa4pYNSQvTQC2JotKOnui6W9DztOrsmYF8WPuIdFq8AQSf0uT1Um90uFsW6aVLBTACbrp2Dt0ekmX8eVdIDSjXpeJHRLhtpz85kuoV5Tc3YHlBL8sjqBkcE22MEQCddjJz687RfV9punkS6ObuPeD7D86ifFBxLPjQUs9Q4LdB2j6PV2W4Rz2hAN7wVz2F76vmFQ2Ge5HT4JQI2MLSMIXIMuAe5ehnXQjsdSj90lSlos5ekR2sLyIExl8kTTFwfGMKt4bq1gEMsFqxPGscgm0k8mKNiWEnZMDrnbyTOsYmAUBHeoin19igAl5wqkctlpNVXPGVqTKl83qiipuPNkOvtEx4glLfeObkRWm8JqdG8zLI5glS3FKXbZrXieBGPw8gW2hJ9QasSpsrkCi9X4hPW83qMP31I7ypu6ZYASNrQc99RP4GURD7TyPEFKUzyjVYqjuyt8qNy6jCq4O2wogIhPaGpChuBsnTOErLlBpbfs8hNnXdxY46Mt6MjZtiwDWcQ0iwuO9xYmMuxv2MYfTIphAFaIdRMtS7NPUy2AIUNwlnWZVrYQY5BiKUdLpo1br6hjEWdqeBWduRCLJZS1OG2i8OwXrIONLox0T8gtPin1slEmcGEapOnxd6Ho1v09mA6fU7ChmPigxjICly7pmbaA6uJb1Hv5vyr7wHGBqWhfx8STJpoPfMjdB5GKwg4SOciLBFMGtuq7GC7sCBkV5XyWBTHgZahZdJZtS18aw6bLmW87s2nxqCgcdFRnVy9t7aOrlFWgHRzRDSEMp17N1MTySg3nBvTOAQBbMaKl7MhkTKKhqJk4t2HpBWO4RCqZtvFrw5ebuCguemSnH3oJ6Hvwsp1uqwfCTsq3Q1zIxJmEszNsZI7oeWXAUwRWwAKt3jagSMNgWiER1CzJBs8UwJXUrqQrk28FIPxvonXPsWaYslf3xtKuIPQ6xK6byote1JHuNs7d2n7Xaa0AhsokR07aM6LqUocSyuLTJ5PipXfwbhFDZ3tTBawUV2sY17e9qEqXDDmT2Yvu3Qe6kuwQ7Go0WsolEND4RJGrpWGJrKKgPAfVsmKboyd8ppCHLBB2PFvQ6uBYqtR9PUtXivYJ8cTzK8uYCoDqNhqJmUtKT8aKvdyBo3cOeNn55MHDIT83zKIB8JudLWdVy2jWqX6p5NxwOetqIvGK3pZrwuFvH6G37sZnhvDwhg8dcXzaI3s2mLaNeb3bwE16BLOpDzVunv4BrmZpbOlOSoAUtkwWboCLbCf9Xxd6ck4slHmOpouFDuDSjU1j38a2OEHxgas02wI5SgagxHfOaUIZvbxQCxuEEWEdQNi46b8K2P6XPt2BwpIAQL16ufy8PgkZQkeMZqyxqcjTr8tNMH2k7u9hq3uksOVP7B8T7IArs9GjeKVEmFABZOdy6Ems400oI7siewhW7Mt1yZX0YAjzKv1h0ybgAFAy2gLdasDQA3zWCjoScqXhfCbdyO4w1EVjb00LYRLRzcKzjj0ekOkATfmeZ30FwhFWCwgEadceC7t5X4noYQ1GTvimc1ZHPWTMZPE7JgQ0IL6W0TINhwWnKTplUmAClyr0AwSwMyyxH2i34OXehGdPdOfae71kqgCGNkcu80boPzGbInrWJ8Zlz0J0z0bss6okRGX3SvVImRwRC7oXfKsWQEVeoF8o7hS3UaSFSsQ70hpXTHGInQ8EI9c6mJZWNi5MA7ArBZydkOqQXI6iGPTDoNNx3wzd8nCAEThiYV4iLpNIqSUlG1pAO71siIPsSkZ8WTq0scMKkF0WhGDo7Lxk4b29CAwKOyp3pGlh7xWAZryeWvfbECWEkMSqfEgYBfkGFMQlUjWumOzMLEZZICwBxtaPhuepasEQmuPTOfB4Hr106aMAFasPjozsYwTcxYUqvew0Ddpt8DGTlyTtnrY0jsF6NkubSVV4hAQFJpBvO4KAlrUWCSrRcQOY3mJXMFWg6E5ckzjrIf9smIn3XpW3IABA96vRT22Bs9FYbEvAX4xlOPjCbU28oHySMcr0iCjGH1Vq0fX6lF0aej2nGcPwvFzmgqy65Glvcnff8mBNui5gSWfxUk6SdheBhqMVKmsq2ZshTK8dUuMzibEQsvAKAuRCGAOzjGNUozTmfOWZ2Ucz6Fp6yXUFbPDBGUAXR9htYSJShCG7hvcudvjJduBvc7AcxDJclrudYUfsOYMBfUWIG9puwDdySbzWu5HIRdV7MnBmPgJ5FLD2ix6UMHYq4yof3nKTplJcCJXtoRVg7JFSkykRUTazEVS4znZcTfneCIfsoN5Sx8YROztsPqtdBqnJlYVOTZYg4jW13f5BnTHzUqDC6pTrjcfuaR9sPf9c0NdAufhPQtgGh4eeflZUbbVWxZFbul6Xm8NtWOhrd5cxh2KhHSn6kzJAyVuxiOVHef7wcpZRdIzMdXXklvu0qvjjWS2KqOhdAxhhIqDSqwnh77w16KFT8Eva2vINUb1qp5qzKNWBGNS7TcvBcgkffcSH5PbnZYh1FOAouOptljDyLJu8YvJeUmue4jvy8kG8W2kesk3nUPjaKS7upfbLzYARtVCsMuuhJauSHvOZqpaVp8DMS3IaoIIMjiRdaQIHmtPvblOQkSnztKehsKkR3oUFUHlRI2HsE9lr5Usbta0NmYrT00wtR2AzzChCNi7QfzwhVvNlmZj6fiAY8pdVdYSPkqAoMG8v5yex6davoexsnVvgEs8hQW6tfxm6rOukcPdoZtMCS9s2Ft8xkg4VxVA2hs5u84vvzgl1vvjaaylwh1iyx04uxAiSiGRaqz6e7knDsmyVnHRxlsUh6OEzi3JQtmM8GR9xnT5DaBNODcWHQVBhI1vVarNsf5f88lMaY7EIZldODkWOKwf94sEOrqdY0gw7EA2Nth01d3j6D0o6Pe3RGptn5BpQbOYLDLL4CMZYQRfOqbs5RaI7WBGWtgmd3ZOAD3reSXVGwx8fgi7HfWEs8hjByFu3hclJszsmQGhUAZ92qlSeEh3K7BdDkuRoXAI4KZZbMw4PEHpQ5tVQ1hk6QIAyXmLSUH3wpcBfBXsM3aAHckQefP5zeOANQ1qE40y5eSqIZ8hzmEjNULwEhQddPIqvK8TTVwDhLghoN9UHIfUbPMgcYknQXzLqz6gK2LSWZXcr6TTV3QqxsOdCdKoW3dc33qmSJJLSGzPIiEjEjqQ67gNmAt2yCUYu8Tne0jxWOzyW8qtuF1LabTrnCcnGOGirs87JgvgOQNzY5HJKFKSUJcmDgLNxycdP8D0kCQeS7q0HvCM9sgLgx3fiEGxUPMXXqyPm7QVldAfm8LSrCjyJWWDb5gKSmOyHs98Bp2iwUwil1zh5FxAzIbm5Ev17O6XBVlPPvc6pIVZyNpcr4QsiDMERS7r56JWWNKwEF3PFHJ2Y6yoqPpohp8WiW3nZKta7FZDwE1iaR7DFY8vFxzCZhtMVL8oOQBPfxXvKwa2fN5S0tN7q22jAGsKOECJkQn3VZeQLGwHaXjIZ0r6XeA39BfZQiUSj5c9VFoBeROCohbwzH0CDda8g7WhieD68wxw7zFc3f5W6jFxyCBW8Z8vVxE9THtIFgwqrHMsohJhD1cu61hR5Qg2Th2GgAHfAcEDfMToilhxKKVyZwbg9lGyJzLaweeSD2e2K7nROabKh2D36iO0N3hWEvsfhvTrFO2UClLzfagEDUUDSZlqJeB60S9QPSXgSY40aYe78ZBff3nLHXvF8aUpgxwMDrU3zkSa2luYCVcgMEPGcP4JO1tbfobHlmSvTlodTFN5kuAvur6p46zK6r9Vg98poNN325sX66jHKHFrdu435MWoC6ac4GZ6AbqddUwLuBxMloXL33ig6WQOshXrHdB1RQzlExWzQJy58U9EVgZOyNrac2pUcG2rzgD98W4MbXmlPeYxH8a0drts1FET2WfQCEctgnud97qnEr57KM0L7SRw2wS1RArQd3nkuyMlXVCMRj82c8J3g31cSvBvvO3GKtSNc6WGYJxorRrOeMz5HgqmVxTbub6yBiRdenzVeHe1KGWd6wX297glKWfVy3i1C2xd72BpXep0prCiKps7XaZAf9yWUi3VwTTTpDQSN4DlswMI6LgYdiKMLBRdWrSbKvG0MKVZldNZnxmehPRRnZNh5lDf8Vx53DcfESCVQV6ad6Kk62l8SDQtNBgK4qFz8faq3h45FbDzWcBQT5PI98LWyAul4kKma8lTlDrFsqPPSLrsCY6qltFJlPZn26GXwvQWi3NthmOL2cUrMPlkS52AKNFGy6VNl8eZacEoU9fgH5bRQAcwJnpe59nvCdueBpJOwVtwRnCo35dZJxqhRn9MbWN4Mk6Rv2CCWjU6JCpSUWjfC176N3kcVDqPWMOM63s1ckgAOFbbKTTQU71elkfrvh8Depa3bGfXe1NrcOnN68hL9jFGwtzl1O5KwxBeO8dY2KPwRGmvWM251ecrVLUEd2PruzKOgycfclvaaU5PXxSoHtYqm6Rl2o27XDijIgEOgXM5v18QepNKej3cd3WdWvxwa3ezkbRayx0iDbeBBh9wLVydb7hG43gBteAWfLDK4sXobszdrRH5YDp2O8YjpSllvuHyIkv6NF9G83PkWsQ3EMHSP5sPrngT9cZ1NMeMkLZyX8NQm3esqPpY1h9zQMCxZnd0BTzCzShFd40z3jjSQfuSgcgowlkmueysZJSoTFObhoDGR96XTxFIyTSPTI9d86ojIzAGZnD6mkwYiN22DjEcGLNWvtpwnYAfUwB7x2Pi1rC1yKTjYSD0Risley6r0DcYbTITPtRH4lxzuMriCt2ZLlqYcHSI7w9CkDd8Jsmm30sOpKIg7euVfhuMHbAoS9JqaNIwZoOVSInlMFUPVlrFZselcxuUQkmyedz3EgtPEYnMJpr9mBeHanxjFxVcxkAOwxa1Ra5c0TINUlm8QANMRvq6yleZcyBdmsDmjJeEEzvtg27mIO3EcZgg2nrRqumZzyFrpClO3PmyQmIUfS3dXamGmNoY00PT8RpN2cAN7Hl5XpHS1JOSY3JHTaQ1I8fUqFlJpAYcWhP9zMcCFdRUD0AvmJx3iFyjEmLOAl9npbcqqiVTc1aTPfF52WAtFMqByUU98L9FNhTKmVbvsgJe4XNsQKju1w6ExLz1FSfAoSN5eFOno4UNTkaCJXfua15LIwiVKf1WNj0YHgL1TVHeU3750D5YX7GvVrInvTaFgCNVFkhKi4HyhBg0EthXoH49Q1FRhfZ3VgFt1xdtc762lPTMWtmDRmO5LwiATPhjKCFJjD1jEexxavorT0YiAVd833R8PrLpB7KKcvgCsf1fx8mOUZr0qKCdL7TMWCCIdlmFKMREZ41hIqdZkN8j4RzfAVvatxFpz5VCNY94SafJsw8M9xxViE1BGWbJ8BNqL5EYsFP0PM37J82BPSIFdmCtQI6M8yljDtZ3kf7aUADZiIMGjH5lP6BwQ3GLPxhcOe1Bf5BzX1wtbGa98OgnqI73diYK0yXcobC67YoEvqs6So9gbrWqc24WyTfDgCdAebUXb98VQuwhfGBNEDsPbPZDKique0lnI3j55pIgttlSTiNnvbQXRt4db5PU2pSOVdCnS6cE56H66R8vAPAjPTUwGsDmD8HFyi9sj8iQGzrxmduCfZ31k7Mgo7a4ln12biI2og5voU44sgrHxRCDcb1XmRhAympcItfQtjgDi8UggaBMYy3T5MF75kLzskeyEGb4Xd81wKoMSi8VmR8eFMwXOqhYSpmjrdf4gq9fLXlzWQi8RDcMqo2vxuCb3A1v1xn8Ksjl3CG9O3T6n1SK2kxf2k0pE4FHsLKqr441hHThLpIRwblFzOxovjCwaRwZEJzkHhHzwX5jljTvhEh0bjsBRnSoCvcMECoqn6waoLICRh4RTeO0NcyFLXlb2PXCR1rw1xs5srCkIjQqa4NnARsMgePn2d6LA9LG8b4ujFmPI4TqKqKtxb4EATL8QdD9DP1qUM7UMxwUtqC2uJl0zbkfcZaHUVMANsRzxVxT01qH6d3YWvbxfBHlX5WrYfQyveanS3dEJ4BN8PcdkCjFty0LCg7DMdl2HPEzT4eQNka8eAiyah4bkytvvigBxyW1AvHmSXIw8Z3PP981FP6nb3Tdp2pElK82wnNjQB4ea2HSzIgSe8fHoObnqwlPruvXsEkstYWElFeARgVFn0YgeycgIgbJtLGj3LABDMs9SplWoPv8CUS7oxgffpKQ0S5nO0w1Ymch6wTsEF5sCZL0cOF3KlmSYlgfArlZ1oGDLUl22DVPMuK0aBeSePEEmHfN8sS4oW5ggJdnYz2mhTu1dsB7UFFTWl4aNaBg4bfCger2strh1tPOrzzyhn6KXsUuFMc3zIzgcONilYT52A0caGKpDcPImhavV3NMSR7zLCBTzD00lGw4k9zY8yFlcJVmMfxiRrNXms9Zd90ZZPLxDvJIS3N8M19k3fddM1WDvaguZtBTTXi0hVz9aYUTeeAg151qOH5tXfDMqNqZMTk4KzStjst6Ilrv6GKpv3ynEbksWWD0dAYFLcwWjCJhzu7SXD22egw6hPPj2fennW2SfUDKPumc39biIdAUrkZ3LnYfAmePFXWItj14kh6KGRaEjXl6iWeIHau6rcoYRb9Z5L5MmRbicSEJsrUg9UifFobqKUHHv7WaP8ihg9yinwu9lTvJATiGdSbHis2uhVVYbsd9OBNA32yzMv76CfE9rBxxHgdSQkz0nNRTZJZKyTOq8K8DWoxWLUJOAQYKIcJqwd20VOho1JWsrCS45ecLDzAqP8LTQQs9ffgQW2wIeE1pTK2haOVUM1KxseDaD7xGgaPTluK1Tox84rtX77XBWXLYpYfiSFmZ28tqhJLyubgJwRh2QgLVtc2gZJhgQG7b1koPbvL2TYyCaH4oXU8kKKmo7m4jVFPaxz6LM6rgcD7heGAZykw2hleI8Q8eGn6gF2umX1RkRs7z4WmfaLijQsUefqOotHDSxOgMC4OqebTaqPJHbfwDuL2k8cyuOUNNdM5BR2UolCShqtssPNHAIXuKLlQZ35CEgzOdaliQcjH5leW6eQDKlAQAOMDsVe5u4LyaRyE9XyStjYENBLWBKNeHkgKJVK5Bez3FY91zueOFOQA5C0uQBVDRQoJEwSr8rywo8JqypxEc7WKfGMYluXbKIOd2CpHpI9u9zzqDQiNyWZiqgBn0znlm0H0ADLag8PX69Sndw3X6cghUDgm6UNbX1EczhFPzSxuTqKNrE8tYf0sflTIg3L9YGgktj2OjVE38suwmSmGju8a8v2hOuO5g5PgXquGPx25owEC90CcxYlrudSVSTxC1iyopBduh48ZNqdkOPkU6oCs1Mkk5VrwsfL0nrG4CoqKyFJYqlnJooJnsZlR9dQ9DwUhOZZXnbSTWuVoLSBTqzfyE8eQ86YdZofIS1on8YoOPrLtHZxdroULBhB1ZsryypL2qsTEQSMbr2EPR1Xk0qkFJ0GwPfbqCPBlbdOUc3usFjnHHKvsI7dZPGMQQ4zSZ2NCFuVxz0VnUYPajyNwWqTxtvVRB6waUIopH45NntyFBuB2woRiatB2MrDZGrlXFqjKiB1WT0XtqBZlvALfus8KTICMNvS66RD032hh0wJUAKPpYaMRqqoeWyHWpsAEXm5E1bMeDCcpjWVd1camrrS4RhUe0Zfv4kfwQQsiLjhiZLuxJ5IFgI6okGD6wXxE7sHBYId17WAJEVtUzGLjBsPfAd5dids6hsd6mQSiMuequwQY69rVqoWu7hIVxsTXdDyA9vjCtGVXoSTFeybz2VsS1CgID8sqcwOg152AOcjUw221slXQnRb8m4CuWdodrpxDaXDDIUt6i2Rq2PGmpqkXWEijc528Vc8XTvPTnDSVwVFRFqnOJtZq4nS5LxY72cuF4vNZPkP1QjZwwOzqMBJ90qOCGldYqPzw0gxXqqR74drZAdGjFxB4pQHp1sZYryRva7chyMcARs45qowRt246N3RKHQkY2QQim4SmSkiRUTtO16FpcSNyAaQU9kdCo6e6nDwhvORDSKZzq0LNsFbbqqCTPYVEvCUkqrCEnxajenGazy0L7NaoM9lNJxaO8m19iJEaEQbseVSml9Ni3vAkS4PKEuz2DYL7IXgRHZ1ejucxrSIvkmwNrTHsQFYUhAfRagZPoHUt22q6CNIv8iYPPT0j4cfy3jkR9MUiOqs0v83Zj29bEwXZUzhzFrozrkKPJrMxHksr8NvTPcDn4JC4s5WJgIG4rxofeofRBLKryZ1sZk5izFobtBGYLiqMtnYsKJnxnvNEk0Yhb4N6RmqC0mpYPXis3PDOWwh8j0IE4z3hCjvO3u1IxV8n8kLht0TOEjfnZyNpcr4QsiDMERS7r56JWWNKwEF3PFHJ2Y6yoqPpohp8WiW3nZKta7FZDwE1iaR7DFY8vFxzCZhtMVL8oOQBPfxXvKwa2fN5S0tN7q22jAGsKOECJkQn3VZeQLGwHaXjIZ0r6XeA39BfZQiUSj5c9VFoBeROCohbwzH0CDda8g7WhieD68wxw7zFc3f5W6jFxyCBW8Z8vVxE9THtIFgwqrHMsohJhD1cu61hR5Qg2Th2GgAHfAcEDfMToilhxKKVyZwbg9lGyJzLaweeSD2e2K7nROabKh2D36iO0N3hWEvsfhvTrFO2UClLzfagEDUUDSZlqJeB60S9QPSXgSY40aYe78ZBff3nLHXvF8aUpgxwMDrU3zkSa2luYCVcgMEPGcP4JO1tbfobHlmSvTlodTFN5kuAvur6p46zK6r9Vg98poNN325sX66jHKHFrdu435MWoC6ac4GZ6AbqddUwLuBxMloXL33ig6WQOshXrHdB1RQzlExWzQJy58U9EVgZOyNrac2pUcG2rzgD98W4MbXmlPeYxH8a0drts1FET2WfQCEctgnud97qnEr57KM0L7SRw2wS1RArQd3nkuyMlXVCMRj82c8J3g31cSvBvvO3GKtSNc6WGYJxorRrOeMz5HgqmVxTbub6yBiRdenzVeHe1KGWd6wX297glKWfVy3i1C2xd72BpXep0prCiKps7XaZAf9yWUi3VwTTTpDQSN4DlswMI6LgYdiKMLBRdWrSbKvG0MKVZldNZnxmehPRRnZNh5lDf8Vx53DcfESCVQV6ad6Kk62l8SDQtNBgK4qFz8faq3h45FbDzWcBQT5PI98LWyAul4kKma8lTlDrFsqPPSLrsCY6qltFJlPZn26GXwvQWi3NthmOL2cUrMPlkS52AKNFGy6VNl8eZacEoU9fgH5bRQAcwJnpe59nvCdueBpJOwVtwRnCo35dZJxqhRn9MbWN4Mk6Rv2CCWjU6JCpSUWjfC176N3kcVDqPWMOM63s1ckgAOFbbKTTQU71elkfrvh8Depa3bGfXe1NrcOnN68hL9jFGwtzl1O5KwxBeO8dY2KPwRGmvWM251ecrVLUEd2PruzKOgycfclvaaU5PXxSoHtYqm6Rl2o27XDijIgEOgXM5v18QepNKej3cd3WdWvxwa3ezkbRayx0iDbeBBh9wLVydb7hG43gBteAWfLDK4sXobszdrRH5YDp2O8YjpSllvuHyIkv6NF9G83PkWsQ3EMHSP5sPrngT9cZ1NMeMkLZyX8NQm3esqPpY1h9zQMCxZnd0BTzCzShFd40z3jjSQfuSgcgowlkmueysZJSoTFObhoDGR96XTxFIyTSPTI9d86ojIzAGZnD6mkwYiN22DjEcGLNWvtpwnYAfUwB7x2Pi1rC1yKTjYSD0Risley6r0DcYbTITPtRH4lxzuMriCt2ZLlqYcHSI7w9CkDd8Jsmm30sOpKIg7euVfhuMHbAoS9JqaNIwZoOVSInlMFUPVlrFZselcxuUQkmyedz3EgtPEYnMJpr9mBeHanxjFxVcxkAOwxa1Ra5c0TINUlm8QANMRvq6yleZcyBdmsDmjJeEEzvtg27mIO3EcZgg2nrRqumZzyFrpClO3PmyQmIUfS3dXamGmNoY00PT8RpN2cAN7Hl5XpHS1JOSY3JHTaQ1I8fUqFlJpAYcWhP9zMcCFdRUD0AvmJx3iFyjEmLOAl9npbcqqiVTc1aTPfF52WAtFMqByUU98L9FNhTKmVbvsgJe4XNsQKju1w6ExLz1FSfAoSN5eFOno4UNTkaCJXfua15LIwiVKf1WNj0YHgL1TVHeU3750D5YX7GvVrInvTaFgCNVFkhKi4HyhBg0EthXoH49Q1FRhfZ3VgFt1xdtc762lPTMWtmDRmO5LwiATPhjKCFJjD1jEexxavorT0YiAVd833R8PrLpB7KKcvgCsf1fx8mOUZr0qKCdL7TMWCCIdlmFKMREZ41hIqdZkN8j4RzfAVvatxFpz5VCNY94SafJsw8M9xxViE1BGWbJ8BNqL5EYsFP0PM37J82BPSIFdmCtQI6M8yljDtZ3kf7aUADZiIMGjH5lP6BwQ3GLPxhcOe1Bf5BzX1wtbGa98OgnqI73diYK0yXcobC67YoEvqs6So9gbrWqc24WyTfDgCdAebUXb98VQuwhfGBNEDsPbPZDKique0lnI3j55pIgttlSTiNnvbQXRt4db5PU2pSOVdCnS6cE56H66R8vAPAjPTUwGsDmD8HFyi9sj8iQGzrxmduCfZ31k7Mgo7a4ln12biI2og5voU44sgrHxRCDcb1XmRhAympcItfQtjgDi8UggaBMYy3T5MF75kLzskeyEGb4Xd81wKoMSi8VmR8eFMwXOqhYSpmjrdf4gq9fLXlzWQi8RDcMqo2vxuCb3A1v1xn8Ksjl3CG9O3T6n1SK2kxf2k0pE4FHsLKqr441hHThLpIRwblFzOxovjCwaRwZEJzkHhHzwX5jljTvhEh0bjsBRnSoCvcMECoqn6waoLICRh4RTeO0NcyFLXlb2PXCR1rw1xs5srCkIjQqa4NnARsMgePn2d6LA9LG8b4ujFmPI4TqKqKtxb4EATL8QdD9DP1qUM7UMxwUtqC2uJl0zbkfcZaHUVMANsRzxVxT01qH6d3YWvbxfBHlX5WrYfQyveanS3dEJ4BN8PcdkCjFty0LCg7DMdl2HPEzT4eQNka8eAiyah4bkytvvigBxyW1AvHmSXIw8Z3PP981FP6nb3Tdp2pElK82wnNjQB4ea2HSzIgSe8fHoObnqwlPruvXsEkstYWElFeARgVFn0YgeycgIgbJtLGj3LABDMs9SplWoPv8CUS7oxgffpKQ0S5nO0w1Ymch6wTsEF5sCZL0cOF3KlmSYlgfArlZ1oGDLUl22DVPMuK0aBeSePEEmHfN8sS4oW5ggJdnYz2mhTu1dsB7UFFTWl4aNaBg4bfCger2strh1tPOrzzyhn6KXsUuFMc3zIzgcONilYT52A0caGKpDcPImhavV3NMSR7zLCBTzD00lGw4k9zY8yFlcJVmMfxiRrNXms9Zd90ZZPLxDvJIS3N8M19k3fddM1WDvaguZtBTTXi0hVz9aYUTeeAg151qOH5tXfDMqNqZMTk4KzStjst6Ilrv6GKpv3ynEbksWWD0dAYFLcwWjCJhzu7SXD22egw6hPPj2fennW2SfUDKPumc39biIdAUrkZ3LnYfAmePFXWItj14kh6KGRaEjXl6iWeIHau6rcoYRb9Z5L5MmRbicSEJsrUg9UifFobqKUHHv7WaP8ihg9yinwu9lTvJATiGdSbHis2uhVVYbsd9OBNA32yzMv76CfE9rBxxHgdSQkz0nNRTZJZKyTOq8K8DWoxWLUJOAQYKIcJqwd20VOho1JWsrCS45ecLDzAqP8LTQQs9ffgQW2wIeE1pTK2haOVUM1KxseDaD7xGgaPTluK1Tox84rtX77XBWXLYpYfiSFmZ28tqhJLyubgJwRh2QgLVtc2gZJhgQG7b1koPbvL2TYyCaH4oXU8kKKmo7m4jVFPaxz6LM6rgcD7heGAZykw2hleI8Q8eGn6gF2umX1RkRs7z4WmfaLijQsUefqOotHDSxOgMC4OqebTaqPJHbfwDuL2k8cyuOUNNdM5BR2UolCShqtssPNHAIXuKLlQZ35CEgzOdaliQcjH5leW6eQDKlAQAOMDsVe5u4LyaRyE9XyStjYENBLWBKNeHkgKJVK5Bez3FY91zueOFOQA5C0uQBVDRQoJEwSr8rywo8JqypxEc7WKfGMYluXbKIOd2CpHpI9u9zzqDQiNyWZiqgBn0znlm0H0ADLag8PX69Sndw3X6cghUDgm6UNbX1EczhFPzSxuTqKNrE8tYf0sflTIg3L9YGgktj2OjVE38suwmSmGju8a8v2hOuO5g5PgXquGPx25owEC90CcxYlrudSVSTxC1iyopBduh48ZNqdkOPkU6oCs1Mkk5VrwsfL0nrG4CoqKyFJYqlnJooJnsZlR9dQ9DwUhOZZXnbSTWuVoLSBTqzfyE8eQ86YdZofIS1on8YoOPrLtHZxdroULBhB1ZsryypL2qsTEQSMbr2EPR1Xk0qkFJ0GwPfbqCPBlbdOUc3usFjnHHKvsI7dZPGMQQ4zSZ2NCFuVxz0VnUYPajyNwWqTxtvVRB6waUIopH45NntyFBuB2woRiatB2MrDZGrlXFqjKiB1WT0XtqBZlvALfus8KTICMNvS66RD032hh0wJUAKPpYaMRqqoeWyHWpsAEXm5E1bMeDCcpjWVd1camrrS4RhUe0Zfv4kfwQQsiLjhiZLuxJ5IFgI6okGD6wXxE7sHBYId17WAJEVtUzGLjBsPfAd5dids6hsd6mQSiMuequwQY69rVqoWu7hIVxsTXdDyA9vjCtGVXoSTFeybz2VsS1CgID8sqcwOg152AOcjUw221slXQnRb8m4CuWdodrpxDaXDDIUt6i2Rq2PGmpqkXWEijc528Vc8XTvPTnDSVwVFRFqnOJtZq4nS5LxY72cuF4vNZPkP1QjZwwOzqMBJ90qOCGldYqPzw0gxXqqR74drZAdGjFxB4pQHp1sZYryRva7chyMcARs45qowRt246N3RKHQkY2QQim4SmSkiRUTtO16FpcSNyAaQU9kdCo6e6nDwhvORDSKZzq0LNsFbbqqCTPYVEvCUkqrCEnxajenGazy0L7NaoM9lNJxaO8m19iJEaEQbseVSml9Ni3vAkS4PKEuz2DYL7IXgRHZ1ejucxrSIvkmwNrTHsQFYUhAfRagZPoHUt22q6CNIv8iYPPT0j4cfy3jkR9MUiOqs0v83Zj29bEwXZUzhzFrozrkKPJrMxHksr8NvTPcDn4JC4s5WJgIG4rxofeofRBLKryZ1sZk5izFobtBGYLiqMtnYsKJnxnvNEk0Yhb4N6RmqC0mpYPXis3PDOWwh8j0IE4z3hCjvO3u1IxV8n8kLht0TOEjfnZyNpcr4QsiDMERS7r56JWWNKwEF3PFHJ2Y6yoqPpohp8WiW3nZKta7FZDwE1iaR7DFY8vFxzCZhtMVL8oOQBPfxXvKwa2fN5S0tN7q22jAGsKOECJkQn3VZeQLGwHaXjIZ0r6XeA39BfZQiUSj5c9VFoBeROCohbwzH0CDda8g7WhieD68wxw7zFc3f5W6jFxyCBW8Z8vVxE9THtIFgwqrHMsohJhD1cu61hR5Qg2Th2GgAHfAcEDfMToilhxKKVyZwbg9lGyJzLaweeSD2e2K7nROabKh2D36iO0N3hWEvsfhvTrFO2UClLzfagEDUUDSZlqJeB60S9QPSXgSY40aYe78ZBff3nLHXvF8aUpgxwMDrU3zkSa2luYCVcgMEPGcP4JO1tbfobHlmSvTlodTFN5kuAvur6p46zK6r9Vg98poNN325sX66jHKHFrdu435MWoC6ac4GZ6AbqddUwLuBxMloXL33ig6WQOshXrHdB1RQzlExWzQJy58U9EVgZOyNrac2pUcG2rzgD98W4MbXmlPeYxH8a0drts1FET2WfQCEctgnud97qnEr57KM0L7SRw2wS1RArQd3nkuyMlXVCMRj82c8J3g31cSvBvvO3GKtSNc6WGYJxorRrOeMz5HgqmVxTbub6yBiRdenzVeHe1KGWd6wX297glKWfVy3i1C2xd72BpXep0prCiKps7XaZAf9yWUi3VwTTTpDQSN4DlswMI6LgYdiKMLBRdWrSbKvG0MKVZldNZnxmehPRRnZNh5lDf8Vx53DcfESCVQV6ad6Kk62l8SDQtNBgK4qFz8faq3h45FbDzWcBQT5PI98LWyAul4kKma8lTlDrFsqPPSLrsCY6qltFJlPZn26GXwvQWi3NthmOL2cUrMPlkS52AKNFGy6VNl8eZacEoU9fgH5bRQAcwJnpe59nvCdueBpJOwVtwRnCo35dZJxqhRn9MbWN4Mk6Rv2CCWjU6JCpSUWjfC176N3kcVDqPWMOM63s1ckgAOFbbKTTQU71elkfrvh8Depa3bGfXe1NrcOnN68hL9jFGwtzl1O5KwxBeO8dY2KPwRGmvWM251ecrVLUEd2PruzKOgycfclvaaU5PXxSoHtYqm6Rl2o27XDijIgEOgXM5v18QepNKej3cd3WdWvxwa3ezkbRayx0iDbeBBh9wLVydb7hG43gBteAWfLDK4sXobszdrRH5YDp2O8YjpSllvuHyIkv6NF9G83PkWsQ3EMHSP5sPrngT9cZ1NMeMkLZyX8NQm3esqPpY1h9zQMCxZnd0BTzCzShFd40z3jjSQfuSgcgowlkmueysZJSoTFObhoDGR96XTxFIyTSPTI9d86ojIzAGZnD6mkwYiN22DjEcGLNWvtpwnYAfUwB7x2Pi1rC1yKTjYSD0Risley6r0DcYbTITPtRH4lxzuMriCt2ZLlqYcHSI7w9CkDd8Jsmm30sOpKIg7euVfhuMHbAoS9JqaNIwZoOVSInlMFUPVlrFZselcxuUQkmyedz3EgtPEYnMJpr9mBeHanxjFxVcxkAOwxa1Ra5c0TINUlm8QANMRvq6yleZcyBdmsDmjJeEEzvtg27mIO3EcZgg2nrRqumZzyFrpClO3PmyQmIUfS3dXamGmNoY00PT8RpN2cAN7Hl5XpHS1JOSY3JHTaQ1I8fUqFlJpAYcWhP9zMcCFdRUD0AvmJx3iFyjEmLOAl9npbcqqiVTc1aTPfF52WAtFMqByUU98L9FNhTKmVbvsgJe4XNsQKju1w6ExLz1FSfAoSN5eFOno4UNTkaCJXfua15LIwiVKf1WNj0YHgL1TVHeU3750D5YX7GvVrInvTaFgCNVFkhKi4HyhBg0EthXoH49Q1FRhfZ3VgFt1xdtc762lPTMWtmDRmO5LwiATPhjKCFJjD1jEexxavorT0YiAVd833R8PrLpB7KKcvgCsf1fx8mOUZr0qKCdL7TMWCCIdlmFKMREZ41hIqdZkN8j4RzfAVvatxFpz5VCNY94SafJsw8M9xxViE1BGWbJ8BNqL5EYsFP0PM37J82BPSIFdmCtQI6M8yljDtZ3kf7aUADZiIMGjH5lP6BwQ3GLPxhcOe1Bf5BzX1wtbGa98OgnqI73diYK0yXcobC67YoEvqs6So9gbrWqc24WyTfDgCdAebUXb98VQuwhfGBNEDsPbPZDKique0lnI3j55pIgttlSTiNnvbQXRt4db5PU2pSOVdCnS6cE56H66R8vAPAjPTUwGsDmD8HFyi9sj8iQGzrxmduCfZ31k7Mgo7a4ln12biI2og5voU44sgrHxRCDcb1XmRhAympcItfQtjgDi8UggaBMYy3T5MF75kLzskeyEGb4Xd81wKoMSi8VmR8eFMwXOqhYSpmjrdf4gq9fLXlzWQi8RDcMqo2vxuCb3A1v1xn8Ksjl3CG9O3T6n1SK2kxf2k0pE4FHsLKqr441hHThLpIRwblFzOxovjCwaRwZEJzkHhHzwX5jljTvhEh0bjsBRnSoCvcMECoqn6waoLICRh4RTeO0NcyFLXlb2PXCR1rw1xs5srCkIjQqa4NnARsMgePn2d6LA9LG8b4ujFmPI4TqKqKtxb4EATL8QdD9DP1qUM7UMxwUtqC2uJl0zbkfcZaHUVMANsRzxVxT01qH6d3YWvbxfBHlX5WrYfQyveanS3dEJ4BN8PcdkCjFty0LCg7DMdl2HPEzT4eQNka8eAiyah4bkytvvigBxyW1AvHmSXIw8Z3PP981FP6nb3Tdp2pElK82wnNjQB4ea2HSzIgSe8fHoObnqwlPruvXsEkstYWElFeARgVFn0YgeycgIgbJtLGj3LABDMs9SplWoPv8CUS7oxgffpKQ0S5nO0w1Ymch6wTsEF5sCZL0cOF3KlmSYlgfArlZ1oGDLUl22DVPMuK0aBeSePEEmHfN8sS4oW5ggJdnYz2mhTu1dsB7UFFTWl4aNaBg4bfCger2strh1tPOrzzyhn6KXsUuFMc3zIzgcONilYT52A0caGKpDcPImhavV3NMSR7zLCBTzD00lGw4k9zY8yFlcJVmMfxiRrNXms9Zd90ZZPLxDvJIS3N8M19k3fddM1WDvaguZtBTTXi0hVz9aYUTeeAg151qOH5tXfDMqNqZMTk4KzStjst6Ilrv6GKpv3ynEbksWWD0dAYFLcwWjCJhzu7SXD22egw6hPPj2fennW2SfUDKPumc39biIdAUrkZ3LnYfAmePFXWItj14kh6KGRaEjXl6iWeIHau6rcoYRb9Z5L5MmRbicSEJsrUg9UifFobqKUHHv7WaP8ihg9yinwu9lTvJATiGdSbHis2uhVVYbsd9OBNA32yzMv76CfE9rBxxHgdSQkz0nNRTZJZKyTOq8K8DWoxWLUJOAQYKIcJqwd20VOho1JWsrCS45ecLDzAqP8LTQQs9ffgQW2wIeE1pTK2haOVUM1KxseDaD7xGgaPTluK1Tox84rtX77XBWXLYpYfiSFmZ28tqhJLyubgJwRh2QgLVtc2gZJhgQG7b1koPbvL2TYyCaH4oXU8kKKmo7m4jVFPaxz6LM6rgcD7heGAZykw2hleI8Q8eGn6gF2umX1RkRs7z4WmfaLijQsUefqOotHDSxOgMC4OqebTaqPJHbfwDuL2k8cyuOUNNdM5BR2UolCShqtssPNHAIXuKLlQZ35CEgzOdaliQcjH5leW6eQDKlAQAOMDsVe5u4LyaRyE9XyStjYENBLWBKNeHkgKJVK5Bez3FY91zueOFOQA5C0uQBVDRQoJEwSr8rywo8JqypxEc7WKfGMYluXbKIOd2CpHpI9u9zzqDQiNyWZiqgBn0znlm0H0ADLag8PX69Sndw3X6cghUDgm6UNbX1EczhFPzSxuTqKNrE8tYf0sflTIg3L9YGgktj2OjVE38suwmSmGju8a8v2hOuO5g5PgXquGPx25owEC90CcxYlrudSVSTxC1iyopBduh48ZNqdkOPkU6oCs1Mkk5VrwsfL0nrG4CoqKyFJYqlnJooJnsZlR9dQ9DwUhOZZXnbSTWuVoLSBTqzfyE8eQ86YdZofIS1on8YoOPrLtHZxdroULBhB1ZsryypL2qsTEQSMbr2EPR1Xk0qkFJ0GwPfbqCPBlbdOUc3usFjnHHKvsI7dZPGMQQ4zSZ2NCFuVxz0VnUYPajyNwWqTxtvVRB6waUIopH45NntyFBuB2woRiatB2MrDZGrlXFqjKiB1WT0XtqBZlvALfus8KTICMNvS66RD032hh0wJUAKPpYaMRqqoeWyHWpsAEXm5E1bMeDCcpjWVd1camrrS4RhUe0Zfv4kfwQQsiLjhiZLuxJ5IFgI6okGD6wXxE7sHBYId17WAJEVtUzGLjBsPfAd5dids6hsd6mQSiMuequwQY69rVqoWu7hIVxsTXdDyA9vjCtGVXoSTFeybz2VsS1CgID8sqcwOg152AOcjUw221slXQnRb8m4CuWdodrpxDaXDDIUt6i2Rq2PGmpqkXWEijc528Vc8XTvPTnDSVwVFRFqnOJtZq4nS5LxY72cuF4vNZPkP1QjZwwOzqMBJ90qOCGldYqPzw0gxXqqR74drZAdGjFxB4pQHp1sZYryRva7chyMcARs45qowRt246N3RKHQkY2QQim4SmSkiRUTtO16FpcSNyAaQU9kdCo6e6nDwhvORDSKZzq0LNsFbbqqCTPYVEvCUkqrCEnxajenGazy0L7NaoM9lNJxaO8m19iJEaEQbseVSml9Ni3vAkS4PKEuz2DYL7IXgRHZ1ejucxrSIvkmwNrTHsQFYUhAfRagZPoHUt22q6CNIv8iYPPT0j4cfy3jkR9MUiOqs0v83Zj29bEwXZUzhzFrozrkKPJrMxHksr8NvTPcDn4JC4s5WJgIG4rxofeofRBLKryZ1sZk5izFobtBGYLiqMtnYsKJnxnvNEk0Yhb4N6RmqC0mpYPXis3PDOWwh8j0IE4z3hCjvO3u1IxV8n8kLht0TOEjfn"; } diff --git a/tests/acceptance/00_basics/def.json/augments.cf b/tests/acceptance/00_basics/def.json/augments.cf index 65e22b58d5..b3bec33745 100644 --- a/tests/acceptance/00_basics/def.json/augments.cf +++ b/tests/acceptance/00_basics/def.json/augments.cf @@ -1,43 +1,63 @@ # basic test of the def.json facility: augments body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ' + "" + usebundle => file_make( + "$(sys.inputdir)/promises.cf", + ' body common control { inputs => { "@(def.inputs)" }; } -'); - +' + ); - "" usebundle => file_make("$(sys.inputdir)/secondary.cf", ' + "" + usebundle => file_make( + "$(sys.inputdir)/secondary.cf", + ' bundle common x { classes: "test_class_f03ab8289d0775ca821b39a724c6f6f08ef8fb17" expression => "any"; } -'); - - "" usebundle => file_copy("$(this.promise_filename).augmenter.json", "$(sys.inputdir)/augmenter.json"); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); +' + ); + + "" + usebundle => file_copy( + "$(this.promise_filename).augmenter.json", + "$(sys.inputdir)/augmenter.json" + ); + + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf|$(G.grep) test_class"; + "command" + string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf|$(G.grep) test_class"; methods: - "" usebundle => dcs_passif_output("test_class_f03ab8289d0775ca821b39a724c6f6f08ef8fb17\s+source=promise", "", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "test_class_f03ab8289d0775ca821b39a724c6f6f08ef8fb17\s+source=promise", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/augments.cf.augmenter.json b/tests/acceptance/00_basics/def.json/augments.cf.augmenter.json index 6bd2f5971f..0c02f54c28 100644 --- a/tests/acceptance/00_basics/def.json/augments.cf.augmenter.json +++ b/tests/acceptance/00_basics/def.json/augments.cf.augmenter.json @@ -1,5 +1,3 @@ { - "vars" : { - "inputs": [ "$(sys.inputdir)/secondary.cf" ] - } + "vars": { "inputs": ["$(sys.inputdir)/secondary.cf"] } } diff --git a/tests/acceptance/00_basics/def.json/augments.cf.json b/tests/acceptance/00_basics/def.json/augments.cf.json index 69238c0912..ddcbdc449f 100644 --- a/tests/acceptance/00_basics/def.json/augments.cf.json +++ b/tests/acceptance/00_basics/def.json/augments.cf.json @@ -1,3 +1,3 @@ { - "augments": [ "$(sys.inputdir)/augmenter.json" ] + "augments": ["$(sys.inputdir)/augmenter.json"] } diff --git a/tests/acceptance/00_basics/def.json/augments_classes/augments_classes.cf b/tests/acceptance/00_basics/def.json/augments_classes/augments_classes.cf index 1dd25ad17f..ac592d042d 100644 --- a/tests/acceptance/00_basics/def.json/augments_classes/augments_classes.cf +++ b/tests/acceptance/00_basics/def.json/augments_classes/augments_classes.cf @@ -1,40 +1,52 @@ # basic test of the def.json facility: augments body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: + "description" -> { "CFE-2956" } + string => "Test that negative lookahead works as expected, when what is being looked for is defined from augments earlier."; - "description" -> { "CFE-2956" } - string => "Test that negative lookahead works as expected, when what is being looked for is defined from augments earlier."; - - "test_soft_fail" - string => "any", - meta => { "CFE-2956" }; + "test_soft_fail" + string => "any", + meta => { "CFE-2956" }; vars: - "expect_defined" slist => { "MY_ALWAYS", "BECAUSE_MY_ALWAYS", "BECAUSE_MISSING_ABSENT" }; - "expect_undefined" slist => { "BECAUSE_MY_ALWAYS_ABSENT" }; + "expect_defined" + slist => { "MY_ALWAYS", "BECAUSE_MY_ALWAYS", "BECAUSE_MISSING_ABSENT" }; - classes: + "expect_undefined" slist => { "BECAUSE_MY_ALWAYS_ABSENT" }; - # When all expect_defined are found and none of the expect_undefined are found. - "pass" expression => concat( "(", join( ".", expect_defined ), ").!(", join( "|", expect_undefined), ")" ); + classes: + # When all expect_defined are found and none of the expect_undefined are found. + "pass" + expression => concat( + "(", + join(".", expect_defined), + ").!(", + join("|", expect_undefined), + ")" + ); reports: - - "$(this.promise_filename) $(with)" with => ifelse( "pass", "Pass", "FAIL" ); + "$(this.promise_filename) $(with)" with => ifelse("pass", "Pass", "FAIL"); DEBUG|EXTRA:: - "Expected $(expect_defined) to be defined, but was not." unless => "$(expect_defined)"; - "Found $(expect_defined) to be defined, as expected." if => "$(expect_defined)"; - "Expected $(expect_undefined) to not be defined, but was." if => "$(expect_undefined)"; - "Found $(expect_undefined) to not be defined, as expected." unless => "$(expect_undefined)"; + "Expected $(expect_defined) to be defined, but was not." + unless => "$(expect_defined)"; + + "Found $(expect_defined) to be defined, as expected." + if => "$(expect_defined)"; + + "Expected $(expect_undefined) to not be defined, but was." + if => "$(expect_undefined)"; + + "Found $(expect_undefined) to not be defined, as expected." + unless => "$(expect_undefined)"; } diff --git a/tests/acceptance/00_basics/def.json/augments_classes/def.json b/tests/acceptance/00_basics/def.json/augments_classes/def.json index 740bdd9354..406a973f2d 100644 --- a/tests/acceptance/00_basics/def.json/augments_classes/def.json +++ b/tests/acceptance/00_basics/def.json/augments_classes/def.json @@ -1,9 +1,8 @@ { - "classes": - { - "MY_ALWAYS": [ "cfengine" ], - "BECAUSE_MY_ALWAYS": [ "MY_ALWAYS" ], - "BECAUSE_MISSING_ABSENT": [ "^(?!MISSING).*" ], - "BECAUSE_MY_ALWAYS_ABSENT": [ "^(?!MY_ALWAYS).*" ] + "classes": { + "MY_ALWAYS": ["cfengine"], + "BECAUSE_MY_ALWAYS": ["MY_ALWAYS"], + "BECAUSE_MISSING_ABSENT": ["^(?!MISSING).*"], + "BECAUSE_MY_ALWAYS_ABSENT": ["^(?!MY_ALWAYS).*"] } } diff --git a/tests/acceptance/00_basics/def.json/augments_order.cf b/tests/acceptance/00_basics/def.json/augments_order.cf index d029b42253..d74ed5e3e0 100644 --- a/tests/acceptance/00_basics/def.json/augments_order.cf +++ b/tests/acceptance/00_basics/def.json/augments_order.cf @@ -1,38 +1,55 @@ # test that 'augments' in def.json are applied last body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "description" -> { "CFE-2844" } - string => "'augments' in def.json should be applied last and thus override values of variables from 'vars'"; + "description" -> { "CFE-2844" } + string => "'augments' in def.json should be applied last and thus override values of variables from 'vars'"; methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ' + "" + usebundle => file_make( + "$(sys.inputdir)/promises.cf", + ' body common control { inputs => { "@(def.inputs)" }; } -'); +' + ); + + "" + usebundle => file_copy( + "$(this.promise_filename).augmenter.json", + "$(sys.inputdir)/augmenter.json" + ); - "" usebundle => file_copy("$(this.promise_filename).augmenter.json", "$(sys.inputdir)/augmenter.json"); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf|$(G.grep) test_var"; + "command" + string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf|$(G.grep) test_var"; methods: - "" usebundle => dcs_passif_output("default:def.test_var\s+\{\"defined in augments.vars\"\}\s+source=augments_file", "", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "default:def.test_var\s+\{\"defined in augments.vars\"\}\s+source=augments_file", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/augments_order.cf.augmenter.json b/tests/acceptance/00_basics/def.json/augments_order.cf.augmenter.json index 7dfebf0a53..8457b7de25 100644 --- a/tests/acceptance/00_basics/def.json/augments_order.cf.augmenter.json +++ b/tests/acceptance/00_basics/def.json/augments_order.cf.augmenter.json @@ -1,5 +1,3 @@ { - "vars" : { - "test_var": [ "defined in augments.vars" ] - } + "vars": { "test_var": ["defined in augments.vars"] } } diff --git a/tests/acceptance/00_basics/def.json/augments_order.cf.json b/tests/acceptance/00_basics/def.json/augments_order.cf.json index be61e220c0..2d8d6eb29f 100644 --- a/tests/acceptance/00_basics/def.json/augments_order.cf.json +++ b/tests/acceptance/00_basics/def.json/augments_order.cf.json @@ -1,6 +1,4 @@ { - "augments": [ "$(sys.inputdir)/augmenter.json" ], - "vars": { - "test_var" : "defined in vars" - } + "augments": ["$(sys.inputdir)/augmenter.json"], + "vars": { "test_var": "defined in vars" } } diff --git a/tests/acceptance/00_basics/def.json/bad-json.cf b/tests/acceptance/00_basics/def.json/bad-json.cf index 76a89e1356..c04b144756 100644 --- a/tests/acceptance/00_basics/def.json/bad-json.cf +++ b/tests/acceptance/00_basics/def.json/bad-json.cf @@ -1,30 +1,39 @@ # test of the def.json facility: complain if a bad JSON file is found body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; methods: - "" usebundle => file_copy("$(this.promise_filename).x.json", "$(sys.inputdir)$(const.dirsep)def.json"); + "" + usebundle => file_copy( + "$(this.promise_filename).x.json", + "$(sys.inputdir)$(const.dirsep)def.json" + ); } ####################################################### - bundle agent check { vars: "command" string => "$(sys.cf_promises) -v|$(G.grep) JSON"; methods: - "" usebundle => dcs_passif_output(".*Could not parse JSON file $(sys.inputdir)$(const.dirsep)def.json.*", "", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + ".*Could not parse JSON file $(sys.inputdir)$(const.dirsep)def.json.*", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/class_from_classexpression.cf b/tests/acceptance/00_basics/def.json/class_from_classexpression.cf index cad2fcbf00..6da7cd6437 100644 --- a/tests/acceptance/00_basics/def.json/class_from_classexpression.cf +++ b/tests/acceptance/00_basics/def.json/class_from_classexpression.cf @@ -1,23 +1,23 @@ # basic test of the def.json facility: augments body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { - meta: - "description" -> { "CFE-2971" } - string => "Test that class expressions can be used to define classes via augments"; + "description" -> { "CFE-2971" } + string => "Test that class expressions can be used to define classes via augments"; methods: - "Test all expected classes defined from augments" - usebundle => file_make("$(sys.inputdir)/promises.cf", ' + "Test all expected classes defined from augments" + usebundle => file_make( + "$(sys.inputdir)/promises.cf", + ' bundle agent main { classes: @@ -40,25 +40,25 @@ bundle agent main !pass:: "FAIL: Not all expected classes found"; } -'); +' + ); - "Place Augments for test" - usebundle => file_copy("$(this.promise_filename).json", - "$(sys.inputdir)/def.json"); + "Place Augments for test" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" - string => "$(sys.cf_agent) --show-evaluated-classes=augments_classes_from_ -f $(sys.inputdir)/promises.cf|$(G.grep) PASS"; + "command" + string => "$(sys.cf_agent) --show-evaluated-classes=augments_classes_from_ -f $(sys.inputdir)/promises.cf|$(G.grep) PASS"; methods: - "PASS/FAIL" - usebundle => dcs_passif_output(".*PASS.*", - "", - $(command), - $(this.promise_filename)); + "PASS/FAIL" + usebundle => dcs_passif_output( + ".*PASS.*", "", $(command), $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/class_from_classexpression.cf.json b/tests/acceptance/00_basics/def.json/class_from_classexpression.cf.json index 190e373296..b4113fc68f 100644 --- a/tests/acceptance/00_basics/def.json/class_from_classexpression.cf.json +++ b/tests/acceptance/00_basics/def.json/class_from_classexpression.cf.json @@ -1,13 +1,15 @@ { - "classes": { - "augments_class_from_regex": [ "cfengine_\\d+" ], - "augments_class_from_single_class_as_regex": [ "cfengine" ], - "augments_class_from_single_class_as_expression": [ "cfengine::" ], - "augments_class_from_classexpression_and": [ "cfengine.cfengine_3::" ], - "augments_class_from_classexpression_not": [ "!MISSING::" ], - "augments_class_from_classexpression_or": [ "cfengine|cfengine_3::" ], - "augments_class_from_classexpression_complex": [ "(cfengine|cfengine_3).!MISSING::" ], - "augments_class_from_true": true, - "augments_class_from_false": false - } + "classes": { + "augments_class_from_regex": ["cfengine_\\d+"], + "augments_class_from_single_class_as_regex": ["cfengine"], + "augments_class_from_single_class_as_expression": ["cfengine::"], + "augments_class_from_classexpression_and": ["cfengine.cfengine_3::"], + "augments_class_from_classexpression_not": ["!MISSING::"], + "augments_class_from_classexpression_or": ["cfengine|cfengine_3::"], + "augments_class_from_classexpression_complex": [ + "(cfengine|cfengine_3).!MISSING::" + ], + "augments_class_from_true": true, + "augments_class_from_false": false + } } diff --git a/tests/acceptance/00_basics/def.json/classes.cf b/tests/acceptance/00_basics/def.json/classes.cf index b368d4c9ee..25d711604d 100644 --- a/tests/acceptance/00_basics/def.json/classes.cf +++ b/tests/acceptance/00_basics/def.json/classes.cf @@ -1,27 +1,36 @@ # basic test of the def.json facility: classes body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); + "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf|$(G.grep) test_class"; + "command" + string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf|$(G.grep) test_class"; methods: - "" usebundle => dcs_passif_output("test_class_29665402e2b4331f10b8d767b512cd916eeb5db9\s+source=augments_file.+test_class_29665402e2b4331f10b8d767b512cd916eeb5db9_2\s+source=augments_file", "test_class_cfengine_and_cfengine_version\s+source=augments_file", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "test_class_29665402e2b4331f10b8d767b512cd916eeb5db9\s+source=augments_file.+test_class_29665402e2b4331f10b8d767b512cd916eeb5db9_2\s+source=augments_file", + "test_class_cfengine_and_cfengine_version\s+source=augments_file", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/classes.cf.json b/tests/acceptance/00_basics/def.json/classes.cf.json index c1ecaf9ad6..272abaf7c8 100644 --- a/tests/acceptance/00_basics/def.json/classes.cf.json +++ b/tests/acceptance/00_basics/def.json/classes.cf.json @@ -1,9 +1,14 @@ { - "classes": - { - "test_class_29665402e2b4331f10b8d767b512cd916eeb5db9": [ "one", "of", "these", "matches_classmatch", "any" ], - "test_class_29665402e2b4331f10b8d767b512cd916eeb5db9_2": [ "cfengine" ], - "test_class_cfengine_and_cfengine_version": [ "cfengine.cfengine_3" ], - "my_other_example": [ "server[34]", "debian.*" ] - } + "classes": { + "test_class_29665402e2b4331f10b8d767b512cd916eeb5db9": [ + "one", + "of", + "these", + "matches_classmatch", + "any" + ], + "test_class_29665402e2b4331f10b8d767b512cd916eeb5db9_2": ["cfengine"], + "test_class_cfengine_and_cfengine_version": ["cfengine.cfengine_3"], + "my_other_example": ["server[34]", "debian.*"] + } } diff --git a/tests/acceptance/00_basics/def.json/classes_with_ns.cf b/tests/acceptance/00_basics/def.json/classes_with_ns.cf index 06ee3c7d02..606af3567c 100644 --- a/tests/acceptance/00_basics/def.json/classes_with_ns.cf +++ b/tests/acceptance/00_basics/def.json/classes_with_ns.cf @@ -1,27 +1,36 @@ # basic test of the def.json facility: classes with namespace specification body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); + "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf|$(G.grep) test_class"; + "command" + string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf|$(G.grep) test_class"; methods: - "" usebundle => dcs_passif_output("my_ns:test_class_29665402e2b4331f10b8d767b512cd916eeb5db9\s+source=augments_file.+my_ns:test_class_29665402e2b4331f10b8d767b512cd916eeb5db9_2\s+source=augments_file", "my_ns2:test_class_cfengine_and_cfengine_version\s+source=augments_file", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "my_ns:test_class_29665402e2b4331f10b8d767b512cd916eeb5db9\s+source=augments_file.+my_ns:test_class_29665402e2b4331f10b8d767b512cd916eeb5db9_2\s+source=augments_file", + "my_ns2:test_class_cfengine_and_cfengine_version\s+source=augments_file", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/classes_with_ns.cf.json b/tests/acceptance/00_basics/def.json/classes_with_ns.cf.json index 5d5ee8fa4b..c0a3712007 100644 --- a/tests/acceptance/00_basics/def.json/classes_with_ns.cf.json +++ b/tests/acceptance/00_basics/def.json/classes_with_ns.cf.json @@ -1,9 +1,14 @@ { - "classes": - { - "my_ns:test_class_29665402e2b4331f10b8d767b512cd916eeb5db9": [ "one", "of", "these", "matches_classmatch", "any" ], - "my_ns:test_class_29665402e2b4331f10b8d767b512cd916eeb5db9_2": [ "cfengine" ], - "my_ns2:test_class_cfengine_and_cfengine_version": [ "cfengine.cfengine_3" ], - "my_ns2:my_other_example": [ "server[34]", "debian.*" ] - } + "classes": { + "my_ns:test_class_29665402e2b4331f10b8d767b512cd916eeb5db9": [ + "one", + "of", + "these", + "matches_classmatch", + "any" + ], + "my_ns:test_class_29665402e2b4331f10b8d767b512cd916eeb5db9_2": ["cfengine"], + "my_ns2:test_class_cfengine_and_cfengine_version": ["cfengine.cfengine_3"], + "my_ns2:my_other_example": ["server[34]", "debian.*"] + } } diff --git a/tests/acceptance/00_basics/def.json/classes_with_ns_tags.cf b/tests/acceptance/00_basics/def.json/classes_with_ns_tags.cf index 4ca40b7253..fe78461dcc 100644 --- a/tests/acceptance/00_basics/def.json/classes_with_ns_tags.cf +++ b/tests/acceptance/00_basics/def.json/classes_with_ns_tags.cf @@ -1,27 +1,36 @@ # basic test of the def.json facility: classes with namespace specification and tags body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); + "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf|$(G.grep) test_class"; + "command" + string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf|$(G.grep) test_class"; methods: - "" usebundle => dcs_passif_output("my_ns:test_class_29665402e2b4331f10b8d767b512cd916eeb5db9\s+test_tag,source=augments_file\s+comment1.+my_ns:test_class_29665402e2b4331f10b8d767b512cd916eeb5db9_2\s+test_tag,source=augments_file\s+comment2", "my_ns2:test_class_cfengine_and_cfengine_version\s+test_tag2,source=augments_file", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "my_ns:test_class_29665402e2b4331f10b8d767b512cd916eeb5db9\s+test_tag,source=augments_file\s+comment1.+my_ns:test_class_29665402e2b4331f10b8d767b512cd916eeb5db9_2\s+test_tag,source=augments_file\s+comment2", + "my_ns2:test_class_cfengine_and_cfengine_version\s+test_tag2,source=augments_file", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/classes_with_ns_tags.cf.json b/tests/acceptance/00_basics/def.json/classes_with_ns_tags.cf.json index f1df8344e4..19bba4ab66 100644 --- a/tests/acceptance/00_basics/def.json/classes_with_ns_tags.cf.json +++ b/tests/acceptance/00_basics/def.json/classes_with_ns_tags.cf.json @@ -1,24 +1,22 @@ { - "classes": - { - "my_ns:test_class_29665402e2b4331f10b8d767b512cd916eeb5db9": { - "class_expressions": [ "one", "of", "these", "matches_classmatch", "any" ], - "tags": ["test_tag"], - "comment": "comment1" - }, - "my_ns:test_class_29665402e2b4331f10b8d767b512cd916eeb5db9_2": { - "regular_expressions": [ "cfengine" ], - "tags": ["test_tag"], - "comment": "comment2" - - }, - "my_ns2:test_class_cfengine_and_cfengine_version": { - "class_expressions": [ "cfengine.cfengine_3" ], - "tags": ["test_tag2"] - }, - "my_ns2:my_other_example": { - "regular_expressions": [ "server[34]", "debian.*" ], - "tags": ["test_tag2"] - } + "classes": { + "my_ns:test_class_29665402e2b4331f10b8d767b512cd916eeb5db9": { + "class_expressions": ["one", "of", "these", "matches_classmatch", "any"], + "tags": ["test_tag"], + "comment": "comment1" + }, + "my_ns:test_class_29665402e2b4331f10b8d767b512cd916eeb5db9_2": { + "regular_expressions": ["cfengine"], + "tags": ["test_tag"], + "comment": "comment2" + }, + "my_ns2:test_class_cfengine_and_cfengine_version": { + "class_expressions": ["cfengine.cfengine_3"], + "tags": ["test_tag2"] + }, + "my_ns2:my_other_example": { + "regular_expressions": ["server[34]", "debian.*"], + "tags": ["test_tag2"] } + } } diff --git a/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/both-can-define-vars.cf b/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/both-can-define-vars.cf index beb15fbd5b..9d62544582 100644 --- a/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/both-can-define-vars.cf +++ b/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/both-can-define-vars.cf @@ -1,37 +1,39 @@ body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "description" -> { "CFE-3975" } - string => "Both 'vars' and 'variables' in Augments are able to define variables concurrently."; + "description" -> { "CFE-3975" } + string => "Both 'vars' and 'variables' in Augments are able to define variables concurrently."; - # The variables key was introduced in 3.18.0, so 3.17 and prior should - # skip this test since the functionality is unsupported. - # Note: This before_version macro was introduced in 3.16.0, 3.15.1, 3.12.4. + # The variables key was introduced in 3.18.0, so 3.17 and prior should + # skip this test since the functionality is unsupported. + # Note: This before_version macro was introduced in 3.16.0, 3.15.1, 3.12.4. @if before_version(3.18.0) - "test_skip_unsupported" string => "any"; + "test_skip_unsupported" string => "any"; @endif } bundle agent check { vars: - "expected_value" string => concat( "Only in vars", "Only in variables"); - "actual_value" string => concat( "$(default:def.in_vars)", "$(default:def.in_variables)"); - "expected_difference" string=> "no"; - "test" string => "$(this.promise_filename)"; + "expected_value" string => concat("Only in vars", "Only in variables"); + + "actual_value" + string => concat("$(default:def.in_vars)", "$(default:def.in_variables)"); + + "expected_difference" string => "no"; + "test" string => "$(this.promise_filename)"; methods: - "Pass/Fail" usebundle => dcs_check_strcmp($(expected_value), - $(actual_value), - $(test), - $(expected_difference)); + "Pass/Fail" + usebundle => dcs_check_strcmp( + $(expected_value), $(actual_value), $(test), $(expected_difference) + ); } diff --git a/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/def.json b/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/def.json index e1756f505a..147f78bb76 100644 --- a/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/def.json +++ b/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/def.json @@ -1,10 +1,7 @@ { - "vars": { - "my_var": "Set by vars key", - "in_vars": "Only in vars" - }, - "variables": { - "default:def.my_var": "Set by variables key", - "in_variables": "Only in variables" - } + "vars": { "my_var": "Set by vars key", "in_vars": "Only in vars" }, + "variables": { + "default:def.my_var": "Set by variables key", + "in_variables": "Only in variables" + } } diff --git a/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/def.json b/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/def.json index 3c3a01359c..992a5dc613 100644 --- a/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/def.json +++ b/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/def.json @@ -1,10 +1,7 @@ { - "variables": { - "default:def.my_var": "Set by variables key", - "in_variables": "Only in variables" - }, - "vars": { - "my_var": "Set by vars key", - "in_vars": "Only in vars" - } + "variables": { + "default:def.my_var": "Set by variables key", + "in_variables": "Only in variables" + }, + "vars": { "my_var": "Set by vars key", "in_vars": "Only in vars" } } diff --git a/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/variables-wins.cf b/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/variables-wins.cf index 0f713777fa..8e73266b03 100644 --- a/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/variables-wins.cf +++ b/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/variables-wins.cf @@ -1,36 +1,36 @@ body common control { - inputs => { "../../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "description" -> { "CFE-3975" } - string => "'variables' in def.json should win if both 'vars' and 'variables' keys define the same variable, even when variables is listed first in augments."; - # The variables key was introduced in 3.18.0, so 3.17 and prior should - # skip this test since the functionality is unsupported. - # Note: This before_version macro was introduced in 3.16.0, 3.15.1, 3.12.4. + "description" -> { "CFE-3975" } + string => "'variables' in def.json should win if both 'vars' and 'variables' keys define the same variable, even when variables is listed first in augments."; + + # The variables key was introduced in 3.18.0, so 3.17 and prior should + # skip this test since the functionality is unsupported. + # Note: This before_version macro was introduced in 3.16.0, 3.15.1, 3.12.4. @if before_version(3.18.0) - "test_skip_unsupported" string => "any"; + "test_skip_unsupported" string => "any"; @endif } bundle agent check { vars: - "expected_value" string => "Set by variables key"; - "actual_value" string => "$(default:def.my_var)"; - "expected_difference" string=> "no"; - "test" string => "$(this.promise_filename)"; + "expected_value" string => "Set by variables key"; + "actual_value" string => "$(default:def.my_var)"; + "expected_difference" string => "no"; + "test" string => "$(this.promise_filename)"; methods: - "Pass/Fail" usebundle => dcs_check_strcmp($(expected_value), - $(actual_value), - $(test), - $(expected_difference)); + "Pass/Fail" + usebundle => dcs_check_strcmp( + $(expected_value), $(actual_value), $(test), $(expected_difference) + ); } diff --git a/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins.cf b/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins.cf index 7282dfd2f9..0c8a6ead4a 100644 --- a/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins.cf +++ b/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins.cf @@ -1,36 +1,36 @@ body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "description" -> { "CFE-3975" } - string => "'variables' in def.json should win if both 'vars' and 'variables' keys define the same variable."; - # The variables key was introduced in 3.18.0, so 3.17 and prior should - # skip this test since the functionality is unsupported. - # Note: This before_version macro was introduced in 3.16.0, 3.15.1, 3.12.4. + "description" -> { "CFE-3975" } + string => "'variables' in def.json should win if both 'vars' and 'variables' keys define the same variable."; + + # The variables key was introduced in 3.18.0, so 3.17 and prior should + # skip this test since the functionality is unsupported. + # Note: This before_version macro was introduced in 3.16.0, 3.15.1, 3.12.4. @if before_version(3.18.0) - "test_skip_unsupported" string => "any"; + "test_skip_unsupported" string => "any"; @endif } bundle agent check { vars: - "expected_value" string => "Set by variables key"; - "actual_value" string => "$(default:def.my_var)"; - "expected_difference" string=> "no"; - "test" string => "$(this.promise_filename)"; + "expected_value" string => "Set by variables key"; + "actual_value" string => "$(default:def.my_var)"; + "expected_difference" string => "no"; + "test" string => "$(this.promise_filename)"; methods: - "Pass/Fail" usebundle => dcs_check_strcmp($(expected_value), - $(actual_value), - $(test), - $(expected_difference)); + "Pass/Fail" + usebundle => dcs_check_strcmp( + $(expected_value), $(actual_value), $(test), $(expected_difference) + ); } diff --git a/tests/acceptance/00_basics/def.json/def.json b/tests/acceptance/00_basics/def.json/def.json index b6cc058a51..cbae76ce12 100644 --- a/tests/acceptance/00_basics/def.json/def.json +++ b/tests/acceptance/00_basics/def.json/def.json @@ -1,10 +1,21 @@ { - "vars": { - "domain": "mydomain", - "acl": [ ".*$(def.domain) note this will remain unexpanded!!!" ], - - "input_name_patterns": [ ".*\\.cf",".*\\.dat",".*\\.txt", ".*\\.conf", ".*\\.mustache", - ".*\\.sh", ".*\\.pl", ".*\\.py", ".*\\.rb", - "cf_promises_release_id", ".*\\.json", ".*\\.yaml", ".*\\.js" ] - } + "vars": { + "domain": "mydomain", + "acl": [".*$(def.domain) note this will remain unexpanded!!!"], + "input_name_patterns": [ + ".*\\.cf", + ".*\\.dat", + ".*\\.txt", + ".*\\.conf", + ".*\\.mustache", + ".*\\.sh", + ".*\\.pl", + ".*\\.py", + ".*\\.rb", + "cf_promises_release_id", + ".*\\.json", + ".*\\.yaml", + ".*\\.js" + ] + } } diff --git a/tests/acceptance/00_basics/def.json/def_preferred.json/def.json b/tests/acceptance/00_basics/def.json/def_preferred.json/def.json index 0956ddc712..2317bd4d50 100644 --- a/tests/acceptance/00_basics/def.json/def_preferred.json/def.json +++ b/tests/acceptance/00_basics/def.json/def_preferred.json/def.json @@ -1,6 +1,3 @@ { - "vars": - { - "bad_var": "foo" - } + "vars": { "bad_var": "foo" } } diff --git a/tests/acceptance/00_basics/def.json/def_preferred.json/def_preferred.cf b/tests/acceptance/00_basics/def.json/def_preferred.json/def_preferred.cf index 526046b2e5..6121c87970 100644 --- a/tests/acceptance/00_basics/def.json/def_preferred.json/def_preferred.cf +++ b/tests/acceptance/00_basics/def.json/def_preferred.json/def_preferred.cf @@ -1,18 +1,15 @@ body common control { - # Feel free to avoid including "default.sub.cf" and define your - # own bundlesequence for simple tests - - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + # Feel free to avoid including "default.sub.cf" and define your + # own bundlesequence for simple tests + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init # Initialize the environment and prepare for test { - } bundle agent test @@ -21,13 +18,15 @@ bundle agent test meta: "description" -> { "CFE-3656" } string => "def_preferred.json is preferred over def.json if it exists."; + classes: "ok" if => and( strcmp(length(variablesmatching(".*\.good_var")), "1"), - strcmp(length(variablesmatching(".*\.bad_var")), "0"), + strcmp(length(variablesmatching(".*\.bad_var")), "0"), fileexists("$(this.promise_dirname)/def.json"), - fileexists("$(this.promise_dirname)/def_preferred.json")), + fileexists("$(this.promise_dirname)/def_preferred.json") + ), scope => "namespace"; } @@ -37,6 +36,7 @@ bundle agent check reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/def.json/def_preferred.json/def_preferred.json b/tests/acceptance/00_basics/def.json/def_preferred.json/def_preferred.json index 921ad5459d..7cdf689d74 100644 --- a/tests/acceptance/00_basics/def.json/def_preferred.json/def_preferred.json +++ b/tests/acceptance/00_basics/def.json/def_preferred.json/def_preferred.json @@ -1,6 +1,3 @@ { - "vars": - { - "good_var": "foo" - } + "vars": { "good_var": "foo" } } diff --git a/tests/acceptance/00_basics/def.json/inputs.cf b/tests/acceptance/00_basics/def.json/inputs.cf index 97602f4bf8..8daf3877bc 100644 --- a/tests/acceptance/00_basics/def.json/inputs.cf +++ b/tests/acceptance/00_basics/def.json/inputs.cf @@ -1,40 +1,57 @@ # basic test of the def.json facility: inputs body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ' + "" + usebundle => file_make( + "$(sys.inputdir)/promises.cf", + ' body common control { inputs => { @(def.augments_inputs) }; } -'); - "" usebundle => file_make("$(sys.inputdir)/secondary.cf", ' +' + ); + + "" + usebundle => file_make( + "$(sys.inputdir)/secondary.cf", + ' bundle common x { classes: "test_class_9f606e44752ce34ef39ee7d4754c5c84890d2b14" expression => "any"; } -'); +' + ); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf|$(G.grep) test_class"; + "command" + string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf|$(G.grep) test_class"; methods: - "" usebundle => dcs_passif_output("test_class_9f606e44752ce34ef39ee7d4754c5c84890d2b14\s+source=promise", "", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "test_class_9f606e44752ce34ef39ee7d4754c5c84890d2b14\s+source=promise", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/inputs.cf.json b/tests/acceptance/00_basics/def.json/inputs.cf.json index 4986384df1..525d507e17 100644 --- a/tests/acceptance/00_basics/def.json/inputs.cf.json +++ b/tests/acceptance/00_basics/def.json/inputs.cf.json @@ -1,3 +1,3 @@ { - "inputs": [ "$(sys.inputdir)/secondary.cf" ] + "inputs": ["$(sys.inputdir)/secondary.cf"] } diff --git a/tests/acceptance/00_basics/def.json/json-inputs-not-array.cf b/tests/acceptance/00_basics/def.json/json-inputs-not-array.cf index cd6545f547..9bde2580f8 100644 --- a/tests/acceptance/00_basics/def.json/json-inputs-not-array.cf +++ b/tests/acceptance/00_basics/def.json/json-inputs-not-array.cf @@ -2,34 +2,44 @@ # error message. body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ' + "" + usebundle => file_make( + "$(sys.inputdir)/promises.cf", + ' body common control { inputs => { @(def.augments_inputs) }; } -'); +' + ); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: "command" string => "$(sys.cf_promises) -f $(sys.inputdir)/promises.cf"; methods: - "" usebundle => dcs_passif_output(".*Trying to augment inputs in [^\n]* but the value was not a list of string.*", - "", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + ".*Trying to augment inputs in [^\n]* but the value was not a list of string.*", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/json-inputs-not-array.cf.json b/tests/acceptance/00_basics/def.json/json-inputs-not-array.cf.json index be055fc28a..2df2c2164e 100644 --- a/tests/acceptance/00_basics/def.json/json-inputs-not-array.cf.json +++ b/tests/acceptance/00_basics/def.json/json-inputs-not-array.cf.json @@ -1,3 +1,3 @@ { - "inputs": { "there-should-not-be-a-key-here": "nor-a-value" } + "inputs": { "there-should-not-be-a-key-here": "nor-a-value" } } diff --git a/tests/acceptance/00_basics/def.json/json-inputs-not-auto-applied.cf b/tests/acceptance/00_basics/def.json/json-inputs-not-auto-applied.cf index 306f22e36d..71f0c02bf8 100644 --- a/tests/acceptance/00_basics/def.json/json-inputs-not-auto-applied.cf +++ b/tests/acceptance/00_basics/def.json/json-inputs-not-auto-applied.cf @@ -1,40 +1,57 @@ # Test that def.json:inputs is not auto loaded. body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ' + "" + usebundle => file_make( + "$(sys.inputdir)/promises.cf", + ' body common control { inputs => { }; } -'); - "" usebundle => file_make("$(sys.inputdir)/secondary.cf", ' +' + ); + + "" + usebundle => file_make( + "$(sys.inputdir)/secondary.cf", + ' bundle common x { classes: "test_class_8f606e44752ce34ef39ee7d4754c5c84890d2b14" expression => "any"; } -'); +' + ); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf|$(G.grep) test_class"; + "command" + string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf|$(G.grep) test_class"; methods: - "" usebundle => dcs_passif_output("", ".*test_class_8f606e44752ce34ef39ee7d4754c5c84890d2b14.*", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "", + ".*test_class_8f606e44752ce34ef39ee7d4754c5c84890d2b14.*", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/json-inputs-not-auto-applied.cf.json b/tests/acceptance/00_basics/def.json/json-inputs-not-auto-applied.cf.json index 4986384df1..525d507e17 100644 --- a/tests/acceptance/00_basics/def.json/json-inputs-not-auto-applied.cf.json +++ b/tests/acceptance/00_basics/def.json/json-inputs-not-auto-applied.cf.json @@ -1,3 +1,3 @@ { - "inputs": [ "$(sys.inputdir)/secondary.cf" ] + "inputs": ["$(sys.inputdir)/secondary.cf"] } diff --git a/tests/acceptance/00_basics/def.json/policy_server_classes.cf b/tests/acceptance/00_basics/def.json/policy_server_classes.cf index a61acf5ca3..98f6613978 100644 --- a/tests/acceptance/00_basics/def.json/policy_server_classes.cf +++ b/tests/acceptance/00_basics/def.json/policy_server_classes.cf @@ -1,29 +1,40 @@ # basic test of the def.json facility: classes body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); - "" usebundle => file_make("$(sys.statedir)/am_policy_hub", ''); - "" usebundle => file_make("$(sys.workdir)/policy_server.dat", 'fake-server'); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); + "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + "" usebundle => file_make("$(sys.statedir)/am_policy_hub", ''); + + "" + usebundle => file_make("$(sys.workdir)/policy_server.dat", 'fake-server'); + + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf|$(G.grep) test_class"; + "command" + string => "$(sys.cf_promises) --show-classes -f $(sys.inputdir)/promises.cf|$(G.grep) test_class"; methods: - "" usebundle => dcs_passif_output("test_class_policy_server\s+source=augments_file", "", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "test_class_policy_server\s+source=augments_file", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/policy_server_classes.cf.json b/tests/acceptance/00_basics/def.json/policy_server_classes.cf.json index 1cc6c60664..8b78debad7 100644 --- a/tests/acceptance/00_basics/def.json/policy_server_classes.cf.json +++ b/tests/acceptance/00_basics/def.json/policy_server_classes.cf.json @@ -1,6 +1,3 @@ { - "classes": - { - "test_class_policy_server": [ "am_policy_hub" ] - } + "classes": { "test_class_policy_server": ["am_policy_hub"] } } diff --git a/tests/acceptance/00_basics/def.json/show_vars_JSON.cf b/tests/acceptance/00_basics/def.json/show_vars_JSON.cf index 58252279b3..257956e3ec 100644 --- a/tests/acceptance/00_basics/def.json/show_vars_JSON.cf +++ b/tests/acceptance/00_basics/def.json/show_vars_JSON.cf @@ -1,27 +1,36 @@ # basic test of the def.json facility: classes body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); + "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-vars -w $(sys.workdir)|$(G.grep) test_var"; + "command" + string => "$(sys.cf_promises) --show-vars -w $(sys.workdir)|$(G.grep) test_var"; methods: - "" usebundle => dcs_passif_output('default:def.test_var\\s+\\{"387c108886725091c6fe2433a9fcafa0820dd61f":\\["8e92eeab70dbef876aeac9d97a74cfdde6f53e86"\\]\\}.*', "", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + 'default:def.test_var\\s+\\{"387c108886725091c6fe2433a9fcafa0820dd61f":\\["8e92eeab70dbef876aeac9d97a74cfdde6f53e86"\\]\\}.*', + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/show_vars_JSON.cf.json b/tests/acceptance/00_basics/def.json/show_vars_JSON.cf.json index 5c694985f3..8bee9f1021 100644 --- a/tests/acceptance/00_basics/def.json/show_vars_JSON.cf.json +++ b/tests/acceptance/00_basics/def.json/show_vars_JSON.cf.json @@ -1,6 +1,9 @@ { - "vars": - { - "test_var": { "387c108886725091c6fe2433a9fcafa0820dd61f": [ "8e92eeab70dbef876aeac9d97a74cfdde6f53e86" ] } - } + "vars": { + "test_var": { + "387c108886725091c6fe2433a9fcafa0820dd61f": [ + "8e92eeab70dbef876aeac9d97a74cfdde6f53e86" + ] + } + } } diff --git a/tests/acceptance/00_basics/def.json/state.cf b/tests/acceptance/00_basics/def.json/state.cf index fb438f3e19..672ce46e8b 100644 --- a/tests/acceptance/00_basics/def.json/state.cf +++ b/tests/acceptance/00_basics/def.json/state.cf @@ -1,26 +1,26 @@ # full test of the def.json facility body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(def, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + def, "$(this.promise_filename).expected.json", $(this.promise_filename) + ); + reports: - "augments policy = $(this.promise_filename)"; - "domain = $(def.domain)"; + "augments policy = $(this.promise_filename)"; + "domain = $(def.domain)"; } diff --git a/tests/acceptance/00_basics/def.json/variables.cf b/tests/acceptance/00_basics/def.json/variables.cf index 86d9e180cf..0b937df99a 100644 --- a/tests/acceptance/00_basics/def.json/variables.cf +++ b/tests/acceptance/00_basics/def.json/variables.cf @@ -1,27 +1,36 @@ # basic test of the def.json facility: variables body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); + "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf|$(G.grep) test_variable"; + "command" + string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf|$(G.grep) test_variable"; methods: - "" usebundle => dcs_passif_output("default:def.test_variable\s+37bff81c825bd57a613ff4770b7a0679ff147bdf\s+test_tag,source=augments_file\s+comment1", "", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "default:def.test_variable\s+37bff81c825bd57a613ff4770b7a0679ff147bdf\s+test_tag,source=augments_file\s+comment1", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/variables.cf.json b/tests/acceptance/00_basics/def.json/variables.cf.json index 2e9d0e0def..f3e479c938 100644 --- a/tests/acceptance/00_basics/def.json/variables.cf.json +++ b/tests/acceptance/00_basics/def.json/variables.cf.json @@ -1,9 +1,9 @@ { - "variables": { - "test_variable": { - "value": "37bff81c825bd57a613ff4770b7a0679ff147bdf", - "tags": ["test_tag"], - "comment": "comment1" - } - } + "variables": { + "test_variable": { + "value": "37bff81c825bd57a613ff4770b7a0679ff147bdf", + "tags": ["test_tag"], + "comment": "comment1" + } + } } diff --git a/tests/acceptance/00_basics/def.json/variables_bare_array.cf b/tests/acceptance/00_basics/def.json/variables_bare_array.cf index f411625969..b8aaed47fe 100644 --- a/tests/acceptance/00_basics/def.json/variables_bare_array.cf +++ b/tests/acceptance/00_basics/def.json/variables_bare_array.cf @@ -1,27 +1,36 @@ # basic test of the def.json facility: variables body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); + "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf | $(G.grep) bare_test"; + "command" + string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf | $(G.grep) bare_test"; methods: - "" usebundle => dcs_passif_output("default:def.bare_test_array\s+.*bare_test_array_element.*", "", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "default:def.bare_test_array\s+.*bare_test_array_element.*", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/variables_bare_array.cf.json b/tests/acceptance/00_basics/def.json/variables_bare_array.cf.json index a8b34ba5b9..e987a107a1 100644 --- a/tests/acceptance/00_basics/def.json/variables_bare_array.cf.json +++ b/tests/acceptance/00_basics/def.json/variables_bare_array.cf.json @@ -1,5 +1,3 @@ { - "variables": { - "bare_test_array": ["bare_test_array_element"] - } + "variables": { "bare_test_array": ["bare_test_array_element"] } } diff --git a/tests/acceptance/00_basics/def.json/variables_bare_string.cf b/tests/acceptance/00_basics/def.json/variables_bare_string.cf index 909040f830..4f1f99f839 100644 --- a/tests/acceptance/00_basics/def.json/variables_bare_string.cf +++ b/tests/acceptance/00_basics/def.json/variables_bare_string.cf @@ -1,27 +1,36 @@ # basic test of the def.json facility: variables body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); + "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf | $(G.grep) bare_test"; + "command" + string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf | $(G.grep) bare_test"; methods: - "" usebundle => dcs_passif_output("default:def.bare_test_string\s+bare_test_string_value\s.*", "", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "default:def.bare_test_string\s+bare_test_string_value\s.*", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/variables_bare_string.cf.json b/tests/acceptance/00_basics/def.json/variables_bare_string.cf.json index f7f4359102..10f2d5e834 100644 --- a/tests/acceptance/00_basics/def.json/variables_bare_string.cf.json +++ b/tests/acceptance/00_basics/def.json/variables_bare_string.cf.json @@ -1,5 +1,3 @@ { - "variables": { - "bare_test_string": "bare_test_string_value" - } + "variables": { "bare_test_string": "bare_test_string_value" } } diff --git a/tests/acceptance/00_basics/def.json/variables_with_bundle.cf b/tests/acceptance/00_basics/def.json/variables_with_bundle.cf index 1a446a93de..db9093ba60 100644 --- a/tests/acceptance/00_basics/def.json/variables_with_bundle.cf +++ b/tests/acceptance/00_basics/def.json/variables_with_bundle.cf @@ -1,27 +1,36 @@ # basic test of the def.json facility: variables with bundle specification body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); + "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf|$(G.grep) test_variable"; + "command" + string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf|$(G.grep) test_variable"; methods: - "" usebundle => dcs_passif_output("default:config.test_variable\s+37bff81c825bd57a613ff4770b7a0679ff147bdf\s+test_tag,source=augments_file", "", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "default:config.test_variable\s+37bff81c825bd57a613ff4770b7a0679ff147bdf\s+test_tag,source=augments_file", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/variables_with_bundle.cf.json b/tests/acceptance/00_basics/def.json/variables_with_bundle.cf.json index 556a959802..574292ca4c 100644 --- a/tests/acceptance/00_basics/def.json/variables_with_bundle.cf.json +++ b/tests/acceptance/00_basics/def.json/variables_with_bundle.cf.json @@ -1,8 +1,8 @@ { - "variables": { - "config.test_variable": { - "value": "37bff81c825bd57a613ff4770b7a0679ff147bdf", - "tags": ["test_tag"] - } - } + "variables": { + "config.test_variable": { + "value": "37bff81c825bd57a613ff4770b7a0679ff147bdf", + "tags": ["test_tag"] + } + } } diff --git a/tests/acceptance/00_basics/def.json/variables_with_ns.cf b/tests/acceptance/00_basics/def.json/variables_with_ns.cf index ea014dbe59..23e5e94cf8 100644 --- a/tests/acceptance/00_basics/def.json/variables_with_ns.cf +++ b/tests/acceptance/00_basics/def.json/variables_with_ns.cf @@ -1,27 +1,36 @@ # basic test of the def.json facility: variables with namespace and bundle specification body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); + "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf|$(G.grep) test_variable"; + "command" + string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf|$(G.grep) test_variable"; methods: - "" usebundle => dcs_passif_output("my_ns:config.test_variable\s+37bff81c825bd57a613ff4770b7a0679ff147bdf\s+test_tag,source=augments_file", "", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "my_ns:config.test_variable\s+37bff81c825bd57a613ff4770b7a0679ff147bdf\s+test_tag,source=augments_file", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/variables_with_ns.cf.json b/tests/acceptance/00_basics/def.json/variables_with_ns.cf.json index a227981fd7..c7aba26e9f 100644 --- a/tests/acceptance/00_basics/def.json/variables_with_ns.cf.json +++ b/tests/acceptance/00_basics/def.json/variables_with_ns.cf.json @@ -1,8 +1,8 @@ { - "variables": { - "my_ns:config.test_variable": { - "value": "37bff81c825bd57a613ff4770b7a0679ff147bdf", - "tags": ["test_tag"] - } - } + "variables": { + "my_ns:config.test_variable": { + "value": "37bff81c825bd57a613ff4770b7a0679ff147bdf", + "tags": ["test_tag"] + } + } } diff --git a/tests/acceptance/00_basics/def.json/vars.cf b/tests/acceptance/00_basics/def.json/vars.cf index 121eb00c28..8da26043d3 100644 --- a/tests/acceptance/00_basics/def.json/vars.cf +++ b/tests/acceptance/00_basics/def.json/vars.cf @@ -1,27 +1,36 @@ # basic test of the def.json facility: vars body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); + "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf|$(G.grep) test_variable"; + "command" + string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf|$(G.grep) test_variable"; methods: - "" usebundle => dcs_passif_output("default:def.test_variable\s+37bff81c825bd57a613ff4770b7a0679ff147bdf\s+source=augments_file", "", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "default:def.test_variable\s+37bff81c825bd57a613ff4770b7a0679ff147bdf\s+source=augments_file", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/vars.cf.json b/tests/acceptance/00_basics/def.json/vars.cf.json index c88eba552d..11d43d804d 100644 --- a/tests/acceptance/00_basics/def.json/vars.cf.json +++ b/tests/acceptance/00_basics/def.json/vars.cf.json @@ -1,11 +1,7 @@ { - "classes": - { - "class_to_define_if": [ "one", "of", "these", "matches_classmatch" ], - "my_other_example": [ "server[34]", "debian.*" ] - }, - - "vars": { - "test_variable": "37bff81c825bd57a613ff4770b7a0679ff147bdf" - } + "classes": { + "class_to_define_if": ["one", "of", "these", "matches_classmatch"], + "my_other_example": ["server[34]", "debian.*"] + }, + "vars": { "test_variable": "37bff81c825bd57a613ff4770b7a0679ff147bdf" } } diff --git a/tests/acceptance/00_basics/def.json/vars_with_bundle.cf b/tests/acceptance/00_basics/def.json/vars_with_bundle.cf index 4984a8a9c9..49a71c7f0a 100644 --- a/tests/acceptance/00_basics/def.json/vars_with_bundle.cf +++ b/tests/acceptance/00_basics/def.json/vars_with_bundle.cf @@ -1,27 +1,36 @@ # basic test of the def.json facility: vars with bundle specification body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); + "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf|$(G.grep) test_variable"; + "command" + string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf|$(G.grep) test_variable"; methods: - "" usebundle => dcs_passif_output("default:config.test_variable\s+37bff81c825bd57a613ff4770b7a0679ff147bdf\s+source=augments_file", "", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "default:config.test_variable\s+37bff81c825bd57a613ff4770b7a0679ff147bdf\s+source=augments_file", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/vars_with_bundle.cf.json b/tests/acceptance/00_basics/def.json/vars_with_bundle.cf.json index de61361e82..4b61556373 100644 --- a/tests/acceptance/00_basics/def.json/vars_with_bundle.cf.json +++ b/tests/acceptance/00_basics/def.json/vars_with_bundle.cf.json @@ -1,5 +1,3 @@ { - "vars": { - "config.test_variable": "37bff81c825bd57a613ff4770b7a0679ff147bdf" - } + "vars": { "config.test_variable": "37bff81c825bd57a613ff4770b7a0679ff147bdf" } } diff --git a/tests/acceptance/00_basics/def.json/vars_with_ns.cf b/tests/acceptance/00_basics/def.json/vars_with_ns.cf index 0108e7c091..5e5d8ea8b1 100644 --- a/tests/acceptance/00_basics/def.json/vars_with_ns.cf +++ b/tests/acceptance/00_basics/def.json/vars_with_ns.cf @@ -1,27 +1,36 @@ # basic test of the def.json facility: vars with namespace and bundle specification body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); - "" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json"); + "" usebundle => file_make("$(sys.inputdir)/promises.cf", ''); + + "" + usebundle => file_copy( + "$(this.promise_filename).json", "$(sys.inputdir)/def.json" + ); } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf|$(G.grep) test_variable"; + "command" + string => "$(sys.cf_promises) --show-vars -f $(sys.inputdir)/promises.cf|$(G.grep) test_variable"; methods: - "" usebundle => dcs_passif_output("my_ns:config.test_variable\s+37bff81c825bd57a613ff4770b7a0679ff147bdf\s+source=augments_file", "", $(command), $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "my_ns:config.test_variable\s+37bff81c825bd57a613ff4770b7a0679ff147bdf\s+source=augments_file", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/def.json/vars_with_ns.cf.json b/tests/acceptance/00_basics/def.json/vars_with_ns.cf.json index 27678912fe..94143360c1 100644 --- a/tests/acceptance/00_basics/def.json/vars_with_ns.cf.json +++ b/tests/acceptance/00_basics/def.json/vars_with_ns.cf.json @@ -1,11 +1,9 @@ { - "classes": - { - "class_to_define_if": [ "one", "of", "these", "matches_classmatch" ], - "my_other_example": [ "server[34]", "debian.*" ] - }, - - "vars": { - "my_ns:config.test_variable": "37bff81c825bd57a613ff4770b7a0679ff147bdf" - } + "classes": { + "class_to_define_if": ["one", "of", "these", "matches_classmatch"], + "my_other_example": ["server[34]", "debian.*"] + }, + "vars": { + "my_ns:config.test_variable": "37bff81c825bd57a613ff4770b7a0679ff147bdf" + } } diff --git a/tests/acceptance/00_basics/environment/hpux.cf b/tests/acceptance/00_basics/environment/hpux.cf index 0501cd03b4..f1643c3433 100644 --- a/tests/acceptance/00_basics/environment/hpux.cf +++ b/tests/acceptance/00_basics/environment/hpux.cf @@ -3,42 +3,38 @@ # Redmine #3842: ensure correct sys.flavor, sys.arch on HP-UX # ############################################################################## - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { } - bundle agent test { } - bundle agent check { vars: - "expected[flavor]" string => ifelse("hpux", "hp-ux_.+", - "unknown"); - - "expected[arch]" string => ifelse("hpux", "ia64", - "unknown"); + "expected[flavor]" string => ifelse("hpux", "hp-ux_.+", "unknown"); + "expected[arch]" string => ifelse("hpux", "ia64", "unknown"); + "checks" slist => getindices("expected"); - "checks" slist => getindices("expected"); - - # If the output contains the string, we fail + # If the output contains the string, we fail classes: - "ok_$(checks)" expression => regcmp("$(expected[$(checks)])", "$(sys.$(checks))"); - "unknown_$(checks)" expression => strcmp("$(expected[$(checks)])", "unknown"); + "ok_$(checks)" + expression => regcmp("$(expected[$(checks)])", "$(sys.$(checks))"); + + "unknown_$(checks)" + expression => strcmp("$(expected[$(checks)])", "unknown"); - "ok" and => { "ok_flavor", "ok_arch" }; - "skipped" and => { "unknown_flavor", "unknown_arch" }; + "ok" and => { "ok_flavor", "ok_arch" }; + "skipped" and => { "unknown_flavor", "unknown_arch" }; reports: DEBUG:: @@ -48,6 +44,7 @@ bundle agent check ok||skipped:: "$(this.promise_filename) Pass"; + !ok.!skipped:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/environment/proc-net-functions.cf b/tests/acceptance/00_basics/environment/proc-net-functions.cf index 460669d382..f2504aa87a 100644 --- a/tests/acceptance/00_basics/environment/proc-net-functions.cf +++ b/tests/acceptance/00_basics/environment/proc-net-functions.cf @@ -1,22 +1,21 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent init { vars: "pid_for_testing" int => "11"; methods: - "" usebundle => dir_sync( - "$(this.promise_dirname)/proc", - "$(G.testdir)/proc" - ); + "" + usebundle => dir_sync( + "$(this.promise_dirname)/proc", "$(G.testdir)/proc" + ); commands: " @@ -30,12 +29,11 @@ ln -s self/net net contain => in_shell; } - bundle agent test { meta: - "test_skip_unsupported" string => "!linux"; + "test_skip_unsupported" string => "!linux"; commands: - "$(G.env) CFENGINE_TEST_OVERRIDE_PROCPID=$(init.pid_for_testing) CFENGINE_TEST_OVERRIDE_PROCDIR=$(G.testdir)/proc $(sys.cf_agent) -DAUTO -f $(this.promise_filename).sub"; + "$(G.env) CFENGINE_TEST_OVERRIDE_PROCPID=$(init.pid_for_testing) CFENGINE_TEST_OVERRIDE_PROCDIR=$(G.testdir)/proc $(sys.cf_agent) -DAUTO -f $(this.promise_filename).sub"; } diff --git a/tests/acceptance/00_basics/environment/proc-net.cf b/tests/acceptance/00_basics/environment/proc-net.cf index f014c88717..f2504aa87a 100644 --- a/tests/acceptance/00_basics/environment/proc-net.cf +++ b/tests/acceptance/00_basics/environment/proc-net.cf @@ -1,22 +1,21 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent init { vars: "pid_for_testing" int => "11"; methods: - "" usebundle => dir_sync( - "$(this.promise_dirname)/proc", - "$(G.testdir)/proc" - ); + "" + usebundle => dir_sync( + "$(this.promise_dirname)/proc", "$(G.testdir)/proc" + ); commands: " @@ -33,8 +32,8 @@ ln -s self/net net bundle agent test { meta: - "test_skip_unsupported" string => "!linux"; + "test_skip_unsupported" string => "!linux"; commands: - "$(G.env) CFENGINE_TEST_OVERRIDE_PROCPID=$(init.pid_for_testing) CFENGINE_TEST_OVERRIDE_PROCDIR=$(G.testdir)/proc $(sys.cf_agent) -DAUTO -f $(this.promise_filename).sub"; + "$(G.env) CFENGINE_TEST_OVERRIDE_PROCPID=$(init.pid_for_testing) CFENGINE_TEST_OVERRIDE_PROCDIR=$(G.testdir)/proc $(sys.cf_agent) -DAUTO -f $(this.promise_filename).sub"; } diff --git a/tests/acceptance/00_basics/environment/workdir_correct_after_files_promise.cf b/tests/acceptance/00_basics/environment/workdir_correct_after_files_promise.cf index 840425ff24..73e92537de 100644 --- a/tests/acceptance/00_basics/environment/workdir_correct_after_files_promise.cf +++ b/tests/acceptance/00_basics/environment/workdir_correct_after_files_promise.cf @@ -1,31 +1,32 @@ ############################################################################## # -# ############################################################################## - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent check { meta: - # This test should be skipped on non linux hosts when its fixed (or # improved to do something similar on platforms that don't have /bin/pwd "test_soft_fail" string => "any", - meta => { "redmine7569" }; + meta => { "redmine7569" }; vars: # When the agent runs the test, pwd should not return /tmp "fail_string" string => 'Q: ".*/bin/pwd": /tmp'; - "command" string => "$(sys.cf-agent) -KIf $(this.promise_filename).sub -DAUTO"; + + "command" + string => "$(sys.cf-agent) -KIf $(this.promise_filename).sub -DAUTO"; methods: "check" - usebundle => dcs_passif_output(".*", escape($(fail_string)), $(command), $(this.promise_filename)); + usebundle => dcs_passif_output( + ".*", escape($(fail_string)), $(command), $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/ifelapsed_and_expireafter/expireafter.cf b/tests/acceptance/00_basics/ifelapsed_and_expireafter/expireafter.cf index addccaa4c8..47a3926f11 100644 --- a/tests/acceptance/00_basics/ifelapsed_and_expireafter/expireafter.cf +++ b/tests/acceptance/00_basics/ifelapsed_and_expireafter/expireafter.cf @@ -3,69 +3,67 @@ # Test that expireafter works with commands promise type # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } ############################################################################## - bundle agent init { meta: - # Solaris 9 & 10 don't seem to handle the backgrounding - "test_skip_needs_work" - string => "windows|sunos_5_9|sunos_5_10"; + # Solaris 9 & 10 don't seem to handle the backgrounding + "test_skip_needs_work" string => "windows|sunos_5_9|sunos_5_10"; + files: - "$(G.testfile)" - delete => tidy; + "$(G.testfile)" delete => tidy; } ############################################################################## - -body action background { +body action background +{ background => "true"; } bundle agent test { meta: - "description" -> { "CFE-1188" } - string => "Test that expireafter works with commands promise type"; + "description" -> { "CFE-1188" } + string => "Test that expireafter works with commands promise type"; commands: - "$(sys.cf_agent) --inform --file $(this.promise_filename).sub --" - action => background, - comment => "I will get killed by the second agent"; - "$(G.sleep) 90" - comment => "I will wait for the first agent to expire"; - "$(sys.cf_agent) --inform --file $(this.promise_filename).sub" - comment => "I will kill the first agent"; + "$(sys.cf_agent) --inform --file $(this.promise_filename).sub --" + action => background, + comment => "I will get killed by the second agent"; + + "$(G.sleep) 90" comment => "I will wait for the first agent to expire"; + + "$(sys.cf_agent) --inform --file $(this.promise_filename).sub" + comment => "I will kill the first agent"; } ############################################################################## - bundle agent check { vars: - "expected" - string => "Hello CFEngine"; - "actual" - string => readfile("$(G.testfile)"), - if => fileexists("$(G.testfile)"); + "expected" string => "Hello CFEngine"; + + "actual" + string => readfile("$(G.testfile)"), + if => fileexists("$(G.testfile)"); classes: - "ok" - expression => strcmp("$(expected)", "$(actual)"); + "ok" expression => strcmp("$(expected)", "$(actual)"); reports: DEBUG:: "Expected '$(expected)', found '$(actual)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/ifelapsed_and_expireafter/locks.cf b/tests/acceptance/00_basics/ifelapsed_and_expireafter/locks.cf index aac018a86d..ca438d7525 100644 --- a/tests/acceptance/00_basics/ifelapsed_and_expireafter/locks.cf +++ b/tests/acceptance/00_basics/ifelapsed_and_expireafter/locks.cf @@ -1,67 +1,73 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_flakey_fail" string => "sunos_5_11.sparc", + "test_flakey_fail" + string => "sunos_5_11.sparc", meta => { "ENT-7068" }; vars: - "first" - string => - execresult("$(sys.cf_agent) -KIf $(this.promise_filename).sub -b example -Dfirst", - "noshell"), - comment => "Ignore locks in this first run - it will still write the locks!"; + "first" + string => execresult( + "$(sys.cf_agent) -KIf $(this.promise_filename).sub -b example -Dfirst", + "noshell" + ), + comment => "Ignore locks in this first run - it will still write the locks!"; - "second" - string => - execresult("$(sys.cf_agent) -If $(this.promise_filename).sub -b example -Dsecond", - "noshell"), - comment => "Don't ignore locks here so for pass_only_first_test_second case"; + "second" + string => execresult( + "$(sys.cf_agent) -If $(this.promise_filename).sub -b example -Dsecond", + "noshell" + ), + comment => "Don't ignore locks here so for pass_only_first_test_second case"; } bundle agent check { vars: - "pass_strings" slist => { "test", "call_report_now", "only_first" }; - "activations" slist => { "test.first", "test.second" }; + "pass_strings" slist => { "test", "call_report_now", "only_first" }; + "activations" slist => { "test.first", "test.second" }; -# we want to see all of those in either "test.first" or "test.second" - "pass_classes" slist => { - "pass_test_test_first", - "pass_call_report_now_test_first", - "pass_test_test_second", - "pass_call_report_now_test_second", - "pass_only_first_test_first", - }; + # we want to see all of those in either "test.first" or "test.second" + "pass_classes" + slist => { + "pass_test_test_first", + "pass_call_report_now_test_first", + "pass_test_test_second", + "pass_call_report_now_test_second", + "pass_only_first_test_first", + }; -# we don't want to any of those in neither "test.first" nor "test.second" - "fail_classes" slist => { - "pass_only_first_test_second" - }; + # we don't want to any of those in neither "test.first" nor "test.second" + "fail_classes" slist => { "pass_only_first_test_second" }; classes: - "pass_$(pass_strings)_$(activations)" expression => regcmp(".*R: Called from $(pass_strings).*", - "$($(activations))"); + "pass_$(pass_strings)_$(activations)" + expression => regcmp( + ".*R: Called from $(pass_strings).*", "$($(activations))" + ); - "ok_pass" and => { @(pass_classes) }; - "fail_pass" or => { @(fail_classes) }; - - "ok" expression => "ok_pass.!fail_pass"; + "ok_pass" and => { @(pass_classes) }; + "fail_pass" or => { @(fail_classes) }; + "ok" expression => "ok_pass.!fail_pass"; reports: DEBUG.!ok:: "Failed activation $(activations): '$($(activations))'"; + DEBUG:: "expected : $(pass_classes)" if => not("$(pass_classes)"); "unexpected: $(fail_classes)" if => "$(fail_classes)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/ifelapsed_and_expireafter/redmine_6334.cf b/tests/acceptance/00_basics/ifelapsed_and_expireafter/redmine_6334.cf index 4d1f0548a2..e421b98972 100644 --- a/tests/acceptance/00_basics/ifelapsed_and_expireafter/redmine_6334.cf +++ b/tests/acceptance/00_basics/ifelapsed_and_expireafter/redmine_6334.cf @@ -1,69 +1,80 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_flakey_fail" string => "sunos_5_11.sparc", + "test_flakey_fail" + string => "sunos_5_11.sparc", meta => { "ENT-7068" }; vars: - "first" - string => - execresult("$(sys.cf_agent) -KIf $(this.promise_filename).sub -b example -Dfirst", - "noshell"), - comment => "Ignore locks in this first run - it will still write the locks!"; + "first" + string => execresult( + "$(sys.cf_agent) -KIf $(this.promise_filename).sub -b example -Dfirst", + "noshell" + ), + comment => "Ignore locks in this first run - it will still write the locks!"; - "second" - string => - execresult("$(sys.cf_agent) -If $(this.promise_filename).sub -b example -Dsecond", - "noshell"), - comment => "Don't ignore locks here so for pass_only_first_test_second case"; + "second" + string => execresult( + "$(sys.cf_agent) -If $(this.promise_filename).sub -b example -Dsecond", + "noshell" + ), + comment => "Don't ignore locks here so for pass_only_first_test_second case"; } bundle agent check { vars: - "pass_strings" slist => { "test", "call_report_now", "only_first", "abort_now" }; - "activations" slist => { "test.first", "test.second" }; + "pass_strings" + slist => { "test", "call_report_now", "only_first", "abort_now" }; -# we want to see all of those in either "test.first" or "test.second" - "pass_classes" slist => { - "pass_test_test_first", - "pass_call_report_now_test_first", - "pass_test_test_second", - "pass_call_report_now_test_second", - "pass_only_first_test_first", - }; + "activations" slist => { "test.first", "test.second" }; -# we don't want to any of those in neither "test.first" nor "test.second" - "fail_classes" slist => { - "pass_only_first_test_second", - "pass_abort_now_test_first", - "pass_abort_now_test_second" - }; + # we want to see all of those in either "test.first" or "test.second" + "pass_classes" + slist => { + "pass_test_test_first", + "pass_call_report_now_test_first", + "pass_test_test_second", + "pass_call_report_now_test_second", + "pass_only_first_test_first", + }; - classes: - "pass_$(pass_strings)_$(activations)" expression => regcmp(".*R: Called from $(pass_strings).*", - "$($(activations))"); + # we don't want to any of those in neither "test.first" nor "test.second" + "fail_classes" + slist => { + "pass_only_first_test_second", + "pass_abort_now_test_first", + "pass_abort_now_test_second", + }; - "ok_pass" and => { @(pass_classes) }; - "fail_pass" or => { @(fail_classes) }; + classes: + "pass_$(pass_strings)_$(activations)" + expression => regcmp( + ".*R: Called from $(pass_strings).*", "$($(activations))" + ); - "ok" expression => "ok_pass.!fail_pass"; + "ok_pass" and => { @(pass_classes) }; + "fail_pass" or => { @(fail_classes) }; + "ok" expression => "ok_pass.!fail_pass"; reports: DEBUG.!ok:: "Failed activation $(activations): '$($(activations))'"; + DEBUG:: "expected : $(pass_classes)" if => not("$(pass_classes)"); "unexpected: $(fail_classes)" if => "$(fail_classes)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/ifelapsed_and_expireafter/timed/defaults.cf b/tests/acceptance/00_basics/ifelapsed_and_expireafter/timed/defaults.cf index 7dbeae45e1..ec1ba884f2 100644 --- a/tests/acceptance/00_basics/ifelapsed_and_expireafter/timed/defaults.cf +++ b/tests/acceptance/00_basics/ifelapsed_and_expireafter/timed/defaults.cf @@ -1,6 +1,5 @@ # Tests that the defaults to ifelapsed and expireafter are correct, # and that changing them has an effect. - # We repeatedly run four promises, all adding a line of text to a file. What we # test is how many times the line gets added to the file, depending on the # value of ifelapsed and expireafter. The promise is carried out three times, @@ -18,41 +17,55 @@ # SE = Short Expireafter # DI = Default Ifelapsed # LI = Long Ifelapsed - body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default($(this.promiser_filename)) }; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default($(this.promiser_filename)) }; } bundle agent init { meta: - # Backgrounding doesn't work properly on Windows or with fakeroot. - # In addition, RHEL4 seems to have some problem killing the test - # afterwards, and HP-UX is too slow for timing to be accurate. Also, - # this test was disabled on all platforms in ENT-6939 - "test_skip_needs_work" string => "any"; + # Backgrounding doesn't work properly on Windows or with fakeroot. + # In addition, RHEL4 seems to have some problem killing the test + # afterwards, and HP-UX is too slow for timing to be accurate. Also, + # this test was disabled on all platforms in ENT-6939 + "test_skip_needs_work" string => "any"; methods: test_pass_1:: - "any" usebundle => file_make("$(G.testfile).expireafter.expected", "one promise execution"); - "any" usebundle => file_make("$(G.testfile).short_expireafter.expected", "one promise execution -one promise execution"); - "any" usebundle => file_make("$(G.testfile).ifelapsed.expected", "one promise execution -one promise execution"); - "any" usebundle => file_make("$(G.testfile).long_ifelapsed.expected", "one promise execution"); + "any" + usebundle => file_make( + "$(G.testfile).expireafter.expected", "one promise execution" + ); + + "any" + usebundle => file_make( + "$(G.testfile).short_expireafter.expected", + "one promise execution +one promise execution" + ); + + "any" + usebundle => file_make( + "$(G.testfile).ifelapsed.expected", + "one promise execution +one promise execution" + ); + "any" + usebundle => file_make( + "$(G.testfile).long_ifelapsed.expected", "one promise execution" + ); } bundle agent test { vars: - "cases" slist => { "expireafter", - "short_expireafter", - "ifelapsed", - "long_ifelapsed", - }; + "cases" + slist => { + "expireafter", "short_expireafter", "ifelapsed", "long_ifelapsed", + }; commands: !DEBUG:: @@ -62,9 +75,11 @@ bundle agent test DEBUG.test_pass_1:: "$(G.no_fds) $(sys.cf_agent) -l --debug -D $(cases) -f $(this.promise_filename).sub 1>>$(G.testfile).$(cases).1.output.log 2>&1 & echo $!" contain => in_shell; + DEBUG.test_pass_2:: "$(G.no_fds) $(sys.cf_agent) -l --debug -D $(cases) -f $(this.promise_filename).sub 1>>$(G.testfile).$(cases).2.output.log 2>&1 & echo $!" contain => in_shell; + DEBUG.test_pass_3:: "$(G.no_fds) $(sys.cf_agent) -l --debug -D $(cases) -f $(this.promise_filename).sub 1>>$(G.testfile).$(cases).3.output.log 2>&1 & echo $!" contain => in_shell; @@ -75,8 +90,10 @@ bundle agent check methods: test_pass_1:: "any" usebundle => dcs_wait($(this.promise_filename), 20); + test_pass_2:: "any" usebundle => dcs_wait($(this.promise_filename), 55); + test_pass_3:: # Final delay is just to make sure all background echos have happened, and # all sub agents have exited. Failure to do so can make the sub agents try @@ -93,11 +110,16 @@ bundle agent check methods: test_pass_4:: - "any" usebundle => dcs_if_diff("$(G.testfile).$(test.cases)", - "$(G.testfile).$(test.cases).expected", - "$(test.cases)_pass", - "$(test.cases)_fail"); + "any" + usebundle => dcs_if_diff( + "$(G.testfile).$(test.cases)", + "$(G.testfile).$(test.cases).expected", + "$(test.cases)_pass", + "$(test.cases)_fail" + ); - "any" usebundle => dcs_passif("$(pass_expr).$(fail_expr)", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif( + "$(pass_expr).$(fail_expr)", "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/00_basics/ifelapsed_and_expireafter/timed/package_lock.cf b/tests/acceptance/00_basics/ifelapsed_and_expireafter/timed/package_lock.cf index 39c3d0cb02..547f7d81fd 100644 --- a/tests/acceptance/00_basics/ifelapsed_and_expireafter/timed/package_lock.cf +++ b/tests/acceptance/00_basics/ifelapsed_and_expireafter/timed/package_lock.cf @@ -1,27 +1,26 @@ # Test whether successive package locks can be grabbed, both immediately # following each other and after a time delay. (Redmine #7933). - body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { meta: - # "no_fds" won't work correctly on Windows. - # Also Solaris 9 and 10 don't seem to handle the backgrounding used in - # this test. But it seems unrelated to the actual fix. - "test_skip_needs_work" string => "windows|sunos_5_9|sunos_5_10"; + # "no_fds" won't work correctly on Windows. + # Also Solaris 9 and 10 don't seem to handle the backgrounding used in + # this test. But it seems unrelated to the actual fix. + "test_skip_needs_work" string => "windows|sunos_5_9|sunos_5_10"; - # The backgrounding doesn't work well under fakeroot. - "test_skip_unsupported" string => "using_fakeroot"; + # The backgrounding doesn't work well under fakeroot. + "test_skip_unsupported" string => "using_fakeroot"; files: test_pass_1:: - "$(sys.workdir)/modules/packages/." - create => "true"; + "$(sys.workdir)/modules/packages/." create => "true"; + "$(sys.workdir)/modules/packages/test_module" copy_from => local_cp("$(this.promise_filename).module"), perms => m("ugo+x"); @@ -50,7 +49,10 @@ bundle agent check "any" usebundle => dcs_wait($(this.promise_filename), 300); test_pass_2:: - "any" usebundle => dcs_check_diff($(G.testfile), - "$(this.promise_filename).expected", - $(this.promise_filename)); + "any" + usebundle => dcs_check_diff( + $(G.testfile), + "$(this.promise_filename).expected", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/linesep.cf b/tests/acceptance/00_basics/linesep.cf index 1de55924fc..642bbba3c9 100644 --- a/tests/acceptance/00_basics/linesep.cf +++ b/tests/acceptance/00_basics/linesep.cf @@ -15,15 +15,15 @@ bundle agent check { classes: windows:: - "ok" - expression => strcmp("$(const.linesep)", "$(const.r)$(const.n)"); + "ok" expression => strcmp("$(const.linesep)", "$(const.r)$(const.n)"); + !windows:: - "ok" - expression => strcmp("$(const.linesep)", "$(const.n)"); + "ok" expression => strcmp("$(const.linesep)", "$(const.n)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/00_basics/macros/if_on_first_line.cf b/tests/acceptance/00_basics/macros/if_on_first_line.cf index 7284d2ab56..bed549ba75 100644 --- a/tests/acceptance/00_basics/macros/if_on_first_line.cf +++ b/tests/acceptance/00_basics/macros/if_on_first_line.cf @@ -5,7 +5,6 @@ # ##################################################### @endif - body common control { inputs => { "../../default.sub.cf" }; diff --git a/tests/acceptance/00_basics/namespaces_can_not_contain_funny_characters.cf b/tests/acceptance/00_basics/namespaces_can_not_contain_funny_characters.cf index c81e504b32..aff4969acc 100644 --- a/tests/acceptance/00_basics/namespaces_can_not_contain_funny_characters.cf +++ b/tests/acceptance/00_basics/namespaces_can_not_contain_funny_characters.cf @@ -5,13 +5,12 @@ ##################################################### body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: @@ -20,7 +19,8 @@ bundle agent test characters that are invalid in bundle names."; vars: - "command" string => "$(sys.cf_agent) -KI --define AUTO,DEBUG $(this.promise_filename).sub"; + "command" + string => "$(sys.cf_agent) -KI --define AUTO,DEBUG $(this.promise_filename).sub"; methods: # We check the output of a sub policy that we expect to be syntatically @@ -29,5 +29,7 @@ bundle agent test # report to print, because the policy should not be syntatically valid and # should never run. "check" - usebundle => dcs_passif_output(".*syntax error.*", ".*FAIL", $(command), $(this.promise_filename)); + usebundle => dcs_passif_output( + ".*syntax error.*", ".*FAIL", $(command), $(this.promise_filename) + ); } diff --git a/tests/acceptance/00_basics/validation/validation_tagging_directory.cf b/tests/acceptance/00_basics/validation/validation_tagging_directory.cf index 96eca00d6a..4a8794eb4e 100644 --- a/tests/acceptance/00_basics/validation/validation_tagging_directory.cf +++ b/tests/acceptance/00_basics/validation/validation_tagging_directory.cf @@ -1,10 +1,9 @@ # Test that cf-promises -T tags a directory correctly - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -14,247 +13,312 @@ bundle agent init bundle agent test { meta: - "test_skip_needs_work" string => "windows"; + "test_skip_needs_work" string => "windows"; vars: - "options" string => ifelse("verbose_mode", " -v ", ""); - "dirs" slist => { $(G.testdir), $(sys.masterdir), $(sys.inputdir) }; - "hubfile" slist => { "$(sys.workdir)/policy_server.dat", "$(sys.workdir)/state/am_policy_hub" }; - - methods: - "rm hub" usebundle => dcs_fini($(hubfile)); - - "run" usebundle => test_dorun("testdir", $(G.testdir), "$(sys.cf_promises) -T $(G.testdir) $(options)"); - "run" usebundle => test_dorun("inputdir", $(sys.inputdir), "$(sys.cf_agent) -K $(options)"); + "options" string => ifelse("verbose_mode", " -v ", ""); + "dirs" slist => { $(G.testdir), $(sys.masterdir), $(sys.inputdir) }; - # make this machine a hub - "mk hub" usebundle => file_make($(hubfile), "$(sys.host)"); + "hubfile" + slist => { + "$(sys.workdir)/policy_server.dat", + "$(sys.workdir)/state/am_policy_hub", + }; - "run" usebundle => test_dorun("masterdir", $(sys.masterdir), "$(sys.cf_agent) -K $(options)"); + methods: + "rm hub" usebundle => dcs_fini($(hubfile)); + + "run" + usebundle => test_dorun( + "testdir", + $(G.testdir), + "$(sys.cf_promises) -T $(G.testdir) $(options)" + ); + + "run" + usebundle => test_dorun( + "inputdir", $(sys.inputdir), "$(sys.cf_agent) -K $(options)" + ); + + # make this machine a hub + "mk hub" usebundle => file_make($(hubfile), "$(sys.host)"); + + "run" + usebundle => test_dorun( + "masterdir", $(sys.masterdir), "$(sys.cf_agent) -K $(options)" + ); } bundle agent test_dorun(name, dir, tagopt) { vars: - "simulated_validated_ok" string => ' + "simulated_validated_ok" string => ' { "timestamp": 1234, } '; - - "simulated_validated_bad" string => ' + "simulated_validated_bad" string => ' { "timestamp": 1234, } '; methods: + vars: - "masters" slist => { "promises.cf", "x.cf", "y.cf" }; + "masters" slist => { "promises.cf", "x.cf", "y.cf" }; methods: - "rsync" - usebundle => dir_sync("$(this.promise_dirname)/testdir", - $(dir)); - - "master2cf" - usebundle => file_copy("$(dir)/$(masters).master", - "$(dir)/$(masters)"); - - "make ignored file 1" - usebundle => file_make("$(dir)/ignoreme", - "fnord $(sys.date)"); - - "make ignored file 2" - usebundle => file_make("$(dir)/ignoredir/2", - "fnord $(sys.date)"); - - "tag1" usebundle => test_tag("1", - $(name), - $(tagopt), - "make new cf_promises_validated and cf_promises_release_id in $(dir)"); - "read1" usebundle => test_read("1", $(name), $(dir)); - - "rm r_id" usebundle => dcs_fini($(test_read.rf)); - "tag2" usebundle => test_tag("2", - $(name), - $(tagopt), - "recreate cf_promises_release_id even if cf_promises_validated is OK"); - "read2" usebundle => test_read("2", $(name), $(dir)); - - "make good validated file" - usebundle => file_make("$(dir)/cf_promises_validated", - $(simulated_validated_ok)); - - "tag3" usebundle => test_tag("3", - $(name), - $(tagopt), - "rewrite good cf_promises_validated and leave cf_promises_release_id alone"); - "read3" usebundle => test_read("3", $(name), $(dir)); - - "make bad validated file" - usebundle => file_make("$(dir)/cf_promises_validated", - $(simulated_validated_bad)); - - "tag4" usebundle => test_tag("4", - $(name), - $(tagopt), - "overwrite bad cf_promises_validated"); - "read4" usebundle => test_read("4", $(name), $(dir)); + "rsync" usebundle => dir_sync("$(this.promise_dirname)/testdir", $(dir)); + + "master2cf" + usebundle => file_copy("$(dir)/$(masters).master", "$(dir)/$(masters)"); + + "make ignored file 1" + usebundle => file_make("$(dir)/ignoreme", "fnord $(sys.date)"); + + "make ignored file 2" + usebundle => file_make("$(dir)/ignoredir/2", "fnord $(sys.date)"); + + "tag1" + usebundle => test_tag( + "1", + $(name), + $(tagopt), + "make new cf_promises_validated and cf_promises_release_id in $(dir)" + ); + + "read1" usebundle => test_read("1", $(name), $(dir)); + "rm r_id" usebundle => dcs_fini($(test_read.rf)); + + "tag2" + usebundle => test_tag( + "2", + $(name), + $(tagopt), + "recreate cf_promises_release_id even if cf_promises_validated is OK" + ); + + "read2" usebundle => test_read("2", $(name), $(dir)); + + "make good validated file" + usebundle => file_make( + "$(dir)/cf_promises_validated", $(simulated_validated_ok) + ); + + "tag3" + usebundle => test_tag( + "3", + $(name), + $(tagopt), + "rewrite good cf_promises_validated and leave cf_promises_release_id alone" + ); + + "read3" usebundle => test_read("3", $(name), $(dir)); + + "make bad validated file" + usebundle => file_make( + "$(dir)/cf_promises_validated", $(simulated_validated_bad) + ); + + "tag4" + usebundle => test_tag( + "4", $(name), $(tagopt), "overwrite bad cf_promises_validated" + ); + + "read4" usebundle => test_read("4", $(name), $(dir)); reports: - "$(this.bundle): $(name) $(dir) '$(tagopt)'"; + "$(this.bundle): $(name) $(dir) '$(tagopt)'"; } bundle agent test_tag(vary, topname, tagopt, desc) { vars: - "uid" string => "$(topname)_$(vary)"; + "uid" string => "$(topname)_$(vary)"; classes: - "tagged_$(uid)" - expression => returnszero("$(tagopt) -D$(uid)", - "noshell"), + "tagged_$(uid)" + expression => returnszero("$(tagopt) -D$(uid)", "noshell"), scope => "namespace"; reports: - "Case $(uid): $(desc)"; + "Case $(uid): $(desc)"; DEBUG:: - "Case $(uid): failed to $(tagopt)" - if => "!tagged_$(uid)"; - - "Case $(uid): tagged $(tagopt)" - if => "tagged_$(uid)"; + "Case $(uid): failed to $(tagopt)" if => "!tagged_$(uid)"; + "Case $(uid): tagged $(tagopt)" if => "tagged_$(uid)"; } bundle agent test_read(suffix, topname, dir) { vars: - "vf" string => "$(dir)/cf_promises_validated"; - "rf" string => "$(dir)/cf_promises_release_id"; - "uid" string => "$(topname)_$(suffix)"; + "vf" string => "$(dir)/cf_promises_validated"; + "rf" string => "$(dir)/cf_promises_release_id"; + "uid" string => "$(topname)_$(suffix)"; - "v_$(uid)" data => readjson($(vf), 4k), + "v_$(uid)" + data => readjson($(vf), 4k), if => "have_vf_$(uid)"; - "v_$(uid)_str" string => format("%S", "v_$(uid)"), + "v_$(uid)_str" + string => format("%S", "v_$(uid)"), handle => "v_$(uid)_str", if => "have_vf_$(uid)"; - "r_$(uid)" data => readjson($(rf), 4k), + "r_$(uid)" + data => readjson($(rf), 4k), if => "have_rf_$(uid)"; - "r_$(uid)_str" string => format("%S", "r_$(uid)"), + "r_$(uid)_str" + string => format("%S", "r_$(uid)"), handle => "r_$(uid)_str", if => "have_rf_$(uid)"; classes: - "have_vf_$(uid)" expression => fileexists($(vf)), + "have_vf_$(uid)" + expression => fileexists($(vf)), scope => "namespace"; - "have_rf_$(uid)" expression => fileexists($(rf)), + "have_rf_$(uid)" + expression => fileexists($(rf)), scope => "namespace"; reports: DEBUG:: "Case $(uid): $(vf) = $(v_$(uid)_str)" - depends_on => { "v_$(uid)_str" }, - if => "have_vf_$(uid)"; + depends_on => { "v_$(uid)_str" }, + if => "have_vf_$(uid)"; - "Case $(uid): Missing validation file $(vf)" - if => "!have_vf_$(uid)"; + "Case $(uid): Missing validation file $(vf)" if => "!have_vf_$(uid)"; "Case $(uid): $(rf) = $(r_$(uid)_str)" - depends_on => { "r_$(uid)_str" }, - if => "have_rf_$(uid)"; + depends_on => { "r_$(uid)_str" }, + if => "have_rf_$(uid)"; - "Case $(uid): Missing release ID file $(rf)" - if => "!have_rf_$(uid)"; + "Case $(uid): Missing release ID file $(rf)" if => "!have_rf_$(uid)"; } bundle agent check { vars: - "expected_checksum" string => "4b974a13b5473cfbf60edfb66b201a364d38960f"; - "tops" slist => { "testdir", "masterdir", "inputdir" }; - "tests" slist => { "1", "2", "3", "4" }; + "expected_checksum" string => "4b974a13b5473cfbf60edfb66b201a364d38960f"; + "tops" slist => { "testdir", "masterdir", "inputdir" }; + "tests" slist => { "1", "2", "3", "4" }; classes: - - # exceptions - - # the release ID is not recreated in a normal agent run if the - # promises validated file is OK, even on the hub - "correct_release_masterdir_2" expression => "any"; - - # the release ID is not generated when running on a non-hub - "correct_release_inputdir_$(tests)" expression => "any"; - - # normal testing - "correct_timestamp_$(tops)_1" expression => "any"; - "correct_release_$(tops)_1" expression => strcmp("$(test_read.r_$(tops)_1[releaseId])", - $(expected_checksum)); - - "correct_timestamp_$(tops)_2" expression => "any"; - "correct_release_$(tops)_2" expression => strcmp("$(test_read.r_$(tops)_2[releaseId])", - $(expected_checksum)); - - # we expect the bad timestamp - "correct_timestamp_inputdir_3" expression => strcmp("$(test_read.v_inputdir_3[timestamp])", - "1234"); - # anything except the bad timestamp is OK - "correct_timestamp_masterdir_3" not => strcmp("$(test_read.v_masterdir_3[timestamp])", - "1234"); - "correct_timestamp_testdir_3" not => strcmp("$(test_read.v_testdir_3[timestamp])", - "1234"); - "correct_release_$(tops)_3" expression => strcmp("$(test_read.r_$(tops)_3[releaseId])", - $(expected_checksum)); - - # we expect the bad timestamp - "correct_timestamp_inputdir_4" expression => strcmp("$(test_read.v_inputdir_4[timestamp])", - "1234"); - # anything except the bad timestamp is OK - "correct_timestamp_masterdir_4" not => strcmp("$(test_read.v_masterdir_4[timestamp])", - "1234"); - "correct_timestamp_testdir_4" not => strcmp("$(test_read.v_testdir_4[timestamp])", - "1234"); - "correct_release_$(tops)_4" expression => strcmp("$(test_read.r_$(tops)_4[releaseId])", - $(expected_checksum)); - - "ok" and => { - "tagged_testdir_1", "correct_timestamp_testdir_1", "correct_release_testdir_1", - "tagged_testdir_2", "correct_timestamp_testdir_2", "correct_release_testdir_2", - "tagged_testdir_3", "correct_timestamp_testdir_3", "correct_release_testdir_3", - "tagged_testdir_4", "correct_timestamp_testdir_4", "correct_release_testdir_4", - - "tagged_masterdir_1", "correct_timestamp_masterdir_1", "correct_release_masterdir_1", - "tagged_masterdir_2", "correct_timestamp_masterdir_2", "correct_release_masterdir_2", - "tagged_masterdir_3", "correct_timestamp_masterdir_3", "correct_release_masterdir_3", - "tagged_masterdir_4", "correct_timestamp_masterdir_4", "correct_release_masterdir_4", - - "tagged_inputdir_1", "correct_timestamp_inputdir_1", "correct_release_inputdir_1", - "tagged_inputdir_2", "correct_timestamp_inputdir_2", "correct_release_inputdir_2", - "tagged_inputdir_3", "correct_timestamp_inputdir_3", "correct_release_inputdir_3", - "tagged_inputdir_4", "correct_timestamp_inputdir_4", "correct_release_inputdir_4", + # exceptions + # the release ID is not recreated in a normal agent run if the + # promises validated file is OK, even on the hub + "correct_release_masterdir_2" expression => "any"; + + # the release ID is not generated when running on a non-hub + "correct_release_inputdir_$(tests)" expression => "any"; + + # normal testing + "correct_timestamp_$(tops)_1" expression => "any"; + + "correct_release_$(tops)_1" + expression => strcmp( + "$(test_read.r_$(tops)_1[releaseId])", $(expected_checksum) + ); + + "correct_timestamp_$(tops)_2" expression => "any"; + + "correct_release_$(tops)_2" + expression => strcmp( + "$(test_read.r_$(tops)_2[releaseId])", $(expected_checksum) + ); + + # we expect the bad timestamp + "correct_timestamp_inputdir_3" + expression => strcmp("$(test_read.v_inputdir_3[timestamp])", "1234"); + + # anything except the bad timestamp is OK + "correct_timestamp_masterdir_3" + not => strcmp("$(test_read.v_masterdir_3[timestamp])", "1234"); + + "correct_timestamp_testdir_3" + not => strcmp("$(test_read.v_testdir_3[timestamp])", "1234"); + + "correct_release_$(tops)_3" + expression => strcmp( + "$(test_read.r_$(tops)_3[releaseId])", $(expected_checksum) + ); + + # we expect the bad timestamp + "correct_timestamp_inputdir_4" + expression => strcmp("$(test_read.v_inputdir_4[timestamp])", "1234"); + + # anything except the bad timestamp is OK + "correct_timestamp_masterdir_4" + not => strcmp("$(test_read.v_masterdir_4[timestamp])", "1234"); + + "correct_timestamp_testdir_4" + not => strcmp("$(test_read.v_testdir_4[timestamp])", "1234"); + + "correct_release_$(tops)_4" + expression => strcmp( + "$(test_read.r_$(tops)_4[releaseId])", $(expected_checksum) + ); + + "ok" + and => { + "tagged_testdir_1", + "correct_timestamp_testdir_1", + "correct_release_testdir_1", + "tagged_testdir_2", + "correct_timestamp_testdir_2", + "correct_release_testdir_2", + "tagged_testdir_3", + "correct_timestamp_testdir_3", + "correct_release_testdir_3", + "tagged_testdir_4", + "correct_timestamp_testdir_4", + "correct_release_testdir_4", + "tagged_masterdir_1", + "correct_timestamp_masterdir_1", + "correct_release_masterdir_1", + "tagged_masterdir_2", + "correct_timestamp_masterdir_2", + "correct_release_masterdir_2", + "tagged_masterdir_3", + "correct_timestamp_masterdir_3", + "correct_release_masterdir_3", + "tagged_masterdir_4", + "correct_timestamp_masterdir_4", + "correct_release_masterdir_4", + "tagged_inputdir_1", + "correct_timestamp_inputdir_1", + "correct_release_inputdir_1", + "tagged_inputdir_2", + "correct_timestamp_inputdir_2", + "correct_release_inputdir_2", + "tagged_inputdir_3", + "correct_timestamp_inputdir_3", + "correct_release_inputdir_3", + "tagged_inputdir_4", + "correct_timestamp_inputdir_4", + "correct_release_inputdir_4", }; reports: DEBUG:: "Case $(tops)_$(tests): the timestamp was correct or ignored" - if => "correct_timestamp_$(tops)_$(tests)"; + if => "correct_timestamp_$(tops)_$(tests)"; "Case $(tops)_$(tests): the timestamp was incorrect, actual $(test_read.v_$(tops)_$(tests)[timestamp])" - if => "!correct_timestamp_$(tops)_$(tests)"; + if => "!correct_timestamp_$(tops)_$(tests)"; "Case $(tops)_$(tests): the release ID was correct ($(expected_checksum)) or ignored" - if => "correct_release_$(tops)_$(tests)"; + if => "correct_release_$(tops)_$(tests)"; "Case $(tops)_$(tests): the release ID was incorrect, expected $(expected_checksum) vs. actual $(test_read.r_$(tops)_$(tests)[releaseId])" - if => "!correct_release_$(tops)_$(tests)"; + if => "!correct_release_$(tops)_$(tests)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/001.cf b/tests/acceptance/01_vars/01_basic/001.cf index 2ab2a15c17..c9c9060e7b 100644 --- a/tests/acceptance/01_vars/01_basic/001.cf +++ b/tests/acceptance/01_vars/01_basic/001.cf @@ -3,50 +3,52 @@ # Test simple variables # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "ten" int => "10"; - "ten[ten]" int => "11"; - "nine" string => "hello", + "ten" int => "10"; + "ten[ten]" int => "11"; + + "nine" + string => "hello", policy => "free"; - "nine" int => "9", + + "nine" + int => "9", policy => "free"; } ####################################################### - bundle agent check { classes: - "ok_10" not => strcmp("$(test.ten)", "$(test.ten[ten])"); - "ok" and => { "ok_10", strcmp("$(test.nine)", "9") }; + "ok_10" not => strcmp("$(test.ten)", "$(test.ten[ten])"); + "ok" and => { "ok_10", strcmp("$(test.nine)", "9") }; reports: DEBUG:: "ten == $(test.ten)"; "ten[ten] == $(test.ten[ten])"; "nine == $(test.nine)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/009.cf b/tests/acceptance/01_vars/01_basic/009.cf index 939e3f91ba..b1a5f56701 100644 --- a/tests/acceptance/01_vars/01_basic/009.cf +++ b/tests/acceptance/01_vars/01_basic/009.cf @@ -3,48 +3,52 @@ # Test simple variables failures # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "zero_p" real => "0e2345678"; # Exponent too big, but still zero - "zero_n" real => "0e-2345678"; # Exponent too big, but still zero + "zero_p" real => "0e2345678"; + + # Exponent too big, but still zero + "zero_n" real => "0e-2345678"; + + # Exponent too big, but still zero } ####################################################### - bundle agent check { classes: - "ok" and => { - isgreaterthan("$(test.zero_p)", "-0.1"), - islessthan("$(test.zero_p)", "0.1"), - isgreaterthan("$(test.zero_n)", "-0.1"), - islessthan("$(test.zero_n)", "0.1"), + "ok" + and => { + isgreaterthan("$(test.zero_p)", "-0.1"), + islessthan("$(test.zero_p)", "0.1"), + isgreaterthan("$(test.zero_n)", "-0.1"), + islessthan("$(test.zero_n)", "0.1"), }; + reports: DEBUG:: "zero_p == $(test.zero_p)"; "zero_n == $(test.zero_n)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/010.cf b/tests/acceptance/01_vars/01_basic/010.cf index bed3a728df..6b7d149232 100644 --- a/tests/acceptance/01_vars/01_basic/010.cf +++ b/tests/acceptance/01_vars/01_basic/010.cf @@ -3,50 +3,53 @@ # Test nested functions # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "oct2" string => '20'; - "oct4" slist => { '11', '12' }; - "separator" string => ","; - "prefix" string => "10.${oct2}.20"; - "temp_namelist" slist => { " ", @(oct4) }; - "foo" slist => splitstring ( - join("${separator}${prefix}", "temp_namelist"), - "$(separator)", - "999999999" + "oct2" string => '20'; + "oct4" slist => { '11', '12' }; + "separator" string => ","; + "prefix" string => "10.${oct2}.20"; + "temp_namelist" slist => { " ", @(oct4) }; + + "foo" + slist => splitstring( + join("${separator}${prefix}", "temp_namelist"), + "$(separator)", + "999999999" + ); + + "nameserv" + slist => grep( + "^[^\s]+$", join(escape("${separator}${prefix}"), "temp_namelist") ); - "nameserv" slist => grep ("^[^\s]+$", join(escape("${separator}${prefix}"), "temp_namelist") ); } ####################################################### - bundle agent check { classes: - "ok" expression => "any"; + "ok" expression => "any"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/012.cf b/tests/acceptance/01_vars/01_basic/012.cf index 8e5f0555d0..7fd25317f7 100644 --- a/tests/acceptance/01_vars/01_basic/012.cf +++ b/tests/acceptance/01_vars/01_basic/012.cf @@ -3,43 +3,41 @@ # Compilation test of strings that end with a \ - issue 690 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "foo" string => "simple"; - "baz" string => "s\imple"; - "gar" string => "s\\imple"; - "goo" string => "s\\"; - "boo" string => "\\e"; - "zoo" string => "\\"; + "foo" string => "simple"; + "baz" string => "s\imple"; + "gar" string => "s\\imple"; + "goo" string => "s\\"; + "boo" string => "\\e"; + "zoo" string => "\\"; } bundle agent check { classes: - "ok" expression => "any"; + "ok" expression => "any"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/013.cf b/tests/acceptance/01_vars/01_basic/013.cf index 3217f04edc..4bf5fdfc56 100644 --- a/tests/acceptance/01_vars/01_basic/013.cf +++ b/tests/acceptance/01_vars/01_basic/013.cf @@ -3,64 +3,64 @@ # Test that 'classes' body works on 'vars' promises # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "foo" + "foo" string => execresult("/nonexisting", "noshell"), classes => setclasses("nonexisting_t", "nonexisting_f"); - "bar" + "bar" string => execresult("$(G.true)", "noshell"), classes => setclasses("true_t", "true_f"); } -body classes setclasses(t,f) +body classes setclasses(t, f) { - promise_repaired => { "$(t)" }; - promise_kept => { "$(t)" }; - repair_failed => { "$(f)" }; - repair_denied => { "$(f)" }; - repair_timeout => { "$(f)" }; + promise_repaired => { "$(t)" }; + promise_kept => { "$(t)" }; + repair_failed => { "$(f)" }; + repair_denied => { "$(f)" }; + repair_timeout => { "$(f)" }; } ####################################################### - bundle agent check { classes: - "ok" expression => "!nonexisting_f.!nonexisting_t.true_t.!true_f"; + "ok" expression => "!nonexisting_f.!nonexisting_t.true_t.!true_f"; reports: DEBUG.nonexisting_t:: "nonexisting_t"; + DEBUG.nonexisting_f:: "nonexisting_f"; + DEBUG.true_t:: "true_t"; + DEBUG.true_f:: "true_f"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/105.cf b/tests/acceptance/01_vars/01_basic/105.cf index 1d8beeeb69..11b874b412 100644 --- a/tests/acceptance/01_vars/01_basic/105.cf +++ b/tests/acceptance/01_vars/01_basic/105.cf @@ -3,52 +3,53 @@ # Test Scoping of "this" variables (issue 349) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - # $(this.promiser) is not available in this context - "not_valid" not => strcmp("xyzzy", "$(this.promiser)"); - "valid" expression => strcmp("xyzzy", "$(this.promiser)"); - "any_promiser" and => { "not_valid", "valid" }; - "ok" not => "any_promiser"; + # $(this.promiser) is not available in this context + "not_valid" not => strcmp("xyzzy", "$(this.promiser)"); + "valid" expression => strcmp("xyzzy", "$(this.promiser)"); + "any_promiser" and => { "not_valid", "valid" }; + "ok" not => "any_promiser"; reports: DEBUG.not_valid:: "not_valid IS set (and should not be)"; + DEBUG.!not_valid:: "not_valid is not set (and should not be)"; + DEBUG.valid:: "valid IS set (and should not be)"; + DEBUG.!valid:: "valid is not set (and should not be)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/106.cf b/tests/acceptance/01_vars/01_basic/106.cf index 1481fbf916..3b5b17c536 100644 --- a/tests/acceptance/01_vars/01_basic/106.cf +++ b/tests/acceptance/01_vars/01_basic/106.cf @@ -3,42 +3,43 @@ # Test arrays with list-specified indices (issue 692) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "subout" string => execresult("$(sys.cf_agent) -Kf $(this.promise_filename).sub", "useshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", "useshell" + ); } ####################################################### - bundle agent check { classes: - "ok" not => regcmp(".*Redefinition.*", "$(test.subout)"); + "ok" not => regcmp(".*Redefinition.*", "$(test.subout)"); reports: DEBUG:: "$(test.subout)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/107.cf b/tests/acceptance/01_vars/01_basic/107.cf index 88e5f8501a..6e0d6e3c17 100644 --- a/tests/acceptance/01_vars/01_basic/107.cf +++ b/tests/acceptance/01_vars/01_basic/107.cf @@ -1,35 +1,40 @@ # Test that function call with computed if does not lead to incorrect # use of values (Mantis #864) (Mantis #1084) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { vars: - "subout" string => execresult("$(sys.cf_agent) -Kf $(this.promise_filename).sub", "useshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", "useshell" + ); } bundle agent check { classes: - "ok" not => regcmp(".*Unable to parse class expression.*", "$(test.subout)"); + "ok" + not => regcmp(".*Unable to parse class expression.*", "$(test.subout)"); reports: DEBUG:: "$(test.subout)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/108.cf b/tests/acceptance/01_vars/01_basic/108.cf index d6ef47c8a7..b94e4885b3 100644 --- a/tests/acceptance/01_vars/01_basic/108.cf +++ b/tests/acceptance/01_vars/01_basic/108.cf @@ -1,34 +1,35 @@ # Test that variables can be passed across bundles and namespaces - body common control { - inputs => { "../../default.sub.cf", "108.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "108.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { methods: - "namespaced" usebundle => ns108:pass($(init.dummy)); + "namespaced" usebundle => ns108:pass($(init.dummy)); } bundle agent check { classes: - "ok" expression => strcmp("$(init.dummy)", "$(ns108:pass.passed_dummy)"); + "ok" expression => strcmp("$(init.dummy)", "$(ns108:pass.passed_dummy)"); reports: DEBUG:: "We passed '$(init.dummy)' to ns108:pass() and it recorded '$(ns108:pass.passed_dummy)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/109.cf b/tests/acceptance/01_vars/01_basic/109.cf index 70868f2bd0..d501f94679 100644 --- a/tests/acceptance/01_vars/01_basic/109.cf +++ b/tests/acceptance/01_vars/01_basic/109.cf @@ -1,34 +1,35 @@ # Test that variables can be passed across bundles and namespaces - body common control { - inputs => { "../../default.sub.cf", "109.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "109.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { methods: - "namespaced" usebundle => ns109:pass($(init.dummy)); + "namespaced" usebundle => ns109:pass($(init.dummy)); } bundle agent check { classes: - "ok" expression => strcmp("$(init.dummy)", "$(ns109:pass.passed_dummy)"); + "ok" expression => strcmp("$(init.dummy)", "$(ns109:pass.passed_dummy)"); reports: DEBUG:: "We passed '$(init.dummy)' to ns109:pass() and it recorded '$(ns109:pass.passed_dummy)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/110.cf b/tests/acceptance/01_vars/01_basic/110.cf index bdee0e15b6..21ca3e4c59 100644 --- a/tests/acceptance/01_vars/01_basic/110.cf +++ b/tests/acceptance/01_vars/01_basic/110.cf @@ -1,35 +1,37 @@ # Test that variables can be passed across bundles and namespaces - body common control { - inputs => { "../../default.sub.cf", "110.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "110.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { methods: - "namespaced" usebundle => ns110:pass($(init.dummy)), + "namespaced" + usebundle => ns110:pass($(init.dummy)), useresult => "nsresult"; } bundle agent check { classes: - "ok" expression => strcmp("$(init.dummy)", "$(test.nsresult[dummy])"); + "ok" expression => strcmp("$(init.dummy)", "$(test.nsresult[dummy])"); reports: DEBUG:: "We passed '$(init.dummy)' to ns110:pass() and it returned '$(test.nsresult[dummy])'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/111.cf b/tests/acceptance/01_vars/01_basic/111.cf index b5153a7bd9..2c36b282b5 100644 --- a/tests/acceptance/01_vars/01_basic/111.cf +++ b/tests/acceptance/01_vars/01_basic/111.cf @@ -4,21 +4,21 @@ # (cf redmine #2182) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### body classes if_touched(x) { - visited:: - promise_repaired => { "revisited" }; - !visited:: - promise_repaired => { "visited" }; + visited:: + promise_repaired => { "revisited" }; + + !visited:: + promise_repaired => { "visited" }; } ####################################################### @@ -30,19 +30,16 @@ bundle agent init bundle agent test { commands: - "$(G.echo) restart" - classes => if_touched("called"); + "$(G.echo) restart" classes => if_touched("called"); methods: - "any" usebundle => call; - + "any" usebundle => call; } bundle agent call { commands: - "$(G.echo) restart" - classes => if_touched("called"); + "$(G.echo) restart" classes => if_touched("called"); } ####################################################### @@ -55,11 +52,13 @@ bundle agent check reports: DEBUG.visited:: "visited defined"; + DEBUG.revisited:: "revisited defined"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/CFE-2191.cf b/tests/acceptance/01_vars/01_basic/CFE-2191.cf index b93d490af7..4157aab8eb 100644 --- a/tests/acceptance/01_vars/01_basic/CFE-2191.cf +++ b/tests/acceptance/01_vars/01_basic/CFE-2191.cf @@ -1,41 +1,43 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent init { vars: - "suffix" string => "devel"; + "suffix" string => "devel"; } + bundle agent test { meta: - "description" -> { "CFE-2191" } - string => "Test that expansion of a nested variable in another bundle expands to the expected value"; + "description" -> { "CFE-2191" } + string => "Test that expansion of a nested variable in another bundle expands to the expected value"; } ########################################################### - bundle agent check { - vars: - "expected" string => "___.___"; - "var_devel" string => "___"; + "expected" string => "___.___"; + "var_devel" string => "___"; methods: - "Pass/Fail" - # First, init.suffix is expanded (to devel) - # Then, $(var_devel) is expanded (to ___) - usebundle => dcs_check_strcmp( "$(expected)", "$(var_$(init.suffix)).___", $(this.promise_filename), "no"); + "Pass/Fail" + # First, init.suffix is expanded (to devel) + # Then, $(var_devel) is expanded (to ___) + usebundle => dcs_check_strcmp( + "$(expected)", + "$(var_$(init.suffix)).___", + $(this.promise_filename), + "no" + ); reports: - DEBUG|EXTRA:: + DEBUG|EXTRA:: "Expect '$(expected)', got '$(var_$(test.suffix)).___'"; - } diff --git a/tests/acceptance/01_vars/01_basic/CFE-628.cf b/tests/acceptance/01_vars/01_basic/CFE-628.cf index e930e65c9d..f3bdfb9853 100644 --- a/tests/acceptance/01_vars/01_basic/CFE-628.cf +++ b/tests/acceptance/01_vars/01_basic/CFE-628.cf @@ -3,42 +3,40 @@ # Test evaluation order expectations # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent test { meta: - "description" -> { "CFE-628" } - string => "Test that the output is as expected"; - - "test_skip_needs_work" -> { "CFE-628" } - string => "windows", - meta => { "CFE-628" }; + "description" -> { "CFE-628" } + string => "Test that the output is as expected"; + "test_skip_needs_work" -> { "CFE-628" } + string => "windows", + meta => { "CFE-628" }; } ########################################################### - bundle agent check { vars: - "cmd" string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub"; + "cmd" string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub"; methods: - - "Pass/Fail" - usebundle => dcs_passif_output( - ".*found_the_file.*", # wanted, - ".*didnt_find_the_file.*", # unwanted, - "$(cmd)", # command, - $(this.promise_filename) ); - + "Pass/Fail" + usebundle => dcs_passif_output( + ".*found_the_file.*", + # wanted, + ".*didnt_find_the_file.*", + # unwanted, + "$(cmd)", + # command, + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/01_basic/access_classic_array_key_value_using_with.cf b/tests/acceptance/01_vars/01_basic/access_classic_array_key_value_using_with.cf index cfe747a9db..f621492799 100644 --- a/tests/acceptance/01_vars/01_basic/access_classic_array_key_value_using_with.cf +++ b/tests/acceptance/01_vars/01_basic/access_classic_array_key_value_using_with.cf @@ -3,55 +3,51 @@ # Test the "with" promise attribute # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent test { meta: - "description" -> { "CFE-3223" } - string => "Test that with can be used in the index of a classic array to access the value"; + "description" -> { "CFE-3223" } + string => "Test that with can be used in the index of a classic array to access the value"; - "test_soft_fail" - string => "any", - meta => { "CFE-3223" }; + "test_soft_fail" + string => "any", + meta => { "CFE-3223" }; vars: - "interfaces" slist => { "eth0", "wlan0", "wlan0.1" }; - - "ip[eth0]" string => "1.1.1.1"; - "ip[wlan0]" string => "2.1.1.1"; - "ip[wlan0_1]" string => "3.1.1.1"; - - "with[$(interfaces)]" - string => "$(ip[$(with)])", - with => canonify( $(interfaces) ), - comment => "This is a bug. This classic array is not generated when I try to dereference an array value using with."; - + "interfaces" slist => { "eth0", "wlan0", "wlan0.1" }; + "ip[eth0]" string => "1.1.1.1"; + "ip[wlan0]" string => "2.1.1.1"; + "ip[wlan0_1]" string => "3.1.1.1"; + + "with[$(interfaces)]" + string => "$(ip[$(with)])", + with => canonify($(interfaces)), + comment => "This is a bug. This classic array is not generated when I try to dereference an array value using with."; } ########################################################### - bundle agent check { classes: - "_pass" and => { - isvariable( "test.with[eth0]" ), - isvariable( "test.with[wlan0]" ), - isvariable( "test.with[wlan0.1]" )}; + "_pass" + and => { + isvariable("test.with[eth0]"), + isvariable("test.with[wlan0]"), + isvariable("test.with[wlan0.1]"), + }; methods: - "Pass/Fail" usebundle => dcs_passif("_pass", $(this.promise_filename) ); + "Pass/Fail" usebundle => dcs_passif("_pass", $(this.promise_filename)); reports: - !_pass:: 'One or more of "test.with[eth0]", "test.with[wlan0]", or "test.with[wlan0.1]" is not defined'; } diff --git a/tests/acceptance/01_vars/01_basic/calling_bundle.cf b/tests/acceptance/01_vars/01_basic/calling_bundle.cf index fab86612a3..7805b244b1 100644 --- a/tests/acceptance/01_vars/01_basic/calling_bundle.cf +++ b/tests/acceptance/01_vars/01_basic/calling_bundle.cf @@ -1,13 +1,11 @@ # Test $(this.calling_bundle) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { methods: @@ -17,16 +15,13 @@ bundle agent init } ####################################################### - bundle agent check { vars: - "expected" - string => "default:init/new_namespace:A/B"; + "expected" string => "default:init/new_namespace:A/B"; classes: - "ok" - expression => strcmp("$(init.return_var[1])", "$(expected)"); + "ok" expression => strcmp("$(init.return_var[1])", "$(expected)"); reports: DEBUG:: @@ -34,16 +29,16 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } body file control { - namespace => "new_namespace"; + namespace => "new_namespace"; } - bundle agent A { methods: @@ -52,14 +47,11 @@ bundle agent A useresult => "return_var"; reports: - "$(this.calling_bundle)/$(return_var[1])" - bundle_return_value_index => "1"; - + "$(this.calling_bundle)/$(return_var[1])" bundle_return_value_index => "1"; } bundle agent B { reports: - "$(this.calling_bundle)/$(this.bundle)" - bundle_return_value_index => "1"; + "$(this.calling_bundle)/$(this.bundle)" bundle_return_value_index => "1"; } diff --git a/tests/acceptance/01_vars/01_basic/can_not_define_variables_in_remote_bundles.cf b/tests/acceptance/01_vars/01_basic/can_not_define_variables_in_remote_bundles.cf index 2bf9a2a69e..ea9f92b962 100644 --- a/tests/acceptance/01_vars/01_basic/can_not_define_variables_in_remote_bundles.cf +++ b/tests/acceptance/01_vars/01_basic/can_not_define_variables_in_remote_bundles.cf @@ -3,49 +3,52 @@ # Test that it is invalid to define variables in remote bundles # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "check.variable" - string => "is defined from bundle $(this.bundle)", - comment => "This should not be allowed, perhaps the first part + "check.variable" + string => "is defined from bundle $(this.bundle)", + comment => "This should not be allowed, perhaps the first part of the variable should be canonified, or it should be a parser error"; - "prefix.variable" - string => "value-ok", - comment => "This should be allowed because there is no such + "prefix.variable" + string => "value-ok", + comment => "This should be allowed because there is no such bundle called 'prefix'"; - "array[with.a.dot]" - string => "value", - comment => "dots should be allowed in array keys"; + "array[with.a.dot]" + string => "value", + comment => "dots should be allowed in array keys"; } -####################################################### +####################################################### bundle agent check { meta: - "description" -> {"CFE-1915"} - string => "Test that it is invalid to define variables in remote bundles"; + "description" -> { "CFE-1915" } + string => "Test that it is invalid to define variables in remote bundles"; classes: - "variable_defined" expression => isvariable("variable"); - "variable_has_content" expression => regcmp(".*", "$(variable)"); - "prefixed_var_fail" expression => not(strcmp("$(prefix.variable)", "value-ok")); - "array_with_a_dot_fail" expression => not(strcmp("$(test.array[with.a.dot])", "value")); + "variable_defined" expression => isvariable("variable"); + "variable_has_content" expression => regcmp(".*", "$(variable)"); + + "prefixed_var_fail" + expression => not(strcmp("$(prefix.variable)", "value-ok")); + + "array_with_a_dot_fail" + expression => not(strcmp("$(test.array[with.a.dot])", "value")); - "fail" expression => "(variable_defined|variable_has_content|prefixed_var_fail|array_with_a_dot_fail)"; + "fail" + expression => "(variable_defined|variable_has_content|prefixed_var_fail|array_with_a_dot_fail)"; reports: DEBUG:: @@ -55,8 +58,7 @@ bundle agent check "'variable' in bundle '$(this.bundle)' = '$(variable)'" if => "variable_has_content"; - "'prefix.variable' = $(prefix.variable)" - if => "prefixed_var_fail"; + "'prefix.variable' = $(prefix.variable)" if => "prefixed_var_fail"; "array[with.a.dot] has the value '$(test.array[with.a.dot])'" if => "array_with_a_dot_fail"; diff --git a/tests/acceptance/01_vars/01_basic/cpusockets.cf b/tests/acceptance/01_vars/01_basic/cpusockets.cf index c9167831ed..dcf3874f5d 100644 --- a/tests/acceptance/01_vars/01_basic/cpusockets.cf +++ b/tests/acceptance/01_vars/01_basic/cpusockets.cf @@ -3,7 +3,6 @@ # Test that sys.cpusockets variable exists on Linux # ####################################################### - body common control { inputs => { "../../default.sub.cf" }; @@ -12,7 +11,6 @@ body common control } ####################################################### - bundle agent test { meta: @@ -25,12 +23,10 @@ bundle agent test } ####################################################### - bundle agent check { classes: - "ok" - expression => isvariable("sys.cpusockets"); + "ok" expression => isvariable("sys.cpusockets"); methods: "any" diff --git a/tests/acceptance/01_vars/01_basic/double_expansion_list.cf b/tests/acceptance/01_vars/01_basic/double_expansion_list.cf index 34fd0a5d36..1d10ad711b 100755 --- a/tests/acceptance/01_vars/01_basic/double_expansion_list.cf +++ b/tests/acceptance/01_vars/01_basic/double_expansion_list.cf @@ -3,7 +3,6 @@ # Test double expansion of list from remote bundle (ENT-9491) # ############################################################################## - body common control { bundlesequence => { "check" }; @@ -31,16 +30,13 @@ bundle agent test(parent_bundle) "$($(parent_bundle)#lst)" comment => "We force mangle the variable, it works, but should this be possible?", bundle_return_value_index => "qux"; - } bundle agent check { vars: - "str" - string => "EXPANDED"; - "lst" - slist => { "EXPANDED" }; + "str" string => "EXPANDED"; + "lst" slist => { "EXPANDED" }; methods: "holder" @@ -48,17 +44,21 @@ bundle agent check useresult => "ret"; reports: - "$(this.promise_filename) Pass" - if => and(strcmp("$(ret[foo])", "EXPANDED"), - strcmp("$(ret[bar])", "EXPANDED"), - strcmp("$(ret[baz])", "EXPANDED"), - strcmp("$(ret[qux])", "EXPANDED")); + "$(this.promise_filename) Pass" + if => and( + strcmp("$(ret[foo])", "EXPANDED"), + strcmp("$(ret[bar])", "EXPANDED"), + strcmp("$(ret[baz])", "EXPANDED"), + strcmp("$(ret[qux])", "EXPANDED") + ); - "$(this.promise_filename) FAIL" - unless => and(strcmp("$(ret[foo])", "EXPANDED"), - strcmp("$(ret[bar])", "EXPANDED"), - strcmp("$(ret[qux])", "EXPANDED"), - strcmp("$(ret[baz])", "EXPANDED")); + "$(this.promise_filename) FAIL" + unless => and( + strcmp("$(ret[foo])", "EXPANDED"), + strcmp("$(ret[bar])", "EXPANDED"), + strcmp("$(ret[qux])", "EXPANDED"), + strcmp("$(ret[baz])", "EXPANDED") + ); DEBUG:: "$(const.dollar)($(const.dollar)(parent_bundle).str) => $(ret[foo])"; diff --git a/tests/acceptance/01_vars/01_basic/double_expansion_list_namespace.cf b/tests/acceptance/01_vars/01_basic/double_expansion_list_namespace.cf index 3553442985..d699de6be1 100755 --- a/tests/acceptance/01_vars/01_basic/double_expansion_list_namespace.cf +++ b/tests/acceptance/01_vars/01_basic/double_expansion_list_namespace.cf @@ -3,7 +3,6 @@ # Test double expansion of list from remote bundle with namespace (ENT-11923) # ############################################################################## - body common control { bundlesequence => { "bogus:check" }; @@ -37,10 +36,8 @@ body file control bundle agent check { vars: - "str" - string => "EXPANDED"; - "lst" - slist => { "EXPANDED" }; + "str" string => "EXPANDED"; + "lst" slist => { "EXPANDED" }; methods: "holder" @@ -48,15 +45,19 @@ bundle agent check useresult => "ret"; reports: - "$(this.promise_filename) Pass" - if => and(strcmp("$(ret[foo])", "EXPANDED"), - strcmp("$(ret[bar])", "EXPANDED"), - strcmp("$(ret[baz])", "EXPANDED")); + "$(this.promise_filename) Pass" + if => and( + strcmp("$(ret[foo])", "EXPANDED"), + strcmp("$(ret[bar])", "EXPANDED"), + strcmp("$(ret[baz])", "EXPANDED") + ); - "$(this.promise_filename) FAIL" - unless => and(strcmp("$(ret[foo])", "EXPANDED"), - strcmp("$(ret[bar])", "EXPANDED"), - strcmp("$(ret[baz])", "EXPANDED")); + "$(this.promise_filename) FAIL" + unless => and( + strcmp("$(ret[foo])", "EXPANDED"), + strcmp("$(ret[bar])", "EXPANDED"), + strcmp("$(ret[baz])", "EXPANDED") + ); default:DEBUG:: "$(const.dollar)($(const.dollar)(parent_namespace):$(const.dollar)(parent_bundle).str) => $(ret[foo])"; diff --git a/tests/acceptance/01_vars/01_basic/duplicate_bundles.cf b/tests/acceptance/01_vars/01_basic/duplicate_bundles.cf index 44b0956030..97b0135c33 100644 --- a/tests/acceptance/01_vars/01_basic/duplicate_bundles.cf +++ b/tests/acceptance/01_vars/01_basic/duplicate_bundles.cf @@ -1,34 +1,36 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - "one" usebundle => gvar( "x", "one" ); + "one" usebundle => gvar("x", "one"); + !FAIL:: - "two" usebundle => gvar( "y", "two" ); + "two" usebundle => gvar("y", "two"); } -bundle agent gvar ( name, value ) +bundle agent gvar(name, value) { vars: - "${name}" string => "${value}"; + "${name}" string => "${value}"; } bundle agent check { classes: - "pass_x" expression => strcmp( "one", "${gvar.x}" ); - "pass_y" expression => strcmp( "two", "${gvar.y}" ); + "pass_x" expression => strcmp("one", "${gvar.x}"); + "pass_y" expression => strcmp("two", "${gvar.y}"); methods: - "" usebundle => dcs_passif_expected("pass_x,pass_y", - "", - $(this.promise_filename)), + "" + usebundle => dcs_passif_expected( + "pass_x,pass_y", "", $(this.promise_filename) + ), inherit => "true"; reports: diff --git a/tests/acceptance/01_vars/01_basic/empty-splice-does-not-segfault.cf b/tests/acceptance/01_vars/01_basic/empty-splice-does-not-segfault.cf index 0380fe6c6d..7bf47ebf60 100644 --- a/tests/acceptance/01_vars/01_basic/empty-splice-does-not-segfault.cf +++ b/tests/acceptance/01_vars/01_basic/empty-splice-does-not-segfault.cf @@ -1,7 +1,7 @@ body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } @@ -11,12 +11,12 @@ bundle agent init bundle agent test { -reports: - "empty @{}"; + reports: + "empty @{}"; } bundle agent check { -reports: - "$(this.promise_filename) Pass"; + reports: + "$(this.promise_filename) Pass"; } diff --git a/tests/acceptance/01_vars/01_basic/fqhost_domain.cf b/tests/acceptance/01_vars/01_basic/fqhost_domain.cf index 7fbc61785d..62d6e42d12 100644 --- a/tests/acceptance/01_vars/01_basic/fqhost_domain.cf +++ b/tests/acceptance/01_vars/01_basic/fqhost_domain.cf @@ -3,7 +3,6 @@ # Test default:sys.fqhost with domain CFE-4053 # ############################################################## - body common control { domain => "cfengine.com"; @@ -17,7 +16,6 @@ bundle agent __main__ } ############################################################## - bundle agent check { reports: @@ -26,8 +24,8 @@ bundle agent check any:: "$(this.promise_filename) Pass" - if => strcmp( "$(sys.fqhost)", "$(sys.uqhost).cfengine.com" ); + if => strcmp("$(sys.fqhost)", "$(sys.uqhost).cfengine.com"); "$(this.promise_filename) FAIL" - unless => strcmp( "$(sys.fqhost)", "$(sys.uqhost).cfengine.com" ); + unless => strcmp("$(sys.fqhost)", "$(sys.uqhost).cfengine.com"); } diff --git a/tests/acceptance/01_vars/01_basic/long_string_from_embedded.cf b/tests/acceptance/01_vars/01_basic/long_string_from_embedded.cf index 57d94778ad..9758f573bd 100644 --- a/tests/acceptance/01_vars/01_basic/long_string_from_embedded.cf +++ b/tests/acceptance/01_vars/01_basic/long_string_from_embedded.cf @@ -4,44 +4,44 @@ # Redmine:3957 (https://cfengine.com/dev/issues/3957) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { vars: - "keys" slist => { -"ssh-dss YavBsyK3sHDac4Gj4nDbVH9E7OfRPi16DADNOWGKEjWiBB0cCe0UY6xxEgcYuwOOl8HUGqqzLOByvUbo1hENDQldKFt8N7WIb2E9gXFtGm0Sf0NlYARALj1nhLju9hodpGxkr4vKioW1fZQBmBqsI7Ky8ZhzU5p4CAm4uCbxAZuiIhDTAcxj7RlDy3fe9WBw7v0cSIbu8E3zEbPn0VQjTduLCJtFOb5LvUxpxUsHMhHu0xS8DvXIwf7l83cQ0XZtwyIgbF3ZxjIZaPyYhKZRAV1qCze4BlcOerJeVYOiKjpXJlOoBprxy2SfEYVS4Khun0efkmsmBAfllKUUNCqsK9j6oWo7BvNbXqzkl2ULJd6h0LNy9jW8IXnnrfWknLGa7lksVmL3afSAufDAb7yRESaUP5KmcD3ghP3Nvu7fy9hz7nIAPgj2dQOwnFRbkv9Svoi9YmCtvBWYAcwIUVNJBmwXe5j5xJyt5vOyRSI2ooJ9mk69UOCsIM8PEnEXwtHcsg9fDjfu9ChFY2HWZPWeNXH05SATnSyLgclQsZcazhQXPoxZbcqR80mfuRX9ymEzNwZJ1jJUERnj9PZkSInu6mFVRjTaQjg8yvqMGRxWknP8aURCDh5rr4Na23jULVVI66heWOi7nzLqBg5U8GsbLsocM8zBam8bhXfU0KvpBo5wlUtHnDWHoMlS3ktr25ldrp3zLuywhHe5vGUbg2E0gr4xB3oPAyaDa3MGQiVXPfngu5CJhwIXmeN5JtIBA0S46ihg7lQ6IU8kAaRHwhWh3TokoNFOYE8R5i24gpYNF8dgCRGqSZIT5V7wuR3qG1Wau963ILuX8EFOSu7xDc5qnGTem3FwICTpSdnZNqpzRt4Ipqsn4Pa2tFFpHlzDwKFRPS7r8v4QX7acqdTSCUOuZ68GwDRlvHIz5mHUf1XLY3FH2InuWFsonJAZwmEbX5evWXFgyJHFlplQcGJvyNdL0T6oBmbG3ssSMoRnqnsk8XjGWtUyvYoQmOY8HWlMhf4V3v78C4k4TnCbN4LmnDYaDcnXMejrUMYDk6QwW3fdTF5ZyjJMy4ANu2fJfKysZMc1Cc== root@host1", -"ssh-dss a58AZSxQlmcq33EBCW1GuhpkYCgUfr7o5A1arQZ2dr8I4kldCF76mpl6o2CFthZs4YUU8LewbIDDPqjhS2WwafTXeMEvPMtmLufk6E5njNy2WQtAnmGc9R21qIteTgikY9ubRCM3hlhzJ1wGSKCsE5oBHDQC0thk1ljJGHzsEl0AuVClkUq3yz4eWAsiRdbD9QY7ddD6zA61aHomuczKU5F0VvyO8gRQmWV7b6lysoUFcMgCPVf3UaDdg7L7vvBVkQN2vGCh9CCJz5OkBShlZVNaAXd5TkKJNmsTuBDscPyxeCBAk8sai69f1NNtTeAyWTtSu1KiqTDvD9aal93MhpZnPdOZzNr7etK4C7HuPD0uFjdvKZy1H55rpwNHnJ4GojqiNG1VvN5bGLa3sSLiKOngtMBCokdtHpZn2eHD7oLUROTIG3ZXqFGGvfKEP5zlpvJz3392n4PDQ7EKuNFPhyNQpVXEIAQEDcmeWMopVTGezLoFJG01hKMPxs5QWF7qetVLi1pCjmlUpqgE8c81WGxvMe7ooMtQbeVNulX3qBC3rZhYKtk0R5AA8JxmxHSLYlLFbtnR1PA97hnRvnvlfk92i7WL1hjJsMl29LOrubi554Dr9N2uVUrCFcPZMK45PY0TiRH82AKFmkM8mbM0rndJxoJobZsqRAGHVIkcS53hxMT69liRxlCyubwcxgDaqmeQnJU2Ug0YyFs1uxt4NT9laJ0CO2IxhkbmGeDGw1FJqKyc8Haov263cFMcB97I3gyNHccsAynQnxpMS1ltTFXalghuochdue4unbq0Ty2PfS4jPMkavBlMYN8UZdnyZHuUhycwBJri1Grv5kf2SP00P6NQhuB8kwjqoTG8ay5fKWvhDrVetd7tPuj4dMouHuDeaLJInc7Cz0S5tQOuMfRhpPqk1E8A0YnuNCyPDNuW75rkXZkxP9cYSVWeDa1wgOyNLZDTzYts82qiu9kxLbZ184jowJ8rru4UB20JRtoehnD2nGU1NfegD1qOBgQHtDuB18xggfvOgvUNXBrQpICSz0JqszpftAgV5TJq1FjOdjUo1kOCFuqqi6C4S0Siho== root@host2",}; - + "keys" + slist => { + "ssh-dss YavBsyK3sHDac4Gj4nDbVH9E7OfRPi16DADNOWGKEjWiBB0cCe0UY6xxEgcYuwOOl8HUGqqzLOByvUbo1hENDQldKFt8N7WIb2E9gXFtGm0Sf0NlYARALj1nhLju9hodpGxkr4vKioW1fZQBmBqsI7Ky8ZhzU5p4CAm4uCbxAZuiIhDTAcxj7RlDy3fe9WBw7v0cSIbu8E3zEbPn0VQjTduLCJtFOb5LvUxpxUsHMhHu0xS8DvXIwf7l83cQ0XZtwyIgbF3ZxjIZaPyYhKZRAV1qCze4BlcOerJeVYOiKjpXJlOoBprxy2SfEYVS4Khun0efkmsmBAfllKUUNCqsK9j6oWo7BvNbXqzkl2ULJd6h0LNy9jW8IXnnrfWknLGa7lksVmL3afSAufDAb7yRESaUP5KmcD3ghP3Nvu7fy9hz7nIAPgj2dQOwnFRbkv9Svoi9YmCtvBWYAcwIUVNJBmwXe5j5xJyt5vOyRSI2ooJ9mk69UOCsIM8PEnEXwtHcsg9fDjfu9ChFY2HWZPWeNXH05SATnSyLgclQsZcazhQXPoxZbcqR80mfuRX9ymEzNwZJ1jJUERnj9PZkSInu6mFVRjTaQjg8yvqMGRxWknP8aURCDh5rr4Na23jULVVI66heWOi7nzLqBg5U8GsbLsocM8zBam8bhXfU0KvpBo5wlUtHnDWHoMlS3ktr25ldrp3zLuywhHe5vGUbg2E0gr4xB3oPAyaDa3MGQiVXPfngu5CJhwIXmeN5JtIBA0S46ihg7lQ6IU8kAaRHwhWh3TokoNFOYE8R5i24gpYNF8dgCRGqSZIT5V7wuR3qG1Wau963ILuX8EFOSu7xDc5qnGTem3FwICTpSdnZNqpzRt4Ipqsn4Pa2tFFpHlzDwKFRPS7r8v4QX7acqdTSCUOuZ68GwDRlvHIz5mHUf1XLY3FH2InuWFsonJAZwmEbX5evWXFgyJHFlplQcGJvyNdL0T6oBmbG3ssSMoRnqnsk8XjGWtUyvYoQmOY8HWlMhf4V3v78C4k4TnCbN4LmnDYaDcnXMejrUMYDk6QwW3fdTF5ZyjJMy4ANu2fJfKysZMc1Cc== root@host1", + "ssh-dss a58AZSxQlmcq33EBCW1GuhpkYCgUfr7o5A1arQZ2dr8I4kldCF76mpl6o2CFthZs4YUU8LewbIDDPqjhS2WwafTXeMEvPMtmLufk6E5njNy2WQtAnmGc9R21qIteTgikY9ubRCM3hlhzJ1wGSKCsE5oBHDQC0thk1ljJGHzsEl0AuVClkUq3yz4eWAsiRdbD9QY7ddD6zA61aHomuczKU5F0VvyO8gRQmWV7b6lysoUFcMgCPVf3UaDdg7L7vvBVkQN2vGCh9CCJz5OkBShlZVNaAXd5TkKJNmsTuBDscPyxeCBAk8sai69f1NNtTeAyWTtSu1KiqTDvD9aal93MhpZnPdOZzNr7etK4C7HuPD0uFjdvKZy1H55rpwNHnJ4GojqiNG1VvN5bGLa3sSLiKOngtMBCokdtHpZn2eHD7oLUROTIG3ZXqFGGvfKEP5zlpvJz3392n4PDQ7EKuNFPhyNQpVXEIAQEDcmeWMopVTGezLoFJG01hKMPxs5QWF7qetVLi1pCjmlUpqgE8c81WGxvMe7ooMtQbeVNulX3qBC3rZhYKtk0R5AA8JxmxHSLYlLFbtnR1PA97hnRvnvlfk92i7WL1hjJsMl29LOrubi554Dr9N2uVUrCFcPZMK45PY0TiRH82AKFmkM8mbM0rndJxoJobZsqRAGHVIkcS53hxMT69liRxlCyubwcxgDaqmeQnJU2Ug0YyFs1uxt4NT9laJ0CO2IxhkbmGeDGw1FJqKyc8Haov263cFMcB97I3gyNHccsAynQnxpMS1ltTFXalghuochdue4unbq0Ty2PfS4jPMkavBlMYN8UZdnyZHuUhycwBJri1Grv5kf2SP00P6NQhuB8kwjqoTG8ay5fKWvhDrVetd7tPuj4dMouHuDeaLJInc7Cz0S5tQOuMfRhpPqk1E8A0YnuNCyPDNuW75rkXZkxP9cYSVWeDa1wgOyNLZDTzYts82qiu9kxLbZ184jowJ8rru4UB20JRtoehnD2nGU1NfegD1qOBgQHtDuB18xggfvOgvUNXBrQpICSz0JqszpftAgV5TJq1FjOdjUo1kOCFuqqi6C4S0Siho== root@host2", + }; } ####################################################### - bundle agent check { classes: - "ok" expression => "any", - comment => "If we made it to here, we didn't crash"; + "ok" + expression => "any", + comment => "If we made it to here, we didn't crash"; reports: DEBUG:: "$(this.bundle): Got key $(test.keys)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/multi_index_arrays_variable_lookup.cf b/tests/acceptance/01_vars/01_basic/multi_index_arrays_variable_lookup.cf index 9908a1f27a..83cf399794 100644 --- a/tests/acceptance/01_vars/01_basic/multi_index_arrays_variable_lookup.cf +++ b/tests/acceptance/01_vars/01_basic/multi_index_arrays_variable_lookup.cf @@ -4,48 +4,42 @@ # Redmine#6674: Conflation of multi-index entries in arrays # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: "file[22][0]" string => "something"; "file[2][20]" string => "anything"; - "a[10]" string => "a"; "a1[0]" string => "b"; } ####################################################### - bundle agent check { classes: - "fail_1" expression => strcmp("${test.file[22][0]}", "${test.file[2][20]}"); - "fail_2" expression => strcmp("${test.a[10]}", "${test.a1[0]}"); - - "failure" or => { "fail_1", "fail_2" }; + "fail_1" expression => strcmp("${test.file[22][0]}", "${test.file[2][20]}"); + "fail_2" expression => strcmp("${test.a[10]}", "${test.a1[0]}"); + "failure" or => { "fail_1", "fail_2" }; reports: failure:: "$(this.promise_filename) FAIL"; + !failure:: "$(this.promise_filename) Pass"; - } diff --git a/tests/acceptance/01_vars/01_basic/namespaces/bundle_qualified_refs/1/main.cf b/tests/acceptance/01_vars/01_basic/namespaces/bundle_qualified_refs/1/main.cf index 01242d5de6..dfc322a0d5 100644 --- a/tests/acceptance/01_vars/01_basic/namespaces/bundle_qualified_refs/1/main.cf +++ b/tests/acceptance/01_vars/01_basic/namespaces/bundle_qualified_refs/1/main.cf @@ -2,58 +2,62 @@ # single variable definition body file control { - inputs => { - "../../../../../default.sub.cf", - }; + inputs => { "../../../../../default.sub.cf" }; } + bundle agent __main__ # If this is the policy entry (cf-agent --file) then this bundle will be run by default. { methods: - "bundlesequence" usebundle => default("$(this.promise_filename)"); + "bundlesequence" usebundle => default("$(this.promise_filename)"); } bundle agent init { commands: windows:: - "$(G.dos2unix) $(this.promise_dirname)/expected_output.txt" -> { "ENT-10433" }; + "$(G.dos2unix) $(this.promise_dirname)/expected_output.txt" -> { + "ENT-10433" + }; } bundle agent test { meta: - "description" -> { "ENT-8817" } - string => "Bundle qualified variables should target the promisers namespace. This shows the case where a variable is NOT set in a bundle of the same name in the default namespace."; - -# NOTE THE ABSENCE OF A VARIABLE DEFINITION HERE + "description" -> { "ENT-8817" } + string => "Bundle qualified variables should target the promisers namespace. This shows the case where a variable is NOT set in a bundle of the same name in the default namespace."; + # NOTE THE ABSENCE OF A VARIABLE DEFINITION HERE methods: - "Test Reporting Namespaced Variables" - usebundle => example_space:test( $(G.testfile) ); + "Test Reporting Namespaced Variables" + usebundle => example_space:test($(G.testfile)); } bundle agent check { methods: - - "Pass/Fail" usebundle => dcs_check_diff("$(this.promise_dirname)/expected_output.txt", - $(G.testfile), - $(this.promise_filename)); + "Pass/Fail" + usebundle => dcs_check_diff( + "$(this.promise_dirname)/expected_output.txt", + $(G.testfile), + $(this.promise_filename) + ); } body file control { - namespace => "example_space"; + namespace => "example_space"; } bundle agent test(file) { vars: - "color" string => "#f5821f"; + "color" string => "#f5821f"; reports: - "Unqualified: The color is $(color)" report_to_file => "$(file)"; - "Bundle-qualified: The color is $(test.color)" report_to_file => "$(file)"; - "Fully-qualified: The color is $(example_space:test.color)" report_to_file => "$(file)"; + "Unqualified: The color is $(color)" report_to_file => "$(file)"; + "Bundle-qualified: The color is $(test.color)" report_to_file => "$(file)"; + + "Fully-qualified: The color is $(example_space:test.color)" + report_to_file => "$(file)"; } diff --git a/tests/acceptance/01_vars/01_basic/namespaces/bundle_qualified_refs/2/main.cf b/tests/acceptance/01_vars/01_basic/namespaces/bundle_qualified_refs/2/main.cf index fa548f6ba9..5489eb5cc9 100644 --- a/tests/acceptance/01_vars/01_basic/namespaces/bundle_qualified_refs/2/main.cf +++ b/tests/acceptance/01_vars/01_basic/namespaces/bundle_qualified_refs/2/main.cf @@ -2,59 +2,65 @@ # single variable definition body file control { - inputs => { - "../../../../../default.sub.cf", - }; + inputs => { "../../../../../default.sub.cf" }; } + bundle agent __main__ # If this is the policy entry (cf-agent --file) then this bundle will be run by default. { methods: - "bundlesequence" usebundle => default("$(this.promise_filename)"); + "bundlesequence" usebundle => default("$(this.promise_filename)"); } bundle agent init { commands: windows:: - "$(G.dos2unix) $(this.promise_dirname)/expected_output.txt" -> { "ENT-10433" }; + "$(G.dos2unix) $(this.promise_dirname)/expected_output.txt" -> { + "ENT-10433" + }; } bundle agent test { meta: - "description" -> { "ENT-8817" } - string => "Bundle qualified variables should target the promisers namespace. This shows the case where a variable is set in a bundle of the same name in the default namespace."; + "description" -> { "ENT-8817" } + string => "Bundle qualified variables should target the promisers namespace. This shows the case where a variable is set in a bundle of the same name in the default namespace."; vars: - "color" string => "#052569"; # THIS IS THE ONLY DIFFERENCE BETWEEN ../1/main.cf + "color" string => "#052569"; + # THIS IS THE ONLY DIFFERENCE BETWEEN ../1/main.cf methods: - "Test Reporting Namespaced Variables" - usebundle => example_space:test( $(G.testfile) ); + "Test Reporting Namespaced Variables" + usebundle => example_space:test($(G.testfile)); } bundle agent check { methods: - - "Pass/Fail" usebundle => dcs_check_diff( "$(this.promise_dirname)/expected_output.txt", - $(G.testfile), - $(this.promise_filename)); + "Pass/Fail" + usebundle => dcs_check_diff( + "$(this.promise_dirname)/expected_output.txt", + $(G.testfile), + $(this.promise_filename) + ); } body file control { - namespace => "example_space"; + namespace => "example_space"; } bundle agent test(file) { vars: - "color" string => "#f5821f"; + "color" string => "#f5821f"; reports: - "Unqualified: The color is $(color)" report_to_file => "$(file)"; - "Bundle-qualified: The color is $(test.color)" report_to_file => "$(file)"; - "Fully-qualified: The color is $(example_space:test.color)" report_to_file => "$(file)"; + "Unqualified: The color is $(color)" report_to_file => "$(file)"; + "Bundle-qualified: The color is $(test.color)" report_to_file => "$(file)"; + + "Fully-qualified: The color is $(example_space:test.color)" + report_to_file => "$(file)"; } diff --git a/tests/acceptance/01_vars/01_basic/namespaces/bundle_qualified_refs/3/main.cf b/tests/acceptance/01_vars/01_basic/namespaces/bundle_qualified_refs/3/main.cf index 4c76ecfa03..cbf1f24b26 100644 --- a/tests/acceptance/01_vars/01_basic/namespaces/bundle_qualified_refs/3/main.cf +++ b/tests/acceptance/01_vars/01_basic/namespaces/bundle_qualified_refs/3/main.cf @@ -1,74 +1,79 @@ # NOTE: This test is nearly identical to ../1/main.cf, the only difference is a # single variable definition - body file control { - inputs => { - "../../../../../default.sub.cf", - }; + inputs => { "../../../../../default.sub.cf" }; } + bundle agent __main__ # If this is the policy entry (cf-agent --file) then this bundle will be run by default. { methods: - "bundlesequence" usebundle => default("$(this.promise_filename)"); + "bundlesequence" usebundle => default("$(this.promise_filename)"); } + bundle agent my_bundle { vars: - "My_Variable" string => "WRONG VARIABLE VALUE"; + "My_Variable" string => "WRONG VARIABLE VALUE"; } + bundle agent test { meta: - "description" -> { "ENT-10397" } - string => concat( "The with attribute should be namespace aware.", - "This shows the case where a variable is set in a bundle of a", - "different name." ); + "description" -> { "ENT-10397" } + string => concat( + "The with attribute should be namespace aware.", + "This shows the case where a variable is set in a bundle of a", + "different name." + ); - "test_soft_fail" - string => "any", - meta => { "ENT-10397" }; + "test_soft_fail" + string => "any", + meta => { "ENT-10397" }; methods: - "Test Reporting Namespaced Variables" - usebundle => example_space:test( $(G.testfile) ); + "Test Reporting Namespaced Variables" + usebundle => example_space:test($(G.testfile)); } bundle agent check { methods: - - "Pass/Fail" usebundle => dcs_check_diff( "$(this.promise_dirname)/expected_output.txt", - $(G.testfile), - $(this.promise_filename)); + "Pass/Fail" + usebundle => dcs_check_diff( + "$(this.promise_dirname)/expected_output.txt", + $(G.testfile), + $(this.promise_filename) + ); } body file control { - namespace => "example_space"; + namespace => "example_space"; } bundle agent my_bundle { vars: - "My_Variable" string => "GOOD VARIABLE VALUE"; - + "My_Variable" string => "GOOD VARIABLE VALUE"; } + bundle agent test(file) { methods: - "My Bundle" usebundle => my_bundle; - "write output" usebundle => write_output( $(file) ); + "My Bundle" usebundle => my_bundle; + "write output" usebundle => write_output($(file)); } -bundle agent write_output(file) { +bundle agent write_output(file) +{ reports: - "Bundle-qualified another bundle: The value of my_bundle.My_Variable is $(with)" - report_to_file => "$(file)", - with => "$(my_bundle.My_Variable)"; + "Bundle-qualified another bundle: The value of my_bundle.My_Variable is $(with)" + report_to_file => "$(file)", + with => "$(my_bundle.My_Variable)"; - "Fully-qualified another bundle: The value of example_space:my_bundle.My_Variable $(with)" - report_to_file => "$(file)", - with => "$(example_space:my_bundle.My_Variable)"; + "Fully-qualified another bundle: The value of example_space:my_bundle.My_Variable $(with)" + report_to_file => "$(file)", + with => "$(example_space:my_bundle.My_Variable)"; } diff --git a/tests/acceptance/01_vars/01_basic/namespaces/namespaced-bundles.cf b/tests/acceptance/01_vars/01_basic/namespaces/namespaced-bundles.cf index 5b40bfb23b..464c914b0f 100644 --- a/tests/acceptance/01_vars/01_basic/namespaces/namespaced-bundles.cf +++ b/tests/acceptance/01_vars/01_basic/namespaces/namespaced-bundles.cf @@ -1,35 +1,39 @@ # Test that variables can be passed across bundles and namespaces - body common control { - inputs => { "../../../default.sub.cf", "namespaced-bundles.cf.sub1", "namespaced-bundles.cf.sub2" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { + "../../../default.sub.cf", + "namespaced-bundles.cf.sub1", + "namespaced-bundles.cf.sub2", + }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { methods: - "1" usebundle => namespaced_bundles_1:unique; - "2" usebundle => namespaced_bundles_2:unique; - "3" usebundle => namespaced_bundles_1:unique2("a", "b"); - "4" usebundle => namespaced_bundles_2:unique2("one value"); + "1" usebundle => namespaced_bundles_1:unique; + "2" usebundle => namespaced_bundles_2:unique; + "3" usebundle => namespaced_bundles_1:unique2("a", "b"); + "4" usebundle => namespaced_bundles_2:unique2("one value"); } bundle agent check { classes: - "ok" expression => "any"; + "ok" expression => "any"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/namespaces/nested-expansion-including-namespace.cf b/tests/acceptance/01_vars/01_basic/namespaces/nested-expansion-including-namespace.cf index 66d8195ea3..e7a4b58e0c 100644 --- a/tests/acceptance/01_vars/01_basic/namespaces/nested-expansion-including-namespace.cf +++ b/tests/acceptance/01_vars/01_basic/namespaces/nested-expansion-including-namespace.cf @@ -1,32 +1,35 @@ body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { meta: - "description" -> { "CFE-1583" } - string => "Check that nested expansion with namespaces works"; - + "description" -> { "CFE-1583" } + string => "Check that nested expansion with namespaces works"; } + bundle agent check { vars: - "data_bundle" string => "default:init"; + "data_bundle" string => "default:init"; methods: - "Pass/FAIL" usebundle => dcs_check_strcmp( "$($(data_bundle).dummy)","dummy", $(this.promise_filename), "no"); + "Pass/FAIL" + usebundle => dcs_check_strcmp( + "$($(data_bundle).dummy)", "dummy", $(this.promise_filename), "no" + ); reports: - "Nested expansion: '$(data_bundle).dummy' = $($(data_bundle).dummy)"; - "Not nested expansion: '$(data_bundle).dummy' = $(default:init.dummy)"; + "Nested expansion: '$(data_bundle).dummy' = $($(data_bundle).dummy)"; + "Not nested expansion: '$(data_bundle).dummy' = $(default:init.dummy)"; } diff --git a/tests/acceptance/01_vars/01_basic/namespaces/nested_expansion_namespaced_variables.cf b/tests/acceptance/01_vars/01_basic/namespaces/nested_expansion_namespaced_variables.cf index fee869b288..88b4918f9d 100644 --- a/tests/acceptance/01_vars/01_basic/namespaces/nested_expansion_namespaced_variables.cf +++ b/tests/acceptance/01_vars/01_basic/namespaces/nested_expansion_namespaced_variables.cf @@ -1,27 +1,24 @@ # Test that nested variables including namespaces are expanded correctly - body common control { - inputs => { "../../../default.sub.cf",}; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { meta: - "tags" slist => { "redmine6349" }; + "tags" slist => { "redmine6349" }; vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent check { - methods: "Check" usebundle => check2("default:init"); - } bundle agent check2(data_bundle) @@ -36,8 +33,7 @@ bundle agent check2(data_bundle) ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; - - } diff --git a/tests/acceptance/01_vars/01_basic/namespaces/unquoted_namespaces.cf b/tests/acceptance/01_vars/01_basic/namespaces/unquoted_namespaces.cf index c3e896e1cc..5bb834bd4b 100644 --- a/tests/acceptance/01_vars/01_basic/namespaces/unquoted_namespaces.cf +++ b/tests/acceptance/01_vars/01_basic/namespaces/unquoted_namespaces.cf @@ -1,13 +1,12 @@ body common control { - inputs => { "../../../default.sub.cf"}; - bundlesequence => { "init", "test", "new_namespace:check" }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { "init", "test", "new_namespace:check" }; + version => "1.0"; } bundle agent init { - } bundle agent test @@ -15,9 +14,9 @@ bundle agent test meta: "description" -> { "ENT-13304" } string => "Test that quotes are not needed for a fully qualified variable name in a function call"; + vars: - "foo_list" - slist => { "1", "2", "3" }; + "foo_list" slist => { "1", "2", "3" }; } body file control @@ -28,81 +27,55 @@ body file control bundle agent check { vars: - "bar_list" - slist => { "1", "2", "3" }; - - "unquoted_foo_list1" - string => join(", ", foo_list); - - "unquoted_foo_list2" - string => join(", ", test.foo_list); - - "unquoted_foo_list3" - string => join(", ", default:foo_list); - - "unquoted_foo_list4" - string => join(", ", default:test.foo_list); - - "unquoted_bar_list1" - string => join(", ", bar_list); - - "unquoted_bar_list2" - string => join(", ", check.bar_list); - - "unquoted_bar_list3" - string => join(", ", new_namespace:bar_list); - - "unquoted_bar_list4" - string => join(", ", new_namespace:check.bar_list); - - "quoted_foo_list1" - string => join(", ", foo_list); - - "quoted_foo_list2" - string => join(", ", test.foo_list); - - "quoted_foo_list3" - string => join(", ", default:foo_list); - - "quoted_foo_list4" - string => join(", ", default:test.foo_list); - - "quoted_bar_list1" - string => join(", ", bar_list); - - "quoted_bar_list2" - string => join(", ", check.bar_list); - - "quoted_bar_list3" - string => join(", ", new_namespace:bar_list); - - "quoted_bar_list4" - string => join(", ", new_namespace:check.bar_list); + "bar_list" slist => { "1", "2", "3" }; + "unquoted_foo_list1" string => join(", ", foo_list); + "unquoted_foo_list2" string => join(", ", test.foo_list); + "unquoted_foo_list3" string => join(", ", default:foo_list); + "unquoted_foo_list4" string => join(", ", default:test.foo_list); + "unquoted_bar_list1" string => join(", ", bar_list); + "unquoted_bar_list2" string => join(", ", check.bar_list); + "unquoted_bar_list3" string => join(", ", new_namespace:bar_list); + "unquoted_bar_list4" string => join(", ", new_namespace:check.bar_list); + "quoted_foo_list1" string => join(", ", foo_list); + "quoted_foo_list2" string => join(", ", test.foo_list); + "quoted_foo_list3" string => join(", ", default:foo_list); + "quoted_foo_list4" string => join(", ", default:test.foo_list); + "quoted_bar_list1" string => join(", ", bar_list); + "quoted_bar_list2" string => join(", ", check.bar_list); + "quoted_bar_list3" string => join(", ", new_namespace:bar_list); + "quoted_bar_list4" string => join(", ", new_namespace:check.bar_list); classes: "undefined_vars" - expression => not(or(isvariable("unquoted_foo_list1"), - isvariable("unquoted_foo_list3"), - isvariable("unquoted_bar_list2"), - isvariable("quoted_foo_list1"), - isvariable("quoted_foo_list3"), - isvariable("quoted_bar_list2"))); + expression => not( + or( + isvariable("unquoted_foo_list1"), + isvariable("unquoted_foo_list3"), + isvariable("unquoted_bar_list2"), + isvariable("quoted_foo_list1"), + isvariable("quoted_foo_list3"), + isvariable("quoted_bar_list2") + ) + ); "defined_vars" - expression => and(strcmp("1, 2, 3", "$(unquoted_foo_list2)"), - strcmp("1, 2, 3", "$(unquoted_foo_list4)"), - strcmp("1, 2, 3", "$(unquoted_bar_list1)"), - strcmp("1, 2, 3", "$(unquoted_bar_list3)"), - strcmp("1, 2, 3", "$(unquoted_bar_list4)"), - strcmp("1, 2, 3", "$(quoted_foo_list2)"), - strcmp("1, 2, 3", "$(quoted_foo_list4)"), - strcmp("1, 2, 3", "$(quoted_bar_list1)"), - strcmp("1, 2, 3", "$(quoted_bar_list3)"), - strcmp("1, 2, 3", "$(quoted_bar_list4)")); - + expression => and( + strcmp("1, 2, 3", "$(unquoted_foo_list2)"), + strcmp("1, 2, 3", "$(unquoted_foo_list4)"), + strcmp("1, 2, 3", "$(unquoted_bar_list1)"), + strcmp("1, 2, 3", "$(unquoted_bar_list3)"), + strcmp("1, 2, 3", "$(unquoted_bar_list4)"), + strcmp("1, 2, 3", "$(quoted_foo_list2)"), + strcmp("1, 2, 3", "$(quoted_foo_list4)"), + strcmp("1, 2, 3", "$(quoted_bar_list1)"), + strcmp("1, 2, 3", "$(quoted_bar_list3)"), + strcmp("1, 2, 3", "$(quoted_bar_list4)") + ); + reports: defined_vars.undefined_vars:: "$(this.promise_filename) Pass"; + !defined_vars|!undefined_vars:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/nested_parens_var_ref.cf b/tests/acceptance/01_vars/01_basic/nested_parens_var_ref.cf index a28eab1cc1..81e70995c8 100644 --- a/tests/acceptance/01_vars/01_basic/nested_parens_var_ref.cf +++ b/tests/acceptance/01_vars/01_basic/nested_parens_var_ref.cf @@ -3,39 +3,35 @@ # Test that a variable reference with nested parentheses works # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent test { meta: - "description" -> { "CFE-3242" } - string => "Test that a variable reference with nested parentheses works"; + "description" -> { "CFE-3242" } + string => "Test that a variable reference with nested parentheses works"; vars: - "my_array[key(1)]" string => "value"; - "value" string => "$(my_array[key(1)])"; + "my_array[key(1)]" string => "value"; + "value" string => "$(my_array[key(1)])"; } ########################################################### - bundle agent check { classes: - "ok" and => { isvariable( "test.value" ), - strcmp( "$(test.value)", "value") - }; + "ok" and => { isvariable("test.value"), strcmp("$(test.value)", "value") }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/os_name_human.cf b/tests/acceptance/01_vars/01_basic/os_name_human.cf index f4d98afe93..be15bc76de 100755 --- a/tests/acceptance/01_vars/01_basic/os_name_human.cf +++ b/tests/acceptance/01_vars/01_basic/os_name_human.cf @@ -6,10 +6,9 @@ body common control bundle agent test { meta: - "description" -> { "CFE-3569" } - string => "Test for expected values of variable sys.os_name_human"; + "description" -> { "CFE-3569" } + string => "Test for expected values of variable sys.os_name_human"; - # # Note: # # Order is important, the last variable assignment wins. @@ -17,37 +16,50 @@ bundle agent test # # This test should also succeed if none of the os-classes are defined. # This should be covered in another test. - # vars: any:: "actual" string => "$(sys.os_name_human)"; "expected" string => "Unknown"; + debian:: "expected" string => "Debian"; + ubuntu:: "expected" string => "Ubuntu"; + redhat:: "expected" string => "RHEL"; + centos:: "expected" string => "CentOS"; + fedora:: "expected" string => "Fedora"; + aix:: "expected" string => "AIX"; + hpux:: "expected" string => "HP-UX"; + suse:: "expected" string => "SUSE"; + opensuse:: "expected" string => "OpenSUSE"; + windows:: "expected" string => "Windows"; + freebsd:: "expected" string => "FreeBSD"; + macos:: "expected" string => "macOS"; + solaris:: "expected" string => "Solaris"; + amazon_linux:: "expected" string => "Amazon"; } @@ -55,14 +67,16 @@ bundle agent test bundle agent check { classes: - "passed" expression => strcmp("$(test.actual)", "$(test.expected)"); + "passed" expression => strcmp("$(test.actual)", "$(test.expected)"); reports: DEBUG:: "$(this.promise_filename) Expected: $(test.expected)"; "$(this.promise_filename) Found: $(test.actual)"; + passed:: "$(this.promise_filename) Pass"; + !passed:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/os_name_human_not_unknown.cf b/tests/acceptance/01_vars/01_basic/os_name_human_not_unknown.cf index 509ab50953..952e84920b 100644 --- a/tests/acceptance/01_vars/01_basic/os_name_human_not_unknown.cf +++ b/tests/acceptance/01_vars/01_basic/os_name_human_not_unknown.cf @@ -13,19 +13,23 @@ bundle agent test bundle agent check { classes: - # Check that sys.os_name_human does not resolve to 'Unknown' - "check1" expression => not(strcmp("Unknown", "$(sys.os_name_human)")); - # Check that sys.os_name_human does not resolve to an empty string - "check2" expression => not(strcmp("", "$(sys.os_name_human)")); - # Check that sys.os_name_human does not contain 'os_name_human' - "check3" expression => not(regcmp("os_name_human", "$(sys.os_name_human)")); - "passed" and => { "check1", "check2", "check3" }; + # Check that sys.os_name_human does not resolve to 'Unknown' + "check1" expression => not(strcmp("Unknown", "$(sys.os_name_human)")); + + # Check that sys.os_name_human does not resolve to an empty string + "check2" expression => not(strcmp("", "$(sys.os_name_human)")); + + # Check that sys.os_name_human does not contain 'os_name_human' + "check3" expression => not(regcmp("os_name_human", "$(sys.os_name_human)")); + "passed" and => { "check1", "check2", "check3" }; reports: DEBUG:: "sys.os_name_human resolved to '$(sys.os_name_human)'"; + passed:: "$(this.promise_filename) Pass"; + !passed:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/os_version_major.cf b/tests/acceptance/01_vars/01_basic/os_version_major.cf index 9e5c9229b1..8b4d3c6f24 100644 --- a/tests/acceptance/01_vars/01_basic/os_version_major.cf +++ b/tests/acceptance/01_vars/01_basic/os_version_major.cf @@ -3,7 +3,6 @@ # Test reworked in CFE-3644 to be more dynamic # ############################################################## - body common control { bundlesequence => { "test", "check" }; @@ -20,15 +19,30 @@ bundle agent test # Platforms to test any:: "platforms" - slist => { "debian", "ubuntu", "redhat", "rhel", "centos", "fedora", - "aix", "hpux", "suse", "opensuse", "opensuse_leap", "sles", - "solaris", "sunos", "windows", "freebsd", "macos" }; - + slist => { + "debian", + "ubuntu", + "redhat", + "rhel", + "centos", + "fedora", + "aix", + "hpux", + "suse", + "opensuse", + "opensuse_leap", + "sles", + "solaris", + "sunos", + "windows", + "freebsd", + "macos", + }; # Regex matching current platforms OS-class with version numbers !solaris&!sunos:: - "class_regex" - string => format("^(%s)_[0-9]+$", join("|", "platforms")); + "class_regex" string => format("^(%s)_[0-9]+$", join("|", "platforms")); + solaris|sunos:: "class_regex" string => format("^(%s)_[0-9]+_[0-9]+$", join("|", "platforms")); @@ -39,32 +53,35 @@ bundle agent test # E.g. Solaris 11 has class "solaris_5_11" any:: "extract_regex" - string => ifelse("solaris|sunos", "^[a-z]+_[0-9]+_([0-9]+$)", - "opensuse_leap", "^[a-z_]+_([0-9]+)$", - "^[a-z]+_([0-9]+)$"); + string => ifelse( + "solaris|sunos", + "^[a-z]+_[0-9]+_([0-9]+$)", + "opensuse_leap", + "^[a-z_]+_([0-9]+)$", + "^[a-z]+_([0-9]+)$" + ); # Find OS-class with version numbers using regex any:: - "os_class" - string => nth(classesmatching("$(class_regex)"), "0"); + "os_class" string => nth(classesmatching("$(class_regex)"), "0"); # Get extracted major version number any:: - "expected" - string => nth("version_number", "1"); + "expected" string => nth("version_number", "1"); classes: any:: "regextract_success" - expression => regextract("$(extract_regex)", "$(os_class)", "version_number"); + expression => regextract( + "$(extract_regex)", "$(os_class)", "version_number" + ); } bundle agent check { vars: any:: - "defined_classes" - slist => classesmatching(".*"); + "defined_classes" slist => classesmatching(".*"); classes: any:: @@ -77,8 +94,10 @@ bundle agent check "Defined classes: $(defined_classes)"; "$(this.promise_filename) Expected: $(test.expected)"; "$(this.promise_filename) Found: $(sys.os_version_major)"; + passed:: "$(this.promise_filename) Pass"; + !passed:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/os_version_minor.cf b/tests/acceptance/01_vars/01_basic/os_version_minor.cf index 035eb9fc28..faa4f439fe 100644 --- a/tests/acceptance/01_vars/01_basic/os_version_minor.cf +++ b/tests/acceptance/01_vars/01_basic/os_version_minor.cf @@ -5,57 +5,70 @@ body common control bundle agent test { - vars: # Platforms to test - "platforms" - slist => { "debian", "ubuntu", "redhat", "rhel", "centos", "fedora", - "aix", "hpux", "suse", "opensuse", "opensuse_leap", "sles", - "solaris", "sunos", "windows", "freebsd", "macos" }; - + slist => { + "debian", + "ubuntu", + "redhat", + "rhel", + "centos", + "fedora", + "aix", + "hpux", + "suse", + "opensuse", + "opensuse_leap", + "sles", + "solaris", + "sunos", + "windows", + "freebsd", + "macos", + }; # Regex matching current platforms OS-class with version numbers "class_regex" string => format("^(%s)_[0-9]+_[0-9]+$", join("|", "platforms")); + # Find OS-class with version numbers using regex - "os_classes" - slist => classesmatching("$(class_regex)"); + "os_classes" slist => classesmatching("$(class_regex)"); # Regex to extract minor version number from OS-class # Edge cases: # - On Solaris/SunOS minor version comes second # E.g. Solaris 11 has class "solaris_5_11" - "extract_regex" - string => ifelse("solaris|sunos", "^[a-z]+_([0-9]+)_[0-9]+$", - "opensuse_leap", "^[a-z_]+_[0-9]+_([0-9]+$)", - "^[a-z]+_[0-9]+_([0-9]+$)"); + string => ifelse( + "solaris|sunos", + "^[a-z]+_([0-9]+)_[0-9]+$", + "opensuse_leap", + "^[a-z_]+_[0-9]+_([0-9]+$)", + "^[a-z]+_[0-9]+_([0-9]+$)" + ); # Get extracted minor version number "version_number" data => data_regextract("$(extract_regex)", "$(os_classes)"); - "expected" - string => nth("@(version_number)", "1"); + "expected" string => nth("@(version_number)", "1"); } bundle agent check { vars: - "defined_classes" - slist => classesmatching(".*"); + "defined_classes" slist => classesmatching(".*"); classes: - "exists" - expression => isvariable("test.expected"); + "exists" expression => isvariable("test.expected"); exists:: "passed" expression => strcmp("$(test.expected)", "$(sys.os_version_minor)"); + !exists:: - "passed" - expression => strcmp("Unknown", "$(sys.os_version_minor)"); + "passed" expression => strcmp("Unknown", "$(sys.os_version_minor)"); reports: DEBUG:: @@ -63,8 +76,10 @@ bundle agent check "Defined classes: $(defined_classes)"; "$(this.promise_filename) Expected: $(test.expected)"; "$(this.promise_filename) Found: $(sys.os_version_minor)"; + passed:: "$(this.promise_filename) Pass"; + !passed:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/parse_long_slists.cf b/tests/acceptance/01_vars/01_basic/parse_long_slists.cf index 27098d11cf..cc84fc72f2 100644 --- a/tests/acceptance/01_vars/01_basic/parse_long_slists.cf +++ b/tests/acceptance/01_vars/01_basic/parse_long_slists.cf @@ -1,7 +1,8 @@ -body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; +body common control +{ + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -9,5003 +10,5004 @@ bundle agent init # Parser used to abort here with message # "error: memory exhausted", see Redmine#6672 vars: - "list" ilist => { - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 82, - 83, - 84, - 85, - 86, - 87, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - 96, - 97, - 98, - 99, - 100, - 101, - 102, - 103, - 104, - 105, - 106, - 107, - 108, - 109, - 110, - 111, - 112, - 113, - 114, - 115, - 116, - 117, - 118, - 119, - 120, - 121, - 122, - 123, - 124, - 125, - 126, - 127, - 128, - 129, - 130, - 131, - 132, - 133, - 134, - 135, - 136, - 137, - 138, - 139, - 140, - 141, - 142, - 143, - 144, - 145, - 146, - 147, - 148, - 149, - 150, - 151, - 152, - 153, - 154, - 155, - 156, - 157, - 158, - 159, - 160, - 161, - 162, - 163, - 164, - 165, - 166, - 167, - 168, - 169, - 170, - 171, - 172, - 173, - 174, - 175, - 176, - 177, - 178, - 179, - 180, - 181, - 182, - 183, - 184, - 185, - 186, - 187, - 188, - 189, - 190, - 191, - 192, - 193, - 194, - 195, - 196, - 197, - 198, - 199, - 200, - 201, - 202, - 203, - 204, - 205, - 206, - 207, - 208, - 209, - 210, - 211, - 212, - 213, - 214, - 215, - 216, - 217, - 218, - 219, - 220, - 221, - 222, - 223, - 224, - 225, - 226, - 227, - 228, - 229, - 230, - 231, - 232, - 233, - 234, - 235, - 236, - 237, - 238, - 239, - 240, - 241, - 242, - 243, - 244, - 245, - 246, - 247, - 248, - 249, - 250, - 251, - 252, - 253, - 254, - 255, - 256, - 257, - 258, - 259, - 260, - 261, - 262, - 263, - 264, - 265, - 266, - 267, - 268, - 269, - 270, - 271, - 272, - 273, - 274, - 275, - 276, - 277, - 278, - 279, - 280, - 281, - 282, - 283, - 284, - 285, - 286, - 287, - 288, - 289, - 290, - 291, - 292, - 293, - 294, - 295, - 296, - 297, - 298, - 299, - 300, - 301, - 302, - 303, - 304, - 305, - 306, - 307, - 308, - 309, - 310, - 311, - 312, - 313, - 314, - 315, - 316, - 317, - 318, - 319, - 320, - 321, - 322, - 323, - 324, - 325, - 326, - 327, - 328, - 329, - 330, - 331, - 332, - 333, - 334, - 335, - 336, - 337, - 338, - 339, - 340, - 341, - 342, - 343, - 344, - 345, - 346, - 347, - 348, - 349, - 350, - 351, - 352, - 353, - 354, - 355, - 356, - 357, - 358, - 359, - 360, - 361, - 362, - 363, - 364, - 365, - 366, - 367, - 368, - 369, - 370, - 371, - 372, - 373, - 374, - 375, - 376, - 377, - 378, - 379, - 380, - 381, - 382, - 383, - 384, - 385, - 386, - 387, - 388, - 389, - 390, - 391, - 392, - 393, - 394, - 395, - 396, - 397, - 398, - 399, - 400, - 401, - 402, - 403, - 404, - 405, - 406, - 407, - 408, - 409, - 410, - 411, - 412, - 413, - 414, - 415, - 416, - 417, - 418, - 419, - 420, - 421, - 422, - 423, - 424, - 425, - 426, - 427, - 428, - 429, - 430, - 431, - 432, - 433, - 434, - 435, - 436, - 437, - 438, - 439, - 440, - 441, - 442, - 443, - 444, - 445, - 446, - 447, - 448, - 449, - 450, - 451, - 452, - 453, - 454, - 455, - 456, - 457, - 458, - 459, - 460, - 461, - 462, - 463, - 464, - 465, - 466, - 467, - 468, - 469, - 470, - 471, - 472, - 473, - 474, - 475, - 476, - 477, - 478, - 479, - 480, - 481, - 482, - 483, - 484, - 485, - 486, - 487, - 488, - 489, - 490, - 491, - 492, - 493, - 494, - 495, - 496, - 497, - 498, - 499, - 500, - 501, - 502, - 503, - 504, - 505, - 506, - 507, - 508, - 509, - 510, - 511, - 512, - 513, - 514, - 515, - 516, - 517, - 518, - 519, - 520, - 521, - 522, - 523, - 524, - 525, - 526, - 527, - 528, - 529, - 530, - 531, - 532, - 533, - 534, - 535, - 536, - 537, - 538, - 539, - 540, - 541, - 542, - 543, - 544, - 545, - 546, - 547, - 548, - 549, - 550, - 551, - 552, - 553, - 554, - 555, - 556, - 557, - 558, - 559, - 560, - 561, - 562, - 563, - 564, - 565, - 566, - 567, - 568, - 569, - 570, - 571, - 572, - 573, - 574, - 575, - 576, - 577, - 578, - 579, - 580, - 581, - 582, - 583, - 584, - 585, - 586, - 587, - 588, - 589, - 590, - 591, - 592, - 593, - 594, - 595, - 596, - 597, - 598, - 599, - 600, - 601, - 602, - 603, - 604, - 605, - 606, - 607, - 608, - 609, - 610, - 611, - 612, - 613, - 614, - 615, - 616, - 617, - 618, - 619, - 620, - 621, - 622, - 623, - 624, - 625, - 626, - 627, - 628, - 629, - 630, - 631, - 632, - 633, - 634, - 635, - 636, - 637, - 638, - 639, - 640, - 641, - 642, - 643, - 644, - 645, - 646, - 647, - 648, - 649, - 650, - 651, - 652, - 653, - 654, - 655, - 656, - 657, - 658, - 659, - 660, - 661, - 662, - 663, - 664, - 665, - 666, - 667, - 668, - 669, - 670, - 671, - 672, - 673, - 674, - 675, - 676, - 677, - 678, - 679, - 680, - 681, - 682, - 683, - 684, - 685, - 686, - 687, - 688, - 689, - 690, - 691, - 692, - 693, - 694, - 695, - 696, - 697, - 698, - 699, - 700, - 701, - 702, - 703, - 704, - 705, - 706, - 707, - 708, - 709, - 710, - 711, - 712, - 713, - 714, - 715, - 716, - 717, - 718, - 719, - 720, - 721, - 722, - 723, - 724, - 725, - 726, - 727, - 728, - 729, - 730, - 731, - 732, - 733, - 734, - 735, - 736, - 737, - 738, - 739, - 740, - 741, - 742, - 743, - 744, - 745, - 746, - 747, - 748, - 749, - 750, - 751, - 752, - 753, - 754, - 755, - 756, - 757, - 758, - 759, - 760, - 761, - 762, - 763, - 764, - 765, - 766, - 767, - 768, - 769, - 770, - 771, - 772, - 773, - 774, - 775, - 776, - 777, - 778, - 779, - 780, - 781, - 782, - 783, - 784, - 785, - 786, - 787, - 788, - 789, - 790, - 791, - 792, - 793, - 794, - 795, - 796, - 797, - 798, - 799, - 800, - 801, - 802, - 803, - 804, - 805, - 806, - 807, - 808, - 809, - 810, - 811, - 812, - 813, - 814, - 815, - 816, - 817, - 818, - 819, - 820, - 821, - 822, - 823, - 824, - 825, - 826, - 827, - 828, - 829, - 830, - 831, - 832, - 833, - 834, - 835, - 836, - 837, - 838, - 839, - 840, - 841, - 842, - 843, - 844, - 845, - 846, - 847, - 848, - 849, - 850, - 851, - 852, - 853, - 854, - 855, - 856, - 857, - 858, - 859, - 860, - 861, - 862, - 863, - 864, - 865, - 866, - 867, - 868, - 869, - 870, - 871, - 872, - 873, - 874, - 875, - 876, - 877, - 878, - 879, - 880, - 881, - 882, - 883, - 884, - 885, - 886, - 887, - 888, - 889, - 890, - 891, - 892, - 893, - 894, - 895, - 896, - 897, - 898, - 899, - 900, - 901, - 902, - 903, - 904, - 905, - 906, - 907, - 908, - 909, - 910, - 911, - 912, - 913, - 914, - 915, - 916, - 917, - 918, - 919, - 920, - 921, - 922, - 923, - 924, - 925, - 926, - 927, - 928, - 929, - 930, - 931, - 932, - 933, - 934, - 935, - 936, - 937, - 938, - 939, - 940, - 941, - 942, - 943, - 944, - 945, - 946, - 947, - 948, - 949, - 950, - 951, - 952, - 953, - 954, - 955, - 956, - 957, - 958, - 959, - 960, - 961, - 962, - 963, - 964, - 965, - 966, - 967, - 968, - 969, - 970, - 971, - 972, - 973, - 974, - 975, - 976, - 977, - 978, - 979, - 980, - 981, - 982, - 983, - 984, - 985, - 986, - 987, - 988, - 989, - 990, - 991, - 992, - 993, - 994, - 995, - 996, - 997, - 998, - 999, - 1000, - 1001, - 1002, - 1003, - 1004, - 1005, - 1006, - 1007, - 1008, - 1009, - 1010, - 1011, - 1012, - 1013, - 1014, - 1015, - 1016, - 1017, - 1018, - 1019, - 1020, - 1021, - 1022, - 1023, - 1024, - 1025, - 1026, - 1027, - 1028, - 1029, - 1030, - 1031, - 1032, - 1033, - 1034, - 1035, - 1036, - 1037, - 1038, - 1039, - 1040, - 1041, - 1042, - 1043, - 1044, - 1045, - 1046, - 1047, - 1048, - 1049, - 1050, - 1051, - 1052, - 1053, - 1054, - 1055, - 1056, - 1057, - 1058, - 1059, - 1060, - 1061, - 1062, - 1063, - 1064, - 1065, - 1066, - 1067, - 1068, - 1069, - 1070, - 1071, - 1072, - 1073, - 1074, - 1075, - 1076, - 1077, - 1078, - 1079, - 1080, - 1081, - 1082, - 1083, - 1084, - 1085, - 1086, - 1087, - 1088, - 1089, - 1090, - 1091, - 1092, - 1093, - 1094, - 1095, - 1096, - 1097, - 1098, - 1099, - 1100, - 1101, - 1102, - 1103, - 1104, - 1105, - 1106, - 1107, - 1108, - 1109, - 1110, - 1111, - 1112, - 1113, - 1114, - 1115, - 1116, - 1117, - 1118, - 1119, - 1120, - 1121, - 1122, - 1123, - 1124, - 1125, - 1126, - 1127, - 1128, - 1129, - 1130, - 1131, - 1132, - 1133, - 1134, - 1135, - 1136, - 1137, - 1138, - 1139, - 1140, - 1141, - 1142, - 1143, - 1144, - 1145, - 1146, - 1147, - 1148, - 1149, - 1150, - 1151, - 1152, - 1153, - 1154, - 1155, - 1156, - 1157, - 1158, - 1159, - 1160, - 1161, - 1162, - 1163, - 1164, - 1165, - 1166, - 1167, - 1168, - 1169, - 1170, - 1171, - 1172, - 1173, - 1174, - 1175, - 1176, - 1177, - 1178, - 1179, - 1180, - 1181, - 1182, - 1183, - 1184, - 1185, - 1186, - 1187, - 1188, - 1189, - 1190, - 1191, - 1192, - 1193, - 1194, - 1195, - 1196, - 1197, - 1198, - 1199, - 1200, - 1201, - 1202, - 1203, - 1204, - 1205, - 1206, - 1207, - 1208, - 1209, - 1210, - 1211, - 1212, - 1213, - 1214, - 1215, - 1216, - 1217, - 1218, - 1219, - 1220, - 1221, - 1222, - 1223, - 1224, - 1225, - 1226, - 1227, - 1228, - 1229, - 1230, - 1231, - 1232, - 1233, - 1234, - 1235, - 1236, - 1237, - 1238, - 1239, - 1240, - 1241, - 1242, - 1243, - 1244, - 1245, - 1246, - 1247, - 1248, - 1249, - 1250, - 1251, - 1252, - 1253, - 1254, - 1255, - 1256, - 1257, - 1258, - 1259, - 1260, - 1261, - 1262, - 1263, - 1264, - 1265, - 1266, - 1267, - 1268, - 1269, - 1270, - 1271, - 1272, - 1273, - 1274, - 1275, - 1276, - 1277, - 1278, - 1279, - 1280, - 1281, - 1282, - 1283, - 1284, - 1285, - 1286, - 1287, - 1288, - 1289, - 1290, - 1291, - 1292, - 1293, - 1294, - 1295, - 1296, - 1297, - 1298, - 1299, - 1300, - 1301, - 1302, - 1303, - 1304, - 1305, - 1306, - 1307, - 1308, - 1309, - 1310, - 1311, - 1312, - 1313, - 1314, - 1315, - 1316, - 1317, - 1318, - 1319, - 1320, - 1321, - 1322, - 1323, - 1324, - 1325, - 1326, - 1327, - 1328, - 1329, - 1330, - 1331, - 1332, - 1333, - 1334, - 1335, - 1336, - 1337, - 1338, - 1339, - 1340, - 1341, - 1342, - 1343, - 1344, - 1345, - 1346, - 1347, - 1348, - 1349, - 1350, - 1351, - 1352, - 1353, - 1354, - 1355, - 1356, - 1357, - 1358, - 1359, - 1360, - 1361, - 1362, - 1363, - 1364, - 1365, - 1366, - 1367, - 1368, - 1369, - 1370, - 1371, - 1372, - 1373, - 1374, - 1375, - 1376, - 1377, - 1378, - 1379, - 1380, - 1381, - 1382, - 1383, - 1384, - 1385, - 1386, - 1387, - 1388, - 1389, - 1390, - 1391, - 1392, - 1393, - 1394, - 1395, - 1396, - 1397, - 1398, - 1399, - 1400, - 1401, - 1402, - 1403, - 1404, - 1405, - 1406, - 1407, - 1408, - 1409, - 1410, - 1411, - 1412, - 1413, - 1414, - 1415, - 1416, - 1417, - 1418, - 1419, - 1420, - 1421, - 1422, - 1423, - 1424, - 1425, - 1426, - 1427, - 1428, - 1429, - 1430, - 1431, - 1432, - 1433, - 1434, - 1435, - 1436, - 1437, - 1438, - 1439, - 1440, - 1441, - 1442, - 1443, - 1444, - 1445, - 1446, - 1447, - 1448, - 1449, - 1450, - 1451, - 1452, - 1453, - 1454, - 1455, - 1456, - 1457, - 1458, - 1459, - 1460, - 1461, - 1462, - 1463, - 1464, - 1465, - 1466, - 1467, - 1468, - 1469, - 1470, - 1471, - 1472, - 1473, - 1474, - 1475, - 1476, - 1477, - 1478, - 1479, - 1480, - 1481, - 1482, - 1483, - 1484, - 1485, - 1486, - 1487, - 1488, - 1489, - 1490, - 1491, - 1492, - 1493, - 1494, - 1495, - 1496, - 1497, - 1498, - 1499, - 1500, - 1501, - 1502, - 1503, - 1504, - 1505, - 1506, - 1507, - 1508, - 1509, - 1510, - 1511, - 1512, - 1513, - 1514, - 1515, - 1516, - 1517, - 1518, - 1519, - 1520, - 1521, - 1522, - 1523, - 1524, - 1525, - 1526, - 1527, - 1528, - 1529, - 1530, - 1531, - 1532, - 1533, - 1534, - 1535, - 1536, - 1537, - 1538, - 1539, - 1540, - 1541, - 1542, - 1543, - 1544, - 1545, - 1546, - 1547, - 1548, - 1549, - 1550, - 1551, - 1552, - 1553, - 1554, - 1555, - 1556, - 1557, - 1558, - 1559, - 1560, - 1561, - 1562, - 1563, - 1564, - 1565, - 1566, - 1567, - 1568, - 1569, - 1570, - 1571, - 1572, - 1573, - 1574, - 1575, - 1576, - 1577, - 1578, - 1579, - 1580, - 1581, - 1582, - 1583, - 1584, - 1585, - 1586, - 1587, - 1588, - 1589, - 1590, - 1591, - 1592, - 1593, - 1594, - 1595, - 1596, - 1597, - 1598, - 1599, - 1600, - 1601, - 1602, - 1603, - 1604, - 1605, - 1606, - 1607, - 1608, - 1609, - 1610, - 1611, - 1612, - 1613, - 1614, - 1615, - 1616, - 1617, - 1618, - 1619, - 1620, - 1621, - 1622, - 1623, - 1624, - 1625, - 1626, - 1627, - 1628, - 1629, - 1630, - 1631, - 1632, - 1633, - 1634, - 1635, - 1636, - 1637, - 1638, - 1639, - 1640, - 1641, - 1642, - 1643, - 1644, - 1645, - 1646, - 1647, - 1648, - 1649, - 1650, - 1651, - 1652, - 1653, - 1654, - 1655, - 1656, - 1657, - 1658, - 1659, - 1660, - 1661, - 1662, - 1663, - 1664, - 1665, - 1666, - 1667, - 1668, - 1669, - 1670, - 1671, - 1672, - 1673, - 1674, - 1675, - 1676, - 1677, - 1678, - 1679, - 1680, - 1681, - 1682, - 1683, - 1684, - 1685, - 1686, - 1687, - 1688, - 1689, - 1690, - 1691, - 1692, - 1693, - 1694, - 1695, - 1696, - 1697, - 1698, - 1699, - 1700, - 1701, - 1702, - 1703, - 1704, - 1705, - 1706, - 1707, - 1708, - 1709, - 1710, - 1711, - 1712, - 1713, - 1714, - 1715, - 1716, - 1717, - 1718, - 1719, - 1720, - 1721, - 1722, - 1723, - 1724, - 1725, - 1726, - 1727, - 1728, - 1729, - 1730, - 1731, - 1732, - 1733, - 1734, - 1735, - 1736, - 1737, - 1738, - 1739, - 1740, - 1741, - 1742, - 1743, - 1744, - 1745, - 1746, - 1747, - 1748, - 1749, - 1750, - 1751, - 1752, - 1753, - 1754, - 1755, - 1756, - 1757, - 1758, - 1759, - 1760, - 1761, - 1762, - 1763, - 1764, - 1765, - 1766, - 1767, - 1768, - 1769, - 1770, - 1771, - 1772, - 1773, - 1774, - 1775, - 1776, - 1777, - 1778, - 1779, - 1780, - 1781, - 1782, - 1783, - 1784, - 1785, - 1786, - 1787, - 1788, - 1789, - 1790, - 1791, - 1792, - 1793, - 1794, - 1795, - 1796, - 1797, - 1798, - 1799, - 1800, - 1801, - 1802, - 1803, - 1804, - 1805, - 1806, - 1807, - 1808, - 1809, - 1810, - 1811, - 1812, - 1813, - 1814, - 1815, - 1816, - 1817, - 1818, - 1819, - 1820, - 1821, - 1822, - 1823, - 1824, - 1825, - 1826, - 1827, - 1828, - 1829, - 1830, - 1831, - 1832, - 1833, - 1834, - 1835, - 1836, - 1837, - 1838, - 1839, - 1840, - 1841, - 1842, - 1843, - 1844, - 1845, - 1846, - 1847, - 1848, - 1849, - 1850, - 1851, - 1852, - 1853, - 1854, - 1855, - 1856, - 1857, - 1858, - 1859, - 1860, - 1861, - 1862, - 1863, - 1864, - 1865, - 1866, - 1867, - 1868, - 1869, - 1870, - 1871, - 1872, - 1873, - 1874, - 1875, - 1876, - 1877, - 1878, - 1879, - 1880, - 1881, - 1882, - 1883, - 1884, - 1885, - 1886, - 1887, - 1888, - 1889, - 1890, - 1891, - 1892, - 1893, - 1894, - 1895, - 1896, - 1897, - 1898, - 1899, - 1900, - 1901, - 1902, - 1903, - 1904, - 1905, - 1906, - 1907, - 1908, - 1909, - 1910, - 1911, - 1912, - 1913, - 1914, - 1915, - 1916, - 1917, - 1918, - 1919, - 1920, - 1921, - 1922, - 1923, - 1924, - 1925, - 1926, - 1927, - 1928, - 1929, - 1930, - 1931, - 1932, - 1933, - 1934, - 1935, - 1936, - 1937, - 1938, - 1939, - 1940, - 1941, - 1942, - 1943, - 1944, - 1945, - 1946, - 1947, - 1948, - 1949, - 1950, - 1951, - 1952, - 1953, - 1954, - 1955, - 1956, - 1957, - 1958, - 1959, - 1960, - 1961, - 1962, - 1963, - 1964, - 1965, - 1966, - 1967, - 1968, - 1969, - 1970, - 1971, - 1972, - 1973, - 1974, - 1975, - 1976, - 1977, - 1978, - 1979, - 1980, - 1981, - 1982, - 1983, - 1984, - 1985, - 1986, - 1987, - 1988, - 1989, - 1990, - 1991, - 1992, - 1993, - 1994, - 1995, - 1996, - 1997, - 1998, - 1999, - 2000, - 2001, - 2002, - 2003, - 2004, - 2005, - 2006, - 2007, - 2008, - 2009, - 2010, - 2011, - 2012, - 2013, - 2014, - 2015, - 2016, - 2017, - 2018, - 2019, - 2020, - 2021, - 2022, - 2023, - 2024, - 2025, - 2026, - 2027, - 2028, - 2029, - 2030, - 2031, - 2032, - 2033, - 2034, - 2035, - 2036, - 2037, - 2038, - 2039, - 2040, - 2041, - 2042, - 2043, - 2044, - 2045, - 2046, - 2047, - 2048, - 2049, - 2050, - 2051, - 2052, - 2053, - 2054, - 2055, - 2056, - 2057, - 2058, - 2059, - 2060, - 2061, - 2062, - 2063, - 2064, - 2065, - 2066, - 2067, - 2068, - 2069, - 2070, - 2071, - 2072, - 2073, - 2074, - 2075, - 2076, - 2077, - 2078, - 2079, - 2080, - 2081, - 2082, - 2083, - 2084, - 2085, - 2086, - 2087, - 2088, - 2089, - 2090, - 2091, - 2092, - 2093, - 2094, - 2095, - 2096, - 2097, - 2098, - 2099, - 2100, - 2101, - 2102, - 2103, - 2104, - 2105, - 2106, - 2107, - 2108, - 2109, - 2110, - 2111, - 2112, - 2113, - 2114, - 2115, - 2116, - 2117, - 2118, - 2119, - 2120, - 2121, - 2122, - 2123, - 2124, - 2125, - 2126, - 2127, - 2128, - 2129, - 2130, - 2131, - 2132, - 2133, - 2134, - 2135, - 2136, - 2137, - 2138, - 2139, - 2140, - 2141, - 2142, - 2143, - 2144, - 2145, - 2146, - 2147, - 2148, - 2149, - 2150, - 2151, - 2152, - 2153, - 2154, - 2155, - 2156, - 2157, - 2158, - 2159, - 2160, - 2161, - 2162, - 2163, - 2164, - 2165, - 2166, - 2167, - 2168, - 2169, - 2170, - 2171, - 2172, - 2173, - 2174, - 2175, - 2176, - 2177, - 2178, - 2179, - 2180, - 2181, - 2182, - 2183, - 2184, - 2185, - 2186, - 2187, - 2188, - 2189, - 2190, - 2191, - 2192, - 2193, - 2194, - 2195, - 2196, - 2197, - 2198, - 2199, - 2200, - 2201, - 2202, - 2203, - 2204, - 2205, - 2206, - 2207, - 2208, - 2209, - 2210, - 2211, - 2212, - 2213, - 2214, - 2215, - 2216, - 2217, - 2218, - 2219, - 2220, - 2221, - 2222, - 2223, - 2224, - 2225, - 2226, - 2227, - 2228, - 2229, - 2230, - 2231, - 2232, - 2233, - 2234, - 2235, - 2236, - 2237, - 2238, - 2239, - 2240, - 2241, - 2242, - 2243, - 2244, - 2245, - 2246, - 2247, - 2248, - 2249, - 2250, - 2251, - 2252, - 2253, - 2254, - 2255, - 2256, - 2257, - 2258, - 2259, - 2260, - 2261, - 2262, - 2263, - 2264, - 2265, - 2266, - 2267, - 2268, - 2269, - 2270, - 2271, - 2272, - 2273, - 2274, - 2275, - 2276, - 2277, - 2278, - 2279, - 2280, - 2281, - 2282, - 2283, - 2284, - 2285, - 2286, - 2287, - 2288, - 2289, - 2290, - 2291, - 2292, - 2293, - 2294, - 2295, - 2296, - 2297, - 2298, - 2299, - 2300, - 2301, - 2302, - 2303, - 2304, - 2305, - 2306, - 2307, - 2308, - 2309, - 2310, - 2311, - 2312, - 2313, - 2314, - 2315, - 2316, - 2317, - 2318, - 2319, - 2320, - 2321, - 2322, - 2323, - 2324, - 2325, - 2326, - 2327, - 2328, - 2329, - 2330, - 2331, - 2332, - 2333, - 2334, - 2335, - 2336, - 2337, - 2338, - 2339, - 2340, - 2341, - 2342, - 2343, - 2344, - 2345, - 2346, - 2347, - 2348, - 2349, - 2350, - 2351, - 2352, - 2353, - 2354, - 2355, - 2356, - 2357, - 2358, - 2359, - 2360, - 2361, - 2362, - 2363, - 2364, - 2365, - 2366, - 2367, - 2368, - 2369, - 2370, - 2371, - 2372, - 2373, - 2374, - 2375, - 2376, - 2377, - 2378, - 2379, - 2380, - 2381, - 2382, - 2383, - 2384, - 2385, - 2386, - 2387, - 2388, - 2389, - 2390, - 2391, - 2392, - 2393, - 2394, - 2395, - 2396, - 2397, - 2398, - 2399, - 2400, - 2401, - 2402, - 2403, - 2404, - 2405, - 2406, - 2407, - 2408, - 2409, - 2410, - 2411, - 2412, - 2413, - 2414, - 2415, - 2416, - 2417, - 2418, - 2419, - 2420, - 2421, - 2422, - 2423, - 2424, - 2425, - 2426, - 2427, - 2428, - 2429, - 2430, - 2431, - 2432, - 2433, - 2434, - 2435, - 2436, - 2437, - 2438, - 2439, - 2440, - 2441, - 2442, - 2443, - 2444, - 2445, - 2446, - 2447, - 2448, - 2449, - 2450, - 2451, - 2452, - 2453, - 2454, - 2455, - 2456, - 2457, - 2458, - 2459, - 2460, - 2461, - 2462, - 2463, - 2464, - 2465, - 2466, - 2467, - 2468, - 2469, - 2470, - 2471, - 2472, - 2473, - 2474, - 2475, - 2476, - 2477, - 2478, - 2479, - 2480, - 2481, - 2482, - 2483, - 2484, - 2485, - 2486, - 2487, - 2488, - 2489, - 2490, - 2491, - 2492, - 2493, - 2494, - 2495, - 2496, - 2497, - 2498, - 2499, - 2500, - 2501, - 2502, - 2503, - 2504, - 2505, - 2506, - 2507, - 2508, - 2509, - 2510, - 2511, - 2512, - 2513, - 2514, - 2515, - 2516, - 2517, - 2518, - 2519, - 2520, - 2521, - 2522, - 2523, - 2524, - 2525, - 2526, - 2527, - 2528, - 2529, - 2530, - 2531, - 2532, - 2533, - 2534, - 2535, - 2536, - 2537, - 2538, - 2539, - 2540, - 2541, - 2542, - 2543, - 2544, - 2545, - 2546, - 2547, - 2548, - 2549, - 2550, - 2551, - 2552, - 2553, - 2554, - 2555, - 2556, - 2557, - 2558, - 2559, - 2560, - 2561, - 2562, - 2563, - 2564, - 2565, - 2566, - 2567, - 2568, - 2569, - 2570, - 2571, - 2572, - 2573, - 2574, - 2575, - 2576, - 2577, - 2578, - 2579, - 2580, - 2581, - 2582, - 2583, - 2584, - 2585, - 2586, - 2587, - 2588, - 2589, - 2590, - 2591, - 2592, - 2593, - 2594, - 2595, - 2596, - 2597, - 2598, - 2599, - 2600, - 2601, - 2602, - 2603, - 2604, - 2605, - 2606, - 2607, - 2608, - 2609, - 2610, - 2611, - 2612, - 2613, - 2614, - 2615, - 2616, - 2617, - 2618, - 2619, - 2620, - 2621, - 2622, - 2623, - 2624, - 2625, - 2626, - 2627, - 2628, - 2629, - 2630, - 2631, - 2632, - 2633, - 2634, - 2635, - 2636, - 2637, - 2638, - 2639, - 2640, - 2641, - 2642, - 2643, - 2644, - 2645, - 2646, - 2647, - 2648, - 2649, - 2650, - 2651, - 2652, - 2653, - 2654, - 2655, - 2656, - 2657, - 2658, - 2659, - 2660, - 2661, - 2662, - 2663, - 2664, - 2665, - 2666, - 2667, - 2668, - 2669, - 2670, - 2671, - 2672, - 2673, - 2674, - 2675, - 2676, - 2677, - 2678, - 2679, - 2680, - 2681, - 2682, - 2683, - 2684, - 2685, - 2686, - 2687, - 2688, - 2689, - 2690, - 2691, - 2692, - 2693, - 2694, - 2695, - 2696, - 2697, - 2698, - 2699, - 2700, - 2701, - 2702, - 2703, - 2704, - 2705, - 2706, - 2707, - 2708, - 2709, - 2710, - 2711, - 2712, - 2713, - 2714, - 2715, - 2716, - 2717, - 2718, - 2719, - 2720, - 2721, - 2722, - 2723, - 2724, - 2725, - 2726, - 2727, - 2728, - 2729, - 2730, - 2731, - 2732, - 2733, - 2734, - 2735, - 2736, - 2737, - 2738, - 2739, - 2740, - 2741, - 2742, - 2743, - 2744, - 2745, - 2746, - 2747, - 2748, - 2749, - 2750, - 2751, - 2752, - 2753, - 2754, - 2755, - 2756, - 2757, - 2758, - 2759, - 2760, - 2761, - 2762, - 2763, - 2764, - 2765, - 2766, - 2767, - 2768, - 2769, - 2770, - 2771, - 2772, - 2773, - 2774, - 2775, - 2776, - 2777, - 2778, - 2779, - 2780, - 2781, - 2782, - 2783, - 2784, - 2785, - 2786, - 2787, - 2788, - 2789, - 2790, - 2791, - 2792, - 2793, - 2794, - 2795, - 2796, - 2797, - 2798, - 2799, - 2800, - 2801, - 2802, - 2803, - 2804, - 2805, - 2806, - 2807, - 2808, - 2809, - 2810, - 2811, - 2812, - 2813, - 2814, - 2815, - 2816, - 2817, - 2818, - 2819, - 2820, - 2821, - 2822, - 2823, - 2824, - 2825, - 2826, - 2827, - 2828, - 2829, - 2830, - 2831, - 2832, - 2833, - 2834, - 2835, - 2836, - 2837, - 2838, - 2839, - 2840, - 2841, - 2842, - 2843, - 2844, - 2845, - 2846, - 2847, - 2848, - 2849, - 2850, - 2851, - 2852, - 2853, - 2854, - 2855, - 2856, - 2857, - 2858, - 2859, - 2860, - 2861, - 2862, - 2863, - 2864, - 2865, - 2866, - 2867, - 2868, - 2869, - 2870, - 2871, - 2872, - 2873, - 2874, - 2875, - 2876, - 2877, - 2878, - 2879, - 2880, - 2881, - 2882, - 2883, - 2884, - 2885, - 2886, - 2887, - 2888, - 2889, - 2890, - 2891, - 2892, - 2893, - 2894, - 2895, - 2896, - 2897, - 2898, - 2899, - 2900, - 2901, - 2902, - 2903, - 2904, - 2905, - 2906, - 2907, - 2908, - 2909, - 2910, - 2911, - 2912, - 2913, - 2914, - 2915, - 2916, - 2917, - 2918, - 2919, - 2920, - 2921, - 2922, - 2923, - 2924, - 2925, - 2926, - 2927, - 2928, - 2929, - 2930, - 2931, - 2932, - 2933, - 2934, - 2935, - 2936, - 2937, - 2938, - 2939, - 2940, - 2941, - 2942, - 2943, - 2944, - 2945, - 2946, - 2947, - 2948, - 2949, - 2950, - 2951, - 2952, - 2953, - 2954, - 2955, - 2956, - 2957, - 2958, - 2959, - 2960, - 2961, - 2962, - 2963, - 2964, - 2965, - 2966, - 2967, - 2968, - 2969, - 2970, - 2971, - 2972, - 2973, - 2974, - 2975, - 2976, - 2977, - 2978, - 2979, - 2980, - 2981, - 2982, - 2983, - 2984, - 2985, - 2986, - 2987, - 2988, - 2989, - 2990, - 2991, - 2992, - 2993, - 2994, - 2995, - 2996, - 2997, - 2998, - 2999, - 3000, - 3001, - 3002, - 3003, - 3004, - 3005, - 3006, - 3007, - 3008, - 3009, - 3010, - 3011, - 3012, - 3013, - 3014, - 3015, - 3016, - 3017, - 3018, - 3019, - 3020, - 3021, - 3022, - 3023, - 3024, - 3025, - 3026, - 3027, - 3028, - 3029, - 3030, - 3031, - 3032, - 3033, - 3034, - 3035, - 3036, - 3037, - 3038, - 3039, - 3040, - 3041, - 3042, - 3043, - 3044, - 3045, - 3046, - 3047, - 3048, - 3049, - 3050, - 3051, - 3052, - 3053, - 3054, - 3055, - 3056, - 3057, - 3058, - 3059, - 3060, - 3061, - 3062, - 3063, - 3064, - 3065, - 3066, - 3067, - 3068, - 3069, - 3070, - 3071, - 3072, - 3073, - 3074, - 3075, - 3076, - 3077, - 3078, - 3079, - 3080, - 3081, - 3082, - 3083, - 3084, - 3085, - 3086, - 3087, - 3088, - 3089, - 3090, - 3091, - 3092, - 3093, - 3094, - 3095, - 3096, - 3097, - 3098, - 3099, - 3100, - 3101, - 3102, - 3103, - 3104, - 3105, - 3106, - 3107, - 3108, - 3109, - 3110, - 3111, - 3112, - 3113, - 3114, - 3115, - 3116, - 3117, - 3118, - 3119, - 3120, - 3121, - 3122, - 3123, - 3124, - 3125, - 3126, - 3127, - 3128, - 3129, - 3130, - 3131, - 3132, - 3133, - 3134, - 3135, - 3136, - 3137, - 3138, - 3139, - 3140, - 3141, - 3142, - 3143, - 3144, - 3145, - 3146, - 3147, - 3148, - 3149, - 3150, - 3151, - 3152, - 3153, - 3154, - 3155, - 3156, - 3157, - 3158, - 3159, - 3160, - 3161, - 3162, - 3163, - 3164, - 3165, - 3166, - 3167, - 3168, - 3169, - 3170, - 3171, - 3172, - 3173, - 3174, - 3175, - 3176, - 3177, - 3178, - 3179, - 3180, - 3181, - 3182, - 3183, - 3184, - 3185, - 3186, - 3187, - 3188, - 3189, - 3190, - 3191, - 3192, - 3193, - 3194, - 3195, - 3196, - 3197, - 3198, - 3199, - 3200, - 3201, - 3202, - 3203, - 3204, - 3205, - 3206, - 3207, - 3208, - 3209, - 3210, - 3211, - 3212, - 3213, - 3214, - 3215, - 3216, - 3217, - 3218, - 3219, - 3220, - 3221, - 3222, - 3223, - 3224, - 3225, - 3226, - 3227, - 3228, - 3229, - 3230, - 3231, - 3232, - 3233, - 3234, - 3235, - 3236, - 3237, - 3238, - 3239, - 3240, - 3241, - 3242, - 3243, - 3244, - 3245, - 3246, - 3247, - 3248, - 3249, - 3250, - 3251, - 3252, - 3253, - 3254, - 3255, - 3256, - 3257, - 3258, - 3259, - 3260, - 3261, - 3262, - 3263, - 3264, - 3265, - 3266, - 3267, - 3268, - 3269, - 3270, - 3271, - 3272, - 3273, - 3274, - 3275, - 3276, - 3277, - 3278, - 3279, - 3280, - 3281, - 3282, - 3283, - 3284, - 3285, - 3286, - 3287, - 3288, - 3289, - 3290, - 3291, - 3292, - 3293, - 3294, - 3295, - 3296, - 3297, - 3298, - 3299, - 3300, - 3301, - 3302, - 3303, - 3304, - 3305, - 3306, - 3307, - 3308, - 3309, - 3310, - 3311, - 3312, - 3313, - 3314, - 3315, - 3316, - 3317, - 3318, - 3319, - 3320, - 3321, - 3322, - 3323, - 3324, - 3325, - 3326, - 3327, - 3328, - 3329, - 3330, - 3331, - 3332, - 3333, - 3334, - 3335, - 3336, - 3337, - 3338, - 3339, - 3340, - 3341, - 3342, - 3343, - 3344, - 3345, - 3346, - 3347, - 3348, - 3349, - 3350, - 3351, - 3352, - 3353, - 3354, - 3355, - 3356, - 3357, - 3358, - 3359, - 3360, - 3361, - 3362, - 3363, - 3364, - 3365, - 3366, - 3367, - 3368, - 3369, - 3370, - 3371, - 3372, - 3373, - 3374, - 3375, - 3376, - 3377, - 3378, - 3379, - 3380, - 3381, - 3382, - 3383, - 3384, - 3385, - 3386, - 3387, - 3388, - 3389, - 3390, - 3391, - 3392, - 3393, - 3394, - 3395, - 3396, - 3397, - 3398, - 3399, - 3400, - 3401, - 3402, - 3403, - 3404, - 3405, - 3406, - 3407, - 3408, - 3409, - 3410, - 3411, - 3412, - 3413, - 3414, - 3415, - 3416, - 3417, - 3418, - 3419, - 3420, - 3421, - 3422, - 3423, - 3424, - 3425, - 3426, - 3427, - 3428, - 3429, - 3430, - 3431, - 3432, - 3433, - 3434, - 3435, - 3436, - 3437, - 3438, - 3439, - 3440, - 3441, - 3442, - 3443, - 3444, - 3445, - 3446, - 3447, - 3448, - 3449, - 3450, - 3451, - 3452, - 3453, - 3454, - 3455, - 3456, - 3457, - 3458, - 3459, - 3460, - 3461, - 3462, - 3463, - 3464, - 3465, - 3466, - 3467, - 3468, - 3469, - 3470, - 3471, - 3472, - 3473, - 3474, - 3475, - 3476, - 3477, - 3478, - 3479, - 3480, - 3481, - 3482, - 3483, - 3484, - 3485, - 3486, - 3487, - 3488, - 3489, - 3490, - 3491, - 3492, - 3493, - 3494, - 3495, - 3496, - 3497, - 3498, - 3499, - 3500, - 3501, - 3502, - 3503, - 3504, - 3505, - 3506, - 3507, - 3508, - 3509, - 3510, - 3511, - 3512, - 3513, - 3514, - 3515, - 3516, - 3517, - 3518, - 3519, - 3520, - 3521, - 3522, - 3523, - 3524, - 3525, - 3526, - 3527, - 3528, - 3529, - 3530, - 3531, - 3532, - 3533, - 3534, - 3535, - 3536, - 3537, - 3538, - 3539, - 3540, - 3541, - 3542, - 3543, - 3544, - 3545, - 3546, - 3547, - 3548, - 3549, - 3550, - 3551, - 3552, - 3553, - 3554, - 3555, - 3556, - 3557, - 3558, - 3559, - 3560, - 3561, - 3562, - 3563, - 3564, - 3565, - 3566, - 3567, - 3568, - 3569, - 3570, - 3571, - 3572, - 3573, - 3574, - 3575, - 3576, - 3577, - 3578, - 3579, - 3580, - 3581, - 3582, - 3583, - 3584, - 3585, - 3586, - 3587, - 3588, - 3589, - 3590, - 3591, - 3592, - 3593, - 3594, - 3595, - 3596, - 3597, - 3598, - 3599, - 3600, - 3601, - 3602, - 3603, - 3604, - 3605, - 3606, - 3607, - 3608, - 3609, - 3610, - 3611, - 3612, - 3613, - 3614, - 3615, - 3616, - 3617, - 3618, - 3619, - 3620, - 3621, - 3622, - 3623, - 3624, - 3625, - 3626, - 3627, - 3628, - 3629, - 3630, - 3631, - 3632, - 3633, - 3634, - 3635, - 3636, - 3637, - 3638, - 3639, - 3640, - 3641, - 3642, - 3643, - 3644, - 3645, - 3646, - 3647, - 3648, - 3649, - 3650, - 3651, - 3652, - 3653, - 3654, - 3655, - 3656, - 3657, - 3658, - 3659, - 3660, - 3661, - 3662, - 3663, - 3664, - 3665, - 3666, - 3667, - 3668, - 3669, - 3670, - 3671, - 3672, - 3673, - 3674, - 3675, - 3676, - 3677, - 3678, - 3679, - 3680, - 3681, - 3682, - 3683, - 3684, - 3685, - 3686, - 3687, - 3688, - 3689, - 3690, - 3691, - 3692, - 3693, - 3694, - 3695, - 3696, - 3697, - 3698, - 3699, - 3700, - 3701, - 3702, - 3703, - 3704, - 3705, - 3706, - 3707, - 3708, - 3709, - 3710, - 3711, - 3712, - 3713, - 3714, - 3715, - 3716, - 3717, - 3718, - 3719, - 3720, - 3721, - 3722, - 3723, - 3724, - 3725, - 3726, - 3727, - 3728, - 3729, - 3730, - 3731, - 3732, - 3733, - 3734, - 3735, - 3736, - 3737, - 3738, - 3739, - 3740, - 3741, - 3742, - 3743, - 3744, - 3745, - 3746, - 3747, - 3748, - 3749, - 3750, - 3751, - 3752, - 3753, - 3754, - 3755, - 3756, - 3757, - 3758, - 3759, - 3760, - 3761, - 3762, - 3763, - 3764, - 3765, - 3766, - 3767, - 3768, - 3769, - 3770, - 3771, - 3772, - 3773, - 3774, - 3775, - 3776, - 3777, - 3778, - 3779, - 3780, - 3781, - 3782, - 3783, - 3784, - 3785, - 3786, - 3787, - 3788, - 3789, - 3790, - 3791, - 3792, - 3793, - 3794, - 3795, - 3796, - 3797, - 3798, - 3799, - 3800, - 3801, - 3802, - 3803, - 3804, - 3805, - 3806, - 3807, - 3808, - 3809, - 3810, - 3811, - 3812, - 3813, - 3814, - 3815, - 3816, - 3817, - 3818, - 3819, - 3820, - 3821, - 3822, - 3823, - 3824, - 3825, - 3826, - 3827, - 3828, - 3829, - 3830, - 3831, - 3832, - 3833, - 3834, - 3835, - 3836, - 3837, - 3838, - 3839, - 3840, - 3841, - 3842, - 3843, - 3844, - 3845, - 3846, - 3847, - 3848, - 3849, - 3850, - 3851, - 3852, - 3853, - 3854, - 3855, - 3856, - 3857, - 3858, - 3859, - 3860, - 3861, - 3862, - 3863, - 3864, - 3865, - 3866, - 3867, - 3868, - 3869, - 3870, - 3871, - 3872, - 3873, - 3874, - 3875, - 3876, - 3877, - 3878, - 3879, - 3880, - 3881, - 3882, - 3883, - 3884, - 3885, - 3886, - 3887, - 3888, - 3889, - 3890, - 3891, - 3892, - 3893, - 3894, - 3895, - 3896, - 3897, - 3898, - 3899, - 3900, - 3901, - 3902, - 3903, - 3904, - 3905, - 3906, - 3907, - 3908, - 3909, - 3910, - 3911, - 3912, - 3913, - 3914, - 3915, - 3916, - 3917, - 3918, - 3919, - 3920, - 3921, - 3922, - 3923, - 3924, - 3925, - 3926, - 3927, - 3928, - 3929, - 3930, - 3931, - 3932, - 3933, - 3934, - 3935, - 3936, - 3937, - 3938, - 3939, - 3940, - 3941, - 3942, - 3943, - 3944, - 3945, - 3946, - 3947, - 3948, - 3949, - 3950, - 3951, - 3952, - 3953, - 3954, - 3955, - 3956, - 3957, - 3958, - 3959, - 3960, - 3961, - 3962, - 3963, - 3964, - 3965, - 3966, - 3967, - 3968, - 3969, - 3970, - 3971, - 3972, - 3973, - 3974, - 3975, - 3976, - 3977, - 3978, - 3979, - 3980, - 3981, - 3982, - 3983, - 3984, - 3985, - 3986, - 3987, - 3988, - 3989, - 3990, - 3991, - 3992, - 3993, - 3994, - 3995, - 3996, - 3997, - 3998, - 3999, - 4000, - 4001, - 4002, - 4003, - 4004, - 4005, - 4006, - 4007, - 4008, - 4009, - 4010, - 4011, - 4012, - 4013, - 4014, - 4015, - 4016, - 4017, - 4018, - 4019, - 4020, - 4021, - 4022, - 4023, - 4024, - 4025, - 4026, - 4027, - 4028, - 4029, - 4030, - 4031, - 4032, - 4033, - 4034, - 4035, - 4036, - 4037, - 4038, - 4039, - 4040, - 4041, - 4042, - 4043, - 4044, - 4045, - 4046, - 4047, - 4048, - 4049, - 4050, - 4051, - 4052, - 4053, - 4054, - 4055, - 4056, - 4057, - 4058, - 4059, - 4060, - 4061, - 4062, - 4063, - 4064, - 4065, - 4066, - 4067, - 4068, - 4069, - 4070, - 4071, - 4072, - 4073, - 4074, - 4075, - 4076, - 4077, - 4078, - 4079, - 4080, - 4081, - 4082, - 4083, - 4084, - 4085, - 4086, - 4087, - 4088, - 4089, - 4090, - 4091, - 4092, - 4093, - 4094, - 4095, - 4096, - 4097, - 4098, - 4099, - 4100, - 4101, - 4102, - 4103, - 4104, - 4105, - 4106, - 4107, - 4108, - 4109, - 4110, - 4111, - 4112, - 4113, - 4114, - 4115, - 4116, - 4117, - 4118, - 4119, - 4120, - 4121, - 4122, - 4123, - 4124, - 4125, - 4126, - 4127, - 4128, - 4129, - 4130, - 4131, - 4132, - 4133, - 4134, - 4135, - 4136, - 4137, - 4138, - 4139, - 4140, - 4141, - 4142, - 4143, - 4144, - 4145, - 4146, - 4147, - 4148, - 4149, - 4150, - 4151, - 4152, - 4153, - 4154, - 4155, - 4156, - 4157, - 4158, - 4159, - 4160, - 4161, - 4162, - 4163, - 4164, - 4165, - 4166, - 4167, - 4168, - 4169, - 4170, - 4171, - 4172, - 4173, - 4174, - 4175, - 4176, - 4177, - 4178, - 4179, - 4180, - 4181, - 4182, - 4183, - 4184, - 4185, - 4186, - 4187, - 4188, - 4189, - 4190, - 4191, - 4192, - 4193, - 4194, - 4195, - 4196, - 4197, - 4198, - 4199, - 4200, - 4201, - 4202, - 4203, - 4204, - 4205, - 4206, - 4207, - 4208, - 4209, - 4210, - 4211, - 4212, - 4213, - 4214, - 4215, - 4216, - 4217, - 4218, - 4219, - 4220, - 4221, - 4222, - 4223, - 4224, - 4225, - 4226, - 4227, - 4228, - 4229, - 4230, - 4231, - 4232, - 4233, - 4234, - 4235, - 4236, - 4237, - 4238, - 4239, - 4240, - 4241, - 4242, - 4243, - 4244, - 4245, - 4246, - 4247, - 4248, - 4249, - 4250, - 4251, - 4252, - 4253, - 4254, - 4255, - 4256, - 4257, - 4258, - 4259, - 4260, - 4261, - 4262, - 4263, - 4264, - 4265, - 4266, - 4267, - 4268, - 4269, - 4270, - 4271, - 4272, - 4273, - 4274, - 4275, - 4276, - 4277, - 4278, - 4279, - 4280, - 4281, - 4282, - 4283, - 4284, - 4285, - 4286, - 4287, - 4288, - 4289, - 4290, - 4291, - 4292, - 4293, - 4294, - 4295, - 4296, - 4297, - 4298, - 4299, - 4300, - 4301, - 4302, - 4303, - 4304, - 4305, - 4306, - 4307, - 4308, - 4309, - 4310, - 4311, - 4312, - 4313, - 4314, - 4315, - 4316, - 4317, - 4318, - 4319, - 4320, - 4321, - 4322, - 4323, - 4324, - 4325, - 4326, - 4327, - 4328, - 4329, - 4330, - 4331, - 4332, - 4333, - 4334, - 4335, - 4336, - 4337, - 4338, - 4339, - 4340, - 4341, - 4342, - 4343, - 4344, - 4345, - 4346, - 4347, - 4348, - 4349, - 4350, - 4351, - 4352, - 4353, - 4354, - 4355, - 4356, - 4357, - 4358, - 4359, - 4360, - 4361, - 4362, - 4363, - 4364, - 4365, - 4366, - 4367, - 4368, - 4369, - 4370, - 4371, - 4372, - 4373, - 4374, - 4375, - 4376, - 4377, - 4378, - 4379, - 4380, - 4381, - 4382, - 4383, - 4384, - 4385, - 4386, - 4387, - 4388, - 4389, - 4390, - 4391, - 4392, - 4393, - 4394, - 4395, - 4396, - 4397, - 4398, - 4399, - 4400, - 4401, - 4402, - 4403, - 4404, - 4405, - 4406, - 4407, - 4408, - 4409, - 4410, - 4411, - 4412, - 4413, - 4414, - 4415, - 4416, - 4417, - 4418, - 4419, - 4420, - 4421, - 4422, - 4423, - 4424, - 4425, - 4426, - 4427, - 4428, - 4429, - 4430, - 4431, - 4432, - 4433, - 4434, - 4435, - 4436, - 4437, - 4438, - 4439, - 4440, - 4441, - 4442, - 4443, - 4444, - 4445, - 4446, - 4447, - 4448, - 4449, - 4450, - 4451, - 4452, - 4453, - 4454, - 4455, - 4456, - 4457, - 4458, - 4459, - 4460, - 4461, - 4462, - 4463, - 4464, - 4465, - 4466, - 4467, - 4468, - 4469, - 4470, - 4471, - 4472, - 4473, - 4474, - 4475, - 4476, - 4477, - 4478, - 4479, - 4480, - 4481, - 4482, - 4483, - 4484, - 4485, - 4486, - 4487, - 4488, - 4489, - 4490, - 4491, - 4492, - 4493, - 4494, - 4495, - 4496, - 4497, - 4498, - 4499, - 4500, - 4501, - 4502, - 4503, - 4504, - 4505, - 4506, - 4507, - 4508, - 4509, - 4510, - 4511, - 4512, - 4513, - 4514, - 4515, - 4516, - 4517, - 4518, - 4519, - 4520, - 4521, - 4522, - 4523, - 4524, - 4525, - 4526, - 4527, - 4528, - 4529, - 4530, - 4531, - 4532, - 4533, - 4534, - 4535, - 4536, - 4537, - 4538, - 4539, - 4540, - 4541, - 4542, - 4543, - 4544, - 4545, - 4546, - 4547, - 4548, - 4549, - 4550, - 4551, - 4552, - 4553, - 4554, - 4555, - 4556, - 4557, - 4558, - 4559, - 4560, - 4561, - 4562, - 4563, - 4564, - 4565, - 4566, - 4567, - 4568, - 4569, - 4570, - 4571, - 4572, - 4573, - 4574, - 4575, - 4576, - 4577, - 4578, - 4579, - 4580, - 4581, - 4582, - 4583, - 4584, - 4585, - 4586, - 4587, - 4588, - 4589, - 4590, - 4591, - 4592, - 4593, - 4594, - 4595, - 4596, - 4597, - 4598, - 4599, - 4600, - 4601, - 4602, - 4603, - 4604, - 4605, - 4606, - 4607, - 4608, - 4609, - 4610, - 4611, - 4612, - 4613, - 4614, - 4615, - 4616, - 4617, - 4618, - 4619, - 4620, - 4621, - 4622, - 4623, - 4624, - 4625, - 4626, - 4627, - 4628, - 4629, - 4630, - 4631, - 4632, - 4633, - 4634, - 4635, - 4636, - 4637, - 4638, - 4639, - 4640, - 4641, - 4642, - 4643, - 4644, - 4645, - 4646, - 4647, - 4648, - 4649, - 4650, - 4651, - 4652, - 4653, - 4654, - 4655, - 4656, - 4657, - 4658, - 4659, - 4660, - 4661, - 4662, - 4663, - 4664, - 4665, - 4666, - 4667, - 4668, - 4669, - 4670, - 4671, - 4672, - 4673, - 4674, - 4675, - 4676, - 4677, - 4678, - 4679, - 4680, - 4681, - 4682, - 4683, - 4684, - 4685, - 4686, - 4687, - 4688, - 4689, - 4690, - 4691, - 4692, - 4693, - 4694, - 4695, - 4696, - 4697, - 4698, - 4699, - 4700, - 4701, - 4702, - 4703, - 4704, - 4705, - 4706, - 4707, - 4708, - 4709, - 4710, - 4711, - 4712, - 4713, - 4714, - 4715, - 4716, - 4717, - 4718, - 4719, - 4720, - 4721, - 4722, - 4723, - 4724, - 4725, - 4726, - 4727, - 4728, - 4729, - 4730, - 4731, - 4732, - 4733, - 4734, - 4735, - 4736, - 4737, - 4738, - 4739, - 4740, - 4741, - 4742, - 4743, - 4744, - 4745, - 4746, - 4747, - 4748, - 4749, - 4750, - 4751, - 4752, - 4753, - 4754, - 4755, - 4756, - 4757, - 4758, - 4759, - 4760, - 4761, - 4762, - 4763, - 4764, - 4765, - 4766, - 4767, - 4768, - 4769, - 4770, - 4771, - 4772, - 4773, - 4774, - 4775, - 4776, - 4777, - 4778, - 4779, - 4780, - 4781, - 4782, - 4783, - 4784, - 4785, - 4786, - 4787, - 4788, - 4789, - 4790, - 4791, - 4792, - 4793, - 4794, - 4795, - 4796, - 4797, - 4798, - 4799, - 4800, - 4801, - 4802, - 4803, - 4804, - 4805, - 4806, - 4807, - 4808, - 4809, - 4810, - 4811, - 4812, - 4813, - 4814, - 4815, - 4816, - 4817, - 4818, - 4819, - 4820, - 4821, - 4822, - 4823, - 4824, - 4825, - 4826, - 4827, - 4828, - 4829, - 4830, - 4831, - 4832, - 4833, - 4834, - 4835, - 4836, - 4837, - 4838, - 4839, - 4840, - 4841, - 4842, - 4843, - 4844, - 4845, - 4846, - 4847, - 4848, - 4849, - 4850, - 4851, - 4852, - 4853, - 4854, - 4855, - 4856, - 4857, - 4858, - 4859, - 4860, - 4861, - 4862, - 4863, - 4864, - 4865, - 4866, - 4867, - 4868, - 4869, - 4870, - 4871, - 4872, - 4873, - 4874, - 4875, - 4876, - 4877, - 4878, - 4879, - 4880, - 4881, - 4882, - 4883, - 4884, - 4885, - 4886, - 4887, - 4888, - 4889, - 4890, - 4891, - 4892, - 4893, - 4894, - 4895, - 4896, - 4897, - 4898, - 4899, - 4900, - 4901, - 4902, - 4903, - 4904, - 4905, - 4906, - 4907, - 4908, - 4909, - 4910, - 4911, - 4912, - 4913, - 4914, - 4915, - 4916, - 4917, - 4918, - 4919, - 4920, - 4921, - 4922, - 4923, - 4924, - 4925, - 4926, - 4927, - 4928, - 4929, - 4930, - 4931, - 4932, - 4933, - 4934, - 4935, - 4936, - 4937, - 4938, - 4939, - 4940, - 4941, - 4942, - 4943, - 4944, - 4945, - 4946, - 4947, - 4948, - 4949, - 4950, - 4951, - 4952, - 4953, - 4954, - 4955, - 4956, - 4957, - 4958, - 4959, - 4960, - 4961, - 4962, - 4963, - 4964, - 4965, - 4966, - 4967, - 4968, - 4969, - 4970, - 4971, - 4972, - 4973, - 4974, - 4975, - 4976, - 4977, - 4978, - 4979, - 4980, - 4981, - 4982, - 4983, - 4984, - 4985, - 4986, - 4987, - 4988, - 4989, - 4990, - 4991, - 4992, - 4993, - 4994, - 4995, - }; + "list" + ilist => { + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97, + 98, + 99, + 100, + 101, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 120, + 121, + 122, + 123, + 124, + 125, + 126, + 127, + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 135, + 136, + 137, + 138, + 139, + 140, + 141, + 142, + 143, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 152, + 153, + 154, + 155, + 156, + 157, + 158, + 159, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 174, + 175, + 176, + 177, + 178, + 179, + 180, + 181, + 182, + 183, + 184, + 185, + 186, + 187, + 188, + 189, + 190, + 191, + 192, + 193, + 194, + 195, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + 216, + 217, + 218, + 219, + 220, + 221, + 222, + 223, + 224, + 225, + 226, + 227, + 228, + 229, + 230, + 231, + 232, + 233, + 234, + 235, + 236, + 237, + 238, + 239, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 247, + 248, + 249, + 250, + 251, + 252, + 253, + 254, + 255, + 256, + 257, + 258, + 259, + 260, + 261, + 262, + 263, + 264, + 265, + 266, + 267, + 268, + 269, + 270, + 271, + 272, + 273, + 274, + 275, + 276, + 277, + 278, + 279, + 280, + 281, + 282, + 283, + 284, + 285, + 286, + 287, + 288, + 289, + 290, + 291, + 292, + 293, + 294, + 295, + 296, + 297, + 298, + 299, + 300, + 301, + 302, + 303, + 304, + 305, + 306, + 307, + 308, + 309, + 310, + 311, + 312, + 313, + 314, + 315, + 316, + 317, + 318, + 319, + 320, + 321, + 322, + 323, + 324, + 325, + 326, + 327, + 328, + 329, + 330, + 331, + 332, + 333, + 334, + 335, + 336, + 337, + 338, + 339, + 340, + 341, + 342, + 343, + 344, + 345, + 346, + 347, + 348, + 349, + 350, + 351, + 352, + 353, + 354, + 355, + 356, + 357, + 358, + 359, + 360, + 361, + 362, + 363, + 364, + 365, + 366, + 367, + 368, + 369, + 370, + 371, + 372, + 373, + 374, + 375, + 376, + 377, + 378, + 379, + 380, + 381, + 382, + 383, + 384, + 385, + 386, + 387, + 388, + 389, + 390, + 391, + 392, + 393, + 394, + 395, + 396, + 397, + 398, + 399, + 400, + 401, + 402, + 403, + 404, + 405, + 406, + 407, + 408, + 409, + 410, + 411, + 412, + 413, + 414, + 415, + 416, + 417, + 418, + 419, + 420, + 421, + 422, + 423, + 424, + 425, + 426, + 427, + 428, + 429, + 430, + 431, + 432, + 433, + 434, + 435, + 436, + 437, + 438, + 439, + 440, + 441, + 442, + 443, + 444, + 445, + 446, + 447, + 448, + 449, + 450, + 451, + 452, + 453, + 454, + 455, + 456, + 457, + 458, + 459, + 460, + 461, + 462, + 463, + 464, + 465, + 466, + 467, + 468, + 469, + 470, + 471, + 472, + 473, + 474, + 475, + 476, + 477, + 478, + 479, + 480, + 481, + 482, + 483, + 484, + 485, + 486, + 487, + 488, + 489, + 490, + 491, + 492, + 493, + 494, + 495, + 496, + 497, + 498, + 499, + 500, + 501, + 502, + 503, + 504, + 505, + 506, + 507, + 508, + 509, + 510, + 511, + 512, + 513, + 514, + 515, + 516, + 517, + 518, + 519, + 520, + 521, + 522, + 523, + 524, + 525, + 526, + 527, + 528, + 529, + 530, + 531, + 532, + 533, + 534, + 535, + 536, + 537, + 538, + 539, + 540, + 541, + 542, + 543, + 544, + 545, + 546, + 547, + 548, + 549, + 550, + 551, + 552, + 553, + 554, + 555, + 556, + 557, + 558, + 559, + 560, + 561, + 562, + 563, + 564, + 565, + 566, + 567, + 568, + 569, + 570, + 571, + 572, + 573, + 574, + 575, + 576, + 577, + 578, + 579, + 580, + 581, + 582, + 583, + 584, + 585, + 586, + 587, + 588, + 589, + 590, + 591, + 592, + 593, + 594, + 595, + 596, + 597, + 598, + 599, + 600, + 601, + 602, + 603, + 604, + 605, + 606, + 607, + 608, + 609, + 610, + 611, + 612, + 613, + 614, + 615, + 616, + 617, + 618, + 619, + 620, + 621, + 622, + 623, + 624, + 625, + 626, + 627, + 628, + 629, + 630, + 631, + 632, + 633, + 634, + 635, + 636, + 637, + 638, + 639, + 640, + 641, + 642, + 643, + 644, + 645, + 646, + 647, + 648, + 649, + 650, + 651, + 652, + 653, + 654, + 655, + 656, + 657, + 658, + 659, + 660, + 661, + 662, + 663, + 664, + 665, + 666, + 667, + 668, + 669, + 670, + 671, + 672, + 673, + 674, + 675, + 676, + 677, + 678, + 679, + 680, + 681, + 682, + 683, + 684, + 685, + 686, + 687, + 688, + 689, + 690, + 691, + 692, + 693, + 694, + 695, + 696, + 697, + 698, + 699, + 700, + 701, + 702, + 703, + 704, + 705, + 706, + 707, + 708, + 709, + 710, + 711, + 712, + 713, + 714, + 715, + 716, + 717, + 718, + 719, + 720, + 721, + 722, + 723, + 724, + 725, + 726, + 727, + 728, + 729, + 730, + 731, + 732, + 733, + 734, + 735, + 736, + 737, + 738, + 739, + 740, + 741, + 742, + 743, + 744, + 745, + 746, + 747, + 748, + 749, + 750, + 751, + 752, + 753, + 754, + 755, + 756, + 757, + 758, + 759, + 760, + 761, + 762, + 763, + 764, + 765, + 766, + 767, + 768, + 769, + 770, + 771, + 772, + 773, + 774, + 775, + 776, + 777, + 778, + 779, + 780, + 781, + 782, + 783, + 784, + 785, + 786, + 787, + 788, + 789, + 790, + 791, + 792, + 793, + 794, + 795, + 796, + 797, + 798, + 799, + 800, + 801, + 802, + 803, + 804, + 805, + 806, + 807, + 808, + 809, + 810, + 811, + 812, + 813, + 814, + 815, + 816, + 817, + 818, + 819, + 820, + 821, + 822, + 823, + 824, + 825, + 826, + 827, + 828, + 829, + 830, + 831, + 832, + 833, + 834, + 835, + 836, + 837, + 838, + 839, + 840, + 841, + 842, + 843, + 844, + 845, + 846, + 847, + 848, + 849, + 850, + 851, + 852, + 853, + 854, + 855, + 856, + 857, + 858, + 859, + 860, + 861, + 862, + 863, + 864, + 865, + 866, + 867, + 868, + 869, + 870, + 871, + 872, + 873, + 874, + 875, + 876, + 877, + 878, + 879, + 880, + 881, + 882, + 883, + 884, + 885, + 886, + 887, + 888, + 889, + 890, + 891, + 892, + 893, + 894, + 895, + 896, + 897, + 898, + 899, + 900, + 901, + 902, + 903, + 904, + 905, + 906, + 907, + 908, + 909, + 910, + 911, + 912, + 913, + 914, + 915, + 916, + 917, + 918, + 919, + 920, + 921, + 922, + 923, + 924, + 925, + 926, + 927, + 928, + 929, + 930, + 931, + 932, + 933, + 934, + 935, + 936, + 937, + 938, + 939, + 940, + 941, + 942, + 943, + 944, + 945, + 946, + 947, + 948, + 949, + 950, + 951, + 952, + 953, + 954, + 955, + 956, + 957, + 958, + 959, + 960, + 961, + 962, + 963, + 964, + 965, + 966, + 967, + 968, + 969, + 970, + 971, + 972, + 973, + 974, + 975, + 976, + 977, + 978, + 979, + 980, + 981, + 982, + 983, + 984, + 985, + 986, + 987, + 988, + 989, + 990, + 991, + 992, + 993, + 994, + 995, + 996, + 997, + 998, + 999, + 1000, + 1001, + 1002, + 1003, + 1004, + 1005, + 1006, + 1007, + 1008, + 1009, + 1010, + 1011, + 1012, + 1013, + 1014, + 1015, + 1016, + 1017, + 1018, + 1019, + 1020, + 1021, + 1022, + 1023, + 1024, + 1025, + 1026, + 1027, + 1028, + 1029, + 1030, + 1031, + 1032, + 1033, + 1034, + 1035, + 1036, + 1037, + 1038, + 1039, + 1040, + 1041, + 1042, + 1043, + 1044, + 1045, + 1046, + 1047, + 1048, + 1049, + 1050, + 1051, + 1052, + 1053, + 1054, + 1055, + 1056, + 1057, + 1058, + 1059, + 1060, + 1061, + 1062, + 1063, + 1064, + 1065, + 1066, + 1067, + 1068, + 1069, + 1070, + 1071, + 1072, + 1073, + 1074, + 1075, + 1076, + 1077, + 1078, + 1079, + 1080, + 1081, + 1082, + 1083, + 1084, + 1085, + 1086, + 1087, + 1088, + 1089, + 1090, + 1091, + 1092, + 1093, + 1094, + 1095, + 1096, + 1097, + 1098, + 1099, + 1100, + 1101, + 1102, + 1103, + 1104, + 1105, + 1106, + 1107, + 1108, + 1109, + 1110, + 1111, + 1112, + 1113, + 1114, + 1115, + 1116, + 1117, + 1118, + 1119, + 1120, + 1121, + 1122, + 1123, + 1124, + 1125, + 1126, + 1127, + 1128, + 1129, + 1130, + 1131, + 1132, + 1133, + 1134, + 1135, + 1136, + 1137, + 1138, + 1139, + 1140, + 1141, + 1142, + 1143, + 1144, + 1145, + 1146, + 1147, + 1148, + 1149, + 1150, + 1151, + 1152, + 1153, + 1154, + 1155, + 1156, + 1157, + 1158, + 1159, + 1160, + 1161, + 1162, + 1163, + 1164, + 1165, + 1166, + 1167, + 1168, + 1169, + 1170, + 1171, + 1172, + 1173, + 1174, + 1175, + 1176, + 1177, + 1178, + 1179, + 1180, + 1181, + 1182, + 1183, + 1184, + 1185, + 1186, + 1187, + 1188, + 1189, + 1190, + 1191, + 1192, + 1193, + 1194, + 1195, + 1196, + 1197, + 1198, + 1199, + 1200, + 1201, + 1202, + 1203, + 1204, + 1205, + 1206, + 1207, + 1208, + 1209, + 1210, + 1211, + 1212, + 1213, + 1214, + 1215, + 1216, + 1217, + 1218, + 1219, + 1220, + 1221, + 1222, + 1223, + 1224, + 1225, + 1226, + 1227, + 1228, + 1229, + 1230, + 1231, + 1232, + 1233, + 1234, + 1235, + 1236, + 1237, + 1238, + 1239, + 1240, + 1241, + 1242, + 1243, + 1244, + 1245, + 1246, + 1247, + 1248, + 1249, + 1250, + 1251, + 1252, + 1253, + 1254, + 1255, + 1256, + 1257, + 1258, + 1259, + 1260, + 1261, + 1262, + 1263, + 1264, + 1265, + 1266, + 1267, + 1268, + 1269, + 1270, + 1271, + 1272, + 1273, + 1274, + 1275, + 1276, + 1277, + 1278, + 1279, + 1280, + 1281, + 1282, + 1283, + 1284, + 1285, + 1286, + 1287, + 1288, + 1289, + 1290, + 1291, + 1292, + 1293, + 1294, + 1295, + 1296, + 1297, + 1298, + 1299, + 1300, + 1301, + 1302, + 1303, + 1304, + 1305, + 1306, + 1307, + 1308, + 1309, + 1310, + 1311, + 1312, + 1313, + 1314, + 1315, + 1316, + 1317, + 1318, + 1319, + 1320, + 1321, + 1322, + 1323, + 1324, + 1325, + 1326, + 1327, + 1328, + 1329, + 1330, + 1331, + 1332, + 1333, + 1334, + 1335, + 1336, + 1337, + 1338, + 1339, + 1340, + 1341, + 1342, + 1343, + 1344, + 1345, + 1346, + 1347, + 1348, + 1349, + 1350, + 1351, + 1352, + 1353, + 1354, + 1355, + 1356, + 1357, + 1358, + 1359, + 1360, + 1361, + 1362, + 1363, + 1364, + 1365, + 1366, + 1367, + 1368, + 1369, + 1370, + 1371, + 1372, + 1373, + 1374, + 1375, + 1376, + 1377, + 1378, + 1379, + 1380, + 1381, + 1382, + 1383, + 1384, + 1385, + 1386, + 1387, + 1388, + 1389, + 1390, + 1391, + 1392, + 1393, + 1394, + 1395, + 1396, + 1397, + 1398, + 1399, + 1400, + 1401, + 1402, + 1403, + 1404, + 1405, + 1406, + 1407, + 1408, + 1409, + 1410, + 1411, + 1412, + 1413, + 1414, + 1415, + 1416, + 1417, + 1418, + 1419, + 1420, + 1421, + 1422, + 1423, + 1424, + 1425, + 1426, + 1427, + 1428, + 1429, + 1430, + 1431, + 1432, + 1433, + 1434, + 1435, + 1436, + 1437, + 1438, + 1439, + 1440, + 1441, + 1442, + 1443, + 1444, + 1445, + 1446, + 1447, + 1448, + 1449, + 1450, + 1451, + 1452, + 1453, + 1454, + 1455, + 1456, + 1457, + 1458, + 1459, + 1460, + 1461, + 1462, + 1463, + 1464, + 1465, + 1466, + 1467, + 1468, + 1469, + 1470, + 1471, + 1472, + 1473, + 1474, + 1475, + 1476, + 1477, + 1478, + 1479, + 1480, + 1481, + 1482, + 1483, + 1484, + 1485, + 1486, + 1487, + 1488, + 1489, + 1490, + 1491, + 1492, + 1493, + 1494, + 1495, + 1496, + 1497, + 1498, + 1499, + 1500, + 1501, + 1502, + 1503, + 1504, + 1505, + 1506, + 1507, + 1508, + 1509, + 1510, + 1511, + 1512, + 1513, + 1514, + 1515, + 1516, + 1517, + 1518, + 1519, + 1520, + 1521, + 1522, + 1523, + 1524, + 1525, + 1526, + 1527, + 1528, + 1529, + 1530, + 1531, + 1532, + 1533, + 1534, + 1535, + 1536, + 1537, + 1538, + 1539, + 1540, + 1541, + 1542, + 1543, + 1544, + 1545, + 1546, + 1547, + 1548, + 1549, + 1550, + 1551, + 1552, + 1553, + 1554, + 1555, + 1556, + 1557, + 1558, + 1559, + 1560, + 1561, + 1562, + 1563, + 1564, + 1565, + 1566, + 1567, + 1568, + 1569, + 1570, + 1571, + 1572, + 1573, + 1574, + 1575, + 1576, + 1577, + 1578, + 1579, + 1580, + 1581, + 1582, + 1583, + 1584, + 1585, + 1586, + 1587, + 1588, + 1589, + 1590, + 1591, + 1592, + 1593, + 1594, + 1595, + 1596, + 1597, + 1598, + 1599, + 1600, + 1601, + 1602, + 1603, + 1604, + 1605, + 1606, + 1607, + 1608, + 1609, + 1610, + 1611, + 1612, + 1613, + 1614, + 1615, + 1616, + 1617, + 1618, + 1619, + 1620, + 1621, + 1622, + 1623, + 1624, + 1625, + 1626, + 1627, + 1628, + 1629, + 1630, + 1631, + 1632, + 1633, + 1634, + 1635, + 1636, + 1637, + 1638, + 1639, + 1640, + 1641, + 1642, + 1643, + 1644, + 1645, + 1646, + 1647, + 1648, + 1649, + 1650, + 1651, + 1652, + 1653, + 1654, + 1655, + 1656, + 1657, + 1658, + 1659, + 1660, + 1661, + 1662, + 1663, + 1664, + 1665, + 1666, + 1667, + 1668, + 1669, + 1670, + 1671, + 1672, + 1673, + 1674, + 1675, + 1676, + 1677, + 1678, + 1679, + 1680, + 1681, + 1682, + 1683, + 1684, + 1685, + 1686, + 1687, + 1688, + 1689, + 1690, + 1691, + 1692, + 1693, + 1694, + 1695, + 1696, + 1697, + 1698, + 1699, + 1700, + 1701, + 1702, + 1703, + 1704, + 1705, + 1706, + 1707, + 1708, + 1709, + 1710, + 1711, + 1712, + 1713, + 1714, + 1715, + 1716, + 1717, + 1718, + 1719, + 1720, + 1721, + 1722, + 1723, + 1724, + 1725, + 1726, + 1727, + 1728, + 1729, + 1730, + 1731, + 1732, + 1733, + 1734, + 1735, + 1736, + 1737, + 1738, + 1739, + 1740, + 1741, + 1742, + 1743, + 1744, + 1745, + 1746, + 1747, + 1748, + 1749, + 1750, + 1751, + 1752, + 1753, + 1754, + 1755, + 1756, + 1757, + 1758, + 1759, + 1760, + 1761, + 1762, + 1763, + 1764, + 1765, + 1766, + 1767, + 1768, + 1769, + 1770, + 1771, + 1772, + 1773, + 1774, + 1775, + 1776, + 1777, + 1778, + 1779, + 1780, + 1781, + 1782, + 1783, + 1784, + 1785, + 1786, + 1787, + 1788, + 1789, + 1790, + 1791, + 1792, + 1793, + 1794, + 1795, + 1796, + 1797, + 1798, + 1799, + 1800, + 1801, + 1802, + 1803, + 1804, + 1805, + 1806, + 1807, + 1808, + 1809, + 1810, + 1811, + 1812, + 1813, + 1814, + 1815, + 1816, + 1817, + 1818, + 1819, + 1820, + 1821, + 1822, + 1823, + 1824, + 1825, + 1826, + 1827, + 1828, + 1829, + 1830, + 1831, + 1832, + 1833, + 1834, + 1835, + 1836, + 1837, + 1838, + 1839, + 1840, + 1841, + 1842, + 1843, + 1844, + 1845, + 1846, + 1847, + 1848, + 1849, + 1850, + 1851, + 1852, + 1853, + 1854, + 1855, + 1856, + 1857, + 1858, + 1859, + 1860, + 1861, + 1862, + 1863, + 1864, + 1865, + 1866, + 1867, + 1868, + 1869, + 1870, + 1871, + 1872, + 1873, + 1874, + 1875, + 1876, + 1877, + 1878, + 1879, + 1880, + 1881, + 1882, + 1883, + 1884, + 1885, + 1886, + 1887, + 1888, + 1889, + 1890, + 1891, + 1892, + 1893, + 1894, + 1895, + 1896, + 1897, + 1898, + 1899, + 1900, + 1901, + 1902, + 1903, + 1904, + 1905, + 1906, + 1907, + 1908, + 1909, + 1910, + 1911, + 1912, + 1913, + 1914, + 1915, + 1916, + 1917, + 1918, + 1919, + 1920, + 1921, + 1922, + 1923, + 1924, + 1925, + 1926, + 1927, + 1928, + 1929, + 1930, + 1931, + 1932, + 1933, + 1934, + 1935, + 1936, + 1937, + 1938, + 1939, + 1940, + 1941, + 1942, + 1943, + 1944, + 1945, + 1946, + 1947, + 1948, + 1949, + 1950, + 1951, + 1952, + 1953, + 1954, + 1955, + 1956, + 1957, + 1958, + 1959, + 1960, + 1961, + 1962, + 1963, + 1964, + 1965, + 1966, + 1967, + 1968, + 1969, + 1970, + 1971, + 1972, + 1973, + 1974, + 1975, + 1976, + 1977, + 1978, + 1979, + 1980, + 1981, + 1982, + 1983, + 1984, + 1985, + 1986, + 1987, + 1988, + 1989, + 1990, + 1991, + 1992, + 1993, + 1994, + 1995, + 1996, + 1997, + 1998, + 1999, + 2000, + 2001, + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030, + 2031, + 2032, + 2033, + 2034, + 2035, + 2036, + 2037, + 2038, + 2039, + 2040, + 2041, + 2042, + 2043, + 2044, + 2045, + 2046, + 2047, + 2048, + 2049, + 2050, + 2051, + 2052, + 2053, + 2054, + 2055, + 2056, + 2057, + 2058, + 2059, + 2060, + 2061, + 2062, + 2063, + 2064, + 2065, + 2066, + 2067, + 2068, + 2069, + 2070, + 2071, + 2072, + 2073, + 2074, + 2075, + 2076, + 2077, + 2078, + 2079, + 2080, + 2081, + 2082, + 2083, + 2084, + 2085, + 2086, + 2087, + 2088, + 2089, + 2090, + 2091, + 2092, + 2093, + 2094, + 2095, + 2096, + 2097, + 2098, + 2099, + 2100, + 2101, + 2102, + 2103, + 2104, + 2105, + 2106, + 2107, + 2108, + 2109, + 2110, + 2111, + 2112, + 2113, + 2114, + 2115, + 2116, + 2117, + 2118, + 2119, + 2120, + 2121, + 2122, + 2123, + 2124, + 2125, + 2126, + 2127, + 2128, + 2129, + 2130, + 2131, + 2132, + 2133, + 2134, + 2135, + 2136, + 2137, + 2138, + 2139, + 2140, + 2141, + 2142, + 2143, + 2144, + 2145, + 2146, + 2147, + 2148, + 2149, + 2150, + 2151, + 2152, + 2153, + 2154, + 2155, + 2156, + 2157, + 2158, + 2159, + 2160, + 2161, + 2162, + 2163, + 2164, + 2165, + 2166, + 2167, + 2168, + 2169, + 2170, + 2171, + 2172, + 2173, + 2174, + 2175, + 2176, + 2177, + 2178, + 2179, + 2180, + 2181, + 2182, + 2183, + 2184, + 2185, + 2186, + 2187, + 2188, + 2189, + 2190, + 2191, + 2192, + 2193, + 2194, + 2195, + 2196, + 2197, + 2198, + 2199, + 2200, + 2201, + 2202, + 2203, + 2204, + 2205, + 2206, + 2207, + 2208, + 2209, + 2210, + 2211, + 2212, + 2213, + 2214, + 2215, + 2216, + 2217, + 2218, + 2219, + 2220, + 2221, + 2222, + 2223, + 2224, + 2225, + 2226, + 2227, + 2228, + 2229, + 2230, + 2231, + 2232, + 2233, + 2234, + 2235, + 2236, + 2237, + 2238, + 2239, + 2240, + 2241, + 2242, + 2243, + 2244, + 2245, + 2246, + 2247, + 2248, + 2249, + 2250, + 2251, + 2252, + 2253, + 2254, + 2255, + 2256, + 2257, + 2258, + 2259, + 2260, + 2261, + 2262, + 2263, + 2264, + 2265, + 2266, + 2267, + 2268, + 2269, + 2270, + 2271, + 2272, + 2273, + 2274, + 2275, + 2276, + 2277, + 2278, + 2279, + 2280, + 2281, + 2282, + 2283, + 2284, + 2285, + 2286, + 2287, + 2288, + 2289, + 2290, + 2291, + 2292, + 2293, + 2294, + 2295, + 2296, + 2297, + 2298, + 2299, + 2300, + 2301, + 2302, + 2303, + 2304, + 2305, + 2306, + 2307, + 2308, + 2309, + 2310, + 2311, + 2312, + 2313, + 2314, + 2315, + 2316, + 2317, + 2318, + 2319, + 2320, + 2321, + 2322, + 2323, + 2324, + 2325, + 2326, + 2327, + 2328, + 2329, + 2330, + 2331, + 2332, + 2333, + 2334, + 2335, + 2336, + 2337, + 2338, + 2339, + 2340, + 2341, + 2342, + 2343, + 2344, + 2345, + 2346, + 2347, + 2348, + 2349, + 2350, + 2351, + 2352, + 2353, + 2354, + 2355, + 2356, + 2357, + 2358, + 2359, + 2360, + 2361, + 2362, + 2363, + 2364, + 2365, + 2366, + 2367, + 2368, + 2369, + 2370, + 2371, + 2372, + 2373, + 2374, + 2375, + 2376, + 2377, + 2378, + 2379, + 2380, + 2381, + 2382, + 2383, + 2384, + 2385, + 2386, + 2387, + 2388, + 2389, + 2390, + 2391, + 2392, + 2393, + 2394, + 2395, + 2396, + 2397, + 2398, + 2399, + 2400, + 2401, + 2402, + 2403, + 2404, + 2405, + 2406, + 2407, + 2408, + 2409, + 2410, + 2411, + 2412, + 2413, + 2414, + 2415, + 2416, + 2417, + 2418, + 2419, + 2420, + 2421, + 2422, + 2423, + 2424, + 2425, + 2426, + 2427, + 2428, + 2429, + 2430, + 2431, + 2432, + 2433, + 2434, + 2435, + 2436, + 2437, + 2438, + 2439, + 2440, + 2441, + 2442, + 2443, + 2444, + 2445, + 2446, + 2447, + 2448, + 2449, + 2450, + 2451, + 2452, + 2453, + 2454, + 2455, + 2456, + 2457, + 2458, + 2459, + 2460, + 2461, + 2462, + 2463, + 2464, + 2465, + 2466, + 2467, + 2468, + 2469, + 2470, + 2471, + 2472, + 2473, + 2474, + 2475, + 2476, + 2477, + 2478, + 2479, + 2480, + 2481, + 2482, + 2483, + 2484, + 2485, + 2486, + 2487, + 2488, + 2489, + 2490, + 2491, + 2492, + 2493, + 2494, + 2495, + 2496, + 2497, + 2498, + 2499, + 2500, + 2501, + 2502, + 2503, + 2504, + 2505, + 2506, + 2507, + 2508, + 2509, + 2510, + 2511, + 2512, + 2513, + 2514, + 2515, + 2516, + 2517, + 2518, + 2519, + 2520, + 2521, + 2522, + 2523, + 2524, + 2525, + 2526, + 2527, + 2528, + 2529, + 2530, + 2531, + 2532, + 2533, + 2534, + 2535, + 2536, + 2537, + 2538, + 2539, + 2540, + 2541, + 2542, + 2543, + 2544, + 2545, + 2546, + 2547, + 2548, + 2549, + 2550, + 2551, + 2552, + 2553, + 2554, + 2555, + 2556, + 2557, + 2558, + 2559, + 2560, + 2561, + 2562, + 2563, + 2564, + 2565, + 2566, + 2567, + 2568, + 2569, + 2570, + 2571, + 2572, + 2573, + 2574, + 2575, + 2576, + 2577, + 2578, + 2579, + 2580, + 2581, + 2582, + 2583, + 2584, + 2585, + 2586, + 2587, + 2588, + 2589, + 2590, + 2591, + 2592, + 2593, + 2594, + 2595, + 2596, + 2597, + 2598, + 2599, + 2600, + 2601, + 2602, + 2603, + 2604, + 2605, + 2606, + 2607, + 2608, + 2609, + 2610, + 2611, + 2612, + 2613, + 2614, + 2615, + 2616, + 2617, + 2618, + 2619, + 2620, + 2621, + 2622, + 2623, + 2624, + 2625, + 2626, + 2627, + 2628, + 2629, + 2630, + 2631, + 2632, + 2633, + 2634, + 2635, + 2636, + 2637, + 2638, + 2639, + 2640, + 2641, + 2642, + 2643, + 2644, + 2645, + 2646, + 2647, + 2648, + 2649, + 2650, + 2651, + 2652, + 2653, + 2654, + 2655, + 2656, + 2657, + 2658, + 2659, + 2660, + 2661, + 2662, + 2663, + 2664, + 2665, + 2666, + 2667, + 2668, + 2669, + 2670, + 2671, + 2672, + 2673, + 2674, + 2675, + 2676, + 2677, + 2678, + 2679, + 2680, + 2681, + 2682, + 2683, + 2684, + 2685, + 2686, + 2687, + 2688, + 2689, + 2690, + 2691, + 2692, + 2693, + 2694, + 2695, + 2696, + 2697, + 2698, + 2699, + 2700, + 2701, + 2702, + 2703, + 2704, + 2705, + 2706, + 2707, + 2708, + 2709, + 2710, + 2711, + 2712, + 2713, + 2714, + 2715, + 2716, + 2717, + 2718, + 2719, + 2720, + 2721, + 2722, + 2723, + 2724, + 2725, + 2726, + 2727, + 2728, + 2729, + 2730, + 2731, + 2732, + 2733, + 2734, + 2735, + 2736, + 2737, + 2738, + 2739, + 2740, + 2741, + 2742, + 2743, + 2744, + 2745, + 2746, + 2747, + 2748, + 2749, + 2750, + 2751, + 2752, + 2753, + 2754, + 2755, + 2756, + 2757, + 2758, + 2759, + 2760, + 2761, + 2762, + 2763, + 2764, + 2765, + 2766, + 2767, + 2768, + 2769, + 2770, + 2771, + 2772, + 2773, + 2774, + 2775, + 2776, + 2777, + 2778, + 2779, + 2780, + 2781, + 2782, + 2783, + 2784, + 2785, + 2786, + 2787, + 2788, + 2789, + 2790, + 2791, + 2792, + 2793, + 2794, + 2795, + 2796, + 2797, + 2798, + 2799, + 2800, + 2801, + 2802, + 2803, + 2804, + 2805, + 2806, + 2807, + 2808, + 2809, + 2810, + 2811, + 2812, + 2813, + 2814, + 2815, + 2816, + 2817, + 2818, + 2819, + 2820, + 2821, + 2822, + 2823, + 2824, + 2825, + 2826, + 2827, + 2828, + 2829, + 2830, + 2831, + 2832, + 2833, + 2834, + 2835, + 2836, + 2837, + 2838, + 2839, + 2840, + 2841, + 2842, + 2843, + 2844, + 2845, + 2846, + 2847, + 2848, + 2849, + 2850, + 2851, + 2852, + 2853, + 2854, + 2855, + 2856, + 2857, + 2858, + 2859, + 2860, + 2861, + 2862, + 2863, + 2864, + 2865, + 2866, + 2867, + 2868, + 2869, + 2870, + 2871, + 2872, + 2873, + 2874, + 2875, + 2876, + 2877, + 2878, + 2879, + 2880, + 2881, + 2882, + 2883, + 2884, + 2885, + 2886, + 2887, + 2888, + 2889, + 2890, + 2891, + 2892, + 2893, + 2894, + 2895, + 2896, + 2897, + 2898, + 2899, + 2900, + 2901, + 2902, + 2903, + 2904, + 2905, + 2906, + 2907, + 2908, + 2909, + 2910, + 2911, + 2912, + 2913, + 2914, + 2915, + 2916, + 2917, + 2918, + 2919, + 2920, + 2921, + 2922, + 2923, + 2924, + 2925, + 2926, + 2927, + 2928, + 2929, + 2930, + 2931, + 2932, + 2933, + 2934, + 2935, + 2936, + 2937, + 2938, + 2939, + 2940, + 2941, + 2942, + 2943, + 2944, + 2945, + 2946, + 2947, + 2948, + 2949, + 2950, + 2951, + 2952, + 2953, + 2954, + 2955, + 2956, + 2957, + 2958, + 2959, + 2960, + 2961, + 2962, + 2963, + 2964, + 2965, + 2966, + 2967, + 2968, + 2969, + 2970, + 2971, + 2972, + 2973, + 2974, + 2975, + 2976, + 2977, + 2978, + 2979, + 2980, + 2981, + 2982, + 2983, + 2984, + 2985, + 2986, + 2987, + 2988, + 2989, + 2990, + 2991, + 2992, + 2993, + 2994, + 2995, + 2996, + 2997, + 2998, + 2999, + 3000, + 3001, + 3002, + 3003, + 3004, + 3005, + 3006, + 3007, + 3008, + 3009, + 3010, + 3011, + 3012, + 3013, + 3014, + 3015, + 3016, + 3017, + 3018, + 3019, + 3020, + 3021, + 3022, + 3023, + 3024, + 3025, + 3026, + 3027, + 3028, + 3029, + 3030, + 3031, + 3032, + 3033, + 3034, + 3035, + 3036, + 3037, + 3038, + 3039, + 3040, + 3041, + 3042, + 3043, + 3044, + 3045, + 3046, + 3047, + 3048, + 3049, + 3050, + 3051, + 3052, + 3053, + 3054, + 3055, + 3056, + 3057, + 3058, + 3059, + 3060, + 3061, + 3062, + 3063, + 3064, + 3065, + 3066, + 3067, + 3068, + 3069, + 3070, + 3071, + 3072, + 3073, + 3074, + 3075, + 3076, + 3077, + 3078, + 3079, + 3080, + 3081, + 3082, + 3083, + 3084, + 3085, + 3086, + 3087, + 3088, + 3089, + 3090, + 3091, + 3092, + 3093, + 3094, + 3095, + 3096, + 3097, + 3098, + 3099, + 3100, + 3101, + 3102, + 3103, + 3104, + 3105, + 3106, + 3107, + 3108, + 3109, + 3110, + 3111, + 3112, + 3113, + 3114, + 3115, + 3116, + 3117, + 3118, + 3119, + 3120, + 3121, + 3122, + 3123, + 3124, + 3125, + 3126, + 3127, + 3128, + 3129, + 3130, + 3131, + 3132, + 3133, + 3134, + 3135, + 3136, + 3137, + 3138, + 3139, + 3140, + 3141, + 3142, + 3143, + 3144, + 3145, + 3146, + 3147, + 3148, + 3149, + 3150, + 3151, + 3152, + 3153, + 3154, + 3155, + 3156, + 3157, + 3158, + 3159, + 3160, + 3161, + 3162, + 3163, + 3164, + 3165, + 3166, + 3167, + 3168, + 3169, + 3170, + 3171, + 3172, + 3173, + 3174, + 3175, + 3176, + 3177, + 3178, + 3179, + 3180, + 3181, + 3182, + 3183, + 3184, + 3185, + 3186, + 3187, + 3188, + 3189, + 3190, + 3191, + 3192, + 3193, + 3194, + 3195, + 3196, + 3197, + 3198, + 3199, + 3200, + 3201, + 3202, + 3203, + 3204, + 3205, + 3206, + 3207, + 3208, + 3209, + 3210, + 3211, + 3212, + 3213, + 3214, + 3215, + 3216, + 3217, + 3218, + 3219, + 3220, + 3221, + 3222, + 3223, + 3224, + 3225, + 3226, + 3227, + 3228, + 3229, + 3230, + 3231, + 3232, + 3233, + 3234, + 3235, + 3236, + 3237, + 3238, + 3239, + 3240, + 3241, + 3242, + 3243, + 3244, + 3245, + 3246, + 3247, + 3248, + 3249, + 3250, + 3251, + 3252, + 3253, + 3254, + 3255, + 3256, + 3257, + 3258, + 3259, + 3260, + 3261, + 3262, + 3263, + 3264, + 3265, + 3266, + 3267, + 3268, + 3269, + 3270, + 3271, + 3272, + 3273, + 3274, + 3275, + 3276, + 3277, + 3278, + 3279, + 3280, + 3281, + 3282, + 3283, + 3284, + 3285, + 3286, + 3287, + 3288, + 3289, + 3290, + 3291, + 3292, + 3293, + 3294, + 3295, + 3296, + 3297, + 3298, + 3299, + 3300, + 3301, + 3302, + 3303, + 3304, + 3305, + 3306, + 3307, + 3308, + 3309, + 3310, + 3311, + 3312, + 3313, + 3314, + 3315, + 3316, + 3317, + 3318, + 3319, + 3320, + 3321, + 3322, + 3323, + 3324, + 3325, + 3326, + 3327, + 3328, + 3329, + 3330, + 3331, + 3332, + 3333, + 3334, + 3335, + 3336, + 3337, + 3338, + 3339, + 3340, + 3341, + 3342, + 3343, + 3344, + 3345, + 3346, + 3347, + 3348, + 3349, + 3350, + 3351, + 3352, + 3353, + 3354, + 3355, + 3356, + 3357, + 3358, + 3359, + 3360, + 3361, + 3362, + 3363, + 3364, + 3365, + 3366, + 3367, + 3368, + 3369, + 3370, + 3371, + 3372, + 3373, + 3374, + 3375, + 3376, + 3377, + 3378, + 3379, + 3380, + 3381, + 3382, + 3383, + 3384, + 3385, + 3386, + 3387, + 3388, + 3389, + 3390, + 3391, + 3392, + 3393, + 3394, + 3395, + 3396, + 3397, + 3398, + 3399, + 3400, + 3401, + 3402, + 3403, + 3404, + 3405, + 3406, + 3407, + 3408, + 3409, + 3410, + 3411, + 3412, + 3413, + 3414, + 3415, + 3416, + 3417, + 3418, + 3419, + 3420, + 3421, + 3422, + 3423, + 3424, + 3425, + 3426, + 3427, + 3428, + 3429, + 3430, + 3431, + 3432, + 3433, + 3434, + 3435, + 3436, + 3437, + 3438, + 3439, + 3440, + 3441, + 3442, + 3443, + 3444, + 3445, + 3446, + 3447, + 3448, + 3449, + 3450, + 3451, + 3452, + 3453, + 3454, + 3455, + 3456, + 3457, + 3458, + 3459, + 3460, + 3461, + 3462, + 3463, + 3464, + 3465, + 3466, + 3467, + 3468, + 3469, + 3470, + 3471, + 3472, + 3473, + 3474, + 3475, + 3476, + 3477, + 3478, + 3479, + 3480, + 3481, + 3482, + 3483, + 3484, + 3485, + 3486, + 3487, + 3488, + 3489, + 3490, + 3491, + 3492, + 3493, + 3494, + 3495, + 3496, + 3497, + 3498, + 3499, + 3500, + 3501, + 3502, + 3503, + 3504, + 3505, + 3506, + 3507, + 3508, + 3509, + 3510, + 3511, + 3512, + 3513, + 3514, + 3515, + 3516, + 3517, + 3518, + 3519, + 3520, + 3521, + 3522, + 3523, + 3524, + 3525, + 3526, + 3527, + 3528, + 3529, + 3530, + 3531, + 3532, + 3533, + 3534, + 3535, + 3536, + 3537, + 3538, + 3539, + 3540, + 3541, + 3542, + 3543, + 3544, + 3545, + 3546, + 3547, + 3548, + 3549, + 3550, + 3551, + 3552, + 3553, + 3554, + 3555, + 3556, + 3557, + 3558, + 3559, + 3560, + 3561, + 3562, + 3563, + 3564, + 3565, + 3566, + 3567, + 3568, + 3569, + 3570, + 3571, + 3572, + 3573, + 3574, + 3575, + 3576, + 3577, + 3578, + 3579, + 3580, + 3581, + 3582, + 3583, + 3584, + 3585, + 3586, + 3587, + 3588, + 3589, + 3590, + 3591, + 3592, + 3593, + 3594, + 3595, + 3596, + 3597, + 3598, + 3599, + 3600, + 3601, + 3602, + 3603, + 3604, + 3605, + 3606, + 3607, + 3608, + 3609, + 3610, + 3611, + 3612, + 3613, + 3614, + 3615, + 3616, + 3617, + 3618, + 3619, + 3620, + 3621, + 3622, + 3623, + 3624, + 3625, + 3626, + 3627, + 3628, + 3629, + 3630, + 3631, + 3632, + 3633, + 3634, + 3635, + 3636, + 3637, + 3638, + 3639, + 3640, + 3641, + 3642, + 3643, + 3644, + 3645, + 3646, + 3647, + 3648, + 3649, + 3650, + 3651, + 3652, + 3653, + 3654, + 3655, + 3656, + 3657, + 3658, + 3659, + 3660, + 3661, + 3662, + 3663, + 3664, + 3665, + 3666, + 3667, + 3668, + 3669, + 3670, + 3671, + 3672, + 3673, + 3674, + 3675, + 3676, + 3677, + 3678, + 3679, + 3680, + 3681, + 3682, + 3683, + 3684, + 3685, + 3686, + 3687, + 3688, + 3689, + 3690, + 3691, + 3692, + 3693, + 3694, + 3695, + 3696, + 3697, + 3698, + 3699, + 3700, + 3701, + 3702, + 3703, + 3704, + 3705, + 3706, + 3707, + 3708, + 3709, + 3710, + 3711, + 3712, + 3713, + 3714, + 3715, + 3716, + 3717, + 3718, + 3719, + 3720, + 3721, + 3722, + 3723, + 3724, + 3725, + 3726, + 3727, + 3728, + 3729, + 3730, + 3731, + 3732, + 3733, + 3734, + 3735, + 3736, + 3737, + 3738, + 3739, + 3740, + 3741, + 3742, + 3743, + 3744, + 3745, + 3746, + 3747, + 3748, + 3749, + 3750, + 3751, + 3752, + 3753, + 3754, + 3755, + 3756, + 3757, + 3758, + 3759, + 3760, + 3761, + 3762, + 3763, + 3764, + 3765, + 3766, + 3767, + 3768, + 3769, + 3770, + 3771, + 3772, + 3773, + 3774, + 3775, + 3776, + 3777, + 3778, + 3779, + 3780, + 3781, + 3782, + 3783, + 3784, + 3785, + 3786, + 3787, + 3788, + 3789, + 3790, + 3791, + 3792, + 3793, + 3794, + 3795, + 3796, + 3797, + 3798, + 3799, + 3800, + 3801, + 3802, + 3803, + 3804, + 3805, + 3806, + 3807, + 3808, + 3809, + 3810, + 3811, + 3812, + 3813, + 3814, + 3815, + 3816, + 3817, + 3818, + 3819, + 3820, + 3821, + 3822, + 3823, + 3824, + 3825, + 3826, + 3827, + 3828, + 3829, + 3830, + 3831, + 3832, + 3833, + 3834, + 3835, + 3836, + 3837, + 3838, + 3839, + 3840, + 3841, + 3842, + 3843, + 3844, + 3845, + 3846, + 3847, + 3848, + 3849, + 3850, + 3851, + 3852, + 3853, + 3854, + 3855, + 3856, + 3857, + 3858, + 3859, + 3860, + 3861, + 3862, + 3863, + 3864, + 3865, + 3866, + 3867, + 3868, + 3869, + 3870, + 3871, + 3872, + 3873, + 3874, + 3875, + 3876, + 3877, + 3878, + 3879, + 3880, + 3881, + 3882, + 3883, + 3884, + 3885, + 3886, + 3887, + 3888, + 3889, + 3890, + 3891, + 3892, + 3893, + 3894, + 3895, + 3896, + 3897, + 3898, + 3899, + 3900, + 3901, + 3902, + 3903, + 3904, + 3905, + 3906, + 3907, + 3908, + 3909, + 3910, + 3911, + 3912, + 3913, + 3914, + 3915, + 3916, + 3917, + 3918, + 3919, + 3920, + 3921, + 3922, + 3923, + 3924, + 3925, + 3926, + 3927, + 3928, + 3929, + 3930, + 3931, + 3932, + 3933, + 3934, + 3935, + 3936, + 3937, + 3938, + 3939, + 3940, + 3941, + 3942, + 3943, + 3944, + 3945, + 3946, + 3947, + 3948, + 3949, + 3950, + 3951, + 3952, + 3953, + 3954, + 3955, + 3956, + 3957, + 3958, + 3959, + 3960, + 3961, + 3962, + 3963, + 3964, + 3965, + 3966, + 3967, + 3968, + 3969, + 3970, + 3971, + 3972, + 3973, + 3974, + 3975, + 3976, + 3977, + 3978, + 3979, + 3980, + 3981, + 3982, + 3983, + 3984, + 3985, + 3986, + 3987, + 3988, + 3989, + 3990, + 3991, + 3992, + 3993, + 3994, + 3995, + 3996, + 3997, + 3998, + 3999, + 4000, + 4001, + 4002, + 4003, + 4004, + 4005, + 4006, + 4007, + 4008, + 4009, + 4010, + 4011, + 4012, + 4013, + 4014, + 4015, + 4016, + 4017, + 4018, + 4019, + 4020, + 4021, + 4022, + 4023, + 4024, + 4025, + 4026, + 4027, + 4028, + 4029, + 4030, + 4031, + 4032, + 4033, + 4034, + 4035, + 4036, + 4037, + 4038, + 4039, + 4040, + 4041, + 4042, + 4043, + 4044, + 4045, + 4046, + 4047, + 4048, + 4049, + 4050, + 4051, + 4052, + 4053, + 4054, + 4055, + 4056, + 4057, + 4058, + 4059, + 4060, + 4061, + 4062, + 4063, + 4064, + 4065, + 4066, + 4067, + 4068, + 4069, + 4070, + 4071, + 4072, + 4073, + 4074, + 4075, + 4076, + 4077, + 4078, + 4079, + 4080, + 4081, + 4082, + 4083, + 4084, + 4085, + 4086, + 4087, + 4088, + 4089, + 4090, + 4091, + 4092, + 4093, + 4094, + 4095, + 4096, + 4097, + 4098, + 4099, + 4100, + 4101, + 4102, + 4103, + 4104, + 4105, + 4106, + 4107, + 4108, + 4109, + 4110, + 4111, + 4112, + 4113, + 4114, + 4115, + 4116, + 4117, + 4118, + 4119, + 4120, + 4121, + 4122, + 4123, + 4124, + 4125, + 4126, + 4127, + 4128, + 4129, + 4130, + 4131, + 4132, + 4133, + 4134, + 4135, + 4136, + 4137, + 4138, + 4139, + 4140, + 4141, + 4142, + 4143, + 4144, + 4145, + 4146, + 4147, + 4148, + 4149, + 4150, + 4151, + 4152, + 4153, + 4154, + 4155, + 4156, + 4157, + 4158, + 4159, + 4160, + 4161, + 4162, + 4163, + 4164, + 4165, + 4166, + 4167, + 4168, + 4169, + 4170, + 4171, + 4172, + 4173, + 4174, + 4175, + 4176, + 4177, + 4178, + 4179, + 4180, + 4181, + 4182, + 4183, + 4184, + 4185, + 4186, + 4187, + 4188, + 4189, + 4190, + 4191, + 4192, + 4193, + 4194, + 4195, + 4196, + 4197, + 4198, + 4199, + 4200, + 4201, + 4202, + 4203, + 4204, + 4205, + 4206, + 4207, + 4208, + 4209, + 4210, + 4211, + 4212, + 4213, + 4214, + 4215, + 4216, + 4217, + 4218, + 4219, + 4220, + 4221, + 4222, + 4223, + 4224, + 4225, + 4226, + 4227, + 4228, + 4229, + 4230, + 4231, + 4232, + 4233, + 4234, + 4235, + 4236, + 4237, + 4238, + 4239, + 4240, + 4241, + 4242, + 4243, + 4244, + 4245, + 4246, + 4247, + 4248, + 4249, + 4250, + 4251, + 4252, + 4253, + 4254, + 4255, + 4256, + 4257, + 4258, + 4259, + 4260, + 4261, + 4262, + 4263, + 4264, + 4265, + 4266, + 4267, + 4268, + 4269, + 4270, + 4271, + 4272, + 4273, + 4274, + 4275, + 4276, + 4277, + 4278, + 4279, + 4280, + 4281, + 4282, + 4283, + 4284, + 4285, + 4286, + 4287, + 4288, + 4289, + 4290, + 4291, + 4292, + 4293, + 4294, + 4295, + 4296, + 4297, + 4298, + 4299, + 4300, + 4301, + 4302, + 4303, + 4304, + 4305, + 4306, + 4307, + 4308, + 4309, + 4310, + 4311, + 4312, + 4313, + 4314, + 4315, + 4316, + 4317, + 4318, + 4319, + 4320, + 4321, + 4322, + 4323, + 4324, + 4325, + 4326, + 4327, + 4328, + 4329, + 4330, + 4331, + 4332, + 4333, + 4334, + 4335, + 4336, + 4337, + 4338, + 4339, + 4340, + 4341, + 4342, + 4343, + 4344, + 4345, + 4346, + 4347, + 4348, + 4349, + 4350, + 4351, + 4352, + 4353, + 4354, + 4355, + 4356, + 4357, + 4358, + 4359, + 4360, + 4361, + 4362, + 4363, + 4364, + 4365, + 4366, + 4367, + 4368, + 4369, + 4370, + 4371, + 4372, + 4373, + 4374, + 4375, + 4376, + 4377, + 4378, + 4379, + 4380, + 4381, + 4382, + 4383, + 4384, + 4385, + 4386, + 4387, + 4388, + 4389, + 4390, + 4391, + 4392, + 4393, + 4394, + 4395, + 4396, + 4397, + 4398, + 4399, + 4400, + 4401, + 4402, + 4403, + 4404, + 4405, + 4406, + 4407, + 4408, + 4409, + 4410, + 4411, + 4412, + 4413, + 4414, + 4415, + 4416, + 4417, + 4418, + 4419, + 4420, + 4421, + 4422, + 4423, + 4424, + 4425, + 4426, + 4427, + 4428, + 4429, + 4430, + 4431, + 4432, + 4433, + 4434, + 4435, + 4436, + 4437, + 4438, + 4439, + 4440, + 4441, + 4442, + 4443, + 4444, + 4445, + 4446, + 4447, + 4448, + 4449, + 4450, + 4451, + 4452, + 4453, + 4454, + 4455, + 4456, + 4457, + 4458, + 4459, + 4460, + 4461, + 4462, + 4463, + 4464, + 4465, + 4466, + 4467, + 4468, + 4469, + 4470, + 4471, + 4472, + 4473, + 4474, + 4475, + 4476, + 4477, + 4478, + 4479, + 4480, + 4481, + 4482, + 4483, + 4484, + 4485, + 4486, + 4487, + 4488, + 4489, + 4490, + 4491, + 4492, + 4493, + 4494, + 4495, + 4496, + 4497, + 4498, + 4499, + 4500, + 4501, + 4502, + 4503, + 4504, + 4505, + 4506, + 4507, + 4508, + 4509, + 4510, + 4511, + 4512, + 4513, + 4514, + 4515, + 4516, + 4517, + 4518, + 4519, + 4520, + 4521, + 4522, + 4523, + 4524, + 4525, + 4526, + 4527, + 4528, + 4529, + 4530, + 4531, + 4532, + 4533, + 4534, + 4535, + 4536, + 4537, + 4538, + 4539, + 4540, + 4541, + 4542, + 4543, + 4544, + 4545, + 4546, + 4547, + 4548, + 4549, + 4550, + 4551, + 4552, + 4553, + 4554, + 4555, + 4556, + 4557, + 4558, + 4559, + 4560, + 4561, + 4562, + 4563, + 4564, + 4565, + 4566, + 4567, + 4568, + 4569, + 4570, + 4571, + 4572, + 4573, + 4574, + 4575, + 4576, + 4577, + 4578, + 4579, + 4580, + 4581, + 4582, + 4583, + 4584, + 4585, + 4586, + 4587, + 4588, + 4589, + 4590, + 4591, + 4592, + 4593, + 4594, + 4595, + 4596, + 4597, + 4598, + 4599, + 4600, + 4601, + 4602, + 4603, + 4604, + 4605, + 4606, + 4607, + 4608, + 4609, + 4610, + 4611, + 4612, + 4613, + 4614, + 4615, + 4616, + 4617, + 4618, + 4619, + 4620, + 4621, + 4622, + 4623, + 4624, + 4625, + 4626, + 4627, + 4628, + 4629, + 4630, + 4631, + 4632, + 4633, + 4634, + 4635, + 4636, + 4637, + 4638, + 4639, + 4640, + 4641, + 4642, + 4643, + 4644, + 4645, + 4646, + 4647, + 4648, + 4649, + 4650, + 4651, + 4652, + 4653, + 4654, + 4655, + 4656, + 4657, + 4658, + 4659, + 4660, + 4661, + 4662, + 4663, + 4664, + 4665, + 4666, + 4667, + 4668, + 4669, + 4670, + 4671, + 4672, + 4673, + 4674, + 4675, + 4676, + 4677, + 4678, + 4679, + 4680, + 4681, + 4682, + 4683, + 4684, + 4685, + 4686, + 4687, + 4688, + 4689, + 4690, + 4691, + 4692, + 4693, + 4694, + 4695, + 4696, + 4697, + 4698, + 4699, + 4700, + 4701, + 4702, + 4703, + 4704, + 4705, + 4706, + 4707, + 4708, + 4709, + 4710, + 4711, + 4712, + 4713, + 4714, + 4715, + 4716, + 4717, + 4718, + 4719, + 4720, + 4721, + 4722, + 4723, + 4724, + 4725, + 4726, + 4727, + 4728, + 4729, + 4730, + 4731, + 4732, + 4733, + 4734, + 4735, + 4736, + 4737, + 4738, + 4739, + 4740, + 4741, + 4742, + 4743, + 4744, + 4745, + 4746, + 4747, + 4748, + 4749, + 4750, + 4751, + 4752, + 4753, + 4754, + 4755, + 4756, + 4757, + 4758, + 4759, + 4760, + 4761, + 4762, + 4763, + 4764, + 4765, + 4766, + 4767, + 4768, + 4769, + 4770, + 4771, + 4772, + 4773, + 4774, + 4775, + 4776, + 4777, + 4778, + 4779, + 4780, + 4781, + 4782, + 4783, + 4784, + 4785, + 4786, + 4787, + 4788, + 4789, + 4790, + 4791, + 4792, + 4793, + 4794, + 4795, + 4796, + 4797, + 4798, + 4799, + 4800, + 4801, + 4802, + 4803, + 4804, + 4805, + 4806, + 4807, + 4808, + 4809, + 4810, + 4811, + 4812, + 4813, + 4814, + 4815, + 4816, + 4817, + 4818, + 4819, + 4820, + 4821, + 4822, + 4823, + 4824, + 4825, + 4826, + 4827, + 4828, + 4829, + 4830, + 4831, + 4832, + 4833, + 4834, + 4835, + 4836, + 4837, + 4838, + 4839, + 4840, + 4841, + 4842, + 4843, + 4844, + 4845, + 4846, + 4847, + 4848, + 4849, + 4850, + 4851, + 4852, + 4853, + 4854, + 4855, + 4856, + 4857, + 4858, + 4859, + 4860, + 4861, + 4862, + 4863, + 4864, + 4865, + 4866, + 4867, + 4868, + 4869, + 4870, + 4871, + 4872, + 4873, + 4874, + 4875, + 4876, + 4877, + 4878, + 4879, + 4880, + 4881, + 4882, + 4883, + 4884, + 4885, + 4886, + 4887, + 4888, + 4889, + 4890, + 4891, + 4892, + 4893, + 4894, + 4895, + 4896, + 4897, + 4898, + 4899, + 4900, + 4901, + 4902, + 4903, + 4904, + 4905, + 4906, + 4907, + 4908, + 4909, + 4910, + 4911, + 4912, + 4913, + 4914, + 4915, + 4916, + 4917, + 4918, + 4919, + 4920, + 4921, + 4922, + 4923, + 4924, + 4925, + 4926, + 4927, + 4928, + 4929, + 4930, + 4931, + 4932, + 4933, + 4934, + 4935, + 4936, + 4937, + 4938, + 4939, + 4940, + 4941, + 4942, + 4943, + 4944, + 4945, + 4946, + 4947, + 4948, + 4949, + 4950, + 4951, + 4952, + 4953, + 4954, + 4955, + 4956, + 4957, + 4958, + 4959, + 4960, + 4961, + 4962, + 4963, + 4964, + 4965, + 4966, + 4967, + 4968, + 4969, + 4970, + 4971, + 4972, + 4973, + 4974, + 4975, + 4976, + 4977, + 4978, + 4979, + 4980, + 4981, + 4982, + 4983, + 4984, + 4985, + 4986, + 4987, + 4988, + 4989, + 4990, + 4991, + 4992, + 4993, + 4994, + 4995, + }; } bundle agent test @@ -5022,8 +5024,10 @@ bundle agent check reports: DEBUG:: "List length should be 4995, and is computed to be $(test.list_len)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/parse_number.cf b/tests/acceptance/01_vars/01_basic/parse_number.cf index 2b13bbe44a..5da016b274 100644 --- a/tests/acceptance/01_vars/01_basic/parse_number.cf +++ b/tests/acceptance/01_vars/01_basic/parse_number.cf @@ -3,96 +3,120 @@ # Test basic interpretation of digits as numbers. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "digits" string => "42"; - "zero" string => "00000"; - "negate" string => "-137"; - "spacey" string => "17 + "digits" string => "42"; + "zero" string => "00000"; + "negate" string => "-137"; + "spacey" string => "17 -"; # Spaces ignored after number - "kilo" string => "42k"; - "kibi" string => "42K"; - "mega" string => "42m"; - "mibi" string => "42M"; - # NB: 42g fails on 32-bit - many places go via int, which overflows (Redmine 4404). - "giga" string => "1g"; - "gibi" string => "1G"; - "pi" string => "3.141592653589793238462643383279502884197169399375105820974"; - "nowt" string => "-000.0000e137"; - "nogiga" string => "0e0G "; # quantifier and spaces - "me2pi" string => "-.5354916555247646e-3M"; # minus exp(two pi) - - "whole" slist => { "digits", "zero", "negate", "spacey", - "kilo", "kibi", "mega", "mibi", "giga", "gibi" }; - "float" slist => { "pi", "nowt", "nogiga", "me2pi" }; - - # Expected answers: - "round[digits]" string => "$(digits)"; - "round[zero]" string => "0"; - "round[negate]" string => "$(negate)"; - "round[spacey]" string => "17"; - "round[kilo]" string => "42000"; - "round[kibi]" string => "43008"; - "round[mega]" string => "42000000"; - "round[mibi]" string => "44040192"; - "round[giga]" string => "1000000000"; - "round[gibi]" string => "1073741824"; +"; + + # Spaces ignored after number + "kilo" string => "42k"; + "kibi" string => "42K"; + "mega" string => "42m"; + "mibi" string => "42M"; + + # NB: 42g fails on 32-bit - many places go via int, which overflows (Redmine 4404). + "giga" string => "1g"; + "gibi" string => "1G"; + + "pi" + string => "3.141592653589793238462643383279502884197169399375105820974"; + + "nowt" string => "-000.0000e137"; + "nogiga" string => "0e0G "; + + # quantifier and spaces + "me2pi" string => "-.5354916555247646e-3M"; + + # minus exp(two pi) + "whole" + slist => { + "digits", + "zero", + "negate", + "spacey", + "kilo", + "kibi", + "mega", + "mibi", + "giga", + "gibi", + }; + + "float" slist => { "pi", "nowt", "nogiga", "me2pi" }; + + # Expected answers: + "round[digits]" string => "$(digits)"; + "round[zero]" string => "0"; + "round[negate]" string => "$(negate)"; + "round[spacey]" string => "17"; + "round[kilo]" string => "42000"; + "round[kibi]" string => "43008"; + "round[mega]" string => "42000000"; + "round[mibi]" string => "44040192"; + "round[giga]" string => "1000000000"; + "round[gibi]" string => "1073741824"; "ratio[$(whole)]" string => "$(round[$(whole)]).000000"; - "ratio[pi]" string => "3.14159265"; - "ratio[nowt]" string => "$(ratio[zero])"; - "ratio[nogiga]" string => "$(ratio[zero])"; - "ratio[me2pi]" string => "535.491656"; + "ratio[pi]" string => "3.14159265"; + "ratio[nowt]" string => "$(ratio[zero])"; + "ratio[nogiga]" string => "$(ratio[zero])"; + "ratio[me2pi]" string => "535.491656"; } ####################################################### - bundle agent test { vars: - "round[$(init.whole)]" int => "$(init.$(init.whole))"; - "ratio[$(init.whole)]" real => "$(init.$(init.whole))"; - "ratio[$(init.float)]" real => "$(init.$(init.float))"; + "round[$(init.whole)]" int => "$(init.$(init.whole))"; + "ratio[$(init.whole)]" real => "$(init.$(init.whole))"; + "ratio[$(init.float)]" real => "$(init.$(init.float))"; } - ####################################################### - bundle agent check { vars: - "float" slist => { @(init.whole), @(init.float) }; + "float" slist => { @(init.whole), @(init.float) }; classes: - "whole_$(init.whole)" expression => strcmp("$(test.round[$(init.whole)])", - "$(init.round[$(init.whole)])"); - "float_$(float)" expression => strcmp("$(test.ratio[$(float)])", - "$(init.ratio[$(float)])"); - "$(init.whole)" and => { "whole_$(init.whole)", "float_$(init.whole)" }; - "$(init.float)" and => { "float_$(init.whole)" }; - "iok" and => { @(init.whole) }; - "rok" and => { @(init.float) }; - "ok" and => { "iok", "rok" }; + "whole_$(init.whole)" + expression => strcmp( + "$(test.round[$(init.whole)])", "$(init.round[$(init.whole)])" + ); + + "float_$(float)" + expression => strcmp( + "$(test.ratio[$(float)])", "$(init.ratio[$(float)])" + ); + + "$(init.whole)" and => { "whole_$(init.whole)", "float_$(init.whole)" }; + "$(init.float)" and => { "float_$(init.whole)" }; + "iok" and => { @(init.whole) }; + "rok" and => { @(init.float) }; + "ok" and => { "iok", "rok" }; reports: DEBUG.!iok:: "Read $(init.$(init.whole)) as int $(test.round[$(init.whole)]), expected $(init.round[$(init.whole)])"; + DEBUG.!rok:: "Read $(init.$(float)) as real $(test.ratio[$(float)]), expected $(init.ratio[$(float)])"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/parse_number_3572.cf b/tests/acceptance/01_vars/01_basic/parse_number_3572.cf index 3a89bbd1b0..db236e057b 100644 --- a/tests/acceptance/01_vars/01_basic/parse_number_3572.cf +++ b/tests/acceptance/01_vars/01_basic/parse_number_3572.cf @@ -3,57 +3,55 @@ # Regression test for RedMine #3572. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "digits" string => "42"; + "digits" string => "42"; } ####################################################### - bundle agent test { vars: - "number" int => "$(init.digits)"; - "floaty" real => "$(init.digits)"; + "number" int => "$(init.digits)"; + "floaty" real => "$(init.digits)"; # RedMine #3572: this stanza should make no difference, but actually # caused the numbers to be unexpanded, hence not "42" but literally # "$(init.digits)", which doesn't parse as a number ! classes: - "ignored" not => "any"; - # (In fact, even an empty classes stanza provoked the bug - but is - # that even valid ?) -} + "ignored" not => "any"; + # (In fact, even an empty classes stanza provoked the bug - but is + # that even valid ?) +} ####################################################### - bundle agent check { classes: - "iok" expression => strcmp("$(test.number)", "$(init.digits)"); - "rok" expression => strcmp("$(test.floaty)", "42.000000"); - "ok" and => { "iok", "rok" }; + "iok" expression => strcmp("$(test.number)", "$(init.digits)"); + "rok" expression => strcmp("$(test.floaty)", "42.000000"); + "ok" and => { "iok", "rok" }; reports: DEBUG.!iok:: "Read $(init.digits) as int $(test.number)"; + DEBUG.!rok:: "Read $(init.digits) as real $(test.floaty)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/policy_release_id.cf b/tests/acceptance/01_vars/01_basic/policy_release_id.cf index 5f53ad807e..30595fdb93 100644 --- a/tests/acceptance/01_vars/01_basic/policy_release_id.cf +++ b/tests/acceptance/01_vars/01_basic/policy_release_id.cf @@ -5,28 +5,41 @@ body common control version => "1.0"; } - bundle agent test { vars: - "release_id_list" slist => variablesmatching("default:sys.policy_release_id"); + "release_id_list" + slist => variablesmatching("default:sys.policy_release_id"); + "escaped" string => escape("$(sys.policy_entry_dirname)"); - "release_id_regex" string => "^$(escaped)\/(bootstrap|failsafe|\(null\)|[A-Fa-f0-9]+)?$"; + + "release_id_regex" + string => "^$(escaped)\/(bootstrap|failsafe|\(null\)|[A-Fa-f0-9]+)?$"; classes: - "var_ok" expression => strcmp("$(release_id_list)", "default:sys.policy_release_id"); - "reg_ok" expression => regcmp("$(release_id_regex)", "$(sys.policy_release_id)"); + "var_ok" + expression => strcmp( + "$(release_id_list)", "default:sys.policy_release_id" + ); + + "reg_ok" + expression => regcmp("$(release_id_regex)", "$(sys.policy_release_id)"); + "ok" expression => and("var_ok", "reg_ok"); reports: DEBUG:: "Found: $(release_id_list), Correct: $(sys.policy_release_id)"; + DEBUG.var_ok:: "var ok"; + DEBUG.reg_ok:: "reg_ok"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/promise_dirname.cf b/tests/acceptance/01_vars/01_basic/promise_dirname.cf index aa94f27963..2f5c252c6b 100644 --- a/tests/acceptance/01_vars/01_basic/promise_dirname.cf +++ b/tests/acceptance/01_vars/01_basic/promise_dirname.cf @@ -1,31 +1,27 @@ # Test $(this.promise_dirname) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { vars: - "expected" string => dirname($(this.promise_filename)); + "expected" string => dirname($(this.promise_filename)); } ####################################################### - bundle agent test { } ####################################################### - bundle agent check { classes: - "ok" expression => strcmp($(init.expected), $(this.promise_dirname)); + "ok" expression => strcmp($(init.expected), $(this.promise_dirname)); reports: DEBUG:: @@ -33,6 +29,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/qualified_array_with_spaced_index.cf b/tests/acceptance/01_vars/01_basic/qualified_array_with_spaced_index.cf index a56f2c8432..37081cb635 100644 --- a/tests/acceptance/01_vars/01_basic/qualified_array_with_spaced_index.cf +++ b/tests/acceptance/01_vars/01_basic/qualified_array_with_spaced_index.cf @@ -4,40 +4,38 @@ # qualified and the index contains spaces # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { vars: - "array[one two three]" string => "snookie"; + "array[one two three]" string => "snookie"; } ####################################################### - bundle agent check { classes: - "ok" expression => strcmp("snookie", "$(test.array[one two three])"); + "ok" expression => strcmp("snookie", "$(test.array[one two three])"); reports: DEBUG:: "array: $(test.array[one two])"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/staging/011.cf b/tests/acceptance/01_vars/01_basic/staging/011.cf index 67ff9673b2..900a7bf320 100644 --- a/tests/acceptance/01_vars/01_basic/staging/011.cf +++ b/tests/acceptance/01_vars/01_basic/staging/011.cf @@ -3,67 +3,54 @@ # Test missing variable expansion consistency # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "foo" int => "42"; - "baz[a]" string => "alpha"; - "gar" string => "$(missing)"; - "bletch" string => "$(gar)"; + "foo" int => "42"; + "baz[a]" string => "alpha"; + "gar" string => "$(missing)"; + "bletch" string => "$(gar)"; classes: - # Known values should test easily - "s_foo" expression => strcmp("$(foo)", "42"); - "s_baz_a" expression => strcmp("$(baz[a])", "alpha"); - # Missing variable names expand to $(varname) in reports and should - # expand to the same value in strcmp... - "s_missing" expression => strcmp("$(missing)", "$(const.dollar)(missing)"); - "s_baz_b" expression => strcmp("$(baz[b])", "$(const.dollar)(baz[b])"); - # We test the rest two ways because we assigned a missing variable to - # another variable - first the literal assigned value and then the - # expanded version testing for missing vars - "s_gar" expression => strcmp("$(gar)", "$(missing)"); - "s_gar2" expression => strcmp("$(gar)", "$(const.dollar)(missing)"); - "s_bletch" expression => strcmp("$(bletch)", "$(missing)"); - "s_bletch2" expression => strcmp("$(bletch)", "$(const.dollar)(missing)"); - - "good" and => { - "s_foo", - "s_baz_a", - "s_gar", - "s_gar2", - "s_bletch", - "s_bletch2", - }; - - "v_missing" expression => isvariable("missing"); - "v_baz" expression => isvariable("baz"); - "v_baz_b" expression => isvariable("baz[b]"); - - "bad" or => { - "v_missing", - "v_baz", - "v_baz_b", - "v_baz_x", - }; - - "ok" expression => "good&!bad"; + # Known values should test easily + "s_foo" expression => strcmp("$(foo)", "42"); + "s_baz_a" expression => strcmp("$(baz[a])", "alpha"); + + # Missing variable names expand to $(varname) in reports and should + # expand to the same value in strcmp... + "s_missing" expression => strcmp("$(missing)", "$(const.dollar)(missing)"); + "s_baz_b" expression => strcmp("$(baz[b])", "$(const.dollar)(baz[b])"); + + # We test the rest two ways because we assigned a missing variable to + # another variable - first the literal assigned value and then the + # expanded version testing for missing vars + "s_gar" expression => strcmp("$(gar)", "$(missing)"); + "s_gar2" expression => strcmp("$(gar)", "$(const.dollar)(missing)"); + "s_bletch" expression => strcmp("$(bletch)", "$(missing)"); + "s_bletch2" expression => strcmp("$(bletch)", "$(const.dollar)(missing)"); + + "good" + and => { "s_foo", "s_baz_a", "s_gar", "s_gar2", "s_bletch", "s_bletch2" }; + + "v_missing" expression => isvariable("missing"); + "v_baz" expression => isvariable("baz"); + "v_baz_b" expression => isvariable("baz[b]"); + "bad" or => { "v_missing", "v_baz", "v_baz_b", "v_baz_x" }; + "ok" expression => "good&!bad"; reports: DEBUG.ok:: @@ -71,19 +58,25 @@ bundle agent test DEBUG.!ok:: "Saw unexpected results!!"; + DEBUG.v_missing:: "$(const.dollar)missing is a variable, and shouldn't be!"; + DEBUG.v_baz:: "$(const.dollar)baz is a variable, and shouldn't be!"; + DEBUG.v_baz_b:: "$(const.dollar)baz[b] is a variable, and shouldn't be!"; DEBUG.!s_foo:: "expected $(const.dollar)foo = '42', saw '$(foo)'"; + DEBUG.!s_baz_a:: "expected $(const.dollar)baz[a] = 'alpha', saw '$(baz[a])'"; + DEBUG.!(s_gar.s_gar2):: "expected $(const.dollar)gar = '$(const.dollar)(missing)', saw '$(gar)'"; + DEBUG.!(s_bletch.s_bletch2):: "expected $(const.dollar)bletch = '$(const.dollar)(missing)', saw '$(bletch)'"; } @@ -96,5 +89,4 @@ bundle agent check !ok:: "$(this.promise_filename) FAIL"; - } diff --git a/tests/acceptance/01_vars/01_basic/staging/025.cf b/tests/acceptance/01_vars/01_basic/staging/025.cf index 85ab267d94..2c10f17a3b 100644 --- a/tests/acceptance/01_vars/01_basic/staging/025.cf +++ b/tests/acceptance/01_vars/01_basic/staging/025.cf @@ -3,99 +3,106 @@ # Test irange # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - # Normal order - "r1" string => irange(10,20); - "r2" string => irange("10","20"); - "r3" string => irange("1k","2K"); - "r4" string => irange("1m","2M"); - "r5" string => irange("1g","2G"); - "r6" string => irange("-20",10); - - # Reverse order - "x1" string => irange(20,10); - "x2" string => irange("20","10"); - "x3" string => irange("2K","1k"); - "x4" string => irange("2M","1m"); - "x5" string => irange("2G","1g"); - "x6" string => irange(10,"-20"); - - # String equivalent - "s1" string => "10,20"; - "s2" string => "10,20"; - "s3" string => "1000,2048"; - "s4" string => "1000000,2097152"; - "s5" string => "1000000000,2147483648"; - "s6" string => "-20,10"; + # Normal order + "r1" string => irange(10, 20); + "r2" string => irange("10", "20"); + "r3" string => irange("1k", "2K"); + "r4" string => irange("1m", "2M"); + "r5" string => irange("1g", "2G"); + "r6" string => irange("-20", 10); + + # Reverse order + "x1" string => irange(20, 10); + "x2" string => irange("20", "10"); + "x3" string => irange("2K", "1k"); + "x4" string => irange("2M", "1m"); + "x5" string => irange("2G", "1g"); + "x6" string => irange(10, "-20"); + + # String equivalent + "s1" string => "10,20"; + "s2" string => "10,20"; + "s3" string => "1000,2048"; + "s4" string => "1000000,2097152"; + "s5" string => "1000000000,2147483648"; + "s6" string => "-20,10"; } ####################################################### - bundle agent check { classes: - "ok1" and => { - strcmp("$(test.r1)", "$(test.x1)"), - strcmp("$(test.r1)", "$(test.s1)"), + "ok1" + and => { + strcmp("$(test.r1)", "$(test.x1)"), strcmp("$(test.r1)", "$(test.s1)"), }; - "ok2" and => { - strcmp("$(test.r2)", "$(test.x2)"), - strcmp("$(test.r2)", "$(test.s2)"), + + "ok2" + and => { + strcmp("$(test.r2)", "$(test.x2)"), strcmp("$(test.r2)", "$(test.s2)"), }; - "ok3" and => { - strcmp("$(test.r3)", "$(test.x3)"), - strcmp("$(test.r3)", "$(test.s3)"), + + "ok3" + and => { + strcmp("$(test.r3)", "$(test.x3)"), strcmp("$(test.r3)", "$(test.s3)"), }; - "ok4" and => { - strcmp("$(test.r4)", "$(test.x4)"), - strcmp("$(test.r4)", "$(test.s4)"), + + "ok4" + and => { + strcmp("$(test.r4)", "$(test.x4)"), strcmp("$(test.r4)", "$(test.s4)"), }; - "ok5" and => { - strcmp("$(test.r5)", "$(test.x5)"), - strcmp("$(test.r5)", "$(test.s5)"), + + "ok5" + and => { + strcmp("$(test.r5)", "$(test.x5)"), strcmp("$(test.r5)", "$(test.s5)"), }; - "ok6" and => { - strcmp("$(test.r6)", "$(test.x6)"), - strcmp("$(test.r6)", "$(test.s6)"), + + "ok6" + and => { + strcmp("$(test.r6)", "$(test.x6)"), strcmp("$(test.r6)", "$(test.s6)"), }; - "ok" and => { "ok1", "ok2", "ok3", "ok4", "ok5", "ok6" }; + "ok" and => { "ok1", "ok2", "ok3", "ok4", "ok5", "ok6" }; reports: DEBUG.!ok1:: "Mismatch 1: '$(test.r1)' '$(test.x1)' '$(test.s1)'"; + DEBUG.!ok2:: "Mismatch 2: '$(test.r2)' '$(test.x2)' '$(test.s2)'"; + DEBUG.!ok3:: "Mismatch 3: '$(test.r3)' '$(test.x3)' '$(test.s3)'"; + DEBUG.!ok4:: "Mismatch 4: '$(test.r4)' '$(test.x4)' '$(test.s4)'"; + DEBUG.!ok5:: "Mismatch 5: '$(test.r5)' '$(test.x5)' '$(test.s5)'"; + DEBUG.!ok6:: "Mismatch 6: '$(test.r6)' '$(test.x6)' '$(test.s6)'"; + ok:: "$(this.promise_filename) Pass"; !ok:: "$(this.promise_filename) FAIL"; - } diff --git a/tests/acceptance/01_vars/01_basic/staging/026.cf b/tests/acceptance/01_vars/01_basic/staging/026.cf index d2e26dc43d..3b8658aaa4 100644 --- a/tests/acceptance/01_vars/01_basic/staging/026.cf +++ b/tests/acceptance/01_vars/01_basic/staging/026.cf @@ -3,109 +3,119 @@ # Test rrange # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - # Normal order - "r1" string => rrange(10,20); - "r2" string => rrange("10.1","20.2"); - "r3" string => rrange("1.1k","2.2K"); - "r4" string => rrange("1.1m","2.2M"); - "r5" string => rrange("1.1g","2.2G"); - "r6" string => rrange("-20.2",10); - "r7" string => rrange("10.1%","20.2%"); - - # Reverse order - "x1" string => rrange(20,10); - "x2" string => rrange("20.2","10.1"); - "x3" string => rrange("2.2K","1.1k"); - "x4" string => rrange("2.2M","1.1m"); - "x5" string => rrange("2.2G","1.1g"); - "x6" string => rrange("20.2",10); - "x7" string => rrange("20.2%","10.1%"); - - # String equivalent - "s1" string => "10.000000,20.000000"; - "s2" string => "10.100000,20.200000"; - "s3" string => "1100.000000,2252.800000"; - "s4" string => "1100000.000000,2306867.200000"; - "s5" string => "1100000000.000000,2362232012.800000"; - "s6" string => "-20.200000,10.000000"; - # Unsure that this is correct behavior... and it do this now anyway - "s7" string => "20.200000,10.100000"; + # Normal order + "r1" string => rrange(10, 20); + "r2" string => rrange("10.1", "20.2"); + "r3" string => rrange("1.1k", "2.2K"); + "r4" string => rrange("1.1m", "2.2M"); + "r5" string => rrange("1.1g", "2.2G"); + "r6" string => rrange("-20.2", 10); + "r7" string => rrange("10.1%", "20.2%"); + + # Reverse order + "x1" string => rrange(20, 10); + "x2" string => rrange("20.2", "10.1"); + "x3" string => rrange("2.2K", "1.1k"); + "x4" string => rrange("2.2M", "1.1m"); + "x5" string => rrange("2.2G", "1.1g"); + "x6" string => rrange("20.2", 10); + "x7" string => rrange("20.2%", "10.1%"); + + # String equivalent + "s1" string => "10.000000,20.000000"; + "s2" string => "10.100000,20.200000"; + "s3" string => "1100.000000,2252.800000"; + "s4" string => "1100000.000000,2306867.200000"; + "s5" string => "1100000000.000000,2362232012.800000"; + "s6" string => "-20.200000,10.000000"; + + # Unsure that this is correct behavior... and it do this now anyway + "s7" string => "20.200000,10.100000"; } ####################################################### - bundle agent check { classes: - "ok1" and => { - strcmp("$(test.r1)", "$(test.x1)"), - strcmp("$(test.r1)", "$(test.s1)"), + "ok1" + and => { + strcmp("$(test.r1)", "$(test.x1)"), strcmp("$(test.r1)", "$(test.s1)"), }; - "ok2" and => { - strcmp("$(test.r2)", "$(test.x2)"), - strcmp("$(test.r2)", "$(test.s2)"), + + "ok2" + and => { + strcmp("$(test.r2)", "$(test.x2)"), strcmp("$(test.r2)", "$(test.s2)"), }; - "ok3" and => { - strcmp("$(test.r3)", "$(test.x3)"), - strcmp("$(test.r3)", "$(test.s3)"), + + "ok3" + and => { + strcmp("$(test.r3)", "$(test.x3)"), strcmp("$(test.r3)", "$(test.s3)"), }; - "ok4" and => { - strcmp("$(test.r4)", "$(test.x4)"), - strcmp("$(test.r4)", "$(test.s4)"), + + "ok4" + and => { + strcmp("$(test.r4)", "$(test.x4)"), strcmp("$(test.r4)", "$(test.s4)"), }; - "ok5" and => { - strcmp("$(test.r5)", "$(test.x5)"), - strcmp("$(test.r5)", "$(test.s5)"), + + "ok5" + and => { + strcmp("$(test.r5)", "$(test.x5)"), strcmp("$(test.r5)", "$(test.s5)"), }; - "ok6" and => { - strcmp("$(test.r6)", "$(test.x6)"), - strcmp("$(test.r6)", "$(test.s6)"), + + "ok6" + and => { + strcmp("$(test.r6)", "$(test.x6)"), strcmp("$(test.r6)", "$(test.s6)"), }; - "ok7" and => { - strcmp("$(test.r7)", "$(test.x7)"), - strcmp("$(test.r7)", "$(test.s7)"), + + "ok7" + and => { + strcmp("$(test.r7)", "$(test.x7)"), strcmp("$(test.r7)", "$(test.s7)"), }; - "ok" and => { "ok1", "ok2", "ok3", "ok4", "ok5", "ok6", "ok7" }; + "ok" and => { "ok1", "ok2", "ok3", "ok4", "ok5", "ok6", "ok7" }; reports: DEBUG.!ok1:: "Mismatch 1: '$(test.r1)' '$(test.x1)' '$(test.s1)'"; + DEBUG.!ok2:: "Mismatch 2: '$(test.r2)' '$(test.x2)' '$(test.s2)'"; + DEBUG.!ok3:: "Mismatch 3: '$(test.r3)' '$(test.x3)' '$(test.s3)'"; + DEBUG.!ok4:: "Mismatch 4: '$(test.r4)' '$(test.x4)' '$(test.s4)'"; + DEBUG.!ok5:: "Mismatch 5: '$(test.r5)' '$(test.x5)' '$(test.s5)'"; + DEBUG.!ok6:: "Mismatch 6: '$(test.r6)' '$(test.x6)' '$(test.s6)'"; + DEBUG.!ok7:: "Mismatch 7: '$(test.r7)' '$(test.x7)' '$(test.s7)'"; + ok:: "$(this.promise_filename) Pass"; !ok:: "$(this.promise_filename) FAIL"; - } diff --git a/tests/acceptance/01_vars/01_basic/staging/107.cf b/tests/acceptance/01_vars/01_basic/staging/107.cf index 0ed8a7bb8a..6ae01852f9 100644 --- a/tests/acceptance/01_vars/01_basic/staging/107.cf +++ b/tests/acceptance/01_vars/01_basic/staging/107.cf @@ -4,44 +4,45 @@ # another file. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "subout" string => execresult("$(sys.cf_agent) -vKf $(this.promise_filename).sub -DAUTO | grep Q:", "useshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -vKf $(this.promise_filename).sub -DAUTO | grep Q:", + "useshell" + ); } ####################################################### - bundle agent check { classes: - "default" expression => regcmp(".*default\\.cf.*", "$(test.subout)"); - "itself" expression => regcmp(".*107\\.cf.*", "$(test.subout)"); - - "ok" and => { "!default", "itself" }; + "default" expression => regcmp(".*default\\.cf.*", "$(test.subout)"); + "itself" expression => regcmp(".*107\\.cf.*", "$(test.subout)"); + "ok" and => { "!default", "itself" }; reports: DEBUG:: "$(test.subout)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/staging/this_promises_in_command_args.cf b/tests/acceptance/01_vars/01_basic/staging/this_promises_in_command_args.cf index 4335c39dfb..7a54411821 100644 --- a/tests/acceptance/01_vars/01_basic/staging/this_promises_in_command_args.cf +++ b/tests/acceptance/01_vars/01_basic/staging/this_promises_in_command_args.cf @@ -3,30 +3,27 @@ # Redmine#5959 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { commands: - # should expand to "touch testfile touch testfile.2" - "$(G.touch) $(G.testfile)" - args => "$(this.promiser).2"; + # should expand to "touch testfile touch testfile.2" + "$(G.touch) $(G.testfile)" args => "$(this.promiser).2"; } ####################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_fileexists("$(G.testfile).2", - $(this.promise_filename)); - + "" + usebundle => dcs_passif_fileexists( + "$(G.testfile).2", $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/01_basic/sys_flavor_on_aix_no_dots.cf b/tests/acceptance/01_vars/01_basic/sys_flavor_on_aix_no_dots.cf index 5925e93bee..ec2f2cad5f 100644 --- a/tests/acceptance/01_vars/01_basic/sys_flavor_on_aix_no_dots.cf +++ b/tests/acceptance/01_vars/01_basic/sys_flavor_on_aix_no_dots.cf @@ -1,32 +1,38 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { classes: - "etc_os_release_present" expression => fileexists( '/etc/os-release'); + "etc_os_release_present" expression => fileexists('/etc/os-release'); meta: - "description" -> { "ENT-3970" } - string => "Test that sys.flavor on aix is in the form aix_digit"; + "description" -> { "ENT-3970" } + string => "Test that sys.flavor on aix is in the form aix_digit"; - "test_skip_needs_work" - string => "!(aix|etc_os_release_present)", - meta => { "ENT-3970"}; + "test_skip_needs_work" + string => "!(aix|etc_os_release_present)", + meta => { "ENT-3970" }; methods: - - # Probably the common case for this would be $(sys.os)_MAJOR or $(sys.os)_\d+ + # Probably the common case for this would be $(sys.os)_MAJOR or $(sys.os)_\d+ aix:: "Pass/Fail" - usebundle => dcs_check_regcmp( "aix_\d+", $(sys.flavor), $(this.promise_filename), "no" ); + usebundle => dcs_check_regcmp( + "aix_\d+", $(sys.flavor), $(this.promise_filename), "no" + ); etc_os_release_present:: "Pass/Fail" - usebundle => dcs_check_regcmp( "$(sys.os_release[ID])_\d+", $(sys.flavor), $(this.promise_filename), "no" ), - if => fileexists( "/etc/os-release" ); + usebundle => dcs_check_regcmp( + "$(sys.os_release[ID])_\d+", + $(sys.flavor), + $(this.promise_filename), + "no" + ), + if => fileexists("/etc/os-release"); } diff --git a/tests/acceptance/01_vars/01_basic/sys_policy_version.cf b/tests/acceptance/01_vars/01_basic/sys_policy_version.cf index 4cef062ef5..fb2cb61518 100644 --- a/tests/acceptance/01_vars/01_basic/sys_policy_version.cf +++ b/tests/acceptance/01_vars/01_basic/sys_policy_version.cf @@ -12,9 +12,11 @@ bundle agent check strcmp("$(sys.policy_version)", "$(default:control_common.version)"), strcmp("$(sys.policy_version)", "1.2.3") ); + reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/sys_policy_version_empty.cf b/tests/acceptance/01_vars/01_basic/sys_policy_version_empty.cf index 183813da65..bf92193a61 100644 --- a/tests/acceptance/01_vars/01_basic/sys_policy_version_empty.cf +++ b/tests/acceptance/01_vars/01_basic/sys_policy_version_empty.cf @@ -6,11 +6,12 @@ body common control bundle agent check { classes: - "ok" - expression => not(isvariable("sys.policy_version")); + "ok" expression => not(isvariable("sys.policy_version")); + reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/sysvars.cf b/tests/acceptance/01_vars/01_basic/sysvars.cf index 1e78446267..7e5b68b18d 100644 --- a/tests/acceptance/01_vars/01_basic/sysvars.cf +++ b/tests/acceptance/01_vars/01_basic/sysvars.cf @@ -1,51 +1,79 @@ # Test $(sys.inputdir), $(sys.masterdir), $(sys.libdir), $(sys.bindir), $(sys.failsafe_policy_path), $(sys.update_policy_path), $(sys.local_libdir) body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { vars: - "expected[bindir]" string => "$(sys.workdir)$(const.dirsep)bin"; - "expected[default_policy_path]" string => "$(sys.workdir)$(const.dirsep)inputs$(const.dirsep)promises.cf"; - "expected[failsafe_policy_path]" string => "$(sys.workdir)$(const.dirsep)inputs$(const.dirsep)failsafe.cf"; - "expected[inputdir]" string => "$(sys.workdir)$(const.dirsep)inputs"; - "expected[libdir]" string => "$(sys.workdir)$(const.dirsep)inputs$(const.dirsep)lib"; - "expected[local_libdir]" string => "lib"; - "expected[masterdir]" string => "$(sys.workdir)$(const.dirsep)masterfiles"; - "expected[update_policy_path]" string => "$(sys.workdir)$(const.dirsep)inputs$(const.dirsep)update.cf"; - - # sys.policy_entry variables are the same as this.promise variables in case the cf-agent is with '-f THIS_POLICY_FILENAME' - # except that "/./" can appear in some places in this.promise variables - "expected[policy_entry_dirname]" string => regex_replace("$(this.promise_dirname)", "/\./", "/", ""); - "expected[policy_entry_filename]" string => regex_replace("$(this.promise_filename)", "/\./", "/", ""); - "expected[policy_entry_basename]" string => regex_replace("$(this.promise_filename)", ".*/", "", ""); - - "sysvars" slist => getindices("expected"); + "expected[bindir]" string => "$(sys.workdir)$(const.dirsep)bin"; + + "expected[default_policy_path]" + string => "$(sys.workdir)$(const.dirsep)inputs$(const.dirsep)promises.cf"; + + "expected[failsafe_policy_path]" + string => "$(sys.workdir)$(const.dirsep)inputs$(const.dirsep)failsafe.cf"; + + "expected[inputdir]" string => "$(sys.workdir)$(const.dirsep)inputs"; + + "expected[libdir]" + string => "$(sys.workdir)$(const.dirsep)inputs$(const.dirsep)lib"; + + "expected[local_libdir]" string => "lib"; + "expected[masterdir]" string => "$(sys.workdir)$(const.dirsep)masterfiles"; + + "expected[update_policy_path]" + string => "$(sys.workdir)$(const.dirsep)inputs$(const.dirsep)update.cf"; + + # sys.policy_entry variables are the same as this.promise variables in case the cf-agent is with '-f THIS_POLICY_FILENAME' + # except that "/./" can appear in some places in this.promise variables + "expected[policy_entry_dirname]" + string => regex_replace("$(this.promise_dirname)", "/\./", "/", ""); + + "expected[policy_entry_filename]" + string => regex_replace("$(this.promise_filename)", "/\./", "/", ""); + + "expected[policy_entry_basename]" + string => regex_replace("$(this.promise_filename)", ".*/", "", ""); + + "sysvars" slist => getindices("expected"); } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; } ####################################################### - bundle agent check { classes: - "$(init.sysvars)_ok" expression => strcmp("$(sys.$(init.sysvars))", "$(init.expected[$(init.sysvars)])"); + "$(init.sysvars)_ok" + expression => strcmp( + "$(sys.$(init.sysvars))", "$(init.expected[$(init.sysvars)])" + ); - "ok" and => { "inputdir_ok", "masterdir_ok", "libdir_ok", "bindir_ok", "default_policy_path_ok", "failsafe_policy_path_ok", "update_policy_path_ok", - "local_libdir_ok", "policy_entry_dirname_ok", "policy_entry_filename_ok", "policy_entry_basename_ok" }; + "ok" + and => { + "inputdir_ok", + "masterdir_ok", + "libdir_ok", + "bindir_ok", + "default_policy_path_ok", + "failsafe_policy_path_ok", + "update_policy_path_ok", + "local_libdir_ok", + "policy_entry_dirname_ok", + "policy_entry_filename_ok", + "policy_entry_basename_ok", + }; reports: DEBUG:: @@ -53,6 +81,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/this_promiser_ifvarclass.cf b/tests/acceptance/01_vars/01_basic/this_promiser_ifvarclass.cf index 6ae3c99ca0..972ceff598 100644 --- a/tests/acceptance/01_vars/01_basic/this_promiser_ifvarclass.cf +++ b/tests/acceptance/01_vars/01_basic/this_promiser_ifvarclass.cf @@ -1,43 +1,42 @@ # Test that this.promiser works in ifvarclass # CFE-2262 (https://northerntech.atlassian.net/browse/CFE-2262) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } bundle agent test { meta: - "description" -> { "redmine#7880", "CFE-2262" } - string => "Test that it is possible to use this.promiser in ifvarclass.", - meta => { "redmine#7880", "CFE-2262" }; + "description" -> { "redmine#7880", "CFE-2262" } + string => "Test that it is possible to use this.promiser in ifvarclass.", + meta => { "redmine#7880", "CFE-2262" }; files: # I should be able to use this.promiser to check if the file is a plain # file "$(G.testfile)" delete => tidy, - ifvarclass => isplain( "$(this.promiser)" ); + ifvarclass => isplain("$(this.promiser)"); } bundle agent check { classes: - "ok" not => fileexists( "$(G.testfile)" ); + "ok" not => fileexists("$(G.testfile)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/this_promiser_with_readjson.cf b/tests/acceptance/01_vars/01_basic/this_promiser_with_readjson.cf index 1e385d487b..60cfff7563 100644 --- a/tests/acceptance/01_vars/01_basic/this_promiser_with_readjson.cf +++ b/tests/acceptance/01_vars/01_basic/this_promiser_with_readjson.cf @@ -1,18 +1,16 @@ # Test that this.promiser can be used in a call with readjson # Redmine:4680 (https://cfengine.com/dev/issues/4680) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "cf_promises_validated_mock_data" - string => '{ + "cf_promises_validated_mock_data" string => '{ "timestamp": 1393095384 }'; @@ -27,11 +25,10 @@ bundle agent init bundle agent test { vars: - "cf_promises_validated" - data => readjson("$(G.testfile).$(this.promiser)", 1K); + "cf_promises_validated" + data => readjson("$(G.testfile).$(this.promiser)", 1K); - "printable" - string => format("%S", "cf_promises_validated"); + "printable" string => format("%S", "cf_promises_validated"); reports: DEBUG:: @@ -41,11 +38,15 @@ bundle agent test bundle agent check { classes: - "ok" expression => strcmp("1393095384", $(test.cf_promises_validated[timestamp])); + "ok" + expression => strcmp( + "1393095384", $(test.cf_promises_validated[timestamp]) + ); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/this_variables.cf b/tests/acceptance/01_vars/01_basic/this_variables.cf index e43d5fb1c1..bf20ed0ecb 100644 --- a/tests/acceptance/01_vars/01_basic/this_variables.cf +++ b/tests/acceptance/01_vars/01_basic/this_variables.cf @@ -1,63 +1,56 @@ # This was created because of a bug while working on purging variable table # copying for CFE-2524. The issue was that variables were not found when # looked up deep inside the INI_SECTION body. - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile).expected" - copy_from => local_cp("$(this.promise_filename).finish"); + "$(G.testfile).expected" + copy_from => local_cp("$(this.promise_filename).finish"); } bundle agent test { vars: - "var" slist => { "var in test" }; + "var" slist => { "var in test" }; "var_test" slist => { "var_test in test" }; files: "$(G.testfile).actual" - create => "true", - edit_line => test_edit_line("testline"); + create => "true", + edit_line => test_edit_line("testline"); } bundle edit_line test_edit_line(line) { - vars: "sectionName" string => "test"; insert_lines: - "[$(sectionName)] -[end]" - location => start; - - "${line}" - select_region => INI_section(escape("$(sectionName)")); - + "[$(sectionName)] +[end]" location => start; + "${line}" select_region => INI_section(escape("$(sectionName)")); } bundle agent check { methods: "check" - usebundle => dcs_if_diff( "$(G.testfile).actual", - "$(G.testfile).expected", - "pass", "_fail"); + usebundle => dcs_if_diff( + "$(G.testfile).actual", "$(G.testfile).expected", "pass", "_fail" + ); - # Fail the test if any of the files fail. - "fail" - usebundle => dcs_fail( $(this.promise_filename) ), - if => "_fail"; + # Fail the test if any of the files fail. + "fail" + usebundle => dcs_fail($(this.promise_filename)), + if => "_fail"; pass:: - "pass" - usebundle => dcs_pass( $(this.promise_filename) ); + "pass" usebundle => dcs_pass($(this.promise_filename)); } diff --git a/tests/acceptance/01_vars/01_basic/time_based_vars.cf b/tests/acceptance/01_vars/01_basic/time_based_vars.cf index 330d43adaf..3cc74bb399 100644 --- a/tests/acceptance/01_vars/01_basic/time_based_vars.cf +++ b/tests/acceptance/01_vars/01_basic/time_based_vars.cf @@ -1,7 +1,7 @@ body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } @@ -34,7 +34,8 @@ bundle agent test string => "Test time based variables"; vars: - "variables" data => '{ + "variables" + data => '{ "dom": "^Day([1-9]|[1-2][0-9]|3[0-1])$", "dow": "^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday)$", "hr": "^Hr(0[0-9]|1[0-9]|2[0-4])$", @@ -62,12 +63,13 @@ bundle agent test "gmt_yr": "^GMT_Yr\d{4}$" }'; - "names" - slist => getindices("variables"); + "names" slist => getindices("variables"); methods: - "any" usebundle => test_variable("default:sys.time_based_$(names)", - "$(variables[$(names)])"); + "any" + usebundle => test_variable( + "default:sys.time_based_$(names)", "$(variables[$(names)])" + ); } bundle agent check diff --git a/tests/acceptance/01_vars/01_basic/unresolved_variables.cf b/tests/acceptance/01_vars/01_basic/unresolved_variables.cf index 8d0b3e7cb2..3a32694cd7 100644 --- a/tests/acceptance/01_vars/01_basic/unresolved_variables.cf +++ b/tests/acceptance/01_vars/01_basic/unresolved_variables.cf @@ -1,10 +1,9 @@ # Redmine#4889: avoid unresolved variables in promiser or attributes - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -14,21 +13,28 @@ bundle agent init bundle agent test { vars: - "subout" string => execresult("$(sys.cf_agent) -Kf $(this.promise_filename).sub -DAUTO,DEBUG 2>&1 | $(G.grep) PURPLE_DINOSAUR", "useshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub -DAUTO,DEBUG 2>&1 | $(G.grep) PURPLE_DINOSAUR", + "useshell" + ); } bundle agent check { classes: - "ok" not => regcmp("PURPLE_DINOSAUR", $(test.subout)); + "ok" not => regcmp("PURPLE_DINOSAUR", $(test.subout)); reports: ok.EXTRA:: "The output was OK: $(test.subout)"; + !ok.DEBUG:: "The output was NOT OK: $(test.subout)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/uptime_systime_and_sysday.cf b/tests/acceptance/01_vars/01_basic/uptime_systime_and_sysday.cf index 4e37b89a75..849b329f40 100644 --- a/tests/acceptance/01_vars/01_basic/uptime_systime_and_sysday.cf +++ b/tests/acceptance/01_vars/01_basic/uptime_systime_and_sysday.cf @@ -1,35 +1,38 @@ # Test $(sys.uptime), $(sys.systime) and $(sys.sysday) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { vars: - # Quite crude testing, only test that it is a number, and not zero. - "regexp" string => "^[0-9]+$"; - "notregexp" string => "^0$"; + # Quite crude testing, only test that it is a number, and not zero. + "regexp" string => "^[0-9]+$"; + "notregexp" string => "^0$"; } ####################################################### - bundle agent check { classes: - "uptime_ok" expression => regcmp("$(init.regexp)", "$(sys.uptime)"); - "systime_ok" expression => regcmp("$(init.regexp)", "$(sys.systime)"); - "sysday_ok" expression => regcmp("$(init.regexp)", "$(sys.sysday)"); - "uptime_ok_zero" not => regcmp("$(init.notregexp)", "$(sys.uptime)"); - "systime_ok_zero" not => regcmp("$(init.notregexp)", "$(sys.systime)"); - "sysday_ok_zero" not => regcmp("$(init.notregexp)", "$(sys.sysday)"); + "uptime_ok" expression => regcmp("$(init.regexp)", "$(sys.uptime)"); + "systime_ok" expression => regcmp("$(init.regexp)", "$(sys.systime)"); + "sysday_ok" expression => regcmp("$(init.regexp)", "$(sys.sysday)"); + "uptime_ok_zero" not => regcmp("$(init.notregexp)", "$(sys.uptime)"); + "systime_ok_zero" not => regcmp("$(init.notregexp)", "$(sys.systime)"); + "sysday_ok_zero" not => regcmp("$(init.notregexp)", "$(sys.sysday)"); - "ok" and => { "uptime_ok", "systime_ok", "sysday_ok", - "uptime_ok_zero", "systime_ok_zero", "sysday_ok_zero" + "ok" + and => { + "uptime_ok", + "systime_ok", + "sysday_ok", + "uptime_ok_zero", + "systime_ok_zero", + "sysday_ok_zero", }; reports: @@ -37,8 +40,10 @@ bundle agent check "sys.uptime: $(sys.uptime)"; "sys.systime: $(sys.systime)"; "sys.sysday: $(sys.sysday)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/var_expansion_in_meta.cf b/tests/acceptance/01_vars/01_basic/var_expansion_in_meta.cf index ca651ded37..581965826b 100644 --- a/tests/acceptance/01_vars/01_basic/var_expansion_in_meta.cf +++ b/tests/acceptance/01_vars/01_basic/var_expansion_in_meta.cf @@ -1,35 +1,30 @@ # Test that variables in meta tags are expanded # Redmine:4885 (https://cfengine.com/dev/issues/4885) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "variables" slist => { "item1", "item2" }; - "variable_tag" string => "mytag"; + "variables" slist => { "item1", "item2" }; + "variable_tag" string => "mytag"; classes: "$(variables)_class" expression => "any", scope => "namespace", meta => { "$(variable_tag)" }; - } bundle agent test { vars: - "found_classes" - slist => classesmatching(".*", $(init.variable_tag)); - - "joined_found_classes" - string => join(",", found_classes); + "found_classes" slist => classesmatching(".*", $(init.variable_tag)); + "joined_found_classes" string => join(",", found_classes); } bundle agent check @@ -38,7 +33,10 @@ bundle agent check "expected_joined_found_classes" string => "item1_class,item2_class"; classes: - "ok" expression => strcmp($(expected_joined_found_classes), $(test.joined_found_classes)); + "ok" + expression => strcmp( + $(expected_joined_found_classes), $(test.joined_found_classes) + ); reports: DEBUG:: @@ -47,6 +45,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/01_basic/var_meta_tags_overridden_correctly.cf b/tests/acceptance/01_vars/01_basic/var_meta_tags_overridden_correctly.cf index 648396638d..40fc33dcd2 100644 --- a/tests/acceptance/01_vars/01_basic/var_meta_tags_overridden_correctly.cf +++ b/tests/acceptance/01_vars/01_basic/var_meta_tags_overridden_correctly.cf @@ -1,14 +1,13 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } + bundle agent init { - meta: - "description" -> { "CFE-2601" } string => "Test that meta tags are correct when a variable is re-defined with new meta tags."; @@ -31,8 +30,7 @@ bundle agent check reports: DEBUG|EXTRA:: - - "Running CFEngine $(sys.cf_version)"; + "Running CFEngine $(sys.cf_version)"; "Tagged with first: $(vars_tagged_first)"; "Tagged with second: $(vars_tagged_second)"; @@ -44,8 +42,16 @@ bundle agent check any:: "$(this.promise_filename) Pass" - if => and(none("default:init.myvar", vars_tagged_first), every("default:init.myvar", vars_tagged_second)); + if => and( + none("default:init.myvar", vars_tagged_first), + every("default:init.myvar", vars_tagged_second) + ); "$(this.promise_filename) FAIL" - if => not(and(none("default:init.myvar", vars_tagged_first), every("default:init.myvar", vars_tagged_second))); + if => not( + and( + none("default:init.myvar", vars_tagged_first), + every("default:init.myvar", vars_tagged_second) + ) + ); } diff --git a/tests/acceptance/01_vars/01_basic/vars_comments_emitted_in_show_vars.cf b/tests/acceptance/01_vars/01_basic/vars_comments_emitted_in_show_vars.cf index 12a7e8660b..de37f58f5c 100644 --- a/tests/acceptance/01_vars/01_basic/vars_comments_emitted_in_show_vars.cf +++ b/tests/acceptance/01_vars/01_basic/vars_comments_emitted_in_show_vars.cf @@ -1,22 +1,27 @@ # Test $(sys.inputdir), $(sys.masterdir), $(sys.libdir), $(sys.bindir), $(sys.failsafe_policy_path), $(sys.update_policy_path), $(sys.local_libdir) body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent test { meta: - "description" string => "Test that comments on variables are emitted in --show-evaluated-vars output."; + "description" + string => "Test that comments on variables are emitted in --show-evaluated-vars output."; } ####################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_output(".*test_var.*test_var value.*This is a comment about test_var.*", "", "$(sys.cf_agent) -Kf $(this.promise_filename).sub --show-evaluated-vars", $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + ".*test_var.*test_var value.*This is a comment about test_var.*", + "", + "$(sys.cf_agent) -Kf $(this.promise_filename).sub --show-evaluated-vars", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/01_basic/vars_comments_emitted_in_verbose.cf b/tests/acceptance/01_vars/01_basic/vars_comments_emitted_in_verbose.cf index 8c539a569a..7e651f6a62 100644 --- a/tests/acceptance/01_vars/01_basic/vars_comments_emitted_in_verbose.cf +++ b/tests/acceptance/01_vars/01_basic/vars_comments_emitted_in_verbose.cf @@ -1,24 +1,28 @@ # Test $(sys.inputdir), $(sys.masterdir), $(sys.libdir), $(sys.bindir), $(sys.failsafe_policy_path), $(sys.update_policy_path), $(sys.local_libdir) body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent test { meta: - "description" - string => "Test that comments on variables are emitted in verbose output.", - meta => { "CFE-2442" }; + "description" + string => "Test that comments on variables are emitted in verbose output.", + meta => { "CFE-2442" }; } ####################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_output(".*This is a comment about test_var.*", "", "$(sys.cf_agent) -Kvf $(this.promise_filename).sub", $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + ".*This is a comment about test_var.*", + "", + "$(sys.cf_agent) -Kvf $(this.promise_filename).sub", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/01_basic/vars_in_arrays.cf b/tests/acceptance/01_vars/01_basic/vars_in_arrays.cf index b4b0dd86e2..e9f7aa9c3f 100644 --- a/tests/acceptance/01_vars/01_basic/vars_in_arrays.cf +++ b/tests/acceptance/01_vars/01_basic/vars_in_arrays.cf @@ -1,51 +1,43 @@ - -# # Parsing paramaterized arrays -# - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "init", "check" }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "init", "check" }; + version => "1.0"; } ####################################################### - bundle agent init { files: - - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => write, edit_defaults => empty; - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => write_control, edit_defaults => empty; - } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).expected", - "$(G.testfile).actual", - "$(this.promise_filename)"); - + "any" + usebundle => sorted_check_diff( + "$(G.testfile).expected", + "$(G.testfile).actual", + "$(this.promise_filename)" + ); } ####################################################### - bundle edit_line write_control { insert_lines: - - "1 + "1 3 2 one @@ -57,20 +49,16 @@ four"; bundle edit_line write { vars: - - "a[1]" string => "a"; - "a[2]" string => "b"; - "a[3]" string => "c"; - - "alias" string => "a"; - "list" slist => getindices($(alias)); - - "one[$(sys.uqhost)]" slist => { "one", "two" }; - "two" slist => { "three", "four" }; - "oneandtwo" slist => { @(one[$(sys.uqhost)]), @(two) }; + "a[1]" string => "a"; + "a[2]" string => "b"; + "a[3]" string => "c"; + "alias" string => "a"; + "list" slist => getindices($(alias)); + "one[$(sys.uqhost)]" slist => { "one", "two" }; + "two" slist => { "three", "four" }; + "oneandtwo" slist => { @(one[$(sys.uqhost)]), @(two) }; insert_lines: - - "$(list)"; - "$(oneandtwo)"; + "$(list)"; + "$(oneandtwo)"; } diff --git a/tests/acceptance/01_vars/02_functions/001.cf b/tests/acceptance/01_vars/02_functions/001.cf index 3e6f97ac28..e4b4444dab 100644 --- a/tests/acceptance/01_vars/02_functions/001.cf +++ b/tests/acceptance/01_vars/02_functions/001.cf @@ -3,34 +3,31 @@ # Test getuid() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: "test_skip_needs_work" string => "windows"; - vars: any:: "uid_root" int => getuid("root"); "uid_daemon" int => getuid("daemon"); + !darwin:: "uid_bin" int => getuid("bin"); @@ -38,14 +35,17 @@ bundle agent test "num_root" int => "0"; "num_daemon" int => "1"; "num_bin" int => "2"; + manjaro|archlinux|SuSE|redhat|gentoo:: "num_root" int => "0"; "num_daemon" int => "2"; "num_bin" int => "1"; + freebsd|openbsd:: "num_root" int => "0"; "num_daemon" int => "1"; "num_bin" int => "3"; + darwin:: "num_root" int => "0"; "num_daemon" int => "1"; @@ -56,31 +56,33 @@ bundle agent test "num_bin" string => "fixme"; } - ####################################################### - bundle agent check { classes: darwin:: "ok_bin" expression => "any"; + !darwin:: "ok_bin" expression => strcmp("$(test.uid_bin)", "$(test.num_bin)"); any:: - "ok" and => { - strcmp("$(test.uid_root)", "$(test.num_root)"), - strcmp("$(test.uid_daemon)", "$(test.num_daemon)"), - "ok_bin" - }; + "ok" + and => { + strcmp("$(test.uid_root)", "$(test.num_root)"), + strcmp("$(test.uid_daemon)", "$(test.num_daemon)"), + "ok_bin", + }; reports: DEBUG:: "root is UID $(test.uid_root), expected $(test.num_root)"; "daemon is UID $(test.uid_daemon), expected $(test.num_daemon)"; "bin is UID $(test.uid_bin), expected $(test.num_bin)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/002.cf b/tests/acceptance/01_vars/02_functions/002.cf index 7d43df6fa1..e413048555 100644 --- a/tests/acceptance/01_vars/02_functions/002.cf +++ b/tests/acceptance/01_vars/02_functions/002.cf @@ -3,24 +3,21 @@ # Test getgid() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: @@ -30,53 +27,67 @@ bundle agent test linux|freebsd|solaris|openbsd|hpux:: "gid_daemon" int => getgid("daemon"); "gid_sys" int => getgid("sys"); + darwin:: "gid_daemon" int => getgid("daemon"); + aix:: "gid_sys" int => getgid("sys"); + !linux.!freebsd.!solaris.!darwin.!openbsd.!hpux.!aix:: "gid_daemon" string => "fixme"; "gid_sys" string => "fixme"; linux|solaris|hpux:: "gid_0" int => getgid("root"); + freebsd|darwin|openbsd:: "gid_0" int => getgid("wheel"); + aix:: "gid_0" int => getgid("system"); + !linux.!freebsd.!solaris.!darwin.!openbsd.!hpux.!aix:: "gid_0" string => "fixme"; manjaro|archlinux|SuSE|redhat|gentoo:: "num_daemon" int => "2"; + (linux.!manjaro.!archlinux.!SuSE.!redhat.!gentoo)|freebsd|darwin|openbsd:: "num_daemon" int => "1"; + solaris:: "num_daemon" int => "12"; + hpux:: "num_daemon" int => "5"; + !linux.!freebsd.!solaris.!darwin.!openbsd.!hpux.!aix:: "num_daemon" string => "fixme"; linux|freebsd|solaris|openbsd|hpux|aix:: "num_sys" int => "3"; + !linux.!freebsd.!solaris.!darwin.!openbsd.!hpux.!aix:: "num_sys" string => "fixme"; } ####################################################### - bundle agent check { classes: darwin:: "ok_sys" expression => "any"; + !darwin:: "ok_sys" expression => strcmp("$(test.gid_sys)", "$(test.num_sys)"); + aix:: "ok_daemon" expression => "any"; + !aix:: - "ok_daemon" expression => strcmp("$(test.gid_daemon)", "$(test.num_daemon)"); + "ok_daemon" + expression => strcmp("$(test.gid_daemon)", "$(test.num_daemon)"); any:: "ok" and => { strcmp("$(test.gid_0)", "0"), "ok_sys", "ok_daemon" }; @@ -86,8 +97,10 @@ bundle agent check "root/wheel is GID $(test.gid_0), expected 0"; "daemon is GID $(test.gid_daemon), expected $(test.num_daemon)"; "sys is GID $(test.gid_sys), expected $(test.num_sys)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/003.cf b/tests/acceptance/01_vars/02_functions/003.cf index b221216da5..0402d7fa4c 100644 --- a/tests/acceptance/01_vars/02_functions/003.cf +++ b/tests/acceptance/01_vars/02_functions/003.cf @@ -3,45 +3,43 @@ # Test countlinesmatching() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "zero_regex" string => "impossible line"; - "one_regex" string => "root:.*"; - "positive_regex" string => ".*:\d+:.*"; - - "zero" int => countlinesmatching("$(zero_regex)", "$(G.etc_passwd)"); - "one" int => countlinesmatching("$(one_regex)", "$(G.etc_passwd)"); - "positive" int => countlinesmatching("$(positive_regex)", "$(G.etc_passwd)"); + "zero_regex" string => "impossible line"; + "one_regex" string => "root:.*"; + "positive_regex" string => ".*:\d+:.*"; + "zero" int => countlinesmatching("$(zero_regex)", "$(G.etc_passwd)"); + "one" int => countlinesmatching("$(one_regex)", "$(G.etc_passwd)"); + + "positive" + int => countlinesmatching("$(positive_regex)", "$(G.etc_passwd)"); } ####################################################### - bundle agent check { classes: - "ok" and => { - strcmp("$(test.zero)", "0"), - strcmp("$(test.one)", "1"), - isgreaterthan("$(test.positive)", "1"), + "ok" + and => { + strcmp("$(test.zero)", "0"), + strcmp("$(test.one)", "1"), + isgreaterthan("$(test.positive)", "1"), }; reports: @@ -49,8 +47,10 @@ bundle agent check "Expected 0 matches to '$(test.zero_regex)', found $(test.zero)"; "Expected 1 matches to '$(test.one_regex)', found $(test.one)"; "Expected >1 matches to '$(test.positive_regex)', found $(test.positive)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/004.cf b/tests/acceptance/01_vars/02_functions/004.cf index 73ef9bd954..dc9d4fcff4 100644 --- a/tests/acceptance/01_vars/02_functions/004.cf +++ b/tests/acceptance/01_vars/02_functions/004.cf @@ -3,70 +3,56 @@ # Test sum() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "six" ilist => { "1", "2", "3" }; - "sum_six" real => sum("six"); - - "minus_six" ilist => { "-1", "-2", "-3" }; - "sum_minus_six" real => sum("minus_six"); - - "zero" ilist => { "-1", "-2", "3" }; - "sum_zero" real => sum("zero"); - - "sixpoint" rlist => { "1.", "2", "3e0" }; - "sum_sixpoint" real => sum("sixpoint"); - - "minus_sixpoint" rlist => { "-1.", "-2", "-3e0" }; - "sum_minus_sixpoint" real => sum("minus_sixpoint"); - - "zeropoint" rlist => { "-1.", "-2", "3e0" }; - "sum_zeropoint" real => sum("zeropoint"); - + "six" ilist => { "1", "2", "3" }; + "sum_six" real => sum("six"); + "minus_six" ilist => { "-1", "-2", "-3" }; + "sum_minus_six" real => sum("minus_six"); + "zero" ilist => { "-1", "-2", "3" }; + "sum_zero" real => sum("zero"); + "sixpoint" rlist => { "1.", "2", "3e0" }; + "sum_sixpoint" real => sum("sixpoint"); + "minus_sixpoint" rlist => { "-1.", "-2", "-3e0" }; + "sum_minus_sixpoint" real => sum("minus_sixpoint"); + "zeropoint" rlist => { "-1.", "-2", "3e0" }; + "sum_zeropoint" real => sum("zeropoint"); } ####################################################### - bundle agent check { classes: - "ok" and => { - isgreaterthan("$(test.sum_six)", "5.9999999"), - islessthan("$(test.sum_six)", "6.0000001"), - - islessthan("$(test.sum_minus_six)", "-5.9999999"), - isgreaterthan("$(test.sum_minus_six)", "-6.0000001"), - - isgreaterthan("$(test.sum_zero)", "-.0000001"), - islessthan("$(test.sum_zero)", ".0000001"), - - isgreaterthan("$(test.sum_sixpoint)", "5.9999999"), - islessthan("$(test.sum_sixpoint)", "6.0000001"), - - islessthan("$(test.sum_minus_sixpoint)", "-5.9999999"), - isgreaterthan("$(test.sum_minus_sixpoint)", "-6.0000001"), - - isgreaterthan("$(test.sum_zeropoint)", "-.0000001"), - islessthan("$(test.sum_zeropoint)", ".0000001"), + "ok" + and => { + isgreaterthan("$(test.sum_six)", "5.9999999"), + islessthan("$(test.sum_six)", "6.0000001"), + islessthan("$(test.sum_minus_six)", "-5.9999999"), + isgreaterthan("$(test.sum_minus_six)", "-6.0000001"), + isgreaterthan("$(test.sum_zero)", "-.0000001"), + islessthan("$(test.sum_zero)", ".0000001"), + isgreaterthan("$(test.sum_sixpoint)", "5.9999999"), + islessthan("$(test.sum_sixpoint)", "6.0000001"), + islessthan("$(test.sum_minus_sixpoint)", "-5.9999999"), + isgreaterthan("$(test.sum_minus_sixpoint)", "-6.0000001"), + isgreaterthan("$(test.sum_zeropoint)", "-.0000001"), + islessthan("$(test.sum_zeropoint)", ".0000001"), }; reports: @@ -77,8 +63,10 @@ bundle agent check "test.sum_sixpoint = $(test.sum_sixpoint)"; "test.sum_minus_sixpoint = $(test.sum_minus_sixpoint)"; "test.sum_zeropoint = $(test.sum_zeropoint)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/005.cf b/tests/acceptance/01_vars/02_functions/005.cf index b647fb1b04..f1ceab10ed 100644 --- a/tests/acceptance/01_vars/02_functions/005.cf +++ b/tests/acceptance/01_vars/02_functions/005.cf @@ -3,70 +3,56 @@ # Test product() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "six" ilist => { "1", "2", "3" }; - "product_six" real => product("six"); - - "minus_six" ilist => { "-1", "-2", "-3" }; - "product_minus_six" real => product("minus_six"); - - "zero" ilist => { "-1", "0", "3" }; - "product_zero" real => product("zero"); - - "sixpoint" rlist => { "1.", "2", "3" }; - "product_sixpoint" real => product("sixpoint"); - - "minus_sixpoint" rlist => { "-1.", "-2", "-3" }; - "product_minus_sixpoint" real => product("minus_sixpoint"); - - "zeropoint" rlist => { "-1.", "0", "3" }; - "product_zeropoint" real => product("zeropoint"); - + "six" ilist => { "1", "2", "3" }; + "product_six" real => product("six"); + "minus_six" ilist => { "-1", "-2", "-3" }; + "product_minus_six" real => product("minus_six"); + "zero" ilist => { "-1", "0", "3" }; + "product_zero" real => product("zero"); + "sixpoint" rlist => { "1.", "2", "3" }; + "product_sixpoint" real => product("sixpoint"); + "minus_sixpoint" rlist => { "-1.", "-2", "-3" }; + "product_minus_sixpoint" real => product("minus_sixpoint"); + "zeropoint" rlist => { "-1.", "0", "3" }; + "product_zeropoint" real => product("zeropoint"); } ####################################################### - bundle agent check { classes: - "ok" and => { - isgreaterthan("$(test.product_six)", "5.9999999"), - islessthan("$(test.product_six)", "6.0000001"), - - islessthan("$(test.product_minus_six)", "-5.9999999"), - isgreaterthan("$(test.product_minus_six)", "-6.0000001"), - - isgreaterthan("$(test.product_zero)", "-.0000001"), - islessthan("$(test.product_zero)", ".0000001"), - - isgreaterthan("$(test.product_sixpoint)", "5.9999999"), - islessthan("$(test.product_sixpoint)", "6.0000001"), - - islessthan("$(test.product_minus_sixpoint)", "-5.9999999"), - isgreaterthan("$(test.product_minus_sixpoint)", "-6.0000001"), - - isgreaterthan("$(test.product_zeropoint)", "-.0000001"), - islessthan("$(test.product_zeropoint)", ".0000001"), + "ok" + and => { + isgreaterthan("$(test.product_six)", "5.9999999"), + islessthan("$(test.product_six)", "6.0000001"), + islessthan("$(test.product_minus_six)", "-5.9999999"), + isgreaterthan("$(test.product_minus_six)", "-6.0000001"), + isgreaterthan("$(test.product_zero)", "-.0000001"), + islessthan("$(test.product_zero)", ".0000001"), + isgreaterthan("$(test.product_sixpoint)", "5.9999999"), + islessthan("$(test.product_sixpoint)", "6.0000001"), + islessthan("$(test.product_minus_sixpoint)", "-5.9999999"), + isgreaterthan("$(test.product_minus_sixpoint)", "-6.0000001"), + isgreaterthan("$(test.product_zeropoint)", "-.0000001"), + islessthan("$(test.product_zeropoint)", ".0000001"), }; reports: @@ -77,8 +63,10 @@ bundle agent check "test.product_sixpoint = $(test.product_sixpoint)"; "test.product_minus_sixpoint = $(test.product_minus_sixpoint)"; "test.product_zeropoint = $(test.product_zeropoint)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/006.cf b/tests/acceptance/01_vars/02_functions/006.cf index 0137178ed9..62914fdb89 100644 --- a/tests/acceptance/01_vars/02_functions/006.cf +++ b/tests/acceptance/01_vars/02_functions/006.cf @@ -3,49 +3,46 @@ # Test diskfree() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "positive_disk" string => "$(G.etc)"; - "p_disk" string => "$(G.etc_passwd)"; - "zero_disk" string => "/lkjqeroiu"; - - "positive" int => diskfree("$(positive_disk)"); - "p" int => diskfree("$(p_disk)"); - "zero" int => diskfree("$(zero_disk)"); + "positive_disk" string => "$(G.etc)"; + "p_disk" string => "$(G.etc_passwd)"; + "zero_disk" string => "/lkjqeroiu"; + "positive" int => diskfree("$(positive_disk)"); + "p" int => diskfree("$(p_disk)"); + "zero" int => diskfree("$(zero_disk)"); meta: - "test_suppress_fail" string => "windows", - meta => { "redmine4686" }; + "test_suppress_fail" + string => "windows", + meta => { "redmine4686" }; } ####################################################### - bundle agent check { classes: - "ok" and => { - strcmp("$(test.zero)", "0"), - isgreaterthan("$(test.p)", "0"), - isgreaterthan("$(test.positive)", "0"), + "ok" + and => { + strcmp("$(test.zero)", "0"), + isgreaterthan("$(test.p)", "0"), + isgreaterthan("$(test.positive)", "0"), }; reports: @@ -53,8 +50,10 @@ bundle agent check "Expected 0 size on $(test.zero_disk), found $(test.zero)"; "Expected >1 size on $(test.p_disk), found $(test.p)"; "Expected >1 size on $(test.positive_disk), found $(test.positive)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/007.cf b/tests/acceptance/01_vars/02_functions/007.cf index 2a0fc4b7f8..f612a3937d 100644 --- a/tests/acceptance/01_vars/02_functions/007.cf +++ b/tests/acceptance/01_vars/02_functions/007.cf @@ -3,74 +3,64 @@ # Test canonify() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "in1" string => "hello"; - "expect1" string => "hello"; - "out1" string => canonify("$(in1)"); - - "in2" string => "hello there"; - "expect2" string => "hello_there"; - "out2" string => canonify("$(in2)"); - - "in3" string => "/etc/passwd"; - "expect3" string => "_etc_passwd"; - "out3" string => canonify("$(in3)"); - - "in4" string => "hello@mumble.com"; - "expect4" string => "hello_mumble_com"; - "out4" string => canonify("$(in4)"); - - "in5" string => "!@#$%^&*()_-+={}[]\:;<>,?"; - "expect5" string => "_________________________"; - "out5" string => canonify("$(in5)"); - - "in6" string => "Eystein Måløy Stenberg"; - "expect6" string => "Eystein_M__l__y_Stenberg"; - "out6" string => canonify("$(in6)"); - - "in7" string => "$(in1) $(in1)"; - "expect7" string => "$(in1)_$(in1)"; - "out7" string => canonify("$(in1) $(in1)"); - - "in8" string => "'\"hello\"'"; - "expect8" string => "__hello__"; - "out8" string => canonify("$(in8)"); + "in1" string => "hello"; + "expect1" string => "hello"; + "out1" string => canonify("$(in1)"); + "in2" string => "hello there"; + "expect2" string => "hello_there"; + "out2" string => canonify("$(in2)"); + "in3" string => "/etc/passwd"; + "expect3" string => "_etc_passwd"; + "out3" string => canonify("$(in3)"); + "in4" string => "hello@mumble.com"; + "expect4" string => "hello_mumble_com"; + "out4" string => canonify("$(in4)"); + "in5" string => "!@#$%^&*()_-+={}[]\:;<>,?"; + "expect5" string => "_________________________"; + "out5" string => canonify("$(in5)"); + "in6" string => "Eystein Måløy Stenberg"; + "expect6" string => "Eystein_M__l__y_Stenberg"; + "out6" string => canonify("$(in6)"); + "in7" string => "$(in1) $(in1)"; + "expect7" string => "$(in1)_$(in1)"; + "out7" string => canonify("$(in1) $(in1)"); + "in8" string => "'\"hello\"'"; + "expect8" string => "__hello__"; + "out8" string => canonify("$(in8)"); } ####################################################### - bundle agent check { classes: - "ok" and => { - strcmp("$(test.expect1)", "$(test.out1)"), - strcmp("$(test.expect2)", "$(test.out2)"), - strcmp("$(test.expect3)", "$(test.out3)"), - strcmp("$(test.expect4)", "$(test.out4)"), - strcmp("$(test.expect5)", "$(test.out5)"), - strcmp("$(test.expect6)", "$(test.out6)"), - strcmp("$(test.expect7)", "$(test.out7)"), - strcmp("$(test.expect8)", "$(test.out8)"), + "ok" + and => { + strcmp("$(test.expect1)", "$(test.out1)"), + strcmp("$(test.expect2)", "$(test.out2)"), + strcmp("$(test.expect3)", "$(test.out3)"), + strcmp("$(test.expect4)", "$(test.out4)"), + strcmp("$(test.expect5)", "$(test.out5)"), + strcmp("$(test.expect6)", "$(test.out6)"), + strcmp("$(test.expect7)", "$(test.out7)"), + strcmp("$(test.expect8)", "$(test.out8)"), }; reports: @@ -83,8 +73,10 @@ bundle agent check "Expected canonify('$(test.in6)') => $(test.out6) == $(test.expect6)"; "Expected canonify('$(test.in7)') => $(test.out7) == $(test.expect7)"; "Expected canonify('$(test.in8)') => $(test.out8) == $(test.expect8)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/008.cf b/tests/acceptance/01_vars/02_functions/008.cf index 9113204f64..3918711188 100644 --- a/tests/acceptance/01_vars/02_functions/008.cf +++ b/tests/acceptance/01_vars/02_functions/008.cf @@ -1,95 +1,107 @@ # splitstring() - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { vars: - # Basic stuff - "test1" slist => splitstring("abcXdefXghiXjkl", "X", "100"); - - "test1_result" string => join(":", "test1"); - "test1_expected" string => "abc:def:ghi:jkl"; - - # Empty last item - "test2" slist => splitstring("abcX", "X", "100"); - - "test2_result" string => join(":", "test2"); - "test2_expected" string => "abc:"; + # Basic stuff + "test1" slist => splitstring("abcXdefXghiXjkl", "X", "100"); + "test1_result" string => join(":", "test1"); + "test1_expected" string => "abc:def:ghi:jkl"; + + # Empty last item + "test2" slist => splitstring("abcX", "X", "100"); + "test2_result" string => join(":", "test2"); + "test2_expected" string => "abc:"; + + # Empty first item + "test3" slist => splitstring("Xabc", "X", "100"); + "test3_result" string => join(":", "test3"); + "test3_expected" string => ":abc"; + + # Regex + "test4" slist => splitstring("abc0123def", "[0-9]", "100"); + "test4_result" string => join(":", "test4"); + "test4_expected" string => "abc::::def"; + + # No matches + "test5" slist => splitstring("abcYdef", "X", "100"); + "test5_result" string => join(":", "test5"); + "test5_expected" string => "abcYdef"; + + # Empty string + "test6" slist => splitstring("", "X", "100"); + "test6_result" string => join(":", "test6"); + "test6_expected" string => "$(const.dollar)(test.test6_result)"; + + # Limit + "test7" slist => splitstring("abcXdefXghiXjklXmno", "X", 3); + "test7_result" string => join(":", "test7"); + "test7_expected" string => "abc:def:ghi"; +} - # Empty first item - "test3" slist => splitstring("Xabc", "X", "100"); +bundle agent check +{ + classes: + "ok1" + expression => strcmp("$(test.test1_result)", "$(test.test1_expected)"); - "test3_result" string => join(":", "test3"); - "test3_expected" string => ":abc"; + "ok2" + expression => strcmp("$(test.test2_result)", "$(test.test2_expected)"); - # Regex - "test4" slist => splitstring("abc0123def", "[0-9]", "100"); + "ok3" + expression => strcmp("$(test.test3_result)", "$(test.test3_expected)"); - "test4_result" string => join(":", "test4"); - "test4_expected" string => "abc::::def"; + "ok4" + expression => strcmp("$(test.test4_result)", "$(test.test4_expected)"); - # No matches - "test5" slist => splitstring("abcYdef", "X", "100"); + "ok5" + expression => strcmp("$(test.test5_result)", "$(test.test5_expected)"); - "test5_result" string => join(":", "test5"); - "test5_expected" string => "abcYdef"; + "ok6" + expression => strcmp("$(test.test6_result)", "$(test.test6_expected)"); - # Empty string - "test6" slist => splitstring("", "X", "100"); - - "test6_result" string => join(":", "test6"); - "test6_expected" string => "$(const.dollar)(test.test6_result)"; + "ok7" + expression => strcmp("$(test.test7_result)", "$(test.test7_expected)"); - # Limit - "test7" slist => splitstring("abcXdefXghiXjklXmno", "X", 3); - - "test7_result" string => join(":", "test7"); - "test7_expected" string => "abc:def:ghi"; -} - -bundle agent check -{ - classes: - "ok1" expression => strcmp("$(test.test1_result)", "$(test.test1_expected)"); - "ok2" expression => strcmp("$(test.test2_result)", "$(test.test2_expected)"); - "ok3" expression => strcmp("$(test.test3_result)", "$(test.test3_expected)"); - "ok4" expression => strcmp("$(test.test4_result)", "$(test.test4_expected)"); - "ok5" expression => strcmp("$(test.test5_result)", "$(test.test5_expected)"); - "ok6" expression => strcmp("$(test.test6_result)", "$(test.test6_expected)"); - "ok7" expression => strcmp("$(test.test7_result)", "$(test.test7_expected)"); - - "ok" and => { "ok1", "ok2", "ok3", "ok4", "ok5", "ok6", "ok7" }; + "ok" and => { "ok1", "ok2", "ok3", "ok4", "ok5", "ok6", "ok7" }; reports: DEBUG.!ok1:: "$(test.test1_result) != $(test.test1_expected)"; + DEBUG.!ok2:: "$(test.test2_result) != $(test.test2_expected)"; + DEBUG.!ok3:: "$(test.test3_result) != $(test.test3_expected)"; + DEBUG.!ok4:: "$(test.test4_result) != $(test.test4_expected)"; + DEBUG.!ok5:: "$(test.test5_result) != $(test.test5_expected)"; + DEBUG.!ok6:: "$(test.test6_result) != $(test.test6_expected)"; + DEBUG.!ok7:: "$(test.test7_result) != $(test.test7_expected)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/010.cf b/tests/acceptance/01_vars/02_functions/010.cf index 52eccf6d0d..0a0bb2bd3c 100644 --- a/tests/acceptance/01_vars/02_functions/010.cf +++ b/tests/acceptance/01_vars/02_functions/010.cf @@ -3,44 +3,44 @@ # Test hostsseen() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "hosts" slist => hostsseen("inf", "lastseen", "name"); + "hosts" slist => hostsseen("inf", "lastseen", "name"); } ####################################################### - bundle agent check { vars: - "hosts" slist => { @{test.hosts} }; + "hosts" slist => { @{test.hosts} }; + classes: - "ok" expression => "any"; # XXX # I don't know how to test hostsseen! + "ok" expression => "any"; + # XXX # I don't know how to test hostsseen! reports: DEBUG:: "$(hosts)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/011.cf b/tests/acceptance/01_vars/02_functions/011.cf index 8e815c9da7..0405b37d51 100644 --- a/tests/acceptance/01_vars/02_functions/011.cf +++ b/tests/acceptance/01_vars/02_functions/011.cf @@ -3,23 +3,20 @@ # Test readstringlist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -27,45 +24,48 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123"; + "123"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" slist => { @{test.nums} }; + "nums" slist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok" and => { "ok_list", - islessthan("$(test.sum)", "123.1"), - isgreaterthan("$(test.sum)", "122.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + + "ok" + and => { + "ok_list", + islessthan("$(test.sum)", "123.1"), + isgreaterthan("$(test.sum)", "122.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/012.cf b/tests/acceptance/01_vars/02_functions/012.cf index ed278d13a8..6ace98654c 100644 --- a/tests/acceptance/01_vars/02_functions/012.cf +++ b/tests/acceptance/01_vars/02_functions/012.cf @@ -3,23 +3,20 @@ # Test readstringlist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -27,47 +24,52 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123"; - "456"; + "123"; + "456"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" slist => { @{test.nums} }; + "nums" slist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", - islessthan("$(test.sum)", "579.1"), - isgreaterthan("$(test.sum)", "578.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + islessthan("$(test.sum)", "579.1"), + isgreaterthan("$(test.sum)", "578.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/013.cf b/tests/acceptance/01_vars/02_functions/013.cf index b3f1685b7b..1708bbaddc 100644 --- a/tests/acceptance/01_vars/02_functions/013.cf +++ b/tests/acceptance/01_vars/02_functions/013.cf @@ -3,23 +3,20 @@ # Test readstringlist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -27,46 +24,51 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123 456"; + "123 456"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" slist => { @{test.nums} }; + "nums" slist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", - islessthan("$(test.sum)", "579.1"), - isgreaterthan("$(test.sum)", "578.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + islessthan("$(test.sum)", "579.1"), + isgreaterthan("$(test.sum)", "578.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/014.cf b/tests/acceptance/01_vars/02_functions/014.cf index d25c45a85f..716e887339 100644 --- a/tests/acceptance/01_vars/02_functions/014.cf +++ b/tests/acceptance/01_vars/02_functions/014.cf @@ -3,23 +3,20 @@ # Test readstringlist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -27,46 +24,51 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123.456"; + "123.456"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)","NoComment","\.",5,100); - "sum" real => sum("nums"); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\.", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" slist => { @{test.nums} }; + "nums" slist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", - islessthan("$(test.sum)", "579.1"), - isgreaterthan("$(test.sum)", "578.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + islessthan("$(test.sum)", "579.1"), + isgreaterthan("$(test.sum)", "578.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/015.cf b/tests/acceptance/01_vars/02_functions/015.cf index a23fb60726..c515ba037d 100644 --- a/tests/acceptance/01_vars/02_functions/015.cf +++ b/tests/acceptance/01_vars/02_functions/015.cf @@ -3,23 +3,20 @@ # Test readstringlist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -27,45 +24,49 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123.456"; + "123.456"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" slist => { @{test.nums} }; + "nums" slist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123.456", "$(nums)"); - "ok" and => { "ok_list", "ok123", - islessthan("$(test.sum)", "123.457"), - isgreaterthan("$(test.sum)", "123.455") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123.456", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + islessthan("$(test.sum)", "123.457"), + isgreaterthan("$(test.sum)", "123.455"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/016.cf b/tests/acceptance/01_vars/02_functions/016.cf index b7376f32a8..0688544a87 100644 --- a/tests/acceptance/01_vars/02_functions/016.cf +++ b/tests/acceptance/01_vars/02_functions/016.cf @@ -3,23 +3,20 @@ # Test readstringlist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -27,48 +24,54 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123 456"; - "789"; + "123 456"; + "789"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" slist => { @{test.nums} }; + "nums" slist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/017.cf b/tests/acceptance/01_vars/02_functions/017.cf index b83871009a..b9cfa15a1b 100644 --- a/tests/acceptance/01_vars/02_functions/017.cf +++ b/tests/acceptance/01_vars/02_functions/017.cf @@ -3,23 +3,20 @@ # Test readstringlist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -27,47 +24,52 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123.456"; - "789"; + "123.456"; + "789"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" slist => { @{test.nums} }; + "nums" slist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123.456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok789", - islessthan("$(test.sum)", "912.457"), - isgreaterthan("$(test.sum)", "912.455") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123.456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok789", + islessthan("$(test.sum)", "912.457"), + isgreaterthan("$(test.sum)", "912.455"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/018.cf b/tests/acceptance/01_vars/02_functions/018.cf index 957e7fadb4..d72de43df2 100644 --- a/tests/acceptance/01_vars/02_functions/018.cf +++ b/tests/acceptance/01_vars/02_functions/018.cf @@ -3,23 +3,20 @@ # Test readstringlist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -27,47 +24,53 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123 456 789"; + "123 456 789"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" slist => { @{test.nums} }; + "nums" slist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/019.cf b/tests/acceptance/01_vars/02_functions/019.cf index 845e41fe6a..6b1af5b687 100644 --- a/tests/acceptance/01_vars/02_functions/019.cf +++ b/tests/acceptance/01_vars/02_functions/019.cf @@ -3,23 +3,20 @@ # Test readstringlist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -27,45 +24,49 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123.456"; + "123.456"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)","NoComment","X",5,100); - "sum" real => sum("nums"); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "X", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" slist => { @{test.nums} }; + "nums" slist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123.456", "$(nums)"); - "ok" and => { "ok_list", "ok123", - islessthan("$(test.sum)", "123.457"), - isgreaterthan("$(test.sum)", "123.455") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123.456", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + islessthan("$(test.sum)", "123.457"), + isgreaterthan("$(test.sum)", "123.455"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/020.cf b/tests/acceptance/01_vars/02_functions/020.cf index 146813588f..3991eb2c14 100644 --- a/tests/acceptance/01_vars/02_functions/020.cf +++ b/tests/acceptance/01_vars/02_functions/020.cf @@ -3,23 +3,20 @@ # Test readstringlist() issue 364, also 366 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -27,47 +24,55 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123 456 789"; # "empty" fields + "123 456 789"; + + # "empty" fields } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)","NoComment","\s",5,100); - "sum" real => sum("nums"); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" slist => { @{test.nums} }; + "nums" slist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/021.cf b/tests/acceptance/01_vars/02_functions/021.cf index 50fd2c090f..de76fbe70a 100644 --- a/tests/acceptance/01_vars/02_functions/021.cf +++ b/tests/acceptance/01_vars/02_functions/021.cf @@ -3,23 +3,20 @@ # Test readstringlist() issue 364, also 366 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -27,47 +24,55 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123,,,456,789"; # "empty" fields + "123,,,456,789"; + + # "empty" fields } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)","NoComment",",",5,100); - "sum" real => sum("nums"); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", ",", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" slist => { @{test.nums} }; + "nums" slist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/024.cf b/tests/acceptance/01_vars/02_functions/024.cf index 867bd7ccc4..74df030785 100644 --- a/tests/acceptance/01_vars/02_functions/024.cf +++ b/tests/acceptance/01_vars/02_functions/024.cf @@ -3,21 +3,19 @@ # Test readintlist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,43 +23,45 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123"; + "123"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" ilist => { @{test.nums} }; + "nums" ilist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok" and => { "ok_list", - islessthan("$(test.sum)", "123.1"), - isgreaterthan("$(test.sum)", "122.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + + "ok" + and => { + "ok_list", + islessthan("$(test.sum)", "123.1"), + isgreaterthan("$(test.sum)", "122.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/025.cf b/tests/acceptance/01_vars/02_functions/025.cf index 004571d9d3..3d6351e52c 100644 --- a/tests/acceptance/01_vars/02_functions/025.cf +++ b/tests/acceptance/01_vars/02_functions/025.cf @@ -3,21 +3,19 @@ # Test readintlist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,45 +23,49 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123"; - "456"; + "123"; + "456"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" ilist => { @{test.nums} }; + "nums" ilist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", - islessthan("$(test.sum)", "579.1"), - isgreaterthan("$(test.sum)", "578.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + islessthan("$(test.sum)", "579.1"), + isgreaterthan("$(test.sum)", "578.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/026.cf b/tests/acceptance/01_vars/02_functions/026.cf index 11af325962..50b0cf1ec3 100644 --- a/tests/acceptance/01_vars/02_functions/026.cf +++ b/tests/acceptance/01_vars/02_functions/026.cf @@ -3,21 +3,19 @@ # Test readintlist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,44 +23,48 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123 456"; + "123 456"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" ilist => { @{test.nums} }; + "nums" ilist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", - islessthan("$(test.sum)", "579.1"), - isgreaterthan("$(test.sum)", "578.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + islessthan("$(test.sum)", "579.1"), + isgreaterthan("$(test.sum)", "578.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/027.cf b/tests/acceptance/01_vars/02_functions/027.cf index d9f3e95862..55a80306d4 100644 --- a/tests/acceptance/01_vars/02_functions/027.cf +++ b/tests/acceptance/01_vars/02_functions/027.cf @@ -3,21 +3,19 @@ # Test readintlist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,44 +23,48 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123.456"; + "123.456"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)","NoComment","\.",5,100); - "sum" real => sum("nums"); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\.", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" ilist => { @{test.nums} }; + "nums" ilist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", - islessthan("$(test.sum)", "579.1"), - isgreaterthan("$(test.sum)", "578.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + islessthan("$(test.sum)", "579.1"), + isgreaterthan("$(test.sum)", "578.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/028.cf b/tests/acceptance/01_vars/02_functions/028.cf index 401fa1632c..322b4fa70a 100644 --- a/tests/acceptance/01_vars/02_functions/028.cf +++ b/tests/acceptance/01_vars/02_functions/028.cf @@ -3,21 +3,19 @@ # Test readintlist() with reals # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,42 +23,40 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123.456"; + "123.456"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" ilist => { @{test.nums} }; + "nums" ilist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok1" not => strcmp("123.456", "$(nums)"); - "ok2" not => strcmp("123", "$(nums)"); - - "ok" and => { "ok_list", "ok1", "ok2" }; + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok1" not => strcmp("123.456", "$(nums)"); + "ok2" not => strcmp("123", "$(nums)"); + "ok" and => { "ok_list", "ok1", "ok2" }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/029.cf b/tests/acceptance/01_vars/02_functions/029.cf index 6149c19fe1..3a74674426 100644 --- a/tests/acceptance/01_vars/02_functions/029.cf +++ b/tests/acceptance/01_vars/02_functions/029.cf @@ -3,21 +3,19 @@ # Test readintlist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,46 +23,51 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123 456"; - "789"; + "123 456"; + "789"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" ilist => { @{test.nums} }; + "nums" ilist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/030.cf b/tests/acceptance/01_vars/02_functions/030.cf index 95bfd808e6..c5e438f364 100644 --- a/tests/acceptance/01_vars/02_functions/030.cf +++ b/tests/acceptance/01_vars/02_functions/030.cf @@ -3,21 +3,19 @@ # Test readintlist() with reals # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,45 +23,44 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123.456"; - "789"; + "123.456"; + "789"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" ilist => { @{test.nums} }; + "nums" ilist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok1" not => strcmp("123.456", "$(nums)"); - "ok2" not => strcmp("123", "$(nums)"); - # One failure and the readintlist aborts parsing the rest - "ok3" not => strcmp("789", "$(nums)"); + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok1" not => strcmp("123.456", "$(nums)"); + "ok2" not => strcmp("123", "$(nums)"); - "ok" and => { "ok_list", "ok1", "ok2", "ok3" }; + # One failure and the readintlist aborts parsing the rest + "ok3" not => strcmp("789", "$(nums)"); + "ok" and => { "ok_list", "ok1", "ok2", "ok3" }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/031.cf b/tests/acceptance/01_vars/02_functions/031.cf index 296c1d5323..d40f59a103 100644 --- a/tests/acceptance/01_vars/02_functions/031.cf +++ b/tests/acceptance/01_vars/02_functions/031.cf @@ -3,21 +3,19 @@ # Test readintlist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,45 +23,50 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123 456 789"; + "123 456 789"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" ilist => { @{test.nums} }; + "nums" ilist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/032.cf b/tests/acceptance/01_vars/02_functions/032.cf index 4f254969e0..742c4e4f0b 100644 --- a/tests/acceptance/01_vars/02_functions/032.cf +++ b/tests/acceptance/01_vars/02_functions/032.cf @@ -3,21 +3,19 @@ # Test readintlist() with reals # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,41 +23,40 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123.456"; + "123.456"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)","NoComment","X",5,100); - "sum" real => sum("nums"); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "X", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" ilist => { @{test.nums} }; + "nums" ilist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok1" not => strcmp("123.456", "$(nums)"); - "ok2" not => strcmp("123", "$(nums)"); - "ok" and => { "ok_list", "ok1", "ok2" }; + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok1" not => strcmp("123.456", "$(nums)"); + "ok2" not => strcmp("123", "$(nums)"); + "ok" and => { "ok_list", "ok1", "ok2" }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/033.cf b/tests/acceptance/01_vars/02_functions/033.cf index 061bbac5f2..53d80f8c3d 100644 --- a/tests/acceptance/01_vars/02_functions/033.cf +++ b/tests/acceptance/01_vars/02_functions/033.cf @@ -3,21 +3,19 @@ # Test readintlist() issue 364, also 366 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,45 +23,52 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123 456 789"; # "empty" fields + "123 456 789"; + + # "empty" fields } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)","NoComment","\s",5,100); - "sum" real => sum("nums"); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" ilist => { @{test.nums} }; + "nums" ilist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/034.cf b/tests/acceptance/01_vars/02_functions/034.cf index 08106e2be0..0466198f6c 100644 --- a/tests/acceptance/01_vars/02_functions/034.cf +++ b/tests/acceptance/01_vars/02_functions/034.cf @@ -3,21 +3,19 @@ # Test readintlist() issue 364, also 366 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,45 +23,52 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123,,,456,789"; # "empty" fields + "123,,,456,789"; + + # "empty" fields } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)","NoComment",",",5,100); - "sum" real => sum("nums"); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", ",", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" ilist => { @{test.nums} }; + "nums" ilist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/037.cf b/tests/acceptance/01_vars/02_functions/037.cf index d10a07e62e..770c373c58 100644 --- a/tests/acceptance/01_vars/02_functions/037.cf +++ b/tests/acceptance/01_vars/02_functions/037.cf @@ -3,21 +3,19 @@ # Test readreallist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,43 +23,45 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123"; + "123"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" rlist => { @{test.nums} }; + "nums" rlist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok" and => { "ok_list", - islessthan("$(test.sum)", "123.1"), - isgreaterthan("$(test.sum)", "122.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + + "ok" + and => { + "ok_list", + islessthan("$(test.sum)", "123.1"), + isgreaterthan("$(test.sum)", "122.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/038.cf b/tests/acceptance/01_vars/02_functions/038.cf index 2957a1d7a3..26eabcf463 100644 --- a/tests/acceptance/01_vars/02_functions/038.cf +++ b/tests/acceptance/01_vars/02_functions/038.cf @@ -3,21 +3,19 @@ # Test readreallist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,45 +23,49 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123"; - "456"; + "123"; + "456"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" rlist => { @{test.nums} }; + "nums" rlist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", - islessthan("$(test.sum)", "579.1"), - isgreaterthan("$(test.sum)", "578.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + islessthan("$(test.sum)", "579.1"), + isgreaterthan("$(test.sum)", "578.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/039.cf b/tests/acceptance/01_vars/02_functions/039.cf index ba887c972d..53dd4046be 100644 --- a/tests/acceptance/01_vars/02_functions/039.cf +++ b/tests/acceptance/01_vars/02_functions/039.cf @@ -3,21 +3,19 @@ # Test readreallist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,44 +23,48 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123 456"; + "123 456"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" rlist => { @{test.nums} }; + "nums" rlist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", - islessthan("$(test.sum)", "579.1"), - isgreaterthan("$(test.sum)", "578.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + islessthan("$(test.sum)", "579.1"), + isgreaterthan("$(test.sum)", "578.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/040.cf b/tests/acceptance/01_vars/02_functions/040.cf index c9e5656d1d..3ba0f3c2db 100644 --- a/tests/acceptance/01_vars/02_functions/040.cf +++ b/tests/acceptance/01_vars/02_functions/040.cf @@ -3,21 +3,19 @@ # Test readreallist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,44 +23,48 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123.456"; + "123.456"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)","NoComment","\.",5,100); - "sum" real => sum("nums"); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\.", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" rlist => { @{test.nums} }; + "nums" rlist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", - islessthan("$(test.sum)", "579.1"), - isgreaterthan("$(test.sum)", "578.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + islessthan("$(test.sum)", "579.1"), + isgreaterthan("$(test.sum)", "578.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/041.cf b/tests/acceptance/01_vars/02_functions/041.cf index 7c2f985df3..61608635fd 100644 --- a/tests/acceptance/01_vars/02_functions/041.cf +++ b/tests/acceptance/01_vars/02_functions/041.cf @@ -3,21 +3,19 @@ # Test readreallist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,43 +23,46 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123.456"; + "123.456"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" rlist => { @{test.nums} }; + "nums" rlist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123.456", "$(nums)"); - "ok" and => { "ok_list", "ok123", - islessthan("$(test.sum)", "123.457"), - isgreaterthan("$(test.sum)", "123.455") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123.456", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + islessthan("$(test.sum)", "123.457"), + isgreaterthan("$(test.sum)", "123.455"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/042.cf b/tests/acceptance/01_vars/02_functions/042.cf index 74a7a43b73..ee96964fae 100644 --- a/tests/acceptance/01_vars/02_functions/042.cf +++ b/tests/acceptance/01_vars/02_functions/042.cf @@ -3,21 +3,19 @@ # Test readreallist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,46 +23,51 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123 456"; - "789"; + "123 456"; + "789"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" rlist => { @{test.nums} }; + "nums" rlist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/043.cf b/tests/acceptance/01_vars/02_functions/043.cf index 543e732bbe..7a9427aed8 100644 --- a/tests/acceptance/01_vars/02_functions/043.cf +++ b/tests/acceptance/01_vars/02_functions/043.cf @@ -3,21 +3,19 @@ # Test readreallist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,45 +23,49 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123.456"; - "789"; + "123.456"; + "789"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" rlist => { @{test.nums} }; + "nums" rlist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123.456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok789", - islessthan("$(test.sum)", "912.457"), - isgreaterthan("$(test.sum)", "912.455") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123.456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok789", + islessthan("$(test.sum)", "912.457"), + isgreaterthan("$(test.sum)", "912.455"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/044.cf b/tests/acceptance/01_vars/02_functions/044.cf index 76d7e0650c..6b0e85e0c7 100644 --- a/tests/acceptance/01_vars/02_functions/044.cf +++ b/tests/acceptance/01_vars/02_functions/044.cf @@ -3,21 +3,19 @@ # Test readreallist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,45 +23,50 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123 456 789"; + "123 456 789"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)","NoComment","\s+",5,100); - "sum" real => sum("nums"); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" rlist => { @{test.nums} }; + "nums" rlist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/045.cf b/tests/acceptance/01_vars/02_functions/045.cf index 50d6c6fbe7..0cddcd7562 100644 --- a/tests/acceptance/01_vars/02_functions/045.cf +++ b/tests/acceptance/01_vars/02_functions/045.cf @@ -3,21 +3,19 @@ # Test readreallist() issue 364 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,43 +23,46 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123.456"; + "123.456"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)","NoComment","X",5,100); - "sum" real => sum("nums"); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "X", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" rlist => { @{test.nums} }; + "nums" rlist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123.456", "$(nums)"); - "ok" and => { "ok_list", "ok123", - islessthan("$(test.sum)", "123.457"), - isgreaterthan("$(test.sum)", "123.455") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123.456", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + islessthan("$(test.sum)", "123.457"), + isgreaterthan("$(test.sum)", "123.455"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/046.cf b/tests/acceptance/01_vars/02_functions/046.cf index 0b03d64be0..be53cf261c 100644 --- a/tests/acceptance/01_vars/02_functions/046.cf +++ b/tests/acceptance/01_vars/02_functions/046.cf @@ -3,21 +3,19 @@ # Test readreallist() issue 364, also 366 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,45 +23,52 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123 456 789"; # "empty" fields + "123 456 789"; + + # "empty" fields } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)","NoComment","\s",5,100); - "sum" real => sum("nums"); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" rlist => { @{test.nums} }; + "nums" rlist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/047.cf b/tests/acceptance/01_vars/02_functions/047.cf index ebde3b12d7..fa8c7ce9b7 100644 --- a/tests/acceptance/01_vars/02_functions/047.cf +++ b/tests/acceptance/01_vars/02_functions/047.cf @@ -3,21 +3,19 @@ # Test readreallist() issue 364, also 366 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,45 +23,52 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123,,,456,789"; # "empty" fields + "123,,,456,789"; + + # "empty" fields } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)","NoComment",",",5,100); - "sum" real => sum("nums"); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", ",", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" rlist => { @{test.nums} }; + "nums" rlist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/050.cf b/tests/acceptance/01_vars/02_functions/050.cf index c3296891a1..7bfac4592c 100644 --- a/tests/acceptance/01_vars/02_functions/050.cf +++ b/tests/acceptance/01_vars/02_functions/050.cf @@ -3,21 +3,19 @@ # Test readreallist() issue 364, also 366 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,45 +23,52 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123.456.789"; # Is is a real or a set of ints? + "123.456.789"; + + # Is is a real or a set of ints? } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)","NoComment","\.",5,100); - "sum" real => sum("nums"); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\.", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" rlist => { @{test.nums} }; + "nums" rlist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/051.cf b/tests/acceptance/01_vars/02_functions/051.cf index acd9015d64..206cba1a64 100644 --- a/tests/acceptance/01_vars/02_functions/051.cf +++ b/tests/acceptance/01_vars/02_functions/051.cf @@ -3,46 +3,44 @@ # Test accumulated() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "time" int => accumulated(0,0,0,0,0,100); + "time" int => accumulated(0, 0, 0, 0, 0, 100); } ####################################################### - bundle agent check { vars: - "time" int => "100"; + "time" int => "100"; classes: - "ok" expression => strcmp("$(time)", "$(test.time)"); + "ok" expression => strcmp("$(time)", "$(test.time)"); reports: DEBUG:: "time: $(time)"; "test.time: $(test.time)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/052.cf b/tests/acceptance/01_vars/02_functions/052.cf index 393711c655..a080d72b33 100644 --- a/tests/acceptance/01_vars/02_functions/052.cf +++ b/tests/acceptance/01_vars/02_functions/052.cf @@ -3,46 +3,44 @@ # Test accumulated() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "time" int => accumulated(0,0,0,0,2,100); + "time" int => accumulated(0, 0, 0, 0, 2, 100); } ####################################################### - bundle agent check { vars: - "time" int => "220"; + "time" int => "220"; classes: - "ok" expression => strcmp("$(time)", "$(test.time)"); + "ok" expression => strcmp("$(time)", "$(test.time)"); reports: DEBUG:: "time: $(time)"; "test.time: $(test.time)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/053.cf b/tests/acceptance/01_vars/02_functions/053.cf index 6ad6eecb94..298db3fcfd 100644 --- a/tests/acceptance/01_vars/02_functions/053.cf +++ b/tests/acceptance/01_vars/02_functions/053.cf @@ -3,46 +3,44 @@ # Test accumulated() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "time" int => accumulated(0,0,1,1,2,100); + "time" int => accumulated(0, 0, 1, 1, 2, 100); } ####################################################### - bundle agent check { vars: - "time" int => "90220"; + "time" int => "90220"; classes: - "ok" expression => strcmp("$(time)", "$(test.time)"); + "ok" expression => strcmp("$(time)", "$(test.time)"); reports: DEBUG:: "time: $(time)"; "test.time: $(test.time)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/054.cf b/tests/acceptance/01_vars/02_functions/054.cf index d7027656aa..289f7fe012 100644 --- a/tests/acceptance/01_vars/02_functions/054.cf +++ b/tests/acceptance/01_vars/02_functions/054.cf @@ -3,46 +3,45 @@ # Test accumulated() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "time" int => accumulated(0,1,0,0,0,100); + "time" int => accumulated(0, 1, 0, 0, 0, 100); } ####################################################### - bundle agent check { vars: - "time" int => "2592100"; # 1 month == 30 days + "time" int => "2592100"; + # 1 month == 30 days classes: - "ok" expression => strcmp("$(time)", "$(test.time)"); + "ok" expression => strcmp("$(time)", "$(test.time)"); reports: DEBUG:: "time: $(time)"; "test.time: $(test.time)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/055.cf b/tests/acceptance/01_vars/02_functions/055.cf index 7ff7266ae9..db9921f344 100644 --- a/tests/acceptance/01_vars/02_functions/055.cf +++ b/tests/acceptance/01_vars/02_functions/055.cf @@ -3,46 +3,45 @@ # Test accumulated() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "time" int => accumulated(1,0,0,0,0,100); + "time" int => accumulated(1, 0, 0, 0, 0, 100); } ####################################################### - bundle agent check { vars: - "time" int => "31536100"; # 1 year == 365 days + "time" int => "31536100"; + # 1 year == 365 days classes: - "ok" expression => strcmp("$(time)", "$(test.time)"); + "ok" expression => strcmp("$(time)", "$(test.time)"); reports: DEBUG:: "time: $(time)"; "test.time: $(test.time)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/065.cf b/tests/acceptance/01_vars/02_functions/065.cf index 968e79ed40..41805bb12c 100644 --- a/tests/acceptance/01_vars/02_functions/065.cf +++ b/tests/acceptance/01_vars/02_functions/065.cf @@ -3,46 +3,45 @@ # Test accumulated() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "time" int => now(); + "time" int => now(); } ####################################################### - bundle agent check { vars: - "time" int => "1289601605"; # About when this test was created + "time" int => "1289601605"; + # About when this test was created classes: - "ok" expression => islessthan("$(time)", "$(test.time)"); + "ok" expression => islessthan("$(time)", "$(test.time)"); reports: DEBUG:: "time: $(time)"; "test.time: $(test.time)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/066.cf b/tests/acceptance/01_vars/02_functions/066.cf index 1d62255346..b816d613e6 100644 --- a/tests/acceptance/01_vars/02_functions/066.cf +++ b/tests/acceptance/01_vars/02_functions/066.cf @@ -3,46 +3,42 @@ # Test getusers(), arg0 only # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - # All users except root, bin, and daemon - "users" slist => getusers("root,daemon,bin",""); + # All users except root, bin, and daemon + "users" slist => getusers("root,daemon,bin", ""); files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; reports: cfengine_3:: - "$(users)" - report_to_file => "$(G.testfile)"; + "$(users)" report_to_file => "$(G.testfile)"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; files: - # Try to delete the lines that shouldn't be there anyway - "$(G.testfile)" + # Try to delete the lines that shouldn't be there anyway + "$(G.testfile)" edit_line => test_delete, classes => full_set; } @@ -50,27 +46,25 @@ bundle agent test bundle edit_line test_delete { delete_lines: - "root"; - "daemon"; - "bin"; + "root"; + "daemon"; + "bin"; } body classes full_set { - promise_kept => { "pass" }; - promise_repaired => { "fail" }; - repair_failed => { "fail" }; - repair_denied => { "fail" }; - repair_timeout => { "fail" }; + promise_kept => { "pass" }; + promise_repaired => { "fail" }; + repair_failed => { "fail" }; + repair_denied => { "fail" }; + repair_timeout => { "fail" }; } - ####################################################### - bundle agent check { classes: - "ok" expression => "pass&!fail"; + "ok" expression => "pass&!fail"; reports: ok:: diff --git a/tests/acceptance/01_vars/02_functions/067.cf b/tests/acceptance/01_vars/02_functions/067.cf index 7027b4221a..e2bd50a50f 100644 --- a/tests/acceptance/01_vars/02_functions/067.cf +++ b/tests/acceptance/01_vars/02_functions/067.cf @@ -3,49 +3,46 @@ # Test getusers() arg1 only # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - # All users except root, bin, and daemon + # All users except root, bin, and daemon freebsd|openbsd:: - "users" slist => getusers("","0,1,3"); + "users" slist => getusers("", "0,1,3"); + !freebsd.!openbsd:: - "users" slist => getusers("","0,1,2"); + "users" slist => getusers("", "0,1,2"); files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; reports: cfengine_3:: - "$(users)" - report_to_file => "$(G.testfile)"; + "$(users)" report_to_file => "$(G.testfile)"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; files: - # Try to delete the lines that shouldn't be there anyway - "$(G.testfile)" + # Try to delete the lines that shouldn't be there anyway + "$(G.testfile)" edit_line => test_delete, classes => full_set; } @@ -53,27 +50,25 @@ bundle agent test bundle edit_line test_delete { delete_lines: - "root"; - "daemon"; - "bin"; + "root"; + "daemon"; + "bin"; } body classes full_set { - promise_kept => { "pass" }; - promise_repaired => { "fail" }; - repair_failed => { "fail" }; - repair_denied => { "fail" }; - repair_timeout => { "fail" }; + promise_kept => { "pass" }; + promise_repaired => { "fail" }; + repair_failed => { "fail" }; + repair_denied => { "fail" }; + repair_timeout => { "fail" }; } - ####################################################### - bundle agent check { classes: - "ok" expression => "pass&!fail"; + "ok" expression => "pass&!fail"; reports: ok:: diff --git a/tests/acceptance/01_vars/02_functions/068.cf b/tests/acceptance/01_vars/02_functions/068.cf index 3e8bbe9826..276b1fa84b 100644 --- a/tests/acceptance/01_vars/02_functions/068.cf +++ b/tests/acceptance/01_vars/02_functions/068.cf @@ -3,46 +3,42 @@ # Test getusers() arg0 and arg1 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - # All users except root, bin, and daemon - "users" slist => getusers("root,bin,daemon","0,1,2"); + # All users except root, bin, and daemon + "users" slist => getusers("root,bin,daemon", "0,1,2"); files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; reports: cfengine_3:: - "$(users)" - report_to_file => "$(G.testfile)"; + "$(users)" report_to_file => "$(G.testfile)"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; files: - # Try to delete the lines that shouldn't be there anyway - "$(G.testfile)" + # Try to delete the lines that shouldn't be there anyway + "$(G.testfile)" edit_line => test_delete, classes => full_set; } @@ -50,27 +46,25 @@ bundle agent test bundle edit_line test_delete { delete_lines: - "root"; - "daemon"; - "bin"; + "root"; + "daemon"; + "bin"; } body classes full_set { - promise_kept => { "pass" }; - promise_repaired => { "fail" }; - repair_failed => { "fail" }; - repair_denied => { "fail" }; - repair_timeout => { "fail" }; + promise_kept => { "pass" }; + promise_repaired => { "fail" }; + repair_failed => { "fail" }; + repair_denied => { "fail" }; + repair_timeout => { "fail" }; } - ####################################################### - bundle agent check { classes: - "ok" expression => "pass&!fail"; + "ok" expression => "pass&!fail"; reports: ok:: diff --git a/tests/acceptance/01_vars/02_functions/069.cf b/tests/acceptance/01_vars/02_functions/069.cf index 06ec42be49..cb5eb9f566 100644 --- a/tests/acceptance/01_vars/02_functions/069.cf +++ b/tests/acceptance/01_vars/02_functions/069.cf @@ -3,46 +3,42 @@ # Test getusers() arg0 and arg1, but expect a failure # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - # All users except r.*t [illegal!], bin, and daemon - "users" slist => getusers("r.*t,bin","1,5,6,7"); + # All users except r.*t [illegal!], bin, and daemon + "users" slist => getusers("r.*t,bin", "1,5,6,7"); files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; reports: cfengine_3:: - "$(users)" - report_to_file => "$(G.testfile)"; + "$(users)" report_to_file => "$(G.testfile)"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; files: - # Try to delete the lines that shouldn't be there anyway - "$(G.testfile)" + # Try to delete the lines that shouldn't be there anyway + "$(G.testfile)" edit_line => test_delete, classes => full_set; } @@ -50,27 +46,25 @@ bundle agent test bundle edit_line test_delete { delete_lines: - "root"; - "daemon"; - "bin"; + "root"; + "daemon"; + "bin"; } body classes full_set { - promise_kept => { "fail" }; - promise_repaired => { "pass" }; - repair_failed => { "fail" }; - repair_denied => { "fail" }; - repair_timeout => { "fail" }; + promise_kept => { "fail" }; + promise_repaired => { "pass" }; + repair_failed => { "fail" }; + repair_denied => { "fail" }; + repair_timeout => { "fail" }; } - ####################################################### - bundle agent check { classes: - "ok" expression => "pass&!fail"; + "ok" expression => "pass&!fail"; reports: ok:: diff --git a/tests/acceptance/01_vars/02_functions/071.cf b/tests/acceptance/01_vars/02_functions/071.cf index 80402dbeb3..7c0fb3b7bc 100644 --- a/tests/acceptance/01_vars/02_functions/071.cf +++ b/tests/acceptance/01_vars/02_functions/071.cf @@ -3,21 +3,19 @@ # Test filesize(), simple # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,46 +23,44 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 this:is:a:test 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "known_val" int => filesize("$(G.testfile)"); - "known_zero" int => filesize("$(G.etc_null)"); - "unknown" int => filesize("/There/Is/nosuch/Name/as-this"); + "known_val" int => filesize("$(G.testfile)"); + "known_zero" int => filesize("$(G.etc_null)"); + "unknown" int => filesize("/There/Is/nosuch/Name/as-this"); } ####################################################### - bundle agent check { vars: - windows:: - "testfilesize" int => "30"; - !windows:: - "testfilesize" int => "27"; + windows:: + "testfilesize" int => "30"; + + !windows:: + "testfilesize" int => "27"; classes: - "var" expression => isvariable("test.unknown"); + "var" expression => isvariable("test.unknown"); - "ok" and => { - "!var", - strcmp("$(test.known_val)", "$(testfilesize)"), - strcmp("$(test.known_zero)", "0"), + "ok" + and => { + "!var", + strcmp("$(test.known_val)", "$(testfilesize)"), + strcmp("$(test.known_zero)", "0"), }; reports: diff --git a/tests/acceptance/01_vars/02_functions/080.cf b/tests/acceptance/01_vars/02_functions/080.cf index 4bf784d593..d44b52c6d6 100644 --- a/tests/acceptance/01_vars/02_functions/080.cf +++ b/tests/acceptance/01_vars/02_functions/080.cf @@ -3,57 +3,56 @@ # Test getuid() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - # NOTE: We need to make this test work on Windows by finding a good - # registry value to use (and we always expect it to fail on non-Windows - # - # Always execute this - the return value depends on the OS used, but - # we always expect registryvalue() to not crash - "regval" string => registryvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Currentversion", "ProgramFilesDir"); + # NOTE: We need to make this test work on Windows by finding a good + # registry value to use (and we always expect it to fail on non-Windows + # + # Always execute this - the return value depends on the OS used, but + # we always expect registryvalue() to not crash + "regval" + string => registryvalue( + "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Currentversion", + "ProgramFilesDir" + ); } - ####################################################### - bundle agent check { classes: windows:: - "ok" and => { - strcmp("$(test.regval)", "C:\Program Files"), - }; + "ok" and => { strcmp("$(test.regval)", "C:\Program Files") }; + !windows:: "ok" not => isvariable("test.regval"); reports: DEBUG:: "Registry value is $(test.regval)"; + ok:: "$(this.promise_filename) Pass"; @@ -62,9 +61,8 @@ bundle agent check } ####################################################### - bundle agent fini { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } diff --git a/tests/acceptance/01_vars/02_functions/201.cf b/tests/acceptance/01_vars/02_functions/201.cf index e9b4ee1d01..c6b15c9581 100644 --- a/tests/acceptance/01_vars/02_functions/201.cf +++ b/tests/acceptance/01_vars/02_functions/201.cf @@ -3,37 +3,34 @@ # Test getindices(), size 0 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile).expected" - create => "true"; + "$(G.testfile).expected" create => "true"; } ####################################################### - bundle agent test { vars: - "array" string => "zero"; # Intentionally not an array + "array" string => "zero"; - "keys" slist => getindices("array"); + # Intentionally not an array + "keys" slist => getindices("array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -45,18 +42,20 @@ bundle agent test bundle edit_line test_insert { vars: - "keys" slist => { @{test.keys} }; + "keys" slist => { @{test.keys} }; insert_lines: - "$(keys)"; + "$(keys)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/202.cf b/tests/acceptance/01_vars/02_functions/202.cf index 3118dbf05f..b5d46e36d7 100644 --- a/tests/acceptance/01_vars/02_functions/202.cf +++ b/tests/acceptance/01_vars/02_functions/202.cf @@ -3,23 +3,21 @@ # Test getindices(), size 1 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert; } @@ -27,20 +25,18 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "alpha"; + "alpha"; } ####################################################### - bundle agent test { vars: - "array[alpha]" string => "zero"; - - "keys" slist => getindices("array"); + "array[alpha]" string => "zero"; + "keys" slist => getindices("array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -52,18 +48,20 @@ bundle agent test bundle edit_line test_insert { vars: - "keys" slist => { @{test.keys} }; + "keys" slist => { @{test.keys} }; insert_lines: - "$(keys)"; + "$(keys)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/203.cf b/tests/acceptance/01_vars/02_functions/203.cf index ed032a9368..fd8995808f 100644 --- a/tests/acceptance/01_vars/02_functions/203.cf +++ b/tests/acceptance/01_vars/02_functions/203.cf @@ -3,23 +3,21 @@ # Test getindices(), size 2 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert; } @@ -27,22 +25,20 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "alpha"; - "beta"; + "alpha"; + "beta"; } ####################################################### - bundle agent test { vars: - "array[alpha]" string => "zero"; - "array[beta]" string => "two"; - - "keys" slist => getindices("array"); + "array[alpha]" string => "zero"; + "array[beta]" string => "two"; + "keys" slist => getindices("array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -54,18 +50,20 @@ bundle agent test bundle edit_line test_insert { vars: - "keys" slist => { @{test.keys} }; + "keys" slist => { @{test.keys} }; insert_lines: - "$(keys)"; + "$(keys)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/204.cf b/tests/acceptance/01_vars/02_functions/204.cf index 69fdcf1f35..e4fdd107f7 100644 --- a/tests/acceptance/01_vars/02_functions/204.cf +++ b/tests/acceptance/01_vars/02_functions/204.cf @@ -3,23 +3,21 @@ # Test getindices(), size 5 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert; } @@ -27,28 +25,26 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "alpha"; - "beta"; - "gamma's"; - "delta-delta:delta"; - "last"; + "alpha"; + "beta"; + "gamma's"; + "delta-delta:delta"; + "last"; } ####################################################### - bundle agent test { vars: - "array[alpha]" string => "zero"; - "array[beta]" string => "two"; - "array[gamma's]" string => "three's"; - "array[delta-delta:delta]" string => "four-fore:quatre"; - "array[last]" string => "last"; - - "keys" slist => getindices("array"); + "array[alpha]" string => "zero"; + "array[beta]" string => "two"; + "array[gamma's]" string => "three's"; + "array[delta-delta:delta]" string => "four-fore:quatre"; + "array[last]" string => "last"; + "keys" slist => getindices("array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -60,18 +56,20 @@ bundle agent test bundle edit_line test_insert { vars: - "keys" slist => { @{test.keys} }; + "keys" slist => { @{test.keys} }; insert_lines: - "$(keys)"; + "$(keys)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/205.cf b/tests/acceptance/01_vars/02_functions/205.cf index fa59d10456..cce538b733 100644 --- a/tests/acceptance/01_vars/02_functions/205.cf +++ b/tests/acceptance/01_vars/02_functions/205.cf @@ -3,41 +3,39 @@ # getindices should not truncate keys # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "longstring" string => "abcdefghijklmnopqrstuvwxyz1234abcdefghijklmnopqrstuvwxyz1234abcdefghijklmnopqrstuvwxyz1234abcdefghijklmnopqrstuvwxyz1234abcdefghijklmnopqrstuvwxyz1234abcdefghijklmnopqrstuvwxyz1234AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIJJJJJJJJJJJJJJJJJJJJJJJKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPQRSTUVWXYZ"; - "table[$(longstring)]" string => "0050"; - "member" slist => getindices("table"); + "longstring" + string => "abcdefghijklmnopqrstuvwxyz1234abcdefghijklmnopqrstuvwxyz1234abcdefghijklmnopqrstuvwxyz1234abcdefghijklmnopqrstuvwxyz1234abcdefghijklmnopqrstuvwxyz1234abcdefghijklmnopqrstuvwxyz1234AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIJJJJJJJJJJJJJJJJJJJJJJJKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPQRSTUVWXYZ"; + + "table[$(longstring)]" string => "0050"; + "member" slist => getindices("table"); } ####################################################### - bundle agent test { } - ####################################################### - bundle agent check { classes: - "ok" expression => strcmp($(init.member), $(init.longstring)); + "ok" expression => strcmp($(init.member), $(init.longstring)); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/211.cf b/tests/acceptance/01_vars/02_functions/211.cf index 947d6f77fb..e0a1395d06 100644 --- a/tests/acceptance/01_vars/02_functions/211.cf +++ b/tests/acceptance/01_vars/02_functions/211.cf @@ -3,24 +3,22 @@ # Test getvalues(string), should return the string itself # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; - "expected" string => "blah"; + "dummy" string => "dummy"; + "expected" string => "blah"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert("$(init.expected)"), edit_defaults => init_empty; @@ -29,25 +27,25 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "array" string => "blah"; # Intentionally not an array + "array" string => "blah"; - "vals" slist => getvalues("array"); + # Intentionally not an array + "vals" slist => getvalues("array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -59,18 +57,20 @@ bundle agent test bundle edit_line test_insert { vars: - "vals" slist => { @{test.vals} }; + "vals" slist => { @{test.vals} }; insert_lines: - "$(vals)"; + "$(vals)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/212.cf b/tests/acceptance/01_vars/02_functions/212.cf index d748aa4e40..f34a87189e 100644 --- a/tests/acceptance/01_vars/02_functions/212.cf +++ b/tests/acceptance/01_vars/02_functions/212.cf @@ -3,23 +3,21 @@ # Test getvalues(), size 1 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert; } @@ -27,20 +25,18 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "zero"; + "zero"; } ####################################################### - bundle agent test { vars: - "array[alpha]" string => "zero"; - - "vals" slist => getvalues("array"); + "array[alpha]" string => "zero"; + "vals" slist => getvalues("array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -52,18 +48,20 @@ bundle agent test bundle edit_line test_insert { vars: - "vals" slist => { @{test.vals} }; + "vals" slist => { @{test.vals} }; insert_lines: - "$(vals)"; + "$(vals)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/221.cf b/tests/acceptance/01_vars/02_functions/221.cf index 6225ed44ca..f14d086083 100644 --- a/tests/acceptance/01_vars/02_functions/221.cf +++ b/tests/acceptance/01_vars/02_functions/221.cf @@ -3,35 +3,31 @@ # Test grep(), size 0, local slist # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile).expected" - create => "true"; + "$(G.testfile).expected" create => "true"; } ####################################################### - bundle agent test { vars: - "array" slist => { "One", "Two", "Three", "Four", "Five" }; - - "vals" slist => grep("Z.*", "array"); + "array" slist => { "One", "Two", "Three", "Four", "Five" }; + "vals" slist => grep("Z.*", "array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -43,18 +39,20 @@ bundle agent test bundle edit_line test_insert { vars: - "vals" slist => { @{test.vals} }; + "vals" slist => { @{test.vals} }; insert_lines: - "$(vals)"; + "$(vals)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/222.cf b/tests/acceptance/01_vars/02_functions/222.cf index b47132bca5..3f867ea425 100644 --- a/tests/acceptance/01_vars/02_functions/222.cf +++ b/tests/acceptance/01_vars/02_functions/222.cf @@ -3,35 +3,31 @@ # Test grep(), size 0, global array # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile).expected" - create => "true"; + "$(G.testfile).expected" create => "true"; } ####################################################### - bundle agent test { vars: - "array" slist => { "One", "Two", "Three", "Four", "Five" }; - - "vals" slist => grep("Z.*", "test.array"); + "array" slist => { "One", "Two", "Three", "Four", "Five" }; + "vals" slist => grep("Z.*", "test.array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -43,18 +39,20 @@ bundle agent test bundle edit_line test_insert { vars: - "vals" slist => { @{test.vals} }; + "vals" slist => { @{test.vals} }; insert_lines: - "$(vals)"; + "$(vals)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/223.cf b/tests/acceptance/01_vars/02_functions/223.cf index 463b042a09..b107b3ec16 100644 --- a/tests/acceptance/01_vars/02_functions/223.cf +++ b/tests/acceptance/01_vars/02_functions/223.cf @@ -3,21 +3,20 @@ # Test grep(), size 2 local array # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert; } @@ -25,21 +24,19 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "Two"; - "Three"; + "Two"; + "Three"; } ####################################################### - bundle agent test { vars: - "array" slist => { "One", "Two", "Three", "Four", "Five" }; - - "vals" slist => grep("T.*", "array"); + "array" slist => { "One", "Two", "Three", "Four", "Five" }; + "vals" slist => grep("T.*", "array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -51,26 +48,27 @@ bundle agent test bundle edit_line test_insert { vars: - "vals" slist => { @{test.vals} }; + "vals" slist => { @{test.vals} }; insert_lines: - "$(vals)"; + "$(vals)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("$(G.testfile).*"); + "any" usebundle => dcs_fini("$(G.testfile).*"); } diff --git a/tests/acceptance/01_vars/02_functions/224.cf b/tests/acceptance/01_vars/02_functions/224.cf index fe3958cd5b..e8304bc616 100644 --- a/tests/acceptance/01_vars/02_functions/224.cf +++ b/tests/acceptance/01_vars/02_functions/224.cf @@ -3,21 +3,20 @@ # Test grep(), size 2, global array # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert; } @@ -25,21 +24,19 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "Two"; - "Three"; + "Two"; + "Three"; } ####################################################### - bundle agent test { vars: - "array" slist => { "One", "Two", "Three", "Four", "Five" }; - - "vals" slist => grep("T.*","test.array"); + "array" slist => { "One", "Two", "Three", "Four", "Five" }; + "vals" slist => grep("T.*", "test.array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -51,26 +48,27 @@ bundle agent test bundle edit_line test_insert { vars: - "vals" slist => { @{test.vals} }; + "vals" slist => { @{test.vals} }; insert_lines: - "$(vals)"; + "$(vals)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("$(G.testfile).*"); + "any" usebundle => dcs_fini("$(G.testfile).*"); } diff --git a/tests/acceptance/01_vars/02_functions/225.cf b/tests/acceptance/01_vars/02_functions/225.cf index a93f141285..3095e2b0a2 100644 --- a/tests/acceptance/01_vars/02_functions/225.cf +++ b/tests/acceptance/01_vars/02_functions/225.cf @@ -3,21 +3,20 @@ # Test grep(), size 1, last element # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert; } @@ -25,20 +24,18 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "Five"; + "Five"; } ####################################################### - bundle agent test { vars: - "array" slist => { "One", "Two", "Three", "Four", "Five" }; - - "vals" slist => grep(".*v.*", "array"); + "array" slist => { "One", "Two", "Three", "Four", "Five" }; + "vals" slist => grep(".*v.*", "array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -50,26 +47,27 @@ bundle agent test bundle edit_line test_insert { vars: - "vals" slist => { @{test.vals} }; + "vals" slist => { @{test.vals} }; insert_lines: - "$(vals)"; + "$(vals)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("$(G.testfile).*"); + "any" usebundle => dcs_fini("$(G.testfile).*"); } diff --git a/tests/acceptance/01_vars/02_functions/226.cf b/tests/acceptance/01_vars/02_functions/226.cf index c7cb4ebe97..95fcee8300 100644 --- a/tests/acceptance/01_vars/02_functions/226.cf +++ b/tests/acceptance/01_vars/02_functions/226.cf @@ -3,36 +3,32 @@ # Test grep(), size 0, ".*v" matches nothing (anchored regex) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "zero" string => "zero"; - "one" string => "one"; + "zero" string => "zero"; + "one" string => "one"; files: - "$(G.testfile).expected" - create => "true"; + "$(G.testfile).expected" create => "true"; } ####################################################### - bundle agent test { vars: - "array" slist => { "One", "Two", "Three", "Four", "Five" }; - - "vals" slist => grep(".*v", "array"); + "array" slist => { "One", "Two", "Three", "Four", "Five" }; + "vals" slist => grep(".*v", "array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -44,26 +40,27 @@ bundle agent test bundle edit_line test_insert { vars: - "vals" slist => { @{test.vals} }; + "vals" slist => { @{test.vals} }; insert_lines: - "$(vals)"; + "$(vals)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("$(G.testfile).*"); + "any" usebundle => dcs_fini("$(G.testfile).*"); } diff --git a/tests/acceptance/01_vars/02_functions/227.cf b/tests/acceptance/01_vars/02_functions/227.cf index 37b2713ee9..dca9861c15 100644 --- a/tests/acceptance/01_vars/02_functions/227.cf +++ b/tests/acceptance/01_vars/02_functions/227.cf @@ -3,36 +3,32 @@ # Test grep(), size 0, empty pattern should match nothing # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "zero" string => "zero"; - "one" string => "one"; + "zero" string => "zero"; + "one" string => "one"; files: - "$(G.testfile).expected" - create => "true"; + "$(G.testfile).expected" create => "true"; } ####################################################### - bundle agent test { vars: - "array" slist => { "One", "Two", "Three", "Four", "Five" }; - - "vals" slist => grep("", "array"); + "array" slist => { "One", "Two", "Three", "Four", "Five" }; + "vals" slist => grep("", "array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -44,26 +40,27 @@ bundle agent test bundle edit_line test_insert { vars: - "vals" slist => { @{test.vals} }; + "vals" slist => { @{test.vals} }; insert_lines: - "$(vals)"; + "$(vals)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("$(G.testfile).*"); + "any" usebundle => dcs_fini("$(G.testfile).*"); } diff --git a/tests/acceptance/01_vars/02_functions/300.cf b/tests/acceptance/01_vars/02_functions/300.cf index 69e7e5c29c..03574e5ad2 100644 --- a/tests/acceptance/01_vars/02_functions/300.cf +++ b/tests/acceptance/01_vars/02_functions/300.cf @@ -3,42 +3,39 @@ # Test multiline regcmp # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "haystack" string => "foo + "haystack" string => "foo bar"; - "needle" string => ".*"; + "needle" string => ".*"; } ####################################################### - bundle agent check { classes: - "ok" and => { regcmp("$(test.needle)", "$(test.haystack)") }; + "ok" and => { regcmp("$(test.needle)", "$(test.haystack)") }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/310.cf b/tests/acceptance/01_vars/02_functions/310.cf index e841b94919..761213683f 100644 --- a/tests/acceptance/01_vars/02_functions/310.cf +++ b/tests/acceptance/01_vars/02_functions/310.cf @@ -3,56 +3,53 @@ # Test escape() - basic tests # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "t1" string => escape("foo"); - "e1" string => "foo"; - "t2" string => escape("foo.baz"); - "e2" string => "foo.baz"; - "t3" string => escape("foo[baz]"); - "e3" string => "foo[baz]"; - "t4" string => escape("(fo?o|baz)+x{3}y*"); - "e4" string => "(fo?o|baz)+x{3}y*"; - "t5" string => escape("~`!@#%&_=\"';:,/<>"); - "e5" string => "~`!@#%&_=\"';:,/<>"; + "t1" string => escape("foo"); + "e1" string => "foo"; + "t2" string => escape("foo.baz"); + "e2" string => "foo.baz"; + "t3" string => escape("foo[baz]"); + "e3" string => "foo[baz]"; + "t4" string => escape("(fo?o|baz)+x{3}y*"); + "e4" string => "(fo?o|baz)+x{3}y*"; + "t5" string => escape("~`!@#%&_=\"';:,/<>"); + "e5" string => "~`!@#%&_=\"';:,/<>"; } ####################################################### - bundle agent check { classes: - "ok" and => { - regcmp("$(test.t1)", "$(test.e1)"), - regcmp("$(test.t2)", "$(test.e2)"), - regcmp("$(test.t3)", "$(test.e3)"), - regcmp("$(test.t4)", "$(test.e4)"), - regcmp("$(test.t5)", "$(test.e5)"), + "ok" + and => { + regcmp("$(test.t1)", "$(test.e1)"), + regcmp("$(test.t2)", "$(test.e2)"), + regcmp("$(test.t3)", "$(test.e3)"), + regcmp("$(test.t4)", "$(test.e4)"), + regcmp("$(test.t5)", "$(test.e5)"), }; reports: @@ -63,6 +60,7 @@ bundle agent check "'$(test.t3)' vs. '$(test.e3)'"; "'$(test.t4)' vs. '$(test.e4)'"; "'$(test.t5)' vs. '$(test.e5)'"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/311.cf b/tests/acceptance/01_vars/02_functions/311.cf index 23e3919d41..a38c478866 100644 --- a/tests/acceptance/01_vars/02_functions/311.cf +++ b/tests/acceptance/01_vars/02_functions/311.cf @@ -3,58 +3,51 @@ # Test escape() - basic tests inside an slist # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "s1" slist => { - "bstr", - escape("foo"), - escape("foo.baz"), - escape("foo[baz]"), - "estr", + "s1" + slist => { + "bstr", escape("foo"), escape("foo.baz"), escape("foo[baz]"), "estr", }; - "t1" string => join(",","s1"); - "e1" string => "bstr,foo,foo.baz,foo[baz],estr"; + + "t1" string => join(",", "s1"); + "e1" string => "bstr,foo,foo.baz,foo[baz],estr"; } ####################################################### - bundle agent check { classes: - "ok" and => { - regcmp("$(test.t1)", "$(test.e1)"), - }; + "ok" and => { regcmp("$(test.t1)", "$(test.e1)") }; reports: DEBUG:: "'$(test.t1)' comprises $(s1)"; "Comparing actual vs. expected:"; "'$(test.t1)' vs. '$(test.e1)'"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/312.cf b/tests/acceptance/01_vars/02_functions/312.cf index 2d668d4c43..dc3fe57dfd 100644 --- a/tests/acceptance/01_vars/02_functions/312.cf +++ b/tests/acceptance/01_vars/02_functions/312.cf @@ -1,53 +1,55 @@ -# # Test escape() - issue 689 -# - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { vars: - "t1" string => escape("1,2"); - "e1" string => "1,2"; - "t2" string => escape("{1,2}"); - "e2" string => "{1,2}"; + "t1" string => escape("1,2"); + "e1" string => "1,2"; + "t2" string => escape("{1,2}"); + "e2" string => "{1,2}"; } bundle agent check { classes: - "ok1" expression => regcmp("$(test.t1)", "$(test.e1)"); - "ok2" expression => regcmp("$(test.t2)", "$(test.e2)"); - "ok" and => { "ok1", "ok2" }; + "ok1" expression => regcmp("$(test.t1)", "$(test.e1)"); + "ok2" expression => regcmp("$(test.t2)", "$(test.e2)"); + "ok" and => { "ok1", "ok2" }; reports: DEBUG:: "Comparing actual vs. expected:"; + DEBUG.ok1:: "'$(test.t1)' is the same as '$(test.e1)'"; + DEBUG.!ok1:: "'$(test.t1)' is NOT the same as '$(test.e1)'"; + DEBUG.ok2:: "'$(test.t2)' is the same as '$(test.e2)'"; + DEBUG.!ok2:: "'$(test.t2)' is NOT the same as '$(test.e2)'"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/313.cf b/tests/acceptance/01_vars/02_functions/313.cf index 163a80e9a7..88474dfb86 100644 --- a/tests/acceptance/01_vars/02_functions/313.cf +++ b/tests/acceptance/01_vars/02_functions/313.cf @@ -3,50 +3,45 @@ # Test escape() - strings that end with \, issue 690 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "t1" string => escape("\\"); - "e1" string => "\\"; + "t1" string => escape("\\"); + "e1" string => "\\"; } ####################################################### - bundle agent check { classes: - "ok" and => { - regcmp("$(test.t1)", "$(test.e1)"), - }; + "ok" and => { regcmp("$(test.t1)", "$(test.e1)") }; reports: DEBUG:: "Comparing actual vs. expected:"; "'$(test.t1)' vs. '$(test.e1)'"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/400.cf b/tests/acceptance/01_vars/02_functions/400.cf index 677b3c36e0..bc6edf6d78 100644 --- a/tests/acceptance/01_vars/02_functions/400.cf +++ b/tests/acceptance/01_vars/02_functions/400.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,77 +27,72 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 this:is:a:test 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarray("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "3"; + "cnt" + int => readstringarray( + "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 + ); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "is"), - strcmp("$(test.ary[this][2])", "a"), - strcmp("$(test.ary[this][3])", "test"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "is"), + strcmp("$(test.ary[this][2])", "a"), + strcmp("$(test.ary[this][3])", "test"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[this][4]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[this][4]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'is', saw '$(test.ary[this][1])'"; "expected test.ary[this][2] = 'a', saw '$(test.ary[this][2])'"; "expected test.ary[this][3] = 'test', saw '$(test.ary[this][3])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/401.cf b/tests/acceptance/01_vars/02_functions/401.cf index f2dabee378..fd2f2da1be 100644 --- a/tests/acceptance/01_vars/02_functions/401.cf +++ b/tests/acceptance/01_vars/02_functions/401.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,71 +27,66 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 singleton 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarray("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "3"; + "cnt" + int => readstringarray( + "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 + ); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[singleton][0])", "singleton"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[singleton][0])", "singleton"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[singleton][1]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[singleton][1]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[singleton][0] = 'singleton', saw '$(test.ary[singleton][0])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/410.cf b/tests/acceptance/01_vars/02_functions/410.cf index 37204fe3a6..2937dd7531 100644 --- a/tests/acceptance/01_vars/02_functions/410.cf +++ b/tests/acceptance/01_vars/02_functions/410.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,69 +36,56 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarray("ary", "$(G.testfile)","^#.*",":+",10,14); - "num" int => "3"; + "cnt" int => readstringarray("ary", "$(G.testfile)", "^#.*", ":+", 10, 14); + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "bad" or => { - isvariable("test.ary[he][1]"), - isvariable("test.ary[blank][0]"), - }; - - "ok" and => { - "!bad", - - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[he][0])", "he"), + "bad" + or => { isvariable("test.ary[he][1]"), isvariable("test.ary[blank][0]") }; + + "ok" + and => { + "!bad", + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[he][0])", "he"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "saw 'bad'-class things"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[he][0] = 'he', saw '$(test.ary[he][0])'"; ok:: diff --git a/tests/acceptance/01_vars/02_functions/420.cf b/tests/acceptance/01_vars/02_functions/420.cf index c0d874cbbd..634072f50f 100644 --- a/tests/acceptance/01_vars/02_functions/420.cf +++ b/tests/acceptance/01_vars/02_functions/420.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,80 +27,76 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 this:is:a:test 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarray("ary", "$(teststr)","NoComment",":",10,1000); - # ensure that bare words are OK - "ignore" int => parsestringarray("ary", "mydata","NoComment",":",10,1000); - "num" int => "3"; + "teststr" string => readfile("$(G.testfile)", 1000); + + "cnt" + int => parsestringarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); + + # ensure that bare words are OK + "ignore" + int => parsestringarray("ary", "mydata", "NoComment", ":", 10, 1000); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "is"), - strcmp("$(test.ary[this][2])", "a"), - strcmp("$(test.ary[this][3])", "test"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "is"), + strcmp("$(test.ary[this][2])", "a"), + strcmp("$(test.ary[this][3])", "test"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[this][4]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[this][4]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'is', saw '$(test.ary[this][1])'"; "expected test.ary[this][2] = 'a', saw '$(test.ary[this][2])'"; "expected test.ary[this][3] = 'test', saw '$(test.ary[this][3])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/421.cf b/tests/acceptance/01_vars/02_functions/421.cf index c5fdc0cbab..9891f76758 100644 --- a/tests/acceptance/01_vars/02_functions/421.cf +++ b/tests/acceptance/01_vars/02_functions/421.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,72 +27,66 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 singleton 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarray("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "3"; + "teststr" string => readfile("$(G.testfile)", 1000); + + "cnt" + int => parsestringarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[singleton][0])", "singleton"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[singleton][0])", "singleton"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[singleton][1]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[singleton][1]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[singleton][0] = 'singleton', saw '$(test.ary[singleton][0])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/440.cf b/tests/acceptance/01_vars/02_functions/440.cf index f25f9d5087..3ffe141d7b 100644 --- a/tests/acceptance/01_vars/02_functions/440.cf +++ b/tests/acceptance/01_vars/02_functions/440.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,77 +27,72 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 this:is:a:test 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarrayidx("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "3"; + "cnt" + int => readstringarrayidx( + "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 + ); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "this"), - strcmp("$(test.ary[1][1])", "is"), - strcmp("$(test.ary[1][2])", "a"), - strcmp("$(test.ary[1][3])", "test"), - - strcmp("$(test.ary[2][0])", "1"), - strcmp("$(test.ary[2][1])", "2"), - strcmp("$(test.ary[2][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "this"), + strcmp("$(test.ary[1][1])", "is"), + strcmp("$(test.ary[1][2])", "a"), + strcmp("$(test.ary[1][3])", "test"), + strcmp("$(test.ary[2][0])", "1"), + strcmp("$(test.ary[2][1])", "2"), + strcmp("$(test.ary[2][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[1][4]"), - isvariable("test.ary[2][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[1][4]"), + isvariable("test.ary[2][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = 'this', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = 'is', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = 'a', saw '$(test.ary[1][2])'"; "expected test.ary[1][3] = 'test', saw '$(test.ary[1][3])'"; - "expected test.ary[2][0] = '1', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = '2', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = '3', saw '$(test.ary[2][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/441.cf b/tests/acceptance/01_vars/02_functions/441.cf index e46582c4ea..3a71cff5cd 100644 --- a/tests/acceptance/01_vars/02_functions/441.cf +++ b/tests/acceptance/01_vars/02_functions/441.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,71 +27,66 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 singleton 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarrayidx("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "3"; + "cnt" + int => readstringarrayidx( + "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 + ); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "singleton"), - - strcmp("$(test.ary[2][0])", "1"), - strcmp("$(test.ary[2][1])", "2"), - strcmp("$(test.ary[2][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "singleton"), + strcmp("$(test.ary[2][0])", "1"), + strcmp("$(test.ary[2][1])", "2"), + strcmp("$(test.ary[2][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[1][1]"), - isvariable("test.ary[2][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[1][1]"), + isvariable("test.ary[2][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = 'singleton', saw '$(test.ary[1][0])'"; - "expected test.ary[2][0] = '1', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = '2', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = '3', saw '$(test.ary[2][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/442.cf b/tests/acceptance/01_vars/02_functions/442.cf index 10f1111e6b..284a6f7357 100644 --- a/tests/acceptance/01_vars/02_functions/442.cf +++ b/tests/acceptance/01_vars/02_functions/442.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,85 +27,78 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 this:is:a:test this:too 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarrayidx("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "4"; + "cnt" + int => readstringarrayidx( + "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 + ); + + "num" int => "4"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "this"), - strcmp("$(test.ary[1][1])", "is"), - strcmp("$(test.ary[1][2])", "a"), - strcmp("$(test.ary[1][3])", "test"), - - strcmp("$(test.ary[2][0])", "this"), - strcmp("$(test.ary[2][1])", "too"), - - strcmp("$(test.ary[3][0])", "1"), - strcmp("$(test.ary[3][1])", "2"), - strcmp("$(test.ary[3][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "this"), + strcmp("$(test.ary[1][1])", "is"), + strcmp("$(test.ary[1][2])", "a"), + strcmp("$(test.ary[1][3])", "test"), + strcmp("$(test.ary[2][0])", "this"), + strcmp("$(test.ary[2][1])", "too"), + strcmp("$(test.ary[3][0])", "1"), + strcmp("$(test.ary[3][1])", "2"), + strcmp("$(test.ary[3][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[1][4]"), - isvariable("test.ary[2][2]"), - isvariable("test.ary[3][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[1][4]"), + isvariable("test.ary[2][2]"), + isvariable("test.ary[3][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = 'this', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = 'is', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = 'a', saw '$(test.ary[1][2])'"; "expected test.ary[1][3] = 'test', saw '$(test.ary[1][3])'"; - "expected test.ary[2][0] = 'this', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = 'too', saw '$(test.ary[2][1])'"; - "expected test.ary[3][0] = '1', saw '$(test.ary[3][0])'"; "expected test.ary[3][1] = '2', saw '$(test.ary[3][1])'"; "expected test.ary[3][2] = '3', saw '$(test.ary[3][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/443.cf b/tests/acceptance/01_vars/02_functions/443.cf index 9af6c1b974..5663b905fb 100644 --- a/tests/acceptance/01_vars/02_functions/443.cf +++ b/tests/acceptance/01_vars/02_functions/443.cf @@ -7,29 +7,26 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "testfile" string => "/tmp/TEST.cfengine"; + "testfile" string => "/tmp/TEST.cfengine"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -37,81 +34,75 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 # Not parsed as a comment this:is:a:test 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarrayidx("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "4"; + "cnt" + int => readstringarrayidx( + "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 + ); + + "num" int => "4"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "# Not parsed as a comment"), - - strcmp("$(test.ary[2][0])", "this"), - strcmp("$(test.ary[2][1])", "is"), - strcmp("$(test.ary[2][2])", "a"), - strcmp("$(test.ary[2][3])", "test"), - - strcmp("$(test.ary[3][0])", "1"), - strcmp("$(test.ary[3][1])", "2"), - strcmp("$(test.ary[3][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "# Not parsed as a comment"), + strcmp("$(test.ary[2][0])", "this"), + strcmp("$(test.ary[2][1])", "is"), + strcmp("$(test.ary[2][2])", "a"), + strcmp("$(test.ary[2][3])", "test"), + strcmp("$(test.ary[3][0])", "1"), + strcmp("$(test.ary[3][1])", "2"), + strcmp("$(test.ary[3][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[1][1]"), - isvariable("test.ary[2][4]"), - isvariable("test.ary[3][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[1][1]"), + isvariable("test.ary[2][4]"), + isvariable("test.ary[3][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'is', saw '$(test.ary[this][1])'"; "expected test.ary[this][2] = 'a', saw '$(test.ary[this][2])'"; "expected test.ary[this][3] = 'test', saw '$(test.ary[this][3])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/444.cf b/tests/acceptance/01_vars/02_functions/444.cf index ea4303032a..5e384aabbd 100644 --- a/tests/acceptance/01_vars/02_functions/444.cf +++ b/tests/acceptance/01_vars/02_functions/444.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,93 +36,81 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarrayidx("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "9"; + "cnt" + int => readstringarrayidx( + "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 + ); + + "num" int => "9"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[2][0])", "here is"), - strcmp("$(test.ary[2][1])", "a line"), - strcmp("$(test.ary[2][2])", " with spaces "), - strcmp("$(test.ary[2][3])", " in it"), - - strcmp("$(test.ary[3][0])", "blank"), - strcmp("$(test.ary[3][1])", "fields"), - strcmp("$(test.ary[3][2])", ""), - strcmp("$(test.ary[3][3])", ""), - strcmp("$(test.ary[3][4])", "in here"), - strcmp("$(test.ary[3][5])", ""), - strcmp("$(test.ary[3][6])", ""), - - strcmp("$(test.ary[4][0])", ""), - strcmp("$(test.ary[4][1])", "leading blank field"), - - strcmp("$(test.ary[5][0])", "this"), - strcmp("$(test.ary[5][1])", "is"), - strcmp("$(test.ary[5][2])", "a"), - strcmp("$(test.ary[5][3])", "test"), - - strcmp("$(test.ary[6][0])", "# A duplicate follows"), - strcmp("$(test.ary[6][1])", " this line is not always a comment"), - - strcmp("$(test.ary[7][0])", "this"), - strcmp("$(test.ary[7][1])", "also"), - - strcmp("$(test.ary[8][0])", "last"), - strcmp("$(test.ary[8][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[2][0])", "here is"), + strcmp("$(test.ary[2][1])", "a line"), + strcmp("$(test.ary[2][2])", " with spaces "), + strcmp("$(test.ary[2][3])", " in it"), + strcmp("$(test.ary[3][0])", "blank"), + strcmp("$(test.ary[3][1])", "fields"), + strcmp("$(test.ary[3][2])", ""), + strcmp("$(test.ary[3][3])", ""), + strcmp("$(test.ary[3][4])", "in here"), + strcmp("$(test.ary[3][5])", ""), + strcmp("$(test.ary[3][6])", ""), + strcmp("$(test.ary[4][0])", ""), + strcmp("$(test.ary[4][1])", "leading blank field"), + strcmp("$(test.ary[5][0])", "this"), + strcmp("$(test.ary[5][1])", "is"), + strcmp("$(test.ary[5][2])", "a"), + strcmp("$(test.ary[5][3])", "test"), + strcmp("$(test.ary[6][0])", "# A duplicate follows"), + strcmp("$(test.ary[6][1])", " this line is not always a comment"), + strcmp("$(test.ary[7][0])", "this"), + strcmp("$(test.ary[7][1])", "also"), + strcmp("$(test.ary[8][0])", "last"), + strcmp("$(test.ary[8][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[2][0] = 'here is', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = 'a line', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = ' with spaces ', saw '$(test.ary[2][2])'"; "expected test.ary[2][3] = ' in it', saw '$(test.ary[2][3])'"; - "expected test.ary[3][0] = 'blank', saw '$(test.ary[3][0])'"; "expected test.ary[3][1] = 'fields', saw '$(test.ary[3][1])'"; "expected test.ary[3][2] = '', saw '$(test.ary[3][2])'"; @@ -133,21 +118,16 @@ bundle agent check "expected test.ary[3][4] = 'in here', saw '$(test.ary[3][4])'"; "expected test.ary[3][5] = '', saw '$(test.ary[3][5])'"; "expected test.ary[3][6] = '', saw '$(test.ary[3][6])'"; - "expected test.ary[4][0] = '', saw '$(test.ary[4][0])'"; "expected test.ary[4][1] = 'leading blank field', saw '$(test.ary[4][1])'"; - "expected test.ary[5][0] = 'this', saw '$(test.ary[5][0])'"; "expected test.ary[5][1] = 'is', saw '$(test.ary[5][1])'"; "expected test.ary[5][2] = 'a', saw '$(test.ary[5][2])'"; "expected test.ary[5][3] = 'test', saw '$(test.ary[5][3])'"; - "expected test.ary[6][0] = '# A duplicate follows', saw '$(test.ary[6][0])'"; "expected test.ary[6][1] = ' this line is not always a comment', saw '$(test.ary[6][1])'"; - "expected test.ary[7][0] = 'this', saw '$(test.ary[7][0])'"; "expected test.ary[7][1] = 'also', saw '$(test.ary[7][1])'"; - "expected test.ary[8][0] = 'last', saw '$(test.ary[8][0])'"; "expected test.ary[8][1] = 'one', saw '$(test.ary[8][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/445.cf b/tests/acceptance/01_vars/02_functions/445.cf index 00f14f1938..82be099cc0 100644 --- a/tests/acceptance/01_vars/02_functions/445.cf +++ b/tests/acceptance/01_vars/02_functions/445.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -42,93 +39,81 @@ last:one "; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarrayidx("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "9"; + "cnt" + int => readstringarrayidx( + "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 + ); + + "num" int => "9"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[2][0])", "here is"), - strcmp("$(test.ary[2][1])", "a line"), - strcmp("$(test.ary[2][2])", " with spaces "), - strcmp("$(test.ary[2][3])", " in it"), - - strcmp("$(test.ary[3][0])", "blank"), - strcmp("$(test.ary[3][1])", "fields"), - strcmp("$(test.ary[3][2])", ""), - strcmp("$(test.ary[3][3])", ""), - strcmp("$(test.ary[3][4])", "in here"), - strcmp("$(test.ary[3][5])", ""), - strcmp("$(test.ary[3][6])", ""), - - strcmp("$(test.ary[4][0])", ""), - strcmp("$(test.ary[4][1])", "leading blank field"), - - strcmp("$(test.ary[5][0])", "this"), - strcmp("$(test.ary[5][1])", "is"), - strcmp("$(test.ary[5][2])", "a"), - strcmp("$(test.ary[5][3])", "test"), - - strcmp("$(test.ary[6][0])", "# A duplicate follows"), - strcmp("$(test.ary[6][1])", " this line is not always a comment"), - - strcmp("$(test.ary[7][0])", "this"), - strcmp("$(test.ary[7][1])", "also"), - - strcmp("$(test.ary[8][0])", "last"), - strcmp("$(test.ary[8][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[2][0])", "here is"), + strcmp("$(test.ary[2][1])", "a line"), + strcmp("$(test.ary[2][2])", " with spaces "), + strcmp("$(test.ary[2][3])", " in it"), + strcmp("$(test.ary[3][0])", "blank"), + strcmp("$(test.ary[3][1])", "fields"), + strcmp("$(test.ary[3][2])", ""), + strcmp("$(test.ary[3][3])", ""), + strcmp("$(test.ary[3][4])", "in here"), + strcmp("$(test.ary[3][5])", ""), + strcmp("$(test.ary[3][6])", ""), + strcmp("$(test.ary[4][0])", ""), + strcmp("$(test.ary[4][1])", "leading blank field"), + strcmp("$(test.ary[5][0])", "this"), + strcmp("$(test.ary[5][1])", "is"), + strcmp("$(test.ary[5][2])", "a"), + strcmp("$(test.ary[5][3])", "test"), + strcmp("$(test.ary[6][0])", "# A duplicate follows"), + strcmp("$(test.ary[6][1])", " this line is not always a comment"), + strcmp("$(test.ary[7][0])", "this"), + strcmp("$(test.ary[7][1])", "also"), + strcmp("$(test.ary[8][0])", "last"), + strcmp("$(test.ary[8][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[2][0] = 'here is', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = 'a line', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = ' with spaces ', saw '$(test.ary[2][2])'"; "expected test.ary[2][3] = ' in it', saw '$(test.ary[2][3])'"; - "expected test.ary[3][0] = 'blank', saw '$(test.ary[3][0])'"; "expected test.ary[3][1] = 'fields', saw '$(test.ary[3][1])'"; "expected test.ary[3][2] = '', saw '$(test.ary[3][2])'"; @@ -136,21 +121,16 @@ bundle agent check "expected test.ary[3][4] = 'in here', saw '$(test.ary[3][4])'"; "expected test.ary[3][5] = '', saw '$(test.ary[3][5])'"; "expected test.ary[3][6] = '', saw '$(test.ary[3][6])'"; - "expected test.ary[4][0] = '', saw '$(test.ary[4][0])'"; "expected test.ary[4][1] = 'leading blank field', saw '$(test.ary[4][1])'"; - "expected test.ary[5][0] = 'this', saw '$(test.ary[5][0])'"; "expected test.ary[5][1] = 'is', saw '$(test.ary[5][1])'"; "expected test.ary[5][2] = 'a', saw '$(test.ary[5][2])'"; "expected test.ary[5][3] = 'test', saw '$(test.ary[5][3])'"; - "expected test.ary[6][0] = '# A duplicate follows', saw '$(test.ary[6][0])'"; "expected test.ary[6][1] = ' this line is not always a comment', saw '$(test.ary[6][1])'"; - "expected test.ary[7][0] = 'this', saw '$(test.ary[7][0])'"; "expected test.ary[7][1] = 'also', saw '$(test.ary[7][1])'"; - "expected test.ary[8][0] = 'last', saw '$(test.ary[8][0])'"; "expected test.ary[8][1] = 'one', saw '$(test.ary[8][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/447.cf b/tests/acceptance/01_vars/02_functions/447.cf index 9a4e80719b..517919c791 100644 --- a/tests/acceptance/01_vars/02_functions/447.cf +++ b/tests/acceptance/01_vars/02_functions/447.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,93 +36,77 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarrayidx("ary", "$(G.testfile)","",":",10,1000); - "num" int => "9"; + "cnt" int => readstringarrayidx("ary", "$(G.testfile)", "", ":", 10, 1000); + "num" int => "9"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[2][0])", "here is"), - strcmp("$(test.ary[2][1])", "a line"), - strcmp("$(test.ary[2][2])", " with spaces "), - strcmp("$(test.ary[2][3])", " in it"), - - strcmp("$(test.ary[3][0])", "blank"), - strcmp("$(test.ary[3][1])", "fields"), - strcmp("$(test.ary[3][2])", ""), - strcmp("$(test.ary[3][3])", ""), - strcmp("$(test.ary[3][4])", "in here"), - strcmp("$(test.ary[3][5])", ""), - strcmp("$(test.ary[3][6])", ""), - - strcmp("$(test.ary[4][0])", ""), - strcmp("$(test.ary[4][1])", "leading blank field"), - - strcmp("$(test.ary[5][0])", "this"), - strcmp("$(test.ary[5][1])", "is"), - strcmp("$(test.ary[5][2])", "a"), - strcmp("$(test.ary[5][3])", "test"), - - strcmp("$(test.ary[6][0])", "# A duplicate follows"), - strcmp("$(test.ary[6][1])", " this line is not always a comment"), - - strcmp("$(test.ary[7][0])", "this"), - strcmp("$(test.ary[7][1])", "also"), - - strcmp("$(test.ary[8][0])", "last"), - strcmp("$(test.ary[8][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[2][0])", "here is"), + strcmp("$(test.ary[2][1])", "a line"), + strcmp("$(test.ary[2][2])", " with spaces "), + strcmp("$(test.ary[2][3])", " in it"), + strcmp("$(test.ary[3][0])", "blank"), + strcmp("$(test.ary[3][1])", "fields"), + strcmp("$(test.ary[3][2])", ""), + strcmp("$(test.ary[3][3])", ""), + strcmp("$(test.ary[3][4])", "in here"), + strcmp("$(test.ary[3][5])", ""), + strcmp("$(test.ary[3][6])", ""), + strcmp("$(test.ary[4][0])", ""), + strcmp("$(test.ary[4][1])", "leading blank field"), + strcmp("$(test.ary[5][0])", "this"), + strcmp("$(test.ary[5][1])", "is"), + strcmp("$(test.ary[5][2])", "a"), + strcmp("$(test.ary[5][3])", "test"), + strcmp("$(test.ary[6][0])", "# A duplicate follows"), + strcmp("$(test.ary[6][1])", " this line is not always a comment"), + strcmp("$(test.ary[7][0])", "this"), + strcmp("$(test.ary[7][1])", "also"), + strcmp("$(test.ary[8][0])", "last"), + strcmp("$(test.ary[8][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[2][0] = 'here is', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = 'a line', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = ' with spaces ', saw '$(test.ary[2][2])'"; "expected test.ary[2][3] = ' in it', saw '$(test.ary[2][3])'"; - "expected test.ary[3][0] = 'blank', saw '$(test.ary[3][0])'"; "expected test.ary[3][1] = 'fields', saw '$(test.ary[3][1])'"; "expected test.ary[3][2] = '', saw '$(test.ary[3][2])'"; @@ -133,21 +114,16 @@ bundle agent check "expected test.ary[3][4] = 'in here', saw '$(test.ary[3][4])'"; "expected test.ary[3][5] = '', saw '$(test.ary[3][5])'"; "expected test.ary[3][6] = '', saw '$(test.ary[3][6])'"; - "expected test.ary[4][0] = '', saw '$(test.ary[4][0])'"; "expected test.ary[4][1] = 'leading blank field', saw '$(test.ary[4][1])'"; - "expected test.ary[5][0] = 'this', saw '$(test.ary[5][0])'"; "expected test.ary[5][1] = 'is', saw '$(test.ary[5][1])'"; "expected test.ary[5][2] = 'a', saw '$(test.ary[5][2])'"; "expected test.ary[5][3] = 'test', saw '$(test.ary[5][3])'"; - "expected test.ary[6][0] = '# A duplicate follows', saw '$(test.ary[6][0])'"; "expected test.ary[6][1] = ' this line is not always a comment', saw '$(test.ary[6][1])'"; - "expected test.ary[7][0] = 'this', saw '$(test.ary[7][0])'"; "expected test.ary[7][1] = 'also', saw '$(test.ary[7][1])'"; - "expected test.ary[8][0] = 'last', saw '$(test.ary[8][0])'"; "expected test.ary[8][1] = 'one', saw '$(test.ary[8][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/450.cf b/tests/acceptance/01_vars/02_functions/450.cf index f8f1009b19..c850c569da 100644 --- a/tests/acceptance/01_vars/02_functions/450.cf +++ b/tests/acceptance/01_vars/02_functions/450.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,69 +36,57 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarrayidx("ary", "$(G.testfile)","^#.*",":+",10,14); - "num" int => "3"; + "cnt" + int => readstringarrayidx("ary", "$(G.testfile)", "^#.*", ":+", 10, 14); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "bad" or => { - isvariable("test.ary[2][1]"), - isvariable("test.ary[3][0]"), - }; - - "ok" and => { - "!bad", - - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[2][0])", "he"), + "bad" or => { isvariable("test.ary[2][1]"), isvariable("test.ary[3][0]") }; + + "ok" + and => { + "!bad", + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[2][0])", "he"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "saw 'bad'-class things"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[2][0] = 'he', saw '$(test.ary[2][0])'"; ok:: diff --git a/tests/acceptance/01_vars/02_functions/500.cf b/tests/acceptance/01_vars/02_functions/500.cf index 97fab50c76..205241c308 100644 --- a/tests/acceptance/01_vars/02_functions/500.cf +++ b/tests/acceptance/01_vars/02_functions/500.cf @@ -6,21 +6,19 @@ # 500-519 are readintarray, 520-539 test the same things for parseintarray # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -28,77 +26,70 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 999:888:777:666 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readintarray("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "3"; + "cnt" + int => readintarray("ary", "$(G.testfile)", "NoComment", ":", 10, 1000); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[999][0])", "999"), - strcmp("$(test.ary[999][1])", "888"), - strcmp("$(test.ary[999][2])", "777"), - strcmp("$(test.ary[999][3])", "666"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[999][0])", "999"), + strcmp("$(test.ary[999][1])", "888"), + strcmp("$(test.ary[999][2])", "777"), + strcmp("$(test.ary[999][3])", "666"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[999][4]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[999][4]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[999][0] = '999', saw '$(test.ary[999][0])'"; "expected test.ary[999][1] = '888', saw '$(test.ary[999][1])'"; "expected test.ary[999][2] = '777', saw '$(test.ary[999][2])'"; "expected test.ary[999][3] = '666', saw '$(test.ary[999][3])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/501.cf b/tests/acceptance/01_vars/02_functions/501.cf index 91d0c2e9b7..7c3c982d76 100644 --- a/tests/acceptance/01_vars/02_functions/501.cf +++ b/tests/acceptance/01_vars/02_functions/501.cf @@ -6,21 +6,19 @@ # 500-519 are readintarray, 520-539 test the same things for parseintarray # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -28,71 +26,64 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 12345 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readintarray("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "3"; + "cnt" + int => readintarray("ary", "$(G.testfile)", "NoComment", ":", 10, 1000); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[12345][0])", "12345"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[12345][0])", "12345"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[12345][1]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[12345][1]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[12345][0] = '12345', saw '$(test.ary[12345][0])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/520.cf b/tests/acceptance/01_vars/02_functions/520.cf index dee54e7dfd..b54fc40213 100644 --- a/tests/acceptance/01_vars/02_functions/520.cf +++ b/tests/acceptance/01_vars/02_functions/520.cf @@ -6,21 +6,19 @@ # 500-519 are readintarray, 520-539 test the same things for parseintarray # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -28,78 +26,69 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 999:888:777:666 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parseintarray("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "3"; + "teststr" string => readfile("$(G.testfile)", 1000); + "cnt" int => parseintarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[999][0])", "999"), - strcmp("$(test.ary[999][1])", "888"), - strcmp("$(test.ary[999][2])", "777"), - strcmp("$(test.ary[999][3])", "666"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[999][0])", "999"), + strcmp("$(test.ary[999][1])", "888"), + strcmp("$(test.ary[999][2])", "777"), + strcmp("$(test.ary[999][3])", "666"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[999][4]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[999][4]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[999][0] = '999', saw '$(test.ary[999][0])'"; "expected test.ary[999][1] = '888', saw '$(test.ary[999][1])'"; "expected test.ary[999][2] = '777', saw '$(test.ary[999][2])'"; "expected test.ary[999][3] = '999', saw '$(test.ary[999][3])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/521.cf b/tests/acceptance/01_vars/02_functions/521.cf index db76ae4668..12424b904f 100644 --- a/tests/acceptance/01_vars/02_functions/521.cf +++ b/tests/acceptance/01_vars/02_functions/521.cf @@ -6,21 +6,19 @@ # 500-519 are readintarray, 520-539 test the same things for parseintarray # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -28,72 +26,63 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 12345 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parseintarray("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "3"; + "teststr" string => readfile("$(G.testfile)", 1000); + "cnt" int => parseintarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[12345][0])", "12345"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[12345][0])", "12345"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[12345][1]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[12345][1]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[12345][0] = '12345', saw '$(test.ary[12345][0])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/600.cf b/tests/acceptance/01_vars/02_functions/600.cf index 4dec9ec3f2..fb48a43369 100644 --- a/tests/acceptance/01_vars/02_functions/600.cf +++ b/tests/acceptance/01_vars/02_functions/600.cf @@ -6,21 +6,19 @@ # 500-519 are readrealarray, 520-539 test the same things for parseintarray # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -28,77 +26,70 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 999.9:888:777:666.6 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readrealarray("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "3"; + "cnt" + int => readrealarray("ary", "$(G.testfile)", "NoComment", ":", 10, 1000); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[999.9][0])", "999.9"), - strcmp("$(test.ary[999.9][1])", "888"), - strcmp("$(test.ary[999.9][2])", "777"), - strcmp("$(test.ary[999.9][3])", "666.6"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[999.9][0])", "999.9"), + strcmp("$(test.ary[999.9][1])", "888"), + strcmp("$(test.ary[999.9][2])", "777"), + strcmp("$(test.ary[999.9][3])", "666.6"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[999.9][4]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[999.9][4]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[999.9][0] = '999.9', saw '$(test.ary[999.9][0])'"; "expected test.ary[999.9][1] = '888', saw '$(test.ary[999.9][1])'"; "expected test.ary[999.9][2] = '777', saw '$(test.ary[999.9][2])'"; "expected test.ary[999.9][3] = '666.6', saw '$(test.ary[999.9][3])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/601.cf b/tests/acceptance/01_vars/02_functions/601.cf index 9118ac0798..e19a254a1b 100644 --- a/tests/acceptance/01_vars/02_functions/601.cf +++ b/tests/acceptance/01_vars/02_functions/601.cf @@ -6,21 +6,19 @@ # 500-519 are readrealarray, 520-539 test the same things for parseintarray # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -28,71 +26,64 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 12345 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readrealarray("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "3"; + "cnt" + int => readrealarray("ary", "$(G.testfile)", "NoComment", ":", 10, 1000); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[12345][0])", "12345"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[12345][0])", "12345"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[12345][1]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[12345][1]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[12345][0] = '12345', saw '$(test.ary[12345][0])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/620.cf b/tests/acceptance/01_vars/02_functions/620.cf index ccf848618c..8ce3531136 100644 --- a/tests/acceptance/01_vars/02_functions/620.cf +++ b/tests/acceptance/01_vars/02_functions/620.cf @@ -6,21 +6,19 @@ # 500-519 are readrealarray, 520-539 test the same things for parseintarray # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -28,78 +26,72 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 999.9:888:777:666.6 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parserealarray("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "3"; + "teststr" string => readfile("$(G.testfile)", 1000); + + "cnt" + int => parserealarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[999.9][0])", "999.9"), - strcmp("$(test.ary[999.9][1])", "888"), - strcmp("$(test.ary[999.9][2])", "777"), - strcmp("$(test.ary[999.9][3])", "666.6"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[999.9][0])", "999.9"), + strcmp("$(test.ary[999.9][1])", "888"), + strcmp("$(test.ary[999.9][2])", "777"), + strcmp("$(test.ary[999.9][3])", "666.6"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[999.9][4]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[999.9][4]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[999.9][0] = '999.9', saw '$(test.ary[999.9][0])'"; "expected test.ary[999.9][1] = '888', saw '$(test.ary[999.9][1])'"; "expected test.ary[999.9][2] = '777', saw '$(test.ary[999.9][2])'"; "expected test.ary[999.9][3] = '999.9', saw '$(test.ary[999.9][3])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/621.cf b/tests/acceptance/01_vars/02_functions/621.cf index 61540e5e7d..59d8b7eb46 100644 --- a/tests/acceptance/01_vars/02_functions/621.cf +++ b/tests/acceptance/01_vars/02_functions/621.cf @@ -6,21 +6,19 @@ # 500-519 are readrealarray, 520-539 test the same things for parseintarray # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -28,72 +26,66 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 12345 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parserealarray("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "3"; + "teststr" string => readfile("$(G.testfile)", 1000); + + "cnt" + int => parserealarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[12345][0])", "12345"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[12345][0])", "12345"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[12345][1]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[12345][1]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[12345][0] = '12345', saw '$(test.ary[12345][0])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/700.cf b/tests/acceptance/01_vars/02_functions/700.cf index 14fd81ad22..ab250dcc73 100644 --- a/tests/acceptance/01_vars/02_functions/700.cf +++ b/tests/acceptance/01_vars/02_functions/700.cf @@ -1,41 +1,44 @@ # Test that long bundle names are not cut off (Mantis #975) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent long_long_long_long_long_long_long_long_long_name { vars: - "foo[ok]" string => "abc"; - "bar" slist => getindices("foo"); + "foo[ok]" string => "abc"; + "bar" slist => getindices("foo"); } bundle agent test { methods: - "l" usebundle => "long_long_long_long_long_long_long_long_long_name"; + "l" usebundle => "long_long_long_long_long_long_long_long_long_name"; } bundle agent check { vars: - "res" string => join("", "long_long_long_long_long_long_long_long_long_name.bar"); + "res" + string => join( + "", "long_long_long_long_long_long_long_long_long_name.bar" + ); classes: - "ok" expression => strcmp("${res}", "ok"); + "ok" expression => strcmp("${res}", "ok"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/701.cf b/tests/acceptance/01_vars/02_functions/701.cf index 8817a1cab8..e50e42b5e6 100644 --- a/tests/acceptance/01_vars/02_functions/701.cf +++ b/tests/acceptance/01_vars/02_functions/701.cf @@ -1,34 +1,36 @@ # Test that countclassesmatching works correctly (Mantis #975) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle common init { classes: - "test_fbeae67f3e347b5e0032302200141131" expression => "any"; - "test_fbeae67f3e347b5e0032302200141131_1" expression => "any"; + "test_fbeae67f3e347b5e0032302200141131" expression => "any"; + "test_fbeae67f3e347b5e0032302200141131_1" expression => "any"; } bundle agent test { vars: - "num" int => countclassesmatching("test_fbeae67f3e347b5e0032302200141131.*"); + "num" + int => countclassesmatching("test_fbeae67f3e347b5e0032302200141131.*"); } bundle agent check { classes: - "ok" expression => strcmp("$(test.num)", "2"); + "ok" expression => strcmp("$(test.num)", "2"); reports: DEBUG:: "$(test.num)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/702.cf b/tests/acceptance/01_vars/02_functions/702.cf index 2838167835..c1ccc3de3a 100644 --- a/tests/acceptance/01_vars/02_functions/702.cf +++ b/tests/acceptance/01_vars/02_functions/702.cf @@ -1,29 +1,31 @@ # Test maplist expansion with ${this} syntax (Mantis #1249) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle common init { vars: - "s" slist => { "suffix" }; + "s" slist => { "suffix" }; } bundle agent test { vars: - "list1" slist => maplist("prefix${this}", "init.s"); - "list2" slist => maplist("prefix$(this)", "init.s"); + "list1" slist => maplist("prefix${this}", "init.s"); + "list2" slist => maplist("prefix$(this)", "init.s"); } bundle agent check { classes: - "ok" and => { reglist("@(test.list1)", "prefixsuffix"), - reglist("@(test.list2)", "prefixsuffix") }; + "ok" + and => { + reglist("@(test.list1)", "prefixsuffix"), + reglist("@(test.list2)", "prefixsuffix"), + }; reports: DEBUG:: @@ -32,6 +34,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/CFE-2704-0.cf b/tests/acceptance/01_vars/02_functions/CFE-2704-0.cf index 14b8c34050..27b521a02b 100644 --- a/tests/acceptance/01_vars/02_functions/CFE-2704-0.cf +++ b/tests/acceptance/01_vars/02_functions/CFE-2704-0.cf @@ -1,7 +1,7 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent test @@ -14,9 +14,10 @@ bundle agent test "data" data => "{\"env\":\"test\"}"; "node" data => mergedata("[]", "data[env]"); } + bundle agent check { methods: "Pass if we made it this far" - usebundle => dcs_pass( $(this.promise_filename) ); + usebundle => dcs_pass($(this.promise_filename)); } diff --git a/tests/acceptance/01_vars/02_functions/CFE-2704-1.cf b/tests/acceptance/01_vars/02_functions/CFE-2704-1.cf index 5e13a410f6..a475b51d68 100644 --- a/tests/acceptance/01_vars/02_functions/CFE-2704-1.cf +++ b/tests/acceptance/01_vars/02_functions/CFE-2704-1.cf @@ -1,7 +1,7 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent test @@ -14,9 +14,10 @@ bundle agent test "data" data => '{"env":"test"}'; "node" data => mergedata("[]", "data[env]"); } + bundle agent check { methods: "Pass if we made it this far" - usebundle => dcs_pass( $(this.promise_filename) ); + usebundle => dcs_pass($(this.promise_filename)); } diff --git a/tests/acceptance/01_vars/02_functions/CFE-954.cf b/tests/acceptance/01_vars/02_functions/CFE-954.cf index 2d09f5b117..77efed6ea9 100644 --- a/tests/acceptance/01_vars/02_functions/CFE-954.cf +++ b/tests/acceptance/01_vars/02_functions/CFE-954.cf @@ -1,21 +1,17 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } + bundle agent init { files: - - "$(G.testdir)/prod/." - create => "true"; - - "$(G.testdir)/test/." - create => "true"; - - "$(G.testdir)/test/FR1234.gz" - create => "true"; + "$(G.testdir)/prod/." create => "true"; + "$(G.testdir)/test/." create => "true"; + "$(G.testdir)/test/FR1234.gz" create => "true"; } + bundle agent test { meta: @@ -23,41 +19,40 @@ bundle agent test string => "Test that using lsdir on a list where nothing matches does not mess up later iterations"; vars: - - "directories" slist => {"prod","test"}; + "directories" slist => { "prod", "test" }; "files_regex_1_$(directories)" - slist => lsdir( "$(G.testdir)/$(directories)", ".*", "false"), - if => isdir( "$(G.testdir)/$(directories)" ); # Suppress errors about missing directory during pre-eval + slist => lsdir("$(G.testdir)/$(directories)", ".*", "false"), + if => isdir("$(G.testdir)/$(directories)"); + # Suppress errors about missing directory during pre-eval # Expect files_regex_1_prod contains . and .. # Expect files_regex_1_test contains . .. and FR1234.gz - "files_regex_2_$(directories)" - slist => lsdir( "$(G.testdir)/$(directories)", "FR.*\.gz", "false"), - if => isdir( "$(G.testdir)/$(directories)" ); # Suppress errors about missing directory during pre-eval - # Expect files_regex_2_prod contains nothing - # Expect files_regex_2_test contains FR1234.gz + slist => lsdir("$(G.testdir)/$(directories)", "FR.*\.gz", "false"), + if => isdir("$(G.testdir)/$(directories)"); + # Suppress errors about missing directory during pre-eval + # Expect files_regex_2_prod contains nothing + # Expect files_regex_2_test contains FR1234.gz reports: - DEBUG|EXTRA:: - "files_regex_1_$(directories) is defined" - if => isvariable( "files_regex_1_$(directories)" ); + if => isvariable("files_regex_1_$(directories)"); + "files_regex_1_$(directories) is not defined" - unless => isvariable( "files_regex_1_$(directories)" ); + unless => isvariable("files_regex_1_$(directories)"); "files_regex_2_$(directories) is defined" - if => isvariable( "files_regex_2_$(directories)" ); + if => isvariable("files_regex_2_$(directories)"); + "files_regex_2_$(directories) is not defined" - unless => isvariable( "files_regex_2_$(directories)" ); + unless => isvariable("files_regex_2_$(directories)"); "Expect files_regex_1_prod contains . and .."; "files_regex_1_prod contains $(files_regex_1_prod)"; "Expect files_regex_1_test contains . .. and FR1234.gz"; "files_regex_1_test contains $(files_regex_1_test)"; - "Expect files_regex_2_prod contains nothing"; "Expect files_regex_2_test contains FR1234.gz"; "files_regex_2_$(directories) contains $(files_regex_2_$(directories))"; @@ -68,32 +63,46 @@ bundle agent check vars: "expect_files_regex_1_prod" slist => { ".", ".." }; "expect_files_regex_1_test" slist => { ".", "..", "FR1234.gz" }; - - "expect_files_regex_2_prod" slist => { }; + "expect_files_regex_2_prod" slist => {}; "expect_files_regex_2_test" slist => { "FR1234.gz" }; - "d_1_prod" slist => difference( "check.expect_files_regex_1_prod", "test.files_regex_1_prod" ); - "d_1_test" slist => difference( "check.expect_files_regex_1_test", "test.files_regex_1_test" ); + "d_1_prod" + slist => difference( + "check.expect_files_regex_1_prod", "test.files_regex_1_prod" + ); - "d_2_prod" slist => difference( "check.expect_files_regex_2_prod", "test.files_regex_2_prod" ); - "d_2_test" slist => difference( "check.expect_files_regex_2_test", "test.files_regex_2_test" ); + "d_1_test" + slist => difference( + "check.expect_files_regex_1_test", "test.files_regex_1_test" + ); + + "d_2_prod" + slist => difference( + "check.expect_files_regex_2_prod", "test.files_regex_2_prod" + ); + + "d_2_test" + slist => difference( + "check.expect_files_regex_2_test", "test.files_regex_2_test" + ); classes: - "pass" and => { - strcmp( "0", length( d_1_prod ) ), - strcmp( "0", length( d_1_test ) ), - strcmp( "0", length( d_2_prod ) ), - strcmp( "0", length( d_2_test ) ) - }; + "pass" + and => { + strcmp("0", length(d_1_prod)), + strcmp("0", length(d_1_test)), + strcmp("0", length(d_2_prod)), + strcmp("0", length(d_2_test)), + }; reports: - DEBUG|EXTRA:: "test.expect_files_regex_2_prod is NOT defined" - if => not(isvariable( "test.expect_files_regex_2_prod" )); + if => not(isvariable("test.expect_files_regex_2_prod")); "test.expect_files_regex_2_prod is defined" - if => isvariable( "test.expect_files_regex_2_prod" ); + if => isvariable("test.expect_files_regex_2_prod"); + "Difference regex 1 prod: $(d_1_prod)"; "Difference regex 1 test: $(d_1_test)"; "Difference regex 2 prod: $(d_2_prod)"; diff --git a/tests/acceptance/01_vars/02_functions/and.cf b/tests/acceptance/01_vars/02_functions/and.cf index 063633b15c..7ac34fba74 100644 --- a/tests/acceptance/01_vars/02_functions/and.cf +++ b/tests/acceptance/01_vars/02_functions/and.cf @@ -5,13 +5,12 @@ ##################################################### body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: @@ -19,18 +18,19 @@ bundle agent test string => "Test that and() behaves as expected"; vars: - "f" # false + "f" + # false string => "(cfengine.(!cfengine))"; - "T" # true, uppercase to be more different visually + + "T" + # true, uppercase to be more different visually string => "(cfengine|(!cfengine))"; - "f_name" - string => "f"; - "T_name" - string => "T"; - "f_name_name" - string => "f_name"; - "T_name_name" - string => "T_name"; + + "f_name" string => "f"; + "T_name" string => "T"; + "f_name_name" string => "f_name"; + "T_name_name" string => "T_name"; + "many_true" slist => { "any", @@ -39,7 +39,8 @@ bundle agent test "(any.cfengine)", concat(and()), concat(and(and())), - }; + }; + "many_false" slist => { "(!any)", @@ -49,11 +50,10 @@ bundle agent test concat(not("any")), concat(not(and())), }; - "many_both" - slist => { @(many_true), @(many_false) }; - classes: + "many_both" slist => { @(many_true), @(many_false) }; + classes: # All elements should be true, fail if one is false: "ok" scope => "namespace", @@ -61,15 +61,12 @@ bundle agent test # Sanity check: "any", "cfengine", - # and() with 0 arguments should default to true: and(), - # and() with 1 static string: and("any"), and("cfengine"), and("!(!cfengine)"), - # and() with 1 string with variable expansion(s): and("$(T)"), and("!$(f)"), @@ -81,7 +78,6 @@ bundle agent test and("!(!any)|$(f)"), and("$(T)|$(f)"), and("$(f)|$(T)"), - # and() with slist: # Careful, if there are expressions in list (using | operator) # they should be parenthesized for this to work: @@ -91,7 +87,6 @@ bundle agent test and(not(join(".", many_false))), and(not(join("|", many_false))), and(not(join(".", many_both))), - # and() with 1 function call as argument: and(and("any")), and(and("cfengine")), @@ -101,7 +96,6 @@ bundle agent test and(not(not("$(T)"))), and(strcmp("cfengine", "cfengine")), and(strcmp("any", not("$(f)"))), - # and() with 2 arguments: and("any", "cfengine"), and("!(!any)", "!(!cfengine)"), @@ -109,7 +103,6 @@ bundle agent test and("$(T)", "!$(f)"), and("$(T)", not("$(f)")), and(not("$(f)"), not("$(f)")), - # and() with 3+ arguments (strings): and("any", "any", "any"), and("any", "any", "any", "any"), @@ -119,17 +112,29 @@ bundle agent test and("$(T)", "$(T)", "$(T)", "$(T)"), and("$(T)", "$(T)", "$(T)", "$(T)", "$(T)"), and("$(T)", "$(T)", "$(T)", "$(T)", "$(T)", "$(T)"), - # and() with 3+ function calls: and(not("!any"), not("!any"), not("!any")), and(not("!any"), not("!any"), not("!any"), not("!any")), and(not("!any"), not("!any"), not("!any"), not("!any"), not("!any")), - and(not("!any"), not("!any"), not("!any"), not("!any"), not("!any"), not("!any")), + and( + not("!any"), + not("!any"), + not("!any"), + not("!any"), + not("!any"), + not("!any") + ), and(not("$(f)"), not("$(f)"), not("$(f)")), and(not("$(f)"), not("$(f)"), not("$(f)"), not("$(f)")), and(not("$(f)"), not("$(f)"), not("$(f)"), not("$(f)"), not("$(f)")), - and(not("$(f)"), not("$(f)"), not("$(f)"), not("$(f)"), not("$(f)"), not("$(f)")), - + and( + not("$(f)"), + not("$(f)"), + not("$(f)"), + not("$(f)"), + not("$(f)"), + not("$(f)") + ), # and() with deep nesting: and(and()), and(and(and())), @@ -138,7 +143,6 @@ bundle agent test and(and(and(and(and(and()))))), and(and(and(and(and(and("any")))))), and(and(and(and(and(and("any", "cfengine")))))), - # Double expansion: and("$($(T_name))"), and("$($(T_name))", "$($(T_name))"), @@ -146,15 +150,17 @@ bundle agent test and("!$($(f_name))", "!$($(f_name))"), and("!$($(f_name))", "!$($(f_name))", "!$($(f_name))"), and(not("$($(f_name))"), not("$($(f_name))")), - # Triple expansion: and("$($($(T_name_name)))"), and("$($($(T_name_name)))", "$($($(T_name_name)))"), - and("$($($(T_name_name)))", "$($($(T_name_name)))", "$($($(T_name_name)))"), + and( + "$($($(T_name_name)))", + "$($($(T_name_name)))", + "$($($(T_name_name)))" + ), and("!$($(f_name_name))", "!$($(f_name_name))"), and("!$($(f_name_name))", "!$($(f_name_name))", "!$($(f_name_name))"), and(not("$($(f_name_name))"), not("$($(f_name_name))")), - # and() should always return any or !any, # this is important for backwards compatibility: strcmp(and("any"), "any"), @@ -188,32 +194,26 @@ bundle agent test and("$(T)", "$(f)", "$(T)", "$(T)", "$(T)", "$(T)", "$(T)", "$(T)"), and("$(f)", "$(T)", "$(T)", "$(T)", "$(T)", "$(T)", "$(T)", "$(T)"), }; + # Should be skipped because of unresolved variable: - "fail_unresolved" - and => { - "any", - and("$(unresolved_var)"), - }; + "fail_unresolved" and => { "any", and("$(unresolved_var)") }; + # Check that it's really skipped because of unresolved, # and not that it accidentally becomes false: - "fail_not_of_unresolved" - and => { - "any", - and(not("$(unresolved_var)")), - }; + "fail_not_of_unresolved" and => { "any", and(not("$(unresolved_var)")) }; + "fail" scope => "namespace", expression => "fail_false|fail_unresolved|fail_not_of_unresolved"; } ####################################################### - bundle agent check { - reports: ok.(!fail):: "$(this.promise_filename) Pass"; + (!ok)|fail:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/array_subkey_collision.cf b/tests/acceptance/01_vars/02_functions/array_subkey_collision.cf index 6c713ff79e..e33c077dd3 100644 --- a/tests/acceptance/01_vars/02_functions/array_subkey_collision.cf +++ b/tests/acceptance/01_vars/02_functions/array_subkey_collision.cf @@ -1,43 +1,43 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "description" -> { "CFE-2536" } + "description" -> { "CFE-2536" } string => "Converting arrays with colliding definitions for subkeys should work, somehow."; vars: - "array[key1][subkey1]" string => "hey"; - "array[key1]" string => "hou"; - - "array_values" slist => getvalues("array"); - "array_values_str" string => format("%S", array_values); - - "array_data" data => mergedata(array); - "array_data_str" string => format("%S", array_data); + "array[key1][subkey1]" string => "hey"; + "array[key1]" string => "hou"; + "array_values" slist => getvalues("array"); + "array_values_str" string => format("%S", array_values); + "array_data" data => mergedata(array); + "array_data_str" string => format("%S", array_data); } bundle agent check { classes: - # the "more structured structure" should win when converting to JSON - "get_values_ok" expression => strcmp("$(test.array_values_str)", '{ "hey" }'); - "array_data_ok" expression => strcmp("$(test.array_data_str)", '{"key1":{"subkey1":"hey"}}'); + # the "more structured structure" should win when converting to JSON + "get_values_ok" + expression => strcmp("$(test.array_values_str)", '{ "hey" }'); - "ok" and => { "get_values_ok", "array_data_ok" }; + "array_data_ok" + expression => strcmp( + "$(test.array_data_str)", '{"key1":{"subkey1":"hey"}}' + ); + + "ok" and => { "get_values_ok", "array_data_ok" }; reports: "DEBUG":: - "array_values_str: $(test.array_values_str)" - if => "!get_values_ok"; - - "array_data_str: $(test.array_data_str)" - if => "!array_data_ok"; + "array_values_str: $(test.array_values_str)" if => "!get_values_ok"; + "array_data_str: $(test.array_data_str)" if => "!array_data_ok"; "ok":: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/basename_1.cf b/tests/acceptance/01_vars/02_functions/basename_1.cf index f637b3024f..de2927cef5 100644 --- a/tests/acceptance/01_vars/02_functions/basename_1.cf +++ b/tests/acceptance/01_vars/02_functions/basename_1.cf @@ -3,142 +3,115 @@ # Test basename() without suffix # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - # The tests starting with template will be tested with both types of - # directory separators on Windows. - - "template_input[root]" string => "/"; - "template_expected[root]" string => "/"; - - "template_input[simple]" string => "/foo/bar"; - "template_expected[simple]" string => "bar"; - - "template_input[slash]" string => "/foo/bar/"; - "template_expected[slash]" string => "bar"; - - "template_input[sub]" string => "/foo"; - "template_expected[sub]" string => "foo"; - - "template_input[subslash]" string => "/foo/"; - "template_expected[subslash]" string => "foo"; - - "template_input[dot]" string => "/foo/."; - "template_expected[dot]" string => "."; - - "template_input[dot_subslash]" string => "/foo/./"; - "template_expected[dot_subslash]" string => "."; - - "template_input[multi]" string => "/foo/bar/baz"; - "template_expected[multi]" string => "baz"; - - "template_input[multislash]" string => "/foo/bar/baz/"; - "template_expected[multislash]" string => "baz"; - - "template_input[more]" string => "/a/b/c/d/e/f/g/h/i"; - "template_expected[more]" string => "i"; - - "template_input[multislash]" string => "/a///b////c///"; - "template_expected[multislash]" string => "c"; - - # Note: no template, because backslashes will be interpreted as UNC path on Windows. - "input[multislash_start]" string => "//a///b////c///"; - "expected[multislash_start]" string => "c"; - - "template_input[rel_one]" string => "foo"; - "template_expected[rel_one]" string => "foo"; - - "template_input[rel_more]" string => "foo/bar"; - "template_expected[rel_more]" string => "bar"; - - "template_input[rel_one_subslash]" string => "foo/"; - "template_expected[rel_one_subslash]" string => "foo"; - - "template_input[rel_more_subslash]" string => "foo/bar/"; - "template_expected[rel_more_subslash]" string => "bar"; - - "template_input[rel_dot]" string => "foo/."; - "template_expected[rel_dot]" string => "."; - - "template_input[rel_only_dot]" string => "./"; - "template_expected[rel_only_dot]" string => "."; - - "template_input[rel_multislash]" string => "a///b////c///"; - "template_expected[rel_multislash]" string => "c"; - - "template_input[noop]" string => ""; - "template_expected[noop]" string => ""; - - "template_keys" slist => getindices("template_input"); + # The tests starting with template will be tested with both types of + # directory separators on Windows. + "template_input[root]" string => "/"; + "template_expected[root]" string => "/"; + "template_input[simple]" string => "/foo/bar"; + "template_expected[simple]" string => "bar"; + "template_input[slash]" string => "/foo/bar/"; + "template_expected[slash]" string => "bar"; + "template_input[sub]" string => "/foo"; + "template_expected[sub]" string => "foo"; + "template_input[subslash]" string => "/foo/"; + "template_expected[subslash]" string => "foo"; + "template_input[dot]" string => "/foo/."; + "template_expected[dot]" string => "."; + "template_input[dot_subslash]" string => "/foo/./"; + "template_expected[dot_subslash]" string => "."; + "template_input[multi]" string => "/foo/bar/baz"; + "template_expected[multi]" string => "baz"; + "template_input[multislash]" string => "/foo/bar/baz/"; + "template_expected[multislash]" string => "baz"; + "template_input[more]" string => "/a/b/c/d/e/f/g/h/i"; + "template_expected[more]" string => "i"; + "template_input[multislash]" string => "/a///b////c///"; + "template_expected[multislash]" string => "c"; + + # Note: no template, because backslashes will be interpreted as UNC path on Windows. + "input[multislash_start]" string => "//a///b////c///"; + "expected[multislash_start]" string => "c"; + "template_input[rel_one]" string => "foo"; + "template_expected[rel_one]" string => "foo"; + "template_input[rel_more]" string => "foo/bar"; + "template_expected[rel_more]" string => "bar"; + "template_input[rel_one_subslash]" string => "foo/"; + "template_expected[rel_one_subslash]" string => "foo"; + "template_input[rel_more_subslash]" string => "foo/bar/"; + "template_expected[rel_more_subslash]" string => "bar"; + "template_input[rel_dot]" string => "foo/."; + "template_expected[rel_dot]" string => "."; + "template_input[rel_only_dot]" string => "./"; + "template_expected[rel_only_dot]" string => "."; + "template_input[rel_multislash]" string => "a///b////c///"; + "template_expected[rel_multislash]" string => "c"; + "template_input[noop]" string => ""; + "template_expected[noop]" string => ""; + "template_keys" slist => getindices("template_input"); windows:: "template_input[full_root]" string => "C:/"; "template_expected[full_root]" string => "/"; - "template_input[full_root_file]" string => "C:/foo"; "template_expected[full_root_file]" string => "foo"; - "template_input[full_root_file_subslash]" string => "C:/foo/"; "template_expected[full_root_file_subslash]" string => "foo"; - "template_input[full_file]" string => "C:/foo/bar"; "template_expected[full_file]" string => "bar"; - "template_input[full_file_subslash]" string => "C:/foo/bar/"; "template_expected[full_file_subslash]" string => "bar"; - "template_input[dir]" string => "C:foo"; "template_expected[dir]" string => "foo"; - "template_input[two_dirs]" string => "C:foo/bar"; "template_expected[two_dirs]" string => "bar"; - "template_input[dir_subslash]" string => "C:foo/"; "template_expected[dir_subslash]" string => "foo"; - "template_input[two_dirs_subslash]" string => "C:foo/bar/"; "template_expected[two_dirs_subslash]" string => "bar"; # UNC paths don't have forward slash equivalents. "input[native_unc_one]" string => "\\\\foo"; "expected[native_unc_one]" string => "foo"; - "input[native_unc_two]" string => "\\\\foo\\bar"; "expected[native_unc_two]" string => "bar"; - "input[native_unc_three]" string => "\\\\foo\\bar\\charlie\\"; "expected[native_unc_three]" string => "charlie"; any:: - "input[native_$(template_keys)]" string => "$(template_input[$(template_keys)])"; - "expected[native_$(template_keys)]" string => "$(template_expected[$(template_keys)])"; + "input[native_$(template_keys)]" + string => "$(template_input[$(template_keys)])"; - "keys" slist => getindices("input"); + "expected[native_$(template_keys)]" + string => "$(template_expected[$(template_keys)])"; + "keys" slist => getindices("input"); "actual[$(keys)]" string => basename("$(input[$(keys)])"); } ####################################################### - bundle agent check { vars: - "keys" slist => { @(test.keys) }; + "keys" slist => { @(test.keys) }; classes: - "failed_cmp_$(keys)" not => strcmp(basename("$(test.input[$(keys)])"), "$(test.expected[$(keys)])"); - "ok" not => classmatch("failed_cmp_.*"); + "failed_cmp_$(keys)" + not => strcmp( + basename("$(test.input[$(keys)])"), "$(test.expected[$(keys)])" + ); + + "ok" not => classmatch("failed_cmp_.*"); reports: DEBUG:: @@ -147,6 +120,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/basename_2.cf b/tests/acceptance/01_vars/02_functions/basename_2.cf index 32d7d39b1c..c62e2927d1 100644 --- a/tests/acceptance/01_vars/02_functions/basename_2.cf +++ b/tests/acceptance/01_vars/02_functions/basename_2.cf @@ -3,68 +3,69 @@ # Test basename() with suffix removal # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - # The tests starting with template will be tested with both types of - # directory separators on Windows. - - "template_input[root]" string => "/"; - "template_suffix[root]" string => ""; - "template_expected[root]" string => "/"; - - "template_input[simple]" string => "/foo/bar.c"; - "template_suffix[simple]" string => ".c"; - "template_expected[simple]" string => "bar"; - - "template_input[rel_suffif]" string => "foo.xyz"; - "template_suffix[rel_suffif]" string => ".xyz"; - "template_expected[rel_suffif]" string => "foo"; - - "template_input[no_matching_suffix]" string => "/foo/bar"; - "template_suffix[no_matching_suffix]" string => "baz"; - "template_expected[no_matching_suffix]" string => "bar"; + # The tests starting with template will be tested with both types of + # directory separators on Windows. + "template_input[root]" string => "/"; + "template_suffix[root]" string => ""; + "template_expected[root]" string => "/"; + "template_input[simple]" string => "/foo/bar.c"; + "template_suffix[simple]" string => ".c"; + "template_expected[simple]" string => "bar"; + "template_input[rel_suffif]" string => "foo.xyz"; + "template_suffix[rel_suffif]" string => ".xyz"; + "template_expected[rel_suffif]" string => "foo"; + "template_input[no_matching_suffix]" string => "/foo/bar"; + "template_suffix[no_matching_suffix]" string => "baz"; + "template_expected[no_matching_suffix]" string => "bar"; + "template_input[same_suffix]" string => "foo"; + "template_suffix[same_suffix]" string => "foo"; + "template_expected[same_suffix]" string => "foo"; + "template_input[sub_same_suffix]" string => "foo/bar"; + "template_suffix[sub_same_suffix]" string => "bar"; + "template_expected[sub_same_suffix]" string => "bar"; + "template_keys" slist => getindices("template_input"); - "template_input[same_suffix]" string => "foo"; - "template_suffix[same_suffix]" string => "foo"; - "template_expected[same_suffix]" string => "foo"; - - "template_input[sub_same_suffix]" string => "foo/bar"; - "template_suffix[sub_same_suffix]" string => "bar"; - "template_expected[sub_same_suffix]" string => "bar"; + any:: + "input[native_$(template_keys)]" + string => "$(template_input[$(template_keys)])"; - "template_keys" slist => getindices("template_input"); + "expected[native_$(template_keys)]" + string => "$(template_expected[$(template_keys)])"; - any:: - "input[native_$(template_keys)]" string => "$(template_input[$(template_keys)])"; - "expected[native_$(template_keys)]" string => "$(template_expected[$(template_keys)])"; - "suffix[native_$(template_keys)]" string => "$(template_suffix[$(template_keys)])"; + "suffix[native_$(template_keys)]" + string => "$(template_suffix[$(template_keys)])"; "keys" slist => getindices("input"); - "actual[$(keys)]" string => basename("$(input[$(keys)])", "$(suffix[$suffix])"); + "actual[$(keys)]" + string => basename("$(input[$(keys)])", "$(suffix[$suffix])"); } ####################################################### - bundle agent check { vars: - "keys" slist => { @(test.keys) }; + "keys" slist => { @(test.keys) }; classes: - "failed_cmp_$(keys)" not => strcmp(basename("$(test.input[$(keys)])", "$(test.suffix[$(keys)])"), "$(test.expected[$(keys)])"); - "ok" not => classmatch("failed_cmp_.*"); + "failed_cmp_$(keys)" + not => strcmp( + basename("$(test.input[$(keys)])", "$(test.suffix[$(keys)])"), + "$(test.expected[$(keys)])" + ); + + "ok" not => classmatch("failed_cmp_.*"); reports: DEBUG:: @@ -73,6 +74,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/bundlesmatching.cf b/tests/acceptance/01_vars/02_functions/bundlesmatching.cf index 5bfe823ef9..8e5b4e7f97 100644 --- a/tests/acceptance/01_vars/02_functions/bundlesmatching.cf +++ b/tests/acceptance/01_vars/02_functions/bundlesmatching.cf @@ -1,9 +1,8 @@ # Test that bundlesmatching works correctly - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init @@ -13,34 +12,50 @@ bundle agent init bundle agent test { vars: - "bundle_runs" slist => bundlesmatching("default:bundle_run.*"); - "bundle_run_123s" slist => bundlesmatching("default:bundle_run_123.*"); - "bundle_123" string => nth(bundle_run_123s, 0); - - "bundle_run_meta_deprecated_unsorted" slist => bundlesmatching("default:bundle_run_meta.*", "deprecated"); - "bundle_run_meta_deprecated" slist => sort(bundle_run_meta_deprecated_unsorted, "lex"); - "bundle_deprecated" string => nth(bundle_run_meta_deprecated, 0); - - "bundle_run_meta_obsoleted_unsorted" slist => bundlesmatching("default:bundle_run_meta.*", "obs.*", "deprecated"); - "bundle_run_meta_obsoleted" slist => sort(bundle_run_meta_obsoleted_unsorted, "lex"); - "bundle_obsoleted" string => nth(bundle_run_meta_obsoleted, 0); - - "count" int => length(bundle_runs); - "123_count" int => length(bundle_run_123s); - "deprecated_count" int => length(bundle_run_meta_deprecated); - "obsoleted_count" int => length(bundle_run_meta_obsoleted); + "bundle_runs" slist => bundlesmatching("default:bundle_run.*"); + "bundle_run_123s" slist => bundlesmatching("default:bundle_run_123.*"); + "bundle_123" string => nth(bundle_run_123s, 0); + + "bundle_run_meta_deprecated_unsorted" + slist => bundlesmatching("default:bundle_run_meta.*", "deprecated"); + + "bundle_run_meta_deprecated" + slist => sort(bundle_run_meta_deprecated_unsorted, "lex"); + + "bundle_deprecated" string => nth(bundle_run_meta_deprecated, 0); + + "bundle_run_meta_obsoleted_unsorted" + slist => bundlesmatching( + "default:bundle_run_meta.*", "obs.*", "deprecated" + ); + + "bundle_run_meta_obsoleted" + slist => sort(bundle_run_meta_obsoleted_unsorted, "lex"); + + "bundle_obsoleted" string => nth(bundle_run_meta_obsoleted, 0); + "count" int => length(bundle_runs); + "123_count" int => length(bundle_run_123s); + "deprecated_count" int => length(bundle_run_meta_deprecated); + "obsoleted_count" int => length(bundle_run_meta_obsoleted); } bundle agent check { classes: - "ok" and => { strcmp("$(test.count)", "6"), - strcmp("$(test.123_count)", "1"), - strcmp("$(test.deprecated_count)", "2"), - strcmp("$(test.bundle_deprecated)", "default:bundle_run_meta_deprecated"), - strcmp("$(test.obsoleted_count)", "1"), - strcmp("$(test.bundle_obsoleted)", "default:bundle_run_meta_deprecated"), - strcmp("$(test.bundle_123)", "default:bundle_run_123_456") }; + "ok" + and => { + strcmp("$(test.count)", "6"), + strcmp("$(test.123_count)", "1"), + strcmp("$(test.deprecated_count)", "2"), + strcmp( + "$(test.bundle_deprecated)", "default:bundle_run_meta_deprecated" + ), + strcmp("$(test.obsoleted_count)", "1"), + strcmp( + "$(test.bundle_obsoleted)", "default:bundle_run_meta_deprecated" + ), + strcmp("$(test.bundle_123)", "default:bundle_run_123_456"), + }; reports: DEBUG:: @@ -55,8 +70,10 @@ bundle agent check "First deprecated bundle is $(test.bundle_deprecated)"; "Found obsoleted bundles $(test.bundle_run_meta_obsoleted)"; "First obsoleted bundle is $(test.bundle_obsoleted)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } @@ -76,13 +93,13 @@ bundle agent bundle_run_cde_fgh bundle agent bundle_run_meta_deprecated { meta: - "tags" slist => { "deprecated", "obsoleted" }; + "tags" slist => { "deprecated", "obsoleted" }; } bundle agent bundle_run_meta_string_tags { meta: - "tags" string => "deprecated"; + "tags" string => "deprecated"; } bundle agent bundle_run_meta_missing_tags diff --git a/tests/acceptance/01_vars/02_functions/bundlesmatching_dynamicsequence.cf b/tests/acceptance/01_vars/02_functions/bundlesmatching_dynamicsequence.cf index 0e915a68f4..5a976d5eb4 100644 --- a/tests/acceptance/01_vars/02_functions/bundlesmatching_dynamicsequence.cf +++ b/tests/acceptance/01_vars/02_functions/bundlesmatching_dynamicsequence.cf @@ -1,9 +1,8 @@ # Test that bundlesmatching works correctly for dynamic sequences - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle common init @@ -13,22 +12,24 @@ bundle common init bundle agent test { vars: - "runs" slist => bundlesmatching("default:run.*"); + "runs" slist => bundlesmatching("default:run.*"); methods: - "run them" usebundle => $(runs); + "run them" usebundle => $(runs); } bundle agent check { classes: - "ok" and => { ok1, ok2, ok3 }; + "ok" and => { ok1, ok2, ok3 }; reports: DEBUG:: "Found bundles $(test.runs)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } @@ -36,17 +37,23 @@ bundle agent check bundle agent run_123_456 { classes: - "ok1" expression => "any", scope => "namespace"; + "ok1" + expression => "any", + scope => "namespace"; } bundle agent run_789_0ab { classes: - "ok2" expression => "any", scope => "namespace"; + "ok2" + expression => "any", + scope => "namespace"; } bundle agent run_cde_fgh { classes: - "ok3" expression => "any", scope => "namespace"; + "ok3" + expression => "any", + scope => "namespace"; } diff --git a/tests/acceptance/01_vars/02_functions/bundlestate.cf b/tests/acceptance/01_vars/02_functions/bundlestate.cf index 67f7ca3935..9200726c66 100644 --- a/tests/acceptance/01_vars/02_functions/bundlestate.cf +++ b/tests/acceptance/01_vars/02_functions/bundlestate.cf @@ -1,48 +1,56 @@ # Test that the bundlestate() function gives good data - body common control { - inputs => { "../../default.sub.cf", "bundlestate.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "bundlestate.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "s" string => "Hello!"; - "d" data => parsejson('[4,5,6]'); - "list" slist => { "element1", "element2" }; - "h" data => parsejson('{ "a": "x", "b": "y"}'); + "s" string => "Hello!"; + "d" data => parsejson('[4,5,6]'); + "list" slist => { "element1", "element2" }; + "h" data => parsejson('{ "a": "x", "b": "y"}'); methods: - "" usebundle => external:init; - "" usebundle => external:dump; + "" usebundle => external:init; + "" usebundle => external:dump; } bundle agent test { vars: - "holder" data => bundlestate("init"); - "holder2" data => bundlestate("$(this.namespace):init"); - "holder3" data => bundlestate("nosuchnamespace:init"); - "holder4" data => bundlestate("external:init"); + "holder" data => bundlestate("init"); + "holder2" data => bundlestate("$(this.namespace):init"); + "holder3" data => bundlestate("nosuchnamespace:init"); + "holder4" data => bundlestate("external:init"); + "holder_s" string => format("%S", holder); + + "holder2_defined" + string => ifelse( + isvariable(holder2), "we have holder 2 and we shouldn't", "" + ); - "holder_s" string => format("%S", holder); - "holder2_defined" string => ifelse(isvariable(holder2), "we have holder 2 and we shouldn't", ""); - "holder3_defined" string => ifelse(isvariable("holder3"), "we have holder 3 and we shouldn't", ""); - "holder4_s" string => format("%S", holder4); + "holder3_defined" + string => ifelse( + isvariable("holder3"), "we have holder 3 and we shouldn't", "" + ); - "s_s" string => format("%S", "holder[s]"); - "s_d" string => format("%S", "holder[d]"); - "s_list" string => format("%S", "holder[list]"); - "s_h" string => format("%S", "holder[h]"); + "holder4_s" string => format("%S", holder4); + "s_s" string => format("%S", "holder[s]"); + "s_d" string => format("%S", "holder[d]"); + "s_list" string => format("%S", "holder[list]"); + "s_h" string => format("%S", "holder[h]"); } bundle agent check { methods: - "check" usebundle => dcs_check_strcmp("$(test.s_s) + "check" + usebundle => dcs_check_strcmp( + "$(test.s_s) $(test.s_d) $(test.s_list) $(test.s_h) @@ -51,7 +59,7 @@ $(external:dump.external_holder_s) $(external:dump.external_holder2_s) $(test.holder2_defined) $(test.holder3_defined)", - '"Hello!" + '"Hello!" [4,5,6] ["element1","element2"] {"a":"x","b":"y"} @@ -60,6 +68,7 @@ $(test.holder_s) {"external_s":"External Hello!"} ', - $(this.promise_filename), - "no"); + $(this.promise_filename), + "no" + ); } diff --git a/tests/acceptance/01_vars/02_functions/cache_name.cf b/tests/acceptance/01_vars/02_functions/cache_name.cf index bff0257413..925238c4c6 100644 --- a/tests/acceptance/01_vars/02_functions/cache_name.cf +++ b/tests/acceptance/01_vars/02_functions/cache_name.cf @@ -3,25 +3,21 @@ # Test that the function result cache checks function name # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - - bundle agent init { vars: - "agent_regex" string => ".*cf-agent.*"; + "agent_regex" string => ".*cf-agent.*"; } ####################################################### - bundle common test { meta: @@ -29,21 +25,19 @@ bundle common test string => "Test that the function result cache checks function name"; vars: - "res1" data => findprocesses("${init.agent_regex}"); + "res1" data => findprocesses("${init.agent_regex}"); classes: - # must not reuse result from previous line - # is reused, produces a type error - "_pass" expression => processexists("${init.agent_regex}"); + # must not reuse result from previous line + # is reused, produces a type error + "_pass" expression => processexists("${init.agent_regex}"); } - ####################################################### - bundle agent check { methods: - _pass:: + _pass:: "pass" usebundle => dcs_pass("$(this.promise_filename)"); !_pass:: diff --git a/tests/acceptance/01_vars/02_functions/canonifyuniquely.cf b/tests/acceptance/01_vars/02_functions/canonifyuniquely.cf index 644719730a..515347ea99 100644 --- a/tests/acceptance/01_vars/02_functions/canonifyuniquely.cf +++ b/tests/acceptance/01_vars/02_functions/canonifyuniquely.cf @@ -3,75 +3,73 @@ # Test canonifyuniquely() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - - "in1" string => "h?llo"; - "expect1" string => "h_llo_ad3f6fcf7063483c9d23b4b83c0b65df72e9f5cc"; - "out1" string => canonifyuniquely("$(in1)"); - - "in2" string => "h/llo"; - "expect2" string => "h_llo_5d049ef5eaa0c5b4622eac3eee899132731bc034"; - "out2" string => canonifyuniquely("$(in2)"); - - "in3" string => "/etc/passwd"; - "expect3" string => "_etc_passwd_b5cc3f676d00dd320d85ef41a5209fa0a99891ea"; - "out3" string => canonifyuniquely("$(in3)"); - - "in4" string => "hello@mumble.com"; - "expect4" string => "hello_mumble_com_5050b0473d3e79adccfb885b8cbe3f44ed706987"; - "out4" string => canonifyuniquely("$(in4)"); - - "in5" string => "!@#$%^&*()_-+={}[]\:;<>,?"; - "expect5" string => "__________________________55a3d62a602f37917827cbe044fcbb5da58f8df5"; - "out5" string => canonifyuniquely("$(in5)"); - - "in6" string => "Eystein Måløy Stenberg"; - "expect6" string => "Eystein_M__l__y_Stenberg_f1d661c705209075cd873226cb131d2e27374357"; - "out6" string => canonifyuniquely("$(in6)"); - - "in7" string => "$(in1) $(in1)"; - "expect7" string => "h_llo_h_llo_53750186dbccd2f8a512345c4a92ccc34d75267d"; - "out7" string => canonifyuniquely("$(in1) $(in1)"); - - "in8" string => "'\"hello\"'"; - "expect8" string => "__hello___b2a2a0459a623c8e1cae32e88673ba4067106dc9"; - "out8" string => canonifyuniquely("$(in8)"); + "in1" string => "h?llo"; + "expect1" string => "h_llo_ad3f6fcf7063483c9d23b4b83c0b65df72e9f5cc"; + "out1" string => canonifyuniquely("$(in1)"); + "in2" string => "h/llo"; + "expect2" string => "h_llo_5d049ef5eaa0c5b4622eac3eee899132731bc034"; + "out2" string => canonifyuniquely("$(in2)"); + "in3" string => "/etc/passwd"; + "expect3" string => "_etc_passwd_b5cc3f676d00dd320d85ef41a5209fa0a99891ea"; + "out3" string => canonifyuniquely("$(in3)"); + "in4" string => "hello@mumble.com"; + + "expect4" + string => "hello_mumble_com_5050b0473d3e79adccfb885b8cbe3f44ed706987"; + + "out4" string => canonifyuniquely("$(in4)"); + "in5" string => "!@#$%^&*()_-+={}[]\:;<>,?"; + + "expect5" + string => "__________________________55a3d62a602f37917827cbe044fcbb5da58f8df5"; + + "out5" string => canonifyuniquely("$(in5)"); + "in6" string => "Eystein Måløy Stenberg"; + + "expect6" + string => "Eystein_M__l__y_Stenberg_f1d661c705209075cd873226cb131d2e27374357"; + + "out6" string => canonifyuniquely("$(in6)"); + "in7" string => "$(in1) $(in1)"; + "expect7" string => "h_llo_h_llo_53750186dbccd2f8a512345c4a92ccc34d75267d"; + "out7" string => canonifyuniquely("$(in1) $(in1)"); + "in8" string => "'\"hello\"'"; + "expect8" string => "__hello___b2a2a0459a623c8e1cae32e88673ba4067106dc9"; + "out8" string => canonifyuniquely("$(in8)"); } ####################################################### - bundle agent check { classes: - "ok" and => { - strcmp("$(test.expect1)", "$(test.out1)"), - strcmp("$(test.expect2)", "$(test.out2)"), - strcmp("$(test.expect3)", "$(test.out3)"), - strcmp("$(test.expect4)", "$(test.out4)"), - strcmp("$(test.expect5)", "$(test.out5)"), - strcmp("$(test.expect6)", "$(test.out6)"), - strcmp("$(test.expect7)", "$(test.out7)"), - strcmp("$(test.expect8)", "$(test.out8)"), + "ok" + and => { + strcmp("$(test.expect1)", "$(test.out1)"), + strcmp("$(test.expect2)", "$(test.out2)"), + strcmp("$(test.expect3)", "$(test.out3)"), + strcmp("$(test.expect4)", "$(test.out4)"), + strcmp("$(test.expect5)", "$(test.out5)"), + strcmp("$(test.expect6)", "$(test.out6)"), + strcmp("$(test.expect7)", "$(test.out7)"), + strcmp("$(test.expect8)", "$(test.out8)"), }; reports: @@ -84,8 +82,10 @@ bundle agent check "Expected canonifyuniquely('$(test.in6)') => $(test.out6) == $(test.expect6)"; "Expected canonifyuniquely('$(test.in7)') => $(test.out7) == $(test.expect7)"; "Expected canonifyuniquely('$(test.in8)') => $(test.out8) == $(test.expect8)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/cf_version.cf b/tests/acceptance/01_vars/02_functions/cf_version.cf index 1a128dac25..14eaad21ca 100644 --- a/tests/acceptance/01_vars/02_functions/cf_version.cf +++ b/tests/acceptance/01_vars/02_functions/cf_version.cf @@ -3,59 +3,90 @@ # Test cf_version convenience functions # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent test { vars: - "after_newer" string => "yes", + "after_newer" + string => "yes", if => cf_version_after("1.0.0"); - "after_newer_major" string => "yes", + + "after_newer_major" + string => "yes", if => cf_version_after("3.12"); - "after_older" string => "no", + + "after_older" + string => "no", if => cf_version_after("999.999.999"); - "at_same" string => "yes", + + "at_same" + string => "yes", if => cf_version_at("$(sys.cf_version)"); - "at_major" string => "yes", + + "at_major" + string => "yes", if => cf_version_at("3"); - "at_not_same" string => "no", + + "at_not_same" + string => "no", if => cf_version_at("999.999.999"); - "before_newer" string => "no", + + "before_newer" + string => "no", if => cf_version_before("1.0.0"); - "before_older" string => "yes", + + "before_older" + string => "yes", if => cf_version_before("999.999.999"); - "before_older_major" string => "yes", + + "before_older_major" + string => "yes", if => cf_version_before("999"); - "between" string => "yes", + + "between" + string => "yes", if => cf_version_between("1.0", "999.999"); - "not_between" string => "no", + + "not_between" + string => "no", if => cf_version_between("999", "999"); - "also_not_between" string => "no", + + "also_not_between" + string => "no", if => cf_version_between("1", "1"); - "max_newer" string => "no", + + "max_newer" + string => "no", if => cf_version_maximum("1.0.0"); - "max_older" string => "yes", + + "max_older" + string => "yes", if => cf_version_maximum("999.999.999"); - "min_newer" string => "yes", + + "min_newer" + string => "yes", if => cf_version_minimum("1.0.0"); - "min_older" string => "no", + + "min_older" + string => "no", if => cf_version_minimum("999.999.999"); } ########################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/classesmatching.cf b/tests/acceptance/01_vars/02_functions/classesmatching.cf index a9e7824941..395fe41f6d 100644 --- a/tests/acceptance/01_vars/02_functions/classesmatching.cf +++ b/tests/acceptance/01_vars/02_functions/classesmatching.cf @@ -1,49 +1,72 @@ # Test that classesmatching and countclassesmatching work correctly - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle common init { classes: - "test_fbeae67f3e347b5e0032302200141131" expression => "any", meta => { "x" }; - "test_fbeae67f3e347b5e0032302200141131_1" expression => "any", meta => { "x" }; - "test_fbeae67f3e347b5e0032302200141131_2" expression => "any", meta => { "y" }; + "test_fbeae67f3e347b5e0032302200141131" + expression => "any", + meta => { "x" }; + + "test_fbeae67f3e347b5e0032302200141131_1" + expression => "any", + meta => { "x" }; + + "test_fbeae67f3e347b5e0032302200141131_2" + expression => "any", + meta => { "y" }; } bundle common test { vars: - "classes" slist => classesmatching("test_fbeae67f3e347b5e0032302200141131.*"); - "x_classes" slist => classesmatching("test_fbeae67f3e347b5e0032302200141131.*", "x"); - "z_classes" slist => classesmatching("test_fbeae67f3e347b5e0032302200141131.*", "z"); + "classes" + slist => classesmatching("test_fbeae67f3e347b5e0032302200141131.*"); - "ccm_classes" int => countclassesmatching("test_fbeae67f3e347b5e0032302200141131.*"); - "ccm_x_classes" int => countclassesmatching("test_fbeae67f3e347b5e0032302200141131.*", "x"); - "ccm_z_classes" int => countclassesmatching("test_fbeae67f3e347b5e0032302200141131.*", "z"); + "x_classes" + slist => classesmatching("test_fbeae67f3e347b5e0032302200141131.*", "x"); - "count" int => length(classes); - "x_count" int => length(x_classes); - "z_count" int => length(z_classes); + "z_classes" + slist => classesmatching("test_fbeae67f3e347b5e0032302200141131.*", "z"); - classes: - "have_count_classes" expression => strcmp($(count), 3); - "have_count_x_classes" expression => strcmp($(x_count), 2); - "have_count_z_classes" expression => strcmp($(z_count), 0); + "ccm_classes" + int => countclassesmatching("test_fbeae67f3e347b5e0032302200141131.*"); - "have_ccm_classes" expression => strcmp($(ccm_classes), 3); - "have_ccm_x_classes" expression => strcmp($(ccm_x_classes), 2); - "have_ccm_z_classes" expression => strcmp($(ccm_z_classes), 0); + "ccm_x_classes" + int => countclassesmatching( + "test_fbeae67f3e347b5e0032302200141131.*", "x" + ); + + "ccm_z_classes" + int => countclassesmatching( + "test_fbeae67f3e347b5e0032302200141131.*", "z" + ); + + "count" int => length(classes); + "x_count" int => length(x_classes); + "z_count" int => length(z_classes); + + classes: + "have_count_classes" expression => strcmp($(count), 3); + "have_count_x_classes" expression => strcmp($(x_count), 2); + "have_count_z_classes" expression => strcmp($(z_count), 0); + "have_ccm_classes" expression => strcmp($(ccm_classes), 3); + "have_ccm_x_classes" expression => strcmp($(ccm_x_classes), 2); + "have_ccm_z_classes" expression => strcmp($(ccm_z_classes), 0); } bundle agent check { - methods: - "" usebundle => dcs_passif_expected("have_count_classes,have_count_x_classes,have_count_z_classes,have_ccm_classes,have_ccm_x_classes,have_ccm_z_classes", - "", - $(this.promise_filename)), + methods: + "" + usebundle => dcs_passif_expected( + "have_count_classes,have_count_x_classes,have_count_z_classes,have_ccm_classes,have_ccm_x_classes,have_ccm_z_classes", + "", + $(this.promise_filename) + ), inherit => "true"; } diff --git a/tests/acceptance/01_vars/02_functions/classfiltercsv_1.cf b/tests/acceptance/01_vars/02_functions/classfiltercsv_1.cf index 444ba55bda..4fff1277f5 100644 --- a/tests/acceptance/01_vars/02_functions/classfiltercsv_1.cf +++ b/tests/acceptance/01_vars/02_functions/classfiltercsv_1.cf @@ -1,51 +1,58 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "description" -> { "CFE-2768" } - string => "Test that classfiltercsv() works: + "description" -> { "CFE-2768" } + string => "Test that classfiltercsv() works: - column headings - simple filtering (no duplicates after filter) - no sorting"; - } + bundle agent check { vars: - "data_file" string => "$(this.promise_filename).csv"; - "d" data => classfiltercsv( $(data_file), - "true", # Data file contains column headings - 0); # Column containing class expression to filter with + "data_file" string => "$(this.promise_filename).csv"; - classes: + "d" + data => classfiltercsv( + $(data_file), + "true", + # Data file contains column headings + 0 + ); - # Check if Token has the value we expect - "Token_OK" expression => strcmp( "$(d[0][Token])", "net.ipv4.ip_forward" ); + # Column containing class expression to filter with + classes: + # Check if Token has the value we expect + "Token_OK" expression => strcmp("$(d[0][Token])", "net.ipv4.ip_forward"); - # Check if Value has the value we expect - "Value_OK" expression => strcmp( "$(d[0][Value])", "ANYVALUE" ); + # Check if Value has the value we expect + "Value_OK" expression => strcmp("$(d[0][Value])", "ANYVALUE"); - # Check if the result contains the number of records we expect. - "Length_OK" expression => strcmp( length( d ), 1 ); + # Check if the result contains the number of records we expect. + "Length_OK" expression => strcmp(length(d), 1); methods: - - "Pass/FAIL" - usebundle => dcs_passif_expected( 'Token_OK,Value_OK,Length_OK', '', $(this.promise_filename) ), - inherit => "true"; + "Pass/FAIL" + usebundle => dcs_passif_expected( + 'Token_OK,Value_OK,Length_OK', '', $(this.promise_filename) + ), + inherit => "true"; reports: - DEBUG|EXTRA:: - "Function returned:$(with)" with => string_mustache( "{{%-top-}}", d ); + DEBUG|EXTRA:: + "Function returned:$(with)" with => string_mustache("{{%-top-}}", d); "supercalifragilisticexpialidociousNOTDEFINED is actually defined." if => "supercalifragilisticexpialidociousNOTDEFINED"; + "supercalifragilisticexpialidociousNOTDEFINED is not defined (as expected)" unless => "supercalifragilisticexpialidociousNOTDEFINED"; } diff --git a/tests/acceptance/01_vars/02_functions/classfiltercsv_2.cf b/tests/acceptance/01_vars/02_functions/classfiltercsv_2.cf index 6c2572f1cf..32ce024d04 100644 --- a/tests/acceptance/01_vars/02_functions/classfiltercsv_2.cf +++ b/tests/acceptance/01_vars/02_functions/classfiltercsv_2.cf @@ -1,51 +1,58 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "description" -> { "CFE-2768" } - string => "Test that classfiltercsv() works: + "description" -> { "CFE-2768" } + string => "Test that classfiltercsv() works: - no column headings - simple filtering (no duplicates after filter) - no sorting"; - } + bundle agent check { vars: - "data_file" string => "$(this.promise_filename).csv"; - "d" data => classfiltercsv( $(data_file), - "false", # Data file contains column headings - 0); # Column containing class expression to filter with + "data_file" string => "$(this.promise_filename).csv"; - classes: + "d" + data => classfiltercsv( + $(data_file), + "false", + # Data file contains column headings + 0 + ); - # Check if Token has the value we expect - "Token_OK" expression => strcmp( "$(d[0][0])", "net.ipv4.ip_forward" ); + # Column containing class expression to filter with + classes: + # Check if Token has the value we expect + "Token_OK" expression => strcmp("$(d[0][0])", "net.ipv4.ip_forward"); - # Check if Value has the value we expect - "Value_OK" expression => strcmp( "$(d[0][1])", "ANYVALUE" ); + # Check if Value has the value we expect + "Value_OK" expression => strcmp("$(d[0][1])", "ANYVALUE"); - # Check if the result contains the number of records we expect. - "Length_OK" expression => strcmp( length( d ), 1 ); + # Check if the result contains the number of records we expect. + "Length_OK" expression => strcmp(length(d), 1); methods: - - "Pass/FAIL" - usebundle => dcs_passif_expected( 'Token_OK,Value_OK,Length_OK', '', $(this.promise_filename) ), - inherit => "true"; + "Pass/FAIL" + usebundle => dcs_passif_expected( + 'Token_OK,Value_OK,Length_OK', '', $(this.promise_filename) + ), + inherit => "true"; reports: - DEBUG|EXTRA:: - "Function returned:$(with)" with => string_mustache( "{{%-top-}}", d ); + DEBUG|EXTRA:: + "Function returned:$(with)" with => string_mustache("{{%-top-}}", d); "supercalifragilisticexpialidociousNOTDEFINED is actually defined." if => "supercalifragilisticexpialidociousNOTDEFINED"; + "supercalifragilisticexpialidociousNOTDEFINED is not defined (as expected)" unless => "supercalifragilisticexpialidociousNOTDEFINED"; } diff --git a/tests/acceptance/01_vars/02_functions/classfiltercsv_3.cf b/tests/acceptance/01_vars/02_functions/classfiltercsv_3.cf index 8c1d7b1a0a..de27b5f223 100644 --- a/tests/acceptance/01_vars/02_functions/classfiltercsv_3.cf +++ b/tests/acceptance/01_vars/02_functions/classfiltercsv_3.cf @@ -1,52 +1,60 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "description" -> { "CFE-2768" } - string => "Test that classfiltercsv() works: + "description" -> { "CFE-2768" } + string => "Test that classfiltercsv() works: - column headings - simple filtering (no duplicates after filter) - sorting"; - } + bundle agent check { vars: - "data_file" string => "$(this.promise_filename).csv"; - "d" data => classfiltercsv( $(data_file), - "true", # Data file contains column headings - 0, # Column containing class expression to filter with - 1); # Column to sort by (NOT IMPLEMENTED AT TIME OF TEST) - + "data_file" string => "$(this.promise_filename).csv"; + + "d" + data => classfiltercsv( + $(data_file), + "true", + # Data file contains column headings + 0, + # Column containing class expression to filter with + 1 + ); + + # Column to sort by (NOT IMPLEMENTED AT TIME OF TEST) classes: + # Check if Token has the value we expect + "Token_OK" expression => strcmp("$(d[0][Token])", "net.ipv4.ip_forward"); - # Check if Token has the value we expect - "Token_OK" expression => strcmp( "$(d[0][Token])", "net.ipv4.ip_forward" ); + # Check if Value has the value we expect + "Value_OK" expression => strcmp("$(d[0][Value])", "ANYVALUE-sort0"); - # Check if Value has the value we expect - "Value_OK" expression => strcmp( "$(d[0][Value])", "ANYVALUE-sort0" ); - - # Check if the result contains the number of records we expect. - "Length_OK" expression => isgreaterthan( length( d ), 0); + # Check if the result contains the number of records we expect. + "Length_OK" expression => isgreaterthan(length(d), 0); methods: - - "Pass/FAIL" - usebundle => dcs_passif_expected( 'Token_OK,Value_OK,Length_OK', '', $(this.promise_filename) ), - inherit => "true"; + "Pass/FAIL" + usebundle => dcs_passif_expected( + 'Token_OK,Value_OK,Length_OK', '', $(this.promise_filename) + ), + inherit => "true"; reports: - DEBUG|EXTRA:: - "Function returned:$(with)" with => string_mustache( "{{%-top-}}", d ); + DEBUG|EXTRA:: + "Function returned:$(with)" with => string_mustache("{{%-top-}}", d); "supercalifragilisticexpialidociousNOTDEFINED is actually defined." if => "supercalifragilisticexpialidociousNOTDEFINED"; + "supercalifragilisticexpialidociousNOTDEFINED is not defined (as expected)" unless => "supercalifragilisticexpialidociousNOTDEFINED"; } diff --git a/tests/acceptance/01_vars/02_functions/classfiltercsv_4.cf b/tests/acceptance/01_vars/02_functions/classfiltercsv_4.cf index 979a215a50..845894f62f 100644 --- a/tests/acceptance/01_vars/02_functions/classfiltercsv_4.cf +++ b/tests/acceptance/01_vars/02_functions/classfiltercsv_4.cf @@ -1,51 +1,59 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "description" -> { "CFE-2768" } - string => "Test that classfiltercsv() works: + "description" -> { "CFE-2768" } + string => "Test that classfiltercsv() works: - column headings - simple filtering (no duplicates after filter) - no sorting - 2 invalid rows, one that would be included, and one that would be filtered out are both ignored"; } + bundle agent check { vars: - "data_file" string => "$(this.promise_filename).csv"; - "d" data => classfiltercsv( $(data_file), - "true", # Data file contains column headings - 0); # Column containing class expression to filter with + "data_file" string => "$(this.promise_filename).csv"; - classes: + "d" + data => classfiltercsv( + $(data_file), + "true", + # Data file contains column headings + 0 + ); - # Check if Token has the value we expect - "Token_OK" expression => strcmp( "$(d[0][Token])", "net.ipv4.ip_forward" ); + # Column containing class expression to filter with + classes: + # Check if Token has the value we expect + "Token_OK" expression => strcmp("$(d[0][Token])", "net.ipv4.ip_forward"); - # Check if Value has the value we expect - "Value_OK" expression => strcmp( "$(d[0][Value])", "ANYVALUE" ); + # Check if Value has the value we expect + "Value_OK" expression => strcmp("$(d[0][Value])", "ANYVALUE"); - # Check if the result contains the number of records we expect. - "Length_OK" expression => strcmp( length( d ), 1 ); + # Check if the result contains the number of records we expect. + "Length_OK" expression => strcmp(length(d), 1); methods: - - "Pass/FAIL" - usebundle => dcs_passif_expected( 'Token_OK,Value_OK,Length_OK', '', $(this.promise_filename) ), - inherit => "true"; + "Pass/FAIL" + usebundle => dcs_passif_expected( + 'Token_OK,Value_OK,Length_OK', '', $(this.promise_filename) + ), + inherit => "true"; reports: - DEBUG|EXTRA:: - "Function returned:$(with)" with => string_mustache( "{{%-top-}}", d ); + DEBUG|EXTRA:: + "Function returned:$(with)" with => string_mustache("{{%-top-}}", d); "supercalifragilisticexpialidociousNOTDEFINED is actually defined." if => "supercalifragilisticexpialidociousNOTDEFINED"; + "supercalifragilisticexpialidociousNOTDEFINED is not defined (as expected)" unless => "supercalifragilisticexpialidociousNOTDEFINED"; } diff --git a/tests/acceptance/01_vars/02_functions/classfiltercsv_5.cf b/tests/acceptance/01_vars/02_functions/classfiltercsv_5.cf index 625f271e79..607d9eec3c 100644 --- a/tests/acceptance/01_vars/02_functions/classfiltercsv_5.cf +++ b/tests/acceptance/01_vars/02_functions/classfiltercsv_5.cf @@ -1,51 +1,59 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "description" -> { "CFE-2768" } - string => "Test that classfiltercsv() works: + "description" -> { "CFE-2768" } + string => "Test that classfiltercsv() works: - column headings - simple filtering (no duplicates after filter) - no sorting - empty rows"; } + bundle agent check { vars: - "data_file" string => "$(this.promise_filename).csv"; - "d" data => classfiltercsv( $(data_file), - "true", # Data file contains column headings - 0); # Column containing class expression to filter with + "data_file" string => "$(this.promise_filename).csv"; - classes: + "d" + data => classfiltercsv( + $(data_file), + "true", + # Data file contains column headings + 0 + ); - # Check if Token has the value we expect - "Token_OK" expression => strcmp( "$(d[0][Token])", "net.ipv4.ip_forward" ); + # Column containing class expression to filter with + classes: + # Check if Token has the value we expect + "Token_OK" expression => strcmp("$(d[0][Token])", "net.ipv4.ip_forward"); - # Check if Value has the value we expect - "Value_OK" expression => strcmp( "$(d[0][Value])", "ANYVALUE" ); + # Check if Value has the value we expect + "Value_OK" expression => strcmp("$(d[0][Value])", "ANYVALUE"); - # Check if the result contains the number of records we expect. - "Length_OK" expression => strcmp( length( d ), 1 ); + # Check if the result contains the number of records we expect. + "Length_OK" expression => strcmp(length(d), 1); methods: - - "Pass/FAIL" - usebundle => dcs_passif_expected( 'Token_OK,Value_OK,Length_OK', '', $(this.promise_filename) ), - inherit => "true"; + "Pass/FAIL" + usebundle => dcs_passif_expected( + 'Token_OK,Value_OK,Length_OK', '', $(this.promise_filename) + ), + inherit => "true"; reports: - DEBUG|EXTRA:: - "Function returned:$(with)" with => string_mustache( "{{%-top-}}", d ); + DEBUG|EXTRA:: + "Function returned:$(with)" with => string_mustache("{{%-top-}}", d); "supercalifragilisticexpialidociousNOTDEFINED is actually defined." if => "supercalifragilisticexpialidociousNOTDEFINED"; + "supercalifragilisticexpialidociousNOTDEFINED is not defined (as expected)" unless => "supercalifragilisticexpialidociousNOTDEFINED"; } diff --git a/tests/acceptance/01_vars/02_functions/classfilterdata_array_of_arrays_foo.cf b/tests/acceptance/01_vars/02_functions/classfilterdata_array_of_arrays_foo.cf index 43052db129..5be3765152 100644 --- a/tests/acceptance/01_vars/02_functions/classfilterdata_array_of_arrays_foo.cf +++ b/tests/acceptance/01_vars/02_functions/classfilterdata_array_of_arrays_foo.cf @@ -18,8 +18,7 @@ bundle agent test(context, index) [ "baz", "!baz", "foo&baz", "foo|baz" ], ]'; - "actual" - data => classfilterdata("@(test)", "array_of_arrays", "$(index)"); + "actual" data => classfilterdata("@(test)", "array_of_arrays", "$(index)"); classes: "$(context)"; @@ -38,29 +37,36 @@ bundle agent check "range" slist => expandrange("[0-$(num_indices)]", "1"); "expected[0]" - string => storejson('[ + string => storejson( + '[ [ "foo", "!foo", "foo&bar", "foo|bar" ], - ]'); + ]' + ); + "expected[1]" - string => storejson('[ + string => storejson( + '[ [ "bar", "!bar", "bar&baz", "bar|baz" ], [ "baz", "!baz", "foo&baz", "foo|baz" ], + ]' + ); + + "expected[2]" string => storejson('[ ]'); - "expected[2]" - string => storejson('[ - ]'); + "expected[3]" - string => storejson('[ + string => storejson( + '[ [ "foo", "!foo", "foo&bar", "foo|bar" ], [ "baz", "!baz", "foo&baz", "foo|baz" ], - ]'); + ]' + ); classes: "ok_$(range)" - expression => strcmp("$(expected[$(range)])", - "$(actual[$(range)])"); - "ok" - expression => and(expandrange("ok_[0-$(num_indices)]", "1")); + expression => strcmp("$(expected[$(range)])", "$(actual[$(range)])"); + + "ok" expression => and(expandrange("ok_[0-$(num_indices)]", "1")); methods: "context: '$(with)' and index: $(range)" @@ -69,10 +75,12 @@ bundle agent check with => join(", ", "context"); reports: - "Context '$(with)'; index $(range); expected '$(expected[$(range)])'; actual '$(actual[$(range)])'" - with => join("', '", "context"); + "Context '$(with)'; index $(range); expected '$(expected[$(range)])'; actual '$(actual[$(range)])'" + with => join("', '", "context"); + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/classfilterdata_array_of_arrays_foo_bar.cf b/tests/acceptance/01_vars/02_functions/classfilterdata_array_of_arrays_foo_bar.cf index 0d2130fdf6..25b601c1cc 100644 --- a/tests/acceptance/01_vars/02_functions/classfilterdata_array_of_arrays_foo_bar.cf +++ b/tests/acceptance/01_vars/02_functions/classfilterdata_array_of_arrays_foo_bar.cf @@ -18,8 +18,7 @@ bundle agent test(context, index) [ "baz", "!baz", "foo&baz", "foo|baz" ], ]'; - "actual" - data => classfilterdata("@(test)", "array_of_arrays", "$(index)"); + "actual" data => classfilterdata("@(test)", "array_of_arrays", "$(index)"); classes: "$(context)"; @@ -38,31 +37,41 @@ bundle agent check "range" slist => expandrange("[0-$(num_indices)]", "1"); "expected[0]" - string => storejson('[ + string => storejson( + '[ [ "foo", "!foo", "foo&bar", "foo|bar" ], [ "bar", "!bar", "bar&baz", "bar|baz" ], - ]'); + ]' + ); + "expected[1]" - string => storejson('[ + string => storejson( + '[ [ "baz", "!baz", "foo&baz", "foo|baz" ], - ]'); + ]' + ); + "expected[2]" - string => storejson('[ + string => storejson( + '[ [ "foo", "!foo", "foo&bar", "foo|bar" ], - ]'); + ]' + ); + "expected[3]" - string => storejson('[ + string => storejson( + '[ [ "foo", "!foo", "foo&bar", "foo|bar" ], [ "bar", "!bar", "bar&baz", "bar|baz" ], [ "baz", "!baz", "foo&baz", "foo|baz" ], - ]'); + ]' + ); classes: "ok_$(range)" - expression => strcmp("$(expected[$(range)])", - "$(actual[$(range)])"); - "ok" - expression => and(expandrange("ok_[0-$(num_indices)]", "1")); + expression => strcmp("$(expected[$(range)])", "$(actual[$(range)])"); + + "ok" expression => and(expandrange("ok_[0-$(num_indices)]", "1")); methods: "context: '$(with)' and index: $(range)" @@ -71,10 +80,12 @@ bundle agent check with => join(", ", "context"); reports: - "Context '$(with)'; index $(range); expected '$(expected[$(range)])'; actual '$(actual[$(range)])'" - with => join("', '", "context"); + "Context '$(with)'; index $(range); expected '$(expected[$(range)])'; actual '$(actual[$(range)])'" + with => join("', '", "context"); + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/classfilterdata_array_of_objects_foo.cf b/tests/acceptance/01_vars/02_functions/classfilterdata_array_of_objects_foo.cf index 5e424e8952..292b701099 100644 --- a/tests/acceptance/01_vars/02_functions/classfilterdata_array_of_objects_foo.cf +++ b/tests/acceptance/01_vars/02_functions/classfilterdata_array_of_objects_foo.cf @@ -38,29 +38,36 @@ bundle agent check "range" slist => expandrange("[0-$(num_indices)]", "1"); "expected[0]" - string => storejson('[ + string => storejson( + '[ { "key_0": "foo", "key_1": "!foo", "key_2": "foo&bar", "key_3": "foo|bar" }, - ]'); + ]' + ); + "expected[1]" - string => storejson('[ + string => storejson( + '[ { "key_0": "bar", "key_1": "!bar", "key_2": "bar&baz", "key_3": "bar|baz" }, { "key_0": "baz", "key_1": "!baz", "key_2": "foo&baz", "key_3": "foo|baz" }, + ]' + ); + + "expected[2]" string => storejson('[ ]'); - "expected[2]" - string => storejson('[ - ]'); + "expected[3]" - string => storejson('[ + string => storejson( + '[ { "key_0": "foo", "key_1": "!foo", "key_2": "foo&bar", "key_3": "foo|bar" }, { "key_0": "baz", "key_1": "!baz", "key_2": "foo&baz", "key_3": "foo|baz" }, - ]'); + ]' + ); classes: "ok_$(range)" - expression => strcmp("$(expected[$(range)])", - "$(actual[$(range)])"); - "ok" - expression => and(expandrange("ok_[0-$(num_indices)]", "1")); + expression => strcmp("$(expected[$(range)])", "$(actual[$(range)])"); + + "ok" expression => and(expandrange("ok_[0-$(num_indices)]", "1")); methods: "context: '$(with)' and index: $(range)" @@ -69,10 +76,12 @@ bundle agent check with => join(", ", "context"); reports: - "Context '$(with)'; index $(range); expected '$(expected[$(range)])'; actual '$(actual[$(range)])'" - with => join("', '", "context"); + "Context '$(with)'; index $(range); expected '$(expected[$(range)])'; actual '$(actual[$(range)])'" + with => join("', '", "context"); + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/classfilterdata_array_of_objects_foo_bar.cf b/tests/acceptance/01_vars/02_functions/classfilterdata_array_of_objects_foo_bar.cf index 42af249d78..e3625244a9 100644 --- a/tests/acceptance/01_vars/02_functions/classfilterdata_array_of_objects_foo_bar.cf +++ b/tests/acceptance/01_vars/02_functions/classfilterdata_array_of_objects_foo_bar.cf @@ -38,31 +38,41 @@ bundle agent check "range" slist => expandrange("[0-$(num_indices)]", "1"); "expected[0]" - string => storejson('[ + string => storejson( + '[ { "key_0": "foo", "key_1": "!foo", "key_2": "foo&bar", "key_3": "foo|bar" }, { "key_0": "bar", "key_1": "!bar", "key_2": "bar&baz", "key_3": "bar|baz" }, - ]'); + ]' + ); + "expected[1]" - string => storejson('[ + string => storejson( + '[ { "key_0": "baz", "key_1": "!baz", "key_2": "foo&baz", "key_3": "foo|baz" }, - ]'); + ]' + ); + "expected[2]" - string => storejson('[ + string => storejson( + '[ { "key_0": "foo", "key_1": "!foo", "key_2": "foo&bar", "key_3": "foo|bar" }, - ]'); + ]' + ); + "expected[3]" - string => storejson('[ + string => storejson( + '[ { "key_0": "foo", "key_1": "!foo", "key_2": "foo&bar", "key_3": "foo|bar" }, { "key_0": "bar", "key_1": "!bar", "key_2": "bar&baz", "key_3": "bar|baz" }, { "key_0": "baz", "key_1": "!baz", "key_2": "foo&baz", "key_3": "foo|baz" }, - ]'); + ]' + ); classes: "ok_$(range)" - expression => strcmp("$(expected[$(range)])", - "$(actual[$(range)])"); - "ok" - expression => and(expandrange("ok_[0-$(num_indices)]", "1")); + expression => strcmp("$(expected[$(range)])", "$(actual[$(range)])"); + + "ok" expression => and(expandrange("ok_[0-$(num_indices)]", "1")); methods: "context: '$(with)' and index: $(range)" @@ -71,10 +81,12 @@ bundle agent check with => join(", ", "context"); reports: - "Context '$(with)'; index $(range); expected '$(expected[$(range)])'; actual '$(actual[$(range)])'" - with => join("', '", "context"); + "Context '$(with)'; index $(range); expected '$(expected[$(range)])'; actual '$(actual[$(range)])'" + with => join("', '", "context"); + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/classfilterdata_collecting.cf b/tests/acceptance/01_vars/02_functions/classfilterdata_collecting.cf index d40d5a4aa8..88ea0d29e6 100644 --- a/tests/acceptance/01_vars/02_functions/classfilterdata_collecting.cf +++ b/tests/acceptance/01_vars/02_functions/classfilterdata_collecting.cf @@ -51,7 +51,8 @@ bundle agent check { vars: "expected" - string => storejson('[ + string => storejson( + '[ { "file": "/tmp/bar", "mode": "600", @@ -66,18 +67,20 @@ bundle agent check "group": "root", "if": "(role_1|role_2)" } -]'); - "actual" - string => storejson("test.filtered"); +]' + ); + + "actual" string => storejson("test.filtered"); classes: - "ok" - expression => strcmp("$(expected)", "$(actual)"); + "ok" expression => strcmp("$(expected)", "$(actual)"); reports: "Expected '$(expected)', actual '$(actual)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/classfilterdata_foo.cf b/tests/acceptance/01_vars/02_functions/classfilterdata_foo.cf index a316dfac90..b1af38fd3e 100644 --- a/tests/acceptance/01_vars/02_functions/classfilterdata_foo.cf +++ b/tests/acceptance/01_vars/02_functions/classfilterdata_foo.cf @@ -11,6 +11,7 @@ bundle agent check "bar": "!foo", "foo": [ "!foo", "foo&bar", "foo|bar" ], }'; + "object_of_arrays_filtered" data => classfilterdata("object_of_arrays", "object_of_arrays", "0"); @@ -19,6 +20,7 @@ bundle agent check "bar": "!foo", "foo": { "foo": "!bar", "key": "value" }, }'; + "object_of_objects_filtered" data => classfilterdata("object_of_objects", "object_of_objects", "foo"); @@ -27,6 +29,7 @@ bundle agent check "bar", [ "baz", "!baz", "foo&baz", "foo|baz" ], ]'; + "array_of_arrays_filtered" data => classfilterdata("array_of_arrays", "array_of_arrays", "0"); @@ -35,25 +38,35 @@ bundle agent check "bar", { "baz": "!baz", "key": "value" }, ]'; + "array_of_objects_filtered" data => classfilterdata("array_of_objects", "array_of_objects", "baz"); classes: - "ok" not => or( + "ok" + not => or( isvariable("array_of_arrays_filtered"), isvariable("array_of_objects_filtered"), isvariable("object_of_arrays_filtered"), isvariable("object_of_objects_filtered") - ); + ); reports: - "Object of Objects filtered: $(with)" with => string(@(object_of_objects_filtered)); - "Object of Arrays filtered: $(with)" with => string(@(object_of_arrays_filtered)); - "Array of Arrays filtered: $(with)" with => string(@(array_of_arrays_filtered)); - "Array of Objects filtered: $(with)" with => string(@(array_of_objects_filtered)); + "Object of Objects filtered: $(with)" + with => string(@(object_of_objects_filtered)); + + "Object of Arrays filtered: $(with)" + with => string(@(object_of_arrays_filtered)); + + "Array of Arrays filtered: $(with)" + with => string(@(array_of_arrays_filtered)); + + "Array of Objects filtered: $(with)" + with => string(@(array_of_objects_filtered)); ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/classfilterdata_object_of_arrays_index_in_obj.cf b/tests/acceptance/01_vars/02_functions/classfilterdata_object_of_arrays_index_in_obj.cf index dd8d7231df..9a8a8a3c99 100644 --- a/tests/acceptance/01_vars/02_functions/classfilterdata_object_of_arrays_index_in_obj.cf +++ b/tests/acceptance/01_vars/02_functions/classfilterdata_object_of_arrays_index_in_obj.cf @@ -17,8 +17,7 @@ bundle agent test "/etc/apt/apt.conf": [ "644", "root", "root", "bar" ] }'; - "actual" - data => classfilterdata("@(test)", "object_of_arrays", "3"); + "actual" data => classfilterdata("@(test)", "object_of_arrays", "3"); classes: "foo"; @@ -28,21 +27,24 @@ bundle agent check { vars: "expected" - string => storejson('{ + string => storejson( + '{ "/etc/chrony.conf": [ "0644", "root", "root", "foo" ], "/etc/apt/sources.list": [ "644", "root", "root", "foo|bar" ] - }'); - "actual" - string => storejson("@(test.actual)"); + }' + ); + + "actual" string => storejson("@(test.actual)"); classes: - "ok" - expression => strcmp("$(expected)", "$(actual)"); + "ok" expression => strcmp("$(expected)", "$(actual)"); reports: - "Expected: '$(expected)', actual: '$(actual)'"; + "Expected: '$(expected)', actual: '$(actual)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/classfilterdata_object_of_arrays_key_to_obj.cf b/tests/acceptance/01_vars/02_functions/classfilterdata_object_of_arrays_key_to_obj.cf index f2ea2ead0d..5489d5f983 100644 --- a/tests/acceptance/01_vars/02_functions/classfilterdata_object_of_arrays_key_to_obj.cf +++ b/tests/acceptance/01_vars/02_functions/classfilterdata_object_of_arrays_key_to_obj.cf @@ -17,8 +17,7 @@ bundle agent test "bar": [ "644", "root", "root", "/etc/apt/apt.conf" ] }'; - "actual" - data => classfilterdata("@(test)", "object_of_arrays"); + "actual" data => classfilterdata("@(test)", "object_of_arrays"); classes: "bar"; @@ -28,21 +27,24 @@ bundle agent check { vars: "expected" - string => storejson('{ + string => storejson( + '{ "foo|bar": [ "644", "root", "root", "/etc/apt/sources.list" ], "bar": [ "644", "root", "root", "/etc/apt/apt.conf" ] - }'); - "actual" - string => storejson("@(test.actual)"); + }' + ); + + "actual" string => storejson("@(test.actual)"); classes: - "ok" - expression => strcmp("$(expected)", "$(actual)"); + "ok" expression => strcmp("$(expected)", "$(actual)"); reports: - "Expected: '$(expected)', actual: '$(actual)'"; + "Expected: '$(expected)', actual: '$(actual)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/classfilterdata_object_of_objects_key_in_obj.cf b/tests/acceptance/01_vars/02_functions/classfilterdata_object_of_objects_key_in_obj.cf index de1323bc5c..31d4bfc24e 100644 --- a/tests/acceptance/01_vars/02_functions/classfilterdata_object_of_objects_key_in_obj.cf +++ b/tests/acceptance/01_vars/02_functions/classfilterdata_object_of_objects_key_in_obj.cf @@ -32,8 +32,7 @@ bundle agent test } }'; - "actual" - data => classfilterdata("@(test)", "object_of_objects", "if"); + "actual" data => classfilterdata("@(test)", "object_of_objects", "if"); classes: "foo"; @@ -43,7 +42,8 @@ bundle agent check { vars: "expected" - string => storejson('{ + string => storejson( + '{ "/etc/chrony.conf": { "mode": "0644", "owner": "root", @@ -56,18 +56,20 @@ bundle agent check "group": "root", "if": "foo|bar" } - }'); - "actual" - string => storejson("@(test.actual)"); + }' + ); + + "actual" string => storejson("@(test.actual)"); classes: - "ok" - expression => strcmp("$(expected)", "$(actual)"); + "ok" expression => strcmp("$(expected)", "$(actual)"); reports: - "Expected: '$(expected)', actual: '$(actual)'"; + "Expected: '$(expected)', actual: '$(actual)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/classfilterdata_object_of_objects_key_to_obj.cf b/tests/acceptance/01_vars/02_functions/classfilterdata_object_of_objects_key_to_obj.cf index 44abb20b80..861f744dcc 100644 --- a/tests/acceptance/01_vars/02_functions/classfilterdata_object_of_objects_key_to_obj.cf +++ b/tests/acceptance/01_vars/02_functions/classfilterdata_object_of_objects_key_to_obj.cf @@ -32,8 +32,7 @@ bundle agent test } }'; - "actual" - data => classfilterdata("@(test)", "object_of_objects"); + "actual" data => classfilterdata("@(test)", "object_of_objects"); classes: "bar"; @@ -43,7 +42,8 @@ bundle agent check { vars: "expected" - string => storejson('{ + string => storejson( + '{ "foo|bar": { "mode": "644", "owner": "root", @@ -56,18 +56,20 @@ bundle agent check "group": "root", "file": "/etc/apt/apt.conf" } - }'); - "actual" - string => storejson("@(test.actual)"); + }' + ); + + "actual" string => storejson("@(test.actual)"); classes: - "ok" - expression => strcmp("$(expected)", "$(actual)"); + "ok" expression => strcmp("$(expected)", "$(actual)"); reports: - "Expected: '$(expected)', actual: '$(actual)'"; + "Expected: '$(expected)', actual: '$(actual)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/classmatch.cf b/tests/acceptance/01_vars/02_functions/classmatch.cf index 0934fc81f8..4fe9de3948 100644 --- a/tests/acceptance/01_vars/02_functions/classmatch.cf +++ b/tests/acceptance/01_vars/02_functions/classmatch.cf @@ -1,34 +1,56 @@ # Test that classmatch works correctly - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle common init { classes: - "test_fbeae67f3e347b5e0032302200141131" expression => "any", meta => { "x" }; - "test_fbeae67f3e347b5e0032302200141131_1" expression => "any", meta => { "x" }; - "test_fbeae67f3e347b5e0032302200141131_2" expression => "any", meta => { "y" }; + "test_fbeae67f3e347b5e0032302200141131" + expression => "any", + meta => { "x" }; + + "test_fbeae67f3e347b5e0032302200141131_1" + expression => "any", + meta => { "x" }; + + "test_fbeae67f3e347b5e0032302200141131_2" + expression => "any", + meta => { "y" }; } bundle common test { classes: - "have_classes" expression => classmatch("test_fbeae67f3e347b5e0032302200141131"); - "have_x_classes" expression => classmatch("test_fbeae67f3e347b5e0032302200141131_1.*", "x"); - "have_z_classes" expression => classmatch("nosuchclass"); - "have_z_classes" expression => classmatch("test_fbeae67f3e347b5e0032302200141131_2", "z"); - "have_z_classes" expression => classmatch("test_fbeae67f3e347b5e0032302200141131_2.*", "z"); + "have_classes" + expression => classmatch("test_fbeae67f3e347b5e0032302200141131"); + + "have_x_classes" + expression => classmatch( + "test_fbeae67f3e347b5e0032302200141131_1.*", "x" + ); + + "have_z_classes" expression => classmatch("nosuchclass"); + + "have_z_classes" + expression => classmatch("test_fbeae67f3e347b5e0032302200141131_2", "z"); + + "have_z_classes" + expression => classmatch( + "test_fbeae67f3e347b5e0032302200141131_2.*", "z" + ); } bundle agent check { - methods: - "" usebundle => dcs_passif_expected("have_classes,have_x_classes", - "have_z_classes", - $(this.promise_filename)), + methods: + "" + usebundle => dcs_passif_expected( + "have_classes,have_x_classes", + "have_z_classes", + $(this.promise_filename) + ), inherit => "true"; } diff --git a/tests/acceptance/01_vars/02_functions/countlinesmatching.cf b/tests/acceptance/01_vars/02_functions/countlinesmatching.cf index f08754eee0..18d42cfa8b 100644 --- a/tests/acceptance/01_vars/02_functions/countlinesmatching.cf +++ b/tests/acceptance/01_vars/02_functions/countlinesmatching.cf @@ -1,9 +1,8 @@ # Test that countlinesmatching works correctly - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle common init @@ -13,32 +12,43 @@ bundle common init bundle agent test { vars: - # meta comment 1 - # meta comment 2 - # meta comment 3 - # meta comment 4 - "metagrep" int => countlinesmatching(".*# meta comment.*", - $(this.promise_filename)); - "exactgrep" int => countlinesmatching("bundle agent test", - $(this.promise_filename)); - "nullgrep" int => countlinesmatching("blue hippo, purple elephant, yellow submarine", - $(this.promise_filename)); + # meta comment 1 + # meta comment 2 + # meta comment 3 + # meta comment 4 + "metagrep" + int => countlinesmatching(".*# meta comment.*", $(this.promise_filename)); + + "exactgrep" + int => countlinesmatching("bundle agent test", $(this.promise_filename)); + + "nullgrep" + int => countlinesmatching( + "blue hippo, purple elephant, yellow submarine", + $(this.promise_filename) + ); } bundle agent check { classes: - "ok" and => { strcmp("$(test.metagrep)", "5"), # the 4 comments plus the pattern! - strcmp("$(test.exactgrep)", "1"), - strcmp("$(test.nullgrep)", "0") }; + "ok" + and => { + strcmp("$(test.metagrep)", "5"), + # the 4 comments plus the pattern! + strcmp("$(test.exactgrep)", "1"), + strcmp("$(test.nullgrep)", "0"), + }; reports: DEBUG:: "Grepping for 'meta comment' found $(test.metagrep) matches, expected 5"; "Grepping for exactly 'bundle agent test' found $(test.exactgrep) matches, expected 1"; "Grepping for children's rhyme found $(test.nullgrep) matches, expected 0"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/countlinesmatching_errors_on_absent_file.cf b/tests/acceptance/01_vars/02_functions/countlinesmatching_errors_on_absent_file.cf index f5f6c6fe8b..7df7778733 100644 --- a/tests/acceptance/01_vars/02_functions/countlinesmatching_errors_on_absent_file.cf +++ b/tests/acceptance/01_vars/02_functions/countlinesmatching_errors_on_absent_file.cf @@ -3,49 +3,47 @@ # Test countlinesmatching() errors when file is absent # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - ####################################################### - bundle agent test { meta: - "description" -> { "CFE-3234" } - string => "Test that the agent emits error output when countlinesmatching() is used on a file that is inaccessible."; + "description" -> { "CFE-3234" } + string => "Test that the agent emits error output when countlinesmatching() is used on a file that is inaccessible."; - "test_skip_needs_work" - string => "windows", - meta => { "CFE-3234" }; + "test_skip_needs_work" + string => "windows", + meta => { "CFE-3234" }; vars: - - "subout" string => execresult("$(sys.cf_agent) -Kv --define AUTO -f $(this.promise_dirname)/countlinesmatching_returns_0_on_inaccessable_file.cf 2>&1 | $(G.grep) countlinesmatching", "useshell"); - + "subout" + string => execresult( + "$(sys.cf_agent) -Kv --define AUTO -f $(this.promise_dirname)/countlinesmatching_returns_0_on_inaccessable_file.cf 2>&1 | $(G.grep) countlinesmatching", + "useshell" + ); } ####################################################### - bundle agent check { - vars: - "expression" string => ".* error: File '/asd/fgh/qwertyio0p' could not be read in countlinesmatching.*"; + "expression" + string => ".* error: File '/asd/fgh/qwertyio0p' could not be read in countlinesmatching.*"; classes: - "__pass" expression => regcmp( $(expression), $(test.subout) ); + "__pass" expression => regcmp($(expression), $(test.subout)); methods: + __pass:: + "Pass" usebundle => dcs_pass($(this.promise_filename)); - __pass:: - "Pass" usebundle => dcs_pass( $(this.promise_filename) ); - !__pass:: - "FAIL" usebundle => dcs_pass( $(this.promise_filename) ); + !__pass:: + "FAIL" usebundle => dcs_pass($(this.promise_filename)); } diff --git a/tests/acceptance/01_vars/02_functions/countlinesmatching_returns_0_on_inaccessable_file.cf b/tests/acceptance/01_vars/02_functions/countlinesmatching_returns_0_on_inaccessable_file.cf index e3983c257f..514d65a20a 100644 --- a/tests/acceptance/01_vars/02_functions/countlinesmatching_returns_0_on_inaccessable_file.cf +++ b/tests/acceptance/01_vars/02_functions/countlinesmatching_returns_0_on_inaccessable_file.cf @@ -3,50 +3,45 @@ # Test countlinesmatching() with some kind of failure expected # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "description" -> { "Mantis 320", "CFE-3234" } - string => "Test that countlinesmatching() returns 0 when the file is inaccessible."; + "description" -> { "Mantis 320", "CFE-3234" } + string => "Test that countlinesmatching() returns 0 when the file is inaccessible."; vars: - "zero_regex" string => "impossible line"; - - "fail" int => countlinesmatching("$(zero_regex)", "/asd/fgh/qwertyio0p"); + "zero_regex" string => "impossible line"; + "fail" int => countlinesmatching("$(zero_regex)", "/asd/fgh/qwertyio0p"); } ####################################################### - bundle agent check { classes: - "ok" and => { - strcmp("$(test.fail)", "0"), - }; + "ok" and => { strcmp("$(test.fail)", "0") }; reports: DEBUG:: "Expected 0 matches to '$(test.zero_regex)', found $(test.fail)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/data_expand.cf b/tests/acceptance/01_vars/02_functions/data_expand.cf index d1fef6916e..a885772a69 100644 --- a/tests/acceptance/01_vars/02_functions/data_expand.cf +++ b/tests/acceptance/01_vars/02_functions/data_expand.cf @@ -3,31 +3,31 @@ # Test data_expand() # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent test { vars: - "x" string => "foo"; - "y" int => "200"; - "load_unexpanded" data => readjson("$(this.promise_filename).json", inf); - "load_expanded" data => data_expand(load_unexpanded); + "x" string => "foo"; + "y" int => "200"; + "load_unexpanded" data => readjson("$(this.promise_filename).json", inf); + "load_expanded" data => data_expand(load_unexpanded); } ########################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/data_expand.cf.json b/tests/acceptance/01_vars/02_functions/data_expand.cf.json index ab7016be70..fb7b70f3dd 100644 --- a/tests/acceptance/01_vars/02_functions/data_expand.cf.json +++ b/tests/acceptance/01_vars/02_functions/data_expand.cf.json @@ -1,5 +1,5 @@ { - "plain data": "nothing", - "$(x)": "nothing again", - "$(y)": "$(nosuchvar)" + "plain data": "nothing", + "$(x)": "nothing again", + "$(y)": "$(nosuchvar)" } diff --git a/tests/acceptance/01_vars/02_functions/data_readstringarray.cf b/tests/acceptance/01_vars/02_functions/data_readstringarray.cf index 9ed03a1e4d..2deb1f0857 100644 --- a/tests/acceptance/01_vars/02_functions/data_readstringarray.cf +++ b/tests/acceptance/01_vars/02_functions/data_readstringarray.cf @@ -1,10 +1,9 @@ # Redmine#2926: test long lines with readstringarrayidx() - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -14,13 +13,13 @@ bundle agent init bundle agent test { vars: - "params" data => data_readstringarray("$(this.promise_filename).txt", - "\s*#[^\n]*", - ";", - 9999, - 99999); - "params_str" string => format("%S", params); - "pk" slist => getindices(params); + "params" + data => data_readstringarray( + "$(this.promise_filename).txt", "\s*#[^\n]*", ";", 9999, 99999 + ); + + "params_str" string => format("%S", params); + "pk" slist => getindices(params); reports: DEBUG:: @@ -30,31 +29,41 @@ bundle agent test bundle agent check { vars: - "dim" int => length("test.params"); - "length" int => length("test.pk"); - "last" string => nth("test.value", 599); + "dim" int => length("test.params"); + "length" int => length("test.pk"); + "last" string => nth("test.value", 599); + classes: - "ok1" expression => strcmp($(dim), "3"); - "ok2" expression => strcmp($(dim), $(length)); - "ok3" expression => strcmp("$(test.params[not_working_app_config][0])", "9123"); - "ok" and => { "ok1", "ok2", "ok3" }; + "ok1" expression => strcmp($(dim), "3"); + "ok2" expression => strcmp($(dim), $(length)); + + "ok3" + expression => strcmp("$(test.params[not_working_app_config][0])", "9123"); + + "ok" and => { "ok1", "ok2", "ok3" }; reports: DEBUG.ok1:: "passed1"; + DEBUG.ok2:: "passed2"; + DEBUG.ok3:: "passed3"; + DEBUG.!ok1:: "failed1 $(dim) != 3"; + DEBUG.!ok2:: "failed2 $(dim) != $(length)"; + DEBUG.!ok3:: "failed3 $(test.params[not_working_app_config][0]) != 9123"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/data_readstringarrayidx.cf b/tests/acceptance/01_vars/02_functions/data_readstringarrayidx.cf index 2d4b2b99df..9d2c50e2fd 100644 --- a/tests/acceptance/01_vars/02_functions/data_readstringarrayidx.cf +++ b/tests/acceptance/01_vars/02_functions/data_readstringarrayidx.cf @@ -1,10 +1,9 @@ # Redmine#2926: test long lines with readstringarrayidx() - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -14,13 +13,13 @@ bundle agent init bundle agent test { vars: - "params" data => data_readstringarrayidx("$(this.promise_filename).txt", - "\s*#[^\n]*", - ";", - 9999, - 99999); - "params_str" string => format("%S", params); - "pk" slist => getindices(params); + "params" + data => data_readstringarrayidx( + "$(this.promise_filename).txt", "\s*#[^\n]*", ";", 9999, 99999 + ); + + "params_str" string => format("%S", params); + "pk" slist => getindices(params); reports: DEBUG:: @@ -30,45 +29,57 @@ bundle agent test bundle agent check { vars: - "dim" int => length("test.params"); - "length" int => length("test.pk"); - "last" string => nth("test.value", 599); - - "pluck_23" data => mergedata("test.params[22]"); - "pluck_24" data => mergedata("test.params[23]"); + "dim" int => length("test.params"); + "length" int => length("test.pk"); + "last" string => nth("test.value", 599); + "pluck_23" data => mergedata("test.params[22]"); + "pluck_24" data => mergedata("test.params[23]"); classes: - "ok1" expression => strcmp($(dim), "24"); - "ok2" expression => strcmp($(dim), $(length)); - "ok3" expression => strcmp("$(test.params[2][0])", "not_working_app_config"); - "ok4" expression => strcmp("$(pluck_24[0])", "LAST"); - "ok5" expression => strcmp("$(pluck_23[0])", "NEXT-TO-LAST"); - "ok" and => { "ok1", "ok2", "ok3", "ok4", "ok5" }; + "ok1" expression => strcmp($(dim), "24"); + "ok2" expression => strcmp($(dim), $(length)); + + "ok3" + expression => strcmp("$(test.params[2][0])", "not_working_app_config"); + + "ok4" expression => strcmp("$(pluck_24[0])", "LAST"); + "ok5" expression => strcmp("$(pluck_23[0])", "NEXT-TO-LAST"); + "ok" and => { "ok1", "ok2", "ok3", "ok4", "ok5" }; reports: DEBUG.ok1:: "passed1"; + DEBUG.ok2:: "passed2"; + DEBUG.ok3:: "passed3"; + DEBUG.ok4:: "passed4"; + DEBUG.ok5:: "passed5"; + DEBUG.!ok1:: "failed1 $(dim) != 24"; + DEBUG.!ok2:: "failed2 $(dim) != $(length)"; + DEBUG.!ok3:: "failed3 $(test.params[2][0]) != not_working_app_config"; + DEBUG.!ok4:: "failed4 $(pluck_24[0]) != LAST"; + DEBUG.!ok5:: "failed5 $(pluck_23[0]) != NEXT-TO-LAST"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/data_regextract-2.cf b/tests/acceptance/01_vars/02_functions/data_regextract-2.cf index 3e0c8f9951..3bb8b6ead4 100644 --- a/tests/acceptance/01_vars/02_functions/data_regextract-2.cf +++ b/tests/acceptance/01_vars/02_functions/data_regextract-2.cf @@ -1,54 +1,61 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent test { meta: - "description" -> { "CFE-3171" } - string => "test that data_regextract uses a multiline regex"; + "description" -> { "CFE-3171" } + string => "test that data_regextract uses a multiline regex"; vars: - "file" string => "$(this.promise_filename).readfile"; - - # Note the newline at the end of the file was included in the backreference. - # Per http://www.pcre.org/current/doc/html/pcre2syntax.html#SEC4 that means the regex is being run in “dotall” mode. - # Dotall mode doesn’t necessarily imply multiline mode, but a “$” matching before an internal newline does (per http://www.pcre.org/current/doc/html/pcre2syntax.html#SEC10) - "instance_guid_until_eof" - data => data_regextract( "^guid\s+=\s+(?.*)$", - readfile ( $(file), inf )); - - "instance_guid" - data => data_regextract( "^guid\s+=\s+(?[^\n]*)", - readfile( $(file), inf )); - - "instance_port" - data => data_regextract( "^port\s?+=\s?+(?[^\n]*)", - readfile( $(file), inf )); + "file" string => "$(this.promise_filename).readfile"; + + # Note the newline at the end of the file was included in the backreference. + # Per http://www.pcre.org/current/doc/html/pcre2syntax.html#SEC4 that means the regex is being run in “dotall” mode. + # Dotall mode doesn’t necessarily imply multiline mode, but a “$” matching before an internal newline does (per http://www.pcre.org/current/doc/html/pcre2syntax.html#SEC10) + "instance_guid_until_eof" + data => data_regextract( + "^guid\s+=\s+(?.*)$", readfile($(file), inf) + ); + + "instance_guid" + data => data_regextract( + "^guid\s+=\s+(?[^\n]*)", readfile($(file), inf) + ); + + "instance_port" + data => data_regextract( + "^port\s?+=\s?+(?[^\n]*)", readfile($(file), inf) + ); } + bundle agent check { classes: - "pass" - and => { - strcmp( "$(test.instance_guid[value])", - "9CB197F0-4569-446A-A987-1DDEC1205F6B"), - strcmp( "$(test.instance_port[value])", - "5308"), - strcmp( "$(test.instance_guid_until_eof[value])", - "9CB197F0-4569-446A-A987-1DDEC1205F6B$(const.n)port=5308"), + "pass" + and => { + strcmp( + "$(test.instance_guid[value])", + "9CB197F0-4569-446A-A987-1DDEC1205F6B" + ), + strcmp("$(test.instance_port[value])", "5308"), + strcmp( + "$(test.instance_guid_until_eof[value])", + "9CB197F0-4569-446A-A987-1DDEC1205F6B$(const.n)port=5308" + ), }; reports: - DEBUG:: + DEBUG:: "expect test.instance_guid[value] '$(test.instance_guid[value])' == '9CB197F0-4569-446A-A987-1DDEC1205F6B'"; "expect test.instance_port[value] '$(test.instance_port[value])' == '5308'"; "expect test.instance_guid_until_eof[value] '$(test.instance_guid_until_eof[value])' == '9CB197F0-4569-446A-A987-1DDEC1205F6B$(const.n)port=5308'"; methods: - "Result" - usebundle => dcs_passif( "pass", $(this.promise_filename) ), - inherit => "true"; + "Result" + usebundle => dcs_passif("pass", $(this.promise_filename)), + inherit => "true"; } diff --git a/tests/acceptance/01_vars/02_functions/data_regextract.cf b/tests/acceptance/01_vars/02_functions/data_regextract.cf index 82ff3e04d0..24cbff7ceb 100644 --- a/tests/acceptance/01_vars/02_functions/data_regextract.cf +++ b/tests/acceptance/01_vars/02_functions/data_regextract.cf @@ -1,25 +1,35 @@ # data_regextract() test - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent test { vars: - "patterns" data => parsejson('["^(?...)(...)(..)-(?...)-(..).*", "", ".*", "(?...)"]'); - "plength" int => length(patterns); - "pi" slist => expandrange("[0-$(plength)]", 1); # this is one more than the valid indices + "patterns" + data => parsejson( + '["^(?...)(...)(..)-(?...)-(..).*", "", ".*", "(?...)"]' + ); + + "plength" int => length(patterns); + "pi" slist => expandrange("[0-$(plength)]", 1); + + # this is one more than the valid indices + "strings" + data => parsejson( + '[ "abcdef12-345-67andsoon", "", "!!!", "one two three"]' + ); - "strings" data => parsejson('[ "abcdef12-345-67andsoon", "", "!!!", "one two three"]'); - "slength" int => length(strings); - "si" slist => expandrange("[0-$(slength)]", 1); # this is one more than the valid indices + "slength" int => length(strings); + "si" slist => expandrange("[0-$(slength)]", 1); - "parsed_$(pi)_$(si)" data => data_regextract(nth(patterns, $(pi)), - nth(strings, $(si))); - "parsed_$(pi)_$(si)_str" string => format("%S", "parsed_$(pi)_$(si)"); + # this is one more than the valid indices + "parsed_$(pi)_$(si)" + data => data_regextract(nth(patterns, $(pi)), nth(strings, $(si))); + + "parsed_$(pi)_$(si)_str" string => format("%S", "parsed_$(pi)_$(si)"); reports: EXTRA:: @@ -29,7 +39,8 @@ bundle agent test bundle agent check { vars: - "actual" string => " + "actual" + string => " 0 0 $(test.parsed_0_0_str) 1 0 $(test.parsed_1_0_str) @@ -47,7 +58,8 @@ bundle agent check 3 3 $(test.parsed_3_3_str) "; - "expected" string => ' + "expected" + string => ' 0 0 {"0":"abcdef12-345-67andsoon","2":"def","3":"12","5":"67","name1":"abc","name2":"345"} 1 0 {"0":""} @@ -66,8 +78,8 @@ bundle agent check '; methods: - "" usebundle => dcs_check_strcmp($(actual), $(expected), - $(this.promise_filename), - "no"); - + "" + usebundle => dcs_check_strcmp( + $(actual), $(expected), $(this.promise_filename), "no" + ); } diff --git a/tests/acceptance/01_vars/02_functions/datastate.cf b/tests/acceptance/01_vars/02_functions/datastate.cf index 36ce5d8b7d..2883442eff 100644 --- a/tests/acceptance/01_vars/02_functions/datastate.cf +++ b/tests/acceptance/01_vars/02_functions/datastate.cf @@ -1,63 +1,80 @@ # Test that the datastate() function gives good data - body common control { - inputs => { "../../default.sub.cf", "datastate.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "datastate.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { classes: - "a" expression => "any", scope => "namespace"; - "b" expression => "any"; - "c" expression => "!any"; + "a" + expression => "any", + scope => "namespace"; + + "b" expression => "any"; + "c" expression => "!any"; vars: - "x" string => "1"; - "y" data => parsejson('{"ykey":["yvalue1", "yvalue2"]}'); - "z" slist => { "z1", "z2", "z3" }; + "x" string => "1"; + "y" data => parsejson('{"ykey":["yvalue1", "yvalue2"]}'); + "z" slist => { "z1", "z2", "z3" }; } bundle agent test { vars: - "state" data => datastate(); + "state" data => datastate(); } bundle agent check { vars: - "init_state_str" string => format("%S", "test.state[vars][init]"); - "ns_state_str" string => format("%S", "test.state[vars][visible_namespace:included]"); - "known_classes" slist => getindices("test.state[classes]"); - "printed_classes" string => format("%S", known_classes); - "init_expected" string => '{"x":"1","y":{"ykey":["yvalue1","yvalue2"]},"z":["z1","z2","z3"]}'; - "ns_expected" string => '{"i":"1","j":"two","k":["k2","everest"],"l":[1,"l","|"]}'; + "init_state_str" string => format("%S", "test.state[vars][init]"); + + "ns_state_str" + string => format("%S", "test.state[vars][visible_namespace:included]"); + + "known_classes" slist => getindices("test.state[classes]"); + "printed_classes" string => format("%S", known_classes); + + "init_expected" + string => '{"x":"1","y":{"ykey":["yvalue1","yvalue2"]},"z":["z1","z2","z3"]}'; + + "ns_expected" + string => '{"i":"1","j":"two","k":["k2","everest"],"l":[1,"l","|"]}'; classes: - "init_ok" expression => strcmp($(init_state_str), $(init_expected)); - "ns_ok" expression => strcmp($(ns_state_str), $(ns_expected)); - "classes_ok" and => { some("cfengine_3", known_classes), - some("a", known_classes), - some("visible_namespace:foo", known_classes) }; - "ok" and => { "init_ok", "ns_ok", "classes_ok" }; + "init_ok" expression => strcmp($(init_state_str), $(init_expected)); + "ns_ok" expression => strcmp($(ns_state_str), $(ns_expected)); + + "classes_ok" + and => { + some("cfengine_3", known_classes), + some("a", known_classes), + some("visible_namespace:foo", known_classes), + }; + + "ok" and => { "init_ok", "ns_ok", "classes_ok" }; reports: DEBUG.!ns_ok:: "visible_namespace:included data state is $(ns_state_str)"; "expected visible_namespace:included state is $(ns_expected)"; "expected state != visible_namespace:included data state"; + DEBUG.!init_ok:: "init data state is $(init_state_str)"; "expected init state is $(init_expected)"; "expected init state != init data state"; + DEBUG.!classes_ok:: "expected classes a, visible_namespace:foo, and cfengine_3 were not in $(printed_classes)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/dirname.cf b/tests/acceptance/01_vars/02_functions/dirname.cf index f32efdc054..20cb9f2b28 100644 --- a/tests/acceptance/01_vars/02_functions/dirname.cf +++ b/tests/acceptance/01_vars/02_functions/dirname.cf @@ -3,148 +3,128 @@ # Test dirname() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - # The tests starting with template will be tested with both types of - # directory separators on Windows. - - "template_input[root]" string => "/"; - "template_expected[root]" string => "/"; - - "template_input[simple]" string => "/foo/bar"; - "template_expected[simple]" string => "/foo"; - - "template_input[slash]" string => "/foo/bar/"; - "template_expected[slash]" string => "/foo"; - - "template_input[sub]" string => "/foo"; - "template_expected[sub]" string => "/"; - - "template_input[subslash]" string => "/foo/"; - "template_expected[subslash]" string => "/"; - - "template_input[dot]" string => "/foo/."; - "template_expected[dot]" string => "/foo"; - - "template_input[dot_subslash]" string => "/foo/./"; - "template_expected[dot_subslash]" string => "/foo"; - - "template_input[multi]" string => "/foo/bar/baz"; - "template_expected[multi]" string => "/foo/bar"; - - "template_input[multislash]" string => "/foo/bar/baz/"; - "template_expected[multislash]" string => "/foo/bar"; - - "template_input[more]" string => "/a/b/c/d/e/f/g/h/i"; - "template_expected[more]" string => "/a/b/c/d/e/f/g/h"; - - "template_input[multislash]" string => "/a///b////c///"; - "template_expected[multislash]" string => "/a/b"; - - # Note: no template, because backslashes will be interpreted as UNC path on Windows. - "input[multislash_start]" string => "//a///b////c///"; - "expected[multislash_start]" string => "/a/b"; - - "template_input[rel_one]" string => "foo"; - "template_expected[rel_one]" string => "."; - - "template_input[rel_more]" string => "foo/bar"; - "template_expected[rel_more]" string => "foo"; - - "template_input[rel_one_subslash]" string => "foo/"; - "template_expected[rel_one_subslash]" string => "."; - - "template_input[rel_more_subslash]" string => "foo/bar/"; - "template_expected[rel_more_subslash]" string => "foo"; - - "template_input[rel_dot]" string => "foo/."; - "template_expected[rel_dot]" string => "foo"; - - "template_input[rel_only_dot]" string => "./"; - "template_expected[rel_only_dot]" string => "."; - - "template_input[rel_multislash]" string => "a///b////c///"; - "template_expected[rel_multislash]" string => "a/b"; - - "template_input[noop]" string => ""; - "template_expected[noop]" string => ""; - - "template_keys" slist => getindices("template_input"); + # The tests starting with template will be tested with both types of + # directory separators on Windows. + "template_input[root]" string => "/"; + "template_expected[root]" string => "/"; + "template_input[simple]" string => "/foo/bar"; + "template_expected[simple]" string => "/foo"; + "template_input[slash]" string => "/foo/bar/"; + "template_expected[slash]" string => "/foo"; + "template_input[sub]" string => "/foo"; + "template_expected[sub]" string => "/"; + "template_input[subslash]" string => "/foo/"; + "template_expected[subslash]" string => "/"; + "template_input[dot]" string => "/foo/."; + "template_expected[dot]" string => "/foo"; + "template_input[dot_subslash]" string => "/foo/./"; + "template_expected[dot_subslash]" string => "/foo"; + "template_input[multi]" string => "/foo/bar/baz"; + "template_expected[multi]" string => "/foo/bar"; + "template_input[multislash]" string => "/foo/bar/baz/"; + "template_expected[multislash]" string => "/foo/bar"; + "template_input[more]" string => "/a/b/c/d/e/f/g/h/i"; + "template_expected[more]" string => "/a/b/c/d/e/f/g/h"; + "template_input[multislash]" string => "/a///b////c///"; + "template_expected[multislash]" string => "/a/b"; + + # Note: no template, because backslashes will be interpreted as UNC path on Windows. + "input[multislash_start]" string => "//a///b////c///"; + "expected[multislash_start]" string => "/a/b"; + "template_input[rel_one]" string => "foo"; + "template_expected[rel_one]" string => "."; + "template_input[rel_more]" string => "foo/bar"; + "template_expected[rel_more]" string => "foo"; + "template_input[rel_one_subslash]" string => "foo/"; + "template_expected[rel_one_subslash]" string => "."; + "template_input[rel_more_subslash]" string => "foo/bar/"; + "template_expected[rel_more_subslash]" string => "foo"; + "template_input[rel_dot]" string => "foo/."; + "template_expected[rel_dot]" string => "foo"; + "template_input[rel_only_dot]" string => "./"; + "template_expected[rel_only_dot]" string => "."; + "template_input[rel_multislash]" string => "a///b////c///"; + "template_expected[rel_multislash]" string => "a/b"; + "template_input[noop]" string => ""; + "template_expected[noop]" string => ""; + "template_keys" slist => getindices("template_input"); windows:: "template_input[full_root]" string => "C:/"; "template_expected[full_root]" string => "C:/"; - "template_input[full_root_file]" string => "C:/foo"; "template_expected[full_root_file]" string => "C:/"; - "template_input[full_root_file_subslash]" string => "C:/foo/"; "template_expected[full_root_file_subslash]" string => "C:/"; - "template_input[full_file]" string => "C:/foo/bar"; "template_expected[full_file]" string => "C:/foo"; - "template_input[full_file_subslash]" string => "C:/foo/bar/"; "template_expected[full_file_subslash]" string => "C:/foo"; - "template_input[dir]" string => "C:foo"; "template_expected[dir]" string => "C:."; - "template_input[two_dirs]" string => "C:foo/bar"; "template_expected[two_dirs]" string => "C:foo"; - "template_input[dir_subslash]" string => "C:foo/"; "template_expected[dir_subslash]" string => "C:."; - "template_input[two_dirs_subslash]" string => "C:foo/bar/"; "template_expected[two_dirs_subslash]" string => "C:foo"; # UNC paths don't have forward slash equivalents. "input[native_unc_one]" string => "\\\\foo"; "expected[native_unc_one]" string => "\\\\"; - "input[native_unc_two]" string => "\\\\foo\\bar"; "expected[native_unc_two]" string => "\\\\foo"; - "input[native_unc_three]" string => "\\\\foo\\bar\\charlie\\"; "expected[native_unc_three]" string => "\\\\foo\\bar"; + "input[unix_$(template_keys)]" + string => "$(template_input[$(template_keys)])"; + + "input[native_$(template_keys)]" + string => translatepath("$(template_input[$(template_keys)])"); + + "expected[unix_$(template_keys)]" + string => "$(template_expected[$(template_keys)])"; + + "expected[native_$(template_keys)]" + string => translatepath("$(template_expected[$(template_keys)])"); - "input[unix_$(template_keys)]" string => "$(template_input[$(template_keys)])"; - "input[native_$(template_keys)]" string => translatepath("$(template_input[$(template_keys)])"); - "expected[unix_$(template_keys)]" string => "$(template_expected[$(template_keys)])"; - "expected[native_$(template_keys)]" string => translatepath("$(template_expected[$(template_keys)])"); !windows:: - "input[native_$(template_keys)]" string => "$(template_input[$(template_keys)])"; - "expected[native_$(template_keys)]" string => "$(template_expected[$(template_keys)])"; + "input[native_$(template_keys)]" + string => "$(template_input[$(template_keys)])"; + + "expected[native_$(template_keys)]" + string => "$(template_expected[$(template_keys)])"; any:: "keys" slist => getindices("input"); - "actual[$(keys)]" string => dirname("$(input[$(keys)])"); } ####################################################### - bundle agent check { vars: - "keys" slist => { @(test.keys) }; + "keys" slist => { @(test.keys) }; classes: - "failed_cmp_$(keys)" not => strcmp(dirname("$(test.input[$(keys)])"), "$(test.expected[$(keys)])"); - "ok" not => classmatch("failed_cmp_.*"); + "failed_cmp_$(keys)" + not => strcmp( + dirname("$(test.input[$(keys)])"), "$(test.expected[$(keys)])" + ); + + "ok" not => classmatch("failed_cmp_.*"); reports: DEBUG:: @@ -153,6 +133,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/eval.cf b/tests/acceptance/01_vars/02_functions/eval.cf index 62bdc00e18..1273fdf046 100644 --- a/tests/acceptance/01_vars/02_functions/eval.cf +++ b/tests/acceptance/01_vars/02_functions/eval.cf @@ -3,154 +3,194 @@ # Test eval() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "values[0]" string => "x"; - "values[1]" string => "+ 200"; - "values[2]" string => "200 + 100"; - "values[3]" string => "200 - 100"; - "values[4]" string => "- - -"; - "values[5]" string => "2 - (3 - 1)"; - "values[6]" string => ""; - "values[7]" string => "3 / 0"; - "values[8]" string => "3^3"; - "values[9]" string => "(-1)^2"; - "values[10]" string => "sin(20)"; - "values[11]" string => "cos(20)"; - "values[12]" string => "asin(0.2)"; - "values[13]" string => "acos(0.2)"; - "values[14]" string => "tan(20)"; - "values[15]" string => "atan(0.2)"; - "values[16]" string => "log(0.2)"; - "values[17]" string => "ln2"; - "values[18]" string => "ln10"; - "values[19]" string => "20 % 3"; - "values[20]" string => "sqrt(0.2)"; - "values[21]" string => "ceil(3.5)"; - "values[22]" string => "floor(3.4)"; - "values[23]" string => "abs(-3.4)"; - "values[24]" string => "-3.4 -3.4"; - "values[25]" string => "-3.400000 -3.400001"; - "values[26]" string => "pi"; - "values[27]" string => "e"; - "values[28]" string => "10 == 10"; - "values[29]" string => "10 == 11"; - "values[30]" string => "3**0"; - "values[31]" string => "step(10)"; - "values[32]" string => "step(-10)"; - "values[33]" string => "100k"; - "values[34]" string => "(200m - 100k) / (2t + 2t)"; - "values[35]" string => "10 > 10"; - "values[36]" string => "10 > 11"; - "values[37]" string => "10 >= 10"; - "values[38]" string => "10 >= 11"; - "values[39]" string => "10 < 10"; - "values[40]" string => "10 < 11"; - "values[41]" string => "10 <= 10"; - "values[42]" string => "10 <= 11"; - "values[43]" -> { "CFE-2762" } string => "1 * .75"; + "values[0]" string => "x"; + "values[1]" string => "+ 200"; + "values[2]" string => "200 + 100"; + "values[3]" string => "200 - 100"; + "values[4]" string => "- - -"; + "values[5]" string => "2 - (3 - 1)"; + "values[6]" string => ""; + "values[7]" string => "3 / 0"; + "values[8]" string => "3^3"; + "values[9]" string => "(-1)^2"; + "values[10]" string => "sin(20)"; + "values[11]" string => "cos(20)"; + "values[12]" string => "asin(0.2)"; + "values[13]" string => "acos(0.2)"; + "values[14]" string => "tan(20)"; + "values[15]" string => "atan(0.2)"; + "values[16]" string => "log(0.2)"; + "values[17]" string => "ln2"; + "values[18]" string => "ln10"; + "values[19]" string => "20 % 3"; + "values[20]" string => "sqrt(0.2)"; + "values[21]" string => "ceil(3.5)"; + "values[22]" string => "floor(3.4)"; + "values[23]" string => "abs(-3.4)"; + "values[24]" string => "-3.4 -3.4"; + "values[25]" string => "-3.400000 -3.400001"; + "values[26]" string => "pi"; + "values[27]" string => "e"; + "values[28]" string => "10 == 10"; + "values[29]" string => "10 == 11"; + "values[30]" string => "3**0"; + "values[31]" string => "step(10)"; + "values[32]" string => "step(-10)"; + "values[33]" string => "100k"; + "values[34]" string => "(200m - 100k) / (2t + 2t)"; + "values[35]" string => "10 > 10"; + "values[36]" string => "10 > 11"; + "values[37]" string => "10 >= 10"; + "values[38]" string => "10 >= 11"; + "values[39]" string => "10 < 10"; + "values[40]" string => "10 < 11"; + "values[41]" string => "10 <= 10"; + "values[42]" string => "10 <= 11"; + + "values[43]" -> { "CFE-2762" } + string => "1 * .75"; } - ####################################################### - bundle agent test { vars: - "indices" slist => getindices("init.values"); + "indices" slist => getindices("init.values"); - # convert the result to lowercase because some platforms use 'inf' - # and others 'Inf' and others... you don't wanna know - "eval[$(indices)]" string => string_downcase(eval("$(init.values[$(indices)])")); + # convert the result to lowercase because some platforms use 'inf' + # and others 'Inf' and others... you don't wanna know + "eval[$(indices)]" + string => string_downcase(eval("$(init.values[$(indices)])")); } - ####################################################### - bundle agent check { vars: - # note this test will be MUCH more accurate when we have sprintf and rounding - "verify[0]" string => ''; - "verify[1]" string => ''; - "verify[2]" string => '300.000000'; - "verify[3]" string => '100.000000'; - "verify[4]" string => ''; - "verify[5]" string => '0.000000'; - "verify[6]" string => '0.000000'; - "verify[7]" string => 'inf'; - "verify[8]" string => '27.000000'; - "verify[9]" string => '1.000000'; - "verify[10]" string => '0.912945'; - "verify[11]" string => '0.408082'; - "verify[12]" string => '0.201358'; - "verify[13]" string => '1.369438'; - "verify[14]" string => '2.237161'; - "verify[15]" string => '0.197396'; - "verify[16]" string => '-1.609438'; - "verify[17]" string => '0.693147'; - "verify[18]" string => '2.302585'; - "verify[19]" string => '2.000000'; - "verify[20]" string => '0.447214'; - "verify[21]" string => '4.000000'; - "verify[22]" string => '3.000000'; - "verify[23]" string => '3.400000'; - "verify[24]" string => '-6.800000'; - "verify[25]" string => '-6.800001'; - "verify[26]" string => '3.141593'; - "verify[27]" string => '2.718282'; - "verify[28]" string => '1.000000'; - "verify[29]" string => '0.000000'; - "verify[30]" string => '1.000000'; - "verify[31]" string => '1.000000'; - "verify[32]" string => '0.000000'; - "verify[33]" string => '100000.000000'; - "verify[34]" string => '0.000050'; - "verify[35]" string => '0.000000'; - "verify[36]" string => '0.000000'; - "verify[37]" string => '1.000000'; - "verify[38]" string => '0.000000'; - "verify[39]" string => '0.000000'; - "verify[40]" string => '1.000000'; - "verify[41]" string => '1.000000'; - "verify[42]" string => '1.000000'; - "verify[43]" -> { "CFE-2762" } string => '0.750000'; - - "indices" slist => getindices("verify"); + # note this test will be MUCH more accurate when we have sprintf and rounding + "verify[0]" string => ''; + "verify[1]" string => ''; + "verify[2]" string => '300.000000'; + "verify[3]" string => '100.000000'; + "verify[4]" string => ''; + "verify[5]" string => '0.000000'; + "verify[6]" string => '0.000000'; + "verify[7]" string => 'inf'; + "verify[8]" string => '27.000000'; + "verify[9]" string => '1.000000'; + "verify[10]" string => '0.912945'; + "verify[11]" string => '0.408082'; + "verify[12]" string => '0.201358'; + "verify[13]" string => '1.369438'; + "verify[14]" string => '2.237161'; + "verify[15]" string => '0.197396'; + "verify[16]" string => '-1.609438'; + "verify[17]" string => '0.693147'; + "verify[18]" string => '2.302585'; + "verify[19]" string => '2.000000'; + "verify[20]" string => '0.447214'; + "verify[21]" string => '4.000000'; + "verify[22]" string => '3.000000'; + "verify[23]" string => '3.400000'; + "verify[24]" string => '-6.800000'; + "verify[25]" string => '-6.800001'; + "verify[26]" string => '3.141593'; + "verify[27]" string => '2.718282'; + "verify[28]" string => '1.000000'; + "verify[29]" string => '0.000000'; + "verify[30]" string => '1.000000'; + "verify[31]" string => '1.000000'; + "verify[32]" string => '0.000000'; + "verify[33]" string => '100000.000000'; + "verify[34]" string => '0.000050'; + "verify[35]" string => '0.000000'; + "verify[36]" string => '0.000000'; + "verify[37]" string => '1.000000'; + "verify[38]" string => '0.000000'; + "verify[39]" string => '0.000000'; + "verify[40]" string => '1.000000'; + "verify[41]" string => '1.000000'; + "verify[42]" string => '1.000000'; + + "verify[43]" -> { "CFE-2762" } + string => '0.750000'; + + "indices" slist => getindices("verify"); classes: - "ok_$(indices)" expression => strcmp("$(test.eval[$(indices)])", "$(verify[$(indices)])"); - "not_ok_$(indices)" not => strcmp("$(test.eval[$(indices)])", "$(verify[$(indices)])"); - - "ok" and => { ok_0, ok_1, ok_3, ok_4, ok_5, ok_6, ok_7, ok_8, - ok_9, ok_10, ok_11, ok_13, ok_14, ok_15, ok_16, - ok_17, ok_18, ok_19, ok_20, ok_21, ok_23, ok_24, - ok_25, ok_26, ok_27, ok_28, ok_29, ok_30, ok_31, - ok_32, ok_33, ok_34, ok_35, ok_36, ok_37, ok_38, - ok_39, ok_40, ok_41, ok_42, ok_43 + "ok_$(indices)" + expression => strcmp("$(test.eval[$(indices)])", "$(verify[$(indices)])"); + + "not_ok_$(indices)" + not => strcmp("$(test.eval[$(indices)])", "$(verify[$(indices)])"); + + "ok" + and => { + ok_0, + ok_1, + ok_3, + ok_4, + ok_5, + ok_6, + ok_7, + ok_8, + ok_9, + ok_10, + ok_11, + ok_13, + ok_14, + ok_15, + ok_16, + ok_17, + ok_18, + ok_19, + ok_20, + ok_21, + ok_23, + ok_24, + ok_25, + ok_26, + ok_27, + ok_28, + ok_29, + ok_30, + ok_31, + ok_32, + ok_33, + ok_34, + ok_35, + ok_36, + ok_37, + ok_38, + ok_39, + ok_40, + ok_41, + ok_42, + ok_43, }; reports: DEBUG:: "OK math $(indices) eval('$(init.values[$(indices)])') = '$(test.eval[$(indices)])'" - if => "ok_$(indices)"; + if => "ok_$(indices)"; "FAIL math $(indices) eval('$(init.values[$(indices)])') = '$(test.eval[$(indices)])' (expected '$(verify[$(indices)])')" - if => "not_ok_$(indices)"; + if => "not_ok_$(indices)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/eval_class.cf b/tests/acceptance/01_vars/02_functions/eval_class.cf index 24bcf7d42d..25613d11b9 100644 --- a/tests/acceptance/01_vars/02_functions/eval_class.cf +++ b/tests/acceptance/01_vars/02_functions/eval_class.cf @@ -3,83 +3,82 @@ # Test eval() in class context mode # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "values[0]" string => "x"; - "values[1]" string => "+ 200"; - "values[2]" string => "200 + 100"; - "values[3]" string => "200 - 100"; - "values[4]" string => "- - -"; - "values[5]" string => "2 - (3 - 1)"; - "values[6]" string => ""; - "values[7]" string => "3 / 0"; - "values[8]" string => "3^3"; - "values[9]" string => "(-1)^2"; - "values[10]" string => "sin(20)"; - "values[11]" string => "cos(20)"; - "values[12]" string => "asin(0.2)"; - "values[13]" string => "acos(0.2)"; - "values[14]" string => "tan(20)"; - "values[15]" string => "atan(0.2)"; - "values[16]" string => "log(0.2)"; - "values[17]" string => "ln2"; - "values[18]" string => "ln10"; - "values[19]" string => "20 % 3"; - "values[20]" string => "sqrt(0.2)"; - "values[21]" string => "ceil(3.5)"; - "values[22]" string => "floor(3.4)"; - "values[23]" string => "abs(-3.4)"; - "values[24]" string => "-3.4 -3.4"; - "values[25]" string => "-3.400000 -3.400001"; - "values[26]" string => "pi"; - "values[27]" string => "e"; - "values[28]" string => "10 == 10"; - "values[29]" string => "10 == 11"; - "values[30]" string => "3**0"; - "values[31]" string => "step(10)"; - "values[32]" string => "step(-10)"; - "values[33]" string => "100k"; - "values[34]" string => "(200m - 100k) / (2t + 2t)"; - "values[35]" string => "10 > 10"; - "values[36]" string => "10 > 11"; - "values[37]" string => "10 >= 10"; - "values[38]" string => "10 >= 11"; - "values[39]" string => "10 < 10"; - "values[40]" string => "10 < 11"; - "values[41]" string => "10 <= 10"; - "values[42]" string => "10 <= 11"; + "values[0]" string => "x"; + "values[1]" string => "+ 200"; + "values[2]" string => "200 + 100"; + "values[3]" string => "200 - 100"; + "values[4]" string => "- - -"; + "values[5]" string => "2 - (3 - 1)"; + "values[6]" string => ""; + "values[7]" string => "3 / 0"; + "values[8]" string => "3^3"; + "values[9]" string => "(-1)^2"; + "values[10]" string => "sin(20)"; + "values[11]" string => "cos(20)"; + "values[12]" string => "asin(0.2)"; + "values[13]" string => "acos(0.2)"; + "values[14]" string => "tan(20)"; + "values[15]" string => "atan(0.2)"; + "values[16]" string => "log(0.2)"; + "values[17]" string => "ln2"; + "values[18]" string => "ln10"; + "values[19]" string => "20 % 3"; + "values[20]" string => "sqrt(0.2)"; + "values[21]" string => "ceil(3.5)"; + "values[22]" string => "floor(3.4)"; + "values[23]" string => "abs(-3.4)"; + "values[24]" string => "-3.4 -3.4"; + "values[25]" string => "-3.400000 -3.400001"; + "values[26]" string => "pi"; + "values[27]" string => "e"; + "values[28]" string => "10 == 10"; + "values[29]" string => "10 == 11"; + "values[30]" string => "3**0"; + "values[31]" string => "step(10)"; + "values[32]" string => "step(-10)"; + "values[33]" string => "100k"; + "values[34]" string => "(200m - 100k) / (2t + 2t)"; + "values[35]" string => "10 > 10"; + "values[36]" string => "10 > 11"; + "values[37]" string => "10 >= 10"; + "values[38]" string => "10 >= 11"; + "values[39]" string => "10 < 10"; + "values[40]" string => "10 < 11"; + "values[41]" string => "10 <= 10"; + "values[42]" string => "10 <= 11"; } - ####################################################### - bundle agent test { classes: - "context_eval_$(indices)" expression => eval("$(init.values[$(indices)])", "class"), + "context_eval_$(indices)" + expression => eval("$(init.values[$(indices)])", "class"), scope => "namespace"; vars: - "indices" slist => getindices("init.values"); + "indices" slist => getindices("init.values"); } ####################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_expected("context_eval_2,context_eval_3,context_eval_7,context_eval_8,context_eval_9,context_eval_10,context_eval_11,context_eval_12,context_eval_13,context_eval_14,context_eval_15,context_eval_16,context_eval_17,context_eval_18,context_eval_19,context_eval_20,context_eval_21,context_eval_22,context_eval_23,context_eval_24,context_eval_25,context_eval_26,context_eval_27,context_eval_28,context_eval_30,context_eval_31,context_eval_33,context_eval_34,context_eval_37,context_eval_40,context_eval_41,context_eval_42", - "context_eval_0,context_eval_1,context_eval_4,context_eval_5,context_eval_6,context_eval_29,context_eval_32,context_eval_35,context_eval_36,context_eval_38,context_eval_39", - $(this.promise_filename)); + "" + usebundle => dcs_passif_expected( + "context_eval_2,context_eval_3,context_eval_7,context_eval_8,context_eval_9,context_eval_10,context_eval_11,context_eval_12,context_eval_13,context_eval_14,context_eval_15,context_eval_16,context_eval_17,context_eval_18,context_eval_19,context_eval_20,context_eval_21,context_eval_22,context_eval_23,context_eval_24,context_eval_25,context_eval_26,context_eval_27,context_eval_28,context_eval_30,context_eval_31,context_eval_33,context_eval_34,context_eval_37,context_eval_40,context_eval_41,context_eval_42", + "context_eval_0,context_eval_1,context_eval_4,context_eval_5,context_eval_6,context_eval_29,context_eval_32,context_eval_35,context_eval_36,context_eval_38,context_eval_39", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/every_some_none.cf b/tests/acceptance/01_vars/02_functions/every_some_none.cf index 417ea9fa11..b514a9a83d 100644 --- a/tests/acceptance/01_vars/02_functions/every_some_none.cf +++ b/tests/acceptance/01_vars/02_functions/every_some_none.cf @@ -3,105 +3,188 @@ # Test every(), some(), and none() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { methods: - "pretest"; - "collect"; + "pretest"; + "collect"; } bundle common pretest { vars: - "test" slist => { - 1,2,3, - "one", "two", "three", - "long string", - "four", "fix", "six", - "one", "two", "three", + "test" + slist => { + 1, + 2, + 3, + "one", + "two", + "three", + "long string", + "four", + "fix", + "six", + "one", + "two", + "three", }; - "empty" slist => { }; + "empty" slist => {}; - "d1" data => parsejson(' + "d1" + data => parsejson( + ' [1,2,3, "one", "two", "three", "long string", "four", "fix", "six", - "one", "two", "three"]'); + "one", "two", "three"]' + ); - "d2" data => parsejson(' + "d2" + data => parsejson( + ' { "one": 1, "two": 2, "three": 3, - "x": "y", "a": "b", "p": "q" }'); + "x": "y", "a": "b", "p": "q" }' + ); - "dempty" data => parsejson('[]'); - - "collected" slist => classesmatching(".*", "collect"); - "collected_sorted" slist => sort(collected, "lex"); + "dempty" data => parsejson('[]'); + "collected" slist => classesmatching(".*", "collect"); + "collected_sorted" slist => sort(collected, "lex"); classes: - "every1" meta => { "collect" }, expression => every(".*", "test"); - "every2" meta => { "collect" }, expression => every(".", "test"); - - "some1" meta => { "collect" }, expression => some("long string", "test"); - "some2" meta => { "collect" }, expression => some("none", "test"); - - "none1" meta => { "collect" }, expression => none("jebadiah", "test"); - "none2" meta => { "collect" }, expression => none("2", "test"); - - "every_empty" meta => { "collect" }, expression => every(".*", "empty"); - "some_empty" meta => { "collect" }, expression => some(".*", "empty"); - "none_empty" meta => { "collect" }, expression => none(".*", "empty"); - - "everyd11" meta => { "collect" }, expression => every(".*", d1); - "everyd12" meta => { "collect" }, expression => every(".", d1); - - "somed11" meta => { "collect" }, expression => some("long string", d1); - "somed12" meta => { "collect" }, expression => some("none", d1); - - "noned11" meta => { "collect" }, expression => none("jebadiah", d1); - "noned12" meta => { "collect" }, expression => none("2", d1); - - "everyd21" meta => { "collect" }, expression => every(".*", d2); - "everyd22" meta => { "collect" }, expression => every(".", d2); - - "somed21" meta => { "collect" }, expression => some("long string", d2); - "somed22" meta => { "collect" }, expression => some("none", d2); - - "noned21" meta => { "collect" }, expression => none("jebadiah", d2); - "noned22" meta => { "collect" }, expression => none("2", d2); - - "every_dempty" meta => { "collect" }, expression => every(".*", dempty); - "some_dempty" meta => { "collect" }, expression => some(".*", dempty); - "none_dempty" meta => { "collect" }, expression => none(".*", dempty); - - # with inline JSON - "inline_every_empty" meta => { "collect" }, expression => every(".*", '[]'); - "inline_some_data" meta => { "collect" }, expression => every(".*", '[ "foo", "bar" ]'); - "inline_none_data" meta => { "collect" }, expression => none("jebadiah", '[ "foo", "bar" ]'); - + "every1" + meta => { "collect" }, + expression => every(".*", "test"); + + "every2" + meta => { "collect" }, + expression => every(".", "test"); + + "some1" + meta => { "collect" }, + expression => some("long string", "test"); + + "some2" + meta => { "collect" }, + expression => some("none", "test"); + + "none1" + meta => { "collect" }, + expression => none("jebadiah", "test"); + + "none2" + meta => { "collect" }, + expression => none("2", "test"); + + "every_empty" + meta => { "collect" }, + expression => every(".*", "empty"); + + "some_empty" + meta => { "collect" }, + expression => some(".*", "empty"); + + "none_empty" + meta => { "collect" }, + expression => none(".*", "empty"); + + "everyd11" + meta => { "collect" }, + expression => every(".*", d1); + + "everyd12" + meta => { "collect" }, + expression => every(".", d1); + + "somed11" + meta => { "collect" }, + expression => some("long string", d1); + + "somed12" + meta => { "collect" }, + expression => some("none", d1); + + "noned11" + meta => { "collect" }, + expression => none("jebadiah", d1); + + "noned12" + meta => { "collect" }, + expression => none("2", d1); + + "everyd21" + meta => { "collect" }, + expression => every(".*", d2); + + "everyd22" + meta => { "collect" }, + expression => every(".", d2); + + "somed21" + meta => { "collect" }, + expression => some("long string", d2); + + "somed22" + meta => { "collect" }, + expression => some("none", d2); + + "noned21" + meta => { "collect" }, + expression => none("jebadiah", d2); + + "noned22" + meta => { "collect" }, + expression => none("2", d2); + + "every_dempty" + meta => { "collect" }, + expression => every(".*", dempty); + + "some_dempty" + meta => { "collect" }, + expression => some(".*", dempty); + + "none_dempty" + meta => { "collect" }, + expression => none(".*", dempty); + + # with inline JSON + "inline_every_empty" + meta => { "collect" }, + expression => every(".*", '[]'); + + "inline_some_data" + meta => { "collect" }, + expression => every(".*", '[ "foo", "bar" ]'); + + "inline_none_data" + meta => { "collect" }, + expression => none("jebadiah", '[ "foo", "bar" ]'); } bundle common collect { vars: - "collected" slist => { @(pretest.collected_sorted) }; + "collected" slist => { @(pretest.collected_sorted) }; } bundle agent check { methods: - "check" usebundle => dcs_check_state(collect, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + collect, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/execresult.cf b/tests/acceptance/01_vars/02_functions/execresult.cf index b2cd12a176..37c805acf9 100644 --- a/tests/acceptance/01_vars/02_functions/execresult.cf +++ b/tests/acceptance/01_vars/02_functions/execresult.cf @@ -3,56 +3,63 @@ # Test returnszero() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10217" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10217" }; + vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "cwd" string => dirname("$(this.promise_filename)"); + "cwd" string => dirname("$(this.promise_filename)"); windows:: "zero_rel" string => "type $(cwd)$(const.dirsep)text.txt"; "one_rel" string => "type $(cwd)$(const.dirsep)text.txt.doesnotexist"; "nxe_rel" string => "nosuchprogramexists"; - "zero_abs" string => "c:\windows\system32\cmd.exe /C type $(cwd)$(const.dirsep)text.txt"; - "one_abs" string => "c:\windows\system32\cmd.exe /C type $(cwd)$(const.dirsep)text.txt.doesnotexist"; + + "zero_abs" + string => "c:\windows\system32\cmd.exe /C type $(cwd)$(const.dirsep)text.txt"; + + "one_abs" + string => "c:\windows\system32\cmd.exe /C type $(cwd)$(const.dirsep)text.txt.doesnotexist"; + "nxe_abs" string => "c:\xbin\nosuchprogramexists"; "zero_powershell" string => "Get-Content $(cwd)$(const.dirsep)text.txt"; - "one_powershell" string => "Get-Content $(cwd)$(const.dirsep)text.txt.doesnotexist"; + + "one_powershell" + string => "Get-Content $(cwd)$(const.dirsep)text.txt.doesnotexist"; + "nxe_powershell" string => "nosuchprogramexists"; + !windows:: "zero_rel" string => "cat $(cwd)$(const.dirsep)text.txt"; "one_rel" string => "cat $(cwd)$(const.dirsep)text.txt.doesnotexist"; @@ -62,66 +69,178 @@ bundle agent check "nxe_abs" string => "/xbin/nosuchprogramexists"; classes: - # Test whether we extracted the expected string. - "zero_noshell_rel" expression => regcmp(".*Succeeded.*", execresult("$(zero_rel)", "noshell")); - "zero_useshell_rel" expression => regcmp(".*Succeeded.*", execresult("$(zero_rel)", "useshell")); - "zero_noshell_abs" expression => regcmp(".*Succeeded.*", execresult("$(zero_abs)", "noshell")); - "zero_useshell_abs" expression => regcmp(".*Succeeded.*", execresult("$(zero_abs)", "useshell")); + # Test whether we extracted the expected string. + "zero_noshell_rel" + expression => regcmp( + ".*Succeeded.*", execresult("$(zero_rel)", "noshell") + ); - "one_noshell_rel" expression => regcmp(".*Succeeded.*", execresult("$(one_rel)", "noshell")); - "one_useshell_rel" expression => regcmp(".*Succeeded.*", execresult("$(one_rel)", "useshell")); - "one_noshell_abs" expression => regcmp(".*Succeeded.*", execresult("$(one_abs)", "noshell")); - "one_useshell_abs" expression => regcmp(".*Succeeded.*", execresult("$(one_abs)", "useshell")); + "zero_useshell_rel" + expression => regcmp( + ".*Succeeded.*", execresult("$(zero_rel)", "useshell") + ); - "nxe_noshell_rel" expression => regcmp(".*Succeeded.*", execresult("$(nxe_rel)", "noshell")); - "nxe_useshell_rel" expression => regcmp(".*Succeeded.*", execresult("$(nxe_rel)", "useshell")); - "nxe_noshell_abs" expression => regcmp(".*Succeeded.*", execresult("$(nxe_abs)", "noshell")); - "nxe_useshell_abs" expression => regcmp(".*Succeeded.*", execresult("$(nxe_abs)", "useshell")); + "zero_noshell_abs" + expression => regcmp( + ".*Succeeded.*", execresult("$(zero_abs)", "noshell") + ); - # Test whether any assignment happens at all. - "does_assign_zero_noshell_rel" expression => regcmp(".*", execresult("$(zero_rel)", "noshell")); - "does_assign_zero_useshell_rel" expression => regcmp(".*", execresult("$(zero_rel)", "useshell")); - "does_assign_zero_noshell_abs" expression => regcmp(".*", execresult("$(zero_abs)", "noshell")); - "does_assign_zero_useshell_abs" expression => regcmp(".*", execresult("$(zero_abs)", "useshell")); + "zero_useshell_abs" + expression => regcmp( + ".*Succeeded.*", execresult("$(zero_abs)", "useshell") + ); + + "one_noshell_rel" + expression => regcmp( + ".*Succeeded.*", execresult("$(one_rel)", "noshell") + ); + + "one_useshell_rel" + expression => regcmp( + ".*Succeeded.*", execresult("$(one_rel)", "useshell") + ); + + "one_noshell_abs" + expression => regcmp( + ".*Succeeded.*", execresult("$(one_abs)", "noshell") + ); + + "one_useshell_abs" + expression => regcmp( + ".*Succeeded.*", execresult("$(one_abs)", "useshell") + ); + + "nxe_noshell_rel" + expression => regcmp( + ".*Succeeded.*", execresult("$(nxe_rel)", "noshell") + ); + + "nxe_useshell_rel" + expression => regcmp( + ".*Succeeded.*", execresult("$(nxe_rel)", "useshell") + ); + + "nxe_noshell_abs" + expression => regcmp( + ".*Succeeded.*", execresult("$(nxe_abs)", "noshell") + ); + + "nxe_useshell_abs" + expression => regcmp( + ".*Succeeded.*", execresult("$(nxe_abs)", "useshell") + ); + + # Test whether any assignment happens at all. + "does_assign_zero_noshell_rel" + expression => regcmp(".*", execresult("$(zero_rel)", "noshell")); + + "does_assign_zero_useshell_rel" + expression => regcmp(".*", execresult("$(zero_rel)", "useshell")); - "does_assign_one_noshell_rel" expression => regcmp(".*", execresult("$(one_rel)", "noshell")); - "does_assign_one_useshell_rel" expression => regcmp(".*", execresult("$(one_rel)", "useshell")); - "does_assign_one_noshell_abs" expression => regcmp(".*", execresult("$(one_abs)", "noshell")); - "does_assign_one_useshell_abs" expression => regcmp(".*", execresult("$(one_abs)", "useshell")); + "does_assign_zero_noshell_abs" + expression => regcmp(".*", execresult("$(zero_abs)", "noshell")); - "does_assign_nxe_noshell_rel" expression => regcmp(".*", execresult("$(nxe_rel)", "noshell")); - "does_assign_nxe_useshell_rel" expression => regcmp(".*", execresult("$(nxe_rel)", "useshell")); - "does_assign_nxe_noshell_abs" expression => regcmp(".*", execresult("$(nxe_abs)", "noshell")); - "does_assign_nxe_useshell_abs" expression => regcmp(".*", execresult("$(nxe_abs)", "useshell")); + "does_assign_zero_useshell_abs" + expression => regcmp(".*", execresult("$(zero_abs)", "useshell")); + + "does_assign_one_noshell_rel" + expression => regcmp(".*", execresult("$(one_rel)", "noshell")); + + "does_assign_one_useshell_rel" + expression => regcmp(".*", execresult("$(one_rel)", "useshell")); + + "does_assign_one_noshell_abs" + expression => regcmp(".*", execresult("$(one_abs)", "noshell")); + + "does_assign_one_useshell_abs" + expression => regcmp(".*", execresult("$(one_abs)", "useshell")); + + "does_assign_nxe_noshell_rel" + expression => regcmp(".*", execresult("$(nxe_rel)", "noshell")); + + "does_assign_nxe_useshell_rel" + expression => regcmp(".*", execresult("$(nxe_rel)", "useshell")); + + "does_assign_nxe_noshell_abs" + expression => regcmp(".*", execresult("$(nxe_abs)", "noshell")); + + "does_assign_nxe_useshell_abs" + expression => regcmp(".*", execresult("$(nxe_abs)", "useshell")); windows:: # Test whether we extracted the expected string. - "zero_powershell" expression => regcmp(".*Succeeded.*", execresult("$(zero_powershell)", "powershell")); - "one_powershell" expression => regcmp(".*Succeeded.*", execresult("$(one_powershell)", "powershell")); - "nxe_powershell" expression => regcmp(".*Succeeded.*", execresult("$(nxe_powershell)", "powershell")); + "zero_powershell" + expression => regcmp( + ".*Succeeded.*", execresult("$(zero_powershell)", "powershell") + ); + + "one_powershell" + expression => regcmp( + ".*Succeeded.*", execresult("$(one_powershell)", "powershell") + ); + + "nxe_powershell" + expression => regcmp( + ".*Succeeded.*", execresult("$(nxe_powershell)", "powershell") + ); # Test whether any assignment happens at all. - "does_assign_zero_powershell" expression => regcmp(".*", execresult("$(zero_powershell)", "powershell")); - "does_assign_one_powershell" expression => regcmp(".*", execresult("$(one_powershell)", "powershell")); - "does_assign_nxe_powershell" expression => regcmp(".*", execresult("$(nxe_powershell)", "powershell")); + "does_assign_zero_powershell" + expression => regcmp( + ".*", execresult("$(zero_powershell)", "powershell") + ); + + "does_assign_one_powershell" + expression => regcmp( + ".*", execresult("$(one_powershell)", "powershell") + ); + + "does_assign_nxe_powershell" + expression => regcmp( + ".*", execresult("$(nxe_powershell)", "powershell") + ); any:: - "ok_common" and => { - "!zero_noshell_rel", "zero_useshell_rel", "zero_noshell_abs", "zero_useshell_abs", - "!one_noshell_rel", "!one_useshell_rel", "!one_noshell_abs", "!one_useshell_abs", - "!nxe_noshell_rel", "!nxe_useshell_rel", "!nxe_noshell_abs", "!nxe_useshell_abs", - "!does_assign_zero_noshell_rel", "does_assign_zero_useshell_rel", "does_assign_zero_noshell_abs", "does_assign_zero_useshell_abs", - "!does_assign_one_noshell_rel", "does_assign_one_useshell_rel", "does_assign_one_noshell_abs", "does_assign_one_useshell_abs", - "!does_assign_nxe_noshell_rel", "does_assign_nxe_useshell_rel", "!does_assign_nxe_noshell_abs", "!does_assign_nxe_useshell_abs", - }; + "ok_common" + and => { + "!zero_noshell_rel", + "zero_useshell_rel", + "zero_noshell_abs", + "zero_useshell_abs", + "!one_noshell_rel", + "!one_useshell_rel", + "!one_noshell_abs", + "!one_useshell_abs", + "!nxe_noshell_rel", + "!nxe_useshell_rel", + "!nxe_noshell_abs", + "!nxe_useshell_abs", + "!does_assign_zero_noshell_rel", + "does_assign_zero_useshell_rel", + "does_assign_zero_noshell_abs", + "does_assign_zero_useshell_abs", + "!does_assign_one_noshell_rel", + "does_assign_one_useshell_rel", + "does_assign_one_noshell_abs", + "does_assign_one_useshell_abs", + "!does_assign_nxe_noshell_rel", + "does_assign_nxe_useshell_rel", + "!does_assign_nxe_noshell_abs", + "!does_assign_nxe_useshell_abs", + }; + windows:: - "ok_windows" and => { - "zero_powershell", "!one_powershell", "!nxe_powershell", - "does_assign_zero_powershell", "does_assign_one_powershell", "does_assign_nxe_powershell", - }; - "ok" and => { - "ok_common", "ok_windows", - }; + "ok_windows" + and => { + "zero_powershell", + "!one_powershell", + "!nxe_powershell", + "does_assign_zero_powershell", + "does_assign_one_powershell", + "does_assign_nxe_powershell", + }; + + "ok" and => { "ok_common", "ok_windows" }; !windows:: "ok" and => { "ok_common" }; @@ -133,14 +252,12 @@ bundle agent check DEBUG.!zero_useshell_rel:: "'$(zero_rel)' executes command unsuccessfully with useshell"; - DEBUG.one_noshell_rel:: "'$(one_rel)' executes command successfully with noshell"; DEBUG.one_useshell_rel:: "'$(one_rel)' executes command successfully with useshell"; - DEBUG.nxe_noshell_rel:: "'$(nxe_rel)' executes command successfully with noshell"; @@ -153,35 +270,30 @@ bundle agent check DEBUG.!zero_useshell_abs:: "'$(zero_abs)' executes command unsuccessfully with useshell"; - DEBUG.one_noshell_abs:: "'$(one_abs)' executes command successfully with noshell"; DEBUG.one_useshell_abs:: "'$(one_abs)' executes command successfully with useshell"; - DEBUG.nxe_noshell_abs:: "'$(nxe_abs)' executes command successfully with noshell"; DEBUG.nxe_useshell_abs:: "'$(nxe_abs)' executes command successfully with useshell"; - DEBUG.does_assign_zero_noshell_rel:: "'$(zero_rel)' executes command with noshell"; DEBUG.!does_assign_zero_useshell_rel:: "'$(zero_rel)' does not execute command with useshell"; - DEBUG.does_assign_one_noshell_rel:: "'$(one_rel)' executes command with noshell"; DEBUG.!does_assign_one_useshell_rel:: "'$(one_rel)' does not execute command with useshell"; - DEBUG.does_assign_nxe_noshell_rel:: "'$(nxe_rel)' executes command with noshell"; @@ -194,14 +306,12 @@ bundle agent check DEBUG.!does_assign_zero_useshell_abs:: "'$(zero_abs)' does not execute command with useshell"; - DEBUG.!does_assign_one_noshell_abs:: "'$(one_abs)' does not execute command with noshell"; DEBUG.!does_assign_one_useshell_abs:: "'$(one_abs)' does not execute command with useshell"; - DEBUG.does_assign_nxe_noshell_abs:: "'$(nxe_abs)' executes command with noshell"; @@ -228,6 +338,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/execresult_4k.cf b/tests/acceptance/01_vars/02_functions/execresult_4k.cf index e0d08e86a6..35009640b7 100644 --- a/tests/acceptance/01_vars/02_functions/execresult_4k.cf +++ b/tests/acceptance/01_vars/02_functions/execresult_4k.cf @@ -3,12 +3,11 @@ # Test returnszero() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -30,9 +29,10 @@ bundle agent test reports: DEBUG:: "$(result)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; - } diff --git a/tests/acceptance/01_vars/02_functions/execresult_action_immediate.cf b/tests/acceptance/01_vars/02_functions/execresult_action_immediate.cf index 4ec4aa1a78..0181e9569e 100644 --- a/tests/acceptance/01_vars/02_functions/execresult_action_immediate.cf +++ b/tests/acceptance/01_vars/02_functions/execresult_action_immediate.cf @@ -1,51 +1,49 @@ # Test that execresult is called multiple times with the same command if # 'ifelapsed => "0"' is used. - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent check_date(x) { vars: - "reports_file" string => "$(G.testdir)/execresult_action_immediate_report"; + "reports_file" string => "$(G.testdir)/execresult_action_immediate_report"; - "date" string => execresult("date; sleep 1", "useshell"), - action => immediate; + "date" + string => execresult("date; sleep 1", "useshell"), + action => immediate; reports: - "Date for ${x}: ${date}" - report_to_file => "$(reports_file)"; + "Date for ${x}: ${date}" report_to_file => "$(reports_file)"; } bundle agent test { meta: - "description" -> {"ENT-7478"} - string => "If 'ifelapsed => 0' is used, execresult() should run the given command every time"; - "test_soft_fail" string => "windows", - meta => { "ENT-10217" }; + "description" -> { "ENT-7478" } + string => "If 'ifelapsed => 0' is used, execresult() should run the given command every time"; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10217" }; methods: - "foo" usebundle => check_date("foo"); - "bar" usebundle => check_date("bar"); + "foo" usebundle => check_date("foo"); + "bar" usebundle => check_date("bar"); } - bundle agent check { vars: - "content" - slist => readstringlist( "$(check_date.reports_file)", - "", - '$(const.n)', - inf, - inf); - "count" - int => length( content ); + "content" + slist => readstringlist( + "$(check_date.reports_file)", "", '$(const.n)', inf, inf + ); + + "count" int => length(content); reports: DEBUG|EXTRA:: @@ -55,6 +53,6 @@ bundle agent check any:: # Pass if there are 6 lines, 3 for each check_date bundle actuation, # indicating that execresult is being called once for each pass. - "$(this.promise_filename) Pass" if => strcmp( $(count), 6 ); - "$(this.promise_filename) FAIL" unless => strcmp( $(count), 6 ); + "$(this.promise_filename) Pass" if => strcmp($(count), 6); + "$(this.promise_filename) FAIL" unless => strcmp($(count), 6); } diff --git a/tests/acceptance/01_vars/02_functions/execresult_multiples.cf b/tests/acceptance/01_vars/02_functions/execresult_multiples.cf index f7cdc07d29..26d0ed8d6f 100644 --- a/tests/acceptance/01_vars/02_functions/execresult_multiples.cf +++ b/tests/acceptance/01_vars/02_functions/execresult_multiples.cf @@ -3,7 +3,6 @@ # Redmine #2981: execresult and returnszero should not be run so much # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; @@ -13,37 +12,39 @@ body common control bundle agent init { - } - bundle agent test { -vars: - "subout" string => execresult("$(sys.cf_agent) -Kv -f $(this.promise_filename).sub | $(G.egrep) 'execresult|returnszero'", "useshell"); + vars: + "subout" + string => execresult( + "$(sys.cf_agent) -Kv -f $(this.promise_filename).sub | $(G.egrep) 'execresult|returnszero'", + "useshell" + ); } - bundle agent check { -# If the output contains CLASSONCE or RETONCE more than once, we fail -classes: - "ok1" not => regcmp(".*ran.*CLASSONCE.*ran.*CLASSONCE.*", "$(test.subout)"); - "ok2" not => regcmp(".*ran.*RETONCE.*ran.*RETONCE.*", "$(test.subout)"); + # If the output contains CLASSONCE or RETONCE more than once, we fail + classes: + "ok1" not => regcmp(".*ran.*CLASSONCE.*ran.*CLASSONCE.*", "$(test.subout)"); + "ok2" not => regcmp(".*ran.*RETONCE.*ran.*RETONCE.*", "$(test.subout)"); + "ok" and => { "ok1", "ok2" }; - "ok" and => { "ok1", "ok2" }; - -reports: - DEBUG:: - "agent output: $(test.subout)"; + reports: + DEBUG:: + "agent output: $(test.subout)"; ok1.ok2:: "The duplicate output in cf-agent didn't happen"; + !(ok1.ok2):: "The duplicate output in cf-agent happened"; - ok:: - "$(this.promise_filename) Pass"; - !ok:: - "$(this.promise_filename) FAIL"; + ok:: + "$(this.promise_filename) Pass"; + + !ok:: + "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/execresult_select.cf b/tests/acceptance/01_vars/02_functions/execresult_select.cf index c2eb1bc4fa..dfb36c5cec 100644 --- a/tests/acceptance/01_vars/02_functions/execresult_select.cf +++ b/tests/acceptance/01_vars/02_functions/execresult_select.cf @@ -3,53 +3,64 @@ # Test that you can select stderr/stdout in execresult # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "description" -> { "CFE-3108" } - string => "Test that you can select stderr/stdout in execresult"; - "test_soft_fail" string => "windows", - meta => { "ENT-10217" }; + "description" -> { "CFE-3108" } + string => "Test that you can select stderr/stdout in execresult"; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10217" }; vars: - "result_with_stdout_stderr" - string => execresult("$(G.echo) stdout; $(G.echo) stderr >&2", "useshell", "both"); + "result_with_stdout_stderr" + string => execresult( + "$(G.echo) stdout; $(G.echo) stderr >&2", "useshell", "both" + ); - "result_with_stdout" - string => execresult("$(G.echo) stdout; $(G.echo) stderr >&2", "useshell", "stdout"); + "result_with_stdout" + string => execresult( + "$(G.echo) stdout; $(G.echo) stderr >&2", "useshell", "stdout" + ); - "result_with_stderr" - string => execresult("$(G.echo) stdout; $(G.echo) stderr >&2", "useshell", "stderr"); + "result_with_stderr" + string => execresult( + "$(G.echo) stdout; $(G.echo) stderr >&2", "useshell", "stderr" + ); classes: - "pass_stdout_stderr" - scope => "namespace", - expression => strcmp( "stdout$(const.n)stderr", $(result_with_stdout_stderr) ); + "pass_stdout_stderr" + scope => "namespace", + expression => strcmp( + "stdout$(const.n)stderr", $(result_with_stdout_stderr) + ); - "pass_stdout" - scope => "namespace", - expression => strcmp( "stdout", $(result_with_stdout) ); + "pass_stdout" + scope => "namespace", + expression => strcmp("stdout", $(result_with_stdout)); - "pass_stderr" - scope => "namespace", - expression => strcmp( "stderr", $(result_with_stderr) ); + "pass_stderr" + scope => "namespace", + expression => strcmp("stderr", $(result_with_stderr)); methods: - "Pass/Fail" - usebundle => dcs_passif("pass_stdout_stderr.pass_stdout.pass_stderr", $(this.promise_filename)); + "Pass/Fail" + usebundle => dcs_passif( + "pass_stdout_stderr.pass_stdout.pass_stderr", $(this.promise_filename) + ); } bundle agent __main__ { - methods: "test"; + methods: + "test"; } diff --git a/tests/acceptance/01_vars/02_functions/execresult_stderr.cf b/tests/acceptance/01_vars/02_functions/execresult_stderr.cf index 5cf8a27db4..9396797267 100644 --- a/tests/acceptance/01_vars/02_functions/execresult_stderr.cf +++ b/tests/acceptance/01_vars/02_functions/execresult_stderr.cf @@ -3,54 +3,59 @@ # Test execresult() captures stdout and stderr # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "description" -> { "CFE-3103" } - string => "Test that execresult captures both stdout and stderr"; - "test_soft_fail" string => "windows", - meta => { "ENT-10217" }; + "description" -> { "CFE-3103" } + string => "Test that execresult captures both stdout and stderr"; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10217" }; vars: - "result_with_stdout_stderr" - string => execresult("$(G.echo) stdout; $(G.echo) stderr >&2", "useshell"); + "result_with_stdout_stderr" + string => execresult( + "$(G.echo) stdout; $(G.echo) stderr >&2", "useshell" + ); - "result_with_stdout" - string => execresult("$(G.echo) stdout", "useshell"); + "result_with_stdout" string => execresult("$(G.echo) stdout", "useshell"); - "result_with_stderr" - string => execresult("$(G.echo) stderr >&2", "useshell"); + "result_with_stderr" + string => execresult("$(G.echo) stderr >&2", "useshell"); classes: - "pass_stdout_stderr" - scope => "namespace", - expression => strcmp( "stdout$(const.n)stderr", $(result_with_stdout_stderr) ); + "pass_stdout_stderr" + scope => "namespace", + expression => strcmp( + "stdout$(const.n)stderr", $(result_with_stdout_stderr) + ); - "pass_stdout" - scope => "namespace", - expression => strcmp( "stdout", $(result_with_stdout) ); + "pass_stdout" + scope => "namespace", + expression => strcmp("stdout", $(result_with_stdout)); - "pass_stderr" - scope => "namespace", - expression => strcmp( "stderr", $(result_with_stderr) ); + "pass_stderr" + scope => "namespace", + expression => strcmp("stderr", $(result_with_stderr)); methods: - "Pass/Fail" - usebundle => dcs_passif("pass_stdout_stderr.pass_stdout.pass_stderr", $(this.promise_filename)); - + "Pass/Fail" + usebundle => dcs_passif( + "pass_stdout_stderr.pass_stdout.pass_stderr", $(this.promise_filename) + ); } bundle agent __main__ { - methods: "test"; + methods: + "test"; } diff --git a/tests/acceptance/01_vars/02_functions/expand_range.cf b/tests/acceptance/01_vars/02_functions/expand_range.cf index eb367803a6..e4bf0bc5b3 100644 --- a/tests/acceptance/01_vars/02_functions/expand_range.cf +++ b/tests/acceptance/01_vars/02_functions/expand_range.cf @@ -1,35 +1,36 @@ # data_regextract() test - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent test { vars: - "case1" slist => expandrange("case1[1-3]", 1); + "case1" slist => expandrange("case1[1-3]", 1); "case1s" string => format("%S", "case1"); - "case2" slist => expandrange("case2[1-10]", 3); + "case2" slist => expandrange("case2[1-10]", 3); "case2s" string => format("%S", "case2"); - "case3" slist => expandrange("case3[1-1]", 3); + "case3" slist => expandrange("case3[1-1]", 3); "case3s" string => format("%S", "case3"); - "case4" slist => expandrange("case4[1-2]", 3); + "case4" slist => expandrange("case4[1-2]", 3); "case4s" string => format("%S", "case4"); } bundle agent check { vars: - "actual" string => " + "actual" + string => " 1 $(test.case1s) 2 $(test.case2s) 3 $(test.case3s) 4 $(test.case4s) "; - "expected" string => ' + "expected" + string => ' 1 { \"case11\", \"case12\", \"case13\" } 2 { \"case21\", \"case24\", \"case27\", \"case210\" } 3 { \"case31\" } @@ -37,7 +38,8 @@ bundle agent check '; methods: - "" usebundle => dcs_check_strcmp($(actual), $(expected), - $(this.promise_filename), - "no"); + "" + usebundle => dcs_check_strcmp( + $(actual), $(expected), $(this.promise_filename), "no" + ); } diff --git a/tests/acceptance/01_vars/02_functions/filesexist-can-detect-files-containing-hash-character.cf b/tests/acceptance/01_vars/02_functions/filesexist-can-detect-files-containing-hash-character.cf index cb6b6a8a2e..c5020ac89f 100644 --- a/tests/acceptance/01_vars/02_functions/filesexist-can-detect-files-containing-hash-character.cf +++ b/tests/acceptance/01_vars/02_functions/filesexist-can-detect-files-containing-hash-character.cf @@ -3,61 +3,54 @@ # Test that filesexist() can check for presence of files containing hashes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "test_files" slist => { "example##4567", "example##123" }; + "test_files" slist => { "example##4567", "example##123" }; files: - "$(G.testdir)/$(test_files)" - create => "true"; + "$(G.testdir)/$(test_files)" create => "true"; } ####################################################### - bundle agent test { meta: - "description" -> { "CFE-2744" } - string => "Test that filesexist can verify files containing hashes exist"; + "description" -> { "CFE-2744" } + string => "Test that filesexist can verify files containing hashes exist"; vars: - "found_files" slist => findfiles( "$(G.testdir)/example##*"); + "found_files" slist => findfiles("$(G.testdir)/example##*"); classes: # This should always be true. # We check that the files that we found exist. - "found_expected_files_with_filesexist" - expression => filesexist( "@(found_files)" ), - scope => "namespace"; - + expression => filesexist("@(found_files)"), + scope => "namespace"; } -####################################################### +####################################################### bundle agent check { classes: - "ok" expression => "found_expected_files_with_filesexist"; + "ok" expression => "found_expected_files_with_filesexist"; reports: DEBUG|EXTRA:: "Test files: $(init.test_files)"; - "Found files: $(test.found_files)"; "filesexist() cannot validate files containing '#', not working as expected" - if => not( "ok" ); + if => not("ok"); ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/filesexist-is-collecting.cf b/tests/acceptance/01_vars/02_functions/filesexist-is-collecting.cf index 2214cbcc68..685f185ae4 100644 --- a/tests/acceptance/01_vars/02_functions/filesexist-is-collecting.cf +++ b/tests/acceptance/01_vars/02_functions/filesexist-is-collecting.cf @@ -3,74 +3,75 @@ # Test that filesexist() can check for presence of files containing hashes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "test_files" slist => { "example4567", "example123" }; + "test_files" slist => { "example4567", "example123" }; files: - "$(G.testdir)/$(test_files)" - create => "true"; + "$(G.testdir)/$(test_files)" create => "true"; } ####################################################### - bundle agent test { meta: - "description" -> { "CFE-2744" } - string => "Test that filesexist works as a collecting function"; + "description" -> { "CFE-2744" } + string => "Test that filesexist works as a collecting function"; classes: - "filesexist_slist_identifier_ok" - expression => filesexist( "init.test_files" ), - scope => "namespace"; + "filesexist_slist_identifier_ok" + expression => filesexist("init.test_files"), + scope => "namespace"; - "filesexist_slist_ref_ok" - expression => filesexist( @(init.test_files) ), - scope => "namespace"; + "filesexist_slist_ref_ok" + expression => filesexist(@(init.test_files)), + scope => "namespace"; - "filesexist_findfiles_ok" - expression => filesexist( findfiles( "$(G.testdir)/example*" ) ), - scope => "namespace"; + "filesexist_findfiles_ok" + expression => filesexist(findfiles("$(G.testdir)/example*")), + scope => "namespace"; - "filesexist_json_array_ok" - expression => filesexist( '[ "example4567", "example123" ]' ), - scope => "namespace"; + "filesexist_json_array_ok" + expression => filesexist('[ "example4567", "example123" ]'), + scope => "namespace"; } -####################################################### +####################################################### bundle agent check { classes: - "ok" and => { "filesexist_slist_identifier_ok", "filesexist_slist_ref_ok", - "filesexist_findfiles_ok", "filesexist_json_array_ok" }; + "ok" + and => { + "filesexist_slist_identifier_ok", + "filesexist_slist_ref_ok", + "filesexist_findfiles_ok", + "filesexist_json_array_ok", + }; reports: DEBUG|EXTRA:: "Test files: $(init.test_files)"; "filesexist() doesn't work with an slist identifier" - if => not( "filesexist_slist_identifier_ok" ); + if => not("filesexist_slist_identifier_ok"); "filesexist() doesn't work with an slist reference" - if => not( "filesexist_slist_ref_ok" ); + if => not("filesexist_slist_ref_ok"); "filesexist() doesn't work properly with a nested findfiles() call" - if => not( "filesexist_findfiles_ok" ); + if => not("filesexist_findfiles_ok"); "filesexist() doesn't work with a JSON array" - if => not( "filesexist_json_array_ok" ); + if => not("filesexist_json_array_ok"); ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/filestat.cf b/tests/acceptance/01_vars/02_functions/filestat.cf index 7d8c7af4b2..302759c898 100644 --- a/tests/acceptance/01_vars/02_functions/filestat.cf +++ b/tests/acceptance/01_vars/02_functions/filestat.cf @@ -3,20 +3,18 @@ # Test filestat() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => init_m(600), edit_defaults => init_empty, @@ -29,90 +27,103 @@ bundle agent init body edit_defaults init_empty { - empty_file_before_editing => "true"; - edit_backup => "false"; + empty_file_before_editing => "true"; + edit_backup => "false"; } body perms init_m(mode) { - mode => "$(mode)"; + mode => "$(mode)"; } bundle edit_line init_fill_in { insert_lines: - "012345789"; - "112345789"; - "212345789"; - "312345789"; - "4"; + "012345789"; + "112345789"; + "212345789"; + "312345789"; + "4"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } - ####################################################### - bundle agent test { vars: - "fields" slist => splitstring("size,gid,uid,ino,nlink,ctime,atime,mtime,mode,modeoct,permstr,permoct,type,devno,dev_minor,dev_major,basename,dirname,linktarget,linktarget_shallow", ",", 999); - - "stat[$(fields)]" string => filestat($(G.testfile), $(fields)); + "fields" + slist => splitstring( + "size,gid,uid,ino,nlink,ctime,atime,mtime,mode,modeoct,permstr,permoct,type,devno,dev_minor,dev_major,basename,dirname,linktarget,linktarget_shallow", + ",", + 999 + ); + + "stat[$(fields)]" string => filestat($(G.testfile), $(fields)); } - ####################################################### - bundle agent check { vars: - "expected[type]" string => "regular file"; - "expected[nlink]" string => "1"; - "expected[dirname]" string => dirname($(G.testfile)); - "expected[basename]" string => lastnode($(G.testfile), escape("$(const.dirsep)")); - "expected[linktarget]" string => $(G.testfile); - "expected[linktarget_shallow]" string => $(G.testfile); + "expected[type]" string => "regular file"; + "expected[nlink]" string => "1"; + "expected[dirname]" string => dirname($(G.testfile)); + + "expected[basename]" + string => lastnode($(G.testfile), escape("$(const.dirsep)")); + + "expected[linktarget]" string => $(G.testfile); + "expected[linktarget_shallow]" string => $(G.testfile); windows:: "expected[size]" string => "47"; - "expected[mode]" string => "33206"; # 100666 + "expected[mode]" string => "33206"; + + # 100666 "expected[permoct]" string => "666"; "expected[modeoct]" string => "100666"; "expected[permstr]" string => "-rw-rw-rw-"; + !windows:: "expected[size]" string => "42"; - "expected[mode]" string => "33152"; # 100600 + "expected[mode]" string => "33152"; + + # 100600 "expected[permoct]" string => "600"; "expected[modeoct]" string => "100600"; "expected[permstr]" string => "-rw-------"; any:: "expects" slist => getindices("expected"); - "fields" slist => getindices("test.stat"); - "joint_condition" string => join(".", "expects"); + classes: - "$(expects)" expression => strcmp("$(test.stat[$(expects)])", "$(expected[$(expects)])"); - "ok" expression => "$(joint_condition)"; + "$(expects)" + expression => strcmp( + "$(test.stat[$(expects)])", "$(expected[$(expects)])" + ); + + "ok" expression => "$(joint_condition)"; reports: DEBUG:: "got $(G.testfile) field $(fields)=$(test.stat[$(fields)])"; "got $(G.testfile) field $(expects)=$(test.stat[$(expects)]) matches expected" - if => "$(expects)"; + if => "$(expects)"; "got $(G.testfile) field $(expects)=$(test.stat[$(expects)]) did NOT match expected $(expected[$(expects)])" - if => "!$(expects)"; + if => "!$(expects)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/filestat_linktarget.cf b/tests/acceptance/01_vars/02_functions/filestat_linktarget.cf index ef07c52de1..874dcc7c26 100644 --- a/tests/acceptance/01_vars/02_functions/filestat_linktarget.cf +++ b/tests/acceptance/01_vars/02_functions/filestat_linktarget.cf @@ -3,71 +3,69 @@ # Test filestat() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { commands: - "$(G.ln) -fs $(G.testfile) $(G.testfile)"; + "$(G.ln) -fs $(G.testfile) $(G.testfile)"; reports: DEBUG:: "Created $(G.testfile) linked to itself"; } - ####################################################### - bundle agent test { meta: - "test_suppress_fail" string => "windows", - meta => { "redmine4608" }; - vars: - "fields" slist => splitstring("linktarget,linktarget_shallow", ",", 999); + "test_suppress_fail" + string => "windows", + meta => { "redmine4608" }; - "stat[$(fields)]" string => filestat($(G.testfile), $(fields)); + vars: + "fields" slist => splitstring("linktarget,linktarget_shallow", ",", 999); + "stat[$(fields)]" string => filestat($(G.testfile), $(fields)); } - ####################################################### - bundle agent check { vars: - # Note that on W32 the link target is the file itself - "expected[linktarget]" string => $(G.testfile); - "expected[linktarget_shallow]" string => $(G.testfile); - - "expects" slist => getindices("expected"); + # Note that on W32 the link target is the file itself + "expected[linktarget]" string => $(G.testfile); + "expected[linktarget_shallow]" string => $(G.testfile); + "expects" slist => getindices("expected"); + "fields" slist => getindices("test.stat"); + "joint_condition" string => join(".", "expects"); - "fields" slist => getindices("test.stat"); - - "joint_condition" string => join(".", "expects"); classes: - "$(expects)" expression => strcmp("$(test.stat[$(expects)])", "$(expected[$(expects)])"); - "ok" expression => "$(joint_condition)"; + "$(expects)" + expression => strcmp( + "$(test.stat[$(expects)])", "$(expected[$(expects)])" + ); + + "ok" expression => "$(joint_condition)"; reports: DEBUG:: "got $(G.testfile) field $(fields)=$(test.stat[$(fields)])"; "got $(G.testfile) field $(expects)=$(test.stat[$(expects)]) matches expected" - if => "$(expects)"; + if => "$(expects)"; "got $(G.testfile) field $(expects)=$(test.stat[$(expects)]) did NOT match expected $(expected[$(expects)])" - if => "!$(expects)"; + if => "!$(expects)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/filestat_linktarget_relative_symlink.cf b/tests/acceptance/01_vars/02_functions/filestat_linktarget_relative_symlink.cf index 0ea22dde3f..7c596fe247 100644 --- a/tests/acceptance/01_vars/02_functions/filestat_linktarget_relative_symlink.cf +++ b/tests/acceptance/01_vars/02_functions/filestat_linktarget_relative_symlink.cf @@ -4,62 +4,58 @@ # Also filestat(linktarget_shallow) should output the first relative symlink itself # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { - # Create chain of links first_link -> second_link -> final_target - commands: - "$(G.touch) $(G.testdir)/final_target"; - "$(G.ln) -s final_target $(G.testdir)/second_link"; - "$(G.ln) -s second_link $(G.testdir)/first_link"; + "$(G.touch) $(G.testdir)/final_target"; + "$(G.ln) -s final_target $(G.testdir)/second_link"; + "$(G.ln) -s second_link $(G.testdir)/first_link"; reports: DEBUG:: "Init: created chain of links first_link -> second_link -> final_target"; } - ####################################################### - bundle agent test { meta: - # windows don't support symlinks - "test_skip_unsupported" string => "windows"; + # windows don't support symlinks + "test_skip_unsupported" string => "windows"; vars: - "fields" slist => splitstring("linktarget,linktarget_shallow", ",", 999); - - "stat[$(fields)]" string => filestat("$(G.testdir)/first_link", $(fields)); + "fields" slist => splitstring("linktarget,linktarget_shallow", ",", 999); + "stat[$(fields)]" string => filestat("$(G.testdir)/first_link", $(fields)); } - ####################################################### - bundle agent check { vars: - "expected[linktarget_shallow]" string => "second_link"; - "expected[linktarget]" string => "$(G.testdir)/final_target"; + "expected[linktarget_shallow]" string => "second_link"; + "expected[linktarget]" string => "$(G.testdir)/final_target"; classes: + "test1_ok" + expression => strcmp( + "$(test.stat[linktarget])", "$(expected[linktarget])" + ); - "test1_ok" expression => strcmp("$(test.stat[linktarget])", - "$(expected[linktarget])"); - "test2_ok" expression => strcmp("$(test.stat[linktarget_shallow])", - "$(expected[linktarget_shallow])"); - "ok" expression => "test1_ok.test2_ok"; + "test2_ok" + expression => strcmp( + "$(test.stat[linktarget_shallow])", "$(expected[linktarget_shallow])" + ); + + "ok" expression => "test1_ok.test2_ok"; reports: DEBUG:: @@ -68,6 +64,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/filestat_xattr.cf b/tests/acceptance/01_vars/02_functions/filestat_xattr.cf index e9100f021f..075eb8894f 100644 --- a/tests/acceptance/01_vars/02_functions/filestat_xattr.cf +++ b/tests/acceptance/01_vars/02_functions/filestat_xattr.cf @@ -3,55 +3,49 @@ # Redmine#4079: Test filestat() with xattr # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle common xattr_support { vars: - "xattr" string => "/usr/bin/xattr"; + "xattr" string => "/usr/bin/xattr"; classes: - "has_xattr" and => { fileexists($(xattr)) }; + "has_xattr" and => { fileexists($(xattr)) }; } ####################################################### - bundle agent init { meta: - "test_skip_unsupported" string => "!has_xattr"; + "test_skip_unsupported" string => "!has_xattr"; methods: - "" usebundle => file_make($(G.testfile), ""); + "" usebundle => file_make($(G.testfile), ""); } - ####################################################### - bundle agent test { commands: - "$(init.xattr) -w foo bar $(G.testfile)"; + "$(init.xattr) -w foo bar $(G.testfile)"; } - ####################################################### - bundle agent check { vars: - "attributes" string => filestat($(G.testfile), "xattr"); + "attributes" string => filestat($(G.testfile), "xattr"); methods: - "" usebundle => dcs_check_strcmp($(attributes), "foo=bar", - $(this.promise_filename), - "no"); + "" + usebundle => dcs_check_strcmp( + $(attributes), "foo=bar", $(this.promise_filename), "no" + ); } diff --git a/tests/acceptance/01_vars/02_functions/filter.cf b/tests/acceptance/01_vars/02_functions/filter.cf index 269e25bf49..15c87c9b45 100644 --- a/tests/acceptance/01_vars/02_functions/filter.cf +++ b/tests/acceptance/01_vars/02_functions/filter.cf @@ -3,69 +3,82 @@ # Test filter() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent test { vars: - "tests" slist => { "fgrep09", "exact1", "exactdot", "regexdot", "invert", "max2", "max0", "grep09" }; - "lists" slist => { "s1", "d1", "d2", "dempty" }; + "tests" + slist => { + "fgrep09", + "exact1", + "exactdot", + "regexdot", + "invert", + "max2", + "max0", + "grep09", + }; + + "lists" slist => { "s1", "d1", "d2", "dempty" }; - "s1" slist => { - 1,2,3, - "one", "two", "three", - "long string", - "one", "two", "three", + "s1" + slist => { + 1, 2, 3, "one", "two", "three", "long string", "one", "two", "three", }; - "d1" data => parsejson(' + "d1" + data => parsejson( + ' [1,2,3, "one", "two", "three", "long string", "four", "fix", "six", - "one", "two", "three"]'); + "one", "two", "three"]' + ); - "d2" data => parsejson(' + "d2" + data => parsejson( + ' { "one": 1, "two": 2, "three": 3, - "x": "y", "a": "b", "p": "q" }'); + "x": "y", "a": "b", "p": "q" }' + ); - "dempty" data => parsejson('[]'); - - "$(lists)_fgrep09" slist => filter("[0-9]", $(lists), "true", "false", 999); - "$(lists)_exact1" slist => filter("one", $(lists), "false", "false", 999); - "$(lists)_exactdot" slist => filter(".", $(lists), "false", "false", 999); - "$(lists)_regexdot" slist => filter(".", $(lists), "true", "false", 999); - "$(lists)_invert" slist => filter("[0-9]", $(lists), "true", "true", 999); - "$(lists)_max2" slist => filter(".*", $(lists), "true", "false", 2); - "$(lists)_max0" slist => filter(".*", $(lists), "true", "false", 0); - "$(lists)_grep09" slist => grep("[0-9]", $(lists)); - - # with inline JSON - "inline_fgrep09" slist => filter("[0-9]", '[1,2,3]', "true", "false", 999); - "inline_exact1" slist => filter("one", '[1,2,3]', "false", "false", 999); - "inline_exactdot" slist => filter(".", '[1,2,3]', "false", "false", 999); - "inline_regexdot" slist => filter(".", '[1,2,3]', "true", "false", 999); - "inline_invert" slist => filter("[0-9]", '[1,2,3]', "true", "true", 999); - "inline_max2" slist => filter(".*", '[1,2,3]', "true", "false", 2); - "inline_max0" slist => filter(".*", '[1,2,3]', "true", "false", 0); - "inline_grep09" slist => grep("[0-9]", '[1,2,3]'); + "dempty" data => parsejson('[]'); + "$(lists)_fgrep09" slist => filter("[0-9]", $(lists), "true", "false", 999); + "$(lists)_exact1" slist => filter("one", $(lists), "false", "false", 999); + "$(lists)_exactdot" slist => filter(".", $(lists), "false", "false", 999); + "$(lists)_regexdot" slist => filter(".", $(lists), "true", "false", 999); + "$(lists)_invert" slist => filter("[0-9]", $(lists), "true", "true", 999); + "$(lists)_max2" slist => filter(".*", $(lists), "true", "false", 2); + "$(lists)_max0" slist => filter(".*", $(lists), "true", "false", 0); + "$(lists)_grep09" slist => grep("[0-9]", $(lists)); + # with inline JSON + "inline_fgrep09" slist => filter("[0-9]", '[1,2,3]', "true", "false", 999); + "inline_exact1" slist => filter("one", '[1,2,3]', "false", "false", 999); + "inline_exactdot" slist => filter(".", '[1,2,3]', "false", "false", 999); + "inline_regexdot" slist => filter(".", '[1,2,3]', "true", "false", 999); + "inline_invert" slist => filter("[0-9]", '[1,2,3]', "true", "true", 999); + "inline_max2" slist => filter(".*", '[1,2,3]', "true", "false", 2); + "inline_max0" slist => filter(".*", '[1,2,3]', "true", "false", 0); + "inline_grep09" slist => grep("[0-9]", '[1,2,3]'); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/findfiles-GLOB_BRACE.cf b/tests/acceptance/01_vars/02_functions/findfiles-GLOB_BRACE.cf index 52366b150e..fe8d59b0c8 100644 --- a/tests/acceptance/01_vars/02_functions/findfiles-GLOB_BRACE.cf +++ b/tests/acceptance/01_vars/02_functions/findfiles-GLOB_BRACE.cf @@ -3,84 +3,78 @@ # Test GLOB_BRACE with findfiles() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common findfiles { vars: - "names" slist => { "a", "bc", "d/e/f", "g/h/i/j", "klm/nop/qrs" }; + "names" slist => { "a", "bc", "d/e/f", "g/h/i/j", "klm/nop/qrs" }; } ####################################################### - bundle agent init { files: - "$(G.testdir)/$(findfiles.names)" - create => "true"; + "$(G.testdir)/$(findfiles.names)" create => "true"; reports: DEBUG:: "Created $(G.testdir)/$(findfiles.names)"; } - ####################################################### - bundle agent test { meta: - "description" -> { "CFE-3292" } - string => "Test that findfiles() works as expected."; + "description" -> { "CFE-3292" } + string => "Test that findfiles() works as expected."; vars: - "patterns[GLOB_BRACE]" string => "$(G.testdir)/{a,bc}"; - - "pnames" slist => getindices("patterns"); - - "found[$(pnames)]" slist => findfiles("$(patterns[$(pnames)])"); - "found_string[$(pnames)]" string => join(",", "found[$(pnames)]"); - + "patterns[GLOB_BRACE]" string => "$(G.testdir)/{a,bc}"; + "pnames" slist => getindices("patterns"); + "found[$(pnames)]" slist => findfiles("$(patterns[$(pnames)])"); + "found_string[$(pnames)]" string => join(",", "found[$(pnames)]"); reports: DEBUG:: "findfiles pattern $(pnames) '$(patterns[$(pnames)])' => '$(found_string[$(pnames)])'"; } - ####################################################### - bundle agent check { vars: - "expected[GLOB_BRACE]" string => "$(G.testdir)$(const.dirsep)a,$(G.testdir)$(const.dirsep)bc"; - - "expects" slist => getindices("expected"); + "expected[GLOB_BRACE]" + string => "$(G.testdir)$(const.dirsep)a,$(G.testdir)$(const.dirsep)bc"; - "fstring" slist => getindices("test.found_string"); - - "joint_condition" string => join(".", "expects"); + "expects" slist => getindices("expected"); + "fstring" slist => getindices("test.found_string"); + "joint_condition" string => join(".", "expects"); classes: - "$(expects)" expression => strcmp("$(test.found_string[$(expects)])", "$(expected[$(expects)])"); - "ok" expression => "$(joint_condition)"; + "$(expects)" + expression => strcmp( + "$(test.found_string[$(expects)])", "$(expected[$(expects)])" + ); + + "ok" expression => "$(joint_condition)"; reports: DEBUG:: "pattern $(expects) matches as expected: '$(expected[$(expects)])'" - if => "$(expects)"; + if => "$(expects)"; "pattern $(expects) does NOT match expected: '$(test.found_string[$(expects)])' != '$(expected[$(expects)])'" - if => "!$(expects)"; + if => "!$(expects)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/findfiles.cf b/tests/acceptance/01_vars/02_functions/findfiles.cf index 1d06a1a3eb..478b0fbabd 100644 --- a/tests/acceptance/01_vars/02_functions/findfiles.cf +++ b/tests/acceptance/01_vars/02_functions/findfiles.cf @@ -3,12 +3,11 @@ # Test findfiles() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common findfiles @@ -17,109 +16,115 @@ bundle common findfiles # * in filenames not allowed on win windows:: "names" slist => { "a", "bc", "d/e/f", "g/h/i/j", "klm/nop/qrs" }; - !windows:: + + !windows:: "names" slist => { "a", "bc", "d/e/f", "g/h/i/j", "klm/nop/qrs", "tu/*" }; } ####################################################### - bundle agent init { files: - "$(G.testdir)/$(findfiles.names)" - create => "true"; + "$(G.testdir)/$(findfiles.names)" create => "true"; reports: DEBUG:: "Created $(G.testdir)/$(findfiles.names)"; } - ####################################################### - bundle agent test { vars: - "patterns[a]" string => "$(G.testdir)/?"; - "patterns[b]" string => "$(G.testdir)/*"; - "patterns[c]" string => "$(G.testdir)/?/*"; - "patterns[d]" string => "$(G.testdir)/[ab]*"; - "patterns[e]" string => "$(G.testdir)/nosuch/*"; - "patterns[relative_path_1]" string => "./*"; - "patterns[relative_path_2]" string => "**"; - "patterns[relative_path_3]" string => "../**"; - !windows:: + "patterns[a]" string => "$(G.testdir)/?"; + "patterns[b]" string => "$(G.testdir)/*"; + "patterns[c]" string => "$(G.testdir)/?/*"; + "patterns[d]" string => "$(G.testdir)/[ab]*"; + "patterns[e]" string => "$(G.testdir)/nosuch/*"; + "patterns[relative_path_1]" string => "./*"; + "patterns[relative_path_2]" string => "**"; + "patterns[relative_path_3]" string => "../**"; + + !windows:: # First of all '*' is an illegal filename on Windows. Also you cannot # escape wildcards with backslash when it is a file separator. "patterns[f]" string => "$(G.testdir)/tu/\\*"; - any:: + + any:: "patterns[g]" string => "$(G.testdir)/*/**"; "patterns[h]" string => "$(G.testdir)/**/j"; - "pnames" slist => getindices("patterns"); - "found[$(pnames)]" slist => findfiles("$(patterns[$(pnames)])"); "found_string[$(pnames)]" string => join(",", "found[$(pnames)]"); - reports: DEBUG:: "findfiles pattern $(pnames) '$(patterns[$(pnames)])' => '$(found_string[$(pnames)])'"; } - ####################################################### - bundle agent check { vars: !windows:: "expected[a]" string => "$(G.testdir)/a,$(G.testdir)/d/,$(G.testdir)/g/"; - "expected[b]" string => "$(G.testdir)/a,$(G.testdir)/bc,$(G.testdir)/d/,$(G.testdir)/g/,$(G.testdir)/klm/,$(G.testdir)/tu/"; + + "expected[b]" + string => "$(G.testdir)/a,$(G.testdir)/bc,$(G.testdir)/d/,$(G.testdir)/g/,$(G.testdir)/klm/,$(G.testdir)/tu/"; "expected[c]" string => "$(G.testdir)/d/e/,$(G.testdir)/g/h/"; "expected[d]" string => "$(G.testdir)/a,$(G.testdir)/bc"; "expected[e]" string => ""; - "expected[f]" string => "$(G.testdir)/tu/*"; - "expected[g]" string => "$(G.testdir)/a,$(G.testdir)/bc,$(G.testdir)/d/,$(G.testdir)/g/,$(G.testdir)/klm/,$(G.testdir)/tu/,$(G.testdir)/d/e/,$(G.testdir)/g/h/,$(G.testdir)/klm/nop/,$(G.testdir)/tu/*,$(G.testdir)/d/e/f,$(G.testdir)/g/h/i/,$(G.testdir)/klm/nop/qrs,$(G.testdir)/g/h/i/j"; + + "expected[g]" + string => "$(G.testdir)/a,$(G.testdir)/bc,$(G.testdir)/d/,$(G.testdir)/g/,$(G.testdir)/klm/,$(G.testdir)/tu/,$(G.testdir)/d/e/,$(G.testdir)/g/h/,$(G.testdir)/klm/nop/,$(G.testdir)/tu/*,$(G.testdir)/d/e/f,$(G.testdir)/g/h/i/,$(G.testdir)/klm/nop/qrs,$(G.testdir)/g/h/i/j"; + "expected[h]" string => "$(G.testdir)/g/h/i/j"; + windows:: "expected[a]" string => "$(G.testdir)\\a,$(G.testdir)\\d,$(G.testdir)\\g"; - "expected[b]" string => "$(G.testdir)\\a,$(G.testdir)\\bc,$(G.testdir)\\d,$(G.testdir)\\g,$(G.testdir)\\klm"; + + "expected[b]" + string => "$(G.testdir)\\a,$(G.testdir)\\bc,$(G.testdir)\\d,$(G.testdir)\\g,$(G.testdir)\\klm"; "expected[c]" string => "$(G.testdir)\\d\\e,$(G.testdir)\\g\\h"; "expected[d]" string => "$(G.testdir)\\a,$(G.testdir)\\bc"; "expected[e]" string => ""; - "expected[g]" string => "$(G.testdir)\\a,$(G.testdir)\\bc,$(G.testdir)\\d,$(G.testdir)\\g,$(G.testdir)\\klm,$(G.testdir)\\d\\e,$(G.testdir)\\g\\h,$(G.testdir)\\klm\\nop,$(G.testdir)\\d\\e\\f,$(G.testdir)\\g\\h\\i,$(G.testdir)\\klm\\nop\\qrs,$(G.testdir)\\g\\h\\i\\j"; + "expected[g]" + string => "$(G.testdir)\\a,$(G.testdir)\\bc,$(G.testdir)\\d,$(G.testdir)\\g,$(G.testdir)\\klm,$(G.testdir)\\d\\e,$(G.testdir)\\g\\h,$(G.testdir)\\klm\\nop,$(G.testdir)\\d\\e\\f,$(G.testdir)\\g\\h\\i,$(G.testdir)\\klm\\nop\\qrs,$(G.testdir)\\g\\h\\i\\j"; + "expected[h]" string => "$(G.testdir)\\g\\h\\i\\j"; + any:: # relative paths are skipped, thus return empty list "expected[relative_path_1]" string => ""; "expected[relative_path_2]" string => ""; "expected[relative_path_3]" string => ""; - "expects" slist => getindices("expected"); - "fstring" slist => getindices("test.found_string"); - "joint_condition" string => join(".", "expects"); classes: - "$(expects)" expression => strcmp("$(test.found_string[$(expects)])", "$(expected[$(expects)])"); - "ok" expression => "$(joint_condition)"; + "$(expects)" + expression => strcmp( + "$(test.found_string[$(expects)])", "$(expected[$(expects)])" + ); + + "ok" expression => "$(joint_condition)"; reports: DEBUG:: "pattern $(expects) matches as expected: '$(expected[$(expects)])'" - if => "$(expects)"; + if => "$(expects)"; "pattern $(expects) does NOT match expected: '$(test.found_string[$(expects)])' != '$(expected[$(expects)])'" - if => "!$(expects)"; + if => "!$(expects)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/findfiles_glob_bracket.cf b/tests/acceptance/01_vars/02_functions/findfiles_glob_bracket.cf index 1a7f69799e..3d46dda9f5 100644 --- a/tests/acceptance/01_vars/02_functions/findfiles_glob_bracket.cf +++ b/tests/acceptance/01_vars/02_functions/findfiles_glob_bracket.cf @@ -3,101 +3,82 @@ # Test that square bracket works in glob patterns # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "init", "test", "check" }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "init", "test", "check" }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "filenames" - slist => { "foo", "bar", "baz" }; + "filenames" slist => { "foo", "bar", "baz" }; files: - "$(G.testdir)/$(filenames)" - create => "true"; + "$(G.testdir)/$(filenames)" create => "true"; reports: DEBUG:: "Created $(G.testdir)/$(filenames)"; } - ####################################################### - bundle agent test { meta: - "description" - string => "Test that square bracket works in glob patterns."; + "description" string => "Test that square bracket works in glob patterns."; vars: - "patterns[a]" - string => "$(G.testdir)/[f]oo"; - "patterns[b]" - string => "$(G.testdir)/b[a]r"; - "patterns[c]" - string => "$(G.testdir)/ba[z]"; - "patterns[d]" - string => "$(G.testdir)/[a-z][a-z][a-z]"; - "patterns[e]" - string => "$(G.testdir)/ba[rz]"; - "patterns[f]" - string => "$(G.testdir)/[fb][oa][orz]"; - - "pnames" - slist => getindices("patterns"); - "found[$(pnames)]" - slist => findfiles("$(patterns[$(pnames)])"); - "found_string[$(pnames)]" - string => join(",", "found[$(pnames)]"); + "patterns[a]" string => "$(G.testdir)/[f]oo"; + "patterns[b]" string => "$(G.testdir)/b[a]r"; + "patterns[c]" string => "$(G.testdir)/ba[z]"; + "patterns[d]" string => "$(G.testdir)/[a-z][a-z][a-z]"; + "patterns[e]" string => "$(G.testdir)/ba[rz]"; + "patterns[f]" string => "$(G.testdir)/[fb][oa][orz]"; + "pnames" slist => getindices("patterns"); + "found[$(pnames)]" slist => findfiles("$(patterns[$(pnames)])"); + "found_string[$(pnames)]" string => join(",", "found[$(pnames)]"); reports: DEBUG:: "findfiles pattern $(pnames) '$(patterns[$(pnames)])' => '$(found_string[$(pnames)])'"; } - ####################################################### - bundle agent check { meta: - "test_skip_needs_work" string => "windows", - meta => { "ENT-11176" }; + "test_skip_needs_work" + string => "windows", + meta => { "ENT-11176" }; vars: - "expected[a]" - string => "$(G.testdir)$(const.dirsep)foo"; - "expected[b]" - string => "$(G.testdir)$(const.dirsep)bar"; - "expected[c]" - string => "$(G.testdir)$(const.dirsep)baz"; - "expected[d]" - string => "$(G.testdir)$(const.dirsep)bar,$(G.testdir)$(const.dirsep)baz,$(G.testdir)$(const.dirsep)foo"; - "expected[e]" - string => "$(G.testdir)$(const.dirsep)bar,$(G.testdir)$(const.dirsep)baz"; - "expected[f]" - string => "$(G.testdir)$(const.dirsep)bar,$(G.testdir)$(const.dirsep)baz,$(G.testdir)$(const.dirsep)foo"; - - "expects" - slist => getindices("expected"); - "fstring" - slist => getindices("test.found_string"); - "joint_condition" - string => join(".", "expects"); + "expected[a]" string => "$(G.testdir)$(const.dirsep)foo"; + "expected[b]" string => "$(G.testdir)$(const.dirsep)bar"; + "expected[c]" string => "$(G.testdir)$(const.dirsep)baz"; + + "expected[d]" + string => "$(G.testdir)$(const.dirsep)bar,$(G.testdir)$(const.dirsep)baz,$(G.testdir)$(const.dirsep)foo"; + + "expected[e]" + string => "$(G.testdir)$(const.dirsep)bar,$(G.testdir)$(const.dirsep)baz"; + + "expected[f]" + string => "$(G.testdir)$(const.dirsep)bar,$(G.testdir)$(const.dirsep)baz,$(G.testdir)$(const.dirsep)foo"; + + "expects" slist => getindices("expected"); + "fstring" slist => getindices("test.found_string"); + "joint_condition" string => join(".", "expects"); classes: - "$(expects)" - expression => strcmp("$(test.found_string[$(expects)])", "$(expected[$(expects)])"); - "ok" - expression => "$(joint_condition)"; + "$(expects)" + expression => strcmp( + "$(test.found_string[$(expects)])", "$(expected[$(expects)])" + ); + + "ok" expression => "$(joint_condition)"; reports: DEBUG:: @@ -109,6 +90,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/findfiles_up.cf b/tests/acceptance/01_vars/02_functions/findfiles_up.cf index 98c2a564bd..f8ac71214c 100755 --- a/tests/acceptance/01_vars/02_functions/findfiles_up.cf +++ b/tests/acceptance/01_vars/02_functions/findfiles_up.cf @@ -4,33 +4,32 @@ body common control version => "1.0"; } -bundle common G { +bundle common G +{ vars: - "testdir" - string => concat( - getenv("TEMP", "65535"), - "$(const.dirsep)TESTDIR.cfengine" - ); + "testdir" + string => concat( + getenv("TEMP", "65535"), "$(const.dirsep)TESTDIR.cfengine" + ); } bundle agent init { vars: - "files" - slist => { - "core/.gitignore", - "core/.git/config", - "core/libpromises/cf3parse.y", - "core/libpromises/cf3lex.l", - "core/libntech/.gitignore", - "core/libntech/.git/config", - "core/libntech/libutils/string.h", - "core/libntech/libutils/string.c" - }; + "files" + slist => { + "core/.gitignore", + "core/.git/config", + "core/libpromises/cf3parse.y", + "core/libpromises/cf3lex.l", + "core/libntech/.gitignore", + "core/libntech/.git/config", + "core/libntech/libutils/string.h", + "core/libntech/libutils/string.c", + }; files: - "$(G.testdir)/$(files)" - create => "true"; + "$(G.testdir)/$(files)" create => "true"; reports: DEBUG:: @@ -40,22 +39,34 @@ bundle agent init bundle agent test { meta: - "description" -> { "CFE-3577" } - string => "Test for expected results from policy function findfiles_up"; + "description" -> { "CFE-3577" } + string => "Test for expected results from policy function findfiles_up"; vars: - "t1" - data => findfiles_up("$(G.testdir)/core/libntech/libutils/", ".gitignore", "inf"); - "t2" - data => findfiles_up("$(G.testdir)/core/libntech/libutils/", "string.?"); - "t3" - data => findfiles_up("$(G.testdir)/core/libntech/libutils/", ".git/"); - "t4" - data => findfiles_up("$(G.testdir)/core/libntech/libutils/", ".git/", "1"); - "t5" - data => findfiles_up("$(G.testdir)/core/libntech/libutils/", ".git/config"); - "t6" - data => findfiles_up("$(G.testdir)/core/libntech/libutils/", "*/cf?{lex,parse}.[ly]"); + "t1" + data => findfiles_up( + "$(G.testdir)/core/libntech/libutils/", ".gitignore", "inf" + ); + + "t2" + data => findfiles_up("$(G.testdir)/core/libntech/libutils/", "string.?"); + + "t3" data => findfiles_up("$(G.testdir)/core/libntech/libutils/", ".git/"); + + "t4" + data => findfiles_up( + "$(G.testdir)/core/libntech/libutils/", ".git/", "1" + ); + + "t5" + data => findfiles_up( + "$(G.testdir)/core/libntech/libutils/", ".git/config" + ); + + "t6" + data => findfiles_up( + "$(G.testdir)/core/libntech/libutils/", "*/cf?{lex,parse}.[ly]" + ); } bundle agent check @@ -67,30 +78,43 @@ bundle agent check strcmp("$(G.testdir)\\core\\libntech\\.gitignore", "$(test.t1[0])"), strcmp("$(G.testdir)\\core\\.gitignore", "$(test.t1[1])") ); + "c2" expression => and( - strcmp("$(G.testdir)\\core\\libntech\\libutils\\string.c", "$(test.t2[0])"), - strcmp("$(G.testdir)\\core\\libntech\\libutils\\string.h", "$(test.t2[1])") + strcmp( + "$(G.testdir)\\core\\libntech\\libutils\\string.c", "$(test.t2[0])" + ), + strcmp( + "$(G.testdir)\\core\\libntech\\libutils\\string.h", "$(test.t2[1])" + ) ); + "c3" expression => and( strcmp("$(G.testdir)\\core\\libntech\\.git\\", "$(test.t3[0])"), strcmp("$(G.testdir)\\core\\.git\\", "$(test.t3[1])") ); + "c4" expression => and( strcmp("$(G.testdir)\\core\\libntech\\.git\\", "$(test.t4[0])"), not(isvariable("test.t4[1]")) ); + "c5" expression => and( - strcmp("$(G.testdir)\\core\\libntech\\.git\\config", "$(test.t5[0])"), + strcmp( + "$(G.testdir)\\core\\libntech\\.git\\config", "$(test.t5[0])" + ), strcmp("$(G.testdir)\\core\\.git\\config", "$(test.t5[1])") ); + "c6" expression => and( strcmp("$(G.testdir)\\core\\libpromises\\cf3lex.l", "$(test.t6[0])"), - strcmp("$(G.testdir)\\core\\libpromises\\cf3parse.y", "$(test.t6[1])") + strcmp( + "$(G.testdir)\\core\\libpromises\\cf3parse.y", "$(test.t6[1])" + ) ); !windows:: @@ -99,26 +123,35 @@ bundle agent check strcmp("$(G.testdir)/core/libntech/.gitignore", "$(test.t1[0])"), strcmp("$(G.testdir)/core/.gitignore", "$(test.t1[1])") ); + "c2" expression => and( - strcmp("$(G.testdir)/core/libntech/libutils/string.c", "$(test.t2[0])"), - strcmp("$(G.testdir)/core/libntech/libutils/string.h", "$(test.t2[1])") + strcmp( + "$(G.testdir)/core/libntech/libutils/string.c", "$(test.t2[0])" + ), + strcmp( + "$(G.testdir)/core/libntech/libutils/string.h", "$(test.t2[1])" + ) ); + "c3" expression => and( strcmp("$(G.testdir)/core/libntech/.git/", "$(test.t3[0])"), strcmp("$(G.testdir)/core/.git/", "$(test.t3[1])") ); + "c4" expression => and( strcmp("$(G.testdir)/core/libntech/.git/", "$(test.t4[0])"), not(isvariable("test.t4[1]")) ); + "c5" expression => and( strcmp("$(G.testdir)/core/libntech/.git/config", "$(test.t5[0])"), strcmp("$(G.testdir)/core/.git/config", "$(test.t5[1])") ); + "c6" expression => and( strcmp("$(G.testdir)/core/libpromises/cf3lex.l", "$(test.t6[0])"), @@ -126,26 +159,33 @@ bundle agent check ); any:: - "ok" - expression => and("c1", "c2", "c3", "c4", "c5", "c6"); + "ok" expression => and("c1", "c2", "c3", "c4", "c5", "c6"); reports: DEBUG.windows.!c1:: "$(const.dollar)(test.t1[0]): Expected '$(G.testdir)\\core\\libntech\\.gitignore', found '$(test.t1[0])'"; "$(const.dollar)(test.t1[1]): Expected '$(G.testdir)\\core\\.gitignore', found '$(test.t1[1])'"; + DEBUG.windows.!c2:: "$(const.dollar)(test.t2[0]): Expected '$(G.testdir)\\core\\libntech\\libutils\\string.c', found '$(test.t2[0])'"; "$(const.dollar)(test.t2[1]): Expected '$(G.testdir)\\core\\libntech\\libutils\\string.h', found '$(test.t2[1])'"; + DEBUG.windows.!c3:: "$(const.dollar)(test.t3[0]): Expected '$(G.testdir)\\core\\libntech\\.git', found '$(test.t3[0])'"; "$(const.dollar)(test.t3[1]): Expected '$(G.testdir)\\core\\.git', found '$(test.t3[1])'"; + DEBUG.windows.!c4:: "$(const.dollar)(test.t4[0]): Expected '$(G.testdir)\\core\\libntech\\.git', found '$(test.t4[0])'"; + "$(const.dollar)(test.t4[1]): Should not exist, $(with). Expanded value: '$(test.t4[1])'" - with => ifelse(isvariable("test.t4[1]"), "but does exist", "and does not exist"); + with => ifelse( + isvariable("test.t4[1]"), "but does exist", "and does not exist" + ); + DEBUG.windows.!c5:: "$(const.dollar)(test.t5[0]): Expected '$(G.testdir)\\core\\libntech\\.git\\config', found '$(test.t5[0])'"; "$(const.dollar)(test.t5[1]): Expected '$(G.testdir)\\core\\.git\\config', found '$(test.t5[1])'"; + DEBUG.windows.!c6:: "$(const.dollar)(test.t6[0]): Expected '$(G.testdir)\\core\\libpromises\\cf3lex.l', found '$(test.t6[0])'"; "$(const.dollar)(test.t6[1]): Expected '$(G.testdir)\\core\\libpromises\\cf3parse.y', found '$(test.t6[1])'"; @@ -153,25 +193,34 @@ bundle agent check DEBUG.!windows.!c1:: "$(const.dollar)(test.t1[0]): Expected '$(G.testdir)/core/libntech/.gitignore', found '$(test.t1[0])'"; "$(const.dollar)(test.t1[1]): Expected '$(G.testdir)/core/.gitignore', found '$(test.t1[1])'"; + DEBUG.!windows.!c2:: "$(const.dollar)(test.t2[0]): Expected '$(G.testdir)/core/libntech/libutils/string.c', found '$(test.t2[0])'"; "$(const.dollar)(test.t2[1]): Expected '$(G.testdir)/core/libntech/libutils/string.h', found '$(test.t2[1])'"; + DEBUG.!windows.!c3:: "$(const.dollar)(test.t3[0]): Expected '$(G.testdir)/core/libntech/.git', found '$(test.t3[0])'"; "$(const.dollar)(test.t3[1]): Expected '$(G.testdir)/core/.git', found '$(test.t3[1])'"; + DEBUG.!windows.!c4:: "$(const.dollar)(test.t4[0]): Expected '$(G.testdir)/core/libntech/.git', found '$(test.t4[0])'"; + "$(const.dollar)(test.t4[1]): Should not exist, $(with). Expanded value: '$(test.t4[1])'" - with => ifelse(isvariable("test.t4[1]"), "but does exist", "and does not exist"); + with => ifelse( + isvariable("test.t4[1]"), "but does exist", "and does not exist" + ); + DEBUG.!windows.!c5:: "$(const.dollar)(test.t5[0]): Expected '$(G.testdir)/core/libntech/.git/config', found '$(test.t5[0])'"; "$(const.dollar)(test.t5[1]): Expected '$(G.testdir)/core/.git/config', found '$(test.t5[1])'"; + DEBUG.!windows.!c6:: "$(const.dollar)(test.t6[0]): Expected '$(G.testdir)/core/libpromises/cf3lex.l', found '$(test.t6[0])'"; "$(const.dollar)(test.t6[1]): Expected '$(G.testdir)/core/libpromises/cf3parse.y', found '$(test.t6[1])'"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/findlocalgroups.cf b/tests/acceptance/01_vars/02_functions/findlocalgroups.cf index cdf085a348..b5fd4daf26 100644 --- a/tests/acceptance/01_vars/02_functions/findlocalgroups.cf +++ b/tests/acceptance/01_vars/02_functions/findlocalgroups.cf @@ -8,27 +8,23 @@ body common control bundle agent init { vars: - # simple filters - "simple_filter" - slist => { "name=root" }; - "number_filter" - slist => { "gid=0" }; - # longer filters - "slist_filter" - slist => { "gid=0", "name=root" }; - # using data - "data_filter" - data => '[ "gid=0", "name=root" ]'; - # using regex - "simple_regex" - slist => { "name=roo.*" }; - "number_regex" - slist => { "gid=0.*" }; - "longer_regex" - slist => { "name=ro.*", "gid=0.*" }; - # non-existent group - "unknown" - slist => { "name=thisgroupdoesntexist" }; + # simple filters + "simple_filter" slist => { "name=root" }; + "number_filter" slist => { "gid=0" }; + + # longer filters + "slist_filter" slist => { "gid=0", "name=root" }; + + # using data + "data_filter" data => '[ "gid=0", "name=root" ]'; + + # using regex + "simple_regex" slist => { "name=roo.*" }; + "number_regex" slist => { "gid=0.*" }; + "longer_regex" slist => { "name=ro.*", "gid=0.*" }; + + # non-existent group + "unknown" slist => { "name=thisgroupdoesntexist" }; } bundle agent test @@ -37,23 +33,16 @@ bundle agent test "test_soft_fail" string => "(!linux&!solaris)|(termux|android)", meta => { "CFE-2318" }; + vars: - "glist1" - data => findlocalgroups("@(init.simple_filter)"); - "glist2" - data => findlocalgroups("@(init.number_filter)"); - "glist4" - data => findlocalgroups("@(init.slist_filter)"); - "glist3" - data => findlocalgroups("@(init.data_filter)"); - "glist5" - data => findlocalgroups("@(init.simple_regex)"); - "glist6" - data => findlocalgroups("@(init.number_regex)"); - "glist7" - data => findlocalgroups("@(init.longer_regex)"); - "glist8" - data => findlocalgroups("@(init.unknown)"); + "glist1" data => findlocalgroups("@(init.simple_filter)"); + "glist2" data => findlocalgroups("@(init.number_filter)"); + "glist4" data => findlocalgroups("@(init.slist_filter)"); + "glist3" data => findlocalgroups("@(init.data_filter)"); + "glist5" data => findlocalgroups("@(init.simple_regex)"); + "glist6" data => findlocalgroups("@(init.number_regex)"); + "glist7" data => findlocalgroups("@(init.longer_regex)"); + "glist8" data => findlocalgroups("@(init.unknown)"); } bundle agent check diff --git a/tests/acceptance/01_vars/02_functions/findlocalusers.cf b/tests/acceptance/01_vars/02_functions/findlocalusers.cf index 54c2d702ce..55d5f6ca0b 100644 --- a/tests/acceptance/01_vars/02_functions/findlocalusers.cf +++ b/tests/acceptance/01_vars/02_functions/findlocalusers.cf @@ -1,37 +1,47 @@ -body common control +body common control { inputs => { "../../default.sub.cf" }; bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } + bundle agent init { vars: - # parsing /etc/passwd for 'root' user - "root_idx" int => getfields("root.*", "/etc/passwd", ":", "userdata"); - "root_string" string => ifelse(isvariable("userdata[1]"), - storejson(parsejson('{$(userdata[1]) : { "uid" : $(userdata[3]) , "gid" : $(userdata[4]) , "gecos" : "$(userdata[5])", "dir" : "$(userdata[6])", "shell" : "$(userdata[7])"}}')), + # parsing /etc/passwd for 'root' user + "root_idx" int => getfields("root.*", "/etc/passwd", ":", "userdata"); + + "root_string" + string => ifelse( + isvariable("userdata[1]"), + storejson( + parsejson( + '{$(userdata[1]) : { "uid" : $(userdata[3]) , "gid" : $(userdata[4]) , "gecos" : "$(userdata[5])", "dir" : "$(userdata[6])", "shell" : "$(userdata[7])"}}' + ) + ), storejson(parsejson('{}')) ); - "empty_string" string => storejson(parsejson('{}')); - # simple filters - "simple_filter" slist => { "name=$(userdata[1])" }; - - # longer filters - "slist_filter" slist => { "gid=$(userdata[4])", "name=root" }; + "empty_string" string => storejson(parsejson('{}')); + + # simple filters + "simple_filter" slist => { "name=$(userdata[1])" }; + + # longer filters + "slist_filter" slist => { "gid=$(userdata[4])", "name=root" }; - # using data - "data_filter" data => '[ "gid=$(userdata[4])", "name=root" ]'; + # using data + "data_filter" data => '[ "gid=$(userdata[4])", "name=root" ]'; - # using regex - "simple_regex" slist => { "name=roo.*" }; - "longer_regex" slist => { "name=roo.*", "uid=0.*" }; + # using regex + "simple_regex" slist => { "name=roo.*" }; + "longer_regex" slist => { "name=roo.*", "uid=0.*" }; - # non-existent user - "unknown" slist => { "name=thisuserdoesntexist" }; + # non-existent user + "unknown" slist => { "name=thisuserdoesntexist" }; } -bundle agent test + +bundle agent test { vars: "ulist1" string => storejson(findlocalusers("@(init.simple_filter)")); @@ -40,30 +50,35 @@ bundle agent test "ulist4" string => storejson(findlocalusers("@(init.simple_regex)")); "ulist5" string => storejson(findlocalusers("@(init.longer_regex)")); "ulist6" string => storejson(findlocalusers("@(init.unknown)")); - } + bundle agent check { meta: - "test_soft_fail" string => "windows", + "test_soft_fail" + string => "windows", meta => { "CFE-2318" }; + classes: - "ok" expression => and( - strcmp("$(test.ulist1)", "$(init.root_string)"), - strcmp("$(test.ulist2)", "$(init.root_string)"), - strcmp("$(test.ulist3)", "$(init.root_string)"), - strcmp("$(test.ulist4)", "$(init.root_string)"), - strcmp("$(test.ulist5)", "$(init.root_string)"), - strcmp("$(test.ulist6)", "$(init.empty_string)") - ); + "ok" + expression => and( + strcmp("$(test.ulist1)", "$(init.root_string)"), + strcmp("$(test.ulist2)", "$(init.root_string)"), + strcmp("$(test.ulist3)", "$(init.root_string)"), + strcmp("$(test.ulist4)", "$(init.root_string)"), + strcmp("$(test.ulist5)", "$(init.root_string)"), + strcmp("$(test.ulist6)", "$(init.empty_string)") + ); + reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + DEBUG:: "$(init.root_string)"; - "$(test.ulist1)"; "$(test.ulist2)"; "$(test.ulist3)"; diff --git a/tests/acceptance/01_vars/02_functions/fold.cf b/tests/acceptance/01_vars/02_functions/fold.cf index 8732d27ea2..0c34e8c3a4 100644 --- a/tests/acceptance/01_vars/02_functions/fold.cf +++ b/tests/acceptance/01_vars/02_functions/fold.cf @@ -3,51 +3,54 @@ # Test folding functions: length(), max(), min(), mean(), range(), and variance() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { vars: - "a" slist => { "b", "c", "a" }; - "b" slist => { "100", "9", "10" }; - "c" slist => { }; - "d" slist => { "", "a", "", "b" }; - "e" slist => { "a", "1", "b" }; - "f" rlist => { "100", "200", "300" }; - "g" rlist => { "1.11", "-2.22", "-3.33" }; - "h" ilist => { "-10", "0", "200" }; - "i" data => parsejson('[ 1, 2, 3000 ]'); - "j" data => parsejson('[ 1, 2, [ 3, 4, 5 ], null, true, false ]'); - "k" data => parsejson('{}'); - "l" data => parsejson('{ "a": 100, "b": 200, "c": null}'); - - "lists" slist => { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l" }; - "bad_lists" slist => { "c", "k" }; - "good_lists" slist => difference("lists", "bad_lists"); - "joined_$(lists)" string => format("%S", $(lists)); - - "length_$(lists)" int => length($(lists)); - "lexmin_$(lists)" string => min($(lists), "lex"); - "realmin_$(lists)" string => min($(lists), "real"); - "lexmax_$(lists)" string => max($(lists), "lex"); - "realmax_$(lists)" string => max($(lists), "real"); - "variance_$(lists)" string => format("%.2f", variance($(lists))); - "stddev_$(lists)" string => format("%.2f", eval("sqrt($(variance_$(lists)))", "math", "infix")); - "mean_$(lists)" string => format("%.2f", mean($(lists))); + "a" slist => { "b", "c", "a" }; + "b" slist => { "100", "9", "10" }; + "c" slist => {}; + "d" slist => { "", "a", "", "b" }; + "e" slist => { "a", "1", "b" }; + "f" rlist => { "100", "200", "300" }; + "g" rlist => { "1.11", "-2.22", "-3.33" }; + "h" ilist => { "-10", "0", "200" }; + "i" data => parsejson('[ 1, 2, 3000 ]'); + "j" data => parsejson('[ 1, 2, [ 3, 4, 5 ], null, true, false ]'); + "k" data => parsejson('{}'); + "l" data => parsejson('{ "a": 100, "b": 200, "c": null}'); + + "lists" + slist => { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l" }; + + "bad_lists" slist => { "c", "k" }; + "good_lists" slist => difference("lists", "bad_lists"); + "joined_$(lists)" string => format("%S", $(lists)); + "length_$(lists)" int => length($(lists)); + "lexmin_$(lists)" string => min($(lists), "lex"); + "realmin_$(lists)" string => min($(lists), "real"); + "lexmax_$(lists)" string => max($(lists), "lex"); + "realmax_$(lists)" string => max($(lists), "real"); + "variance_$(lists)" string => format("%.2f", variance($(lists))); + + "stddev_$(lists)" + string => format( + "%.2f", eval("sqrt($(variance_$(lists)))", "math", "infix") + ); + + "mean_$(lists)" string => format("%.2f", mean($(lists))); reports: DEBUG:: @@ -61,148 +64,244 @@ bundle agent test "List $(lists): $(joined_$(lists)) had real max $(realmax_$(lists))"; } - ####################################################### - bundle agent check { vars: - "lists" slist => { @(test.lists) }; - "good_lists" slist => { @(test.good_lists) }; - "methods" slist => { @(test.methods) }; - "measurements" slist => { "length", "mean", "variance", "stddev", "lexmin", "lexmax", "realmin", "realmax" }; - - "expected[a][length]" int => "3"; - "expected[b][length]" int => "3"; - "expected[c][length]" int => "0"; - "expected[d][length]" int => "4"; - "expected[e][length]" int => "3"; - "expected[f][length]" int => "3"; - "expected[g][length]" int => "3"; - "expected[h][length]" int => "3"; - "expected[i][length]" int => "3"; - "expected[j][length]" int => "6"; - "expected[k][length]" int => "0"; - "expected[l][length]" int => "3"; - - "expected[a][variance]" string => "0.00"; - "expected[b][variance]" string => "2730.33"; - "expected[c][variance]" string => "-1"; - "expected[d][variance]" string => "0.00"; - "expected[e][variance]" string => "0.33"; - "expected[f][variance]" string => "10000.00"; - "expected[g][variance]" string => "5.34"; - "expected[h][variance]" string => "14033.33"; - "expected[i][variance]" string => "2997001.00"; - "expected[j][variance]" string => "0.92"; - "expected[k][variance]" string => "0"; - "expected[l][variance]" string => "5000.00"; - - "expected[a][stddev]" string => "0.00"; - "expected[b][stddev]" string => "52.25"; - "expected[c][stddev]" string => "-1"; - "expected[d][stddev]" string => "0.00"; - "expected[e][stddev]" string => "0.57"; - "expected[f][stddev]" string => "100.00"; - "expected[g][stddev]" string => "2.31"; - "expected[h][stddev]" string => "118.46"; - "expected[i][stddev]" string => "1731.18"; - "expected[j][stddev]" string => "0.96"; - "expected[k][stddev]" string => "0"; - "expected[l][stddev]" string => "70.71"; - - "expected[a][mean]" string => "0.00"; - "expected[b][mean]" string => "39.67"; - "expected[c][mean]" string => "-1"; - "expected[d][mean]" string => "0.00"; - "expected[e][mean]" string => "0.33"; - "expected[f][mean]" string => "200.00"; - "expected[g][mean]" string => "-1.48"; - "expected[h][mean]" string => "63.33"; - "expected[i][mean]" string => "1001.00"; - "expected[j][mean]" string => "0.75"; - "expected[k][mean]" string => "0"; - "expected[l][mean]" string => "150.00"; - - "expected[a][lexmin]" string => "a"; - "expected[b][lexmin]" string => "10"; - "expected[c][lexmin]" string => "-1"; - "expected[d][lexmin]" string => ""; - "expected[e][lexmin]" string => "1"; - "expected[f][lexmin]" string => "100"; - "expected[g][lexmin]" string => "-2.22"; - "expected[h][lexmin]" string => "-10"; - "expected[i][lexmin]" string => "1"; - "expected[j][lexmin]" string => "1"; - "expected[k][lexmin]" string => ""; - "expected[l][lexmin]" string => "100"; - - "expected[a][realmin]" string => "a"; - "expected[b][realmin]" string => "9"; - "expected[c][realmin]" string => "-1"; - "expected[d][realmin]" string => ""; - "expected[e][realmin]" string => "a"; - "expected[f][realmin]" string => "100"; - "expected[g][realmin]" string => "-3.33"; - "expected[h][realmin]" string => "-10"; - "expected[i][realmin]" string => "1"; - "expected[j][realmin]" string => "false"; - "expected[k][realmin]" string => ""; - "expected[l][realmin]" string => "100"; - - "expected[a][lexmax]" string => "c"; - "expected[b][lexmax]" string => "9"; - "expected[c][lexmax]" string => "-1"; - "expected[d][lexmax]" string => "b"; - "expected[e][lexmax]" string => "b"; - "expected[f][lexmax]" string => "300"; - "expected[g][lexmax]" string => "1.11"; - "expected[h][lexmax]" string => "200"; - "expected[i][lexmax]" string => "3000"; - "expected[j][lexmax]" string => "true"; - "expected[k][lexmax]" string => ""; - "expected[l][lexmax]" string => "200"; - - "expected[a][realmax]" string => "c"; - "expected[b][realmax]" string => "100"; - "expected[c][realmax]" string => "-1"; - "expected[d][realmax]" string => "b"; - "expected[e][realmax]" string => "1"; - "expected[f][realmax]" string => "300"; - "expected[g][realmax]" string => "1.11"; - "expected[h][realmax]" string => "200"; - "expected[i][realmax]" string => "3000"; - "expected[j][realmax]" string => "2"; - "expected[k][realmax]" string => ""; - "expected[l][realmax]" string => "200"; + "lists" slist => { @(test.lists) }; + "good_lists" slist => { @(test.good_lists) }; + "methods" slist => { @(test.methods) }; + + "measurements" + slist => { + "length", + "mean", + "variance", + "stddev", + "lexmin", + "lexmax", + "realmin", + "realmax", + }; + + "expected[a][length]" int => "3"; + "expected[b][length]" int => "3"; + "expected[c][length]" int => "0"; + "expected[d][length]" int => "4"; + "expected[e][length]" int => "3"; + "expected[f][length]" int => "3"; + "expected[g][length]" int => "3"; + "expected[h][length]" int => "3"; + "expected[i][length]" int => "3"; + "expected[j][length]" int => "6"; + "expected[k][length]" int => "0"; + "expected[l][length]" int => "3"; + "expected[a][variance]" string => "0.00"; + "expected[b][variance]" string => "2730.33"; + "expected[c][variance]" string => "-1"; + "expected[d][variance]" string => "0.00"; + "expected[e][variance]" string => "0.33"; + "expected[f][variance]" string => "10000.00"; + "expected[g][variance]" string => "5.34"; + "expected[h][variance]" string => "14033.33"; + "expected[i][variance]" string => "2997001.00"; + "expected[j][variance]" string => "0.92"; + "expected[k][variance]" string => "0"; + "expected[l][variance]" string => "5000.00"; + "expected[a][stddev]" string => "0.00"; + "expected[b][stddev]" string => "52.25"; + "expected[c][stddev]" string => "-1"; + "expected[d][stddev]" string => "0.00"; + "expected[e][stddev]" string => "0.57"; + "expected[f][stddev]" string => "100.00"; + "expected[g][stddev]" string => "2.31"; + "expected[h][stddev]" string => "118.46"; + "expected[i][stddev]" string => "1731.18"; + "expected[j][stddev]" string => "0.96"; + "expected[k][stddev]" string => "0"; + "expected[l][stddev]" string => "70.71"; + "expected[a][mean]" string => "0.00"; + "expected[b][mean]" string => "39.67"; + "expected[c][mean]" string => "-1"; + "expected[d][mean]" string => "0.00"; + "expected[e][mean]" string => "0.33"; + "expected[f][mean]" string => "200.00"; + "expected[g][mean]" string => "-1.48"; + "expected[h][mean]" string => "63.33"; + "expected[i][mean]" string => "1001.00"; + "expected[j][mean]" string => "0.75"; + "expected[k][mean]" string => "0"; + "expected[l][mean]" string => "150.00"; + "expected[a][lexmin]" string => "a"; + "expected[b][lexmin]" string => "10"; + "expected[c][lexmin]" string => "-1"; + "expected[d][lexmin]" string => ""; + "expected[e][lexmin]" string => "1"; + "expected[f][lexmin]" string => "100"; + "expected[g][lexmin]" string => "-2.22"; + "expected[h][lexmin]" string => "-10"; + "expected[i][lexmin]" string => "1"; + "expected[j][lexmin]" string => "1"; + "expected[k][lexmin]" string => ""; + "expected[l][lexmin]" string => "100"; + "expected[a][realmin]" string => "a"; + "expected[b][realmin]" string => "9"; + "expected[c][realmin]" string => "-1"; + "expected[d][realmin]" string => ""; + "expected[e][realmin]" string => "a"; + "expected[f][realmin]" string => "100"; + "expected[g][realmin]" string => "-3.33"; + "expected[h][realmin]" string => "-10"; + "expected[i][realmin]" string => "1"; + "expected[j][realmin]" string => "false"; + "expected[k][realmin]" string => ""; + "expected[l][realmin]" string => "100"; + "expected[a][lexmax]" string => "c"; + "expected[b][lexmax]" string => "9"; + "expected[c][lexmax]" string => "-1"; + "expected[d][lexmax]" string => "b"; + "expected[e][lexmax]" string => "b"; + "expected[f][lexmax]" string => "300"; + "expected[g][lexmax]" string => "1.11"; + "expected[h][lexmax]" string => "200"; + "expected[i][lexmax]" string => "3000"; + "expected[j][lexmax]" string => "true"; + "expected[k][lexmax]" string => ""; + "expected[l][lexmax]" string => "200"; + "expected[a][realmax]" string => "c"; + "expected[b][realmax]" string => "100"; + "expected[c][realmax]" string => "-1"; + "expected[d][realmax]" string => "b"; + "expected[e][realmax]" string => "1"; + "expected[f][realmax]" string => "300"; + "expected[g][realmax]" string => "1.11"; + "expected[h][realmax]" string => "200"; + "expected[i][realmax]" string => "3000"; + "expected[j][realmax]" string => "2"; + "expected[k][realmax]" string => ""; + "expected[l][realmax]" string => "200"; classes: - "ok_$(measurements)_$(lists)" expression => strcmp("$(expected[$(lists)][$(measurements)])", - "$(test.$(measurements)_$(lists))"); - - "no_$(measurements)_$(lists)" not => isvariable("test.$(measurements)_$(lists)"); - - "ok" and => { - "ok_length_a", "ok_length_b", "ok_length_c", "ok_length_d", "ok_length_e", "ok_length_f", "ok_length_g", "ok_length_h", "ok_length_i", "ok_length_j", "ok_length_k", "ok_length_l", - "ok_mean_a", "ok_mean_b", "no_mean_c", "ok_mean_d", "ok_mean_e", "ok_mean_f", "ok_mean_g", "ok_mean_h", "ok_mean_i", "ok_mean_j", "no_mean_k", "ok_mean_l", - "ok_variance_a", "ok_variance_b", "no_variance_c", "ok_variance_d", "ok_variance_e", "ok_variance_f", "ok_variance_g", "ok_variance_h", "ok_variance_i", "ok_variance_j", "no_variance_k", "ok_variance_l", - "ok_stddev_a", "ok_stddev_b", "no_stddev_c", "ok_stddev_d", "ok_stddev_e", "ok_stddev_f", "ok_stddev_g", "ok_stddev_h", "ok_stddev_i", "ok_stddev_j", "no_stddev_k", "ok_stddev_l", - "ok_realmax_a", "ok_realmax_b", "no_realmax_c", "ok_realmax_d", "ok_realmax_e", "ok_realmax_f", "ok_realmax_g", "ok_realmax_h", "ok_realmax_i", "ok_realmax_j", "no_realmax_k", "ok_realmax_l", - "ok_realmin_a", "ok_realmin_b", "no_realmin_c", "ok_realmin_d", "ok_realmin_e", "ok_realmin_f", "ok_realmin_g", "ok_realmin_h", "ok_realmin_i", "ok_realmin_j", "no_realmin_k", "ok_realmin_l", - "ok_lexmax_a", "ok_lexmax_b", "no_lexmax_c", "ok_lexmax_d", "ok_lexmax_e", "ok_lexmax_f", "ok_lexmax_g", "ok_lexmax_h", "ok_lexmax_i", "ok_lexmax_j", "no_lexmax_k", "ok_lexmax_l", - "ok_lexmin_a", "ok_lexmin_b", "no_lexmin_c", "ok_lexmin_d", "ok_lexmin_e", "ok_lexmin_f", "ok_lexmin_g", "ok_lexmin_h", "ok_lexmin_i", "ok_lexmin_j", "no_lexmin_k", "ok_lexmin_l", + "ok_$(measurements)_$(lists)" + expression => strcmp( + "$(expected[$(lists)][$(measurements)])", + "$(test.$(measurements)_$(lists))" + ); + + "no_$(measurements)_$(lists)" + not => isvariable("test.$(measurements)_$(lists)"); + + "ok" + and => { + "ok_length_a", + "ok_length_b", + "ok_length_c", + "ok_length_d", + "ok_length_e", + "ok_length_f", + "ok_length_g", + "ok_length_h", + "ok_length_i", + "ok_length_j", + "ok_length_k", + "ok_length_l", + "ok_mean_a", + "ok_mean_b", + "no_mean_c", + "ok_mean_d", + "ok_mean_e", + "ok_mean_f", + "ok_mean_g", + "ok_mean_h", + "ok_mean_i", + "ok_mean_j", + "no_mean_k", + "ok_mean_l", + "ok_variance_a", + "ok_variance_b", + "no_variance_c", + "ok_variance_d", + "ok_variance_e", + "ok_variance_f", + "ok_variance_g", + "ok_variance_h", + "ok_variance_i", + "ok_variance_j", + "no_variance_k", + "ok_variance_l", + "ok_stddev_a", + "ok_stddev_b", + "no_stddev_c", + "ok_stddev_d", + "ok_stddev_e", + "ok_stddev_f", + "ok_stddev_g", + "ok_stddev_h", + "ok_stddev_i", + "ok_stddev_j", + "no_stddev_k", + "ok_stddev_l", + "ok_realmax_a", + "ok_realmax_b", + "no_realmax_c", + "ok_realmax_d", + "ok_realmax_e", + "ok_realmax_f", + "ok_realmax_g", + "ok_realmax_h", + "ok_realmax_i", + "ok_realmax_j", + "no_realmax_k", + "ok_realmax_l", + "ok_realmin_a", + "ok_realmin_b", + "no_realmin_c", + "ok_realmin_d", + "ok_realmin_e", + "ok_realmin_f", + "ok_realmin_g", + "ok_realmin_h", + "ok_realmin_i", + "ok_realmin_j", + "no_realmin_k", + "ok_realmin_l", + "ok_lexmax_a", + "ok_lexmax_b", + "no_lexmax_c", + "ok_lexmax_d", + "ok_lexmax_e", + "ok_lexmax_f", + "ok_lexmax_g", + "ok_lexmax_h", + "ok_lexmax_i", + "ok_lexmax_j", + "no_lexmax_k", + "ok_lexmax_l", + "ok_lexmin_a", + "ok_lexmin_b", + "no_lexmin_c", + "ok_lexmin_d", + "ok_lexmin_e", + "ok_lexmin_f", + "ok_lexmin_g", + "ok_lexmin_h", + "ok_lexmin_i", + "ok_lexmin_j", + "no_lexmin_k", + "ok_lexmin_l", }; reports: DEBUG:: "$(good_lists) $(measurements) check expected '$(expected[$(good_lists)][$(measurements)])' <> actual '$(test.$(measurements)_$(good_lists))'" - if => "!ok_$(measurements)_$(good_lists)"; + if => "!ok_$(measurements)_$(good_lists)"; "good list $(good_lists) had no $(measurements): '$(test.$(measurements)_$(good_lists))' was not expanded" - if => "no_$(measurements)_$(good_lists)"; + if => "no_$(measurements)_$(good_lists)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/format.cf b/tests/acceptance/01_vars/02_functions/format.cf index 8115d68ee1..a9cf432a9b 100644 --- a/tests/acceptance/01_vars/02_functions/format.cf +++ b/tests/acceptance/01_vars/02_functions/format.cf @@ -3,23 +3,21 @@ # Test formatint(), formatreal(), and formatstring() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_defaults => empty, edit_line => init_insert; @@ -28,68 +26,65 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "key='c32' value='(unhandled format)'"; - "key='c107' value='(unhandled format)'"; - "key='int100' value='100'"; - "key='string100' value='100'"; - "key='int0100' value='0100'"; - "key='string0100' value='0100'"; - "key='real200' value='200.0'"; - "key='string200' value='200.0'"; - "key='real0200_00' value='0200.00'"; - "key='string0200_00' value='0200.00'"; - "key='stringabc' value='abc'"; - "key='string6abc' value=' abc'"; - "key='string-6abc' value='abc '"; - "key='2strings-6abc-6def' value='abc def '"; - "key='S_empty_list' value='{ }'"; - "key='badend' value='ends badly '"; - "key='escape' value='% should be a single percent'"; - "key='S_123_list' value='{ \"one\", \"two\", \"\\\"three\\\"\" }'"; - "key='S_container_1' value='[null]'"; - "key='S_container_2' value='[{\"x\":123},\"yz\"]'"; + "key='c32' value='(unhandled format)'"; + "key='c107' value='(unhandled format)'"; + "key='int100' value='100'"; + "key='string100' value='100'"; + "key='int0100' value='0100'"; + "key='string0100' value='0100'"; + "key='real200' value='200.0'"; + "key='string200' value='200.0'"; + "key='real0200_00' value='0200.00'"; + "key='string0200_00' value='0200.00'"; + "key='stringabc' value='abc'"; + "key='string6abc' value=' abc'"; + "key='string-6abc' value='abc '"; + "key='2strings-6abc-6def' value='abc def '"; + "key='S_empty_list' value='{ }'"; + "key='badend' value='ends badly '"; + "key='escape' value='% should be a single percent'"; + "key='S_123_list' value='{ \"one\", \"two\", \"\\\"three\\\"\" }'"; + "key='S_container_1' value='[null]'"; + "key='S_container_2' value='[{\"x\":123},\"yz\"]'"; } ####################################################### - bundle agent test { vars: - "array[c32]" string => format("%c", 32); - "array[c107]" string => format("%c", 107); - "array[int100]" string => format("%d", 100); - "array[string100]" string => format("%d", "100"); - "array[int0100]" string => format("%04d", 100); - "array[string0100]" string => format("%04d", "100"); - "array[real200]" string => format("%.1f", 200); - "array[string200]" string => format("%.1f", "200.00"); - "array[real0200_00]" string => format("%07.2f", 200); - "array[string0200_00]" string => format("%07.2f", "200.00"); - "array[stringabc]" string => format("%s", "abc"); - "array[string6abc]" string => format("%6s", "abc"); - "array[string-6abc]" string => format("%-6s", "abc"); - "array[2strings-6abc-6def]" string => format("%-6s%-6s", "abc", "def"); - "array[badend]" string => format("ends badly %"); - "array[escape]" string => format("%% should be a single percent"); - - # %S specifier - "mydata" string => 'simplest data'; - "emptylist" slist => {}; - "list123" slist => { "one", "two", '"three"'}; - "mycontainer1" data => parsejson("[ null ]"); - "mycontainer2" data => parsejson('[ { "x": 123 }, "yz" ]'); - - "array[S_string]" string => format("prefix %S suffix", "simple data"); - "array[S_var]" string => format("%S", $(mydata)); - "array[S_empty_list]" string => format("%S", emptylist); - "array[S_123_list]" string => format("%S", list123); - "array[S_container_1]" string => format("%S", mycontainer1); - "array[S_container_2]" string => format("%S", mycontainer2); - - "formatted" slist => maparray("key='$(this.k)' value='$(this.v)'", "array"); + "array[c32]" string => format("%c", 32); + "array[c107]" string => format("%c", 107); + "array[int100]" string => format("%d", 100); + "array[string100]" string => format("%d", "100"); + "array[int0100]" string => format("%04d", 100); + "array[string0100]" string => format("%04d", "100"); + "array[real200]" string => format("%.1f", 200); + "array[string200]" string => format("%.1f", "200.00"); + "array[real0200_00]" string => format("%07.2f", 200); + "array[string0200_00]" string => format("%07.2f", "200.00"); + "array[stringabc]" string => format("%s", "abc"); + "array[string6abc]" string => format("%6s", "abc"); + "array[string-6abc]" string => format("%-6s", "abc"); + "array[2strings-6abc-6def]" string => format("%-6s%-6s", "abc", "def"); + "array[badend]" string => format("ends badly %"); + "array[escape]" string => format("%% should be a single percent"); + + # %S specifier + "mydata" string => 'simplest data'; + "emptylist" slist => {}; + "list123" slist => { "one", "two", '"three"' }; + "mycontainer1" data => parsejson("[ null ]"); + "mycontainer2" data => parsejson('[ { "x": 123 }, "yz" ]'); + "array[S_string]" string => format("prefix %S suffix", "simple data"); + "array[S_var]" string => format("%S", $(mydata)); + "array[S_empty_list]" string => format("%S", emptylist); + "array[S_123_list]" string => format("%S", list123); + "array[S_container_1]" string => format("%S", mycontainer1); + "array[S_container_2]" string => format("%S", mycontainer2); + "formatted" slist => maparray("key='$(this.k)' value='$(this.v)'", "array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -101,18 +96,20 @@ bundle agent test bundle edit_line test_insert { vars: - "formatted" slist => { @{test.formatted} }; + "formatted" slist => { @{test.formatted} }; insert_lines: - "$(formatted)"; + "$(formatted)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/format_edge_case.cf b/tests/acceptance/01_vars/02_functions/format_edge_case.cf index 7133b01617..abd24f4745 100644 --- a/tests/acceptance/01_vars/02_functions/format_edge_case.cf +++ b/tests/acceptance/01_vars/02_functions/format_edge_case.cf @@ -1,28 +1,36 @@ # Test bug fix # Former bug truncates strings greater than 4096 bytes # There is no reason for format() to truncate strings - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ########################################################## - -bundle agent test { +bundle agent test +{ vars: - "str" string => format('%s', 'Hello, everyone! This is the LONGEST TEXT EVER! I was inspired by the various other longest texts ever on the internet, and I wanted to make my own. So here it is! This is going to be a WORLD RECORD! This is actually my third attempt at doing this. The first time, I didnt save it. The second time, the Neocities editor crashed. Now Im writing this in Notepad, then copying it into the Neocities editor instead of typing it directly in the Neocities editor to avoid crashing. It sucks that my past two attempts are gone now. Those actually got pretty long. Not the longest, but still pretty long. I hope this one wont get lost somehow. Anyways, lets talk about WAFFLES! I like waffles. Waffles are cool. Waffles is a funny word. Theres a Teen Titans Go episode called Waffles where the word Waffles is said a hundred-something times. Its pretty annoying. Theres also a Teen Titans Go episode about Pig Latin. Dont know what Pig Latin is? Its a language where you take all the consonants before the first vowel, move them to the end, and add -ay to the end. If the word begins with a vowel, you just add -way to the end. For example, Waffles becomes Afflesway. Ive been speaking Pig Latin fluently since the fourth grade, so it surprised me when I saw the episode for the first time. I speak Pig Latin with my sister sometimes. Its pretty fun. I like speaking it in public so that everyone around us gets confused. Thats never actually happened before, but if it ever does, twill be pretty funny. By the way, twill is a word I invented recently, and its a contraction of it will. I really hope it gains popularity in the near future, because twill is WAY more fun than saying itll. Itll is too boring. Nobody likes boring. This is nowhere near being the longest text ever, but eventually it will be! I might still be writing this a decade later, who knows? But right now, its not very long. But Ill just keep writing until it is the longest! Have you ever heard the song Dau Dau by Awesome Scampis? Its an amazing song. Look it up on YouTube! I play that song all the time around my sister! It drives her crazy, and I love it. Another way I like driving my sister crazy is by speaking my own made up language to her. She hates the languages I make! The only language that we both speak besides English is Pig Latin. I think you already knew that. Whatever. I think Im gonna go for now. Bye! Hi, Im back now. Im gonna contribute more to this soon-to-be giant wall of text. I just realised I have a giant stuffed frog on my bed. I forgot his name. Im pretty sure it was something stupid though. I think it was FROG in Morse Code or something. Morse Code is cool. I know a bit of it, but Im not very good at it. Im also not very good at French. I barely know anything in French, and my pronunciation probably sucks. But Im learning it, at least. Im also learning Esperanto. Its this language that was made up by some guy a long time ago to be the universal language. A lot of people speak it. I am such a language nerd. Half of this text is probably gonna be about languages. But hey, as long as its long! Ha, get it? As LONG as its LONG? Im so funny, right? No, Im not. I should probably get some sleep. Goodnight! Hello, Im back again. I basically have only two interests nowadays: languages and furries. What? Oh, sorry, I thought you knew I was a furry. Haha, oops. Anyway, yeah, Im a furry, but since Im a young furry, I cant really do as much as I would like to do in the fandom. When Im older, I would like to have a fursuit, go to furry conventions, all that stuff. But for now I can only dream of that. Sorry you had to deal with me talking about furries, but Im honestly very desperate for this to be the longest text ever. Last night I was watching nothing but fursuit unboxings. I think I need help. This one time, me and my mom were going to go to a furry Christmas party, but we didnt end up going because of the fact that there was alcohol on the premises, and that she didnt wanna have to be a mom dragging her son through a crowd of furries. Both of those reasons were understandable. Okay, hopefully I wont have to talk about furries anymore. I dont care if youre a furry reading this right now, I just dont wanna have to torture everyone else.'); - "list" slist => { $(str) }; - "list_str" string => format('%S', "list"); - "container" data => parsejson(' ["$(str)"] '); - "container_str" string => format('%S', "container"); + "str" + string => format( + '%s', + 'Hello, everyone! This is the LONGEST TEXT EVER! I was inspired by the various other longest texts ever on the internet, and I wanted to make my own. So here it is! This is going to be a WORLD RECORD! This is actually my third attempt at doing this. The first time, I didnt save it. The second time, the Neocities editor crashed. Now Im writing this in Notepad, then copying it into the Neocities editor instead of typing it directly in the Neocities editor to avoid crashing. It sucks that my past two attempts are gone now. Those actually got pretty long. Not the longest, but still pretty long. I hope this one wont get lost somehow. Anyways, lets talk about WAFFLES! I like waffles. Waffles are cool. Waffles is a funny word. Theres a Teen Titans Go episode called Waffles where the word Waffles is said a hundred-something times. Its pretty annoying. Theres also a Teen Titans Go episode about Pig Latin. Dont know what Pig Latin is? Its a language where you take all the consonants before the first vowel, move them to the end, and add -ay to the end. If the word begins with a vowel, you just add -way to the end. For example, Waffles becomes Afflesway. Ive been speaking Pig Latin fluently since the fourth grade, so it surprised me when I saw the episode for the first time. I speak Pig Latin with my sister sometimes. Its pretty fun. I like speaking it in public so that everyone around us gets confused. Thats never actually happened before, but if it ever does, twill be pretty funny. By the way, twill is a word I invented recently, and its a contraction of it will. I really hope it gains popularity in the near future, because twill is WAY more fun than saying itll. Itll is too boring. Nobody likes boring. This is nowhere near being the longest text ever, but eventually it will be! I might still be writing this a decade later, who knows? But right now, its not very long. But Ill just keep writing until it is the longest! Have you ever heard the song Dau Dau by Awesome Scampis? Its an amazing song. Look it up on YouTube! I play that song all the time around my sister! It drives her crazy, and I love it. Another way I like driving my sister crazy is by speaking my own made up language to her. She hates the languages I make! The only language that we both speak besides English is Pig Latin. I think you already knew that. Whatever. I think Im gonna go for now. Bye! Hi, Im back now. Im gonna contribute more to this soon-to-be giant wall of text. I just realised I have a giant stuffed frog on my bed. I forgot his name. Im pretty sure it was something stupid though. I think it was FROG in Morse Code or something. Morse Code is cool. I know a bit of it, but Im not very good at it. Im also not very good at French. I barely know anything in French, and my pronunciation probably sucks. But Im learning it, at least. Im also learning Esperanto. Its this language that was made up by some guy a long time ago to be the universal language. A lot of people speak it. I am such a language nerd. Half of this text is probably gonna be about languages. But hey, as long as its long! Ha, get it? As LONG as its LONG? Im so funny, right? No, Im not. I should probably get some sleep. Goodnight! Hello, Im back again. I basically have only two interests nowadays: languages and furries. What? Oh, sorry, I thought you knew I was a furry. Haha, oops. Anyway, yeah, Im a furry, but since Im a young furry, I cant really do as much as I would like to do in the fandom. When Im older, I would like to have a fursuit, go to furry conventions, all that stuff. But for now I can only dream of that. Sorry you had to deal with me talking about furries, but Im honestly very desperate for this to be the longest text ever. Last night I was watching nothing but fursuit unboxings. I think I need help. This one time, me and my mom were going to go to a furry Christmas party, but we didnt end up going because of the fact that there was alcohol on the premises, and that she didnt wanna have to be a mom dragging her son through a crowd of furries. Both of those reasons were understandable. Okay, hopefully I wont have to talk about furries anymore. I dont care if youre a furry reading this right now, I just dont wanna have to torture everyone else.' + ); + + "list" slist => { $(str) }; + "list_str" string => format('%S', "list"); + "container" data => parsejson(' ["$(str)"] '); + "container_str" string => format('%S', "container"); } -bundle agent check { +bundle agent check +{ methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/function_with_skipped_promise.cf b/tests/acceptance/01_vars/02_functions/function_with_skipped_promise.cf index 3f5aadc3fb..dab893ecef 100644 --- a/tests/acceptance/01_vars/02_functions/function_with_skipped_promise.cf +++ b/tests/acceptance/01_vars/02_functions/function_with_skipped_promise.cf @@ -1,43 +1,45 @@ # Make sure function is (not) evaluated in a promise (not) skipped via if # Redmine 6577 - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testdir)/." create => "true"; + "$(G.testdir)/." create => "true"; } bundle agent test { vars: - "files" slist => { "want_file", "dont_want_file" }; + "files" slist => { "want_file", "dont_want_file" }; classes: - "want_file" expression => "any"; + "want_file" expression => "any"; - "test" expression => returnszero("$(G.touch) $(G.testdir)/$(files)", "noshell"), - if => "$(files)"; + "test" + expression => returnszero("$(G.touch) $(G.testdir)/$(files)", "noshell"), + if => "$(files)"; } bundle agent check { classes: - "$(test.files)_exists" expression => fileexists("$(G.testdir)/$(test.files)"); + "$(test.files)_exists" + expression => fileexists("$(G.testdir)/$(test.files)"); - "ok" expression => "want_file_exists.!dont_want_file_exists"; + "ok" expression => "want_file_exists.!dont_want_file_exists"; reports: DEBUG.!ok:: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/getfields.cf b/tests/acceptance/01_vars/02_functions/getfields.cf index d6274b9809..7af6fdbd12 100644 --- a/tests/acceptance/01_vars/02_functions/getfields.cf +++ b/tests/acceptance/01_vars/02_functions/getfields.cf @@ -3,20 +3,18 @@ # Test getfields() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_fill_in; @@ -28,46 +26,45 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "one:data1"; - "two:data2"; - "three:data3"; + "one:data1"; + "two:data2"; + "three:data3"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } - ####################################################### - bundle agent test { vars: - "num_matching" int => getfields("t.*", "$(G.testfile)", ":", "fields"); + "num_matching" int => getfields("t.*", "$(G.testfile)", ":", "fields"); } - ####################################################### - bundle agent check { classes: any:: - "ok" and => { - strcmp("$(test.fields[1])", "two"), - strcmp("$(test.fields[2])", "data2"), - strcmp("$(test.num_matching)", "2") - }; + "ok" + and => { + strcmp("$(test.fields[1])", "two"), + strcmp("$(test.fields[2])", "data2"), + strcmp("$(test.num_matching)", "2"), + }; reports: DEBUG:: "got field $(test.fields[1])"; "got field $(test.fields[2])"; "num_matching is $(test.num_matching)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/getgroupinfo.cf b/tests/acceptance/01_vars/02_functions/getgroupinfo.cf index ebc67b2f03..18c2630a19 100644 --- a/tests/acceptance/01_vars/02_functions/getgroupinfo.cf +++ b/tests/acceptance/01_vars/02_functions/getgroupinfo.cf @@ -3,29 +3,33 @@ # Test 'getgroupinfo' function # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10217" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10217" }; + vars: - # this is pretty much all we can test across platforms - "info_root" string => nth(getgroupinfo("root"), "name"); - "info_0" string => nth(getgroupinfo(0), "gid"); + # this is pretty much all we can test across platforms + "info_root" string => nth(getgroupinfo("root"), "name"); + "info_0" string => nth(getgroupinfo(0), "gid"); } bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - "$(this.promise_filename)"); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/getgroups.cf b/tests/acceptance/01_vars/02_functions/getgroups.cf index c74c77f678..fd354c1dc6 100644 --- a/tests/acceptance/01_vars/02_functions/getgroups.cf +++ b/tests/acceptance/01_vars/02_functions/getgroups.cf @@ -3,7 +3,6 @@ # Test getgroups(), list content # ####################################################### - body common control { inputs => { "../../default.sub.cf" }; @@ -16,51 +15,82 @@ bundle agent check meta: "description" -> { "ENT-12722" } string => "Test whether the entries of getroups() are like the ones inside /etc/group"; - "test_skip_unsupported" - string => "windows"; + + "test_skip_unsupported" string => "windows"; + vars: # parse /etc/group "group_entries" slist => splitstring(string_trim(readfile("/etc/group")), "\n", 999); + "name_gid_dict" slist => maplist( - concat(nth(splitstring("$(this)", ":", 4), 0), ":", nth(splitstring("$(this)", ":", 4), 2)), + concat( + nth(splitstring("$(this)", ":", 4), 0), + ":", + nth(splitstring("$(this)", ":", 4), 2) + ), "@(group_entries)" ); + # extra three arbitrary groups - "three_first_dict" - slist => sublist("@(name_gid_dict)", "head", 3); - "group_filter" - string => join("|", "@(three_first_dict)"); + "three_first_dict" slist => sublist("@(name_gid_dict)", "head", 3); + "group_filter" string => join("|", "@(three_first_dict)"); + # list of group names apart from the three extracted "actual_groups" - slist => maplist(nth(splitstring("$(this)", ":", 2), 0), filter("($(group_filter))", "@(name_gid_dict)", true, true, 999)); + slist => maplist( + nth(splitstring("$(this)", ":", 2), 0), + filter("($(group_filter))", "@(name_gid_dict)", true, true, 999) + ); # prepare getgroups args "arg1" - slist => maplist(nth(splitstring("$(this)", ":", 2), 0), "@(three_first_dict)"); + slist => maplist( + nth(splitstring("$(this)", ":", 2), 0), "@(three_first_dict)" + ); + "arg2" - slist => maplist(nth(splitstring("$(this)", ":", 2), 1), "@(three_first_dict)"); + slist => maplist( + nth(splitstring("$(this)", ":", 2), 1), "@(three_first_dict)" + ); # Concat resulting lists "actual_groups_content" string => join(" ", sort("@(actual_groups)", "lex")); + "retrieved_groups_content_arg1" string => join(" ", sort(getgroups(join(",", "@(arg1)"), ""), "lex")); + "retrieved_groups_content_arg2" string => join(" ", sort(getgroups("", join(",", "@(arg2)")), "lex")); + "retrieved_groups_content_arg1_arg2" - string => join(" ", sort(getgroups(join(",", sublist("@(arg1)", "head", 2)), join(",", sublist("@(arg2)", "tail", 2))), "lex")); + string => join( + " ", + sort( + getgroups( + join(",", sublist("@(arg1)", "head", 2)), + join(",", sublist("@(arg2)", "tail", 2)) + ), + "lex" + ) + ); + classes: "ok" expression => and( strcmp("$(actual_groups_content)", "$(retrieved_groups_content_arg1)"), strcmp("$(actual_groups_content)", "$(retrieved_groups_content_arg2)"), - strcmp("$(actual_groups_content)", "$(retrieved_groups_content_arg1_arg2)") + strcmp( + "$(actual_groups_content)", "$(retrieved_groups_content_arg1_arg2)" + ) ); + reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/getgroups_vararg.cf b/tests/acceptance/01_vars/02_functions/getgroups_vararg.cf index 4edd518a67..fdf7058811 100644 --- a/tests/acceptance/01_vars/02_functions/getgroups_vararg.cf +++ b/tests/acceptance/01_vars/02_functions/getgroups_vararg.cf @@ -3,54 +3,51 @@ # Test getgroups() variable args # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } + bundle agent test { - meta: - "description" - string => "Test variable arguments with getgroups()"; + meta: + "description" string => "Test variable arguments with getgroups()"; + "test_skip_unsupported" string => "windows"; - "test_skip_unsupported" - string => "windows"; vars: - "group_entries" slist => splitstring(string_trim(readfile("/etc/group")), "\n", 999); + "group_entries" + slist => splitstring(string_trim(readfile("/etc/group")), "\n", 999); "name_list" slist => maplist( - nth(splitstring("$(this)", ":", 1), 0), - "@(group_entries)" + nth(splitstring("$(this)", ":", 1), 0), "@(group_entries)" ); - "actual_groups_content" - string => join(" ", sort("@(name_list)", "lex")); + "actual_groups_content" string => join(" ", sort("@(name_list)", "lex")); "groups1" slist => getgroups(); "groups2" slist => getgroups(""); - "groups3" slist => getgroups("",""); - - "retrieved_groups_content_1" - string => join(" ", sort("@(groups1)", "lex")); - "retrieved_groups_content_2" - string => join(" ", sort("@(groups2)", "lex")); - "retrieved_groups_content_3" - string => join(" ", sort("@(groups3)", "lex")); - + "groups3" slist => getgroups("", ""); + "retrieved_groups_content_1" string => join(" ", sort("@(groups1)", "lex")); + "retrieved_groups_content_2" string => join(" ", sort("@(groups2)", "lex")); + "retrieved_groups_content_3" string => join(" ", sort("@(groups3)", "lex")); } bundle agent check { - classes: "ok" expression => and( - strcmp("$(test.actual_groups_content)", "$(test.retrieved_groups_content_1)"), - strcmp("$(test.actual_groups_content)", "$(test.retrieved_groups_content_2)"), - strcmp("$(test.actual_groups_content)", "$(test.retrieved_groups_content_3)") + strcmp( + "$(test.actual_groups_content)", "$(test.retrieved_groups_content_1)" + ), + strcmp( + "$(test.actual_groups_content)", "$(test.retrieved_groups_content_2)" + ), + strcmp( + "$(test.actual_groups_content)", "$(test.retrieved_groups_content_3)" + ) ); reports: diff --git a/tests/acceptance/01_vars/02_functions/getindices.cf b/tests/acceptance/01_vars/02_functions/getindices.cf index c5d023689c..e0369c30c9 100644 --- a/tests/acceptance/01_vars/02_functions/getindices.cf +++ b/tests/acceptance/01_vars/02_functions/getindices.cf @@ -3,65 +3,62 @@ # Test that getindices on an array variable will resolve to 2 levels # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - # Do not change the name of this bundle or of variables inside this bundle. The # original bug CFE-2397 depended on a certain order in the variable table which # was triggered by these names. bundle common b { vars: - "d[k]" string => "val1"; - "d[f][f1]" string => "val2"; - "d[s][s1]" string => "val3"; - - "d_keys" slist => getindices("d"); - "d_keys_f" slist => getindices("d[f]"); - "d_keys_s" slist => getindices("d[s]"); - - "c[$(d_keys)]" string => "$(d[$(d_keys)])"; - "c[f][$(d_keys_f)]" string => "$(d[f][$(d_keys_f)])"; - "c[s][$(d_keys_s)]" string => "$(d[s][$(d_keys_s)])"; - - "c_keys" slist => getindices("c"); - "c_keys_f" slist => getindices("c[f]"); - "c_keys_s" slist => getindices("c[s]"); + "d[k]" string => "val1"; + "d[f][f1]" string => "val2"; + "d[s][s1]" string => "val3"; + "d_keys" slist => getindices("d"); + "d_keys_f" slist => getindices("d[f]"); + "d_keys_s" slist => getindices("d[s]"); + "c[$(d_keys)]" string => "$(d[$(d_keys)])"; + "c[f][$(d_keys_f)]" string => "$(d[f][$(d_keys_f)])"; + "c[s][$(d_keys_s)]" string => "$(d[s][$(d_keys_s)])"; + "c_keys" slist => getindices("c"); + "c_keys_f" slist => getindices("c[f]"); + "c_keys_s" slist => getindices("c[s]"); } bundle agent test { vars: - "user[name]" string => "zamboni"; - "user[fullname][first]" string => "Diego"; - "user[fullname][last]" string => "Zamboni"; - "user[dirs]" slist => { "/home/zamboni", - "/tmp/zamboni", - "/export/home/zamboni" }; + "user[name]" string => "zamboni"; + "user[fullname][first]" string => "Diego"; + "user[fullname][last]" string => "Zamboni"; + + "user[dirs]" + slist => { "/home/zamboni", "/tmp/zamboni", "/export/home/zamboni" }; - "fields" slist => getindices("user"); - "userfields" slist => getindices("user[fullname]"); - "inline_fields" slist => getindices('{ "foo": 1, "bar": 2 }'); - "inline_numfields" slist => getindices('[ "foo", 1, "bar", 2 ]'); - "inline_function" slist => getindices(parsejson('{ "a": "b", "c": "d" }')); - "c_keys" slist => { @(b.c_keys) }; - "c_keys_f" slist => { @(b.c_keys_f) }; - "c_keys_s" slist => { @(b.c_keys_s) }; + "fields" slist => getindices("user"); + "userfields" slist => getindices("user[fullname]"); + "inline_fields" slist => getindices('{ "foo": 1, "bar": 2 }'); + "inline_numfields" slist => getindices('[ "foo", 1, "bar", 2 ]'); + "inline_function" slist => getindices(parsejson('{ "a": "b", "c": "d" }')); + "c_keys" slist => { @(b.c_keys) }; + "c_keys_f" slist => { @(b.c_keys_f) }; + "c_keys_s" slist => { @(b.c_keys_s) }; } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/getindices_and_getvalues_return_same_with_empty_datacontainer.cf b/tests/acceptance/01_vars/02_functions/getindices_and_getvalues_return_same_with_empty_datacontainer.cf index e1fe3fba06..c18a2d066c 100644 --- a/tests/acceptance/01_vars/02_functions/getindices_and_getvalues_return_same_with_empty_datacontainer.cf +++ b/tests/acceptance/01_vars/02_functions/getindices_and_getvalues_return_same_with_empty_datacontainer.cf @@ -1,42 +1,38 @@ body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test { meta: - "description" string => "Test that getindices() and getvalues() return the same data when run against an empty data container"; + "description" + string => "Test that getindices() and getvalues() return the same data when run against an empty data container"; - "test_soft_fail" - string => "cfengine_3_9_1", - meta => { "CFE-2479" }, - comment => "This regression was found in 3.9.1 from 3.7.4. Soft failing + "test_soft_fail" + string => "cfengine_3_9_1", + meta => { "CFE-2479" }, + comment => "This regression was found in 3.9.1 from 3.7.4. Soft failing for already released version where tests will fail."; vars: - # Because def.does_not_exist does in fact not exist, we expect this will - # produce an empty data container. - "data" data => mergedata("def.does_not_exist"); - - "a" slist => getindices(data); - "b" slist => getvalues(data); + # Because def.does_not_exist does in fact not exist, we expect this will + # produce an empty data container. + "data" data => mergedata("def.does_not_exist"); + "a" slist => getindices(data); + "b" slist => getvalues(data); reports: DEBUG:: - "a is variable" - if => isvariable(a); - "b is variable" - if => isvariable(b); + "a is variable" if => isvariable(a); + "b is variable" if => isvariable(b); "getindices and getvalues do not behave the same when run against an empty data container." if => not(and(isvariable(a), isvariable(b))); any:: "CFEngine version: $(sys.cf_version)"; - - "$(this.promise_filename) Pass" - if => and(isvariable(a), isvariable(b)); + "$(this.promise_filename) Pass" if => and(isvariable(a), isvariable(b)); "$(this.promise_filename) FAIL" if => not(and(isvariable(a), isvariable(b))); diff --git a/tests/acceptance/01_vars/02_functions/getindices_returns_empty_list_if_array_index_has_no_key_values.cf b/tests/acceptance/01_vars/02_functions/getindices_returns_empty_list_if_array_index_has_no_key_values.cf index c0b2421579..328ccbe37a 100644 --- a/tests/acceptance/01_vars/02_functions/getindices_returns_empty_list_if_array_index_has_no_key_values.cf +++ b/tests/acceptance/01_vars/02_functions/getindices_returns_empty_list_if_array_index_has_no_key_values.cf @@ -6,13 +6,12 @@ ####################################################### body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: @@ -21,33 +20,30 @@ bundle agent init } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "!any", - meta => { "redmine7116" }; + "test_soft_fail" + string => "!any", + meta => { "redmine7116" }; vars: "values_data" slist => getindices("init.data[bar]"); } ####################################################### - bundle agent check { vars: - "expected_elements" slist => { }; - - "diff1" slist => difference( "test.values_data", expected_elements ); - "diff2" slist => difference( expected_elements, "test.values_data"); - - "len_values_data" int => length( "test.values_data" ); + "expected_elements" slist => {}; + "diff1" slist => difference("test.values_data", expected_elements); + "diff2" slist => difference(expected_elements, "test.values_data"); + "len_values_data" int => length("test.values_data"); "len_diff1" int => length(diff1); "len_diff2" int => length(diff2); classes: - "ok" expression => strcmp( $(len_diff1), $(len_diff2) ); + "ok" expression => strcmp($(len_diff1), $(len_diff2)); reports: DEBUG:: diff --git a/tests/acceptance/01_vars/02_functions/getindices_returns_empty_list_if_datacontainer_index_has_no_key_values.cf b/tests/acceptance/01_vars/02_functions/getindices_returns_empty_list_if_datacontainer_index_has_no_key_values.cf index 55328f0204..2a5f1b3886 100644 --- a/tests/acceptance/01_vars/02_functions/getindices_returns_empty_list_if_datacontainer_index_has_no_key_values.cf +++ b/tests/acceptance/01_vars/02_functions/getindices_returns_empty_list_if_datacontainer_index_has_no_key_values.cf @@ -4,56 +4,54 @@ # on a datacontainer index that has no key values. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "data" data => parsejson('{ + "data" + data => parsejson( + '{ "foo": [ "alpha", "bravo" ], "bar": "zulu" -}'); +}' + ); } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "!any", - meta => { "redmine7116" }; + "test_soft_fail" + string => "!any", + meta => { "redmine7116" }; vars: "values_data" slist => getindices("init.data[bar]"); } ####################################################### - bundle agent check { vars: - "expected_elements" slist => { }; - - "diff1" slist => difference( "test.values_data", expected_elements ); - "diff2" slist => difference( expected_elements, "test.values_data"); - - "len_values_data" int => length( "test.values_data" ); + "expected_elements" slist => {}; + "diff1" slist => difference("test.values_data", expected_elements); + "diff2" slist => difference(expected_elements, "test.values_data"); + "len_values_data" int => length("test.values_data"); "len_diff1" int => length(diff1); "len_diff2" int => length(diff2); classes: - "ok" expression => strcmp( $(len_diff1), $(len_diff2) ); + "ok" expression => strcmp($(len_diff1), $(len_diff2)); reports: DEBUG:: diff --git a/tests/acceptance/01_vars/02_functions/getindices_returns_expected_list_from_array.cf b/tests/acceptance/01_vars/02_functions/getindices_returns_expected_list_from_array.cf index 4600f3dd17..030fd5b637 100644 --- a/tests/acceptance/01_vars/02_functions/getindices_returns_expected_list_from_array.cf +++ b/tests/acceptance/01_vars/02_functions/getindices_returns_expected_list_from_array.cf @@ -4,16 +4,14 @@ # an array # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: @@ -21,12 +19,10 @@ bundle agent init "data[bar]" string => "zulu"; "data[bar][one]" string => "1"; "data[bar][two]" string => "2"; - "data[zebra][gazelle]" slist => { "alpha", "bravo" }; "data[zebra][lion]" string => "zulu"; "data[zebra][lion][first]" string => "1st"; "data[zebra][lion][second]" string => "2nd"; - "data[one][two][zero]" slist => { "alpha", "bravo" }; "data[one][two][three]" string => "zulu"; "data[one][two][three][a]" string => "c"; @@ -34,7 +30,6 @@ bundle agent init } ####################################################### - bundle agent test { vars: @@ -44,11 +39,13 @@ bundle agent test } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "any" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/getindices_returns_expected_list_from_datacontainer.cf b/tests/acceptance/01_vars/02_functions/getindices_returns_expected_list_from_datacontainer.cf index 35dfe1b4a2..f920dad1de 100644 --- a/tests/acceptance/01_vars/02_functions/getindices_returns_expected_list_from_datacontainer.cf +++ b/tests/acceptance/01_vars/02_functions/getindices_returns_expected_list_from_datacontainer.cf @@ -4,20 +4,20 @@ # a data container # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "data" data => parsejson('{ + "data" + data => parsejson( + '{ "foo": [ "alpha", "bravo" @@ -26,24 +26,26 @@ bundle agent init "one": "1", "two": "2" } -}'); +}' + ); } ####################################################### - bundle agent test { vars: - # expected: one, two - "values_data" slist => getindices("init.data[bar]"); + # expected: one, two + "values_data" slist => getindices("init.data[bar]"); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/getindices_size2_with_expansion.cf b/tests/acceptance/01_vars/02_functions/getindices_size2_with_expansion.cf index 140b70f3d3..f47e08b855 100644 --- a/tests/acceptance/01_vars/02_functions/getindices_size2_with_expansion.cf +++ b/tests/acceptance/01_vars/02_functions/getindices_size2_with_expansion.cf @@ -3,21 +3,20 @@ # Test getindices(), size 2 with variable expansion # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert; } @@ -25,28 +24,25 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "the fini$end"; - "the end$(const.dollar)fini"; - "XXX dummy XXX"; - "YYY $(init.dummy) YYY"; + "the fini$end"; + "the end$(const.dollar)fini"; + "XXX dummy XXX"; + "YYY $(init.dummy) YYY"; } ####################################################### - bundle agent test { vars: - "array[the fini$end]" string => - "additional line + "array[the fini$end]" string => "additional line again"; - "array[the end$(const.dollar)fini]" string => "one$(const.n)extra line"; - "array[XXX dummy XXX]" string => "XXX dummy XXX"; - "array[YYY $(init.dummy) YYY]" string => "YYY $(init.dummy) YYY"; - - "keys" slist => getindices("array"); + "array[the end$(const.dollar)fini]" string => "one$(const.n)extra line"; + "array[XXX dummy XXX]" string => "XXX dummy XXX"; + "array[YYY $(init.dummy) YYY]" string => "YYY $(init.dummy) YYY"; + "keys" slist => getindices("array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -58,26 +54,27 @@ again"; bundle edit_line test_insert { vars: - "keys" slist => { @{test.keys} }; + "keys" slist => { @{test.keys} }; insert_lines: - "$(keys)"; + "$(keys)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("$(G.testfile).*"); + "any" usebundle => dcs_fini("$(G.testfile).*"); } diff --git a/tests/acceptance/01_vars/02_functions/getindices_with_multi_index_arrays.cf b/tests/acceptance/01_vars/02_functions/getindices_with_multi_index_arrays.cf index 85d6e87971..f652c35654 100644 --- a/tests/acceptance/01_vars/02_functions/getindices_with_multi_index_arrays.cf +++ b/tests/acceptance/01_vars/02_functions/getindices_with_multi_index_arrays.cf @@ -4,59 +4,58 @@ # Redmine#6779 # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ########################################################### - bundle agent init { } ########################################################### - bundle agent test { - vars: - "bundle_config[dir][dir_test1]" string => "dir_test1"; - "bundle_config[dir][dir_test2]" string => "dir_test2"; - "bundle_config[lnk][lnk_test1]" string => "lnk_test1"; - "bundle_config[lnk][lnk_test2]" string => "lnk_test2"; - - "dir_keys" slist => getindices("bundle_config[dir]"); - "lnk_keys" slist => getindices("bundle_config[lnk]"); - - "dir_keys_sorted" slist => sort("dir_keys", "lex"); - "lnk_keys_sorted" slist => sort("lnk_keys", "lex"); - - "dir_keys_str" string => join(",", "dir_keys_sorted"); - "lnk_keys_str" string => join(",", "lnk_keys_sorted"); + vars: + "bundle_config[dir][dir_test1]" string => "dir_test1"; + "bundle_config[dir][dir_test2]" string => "dir_test2"; + "bundle_config[lnk][lnk_test1]" string => "lnk_test1"; + "bundle_config[lnk][lnk_test2]" string => "lnk_test2"; + "dir_keys" slist => getindices("bundle_config[dir]"); + "lnk_keys" slist => getindices("bundle_config[lnk]"); + "dir_keys_sorted" slist => sort("dir_keys", "lex"); + "lnk_keys_sorted" slist => sort("lnk_keys", "lex"); + "dir_keys_str" string => join(",", "dir_keys_sorted"); + "lnk_keys_str" string => join(",", "lnk_keys_sorted"); } ########################################################### - bundle agent check { - vars: - "expected_dir_keys" string => "dir_test1,dir_test2"; - "expected_lnk_keys" string => "lnk_test1,lnk_test2"; - - classes: - "ok_dir_keys" expression => strcmp($(expected_dir_keys), $(test.dir_keys_str)); - "ok_lnk_keys" expression => strcmp($(expected_lnk_keys), $(test.lnk_keys_str)); - "ok" and => { "ok_dir_keys", "ok_lnk_keys" }; - - reports: - DEBUG:: - "dir_keys = '$(test.dir_keys_str)', expected = '$(expected_dir_keys)'"; - "lnk_keys = '$(test.lnk_keys_str)', expected = '$(expected_lnk_keys)'"; - ok:: - "$(this.promise_filename) Pass"; - !ok:: - "$(this.promise_filename) FAIL"; + vars: + "expected_dir_keys" string => "dir_test1,dir_test2"; + "expected_lnk_keys" string => "lnk_test1,lnk_test2"; + + classes: + "ok_dir_keys" + expression => strcmp($(expected_dir_keys), $(test.dir_keys_str)); + + "ok_lnk_keys" + expression => strcmp($(expected_lnk_keys), $(test.lnk_keys_str)); + + "ok" and => { "ok_dir_keys", "ok_lnk_keys" }; + + reports: + DEBUG:: + "dir_keys = '$(test.dir_keys_str)', expected = '$(expected_dir_keys)'"; + "lnk_keys = '$(test.lnk_keys_str)', expected = '$(expected_lnk_keys)'"; + + ok:: + "$(this.promise_filename) Pass"; + + !ok:: + "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/gettags.cf b/tests/acceptance/01_vars/02_functions/gettags.cf index ed2df21691..b4dd0c202d 100644 --- a/tests/acceptance/01_vars/02_functions/gettags.cf +++ b/tests/acceptance/01_vars/02_functions/gettags.cf @@ -1,57 +1,81 @@ # Test that getvariabletags and getclasstags work correctly - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle common init { meta: - "tags" slist => { "bundletag1", "foo=bar" }; + "tags" slist => { "bundletag1", "foo=bar" }; + classes: - "myclass" expression => "any", meta => { "mytag1" }; - "myotherclass" expression => "any", meta => { "mytag5", "mytag51" }; - "myplainclass" expression => "any"; - "keyclass" expression => "any", meta => { "foo=1", "mytag51", "foo", "foo=2" }; - "keyclass2" expression => "any", meta => { "foo" }; + "myclass" + expression => "any", + meta => { "mytag1" }; + + "myotherclass" + expression => "any", + meta => { "mytag5", "mytag51" }; + + "myplainclass" expression => "any"; + + "keyclass" + expression => "any", + meta => { "foo=1", "mytag51", "foo", "foo=2" }; + + "keyclass2" + expression => "any", + meta => { "foo" }; vars: - "tests" slist => { "1", "2", "3", "4", "5" }; - "myvar" string => "123", meta => { "mytag3" }; - "myothervar" string => "123"; - "keyvar" int => "1", meta => { "foo=1", "mytag51", "foo", "foo=2" }; - "keyvar2" real => "20", meta => { "foo" }; + "tests" slist => { "1", "2", "3", "4", "5" }; + + "myvar" + string => "123", + meta => { "mytag3" }; + + "myothervar" string => "123"; + + "keyvar" + int => "1", + meta => { "foo=1", "mytag51", "foo", "foo=2" }; + + "keyvar2" + real => "20", + meta => { "foo" }; } bundle agent test { vars: - "tags1" slist => getclassmetatags("myclass"); - "tags2" slist => getclassmetatags("myplainclass"); - "tags3" slist => getvariablemetatags("init.myvar"); - "tags4" slist => getvariablemetatags("init.myothervar"); - "tags5" slist => getclassmetatags("myotherclass"); - "tags6" slist => getclassmetatags("nosuchclass"); - "tags7" slist => getvariablemetatags("nosuchvariable"); - "tags8" slist => getclassmetatags("keyclass", "foo"); - "tags9" slist => getclassmetatags("keyclass2", "foo"); - "tagsa" slist => getvariablemetatags("init.keyvar", "foo"); - "tagsb" slist => getvariablemetatags("init.keyvar2", "foo"); - "tagsc" slist => getbundlemetatags("default:init"); - "tagsd" slist => getbundlemetatags("init", "foo"); - "tagse" slist => getbundlemetatags("something:dummy"); - "tagsf" slist => getbundlemetatags("something:dummy", "foo"); + "tags1" slist => getclassmetatags("myclass"); + "tags2" slist => getclassmetatags("myplainclass"); + "tags3" slist => getvariablemetatags("init.myvar"); + "tags4" slist => getvariablemetatags("init.myothervar"); + "tags5" slist => getclassmetatags("myotherclass"); + "tags6" slist => getclassmetatags("nosuchclass"); + "tags7" slist => getvariablemetatags("nosuchvariable"); + "tags8" slist => getclassmetatags("keyclass", "foo"); + "tags9" slist => getclassmetatags("keyclass2", "foo"); + "tagsa" slist => getvariablemetatags("init.keyvar", "foo"); + "tagsb" slist => getvariablemetatags("init.keyvar2", "foo"); + "tagsc" slist => getbundlemetatags("default:init"); + "tagsd" slist => getbundlemetatags("init", "foo"); + "tagse" slist => getbundlemetatags("something:dummy"); + "tagsf" slist => getbundlemetatags("something:dummy", "foo"); } - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } body file control @@ -62,5 +86,5 @@ body file control bundle common dummy { meta: - "tags" slist => { "dummytag1", "dummytag2", "foo=bar", "foo=hello" }; + "tags" slist => { "dummytag1", "dummytag2", "foo=bar", "foo=hello" }; } diff --git a/tests/acceptance/01_vars/02_functions/getuserinfo.cf b/tests/acceptance/01_vars/02_functions/getuserinfo.cf index bd20ab454a..eb21e1fc4b 100644 --- a/tests/acceptance/01_vars/02_functions/getuserinfo.cf +++ b/tests/acceptance/01_vars/02_functions/getuserinfo.cf @@ -3,29 +3,33 @@ # Test 'getuserinfo' function # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10217" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10217" }; + vars: - # this is pretty much all we can test across platforms - "info_root" string => nth(getuserinfo("root"), "username"); - "info_0" string => nth(getuserinfo(0), "uid"); + # this is pretty much all we can test across platforms + "info_root" string => nth(getuserinfo("root"), "username"); + "info_0" string => nth(getuserinfo(0), "uid"); } bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/getusers_vararg.cf b/tests/acceptance/01_vars/02_functions/getusers_vararg.cf index 47abf6f240..6478ce9a74 100644 --- a/tests/acceptance/01_vars/02_functions/getusers_vararg.cf +++ b/tests/acceptance/01_vars/02_functions/getusers_vararg.cf @@ -3,54 +3,53 @@ # Test getusers() variable args # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } + bundle agent test { - meta: + meta: "description" -> { "ENT-9962" } string => "Test variable arguments with getusers()"; - "test_skip_unsupported" - string => "windows"; + "test_skip_unsupported" string => "windows"; + vars: - "user_entries" slist => splitstring(string_trim(readfile("/etc/passwd")), "\n", 999); + "user_entries" + slist => splitstring(string_trim(readfile("/etc/passwd")), "\n", 999); "name_list" slist => maplist( - nth(splitstring("$(this)", ":", 1), 0), - "@(user_entries)" + nth(splitstring("$(this)", ":", 1), 0), "@(user_entries)" ); - "actual_users_content" - string => join(" ", sort("@(name_list)", "lex")); - "users1" slist => getusers(); + "actual_users_content" string => join(" ", sort("@(name_list)", "lex")); + "users1" slist => getusers(); "users2" slist => getusers(""); - "users3" slist => getusers("",""); - - "retrieved_users_content_1" - string => join(" ", sort("@(users1)", "lex")); - "retrieved_users_content_2" - string => join(" ", sort("@(users2)", "lex")); - "retrieved_users_content_3" - string => join(" ", sort("@(users3)", "lex")); - + "users3" slist => getusers("", ""); + "retrieved_users_content_1" string => join(" ", sort("@(users1)", "lex")); + "retrieved_users_content_2" string => join(" ", sort("@(users2)", "lex")); + "retrieved_users_content_3" string => join(" ", sort("@(users3)", "lex")); } bundle agent check { - classes: "ok" expression => and( - strcmp("$(test.actual_users_content)", "$(test.retrieved_users_content_1)"), - strcmp("$(test.actual_users_content)", "$(test.retrieved_users_content_2)"), - strcmp("$(test.actual_users_content)", "$(test.retrieved_users_content_3)") + strcmp( + "$(test.actual_users_content)", "$(test.retrieved_users_content_1)" + ), + strcmp( + "$(test.actual_users_content)", "$(test.retrieved_users_content_2)" + ), + strcmp( + "$(test.actual_users_content)", "$(test.retrieved_users_content_3)" + ) ); reports: diff --git a/tests/acceptance/01_vars/02_functions/getvalues.cf b/tests/acceptance/01_vars/02_functions/getvalues.cf index 8d274de1f7..de1a2ea579 100644 --- a/tests/acceptance/01_vars/02_functions/getvalues.cf +++ b/tests/acceptance/01_vars/02_functions/getvalues.cf @@ -3,38 +3,38 @@ # Test getvalues() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "user[name]" string => "zamboni"; - "user[fullname][first]" string => "Diego"; - "user[fullname][last]" string => "Zamboni"; - "user[dirs]" slist => { "/home/zamboni", - "/tmp/zamboni", - "/export/home/zamboni" }; + "user[name]" string => "zamboni"; + "user[fullname][first]" string => "Diego"; + "user[fullname][last]" string => "Zamboni"; - "values" slist => getvalues("user"); - "uservalues" slist => getvalues("user[fullname]"); - "inline_values_map" slist => getvalues('{ "foo": 1, "bar": 2 }'); - "inline_values_array" slist => getvalues('[ "foo", 1, "bar", 2 ]'); + "user[dirs]" + slist => { "/home/zamboni", "/tmp/zamboni", "/export/home/zamboni" }; + + "values" slist => getvalues("user"); + "uservalues" slist => getvalues("user[fullname]"); + "inline_values_map" slist => getvalues('{ "foo": 1, "bar": 2 }'); + "inline_values_array" slist => getvalues('[ "foo", 1, "bar", 2 ]'); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/getvalues_array_returns_first_index_values.cf b/tests/acceptance/01_vars/02_functions/getvalues_array_returns_first_index_values.cf index f78136732b..ea5b9eda6a 100644 --- a/tests/acceptance/01_vars/02_functions/getvalues_array_returns_first_index_values.cf +++ b/tests/acceptance/01_vars/02_functions/getvalues_array_returns_first_index_values.cf @@ -3,43 +3,39 @@ # Test getvalues() # ####################################################### - # If we run getvalues on a classic array index that contains a string # we should end up with a list made up of that single value - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { - vars: - "array[string]" string => "scrumdiddlyumptious"; - "array[slist]" slist => { "1", "2" }; - "array[idx][2]" slist => { "3", "4" }; # DO not expect to get these values - "values" slist => getvalues("array"); + "array[string]" string => "scrumdiddlyumptious"; + "array[slist]" slist => { "1", "2" }; + "array[idx][2]" slist => { "3", "4" }; + + # DO not expect to get these values + "values" slist => getvalues("array"); } ####################################################### - bundle agent check { vars: "expected" slist => { "scrumdiddlyumptious", 1, 2 }; - "diff" slist => difference( expected, "test.values" ); - + "diff" slist => difference(expected, "test.values"); + classes: - "_pass" expression => strcmp( length( diff ), 0 ); + "_pass" expression => strcmp(length(diff), 0); methods: - - _pass:: + _pass:: "pass" usebundle => dcs_pass("$(this.promise_filename)"); !_pass:: diff --git a/tests/acceptance/01_vars/02_functions/getvalues_array_slist.cf b/tests/acceptance/01_vars/02_functions/getvalues_array_slist.cf index 4da2748095..6d4fc78514 100644 --- a/tests/acceptance/01_vars/02_functions/getvalues_array_slist.cf +++ b/tests/acceptance/01_vars/02_functions/getvalues_array_slist.cf @@ -3,40 +3,35 @@ # Test getvalues() # ####################################################### - # If we run getvalues on a classic array index that contains an slist we should # end up with a copy of that slist. - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "array[slist]" slist => { "scrumdiddlyumptious" }; - "values" slist => getvalues("array[slist]"); + "array[slist]" slist => { "scrumdiddlyumptious" }; + "values" slist => getvalues("array[slist]"); } ####################################################### - bundle agent check { vars: "expected" slist => { "scrumdiddlyumptious" }; - "diff" slist => difference( expected, "test.values" ); - + "diff" slist => difference(expected, "test.values"); + classes: - "_pass" expression => strcmp( length( diff ), 0 ); + "_pass" expression => strcmp(length(diff), 0); methods: - - _pass:: + _pass:: "pass" usebundle => dcs_pass("$(this.promise_filename)"); !_pass:: diff --git a/tests/acceptance/01_vars/02_functions/getvalues_array_string.cf b/tests/acceptance/01_vars/02_functions/getvalues_array_string.cf index b0922d900a..c3d5c782cd 100644 --- a/tests/acceptance/01_vars/02_functions/getvalues_array_string.cf +++ b/tests/acceptance/01_vars/02_functions/getvalues_array_string.cf @@ -3,39 +3,34 @@ # Test getvalues() # ####################################################### - # If we run getvalues on a classic array index that contains a string # we should end up with a list made up of that single value - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "array[string]" string => "scrumdiddlyumptious"; - "values" slist => getvalues("array[string]"); + "array[string]" string => "scrumdiddlyumptious"; + "values" slist => getvalues("array[string]"); } ####################################################### - bundle agent check { vars: "expected" slist => { "scrumdiddlyumptious" }; - "diff" slist => difference( expected, "test.values" ); + "diff" slist => difference(expected, "test.values"); classes: - "_pass" expression => strcmp( length( diff ), 0 ); + "_pass" expression => strcmp(length(diff), 0); methods: - _pass:: "pass" usebundle => dcs_pass("$(this.promise_filename)"); diff --git a/tests/acceptance/01_vars/02_functions/getvalues_containers.cf b/tests/acceptance/01_vars/02_functions/getvalues_containers.cf index 90e089c86c..b365957be0 100644 --- a/tests/acceptance/01_vars/02_functions/getvalues_containers.cf +++ b/tests/acceptance/01_vars/02_functions/getvalues_containers.cf @@ -1,32 +1,34 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "arr" data => '["a", [], { "x": 1 }, 2, 5.30, true]'; + "arr" data => '["a", [], { "x": 1 }, 2, 5.30, true]'; } bundle agent test { vars: - "arr_v" slist => getvalues("init.arr"); + "arr_v" slist => getvalues("init.arr"); -reports: - DEBUG:: - "arr_v $(arr_v)"; + reports: + DEBUG:: + "arr_v $(arr_v)"; } bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/getvalues_flattens-list-elements.cf b/tests/acceptance/01_vars/02_functions/getvalues_flattens-list-elements.cf index 55f2ec0aea..dcd4a644cf 100644 --- a/tests/acceptance/01_vars/02_functions/getvalues_flattens-list-elements.cf +++ b/tests/acceptance/01_vars/02_functions/getvalues_flattens-list-elements.cf @@ -5,23 +5,21 @@ # to make the return value a list. (Bug #1271) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "results" slist => { "one", "two", "red", "blue" }; + "results" slist => { "one", "two", "red", "blue" }; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert; } @@ -29,42 +27,43 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "$(init.results)"; + "$(init.results)"; } ####################################################### - bundle agent test { vars: - "sea[fish]" slist => { "one", "two" }; - "sea[shark]" slist => { "red", "blue" }; + "sea[fish]" slist => { "one", "two" }; + "sea[shark]" slist => { "red", "blue" }; secondpass:: "vals" slist => getvalues("sea"); classes: - "secondpass" expression => "any"; + "secondpass" expression => "any"; files: secondpass:: "$(G.testfile).actual" - create => "true", - edit_line => test_insert; + create => "true", + edit_line => test_insert; } bundle edit_line test_insert { insert_lines: - "$(test.vals)"; + "$(test.vals)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/getvalues_plain_slist.cf b/tests/acceptance/01_vars/02_functions/getvalues_plain_slist.cf index 0ae781a38f..89f2a2c3f2 100644 --- a/tests/acceptance/01_vars/02_functions/getvalues_plain_slist.cf +++ b/tests/acceptance/01_vars/02_functions/getvalues_plain_slist.cf @@ -3,40 +3,35 @@ # Test getvalues() # ####################################################### - # If we run getvalues on a plan slist, we should end up with a copy of that # list. - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "slist" slist => { "scrumdiddlyumptious" }; - "values" slist => getvalues("slist"); + "slist" slist => { "scrumdiddlyumptious" }; + "values" slist => getvalues("slist"); } ####################################################### - bundle agent check { vars: "expected" slist => { "scrumdiddlyumptious" }; - "diff" slist => difference( expected, "test.values" ); - + "diff" slist => difference(expected, "test.values"); + classes: - "_pass" expression => strcmp( length( diff ), 0 ); + "_pass" expression => strcmp(length(diff), 0); methods: - - _pass:: + _pass:: "pass" usebundle => dcs_pass("$(this.promise_filename)"); !_pass:: diff --git a/tests/acceptance/01_vars/02_functions/getvalues_plain_string.cf b/tests/acceptance/01_vars/02_functions/getvalues_plain_string.cf index fe424910fe..129b33ca72 100644 --- a/tests/acceptance/01_vars/02_functions/getvalues_plain_string.cf +++ b/tests/acceptance/01_vars/02_functions/getvalues_plain_string.cf @@ -3,39 +3,34 @@ # Test getvalues() # ####################################################### - # If we run getvalues on a plan string, we should end up with a list of one # element being that string value. - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "string" string => "scrumdiddlyumptious"; - "values" slist => getvalues("string"); + "string" string => "scrumdiddlyumptious"; + "values" slist => getvalues("string"); } ####################################################### - bundle agent check { vars: "expected" slist => { "scrumdiddlyumptious" }; - "diff" slist => difference( expected, "test.values" ); + "diff" slist => difference(expected, "test.values"); classes: - "_pass" expression => strcmp( length( diff ), 0 ); + "_pass" expression => strcmp(length(diff), 0); methods: - _pass:: "pass" usebundle => dcs_pass("$(this.promise_filename)"); diff --git a/tests/acceptance/01_vars/02_functions/getvalues_returns_all_values_for_given_array_index_merging_strings.cf b/tests/acceptance/01_vars/02_functions/getvalues_returns_all_values_for_given_array_index_merging_strings.cf index 8f9f775853..49360fba73 100644 --- a/tests/acceptance/01_vars/02_functions/getvalues_returns_all_values_for_given_array_index_merging_strings.cf +++ b/tests/acceptance/01_vars/02_functions/getvalues_returns_all_values_for_given_array_index_merging_strings.cf @@ -4,16 +4,14 @@ # merging strings # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: @@ -22,32 +20,29 @@ bundle agent init } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "!any", - meta => { "redmine7116" }; + "test_soft_fail" + string => "!any", + meta => { "redmine7116" }; vars: "values_data" slist => getvalues("init.data"); } ####################################################### - bundle agent check { vars: "expected_elements" slist => { "alpha", "bravo", "zulu" }; - - "diff1" slist => difference( "test.values_data", expected_elements ); - "diff2" slist => difference( expected_elements, "test.values_data"); - + "diff1" slist => difference("test.values_data", expected_elements); + "diff2" slist => difference(expected_elements, "test.values_data"); "len_diff1" int => length(diff1); "len_diff2" int => length(diff2); classes: - "ok" expression => strcmp( $(len_diff1), $(len_diff2) ); + "ok" expression => strcmp($(len_diff1), $(len_diff2)); reports: DEBUG:: diff --git a/tests/acceptance/01_vars/02_functions/getvalues_returns_all_values_for_given_datacontainer_index_merging_strings.cf b/tests/acceptance/01_vars/02_functions/getvalues_returns_all_values_for_given_datacontainer_index_merging_strings.cf index 58d4c65a52..5e8005c71f 100644 --- a/tests/acceptance/01_vars/02_functions/getvalues_returns_all_values_for_given_datacontainer_index_merging_strings.cf +++ b/tests/acceptance/01_vars/02_functions/getvalues_returns_all_values_for_given_datacontainer_index_merging_strings.cf @@ -4,25 +4,25 @@ # datacontainer index merging strings. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "data" data => ' + "data" data => ' { "foo": [ "alpha", "bravo" ], "bar": "zulu" }'; - "data2" data => ' + + "data2" + data => ' { "foo": [ null, "bravo" ], "zed": { "quu": "something else" }, @@ -30,25 +30,26 @@ bundle agent init "bar2": 1233333 }'; - "data3" data => '[ "foo", null, "bravo", { "bar": "barista" } ]'; + "data3" data => '[ "foo", null, "bravo", { "bar": "barista" } ]'; } ####################################################### - bundle agent test { vars: - "values_data" slist => getvalues("init.data"); - "values_data2" slist => getvalues("init.data2"); - "values_data3" slist => getvalues("init.data3"); + "values_data" slist => getvalues("init.data"); + "values_data2" slist => getvalues("init.data2"); + "values_data3" slist => getvalues("init.data3"); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/getvalues_returns_slist_for_array_scalar.cf b/tests/acceptance/01_vars/02_functions/getvalues_returns_slist_for_array_scalar.cf index 4b59f3cc5d..e15d484535 100644 --- a/tests/acceptance/01_vars/02_functions/getvalues_returns_slist_for_array_scalar.cf +++ b/tests/acceptance/01_vars/02_functions/getvalues_returns_slist_for_array_scalar.cf @@ -4,16 +4,14 @@ # an array that has a scalar. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: @@ -21,32 +19,29 @@ bundle agent init } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "!any", - meta => { "redmine7116" }; + "test_soft_fail" + string => "!any", + meta => { "redmine7116" }; vars: "values_data" slist => getvalues("init.data"); } ####################################################### - bundle agent check { vars: "expected_elements" slist => { "bar" }; - - "diff1" slist => difference( "test.values_data", expected_elements ); - "diff2" slist => difference( expected_elements, "test.values_data"); - + "diff1" slist => difference("test.values_data", expected_elements); + "diff2" slist => difference(expected_elements, "test.values_data"); "len_diff1" int => length(diff1); "len_diff2" int => length(diff2); classes: - "ok" expression => strcmp( $(len_diff1), $(len_diff2) ); + "ok" expression => strcmp($(len_diff1), $(len_diff2)); reports: DEBUG:: diff --git a/tests/acceptance/01_vars/02_functions/getvalues_returns_slist_for_datacontainer_scalar.cf b/tests/acceptance/01_vars/02_functions/getvalues_returns_slist_for_datacontainer_scalar.cf index 8cab6873d6..d6dcca8e29 100644 --- a/tests/acceptance/01_vars/02_functions/getvalues_returns_slist_for_datacontainer_scalar.cf +++ b/tests/acceptance/01_vars/02_functions/getvalues_returns_slist_for_datacontainer_scalar.cf @@ -4,16 +4,14 @@ # scalar # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: @@ -21,32 +19,29 @@ bundle agent init } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "!any", - meta => { "redmine7116" }; + "test_soft_fail" + string => "!any", + meta => { "redmine7116" }; vars: "values_data" slist => getvalues("init.data"); } ####################################################### - bundle agent check { vars: "expected_elements" slist => { "bar" }; - - "diff1" slist => difference( "test.values_data", expected_elements ); - "diff2" slist => difference( expected_elements, "test.values_data"); - + "diff1" slist => difference("test.values_data", expected_elements); + "diff2" slist => difference(expected_elements, "test.values_data"); "len_diff1" int => length(diff1); "len_diff2" int => length(diff2); classes: - "ok" expression => strcmp( $(len_diff1), $(len_diff2) ); + "ok" expression => strcmp($(len_diff1), $(len_diff2)); reports: DEBUG:: diff --git a/tests/acceptance/01_vars/02_functions/hash.cf b/tests/acceptance/01_vars/02_functions/hash.cf index 364583061a..e6ad802794 100644 --- a/tests/acceptance/01_vars/02_functions/hash.cf +++ b/tests/acceptance/01_vars/02_functions/hash.cf @@ -3,180 +3,230 @@ # Test hash() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "base_null" string => ""; - "base_easy" string => "test"; - "base_hard" string => 'This is a test of + "base_null" string => ""; + "base_easy" string => "test"; + "base_hard" string => 'This is a test of the hash function!";'; - - "strings" slist => { "null", "easy", "hard" }; - - "$(strings)" string => "$(base_$(strings)) + "strings" slist => { "null", "easy", "hard" }; + "$(strings)" string => "$(base_$(strings)) "; methods: - "make $(strings)" usebundle => file_make("$(G.testfile).$(strings).txt", "$(base_$(strings))"); + "make $(strings)" + usebundle => file_make( + "$(G.testfile).$(strings).txt", "$(base_$(strings))" + ); } ####################################################### - bundle agent test { meta: - "test_skip_needs_work" string => "windows"; + "test_skip_needs_work" string => "windows"; vars: - "algos" slist => { "md5", "sha1", "sha256", "sha384", "sha512" }; + "algos" slist => { "md5", "sha1", "sha256", "sha384", "sha512" }; - # XXX # What do we do about testing the crypt hash-type? - # - "null_$(algos)" string => hash("$(init.null)", $(algos)); + # XXX # What do we do about testing the crypt hash-type? + "null_$(algos)" string => hash("$(init.null)", $(algos)); - # Cfengine does not expand most \ characters, so use Perl :-) - "easy_$(algos)" string => hash("$(init.easy)", $(algos)); - - "hard_$(algos)" string => hash("$(init.hard)", $(algos)); + # Cfengine does not expand most \ characters, so use Perl :-) + "easy_$(algos)" string => hash("$(init.easy)", $(algos)); + "hard_$(algos)" string => hash("$(init.hard)", $(algos)); } ####################################################### - bundle agent check { vars: - "null_md5" string => "68b329da9893e34099c7d8ad5cb9c940"; - "null_sha1" string => "adc83b19e793491b1c6ea0fd8b46cd9f32e592fc"; - "null_sha256" string => "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b"; - "null_sha384" string => "ec664e889ed6c1b2763cacf7899d95b7f347373eb982e523419feea3aa362d891b3bf025f292267a5854049091789c3e"; - "null_sha512" string => "be688838ca8686e5c90689bf2ab585cef1137c999b48c70b92f67a5c34dc15697b5d11c982ed6d71be1e1e7f7b4e0733884aa97c3f7a339a8ed03577cf74be09"; - - "easy_md5" string => "d8e8fca2dc0f896fd7cb4cb0031ba249"; - "easy_sha1" string => "4e1243bd22c66e76c2ba9eddc1f91394e57f9f83"; - "easy_sha256" string => "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2"; - "easy_sha384" string => "109bb6b5b6d5547c1ce03c7a8bd7d8f80c1cb0957f50c4f7fda04692079917e4f9cad52b878f3d8234e1a170b154b72d"; - "easy_sha512" string => "0e3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123"; - - "hard_md5" string => "e80a705b338f8bd4e2525a2cec846233"; - "hard_sha1" string => "305636f0563c179c71955612bff716648d2aa9bf"; - "hard_sha256" string => "fbfa93af3ddc81df9f812a6d2eff1a40d53160692c81f9f8cfffa9b4562a1749"; - "hard_sha384" string => "712843c71d5ca0b6a2b663251b8b5d08abe5fb55adc4445e6fdf759e5429a98f2c762a0f82612d4e42c4703474b58eb5"; - "hard_sha512" string => "c9d45d2669a941d4e5014ac291fd0cac0c7717604476416cad118898f238a2887057269e70ac5cad972cf5b8cbb0673e985285b0cc69810d4fee507b8b89067c"; - - "algos" slist => { @(test.algos) }; - "strings" slist => { @(init.strings) }; + "null_md5" string => "68b329da9893e34099c7d8ad5cb9c940"; + "null_sha1" string => "adc83b19e793491b1c6ea0fd8b46cd9f32e592fc"; - classes: - "ok_$(strings)_$(algos)" expression => strcmp("$(test.$(strings)_$(algos))", "$($(strings)_$(algos))"); - "not_ok_$(strings)_$(algos)" not => strcmp("$(test.$(strings)_$(algos))", "$($(strings)_$(algos))"); + "null_sha256" + string => "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b"; + + "null_sha384" + string => "ec664e889ed6c1b2763cacf7899d95b7f347373eb982e523419feea3aa362d891b3bf025f292267a5854049091789c3e"; + + "null_sha512" + string => "be688838ca8686e5c90689bf2ab585cef1137c999b48c70b92f67a5c34dc15697b5d11c982ed6d71be1e1e7f7b4e0733884aa97c3f7a339a8ed03577cf74be09"; - "ok_hmatch_$(strings)_$(algos)" expression => hashmatch("$(G.testfile).$(strings).txt", $(algos), "$($(strings)_$(algos))"); - "not_ok_hmatch_$(strings)_$(algos)" not => hashmatch("$(G.testfile).$(strings).txt", $(algos), "$($(strings)_$(algos))"); + "easy_md5" string => "d8e8fca2dc0f896fd7cb4cb0031ba249"; + "easy_sha1" string => "4e1243bd22c66e76c2ba9eddc1f91394e57f9f83"; - "ok_filehash_$(strings)_$(algos)" expression => strcmp(file_hash("$(G.testfile).$(strings).txt", $(algos)), "$($(strings)_$(algos))"); - "not_ok_filehash_$(strings)_$(algos)" not => strcmp(file_hash("$(G.testfile).$(strings).txt", $(algos)), "$($(strings)_$(algos))"); + "easy_sha256" + string => "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2"; - "ok_null" and => { - "ok_null_md5", - "ok_null_sha1", - "ok_null_sha256", - "ok_null_sha384", - "ok_null_sha512", + "easy_sha384" + string => "109bb6b5b6d5547c1ce03c7a8bd7d8f80c1cb0957f50c4f7fda04692079917e4f9cad52b878f3d8234e1a170b154b72d"; + + "easy_sha512" + string => "0e3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123"; + + "hard_md5" string => "e80a705b338f8bd4e2525a2cec846233"; + "hard_sha1" string => "305636f0563c179c71955612bff716648d2aa9bf"; + + "hard_sha256" + string => "fbfa93af3ddc81df9f812a6d2eff1a40d53160692c81f9f8cfffa9b4562a1749"; + + "hard_sha384" + string => "712843c71d5ca0b6a2b663251b8b5d08abe5fb55adc4445e6fdf759e5429a98f2c762a0f82612d4e42c4703474b58eb5"; + + "hard_sha512" + string => "c9d45d2669a941d4e5014ac291fd0cac0c7717604476416cad118898f238a2887057269e70ac5cad972cf5b8cbb0673e985285b0cc69810d4fee507b8b89067c"; + + "algos" slist => { @(test.algos) }; + "strings" slist => { @(init.strings) }; + + classes: + "ok_$(strings)_$(algos)" + expression => strcmp( + "$(test.$(strings)_$(algos))", "$($(strings)_$(algos))" + ); + + "not_ok_$(strings)_$(algos)" + not => strcmp("$(test.$(strings)_$(algos))", "$($(strings)_$(algos))"); + + "ok_hmatch_$(strings)_$(algos)" + expression => hashmatch( + "$(G.testfile).$(strings).txt", $(algos), "$($(strings)_$(algos))" + ); + + "not_ok_hmatch_$(strings)_$(algos)" + not => hashmatch( + "$(G.testfile).$(strings).txt", $(algos), "$($(strings)_$(algos))" + ); + + "ok_filehash_$(strings)_$(algos)" + expression => strcmp( + file_hash("$(G.testfile).$(strings).txt", $(algos)), + "$($(strings)_$(algos))" + ); + + "not_ok_filehash_$(strings)_$(algos)" + not => strcmp( + file_hash("$(G.testfile).$(strings).txt", $(algos)), + "$($(strings)_$(algos))" + ); + + "ok_null" + and => { + "ok_null_md5", + "ok_null_sha1", + "ok_null_sha256", + "ok_null_sha384", + "ok_null_sha512", }; - "ok_easy" and => { - "ok_easy_md5", - "ok_easy_sha1", - "ok_easy_sha256", - "ok_easy_sha384", - "ok_easy_sha512", + "ok_easy" + and => { + "ok_easy_md5", + "ok_easy_sha1", + "ok_easy_sha256", + "ok_easy_sha384", + "ok_easy_sha512", }; - "ok_hard" and => { - "ok_hard_md5", - "ok_hard_sha1", - "ok_hard_sha256", - "ok_hard_sha384", - "ok_hard_sha512", + "ok_hard" + and => { + "ok_hard_md5", + "ok_hard_sha1", + "ok_hard_sha256", + "ok_hard_sha384", + "ok_hard_sha512", }; - "ok_hmatch_null" and => { - "ok_hmatch_null_md5", - "ok_hmatch_null_sha1", - "ok_hmatch_null_sha256", - "ok_hmatch_null_sha384", - "ok_hmatch_null_sha512", + "ok_hmatch_null" + and => { + "ok_hmatch_null_md5", + "ok_hmatch_null_sha1", + "ok_hmatch_null_sha256", + "ok_hmatch_null_sha384", + "ok_hmatch_null_sha512", }; - "ok_hmatch_easy" and => { - "ok_hmatch_easy_md5", - "ok_hmatch_easy_sha1", - "ok_hmatch_easy_sha256", - "ok_hmatch_easy_sha384", - "ok_hmatch_easy_sha512", + "ok_hmatch_easy" + and => { + "ok_hmatch_easy_md5", + "ok_hmatch_easy_sha1", + "ok_hmatch_easy_sha256", + "ok_hmatch_easy_sha384", + "ok_hmatch_easy_sha512", }; - "ok_hmatch_hard" and => { - "ok_hmatch_hard_md5", - "ok_hmatch_hard_sha1", - "ok_hmatch_hard_sha256", - "ok_hmatch_hard_sha384", - "ok_hmatch_hard_sha512", + "ok_hmatch_hard" + and => { + "ok_hmatch_hard_md5", + "ok_hmatch_hard_sha1", + "ok_hmatch_hard_sha256", + "ok_hmatch_hard_sha384", + "ok_hmatch_hard_sha512", }; - "ok_filehash_null" and => { - "ok_filehash_null_md5", - "ok_filehash_null_sha1", - "ok_filehash_null_sha256", - "ok_filehash_null_sha384", - "ok_filehash_null_sha512", + "ok_filehash_null" + and => { + "ok_filehash_null_md5", + "ok_filehash_null_sha1", + "ok_filehash_null_sha256", + "ok_filehash_null_sha384", + "ok_filehash_null_sha512", }; - "ok_filehash_easy" and => { - "ok_filehash_easy_md5", - "ok_filehash_easy_sha1", - "ok_filehash_easy_sha256", - "ok_filehash_easy_sha384", - "ok_filehash_easy_sha512", + "ok_filehash_easy" + and => { + "ok_filehash_easy_md5", + "ok_filehash_easy_sha1", + "ok_filehash_easy_sha256", + "ok_filehash_easy_sha384", + "ok_filehash_easy_sha512", }; - "ok_filehash_hard" and => { - "ok_filehash_hard_md5", - "ok_filehash_hard_sha1", - "ok_filehash_hard_sha256", - "ok_filehash_hard_sha384", - "ok_filehash_hard_sha512", + "ok_filehash_hard" + and => { + "ok_filehash_hard_md5", + "ok_filehash_hard_sha1", + "ok_filehash_hard_sha256", + "ok_filehash_hard_sha384", + "ok_filehash_hard_sha512", }; methods: - "" usebundle => dcs_passif_expected("ok_null,ok_easy,ok_hard,ok_filehash_null,ok_filehash_easy,ok_filehash_hard,ok_hmatch_null,ok_hmatch_easy,ok_hmatch_hard", - "", - $(this.promise_filename)), + "" + usebundle => dcs_passif_expected( + "ok_null,ok_easy,ok_hard,ok_filehash_null,ok_filehash_easy,ok_filehash_hard,ok_hmatch_null,ok_hmatch_easy,ok_hmatch_hard", + "", + $(this.promise_filename) + ), inherit => "true"; reports: DEBUG:: "$(strings) / $(algos) failed, $(test.$(strings)_$(algos)) != $($(strings)_$(algos)) (original = $(init.$(strings)))" - if => "not_ok_$(strings)_$(algos)"; + if => "not_ok_$(strings)_$(algos)"; "$(strings) / $(algos) hashmatch failed $($(strings)_$(algos)) against $(G.testfile).$(strings).txt" - if => "not_ok_hmatch_$(strings)_$(algos)"; + if => "not_ok_hmatch_$(strings)_$(algos)"; "$(strings) / $(algos) file_hash failed $($(strings)_$(algos)) against $(G.testfile).$(strings).txt" - if => "not_ok_filehash_$(strings)_$(algos)"; + if => "not_ok_filehash_$(strings)_$(algos)"; EXTRA:: "$(strings) / $(algos) is OK" if => "ok_$(strings)_$(algos)"; - "$(strings) / $(algos) hashmatch is OK" if => "ok_hmatch_$(strings)_$(algos)"; - "$(strings) / $(algos) file_hash is OK" if => "ok_filehash_$(strings)_$(algos)"; + + "$(strings) / $(algos) hashmatch is OK" + if => "ok_hmatch_$(strings)_$(algos)"; + + "$(strings) / $(algos) file_hash is OK" + if => "ok_filehash_$(strings)_$(algos)"; } diff --git a/tests/acceptance/01_vars/02_functions/hash_to_int.cf b/tests/acceptance/01_vars/02_functions/hash_to_int.cf index bbd87d61d0..5412b41bd7 100644 --- a/tests/acceptance/01_vars/02_functions/hash_to_int.cf +++ b/tests/acceptance/01_vars/02_functions/hash_to_int.cf @@ -3,45 +3,46 @@ # Test hash_to_int() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "a_9" int => hash_to_int(9,10,"string"); - "b_9" int => hash_to_int(9,9,"doesn't"); - "c_9" int => hash_to_int(10,9,"matter"); - "empty_27" int => hash_to_int(0,100,""); - "empty_5327" int => hash_to_int(100,10000,""); - "empty_n2" int => hash_to_int("-2","-1",""); - "short_9872" int => hash_to_int("-10000","10001","shortstring"); - "long_n893" int => - hash_to_int("-1000","1001", - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\\!\"#$%&/()=?.:,;-_"); + "a_9" int => hash_to_int(9, 10, "string"); + "b_9" int => hash_to_int(9, 9, "doesn't"); + "c_9" int => hash_to_int(10, 9, "matter"); + "empty_27" int => hash_to_int(0, 100, ""); + "empty_5327" int => hash_to_int(100, 10000, ""); + "empty_n2" int => hash_to_int("-2", "-1", ""); + "short_9872" int => hash_to_int("-10000", "10001", "shortstring"); + + "long_n893" + int => hash_to_int( + "-1000", + "1001", + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\\!\"#$%&/()=?.:,;-_" + ); } ####################################################### - bundle agent check { classes: - "ok_a" expression => strcmp("$(test.a_9)", "9"); - "ok_b" expression => strcmp("$(test.b_9)", "9"); - "ok_c" expression => strcmp("$(test.c_9)", "9"); - "ok_d" expression => strcmp("$(test.empty_27)", "27"); - "ok_e" expression => strcmp("$(test.empty_5327)", "5327"); - "ok_f" expression => strcmp("$(test.empty_n2)", "-2"); - "ok_g" expression => strcmp("$(test.long_n893)", "-893"); - "ok_h" expression => strcmp("$(test.short_9872)", "9872"); - "ok" and => {ok_a, ok_b, ok_c, ok_d, ok_e, ok_f, ok_g, ok_h}; + "ok_a" expression => strcmp("$(test.a_9)", "9"); + "ok_b" expression => strcmp("$(test.b_9)", "9"); + "ok_c" expression => strcmp("$(test.c_9)", "9"); + "ok_d" expression => strcmp("$(test.empty_27)", "27"); + "ok_e" expression => strcmp("$(test.empty_5327)", "5327"); + "ok_f" expression => strcmp("$(test.empty_n2)", "-2"); + "ok_g" expression => strcmp("$(test.long_n893)", "-893"); + "ok_h" expression => strcmp("$(test.short_9872)", "9872"); + "ok" and => { ok_a, ok_b, ok_c, ok_d, ok_e, ok_f, ok_g, ok_h }; reports: DEBUG:: @@ -53,8 +54,10 @@ bundle agent check "empty_n2: $(test.empty_n2)"; "long_n893: $(test.long_n893)"; "short_9872: $(test.short_9872)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/ifelse.cf b/tests/acceptance/01_vars/02_functions/ifelse.cf index 637bcc1fc4..bc3ffe9fad 100644 --- a/tests/acceptance/01_vars/02_functions/ifelse.cf +++ b/tests/acceptance/01_vars/02_functions/ifelse.cf @@ -3,56 +3,76 @@ # Test ifelse() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle common init { classes: - "myclass" expression => "any"; + "myclass" expression => "any"; } ####################################################### - bundle agent test { classes: - "myclass2" expression => "any"; + "myclass2" expression => "any"; + vars: - "one" string => ifelse(1); - "single" string => ifelse("single string parameter"); - "hardclass" string => ifelse("cfengine", "hardclass OK", "hardclass broken"); - "empty" string => ifelse("cfengine", "", "hardclass broken"); - "empty2" string => ifelse("!cfengine", "", "hardclass expected"); - "five" string => ifelse("this is not true", "5 parameters broken", - "this is also not true", "5 parameters broken 2", - "5 parameters OK"); - "unresolved1" string => ifelse( isvariable( "missing" ), "$(missing)", "expected fallback 1"); - "unresolved2" string => ifelse( isvariable( "missing" ), "$($(missing))", "expected fallback 2"); + "one" string => ifelse(1); + "single" string => ifelse("single string parameter"); + + "hardclass" + string => ifelse("cfengine", "hardclass OK", "hardclass broken"); + + "empty" string => ifelse("cfengine", "", "hardclass broken"); + "empty2" string => ifelse("!cfengine", "", "hardclass expected"); + + "five" + string => ifelse( + "this is not true", + "5 parameters broken", + "this is also not true", + "5 parameters broken 2", + "5 parameters OK" + ); + + "unresolved1" + string => ifelse( + isvariable("missing"), "$(missing)", "expected fallback 1" + ); + + "unresolved2" + string => ifelse( + isvariable("missing"), "$($(missing))", "expected fallback 2" + ); any:: - "mystring" string => ifelse("any","pass","!any","$(foo)","bar"); + "mystring" string => ifelse("any", "pass", "!any", "$(foo)", "bar"); myclass2:: - "expression" string => ifelse("myclass.myclass2", "bundle class OK", "bundle class broken"); + "expression" + string => ifelse( + "myclass.myclass2", "bundle class OK", "bundle class broken" + ); reports: - "ifelse result: $(mystring)"; + "ifelse result: $(mystring)"; } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/ifelse_isvariable-ENT-4653.cf b/tests/acceptance/01_vars/02_functions/ifelse_isvariable-ENT-4653.cf index d06560e5f8..f1bf4a0bb8 100644 --- a/tests/acceptance/01_vars/02_functions/ifelse_isvariable-ENT-4653.cf +++ b/tests/acceptance/01_vars/02_functions/ifelse_isvariable-ENT-4653.cf @@ -1,35 +1,27 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "description" -> { "ENT-4653" } - string => "Test that ifelse can use the result of isvariable with 3 arguments even when they contain variables that don't resolve"; + "description" -> { "ENT-4653" } + string => "Test that ifelse can use the result of isvariable with 3 arguments even when they contain variables that don't resolve"; vars: - "lookup" string => "THIS_IS_NOT_A_DEFINED_VARIABLE"; + "lookup" string => "THIS_IS_NOT_A_DEFINED_VARIABLE"; - "test" string => - ifelse( isvariable( "$(lookup)" ), - "$($(lookup))", - "FALLBACK"); + "test" + string => ifelse(isvariable("$(lookup)"), "$($(lookup))", "FALLBACK"); } bundle agent check { - reports: - '$(this.promise_filename) Pass' - if => strcmp( "FALLBACK", $(test.test) ) ; - - '$(this.promise_filename) FAIL' - if => not( isvariable( "test.test" ) ); - - '$(this.promise_filename) FAIL' - if => not( strcmp( "FALLBACK", $(test.test) ) ); + '$(this.promise_filename) Pass' if => strcmp("FALLBACK", $(test.test)); + '$(this.promise_filename) FAIL' if => not(isvariable("test.test")); + '$(this.promise_filename) FAIL' if => not(strcmp("FALLBACK", $(test.test))); } diff --git a/tests/acceptance/01_vars/02_functions/ifelse_isvariable.cf b/tests/acceptance/01_vars/02_functions/ifelse_isvariable.cf index af1afa6e09..1253977a29 100644 --- a/tests/acceptance/01_vars/02_functions/ifelse_isvariable.cf +++ b/tests/acceptance/01_vars/02_functions/ifelse_isvariable.cf @@ -1,41 +1,45 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "passwd_file" - string => "/tmp/custom_passwd"; + "passwd_file" string => "/tmp/custom_passwd"; } bundle agent test { meta: - "description" - string => "Test that ifelse can use the result of isvariable as a class identifer"; + "description" + string => "Test that ifelse can use the result of isvariable as a class identifer"; vars: - # Since init.passwd_file is defined, I expect the value to be - # the value of init.passwd_file - "use_passwd_file" - string => ifelse( isvariable("init.passwd_file"), $(init.passwd_file), - "/etc/passwd"); + # Since init.passwd_file is defined, I expect the value to be + # the value of init.passwd_file + "use_passwd_file" + string => ifelse( + isvariable("init.passwd_file"), $(init.passwd_file), "/etc/passwd" + ); - # Since init.shadow_file is not defined, I expect that the value - # will be "/etc/shadow" - "use_shadow_file" - string => ifelse( isvariable("init.shadow_file"), $(init.shadow_file), - "/etc/shadow"); + # Since init.shadow_file is not defined, I expect that the value + # will be "/etc/shadow" + "use_shadow_file" + string => ifelse( + isvariable("init.shadow_file"), $(init.shadow_file), "/etc/shadow" + ); } bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/ifelse_undefined.cf b/tests/acceptance/01_vars/02_functions/ifelse_undefined.cf index 2fccbd859f..9d84d03d3f 100644 --- a/tests/acceptance/01_vars/02_functions/ifelse_undefined.cf +++ b/tests/acceptance/01_vars/02_functions/ifelse_undefined.cf @@ -1,37 +1,43 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "description" -> { "ENT-4653" } - string => "Test that ifelse works with undefined variables in the second or third arguments"; + "description" -> { "ENT-4653" } + string => "Test that ifelse works with undefined variables in the second or third arguments"; vars: - "test_one" string => ifelse( "no_such_class", "$(no_such_var)", "test_one_expected_value" ); - "test_two" string => ifelse( "any", "test_two_expected_value", "$(no_such_var)" ); + "test_one" + string => ifelse( + "no_such_class", "$(no_such_var)", "test_one_expected_value" + ); + + "test_two" + string => ifelse("any", "test_two_expected_value", "$(no_such_var)"); } bundle agent check { - reports: - '$(this.promise_filename) Pass' - if => and( - strcmp( "test_one_expected_value", $(test.test_one) ), - strcmp( "test_two_expected_value", $(test.test_two) ) ); + '$(this.promise_filename) Pass' + if => and( + strcmp("test_one_expected_value", $(test.test_one)), + strcmp("test_two_expected_value", $(test.test_two)) + ); - '$(this.promise_filename) FAIL' - if => or( - not( isvariable( "test.test_one" ) ), - not( isvariable( "test.test_two" ) ) ); + '$(this.promise_filename) FAIL' + if => or( + not(isvariable("test.test_one")), not(isvariable("test.test_two")) + ); - '$(this.propmise_filename) FAIL' - if => or( - not(strcmp( "test_one_expected_value", $(test.test_one) ) ), - not(strcmp( "test_two_expected_value", $(test.test_two) ) ) ); + '$(this.propmise_filename) FAIL' + if => or( + not(strcmp("test_one_expected_value", $(test.test_one))), + not(strcmp("test_two_expected_value", $(test.test_two))) + ); } diff --git a/tests/acceptance/01_vars/02_functions/inline_json.cf b/tests/acceptance/01_vars/02_functions/inline_json.cf index a7a5f1c47a..a91fa741c4 100644 --- a/tests/acceptance/01_vars/02_functions/inline_json.cf +++ b/tests/acceptance/01_vars/02_functions/inline_json.cf @@ -3,65 +3,64 @@ # Test inline JSON expansion # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent test { vars: - "z" string => "100"; - "foo" string => "bar"; + "z" string => "100"; + "foo" string => "bar"; - # test mergedata() as well - "var" data => mergedata('[]', '["x"]'); + # test mergedata() as well + "var" data => mergedata('[]', '["x"]'); - # test mapdata() as well - "var2" data => mapdata("none", '$(this.v)', '["x"]'); + # test mapdata() as well + "var2" data => mapdata("none", '$(this.v)', '["x"]'); - # the basic building block - "var3" data => data_expand('["linux"]'); + # the basic building block + "var3" data => data_expand('["linux"]'); - # variable references with a bundle - "var4" data => data_expand('[test.var3]'); - "var5" data => data_expand('[test.var3,]'); + # variable references with a bundle + "var4" data => data_expand('[test.var3]'); + "var5" data => data_expand('[test.var3,]'); - # make sure bareword keys are not expanded - "var6" data => data_expand('[foo]'); - "var7" data => data_expand('{foo:var3}'); + # make sure bareword keys are not expanded + "var6" data => data_expand('[foo]'); + "var7" data => data_expand('{foo:var3}'); - # variable references without a bundle - "var8" data => data_expand('[var3]'); - "var9" data => data_expand('{ "x": var3 }'); + # variable references without a bundle + "var8" data => data_expand('[var3]'); + "var9" data => data_expand('{ "x": var3 }'); - # regular lookup with bundle name into a map value - "varA" data => data_expand('{ "fullx": test.var3 }'); + # regular lookup with bundle name into a map value + "varA" data => data_expand('{ "fullx": test.var3 }'); - # try to trigger off-by-one errors - "varB" data => data_expand('[z]'); + # try to trigger off-by-one errors + "varB" data => data_expand('[z]'); - # intentionally broken to try to trigger off-by-one errors - "varC" data => data_expand('[z'); - - # inline array lookup - "varD" data => data_expand('[var3[0]]'); - "varE" data => data_expand('[varA[fullx]]'); - "varF" data => data_expand('[var9[x]]'); + # intentionally broken to try to trigger off-by-one errors + "varC" data => data_expand('[z'); + # inline array lookup + "varD" data => data_expand('[var3[0]]'); + "varE" data => data_expand('[varA[fullx]]'); + "varF" data => data_expand('[var9[x]]'); } ########################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/int.cf b/tests/acceptance/01_vars/02_functions/int.cf index de12264af2..dd5e8cd21e 100644 --- a/tests/acceptance/01_vars/02_functions/int.cf +++ b/tests/acceptance/01_vars/02_functions/int.cf @@ -1,13 +1,14 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle common init { vars: - "expect" data => '{ + "expect" + data => '{ "pos_int": { "in": "12", "out": "12" @@ -42,39 +43,37 @@ bundle common init }, }'; - "cases" slist => getindices( @{expect} ); - "all_ok_classes" slist => maplist( "ok_${this}", @{cases} ); + "cases" slist => getindices(@{expect}); + "all_ok_classes" slist => maplist("ok_${this}", @{cases}); } bundle common test { meta: - "description" -> { "CFE-3616" } - string => "Test whether the int() policy function properly returns integer from string"; + "description" -> { "CFE-3616" } + string => "Test whether the int() policy function properly returns integer from string"; classes: - "ok_${init.cases}" - expression => strcmp( int( "${init.expect[${init.cases}][in]}" ), - "${init.expect[${init.cases}][out]}" - ); + "ok_${init.cases}" + expression => strcmp( + int("${init.expect[${init.cases}][in]}"), + "${init.expect[${init.cases}][out]}" + ); } bundle agent check { vars: - "difference" - slist => difference( @{init.all_ok_classes}, - classesmatching( "ok_.*" ) - ); + "difference" + slist => difference(@{init.all_ok_classes}, classesmatching("ok_.*")); classes: - "ok" - expression => strcmp( "0", length( @{difference} ) ); + "ok" expression => strcmp("0", length(@{difference})); methods: - "Pass/FAIL" - usebundle => dcs_passif( "ok", ${this.promise_filename} ), - inherit => "true"; + "Pass/FAIL" + usebundle => dcs_passif("ok", ${this.promise_filename}), + inherit => "true"; reports: !ok.DEBUG:: diff --git a/tests/acceptance/01_vars/02_functions/is_type.cf b/tests/acceptance/01_vars/02_functions/is_type.cf index cc6332d9c3..4d85924e81 100644 --- a/tests/acceptance/01_vars/02_functions/is_type.cf +++ b/tests/acceptance/01_vars/02_functions/is_type.cf @@ -1,10 +1,10 @@ -body common control +body common control { bundlesequence => { test, check }; version => "1.0"; } -bundle agent test +bundle agent test { meta: "description" -> { "CFE-3641" } @@ -20,70 +20,69 @@ bundle agent check "myslist" slist => { "one", "two", "three" }; "myilist" ilist => { "1", "2", "3" }; "myrlist" rlist => { "0.1", "0.2", "0.3" }; - "mydata" data => '{ "dstring": "two", "dint": 2, "darray": [1,2,3], "dreal": 0.3, "dbool": true, "dnull": null }'; + + "mydata" + data => '{ "dstring": "two", "dint": 2, "darray": [1,2,3], "dreal": 0.3, "dbool": true, "dnull": null }'; classes: - "isstring" - expression => is_type("mystring", "string"); - "isint" - expression => is_type("myint", "int"); - "isreal" - expression => is_type("myreal", "real"); - "isslist" - expression => is_type("myslist", "slist"); - "isilist" - expression => is_type("myilist", "ilist"); - "isrlist" - expression => is_type("myrlist", "rlist"); - "ispolicystring" - expression => is_type("mystring", "policy string"); - "ispolicyint" - expression => is_type("myint", "policy int"); - "ispolicyreal" - expression => is_type("myreal", "policy real"); - "ispolicyslist" - expression => is_type("myslist", "policy slist"); - "ispolicyilist" - expression => is_type("myilist", "policy ilist"); - "ispolicyrlist" - expression => is_type("myrlist", "policy rlist"); - "isdata" - expression => is_type("mydata", "data"); - "isdataobject" - expression => is_type("mydata", "data object"); - "isdatastring" - expression => is_type("mydata[dstring]", "data string"); - "isdataint" - expression => is_type("mydata[dint]", "data int"); - "isdataarray" - expression => is_type("mydata[darray]", "data array"); - "isdatareal" - expression => is_type("mydata[dreal]", "data real"); - "isdataboolean" - expression => is_type("mydata[dbool]", "data boolean"); - "isdatanull" - expression => is_type("mydata[dnull]", "data null"); + "isstring" expression => is_type("mystring", "string"); + "isint" expression => is_type("myint", "int"); + "isreal" expression => is_type("myreal", "real"); + "isslist" expression => is_type("myslist", "slist"); + "isilist" expression => is_type("myilist", "ilist"); + "isrlist" expression => is_type("myrlist", "rlist"); + "ispolicystring" expression => is_type("mystring", "policy string"); + "ispolicyint" expression => is_type("myint", "policy int"); + "ispolicyreal" expression => is_type("myreal", "policy real"); + "ispolicyslist" expression => is_type("myslist", "policy slist"); + "ispolicyilist" expression => is_type("myilist", "policy ilist"); + "ispolicyrlist" expression => is_type("myrlist", "policy rlist"); + "isdata" expression => is_type("mydata", "data"); + "isdataobject" expression => is_type("mydata", "data object"); + "isdatastring" expression => is_type("mydata[dstring]", "data string"); + "isdataint" expression => is_type("mydata[dint]", "data int"); + "isdataarray" expression => is_type("mydata[darray]", "data array"); + "isdatareal" expression => is_type("mydata[dreal]", "data real"); + "isdataboolean" expression => is_type("mydata[dbool]", "data boolean"); + "isdatanull" expression => is_type("mydata[dnull]", "data null"); + "isnottype" expression => not(is_type("mystring", "int")); + "containerisnottype" expression => not(is_type("mydata[darray]", "string")); + "isnotcontainer" expression => not(is_type("myreal", "data array")); - "isnottype" - expression => not(is_type("mystring", "int")); - "containerisnottype" - expression => not(is_type("mydata[darray]", "string")); - "isnotcontainer" - expression => not(is_type("myreal", "data array")); "containerisnotcontainer" expression => not(is_type("mydata[dbool]", "data int")); - "ok" - and => { "isstring", "isint", "isreal", "isslist", "isilist", "isrlist", - "ispolicystring", "ispolicyint", "ispolicyreal", "ispolicyslist", "ispolicyilist", - "isdata", "isdataobject", "isdatastring", "isdataint", "isdataarray", - "isdatareal", "isdataboolean", "isdatanull", "isnottype", "containerisnottype", - "isnotcontainer", "containerisnotcontainer" }; + and => { + "isstring", + "isint", + "isreal", + "isslist", + "isilist", + "isrlist", + "ispolicystring", + "ispolicyint", + "ispolicyreal", + "ispolicyslist", + "ispolicyilist", + "isdata", + "isdataobject", + "isdatastring", + "isdataint", + "isdataarray", + "isdatareal", + "isdataboolean", + "isdatanull", + "isnottype", + "containerisnottype", + "isnotcontainer", + "containerisnotcontainer", + }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/isconnectable.cf b/tests/acceptance/01_vars/02_functions/isconnectable.cf index 362bd984f3..8ee200ce8b 100644 --- a/tests/acceptance/01_vars/02_functions/isconnectable.cf +++ b/tests/acceptance/01_vars/02_functions/isconnectable.cf @@ -1,8 +1,8 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -13,13 +13,17 @@ bundle agent init # local_address is ip:port # example line for ssh (port 22, hex 16): 0: 00000000:0016 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 0 25575 2 ffff9eac03038000 100 0 0 10 0 # finally, to keep things "simple" only try ports listening on 0.0.0.0 aka 00000000: in the local_address column - "port_to_check" string => execresult("cat /proc/net/tcp | grep ': 00000000:' | head -2 | tail -1 | awk '{print $2}' | cut -d: -f2 | xargs -I{} printf '%d\n' 0x{}", "useshell"); + "port_to_check" + string => execresult( + "cat /proc/net/tcp | grep ': 00000000:' | head -2 | tail -1 | awk '{print $2}' | cut -d: -f2 | xargs -I{} printf '%d\n' 0x{}", + "useshell" + ); classes: - "port_to_check_available" expression => and( - isvariable("port_to_check"), - not(strcmp("${port_to_check}","")) - ), + "port_to_check_available" + expression => and( + isvariable("port_to_check"), not(strcmp("${port_to_check}", "")) + ), scope => "namespace"; reports: @@ -32,12 +36,15 @@ bundle agent check "test_skip_unsupported" string => "!linux|!port_to_check_available"; classes: - "isconnectable" expression => isconnectable("localhost", ${init.port_to_check}, "30"); + "isconnectable" + expression => isconnectable("localhost", ${init.port_to_check}, "30"); reports: "Tried isconnectable on port_to_check ${init.port_to_check}"; + isconnectable:: "${this.promise_filename} Pass"; + !isconnectable:: "${this.promise_filename} FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/isreadable.cf b/tests/acceptance/01_vars/02_functions/isreadable.cf index b0df65508e..cf046c6979 100644 --- a/tests/acceptance/01_vars/02_functions/isreadable.cf +++ b/tests/acceptance/01_vars/02_functions/isreadable.cf @@ -3,115 +3,153 @@ # Test policy function isreadable # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } ############################################################################## - bundle agent init { files: - # Has content - "$(G.testfile)_1" - content => "Hello CFEngine!"; - # No content - "$(G.testfile)_2" - content => ""; - # Does not exists - "$(G.testfile)_3" - delete => tidy; - # Not a regular file - "$(G.testfile)_4/." - create => "true"; + # Has content + "$(G.testfile)_1" content => "Hello CFEngine!"; + + # No content + "$(G.testfile)_2" content => ""; + + # Does not exists + "$(G.testfile)_3" delete => tidy; + + # Not a regular file + "$(G.testfile)_4/." create => "true"; } ############################################################################## - bundle agent test { meta: - "description" -> { "ENT-9380" } - string => "Test policy function filereadable"; + "description" -> { "ENT-9380" } + string => "Test policy function filereadable"; - "test_soft_fail" -> { "ENT-9930" } - string => "hpux|aix", - meta => { "ENT-9930" }; + "test_soft_fail" -> { "ENT-9930" } + string => "hpux|aix", + meta => { "ENT-9930" }; } ############################################################################## - bundle agent check { classes: - # Possibly block for 3 seconds (default) - "test_1" # Has content - expression => isreadable("$(G.testfile)_1"); - "test_2" # No content - expression => isreadable("$(G.testfile)_2"); - "test_3" # Does not exist - expression => not(isreadable("$(G.testfile)_3")); - "test_4" # Not a regular file - expression => not(isreadable("$(G.testfile)_4")); - - # Possibly block forever - "test_5" # Has content - expression => isreadable("$(G.testfile)_1", 0); - "test_6" # No content - expression => isreadable("$(G.testfile)_2", 0); - "test_7" # Does not exist - expression => not(isreadable("$(G.testfile)_3", 0)); - "test_8" # Not a regular file - expression => not(isreadable("$(G.testfile)_4", 0)); - - # Possibly block for 5 seconds - "test_9" # Has content - expression => isreadable("$(G.testfile)_1", 5); - "test_10" # No content - expression => isreadable("$(G.testfile)_2", 5); - "test_11" # Does not exists - expression => not(isreadable("$(G.testfile)_3", 5)); - "test_12" # Not a regular file - expression => not(isreadable("$(G.testfile)_4", 5)); - "ok" - expression => and("test_1", "test_2", "test_3", "test_4", - "test_5", "test_6", "test_7", "test_8", - "test_9", "test_10", "test_11", "test_12"); + # Possibly block for 3 seconds (default) + "test_1" + # Has content + expression => isreadable("$(G.testfile)_1"); + + "test_2" + # No content + expression => isreadable("$(G.testfile)_2"); + + "test_3" + # Does not exist + expression => not(isreadable("$(G.testfile)_3")); + + "test_4" + # Not a regular file + expression => not(isreadable("$(G.testfile)_4")); + + # Possibly block forever + "test_5" + # Has content + expression => isreadable("$(G.testfile)_1", 0); + + "test_6" + # No content + expression => isreadable("$(G.testfile)_2", 0); + + "test_7" + # Does not exist + expression => not(isreadable("$(G.testfile)_3", 0)); + + "test_8" + # Not a regular file + expression => not(isreadable("$(G.testfile)_4", 0)); + + # Possibly block for 5 seconds + "test_9" + # Has content + expression => isreadable("$(G.testfile)_1", 5); + + "test_10" + # No content + expression => isreadable("$(G.testfile)_2", 5); + + "test_11" + # Does not exists + expression => not(isreadable("$(G.testfile)_3", 5)); + + "test_12" + # Not a regular file + expression => not(isreadable("$(G.testfile)_4", 5)); + + "ok" + expression => and( + "test_1", + "test_2", + "test_3", + "test_4", + "test_5", + "test_6", + "test_7", + "test_8", + "test_9", + "test_10", + "test_11", + "test_12" + ); reports: DEBUG.!test_1:: - "Expected 'test_1' to be defined, but 'test_1' was not defined"; + "Expected 'test_1' to be defined, but 'test_1' was not defined"; + DEBUG.!test_2:: - "Expected 'test_2' to be defined, but 'test_2' was not defined"; + "Expected 'test_2' to be defined, but 'test_2' was not defined"; + DEBUG.!test_3:: - "Expected 'test_3' to be defined, but 'test_3' was not defined"; + "Expected 'test_3' to be defined, but 'test_3' was not defined"; + DEBUG.!test_4:: - "Expected 'test_4' to be defined, but 'test_4' was not defined"; + "Expected 'test_4' to be defined, but 'test_4' was not defined"; DEBUG.!test_5:: - "Expected 'test_5' to be defined, but 'test_5' was not defined"; + "Expected 'test_5' to be defined, but 'test_5' was not defined"; + DEBUG.!test_6:: - "Expected 'test_6' to be defined, but 'test_6' was not defined"; + "Expected 'test_6' to be defined, but 'test_6' was not defined"; + DEBUG.!test_7:: - "Expected 'test_7' to be defined, but 'test_7' was not defined"; + "Expected 'test_7' to be defined, but 'test_7' was not defined"; + DEBUG.!test_8:: - "Expected 'test_8' to be defined, but 'test_8' was not defined"; + "Expected 'test_8' to be defined, but 'test_8' was not defined"; DEBUG.!test_9:: - "Expected 'test_9' to be defined, but 'test_9' was not defined"; + "Expected 'test_9' to be defined, but 'test_9' was not defined"; + DEBUG.!test_10:: - "Expected 'test_10' to be defined, but 'test_10' was not defined"; + "Expected 'test_10' to be defined, but 'test_10' was not defined"; + DEBUG.!test_11:: - "Expected 'test_11' to be defined, but 'test_11' was not defined"; + "Expected 'test_11' to be defined, but 'test_11' was not defined"; + DEBUG.!test_12:: - "Expected 'test_12' to be defined, but 'test_12' was not defined"; + "Expected 'test_12' to be defined, but 'test_12' was not defined"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/iterating_variablesmatching_results.cf b/tests/acceptance/01_vars/02_functions/iterating_variablesmatching_results.cf index b2a64200dd..013aadc32b 100644 --- a/tests/acceptance/01_vars/02_functions/iterating_variablesmatching_results.cf +++ b/tests/acceptance/01_vars/02_functions/iterating_variablesmatching_results.cf @@ -1,22 +1,24 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } -bundle agent test { +bundle agent test +{ meta: "description" -> { "CFE-2593" } string => "Test that the agent won't crash trying to iterate over variablesmatching() results"; } -bundle agent check { + +bundle agent check +{ vars: - "some_var" - string => "some value"; - + "some_var" string => "some value"; + "make_cfe_crash" slist => variablesmatching("$(this.namespace):$(this.bundle)\..*"); - + reports: "DEBUG: '$(make_cfe_crash)' = '$($(make_cfe_crash))'"; "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/join.cf b/tests/acceptance/01_vars/02_functions/join.cf index eaefdb0cfb..8c670c696d 100644 --- a/tests/acceptance/01_vars/02_functions/join.cf +++ b/tests/acceptance/01_vars/02_functions/join.cf @@ -3,79 +3,99 @@ # test join() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "a" slist => { "b", "c", "a" }; - "b" slist => { "100", "9", "10" }; - "c" slist => { }; - "d" slist => { "", "a", "", "b" }; - "e" slist => { "a", "1", "b" }; - "f" rlist => { "100", "200", "300" }; - "g" rlist => { "1.11", "-2.22", "-3.33" }; - "h" ilist => { "-10", "0", "200" }; - "i" data => parsejson('[ 1, 2, "", 3000, "" ]'); - "j" data => parsejson('[ 1, 2, [ 3, 4, 5 ], null, true, false ]'); - "k" data => parsejson('{}'); - "l" data => parsejson('{ "a": 100, "b": 200, "c": null}'); - "m" slist => { "cf_null" }; - "n" slist => { "a", "b", "c", "cf_null" }; - "o" slist => { @(a), @(c) }; - "p" slist => { @(c), @(m) }; - "q" slist => { ":", ":" }; - "r" slist => { ":", @(c) }; - "s" slist => { ":", @(c), @(m) }; - "t" slist => { @(n), @(m), @(n), ":" }; + "a" slist => { "b", "c", "a" }; + "b" slist => { "100", "9", "10" }; + "c" slist => {}; + "d" slist => { "", "a", "", "b" }; + "e" slist => { "a", "1", "b" }; + "f" rlist => { "100", "200", "300" }; + "g" rlist => { "1.11", "-2.22", "-3.33" }; + "h" ilist => { "-10", "0", "200" }; + "i" data => parsejson('[ 1, 2, "", 3000, "" ]'); + "j" data => parsejson('[ 1, 2, [ 3, 4, 5 ], null, true, false ]'); + "k" data => parsejson('{}'); + "l" data => parsejson('{ "a": 100, "b": 200, "c": null}'); + "m" slist => { "cf_null" }; + "n" slist => { "a", "b", "c", "cf_null" }; + "o" slist => { @(a), @(c) }; + "p" slist => { @(c), @(m) }; + "q" slist => { ":", ":" }; + "r" slist => { ":", @(c) }; + "s" slist => { ":", @(c), @(m) }; + "t" slist => { @(n), @(m), @(n), ":" }; - "lists" slist => { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t" }; + "lists" + slist => { + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + }; } ####################################################### - bundle agent test { - # "expected_a" string => "b:c:a"; - # "expected_b" string => "100:9:10"; - # "expected_c" string => ""; - # "expected_d" string => ":a::b"; - # "expected_e" string => "a:1:b"; - # "expected_f" string => "100:200:300"; - # "expected_g" string => "1.11:-2.22:-3.33"; - # "expected_h" string => "-10:0:200"; - # "expected_i" string => "1:2::3000:"; - # "expected_j" string => "1:2:true:false"; - # "expected_k" string => ""; - # "expected_l" string => "100:200"; - # "expected_m" string => "cf_null"; - # "expected_n" string => "a:b:c:cf_null"; - # "expected_o" string => "b:c:a"; - # "expected_p" string => "cf_null"; - # "expected_q" string => ":::"; - # "expected_r" string => ":"; - # "expected_s" string => "::cf_null"; - # "expected_t" string => "a:b:c:cf_null:cf_null:a:b:c:cf_null::"; + # "expected_a" string => "b:c:a"; + # "expected_b" string => "100:9:10"; + # "expected_c" string => ""; + # "expected_d" string => ":a::b"; + # "expected_e" string => "a:1:b"; + # "expected_f" string => "100:200:300"; + # "expected_g" string => "1.11:-2.22:-3.33"; + # "expected_h" string => "-10:0:200"; + # "expected_i" string => "1:2::3000:"; + # "expected_j" string => "1:2:true:false"; + # "expected_k" string => ""; + # "expected_l" string => "100:200"; + # "expected_m" string => "cf_null"; + # "expected_n" string => "a:b:c:cf_null"; + # "expected_o" string => "b:c:a"; + # "expected_p" string => "cf_null"; + # "expected_q" string => ":::"; + # "expected_r" string => ":"; + # "expected_s" string => "::cf_null"; + # "expected_t" string => "a:b:c:cf_null:cf_null:a:b:c:cf_null::"; vars: - "lists" slist => { @(init.lists) }; - "join_$(lists)" string => join(":", "init.$(lists)"); + "lists" slist => { @(init.lists) }; + "join_$(lists)" string => join(":", "init.$(lists)"); } - ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/join_mapped_list.cf b/tests/acceptance/01_vars/02_functions/join_mapped_list.cf index cbc7d9a3d2..92182f9270 100644 --- a/tests/acceptance/01_vars/02_functions/join_mapped_list.cf +++ b/tests/acceptance/01_vars/02_functions/join_mapped_list.cf @@ -3,43 +3,39 @@ # Redmine #2614: join should iterate over all elements of a mapped list # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "elements" slist => { "a", "b", "c" }; - "expected" string => "a_x:b_x:c_x"; + "elements" slist => { "a", "b", "c" }; + "expected" string => "a_x:b_x:c_x"; } ####################################################### - bundle agent test { vars: - "map" slist => maplist("$(this)_x", "init.elements"); - "join" string => join(":","map"); + "map" slist => maplist("$(this)_x", "init.elements"); + "join" string => join(":", "map"); } - ####################################################### - bundle agent check { classes: - "ok" expression => strcmp($(init.expected), $(test.join)); + "ok" expression => strcmp($(init.expected), $(test.join)); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/length.cf b/tests/acceptance/01_vars/02_functions/length.cf index 3a16ca4235..9336fabd85 100644 --- a/tests/acceptance/01_vars/02_functions/length.cf +++ b/tests/acceptance/01_vars/02_functions/length.cf @@ -3,48 +3,55 @@ # Test 'length' function # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { vars: - "normal_list" slist => { "b", "c", "a" }; # 3 - "empty_list" slist => { }; # 0 - "normal_object" data => parsejson('{ "a": 1, "b": 2 }'); # 2 - "empty_object" data => parsejson('{}'); # 0 - - "normal_list_len" int => length(normal_list); - "empty_list_len" int => length(empty_list); - "normal_object_len" int => length(normal_object); - "empty_object_len" int => length(empty_object); - - "inline_object_len" int => length('{ "a": 1, "b": 2 }'); # 2 - "inline_array_len" int => length('[ "a", 1, "b", 2 ]'); # 4 -} + "normal_list" slist => { "b", "c", "a" }; + # 3 + "empty_list" slist => {}; -####################################################### + # 0 + "normal_object" data => parsejson('{ "a": 1, "b": 2 }'); -####################################################### + # 2 + "empty_object" data => parsejson('{}'); + # 0 + "normal_list_len" int => length(normal_list); + "empty_list_len" int => length(empty_list); + "normal_object_len" int => length(normal_object); + "empty_object_len" int => length(empty_object); + "inline_object_len" int => length('{ "a": 1, "b": 2 }'); + + # 2 + "inline_array_len" int => length('[ "a", 1, "b", 2 ]'); + + # 4 +} + +####################################################### +####################################################### bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/long_string_from_module.cf b/tests/acceptance/01_vars/02_functions/long_string_from_module.cf index de21f630e6..69b54f19ed 100644 --- a/tests/acceptance/01_vars/02_functions/long_string_from_module.cf +++ b/tests/acceptance/01_vars/02_functions/long_string_from_module.cf @@ -4,54 +4,50 @@ # Redmine:3957 (https://cfengine.com/dev/issues/3957) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).module" - create => "true", - perms => m("700"), - edit_defaults => empty, - edit_line => seed_module; + "$(G.testfile).module" + create => "true", + perms => m("700"), + edit_defaults => empty, + edit_line => seed_module; } ####################################################### - bundle agent test { commands: - "$(G.testfile).module" - module => "true"; + "$(G.testfile).module" module => "true"; } ####################################################### - bundle agent check { classes: - "ok" expression => "any", - comment => "If we made it to here, we didn't crash"; + "ok" + expression => "any", + comment => "If we made it to here, we didn't crash"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } - bundle edit_line seed_module { insert_lines: - "#!/bin/bash"; - "echo '@keys= { \"ssh-dss YavBsyK3sHDac4Gj4nDbVH9E7OfRPi16DADNOWGKEjWiBB0cCe0UY6xxEgcYuwOOl8HUGqqzLOByvUbo1hENDQldKFt8N7WIb2E9gXFtGm0Sf0NlYARALj1nhLju9hodpGxkr4vKioW1fZQBmBqsI7Ky8ZhzU5p4CAm4uCbxAZuiIhDTAcxj7RlDy3fe9WBw7v0cSIbu8E3zEbPn0VQjTduLCJtFOb5LvUxpxUsHMhHu0xS8DvXIwf7l83cQ0XZtwyIgbF3ZxjIZaPyYhKZRAV1qCze4BlcOerJeVYOiKjpXJlOoBprxy2SfEYVS4Khun0efkmsmBAfllKUUNCqsK9j6oWo7BvNbXqzkl2ULJd6h0LNy9jW8IXnnrfWknLGa7lksVmL3afSAufDAb7yRESaUP5KmcD3ghP3Nvu7fy9hz7nIAPgj2dQOwnFRbkv9Svoi9YmCtvBWYAcwIUVNJBmwXe5j5xJyt5vOyRSI2ooJ9mk69UOCsIM8PEnEXwtHcsg9fDjfu9ChFY2HWZPWeNXH05SATnSyLgclQsZcazhQXPoxZbcqR80mfuRX9ymEzNwZJ1jJUERnj9PZkSInu6mFVRjTaQjg8yvqMGRxWknP8aURCDh5rr4Na23jULVVI66heWOi7nzLqBg5U8GsbLsocM8zBam8bhXfU0KvpBo5wlUtHnDWHoMlS3ktr25ldrp3zLuywhHe5vGUbg2E0gr4xB3oPAyaDa3MGQiVXPfngu5CJhwIXmeN5JtIBA0S46ihg7lQ6IU8kAaRHwhWh3TokoNFOYE8R5i24gpYNF8dgCRGqSZIT5V7wuR3qG1Wau963ILuX8EFOSu7xDc5qnGTem3FwICTpSdnZNqpzRt4Ipqsn4Pa2tFFpHlzDwKFRPS7r8v4QX7acqdTSCUOuZ68GwDRlvHIz5mHUf1XLY3FH2InuWFsonJAZwmEbX5evWXFgyJHFlplQcGJvyNdL0T6oBmbG3ssSMoRnqnsk8XjGWtUyvYoQmOY8HWlMhf4V3v78C4k4TnCbN4LmnDYaDcnXMejrUMYDk6QwW3fdTF5ZyjJMy4ANu2fJfKysZMc1Cc== root@host1\", \"ssh-dss a58AZSxQlmcq33EBCW1GuhpkYCgUfr7o5A1arQZ2dr8I4kldCF76mpl6o2CFthZs4YUU8LewbIDDPqjhS2WwafTXeMEvPMtmLufk6E5njNy2WQtAnmGc9R21qIteTgikY9ubRCM3hlhzJ1wGSKCsE5oBHDQC0thk1ljJGHzsEl0AuVClkUq3yz4eWAsiRdbD9QY7ddD6zA61aHomuczKU5F0VvyO8gRQmWV7b6lysoUFcMgCPVf3UaDdg7L7vvBVkQN2vGCh9CCJz5OkBShlZVNaAXd5TkKJNmsTuBDscPyxeCBAk8sai69f1NNtTeAyWTtSu1KiqTDvD9aal93MhpZnPdOZzNr7etK4C7HuPD0uFjdvKZy1H55rpwNHnJ4GojqiNG1VvN5bGLa3sSLiKOngtMBCokdtHpZn2eHD7oLUROTIG3ZXqFGGvfKEP5zlpvJz3392n4PDQ7EKuNFPhyNQpVXEIAQEDcmeWMopVTGezLoFJG01hKMPxs5QWF7qetVLi1pCjmlUpqgE8c81WGxvMe7ooMtQbeVNulX3qBC3rZhYKtk0R5AA8JxmxHSLYlLFbtnR1PA97hnRvnvlfk92i7WL1hjJsMl29LOrubi554Dr9N2uVUrCFcPZMK45PY0TiRH82AKFmkM8mbM0rndJxoJobZsqRAGHVIkcS53hxMT69liRxlCyubwcxgDaqmeQnJU2Ug0YyFs1uxt4NT9laJ0CO2IxhkbmGeDGw1FJqKyc8Haov263cFMcB97I3gyNHccsAynQnxpMS1ltTFXalghuochdue4unbq0Ty2PfS4jPMkavBlMYN8UZdnyZHuUhycwBJri1Grv5kf2SP00P6NQhuB8kwjqoTG8ay5fKWvhDrVetd7tPuj4dMouHuDeaLJInc7Cz0S5tQOuMfRhpPqk1E8A0YnuNCyPDNuW75rkXZkxP9cYSVWeDa1wgOyNLZDTzYts82qiu9kxLbZ184jowJ8rru4UB20JRtoehnD2nGU1NfegD1qOBgQHtDuB18xggfvOgvUNXBrQpICSz0JqszpftAgV5TJq1FjOdjUo1kOCFuqqi6C4S0Siho== root@host2\" }'"; + "#!/bin/bash"; + "echo '@keys= { \"ssh-dss YavBsyK3sHDac4Gj4nDbVH9E7OfRPi16DADNOWGKEjWiBB0cCe0UY6xxEgcYuwOOl8HUGqqzLOByvUbo1hENDQldKFt8N7WIb2E9gXFtGm0Sf0NlYARALj1nhLju9hodpGxkr4vKioW1fZQBmBqsI7Ky8ZhzU5p4CAm4uCbxAZuiIhDTAcxj7RlDy3fe9WBw7v0cSIbu8E3zEbPn0VQjTduLCJtFOb5LvUxpxUsHMhHu0xS8DvXIwf7l83cQ0XZtwyIgbF3ZxjIZaPyYhKZRAV1qCze4BlcOerJeVYOiKjpXJlOoBprxy2SfEYVS4Khun0efkmsmBAfllKUUNCqsK9j6oWo7BvNbXqzkl2ULJd6h0LNy9jW8IXnnrfWknLGa7lksVmL3afSAufDAb7yRESaUP5KmcD3ghP3Nvu7fy9hz7nIAPgj2dQOwnFRbkv9Svoi9YmCtvBWYAcwIUVNJBmwXe5j5xJyt5vOyRSI2ooJ9mk69UOCsIM8PEnEXwtHcsg9fDjfu9ChFY2HWZPWeNXH05SATnSyLgclQsZcazhQXPoxZbcqR80mfuRX9ymEzNwZJ1jJUERnj9PZkSInu6mFVRjTaQjg8yvqMGRxWknP8aURCDh5rr4Na23jULVVI66heWOi7nzLqBg5U8GsbLsocM8zBam8bhXfU0KvpBo5wlUtHnDWHoMlS3ktr25ldrp3zLuywhHe5vGUbg2E0gr4xB3oPAyaDa3MGQiVXPfngu5CJhwIXmeN5JtIBA0S46ihg7lQ6IU8kAaRHwhWh3TokoNFOYE8R5i24gpYNF8dgCRGqSZIT5V7wuR3qG1Wau963ILuX8EFOSu7xDc5qnGTem3FwICTpSdnZNqpzRt4Ipqsn4Pa2tFFpHlzDwKFRPS7r8v4QX7acqdTSCUOuZ68GwDRlvHIz5mHUf1XLY3FH2InuWFsonJAZwmEbX5evWXFgyJHFlplQcGJvyNdL0T6oBmbG3ssSMoRnqnsk8XjGWtUyvYoQmOY8HWlMhf4V3v78C4k4TnCbN4LmnDYaDcnXMejrUMYDk6QwW3fdTF5ZyjJMy4ANu2fJfKysZMc1Cc== root@host1\", \"ssh-dss a58AZSxQlmcq33EBCW1GuhpkYCgUfr7o5A1arQZ2dr8I4kldCF76mpl6o2CFthZs4YUU8LewbIDDPqjhS2WwafTXeMEvPMtmLufk6E5njNy2WQtAnmGc9R21qIteTgikY9ubRCM3hlhzJ1wGSKCsE5oBHDQC0thk1ljJGHzsEl0AuVClkUq3yz4eWAsiRdbD9QY7ddD6zA61aHomuczKU5F0VvyO8gRQmWV7b6lysoUFcMgCPVf3UaDdg7L7vvBVkQN2vGCh9CCJz5OkBShlZVNaAXd5TkKJNmsTuBDscPyxeCBAk8sai69f1NNtTeAyWTtSu1KiqTDvD9aal93MhpZnPdOZzNr7etK4C7HuPD0uFjdvKZy1H55rpwNHnJ4GojqiNG1VvN5bGLa3sSLiKOngtMBCokdtHpZn2eHD7oLUROTIG3ZXqFGGvfKEP5zlpvJz3392n4PDQ7EKuNFPhyNQpVXEIAQEDcmeWMopVTGezLoFJG01hKMPxs5QWF7qetVLi1pCjmlUpqgE8c81WGxvMe7ooMtQbeVNulX3qBC3rZhYKtk0R5AA8JxmxHSLYlLFbtnR1PA97hnRvnvlfk92i7WL1hjJsMl29LOrubi554Dr9N2uVUrCFcPZMK45PY0TiRH82AKFmkM8mbM0rndJxoJobZsqRAGHVIkcS53hxMT69liRxlCyubwcxgDaqmeQnJU2Ug0YyFs1uxt4NT9laJ0CO2IxhkbmGeDGw1FJqKyc8Haov263cFMcB97I3gyNHccsAynQnxpMS1ltTFXalghuochdue4unbq0Ty2PfS4jPMkavBlMYN8UZdnyZHuUhycwBJri1Grv5kf2SP00P6NQhuB8kwjqoTG8ay5fKWvhDrVetd7tPuj4dMouHuDeaLJInc7Cz0S5tQOuMfRhpPqk1E8A0YnuNCyPDNuW75rkXZkxP9cYSVWeDa1wgOyNLZDTzYts82qiu9kxLbZ184jowJ8rru4UB20JRtoehnD2nGU1NfegD1qOBgQHtDuB18xggfvOgvUNXBrQpICSz0JqszpftAgV5TJq1FjOdjUo1kOCFuqqi6C4S0Siho== root@host2\" }'"; } diff --git a/tests/acceptance/01_vars/02_functions/long_string_from_text_file.cf b/tests/acceptance/01_vars/02_functions/long_string_from_text_file.cf index 8f5d8f98b7..80ecfd7f31 100644 --- a/tests/acceptance/01_vars/02_functions/long_string_from_text_file.cf +++ b/tests/acceptance/01_vars/02_functions/long_string_from_text_file.cf @@ -4,50 +4,47 @@ # Redmine:3957 (https://cfengine.com/dev/issues/3957) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).data" - create => "true", - edit_defaults => empty, - edit_line => seed_data; + "$(G.testfile).data" + create => "true", + edit_defaults => empty, + edit_line => seed_data; } ####################################################### - bundle agent test { vars: - "keyfile" string => "$(G.testfile).data"; - "keys" slist => readstringlist("$(keyfile)", "#[^\n]*", "\n", 10, 3072); + "keyfile" string => "$(G.testfile).data"; + "keys" slist => readstringlist("$(keyfile)", "#[^\n]*", "\n", 10, 3072); } ####################################################### - bundle agent check { classes: - "ok" expression => "any", - comment => "If we made it to here, we didn't crash"; + "ok" + expression => "any", + comment => "If we made it to here, we didn't crash"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } - bundle edit_line seed_data { insert_lines: diff --git a/tests/acceptance/01_vars/02_functions/lsdir.cf b/tests/acceptance/01_vars/02_functions/lsdir.cf index 625c40f8c7..7235cf7c96 100644 --- a/tests/acceptance/01_vars/02_functions/lsdir.cf +++ b/tests/acceptance/01_vars/02_functions/lsdir.cf @@ -3,12 +3,11 @@ # Test lsdir() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common files @@ -17,77 +16,80 @@ bundle common files # * in filenames not allowed on win windows:: "names" slist => { "a", "bc", "d/e/f", "g/h/i/j", "klm/nop/qrs" }; + !windows:: "names" slist => { "a", "bc", "d/e/f", "g/h/i/j", "klm/nop/qrs", "tu/*" }; } ####################################################### - bundle agent init { files: - "$(G.testdir)/$(files.names)" - create => "true"; + "$(G.testdir)/$(files.names)" create => "true"; reports: DEBUG:: "Created $(G.testdir)/$(files.names)"; } - ####################################################### - bundle agent test { vars: - "patterns[a]" string => "$(G.testdir)"; - "patterns[b]" string => "$(G.testdir)/b"; # no such directory + "patterns[a]" string => "$(G.testdir)"; + "patterns[b]" string => "$(G.testdir)/b"; + + # no such directory + "pnames" slist => getindices("patterns"); - "pnames" slist => getindices("patterns"); + "found_unsorted[$(pnames)]" + slist => lsdir("$(patterns[$(pnames)])", "[^.].*", "true"); - "found_unsorted[$(pnames)]" slist => lsdir("$(patterns[$(pnames)])", "[^.].*", "true"); - "found[$(pnames)]" slist => sort("found_unsorted[$(pnames)]", "lex"); - "found_string[$(pnames)]" string => join(",", "found[$(pnames)]"); + "found[$(pnames)]" slist => sort("found_unsorted[$(pnames)]", "lex"); + "found_string[$(pnames)]" string => join(",", "found[$(pnames)]"); reports: DEBUG:: "found pattern $(pnames) '$(patterns[$(pnames)])' => '$(found_string[$(pnames)])'"; } - ####################################################### - bundle agent check { vars: windows:: - "expected[a]" string => "$(G.testdir)$(const.dirsep)a,$(G.testdir)$(const.dirsep)bc,$(G.testdir)$(const.dirsep)d,$(G.testdir)$(const.dirsep)g,$(G.testdir)$(const.dirsep)klm"; + "expected[a]" + string => "$(G.testdir)$(const.dirsep)a,$(G.testdir)$(const.dirsep)bc,$(G.testdir)$(const.dirsep)d,$(G.testdir)$(const.dirsep)g,$(G.testdir)$(const.dirsep)klm"; + !windows:: - "expected[a]" string => "$(G.testdir)/a,$(G.testdir)/bc,$(G.testdir)/d,$(G.testdir)/g,$(G.testdir)/klm,$(G.testdir)/tu"; + "expected[a]" + string => "$(G.testdir)/a,$(G.testdir)/bc,$(G.testdir)/d,$(G.testdir)/g,$(G.testdir)/klm,$(G.testdir)/tu"; any:: "expected[b]" string => ""; - "expects" slist => getindices("expected"); - "fstring" slist => getindices("test.found_string"); - "joint_condition" string => join(".", "expects"); classes: - "$(expects)" expression => strcmp("$(test.found_string[$(expects)])", "$(expected[$(expects)])"); - "ok" expression => "$(joint_condition)"; + "$(expects)" + expression => strcmp( + "$(test.found_string[$(expects)])", "$(expected[$(expects)])" + ); + + "ok" expression => "$(joint_condition)"; reports: DEBUG:: "pattern $(expects) matches as expected: '$(expected[$(expects)])'" - if => "$(expects)"; + if => "$(expects)"; "pattern $(expects) does NOT match expected: '$(test.found_string[$(expects)])' != '$(expected[$(expects)])'" - if => "!$(expects)"; + if => "!$(expects)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/maparray.cf b/tests/acceptance/01_vars/02_functions/maparray.cf index 5e69ad8415..ee6272c64e 100644 --- a/tests/acceptance/01_vars/02_functions/maparray.cf +++ b/tests/acceptance/01_vars/02_functions/maparray.cf @@ -3,70 +3,66 @@ # Test maparray() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { vars: - "load1" data => parsejson('[ 1, 2, 3]'); - "load2" slist => { "eleme\"nt1", "element2", "element3" }; - "load3" data => parsejson('{ "x\\"x": "y\\"y" }'); - "load4" data => parsejson('[]'); - "load5[mykey]" slist => { "myvalue" }; - "load5[anotherkey]" string => "anothervalue"; - "load5[lastkey!]" slist => { "o\"ne", "two", "three" }; - "load6" data => parsejson('{ "a": { "b": "c" } }'); - - "static[x]" string => "xvalue"; - "static[x\"x]" string => "xxvalue"; - "static[0]" string => "0value"; - "static[1]" string => "1value"; - "static[2]" string => "2value"; - "static[lastkey!]" string => "lastvalue"; - "static[anotherkey]" string => "anothervalue"; - "static[mykey]" string => "myvalue"; - "static[a]" string => "avalue"; + "load1" data => parsejson('[ 1, 2, 3]'); + "load2" slist => { "eleme\"nt1", "element2", "element3" }; + "load3" data => parsejson('{ "x\\"x": "y\\"y" }'); + "load4" data => parsejson('[]'); + "load5[mykey]" slist => { "myvalue" }; + "load5[anotherkey]" string => "anothervalue"; + "load5[lastkey!]" slist => { "o\"ne", "two", "three" }; + "load6" data => parsejson('{ "a": { "b": "c" } }'); + "static[x]" string => "xvalue"; + "static[x\"x]" string => "xxvalue"; + "static[0]" string => "0value"; + "static[1]" string => "1value"; + "static[2]" string => "2value"; + "static[lastkey!]" string => "lastvalue"; + "static[anotherkey]" string => "anothervalue"; + "static[mykey]" string => "myvalue"; + "static[a]" string => "avalue"; + "spec1" string => "key = $(this.k)"; + "spec2" string => "key = $(this.k), value = ${this.v}"; + "spec3" string => "key = $(this.k), key2 = $(this.k[1]), value = ${this.v}"; + "spec4" string => "xvalue should be $(static[$(this.k)])"; + "jsonspec1" string => '{ "key": "$(this.k)", "value": "$(this.v)"'; + "jsonspec2" string => '{ "key": "$(this.k)", "value": "$(this.v)" }'; + "jsonspec3" string => '[ "$(this.k)", "$(this.v)" ]'; - "spec1" string => "key = $(this.k)"; - "spec2" string => "key = $(this.k), value = ${this.v}"; - "spec3" string => "key = $(this.k), key2 = $(this.k[1]), value = ${this.v}"; - "spec4" string => "xvalue should be $(static[$(this.k)])"; + "jsonspec4" + string => '{ "key": "$(this.k)", "key2": "$(this.k[1])", "value": "$(this.v)" }'; - "jsonspec1" string => '{ "key": "$(this.k)", "value": "$(this.v)"'; - "jsonspec2" string => '{ "key": "$(this.k)", "value": "$(this.v)" }'; - "jsonspec3" string => '[ "$(this.k)", "$(this.v)" ]'; - "jsonspec4" string => '{ "key": "$(this.k)", "key2": "$(this.k[1])", "value": "$(this.v)" }'; - - "X" slist => { "1", "2", "3", "4", "5", "6" }; - "Y" slist => { "1", "2", "3", "4" }; - - "maparray_$(X)_$(Y)" slist => sort(maparray("$(spec$(Y))", "load$(X)")); - "bad2" slist => maparray("", missingvar); - - "justastring" string => "me"; - "bad4" slist => maparray("", justastring); + "X" slist => { "1", "2", "3", "4", "5", "6" }; + "Y" slist => { "1", "2", "3", "4" }; + "maparray_$(X)_$(Y)" slist => sort(maparray("$(spec$(Y))", "load$(X)")); + "bad2" slist => maparray("", missingvar); + "justastring" string => "me"; + "bad4" slist => maparray("", justastring); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/maparray_mixed.cf b/tests/acceptance/01_vars/02_functions/maparray_mixed.cf index 73c11a4986..7c39f07c46 100644 --- a/tests/acceptance/01_vars/02_functions/maparray_mixed.cf +++ b/tests/acceptance/01_vars/02_functions/maparray_mixed.cf @@ -3,27 +3,29 @@ # Test maparray() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "description" string => "Test that maparray can expand variables with this and without this at the same time."; + "description" + string => "Test that maparray can expand variables with this and without this at the same time."; - "test_soft_fail" string => "any", meta => { "CFE-2590" }; + "test_soft_fail" + string => "any", + meta => { "CFE-2590" }; vars: - - "ntp_servers" string => ifelse( - "cfengine", ' + "ntp_servers" + string => ifelse( + "cfengine", + ' { "kali01": { "address" : "172.27.82.22", "key" : "232", @@ -43,7 +45,8 @@ bundle agent test "serverkey" : "213" } }', - "EOP", ' + "EOP", + ' { "nexus": { "address" : "134.152.192.11", "key" : "", @@ -51,23 +54,28 @@ bundle agent test "serverkey" : "" } }', - "undefined"); - - "ntp" data => parsejson($(ntp_servers)); - "i" slist => getindices("ntp"); - - "key[$(i)]" string => ifelse(isgreaterthan( string_length("$(ntp[$(i)][key])"), "0" ), "key", - " "); + "undefined" + ); - # In 3.9.2 $(key[$(i)]) is expanded in the maparray used below. In 3.10 it - # is not expanded and the literal is left in each entry of the resulting - # slist. + "ntp" data => parsejson($(ntp_servers)); + "i" slist => getindices("ntp"); - "commands" slist => maparray("server $(ntp[$(this.k)][address]) iburst $(key[$(i)]) $(ntp[$(this.k)][key]) # $(this.k)", "ntp"); + "key[$(i)]" + string => ifelse( + isgreaterthan(string_length("$(ntp[$(i)][key])"), "0"), "key", " " + ); + # In 3.9.2 $(key[$(i)]) is expanded in the maparray used below. In 3.10 it + # is not expanded and the literal is left in each entry of the resulting + # slist. + "commands" + slist => maparray( + "server $(ntp[$(this.k)][address]) iburst $(key[$(i)]) $(ntp[$(this.k)][key]) # $(this.k)", + "ntp" + ); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_template => "$(this.promise_dirname)/multiline_json.mustache", template_method => "mustache", @@ -81,7 +89,10 @@ bundle agent test bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(this.promise_filename).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(this.promise_filename).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/maparray_multi_index.cf b/tests/acceptance/01_vars/02_functions/maparray_multi_index.cf index 482c712127..afe8000645 100644 --- a/tests/acceptance/01_vars/02_functions/maparray_multi_index.cf +++ b/tests/acceptance/01_vars/02_functions/maparray_multi_index.cf @@ -4,52 +4,53 @@ # Redmine#6033 # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ########################################################### - bundle agent init { } ########################################################### - bundle agent test { vars: "bundles[x][y][z1]" string => "xyz1"; "bundles[x][y][z23]" slist => { "xyz2", "xyz3" }; - - "bundles[zculib][mypaths]" slist => { "pathsa.cf", "pathsb.cf" }; + "bundles[zculib][mypaths]" slist => { "pathsa.cf", "pathsb.cf" }; "bundles[zculib][myservices]" slist => { "myservices.cf" }; #make sure that below variables will be not mapped - "bundles[zcuinventory][zcuinventory]" slist => { "inv_zcuinventory.cf" }; - "bundles[zcuinventory][inventory_fibrechannel]" slist => { "inv_fibrechannel.cf" }; - "bundles[zcuinventory][inventory_virtualization]" slist => { "inv_virtualization.cf" }; - "bundles[services][afs]" slist => { "afs.cf", "afsadm.cf" }; - "bundles[services][base]" slist => { "base.cf", "base2.cf" }; + "bundles[zcuinventory][zcuinventory]" slist => { "inv_zcuinventory.cf" }; + + "bundles[zcuinventory][inventory_fibrechannel]" + slist => { "inv_fibrechannel.cf" }; - "bundles[onelevel1]" slist => { "onelevel1_avalue", "onelevel1_bvalue" }; - "bundles[onelevel2]" string => "onelevel2value"; + "bundles[zcuinventory][inventory_virtualization]" + slist => { "inv_virtualization.cf" }; - "inputs" slist => maparray("zculib/$(this.v)","bundles[zculib]"); + "bundles[services][afs]" slist => { "afs.cf", "afsadm.cf" }; + "bundles[services][base]" slist => { "base.cf", "base2.cf" }; + "bundles[onelevel1]" slist => { "onelevel1_avalue", "onelevel1_bvalue" }; + "bundles[onelevel2]" string => "onelevel2value"; + "inputs" slist => maparray("zculib/$(this.v)", "bundles[zculib]"); "merged_bundles" data => mergedata(bundles); "merged_zculib" data => mergedata("bundles[zculib]"); } ########################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/mapdata.cf b/tests/acceptance/01_vars/02_functions/mapdata.cf index 9a54b94ba7..57f2d9b38f 100644 --- a/tests/acceptance/01_vars/02_functions/mapdata.cf +++ b/tests/acceptance/01_vars/02_functions/mapdata.cf @@ -3,323 +3,974 @@ # Test mapdata() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { vars: - "load1" data => parsejson('[ 1, 2, 3]'); - "load2" slist => { "eleme\"nt1", "element2", "element3" }; - "load3" data => parsejson('{ "x\\"x": "y\\"y" }'); - "load4" data => parsejson('[]'); - "load5[mykey]" slist => { "myvalue" }; - "load5[anotherkey]" string => "anothervalue"; - "load5[lastkey!]" slist => { "o\"ne", "two", "three" }; - "load6" data => parsejson('{ "a": { "b": "c" } }'); - - "static[x]" string => "xvalue"; - "static[x\"x]" string => "xxvalue"; - "static[0]" string => "0value"; - "static[1]" string => "1value"; - "static[2]" string => "2value"; - "static[lastkey!]" string => "lastvalue"; - "static[anotherkey]" string => "anothervalue"; - "static[mykey]" string => "myvalue"; - "static[a]" string => "avalue"; - - "spec1" string => "key = $(this.k)"; - "spec2" string => "key = $(this.k), value = ${this.v}"; - "spec3" string => "key = $(this.k), key2 = $(this.k[1]), value = ${this.v}"; - "spec4" string => "xvalue should be $(static[$(this.k)])"; - - "jsonspec1" string => '{ "key": "$(this.k)", "value": "$(this.v)"'; - "jsonspec2" string => '{ "key": "$(this.k)", "value": "$(this.v)" }'; - "jsonspec3" string => '[ "$(this.k)", "$(this.v)" ]'; - "jsonspec4" string => '{ "key": "$(this.k)", "key2": "$(this.k[1])", "value": "$(this.v)" }'; - - "X" slist => { "1", "2", "3", "4", "5", "6" }; - "Y" slist => { "1", "2", "3", "4" }; - - "mapdata_none_$(X)_$(Y)" data => mapdata("none", "$(spec$(Y))", "load$(X)"); - "mapdata_none_str_$(X)_$(Y)" string => format("%S", "mapdata_none_$(X)_$(Y)"); - - "mapdata_canonify_$(X)_$(Y)" data => mapdata("canonify", "$(spec$(Y))", "load$(X)"); - "mapdata_canonify_str_$(X)_$(Y)" string => format("%S", "mapdata_canonify_$(X)_$(Y)"); - - "mapdata_canonify_eval_$(X)_$(Y)" data => mapdata("canonify", concat("$(spec$(Y))"), "load$(X)"); - "mapdata_canonify_eval_str_$(X)_$(Y)" string => format("%S", "mapdata_canonify_eval_$(X)_$(Y)"); - - "mapdata_json_$(X)_$(Y)" data => mapdata("json", "$(jsonspec$(Y))", "load$(X)"); - "mapdata_json_str_$(X)_$(Y)" string => format("%S", "mapdata_json_$(X)_$(Y)"); - - "bad1" data => mapdata("json", "", missingvar); - - "justastring" string => "me"; - "bad3" data => mapdata("json", "", justastring); + "load1" data => parsejson('[ 1, 2, 3]'); + "load2" slist => { "eleme\"nt1", "element2", "element3" }; + "load3" data => parsejson('{ "x\\"x": "y\\"y" }'); + "load4" data => parsejson('[]'); + "load5[mykey]" slist => { "myvalue" }; + "load5[anotherkey]" string => "anothervalue"; + "load5[lastkey!]" slist => { "o\"ne", "two", "three" }; + "load6" data => parsejson('{ "a": { "b": "c" } }'); + "static[x]" string => "xvalue"; + "static[x\"x]" string => "xxvalue"; + "static[0]" string => "0value"; + "static[1]" string => "1value"; + "static[2]" string => "2value"; + "static[lastkey!]" string => "lastvalue"; + "static[anotherkey]" string => "anothervalue"; + "static[mykey]" string => "myvalue"; + "static[a]" string => "avalue"; + "spec1" string => "key = $(this.k)"; + "spec2" string => "key = $(this.k), value = ${this.v}"; + "spec3" string => "key = $(this.k), key2 = $(this.k[1]), value = ${this.v}"; + "spec4" string => "xvalue should be $(static[$(this.k)])"; + "jsonspec1" string => '{ "key": "$(this.k)", "value": "$(this.v)"'; + "jsonspec2" string => '{ "key": "$(this.k)", "value": "$(this.v)" }'; + "jsonspec3" string => '[ "$(this.k)", "$(this.v)" ]'; + + "jsonspec4" + string => '{ "key": "$(this.k)", "key2": "$(this.k[1])", "value": "$(this.v)" }'; + + "X" slist => { "1", "2", "3", "4", "5", "6" }; + "Y" slist => { "1", "2", "3", "4" }; + "mapdata_none_$(X)_$(Y)" data => mapdata("none", "$(spec$(Y))", "load$(X)"); + + "mapdata_none_str_$(X)_$(Y)" + string => format("%S", "mapdata_none_$(X)_$(Y)"); + + "mapdata_canonify_$(X)_$(Y)" + data => mapdata("canonify", "$(spec$(Y))", "load$(X)"); + + "mapdata_canonify_str_$(X)_$(Y)" + string => format("%S", "mapdata_canonify_$(X)_$(Y)"); + + "mapdata_canonify_eval_$(X)_$(Y)" + data => mapdata("canonify", concat("$(spec$(Y))"), "load$(X)"); + + "mapdata_canonify_eval_str_$(X)_$(Y)" + string => format("%S", "mapdata_canonify_eval_$(X)_$(Y)"); + + "mapdata_json_$(X)_$(Y)" + data => mapdata("json", "$(jsonspec$(Y))", "load$(X)"); + + "mapdata_json_str_$(X)_$(Y)" + string => format("%S", "mapdata_json_$(X)_$(Y)"); + + "bad1" data => mapdata("json", "", missingvar); + "justastring" string => "me"; + "bad3" data => mapdata("json", "", justastring); classes: - 'mapdata_none_1_1_ok' and => { regcmp('.*"key = 0".*', '$(mapdata_none_str_1_1)'), - regcmp('.*"key = 1".*', '$(mapdata_none_str_1_1)'), - regcmp('.*"key = 2".*', '$(mapdata_none_str_1_1)') }; - 'mapdata_none_1_2_ok' and => { regcmp('.*"key = 0, value = 1".*', '$(mapdata_none_str_1_2)'), - regcmp('.*"key = 1, value = 2".*', '$(mapdata_none_str_1_2)'), - regcmp('.*"key = 2, value = 3".*', '$(mapdata_none_str_1_2)') }; - 'mapdata_none_1_3_ok' and => { regcmp('.*"key = 0, key2 = \$\(this.k\[1\]\), value = 1".*', '$(mapdata_none_str_1_3)'), - regcmp('.*"key = 1, key2 = \$\(this.k\[1\]\), value = 2".*', '$(mapdata_none_str_1_3)'), - regcmp('.*"key = 2, key2 = \$\(this.k\[1\]\), value = 3".*', '$(mapdata_none_str_1_3)') }; - 'mapdata_none_1_4_ok' and => { regcmp('.*"xvalue should be 0value".*', '$(mapdata_none_str_1_4)'), - regcmp('.*"xvalue should be 1value".*', '$(mapdata_none_str_1_4)'), - regcmp('.*"xvalue should be 2value".*', '$(mapdata_none_str_1_4)') }; - 'mapdata_none_2_1_ok' and => { regcmp('.*"key = 0".*', '$(mapdata_none_str_2_1)'), - regcmp('.*"key = 1".*', '$(mapdata_none_str_2_1)'), - regcmp('.*"key = 2".*', '$(mapdata_none_str_2_1)') }; - 'mapdata_none_2_2_ok' and => { regcmp('.*"key = 0, value = eleme\\\\"nt1".*', '$(mapdata_none_str_2_2)'), - regcmp('.*"key = 1, value = element2".*', '$(mapdata_none_str_2_2)'), - regcmp('.*"key = 2, value = element3".*', '$(mapdata_none_str_2_2)') }; - 'mapdata_none_2_3_ok' and => { regcmp('.*"key = 0, key2 = \$\(this.k\[1\]\), value = eleme\\\\"nt1".*', '$(mapdata_none_str_2_3)'), - regcmp('.*"key = 1, key2 = \$\(this.k\[1\]\), value = element2".*', '$(mapdata_none_str_2_3)'), - regcmp('.*"key = 2, key2 = \$\(this.k\[1\]\), value = element3".*', '$(mapdata_none_str_2_3)') }; - 'mapdata_none_2_4_ok' and => { regcmp('.*"xvalue should be 0value".*', '$(mapdata_none_str_2_4)'), - regcmp('.*"xvalue should be 1value".*', '$(mapdata_none_str_2_4)'), - regcmp('.*"xvalue should be 2value".*', '$(mapdata_none_str_2_4)') }; - 'mapdata_none_3_1_ok' and => { regcmp('.*"key = x\\\\"x".*', '$(mapdata_none_str_3_1)') }; - 'mapdata_none_3_2_ok' and => { regcmp('.*"key = x\\\\"x, value = y\\\\"y".*', '$(mapdata_none_str_3_2)') }; - 'mapdata_none_3_3_ok' and => { regcmp('.*"key = x\\\\"x, key2 = \$\(this.k\[1\]\), value = y\\\\"y".*', '$(mapdata_none_str_3_3)') }; - 'mapdata_none_3_4_ok' and => { regcmp('.*"xvalue should be xxvalue".*', '$(mapdata_none_str_3_4)') }; - 'mapdata_none_4_1_ok' expression => strcmp('$(mapdata_none_str_4_1)', '[]'); - 'mapdata_none_4_2_ok' expression => strcmp('$(mapdata_none_str_4_1)', '[]'); - 'mapdata_none_4_3_ok' expression => strcmp('$(mapdata_none_str_4_1)', '[]'); - 'mapdata_none_4_4_ok' expression => strcmp('$(mapdata_none_str_4_1)', '[]'); - 'mapdata_none_5_1_ok' and => { regcmp('.*"key = mykey".*', '$(mapdata_none_str_5_1)'), - regcmp('.*"key = anotherkey".*', '$(mapdata_none_str_5_1)'), - regcmp('.*"key = lastkey!".*', '$(mapdata_none_str_5_1)') }; - 'mapdata_none_5_2_ok' and => { regcmp('.*"key = mykey, value = myvalue".*', '$(mapdata_none_str_5_2)'), - regcmp('.*"key = anotherkey, value = anothervalue".*', '$(mapdata_none_str_5_2)'), - regcmp('.*"key = lastkey!, value = o\\\\"ne".*', '$(mapdata_none_str_5_2)'), - regcmp('.*"key = lastkey!, value = two".*', '$(mapdata_none_str_5_2)'), - regcmp('.*"key = lastkey!, value = three".*', '$(mapdata_none_str_5_2)') }; - 'mapdata_none_5_3_ok' and => { regcmp('.*"key = mykey, key2 = \$\(this.k\[1\]\), value = myvalue".*', '$(mapdata_none_str_5_3)'), - regcmp('.*"key = anotherkey, key2 = \$\(this.k\[1\]\), value = anothervalue".*', '$(mapdata_none_str_5_3)'), - regcmp('.*"key = lastkey!, key2 = \$\(this.k\[1\]\), value = o\\\\"ne".*', '$(mapdata_none_str_5_3)'), - regcmp('.*"key = lastkey!, key2 = \$\(this.k\[1\]\), value = two".*', '$(mapdata_none_str_5_3)'), - regcmp('.*"key = lastkey!, key2 = \$\(this.k\[1\]\), value = three".*', '$(mapdata_none_str_5_3)') }; - 'mapdata_none_5_4_ok' and => { regcmp('.*"xvalue should be myvalue".*', '$(mapdata_none_str_5_4)'), - regcmp('.*"xvalue should be anothervalue".*', '$(mapdata_none_str_5_4)'), - regcmp('.*"xvalue should be lastvalue".*', '$(mapdata_none_str_5_4)') }; - 'mapdata_none_6_1_ok' and => { regcmp('.*"key = a".*', '$(mapdata_none_str_6_1)') }; - 'mapdata_none_6_2_ok' and => { regcmp('.*"key = a, value = c".*', '$(mapdata_none_str_6_2)') }; - 'mapdata_none_6_3_ok' and => { regcmp('.*"key = a, key2 = b, value = c".*', '$(mapdata_none_str_6_3)') }; - 'mapdata_none_6_4_ok' and => { regcmp('.*"xvalue should be avalue".*', '$(mapdata_none_str_6_4)') }; - - 'mapdata_canonify_1_1_ok' and => { regcmp('.*"key___0".*', '$(mapdata_canonify_str_1_1)'), - regcmp('.*"key___1".*', '$(mapdata_canonify_str_1_1)'), - regcmp('.*"key___2".*', '$(mapdata_canonify_str_1_1)') }; - 'mapdata_canonify_1_2_ok' and => { regcmp('.*"key___0__value___1".*', '$(mapdata_canonify_str_1_2)'), - regcmp('.*"key___1__value___2".*', '$(mapdata_canonify_str_1_2)'), - regcmp('.*"key___2__value___3".*', '$(mapdata_canonify_str_1_2)') }; - 'mapdata_canonify_1_3_ok' and => { regcmp('.*"key___0__key2_____this_k_1____value___1".*', '$(mapdata_canonify_str_1_3)'), - regcmp('.*"key___1__key2_____this_k_1____value___2".*', '$(mapdata_canonify_str_1_3)'), - regcmp('.*"key___2__key2_____this_k_1____value___3".*', '$(mapdata_canonify_str_1_3)') }; - 'mapdata_canonify_1_4_ok' and => { regcmp('.*"xvalue_should_be_0value".*', '$(mapdata_canonify_str_1_4)'), - regcmp('.*"xvalue_should_be_1value".*', '$(mapdata_canonify_str_1_4)'), - regcmp('.*"xvalue_should_be_2value".*', '$(mapdata_canonify_str_1_4)') }; - 'mapdata_canonify_2_1_ok' and => { regcmp('.*"key___0".*', '$(mapdata_canonify_str_2_1)'), - regcmp('.*"key___1".*', '$(mapdata_canonify_str_2_1)'), - regcmp('.*"key___2".*', '$(mapdata_canonify_str_2_1)') }; - 'mapdata_canonify_2_2_ok' and => { regcmp('.*"key___0__value___eleme_nt1".*', '$(mapdata_canonify_str_2_2)'), - regcmp('.*"key___1__value___element2".*', '$(mapdata_canonify_str_2_2)'), - regcmp('.*"key___2__value___element3".*', '$(mapdata_canonify_str_2_2)') }; - 'mapdata_canonify_2_3_ok' and => { regcmp('.*"key___0__key2_____this_k_1____value___eleme_nt1".*', '$(mapdata_canonify_str_2_3)'), - regcmp('.*"key___1__key2_____this_k_1____value___element2".*', '$(mapdata_canonify_str_2_3)'), - regcmp('.*"key___2__key2_____this_k_1____value___element3".*', '$(mapdata_canonify_str_2_3)') }; - 'mapdata_canonify_2_4_ok' and => { regcmp('.*"xvalue_should_be_0value".*', '$(mapdata_canonify_str_2_4)'), - regcmp('.*"xvalue_should_be_1value".*', '$(mapdata_canonify_str_2_4)'), - regcmp('.*"xvalue_should_be_2value".*', '$(mapdata_canonify_str_2_4)') }; - 'mapdata_canonify_3_1_ok' and => { regcmp('.*"key___x_x".*', '$(mapdata_canonify_str_3_1)') }; - 'mapdata_canonify_3_2_ok' and => { regcmp('.*"key___x_x__value___y_y".*', '$(mapdata_canonify_str_3_2)') }; - 'mapdata_canonify_3_3_ok' and => { regcmp('.*"key___x_x__key2_____this_k_1____value___y_y".*', '$(mapdata_canonify_str_3_3)') }; - 'mapdata_canonify_3_4_ok' and => { regcmp('.*"xvalue_should_be_xxvalue".*', '$(mapdata_canonify_str_3_4)') }; - 'mapdata_canonify_4_1_ok' expression => strcmp('$(mapdata_canonify_str_4_1)', '[]'); - 'mapdata_canonify_4_2_ok' expression => strcmp('$(mapdata_canonify_str_4_1)', '[]'); - 'mapdata_canonify_4_3_ok' expression => strcmp('$(mapdata_canonify_str_4_1)', '[]'); - 'mapdata_canonify_4_4_ok' expression => strcmp('$(mapdata_canonify_str_4_1)', '[]'); - 'mapdata_canonify_5_1_ok' and => { regcmp('.*"key___mykey".*', '$(mapdata_canonify_str_5_1)'), - regcmp('.*"key___anotherkey".*', '$(mapdata_canonify_str_5_1)'), - regcmp('.*"key___lastkey_".*', '$(mapdata_canonify_str_5_1)') }; - 'mapdata_canonify_5_2_ok' and => { regcmp('.*"key___mykey__value___myvalue".*', '$(mapdata_canonify_str_5_2)'), - regcmp('.*"key___anotherkey__value___anothervalue".*', '$(mapdata_canonify_str_5_2)'), - regcmp('.*"key___lastkey___value___o_ne".*', '$(mapdata_canonify_str_5_2)'), - regcmp('.*"key___lastkey___value___two".*', '$(mapdata_canonify_str_5_2)'), - regcmp('.*"key___lastkey___value___three".*', '$(mapdata_canonify_str_5_2)') }; - 'mapdata_canonify_5_3_ok' and => { regcmp('.*"key___mykey__key2_____this_k_1____value___myvalue".*', '$(mapdata_canonify_str_5_3)'), - regcmp('.*"key___anotherkey__key2_____this_k_1____value___anothervalue".*', '$(mapdata_canonify_str_5_3)'), - regcmp('.*"key___lastkey___key2_____this_k_1____value___o_ne".*', '$(mapdata_canonify_str_5_3)'), - regcmp('.*"key___lastkey___key2_____this_k_1____value___two".*', '$(mapdata_canonify_str_5_3)'), - regcmp('.*"key___lastkey___key2_____this_k_1____value___three".*', '$(mapdata_canonify_str_5_3)') }; - 'mapdata_canonify_5_4_ok' and => { regcmp('.*"xvalue_should_be_myvalue".*', '$(mapdata_canonify_str_5_4)'), - regcmp('.*"xvalue_should_be_anothervalue".*', '$(mapdata_canonify_str_5_4)'), - regcmp('.*"xvalue_should_be_lastvalue".*', '$(mapdata_canonify_str_5_4)') }; - 'mapdata_canonify_6_1_ok' and => { regcmp('.*"key___a".*', '$(mapdata_canonify_str_6_1)') }; - 'mapdata_canonify_6_2_ok' and => { regcmp('.*"key___a__value___c".*', '$(mapdata_canonify_str_6_2)') }; - 'mapdata_canonify_6_3_ok' and => { regcmp('.*"key___a__key2___b__value___c".*', '$(mapdata_canonify_str_6_3)') }; - 'mapdata_canonify_6_4_ok' and => { regcmp('.*"xvalue_should_be_avalue".*', '$(mapdata_canonify_str_6_4)') }; - - 'mapdata_canonify_eval_1_1_ok' and => { regcmp('.*"key___0".*', '$(mapdata_canonify_eval_str_1_1)'), - regcmp('.*"key___1".*', '$(mapdata_canonify_eval_str_1_1)'), - regcmp('.*"key___2".*', '$(mapdata_canonify_eval_str_1_1)') }; - 'mapdata_canonify_eval_1_2_ok' and => { regcmp('.*"key___0__value___1".*', '$(mapdata_canonify_eval_str_1_2)'), - regcmp('.*"key___1__value___2".*', '$(mapdata_canonify_eval_str_1_2)'), - regcmp('.*"key___2__value___3".*', '$(mapdata_canonify_eval_str_1_2)') }; - 'mapdata_canonify_eval_1_3_ok' and => { regcmp('.*"key___0__key2_____this_k_1____value___1".*', '$(mapdata_canonify_eval_str_1_3)'), - regcmp('.*"key___1__key2_____this_k_1____value___2".*', '$(mapdata_canonify_eval_str_1_3)'), - regcmp('.*"key___2__key2_____this_k_1____value___3".*', '$(mapdata_canonify_eval_str_1_3)') }; - 'mapdata_canonify_eval_1_4_ok' and => { regcmp('.*"xvalue_should_be_0value".*', '$(mapdata_canonify_eval_str_1_4)'), - regcmp('.*"xvalue_should_be_1value".*', '$(mapdata_canonify_eval_str_1_4)'), - regcmp('.*"xvalue_should_be_2value".*', '$(mapdata_canonify_eval_str_1_4)') }; - 'mapdata_canonify_eval_2_1_ok' and => { regcmp('.*"key___0".*', '$(mapdata_canonify_eval_str_2_1)'), - regcmp('.*"key___1".*', '$(mapdata_canonify_eval_str_2_1)'), - regcmp('.*"key___2".*', '$(mapdata_canonify_eval_str_2_1)') }; - 'mapdata_canonify_eval_2_2_ok' and => { regcmp('.*"key___0__value___eleme_nt1".*', '$(mapdata_canonify_eval_str_2_2)'), - regcmp('.*"key___1__value___element2".*', '$(mapdata_canonify_eval_str_2_2)'), - regcmp('.*"key___2__value___element3".*', '$(mapdata_canonify_eval_str_2_2)') }; - 'mapdata_canonify_eval_2_3_ok' and => { regcmp('.*"key___0__key2_____this_k_1____value___eleme_nt1".*', '$(mapdata_canonify_eval_str_2_3)'), - regcmp('.*"key___1__key2_____this_k_1____value___element2".*', '$(mapdata_canonify_eval_str_2_3)'), - regcmp('.*"key___2__key2_____this_k_1____value___element3".*', '$(mapdata_canonify_eval_str_2_3)') }; - 'mapdata_canonify_eval_2_4_ok' and => { regcmp('.*"xvalue_should_be_0value".*', '$(mapdata_canonify_eval_str_2_4)'), - regcmp('.*"xvalue_should_be_1value".*', '$(mapdata_canonify_eval_str_2_4)'), - regcmp('.*"xvalue_should_be_2value".*', '$(mapdata_canonify_eval_str_2_4)') }; - 'mapdata_canonify_eval_3_1_ok' and => { regcmp('.*"key___x_x".*', '$(mapdata_canonify_eval_str_3_1)') }; - 'mapdata_canonify_eval_3_2_ok' and => { regcmp('.*"key___x_x__value___y_y".*', '$(mapdata_canonify_eval_str_3_2)') }; - 'mapdata_canonify_eval_3_3_ok' and => { regcmp('.*"key___x_x__key2_____this_k_1____value___y_y".*', '$(mapdata_canonify_eval_str_3_3)') }; - 'mapdata_canonify_eval_3_4_ok' and => { regcmp('.*"xvalue_should_be_xxvalue".*', '$(mapdata_canonify_eval_str_3_4)') }; - 'mapdata_canonify_eval_4_1_ok' expression => strcmp('$(mapdata_canonify_eval_str_4_1)', '[]'); - 'mapdata_canonify_eval_4_2_ok' expression => strcmp('$(mapdata_canonify_eval_str_4_1)', '[]'); - 'mapdata_canonify_eval_4_3_ok' expression => strcmp('$(mapdata_canonify_eval_str_4_1)', '[]'); - 'mapdata_canonify_eval_4_4_ok' expression => strcmp('$(mapdata_canonify_eval_str_4_1)', '[]'); - 'mapdata_canonify_eval_5_1_ok' and => { regcmp('.*"key___mykey".*', '$(mapdata_canonify_eval_str_5_1)'), - regcmp('.*"key___anotherkey".*', '$(mapdata_canonify_eval_str_5_1)'), - regcmp('.*"key___lastkey_".*', '$(mapdata_canonify_eval_str_5_1)') }; - 'mapdata_canonify_eval_5_2_ok' and => { regcmp('.*"key___mykey__value___myvalue".*', '$(mapdata_canonify_eval_str_5_2)'), - regcmp('.*"key___anotherkey__value___anothervalue".*', '$(mapdata_canonify_eval_str_5_2)'), - regcmp('.*"key___lastkey___value___o_ne".*', '$(mapdata_canonify_eval_str_5_2)'), - regcmp('.*"key___lastkey___value___two".*', '$(mapdata_canonify_eval_str_5_2)'), - regcmp('.*"key___lastkey___value___three".*', '$(mapdata_canonify_eval_str_5_2)') }; - 'mapdata_canonify_eval_5_3_ok' and => { regcmp('.*"key___mykey__key2_____this_k_1____value___myvalue".*', '$(mapdata_canonify_eval_str_5_3)'), - regcmp('.*"key___anotherkey__key2_____this_k_1____value___anothervalue".*', - '$(mapdata_canonify_eval_str_5_3)'), - regcmp('.*"key___lastkey___key2_____this_k_1____value___o_ne".*', '$(mapdata_canonify_eval_str_5_3)'), - regcmp('.*"key___lastkey___key2_____this_k_1____value___two".*', '$(mapdata_canonify_eval_str_5_3)'), - regcmp('.*"key___lastkey___key2_____this_k_1____value___three".*', '$(mapdata_canonify_eval_str_5_3)') }; - 'mapdata_canonify_eval_5_4_ok' and => { regcmp('.*"xvalue_should_be_myvalue".*', '$(mapdata_canonify_eval_str_5_4)'), - regcmp('.*"xvalue_should_be_anothervalue".*', '$(mapdata_canonify_eval_str_5_4)'), - regcmp('.*"xvalue_should_be_lastvalue".*', '$(mapdata_canonify_eval_str_5_4)') }; - 'mapdata_canonify_eval_6_1_ok' and => { regcmp('.*"key___a".*', '$(mapdata_canonify_eval_str_6_1)') }; - 'mapdata_canonify_eval_6_2_ok' and => { regcmp('.*"key___a__value___c".*', '$(mapdata_canonify_eval_str_6_2)') }; - 'mapdata_canonify_eval_6_3_ok' and => { regcmp('.*"key___a__key2___b__value___c".*', '$(mapdata_canonify_eval_str_6_3)') }; - 'mapdata_canonify_eval_6_4_ok' and => { regcmp('.*"xvalue_should_be_avalue".*', '$(mapdata_canonify_eval_str_6_4)') }; - - 'mapdata_json_1_1_ok' expression => strcmp('$(mapdata_json_str_1_1)', '[]'); - 'mapdata_json_1_2_ok' and => { regcmp('.*\{"key":"0","value":"1"\}.*', '$(mapdata_json_str_1_2)'), - regcmp('.*\{"key":"1","value":"2"\}.*', '$(mapdata_json_str_1_2)'), - regcmp('.*\{"key":"2","value":"3"\}.*', '$(mapdata_json_str_1_2)') }; - 'mapdata_json_1_3_ok' and => { regcmp('.*\["0","1"\].*', '$(mapdata_json_str_1_3)'), - regcmp('.*\["1","2"\].*', '$(mapdata_json_str_1_3)'), - regcmp('.*\["2","3"\].*', '$(mapdata_json_str_1_3)') }; - 'mapdata_json_1_4_ok' and => { regcmp('.*\{"key":"0","key2":"\$\(this.k\[1\]\)","value":"1"\}.*', '$(mapdata_json_str_1_4)'), - regcmp('.*\{"key":"1","key2":"\$\(this.k\[1\]\)","value":"2"\}.*', '$(mapdata_json_str_1_4)'), - regcmp('.*\{"key":"2","key2":"\$\(this.k\[1\]\)","value":"3"\}.*', '$(mapdata_json_str_1_4)') }; - 'mapdata_json_2_1_ok' expression => strcmp('$(mapdata_json_str_2_1)', '[]'); - 'mapdata_json_2_2_ok' and => { regcmp('.*\{"key":"0","value":"eleme\\\\"nt1"\}.*', '$(mapdata_json_str_2_2)'), - regcmp('.*\{"key":"1","value":"element2"\}.*', '$(mapdata_json_str_2_2)'), - regcmp('.*\{"key":"2","value":"element3"\}.*', '$(mapdata_json_str_2_2)') }; - 'mapdata_json_2_3_ok' and => { regcmp('.*\["0","eleme\\\\"nt1"\].*', '$(mapdata_json_str_2_3)'), - regcmp('.*\["1","element2"\].*', '$(mapdata_json_str_2_3)'), - regcmp('.*\["2","element3"\].*', '$(mapdata_json_str_2_3)') }; - 'mapdata_json_2_4_ok' and => { regcmp('.*\{"key":"0","key2":"\$\(this.k\[1\]\)","value":"eleme\\\\"nt1"\}.*', '$(mapdata_json_str_2_4)'), - regcmp('.*\{"key":"1","key2":"\$\(this.k\[1\]\)","value":"element2"\}.*', '$(mapdata_json_str_2_4)'), - regcmp('.*\{"key":"2","key2":"\$\(this.k\[1\]\)","value":"element3"\}.*', '$(mapdata_json_str_2_4)') }; - 'mapdata_json_3_1_ok' expression => strcmp('$(mapdata_json_str_3_1)', '[]'); - 'mapdata_json_3_2_ok' and => { regcmp('.*\{"key":"x\\\\"x","value":"y\\\\"y"\}.*', '$(mapdata_json_str_3_2)') }; - 'mapdata_json_3_3_ok' and => { regcmp('.*\["x\\\\"x","y\\\\"y"\].*', '$(mapdata_json_str_3_3)') }; - 'mapdata_json_3_4_ok' and => { regcmp('.*\{"key":"x\\\\"x","key2":"\$\(this.k\[1\]\)","value":"y\\\\"y"\}.*', '$(mapdata_json_str_3_4)') }; - 'mapdata_json_4_1_ok' expression => strcmp('$(mapdata_json_str_4_1)', '[]'); - 'mapdata_json_4_2_ok' expression => strcmp('$(mapdata_json_str_4_1)', '[]'); - 'mapdata_json_4_3_ok' expression => strcmp('$(mapdata_json_str_4_1)', '[]'); - 'mapdata_json_4_4_ok' expression => strcmp('$(mapdata_json_str_4_1)', '[]'); - 'mapdata_json_5_1_ok' expression => strcmp('$(mapdata_json_str_5_1)', '[]'); - 'mapdata_json_5_2_ok' and => { regcmp('.*\{"key":"mykey","value":"myvalue"\}.*', '$(mapdata_json_str_5_2)'), - regcmp('.*\{"key":"anotherkey","value":"anothervalue"\}.*', '$(mapdata_json_str_5_2)'), - regcmp('.*\{"key":"lastkey!","value":"o\\\\"ne"\}.*', '$(mapdata_json_str_5_2)'), - regcmp('.*\{"key":"lastkey!","value":"two"\}.*', '$(mapdata_json_str_5_2)'), - regcmp('.*\{"key":"lastkey!","value":"three"\}.*', '$(mapdata_json_str_5_2)') }; - 'mapdata_json_5_3_ok' and => { regcmp('.*\["mykey","myvalue"\].*', '$(mapdata_json_str_5_3)'), - regcmp('.*\["anotherkey","anothervalue"\].*', '$(mapdata_json_str_5_3)'), - regcmp('.*\["lastkey!","o\\\\"ne"\].*', '$(mapdata_json_str_5_3)'), - regcmp('.*\["lastkey!","two"\].*', '$(mapdata_json_str_5_3)'), - regcmp('.*\["lastkey!","three"\].*', '$(mapdata_json_str_5_3)') }; - 'mapdata_json_5_4_ok' and => { regcmp('.*\{"key":"mykey","key2":"\$\(this.k\[1\]\)","value":"myvalue"\}.*', '$(mapdata_json_str_5_4)'), - regcmp('.*\{"key":"anotherkey","key2":"\$\(this.k\[1\]\)","value":"anothervalue"\}.*', '$(mapdata_json_str_5_4)'), - regcmp('.*\{"key":"lastkey!","key2":"\$\(this.k\[1\]\)","value":"o\\\\"ne"\}.*', '$(mapdata_json_str_5_4)'), - regcmp('.*\{"key":"lastkey!","key2":"\$\(this.k\[1\]\)","value":"two"\}.*', '$(mapdata_json_str_5_4)'), - regcmp('.*\{"key":"lastkey!","key2":"\$\(this.k\[1\]\)","value":"three"\}.*', '$(mapdata_json_str_5_4)') }; - 'mapdata_json_6_1_ok' expression => strcmp('$(mapdata_json_str_6_1)', '[]'); - 'mapdata_json_6_2_ok' and => { regcmp('.*\{"key":"a","value":"c"\}.*', '$(mapdata_json_str_6_2)') }; - 'mapdata_json_6_3_ok' and => { regcmp('.*\["a","c"\].*', '$(mapdata_json_str_6_3)') }; - 'mapdata_json_6_4_ok' and => { regcmp('.*\{"key":"a","key2":"b","value":"c"\}.*', '$(mapdata_json_str_6_4)') }; - - "mapdata_none_ok" and => { "mapdata_none_1_1_ok", "mapdata_none_1_2_ok", "mapdata_none_1_3_ok", "mapdata_none_1_4_ok", - "mapdata_none_2_1_ok", "mapdata_none_2_2_ok", "mapdata_none_2_3_ok", "mapdata_none_2_4_ok", - "mapdata_none_3_1_ok", "mapdata_none_3_2_ok", "mapdata_none_3_3_ok", "mapdata_none_3_4_ok", - "mapdata_none_4_1_ok", "mapdata_none_4_2_ok", "mapdata_none_4_3_ok", "mapdata_none_4_4_ok", - "mapdata_none_5_1_ok", "mapdata_none_5_2_ok", "mapdata_none_5_3_ok", "mapdata_none_5_4_ok", - "mapdata_none_6_1_ok", "mapdata_none_6_2_ok", "mapdata_none_6_3_ok", "mapdata_none_6_4_ok" }; - - "mapdata_canonify_ok" and => { "mapdata_canonify_1_1_ok", "mapdata_canonify_1_2_ok", "mapdata_canonify_1_3_ok", - "mapdata_canonify_1_4_ok", "mapdata_canonify_2_1_ok", "mapdata_canonify_2_2_ok", - "mapdata_canonify_2_3_ok", "mapdata_canonify_2_4_ok", "mapdata_canonify_3_1_ok", - "mapdata_canonify_3_2_ok", "mapdata_canonify_3_3_ok", "mapdata_canonify_3_4_ok", - "mapdata_canonify_4_1_ok", "mapdata_canonify_4_2_ok", "mapdata_canonify_4_3_ok", - "mapdata_canonify_4_4_ok", "mapdata_canonify_5_1_ok", "mapdata_canonify_5_2_ok", - "mapdata_canonify_5_3_ok", "mapdata_canonify_5_4_ok", "mapdata_canonify_6_1_ok", - "mapdata_canonify_6_2_ok", "mapdata_canonify_6_3_ok", "mapdata_canonify_6_4_ok" }; - - "mapdata_canonify_eval_ok" and => { "mapdata_canonify_eval_1_1_ok", "mapdata_canonify_eval_1_2_ok", "mapdata_canonify_eval_1_3_ok", - "mapdata_canonify_eval_1_4_ok", "mapdata_canonify_eval_2_1_ok", "mapdata_canonify_eval_2_2_ok", - "mapdata_canonify_eval_2_3_ok", "mapdata_canonify_eval_2_4_ok", "mapdata_canonify_eval_3_1_ok", - "mapdata_canonify_eval_3_2_ok", "mapdata_canonify_eval_3_3_ok", "mapdata_canonify_eval_3_4_ok", - "mapdata_canonify_eval_4_1_ok", "mapdata_canonify_eval_4_2_ok", "mapdata_canonify_eval_4_3_ok", - "mapdata_canonify_eval_4_4_ok", "mapdata_canonify_eval_5_1_ok", "mapdata_canonify_eval_5_2_ok", - "mapdata_canonify_eval_5_3_ok", "mapdata_canonify_eval_5_4_ok", "mapdata_canonify_eval_6_1_ok", - "mapdata_canonify_eval_6_2_ok", "mapdata_canonify_eval_6_3_ok", "mapdata_canonify_eval_6_4_ok" }; - - "mapdata_json_ok" and => { "mapdata_json_1_1_ok", "mapdata_json_1_2_ok", "mapdata_json_1_3_ok", "mapdata_json_1_4_ok", - "mapdata_json_2_1_ok", "mapdata_json_2_2_ok", "mapdata_json_2_3_ok", "mapdata_json_2_4_ok", - "mapdata_json_3_1_ok", "mapdata_json_3_2_ok", "mapdata_json_3_3_ok", "mapdata_json_3_4_ok", - "mapdata_json_4_1_ok", "mapdata_json_4_2_ok", "mapdata_json_4_3_ok", "mapdata_json_4_4_ok", - "mapdata_json_5_1_ok", "mapdata_json_5_2_ok", "mapdata_json_5_3_ok", "mapdata_json_5_4_ok", - "mapdata_json_6_1_ok", "mapdata_json_6_2_ok", "mapdata_json_6_3_ok", "mapdata_json_6_4_ok" }; - - - "ok" and => { "mapdata_none_ok", "mapdata_canonify_ok", "mapdata_canonify_eval_ok", "mapdata_json_ok" }, - scope => "namespace"; + 'mapdata_none_1_1_ok' + and => { + regcmp('.*"key = 0".*', '$(mapdata_none_str_1_1)'), + regcmp('.*"key = 1".*', '$(mapdata_none_str_1_1)'), + regcmp('.*"key = 2".*', '$(mapdata_none_str_1_1)'), + }; + + 'mapdata_none_1_2_ok' + and => { + regcmp('.*"key = 0, value = 1".*', '$(mapdata_none_str_1_2)'), + regcmp('.*"key = 1, value = 2".*', '$(mapdata_none_str_1_2)'), + regcmp('.*"key = 2, value = 3".*', '$(mapdata_none_str_1_2)'), + }; + + 'mapdata_none_1_3_ok' + and => { + regcmp( + '.*"key = 0, key2 = \$\(this.k\[1\]\), value = 1".*', + '$(mapdata_none_str_1_3)' + ), + regcmp( + '.*"key = 1, key2 = \$\(this.k\[1\]\), value = 2".*', + '$(mapdata_none_str_1_3)' + ), + regcmp( + '.*"key = 2, key2 = \$\(this.k\[1\]\), value = 3".*', + '$(mapdata_none_str_1_3)' + ), + }; + + 'mapdata_none_1_4_ok' + and => { + regcmp('.*"xvalue should be 0value".*', '$(mapdata_none_str_1_4)'), + regcmp('.*"xvalue should be 1value".*', '$(mapdata_none_str_1_4)'), + regcmp('.*"xvalue should be 2value".*', '$(mapdata_none_str_1_4)'), + }; + + 'mapdata_none_2_1_ok' + and => { + regcmp('.*"key = 0".*', '$(mapdata_none_str_2_1)'), + regcmp('.*"key = 1".*', '$(mapdata_none_str_2_1)'), + regcmp('.*"key = 2".*', '$(mapdata_none_str_2_1)'), + }; + + 'mapdata_none_2_2_ok' + and => { + regcmp( + '.*"key = 0, value = eleme\\\\"nt1".*', '$(mapdata_none_str_2_2)' + ), + regcmp('.*"key = 1, value = element2".*', '$(mapdata_none_str_2_2)'), + regcmp('.*"key = 2, value = element3".*', '$(mapdata_none_str_2_2)'), + }; + + 'mapdata_none_2_3_ok' + and => { + regcmp( + '.*"key = 0, key2 = \$\(this.k\[1\]\), value = eleme\\\\"nt1".*', + '$(mapdata_none_str_2_3)' + ), + regcmp( + '.*"key = 1, key2 = \$\(this.k\[1\]\), value = element2".*', + '$(mapdata_none_str_2_3)' + ), + regcmp( + '.*"key = 2, key2 = \$\(this.k\[1\]\), value = element3".*', + '$(mapdata_none_str_2_3)' + ), + }; + + 'mapdata_none_2_4_ok' + and => { + regcmp('.*"xvalue should be 0value".*', '$(mapdata_none_str_2_4)'), + regcmp('.*"xvalue should be 1value".*', '$(mapdata_none_str_2_4)'), + regcmp('.*"xvalue should be 2value".*', '$(mapdata_none_str_2_4)'), + }; + + 'mapdata_none_3_1_ok' + and => { regcmp('.*"key = x\\\\"x".*', '$(mapdata_none_str_3_1)') }; + + 'mapdata_none_3_2_ok' + and => { + regcmp( + '.*"key = x\\\\"x, value = y\\\\"y".*', '$(mapdata_none_str_3_2)' + ), + }; + + 'mapdata_none_3_3_ok' + and => { + regcmp( + '.*"key = x\\\\"x, key2 = \$\(this.k\[1\]\), value = y\\\\"y".*', + '$(mapdata_none_str_3_3)' + ), + }; + + 'mapdata_none_3_4_ok' + and => { + regcmp('.*"xvalue should be xxvalue".*', '$(mapdata_none_str_3_4)') + }; + + 'mapdata_none_4_1_ok' expression => strcmp('$(mapdata_none_str_4_1)', '[]'); + 'mapdata_none_4_2_ok' expression => strcmp('$(mapdata_none_str_4_1)', '[]'); + 'mapdata_none_4_3_ok' expression => strcmp('$(mapdata_none_str_4_1)', '[]'); + 'mapdata_none_4_4_ok' expression => strcmp('$(mapdata_none_str_4_1)', '[]'); + + 'mapdata_none_5_1_ok' + and => { + regcmp('.*"key = mykey".*', '$(mapdata_none_str_5_1)'), + regcmp('.*"key = anotherkey".*', '$(mapdata_none_str_5_1)'), + regcmp('.*"key = lastkey!".*', '$(mapdata_none_str_5_1)'), + }; + + 'mapdata_none_5_2_ok' + and => { + regcmp( + '.*"key = mykey, value = myvalue".*', '$(mapdata_none_str_5_2)' + ), + regcmp( + '.*"key = anotherkey, value = anothervalue".*', + '$(mapdata_none_str_5_2)' + ), + regcmp( + '.*"key = lastkey!, value = o\\\\"ne".*', '$(mapdata_none_str_5_2)' + ), + regcmp('.*"key = lastkey!, value = two".*', '$(mapdata_none_str_5_2)'), + regcmp( + '.*"key = lastkey!, value = three".*', '$(mapdata_none_str_5_2)' + ), + }; + + 'mapdata_none_5_3_ok' + and => { + regcmp( + '.*"key = mykey, key2 = \$\(this.k\[1\]\), value = myvalue".*', + '$(mapdata_none_str_5_3)' + ), + regcmp( + '.*"key = anotherkey, key2 = \$\(this.k\[1\]\), value = anothervalue".*', + '$(mapdata_none_str_5_3)' + ), + regcmp( + '.*"key = lastkey!, key2 = \$\(this.k\[1\]\), value = o\\\\"ne".*', + '$(mapdata_none_str_5_3)' + ), + regcmp( + '.*"key = lastkey!, key2 = \$\(this.k\[1\]\), value = two".*', + '$(mapdata_none_str_5_3)' + ), + regcmp( + '.*"key = lastkey!, key2 = \$\(this.k\[1\]\), value = three".*', + '$(mapdata_none_str_5_3)' + ), + }; + + 'mapdata_none_5_4_ok' + and => { + regcmp('.*"xvalue should be myvalue".*', '$(mapdata_none_str_5_4)'), + regcmp( + '.*"xvalue should be anothervalue".*', '$(mapdata_none_str_5_4)' + ), + regcmp('.*"xvalue should be lastvalue".*', '$(mapdata_none_str_5_4)'), + }; + + 'mapdata_none_6_1_ok' + and => { regcmp('.*"key = a".*', '$(mapdata_none_str_6_1)') }; + + 'mapdata_none_6_2_ok' + and => { regcmp('.*"key = a, value = c".*', '$(mapdata_none_str_6_2)') }; + + 'mapdata_none_6_3_ok' + and => { + regcmp('.*"key = a, key2 = b, value = c".*', '$(mapdata_none_str_6_3)') + }; + + 'mapdata_none_6_4_ok' + and => { + regcmp('.*"xvalue should be avalue".*', '$(mapdata_none_str_6_4)') + }; + + 'mapdata_canonify_1_1_ok' + and => { + regcmp('.*"key___0".*', '$(mapdata_canonify_str_1_1)'), + regcmp('.*"key___1".*', '$(mapdata_canonify_str_1_1)'), + regcmp('.*"key___2".*', '$(mapdata_canonify_str_1_1)'), + }; + + 'mapdata_canonify_1_2_ok' + and => { + regcmp('.*"key___0__value___1".*', '$(mapdata_canonify_str_1_2)'), + regcmp('.*"key___1__value___2".*', '$(mapdata_canonify_str_1_2)'), + regcmp('.*"key___2__value___3".*', '$(mapdata_canonify_str_1_2)'), + }; + + 'mapdata_canonify_1_3_ok' + and => { + regcmp( + '.*"key___0__key2_____this_k_1____value___1".*', + '$(mapdata_canonify_str_1_3)' + ), + regcmp( + '.*"key___1__key2_____this_k_1____value___2".*', + '$(mapdata_canonify_str_1_3)' + ), + regcmp( + '.*"key___2__key2_____this_k_1____value___3".*', + '$(mapdata_canonify_str_1_3)' + ), + }; + + 'mapdata_canonify_1_4_ok' + and => { + regcmp('.*"xvalue_should_be_0value".*', '$(mapdata_canonify_str_1_4)'), + regcmp('.*"xvalue_should_be_1value".*', '$(mapdata_canonify_str_1_4)'), + regcmp('.*"xvalue_should_be_2value".*', '$(mapdata_canonify_str_1_4)'), + }; + + 'mapdata_canonify_2_1_ok' + and => { + regcmp('.*"key___0".*', '$(mapdata_canonify_str_2_1)'), + regcmp('.*"key___1".*', '$(mapdata_canonify_str_2_1)'), + regcmp('.*"key___2".*', '$(mapdata_canonify_str_2_1)'), + }; + + 'mapdata_canonify_2_2_ok' + and => { + regcmp( + '.*"key___0__value___eleme_nt1".*', '$(mapdata_canonify_str_2_2)' + ), + regcmp( + '.*"key___1__value___element2".*', '$(mapdata_canonify_str_2_2)' + ), + regcmp( + '.*"key___2__value___element3".*', '$(mapdata_canonify_str_2_2)' + ), + }; + + 'mapdata_canonify_2_3_ok' + and => { + regcmp( + '.*"key___0__key2_____this_k_1____value___eleme_nt1".*', + '$(mapdata_canonify_str_2_3)' + ), + regcmp( + '.*"key___1__key2_____this_k_1____value___element2".*', + '$(mapdata_canonify_str_2_3)' + ), + regcmp( + '.*"key___2__key2_____this_k_1____value___element3".*', + '$(mapdata_canonify_str_2_3)' + ), + }; + + 'mapdata_canonify_2_4_ok' + and => { + regcmp('.*"xvalue_should_be_0value".*', '$(mapdata_canonify_str_2_4)'), + regcmp('.*"xvalue_should_be_1value".*', '$(mapdata_canonify_str_2_4)'), + regcmp('.*"xvalue_should_be_2value".*', '$(mapdata_canonify_str_2_4)'), + }; + + 'mapdata_canonify_3_1_ok' + and => { regcmp('.*"key___x_x".*', '$(mapdata_canonify_str_3_1)') }; + + 'mapdata_canonify_3_2_ok' + and => { + regcmp('.*"key___x_x__value___y_y".*', '$(mapdata_canonify_str_3_2)') + }; + + 'mapdata_canonify_3_3_ok' + and => { + regcmp( + '.*"key___x_x__key2_____this_k_1____value___y_y".*', + '$(mapdata_canonify_str_3_3)' + ), + }; + + 'mapdata_canonify_3_4_ok' + and => { + regcmp('.*"xvalue_should_be_xxvalue".*', '$(mapdata_canonify_str_3_4)') + }; + + 'mapdata_canonify_4_1_ok' + expression => strcmp('$(mapdata_canonify_str_4_1)', '[]'); + + 'mapdata_canonify_4_2_ok' + expression => strcmp('$(mapdata_canonify_str_4_1)', '[]'); + + 'mapdata_canonify_4_3_ok' + expression => strcmp('$(mapdata_canonify_str_4_1)', '[]'); + + 'mapdata_canonify_4_4_ok' + expression => strcmp('$(mapdata_canonify_str_4_1)', '[]'); + + 'mapdata_canonify_5_1_ok' + and => { + regcmp('.*"key___mykey".*', '$(mapdata_canonify_str_5_1)'), + regcmp('.*"key___anotherkey".*', '$(mapdata_canonify_str_5_1)'), + regcmp('.*"key___lastkey_".*', '$(mapdata_canonify_str_5_1)'), + }; + + 'mapdata_canonify_5_2_ok' + and => { + regcmp( + '.*"key___mykey__value___myvalue".*', '$(mapdata_canonify_str_5_2)' + ), + regcmp( + '.*"key___anotherkey__value___anothervalue".*', + '$(mapdata_canonify_str_5_2)' + ), + regcmp( + '.*"key___lastkey___value___o_ne".*', '$(mapdata_canonify_str_5_2)' + ), + regcmp( + '.*"key___lastkey___value___two".*', '$(mapdata_canonify_str_5_2)' + ), + regcmp( + '.*"key___lastkey___value___three".*', '$(mapdata_canonify_str_5_2)' + ), + }; + + 'mapdata_canonify_5_3_ok' + and => { + regcmp( + '.*"key___mykey__key2_____this_k_1____value___myvalue".*', + '$(mapdata_canonify_str_5_3)' + ), + regcmp( + '.*"key___anotherkey__key2_____this_k_1____value___anothervalue".*', + '$(mapdata_canonify_str_5_3)' + ), + regcmp( + '.*"key___lastkey___key2_____this_k_1____value___o_ne".*', + '$(mapdata_canonify_str_5_3)' + ), + regcmp( + '.*"key___lastkey___key2_____this_k_1____value___two".*', + '$(mapdata_canonify_str_5_3)' + ), + regcmp( + '.*"key___lastkey___key2_____this_k_1____value___three".*', + '$(mapdata_canonify_str_5_3)' + ), + }; + + 'mapdata_canonify_5_4_ok' + and => { + regcmp( + '.*"xvalue_should_be_myvalue".*', '$(mapdata_canonify_str_5_4)' + ), + regcmp( + '.*"xvalue_should_be_anothervalue".*', '$(mapdata_canonify_str_5_4)' + ), + regcmp( + '.*"xvalue_should_be_lastvalue".*', '$(mapdata_canonify_str_5_4)' + ), + }; + + 'mapdata_canonify_6_1_ok' + and => { regcmp('.*"key___a".*', '$(mapdata_canonify_str_6_1)') }; + + 'mapdata_canonify_6_2_ok' + and => { + regcmp('.*"key___a__value___c".*', '$(mapdata_canonify_str_6_2)') + }; + + 'mapdata_canonify_6_3_ok' + and => { + regcmp( + '.*"key___a__key2___b__value___c".*', '$(mapdata_canonify_str_6_3)' + ), + }; + + 'mapdata_canonify_6_4_ok' + and => { + regcmp('.*"xvalue_should_be_avalue".*', '$(mapdata_canonify_str_6_4)') + }; + + 'mapdata_canonify_eval_1_1_ok' + and => { + regcmp('.*"key___0".*', '$(mapdata_canonify_eval_str_1_1)'), + regcmp('.*"key___1".*', '$(mapdata_canonify_eval_str_1_1)'), + regcmp('.*"key___2".*', '$(mapdata_canonify_eval_str_1_1)'), + }; + + 'mapdata_canonify_eval_1_2_ok' + and => { + regcmp('.*"key___0__value___1".*', '$(mapdata_canonify_eval_str_1_2)'), + regcmp('.*"key___1__value___2".*', '$(mapdata_canonify_eval_str_1_2)'), + regcmp('.*"key___2__value___3".*', '$(mapdata_canonify_eval_str_1_2)'), + }; + + 'mapdata_canonify_eval_1_3_ok' + and => { + regcmp( + '.*"key___0__key2_____this_k_1____value___1".*', + '$(mapdata_canonify_eval_str_1_3)' + ), + regcmp( + '.*"key___1__key2_____this_k_1____value___2".*', + '$(mapdata_canonify_eval_str_1_3)' + ), + regcmp( + '.*"key___2__key2_____this_k_1____value___3".*', + '$(mapdata_canonify_eval_str_1_3)' + ), + }; + + 'mapdata_canonify_eval_1_4_ok' + and => { + regcmp( + '.*"xvalue_should_be_0value".*', '$(mapdata_canonify_eval_str_1_4)' + ), + regcmp( + '.*"xvalue_should_be_1value".*', '$(mapdata_canonify_eval_str_1_4)' + ), + regcmp( + '.*"xvalue_should_be_2value".*', '$(mapdata_canonify_eval_str_1_4)' + ), + }; + + 'mapdata_canonify_eval_2_1_ok' + and => { + regcmp('.*"key___0".*', '$(mapdata_canonify_eval_str_2_1)'), + regcmp('.*"key___1".*', '$(mapdata_canonify_eval_str_2_1)'), + regcmp('.*"key___2".*', '$(mapdata_canonify_eval_str_2_1)'), + }; + + 'mapdata_canonify_eval_2_2_ok' + and => { + regcmp( + '.*"key___0__value___eleme_nt1".*', + '$(mapdata_canonify_eval_str_2_2)' + ), + regcmp( + '.*"key___1__value___element2".*', '$(mapdata_canonify_eval_str_2_2)' + ), + regcmp( + '.*"key___2__value___element3".*', '$(mapdata_canonify_eval_str_2_2)' + ), + }; + + 'mapdata_canonify_eval_2_3_ok' + and => { + regcmp( + '.*"key___0__key2_____this_k_1____value___eleme_nt1".*', + '$(mapdata_canonify_eval_str_2_3)' + ), + regcmp( + '.*"key___1__key2_____this_k_1____value___element2".*', + '$(mapdata_canonify_eval_str_2_3)' + ), + regcmp( + '.*"key___2__key2_____this_k_1____value___element3".*', + '$(mapdata_canonify_eval_str_2_3)' + ), + }; + + 'mapdata_canonify_eval_2_4_ok' + and => { + regcmp( + '.*"xvalue_should_be_0value".*', '$(mapdata_canonify_eval_str_2_4)' + ), + regcmp( + '.*"xvalue_should_be_1value".*', '$(mapdata_canonify_eval_str_2_4)' + ), + regcmp( + '.*"xvalue_should_be_2value".*', '$(mapdata_canonify_eval_str_2_4)' + ), + }; + + 'mapdata_canonify_eval_3_1_ok' + and => { regcmp('.*"key___x_x".*', '$(mapdata_canonify_eval_str_3_1)') }; + + 'mapdata_canonify_eval_3_2_ok' + and => { + regcmp( + '.*"key___x_x__value___y_y".*', '$(mapdata_canonify_eval_str_3_2)' + ), + }; + + 'mapdata_canonify_eval_3_3_ok' + and => { + regcmp( + '.*"key___x_x__key2_____this_k_1____value___y_y".*', + '$(mapdata_canonify_eval_str_3_3)' + ), + }; + + 'mapdata_canonify_eval_3_4_ok' + and => { + regcmp( + '.*"xvalue_should_be_xxvalue".*', '$(mapdata_canonify_eval_str_3_4)' + ), + }; + + 'mapdata_canonify_eval_4_1_ok' + expression => strcmp('$(mapdata_canonify_eval_str_4_1)', '[]'); + + 'mapdata_canonify_eval_4_2_ok' + expression => strcmp('$(mapdata_canonify_eval_str_4_1)', '[]'); + + 'mapdata_canonify_eval_4_3_ok' + expression => strcmp('$(mapdata_canonify_eval_str_4_1)', '[]'); + + 'mapdata_canonify_eval_4_4_ok' + expression => strcmp('$(mapdata_canonify_eval_str_4_1)', '[]'); + + 'mapdata_canonify_eval_5_1_ok' + and => { + regcmp('.*"key___mykey".*', '$(mapdata_canonify_eval_str_5_1)'), + regcmp('.*"key___anotherkey".*', '$(mapdata_canonify_eval_str_5_1)'), + regcmp('.*"key___lastkey_".*', '$(mapdata_canonify_eval_str_5_1)'), + }; + + 'mapdata_canonify_eval_5_2_ok' + and => { + regcmp( + '.*"key___mykey__value___myvalue".*', + '$(mapdata_canonify_eval_str_5_2)' + ), + regcmp( + '.*"key___anotherkey__value___anothervalue".*', + '$(mapdata_canonify_eval_str_5_2)' + ), + regcmp( + '.*"key___lastkey___value___o_ne".*', + '$(mapdata_canonify_eval_str_5_2)' + ), + regcmp( + '.*"key___lastkey___value___two".*', + '$(mapdata_canonify_eval_str_5_2)' + ), + regcmp( + '.*"key___lastkey___value___three".*', + '$(mapdata_canonify_eval_str_5_2)' + ), + }; + + 'mapdata_canonify_eval_5_3_ok' + and => { + regcmp( + '.*"key___mykey__key2_____this_k_1____value___myvalue".*', + '$(mapdata_canonify_eval_str_5_3)' + ), + regcmp( + '.*"key___anotherkey__key2_____this_k_1____value___anothervalue".*', + '$(mapdata_canonify_eval_str_5_3)' + ), + regcmp( + '.*"key___lastkey___key2_____this_k_1____value___o_ne".*', + '$(mapdata_canonify_eval_str_5_3)' + ), + regcmp( + '.*"key___lastkey___key2_____this_k_1____value___two".*', + '$(mapdata_canonify_eval_str_5_3)' + ), + regcmp( + '.*"key___lastkey___key2_____this_k_1____value___three".*', + '$(mapdata_canonify_eval_str_5_3)' + ), + }; + + 'mapdata_canonify_eval_5_4_ok' + and => { + regcmp( + '.*"xvalue_should_be_myvalue".*', '$(mapdata_canonify_eval_str_5_4)' + ), + regcmp( + '.*"xvalue_should_be_anothervalue".*', + '$(mapdata_canonify_eval_str_5_4)' + ), + regcmp( + '.*"xvalue_should_be_lastvalue".*', + '$(mapdata_canonify_eval_str_5_4)' + ), + }; + + 'mapdata_canonify_eval_6_1_ok' + and => { regcmp('.*"key___a".*', '$(mapdata_canonify_eval_str_6_1)') }; + + 'mapdata_canonify_eval_6_2_ok' + and => { + regcmp('.*"key___a__value___c".*', '$(mapdata_canonify_eval_str_6_2)') + }; + + 'mapdata_canonify_eval_6_3_ok' + and => { + regcmp( + '.*"key___a__key2___b__value___c".*', + '$(mapdata_canonify_eval_str_6_3)' + ), + }; + + 'mapdata_canonify_eval_6_4_ok' + and => { + regcmp( + '.*"xvalue_should_be_avalue".*', '$(mapdata_canonify_eval_str_6_4)' + ), + }; + + 'mapdata_json_1_1_ok' expression => strcmp('$(mapdata_json_str_1_1)', '[]'); + + 'mapdata_json_1_2_ok' + and => { + regcmp('.*\{"key":"0","value":"1"\}.*', '$(mapdata_json_str_1_2)'), + regcmp('.*\{"key":"1","value":"2"\}.*', '$(mapdata_json_str_1_2)'), + regcmp('.*\{"key":"2","value":"3"\}.*', '$(mapdata_json_str_1_2)'), + }; + + 'mapdata_json_1_3_ok' + and => { + regcmp('.*\["0","1"\].*', '$(mapdata_json_str_1_3)'), + regcmp('.*\["1","2"\].*', '$(mapdata_json_str_1_3)'), + regcmp('.*\["2","3"\].*', '$(mapdata_json_str_1_3)'), + }; + + 'mapdata_json_1_4_ok' + and => { + regcmp( + '.*\{"key":"0","key2":"\$\(this.k\[1\]\)","value":"1"\}.*', + '$(mapdata_json_str_1_4)' + ), + regcmp( + '.*\{"key":"1","key2":"\$\(this.k\[1\]\)","value":"2"\}.*', + '$(mapdata_json_str_1_4)' + ), + regcmp( + '.*\{"key":"2","key2":"\$\(this.k\[1\]\)","value":"3"\}.*', + '$(mapdata_json_str_1_4)' + ), + }; + + 'mapdata_json_2_1_ok' expression => strcmp('$(mapdata_json_str_2_1)', '[]'); + + 'mapdata_json_2_2_ok' + and => { + regcmp( + '.*\{"key":"0","value":"eleme\\\\"nt1"\}.*', + '$(mapdata_json_str_2_2)' + ), + regcmp( + '.*\{"key":"1","value":"element2"\}.*', '$(mapdata_json_str_2_2)' + ), + regcmp( + '.*\{"key":"2","value":"element3"\}.*', '$(mapdata_json_str_2_2)' + ), + }; + + 'mapdata_json_2_3_ok' + and => { + regcmp('.*\["0","eleme\\\\"nt1"\].*', '$(mapdata_json_str_2_3)'), + regcmp('.*\["1","element2"\].*', '$(mapdata_json_str_2_3)'), + regcmp('.*\["2","element3"\].*', '$(mapdata_json_str_2_3)'), + }; + + 'mapdata_json_2_4_ok' + and => { + regcmp( + '.*\{"key":"0","key2":"\$\(this.k\[1\]\)","value":"eleme\\\\"nt1"\}.*', + '$(mapdata_json_str_2_4)' + ), + regcmp( + '.*\{"key":"1","key2":"\$\(this.k\[1\]\)","value":"element2"\}.*', + '$(mapdata_json_str_2_4)' + ), + regcmp( + '.*\{"key":"2","key2":"\$\(this.k\[1\]\)","value":"element3"\}.*', + '$(mapdata_json_str_2_4)' + ), + }; + + 'mapdata_json_3_1_ok' expression => strcmp('$(mapdata_json_str_3_1)', '[]'); + + 'mapdata_json_3_2_ok' + and => { + regcmp( + '.*\{"key":"x\\\\"x","value":"y\\\\"y"\}.*', + '$(mapdata_json_str_3_2)' + ), + }; + + 'mapdata_json_3_3_ok' + and => { + regcmp('.*\["x\\\\"x","y\\\\"y"\].*', '$(mapdata_json_str_3_3)') + }; + + 'mapdata_json_3_4_ok' + and => { + regcmp( + '.*\{"key":"x\\\\"x","key2":"\$\(this.k\[1\]\)","value":"y\\\\"y"\}.*', + '$(mapdata_json_str_3_4)' + ), + }; + + 'mapdata_json_4_1_ok' expression => strcmp('$(mapdata_json_str_4_1)', '[]'); + 'mapdata_json_4_2_ok' expression => strcmp('$(mapdata_json_str_4_1)', '[]'); + 'mapdata_json_4_3_ok' expression => strcmp('$(mapdata_json_str_4_1)', '[]'); + 'mapdata_json_4_4_ok' expression => strcmp('$(mapdata_json_str_4_1)', '[]'); + 'mapdata_json_5_1_ok' expression => strcmp('$(mapdata_json_str_5_1)', '[]'); + + 'mapdata_json_5_2_ok' + and => { + regcmp( + '.*\{"key":"mykey","value":"myvalue"\}.*', '$(mapdata_json_str_5_2)' + ), + regcmp( + '.*\{"key":"anotherkey","value":"anothervalue"\}.*', + '$(mapdata_json_str_5_2)' + ), + regcmp( + '.*\{"key":"lastkey!","value":"o\\\\"ne"\}.*', + '$(mapdata_json_str_5_2)' + ), + regcmp( + '.*\{"key":"lastkey!","value":"two"\}.*', '$(mapdata_json_str_5_2)' + ), + regcmp( + '.*\{"key":"lastkey!","value":"three"\}.*', '$(mapdata_json_str_5_2)' + ), + }; + + 'mapdata_json_5_3_ok' + and => { + regcmp('.*\["mykey","myvalue"\].*', '$(mapdata_json_str_5_3)'), + regcmp( + '.*\["anotherkey","anothervalue"\].*', '$(mapdata_json_str_5_3)' + ), + regcmp('.*\["lastkey!","o\\\\"ne"\].*', '$(mapdata_json_str_5_3)'), + regcmp('.*\["lastkey!","two"\].*', '$(mapdata_json_str_5_3)'), + regcmp('.*\["lastkey!","three"\].*', '$(mapdata_json_str_5_3)'), + }; + + 'mapdata_json_5_4_ok' + and => { + regcmp( + '.*\{"key":"mykey","key2":"\$\(this.k\[1\]\)","value":"myvalue"\}.*', + '$(mapdata_json_str_5_4)' + ), + regcmp( + '.*\{"key":"anotherkey","key2":"\$\(this.k\[1\]\)","value":"anothervalue"\}.*', + '$(mapdata_json_str_5_4)' + ), + regcmp( + '.*\{"key":"lastkey!","key2":"\$\(this.k\[1\]\)","value":"o\\\\"ne"\}.*', + '$(mapdata_json_str_5_4)' + ), + regcmp( + '.*\{"key":"lastkey!","key2":"\$\(this.k\[1\]\)","value":"two"\}.*', + '$(mapdata_json_str_5_4)' + ), + regcmp( + '.*\{"key":"lastkey!","key2":"\$\(this.k\[1\]\)","value":"three"\}.*', + '$(mapdata_json_str_5_4)' + ), + }; + + 'mapdata_json_6_1_ok' expression => strcmp('$(mapdata_json_str_6_1)', '[]'); + + 'mapdata_json_6_2_ok' + and => { + regcmp('.*\{"key":"a","value":"c"\}.*', '$(mapdata_json_str_6_2)') + }; + + 'mapdata_json_6_3_ok' + and => { regcmp('.*\["a","c"\].*', '$(mapdata_json_str_6_3)') }; + + 'mapdata_json_6_4_ok' + and => { + regcmp( + '.*\{"key":"a","key2":"b","value":"c"\}.*', '$(mapdata_json_str_6_4)' + ), + }; + + "mapdata_none_ok" + and => { + "mapdata_none_1_1_ok", + "mapdata_none_1_2_ok", + "mapdata_none_1_3_ok", + "mapdata_none_1_4_ok", + "mapdata_none_2_1_ok", + "mapdata_none_2_2_ok", + "mapdata_none_2_3_ok", + "mapdata_none_2_4_ok", + "mapdata_none_3_1_ok", + "mapdata_none_3_2_ok", + "mapdata_none_3_3_ok", + "mapdata_none_3_4_ok", + "mapdata_none_4_1_ok", + "mapdata_none_4_2_ok", + "mapdata_none_4_3_ok", + "mapdata_none_4_4_ok", + "mapdata_none_5_1_ok", + "mapdata_none_5_2_ok", + "mapdata_none_5_3_ok", + "mapdata_none_5_4_ok", + "mapdata_none_6_1_ok", + "mapdata_none_6_2_ok", + "mapdata_none_6_3_ok", + "mapdata_none_6_4_ok", + }; + + "mapdata_canonify_ok" + and => { + "mapdata_canonify_1_1_ok", + "mapdata_canonify_1_2_ok", + "mapdata_canonify_1_3_ok", + "mapdata_canonify_1_4_ok", + "mapdata_canonify_2_1_ok", + "mapdata_canonify_2_2_ok", + "mapdata_canonify_2_3_ok", + "mapdata_canonify_2_4_ok", + "mapdata_canonify_3_1_ok", + "mapdata_canonify_3_2_ok", + "mapdata_canonify_3_3_ok", + "mapdata_canonify_3_4_ok", + "mapdata_canonify_4_1_ok", + "mapdata_canonify_4_2_ok", + "mapdata_canonify_4_3_ok", + "mapdata_canonify_4_4_ok", + "mapdata_canonify_5_1_ok", + "mapdata_canonify_5_2_ok", + "mapdata_canonify_5_3_ok", + "mapdata_canonify_5_4_ok", + "mapdata_canonify_6_1_ok", + "mapdata_canonify_6_2_ok", + "mapdata_canonify_6_3_ok", + "mapdata_canonify_6_4_ok", + }; + + "mapdata_canonify_eval_ok" + and => { + "mapdata_canonify_eval_1_1_ok", + "mapdata_canonify_eval_1_2_ok", + "mapdata_canonify_eval_1_3_ok", + "mapdata_canonify_eval_1_4_ok", + "mapdata_canonify_eval_2_1_ok", + "mapdata_canonify_eval_2_2_ok", + "mapdata_canonify_eval_2_3_ok", + "mapdata_canonify_eval_2_4_ok", + "mapdata_canonify_eval_3_1_ok", + "mapdata_canonify_eval_3_2_ok", + "mapdata_canonify_eval_3_3_ok", + "mapdata_canonify_eval_3_4_ok", + "mapdata_canonify_eval_4_1_ok", + "mapdata_canonify_eval_4_2_ok", + "mapdata_canonify_eval_4_3_ok", + "mapdata_canonify_eval_4_4_ok", + "mapdata_canonify_eval_5_1_ok", + "mapdata_canonify_eval_5_2_ok", + "mapdata_canonify_eval_5_3_ok", + "mapdata_canonify_eval_5_4_ok", + "mapdata_canonify_eval_6_1_ok", + "mapdata_canonify_eval_6_2_ok", + "mapdata_canonify_eval_6_3_ok", + "mapdata_canonify_eval_6_4_ok", + }; + + "mapdata_json_ok" + and => { + "mapdata_json_1_1_ok", + "mapdata_json_1_2_ok", + "mapdata_json_1_3_ok", + "mapdata_json_1_4_ok", + "mapdata_json_2_1_ok", + "mapdata_json_2_2_ok", + "mapdata_json_2_3_ok", + "mapdata_json_2_4_ok", + "mapdata_json_3_1_ok", + "mapdata_json_3_2_ok", + "mapdata_json_3_3_ok", + "mapdata_json_3_4_ok", + "mapdata_json_4_1_ok", + "mapdata_json_4_2_ok", + "mapdata_json_4_3_ok", + "mapdata_json_4_4_ok", + "mapdata_json_5_1_ok", + "mapdata_json_5_2_ok", + "mapdata_json_5_3_ok", + "mapdata_json_5_4_ok", + "mapdata_json_6_1_ok", + "mapdata_json_6_2_ok", + "mapdata_json_6_3_ok", + "mapdata_json_6_4_ok", + }; + + "ok" + and => { + "mapdata_none_ok", + "mapdata_canonify_ok", + "mapdata_canonify_eval_ok", + "mapdata_json_ok", + }, + scope => "namespace"; } ####################################################### - bundle agent check { reports: diff --git a/tests/acceptance/01_vars/02_functions/mapdata_json_pipe.cf b/tests/acceptance/01_vars/02_functions/mapdata_json_pipe.cf index 95fd914e4e..1a3d32ece7 100644 --- a/tests/acceptance/01_vars/02_functions/mapdata_json_pipe.cf +++ b/tests/acceptance/01_vars/02_functions/mapdata_json_pipe.cf @@ -3,35 +3,47 @@ # Test mapdata('json_pipe') # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - # Skip on Windows because we use shell script below. - "test_skip_needs_work" string => "windows"; + # Skip on Windows because we use shell script below. + "test_skip_needs_work" string => "windows"; vars: - "items" data => '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}'; - "items_passthrough" data => mapdata("json_pipe", "$(G.cat)", items); - "items_jqinput" data => mapdata("json_pipe", "$(this.promise_dirname)/mapdata_json_pipe.cat_consume_input.sh $(this.promise_filename).jqinput.json", items); - "items_input" data => mapdata("json_pipe", "$(this.promise_dirname)/mapdata_json_pipe.cat_consume_input.sh $(this.promise_filename).input.json", items); + "items" data => '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}'; + "items_passthrough" data => mapdata("json_pipe", "$(G.cat)", items); + + "items_jqinput" + data => mapdata( + "json_pipe", + "$(this.promise_dirname)/mapdata_json_pipe.cat_consume_input.sh $(this.promise_filename).jqinput.json", + items + ); + + "items_input" + data => mapdata( + "json_pipe", + "$(this.promise_dirname)/mapdata_json_pipe.cat_consume_input.sh $(this.promise_filename).input.json", + items + ); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/maplist.cf b/tests/acceptance/01_vars/02_functions/maplist.cf index 3959806df4..8dbe77d5c2 100644 --- a/tests/acceptance/01_vars/02_functions/maplist.cf +++ b/tests/acceptance/01_vars/02_functions/maplist.cf @@ -3,36 +3,39 @@ # Test maplist() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "testlist" slist => { "zero", "two", "three's", "four-fore:quatre", "last" }; - "empty" slist => { }; + "testlist" + slist => { "zero", "two", "three's", "four-fore:quatre", "last" }; - "mapped_testlist" slist => maplist("value=$(this)", "testlist"); - "mapped_empty" slist => maplist("value=$(this)", empty); - "mapped_inline" slist => maplist("value=$(this)", '["a", "b", "c"]'); - "mapped_function_empty" slist => maplist(canonify($(this)), empty); - "mapped_function1" slist => maplist(format("%10.10s", $(this)), testlist); - "mapped_function2" slist => maplist(canonify($(this)), '["a or b", "b and c", "c+d", "e"]'); + "empty" slist => {}; + "mapped_testlist" slist => maplist("value=$(this)", "testlist"); + "mapped_empty" slist => maplist("value=$(this)", empty); + "mapped_inline" slist => maplist("value=$(this)", '["a", "b", "c"]'); + "mapped_function_empty" slist => maplist(canonify($(this)), empty); + "mapped_function1" slist => maplist(format("%10.10s", $(this)), testlist); + + "mapped_function2" + slist => maplist(canonify($(this)), '["a or b", "b and c", "c+d", "e"]'); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/mergedata-CFE-2551-0.cf b/tests/acceptance/01_vars/02_functions/mergedata-CFE-2551-0.cf index ed5c5b7f04..1ce020f371 100644 --- a/tests/acceptance/01_vars/02_functions/mergedata-CFE-2551-0.cf +++ b/tests/acceptance/01_vars/02_functions/mergedata-CFE-2551-0.cf @@ -1,53 +1,43 @@ # Test that merged data does not inherit variables from calling bundle - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent test { meta: - "description" -> { "CFE-2551" } - string => "Test that merged data does not include variables from calling bundle."; + "description" -> { "CFE-2551" } + string => "Test that merged data does not include variables from calling bundle."; - "test_soft_fail" - string => "any", - meta => { "CFE-2551"}; + "test_soft_fail" + string => "any", + meta => { "CFE-2551" }; vars: - - "a" string => "string a"; - "b" string => "string b"; - - "vars1[a]" string => "$(a)"; - "vars1[b]" string => "$(b)"; + "a" string => "string a"; + "b" string => "string b"; + "vars1[a]" string => "$(a)"; + "vars1[b]" string => "$(b)"; methods: - - # Call bundle that will define and merge it's own vars1 data structure. - - "Call another bundle" - usebundle => called_by_bundle_test; - + # Call bundle that will define and merge it's own vars1 data structure. + "Call another bundle" usebundle => called_by_bundle_test; } bundle agent called_by_bundle_test { vars: - "c" string => "string c"; - "vars1[c]" string => "$(c)"; + "c" string => "string c"; + "vars1[c]" string => "$(c)"; - # Create a new data structure NOT including data from calling bundle - - "merged_data_vars" - data => mergedata('{ "vars1": vars1 }'); + # Create a new data structure NOT including data from calling bundle + "merged_data_vars" data => mergedata('{ "vars1": vars1 }'); DEBUG|EXTRA:: # We only care to stringify this if we need the debug reports - "merged_data_vars_string" - string => storejson( merged_data_vars ); + "merged_data_vars_string" string => storejson(merged_data_vars); reports: DEBUG|EXTRA:: @@ -60,39 +50,33 @@ bundle agent called_by_bundle_test }'; } - bundle agent check { classes: - - # We pass if the variable indicies found in bundle test are NOT found in - # the bundle it called, and we find the index defined in the bundle it - # called that we expect. - - "pass" - expression => and( - and( - not( isvariable("called_by_bundle_test.merged_data_vars[vars1][a]")), - not( isvariable("called_by_bundle_test.merged_data_vars[vars1][b]")) - ), - isvariable("called_by_bundle_test.merged_data_vars[vars1][c]") - ); - - # We fail if the variable indicies found in bundle test are also found in - # the bundle it called. - - "fail" - or => { - isvariable( "called_by_bundle_test.merged_data_vars[vars1][a]" ), - isvariable( "called_by_bundle_test.merged_data_vars[vars1][b]" ), - }; - + # We pass if the variable indicies found in bundle test are NOT found in + # the bundle it called, and we find the index defined in the bundle it + # called that we expect. + "pass" + expression => and( + and( + not(isvariable("called_by_bundle_test.merged_data_vars[vars1][a]")), + not(isvariable("called_by_bundle_test.merged_data_vars[vars1][b]")) + ), + isvariable("called_by_bundle_test.merged_data_vars[vars1][c]") + ); + + # We fail if the variable indicies found in bundle test are also found in + # the bundle it called. + "fail" + or => { + isvariable("called_by_bundle_test.merged_data_vars[vars1][a]"), + isvariable("called_by_bundle_test.merged_data_vars[vars1][b]"), + }; reports: - fail:: "$(this.promise_filename) FAIL"; pass:: "$(this.promise_filename) Pass"; - } +} diff --git a/tests/acceptance/01_vars/02_functions/mergedata-CFE-2551-1.cf b/tests/acceptance/01_vars/02_functions/mergedata-CFE-2551-1.cf index 44e7516bdc..2378872c22 100644 --- a/tests/acceptance/01_vars/02_functions/mergedata-CFE-2551-1.cf +++ b/tests/acceptance/01_vars/02_functions/mergedata-CFE-2551-1.cf @@ -1,50 +1,40 @@ # Test that merged data does not inherit variables from calling bundle - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent test { meta: - "description" -> { "CFE-2551" } - string => "Test that merged data does not include variables from calling bundle. Variant specifying bundle qualified variable"; + "description" -> { "CFE-2551" } + string => "Test that merged data does not include variables from calling bundle. Variant specifying bundle qualified variable"; vars: - - "a" string => "string a"; - "b" string => "string b"; - - "vars1[a]" string => "$(a)"; - "vars1[b]" string => "$(b)"; + "a" string => "string a"; + "b" string => "string b"; + "vars1[a]" string => "$(a)"; + "vars1[b]" string => "$(b)"; methods: - - # Call bundle that will define and merge it's own vars1 data structure. - - "Call another bundle" - usebundle => called_by_bundle_test; - + # Call bundle that will define and merge it's own vars1 data structure. + "Call another bundle" usebundle => called_by_bundle_test; } bundle agent called_by_bundle_test { vars: - "c" string => "string c"; - "vars1[c]" string => "$(c)"; + "c" string => "string c"; + "vars1[c]" string => "$(c)"; - # Create a new data structure NOT including data from calling bundle - - # NOTE: This is what differs from the base test - "merged_data_vars" - data => mergedata('{ "vars1": $(this.bundle).vars1 }'); + # Create a new data structure NOT including data from calling bundle + # NOTE: This is what differs from the base test + "merged_data_vars" data => mergedata('{ "vars1": $(this.bundle).vars1 }'); DEBUG|EXTRA:: # We only care to stringify this if we need the debug reports - "merged_data_vars_string" - string => storejson( merged_data_vars ); + "merged_data_vars_string" string => storejson(merged_data_vars); reports: DEBUG|EXTRA:: @@ -57,39 +47,33 @@ bundle agent called_by_bundle_test }'; } - bundle agent check { classes: - - # We pass if the variable indicies found in bundle test are NOT found in - # the bundle it called, and we find the index defined in the bundle it - # called that we expect. - - "pass" - expression => and( - and( - not( isvariable("called_by_bundle_test.merged_data_vars[vars1][a]")), - not( isvariable("called_by_bundle_test.merged_data_vars[vars1][b]")) - ), - isvariable("called_by_bundle_test.merged_data_vars[vars1][c]") - ); - - # We fail if the variable indicies found in bundle test are also found in - # the bundle it called. - - "fail" - or => { - isvariable( "called_by_bundle_test.merged_data_vars[vars1][a]" ), - isvariable( "called_by_bundle_test.merged_data_vars[vars1][b]" ), - }; - + # We pass if the variable indicies found in bundle test are NOT found in + # the bundle it called, and we find the index defined in the bundle it + # called that we expect. + "pass" + expression => and( + and( + not(isvariable("called_by_bundle_test.merged_data_vars[vars1][a]")), + not(isvariable("called_by_bundle_test.merged_data_vars[vars1][b]")) + ), + isvariable("called_by_bundle_test.merged_data_vars[vars1][c]") + ); + + # We fail if the variable indicies found in bundle test are also found in + # the bundle it called. + "fail" + or => { + isvariable("called_by_bundle_test.merged_data_vars[vars1][a]"), + isvariable("called_by_bundle_test.merged_data_vars[vars1][b]"), + }; reports: - fail:: "$(this.promise_filename) FAIL"; pass:: "$(this.promise_filename) Pass"; - } +} diff --git a/tests/acceptance/01_vars/02_functions/mergedata-CFE-2551-2.cf b/tests/acceptance/01_vars/02_functions/mergedata-CFE-2551-2.cf index 3a98932832..6dc4979610 100644 --- a/tests/acceptance/01_vars/02_functions/mergedata-CFE-2551-2.cf +++ b/tests/acceptance/01_vars/02_functions/mergedata-CFE-2551-2.cf @@ -1,54 +1,44 @@ # Test that merged data does not inherit variables from calling bundle - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent test { meta: - "description" -> { "CFE-2551" } - string => "Test that merged data does not include variables from calling bundle."; + "description" -> { "CFE-2551" } + string => "Test that merged data does not include variables from calling bundle."; vars: - - "a" string => "string a"; - "b" string => "string b"; - - "vars1[a]" string => "$(a)"; - "vars1[b]" string => "$(b)"; + "a" string => "string a"; + "b" string => "string b"; + "vars1[a]" string => "$(a)"; + "vars1[b]" string => "$(b)"; methods: - - # Call bundle that will define and merge it's own vars1 data structure. - - "Call another bundle" - usebundle => called_by_bundle_test; - + # Call bundle that will define and merge it's own vars1 data structure. + "Call another bundle" usebundle => called_by_bundle_test; } bundle agent called_by_bundle_test { vars: - "c" string => "string c"; - "vars1[c]" string => "$(c)"; - - # Create a new data structure NOT including data from calling bundle + "c" string => "string c"; + "vars1[c]" string => "$(c)"; - # This variant is expected to not work, because the data structure (this - # bundles var1) cannot be referenced "bare" as the colon (:) makes the - # data look like JSON. So the mergedata fails, and the merged_data_vars - # isn't defined. - - "merged_data_vars" - data => mergedata('{ "vars1": $(this.namespace):$(this.bundle).vars1 }'); + # Create a new data structure NOT including data from calling bundle + # This variant is expected to not work, because the data structure (this + # bundles var1) cannot be referenced "bare" as the colon (:) makes the + # data look like JSON. So the mergedata fails, and the merged_data_vars + # isn't defined. + "merged_data_vars" + data => mergedata('{ "vars1": $(this.namespace):$(this.bundle).vars1 }'); DEBUG|EXTRA:: # We only care to stringify this if we need the debug reports - "merged_data_vars_string" - string => storejson( merged_data_vars ); + "merged_data_vars_string" string => storejson(merged_data_vars); reports: DEBUG|EXTRA:: @@ -56,28 +46,22 @@ bundle agent called_by_bundle_test "Expect merged_data_vars to be undefined."; } - bundle agent check { classes: + # We pass if the variable indicies found in bundle test are NOT found in + # the bundle it called, and we find the index defined in the bundle it + # called that we expect. + "pass" not => isvariable("called_by_bundle_test.merged_data_vars"); - # We pass if the variable indicies found in bundle test are NOT found in - # the bundle it called, and we find the index defined in the bundle it - # called that we expect. - - "pass" - not => isvariable("called_by_bundle_test.merged_data_vars"); - # We fail if the variable indicies found in bundle test are also found in - # the bundle it called. - - "fail" - expression => isvariable( "called_by_bundle_test.merged_data_vars" ); + # We fail if the variable indicies found in bundle test are also found in + # the bundle it called. + "fail" expression => isvariable("called_by_bundle_test.merged_data_vars"); reports: - fail:: "$(this.promise_filename) FAIL"; pass:: "$(this.promise_filename) Pass"; - } +} diff --git a/tests/acceptance/01_vars/02_functions/mergedata-json-strings.cf b/tests/acceptance/01_vars/02_functions/mergedata-json-strings.cf index 8d0a41e398..fd0f8f4829 100644 --- a/tests/acceptance/01_vars/02_functions/mergedata-json-strings.cf +++ b/tests/acceptance/01_vars/02_functions/mergedata-json-strings.cf @@ -1,34 +1,33 @@ #!/var/cfengine/bin/cf-agent -f- body common control { - inputs => { - "../../default.sub.cf" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent test { meta: - "description" - string => "Test that plain json strings can be merged"; + "description" string => "Test that plain json strings can be merged"; - vars: - "merged" data => mergedata( '[]', '{ "one": "1" }', '{ "two":"2"}' ); + vars: + "merged" data => mergedata('[]', '{ "one": "1" }', '{ "two":"2"}'); files: - "$(G.testfile)" - create => "true", - edit_template_string => "{{%-top-}}", - template_method => "inline_mustache", - template_data => @(merged); + "$(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)"); + "PASS/FAIL" + usebundle => dcs_check_diff( + "$(G.testfile)", + "$(this.promise_filename).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/mergedata.cf b/tests/acceptance/01_vars/02_functions/mergedata.cf index a80d8e197f..416d27de0e 100644 --- a/tests/acceptance/01_vars/02_functions/mergedata.cf +++ b/tests/acceptance/01_vars/02_functions/mergedata.cf @@ -4,136 +4,170 @@ # This test is unstable until we have canonical JSON output # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { vars: - "load1" data => parsejson('[ 1, 2, 3]'); - "load2" slist => { "element1", "element2", "element3" }; - "load3" data => parsejson('{ "x": "y" }'); - "load4" slist => { }; - "load5[mykey]" slist => { "myvalue" }; - "load5[anotherkey]" string => "anothervalue"; - "load5[lastkey!]" slist => {}; - - "X" slist => { "1", "2", "3", "4", "5" }; - "Y" slist => { @(X) }; - - "load_$(X)" data => mergedata("load$(X)"); - "load_$(X)_$(Y)" data => mergedata("load$(X)", "load$(Y)"); - "wrap_key_$(X)" data => mergedata('{ "wrapkey": load$(X) }'); - "wrap_array_$(X)" data => mergedata('[ load$(X) ]'); - - "bad1" data => mergedata(missingvar); - "bad2" data => mergedata(load1, missingvar); - - "justastring" string => "me"; - "bad3" data => mergedata(justastring); - "bad4" data => mergedata(load1, justastring); + "load1" data => parsejson('[ 1, 2, 3]'); + "load2" slist => { "element1", "element2", "element3" }; + "load3" data => parsejson('{ "x": "y" }'); + "load4" slist => {}; + "load5[mykey]" slist => { "myvalue" }; + "load5[anotherkey]" string => "anothervalue"; + "load5[lastkey!]" slist => {}; + "X" slist => { "1", "2", "3", "4", "5" }; + "Y" slist => { @(X) }; + "load_$(X)" data => mergedata("load$(X)"); + "load_$(X)_$(Y)" data => mergedata("load$(X)", "load$(Y)"); + "wrap_key_$(X)" data => mergedata('{ "wrapkey": load$(X) }'); + "wrap_array_$(X)" data => mergedata('[ load$(X) ]'); + "bad1" data => mergedata(missingvar); + "bad2" data => mergedata(load1, missingvar); + "justastring" string => "me"; + "bad3" data => mergedata(justastring); + "bad4" data => mergedata(load1, justastring); } ####################################################### - bundle agent check { vars: - "X" slist => { @(test.X) }; - "Y" slist => { @(test.X) }; - - "expected_1" string => '[1,2,3]'; - "expected_2" string => '["element1","element2","element3"]'; - "expected_3" string => '{"x":"y"}'; - "expected_4" string => '[]'; - "expected_5" string => '{"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}'; - "expected_1_1" string => '[1,2,3,1,2,3]'; - "expected_1_2" string => '[1,2,3,"element1","element2","element3"]'; - "expected_1_3" string => '{"0":1,"1":2,"2":3,"x":"y"}'; - "expected_1_4" string => '[1,2,3]'; - "expected_1_5" string => '{"0":1,"1":2,"2":3,"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}'; - "expected_2_1" string => '["element1","element2","element3",1,2,3]'; - "expected_2_2" string => '["element1","element2","element3","element1","element2","element3"]'; - "expected_2_3" string => '{"0":"element1","1":"element2","2":"element3","x":"y"}'; - "expected_2_4" string => '["element1","element2","element3"]'; - "expected_2_5" string => '{"0":"element1","1":"element2","2":"element3","anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}'; - "expected_3_1" string => '{"0":1,"1":2,"2":3,"x":"y"}'; - "expected_3_2" string => '{"0":"element1","1":"element2","2":"element3","x":"y"}'; - "expected_3_3" string => '{"x":"y"}'; - "expected_3_4" string => '{"x":"y"}'; - "expected_3_5" string => '{"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"],"x":"y"}'; - "expected_4_1" string => '[1,2,3]'; - "expected_4_2" string => '["element1","element2","element3"]'; - "expected_4_3" string => '{"x":"y"}'; - "expected_4_4" string => '[]'; - "expected_4_5" string => '{"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}'; - "expected_5_1" string => '{"0":1,"1":2,"2":3,"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}'; - "expected_5_2" string => '{"0":"element1","1":"element2","2":"element3","anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}'; - "expected_5_3" string => '{"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"],"x":"y"}'; - "expected_5_4" string => '{"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}'; - "expected_5_5" string => '{"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}'; - - "expected_wrapped_key_1" string => '{"wrapkey":[1,2,3]}'; - "expected_wrapped_key_2" string => '{"wrapkey":["element1","element2","element3"]}'; - "expected_wrapped_key_3" string => '{"wrapkey":{"x":"y"}}'; - "expected_wrapped_key_4" string => '{"wrapkey":[]}'; - "expected_wrapped_key_5" string => '{"wrapkey":{"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}}'; - - "expected_wrapped_array_1" string => '[[1,2,3]]'; - "expected_wrapped_array_2" string => '[["element1","element2","element3"]]'; - "expected_wrapped_array_3" string => '[{"x":"y"}]'; - "expected_wrapped_array_4" string => '[[]]'; - "expected_wrapped_array_5" string => '[{"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}]'; - - "actual_$(X)_$(Y)" string => format("%S", "test.load_$(X)_$(Y)"); - "actual_$(X)" string => format("%S", "test.load_$(X)"); - "actual_wrapped_key_$(X)" string => format("%S", "test.wrap_key_$(X)"); - "actual_wrapped_array_$(X)" string => format("%S", "test.wrap_array_$(X)"); + "X" slist => { @(test.X) }; + "Y" slist => { @(test.X) }; + "expected_1" string => '[1,2,3]'; + "expected_2" string => '["element1","element2","element3"]'; + "expected_3" string => '{"x":"y"}'; + "expected_4" string => '[]'; + + "expected_5" + string => '{"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}'; + + "expected_1_1" string => '[1,2,3,1,2,3]'; + "expected_1_2" string => '[1,2,3,"element1","element2","element3"]'; + "expected_1_3" string => '{"0":1,"1":2,"2":3,"x":"y"}'; + "expected_1_4" string => '[1,2,3]'; + + "expected_1_5" + string => '{"0":1,"1":2,"2":3,"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}'; + + "expected_2_1" string => '["element1","element2","element3",1,2,3]'; + + "expected_2_2" + string => '["element1","element2","element3","element1","element2","element3"]'; + + "expected_2_3" + string => '{"0":"element1","1":"element2","2":"element3","x":"y"}'; + + "expected_2_4" string => '["element1","element2","element3"]'; + + "expected_2_5" + string => '{"0":"element1","1":"element2","2":"element3","anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}'; + + "expected_3_1" string => '{"0":1,"1":2,"2":3,"x":"y"}'; + + "expected_3_2" + string => '{"0":"element1","1":"element2","2":"element3","x":"y"}'; + + "expected_3_3" string => '{"x":"y"}'; + "expected_3_4" string => '{"x":"y"}'; + + "expected_3_5" + string => '{"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"],"x":"y"}'; + + "expected_4_1" string => '[1,2,3]'; + "expected_4_2" string => '["element1","element2","element3"]'; + "expected_4_3" string => '{"x":"y"}'; + "expected_4_4" string => '[]'; + + "expected_4_5" + string => '{"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}'; + + "expected_5_1" + string => '{"0":1,"1":2,"2":3,"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}'; + + "expected_5_2" + string => '{"0":"element1","1":"element2","2":"element3","anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}'; + + "expected_5_3" + string => '{"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"],"x":"y"}'; + + "expected_5_4" + string => '{"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}'; + + "expected_5_5" + string => '{"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}'; + + "expected_wrapped_key_1" string => '{"wrapkey":[1,2,3]}'; + + "expected_wrapped_key_2" + string => '{"wrapkey":["element1","element2","element3"]}'; + + "expected_wrapped_key_3" string => '{"wrapkey":{"x":"y"}}'; + "expected_wrapped_key_4" string => '{"wrapkey":[]}'; + + "expected_wrapped_key_5" + string => '{"wrapkey":{"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}}'; + + "expected_wrapped_array_1" string => '[[1,2,3]]'; + "expected_wrapped_array_2" string => '[["element1","element2","element3"]]'; + "expected_wrapped_array_3" string => '[{"x":"y"}]'; + "expected_wrapped_array_4" string => '[[]]'; + + "expected_wrapped_array_5" + string => '[{"anotherkey":"anothervalue","lastkey!":[],"mykey":["myvalue"]}]'; + + "actual_$(X)_$(Y)" string => format("%S", "test.load_$(X)_$(Y)"); + "actual_$(X)" string => format("%S", "test.load_$(X)"); + "actual_wrapped_key_$(X)" string => format("%S", "test.wrap_key_$(X)"); + "actual_wrapped_array_$(X)" string => format("%S", "test.wrap_array_$(X)"); classes: - "ok_$(X)_$(Y)" expression => strcmp("$(actual_$(X)_$(Y))", - "$(expected_$(X)_$(Y))"); + "ok_$(X)_$(Y)" + expression => strcmp("$(actual_$(X)_$(Y))", "$(expected_$(X)_$(Y))"); - "ok_$(X)" expression => strcmp("$(actual_$(X))", - "$(expected_$(X))"); + "ok_$(X)" expression => strcmp("$(actual_$(X))", "$(expected_$(X))"); - "not_ok_wrapped_key_$(X)" not => strcmp("$(actual_wrapped_key_$(X))", - "$(expected_wrapped_key_$(X))"); + "not_ok_wrapped_key_$(X)" + not => strcmp( + "$(actual_wrapped_key_$(X))", "$(expected_wrapped_key_$(X))" + ); - "not_ok_wrapped_array_$(X)" not => strcmp("$(actual_wrapped_array_$(X))", - "$(expected_wrapped_array_$(X))"); + "not_ok_wrapped_array_$(X)" + not => strcmp( + "$(actual_wrapped_array_$(X))", "$(expected_wrapped_array_$(X))" + ); - "ok" not => classmatch("not_ok_.*"); + "ok" not => classmatch("not_ok_.*"); reports: DEBUG:: "$(X): actual $(actual_$(X)) != $(X) expected $(expected_$(X))" - if => "!ok_$(X)"; + if => "!ok_$(X)"; "$(X): actual wrap key $(actual_wrapped_key_$(X)) != $(X) expected wrapped key $(expected_wrapped_key_$(X))" - if => "not_ok_wrapped_key_$(X)"; + if => "not_ok_wrapped_key_$(X)"; "$(X): actual wrap array $(actual_wrapped_array_$(X)) != $(X) expected wrapped array $(expected_wrapped_array_$(X))" - if => "not_ok_wrapped_array_$(X)"; + if => "not_ok_wrapped_array_$(X)"; "$(X)+$(Y): actual $(actual_$(X)_$(Y)) != $(X)+$(Y) expected $(expected_$(X)_$(Y))" - if => "!ok_$(X)_$(Y)"; + if => "!ok_$(X)_$(Y)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/mergedata_CFE-2551-0.cf b/tests/acceptance/01_vars/02_functions/mergedata_CFE-2551-0.cf index 932b763f45..0b44602c71 100644 --- a/tests/acceptance/01_vars/02_functions/mergedata_CFE-2551-0.cf +++ b/tests/acceptance/01_vars/02_functions/mergedata_CFE-2551-0.cf @@ -1,63 +1,62 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } + bundle agent main { methods: - "test"; - "check"; + "test"; + "check"; } bundle agent test { meta: - "description" -> { "CFE-2551" } - string => "Test that variables defined in other bundles with the same name are not included in a merged result"; + "description" -> { "CFE-2551" } + string => "Test that variables defined in other bundles with the same name are not included in a merged result"; - "test_soft_fail" - string => "any", - meta => { "CFE-2551" }; + "test_soft_fail" + string => "any", + meta => { "CFE-2551" }; vars: - - "a" string => "string a"; - "b" string => "string b"; - - "vars1[a]" string => "$(a)"; - "vars1[b]" string => "$(b)"; + "a" string => "string a"; + "b" string => "string b"; + "vars1[a]" string => "$(a)"; + "vars1[b]" string => "$(b)"; methods: - "run_low_test_merged" usebundle => test_merged_low; - + "run_low_test_merged" usebundle => test_merged_low; } bundle agent test_merged_low { vars: - "c" string => "string c"; - "vars1[c]" string => "$(c)"; + "c" string => "string c"; + "vars1[c]" string => "$(c)"; - # We expect that only the values from the classic array vars1 in this - # bundle will be merged together. And thus, we should only end up with ={ "vars1" : { "c": "string c" } }= - - "merged_data_vars" data => mergedata('{ "vars1": vars1 }'); - "merged_data_vars_str" string => format( "%S", merged_data_vars ); + # We expect that only the values from the classic array vars1 in this + # bundle will be merged together. And thus, we should only end up with ={ "vars1" : { "c": "string c" } }= + "merged_data_vars" data => mergedata('{ "vars1": vars1 }'); + "merged_data_vars_str" string => format("%S", merged_data_vars); reports: DEBUG|EXTRA:: "$(this.bundle) : merged_data_vars_str : $(merged_data_vars_str)"; - } bundle agent check { vars: - "expected" string => '{"vars1":{"c":"string c"}}'; + "expected" string => '{"vars1":{"c":"string c"}}'; classes: - "pass" expression => strcmp( $(expected), $(test_merged_low.merged_data_vars_str) ); + "pass" + expression => strcmp( + $(expected), $(test_merged_low.merged_data_vars_str) + ); reports: pass:: @@ -67,5 +66,4 @@ bundle agent check "$(this.promise_filename) FAIL"; "expected: '$(expected)'"; "got: '$(test_merged_low.merged_data_vars_str)'"; - } diff --git a/tests/acceptance/01_vars/02_functions/mergedata_CFE-2551-1.cf b/tests/acceptance/01_vars/02_functions/mergedata_CFE-2551-1.cf index 9a6be0260a..e2e6c96aff 100644 --- a/tests/acceptance/01_vars/02_functions/mergedata_CFE-2551-1.cf +++ b/tests/acceptance/01_vars/02_functions/mergedata_CFE-2551-1.cf @@ -1,59 +1,58 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } + bundle agent main { methods: - "test"; - "check"; + "test"; + "check"; } bundle agent test { meta: - "description" -> { "CFE-2551" } - string => "Test that variables defined in other bundles with the same name are not included in a merged result"; + "description" -> { "CFE-2551" } + string => "Test that variables defined in other bundles with the same name are not included in a merged result"; vars: - - "a" string => "string a"; - "b" string => "string b"; - - "vars1[a]" string => "$(a)"; - "vars1[b]" string => "$(b)"; + "a" string => "string a"; + "b" string => "string b"; + "vars1[a]" string => "$(a)"; + "vars1[b]" string => "$(b)"; methods: - "run_low_test_merged" usebundle => test_merged_low; - + "run_low_test_merged" usebundle => test_merged_low; } bundle agent test_merged_low { vars: - "c" string => "string c"; - "vars1[c]" string => "$(c)"; + "c" string => "string c"; + "vars1[c]" string => "$(c)"; - # We expect that only the values from the classic array vars1 in this - # bundle will be merged together. And thus, we should only end up with ={ "vars1" : { "c": "string c" } }= - - "merged_data_vars" data => mergedata('{ "vars1": test_merged_low.vars1 }'); - "merged_data_vars_str" string => format( "%S", merged_data_vars ); + # We expect that only the values from the classic array vars1 in this + # bundle will be merged together. And thus, we should only end up with ={ "vars1" : { "c": "string c" } }= + "merged_data_vars" data => mergedata('{ "vars1": test_merged_low.vars1 }'); + "merged_data_vars_str" string => format("%S", merged_data_vars); reports: DEBUG|EXTRA:: "$(this.bundle) : merged_data_vars_str : $(merged_data_vars_str)"; - } bundle agent check { vars: - "expected" string => '{"vars1":{"c":"string c"}}'; + "expected" string => '{"vars1":{"c":"string c"}}'; classes: - "pass" expression => strcmp( $(expected), $(test_merged_low.merged_data_vars_str) ); + "pass" + expression => strcmp( + $(expected), $(test_merged_low.merged_data_vars_str) + ); reports: pass:: @@ -63,5 +62,4 @@ bundle agent check "$(this.promise_filename) FAIL"; "expected: '$(expected)'"; "got: '$(test_merged_low.merged_data_vars_str)'"; - } diff --git a/tests/acceptance/01_vars/02_functions/mergedata_CFE-2551-2.cf b/tests/acceptance/01_vars/02_functions/mergedata_CFE-2551-2.cf index 2feab0b746..ea0f9c27b3 100644 --- a/tests/acceptance/01_vars/02_functions/mergedata_CFE-2551-2.cf +++ b/tests/acceptance/01_vars/02_functions/mergedata_CFE-2551-2.cf @@ -1,59 +1,58 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } + bundle agent main { methods: - "test"; - "check"; + "test"; + "check"; } bundle agent test { meta: - "description" -> { "CFE-2551" } - string => "Test that variables defined in other bundles with the same name are not included in a merged result"; + "description" -> { "CFE-2551" } + string => "Test that variables defined in other bundles with the same name are not included in a merged result"; vars: - - "a" string => "string a"; - "b" string => "string b"; - - "vars1[a]" string => "$(a)"; - "vars1[b]" string => "$(b)"; + "a" string => "string a"; + "b" string => "string b"; + "vars1[a]" string => "$(a)"; + "vars1[b]" string => "$(b)"; methods: - "run_low_test_merged" usebundle => test_merged_low; - + "run_low_test_merged" usebundle => test_merged_low; } bundle agent test_merged_low { vars: - "c" string => "string c"; - "vars1[c]" string => "$(c)"; + "c" string => "string c"; + "vars1[c]" string => "$(c)"; - # We expect that only the values from the classic array vars1 in this - # bundle will be merged together. And thus, we should only end up with ={ "vars1" : { "c": "string c" } }= - - "merged_data_vars" data => mergedata('{ "vars1": $(this.bundle).vars1 }'); - "merged_data_vars_str" string => format( "%S", merged_data_vars ); + # We expect that only the values from the classic array vars1 in this + # bundle will be merged together. And thus, we should only end up with ={ "vars1" : { "c": "string c" } }= + "merged_data_vars" data => mergedata('{ "vars1": $(this.bundle).vars1 }'); + "merged_data_vars_str" string => format("%S", merged_data_vars); reports: DEBUG|EXTRA:: "$(this.bundle) : merged_data_vars_str : $(merged_data_vars_str)"; - } bundle agent check { vars: - "expected" string => '{"vars1":{"c":"string c"}}'; + "expected" string => '{"vars1":{"c":"string c"}}'; classes: - "pass" expression => strcmp( $(expected), $(test_merged_low.merged_data_vars_str) ); + "pass" + expression => strcmp( + $(expected), $(test_merged_low.merged_data_vars_str) + ); reports: pass:: @@ -63,5 +62,4 @@ bundle agent check "$(this.promise_filename) FAIL"; "expected: '$(expected)'"; "got: '$(test_merged_low.merged_data_vars_str)'"; - } diff --git a/tests/acceptance/01_vars/02_functions/mergedata_multilevel_array.cf b/tests/acceptance/01_vars/02_functions/mergedata_multilevel_array.cf index 29db37cf52..53ace23511 100644 --- a/tests/acceptance/01_vars/02_functions/mergedata_multilevel_array.cf +++ b/tests/acceptance/01_vars/02_functions/mergedata_multilevel_array.cf @@ -2,34 +2,33 @@ # Ref: https://dev.cfengine.com/issues/4566 body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent check { - vars: - "a[0][class]" string => "any"; - "a[0][command]" string => "/bin/true"; - "a[1][class]" string => "linux"; - "a[1][command]" string => "/bin/false"; + vars: + "a[0][class]" string => "any"; + "a[0][command]" string => "/bin/true"; + "a[1][class]" string => "linux"; + "a[1][command]" string => "/bin/false"; + "m" data => mergedata(a); + "i" slist => getindices(m); - "m" data => mergedata( a ); + classes: + "PASS" expression => strcmp("any", "$(m[0][class])"); - "i" slist => getindices( m ); + reports: + PASS:: + "$(this.promise_filename) Pass"; - classes: - "PASS" expression => strcmp( "any", "$(m[0][class])" ); + !PASS:: + "$(this.promise_filename) FAIL"; - reports: - PASS:: - "$(this.promise_filename) Pass"; - !PASS:: - "$(this.promise_filename) FAIL"; - - DEBUG:: - "i => [$(i)]"; - "class => $(m[$(i)][class])"; - "command => $(m[$(i)][command])"; - "version => $(sys.cf_version)"; + DEBUG:: + "i => [$(i)]"; + "class => $(m[$(i)][class])"; + "command => $(m[$(i)][command])"; + "version => $(sys.cf_version)"; } diff --git a/tests/acceptance/01_vars/02_functions/mergedata_with_list_iteration.cf b/tests/acceptance/01_vars/02_functions/mergedata_with_list_iteration.cf index f09366fb3d..34f1ee07ba 100644 --- a/tests/acceptance/01_vars/02_functions/mergedata_with_list_iteration.cf +++ b/tests/acceptance/01_vars/02_functions/mergedata_with_list_iteration.cf @@ -3,28 +3,27 @@ # Test that mergedata works with list iteration # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { test_1, test_2, default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { test_1, test_2, default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test_1 { vars: "hosts" meta => { "hosts" }, - data => parsejson('{"10.100.250.11": [ "slot2" ], "10.100.250.10": [ "slot1" ], "111": 222 }'); + data => parsejson( + '{"10.100.250.11": [ "slot2" ], "10.100.250.10": [ "slot1" ], "111": 222 }' + ); } bundle agent test_2 @@ -32,7 +31,9 @@ bundle agent test_2 vars: "hosts" meta => { "hosts" }, - data => parsejson('{"10.100.250.11": [ "cflin111" ], "10.100.250.10": [ "cflin110" ]}'); + data => parsejson( + '{"10.100.250.11": [ "cflin111" ], "10.100.250.10": [ "cflin110" ]}' + ); } # this bundle is not in the bundlesequence but will be evaluated @@ -41,7 +42,9 @@ bundle agent test_3 vars: "hosts" meta => { "hosts" }, - data => parsejson('{"10.100.250.12": [ "cflin111" ], "10.100.250.13": [ "cflin110" ]}'); + data => parsejson( + '{"10.100.250.12": [ "cflin111" ], "10.100.250.13": [ "cflin110" ]}' + ); } bundle common test @@ -50,29 +53,37 @@ bundle common test "variables" slist => variablesmatching(".*", "hosts"); "sorted_vars" slist => sort("variables", "lex"); - "merged" data => parsejson('{}'), policy => "free"; - "merged" data => mergedata(merged, $(sorted_vars)), policy => "free"; + "merged" + data => parsejson('{}'), + policy => "free"; - "result" string => format("%S", "merged"), policy => "free"; -} + "merged" + data => mergedata(merged, $(sorted_vars)), + policy => "free"; + "result" + string => format("%S", "merged"), + policy => "free"; +} ####################################################### - bundle agent check { vars: - "expected" string => '{"10.100.250.10":["cflin110"],"10.100.250.11":["cflin111"],"10.100.250.12":["cflin111"],"10.100.250.13":["cflin110"],"111":222}'; + "expected" + string => '{"10.100.250.10":["cflin110"],"10.100.250.11":["cflin111"],"10.100.250.12":["cflin111"],"10.100.250.13":["cflin110"],"111":222}'; classes: - "ok" expression => strcmp($(test.result), $(check.expected)); + "ok" expression => strcmp($(test.result), $(check.expected)); reports: DEBUG.inform_mode:: "Expected: '$(check.expected)'"; "Result: '$(test.result)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/missing_functions.cf b/tests/acceptance/01_vars/02_functions/missing_functions.cf index 01e4ec57e1..ac09f07a3c 100644 --- a/tests/acceptance/01_vars/02_functions/missing_functions.cf +++ b/tests/acceptance/01_vars/02_functions/missing_functions.cf @@ -3,31 +3,35 @@ # Redmine #3907: supposedly missing functions (in this case, a classes body with parameters) aren't # ############################################################################## - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { - } - bundle agent test { vars: - "subout" string => execresult("$(sys.cf_agent) -KI -f $(this.promise_filename).sub | $(G.grep) 'FnCall'", "useshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -KI -f $(this.promise_filename).sub | $(G.grep) 'FnCall'", + "useshell" + ); } bundle agent check { - # If the output contains the FnCall warning about 9fdee2550bec1030e22addb0dc9d7218b9174c70, we fail + # If the output contains the FnCall warning about 9fdee2550bec1030e22addb0dc9d7218b9174c70, we fail classes: - "ok" not => regcmp(".*9fdee2550bec1030e22addb0dc9d7218b9174c70.*", "$(test.subout)"); + "ok" + not => regcmp( + ".*9fdee2550bec1030e22addb0dc9d7218b9174c70.*", "$(test.subout)" + ); reports: DEBUG:: @@ -35,11 +39,13 @@ bundle agent check ok:: "The FnCall bogus warning didn't happen"; + !ok:: "The FnCall bogus warning happened"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/mustach_doesnt_render_null.cf b/tests/acceptance/01_vars/02_functions/mustach_doesnt_render_null.cf index 6483aa4ada..f3ada9d972 100644 --- a/tests/acceptance/01_vars/02_functions/mustach_doesnt_render_null.cf +++ b/tests/acceptance/01_vars/02_functions/mustach_doesnt_render_null.cf @@ -1,35 +1,39 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "description" string => "Test that mustache doesn't render nulls that don't exist (CFE-2077)"; + "description" + string => "Test that mustache doesn't render nulls that don't exist (CFE-2077)"; vars: - "jsondata" data => parsejson('{ "key" : ["one", "two", "three"]}'); - - "noninstersecting_list" slist => { "four" }; - - "list" slist => getvalues("jsondata[key]"); - - "diff_list" slist => difference("list", "noninstersecting_list"); - "diff_string" string => join(" ", diff_list); - - "mustache_string" string => string_mustache("{{#vars.test.diff_list}}{{{.}}} {{/vars.test.diff_list}}"); - + "jsondata" data => parsejson('{ "key" : ["one", "two", "three"]}'); + "noninstersecting_list" slist => { "four" }; + "list" slist => getvalues("jsondata[key]"); + "diff_list" slist => difference("list", "noninstersecting_list"); + "diff_string" string => join(" ", diff_list); + + "mustache_string" + string => string_mustache( + "{{#vars.test.diff_list}}{{{.}}} {{/vars.test.diff_list}}" + ); } bundle agent check { - methods: - - "check" usebundle => dcs_check_regcmp("one two three ", $(test.mustache_string), $(this.promise_filename), "no"); + "check" + usebundle => dcs_check_regcmp( + "one two three ", + $(test.mustache_string), + $(this.promise_filename), + "no" + ); reports: DEBUG|EXTRA:: diff --git a/tests/acceptance/01_vars/02_functions/mustache_iterating_object_should_use_context_for_single_block_render.cf b/tests/acceptance/01_vars/02_functions/mustache_iterating_object_should_use_context_for_single_block_render.cf index 19d992d380..13a672d79c 100644 --- a/tests/acceptance/01_vars/02_functions/mustache_iterating_object_should_use_context_for_single_block_render.cf +++ b/tests/acceptance/01_vars/02_functions/mustache_iterating_object_should_use_context_for_single_block_render.cf @@ -1,15 +1,15 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - - "template" string => "# Test1 + "template" + string => "# Test1 {{#testcase.test1}} {{#data}} Data = {{.}} @@ -26,7 +26,8 @@ Other data = {{.}} {{/otherdata}} {{/testcase.test2}}"; - "data" data => '{ + "data" + data => '{ "testcase": { "test1": { "data": [ @@ -46,35 +47,31 @@ Other data = {{.}} } } }'; - } bundle agent test { meta: - - # https://mustache.github.io/#demo Try the template and data from above in - # the demo site. The issue we see in cfengine is that while iterating over - # testcase.test2 the rendering happens for each sub structure iterated - # duplicating the data. - - # So we get Instead of - # # Test2 | # Test2 - # Data = v1 | Data = v1 - # Data = v2 | Data = v2 - # Other data = v3 | Other data = v3 - # Other data = v4 | Other data = v4 - # Data = v1 | - # Data = v2 | - # Other data = v3 | - # Other data = v4 | - - "description" -> { "CFE-2125" } - string => "Test that iterating over object results in single block with + # https://mustache.github.io/#demo Try the template and data from above in + # the demo site. The issue we see in cfengine is that while iterating over + # testcase.test2 the rendering happens for each sub structure iterated + # duplicating the data. + # So we get Instead of + # # Test2 | # Test2 + # Data = v1 | Data = v1 + # Data = v2 | Data = v2 + # Other data = v3 | Other data = v3 + # Other data = v4 | Other data = v4 + # Data = v1 | + # Data = v2 | + # Other data = v3 | + # Other data = v4 | + "description" -> { "CFE-2125" } + string => "Test that iterating over object results in single block with correct context (CFE-2125)."; vars: - "got" string => string_mustache( $(init.template), @(init.data) ); + "got" string => string_mustache($(init.template), @(init.data)); } bundle agent check @@ -84,7 +81,8 @@ bundle agent check "got output: $(test.got)"; vars: - "expected" string => "# Test1 + "expected" + string => "# Test1 Data = v1 Data = v2 @@ -96,5 +94,8 @@ Other data = v4 "; methods: - "check" usebundle => dcs_check_strcmp( $(test.got), $(check.expected), $(this.promise_filename), "no" ); + "check" + usebundle => dcs_check_strcmp( + $(test.got), $(check.expected), $(this.promise_filename), "no" + ); } diff --git a/tests/acceptance/01_vars/02_functions/mustache_iterating_object_workaround.cf b/tests/acceptance/01_vars/02_functions/mustache_iterating_object_workaround.cf index 55490a1869..1745de0afe 100644 --- a/tests/acceptance/01_vars/02_functions/mustache_iterating_object_workaround.cf +++ b/tests/acceptance/01_vars/02_functions/mustache_iterating_object_workaround.cf @@ -1,15 +1,15 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - - "template" string => "# Test1 + "template" + string => "# Test1 {{#testcase.test1}} {{#data}} Data = {{.}} @@ -24,7 +24,8 @@ Data = {{.}} Other data = {{.}} {{/testcase.test2.otherdata}}"; - "data" data => '{ + "data" + data => '{ "testcase": { "test1": { "data": [ @@ -44,25 +45,22 @@ Other data = {{.}} } } }'; - } bundle agent test { meta: - - # The issue we see in cfengine is that if a {{#testcase.test2}} section is - # used the corresponding JSON object is iterated over and the rendering - # happens for each sub structure (property) iterated duplicating the - # data. The workaround is to not use a separate section corresponding to - # the testcase.test2 JSON object with multiple properties. - - "description" -> { "CFE-2125" } - string => "Test a workaround for iterating over object to get a single + # The issue we see in cfengine is that if a {{#testcase.test2}} section is + # used the corresponding JSON object is iterated over and the rendering + # happens for each sub structure (property) iterated duplicating the + # data. The workaround is to not use a separate section corresponding to + # the testcase.test2 JSON object with multiple properties. + "description" -> { "CFE-2125" } + string => "Test a workaround for iterating over object to get a single block with correct context (CFE-2125)."; vars: - "got" string => string_mustache( $(init.template), @(init.data) ); + "got" string => string_mustache($(init.template), @(init.data)); } bundle agent check @@ -72,7 +70,8 @@ bundle agent check "got output: $(test.got)"; vars: - "expected" string => "# Test1 + "expected" + string => "# Test1 Data = v1 Data = v2 @@ -84,5 +83,8 @@ Other data = v4 "; methods: - "check" usebundle => dcs_check_strcmp( $(test.got), $(check.expected), $(this.promise_filename), "no" ); + "check" + usebundle => dcs_check_strcmp( + $(test.got), $(check.expected), $(this.promise_filename), "no" + ); } diff --git a/tests/acceptance/01_vars/02_functions/mustache_iteration_with_nonfalse_values.cf b/tests/acceptance/01_vars/02_functions/mustache_iteration_with_nonfalse_values.cf index 2d6ed37cd8..6ddc80d8f0 100644 --- a/tests/acceptance/01_vars/02_functions/mustache_iteration_with_nonfalse_values.cf +++ b/tests/acceptance/01_vars/02_functions/mustache_iteration_with_nonfalse_values.cf @@ -3,26 +3,36 @@ body common control inputs => { "../../default.sub.cf" }; bundlesequence => { default("$(this.promise_filename)") }; } + bundle agent test { meta: - "test_soft_fail" - string => "any", + "test_soft_fail" + string => "any", meta => { "CFE-2535" }; } -bundle agent check { +bundle agent check +{ vars: - "json" data => '{"test":[ + "json" + data => '{"test":[ {"a?":{"val":"a1"}}, {"b?":{"val":"b2"}}, {"a?":{"val":"a3"}} ]}'; + "json_str" string => format("%S", 'json'); - "result" string => string_mustache('{{#test}} + + "result" + string => string_mustache( + '{{#test}} --- A:{{#a?}}{{val}}{{/a?}}, B:{{#b?}}{{val}}{{/b?}} -{{/test}}', json); +{{/test}}', + json + ); + "expected" string => "--- A:a1, B: --- @@ -31,16 +41,12 @@ A:, B:b2 A:a3,B: "; - reports: - "$(this.promise_filename) Pass" - if => strcmp( $(result), $(expected) ); - - "$(this.promise_filename) FAIL" - unless => strcmp( $(result), $(expected) ); + "$(this.promise_filename) Pass" if => strcmp($(result), $(expected)); + "$(this.promise_filename) FAIL" unless => strcmp($(result), $(expected)); EXTRA:: - "$(sys.cf_version)"; + "$(sys.cf_version)"; "Result: $(result)"; "Should be: diff --git a/tests/acceptance/01_vars/02_functions/mustache_section_nonfalse_inverted.cf b/tests/acceptance/01_vars/02_functions/mustache_section_nonfalse_inverted.cf index 5654df447f..f4e1f7c564 100644 --- a/tests/acceptance/01_vars/02_functions/mustache_section_nonfalse_inverted.cf +++ b/tests/acceptance/01_vars/02_functions/mustache_section_nonfalse_inverted.cf @@ -1,15 +1,15 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - - "template" string => "{{#network_interfaces}} + "template" + string => "{{#network_interfaces}} interface {{interface}} {{#gateway}} @@ -21,7 +21,8 @@ gateway {{.}} {{/network_interfaces}}"; - "data" data => '{ + "data" + data => '{ "network_interfaces": [ { "interface":"eth1", @@ -40,31 +41,35 @@ gateway {{.}} } ] }'; - } bundle agent test { meta: - "description" -> { "CFE-1565" } - string => "Test that inversion of non-false values works as expected with mustache. (CFE-1565)"; + "description" -> { "CFE-1565" } + string => "Test that inversion of non-false values works as expected with mustache. (CFE-1565)"; + + "test_soft_fail" + string => "any", + meta => { "CFE-1565" }; - "test_soft_fail" - string => "any", - meta => { "CFE-1565" }; vars: - "got" string => string_mustache( $(init.template), @(init.data) ); + "got" string => string_mustache($(init.template), @(init.data)); } bundle agent check { vars: - "expected" string => "interface eth1 + "expected" + string => "interface eth1 #no gateway interface vlan10 gateway 192.168.1.1 "; methods: - "check" usebundle => dcs_check_strcmp( $(test.got), $(check.expected), $(this.promise_filename), "no" ); + "check" + usebundle => dcs_check_strcmp( + $(test.got), $(check.expected), $(this.promise_filename), "no" + ); } diff --git a/tests/acceptance/01_vars/02_functions/namespaces/001.cf b/tests/acceptance/01_vars/02_functions/namespaces/001.cf index 5508bceebc..2f1700ba59 100644 --- a/tests/acceptance/01_vars/02_functions/namespaces/001.cf +++ b/tests/acceptance/01_vars/02_functions/namespaces/001.cf @@ -1,18 +1,16 @@ # Check that getindices() works correctly within and across namespaces - # 001: getindices() with parameter variable in its argument, from a non-default namespace to the default namespace - body common control { - inputs => { "../../../default.sub.cf", "001_namespaced_getindices.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf", "001_namespaced_getindices.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "array[key]" string => "string"; + "array[key]" string => "string"; } bundle agent init @@ -23,11 +21,13 @@ bundle agent init bundle agent test { methods: - "test_in_namespace" usebundle => b:test_in_namespace("default:g.array", "b:variables.array2"); + "test_in_namespace" + usebundle => b:test_in_namespace("default:g.array", "b:variables.array2"); } bundle agent check { methods: - "check_in_namespace" usebundle => b:check_in_namespace("$(this.promise_filename)"); + "check_in_namespace" + usebundle => b:check_in_namespace("$(this.promise_filename)"); } diff --git a/tests/acceptance/01_vars/02_functions/namespaces/002.cf b/tests/acceptance/01_vars/02_functions/namespaces/002.cf index c724ef6e52..7fef762390 100644 --- a/tests/acceptance/01_vars/02_functions/namespaces/002.cf +++ b/tests/acceptance/01_vars/02_functions/namespaces/002.cf @@ -1,18 +1,16 @@ # Check that getindices() works correctly within and across namespaces - # 002: getindices() with constant argument, from a non-default namespace to default namespace - body common control { - inputs => { "../../../default.sub.cf", "002_namespaced_getindices.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf", "002_namespaced_getindices.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "array[key]" string => "string"; + "array[key]" string => "string"; } bundle agent init @@ -23,11 +21,13 @@ bundle agent init bundle agent test { methods: - "test_in_namespace" usebundle => b:test_in_namespace("default:g.array", "b:variables.array2"); + "test_in_namespace" + usebundle => b:test_in_namespace("default:g.array", "b:variables.array2"); } bundle agent check { methods: - "check_in_namespace" usebundle => b:check_in_namespace("$(this.promise_filename)"); + "check_in_namespace" + usebundle => b:check_in_namespace("$(this.promise_filename)"); } diff --git a/tests/acceptance/01_vars/02_functions/namespaces/003.cf b/tests/acceptance/01_vars/02_functions/namespaces/003.cf index 96d39d037c..01d89574a8 100644 --- a/tests/acceptance/01_vars/02_functions/namespaces/003.cf +++ b/tests/acceptance/01_vars/02_functions/namespaces/003.cf @@ -1,18 +1,16 @@ # Check that getindices() works correctly within and across namespaces - # 003: getindices() with parameter variable argument, from non-default namespace to the same namespace - body common control { - inputs => { "../../../default.sub.cf", "003_namespaced_getindices.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf", "003_namespaced_getindices.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "array[key]" string => "string"; + "array[key]" string => "string"; } bundle agent init @@ -23,11 +21,13 @@ bundle agent init bundle agent test { methods: - "test_in_namespace" usebundle => b:test_in_namespace("default:g.array", "b:variables.array2"); + "test_in_namespace" + usebundle => b:test_in_namespace("default:g.array", "b:variables.array2"); } bundle agent check { methods: - "check_in_namespace" usebundle => b:check_in_namespace("$(this.promise_filename)"); + "check_in_namespace" + usebundle => b:check_in_namespace("$(this.promise_filename)"); } diff --git a/tests/acceptance/01_vars/02_functions/namespaces/004.cf b/tests/acceptance/01_vars/02_functions/namespaces/004.cf index bd7b27d054..51e84ab18c 100644 --- a/tests/acceptance/01_vars/02_functions/namespaces/004.cf +++ b/tests/acceptance/01_vars/02_functions/namespaces/004.cf @@ -1,18 +1,16 @@ # Check that getindices() works correctly within and across namespaces - # 004: getindices() with constant argument, from non-default namespace to the same namespace. - body common control { - inputs => { "../../../default.sub.cf", "004_namespaced_getindices.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf", "004_namespaced_getindices.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "array[key]" string => "string"; + "array[key]" string => "string"; } bundle agent init @@ -23,11 +21,13 @@ bundle agent init bundle agent test { methods: - "test_in_namespace" usebundle => b:test_in_namespace("default:g.array", "b:variables.array2"); + "test_in_namespace" + usebundle => b:test_in_namespace("default:g.array", "b:variables.array2"); } bundle agent check { methods: - "check_in_namespace" usebundle => b:check_in_namespace("$(this.promise_filename)"); + "check_in_namespace" + usebundle => b:check_in_namespace("$(this.promise_filename)"); } diff --git a/tests/acceptance/01_vars/02_functions/namespaces/005.cf b/tests/acceptance/01_vars/02_functions/namespaces/005.cf index bd743afdfd..7e4108c39a 100644 --- a/tests/acceptance/01_vars/02_functions/namespaces/005.cf +++ b/tests/acceptance/01_vars/02_functions/namespaces/005.cf @@ -1,18 +1,16 @@ # Check that getindices() works correctly within and across namespaces - # 004: getindices() with constant argument, from non-default namespace to the same namespace. - body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "array[key]" string => "string"; + "array[key]" string => "string"; } bundle agent init @@ -23,17 +21,23 @@ bundle agent init bundle agent test { methods: - "any" usebundle => test_default_namespace("g.array"); + "any" usebundle => test_default_namespace("g.array"); } bundle agent test_default_namespace(array_name) { vars: - "repo_ids5" slist => getindices("$(array_name)"); + "repo_ids5" slist => getindices("$(array_name)"); } bundle agent check { methods: - "check" usebundle => dcs_check_strcmp("$(test_default_namespace.repo_ids5)", "key", "$(this.promise_filename)", "no"); + "check" + usebundle => dcs_check_strcmp( + "$(test_default_namespace.repo_ids5)", + "key", + "$(this.promise_filename)", + "no" + ); } diff --git a/tests/acceptance/01_vars/02_functions/namespaces/006.cf b/tests/acceptance/01_vars/02_functions/namespaces/006.cf index 8c8ea7ad4b..34cc7bd5fe 100644 --- a/tests/acceptance/01_vars/02_functions/namespaces/006.cf +++ b/tests/acceptance/01_vars/02_functions/namespaces/006.cf @@ -1,18 +1,16 @@ # Check that getindices() works correctly within and across namespaces - # 004: getindices() with constant argument, from non-default namespace to the same namespace. - body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "array[key]" string => "string"; + "array[key]" string => "string"; } bundle agent init @@ -23,17 +21,23 @@ bundle agent init bundle agent test { methods: - "any" usebundle => test_default_namespace; + "any" usebundle => test_default_namespace; } bundle agent test_default_namespace { vars: - "repo_ids6" slist => getindices("g.array"); + "repo_ids6" slist => getindices("g.array"); } bundle agent check { methods: - "check" usebundle => dcs_check_strcmp("$(test_default_namespace.repo_ids6)", "key", "$(this.promise_filename)", "no"); + "check" + usebundle => dcs_check_strcmp( + "$(test_default_namespace.repo_ids6)", + "key", + "$(this.promise_filename)", + "no" + ); } diff --git a/tests/acceptance/01_vars/02_functions/namespaces/101.cf b/tests/acceptance/01_vars/02_functions/namespaces/101.cf index a1e9dbf7fc..f47bf0b5b7 100644 --- a/tests/acceptance/01_vars/02_functions/namespaces/101.cf +++ b/tests/acceptance/01_vars/02_functions/namespaces/101.cf @@ -1,19 +1,17 @@ # Check that getindices() works correctly within and across namespaces - # 101: getindices() with local variable in its argument, from a non-default namespace to the default namespace # same as 001.cf but without using a parameter - body common control { - inputs => { "../../../default.sub.cf", "101_namespaced_getindices.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf", "101_namespaced_getindices.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "array[key]" string => "string"; + "array[key]" string => "string"; } bundle agent init @@ -24,11 +22,12 @@ bundle agent init bundle agent test { methods: - "test_in_namespace" usebundle => b:test_in_namespace; + "test_in_namespace" usebundle => b:test_in_namespace; } bundle agent check { methods: - "check_in_namespace" usebundle => b:check_in_namespace("$(this.promise_filename)"); + "check_in_namespace" + usebundle => b:check_in_namespace("$(this.promise_filename)"); } diff --git a/tests/acceptance/01_vars/02_functions/namespaces/103.cf b/tests/acceptance/01_vars/02_functions/namespaces/103.cf index e686009c13..d396a25a06 100644 --- a/tests/acceptance/01_vars/02_functions/namespaces/103.cf +++ b/tests/acceptance/01_vars/02_functions/namespaces/103.cf @@ -1,19 +1,17 @@ # Check that getindices() works correctly within and across namespaces - # 103: getindices() with local variable argument, from non-default namespace to the same namespace # same as 003.cf but without using a parameter - body common control { - inputs => { "../../../default.sub.cf", "103_namespaced_getindices.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf", "103_namespaced_getindices.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "array[key]" string => "string"; + "array[key]" string => "string"; } bundle agent init @@ -24,11 +22,12 @@ bundle agent init bundle agent test { methods: - "test_in_namespace" usebundle => b:test_in_namespace; + "test_in_namespace" usebundle => b:test_in_namespace; } bundle agent check { methods: - "check_in_namespace" usebundle => b:check_in_namespace("$(this.promise_filename)"); + "check_in_namespace" + usebundle => b:check_in_namespace("$(this.promise_filename)"); } diff --git a/tests/acceptance/01_vars/02_functions/namespaces/201.cf b/tests/acceptance/01_vars/02_functions/namespaces/201.cf index ef571ba3e9..f2163e182c 100644 --- a/tests/acceptance/01_vars/02_functions/namespaces/201.cf +++ b/tests/acceptance/01_vars/02_functions/namespaces/201.cf @@ -1,18 +1,16 @@ # Check that getindices() works correctly within and across namespaces - # 201: getindices() with parameter variable in its argument, from a non-default namespace to the default namespace, but with getindices() inside braces. - body common control { - inputs => { "../../../default.sub.cf", "201_namespaced_getindices.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf", "201_namespaced_getindices.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "array[key]" string => "string"; + "array[key]" string => "string"; } bundle agent init @@ -23,11 +21,13 @@ bundle agent init bundle agent test { methods: - "test_in_namespace" usebundle => b:test_in_namespace("default:g.array", "b:variables.array2"); + "test_in_namespace" + usebundle => b:test_in_namespace("default:g.array", "b:variables.array2"); } bundle agent check { methods: - "check_in_namespace" usebundle => b:check_in_namespace("$(this.promise_filename)"); + "check_in_namespace" + usebundle => b:check_in_namespace("$(this.promise_filename)"); } diff --git a/tests/acceptance/01_vars/02_functions/namespaces/203.cf b/tests/acceptance/01_vars/02_functions/namespaces/203.cf index 6be474b918..ef418fbc0a 100644 --- a/tests/acceptance/01_vars/02_functions/namespaces/203.cf +++ b/tests/acceptance/01_vars/02_functions/namespaces/203.cf @@ -1,18 +1,16 @@ # Check that getindices() works correctly within and across namespaces - # 003: getindices() with parameter variable argument, from non-default namespace to the same namespace, but with getindices() inside braces. - body common control { - inputs => { "../../../default.sub.cf", "203_namespaced_getindices.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf", "203_namespaced_getindices.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "array[key]" string => "string"; + "array[key]" string => "string"; } bundle agent init @@ -23,11 +21,13 @@ bundle agent init bundle agent test { methods: - "test_in_namespace" usebundle => b:test_in_namespace("default:g.array", "b:variables.array2"); + "test_in_namespace" + usebundle => b:test_in_namespace("default:g.array", "b:variables.array2"); } bundle agent check { methods: - "check_in_namespace" usebundle => b:check_in_namespace("$(this.promise_filename)"); + "check_in_namespace" + usebundle => b:check_in_namespace("$(this.promise_filename)"); } diff --git a/tests/acceptance/01_vars/02_functions/network/008.cf b/tests/acceptance/01_vars/02_functions/network/008.cf index aec0b6fea6..85d3944e71 100644 --- a/tests/acceptance/01_vars/02_functions/network/008.cf +++ b/tests/acceptance/01_vars/02_functions/network/008.cf @@ -3,63 +3,57 @@ # Test host2ip() # ####################################################### - body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { - vars: - # Neither of these are likely to change... - "localhost" string => host2ip("localhost"); - "a" string => host2ip("a.root-servers.net"); + # Neither of these are likely to change... + "localhost" string => host2ip("localhost"); + "a" string => host2ip("a.root-servers.net"); } ####################################################### - bundle agent check { vars: - "localhost" string => "127.0.0.1"; - "localhost_6" string => "::1"; - "a" string => "198.41.0.4"; - "a_6" string => "2001:503:ba3e::2:30"; + "localhost" string => "127.0.0.1"; + "localhost_6" string => "::1"; + "a" string => "198.41.0.4"; + "a_6" string => "2001:503:ba3e::2:30"; classes: - "ok_a" or => { - strcmp("$(test.a)", "$(a)"), - strcmp("$(test.a)", "$(a_6)"), - }; - "ok_localhost" or => { - strcmp("$(test.localhost)", "$(localhost)"), - strcmp("$(test.localhost)", "$(localhost_6)"), - }; - "ok" and => { - "ok_a", - "ok_localhost", + "ok_a" or => { strcmp("$(test.a)", "$(a)"), strcmp("$(test.a)", "$(a_6)") }; + + "ok_localhost" + or => { + strcmp("$(test.localhost)", "$(localhost)"), + strcmp("$(test.localhost)", "$(localhost_6)"), }; + "ok" and => { "ok_a", "ok_localhost" }; + reports: DEBUG:: "Expected $(test.localhost) == $(localhost)"; "Expected $(test.a) == ( $(a) or $(a_6) )"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/network/selectservers.cf b/tests/acceptance/01_vars/02_functions/network/selectservers.cf index 91367888d3..1b1a04aa9b 100644 --- a/tests/acceptance/01_vars/02_functions/network/selectservers.cf +++ b/tests/acceptance/01_vars/02_functions/network/selectservers.cf @@ -1,17 +1,16 @@ # Test that failure to connect to remote host does not result in "Could not # close socket" error messages. - body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } body agent control { - # 5 seconds timeout for selectservers for non-connecting host 8.8.8.8 - default_timeout => "5"; + # 5 seconds timeout for selectservers for non-connecting host 8.8.8.8 + default_timeout => "5"; } bundle agent init @@ -21,28 +20,38 @@ bundle agent init bundle agent test { vars: - - # The first two hosts listen to port 80, the third does not listen - # to port 80, the fourth does not even resolve - "hosts" slist => { "cfengine.com", "www.duckduckgo.com", "smtp.mail.yahoo.com", "inexistent-server" }; - "retval" int => selectservers("@(hosts)","80","","","100","alive_servers"); + # The first two hosts listen to port 80, the third does not listen + # to port 80, the fourth does not even resolve + "hosts" + slist => { + "cfengine.com", + "www.duckduckgo.com", + "smtp.mail.yahoo.com", + "inexistent-server", + }; + + "retval" + int => selectservers("@(hosts)", "80", "", "", "100", "alive_servers"); } bundle agent check { classes: - "up2servers" expression => strcmp("$(test.retval)", "2"); - - "first_is_ok" expression => isvariable("test.alive_servers[0]"); - "second_is_ok" expression => isvariable("test.alive_servers[1]"); - "third_is_bad" not => isvariable("test.alive_servers[2]"); - "fourth_is_bad" not => isvariable("test.alive_servers[3]"); + "up2servers" expression => strcmp("$(test.retval)", "2"); + "first_is_ok" expression => isvariable("test.alive_servers[0]"); + "second_is_ok" expression => isvariable("test.alive_servers[1]"); + "third_is_bad" not => isvariable("test.alive_servers[2]"); + "fourth_is_bad" not => isvariable("test.alive_servers[3]"); methods: - # All above classes must be set for test to pass - "" usebundle => dcs_passif_expected("up2servers,first_is_ok,second_is_ok,third_is_bad,fourth_is_bad", - "", $(this.promise_filename)), - inherit => "true"; + # All above classes must be set for test to pass + "" + usebundle => dcs_passif_expected( + "up2servers,first_is_ok,second_is_ok,third_is_bad,fourth_is_bad", + "", + $(this.promise_filename) + ), + inherit => "true"; reports: DEBUG:: diff --git a/tests/acceptance/01_vars/02_functions/network/url_get.cf b/tests/acceptance/01_vars/02_functions/network/url_get.cf index dd8d1e5040..ddbdee67e8 100644 --- a/tests/acceptance/01_vars/02_functions/network/url_get.cf +++ b/tests/acceptance/01_vars/02_functions/network/url_get.cf @@ -3,20 +3,19 @@ # Test url_get() # ########################################################### - body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent init { vars: - "options_limit" data => ' + "options_limit" + data => ' { "url.max_content": 200, "nosuchoption": 100, @@ -24,43 +23,49 @@ bundle agent init "url.headers": [ "Foo: bar" ] }'; - "options_clean" data => '{}'; - "res1" data => url_get("http://acme.com", options_clean); - "res2" data => url_get("http://nosuchcfenginehost.com", options_clean); - # static content, we hope won't change much - "res3" data => url_get("http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js", options_limit); + "options_clean" data => '{}'; + "res1" data => url_get("http://acme.com", options_clean); + "res2" data => url_get("http://nosuchcfenginehost.com", options_clean); + + # static content, we hope won't change much + "res3" + data => url_get( + "http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js", + options_limit + ); } bundle agent test { meta: - "test_skip_unsupported" string => "!feature_curl"; + "test_skip_unsupported" string => "!feature_curl"; vars: - "kept" data => mergedata( - '{ "res1/returncode": init.res1[returncode] }', - '{ "res1/rc": init.res1[rc] }', - '{ "res1/success": init.res1[success] }', - - '{ "res2": init.res2[content] }', - '{ "res2/returncode": init.res2[returncode] }', - '{ "res2/rc": init.res2[rc] }', - '{ "res2/error_message": init.res2[error_message] }', - '{ "res2/success": init.res2[success] }', - - '{ "res3": init.res3[content] }', - '{ "res3/returncode": init.res3[returncode] }', - '{ "res3/rc": init.res3[rc] }', - '{ "res3/success": init.res3[success] }' + "kept" + data => mergedata( + '{ "res1/returncode": init.res1[returncode] }', + '{ "res1/rc": init.res1[rc] }', + '{ "res1/success": init.res1[success] }', + '{ "res2": init.res2[content] }', + '{ "res2/returncode": init.res2[returncode] }', + '{ "res2/rc": init.res2[rc] }', + '{ "res2/error_message": init.res2[error_message] }', + '{ "res2/success": init.res2[success] }', + '{ "res3": init.res3[content] }', + '{ "res3/returncode": init.res3[returncode] }', + '{ "res3/rc": init.res3[rc] }', + '{ "res3/success": init.res3[success] }' ); } ########################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/not.cf b/tests/acceptance/01_vars/02_functions/not.cf index aecbee6421..d84c55885e 100644 --- a/tests/acceptance/01_vars/02_functions/not.cf +++ b/tests/acceptance/01_vars/02_functions/not.cf @@ -5,13 +5,12 @@ ##################################################### body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: @@ -27,21 +26,17 @@ bundle agent test not("!any"), "cfengine", not("!cfengine"), - # Variable expansion: "$(true_variable)", not("$(false_variable)"), not(not("$(true_variable)")), not(not(not("$(false_variable)"))), - # Double expand: not(not("$($(true_variable_name))")), not(not(not("$($(false_variable_name))"))), - # Triple expand: not(not("$($($(true_variable_name_name)))")), not(not(not("$($($(false_variable_name_name)))"))), - # not() should always return any or !any, # this is important for backwards compatibility: strcmp(not("any"), "!any"), @@ -57,44 +52,29 @@ bundle agent test # This tests function/promise skipping because of unresolved variables, # but also that there is no syntax / type error, when the unresolved # function call stays in the and list forever (Never resolved). - "fail_one" - and => { - "any", - not("$(unresolved_var)"), - }; - "fail_two" - and => { - "any", - not(not("$(unresolved_var)")), - }; + "fail_one" and => { "any", not("$(unresolved_var)") }; + "fail_two" and => { "any", not(not("$(unresolved_var)")) }; + "fail" scope => "namespace", expression => "fail_one|fail_two"; vars: - "false_variable" - string => "cfengine.(!cfengine)"; - "true_variable" - string => "cfengine|(!cfengine)"; - "false_variable_name" - string => "false_variable"; - "true_variable_name" - string => "true_variable"; - "false_variable_name_name" - string => "false_variable_name"; - "true_variable_name_name" - string => "true_variable_name"; - + "false_variable" string => "cfengine.(!cfengine)"; + "true_variable" string => "cfengine|(!cfengine)"; + "false_variable_name" string => "false_variable"; + "true_variable_name" string => "true_variable"; + "false_variable_name_name" string => "false_variable_name"; + "true_variable_name_name" string => "true_variable_name"; } ####################################################### - bundle agent check { - reports: ok.(!fail):: "$(this.promise_filename) Pass"; + (!ok)|fail:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/nth.cf b/tests/acceptance/01_vars/02_functions/nth.cf index 79e26c932d..92ac21578c 100644 --- a/tests/acceptance/01_vars/02_functions/nth.cf +++ b/tests/acceptance/01_vars/02_functions/nth.cf @@ -3,46 +3,45 @@ # Test nth() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "results" slist => { - "starting list = 1", - "starting list = 2", - "starting list = 3", - "starting list = one", - "starting list = two", - "starting list = three", - "starting list = long string", - "starting list = four", - "starting list = fix", - "starting list = six", - "starting list = one", - "starting list = two", - "starting list = three", - "element #0 of the test list: 1", - "element #1 of the test list: 2", - "element #10 of the test list: one", - "element #11 of the test list: two", - "element #2 of the test list: 3", - "element #6 of the test list: long string", - "element #-1 of the test list: three", - "element #-13 of the test list: 1", - "element #-6 of the test list: four", + "results" + slist => { + "starting list = 1", + "starting list = 2", + "starting list = 3", + "starting list = one", + "starting list = two", + "starting list = three", + "starting list = long string", + "starting list = four", + "starting list = fix", + "starting list = six", + "starting list = one", + "starting list = two", + "starting list = three", + "element #0 of the test list: 1", + "element #1 of the test list: 2", + "element #10 of the test list: one", + "element #11 of the test list: two", + "element #2 of the test list: 3", + "element #6 of the test list: long string", + "element #-1 of the test list: three", + "element #-13 of the test list: 1", + "element #-6 of the test list: four", }; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_defaults => init_empty, edit_line => init_insert; @@ -50,36 +49,43 @@ bundle agent init body edit_defaults init_empty { - empty_file_before_editing => "true"; - edit_backup => "false"; + empty_file_before_editing => "true"; + edit_backup => "false"; } bundle edit_line init_insert { insert_lines: - "$(init.results)"; + "$(init.results)"; } ####################################################### - bundle agent test { vars: - "test" slist => { - 1,2,3, - "one", "two", "three", - "long string", - "four", "fix", "six", - "one", "two", "three", + "test" + slist => { + 1, + 2, + 3, + "one", + "two", + "three", + "long string", + "four", + "fix", + "six", + "one", + "two", + "three", }; - "nth" slist => { 1, 2, 6, 10, 11, 1000, "-1", "-13", "-6", "-1000" }; - - "test[$(nth)]" string => nth("test", $(nth)); - "test[0]" string => nth("test", 0); + "nth" slist => { 1, 2, 6, 10, 11, 1000, "-1", "-13", "-6", "-1000" }; + "test[$(nth)]" string => nth("test", $(nth)); + "test[0]" string => nth("test", 0); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -87,17 +93,19 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "starting list = $(test.test)"; - "element #$(test.nth) of the test list: $(test.test[$(test.nth)])"; - "element #0 of the test list: $(test.test[0])"; + "starting list = $(test.test)"; + "element #$(test.nth) of the test list: $(test.test[$(test.nth)])"; + "element #0 of the test list: $(test.test[0])"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/nth_datacontainer.cf b/tests/acceptance/01_vars/02_functions/nth_datacontainer.cf index 1d2c4c5f54..ea599ed3e9 100644 --- a/tests/acceptance/01_vars/02_functions/nth_datacontainer.cf +++ b/tests/acceptance/01_vars/02_functions/nth_datacontainer.cf @@ -3,60 +3,54 @@ # Test nth() with data container input # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" copy_from => local_cp("$(this.promise_filename).expected"); } ####################################################### - bundle common test_common { vars: - "data" data => readjson("$(this.promise_filename).json", "100k"); - "datastr" string => format("%S", data); + "data" data => readjson("$(this.promise_filename).json", "100k"); + "datastr" string => format("%S", data); + + "numbers" + ilist => { "-100", "-1", 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1000 }; + + "keys" slist => getindices(data); + "object_keys" slist => getindices("data[object]"); + "list_keys" slist => getindices("data[list]"); - "numbers" ilist => { "-100", "-1", 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1000 }; - "keys" slist => getindices(data); - "object_keys" slist => getindices("data[object]"); - "list_keys" slist => getindices("data[list]"); - "all_keys" slist => - { - @(object_keys), - @(list_keys), - "foo", "bar", "", - $(numbers), - $(keys) + "all_keys" + slist => { + @(object_keys), @(list_keys), "foo", "bar", "", $(numbers), $(keys) }; - "primitives[$(keys)]" string => nth(data, $(keys)); - "list[$(all_keys)]" string => nth("data[list]", $(all_keys)); - "object[$(all_keys)]" string => nth("data[object]", $(all_keys)); + "primitives[$(keys)]" string => nth(data, $(keys)); + "list[$(all_keys)]" string => nth("data[list]", $(all_keys)); + "object[$(all_keys)]" string => nth("data[object]", $(all_keys)); classes: - - "hasprimitive_$(keys)" expression => isvariable("primitives[$(keys)]"); - "haslist_$(all_keys)" expression => isvariable("list[$(all_keys)]"); - "hasobject_$(all_keys)" expression => isvariable("object[$(all_keys)]"); + "hasprimitive_$(keys)" expression => isvariable("primitives[$(keys)]"); + "haslist_$(all_keys)" expression => isvariable("list[$(all_keys)]"); + "hasobject_$(all_keys)" expression => isvariable("object[$(all_keys)]"); } bundle agent test { files: - - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -64,27 +58,27 @@ bundle agent test bundle edit_line test_insert { insert_lines: + "jsonstring = $(test_common.datastr)"; + "keys:json = $(test_common.keys)"; - "jsonstring = $(test_common.datastr)"; - "keys:json = $(test_common.keys)"; - - "primitive:json[$(test_common.keys)] = $(test_common.primitives[$(test_common.keys)])" + "primitive:json[$(test_common.keys)] = $(test_common.primitives[$(test_common.keys)])" if => "hasprimitive_$(test_common.keys)"; - "list:json[$(test_common.all_keys)] = $(test_common.list[$(test_common.all_keys)])" + "list:json[$(test_common.all_keys)] = $(test_common.list[$(test_common.all_keys)])" if => "haslist_$(test_common.all_keys)"; - "object:json[$(test_common.all_keys)] = $(test_common.object[$(test_common.all_keys)])" + "object:json[$(test_common.all_keys)] = $(test_common.object[$(test_common.all_keys)])" if => "hasobject_$(test_common.all_keys)"; - } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/nth_datacontainer.cf.json b/tests/acceptance/01_vars/02_functions/nth_datacontainer.cf.json index 483c0ad72a..b9ceba1a56 100644 --- a/tests/acceptance/01_vars/02_functions/nth_datacontainer.cf.json +++ b/tests/acceptance/01_vars/02_functions/nth_datacontainer.cf.json @@ -2,8 +2,8 @@ "boolean": true, "string": "Figaro. Figaro. Figaro, Figaro, Figaro... Figaro!", "integer": 20130111, - "list": [ "chris", "dituri", "was", "here" ], - "object": { "a": true, "b": [ 1, 2, 3 ], "c": "cat", "d": 108 }, + "list": ["chris", "dituri", "was", "here"], + "object": { "a": true, "b": [1, 2, 3], "c": "cat", "d": 108 }, "integer_2": 987654321, "string_2": "Othello? Where art thou now?", "boolean_2": false, diff --git a/tests/acceptance/01_vars/02_functions/on.cf b/tests/acceptance/01_vars/02_functions/on.cf index f491592de2..7a5e3121cb 100644 --- a/tests/acceptance/01_vars/02_functions/on.cf +++ b/tests/acceptance/01_vars/02_functions/on.cf @@ -3,34 +3,30 @@ # Test on(), especially integer out of bounds on some Unices # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "unix_timestamp" int => on(2014, 7 , 21 , 23 , 13 ,0); - + "unix_timestamp" int => on(2014, 7, 21, 23, 13, 0); } ####################################################### - bundle agent check { classes: - - "ok" expression => isvariable("test.unix_timestamp"); + "ok" expression => isvariable("test.unix_timestamp"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/or.cf b/tests/acceptance/01_vars/02_functions/or.cf index 2c50f4a291..4f0e84d9a0 100644 --- a/tests/acceptance/01_vars/02_functions/or.cf +++ b/tests/acceptance/01_vars/02_functions/or.cf @@ -5,13 +5,12 @@ ##################################################### body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: @@ -19,18 +18,19 @@ bundle agent test string => "Test that or() behaves as expected"; vars: - "f" # false + "f" + # false string => "(cfengine.(!cfengine))"; - "T" # true, uppercase to be more different visually + + "T" + # true, uppercase to be more different visually string => "(cfengine|(!cfengine))"; - "f_name" - string => "f"; - "T_name" - string => "T"; - "f_name_name" - string => "f_name"; - "T_name_name" - string => "T_name"; + + "f_name" string => "f"; + "T_name" string => "T"; + "f_name_name" string => "f_name"; + "T_name_name" string => "T_name"; + "many_true" slist => { "any", @@ -39,7 +39,8 @@ bundle agent test "(any.cfengine)", concat(not(or())), concat(not(or(or()))), - }; + }; + "many_false" slist => { "(!any)", @@ -49,11 +50,10 @@ bundle agent test concat(not("any")), concat(or()), }; - "many_both" - slist => { @(many_true), @(many_false) }; - classes: + "many_both" slist => { @(many_true), @(many_false) }; + classes: # All elements should be true, fail if one is false: "ok" scope => "namespace", @@ -61,15 +61,12 @@ bundle agent test # Sanity check: "any", "cfengine", - # or() with 0 arguments should default to false: not(or()), - # or() with 1 static string: or("any"), or("cfengine"), or("!(!cfengine)"), - # or() with 1 string with variable expansion(s): or("$(T)"), or("!$(f)"), @@ -81,7 +78,6 @@ bundle agent test or("!(!any)|$(f)"), or("$(T)|$(f)"), or("$(f)|$(T)"), - # or() with slist: # Careful, if there are expressions in list (using | operator) # they should be parenthesized for this to work: @@ -91,7 +87,6 @@ bundle agent test or(not(join(".", many_false))), or(not(join("|", many_false))), or(not(join(".", many_both))), - # or() with 1 function call as argument: or(or("any")), or(or("cfengine")), @@ -101,7 +96,6 @@ bundle agent test or(not(not("$(T)"))), or(strcmp("cfengine", "cfengine")), or(strcmp("any", not("$(f)"))), - # or() with 2 arguments: or("any", "cfengine"), or("any", "!any"), @@ -112,7 +106,6 @@ bundle agent test or("$(T)", "!$(f)"), or("$(T)", not("$(f)")), or(not("$(f)"), not("$(f)")), - # or() with 3+ arguments (strings): or("any", "any", "any"), or("any", "any", "any", "any"), @@ -142,17 +135,29 @@ bundle agent test or("$(f)", "$(f)", "$(f)", "$(T)", "$(T)", "$(T)"), or("$(f)", "$(f)", "$(T)", "$(T)", "$(T)", "$(T)"), or("$(f)", "$(T)", "$(T)", "$(T)", "$(T)", "$(T)"), - # or() with 3+ function calls: or(not("any"), not("any"), not("!any")), or(not("any"), not("any"), not("any"), not("!any")), or(not("any"), not("any"), not("any"), not("any"), not("!any")), - or(not("any"), not("any"), not("any"), not("any"), not("any"), not("!any")), + or( + not("any"), + not("any"), + not("any"), + not("any"), + not("any"), + not("!any") + ), or(not("$(T)"), not("$(T)"), not("$(f)")), or(not("$(T)"), not("$(T)"), not("$(T)"), not("$(f)")), or(not("$(T)"), not("$(T)"), not("$(T)"), not("$(T)"), not("$(f)")), - or(not("$(T)"), not("$(T)"), not("$(T)"), not("$(T)"), not("$(T)"), not("$(f)")), - + or( + not("$(T)"), + not("$(T)"), + not("$(T)"), + not("$(T)"), + not("$(T)"), + not("$(f)") + ), # or() with deep nesting: not(or(or())), not(or(or(or()))), @@ -161,7 +166,6 @@ bundle agent test not(or(or(or(or(or(or())))))), or(or(or(or(or(or("any")))))), or(or(or(or(or(or("any", "cfengine")))))), - # Double expansion: or("$($(T_name))"), or("$($(f_name))", "$($(T_name))"), @@ -169,15 +173,17 @@ bundle agent test or("!$($(T_name))", "!$($(f_name))"), or("!$($(T_name))", "!$($(T_name))", "!$($(f_name))"), or(not("$($(T_name))"), not("$($(f_name))")), - # Triple expansion: or("$($($(T_name_name)))"), or("$($($(f_name_name)))", "$($($(T_name_name)))"), - or("$($($(f_name_name)))", "$($($(f_name_name)))", "$($($(T_name_name)))"), + or( + "$($($(f_name_name)))", + "$($($(f_name_name)))", + "$($($(T_name_name)))" + ), or("!$($(T_name_name))", "!$($(f_name_name))"), or("!$($(T_name_name))", "!$($(T_name_name))", "!$($(f_name_name))"), or(not("$($(T_name_name))"), not("$($(f_name_name))")), - # or() should always return any or !any, # this is important for backwards compatibility: strcmp(or("any"), "any"), @@ -204,32 +210,26 @@ bundle agent test or("$(f)", "$(f)", "$(f)", "$(f)", "$(f)", "$(f)", "$(f)"), or("$(f)", "$(f)", "$(f)", "$(f)", "$(f)", "$(f)", "$(f)", "$(f)"), }; + # Should be skipped because of unresolved variable: - "fail_unresolved" - and => { - "any", - or("$(unresolved_var)"), - }; + "fail_unresolved" and => { "any", or("$(unresolved_var)") }; + # Check that it's really skipped because of unresolved, # and not that it accidentally becomes false: - "fail_not_of_unresolved" - and => { - "any", - or(not("$(unresolved_var)")), - }; + "fail_not_of_unresolved" and => { "any", or(not("$(unresolved_var)")) }; + "fail" scope => "namespace", expression => "fail_false|fail_unresolved|fail_not_of_unresolved"; } ####################################################### - bundle agent check { - reports: ok.(!fail):: "$(this.promise_filename) Pass"; + (!ok)|fail:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/packagesmatching.cf b/tests/acceptance/01_vars/02_functions/packagesmatching.cf index 773164b994..3caaba4b7d 100644 --- a/tests/acceptance/01_vars/02_functions/packagesmatching.cf +++ b/tests/acceptance/01_vars/02_functions/packagesmatching.cf @@ -3,128 +3,113 @@ # Test packagesmatching() and that the env prefix is stripped # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { packages: - "cfe-no-such-package" + "cfe-no-such-package" package_policy => "add", package_method => mock1; - "cfe-no-such-package" + "cfe-no-such-package" package_policy => "add", package_method => mock2; - # the parsing of env X="y z" fails - - # "cfe-no-such-package" - # package_policy => "add", - # package_method => mock3; - - "cfe-no-such-package" + # the parsing of env X="y z" fails + # "cfe-no-such-package" + # package_policy => "add", + # package_method => mock3; + "cfe-no-such-package" package_policy => "add", package_method => mock4; } body package_method mock1 { - package_changes => "individual"; - - package_list_command => "$(G.printf) 'bfoobar-1-besm6'"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-([\S]+)"; - - package_installed_regex => ".*"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; + package_changes => "individual"; + package_list_command => "$(G.printf) 'bfoobar-1-besm6'"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-([\S]+)"; + package_installed_regex => ".*"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; } body package_method mock2 { - package_changes => "individual"; - - package_list_command => "/usr/bin/env $(G.printf) 'bfoobar-1-besm6'"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-([\S]+)"; - - package_installed_regex => ".*"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; + package_changes => "individual"; + package_list_command => "/usr/bin/env $(G.printf) 'bfoobar-1-besm6'"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-([\S]+)"; + package_installed_regex => ".*"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; } body package_method mock3 { - package_changes => "individual"; - - package_list_command => '/usr/bin/env X="y z" $(G.printf) "bfoobar-1-besm6"'; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-([\S]+)"; - - package_installed_regex => ".*"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; + package_changes => "individual"; + package_list_command => '/usr/bin/env X="y z" $(G.printf) "bfoobar-1-besm6"'; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-([\S]+)"; + package_installed_regex => ".*"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; } body package_method mock4 { - package_changes => "individual"; - - package_list_command => "/usr/bin/env X=Y $(G.printf) 'bfoobar-1-besm6'"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-([\S]+)"; - - package_installed_regex => ".*"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; + package_changes => "individual"; + package_list_command => "/usr/bin/env X=Y $(G.printf) 'bfoobar-1-besm6'"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-([\S]+)"; + package_installed_regex => ".*"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; } ####################################################### - bundle agent test { meta: - "test_suppress_fail" string => "windows", - meta => { "redmine4741", "ENT-10422" }; + "test_suppress_fail" + string => "windows", + meta => { "redmine4741", "ENT-10422" }; vars: - "all_packages" data => packagesmatching(".*", ".*", ".*", ".*"); - "all_string" string => format("packages = %S", all_packages); + "all_packages" data => packagesmatching(".*", ".*", ".*", ".*"); + "all_string" string => format("packages = %S", all_packages); } ####################################################### - bundle agent check { vars: - "e" string => '{"arch":"besm6","method":"printf","name":"bfoobar","version":"1"}'; + "e" + string => '{"arch":"besm6","method":"printf","name":"bfoobar","version":"1"}'; + methods: - "" usebundle => dcs_check_strcmp($(test.all_string), - 'packages = [$(e)]', - $(this.promise_filename), - "no"); + "" + usebundle => dcs_check_strcmp( + $(test.all_string), 'packages = [$(e)]', $(this.promise_filename), "no" + ); } diff --git a/tests/acceptance/01_vars/02_functions/parsearray_maxlen.cf b/tests/acceptance/01_vars/02_functions/parsearray_maxlen.cf index aa9994dc8c..69bf9a0ec4 100644 --- a/tests/acceptance/01_vars/02_functions/parsearray_maxlen.cf +++ b/tests/acceptance/01_vars/02_functions/parsearray_maxlen.cf @@ -1,28 +1,33 @@ # Test the parse\w+array(idx)? functions honour their maxlen parameter. body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { vars: - "float" string => " + "float" + string => " 1.0 4.0 2.0 1.0 3.0 1e1 # 36 bytes up to 1e1 4.0 2.0 5.0 16.0 6.0 3.0"; - "whole" string => " + + "whole" + string => " 1 4 2 1 3 10 # 30 bytes up to 10 4 2 5 16 6 3"; - "words" string => " + + "words" + string => " one four two one three ten # 37 bytes up to ten @@ -34,38 +39,56 @@ six three"; bundle agent test { vars: - "flen" int => parserealarray("float", "$(init.float)", "\s*#[^\n]*", "\s+", 1000, 36); - "ilen" int => parseintarray("whole", "$(init.whole)", "\s*#[^\n]*", "\s+", 1000, 30); - "slen" int => parsestringarray("words", "$(init.words)", "\s*#[^\n]*", "\s+", 1000, 37); - "tlen" int => parsestringarrayidx("texts", "$(init.words)", "\s*#[^\n]*", "\s+", 1000, 37); + "flen" + int => parserealarray( + "float", "$(init.float)", "\s*#[^\n]*", "\s+", 1000, 36 + ); + + "ilen" + int => parseintarray( + "whole", "$(init.whole)", "\s*#[^\n]*", "\s+", 1000, 30 + ); + + "slen" + int => parsestringarray( + "words", "$(init.words)", "\s*#[^\n]*", "\s+", 1000, 37 + ); + + "tlen" + int => parsestringarrayidx( + "texts", "$(init.words)", "\s*#[^\n]*", "\s+", 1000, 37 + ); } bundle agent check { vars: - "arrays" slist => { "float", "whole", "words", "texts" }; + "arrays" slist => { "float", "whole", "words", "texts" }; + "key_$(arrays)" slist => getindices("test.$(arrays)"); - "key_$(arrays)" slist => getindices("test.$(arrays)"); - "sub_$(key_$(arrays))" slist => getindices("test.$(arrays)[$(key_$(arrays))]"); + "sub_$(key_$(arrays))" + slist => getindices("test.$(arrays)[$(key_$(arrays))]"); classes: - "okf" expression => strcmp("$(test.flen)", "3"); - "oki" expression => strcmp("$(test.ilen)", "3"); - "oks" expression => strcmp("$(test.slen)", "3"); - "okt" expression => strcmp("$(test.tlen)", "3"); - - "ok" and => { "okf", "oki", "oks", "okt" }; + "okf" expression => strcmp("$(test.flen)", "3"); + "oki" expression => strcmp("$(test.ilen)", "3"); + "oks" expression => strcmp("$(test.slen)", "3"); + "okt" expression => strcmp("$(test.tlen)", "3"); + "ok" and => { "okf", "oki", "oks", "okt" }; reports: DEBUG.!okf:: "float: '$(test.flen)'"; "float[$(key_float)][$(sub_$(key_float))] = $(test.float[$(key_float)][$(sub_$(key_float))])"; + DEBUG.!oki:: "whole: '$(test.ilen)'"; "whole[$(key_whole)][$(sub_$(key_whole))] = $(test.whole[$(key_whole)][$(sub_$(key_whole))])"; + DEBUG.!oks:: "words: '$(test.slen)'"; "words[$(key_words)][$(sub_$(key_words))] = $(test.words[$(key_words)][$(sub_$(key_words))])"; + DEBUG.!okt:: "texts: '$(test.tlen)'"; "texts[$(key_texts)][$(sub_$(key_texts))] = $(test.texts[$(key_texts)][$(sub_$(key_texts))])"; @@ -73,6 +96,7 @@ bundle agent check reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/parsestringarray_dontread_comment_duplicate_lastline2.cf b/tests/acceptance/01_vars/02_functions/parsestringarray_dontread_comment_duplicate_lastline2.cf index 9beb8f8a29..643b67106b 100644 --- a/tests/acceptance/01_vars/02_functions/parsestringarray_dontread_comment_duplicate_lastline2.cf +++ b/tests/acceptance/01_vars/02_functions/parsestringarray_dontread_comment_duplicate_lastline2.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,97 +36,86 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarrayidx("ary", "$(G.testfile)","NoComment",":",6,1000); - "num" int => "6"; + "cnt" + int => readstringarrayidx( + "ary", "$(G.testfile)", "NoComment", ":", 6, 1000 + ); + + "num" int => "6"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "bad" or => { - isvariable("test.ary[6][0]"), - isvariable("test.ary[6][1]"), - - isvariable("test.ary[7][0]"), - isvariable("test.ary[7][1]"), - - isvariable("test.ary[8][0]"), - isvariable("test.ary[8][1]"), + "bad" + or => { + isvariable("test.ary[6][0]"), + isvariable("test.ary[6][1]"), + isvariable("test.ary[7][0]"), + isvariable("test.ary[7][1]"), + isvariable("test.ary[8][0]"), + isvariable("test.ary[8][1]"), }; - "ok" and => { - "!bad", - - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[2][0])", "here is"), - strcmp("$(test.ary[2][1])", "a line"), - strcmp("$(test.ary[2][2])", " with spaces "), - strcmp("$(test.ary[2][3])", " in it"), - - strcmp("$(test.ary[3][0])", "blank"), - strcmp("$(test.ary[3][1])", "fields"), - strcmp("$(test.ary[3][2])", ""), - strcmp("$(test.ary[3][3])", ""), - strcmp("$(test.ary[3][4])", "in here"), - strcmp("$(test.ary[3][5])", ""), - strcmp("$(test.ary[3][6])", ""), - - strcmp("$(test.ary[4][0])", ""), - strcmp("$(test.ary[4][1])", "leading blank field"), - - strcmp("$(test.ary[5][0])", "this"), - strcmp("$(test.ary[5][1])", "is"), - strcmp("$(test.ary[5][2])", "a"), - strcmp("$(test.ary[5][3])", "test"), + "ok" + and => { + "!bad", + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[2][0])", "here is"), + strcmp("$(test.ary[2][1])", "a line"), + strcmp("$(test.ary[2][2])", " with spaces "), + strcmp("$(test.ary[2][3])", " in it"), + strcmp("$(test.ary[3][0])", "blank"), + strcmp("$(test.ary[3][1])", "fields"), + strcmp("$(test.ary[3][2])", ""), + strcmp("$(test.ary[3][3])", ""), + strcmp("$(test.ary[3][4])", "in here"), + strcmp("$(test.ary[3][5])", ""), + strcmp("$(test.ary[3][6])", ""), + strcmp("$(test.ary[4][0])", ""), + strcmp("$(test.ary[4][1])", "leading blank field"), + strcmp("$(test.ary[5][0])", "this"), + strcmp("$(test.ary[5][1])", "is"), + strcmp("$(test.ary[5][2])", "a"), + strcmp("$(test.ary[5][3])", "test"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[2][0] = 'here is', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = 'a line', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = ' with spaces ', saw '$(test.ary[2][2])'"; "expected test.ary[2][3] = ' in it', saw '$(test.ary[2][3])'"; - "expected test.ary[3][0] = 'blank', saw '$(test.ary[3][0])'"; "expected test.ary[3][1] = 'fields', saw '$(test.ary[3][1])'"; "expected test.ary[3][2] = '', saw '$(test.ary[3][2])'"; @@ -137,10 +123,8 @@ bundle agent check "expected test.ary[3][4] = 'in here', saw '$(test.ary[3][4])'"; "expected test.ary[3][5] = '', saw '$(test.ary[3][5])'"; "expected test.ary[3][6] = '', saw '$(test.ary[3][6])'"; - "expected test.ary[4][0] = '', saw '$(test.ary[4][0])'"; "expected test.ary[4][1] = 'leading blank field', saw '$(test.ary[4][1])'"; - "expected test.ary[5][0] = 'this', saw '$(test.ary[5][0])'"; "expected test.ary[5][1] = 'is', saw '$(test.ary[5][1])'"; "expected test.ary[5][2] = 'a', saw '$(test.ary[5][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/parsestringarray_weird_indices_real_comments_noemptyfields2.cf b/tests/acceptance/01_vars/02_functions/parsestringarray_weird_indices_real_comments_noemptyfields2.cf index 8a30d7de7d..801e3f09c2 100644 --- a/tests/acceptance/01_vars/02_functions/parsestringarray_weird_indices_real_comments_noemptyfields2.cf +++ b/tests/acceptance/01_vars/02_functions/parsestringarray_weird_indices_real_comments_noemptyfields2.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,70 +36,57 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarray("ary", "$(teststr)","^#.*",":+",10,14); - "num" int => "3"; + "teststr" string => readfile("$(G.testfile)", 1000); + "cnt" int => parsestringarray("ary", "$(teststr)", "^#.*", ":+", 10, 14); + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "bad" or => { - isvariable("test.ary[he][1]"), - isvariable("test.ary[blank][0]"), - }; - - "ok" and => { - "!bad", - - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[he][0])", "he"), + "bad" + or => { isvariable("test.ary[he][1]"), isvariable("test.ary[blank][0]") }; + + "ok" + and => { + "!bad", + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[he][0])", "he"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "saw 'bad'-class things"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[he][0] = 'he', saw '$(test.ary[he][0])'"; ok:: diff --git a/tests/acceptance/01_vars/02_functions/parseyaml_with_unquoted_values_starting_with_digits.cf b/tests/acceptance/01_vars/02_functions/parseyaml_with_unquoted_values_starting_with_digits.cf index 8c352e0c3b..114dda8c52 100644 --- a/tests/acceptance/01_vars/02_functions/parseyaml_with_unquoted_values_starting_with_digits.cf +++ b/tests/acceptance/01_vars/02_functions/parseyaml_with_unquoted_values_starting_with_digits.cf @@ -1,31 +1,34 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent test { - meta: - "description" -> { "CFE-2033" } - string => "Make sure parsing YAML values starting with numbers works"; + meta: + "description" -> { "CFE-2033" } + string => "Make sure parsing YAML values starting with numbers works"; - vars: - "class" string => "1003_efl_test"; - "d" data => parseyaml( "- class: ${class}" ); + vars: + "class" string => "1003_efl_test"; + "d" data => parseyaml("- class: ${class}"); - classes: - "PASS" expression => strcmp( ${d[0][class]}, "${class}" ); - "FAIL" not => strcmp( ${d[0][class]}, "${class}" ); + classes: + "PASS" expression => strcmp(${d[0][class]}, "${class}"); + "FAIL" not => strcmp(${d[0][class]}, "${class}"); - reports: - PASS:: - "$(this.promise_filename) Pass"; - FAIL:: - "$(this.promise_filename) FAIL"; - PASS.FAIL:: - "$(this.promise_filename) EXCEPTION"; - DEBUG:: - "version => ${sys.cf_version}"; - "class => ${d[0][class]}"; + reports: + PASS:: + "$(this.promise_filename) Pass"; + + FAIL:: + "$(this.promise_filename) FAIL"; + + PASS.FAIL:: + "$(this.promise_filename) EXCEPTION"; + + DEBUG:: + "version => ${sys.cf_version}"; + "class => ${d[0][class]}"; } diff --git a/tests/acceptance/01_vars/02_functions/peers.cf b/tests/acceptance/01_vars/02_functions/peers.cf index 5a8cf7a377..5b87f0b1cb 100644 --- a/tests/acceptance/01_vars/02_functions/peers.cf +++ b/tests/acceptance/01_vars/02_functions/peers.cf @@ -3,51 +3,46 @@ # Test peers() # Ref:Redmine:4848 (https://cfengine.com/dev/issues/4848) ####################################################### - ### TODO this test is failing, because for example the variable ### default:this.test#actual_peers_nohosts_2 ### is never VariableTablePut ### regex:VariableTablePut\([^)]*actual_peers_nohosts_2 ### ### TODO figure out why actual_peers_nohosts_2 is never Put() - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### bundle agent init { methods: - "nohosts" - usebundle => file_empty("$(G.testfile).nohosts"), - comment => "Test the behavior when there are no entries in the file."; - - "nopeers" - usebundle => file_mustache_jsonstring - ( - "$(this.promise_filename).mustache", - '{ "peers": [ "a", "b", "c" ] }', - "$(G.testfile).nopeers" - ), - comment => "Test the behaviour when there are no peers (some hosts, but - when the executing host is not found in the list)"; + "nohosts" + usebundle => file_empty("$(G.testfile).nohosts"), + comment => "Test the behavior when there are no entries in the file."; - "somepeers" - usebundle => file_mustache_jsonstring - ( - "$(this.promise_filename).mustache", - '{ "peers": [ "a", "b", "c", "$(sys.fqhost)" ] }', - "$(G.testfile).somepeers" - ), - comment => "Test the behaviour when there are some peers."; + "nopeers" + usebundle => file_mustache_jsonstring( + "$(this.promise_filename).mustache", + '{ "peers": [ "a", "b", "c" ] }', + "$(G.testfile).nopeers" + ), + comment => "Test the behaviour when there are no peers (some hosts, but + when the executing host is not found in the list)"; + "somepeers" + usebundle => file_mustache_jsonstring( + "$(this.promise_filename).mustache", + '{ "peers": [ "a", "b", "c", "$(sys.fqhost)" ] }', + "$(G.testfile).somepeers" + ), + comment => "Test the behaviour when there are some peers."; - "allpeers" usebundle => file_mustache_jsonstring - ( + "allpeers" + usebundle => file_mustache_jsonstring( "$(this.promise_filename).mustache", '{ "peers": [ "$(sys.fqhost)", "$(sys.fqhost)", "$(sys.fqhost)", "$(sys.fqhost)" ] }', "$(G.testfile).allpeers" @@ -57,121 +52,173 @@ bundle agent init bundle agent test { vars: - "tests" slist => { "nohosts", "nopeers", "somepeers", "allpeers" }; - "subtests" ilist => { "0", "1", "2", "3", "4", "5" }; - - "peers_$(tests)_$(subtests)" slist => peers("$(G.testfile).$(tests)", "#.*", $(subtests)); - "peerleaders_$(tests)_$(subtests)" slist => peerleaders("$(G.testfile).$(tests)", "#.*", $(subtests)); - "actual_peers_$(tests)_$(subtests)" string => format("%S", "peers_$(tests)_$(subtests)"); - "actual_peerleaders_$(tests)_$(subtests)" string => format("%S", "peerleaders_$(tests)_$(subtests)"); - "actual_peerleader_$(tests)_$(subtests)" string => peerleader("$(G.testfile).$(tests)", "#.*", $(subtests)); + "tests" slist => { "nohosts", "nopeers", "somepeers", "allpeers" }; + "subtests" ilist => { "0", "1", "2", "3", "4", "5" }; + + "peers_$(tests)_$(subtests)" + slist => peers("$(G.testfile).$(tests)", "#.*", $(subtests)); + + "peerleaders_$(tests)_$(subtests)" + slist => peerleaders("$(G.testfile).$(tests)", "#.*", $(subtests)); + + "actual_peers_$(tests)_$(subtests)" + string => format("%S", "peers_$(tests)_$(subtests)"); + + "actual_peerleaders_$(tests)_$(subtests)" + string => format("%S", "peerleaders_$(tests)_$(subtests)"); + + "actual_peerleader_$(tests)_$(subtests)" + string => peerleader("$(G.testfile).$(tests)", "#.*", $(subtests)); } ####################################################### - bundle agent check { vars: - "f" slist => { "peers", "peerleader", "peerleaders" }; - "tests" slist => { @(test.tests) }; - "subtests" ilist => { @(test.subtests) }; - - "good_cases" slist => - { - "peers_nohosts_2", "peers_nohosts_3", "peers_nohosts_4", "peers_nohosts_5", - "peers_nopeers_2", "peers_nopeers_3", "peers_nopeers_4", "peers_nopeers_5", - "peers_somepeers_2", "peers_somepeers_3", "peers_somepeers_4", "peers_somepeers_5", - "peers_allpeers_2", "peers_allpeers_3", "peers_allpeers_4", "peers_allpeers_5", - "peers_somepeers_2", "peers_somepeers_4", "peers_somepeers_5", - - "peerleader_somepeers_2", "peerleader_somepeers_3", "peerleader_somepeers_4", "peerleader_somepeers_5", - "peerleader_allpeers_2", "peerleader_allpeers_3", "peerleader_allpeers_4", "peerleader_allpeers_5", - - "peerleaders_nohosts_2", "peerleaders_nohosts_3", "peerleaders_nohosts_4", "peerleaders_nohosts_5", - "peerleaders_nopeers_2", "peerleaders_nopeers_3", "peerleaders_nopeers_4", "peerleaders_nopeers_5", - "peerleaders_somepeers_2", "peerleaders_somepeers_3", "peerleaders_somepeers_4", "peerleaders_somepeers_5", - "peerleaders_allpeers_2", "peerleaders_allpeers_3", "peerleaders_allpeers_4", "peerleaders_allpeers_5", + "f" slist => { "peers", "peerleader", "peerleaders" }; + "tests" slist => { @(test.tests) }; + "subtests" ilist => { @(test.subtests) }; + + "good_cases" + slist => { + "peers_nohosts_2", + "peers_nohosts_3", + "peers_nohosts_4", + "peers_nohosts_5", + "peers_nopeers_2", + "peers_nopeers_3", + "peers_nopeers_4", + "peers_nopeers_5", + "peers_somepeers_2", + "peers_somepeers_3", + "peers_somepeers_4", + "peers_somepeers_5", + "peers_allpeers_2", + "peers_allpeers_3", + "peers_allpeers_4", + "peers_allpeers_5", + "peers_somepeers_2", + "peers_somepeers_4", + "peers_somepeers_5", + "peerleader_somepeers_2", + "peerleader_somepeers_3", + "peerleader_somepeers_4", + "peerleader_somepeers_5", + "peerleader_allpeers_2", + "peerleader_allpeers_3", + "peerleader_allpeers_4", + "peerleader_allpeers_5", + "peerleaders_nohosts_2", + "peerleaders_nohosts_3", + "peerleaders_nohosts_4", + "peerleaders_nohosts_5", + "peerleaders_nopeers_2", + "peerleaders_nopeers_3", + "peerleaders_nopeers_4", + "peerleaders_nopeers_5", + "peerleaders_somepeers_2", + "peerleaders_somepeers_3", + "peerleaders_somepeers_4", + "peerleaders_somepeers_5", + "peerleaders_allpeers_2", + "peerleaders_allpeers_3", + "peerleaders_allpeers_4", + "peerleaders_allpeers_5", }; - "bad_cases" slist => - { - "peers_nohosts_0", "peers_nohosts_1", - "peers_nopeers_0", "peers_nopeers_1", - "peers_somepeers_0", "peers_somepeers_1", - "peers_allpeers_0", "peers_allpeers_1", - - "peerleader_nohosts_0", "peerleader_nohosts_1", "peerleader_nohosts_2", "peerleader_nohosts_3", "peerleader_nohosts_4", "peerleader_nohosts_5", - "peerleader_nopeers_0", "peerleader_nopeers_1", "peerleader_nopeers_2", "peerleader_nopeers_3", "peerleader_nopeers_4", "peerleader_nopeers_5", - "peerleader_somepeers_0", "peerleader_somepeers_1", - "peerleader_allpeers_0", "peerleader_allpeers_1", - - "peerleaders_nohosts_0", "peerleaders_nohosts_1", - "peerleaders_nopeers_0", "peerleaders_nopeers_1", - "peerleaders_somepeers_0", "peerleaders_somepeers_1", - "peerleaders_allpeers_0", "peerleaders_allpeers_1", + "bad_cases" + slist => { + "peers_nohosts_0", + "peers_nohosts_1", + "peers_nopeers_0", + "peers_nopeers_1", + "peers_somepeers_0", + "peers_somepeers_1", + "peers_allpeers_0", + "peers_allpeers_1", + "peerleader_nohosts_0", + "peerleader_nohosts_1", + "peerleader_nohosts_2", + "peerleader_nohosts_3", + "peerleader_nohosts_4", + "peerleader_nohosts_5", + "peerleader_nopeers_0", + "peerleader_nopeers_1", + "peerleader_nopeers_2", + "peerleader_nopeers_3", + "peerleader_nopeers_4", + "peerleader_nopeers_5", + "peerleader_somepeers_0", + "peerleader_somepeers_1", + "peerleader_allpeers_0", + "peerleader_allpeers_1", + "peerleaders_nohosts_0", + "peerleaders_nohosts_1", + "peerleaders_nopeers_0", + "peerleaders_nopeers_1", + "peerleaders_somepeers_0", + "peerleaders_somepeers_1", + "peerleaders_allpeers_0", + "peerleaders_allpeers_1", }; - "expected_peers_allpeers_$(subtests)" string => '{ }'; - "expected_peers_nopeers_$(subtests)" string => '{ }'; - "expected_peers_nohosts_$(subtests)" string => '{ }'; - "expected_peers_allpeers_$(subtests)" string => '{ }'; - "expected_peers_nopeers_$(subtests)" string => '{ }'; - "expected_peers_nohosts_$(subtests)" string => '{ }'; - "expected_peers_somepeers_2" string => '{ "c" }'; - "expected_peers_somepeers_3" string => '{ }'; - "expected_peers_somepeers_4" string => '{ "a", "b", "c" }'; - "expected_peers_somepeers_5" string => '{ "a", "b", "c" }'; - - "expected_peerleader_allpeers_$(subtests)" string => 'localhost'; - "expected_peerleader_somepeers_2" string => 'c'; - "expected_peerleader_somepeers_3" string => 'localhost'; - "expected_peerleader_somepeers_4" string => 'a'; - "expected_peerleader_somepeers_5" string => 'a'; - - "expected_peerleaders_nohosts_$(subtests)" string => '{ }'; - - "expected_peerleaders_nopeers_2" string => '{ "a", "c" }'; - "expected_peerleaders_nopeers_3" string => '{ "a" }'; - "expected_peerleaders_nopeers_4" string => '{ "a" }'; - "expected_peerleaders_nopeers_5" string => '{ "a" }'; - - "expected_peerleaders_somepeers_2" string => '{ "a", "c" }'; - "expected_peerleaders_somepeers_3" string => '{ "a", "localhost" }'; - "expected_peerleaders_somepeers_4" string => '{ "a" }'; - "expected_peerleaders_somepeers_5" string => '{ "a" }'; - - "expected_peerleaders_allpeers_2" string => '{ "localhost", "localhost" }'; - "expected_peerleaders_allpeers_3" string => '{ "localhost", "localhost" }'; - "expected_peerleaders_allpeers_4" string => '{ "localhost" }'; - "expected_peerleaders_allpeers_5" string => '{ "localhost" }'; - - "c[$(f)_$(tests)_$(subtests)]" string => "ok_$(f)_$(tests)_$(subtests)"; - "cases" slist => getvalues(c); - "cs" string => join(",", cases); + "expected_peers_allpeers_$(subtests)" string => '{ }'; + "expected_peers_nopeers_$(subtests)" string => '{ }'; + "expected_peers_nohosts_$(subtests)" string => '{ }'; + "expected_peers_allpeers_$(subtests)" string => '{ }'; + "expected_peers_nopeers_$(subtests)" string => '{ }'; + "expected_peers_nohosts_$(subtests)" string => '{ }'; + "expected_peers_somepeers_2" string => '{ "c" }'; + "expected_peers_somepeers_3" string => '{ }'; + "expected_peers_somepeers_4" string => '{ "a", "b", "c" }'; + "expected_peers_somepeers_5" string => '{ "a", "b", "c" }'; + "expected_peerleader_allpeers_$(subtests)" string => 'localhost'; + "expected_peerleader_somepeers_2" string => 'c'; + "expected_peerleader_somepeers_3" string => 'localhost'; + "expected_peerleader_somepeers_4" string => 'a'; + "expected_peerleader_somepeers_5" string => 'a'; + "expected_peerleaders_nohosts_$(subtests)" string => '{ }'; + "expected_peerleaders_nopeers_2" string => '{ "a", "c" }'; + "expected_peerleaders_nopeers_3" string => '{ "a" }'; + "expected_peerleaders_nopeers_4" string => '{ "a" }'; + "expected_peerleaders_nopeers_5" string => '{ "a" }'; + "expected_peerleaders_somepeers_2" string => '{ "a", "c" }'; + "expected_peerleaders_somepeers_3" string => '{ "a", "localhost" }'; + "expected_peerleaders_somepeers_4" string => '{ "a" }'; + "expected_peerleaders_somepeers_5" string => '{ "a" }'; + "expected_peerleaders_allpeers_2" string => '{ "localhost", "localhost" }'; + "expected_peerleaders_allpeers_3" string => '{ "localhost", "localhost" }'; + "expected_peerleaders_allpeers_4" string => '{ "localhost" }'; + "expected_peerleaders_allpeers_5" string => '{ "localhost" }'; + "c[$(f)_$(tests)_$(subtests)]" string => "ok_$(f)_$(tests)_$(subtests)"; + "cases" slist => getvalues(c); + "cs" string => join(",", cases); classes: - "ok_$(bad_cases)" not => isvariable("test.actual_$(bad_cases)"); - "ok_$(good_cases)" expression => strcmp("$(expected_$(good_cases))", - "$(test.actual_$(good_cases))"); + "ok_$(bad_cases)" not => isvariable("test.actual_$(bad_cases)"); + + "ok_$(good_cases)" + expression => strcmp( + "$(expected_$(good_cases))", "$(test.actual_$(good_cases))" + ); methods: - "" usebundle => dcs_passif_expected($(cs), "", $(this.promise_filename)), + "" + usebundle => dcs_passif_expected($(cs), "", $(this.promise_filename)), inherit => "true"; reports: EXTRA:: "$(good_cases): as expected, '$(expected_$(good_cases))'" - if => "ok_$(good_cases)"; - - "$(bad_cases): as expected, no variable" - if => "ok_$(bad_cases)"; + if => "ok_$(good_cases)"; - #"test.actual_$(good_cases) = '$(test.actual_$(good_cases))'"; + "$(bad_cases): as expected, no variable" if => "ok_$(bad_cases)"; + #"test.actual_$(good_cases) = '$(test.actual_$(good_cases))'"; DEBUG:: "$(good_cases): NOT as expected, '$(expected_$(good_cases))' != '$(test.actual_$(good_cases))'" - if => "!ok_$(good_cases)"; + if => "!ok_$(good_cases)"; "$(bad_cases): NOT as expected, has variable '$(test.actual_$(bad_cases))'" - if => "!ok_$(bad_cases)"; + if => "!ok_$(bad_cases)"; } diff --git a/tests/acceptance/01_vars/02_functions/randomint.cf b/tests/acceptance/01_vars/02_functions/randomint.cf index 9e5d5fa2de..d17905b0d4 100644 --- a/tests/acceptance/01_vars/02_functions/randomint.cf +++ b/tests/acceptance/01_vars/02_functions/randomint.cf @@ -3,41 +3,40 @@ # Test randomint() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "nine_a" int => randomint(9,10); - "nine_b" int => randomint(9,9); - "nine_c" int => randomint(10,9); + "nine_a" int => randomint(9, 10); + "nine_b" int => randomint(9, 9); + "nine_c" int => randomint(10, 9); } ####################################################### - bundle agent check { classes: - "ok_a" expression => strcmp("$(test.nine_a)", "9"); - "ok_b" expression => strcmp("$(test.nine_b)", "9"); - "ok_c" expression => strcmp("$(test.nine_c)", "9"); - "ok" and => {ok_a, ok_b, ok_c}; + "ok_a" expression => strcmp("$(test.nine_a)", "9"); + "ok_b" expression => strcmp("$(test.nine_b)", "9"); + "ok_c" expression => strcmp("$(test.nine_c)", "9"); + "ok" and => { ok_a, ok_b, ok_c }; reports: DEBUG:: "nine_a: $(test.nine_a)"; "nine_b: $(test.nine_b)"; "nine_c: $(test.nine_c)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/read-file-endless-loop.cf b/tests/acceptance/01_vars/02_functions/read-file-endless-loop.cf index fd7967eefd..1cfaa98e16 100644 --- a/tests/acceptance/01_vars/02_functions/read-file-endless-loop.cf +++ b/tests/acceptance/01_vars/02_functions/read-file-endless-loop.cf @@ -1,10 +1,9 @@ # Test that regline, getfields and countlinesmatching do not loop endlessly if # supplied with a directory (Redmine #2453) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle common init @@ -14,15 +13,15 @@ bundle common init bundle agent test { classes: - "foo" expression => regline("foo", "/"); + "foo" expression => regline("foo", "/"); vars: - "bar" int => getfields(".*", "/", ":", "foo"); - "baz" int => countlinesmatching(".*", "/"); + "bar" int => getfields(".*", "/", ":", "foo"); + "baz" int => countlinesmatching(".*", "/"); } bundle agent check { reports: - "$(this.promise_filename) Pass"; + "$(this.promise_filename) Pass"; } diff --git a/tests/acceptance/01_vars/02_functions/read_empty_file.cf b/tests/acceptance/01_vars/02_functions/read_empty_file.cf index 13e439e1a8..1ce7d0bb4c 100644 --- a/tests/acceptance/01_vars/02_functions/read_empty_file.cf +++ b/tests/acceptance/01_vars/02_functions/read_empty_file.cf @@ -1,47 +1,49 @@ # Test that empty file is successfully read by readfile() function - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } bundle agent test { vars: - "value1" string => readfile("$(G.testfile)", 10000); - "value2" string => readfile("$(G.testfile)", 0); + "value1" string => readfile("$(G.testfile)", 10000); + "value2" string => readfile("$(G.testfile)", 0); } bundle agent check { classes: - "ok1" expression => strcmp("$(test.value1)", ""); - "ok2" expression => strcmp("$(test.value2)", ""); - "not_ok1" not => strcmp("$(test.value1)", ""); - "not_ok2" not => strcmp("$(test.value2)", ""); - "ok" and => { "ok1", "ok2" }; + "ok1" expression => strcmp("$(test.value1)", ""); + "ok2" expression => strcmp("$(test.value2)", ""); + "not_ok1" not => strcmp("$(test.value1)", ""); + "not_ok2" not => strcmp("$(test.value2)", ""); + "ok" and => { "ok1", "ok2" }; reports: DEBUG.ok1:: "passed1: '$(test.value1)' == ''"; + DEBUG.ok2:: "passed2: '$(test.value1)' == ''"; + DEBUG.not_ok1:: "failed1: '$(test.value1)' != ''"; + DEBUG.not_ok2:: "failed2: '$(test.value2)' != ''"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/read_long_file.cf b/tests/acceptance/01_vars/02_functions/read_long_file.cf index 157c7e0d7c..c947b3e653 100644 --- a/tests/acceptance/01_vars/02_functions/read_long_file.cf +++ b/tests/acceptance/01_vars/02_functions/read_long_file.cf @@ -1,10 +1,9 @@ # Test that long file is successfully read by readstringlist() function - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -14,31 +13,39 @@ bundle agent init bundle agent test { vars: - "value" slist => readstringlist("$(this.promise_filename).txt", "", "\n", 100000, 1000000); + "value" + slist => readstringlist( + "$(this.promise_filename).txt", "", "\n", 100000, 1000000 + ); } bundle agent check { vars: - "length" int => length("test.value"); - "last" string => nth("test.value", 599); + "length" int => length("test.value"); + "last" string => nth("test.value", 599); + classes: - "ok1" expression => strcmp("$(length)", "600"); - "ok2" expression => strcmp("$(last)", "line600"); - "ok" and => { "ok1", "ok2" }; + "ok1" expression => strcmp("$(length)", "600"); + "ok2" expression => strcmp("$(last)", "line600"); + "ok" and => { "ok1", "ok2" }; reports: DEBUG.ok1:: "passed1"; + DEBUG.ok2:: "passed2"; + DEBUG.!ok1:: "failed1 $(length) != 600"; + DEBUG.!ok2:: "failed2 $(last) != line600"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/read_sys_file.cf b/tests/acceptance/01_vars/02_functions/read_sys_file.cf index bbab52d44e..b15e1b7154 100644 --- a/tests/acceptance/01_vars/02_functions/read_sys_file.cf +++ b/tests/acceptance/01_vars/02_functions/read_sys_file.cf @@ -1,10 +1,9 @@ # Redmine#1032: Test that /sys and /proc files with 0 length are successfully read by readfile() function - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -14,54 +13,64 @@ bundle agent init bundle agent test { classes: - "have_sys" expression => fileexists("/sys/kernel/vmcoreinfo"); - "have_proc0" expression => fileexists("/proc/meminfo"); - "have_proc1" expression => fileexists("/proc/kallsyms"); + "have_sys" expression => fileexists("/sys/kernel/vmcoreinfo"); + "have_proc0" expression => fileexists("/proc/meminfo"); + "have_proc1" expression => fileexists("/proc/kallsyms"); vars: have_sys:: "sys_info" string => readfile("/sys/kernel/vmcoreinfo", 0); + !have_sys:: "sys_info" string => "42"; have_proc0:: "proc0_info" string => readfile("/proc/meminfo", 0); + !have_proc0:: "proc0_info" string => "42"; have_proc1:: "proc1_info" string => readfile("/proc/kallsyms", 0); + !have_proc1:: "proc1_info" string => "42"; - } bundle agent check { classes: - "ok_proc0" expression => regcmp(".*\d+.*", $(test.proc0_info)); - "ok_proc1" expression => regcmp(".*\d+.*", $(test.proc1_info)); - "not_ok_proc0" not => regcmp(".*\d+.*", $(test.proc0_info)); - "not_ok_proc1" not => regcmp(".*\d+.*", $(test.proc1_info)); - "ok_sys" expression => regcmp(".*\d+.*", $(test.sys_info)); - "not_ok_sys" not => regcmp(".*\d+.*", $(test.sys_info)); - - "ok" not => classmatch("not_ok_.+"); + "ok_proc0" expression => regcmp(".*\d+.*", $(test.proc0_info)); + "ok_proc1" expression => regcmp(".*\d+.*", $(test.proc1_info)); + "not_ok_proc0" not => regcmp(".*\d+.*", $(test.proc0_info)); + "not_ok_proc1" not => regcmp(".*\d+.*", $(test.proc1_info)); + "ok_sys" expression => regcmp(".*\d+.*", $(test.sys_info)); + "not_ok_sys" not => regcmp(".*\d+.*", $(test.sys_info)); + "ok" not => classmatch("not_ok_.+"); reports: DEBUG:: "/proc0 test OK" if => "ok_proc0"; "/proc1 test OK" if => "ok_proc1"; "/sys test OK" if => "ok_sys"; - "/proc0 test NOT OK: data '$(test.proc0_info)' did not contain digits" if => "not_ok_proc0"; - "/proc1 test NOT OK: data '$(test.proc1_info)' did not contain digits" if => "not_ok_proc1"; - "/sys test NOT OK: data '$(test.sys_info)' did not contain digits" if => "not_ok_sys"; + + "/proc0 test NOT OK: data '$(test.proc0_info)' did not contain digits" + if => "not_ok_proc0"; + + "/proc1 test NOT OK: data '$(test.proc1_info)' did not contain digits" + if => "not_ok_proc1"; + + "/sys test NOT OK: data '$(test.sys_info)' did not contain digits" + if => "not_ok_sys"; + DEBUG.inform_mode:: "/proc0 test got data '$(test.proc0_info)'"; "/proc1 test got data '$(test.proc1_info)'"; "/sys test got data '$(test.sys_info)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/readcsv.cf b/tests/acceptance/01_vars/02_functions/readcsv.cf index 54751df2a9..f4c9116ab5 100644 --- a/tests/acceptance/01_vars/02_functions/readcsv.cf +++ b/tests/acceptance/01_vars/02_functions/readcsv.cf @@ -1,27 +1,27 @@ # test readcsv() - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { vars: - "c" data => readcsv("$(this.promise_filename).csv"); - "cs" string => format("%S", c); + "c" data => readcsv("$(this.promise_filename).csv"); + "cs" string => format("%S", c); } bundle agent check { vars: - "expected" string => '[["emptydata","99","xyz","/default/default/methods/\'any\'[0]","p","[]","[]","default","ny","default.sub.cf"],["emptydata","99","def","/default/default/methods/\'any\'/default/test_run/methods/\'any\'[0]","q","[]","[]","default","ny","default.sub.cf"],["emptydata","99","abc","/default/default/methods/\'any\'/default/test_run/methods/\'any\'[0]","r","[]","[]","default","ny","default.sub.cf"],["emptydata","99","pqr","/default/default/methods/\'any\'/default/test_run/methods/\'any\'[0]","s","[]","[]","default","ny","default.sub.cf"],["emptydata","110","???","[\\"Proposed executable file \'/TEST.cfengine.willfail\' doesn\'t exist\\",\\"\'/TEST.cfengine.willfail\' promises to be executable but isn\'t\\"]","default"]]'; + "expected" + string => '[["emptydata","99","xyz","/default/default/methods/\'any\'[0]","p","[]","[]","default","ny","default.sub.cf"],["emptydata","99","def","/default/default/methods/\'any\'/default/test_run/methods/\'any\'[0]","q","[]","[]","default","ny","default.sub.cf"],["emptydata","99","abc","/default/default/methods/\'any\'/default/test_run/methods/\'any\'[0]","r","[]","[]","default","ny","default.sub.cf"],["emptydata","99","pqr","/default/default/methods/\'any\'/default/test_run/methods/\'any\'[0]","s","[]","[]","default","ny","default.sub.cf"],["emptydata","110","???","[\\"Proposed executable file \'/TEST.cfengine.willfail\' doesn\'t exist\\",\\"\'/TEST.cfengine.willfail\' promises to be executable but isn\'t\\"]","default"]]'; methods: - "check" usebundle => dcs_check_strcmp("$(test.cs)", - $(expected), - "$(this.promise_filename)", - "no"); + "check" + usebundle => dcs_check_strcmp( + "$(test.cs)", $(expected), "$(this.promise_filename)", "no" + ); } diff --git a/tests/acceptance/01_vars/02_functions/readdata.cf b/tests/acceptance/01_vars/02_functions/readdata.cf index 113f2d2a5d..2febdcd312 100644 --- a/tests/acceptance/01_vars/02_functions/readdata.cf +++ b/tests/acceptance/01_vars/02_functions/readdata.cf @@ -3,47 +3,51 @@ # Test readdata() with YAML # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10252" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10252" }; vars: - "explicit_csv" data => readdata("$(this.promise_filename).csv", "CSV"); - "explicit_env" data => readdata("$(this.promise_filename).env", "ENV"); - "explicit_json" data => readdata("$(this.promise_filename).json", "JSON"); + "explicit_csv" data => readdata("$(this.promise_filename).csv", "CSV"); + "explicit_env" data => readdata("$(this.promise_filename).env", "ENV"); + "explicit_json" data => readdata("$(this.promise_filename).json", "JSON"); + "extension_csv" data => readdata("$(this.promise_filename).csv", "auto"); + "extension_env" data => readdata("$(this.promise_filename).env", "auto"); + "extension_json" data => readdata("$(this.promise_filename).json", "auto"); + "guess_csv" data => readdata("$(this.promise_filename).csv.guess", "auto"); - "extension_csv" data => readdata("$(this.promise_filename).csv", "auto"); - "extension_env" data => readdata("$(this.promise_filename).env", "auto"); - "extension_json" data => readdata("$(this.promise_filename).json", "auto"); + # should be empty (JSON is attempted) + "guess_json" + data => readdata("$(this.promise_filename).json.guess", "auto"); - "guess_csv" data => readdata("$(this.promise_filename).csv.guess", "auto"); # should be empty (JSON is attempted) - "guess_json" data => readdata("$(this.promise_filename).json.guess", "auto"); + "failed_explicit_csv" data => readdata($(this.promise_filename), "CSV"); - "failed_explicit_csv" data => readdata($(this.promise_filename), "CSV"); - "failed_explicit_env" data => readdata("$(this.promise_filename).csv", "ENV"); - "failed_explicit_json" data => readdata($(this.promise_filename), "JSON"); + "failed_explicit_env" + data => readdata("$(this.promise_filename).csv", "ENV"); - "failed_guess" data => readdata($(this.promise_filename), "auto"); + "failed_explicit_json" data => readdata($(this.promise_filename), "JSON"); + "failed_guess" data => readdata($(this.promise_filename), "auto"); } ########################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/readdata.cf.json b/tests/acceptance/01_vars/02_functions/readdata.cf.json index 94e8e1fa87..8a2b03b046 100644 --- a/tests/acceptance/01_vars/02_functions/readdata.cf.json +++ b/tests/acceptance/01_vars/02_functions/readdata.cf.json @@ -1,5 +1,5 @@ { - "x": [ 1, 2, 3 ], - "y": "more data here", - "z": { "300": 400 } + "x": [1, 2, 3], + "y": "more data here", + "z": { "300": 400 } } diff --git a/tests/acceptance/01_vars/02_functions/readdata_yaml.cf b/tests/acceptance/01_vars/02_functions/readdata_yaml.cf index eb13c850ec..345110cd15 100644 --- a/tests/acceptance/01_vars/02_functions/readdata_yaml.cf +++ b/tests/acceptance/01_vars/02_functions/readdata_yaml.cf @@ -3,41 +3,44 @@ # Test readdata() with YAML # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent test { vars: feature_yaml:: "explicit_yaml" data => readdata("$(this.promise_filename).yaml", "YAML"); - "extension_yaml" data => readdata("$(this.promise_filename).yaml", "auto"); + "extension_yaml" + data => readdata("$(this.promise_filename).yaml", "auto"); "extension_yml" data => readdata("$(this.promise_filename).yml", "auto"); - "guess_yaml" data => readdata("$(this.promise_filename).yaml.guess", "auto"); # should be empty (JSON is attempted) + "guess_yaml" + data => readdata("$(this.promise_filename).yaml.guess", "auto"); + # should be empty (JSON is attempted) "failed_explicit_yaml" data => readdata($(this.promise_filename), "YAML"); } ########################################################### - bundle agent check { methods: feature_yaml:: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); - !feature_yaml:: - "check" usebundle => dcs_pass($(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); + !feature_yaml:: + "check" usebundle => dcs_pass($(this.promise_filename)); } diff --git a/tests/acceptance/01_vars/02_functions/readfile.cf b/tests/acceptance/01_vars/02_functions/readfile.cf index 648c315c1e..d993b7e070 100644 --- a/tests/acceptance/01_vars/02_functions/readfile.cf +++ b/tests/acceptance/01_vars/02_functions/readfile.cf @@ -1,10 +1,9 @@ # test readfile() - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -14,54 +13,59 @@ bundle agent init bundle agent test { vars: - "sizes" ilist => { "0", "1", "4094", "4095", "4096", "4097", "99999999" }; - "read_$(sizes)" string => readfile("$(this.promise_filename).txt", - $(sizes)); - "length_$(sizes)" int => string_length("$(read_$(sizes))"); + "sizes" ilist => { "0", "1", "4094", "4095", "4096", "4097", "99999999" }; + + "read_$(sizes)" + string => readfile("$(this.promise_filename).txt", $(sizes)); - "read_no_size" string => readfile("$(this.promise_filename).txt"); - "length_no_size" int => string_length("$(read_no_size)"); + "length_$(sizes)" int => string_length("$(read_$(sizes))"); + "read_no_size" string => readfile("$(this.promise_filename).txt"); + "length_no_size" int => string_length("$(read_no_size)"); } bundle agent check { vars: - "sizes" ilist => { @(test.sizes) }; - "expected[0]" int => "10240"; - "expected[1]" int => "1"; - "expected[4094]" int => "4094"; - "expected[4095]" int => "4095"; - "expected[4096]" int => "4096"; - "expected[4097]" int => "4097"; - "expected[99999999]" int => "10240"; - "expected_no_size" int => "10240"; + "sizes" ilist => { @(test.sizes) }; + "expected[0]" int => "10240"; + "expected[1]" int => "1"; + "expected[4094]" int => "4094"; + "expected[4095]" int => "4095"; + "expected[4096]" int => "4096"; + "expected[4097]" int => "4097"; + "expected[99999999]" int => "10240"; + "expected_no_size" int => "10240"; classes: - "ok_$(sizes)" expression => strcmp("$(test.length_$(sizes))", - "$(expected[$(sizes)])"); - "ok_no_size" expression => strcmp("$(test.length_no_size)", - "$(expected_no_size)"); + "ok_$(sizes)" + expression => strcmp("$(test.length_$(sizes))", "$(expected[$(sizes)])"); + + "ok_no_size" + expression => strcmp("$(test.length_no_size)", "$(expected_no_size)"); - "ok" and => { - "ok_0", - "ok_1", - "ok_4094", - "ok_4095", - "ok_4096", - "ok_4097", - "ok_99999999", - "ok_no_size", + "ok" + and => { + "ok_0", + "ok_1", + "ok_4094", + "ok_4095", + "ok_4096", + "ok_4097", + "ok_99999999", + "ok_no_size", }; reports: DEBUG:: "Got expected size for read of $(sizes): $(test.length_$(sizes))" - if => "ok_$(sizes)"; + if => "ok_$(sizes)"; + "Did NOT get expected size for read of $(sizes): $(test.length_$(sizes)) != expected $(expected[$(sizes)])" - if => "!ok_$(sizes)"; + if => "!ok_$(sizes)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/readfile_absent_does_not_error_in_pre_eval.cf b/tests/acceptance/01_vars/02_functions/readfile_absent_does_not_error_in_pre_eval.cf index df4081fea6..4ffb4a0787 100644 --- a/tests/acceptance/01_vars/02_functions/readfile_absent_does_not_error_in_pre_eval.cf +++ b/tests/acceptance/01_vars/02_functions/readfile_absent_does_not_error_in_pre_eval.cf @@ -1,38 +1,35 @@ body common control { - - # If you want to see this work on 3.6.x comment out - # inputs and bundlesequence, and inline the following - # bundles from dcs.sub.cf - # - dcs_passif_output - # - dcs_passif_expected - # - dcs_passif - - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; -# bundlesequence => { "test", "check" }; - version => "1.0"; + # If you want to see this work on 3.6.x comment out + # inputs and bundlesequence, and inline the following + # bundles from dcs.sub.cf + # - dcs_passif_output + # - dcs_passif_expected + # - dcs_passif + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + + # bundlesequence => { "test", "check" }; + version => "1.0"; } ########################################################### - bundle agent test { meta: - "description" string => "Test that readfile() does not throw an error during pre-eval if the file does not exist."; - } ########################################################### - bundle agent check { - methods: - "check" - usebundle => dcs_passif_output(".*Hello World.*", ".*failed to read file.*", - "$(sys.cf_agent) -Kf $(this.promise_filename).sub", $(this.promise_filename)); - + "check" + usebundle => dcs_passif_output( + ".*Hello World.*", + ".*failed to read file.*", + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/readstringarray_dontread_comment_duplicatekey_lastline.cf b/tests/acceptance/01_vars/02_functions/readstringarray_dontread_comment_duplicatekey_lastline.cf index 9b37fc2d3b..f9339fc69e 100644 --- a/tests/acceptance/01_vars/02_functions/readstringarray_dontread_comment_duplicatekey_lastline.cf +++ b/tests/acceptance/01_vars/02_functions/readstringarray_dontread_comment_duplicatekey_lastline.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,84 +36,73 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarray("ary", "$(G.testfile)","NoComment",":",6,1000); - "num" int => "6"; + "cnt" + int => readstringarray("ary", "$(G.testfile)", "NoComment", ":", 6, 1000); + + "num" int => "6"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[here is][0])", "here is"), - strcmp("$(test.ary[here is][1])", "a line"), - strcmp("$(test.ary[here is][2])", " with spaces "), - strcmp("$(test.ary[here is][3])", " in it"), - - strcmp("$(test.ary[blank][0])", "blank"), - strcmp("$(test.ary[blank][1])", "fields"), - strcmp("$(test.ary[blank][2])", ""), - strcmp("$(test.ary[blank][3])", ""), - strcmp("$(test.ary[blank][4])", "in here"), - strcmp("$(test.ary[blank][5])", ""), - strcmp("$(test.ary[blank][6])", ""), - - strcmp("$(test.ary[][0])", ""), - strcmp("$(test.ary[][1])", "leading blank field"), - - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "is"), - strcmp("$(test.ary[this][2])", "a"), - strcmp("$(test.ary[this][3])", "test"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[here is][0])", "here is"), + strcmp("$(test.ary[here is][1])", "a line"), + strcmp("$(test.ary[here is][2])", " with spaces "), + strcmp("$(test.ary[here is][3])", " in it"), + strcmp("$(test.ary[blank][0])", "blank"), + strcmp("$(test.ary[blank][1])", "fields"), + strcmp("$(test.ary[blank][2])", ""), + strcmp("$(test.ary[blank][3])", ""), + strcmp("$(test.ary[blank][4])", "in here"), + strcmp("$(test.ary[blank][5])", ""), + strcmp("$(test.ary[blank][6])", ""), + strcmp("$(test.ary[][0])", ""), + strcmp("$(test.ary[][1])", "leading blank field"), + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "is"), + strcmp("$(test.ary[this][2])", "a"), + strcmp("$(test.ary[this][3])", "test"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[here is][0] = 'here is', saw '$(test.ary[here is][0])'"; "expected test.ary[here is][1] = 'a line', saw '$(test.ary[here is][1])'"; "expected test.ary[here is][2] = ' with spaces ', saw '$(test.ary[here is][2])'"; "expected test.ary[here is][3] = ' in it', saw '$(test.ary[here is][3])'"; - "expected test.ary[blank][0] = 'blank', saw '$(test.ary[blank][0])'"; "expected test.ary[blank][1] = 'fields', saw '$(test.ary[blank][1])'"; "expected test.ary[blank][2] = '', saw '$(test.ary[blank][2])'"; @@ -124,15 +110,12 @@ bundle agent check "expected test.ary[blank][4] = 'in here', saw '$(test.ary[blank][4])'"; "expected test.ary[blank][5] = '', saw '$(test.ary[blank][5])'"; "expected test.ary[blank][6] = '', saw '$(test.ary[blank][6])'"; - "expected test.ary[][0] = '', saw '$(test.ary[][0])'"; "expected test.ary[][1] = 'leading blank field', saw '$(test.ary[][1])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'is', saw '$(test.ary[this][1])'"; "expected test.ary[this][2] = 'a', saw '$(test.ary[this][2])'"; "expected test.ary[this][3] = 'test', saw '$(test.ary[this][3])'"; - "expected test.ary[# A duplicate follows][0] = '# A duplicate follows', saw '$(test.ary[# A duplicate follows][0])'"; "expected test.ary[# A duplicate follows][1] = 'this line is not always a comment', saw '$(test.ary[# A duplicate follows][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/readstringarrayidx.cf b/tests/acceptance/01_vars/02_functions/readstringarrayidx.cf index 04d3221b42..374d66d986 100644 --- a/tests/acceptance/01_vars/02_functions/readstringarrayidx.cf +++ b/tests/acceptance/01_vars/02_functions/readstringarrayidx.cf @@ -1,10 +1,9 @@ # Redmine#2926: test long lines with readstringarrayidx() - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -14,13 +13,12 @@ bundle agent init bundle agent test { vars: - "dim" int => readstringarrayidx("parms", - "$(this.promise_filename).txt", - "\s*#[^\n]*", - ";", - 9999, - 99999); - "pk" slist => getindices("parms"); + "dim" + int => readstringarrayidx( + "parms", "$(this.promise_filename).txt", "\s*#[^\n]*", ";", 9999, 99999 + ); + + "pk" slist => getindices("parms"); reports: DEBUG:: @@ -30,30 +28,37 @@ bundle agent test bundle agent check { vars: - "length" int => length("test.pk"); - "last" string => nth("test.value", 599); + "length" int => length("test.pk"); + "last" string => nth("test.value", 599); + classes: - "ok1" expression => strcmp("$(test.dim)", "3"); - "ok2" expression => strcmp("$(test.dim)", "$(length)"); - "ok3" expression => strcmp("$(test.parms[2][0])", "not_working_app_config"); - "ok" and => { "ok1", "ok2", "ok3" }; + "ok1" expression => strcmp("$(test.dim)", "3"); + "ok2" expression => strcmp("$(test.dim)", "$(length)"); + "ok3" expression => strcmp("$(test.parms[2][0])", "not_working_app_config"); + "ok" and => { "ok1", "ok2", "ok3" }; reports: DEBUG.ok1:: "passed1"; + DEBUG.ok2:: "passed2"; + DEBUG.ok3:: "passed3"; + DEBUG.!ok1:: "failed1 $(test.dim) != 3"; + DEBUG.!ok2:: "failed2 $(test.dim) != $(length)"; + DEBUG.!ok3:: "failed3 $(test.parms[2][0]) != not_working_app_config"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/readstringarrayidx_order.cf b/tests/acceptance/01_vars/02_functions/readstringarrayidx_order.cf index 36ddda66a6..3d8236815e 100644 --- a/tests/acceptance/01_vars/02_functions/readstringarrayidx_order.cf +++ b/tests/acceptance/01_vars/02_functions/readstringarrayidx_order.cf @@ -6,108 +6,110 @@ # Based on an initial test by Neil Watson. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - # Note: order is deliberately one unlikely to happen - # automatically; and there are duplicates. - "file" slist => { "1 ;; other field 1", - "2 ;; other field 2", - "4 ;; other field 4", - "8 ;; other field 8", - "16 ;; other field 16", - "2 ;; other field 2", - "3 ;; other field 3", - "6 ;; other field 6", - "12 ;; other field 12", - "9 ;; other field 9", - "18 ;; other field 18", - "3 ;; other field 3", - "5 ;; other field 5", - "10 ;; other field 10", - "15 ;; other field 15", - "5 ;; other field 5", - "7 ;; other field 7", - "14 ;; other field 14", - "7 ;; other field 7", - "0 ;; other field 0" }; + # Note: order is deliberately one unlikely to happen + # automatically; and there are duplicates. + "file" + slist => { + "1 ;; other field 1", + "2 ;; other field 2", + "4 ;; other field 4", + "8 ;; other field 8", + "16 ;; other field 16", + "2 ;; other field 2", + "3 ;; other field 3", + "6 ;; other field 6", + "12 ;; other field 12", + "9 ;; other field 9", + "18 ;; other field 18", + "3 ;; other field 3", + "5 ;; other field 5", + "10 ;; other field 10", + "15 ;; other field 15", + "5 ;; other field 5", + "7 ;; other field 7", + "14 ;; other field 14", + "7 ;; other field 7", + "0 ;; other field 0", + }; files: - "$(G.testfile).orig.txt" - create => 'true', - edit_defaults => empty, - edit_line => insert_all_lines( "@{file}" ); + "$(G.testfile).orig.txt" + create => 'true', + edit_defaults => empty, + edit_line => insert_all_lines("@{file}"); } ####################################################### # Insert lines, preserving duplicates: - bundle edit_line insert_all_lines(lines) { vars: - "whole" string => join(" + "whole" string => join(" ", "lines"); insert_lines: - "$(whole)" - insert_type => "preserve_block"; + "$(whole)" insert_type => "preserve_block"; } ####################################################### - bundle agent test { vars: - "num" int => readstringarrayidx("mylines", - "$(G.testfile).orig.txt", - "\s*#[^\n]*", - "\s*;;\s*", - 50, 9999); + "num" + int => readstringarrayidx( + "mylines", "$(G.testfile).orig.txt", "\s*#[^\n]*", "\s*;;\s*", 50, 9999 + ); - "file" slist => { "${mylines[0][0]} ;; ${mylines[0][1]}", - "${mylines[1][0]} ;; ${mylines[1][1]}", - "${mylines[2][0]} ;; ${mylines[2][1]}", - "${mylines[3][0]} ;; ${mylines[3][1]}", - "${mylines[4][0]} ;; ${mylines[4][1]}", - "${mylines[5][0]} ;; ${mylines[5][1]}", - "${mylines[6][0]} ;; ${mylines[6][1]}", - "${mylines[7][0]} ;; ${mylines[7][1]}", - "${mylines[8][0]} ;; ${mylines[8][1]}", - "${mylines[9][0]} ;; ${mylines[9][1]}", - "${mylines[10][0]} ;; ${mylines[10][1]}", - "${mylines[11][0]} ;; ${mylines[11][1]}", - "${mylines[12][0]} ;; ${mylines[12][1]}", - "${mylines[13][0]} ;; ${mylines[13][1]}", - "${mylines[14][0]} ;; ${mylines[14][1]}", - "${mylines[15][0]} ;; ${mylines[15][1]}", - "${mylines[16][0]} ;; ${mylines[16][1]}", - "${mylines[17][0]} ;; ${mylines[17][1]}", - "${mylines[18][0]} ;; ${mylines[18][1]}", - "${mylines[19][0]} ;; ${mylines[19][1]}" }; + "file" + slist => { + "${mylines[0][0]} ;; ${mylines[0][1]}", + "${mylines[1][0]} ;; ${mylines[1][1]}", + "${mylines[2][0]} ;; ${mylines[2][1]}", + "${mylines[3][0]} ;; ${mylines[3][1]}", + "${mylines[4][0]} ;; ${mylines[4][1]}", + "${mylines[5][0]} ;; ${mylines[5][1]}", + "${mylines[6][0]} ;; ${mylines[6][1]}", + "${mylines[7][0]} ;; ${mylines[7][1]}", + "${mylines[8][0]} ;; ${mylines[8][1]}", + "${mylines[9][0]} ;; ${mylines[9][1]}", + "${mylines[10][0]} ;; ${mylines[10][1]}", + "${mylines[11][0]} ;; ${mylines[11][1]}", + "${mylines[12][0]} ;; ${mylines[12][1]}", + "${mylines[13][0]} ;; ${mylines[13][1]}", + "${mylines[14][0]} ;; ${mylines[14][1]}", + "${mylines[15][0]} ;; ${mylines[15][1]}", + "${mylines[16][0]} ;; ${mylines[16][1]}", + "${mylines[17][0]} ;; ${mylines[17][1]}", + "${mylines[18][0]} ;; ${mylines[18][1]}", + "${mylines[19][0]} ;; ${mylines[19][1]}", + }; files: - "$(G.testfile).copy.txt" - create => 'true', - edit_defaults => empty, - edit_line => insert_all_lines( "@{file}" ); + "$(G.testfile).copy.txt" + create => 'true', + edit_defaults => empty, + edit_line => insert_all_lines("@{file}"); } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).copy.txt", - "$(G.testfile).orig.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).copy.txt", + "$(G.testfile).orig.txt", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/readstringlist-many-comments.cf b/tests/acceptance/01_vars/02_functions/readstringlist-many-comments.cf index 49d5c4f770..10e24bc8af 100755 --- a/tests/acceptance/01_vars/02_functions/readstringlist-many-comments.cf +++ b/tests/acceptance/01_vars/02_functions/readstringlist-many-comments.cf @@ -1,35 +1,50 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "descripton" -> { "ENT-5042" } - string => "Test that readstringlist correctly ignores many comment lines"; - # https://regex101.com/r/OZUgku/1/ + "descripton" -> { "ENT-5042" } + string => "Test that readstringlist correctly ignores many comment lines"; + # https://regex101.com/r/OZUgku/1/ vars: - "my_list_of_strings" - slist => readstringlist( "$(this.promise_filename).list.txt", # File to read - "\s*#[^\n]*", # Exclude hash comment lines - "\s", # Split on whitespace - inf, # Maximum number of entries - inf); # Maximum number of bytes to read + "my_list_of_strings" + slist => readstringlist( + "$(this.promise_filename).list.txt", + # File to read + "\s*#[^\n]*", + # Exclude hash comment lines + "\s", + # Split on whitespace + inf, + # Maximum number of entries + inf + ); + + # Maximum number of bytes to read } + bundle agent check { vars: - "expected" slist => { "jay", "dave" }; + "expected" slist => { "jay", "dave" }; methods: - "Pass/FAIL" - usebundle => dcs_check_diff_elements( @(test.my_list_of_strings), # First set of elements - @(expected), # Second set of elements - $(this.promise_filename), # Full path to test policy file - "no"); # Expected difference in elements + usebundle => dcs_check_diff_elements( + @(test.my_list_of_strings), + # First set of elements + @(expected), + # Second set of elements + $(this.promise_filename), + # Full path to test policy file + "no" + ); + + # Expected difference in elements } diff --git a/tests/acceptance/01_vars/02_functions/readtcp_connection_fail.cf b/tests/acceptance/01_vars/02_functions/readtcp_connection_fail.cf index 922edf990e..41017a5935 100644 --- a/tests/acceptance/01_vars/02_functions/readtcp_connection_fail.cf +++ b/tests/acceptance/01_vars/02_functions/readtcp_connection_fail.cf @@ -1,37 +1,41 @@ # Test that failure to connect to remote host does not result in "Could not # close socket" error messages. - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { vars: - "subout" string => execresult("$(sys.cf_agent) -Kf $(this.promise_filename).sub", "useshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", "useshell" + ); } bundle agent check { classes: - "ok_output" not => regcmp(".*Bad file descriptor.*", "$(test.subout)"); - "ok_no_crash" expression => isvariable("test.subout"); - "ok" and => { "ok_output", "ok_no_crash" }; + "ok_output" not => regcmp(".*Bad file descriptor.*", "$(test.subout)"); + "ok_no_crash" expression => isvariable("test.subout"); + "ok" and => { "ok_output", "ok_no_crash" }; reports: DEBUG:: "$(test.subout)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/regarray.cf b/tests/acceptance/01_vars/02_functions/regarray.cf index 66d1876026..f3fdb64331 100644 --- a/tests/acceptance/01_vars/02_functions/regarray.cf +++ b/tests/acceptance/01_vars/02_functions/regarray.cf @@ -3,46 +3,41 @@ # Test regarray # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - - "myarray[0]" string => "bla1"; - "myarray[1]" string => "bla2"; - "myarray[3]" string => "bla"; - "myarray" string => "345"; - "not" string => "345"; + "myarray[0]" string => "bla1"; + "myarray[1]" string => "bla2"; + "myarray[3]" string => "bla"; + "myarray" string => "345"; + "not" string => "345"; } - ####################################################### - bundle agent check { classes: - "ok" expression => regarray("test.myarray","b.*2"); + "ok" expression => regarray("test.myarray", "b.*2"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/regex_replace.cf b/tests/acceptance/01_vars/02_functions/regex_replace.cf index 3329524064..2e712f3e64 100644 --- a/tests/acceptance/01_vars/02_functions/regex_replace.cf +++ b/tests/acceptance/01_vars/02_functions/regex_replace.cf @@ -3,59 +3,81 @@ # Test regex_replace function # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "test" string => "abcdefghij"; - - # replace the empty string with empty string, globally - "void" string => regex_replace($(test), "", "", "g"); - # replace any character with empty string, globally - "void1" string => regex_replace($(test), ".", "", "g"); - # replace the empty string with 'x', globally (matches on character boundaries) - "void2" string => regex_replace($(test), "", "x", "g"); - - # replace the whole string - "allofitwithTEST" string => regex_replace($(test), ".*", "TEST", ""); - # no matches, original intact - "nomatch" string => regex_replace($(test), "nonesuch", "TEST", "g"); - "nomatch2" string => regex_replace($(test), "nonesuch", "TEST\1\2\3\4\5\6\7\8\9", "g"); - # replace any character with -DOT- - "dots_everywhere" string => regex_replace($(test), ".", "-DOT-", "g"); - # capture any three characters and replace with a backreference - "cap123" string => regex_replace($(test), "(...)", "[cap=$1]", "g"); - # capture any three characters and replace with a backreference - "cap123_backslash" string => regex_replace($(test), "(...)", "[cap=\1]", "g"); - # note that this is the same as above because the CFE parser tries to be clever in this case, converting \\1 to \1 - "cap123_backslash2" string => regex_replace($(test), "(...)", "[cap=\\1]", "g"); - "cap123_backslashes1to9missing" string => regex_replace($(test), "...", "[cap=\1\2\3\4\5\6\7\8\9]", "g"); - "cap123_backslashes1to9havesome" string => regex_replace($(test), "(.)(.)(.)", "[cap=\1\2\3\4\5\6\7\8\9]", "g"); - # match ABC case-insensitive and replace with ABC - "simple_nocase" string => regex_replace($(test), "ABC", "ABC", "gi"); # case-insensitive - # match abc and replace with ABC - "simple" string => regex_replace($(test), "abc", "ABC", "g"); - - # empty cases - "empty1" string => regex_replace("", "abc", "ABC", "g"); - "empty2" string => regex_replace("", "abc", "", "g"); + "test" string => "abcdefghij"; + + # replace the empty string with empty string, globally + "void" string => regex_replace($(test), "", "", "g"); + + # replace any character with empty string, globally + "void1" string => regex_replace($(test), ".", "", "g"); + + # replace the empty string with 'x', globally (matches on character boundaries) + "void2" string => regex_replace($(test), "", "x", "g"); + + # replace the whole string + "allofitwithTEST" string => regex_replace($(test), ".*", "TEST", ""); + + # no matches, original intact + "nomatch" string => regex_replace($(test), "nonesuch", "TEST", "g"); + + "nomatch2" + string => regex_replace( + $(test), "nonesuch", "TEST\1\2\3\4\5\6\7\8\9", "g" + ); + + # replace any character with -DOT- + "dots_everywhere" string => regex_replace($(test), ".", "-DOT-", "g"); + + # capture any three characters and replace with a backreference + "cap123" string => regex_replace($(test), "(...)", "[cap=$1]", "g"); + + # capture any three characters and replace with a backreference + "cap123_backslash" + string => regex_replace($(test), "(...)", "[cap=\1]", "g"); + + # note that this is the same as above because the CFE parser tries to be clever in this case, converting \\1 to \1 + "cap123_backslash2" + string => regex_replace($(test), "(...)", "[cap=\\1]", "g"); + + "cap123_backslashes1to9missing" + string => regex_replace($(test), "...", "[cap=\1\2\3\4\5\6\7\8\9]", "g"); + + "cap123_backslashes1to9havesome" + string => regex_replace( + $(test), "(.)(.)(.)", "[cap=\1\2\3\4\5\6\7\8\9]", "g" + ); + + # match ABC case-insensitive and replace with ABC + "simple_nocase" string => regex_replace($(test), "ABC", "ABC", "gi"); + + # case-insensitive + # match abc and replace with ABC + "simple" string => regex_replace($(test), "abc", "ABC", "g"); + + # empty cases + "empty1" string => regex_replace("", "abc", "ABC", "g"); + "empty2" string => regex_replace("", "abc", "", "g"); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/regextract.cf b/tests/acceptance/01_vars/02_functions/regextract.cf index d8e331a882..ee882bc096 100644 --- a/tests/acceptance/01_vars/02_functions/regextract.cf +++ b/tests/acceptance/01_vars/02_functions/regextract.cf @@ -3,23 +3,22 @@ # Test regextract # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "text" string => "node-01-10.0"; + "text" string => "node-01-10.0"; classes: - "parsed_text" expression => regextract("^\w+-(\d+)-(\d+\.\d+)", "$(text)", "pair"); + "parsed_text" + expression => regextract("^\w+-(\d+)-(\d+\.\d+)", "$(text)", "pair"); reports: DEBUG.!parsed_text:: @@ -27,37 +26,37 @@ bundle agent init } ####################################################### - bundle agent test { vars: - "lefts" string => "$(init.pair[1])"; - "lefti" int => "$(init.pair[1])"; - "rights" string => "$(init.pair[2])"; - "rightr" real => "$(init.pair[2])"; + "lefts" string => "$(init.pair[1])"; + "lefti" int => "$(init.pair[1])"; + "rights" string => "$(init.pair[2])"; + "rightr" real => "$(init.pair[2])"; } - ####################################################### - bundle agent check { classes: - "sok" expression => strcmp("$(test.lefts):$(test.rights)", "01:10.0"); - "iok" expression => strcmp("$(test.lefti)", "1"); - "rok" expression => strcmp("$(test.rightr)", "10.000000"); - "ok" and => { "sok", "iok", "rok" }; + "sok" expression => strcmp("$(test.lefts):$(test.rights)", "01:10.0"); + "iok" expression => strcmp("$(test.lefti)", "1"); + "rok" expression => strcmp("$(test.rightr)", "10.000000"); + "ok" and => { "sok", "iok", "rok" }; reports: DEBUG.!iok:: "Parsed integer '$(test.lefti)' isn't 1"; + DEBUG.!rok:: "Parsed real '$(test.rightr)' isn't 10.000000"; + DEBUG.!sok:: "Parsed numbers '$(test.lefts)' and '$(test.rights)' aren't '01' and '10.0'"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/regextract2.cf b/tests/acceptance/01_vars/02_functions/regextract2.cf index 74abc414a2..13d74360b1 100644 --- a/tests/acceptance/01_vars/02_functions/regextract2.cf +++ b/tests/acceptance/01_vars/02_functions/regextract2.cf @@ -3,50 +3,45 @@ # Test regextract # ####################################################### - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { vars: parsed:: "part1_as_int" int => "$(part[1])"; "part2_as_int" int => "$(part[2])"; - "part1_as_str" string => "$(part[1])"; "part2_as_str" string => "$(part[2])"; classes: - "parsed" expression => regextract("^node-(\d+)-0*(\d+)", "node-8-01", "part"); + "parsed" + expression => regextract("^node-(\d+)-0*(\d+)", "node-8-01", "part"); } - ####################################################### - bundle agent check { classes: - "ok1" expression => strcmp("$(test.part1_as_int)", "$(test.part1_as_str)"); - "ok2" expression => strcmp("$(test.part2_as_int)", "$(test.part2_as_str)"); + "ok1" expression => strcmp("$(test.part1_as_int)", "$(test.part1_as_str)"); + "ok2" expression => strcmp("$(test.part2_as_int)", "$(test.part2_as_str)"); + "ok" and => { "ok1", "ok2" }; - "ok" and => { "ok1", "ok2" }; - reports: ok:: - "$(this.promise_filename) Pass"; + "$(this.promise_filename) Pass"; + !ok:: - "$(this.promise_filename) FAIL"; + "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/regline.cf b/tests/acceptance/01_vars/02_functions/regline.cf index b9728ffd1f..097150e3cb 100644 --- a/tests/acceptance/01_vars/02_functions/regline.cf +++ b/tests/acceptance/01_vars/02_functions/regline.cf @@ -3,78 +3,71 @@ # Test filter() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "results" slist => { - "five trailing spaces ", - "no trailing spaces", - }; + "results" slist => { "five trailing spaces ", "no trailing spaces" }; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_defaults => init_empty, edit_line => init_insert; } - body edit_defaults init_empty { - empty_file_before_editing => "true"; - edit_backup => "false"; + empty_file_before_editing => "true"; + edit_backup => "false"; } bundle edit_line init_insert { insert_lines: - "$(init.results)"; + "$(init.results)"; } - -bundle agent test +bundle agent test { - classes: - "matched1" - expression => regline("five trailing spaces ", - $(G.testfile)), - scope => "namespace"; - "matched2" - expression => regline("five trailing spaces ", - $(G.testfile)), - scope => "namespace"; + classes: + "matched1" + expression => regline("five trailing spaces ", $(G.testfile)), + scope => "namespace"; + "matched2" + expression => regline("five trailing spaces ", $(G.testfile)), + scope => "namespace"; + reports: + DEBUG.matched1:: + "Line matched1 matched"; + + DEBUG.!matched1:: + "Line matched1 did not match"; - reports: - DEBUG.matched1:: - "Line matched1 matched"; - DEBUG.!matched1:: - "Line matched1 did not match"; - DEBUG.matched2:: - "Line matched2 matched"; - DEBUG.!matched2:: - "Line matched2 did not match"; + DEBUG.matched2:: + "Line matched2 matched"; + DEBUG.!matched2:: + "Line matched2 did not match"; } bundle agent check { classes: - "ok" expression => "matched1.!matched2"; + "ok" expression => "matched1.!matched2"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; - } diff --git a/tests/acceptance/01_vars/02_functions/reverse.cf b/tests/acceptance/01_vars/02_functions/reverse.cf index c96fece0da..66e4a4d00d 100644 --- a/tests/acceptance/01_vars/02_functions/reverse.cf +++ b/tests/acceptance/01_vars/02_functions/reverse.cf @@ -3,40 +3,38 @@ # Test reverse() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "a" slist => { "c", "b", "a" }; - "b" slist => { }; + "a" slist => { "c", "b", "a" }; + "b" slist => {}; } ####################################################### - bundle agent test { vars: - "sa" slist => reverse("init.a"); - "sb" slist => reverse("init.b"); - - "inline" slist => reverse('[ "q", "p", "r" ]'); + "sa" slist => reverse("init.a"); + "sb" slist => reverse("init.b"); + "inline" slist => reverse('[ "q", "p", "r" ]'); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/setop_unique_difference_intersection.cf b/tests/acceptance/01_vars/02_functions/setop_unique_difference_intersection.cf index 50036fc8aa..dd4a02e99b 100644 --- a/tests/acceptance/01_vars/02_functions/setop_unique_difference_intersection.cf +++ b/tests/acceptance/01_vars/02_functions/setop_unique_difference_intersection.cf @@ -3,64 +3,75 @@ # Test unique(), difference() and intersection() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "a" slist => { "x", "y", "z" }; - "b" slist => { "100", "9", "10" }; - "c" slist => { }; - "d" slist => { "" }; - "e" slist => { "x" }; - "f" slist => { - 1,2,3, - "one", "two", "three", - "long string", - "four", "fix", "six", - "one", "two", "three", + "a" slist => { "x", "y", "z" }; + "b" slist => { "100", "9", "10" }; + "c" slist => {}; + "d" slist => { "" }; + "e" slist => { "x" }; + + "f" + slist => { + 1, + 2, + 3, + "one", + "two", + "three", + "long string", + "four", + "fix", + "six", + "one", + "two", + "three", }; } ####################################################### - bundle agent test { vars: - "list1" slist => { "a", "b", "c", "d", "e", "f" }; - "list2" slist => { "a", "b", "c", "d", "e", "f" }; + "list1" slist => { "a", "b", "c", "d", "e", "f" }; + "list2" slist => { "a", "b", "c", "d", "e", "f" }; + "unique_$(list1)" slist => unique("init.$(list1)"); + + "difference_$(list1)_$(list2)" + slist => difference("init.$(list1)", "init.$(list2)"); - "unique_$(list1)" slist => unique("init.$(list1)"); - "difference_$(list1)_$(list2)" slist => difference("init.$(list1)", - "init.$(list2)"); + "intersection_$(list1)_$(list2)" + slist => intersection("init.$(list1)", "init.$(list2)"); - "intersection_$(list1)_$(list2)" slist => intersection("init.$(list1)", - "init.$(list2)"); + "unique_inline_array" slist => unique('[ "one", "b", "one", "q" ]'); - "unique_inline_array" slist => unique('[ "one", "b", "one", "q" ]'); - "unique_inline_object" slist => unique('{ "one": "b", "c": "q", "d": "one" }'); + "unique_inline_object" + slist => unique('{ "one": "b", "c": "q", "d": "one" }'); - "difference_inline_$(list1)" slist => difference('[ "one", "b", "one", "q" ]', - "init.$(list2)"); + "difference_inline_$(list1)" + slist => difference('[ "one", "b", "one", "q" ]', "init.$(list2)"); - "intersection_$(list1)_inline" slist => intersection("init.$(list1)", - '[ "one", "b", "one", "q" ]'); + "intersection_$(list1)_inline" + slist => intersection("init.$(list1)", '[ "one", "b", "one", "q" ]'); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/shuffle-exact.cf b/tests/acceptance/01_vars/02_functions/shuffle-exact.cf index 40099bf002..8ad103914f 100644 --- a/tests/acceptance/01_vars/02_functions/shuffle-exact.cf +++ b/tests/acceptance/01_vars/02_functions/shuffle-exact.cf @@ -3,51 +3,53 @@ # Test shuffle() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { meta: - "test_soft_fail" string => "!linux", - meta => { "redmine7950" }; + "test_soft_fail" + string => "!linux", + meta => { "redmine7950" }; vars: - "a" slist => { "a", "b", "c", "d", "e", "f", "g" }; - "b" slist => { }; + "a" slist => { "a", "b", "c", "d", "e", "f", "g" }; + "b" slist => {}; } ####################################################### - bundle agent test { meta: - # for some reason, shuffle() produces different results on 64bit RHEL 4 - # and Debian 4 than everywhere else - "test_soft_fail" - string => "((centos_4|centos_5|debian_4).64_bit)|windows", - meta => { "CFE-2301,ENT-10254" }; + # for some reason, shuffle() produces different results on 64bit RHEL 4 + # and Debian 4 than everywhere else + "test_soft_fail" + string => "((centos_4|centos_5|debian_4).64_bit)|windows", + meta => { "CFE-2301,ENT-10254" }; + vars: - "lists" slist => { "a", "b" }; - "seeds" slist => { "skruf", "cormorant", "dollhouse" }; + "lists" slist => { "a", "b" }; + "seeds" slist => { "skruf", "cormorant", "dollhouse" }; + "shuffle_$(lists)_$(seeds)" slist => shuffle("init.$(lists)", $(seeds)); - "shuffle_$(lists)_$(seeds)" slist => shuffle("init.$(lists)", $(seeds)); - "shuffle_inline_$(seeds)" slist => shuffle('["a", "b", "delta", "farmer"]', $(seeds)); + "shuffle_inline_$(seeds)" + slist => shuffle('["a", "b", "delta", "farmer"]', $(seeds)); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/shuffle.cf b/tests/acceptance/01_vars/02_functions/shuffle.cf index 254b2bc5f3..e66bf48a48 100644 --- a/tests/acceptance/01_vars/02_functions/shuffle.cf +++ b/tests/acceptance/01_vars/02_functions/shuffle.cf @@ -3,53 +3,45 @@ # Test shuffle() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "a" slist => { "a", "b", "c", "d", "e", "f", "g" }; - "b" slist => { }; + "a" slist => { "a", "b", "c", "d", "e", "f", "g" }; + "b" slist => {}; } ####################################################### - bundle agent test { vars: - "sa" slist => shuffle("init.a", "skruf"); - "sb" slist => shuffle("init.b", "skruf"); + "sa" slist => shuffle("init.a", "skruf"); + "sb" slist => shuffle("init.b", "skruf"); } - ####################################################### - bundle agent check { vars: - "asorted" slist => sort("test.sa", "lex"); - - "jaorig" string => join(",", "init.a"); - "jasorted" string => join(",", "asorted"); - "ja" string => join(",", "test.sa"); - "jb" string => join(",", "test.sb"); + "asorted" slist => sort("test.sa", "lex"); + "jaorig" string => join(",", "init.a"); + "jasorted" string => join(",", "asorted"); + "ja" string => join(",", "test.sa"); + "jb" string => join(",", "test.sb"); classes: - "a_not_changed" expression => strcmp($(jaorig), $(ja)); - "a_is_permutation" expression => strcmp($(jasorted), $(jaorig)); - "ok_a" and => { "!a_not_changed", "a_is_permutation" }; - - "ok_b" expression => strcmp("", $(jb)); - - "ok" and => { "ok_a", "ok_b" }; + "a_not_changed" expression => strcmp($(jaorig), $(ja)); + "a_is_permutation" expression => strcmp($(jasorted), $(jaorig)); + "ok_a" and => { "!a_not_changed", "a_is_permutation" }; + "ok_b" expression => strcmp("", $(jb)); + "ok" and => { "ok_a", "ok_b" }; reports: DEBUG:: @@ -58,6 +50,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/sort.cf b/tests/acceptance/01_vars/02_functions/sort.cf index 5158a244d4..eab3cf8719 100644 --- a/tests/acceptance/01_vars/02_functions/sort.cf +++ b/tests/acceptance/01_vars/02_functions/sort.cf @@ -3,85 +3,120 @@ # Test sort() # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent init { vars: - "a" slist => { "b", "c", "a" }; - "b" slist => { "100", "9", "10" }; - "c" slist => { }; - "d" slist => { "", "a", "", "b" }; - "e" slist => { "a", "1", "b" }; - "f" slist => { "0", "100.0", "0.1", "3.2" }; - "g" slist => { "", "-2.1", "0.88", "b", "00.88" }; + "a" slist => { "b", "c", "a" }; + "b" slist => { "100", "9", "10" }; + "c" slist => {}; + "d" slist => { "", "a", "", "b" }; + "e" slist => { "a", "1", "b" }; + "f" slist => { "0", "100.0", "0.1", "3.2" }; + "g" slist => { "", "-2.1", "0.88", "b", "00.88" }; + + "ip" + slist => { + "100.200.100.0", + "1.2.3.4", + "9.7.5.1", + "9", + "9.7", + "9.7.5", + "", + "-1", + "where are the IP addresses?", + }; - "ip" slist => { "100.200.100.0", "1.2.3.4", "9.7.5.1", "9", "9.7", "9.7.5", "", "-1", "where are the IP addresses?" }; - "ipv6" slist => { "FE80:0000:0000:0000:0202:B3FF:FE1E:8329", - "FE80::0202:B3FF:FE1E:8329", - "::1", - # the following should all be parsed as the same address and sorted together - "2001:db8:0:0:1:0:0:1", - "2001:0db8:0:0:1:0:0:1", - "2001:db8::1:0:0:1", - "2001:db8::0:1:0:0:1", - "2001:0db8::1:0:0:1", - "2001:db8:0:0:1::1", - "2001:db8:0000:0:1::1", - "2001:DB8:0:0:1::1", # note uppercase IPv6 addresses are invalid - # examples from https://www.ripe.net/lir-services/new-lir/ipv6_reference_card.pdf - "8000:63bf:3fff:fdd2", - "::ffff:192.0.2.47", - "fdf8:f53b:82e4::53", - "fe80::200:5aee:feaa:20a2", - "2001:0000:4136:e378:", - "8000:63bf:3fff:fdd2", - "2001:0002:6c::430", - "2001:10:240:ab::a", - "2002:cb0a:3cdd:1::1", - "2001:db8:8:4::2", - "ff01:0:0:0:0:0:0:2", - "-1", "where are the IP addresses?" }; + "ipv6" + slist => { + "FE80:0000:0000:0000:0202:B3FF:FE1E:8329", + "FE80::0202:B3FF:FE1E:8329", + "::1", + # the following should all be parsed as the same address and sorted together + "2001:db8:0:0:1:0:0:1", + "2001:0db8:0:0:1:0:0:1", + "2001:db8::1:0:0:1", + "2001:db8::0:1:0:0:1", + "2001:0db8::1:0:0:1", + "2001:db8:0:0:1::1", + "2001:db8:0000:0:1::1", + "2001:DB8:0:0:1::1", + # note uppercase IPv6 addresses are invalid + # examples from https://www.ripe.net/lir-services/new-lir/ipv6_reference_card.pdf + "8000:63bf:3fff:fdd2", + "::ffff:192.0.2.47", + "fdf8:f53b:82e4::53", + "fe80::200:5aee:feaa:20a2", + "2001:0000:4136:e378:", + "8000:63bf:3fff:fdd2", + "2001:0002:6c::430", + "2001:10:240:ab::a", + "2002:cb0a:3cdd:1::1", + "2001:db8:8:4::2", + "ff01:0:0:0:0:0:0:2", + "-1", + "where are the IP addresses?", + }; - "mac" slist => { "00:14:BF:F7:23:1D", "0:14:BF:F7:23:1D", ":14:BF:F7:23:1D", "00:014:BF:0F7:23:01D", - "00:14:BF:F7:23:1D", "0:14:BF:F7:23:1D", ":14:BF:F7:23:1D", "00:014:BF:0F7:23:01D", - "01:14:BF:F7:23:1D", "1:14:BF:F7:23:1D", - "01:14:BF:F7:23:2D", "1:14:BF:F7:23:2D", - "-1", "where are the MAC addresses?" }; + "mac" + slist => { + "00:14:BF:F7:23:1D", + "0:14:BF:F7:23:1D", + ":14:BF:F7:23:1D", + "00:014:BF:0F7:23:01D", + "00:14:BF:F7:23:1D", + "0:14:BF:F7:23:1D", + ":14:BF:F7:23:1D", + "00:014:BF:0F7:23:01D", + "01:14:BF:F7:23:1D", + "1:14:BF:F7:23:1D", + "01:14:BF:F7:23:2D", + "1:14:BF:F7:23:2D", + "-1", + "where are the MAC addresses?", + }; } bundle agent test { meta: - "test_soft_fail" string => "hpux|sunos_5_9", - meta => { "redmine4934", "redmine5107" }; - "test_flakey_fail" string => "windows", - meta => { "ENT-10254" }; + "test_soft_fail" + string => "hpux|sunos_5_9", + meta => { "redmine4934", "redmine5107" }; + "test_flakey_fail" + string => "windows", + meta => { "ENT-10254" }; vars: - "test" slist => { "a", "b", "c", "d", "e", "f", "g", "ip", "ipv6", "mac" }; - "sort" slist => { "lex", "int", "real", "IP", "MAC" }; + "test" slist => { "a", "b", "c", "d", "e", "f", "g", "ip", "ipv6", "mac" }; + "sort" slist => { "lex", "int", "real", "IP", "MAC" }; + "$(sort)_sorted_$(test)" slist => sort("init.$(test)", $(sort)); - "$(sort)_sorted_$(test)" slist => sort("init.$(test)", $(sort)); - "inline_$(sort)_sorted" slist => sort('["b", "c", "a", "100", "9", "10"]', $(sort)); - "sorted_$(test)" slist => sort("init.$(test)"); # implicit "lex" + "inline_$(sort)_sorted" + slist => sort('["b", "c", "a", "100", "9", "10"]', $(sort)); + + "sorted_$(test)" slist => sort("init.$(test)"); + + # implicit "lex" } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/split.cf b/tests/acceptance/01_vars/02_functions/split.cf index 0cd3bc68aa..4543d4d45f 100644 --- a/tests/acceptance/01_vars/02_functions/split.cf +++ b/tests/acceptance/01_vars/02_functions/split.cf @@ -3,63 +3,55 @@ # Test string_split() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ############################################### - bundle agent init { - -vars: - "states" slist => { "actual", "expected" }; - - "expected" string => - "one + vars: + "states" slist => { "actual", "expected" }; + "expected" string => "one two:three"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => ensure_lines("$(init.expected)"), edit_defaults => empty; - } - ####################################################### - bundle agent test { vars: - "result" slist => string_split("one:two:three", ":", "2"); + "result" slist => string_split("one:two:three", ":", "2"); files: - "$(G.testfile).actual" - create => "true", - edit_defaults => empty, - edit_line => ensure_lines(@(result)); - + "$(G.testfile).actual" + create => "true", + edit_defaults => empty, + edit_line => ensure_lines(@(result)); } - ####################################################### - bundle edit_line ensure_lines(list) { insert_lines: - "$(list)"; + "$(list)"; } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/staging/accumulated.cf b/tests/acceptance/01_vars/02_functions/staging/accumulated.cf index 0226bfbab2..ff3c280cd1 100644 --- a/tests/acceptance/01_vars/02_functions/staging/accumulated.cf +++ b/tests/acceptance/01_vars/02_functions/staging/accumulated.cf @@ -3,46 +3,45 @@ # Test accumulated() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "time" int => accumulated(315,0,0,0,0,0); + "time" int => accumulated(315, 0, 0, 0, 0, 0); } ####################################################### - bundle agent check { vars: - "time" int => "9933840000"; # 1 year == 365 days + "time" int => "9933840000"; + # 1 year == 365 days classes: - "ok" expression => strcmp("$(time)", "$(test.time)"); + "ok" expression => strcmp("$(time)", "$(test.time)"); reports: DEBUG:: "time: $(time)"; "test.time: $(test.time)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/staging/accumulated2.cf b/tests/acceptance/01_vars/02_functions/staging/accumulated2.cf index 307af546a7..fda6f43538 100644 --- a/tests/acceptance/01_vars/02_functions/staging/accumulated2.cf +++ b/tests/acceptance/01_vars/02_functions/staging/accumulated2.cf @@ -3,46 +3,45 @@ # Test accumulated() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "time" int => accumulated(0,1000,1000,1000,1000,40000); + "time" int => accumulated(0, 1000, 1000, 1000, 1000, 40000); } ####################################################### - bundle agent check { vars: - "time" int => "2682100000"; # 1 year == 365 days + "time" int => "2682100000"; + # 1 year == 365 days classes: - "ok" expression => strcmp("$(time)", "$(test.time)"); + "ok" expression => strcmp("$(time)", "$(test.time)"); reports: DEBUG:: "time: $(time)"; "test.time: $(test.time)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/staging/bundlesmatching_dynamicbundlesequence.cf b/tests/acceptance/01_vars/02_functions/staging/bundlesmatching_dynamicbundlesequence.cf index db12236831..9563b9f21d 100644 --- a/tests/acceptance/01_vars/02_functions/staging/bundlesmatching_dynamicbundlesequence.cf +++ b/tests/acceptance/01_vars/02_functions/staging/bundlesmatching_dynamicbundlesequence.cf @@ -1,15 +1,14 @@ # Test that bundlesmatching works correctly for dynamic sequences - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)"), @(init.runs) }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)"), @(init.runs) }; } bundle common init { vars: - "runs" slist => bundlesmatching("default:run.*"); + "runs" slist => bundlesmatching("default:run.*"); } bundle agent test @@ -19,13 +18,15 @@ bundle agent test bundle agent check { classes: - "ok" and => { ok1, ok2, ok3 }; + "ok" and => { ok1, ok2, ok3 }; reports: DEBUG:: "Found bundles $(test.runs)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } @@ -33,17 +34,23 @@ bundle agent check bundle agent run_123_456 { classes: - "ok1" expression => "any", scope => "namespace"; + "ok1" + expression => "any", + scope => "namespace"; } bundle agent run_789_0ab { classes: - "ok2" expression => "any", scope => "namespace"; + "ok2" + expression => "any", + scope => "namespace"; } bundle agent run_cde_fgh { classes: - "ok3" expression => "any", scope => "namespace"; + "ok3" + expression => "any", + scope => "namespace"; } diff --git a/tests/acceptance/01_vars/02_functions/staging/datatype.cf b/tests/acceptance/01_vars/02_functions/staging/datatype.cf index e2a663eda6..a4ea6b269c 100644 --- a/tests/acceptance/01_vars/02_functions/staging/datatype.cf +++ b/tests/acceptance/01_vars/02_functions/staging/datatype.cf @@ -3,20 +3,19 @@ # Test datatype() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "results" string => 'jsonstring = { + "results" + string => 'jsonstring = { "person": { "first": "miyamoto", "last": "musashi" @@ -61,7 +60,8 @@ bundle agent init "dituri was here": 3.1416 }'; - "results2" string => '--------------------- + "results2" + string => '--------------------- toplevel:key = person toplevel:key = birth toplevel:key = death @@ -110,7 +110,8 @@ toplevel[dokkōdō]:key= 19 toplevel[dokkōdō]:key= 20 toplevel[styles]:key= 1'; - "results3" string => 'toplevel[person][first]:type = json_string + "results3" + string => 'toplevel[person][first]:type = json_string toplevel[go rin no sho][1]:type = json_string toplevel[dokkōdō][0]:type = json_string toplevel[styles][0]:type = json_string @@ -144,15 +145,15 @@ ok: datatype(datastr) failed properly'; files: "$(G.testfile).expected" - create => "true", - edit_defaults => init_empty, - edit_line => init_insert; + create => "true", + edit_defaults => init_empty, + edit_line => init_insert; } body edit_defaults init_empty { - empty_file_before_editing => "true"; - edit_backup => "false"; + empty_file_before_editing => "true"; + edit_backup => "false"; } bundle edit_line init_insert @@ -164,12 +165,14 @@ bundle edit_line init_insert } ####################################################### - bundle common test_common { vars: "datastr" string => storejson("data"); - "data" data => parsejson(' + + "data" + data => parsejson( + ' { "person": { "first": "miyamoto", "last": "musashi" }, "birth": null, @@ -202,30 +205,23 @@ bundle common test_common "decidable": false "dituri was here": 3.14159265 } -'); - - "typenames" slist => { "person", "go rin no sho", "dokkōdō", "styles" }; - - "keys[top]" - slist => getindices("data"); +' + ); - "types[top][$(keys[top])]" - string => datatype("data[$(keys[top])]"); - - "keys[$(typenames)]" - slist => getindices("data[$(typenames)]"); + "typenames" slist => { "person", "go rin no sho", "dokkōdō", "styles" }; + "keys[top]" slist => getindices("data"); + "types[top][$(keys[top])]" string => datatype("data[$(keys[top])]"); + "keys[$(typenames)]" slist => getindices("data[$(typenames)]"); "types[$(typenames)][$(keys[$(typenames)])]" string => datatype("data[$(typenames)][$(keys[$(typenames)])]"); - "bad_type_test" - string => datatype("datastr"); + "bad_type_test" string => datatype("datastr"); classes: - "ok_invalid_test_failed" not => isvariable("bad_type_test"); + "ok_invalid_test_failed" not => isvariable("bad_type_test"); } - bundle agent test { files: @@ -239,31 +235,30 @@ bundle edit_line test_insert insert_lines: cfengine:: "jsonstring = $(test_common.datastr)"; - "---------------------"; "toplevel:key = $(test_common.keys[top])"; "toplevel[$(test_common.keys[top])]:type = $(test_common.types[top][$(test_common.keys[top])])"; - "------------------------------------------"; "toplevel[$(test_common.typenames)]:key= $(test_common.keys[$(test_common.typenames)])"; "toplevel[$(test_common.typenames)][$(test_common.keys[$(test_common.typenames)])]:type = $(test_common.types[$(test_common.typenames)][$(test_common.keys[$(test_common.typenames)])])"; - ok_invalid_test_failed:: + ok_invalid_test_failed:: "------------------------------------------"; "ok: datatype(datastr) failed properly"; - !ok_invalid_test_failed:: + !ok_invalid_test_failed:: "------------------------------------------"; "NOT_OK: datatype(datastr) was supposed to fail"; - } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/staging/execresult_large.cf b/tests/acceptance/01_vars/02_functions/staging/execresult_large.cf index 500870524e..e3c5c56c1b 100644 --- a/tests/acceptance/01_vars/02_functions/staging/execresult_large.cf +++ b/tests/acceptance/01_vars/02_functions/staging/execresult_large.cf @@ -3,51 +3,52 @@ # Test execresult() of large files # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { } ####################################################### - bundle agent check { vars: - "testlengths" ilist => { "1024", "4096", "100000", "500000" }; - "result_$(testlengths)" string => execresult("$(G.perl) -e 'my $x = qw/x/ x $(testlengths); print $x;'", "useshell"); - "length_$(testlengths)" int => strlen("$(result_$(testlengths))"); + "testlengths" ilist => { "1024", "4096", "100000", "500000" }; + + "result_$(testlengths)" + string => execresult( + "$(G.perl) -e 'my $x = qw/x/ x $(testlengths); print $x;'", "useshell" + ); + + "length_$(testlengths)" int => strlen("$(result_$(testlengths))"); classes: - "ok_$(testlengths)" expression => strcmp("$(length_$(testlengths))", - $(testlengths)); - "ok" and => { - "ok_1024", "ok_4096", "ok_100000", "ok_500000", - }; + "ok_$(testlengths)" + expression => strcmp("$(length_$(testlengths))", $(testlengths)); + + "ok" and => { "ok_1024", "ok_4096", "ok_100000", "ok_500000" }; reports: DEBUG:: "the read of $(testlengths) bytes gave $(length_$(testlengths)) bytes"; "the read of $(testlengths) bytes failed to match the expected $(testlengths) bytes, actual = $(length_$(testlengths))" - if => "!ok_$(testlengths)"; + if => "!ok_$(testlengths)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/staging/format_empty_lists.cf b/tests/acceptance/01_vars/02_functions/staging/format_empty_lists.cf index 2daa877f5d..39b5a49102 100644 --- a/tests/acceptance/01_vars/02_functions/staging/format_empty_lists.cf +++ b/tests/acceptance/01_vars/02_functions/staging/format_empty_lists.cf @@ -1,35 +1,35 @@ # ensure interpolated empty lists don't drag in cf_null - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "list" slist => { "item1", "item2", "item3", "item4", "item5" }; + "list" slist => { "item1", "item2", "item3", "item4", "item5" }; } bundle agent test { vars: - "local" slist => { }; - # should *not* bring in cf_null - "splice" slist => { @(init.list), @(local) }; + "local" slist => {}; + + # should *not* bring in cf_null + "splice" slist => { @(init.list), @(local) }; } bundle agent check { vars: - "expected" string => '{ "item1", "item2", "item3", "item4", "item5" }'; - "joined" string => format("%S", "test.splice"); + "expected" string => '{ "item1", "item2", "item3", "item4", "item5" }'; + "joined" string => format("%S", "test.splice"); methods: - "check" usebundle => dcs_check_strcmp($(expected), - $(joined), - "$(this.promise_filename)", - "no"); + "check" + usebundle => dcs_check_strcmp( + $(expected), $(joined), "$(this.promise_filename)", "no" + ); } diff --git a/tests/acceptance/01_vars/02_functions/staging/functions_and_nulls.cf b/tests/acceptance/01_vars/02_functions/staging/functions_and_nulls.cf index 18d12f78f2..279777a715 100644 --- a/tests/acceptance/01_vars/02_functions/staging/functions_and_nulls.cf +++ b/tests/acceptance/01_vars/02_functions/staging/functions_and_nulls.cf @@ -3,43 +3,69 @@ # Test hash() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { vars: - # The nulls terminate the string here - "test1" string => execresult("$(G.perl) -e 'print \"Test of \0\1\2\n nulls in a string\";'", "noshell"); + # The nulls terminate the string here + "test1" + string => execresult( + "$(G.perl) -e 'print \"Test of \0\1\2\n nulls in a string\";'", + "noshell" + ); + + # Write the same string to a file and read it in again, they are converted + "test2" + string => execresult( + "$(G.perl) -e 'print \"Test of \0\1\2\n nulls in a string\";' > $(G.testfile)", + "useshell" + ); + + "test3" string => readfile("$(G.testfile)", "100"); + + # They are converted here, too, so the split fails + "test4a" + slist => readstringlist( + "$(G.testfile)", "#no comments", "\0", "2", "100" + ); + + # And simply quoting the backslash doesn't work, because I think the + # regex is also converted + "test4b" + slist => readstringlist( + "$(G.testfile)", "#no comments", "\\0", "2", "100" + ); - # Write the same string to a file and read it in again, they are converted - "test2" string => execresult("$(G.perl) -e 'print \"Test of \0\1\2\n nulls in a string\";' > $(G.testfile)", "useshell"); - "test3" string => readfile("$(G.testfile)","100"); + # So this doubly incorrect split succeeds because of the two conversions + "test4c" + slist => readstringlist( + "$(G.testfile)", "#no comments", "\\\0", "2", "100" + ); - # They are converted here, too, so the split fails - "test4a" slist => readstringlist("$(G.testfile)","#no comments", "\0", "2", "100"); - # And simply quoting the backslash doesn't work, because I think the - # regex is also converted - "test4b" slist => readstringlist("$(G.testfile)","#no comments", "\\0", "2", "100"); + # readstringarray() (or perhaps getindices) simply breaks + "i" + int => readstringarray( + "test5", "$(G.testfile)", "#no comments", "no split", "2", "100" + ); - # So this doubly incorrect split succeeds because of the two conversions - "test4c" slist => readstringlist("$(G.testfile)","#no comments", "\\\0", "2", "100"); + "test5_idx" slist => getindices("test5"); - # readstringarray() (or perhaps getindices) simply breaks - "i" int => readstringarray("test5", "$(G.testfile)","#no comments", "no split", "2", "100"); - "test5_idx" slist => getindices("test5"); + # readstringarrayidx() converts the results (same split issues as test4) + "j" + int => readstringarrayidx( + "test6", "$(G.testfile)", "#no comments", "no split", "2", "100" + ); - # readstringarrayidx() converts the results (same split issues as test4) - "j" int => readstringarrayidx("test6", "$(G.testfile)","#no comments", "no split", "2", "100"); - "test6_idx" slist => getindices("test6"); + "test6_idx" slist => getindices("test6"); - # This shows that the nulls are really there in the file - "od_file" string => execresult("$(G.od) -c $(G.testfile)", "noshell"); + # This shows that the nulls are really there in the file + "od_file" string => execresult("$(G.od) -c $(G.testfile)", "noshell"); reports: cfengine_3:: diff --git a/tests/acceptance/01_vars/02_functions/staging/getindices_size5_namespaces.cf b/tests/acceptance/01_vars/02_functions/staging/getindices_size5_namespaces.cf index 74b3f1da09..132501843b 100644 --- a/tests/acceptance/01_vars/02_functions/staging/getindices_size5_namespaces.cf +++ b/tests/acceptance/01_vars/02_functions/staging/getindices_size5_namespaces.cf @@ -3,23 +3,21 @@ # Test getindices() across namespaces, size 5 # ####################################################### - body common control { - inputs => { "../../../default.sub.cf", "206-namespaced.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf", "206-namespaced.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert; } @@ -27,35 +25,38 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "alpha"; - "beta"; - "gamma's"; - "delta-delta:delta"; - "last"; + "alpha"; + "beta"; + "gamma's"; + "delta-delta:delta"; + "last"; } ####################################################### - bundle agent test { vars: - "array[alpha]" string => "zero"; - "array[beta]" string => "two"; - "array[gamma's]" string => "three's"; - "array[delta-delta:delta]" string => "four-fore:quatre"; - "array[last]" string => "last"; + "array[alpha]" string => "zero"; + "array[beta]" string => "two"; + "array[gamma's]" string => "three's"; + "array[delta-delta:delta]" string => "four-fore:quatre"; + "array[last]" string => "last"; methods: - "run" usebundle => testing_arrays:namespaced_test("$(G.testfile).actual", - "default:test.array"); + "run" + usebundle => testing_arrays:namespaced_test( + "$(G.testfile).actual", "default:test.array" + ); } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/staging/getvalues_size2.cf b/tests/acceptance/01_vars/02_functions/staging/getvalues_size2.cf index 07e2b11499..bff2262ee6 100644 --- a/tests/acceptance/01_vars/02_functions/staging/getvalues_size2.cf +++ b/tests/acceptance/01_vars/02_functions/staging/getvalues_size2.cf @@ -3,21 +3,20 @@ # Test getvalues(), size 2 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert; } @@ -25,22 +24,20 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "zero"; - "one"; + "zero"; + "one"; } ####################################################### - bundle agent test { vars: - "array[alpha]" string => "zero"; - "array[beta]" string => "two"; - - "vals" slist => getvalues("array"); + "array[alpha]" string => "zero"; + "array[beta]" string => "two"; + "vals" slist => getvalues("array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -52,26 +49,27 @@ bundle agent test bundle edit_line test_insert { vars: - "vals" slist => { @{test.vals} }; + "vals" slist => { @{test.vals} }; insert_lines: - "$(vals)"; + "$(vals)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("$(G.testfile).*"); + "any" usebundle => dcs_fini("$(G.testfile).*"); } diff --git a/tests/acceptance/01_vars/02_functions/staging/getvalues_size2_with_expansion.cf b/tests/acceptance/01_vars/02_functions/staging/getvalues_size2_with_expansion.cf index 2ac26bcf98..b7c8bf61cd 100644 --- a/tests/acceptance/01_vars/02_functions/staging/getvalues_size2_with_expansion.cf +++ b/tests/acceptance/01_vars/02_functions/staging/getvalues_size2_with_expansion.cf @@ -3,21 +3,20 @@ # Test getvalues(), size 2 with variable expansion # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert; } @@ -25,29 +24,26 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "one -extra line" - "the end$(const.dollar)fini"; - "XXX dummy XXX"; - "YYY $(init.dummy) YYY"; + "one +extra line"; + "the end$(const.dollar)fini"; + "XXX dummy XXX"; + "YYY $(init.dummy) YYY"; } ####################################################### - bundle agent test { vars: - "array[the fini$end]" string => - "additional line + "array[the fini$end]" string => "additional line again"; - "array[the end$(const.dollar)fini]" string => "one$(const.n)extra line"; - "array[XXX dummy XXX]" string => "XXX dummy XXX"; - "array[YYY $(init.dummy) YYY]" string => "YYY $(init.dummy) YYY"; - - "vals" slist => getvalues("array"); + "array[the end$(const.dollar)fini]" string => "one$(const.n)extra line"; + "array[XXX dummy XXX]" string => "XXX dummy XXX"; + "array[YYY $(init.dummy) YYY]" string => "YYY $(init.dummy) YYY"; + "vals" slist => getvalues("array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -59,26 +55,27 @@ again"; bundle edit_line test_insert { vars: - "vals" slist => { @{test.vals} }; + "vals" slist => { @{test.vals} }; insert_lines: - "$(vals)"; + "$(vals)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("$(G.testfile).*"); + "any" usebundle => dcs_fini("$(G.testfile).*"); } diff --git a/tests/acceptance/01_vars/02_functions/staging/getvalues_size5.cf b/tests/acceptance/01_vars/02_functions/staging/getvalues_size5.cf index dd25ff47bb..bb21d1e725 100644 --- a/tests/acceptance/01_vars/02_functions/staging/getvalues_size5.cf +++ b/tests/acceptance/01_vars/02_functions/staging/getvalues_size5.cf @@ -3,21 +3,20 @@ # Test getvalues(), size 5 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert; } @@ -25,28 +24,26 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "zero"; - "one"; - "three's"; - "four-fore:quatre"; - "last"; + "zero"; + "one"; + "three's"; + "four-fore:quatre"; + "last"; } ####################################################### - bundle agent test { vars: - "array[alpha]" string => "zero"; - "array[beta]" string => "two"; - "array[gamma's]" string => "three's"; - "array[delta-delta:delta]" string => "four-fore:quatre"; - "array[last]" string => "last"; - - "vals" slist => getvalues("array"); + "array[alpha]" string => "zero"; + "array[beta]" string => "two"; + "array[gamma's]" string => "three's"; + "array[delta-delta:delta]" string => "four-fore:quatre"; + "array[last]" string => "last"; + "vals" slist => getvalues("array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -58,26 +55,27 @@ bundle agent test bundle edit_line test_insert { vars: - "vals" slist => { @{test.vals} }; + "vals" slist => { @{test.vals} }; insert_lines: - "$(vals)"; + "$(vals)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("$(G.testfile).*"); + "any" usebundle => dcs_fini("$(G.testfile).*"); } diff --git a/tests/acceptance/01_vars/02_functions/staging/getvalues_size5_with_duplicate_triplicate.cf b/tests/acceptance/01_vars/02_functions/staging/getvalues_size5_with_duplicate_triplicate.cf index e0047dc868..a4ad4c1c79 100644 --- a/tests/acceptance/01_vars/02_functions/staging/getvalues_size5_with_duplicate_triplicate.cf +++ b/tests/acceptance/01_vars/02_functions/staging/getvalues_size5_with_duplicate_triplicate.cf @@ -3,22 +3,21 @@ # Test getvalues(), size 5 with a duplicate and a triplicate # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "zero" string => "zero"; - "one" string => "one"; + "zero" string => "zero"; + "one" string => "one"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert; } @@ -26,25 +25,23 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "zero"; - "one"; + "zero"; + "one"; } ####################################################### - bundle agent test { vars: - "array[alpha]" string => "zero"; - "array[beta]" string => "$(zero)"; - "array[gamma's]" string => "one"; - "array[delta-delta:delta]" string => "$(one)"; - "array[last]" string => "one"; - - "vals" slist => getvalues("array"); + "array[alpha]" string => "zero"; + "array[beta]" string => "$(zero)"; + "array[gamma's]" string => "one"; + "array[delta-delta:delta]" string => "$(one)"; + "array[last]" string => "one"; + "vals" slist => getvalues("array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -56,26 +53,27 @@ bundle agent test bundle edit_line test_insert { vars: - "vals" slist => { @{test.vals} }; + "vals" slist => { @{test.vals} }; insert_lines: - "$(vals)"; + "$(vals)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("$(G.testfile).*"); + "any" usebundle => dcs_fini("$(G.testfile).*"); } diff --git a/tests/acceptance/01_vars/02_functions/staging/host2ip.cf b/tests/acceptance/01_vars/02_functions/staging/host2ip.cf index 183a6c478c..1212ee9f3c 100644 --- a/tests/acceptance/01_vars/02_functions/staging/host2ip.cf +++ b/tests/acceptance/01_vars/02_functions/staging/host2ip.cf @@ -3,66 +3,61 @@ # Test host2ip() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - # Neither of these are likely to change... - "localhost" string => ip2host("127.0.0.1"); - "localhost_6" string => ip2host("::1"); - "a" string => ip2host("198.41.0.4"); - "a_6" string => ip2host("2001:503:ba3e::2:30"); + # Neither of these are likely to change... + "localhost" string => ip2host("127.0.0.1"); + "localhost_6" string => ip2host("::1"); + "a" string => ip2host("198.41.0.4"); + "a_6" string => ip2host("2001:503:ba3e::2:30"); } ####################################################### - bundle agent check { vars: - "localhost" string => "localhost"; - "a" string => "a.root-servers.net"; + "localhost" string => "localhost"; + "a" string => "a.root-servers.net"; classes: - "ok_a" and => { - strcmp("$(test.a)", "$(a)"), - strcmp("$(test.a_6)", "$(a)"), - }; - "ok_localhost" and => { - strcmp("$(test.localhost)", "$(localhost)"), - strcmp("$(test.localhost_6)", "$(localhost)"), - }; - "ok" and => { - "ok_a", - "ok_localhost", + "ok_a" + and => { strcmp("$(test.a)", "$(a)"), strcmp("$(test.a_6)", "$(a)") }; + + "ok_localhost" + and => { + strcmp("$(test.localhost)", "$(localhost)"), + strcmp("$(test.localhost_6)", "$(localhost)"), }; + "ok" and => { "ok_a", "ok_localhost" }; + reports: DEBUG:: "Expected ($(test.localhost) and $(test.localhost_6)) == $(localhost)"; "Expected ($(test.a) and $(test.a_6)) == $(a)"; + ok:: "$(this.promise_filename) Pass"; @@ -71,9 +66,8 @@ bundle agent check } ####################################################### - bundle agent fini { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } diff --git a/tests/acceptance/01_vars/02_functions/staging/parserealarray_duplicate_key.cf b/tests/acceptance/01_vars/02_functions/staging/parserealarray_duplicate_key.cf index ddb1931018..fb6d7fb318 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parserealarray_duplicate_key.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parserealarray_duplicate_key.cf @@ -6,21 +6,19 @@ # 500-519 are readrealarray, 520-539 test the same things for parseintarray # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -28,76 +26,72 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 999.9:888:777:666.6 999.9:000 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parserealarray("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "3"; # 4 lines, but 3 unique keys + "teststr" string => readfile("$(G.testfile)", 1000); + + "cnt" + int => parserealarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); + + "num" int => "3"; + + # 4 lines, but 3 unique keys } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - # The second value should overwrite the first - strcmp("$(test.ary[999.9][0])", "999.9"), - strcmp("$(test.ary[999.9][1])", "0"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + # The second value should overwrite the first + strcmp("$(test.ary[999.9][0])", "999.9"), + strcmp("$(test.ary[999.9][1])", "0"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[999.9][2]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[999.9][2]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[999.9][0] = '999.9', saw '$(test.ary[999.9][0])'"; "expected test.ary[999.9][1] = '0', saw '$(test.ary[999.9][1])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_change_separator_to_s.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_change_separator_to_s.cf index 3f451d8745..ecdf9dcc12 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_change_separator_to_s.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_change_separator_to_s.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,82 +36,65 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarray("ary", "$(teststr)","^#.*","s+",10,1000); - "num" int => "7"; + "teststr" string => readfile("$(G.testfile)", 1000); + "cnt" int => parsestringarray("ary", "$(teststr)", "^#.*", "s+", 10, 1000); + "num" int => "7"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0:1:2][0])", "0:1:2"), - - strcmp("$(test.ary[1:2:3][0])", "1:2:3"), - - strcmp("$(test.ary[here i][0])", "here i"), - strcmp("$(test.ary[here i][1])", ":a line: with space"), - strcmp("$(test.ary[here i][2])", " : in it"), - - strcmp("$(test.ary[blank field][0])", "blank field"), - strcmp("$(test.ary[blank field][2])", "::: in here::"), - - strcmp("$(test.ary[:leading blank field][0])", "leading blank field"), - - strcmp("$(test.ary[thi][0])", "thi"), - strcmp("$(test.ary[thi][1])", ":also"), - strcmp("$(test.ary[thi][2])", "$(const.dollar)test.ary[this][2]"), - strcmp("$(test.ary[thi][3])", "$(const.dollar)test.ary[this][3]"), - - strcmp("$(test.ary[la][0])", "la"), - strcmp("$(test.ary[la][1])", "t:one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0:1:2][0])", "0:1:2"), + strcmp("$(test.ary[1:2:3][0])", "1:2:3"), + strcmp("$(test.ary[here i][0])", "here i"), + strcmp("$(test.ary[here i][1])", ":a line: with space"), + strcmp("$(test.ary[here i][2])", " : in it"), + strcmp("$(test.ary[blank field][0])", "blank field"), + strcmp("$(test.ary[blank field][2])", "::: in here::"), + strcmp("$(test.ary[:leading blank field][0])", "leading blank field"), + strcmp("$(test.ary[thi][0])", "thi"), + strcmp("$(test.ary[thi][1])", ":also"), + strcmp("$(test.ary[thi][2])", "$(const.dollar)test.ary[this][2]"), + strcmp("$(test.ary[thi][3])", "$(const.dollar)test.ary[this][3]"), + strcmp("$(test.ary[la][0])", "la"), + strcmp("$(test.ary[la][1])", "t:one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0:1:2][0] = '0:1:2', saw '$(test.ary[0:1:2][0])'"; - "expected test.ary[1:2:3][0] = '1:2:3', saw '$(test.ary[1:2:3][0])'"; - "expected test.ary[here i][0] = 'here i', saw '$(test.ary[here i][0])'"; "expected test.ary[here i][1] = ':a line: with space', saw '$(test.ary[here i][1])'"; "expected test.ary[here i][2] = ' : in it', saw '$(test.ary[here i][2])'"; - "expected test.ary[blank field][0] = 'blank field', saw '$(test.ary[blank field][0])'"; "expected test.ary[blank field][2] = '::: in here::', saw '$(test.ary[blank field][2])'"; - "expected test.ary[:leading blank field][0] = 'leading blank field', saw '$(test.ary[:leading blank field][0])'"; - "expected test.ary[thi][0] = 'thi', saw '$(test.ary[thi][0])'"; "expected test.ary[thi][1]) = ':also', saw '$(test.ary[thi][1]))'"; "expected test.ary[thi][2]) = '$(const.dollar)test.ary[this][2]', saw '$(test.ary[thi][2]))'"; "expected test.ary[thi][3]) = '$(const.dollar)test.ary[this][3]', saw '$(test.ary[thi][3]))'"; - "expected test.ary[la][0]) = 'la', saw '$(test.ary[la][0]))'"; "expected test.ary[la][1]) = 't:one', saw '$(test.ary[la][1]))'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_dontread_comment_duplicate_lastline.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_dontread_comment_duplicate_lastline.cf index 4338f97387..90c17074a3 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_dontread_comment_duplicate_lastline.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_dontread_comment_duplicate_lastline.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,85 +36,75 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarray("ary", "$(testfile)","NoComment",":",6,1000); - "num" int => "6"; + "teststr" string => readfile("$(G.testfile)", 1000); + + "cnt" + int => parsestringarray("ary", "$(testfile)", "NoComment", ":", 6, 1000); + + "num" int => "6"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[here is][0])", "here is"), - strcmp("$(test.ary[here is][1])", "a line"), - strcmp("$(test.ary[here is][2])", " with spaces "), - strcmp("$(test.ary[here is][3])", " in it"), - - strcmp("$(test.ary[blank][0])", "blank"), - strcmp("$(test.ary[blank][1])", "fields"), - strcmp("$(test.ary[blank][2])", ""), - strcmp("$(test.ary[blank][3])", ""), - strcmp("$(test.ary[blank][4])", "in here"), - strcmp("$(test.ary[blank][5])", ""), - strcmp("$(test.ary[blank][6])", ""), - - strcmp("$(test.ary[][0])", ""), - strcmp("$(test.ary[][1])", "leading blank field"), - - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "is"), - strcmp("$(test.ary[this][2])", "a"), - strcmp("$(test.ary[this][3])", "test"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[here is][0])", "here is"), + strcmp("$(test.ary[here is][1])", "a line"), + strcmp("$(test.ary[here is][2])", " with spaces "), + strcmp("$(test.ary[here is][3])", " in it"), + strcmp("$(test.ary[blank][0])", "blank"), + strcmp("$(test.ary[blank][1])", "fields"), + strcmp("$(test.ary[blank][2])", ""), + strcmp("$(test.ary[blank][3])", ""), + strcmp("$(test.ary[blank][4])", "in here"), + strcmp("$(test.ary[blank][5])", ""), + strcmp("$(test.ary[blank][6])", ""), + strcmp("$(test.ary[][0])", ""), + strcmp("$(test.ary[][1])", "leading blank field"), + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "is"), + strcmp("$(test.ary[this][2])", "a"), + strcmp("$(test.ary[this][3])", "test"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[here is][0] = 'here is', saw '$(test.ary[here is][0])'"; "expected test.ary[here is][1] = 'a line', saw '$(test.ary[here is][1])'"; "expected test.ary[here is][2] = ' with spaces ', saw '$(test.ary[here is][2])'"; "expected test.ary[here is][3] = ' in it', saw '$(test.ary[here is][3])'"; - "expected test.ary[blank][0] = 'blank', saw '$(test.ary[blank][0])'"; "expected test.ary[blank][1] = 'fields', saw '$(test.ary[blank][1])'"; "expected test.ary[blank][2] = '', saw '$(test.ary[blank][2])'"; @@ -125,15 +112,12 @@ bundle agent check "expected test.ary[blank][4] = 'in here', saw '$(test.ary[blank][4])'"; "expected test.ary[blank][5] = '', saw '$(test.ary[blank][5])'"; "expected test.ary[blank][6] = '', saw '$(test.ary[blank][6])'"; - "expected test.ary[][0] = '', saw '$(test.ary[][0])'"; "expected test.ary[][1] = 'leading blank field', saw '$(test.ary[][1])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'is', saw '$(test.ary[this][1])'"; "expected test.ary[this][2] = 'a', saw '$(test.ary[this][2])'"; "expected test.ary[this][3] = 'test', saw '$(test.ary[this][3])'"; - "expected test.ary[# A duplicate follows][0] = '# A duplicate follows', saw '$(test.ary[# A duplicate follows][0])'"; "expected test.ary[# A duplicate follows][1] = 'this line is not always a comment', saw '$(test.ary[# A duplicate follows][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_dontread_comment_duplicate_lastline3.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_dontread_comment_duplicate_lastline3.cf index ca64d6075c..f2ac8963b2 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_dontread_comment_duplicate_lastline3.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_dontread_comment_duplicate_lastline3.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,98 +36,88 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" str => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarrayidx("ary", "$(teststr)","NoComment",":",6,1000); - "num" int => "6"; + "teststr" str => readfile("$(G.testfile)", 1000); + + "cnt" + int => parsestringarrayidx( + "ary", "$(teststr)", "NoComment", ":", 6, 1000 + ); + + "num" int => "6"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "bad" or => { - isvariable("test.ary[6][0]"), - isvariable("test.ary[6][1]"), - - isvariable("test.ary[7][0]"), - isvariable("test.ary[7][1]"), - - isvariable("test.ary[8][0]"), - isvariable("test.ary[8][1]"), + "bad" + or => { + isvariable("test.ary[6][0]"), + isvariable("test.ary[6][1]"), + isvariable("test.ary[7][0]"), + isvariable("test.ary[7][1]"), + isvariable("test.ary[8][0]"), + isvariable("test.ary[8][1]"), }; - "ok" and => { - "!bad", - - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[2][0])", "here is"), - strcmp("$(test.ary[2][1])", "a line"), - strcmp("$(test.ary[2][2])", " with spaces "), - strcmp("$(test.ary[2][3])", " in it"), - - strcmp("$(test.ary[3][0])", "blank"), - strcmp("$(test.ary[3][1])", "fields"), - strcmp("$(test.ary[3][2])", ""), - strcmp("$(test.ary[3][3])", ""), - strcmp("$(test.ary[3][4])", "in here"), - strcmp("$(test.ary[3][5])", ""), - strcmp("$(test.ary[3][6])", ""), - - strcmp("$(test.ary[4][0])", ""), - strcmp("$(test.ary[4][1])", "leading blank field"), - - strcmp("$(test.ary[5][0])", "this"), - strcmp("$(test.ary[5][1])", "is"), - strcmp("$(test.ary[5][2])", "a"), - strcmp("$(test.ary[5][3])", "test"), + "ok" + and => { + "!bad", + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[2][0])", "here is"), + strcmp("$(test.ary[2][1])", "a line"), + strcmp("$(test.ary[2][2])", " with spaces "), + strcmp("$(test.ary[2][3])", " in it"), + strcmp("$(test.ary[3][0])", "blank"), + strcmp("$(test.ary[3][1])", "fields"), + strcmp("$(test.ary[3][2])", ""), + strcmp("$(test.ary[3][3])", ""), + strcmp("$(test.ary[3][4])", "in here"), + strcmp("$(test.ary[3][5])", ""), + strcmp("$(test.ary[3][6])", ""), + strcmp("$(test.ary[4][0])", ""), + strcmp("$(test.ary[4][1])", "leading blank field"), + strcmp("$(test.ary[5][0])", "this"), + strcmp("$(test.ary[5][1])", "is"), + strcmp("$(test.ary[5][2])", "a"), + strcmp("$(test.ary[5][3])", "test"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[2][0] = 'here is', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = 'a line', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = ' with spaces ', saw '$(test.ary[2][2])'"; "expected test.ary[2][3] = ' in it', saw '$(test.ary[2][3])'"; - "expected test.ary[3][0] = 'blank', saw '$(test.ary[3][0])'"; "expected test.ary[3][1] = 'fields', saw '$(test.ary[3][1])'"; "expected test.ary[3][2] = '', saw '$(test.ary[3][2])'"; @@ -138,10 +125,8 @@ bundle agent check "expected test.ary[3][4] = 'in here', saw '$(test.ary[3][4])'"; "expected test.ary[3][5] = '', saw '$(test.ary[3][5])'"; "expected test.ary[3][6] = '', saw '$(test.ary[3][6])'"; - "expected test.ary[4][0] = '', saw '$(test.ary[4][0])'"; "expected test.ary[4][1] = 'leading blank field', saw '$(test.ary[4][1])'"; - "expected test.ary[5][0] = 'this', saw '$(test.ary[5][0])'"; "expected test.ary[5][1] = 'is', saw '$(test.ary[5][1])'"; "expected test.ary[5][2] = 'a', saw '$(test.ary[5][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_introduce_duplicate_key.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_introduce_duplicate_key.cf index 23ef513a92..71a1e71a5c 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_introduce_duplicate_key.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_introduce_duplicate_key.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,76 +27,72 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 this:is:a:test this:too 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarray("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "3"; # 4 lines, but 3 unique keys + "teststr" string => readfile("$(G.testfile)", 1000); + + "cnt" + int => parsestringarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); + + "num" int => "3"; + + # 4 lines, but 3 unique keys } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - # The second value should overwrite the first - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "too"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + # The second value should overwrite the first + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "too"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[this][2]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[this][2]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'too', saw '$(test.ary[this][1])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_introduce_nonparsed_comment.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_introduce_nonparsed_comment.cf index 52efa28504..7b1031ffea 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_introduce_nonparsed_comment.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_introduce_nonparsed_comment.cf @@ -7,29 +7,26 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "testfile" string => "/tmp/TEST.cfengine"; + "testfile" string => "/tmp/TEST.cfengine"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -37,84 +34,79 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 # Not parsed as a comment this:is:a:test 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarray("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "4"; + "teststr" string => readfile("$(G.testfile)", 1000); + + "cnt" + int => parsestringarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); + + "num" int => "4"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "is"), - strcmp("$(test.ary[this][2])", "a"), - strcmp("$(test.ary[this][3])", "test"), - - strcmp("$(test.ary[# Not parsed as a comment][0])", "# Not parsed as a comment"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "is"), + strcmp("$(test.ary[this][2])", "a"), + strcmp("$(test.ary[this][3])", "test"), + strcmp( + "$(test.ary[# Not parsed as a comment][0])", + "# Not parsed as a comment" + ), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[# Not parsed as a comment][1]"), - isvariable("test.ary[this][4]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[# Not parsed as a comment][1]"), + isvariable("test.ary[this][4]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[# Not parsed as a comment][0] = '# Not parsed as a comment', saw 'expected $(test.ary[# Not parsed as a comment][0])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'is', saw '$(test.ary[this][1])'"; "expected test.ary[this][2] = 'a', saw '$(test.ary[this][2])'"; "expected test.ary[this][3] = 'test', saw '$(test.ary[this][3])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_change_comment_parsing.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_change_comment_parsing.cf index 5f2cb78dd8..168c1fb3a6 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_change_comment_parsing.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_change_comment_parsing.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,91 +36,81 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarray("ary", "$(teststr)","",":",10,1000); - "num" int => "8"; + "teststr" string => readfile("$(G.testfile)", 1000); + "cnt" int => parsestringarray("ary", "$(teststr)", "", ":", 10, 1000); + "num" int => "8"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[here is][0])", "here is"), - strcmp("$(test.ary[here is][1])", "a line"), - strcmp("$(test.ary[here is][2])", " with spaces "), - strcmp("$(test.ary[here is][3])", " in it"), - - strcmp("$(test.ary[blank][0])", "blank"), - strcmp("$(test.ary[blank][1])", "fields"), - strcmp("$(test.ary[blank][2])", ""), - strcmp("$(test.ary[blank][3])", ""), - strcmp("$(test.ary[blank][4])", "in here"), - strcmp("$(test.ary[blank][5])", ""), - strcmp("$(test.ary[blank][6])", ""), - - strcmp("$(test.ary[][0])", ""), - strcmp("$(test.ary[][1])", "leading blank field"), - - strcmp("$(test.ary[# A duplicate follows][0])", "# A duplicate follows"), - strcmp("$(test.ary[# A duplicate follows][1])", "this line is not always a comment"), - - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "also"), - strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), - strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), - - strcmp("$(test.ary[last][0])", "last"), - strcmp("$(test.ary[last][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[here is][0])", "here is"), + strcmp("$(test.ary[here is][1])", "a line"), + strcmp("$(test.ary[here is][2])", " with spaces "), + strcmp("$(test.ary[here is][3])", " in it"), + strcmp("$(test.ary[blank][0])", "blank"), + strcmp("$(test.ary[blank][1])", "fields"), + strcmp("$(test.ary[blank][2])", ""), + strcmp("$(test.ary[blank][3])", ""), + strcmp("$(test.ary[blank][4])", "in here"), + strcmp("$(test.ary[blank][5])", ""), + strcmp("$(test.ary[blank][6])", ""), + strcmp("$(test.ary[][0])", ""), + strcmp("$(test.ary[][1])", "leading blank field"), + strcmp( + "$(test.ary[# A duplicate follows][0])", "# A duplicate follows" + ), + strcmp( + "$(test.ary[# A duplicate follows][1])", + "this line is not always a comment" + ), + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "also"), + strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), + strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), + strcmp("$(test.ary[last][0])", "last"), + strcmp("$(test.ary[last][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[here is][0] = 'here is', saw '$(test.ary[here is][0])'"; "expected test.ary[here is][1] = 'a line', saw '$(test.ary[here is][1])'"; "expected test.ary[here is][2] = ' with spaces ', saw '$(test.ary[here is][2])'"; "expected test.ary[here is][3] = ' in it', saw '$(test.ary[here is][3])'"; - "expected test.ary[blank][0] = 'blank', saw '$(test.ary[blank][0])'"; "expected test.ary[blank][1] = 'fields', saw '$(test.ary[blank][1])'"; "expected test.ary[blank][2] = '', saw '$(test.ary[blank][2])'"; @@ -131,18 +118,14 @@ bundle agent check "expected test.ary[blank][4] = 'in here', saw '$(test.ary[blank][4])'"; "expected test.ary[blank][5] = '', saw '$(test.ary[blank][5])'"; "expected test.ary[blank][6] = '', saw '$(test.ary[blank][6])'"; - "expected test.ary[][0] = '', saw '$(test.ary[][0])'"; "expected test.ary[][1] = 'leading blank field', saw '$(test.ary[][1])'"; - "expected test.ary[# A duplicate follows][0] = '# A duplicate follows', saw '$(test.ary[# A duplicate follows][0])'"; "expected test.ary[# A duplicate follows][1] = 'this line is not always a comment', saw '$(test.ary[# A duplicate follows][1])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'also', saw '$(test.ary[this][1])'"; "expected test.ary[this][2] = '$(const.dollar)test.ary[this][2]', saw '$(test.ary[this][2])'"; "expected test.ary[this][3] = '$(const.dollar)test.ary[this][3]', saw '$(test.ary[this][3])'"; - "expected test.ary[last][0] = 'last', saw '$(test.ary[last][0])'"; "expected test.ary[last][1] = 'one', saw '$(test.ary[last][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_change_comment_parsing2.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_change_comment_parsing2.cf index fbafc98052..e617dd9335 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_change_comment_parsing2.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_change_comment_parsing2.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,94 +36,78 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" str => readfile("$(G.testfile)","",":"1000); - "cnt" int => parsestringarrayidx("ary", "$(teststr)","",":",10,1000); - "num" int => "9"; + "teststr" str => readfile("$(G.testfile)", "", ":"1000); + "cnt" int => parsestringarrayidx("ary", "$(teststr)", "", ":", 10, 1000); + "num" int => "9"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[2][0])", "here is"), - strcmp("$(test.ary[2][1])", "a line"), - strcmp("$(test.ary[2][2])", " with spaces "), - strcmp("$(test.ary[2][3])", " in it"), - - strcmp("$(test.ary[3][0])", "blank"), - strcmp("$(test.ary[3][1])", "fields"), - strcmp("$(test.ary[3][2])", ""), - strcmp("$(test.ary[3][3])", ""), - strcmp("$(test.ary[3][4])", "in here"), - strcmp("$(test.ary[3][5])", ""), - strcmp("$(test.ary[3][6])", ""), - - strcmp("$(test.ary[4][0])", ""), - strcmp("$(test.ary[4][1])", "leading blank field"), - - strcmp("$(test.ary[5][0])", "this"), - strcmp("$(test.ary[5][1])", "is"), - strcmp("$(test.ary[5][2])", "a"), - strcmp("$(test.ary[5][3])", "test"), - - strcmp("$(test.ary[6][0])", "# A duplicate follows"), - strcmp("$(test.ary[6][1])", " this line is not always a comment"), - - strcmp("$(test.ary[7][0])", "this"), - strcmp("$(test.ary[7][1])", "also"), - - strcmp("$(test.ary[8][0])", "last"), - strcmp("$(test.ary[8][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[2][0])", "here is"), + strcmp("$(test.ary[2][1])", "a line"), + strcmp("$(test.ary[2][2])", " with spaces "), + strcmp("$(test.ary[2][3])", " in it"), + strcmp("$(test.ary[3][0])", "blank"), + strcmp("$(test.ary[3][1])", "fields"), + strcmp("$(test.ary[3][2])", ""), + strcmp("$(test.ary[3][3])", ""), + strcmp("$(test.ary[3][4])", "in here"), + strcmp("$(test.ary[3][5])", ""), + strcmp("$(test.ary[3][6])", ""), + strcmp("$(test.ary[4][0])", ""), + strcmp("$(test.ary[4][1])", "leading blank field"), + strcmp("$(test.ary[5][0])", "this"), + strcmp("$(test.ary[5][1])", "is"), + strcmp("$(test.ary[5][2])", "a"), + strcmp("$(test.ary[5][3])", "test"), + strcmp("$(test.ary[6][0])", "# A duplicate follows"), + strcmp("$(test.ary[6][1])", " this line is not always a comment"), + strcmp("$(test.ary[7][0])", "this"), + strcmp("$(test.ary[7][1])", "also"), + strcmp("$(test.ary[8][0])", "last"), + strcmp("$(test.ary[8][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[2][0] = 'here is', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = 'a line', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = ' with spaces ', saw '$(test.ary[2][2])'"; "expected test.ary[2][3] = ' in it', saw '$(test.ary[2][3])'"; - "expected test.ary[3][0] = 'blank', saw '$(test.ary[3][0])'"; "expected test.ary[3][1] = 'fields', saw '$(test.ary[3][1])'"; "expected test.ary[3][2] = '', saw '$(test.ary[3][2])'"; @@ -134,21 +115,16 @@ bundle agent check "expected test.ary[3][4] = 'in here', saw '$(test.ary[3][4])'"; "expected test.ary[3][5] = '', saw '$(test.ary[3][5])'"; "expected test.ary[3][6] = '', saw '$(test.ary[3][6])'"; - "expected test.ary[4][0] = '', saw '$(test.ary[4][0])'"; "expected test.ary[4][1] = 'leading blank field', saw '$(test.ary[4][1])'"; - "expected test.ary[5][0] = 'this', saw '$(test.ary[5][0])'"; "expected test.ary[5][1] = 'is', saw '$(test.ary[5][1])'"; "expected test.ary[5][2] = 'a', saw '$(test.ary[5][2])'"; "expected test.ary[5][3] = 'test', saw '$(test.ary[5][3])'"; - "expected test.ary[6][0] = '# A duplicate follows', saw '$(test.ary[6][0])'"; "expected test.ary[6][1] = ' this line is not always a comment', saw '$(test.ary[6][1])'"; - "expected test.ary[7][0] = 'this', saw '$(test.ary[7][0])'"; "expected test.ary[7][1] = 'also', saw '$(test.ary[7][1])'"; - "expected test.ary[8][0] = 'last', saw '$(test.ary[8][0])'"; "expected test.ary[8][1] = 'one', saw '$(test.ary[8][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_duplicates_trailing_newlines.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_duplicates_trailing_newlines.cf index d0c7d12dbe..6e8edbf807 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_duplicates_trailing_newlines.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_duplicates_trailing_newlines.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -42,116 +39,108 @@ last:one "; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarray("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "8"; + "teststr" string => readfile("$(G.testfile)", 1000); + + "cnt" + int => parsestringarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); + + "num" int => "8"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)", - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[here is][0])", "here is"), - strcmp("$(test.ary[here is][1])", "a line"), - strcmp("$(test.ary[here is][2])", " with spaces "), - strcmp("$(test.ary[here is][3])", " in it"), - - strcmp("$(test.ary[blank][0])", "blank"), - strcmp("$(test.ary[blank][1])", "fields"), - strcmp("$(test.ary[blank][2])", ""), - strcmp("$(test.ary[blank][3])", ""), - strcmp("$(test.ary[blank][4])", "in here"), - strcmp("$(test.ary[blank][5])", ""), - strcmp("$(test.ary[blank][6])", ""), - - strcmp("$(test.ary[][0])", ""), - strcmp("$(test.ary[][1])", "leading blank field"), - - strcmp("$(test.ary[# A duplicate follows][0])", "# A duplicate follows"), - strcmp("$(test.ary[# A duplicate follows][1])", "this line is not always a comment"), - - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "also"), - strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), - strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), - - strcmp("$(test.ary[last][0])", "last"), - strcmp("$(test.ary[last][1])", "one"), - }; + "ok" + and => { + strcmp( + "$(test.num)", + "$(test.cnt)", + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[here is][0])", "here is"), + strcmp("$(test.ary[here is][1])", "a line"), + strcmp("$(test.ary[here is][2])", " with spaces "), + strcmp("$(test.ary[here is][3])", " in it"), + strcmp("$(test.ary[blank][0])", "blank"), + strcmp("$(test.ary[blank][1])", "fields"), + strcmp("$(test.ary[blank][2])", ""), + strcmp("$(test.ary[blank][3])", ""), + strcmp("$(test.ary[blank][4])", "in here"), + strcmp("$(test.ary[blank][5])", ""), + strcmp("$(test.ary[blank][6])", ""), + strcmp("$(test.ary[][0])", ""), + strcmp("$(test.ary[][1])", "leading blank field"), + strcmp( + "$(test.ary[# A duplicate follows][0])", "# A duplicate follows" + ), + strcmp( + "$(test.ary[# A duplicate follows][1])", + "this line is not always a comment" + ), + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "also"), + strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), + strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), + strcmp("$(test.ary[last][0])", "last"), + strcmp("$(test.ary[last][1])", "one") + , + }; reports: DEBUG:: - "expected $(test.num) entries, saw $(test.cnt)"; - - "saw array indices '$(idx)'"; - - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; - "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; - "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; - "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; - "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - - "expected test.ary[here is][0] = 'here is', saw '$(test.ary[here is][0])'"; - "expected test.ary[here is][1] = 'a line', saw '$(test.ary[here is][1])'"; - "expected test.ary[here is][2] = ' with spaces ', saw '$(test.ary[here is][2])'"; - "expected test.ary[here is][3] = ' in it', saw '$(test.ary[here is][3])'"; - - "expected test.ary[blank][0] = 'blank', saw '$(test.ary[blank][0])'"; - "expected test.ary[blank][1] = 'fields', saw '$(test.ary[blank][1])'"; - "expected test.ary[blank][2] = '', saw '$(test.ary[blank][2])'"; - "expected test.ary[blank][3] = '', saw '$(test.ary[blank][3])'"; - "expected test.ary[blank][4] = 'in here', saw '$(test.ary[blank][4])'"; - "expected test.ary[blank][5] = '', saw '$(test.ary[blank][5])'"; - "expected test.ary[blank][6] = '', saw '$(test.ary[blank][6])'"; - - "expected test.ary[][0] = '', saw '$(test.ary[][0])'"; - "expected test.ary[][1] = 'leading blank field', saw '$(test.ary[][1])'"; - - "expected test.ary[# A duplicate follows][0] = '# A duplicate follows', saw '$(test.ary[# A duplicate follows][0])'"; - "expected test.ary[# A duplicate follows][1] = 'this line is not always a comment', saw '$(test.ary[# A duplicate follows][1])'"; - - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; - "expected test.ary[this][1] = 'also', saw '$(test.ary[this][1])'"; - "expected test.ary[this][2] = '$(const.dollar)test.ary[this][2]', saw '$(test.ary[this][2])'"; - "expected test.ary[this][3] = '$(const.dollar)test.ary[this][3]', saw '$(test.ary[this][3])'"; - - "expected test.ary[last][0] = 'last', saw '$(test.ary[last][0])'"; - "expected test.ary[last][1] = 'one', saw '$(test.ary[last][1])'"; + "expected $(test.num) entries, saw $(test.cnt)"; + "saw array indices '$(idx)'"; + "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; + "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; + "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; + "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; + "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; + "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; + "expected test.ary[here is][0] = 'here is', saw '$(test.ary[here is][0])'"; + "expected test.ary[here is][1] = 'a line', saw '$(test.ary[here is][1])'"; + "expected test.ary[here is][2] = ' with spaces ', saw '$(test.ary[here is][2])'"; + "expected test.ary[here is][3] = ' in it', saw '$(test.ary[here is][3])'"; + "expected test.ary[blank][0] = 'blank', saw '$(test.ary[blank][0])'"; + "expected test.ary[blank][1] = 'fields', saw '$(test.ary[blank][1])'"; + "expected test.ary[blank][2] = '', saw '$(test.ary[blank][2])'"; + "expected test.ary[blank][3] = '', saw '$(test.ary[blank][3])'"; + "expected test.ary[blank][4] = 'in here', saw '$(test.ary[blank][4])'"; + "expected test.ary[blank][5] = '', saw '$(test.ary[blank][5])'"; + "expected test.ary[blank][6] = '', saw '$(test.ary[blank][6])'"; + "expected test.ary[][0] = '', saw '$(test.ary[][0])'"; + "expected test.ary[][1] = 'leading blank field', saw '$(test.ary[][1])'"; + "expected test.ary[# A duplicate follows][0] = '# A duplicate follows', saw '$(test.ary[# A duplicate follows][0])'"; + "expected test.ary[# A duplicate follows][1] = 'this line is not always a comment', saw '$(test.ary[# A duplicate follows][1])'"; + "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; + "expected test.ary[this][1] = 'also', saw '$(test.ary[this][1])'"; + "expected test.ary[this][2] = '$(const.dollar)test.ary[this][2]', saw '$(test.ary[this][2])'"; + "expected test.ary[this][3] = '$(const.dollar)test.ary[this][3]', saw '$(test.ary[this][3])'"; + "expected test.ary[last][0] = 'last', saw '$(test.ary[last][0])'"; + "expected test.ary[last][1] = 'one', saw '$(test.ary[last][1])'"; ok:: - "$(this.promise_filename) Pass"; + "$(this.promise_filename) Pass"; !ok:: - "$(this.promise_filename) FAIL"; - } + "$(this.promise_filename) FAIL"; +} diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_duplicates_trailing_newlines2.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_duplicates_trailing_newlines2.cf index ea5702a600..0936f2cdcd 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_duplicates_trailing_newlines2.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_duplicates_trailing_newlines2.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -42,94 +39,83 @@ last:one "; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" str => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarrayidx("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "9"; + "teststr" str => readfile("$(G.testfile)", 1000); + + "cnt" + int => parsestringarrayidx( + "ary", "$(teststr)", "NoComment", ":", 10, 1000 + ); + + "num" int => "9"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[2][0])", "here is"), - strcmp("$(test.ary[2][1])", "a line"), - strcmp("$(test.ary[2][2])", " with spaces "), - strcmp("$(test.ary[2][3])", " in it"), - - strcmp("$(test.ary[3][0])", "blank"), - strcmp("$(test.ary[3][1])", "fields"), - strcmp("$(test.ary[3][2])", ""), - strcmp("$(test.ary[3][3])", ""), - strcmp("$(test.ary[3][4])", "in here"), - strcmp("$(test.ary[3][5])", ""), - strcmp("$(test.ary[3][6])", ""), - - strcmp("$(test.ary[4][0])", ""), - strcmp("$(test.ary[4][1])", "leading blank field"), - - strcmp("$(test.ary[5][0])", "this"), - strcmp("$(test.ary[5][1])", "is"), - strcmp("$(test.ary[5][2])", "a"), - strcmp("$(test.ary[5][3])", "test"), - - strcmp("$(test.ary[6][0])", "# A duplicate follows"), - strcmp("$(test.ary[6][1])", " this line is not always a comment"), - - strcmp("$(test.ary[7][0])", "this"), - strcmp("$(test.ary[7][1])", "also"), - - strcmp("$(test.ary[8][0])", "last"), - strcmp("$(test.ary[8][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[2][0])", "here is"), + strcmp("$(test.ary[2][1])", "a line"), + strcmp("$(test.ary[2][2])", " with spaces "), + strcmp("$(test.ary[2][3])", " in it"), + strcmp("$(test.ary[3][0])", "blank"), + strcmp("$(test.ary[3][1])", "fields"), + strcmp("$(test.ary[3][2])", ""), + strcmp("$(test.ary[3][3])", ""), + strcmp("$(test.ary[3][4])", "in here"), + strcmp("$(test.ary[3][5])", ""), + strcmp("$(test.ary[3][6])", ""), + strcmp("$(test.ary[4][0])", ""), + strcmp("$(test.ary[4][1])", "leading blank field"), + strcmp("$(test.ary[5][0])", "this"), + strcmp("$(test.ary[5][1])", "is"), + strcmp("$(test.ary[5][2])", "a"), + strcmp("$(test.ary[5][3])", "test"), + strcmp("$(test.ary[6][0])", "# A duplicate follows"), + strcmp("$(test.ary[6][1])", " this line is not always a comment"), + strcmp("$(test.ary[7][0])", "this"), + strcmp("$(test.ary[7][1])", "also"), + strcmp("$(test.ary[8][0])", "last"), + strcmp("$(test.ary[8][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[2][0] = 'here is', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = 'a line', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = ' with spaces ', saw '$(test.ary[2][2])'"; "expected test.ary[2][3] = ' in it', saw '$(test.ary[2][3])'"; - "expected test.ary[3][0] = 'blank', saw '$(test.ary[3][0])'"; "expected test.ary[3][1] = 'fields', saw '$(test.ary[3][1])'"; "expected test.ary[3][2] = '', saw '$(test.ary[3][2])'"; @@ -137,21 +123,16 @@ bundle agent check "expected test.ary[3][4] = 'in here', saw '$(test.ary[3][4])'"; "expected test.ary[3][5] = '', saw '$(test.ary[3][5])'"; "expected test.ary[3][6] = '', saw '$(test.ary[3][6])'"; - "expected test.ary[4][0] = '', saw '$(test.ary[4][0])'"; "expected test.ary[4][1] = 'leading blank field', saw '$(test.ary[4][1])'"; - "expected test.ary[5][0] = 'this', saw '$(test.ary[5][0])'"; "expected test.ary[5][1] = 'is', saw '$(test.ary[5][1])'"; "expected test.ary[5][2] = 'a', saw '$(test.ary[5][2])'"; "expected test.ary[5][3] = 'test', saw '$(test.ary[5][3])'"; - "expected test.ary[6][0] = '# A duplicate follows', saw '$(test.ary[6][0])'"; "expected test.ary[6][1] = ' this line is not always a comment', saw '$(test.ary[6][1])'"; - "expected test.ary[7][0] = 'this', saw '$(test.ary[7][0])'"; "expected test.ary[7][1] = 'also', saw '$(test.ary[7][1])'"; - "expected test.ary[8][0] = 'last', saw '$(test.ary[8][0])'"; "expected test.ary[8][1] = 'one', saw '$(test.ary[8][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments.cf index 8e0bc6520b..64eed43aa2 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,88 +36,74 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarray("ary", "$(teststr)","^#.*",":",10,1000); - "num" int => "7"; + "teststr" string => readfile("$(G.testfile)", 1000); + "cnt" int => parsestringarray("ary", "$(teststr)", "^#.*", ":", 10, 1000); + "num" int => "7"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[here is][0])", "here is"), - strcmp("$(test.ary[here is][1])", "a line"), - strcmp("$(test.ary[here is][2])", " with spaces "), - strcmp("$(test.ary[here is][3])", " in it"), - - strcmp("$(test.ary[blank][0])", "blank"), - strcmp("$(test.ary[blank][0])", "fields"), - strcmp("$(test.ary[blank][0])", ""), - strcmp("$(test.ary[blank][0])", ""), - strcmp("$(test.ary[blank][0])", "in here"), - strcmp("$(test.ary[blank][0])", ""), - strcmp("$(test.ary[blank][0])", ""), - - strcmp("$(test.ary[][0])", ""), - strcmp("$(test.ary[][1])", "leading blank field"), - - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "also"), - strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), - strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), - - strcmp("$(test.ary[last][0])", "last"), - strcmp("$(test.ary[last][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[here is][0])", "here is"), + strcmp("$(test.ary[here is][1])", "a line"), + strcmp("$(test.ary[here is][2])", " with spaces "), + strcmp("$(test.ary[here is][3])", " in it"), + strcmp("$(test.ary[blank][0])", "blank"), + strcmp("$(test.ary[blank][0])", "fields"), + strcmp("$(test.ary[blank][0])", ""), + strcmp("$(test.ary[blank][0])", ""), + strcmp("$(test.ary[blank][0])", "in here"), + strcmp("$(test.ary[blank][0])", ""), + strcmp("$(test.ary[blank][0])", ""), + strcmp("$(test.ary[][0])", ""), + strcmp("$(test.ary[][1])", "leading blank field"), + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "also"), + strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), + strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), + strcmp("$(test.ary[last][0])", "last"), + strcmp("$(test.ary[last][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[here is][0] = 'here is', saw '$(test.ary[here is][0])'"; "expected test.ary[here is][1] = 'a line', saw '$(test.ary[here is][1])'"; "expected test.ary[here is][2] = ' with spaces ', saw '$(test.ary[here is][2])'"; "expected test.ary[here is][3] = ' in it', saw '$(test.ary[here is][3])'"; - "expected test.ary[blank][0] = 'blank', saw '$(test.ary[blank][0])'"; "expected test.ary[blank][0] = 'fields', saw '$(test.ary[blank][0])'"; "expected test.ary[blank][0] = '', saw '$(test.ary[blank][0])'"; @@ -128,18 +111,14 @@ bundle agent check "expected test.ary[blank][0] = 'in here', saw '$(test.ary[blank][0])'"; "expected test.ary[blank][0] = '', saw '$(test.ary[blank][0])'"; "expected test.ary[blank][0] = '', saw '$(test.ary[blank][0])'"; - "expected test.ary[][0] = '', saw '$(test.ary[][0])'"; "expected test.ary[][1] = 'leading blank field', saw '$(test.ary[][1])'"; - "expected test.ary[# A duplicate follows][0] = '# A duplicate follows', saw '$(test.ary[# A duplicate follows][0])'"; "expected test.ary[# A duplicate follows][1] = 'this line is not always a comment', saw '$(test.ary[# A duplicate follows][1])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'also', saw '$(test.ary[this][1])'"; "expected test.ary[this][2] = '$(const.dollar)test.ary[this][2]', saw '$(test.ary[this][2])'"; "expected test.ary[this][3] = '$(const.dollar)test.ary[this][3]', saw '$(test.ary[this][3])'"; - "expected test.ary[last][0] = 'last', saw '$(test.ary[last][0])'"; "expected test.ary[last][1] = 'one', saw '$(test.ary[last][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments2.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments2.cf index d4870274cc..c4d616e97f 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments2.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments2.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,90 +36,77 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarrayidx("ary", "$(G.testfile)","^#.*",":",10,1000); - "num" int => "8"; + "cnt" + int => readstringarrayidx("ary", "$(G.testfile)", "^#.*", ":", 10, 1000); + + "num" int => "8"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[2][0])", "here is"), - strcmp("$(test.ary[2][1])", "a line"), - strcmp("$(test.ary[2][2])", " with spaces "), - strcmp("$(test.ary[2][3])", " in it"), - - strcmp("$(test.ary[3][0])", "blank"), - strcmp("$(test.ary[3][1])", "fields"), - strcmp("$(test.ary[3][2])", ""), - strcmp("$(test.ary[3][3])", ""), - strcmp("$(test.ary[3][4])", "in here"), - strcmp("$(test.ary[3][5])", ""), - strcmp("$(test.ary[3][6])", ""), - - strcmp("$(test.ary[4][0])", ""), - strcmp("$(test.ary[4][1])", "leading blank field"), - - strcmp("$(test.ary[5][0])", "this"), - strcmp("$(test.ary[5][1])", "is"), - strcmp("$(test.ary[5][2])", "a"), - strcmp("$(test.ary[5][3])", "test"), - - strcmp("$(test.ary[6][0])", "this"), - strcmp("$(test.ary[6][1])", "also"), - - strcmp("$(test.ary[7][0])", "last"), - strcmp("$(test.ary[7][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[2][0])", "here is"), + strcmp("$(test.ary[2][1])", "a line"), + strcmp("$(test.ary[2][2])", " with spaces "), + strcmp("$(test.ary[2][3])", " in it"), + strcmp("$(test.ary[3][0])", "blank"), + strcmp("$(test.ary[3][1])", "fields"), + strcmp("$(test.ary[3][2])", ""), + strcmp("$(test.ary[3][3])", ""), + strcmp("$(test.ary[3][4])", "in here"), + strcmp("$(test.ary[3][5])", ""), + strcmp("$(test.ary[3][6])", ""), + strcmp("$(test.ary[4][0])", ""), + strcmp("$(test.ary[4][1])", "leading blank field"), + strcmp("$(test.ary[5][0])", "this"), + strcmp("$(test.ary[5][1])", "is"), + strcmp("$(test.ary[5][2])", "a"), + strcmp("$(test.ary[5][3])", "test"), + strcmp("$(test.ary[6][0])", "this"), + strcmp("$(test.ary[6][1])", "also"), + strcmp("$(test.ary[7][0])", "last"), + strcmp("$(test.ary[7][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[2][0] = 'here is', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = 'a line', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = ' with spaces ', saw '$(test.ary[2][2])'"; "expected test.ary[2][3] = ' in it', saw '$(test.ary[2][3])'"; - "expected test.ary[3][0] = 'blank', saw '$(test.ary[3][0])'"; "expected test.ary[3][1] = 'fields', saw '$(test.ary[3][1])'"; "expected test.ary[3][2] = '', saw '$(test.ary[3][2])'"; @@ -130,18 +114,14 @@ bundle agent check "expected test.ary[3][4] = 'in here', saw '$(test.ary[3][4])'"; "expected test.ary[3][5] = '', saw '$(test.ary[3][5])'"; "expected test.ary[3][6] = '', saw '$(test.ary[3][6])'"; - "expected test.ary[4][0] = '', saw '$(test.ary[4][0])'"; "expected test.ary[4][1] = 'leading blank field', saw '$(test.ary[4][1])'"; - "expected test.ary[5][0] = 'this', saw '$(test.ary[5][0])'"; "expected test.ary[5][1] = 'is', saw '$(test.ary[5][1])'"; "expected test.ary[5][2] = 'a', saw '$(test.ary[5][2])'"; "expected test.ary[5][3] = 'test', saw '$(test.ary[5][3])'"; - "expected test.ary[6][0] = 'this', saw '$(test.ary[6][0])'"; "expected test.ary[6][1] = 'also', saw '$(test.ary[6][1])'"; - "expected test.ary[7][0] = 'last', saw '$(test.ary[7][0])'"; "expected test.ary[7][1] = 'one', saw '$(test.ary[7][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments3.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments3.cf index c53b101b08..196f151fc1 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments3.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments3.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,91 +36,79 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" str => readfile("$(G.testfile)","^#.*",":"1000); - "cnt" int => parsestringarrayidx("ary", "$(teststr)","^#.*",":",10,1000); - "num" int => "8"; + "teststr" str => readfile("$(G.testfile)", "^#.*", ":"1000); + + "cnt" + int => parsestringarrayidx("ary", "$(teststr)", "^#.*", ":", 10, 1000); + + "num" int => "8"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[2][0])", "here is"), - strcmp("$(test.ary[2][1])", "a line"), - strcmp("$(test.ary[2][2])", " with spaces "), - strcmp("$(test.ary[2][3])", " in it"), - - strcmp("$(test.ary[3][0])", "blank"), - strcmp("$(test.ary[3][1])", "fields"), - strcmp("$(test.ary[3][2])", ""), - strcmp("$(test.ary[3][3])", ""), - strcmp("$(test.ary[3][4])", "in here"), - strcmp("$(test.ary[3][5])", ""), - strcmp("$(test.ary[3][6])", ""), - - strcmp("$(test.ary[4][0])", ""), - strcmp("$(test.ary[4][1])", "leading blank field"), - - strcmp("$(test.ary[5][0])", "this"), - strcmp("$(test.ary[5][1])", "is"), - strcmp("$(test.ary[5][2])", "a"), - strcmp("$(test.ary[5][3])", "test"), - - strcmp("$(test.ary[6][0])", "this"), - strcmp("$(test.ary[6][1])", "also"), - - strcmp("$(test.ary[7][0])", "last"), - strcmp("$(test.ary[7][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[2][0])", "here is"), + strcmp("$(test.ary[2][1])", "a line"), + strcmp("$(test.ary[2][2])", " with spaces "), + strcmp("$(test.ary[2][3])", " in it"), + strcmp("$(test.ary[3][0])", "blank"), + strcmp("$(test.ary[3][1])", "fields"), + strcmp("$(test.ary[3][2])", ""), + strcmp("$(test.ary[3][3])", ""), + strcmp("$(test.ary[3][4])", "in here"), + strcmp("$(test.ary[3][5])", ""), + strcmp("$(test.ary[3][6])", ""), + strcmp("$(test.ary[4][0])", ""), + strcmp("$(test.ary[4][1])", "leading blank field"), + strcmp("$(test.ary[5][0])", "this"), + strcmp("$(test.ary[5][1])", "is"), + strcmp("$(test.ary[5][2])", "a"), + strcmp("$(test.ary[5][3])", "test"), + strcmp("$(test.ary[6][0])", "this"), + strcmp("$(test.ary[6][1])", "also"), + strcmp("$(test.ary[7][0])", "last"), + strcmp("$(test.ary[7][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[2][0] = 'here is', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = 'a line', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = ' with spaces ', saw '$(test.ary[2][2])'"; "expected test.ary[2][3] = ' in it', saw '$(test.ary[2][3])'"; - "expected test.ary[3][0] = 'blank', saw '$(test.ary[3][0])'"; "expected test.ary[3][1] = 'fields', saw '$(test.ary[3][1])'"; "expected test.ary[3][2] = '', saw '$(test.ary[3][2])'"; @@ -131,18 +116,14 @@ bundle agent check "expected test.ary[3][4] = 'in here', saw '$(test.ary[3][4])'"; "expected test.ary[3][5] = '', saw '$(test.ary[3][5])'"; "expected test.ary[3][6] = '', saw '$(test.ary[3][6])'"; - "expected test.ary[4][0] = '', saw '$(test.ary[4][0])'"; "expected test.ary[4][1] = 'leading blank field', saw '$(test.ary[4][1])'"; - "expected test.ary[5][0] = 'this', saw '$(test.ary[5][0])'"; "expected test.ary[5][1] = 'is', saw '$(test.ary[5][1])'"; "expected test.ary[5][2] = 'a', saw '$(test.ary[5][2])'"; "expected test.ary[5][3] = 'test', saw '$(test.ary[5][3])'"; - "expected test.ary[6][0] = 'this', saw '$(test.ary[6][0])'"; "expected test.ary[6][1] = 'also', saw '$(test.ary[6][1])'"; - "expected test.ary[7][0] = 'last', saw '$(test.ary[7][0])'"; "expected test.ary[7][1] = 'one', saw '$(test.ary[7][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments_noemptyfields.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments_noemptyfields.cf index 38d7acb822..d7a812fab5 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments_noemptyfields.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments_noemptyfields.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,99 +36,81 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarray("ary", "$(teststr)","^#.*",":+",10,1000); - "num" int => "7"; + "teststr" string => readfile("$(G.testfile)", 1000); + "cnt" int => parsestringarray("ary", "$(teststr)", "^#.*", ":+", 10, 1000); + "num" int => "7"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[here is][0])", "here is"), - strcmp("$(test.ary[here is][1])", "a line"), - strcmp("$(test.ary[here is][2])", " with spaces "), - strcmp("$(test.ary[here is][3])", " in it"), - - strcmp("$(test.ary[blank][0])", "blank"), - strcmp("$(test.ary[blank][1])", "fields"), - strcmp("$(test.ary[blank][2])", "in here"), - - strcmp("$(test.ary[][0])", ""), - strcmp("$(test.ary[][1])", "leading blank field"), - - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "also"), - strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), - strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), - - strcmp("$(test.ary[last][0])", "last"), - strcmp("$(test.ary[last][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[here is][0])", "here is"), + strcmp("$(test.ary[here is][1])", "a line"), + strcmp("$(test.ary[here is][2])", " with spaces "), + strcmp("$(test.ary[here is][3])", " in it"), + strcmp("$(test.ary[blank][0])", "blank"), + strcmp("$(test.ary[blank][1])", "fields"), + strcmp("$(test.ary[blank][2])", "in here"), + strcmp("$(test.ary[][0])", ""), + strcmp("$(test.ary[][1])", "leading blank field"), + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "also"), + strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), + strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), + strcmp("$(test.ary[last][0])", "last"), + strcmp("$(test.ary[last][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[here is][0] = 'here is', saw '$(test.ary[here is][0])'"; "expected test.ary[here is][1] = 'a line', saw '$(test.ary[here is][1])'"; "expected test.ary[here is][2] = ' with spaces ', saw '$(test.ary[here is][2])'"; "expected test.ary[here is][3] = ' in it', saw '$(test.ary[here is][3])'"; - "expected test.ary[blank][0] = 'blank', saw '$(test.ary[blank][0])'"; "expected test.ary[blank][1] = 'fields', saw '$(test.ary[blank][1])'"; "expected test.ary[blank][2] = 'in here', saw '$(test.ary[blank][2])'"; - "expected test.ary[][0] = '', saw '$(test.ary[][0])'"; "expected test.ary[][1] = 'leading blank field', saw '$(test.ary[][1])'"; - "expected test.ary[# A duplicate follows][0] = '# A duplicate follows', saw '$(test.ary[# A duplicate follows][0])'"; "expected test.ary[# A duplicate follows][1] = 'this line is not always a comment', saw '$(test.ary[# A duplicate follows][1])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'also', saw '$(test.ary[this][1])'"; "expected test.ary[this][2] = '$(const.dollar)test.ary[this][2]', saw '$(test.ary[this][2])'"; "expected test.ary[this][3] = '$(const.dollar)test.ary[this][3]', saw '$(test.ary[this][3])'"; - "expected test.ary[last][0] = 'last', saw '$(test.ary[last][0])'"; "expected test.ary[last][1] = 'one', saw '$(test.ary[last][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments_noemptyfields3.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments_noemptyfields3.cf index 997fbdbda5..7a0eb0c09f 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments_noemptyfields3.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments_noemptyfields3.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,103 +36,86 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarrayidx("ary", "$(G.testfile)","^#.*",":+",10,1000); - "num" int => "8"; + "cnt" + int => readstringarrayidx("ary", "$(G.testfile)", "^#.*", ":+", 10, 1000); + + "num" int => "8"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[2][0])", "here is"), - strcmp("$(test.ary[2][1])", "a line"), - strcmp("$(test.ary[2][2])", " with spaces "), - strcmp("$(test.ary[2][3])", " in it"), - - strcmp("$(test.ary[3][0])", "blank"), - strcmp("$(test.ary[3][1])", "fields"), - strcmp("$(test.ary[3][2])", "in here"), - strcmp("$(test.ary[3][3])", ""), - - strcmp("$(test.ary[4][0])", ""), - strcmp("$(test.ary[4][1])", "leading blank field"), - - strcmp("$(test.ary[5][0])", "this"), - strcmp("$(test.ary[5][1])", "is"), - strcmp("$(test.ary[5][2])", "a"), - strcmp("$(test.ary[5][3])", "test"), - - strcmp("$(test.ary[6][0])", "this"), - strcmp("$(test.ary[6][1])", "also"), - - strcmp("$(test.ary[7][0])", "last"), - strcmp("$(test.ary[7][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[2][0])", "here is"), + strcmp("$(test.ary[2][1])", "a line"), + strcmp("$(test.ary[2][2])", " with spaces "), + strcmp("$(test.ary[2][3])", " in it"), + strcmp("$(test.ary[3][0])", "blank"), + strcmp("$(test.ary[3][1])", "fields"), + strcmp("$(test.ary[3][2])", "in here"), + strcmp("$(test.ary[3][3])", ""), + strcmp("$(test.ary[4][0])", ""), + strcmp("$(test.ary[4][1])", "leading blank field"), + strcmp("$(test.ary[5][0])", "this"), + strcmp("$(test.ary[5][1])", "is"), + strcmp("$(test.ary[5][2])", "a"), + strcmp("$(test.ary[5][3])", "test"), + strcmp("$(test.ary[6][0])", "this"), + strcmp("$(test.ary[6][1])", "also"), + strcmp("$(test.ary[7][0])", "last"), + strcmp("$(test.ary[7][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[2][0] = 'here is', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = 'a line', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = ' with spaces ', saw '$(test.ary[2][2])'"; "expected test.ary[2][3] = ' in it', saw '$(test.ary[2][3])'"; - "expected test.ary[3][0] = 'blank', saw '$(test.ary[3][0])'"; "expected test.ary[3][1] = 'fields', saw '$(test.ary[3][1])'"; "expected test.ary[3][2] = 'in here', saw '$(test.ary[3][2])'"; "expected test.ary[3][3] = '', saw '$(test.ary[3][3])'"; - "expected test.ary[4][0] = '', saw '$(test.ary[4][0])'"; "expected test.ary[4][1] = 'leading blank field', saw '$(test.ary[4][1])'"; - "expected test.ary[5][0] = 'this', saw '$(test.ary[5][0])'"; "expected test.ary[5][1] = 'is', saw '$(test.ary[5][1])'"; "expected test.ary[5][2] = 'a', saw '$(test.ary[5][2])'"; "expected test.ary[5][3] = 'test', saw '$(test.ary[5][3])'"; - "expected test.ary[6][0] = 'this', saw '$(test.ary[6][0])'"; "expected test.ary[6][1] = 'also', saw '$(test.ary[6][1])'"; - "expected test.ary[7][0] = 'last', saw '$(test.ary[7][0])'"; "expected test.ary[7][1] = 'one', saw '$(test.ary[7][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments_noemptyfields4.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments_noemptyfields4.cf index 7e456b288f..75a71e1ccc 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments_noemptyfields4.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_real_comments_noemptyfields4.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,104 +36,88 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" str => readfile("$(G.testfile)","^#.*",":+"1000); - "cnt" int => parsestringarrayidx("ary", "$(teststr)","^#.*",":+",10,1000); - "num" int => "8"; + "teststr" str => readfile("$(G.testfile)", "^#.*", ":+"1000); + + "cnt" + int => parsestringarrayidx("ary", "$(teststr)", "^#.*", ":+", 10, 1000); + + "num" int => "8"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[2][0])", "here is"), - strcmp("$(test.ary[2][1])", "a line"), - strcmp("$(test.ary[2][2])", " with spaces "), - strcmp("$(test.ary[2][3])", " in it"), - - strcmp("$(test.ary[3][0])", "blank"), - strcmp("$(test.ary[3][1])", "fields"), - strcmp("$(test.ary[3][2])", "in here"), - strcmp("$(test.ary[3][3])", ""), - - strcmp("$(test.ary[4][0])", ""), - strcmp("$(test.ary[4][1])", "leading blank field"), - - strcmp("$(test.ary[5][0])", "this"), - strcmp("$(test.ary[5][1])", "is"), - strcmp("$(test.ary[5][2])", "a"), - strcmp("$(test.ary[5][3])", "test"), - - strcmp("$(test.ary[6][0])", "this"), - strcmp("$(test.ary[6][1])", "also"), - - strcmp("$(test.ary[7][0])", "last"), - strcmp("$(test.ary[7][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[2][0])", "here is"), + strcmp("$(test.ary[2][1])", "a line"), + strcmp("$(test.ary[2][2])", " with spaces "), + strcmp("$(test.ary[2][3])", " in it"), + strcmp("$(test.ary[3][0])", "blank"), + strcmp("$(test.ary[3][1])", "fields"), + strcmp("$(test.ary[3][2])", "in here"), + strcmp("$(test.ary[3][3])", ""), + strcmp("$(test.ary[4][0])", ""), + strcmp("$(test.ary[4][1])", "leading blank field"), + strcmp("$(test.ary[5][0])", "this"), + strcmp("$(test.ary[5][1])", "is"), + strcmp("$(test.ary[5][2])", "a"), + strcmp("$(test.ary[5][3])", "test"), + strcmp("$(test.ary[6][0])", "this"), + strcmp("$(test.ary[6][1])", "also"), + strcmp("$(test.ary[7][0])", "last"), + strcmp("$(test.ary[7][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[2][0] = 'here is', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = 'a line', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = ' with spaces ', saw '$(test.ary[2][2])'"; "expected test.ary[2][3] = ' in it', saw '$(test.ary[2][3])'"; - "expected test.ary[3][0] = 'blank', saw '$(test.ary[3][0])'"; "expected test.ary[3][1] = 'fields', saw '$(test.ary[3][1])'"; "expected test.ary[3][2] = 'in here', saw '$(test.ary[3][2])'"; "expected test.ary[3][3] = '', saw '$(test.ary[3][3])'"; - "expected test.ary[4][0] = '', saw '$(test.ary[4][0])'"; "expected test.ary[4][1] = 'leading blank field', saw '$(test.ary[4][1])'"; - "expected test.ary[5][0] = 'this', saw '$(test.ary[5][0])'"; "expected test.ary[5][1] = 'is', saw '$(test.ary[5][1])'"; "expected test.ary[5][2] = 'a', saw '$(test.ary[5][2])'"; "expected test.ary[5][3] = 'test', saw '$(test.ary[5][3])'"; - "expected test.ary[6][0] = 'this', saw '$(test.ary[6][0])'"; "expected test.ary[6][1] = 'also', saw '$(test.ary[6][1])'"; - "expected test.ary[7][0] = 'last', saw '$(test.ary[7][0])'"; "expected test.ary[7][1] = 'one', saw '$(test.ary[7][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_with_duplicate.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_with_duplicate.cf index 669d077540..3d8a918776 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_with_duplicate.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarray_weird_indices_with_duplicate.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,91 +36,84 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarray("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "8"; + "teststr" string => readfile("$(G.testfile)", 1000); + + "cnt" + int => parsestringarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); + + "num" int => "8"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[here is][0])", "here is"), - strcmp("$(test.ary[here is][1])", "a line"), - strcmp("$(test.ary[here is][2])", " with spaces "), - strcmp("$(test.ary[here is][3])", " in it"), - - strcmp("$(test.ary[blank][0])", "blank"), - strcmp("$(test.ary[blank][1])", "fields"), - strcmp("$(test.ary[blank][2])", ""), - strcmp("$(test.ary[blank][3])", ""), - strcmp("$(test.ary[blank][4])", "in here"), - strcmp("$(test.ary[blank][5])", ""), - strcmp("$(test.ary[blank][6])", ""), - - strcmp("$(test.ary[][0])", ""), - strcmp("$(test.ary[][1])", "leading blank field"), - - strcmp("$(test.ary[# A duplicate follows][0])", "# A duplicate follows"), - strcmp("$(test.ary[# A duplicate follows][1])", "this line is not always a comment"), - - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "also"), - strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), - strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), - - strcmp("$(test.ary[last][0])", "last"), - strcmp("$(test.ary[last][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[here is][0])", "here is"), + strcmp("$(test.ary[here is][1])", "a line"), + strcmp("$(test.ary[here is][2])", " with spaces "), + strcmp("$(test.ary[here is][3])", " in it"), + strcmp("$(test.ary[blank][0])", "blank"), + strcmp("$(test.ary[blank][1])", "fields"), + strcmp("$(test.ary[blank][2])", ""), + strcmp("$(test.ary[blank][3])", ""), + strcmp("$(test.ary[blank][4])", "in here"), + strcmp("$(test.ary[blank][5])", ""), + strcmp("$(test.ary[blank][6])", ""), + strcmp("$(test.ary[][0])", ""), + strcmp("$(test.ary[][1])", "leading blank field"), + strcmp( + "$(test.ary[# A duplicate follows][0])", "# A duplicate follows" + ), + strcmp( + "$(test.ary[# A duplicate follows][1])", + "this line is not always a comment" + ), + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "also"), + strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), + strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), + strcmp("$(test.ary[last][0])", "last"), + strcmp("$(test.ary[last][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[here is][0] = 'here is', saw '$(test.ary[here is][0])'"; "expected test.ary[here is][1] = 'a line', saw '$(test.ary[here is][1])'"; "expected test.ary[here is][2] = ' with spaces ', saw '$(test.ary[here is][2])'"; "expected test.ary[here is][3] = ' in it', saw '$(test.ary[here is][3])'"; - "expected test.ary[blank][0] = 'blank', saw '$(test.ary[blank][0])'"; "expected test.ary[blank][1] = 'fields', saw '$(test.ary[blank][1])'"; "expected test.ary[blank][2] = '', saw '$(test.ary[blank][2])'"; @@ -131,18 +121,14 @@ bundle agent check "expected test.ary[blank][4] = 'in here', saw '$(test.ary[blank][4])'"; "expected test.ary[blank][5] = '', saw '$(test.ary[blank][5])'"; "expected test.ary[blank][6] = '', saw '$(test.ary[blank][6])'"; - "expected test.ary[][0] = '', saw '$(test.ary[][0])'"; "expected test.ary[][1] = 'leading blank field', saw '$(test.ary[][1])'"; - "expected test.ary[# A duplicate follows][0] = '# A duplicate follows', saw '$(test.ary[# A duplicate follows][0])'"; "expected test.ary[# A duplicate follows][1] = 'this line is not always a comment', saw '$(test.ary[# A duplicate follows][1])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'also', saw '$(test.ary[this][1])'"; "expected test.ary[this][2] = '$(const.dollar)test.ary[this][2]', saw '$(test.ary[this][2])'"; "expected test.ary[this][3] = '$(const.dollar)test.ary[this][3]', saw '$(test.ary[this][3])'"; - "expected test.ary[last][0] = 'last', saw '$(test.ary[last][0])'"; "expected test.ary[last][1] = 'one', saw '$(test.ary[last][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_change_separator_to_s.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_change_separator_to_s.cf index f345cbae2f..b426f4b0ac 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_change_separator_to_s.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_change_separator_to_s.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,92 +36,76 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" str => readfile("$(G.testfile)","^#.*",1000); - "cnt" int => parsestringarrayidx("ary", "$(teststr)","^#.*","s+",10,1000); - "num" int => "8"; + "teststr" str => readfile("$(G.testfile)", "^#.*", 1000); + + "cnt" + int => parsestringarrayidx("ary", "$(teststr)", "^#.*", "s+", 10, 1000); + + "num" int => "8"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0:1:2"), - - strcmp("$(test.ary[1][0])", "1:2:3"), - - strcmp("$(test.ary[2][0])", "here i"), - strcmp("$(test.ary[2][1])", ":a line: with "), - strcmp("$(test.ary[2][2])", "pace"), - strcmp("$(test.ary[2][3])", " : in it"), - - strcmp("$(test.ary[3][0])", "blank:field"), - strcmp("$(test.ary[3][1])", ":::in here::"), - - strcmp("$(test.ary[4][0])", ":leading blank field"), - - strcmp("$(test.ary[5][0])", "thi"), - strcmp("$(test.ary[5][1])", ":i"), - strcmp("$(test.ary[5][2])", ":a:te"), - strcmp("$(test.ary[5][3])", "t"), - - strcmp("$(test.ary[6][0])", "thi"), - strcmp("$(test.ary[6][1])", ":al"), - strcmp("$(test.ary[6][2])", "o"), - - strcmp("$(test.ary[7][0])", "la"), - strcmp("$(test.ary[7][1])", "t:one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0:1:2"), + strcmp("$(test.ary[1][0])", "1:2:3"), + strcmp("$(test.ary[2][0])", "here i"), + strcmp("$(test.ary[2][1])", ":a line: with "), + strcmp("$(test.ary[2][2])", "pace"), + strcmp("$(test.ary[2][3])", " : in it"), + strcmp("$(test.ary[3][0])", "blank:field"), + strcmp("$(test.ary[3][1])", ":::in here::"), + strcmp("$(test.ary[4][0])", ":leading blank field"), + strcmp("$(test.ary[5][0])", "thi"), + strcmp("$(test.ary[5][1])", ":i"), + strcmp("$(test.ary[5][2])", ":a:te"), + strcmp("$(test.ary[5][3])", "t"), + strcmp("$(test.ary[6][0])", "thi"), + strcmp("$(test.ary[6][1])", ":al"), + strcmp("$(test.ary[6][2])", "o"), + strcmp("$(test.ary[7][0])", "la"), + strcmp("$(test.ary[7][1])", "t:one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0:1:2', saw '$(test.ary[0][0])'"; - "expected test.ary[1][0] = '1:2:3', saw '$(test.ary[1][0])'"; - "expected test.ary[2][0] = 'here i', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = ':a line: with ', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = 'pace', saw '$(test.ary[2][2])'"; "expected test.ary[2][3] = ' : in it', saw '$(test.ary[2][3])'"; - "expected test.ary[3][0] = 'blank:field', saw '$(test.ary[3][0])'"; "expected test.ary[3][1] = ':::in here::', saw '$(test.ary[3][1])'"; - "expected test.ary[4][0] = ':leading blank field', saw '$(test.ary[4][0])'"; - "expected test.ary[5][0] = 'thi', saw '$(test.ary[5][0])'"; "expected test.ary[5][1] = ':i', saw '$(test.ary[5][1])'"; "expected test.ary[5][2] = ':a:te', saw '$(test.ary[5][2])'"; "expected test.ary[5][3] = 't', saw '$(test.ary[5][3])'"; - "expected test.ary[6][0] = 'thi', saw '$(test.ary[6][0])'"; "expected test.ary[6][1] = ':al', saw '$(test.ary[6][1])'"; "expected test.ary[6][2] = 'o', saw '$(test.ary[6][2])'"; - "expected test.ary[7][0] = 'la', saw '$(test.ary[7][0])'"; "expected test.ary[7][1] = 't:one', saw '$(test.ary[7][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_duplicate_key.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_duplicate_key.cf index 59fa0efe18..ea69f69e27 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_duplicate_key.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_duplicate_key.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,86 +27,80 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 this:is:a:test this:too 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" str => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarrayidx("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "4"; + "teststr" str => readfile("$(G.testfile)", 1000); + + "cnt" + int => parsestringarrayidx( + "ary", "$(teststr)", "NoComment", ":", 10, 1000 + ); + + "num" int => "4"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "this"), - strcmp("$(test.ary[1][1])", "is"), - strcmp("$(test.ary[1][2])", "a"), - strcmp("$(test.ary[1][3])", "test"), - - strcmp("$(test.ary[2][0])", "this"), - strcmp("$(test.ary[2][1])", "too"), - - strcmp("$(test.ary[3][0])", "1"), - strcmp("$(test.ary[3][1])", "2"), - strcmp("$(test.ary[3][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "this"), + strcmp("$(test.ary[1][1])", "is"), + strcmp("$(test.ary[1][2])", "a"), + strcmp("$(test.ary[1][3])", "test"), + strcmp("$(test.ary[2][0])", "this"), + strcmp("$(test.ary[2][1])", "too"), + strcmp("$(test.ary[3][0])", "1"), + strcmp("$(test.ary[3][1])", "2"), + strcmp("$(test.ary[3][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[1][4]"), - isvariable("test.ary[2][2]"), - isvariable("test.ary[3][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[1][4]"), + isvariable("test.ary[2][2]"), + isvariable("test.ary[3][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = 'this', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = 'is', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = 'a', saw '$(test.ary[1][2])'"; "expected test.ary[1][3] = 'test', saw '$(test.ary[1][3])'"; - "expected test.ary[2][0] = 'this', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = 'too', saw '$(test.ary[2][1])'"; - "expected test.ary[3][0] = '1', saw '$(test.ary[3][0])'"; "expected test.ary[3][1] = '2', saw '$(test.ary[3][1])'"; "expected test.ary[3][2] = '3', saw '$(test.ary[3][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_nonparsed_comment.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_nonparsed_comment.cf index 6d959b9c8b..f13af81d87 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_nonparsed_comment.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_nonparsed_comment.cf @@ -7,29 +7,26 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "testfile" string => "/tmp/TEST.cfengine"; + "testfile" string => "/tmp/TEST.cfengine"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -37,82 +34,77 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 # Not parsed as a comment this:is:a:test 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" str => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarrayidx("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "4"; + "teststr" str => readfile("$(G.testfile)", 1000); + + "cnt" + int => parsestringarrayidx( + "ary", "$(teststr)", "NoComment", ":", 10, 1000 + ); + + "num" int => "4"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "# Not parsed as a comment"), - - strcmp("$(test.ary[2][0])", "this"), - strcmp("$(test.ary[2][1])", "is"), - strcmp("$(test.ary[2][2])", "a"), - strcmp("$(test.ary[2][3])", "test"), - - strcmp("$(test.ary[3][0])", "1"), - strcmp("$(test.ary[3][1])", "2"), - strcmp("$(test.ary[3][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "# Not parsed as a comment"), + strcmp("$(test.ary[2][0])", "this"), + strcmp("$(test.ary[2][1])", "is"), + strcmp("$(test.ary[2][2])", "a"), + strcmp("$(test.ary[2][3])", "test"), + strcmp("$(test.ary[3][0])", "1"), + strcmp("$(test.ary[3][1])", "2"), + strcmp("$(test.ary[3][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[1][1]"), - isvariable("test.ary[2][4]"), - isvariable("test.ary[3][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[1][1]"), + isvariable("test.ary[2][4]"), + isvariable("test.ary[3][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'is', saw '$(test.ary[this][1])'"; "expected test.ary[this][2] = 'a', saw '$(test.ary[this][2])'"; "expected test.ary[this][3] = 'test', saw '$(test.ary[this][3])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_weird_indices_duplicate.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_weird_indices_duplicate.cf index 495974bc22..689cf2dfd7 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_weird_indices_duplicate.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_weird_indices_duplicate.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,94 +36,83 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" str => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarrayidx("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "9"; + "teststr" str => readfile("$(G.testfile)", 1000); + + "cnt" + int => parsestringarrayidx( + "ary", "$(teststr)", "NoComment", ":", 10, 1000 + ); + + "num" int => "9"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[2][0])", "here is"), - strcmp("$(test.ary[2][1])", "a line"), - strcmp("$(test.ary[2][2])", " with spaces "), - strcmp("$(test.ary[2][3])", " in it"), - - strcmp("$(test.ary[3][0])", "blank"), - strcmp("$(test.ary[3][1])", "fields"), - strcmp("$(test.ary[3][2])", ""), - strcmp("$(test.ary[3][3])", ""), - strcmp("$(test.ary[3][4])", "in here"), - strcmp("$(test.ary[3][5])", ""), - strcmp("$(test.ary[3][6])", ""), - - strcmp("$(test.ary[4][0])", ""), - strcmp("$(test.ary[4][1])", "leading blank field"), - - strcmp("$(test.ary[5][0])", "this"), - strcmp("$(test.ary[5][1])", "is"), - strcmp("$(test.ary[5][2])", "a"), - strcmp("$(test.ary[5][3])", "test"), - - strcmp("$(test.ary[6][0])", "# A duplicate follows"), - strcmp("$(test.ary[6][1])", " this line is not always a comment"), - - strcmp("$(test.ary[7][0])", "this"), - strcmp("$(test.ary[7][1])", "also"), - - strcmp("$(test.ary[8][0])", "last"), - strcmp("$(test.ary[8][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[2][0])", "here is"), + strcmp("$(test.ary[2][1])", "a line"), + strcmp("$(test.ary[2][2])", " with spaces "), + strcmp("$(test.ary[2][3])", " in it"), + strcmp("$(test.ary[3][0])", "blank"), + strcmp("$(test.ary[3][1])", "fields"), + strcmp("$(test.ary[3][2])", ""), + strcmp("$(test.ary[3][3])", ""), + strcmp("$(test.ary[3][4])", "in here"), + strcmp("$(test.ary[3][5])", ""), + strcmp("$(test.ary[3][6])", ""), + strcmp("$(test.ary[4][0])", ""), + strcmp("$(test.ary[4][1])", "leading blank field"), + strcmp("$(test.ary[5][0])", "this"), + strcmp("$(test.ary[5][1])", "is"), + strcmp("$(test.ary[5][2])", "a"), + strcmp("$(test.ary[5][3])", "test"), + strcmp("$(test.ary[6][0])", "# A duplicate follows"), + strcmp("$(test.ary[6][1])", " this line is not always a comment"), + strcmp("$(test.ary[7][0])", "this"), + strcmp("$(test.ary[7][1])", "also"), + strcmp("$(test.ary[8][0])", "last"), + strcmp("$(test.ary[8][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[2][0] = 'here is', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = 'a line', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = ' with spaces ', saw '$(test.ary[2][2])'"; "expected test.ary[2][3] = ' in it', saw '$(test.ary[2][3])'"; - "expected test.ary[3][0] = 'blank', saw '$(test.ary[3][0])'"; "expected test.ary[3][1] = 'fields', saw '$(test.ary[3][1])'"; "expected test.ary[3][2] = '', saw '$(test.ary[3][2])'"; @@ -134,21 +120,16 @@ bundle agent check "expected test.ary[3][4] = 'in here', saw '$(test.ary[3][4])'"; "expected test.ary[3][5] = '', saw '$(test.ary[3][5])'"; "expected test.ary[3][6] = '', saw '$(test.ary[3][6])'"; - "expected test.ary[4][0] = '', saw '$(test.ary[4][0])'"; "expected test.ary[4][1] = 'leading blank field', saw '$(test.ary[4][1])'"; - "expected test.ary[5][0] = 'this', saw '$(test.ary[5][0])'"; "expected test.ary[5][1] = 'is', saw '$(test.ary[5][1])'"; "expected test.ary[5][2] = 'a', saw '$(test.ary[5][2])'"; "expected test.ary[5][3] = 'test', saw '$(test.ary[5][3])'"; - "expected test.ary[6][0] = '# A duplicate follows', saw '$(test.ary[6][0])'"; "expected test.ary[6][1] = ' this line is not always a comment', saw '$(test.ary[6][1])'"; - "expected test.ary[7][0] = 'this', saw '$(test.ary[7][0])'"; "expected test.ary[7][1] = 'also', saw '$(test.ary[7][1])'"; - "expected test.ary[8][0] = 'last', saw '$(test.ary[8][0])'"; "expected test.ary[8][1] = 'one', saw '$(test.ary[8][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_weird_indices_real_comments_noemptyfields.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_weird_indices_real_comments_noemptyfields.cf index 04514f7774..c622349459 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_weird_indices_real_comments_noemptyfields.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarrayidx_weird_indices_real_comments_noemptyfields.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,70 +36,56 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" str => readfile("$(G.testfile)","^#.*",":+"14); - "cnt" int => parsestringarrayidx("ary", "$(teststr)","^#.*",":+",10,14); - "num" int => "3"; + "teststr" str => readfile("$(G.testfile)", "^#.*", ":+"14); + "cnt" int => parsestringarrayidx("ary", "$(teststr)", "^#.*", ":+", 10, 14); + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "bad" or => { - isvariable("test.ary[2][1]"), - isvariable("test.ary[3][0]"), - }; - - "ok" and => { - "!bad", - - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[2][0])", "he"), + "bad" or => { isvariable("test.ary[2][1]"), isvariable("test.ary[3][0]") }; + + "ok" + and => { + "!bad", + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[2][0])", "he"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "saw 'bad'-class things"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[2][0] = 'he', saw '$(test.ary[2][0])'"; ok:: diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarrayinx_simple.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarrayinx_simple.cf index 12c00a3ae8..e674001f90 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarrayinx_simple.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarrayinx_simple.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,78 +27,74 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 this:is:a:test 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" str => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarrayidx("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "3"; + "teststr" str => readfile("$(G.testfile)", 1000); + + "cnt" + int => parsestringarrayidx( + "ary", "$(teststr)", "NoComment", ":", 10, 1000 + ); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "this"), - strcmp("$(test.ary[1][1])", "is"), - strcmp("$(test.ary[1][2])", "a"), - strcmp("$(test.ary[1][3])", "test"), - - strcmp("$(test.ary[2][0])", "1"), - strcmp("$(test.ary[2][1])", "2"), - strcmp("$(test.ary[2][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "this"), + strcmp("$(test.ary[1][1])", "is"), + strcmp("$(test.ary[1][2])", "a"), + strcmp("$(test.ary[1][3])", "test"), + strcmp("$(test.ary[2][0])", "1"), + strcmp("$(test.ary[2][1])", "2"), + strcmp("$(test.ary[2][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[1][4]"), - isvariable("test.ary[2][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[1][4]"), + isvariable("test.ary[2][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = 'this', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = 'is', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = 'a', saw '$(test.ary[1][2])'"; "expected test.ary[1][3] = 'test', saw '$(test.ary[1][3])'"; - "expected test.ary[2][0] = '1', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = '2', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = '3', saw '$(test.ary[2][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/parsestringarrayinx_singleton_nootherfields.cf b/tests/acceptance/01_vars/02_functions/staging/parsestringarrayinx_singleton_nootherfields.cf index c0ebae1531..4c6023cd33 100644 --- a/tests/acceptance/01_vars/02_functions/staging/parsestringarrayinx_singleton_nootherfields.cf +++ b/tests/acceptance/01_vars/02_functions/staging/parsestringarrayinx_singleton_nootherfields.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,72 +27,68 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 singleton 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" str => readfile("$(G.testfile)",1000); - "cnt" int => parsestringarrayidx("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "3"; + "teststr" str => readfile("$(G.testfile)", 1000); + + "cnt" + int => parsestringarrayidx( + "ary", "$(teststr)", "NoComment", ":", 10, 1000 + ); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "singleton"), - - strcmp("$(test.ary[2][0])", "1"), - strcmp("$(test.ary[2][1])", "2"), - strcmp("$(test.ary[2][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "singleton"), + strcmp("$(test.ary[2][0])", "1"), + strcmp("$(test.ary[2][1])", "2"), + strcmp("$(test.ary[2][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[1][1]"), - isvariable("test.ary[2][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[1][1]"), + isvariable("test.ary[2][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = 'singleton', saw '$(test.ary[1][0])'"; - "expected test.ary[2][0] = '1', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = '2', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = '3', saw '$(test.ary[2][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readintarray_duplicate_key.cf b/tests/acceptance/01_vars/02_functions/staging/readintarray_duplicate_key.cf index 090e3e5827..ff54152e11 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readintarray_duplicate_key.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readintarray_duplicate_key.cf @@ -6,21 +6,19 @@ # 500-519 are readintarray, 520-539 test the same things for parseintarray # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -28,75 +26,70 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 999:888:777:666 999:000 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readintarray("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "3"; # 4 lines, but 3 unique keys + "cnt" + int => readintarray("ary", "$(G.testfile)", "NoComment", ":", 10, 1000); + + "num" int => "3"; + + # 4 lines, but 3 unique keys } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - # The second value should overwrite the first - strcmp("$(test.ary[999][0])", "999"), - strcmp("$(test.ary[999][1])", "0"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + # The second value should overwrite the first + strcmp("$(test.ary[999][0])", "999"), + strcmp("$(test.ary[999][1])", "0"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[999][2]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[999][2]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[999][0] = '999', saw '$(test.ary[999][0])'"; "expected test.ary[999][1] = '0', saw '$(test.ary[999][1])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readintarray_non_integers.cf b/tests/acceptance/01_vars/02_functions/staging/readintarray_non_integers.cf index 22db6caf15..00375cbfa8 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readintarray_non_integers.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readintarray_non_integers.cf @@ -6,21 +6,19 @@ # 500-519 are readintarray, 520-539 test the same things for parseintarray # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -28,76 +26,69 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 999:888:777:666 999:000 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parseintarray("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "3"; # 4 lines, but 3 unique keys + "teststr" string => readfile("$(G.testfile)", 1000); + "cnt" int => parseintarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); + "num" int => "3"; + + # 4 lines, but 3 unique keys } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - # The second value should overwrite the first - strcmp("$(test.ary[999][0])", "999"), - strcmp("$(test.ary[999][1])", "0"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + # The second value should overwrite the first + strcmp("$(test.ary[999][0])", "999"), + strcmp("$(test.ary[999][1])", "0"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[999][2]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[999][2]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[999][0] = '999', saw '$(test.ary[999][0])'"; "expected test.ary[999][1] = '0', saw '$(test.ary[999][1])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readintarray_non_integers2.cf b/tests/acceptance/01_vars/02_functions/staging/readintarray_non_integers2.cf index 5741f3528b..dc2f8cc706 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readintarray_non_integers2.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readintarray_non_integers2.cf @@ -6,21 +6,19 @@ # 500-519 are readintarray, 520-539 test the same things for parseintarray # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -28,77 +26,70 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 999::bogus:666 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readintarray("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "3"; + "cnt" + int => readintarray("ary", "$(G.testfile)", "NoComment", ":", 10, 1000); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[999][0])", "999"), - strcmp("$(test.ary[999][1])", "0"), - strcmp("$(test.ary[999][2])", "0"), - strcmp("$(test.ary[999][3])", "666"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[999][0])", "999"), + strcmp("$(test.ary[999][1])", "0"), + strcmp("$(test.ary[999][2])", "0"), + strcmp("$(test.ary[999][3])", "666"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[999][4]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[999][4]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[999][0] = '999', saw '$(test.ary[999][0])'"; "expected test.ary[999][1] = '0', saw '$(test.ary[999][1])'"; "expected test.ary[999][2] = '0', saw '$(test.ary[999][2])'"; "expected test.ary[999][3] = '999', saw '$(test.ary[999][3])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readintarray_non_integers3.cf b/tests/acceptance/01_vars/02_functions/staging/readintarray_non_integers3.cf index dc41c52fb0..b6daf17f0d 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readintarray_non_integers3.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readintarray_non_integers3.cf @@ -6,21 +6,19 @@ # 500-519 are readintarray, 520-539 test the same things for parseintarray # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -28,78 +26,69 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 999::bogus:666 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parseintarray("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "3"; + "teststr" string => readfile("$(G.testfile)", 1000); + "cnt" int => parseintarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[999][0])", "999"), - strcmp("$(test.ary[999][1])", "0"), - strcmp("$(test.ary[999][2])", "0"), - strcmp("$(test.ary[999][3])", "666"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[999][0])", "999"), + strcmp("$(test.ary[999][1])", "0"), + strcmp("$(test.ary[999][2])", "0"), + strcmp("$(test.ary[999][3])", "666"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[999][4]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[999][4]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[999][0] = '999', saw '$(test.ary[999][0])'"; "expected test.ary[999][1] = '0', saw '$(test.ary[999][1])'"; "expected test.ary[999][2] = '0', saw '$(test.ary[999][2])'"; "expected test.ary[999][3] = '999', saw '$(test.ary[999][3])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readintlist.cf b/tests/acceptance/01_vars/02_functions/staging/readintlist.cf index 3042d93a60..348aae14b9 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readintlist.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readintlist.cf @@ -3,21 +3,19 @@ # Test readintlist() issue 364, also 366 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,45 +23,52 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123, ,456,789"; # "empty" fields + "123, ,456,789"; + + # "empty" fields } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)","NoComment",",",5,100); - "sum" real => sum("nums"); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", ",", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" ilist => { @{test.nums} }; + "nums" ilist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readintlist2.cf b/tests/acceptance/01_vars/02_functions/staging/readintlist2.cf index da4ba4ae81..307ca90224 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readintlist2.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readintlist2.cf @@ -3,21 +3,19 @@ # Test readintlist() issue 364, also 366 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,45 +23,52 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123,broken,456,789"; # non-numeric fields + "123,broken,456,789"; + + # non-numeric fields } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)","NoComment",",",5,100); - "sum" real => sum("nums"); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", ",", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" ilist => { @{test.nums} }; + "nums" ilist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readrealarray_duplicate_key.cf b/tests/acceptance/01_vars/02_functions/staging/readrealarray_duplicate_key.cf index 735598e10e..ae5abb347b 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readrealarray_duplicate_key.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readrealarray_duplicate_key.cf @@ -6,21 +6,19 @@ # 500-519 are readrealarray, 520-539 test the same things for parseintarray # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -28,75 +26,70 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 999.9:888:777:666.6 999.9:000 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readrealarray("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "3"; # 4 lines, but 3 unique keys + "cnt" + int => readrealarray("ary", "$(G.testfile)", "NoComment", ":", 10, 1000); + + "num" int => "3"; + + # 4 lines, but 3 unique keys } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - # The second value should overwrite the first - strcmp("$(test.ary[999.9][0])", "999.9"), - strcmp("$(test.ary[999.9][1])", "0"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + # The second value should overwrite the first + strcmp("$(test.ary[999.9][0])", "999.9"), + strcmp("$(test.ary[999.9][1])", "0"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[999.9][2]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[999.9][2]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[999.9][0] = '999.9', saw '$(test.ary[999.9][0])'"; "expected test.ary[999.9][1] = '0', saw '$(test.ary[999.9][1])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readrealarray_non_integers.cf b/tests/acceptance/01_vars/02_functions/staging/readrealarray_non_integers.cf index f43ef214e1..b8aef3959e 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readrealarray_non_integers.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readrealarray_non_integers.cf @@ -6,21 +6,19 @@ # 500-519 are readrealarray, 520-539 test the same things for parseintarray # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -28,77 +26,70 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 999.9::bogus:666.6 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readrealarray("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "3"; + "cnt" + int => readrealarray("ary", "$(G.testfile)", "NoComment", ":", 10, 1000); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[999.9][0])", "999.9"), - strcmp("$(test.ary[999.9][1])", "0"), - strcmp("$(test.ary[999.9][2])", "0"), - strcmp("$(test.ary[999.9][3])", "666.6"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[999.9][0])", "999.9"), + strcmp("$(test.ary[999.9][1])", "0"), + strcmp("$(test.ary[999.9][2])", "0"), + strcmp("$(test.ary[999.9][3])", "666.6"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[999.9][4]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[999.9][4]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[999.9][0] = '999.9', saw '$(test.ary[999.9][0])'"; "expected test.ary[999.9][1] = '0', saw '$(test.ary[999.9][1])'"; "expected test.ary[999.9][2] = '0', saw '$(test.ary[999.9][2])'"; "expected test.ary[999.9][3] = '666.6', saw '$(test.ary[999.9][3])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readrealarray_non_integers2.cf b/tests/acceptance/01_vars/02_functions/staging/readrealarray_non_integers2.cf index 0ef64204bb..b42ac085b2 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readrealarray_non_integers2.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readrealarray_non_integers2.cf @@ -6,21 +6,19 @@ # 500-519 are readrealarray, 520-539 test the same things for parseintarray # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -28,78 +26,72 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 999.9::bogus:666.6 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)",1000); - "cnt" int => parserealarray("ary", "$(teststr)","NoComment",":",10,1000); - "num" int => "3"; + "teststr" string => readfile("$(G.testfile)", 1000); + + "cnt" + int => parserealarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); + + "num" int => "3"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[999.9][0])", "999.9"), - strcmp("$(test.ary[999.9][1])", "0"), - strcmp("$(test.ary[999.9][2])", "0"), - strcmp("$(test.ary[999.9][3])", "666.6"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[999.9][0])", "999.9"), + strcmp("$(test.ary[999.9][1])", "0"), + strcmp("$(test.ary[999.9][2])", "0"), + strcmp("$(test.ary[999.9][3])", "666.6"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[999.9][4]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[999.9][4]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[999.9][0] = '999.9', saw '$(test.ary[999.9][0])'"; "expected test.ary[999.9][1] = '0', saw '$(test.ary[999.9][1])'"; "expected test.ary[999.9][2] = '0', saw '$(test.ary[999.9][2])'"; "expected test.ary[999.9][3] = '666.6', saw '$(test.ary[999.9][3])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readreallist.cf b/tests/acceptance/01_vars/02_functions/staging/readreallist.cf index a593f9d1d1..893aa85c66 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readreallist.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readreallist.cf @@ -3,21 +3,19 @@ # Test readreallist() issue 364, also 366 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,45 +23,52 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123, ,456,789"; # "empty" fields + "123, ,456,789"; + + # "empty" fields } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)","NoComment",",",5,100); - "sum" real => sum("nums"); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", ",", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" rlist => { @{test.nums} }; + "nums" rlist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readreallist2.cf b/tests/acceptance/01_vars/02_functions/staging/readreallist2.cf index b152591f79..dba0454dd6 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readreallist2.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readreallist2.cf @@ -3,21 +3,19 @@ # Test readreallist() issue 364, also 366 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,45 +23,52 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123,broken,456,789"; # non-numeric fields + "123,broken,456,789"; + + # non-numeric fields } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)","NoComment",",",5,100); - "sum" real => sum("nums"); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", ",", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" rlist => { @{test.nums} }; + "nums" rlist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readstringarray_change_separator_to_s.cf b/tests/acceptance/01_vars/02_functions/staging/readstringarray_change_separator_to_s.cf index 35db96d5e3..cc0dd19af7 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readstringarray_change_separator_to_s.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readstringarray_change_separator_to_s.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,81 +36,66 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarray("ary", "$(G.testfile)","^#.*","s+",10,1000); - "num" int => "7"; + "cnt" + int => readstringarray("ary", "$(G.testfile)", "^#.*", "s+", 10, 1000); + + "num" int => "7"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0:1:2][0])", "0:1:2"), - - strcmp("$(test.ary[1:2:3][0])", "1:2:3"), - - strcmp("$(test.ary[here i][0])", "here i"), - strcmp("$(test.ary[here i][1])", ":a line: with space"), - strcmp("$(test.ary[here i][2])", " : in it"), - - strcmp("$(test.ary[blank field][0])", "blank field"), - strcmp("$(test.ary[blank field][2])", "::: in here::"), - - strcmp("$(test.ary[:leading blank field][0])", "leading blank field"), - - strcmp("$(test.ary[thi][0])", "thi"), - strcmp("$(test.ary[thi][1])", ":also"), - strcmp("$(test.ary[thi][2])", "$(const.dollar)test.ary[this][2]"), - strcmp("$(test.ary[thi][3])", "$(const.dollar)test.ary[this][3]"), - - strcmp("$(test.ary[la][0])", "la"), - strcmp("$(test.ary[la][1])", "t:one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0:1:2][0])", "0:1:2"), + strcmp("$(test.ary[1:2:3][0])", "1:2:3"), + strcmp("$(test.ary[here i][0])", "here i"), + strcmp("$(test.ary[here i][1])", ":a line: with space"), + strcmp("$(test.ary[here i][2])", " : in it"), + strcmp("$(test.ary[blank field][0])", "blank field"), + strcmp("$(test.ary[blank field][2])", "::: in here::"), + strcmp("$(test.ary[:leading blank field][0])", "leading blank field"), + strcmp("$(test.ary[thi][0])", "thi"), + strcmp("$(test.ary[thi][1])", ":also"), + strcmp("$(test.ary[thi][2])", "$(const.dollar)test.ary[this][2]"), + strcmp("$(test.ary[thi][3])", "$(const.dollar)test.ary[this][3]"), + strcmp("$(test.ary[la][0])", "la"), + strcmp("$(test.ary[la][1])", "t:one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0:1:2][0] = '0:1:2', saw '$(test.ary[0:1:2][0])'"; - "expected test.ary[1:2:3][0] = '1:2:3', saw '$(test.ary[1:2:3][0])'"; - "expected test.ary[here i][0] = 'here i', saw '$(test.ary[here i][0])'"; "expected test.ary[here i][1] = ':a line: with space', saw '$(test.ary[here i][1])'"; "expected test.ary[here i][2] = ' : in it', saw '$(test.ary[here i][2])'"; - "expected test.ary[blank field][0] = 'blank field', saw '$(test.ary[blank field][0])'"; "expected test.ary[blank field][2] = '::: in here::', saw '$(test.ary[blank field][2])'"; - "expected test.ary[:leading blank field][0] = 'leading blank field', saw '$(test.ary[:leading blank field][0])'"; - "expected test.ary[thi][0] = 'thi', saw '$(test.ary[thi][0])'"; "expected test.ary[thi][1]) = ':also', saw '$(test.ary[thi][1]))'"; "expected test.ary[thi][2]) = '$(const.dollar)test.ary[this][2]', saw '$(test.ary[thi][2]))'"; "expected test.ary[thi][3]) = '$(const.dollar)test.ary[this][3]', saw '$(test.ary[thi][3]))'"; - "expected test.ary[la][0]) = 'la', saw '$(test.ary[la][0]))'"; "expected test.ary[la][1]) = 't:one', saw '$(test.ary[la][1]))'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readstringarray_introduce_duplicate.cf b/tests/acceptance/01_vars/02_functions/staging/readstringarray_introduce_duplicate.cf index d4d7e6fc01..349e632a5e 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readstringarray_introduce_duplicate.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readstringarray_introduce_duplicate.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,75 +27,72 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 this:is:a:test this:too 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarray("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "3"; # 4 lines, but 3 unique keys + "cnt" + int => readstringarray( + "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 + ); + + "num" int => "3"; + + # 4 lines, but 3 unique keys } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - # The second value should overwrite the first - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "too"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + # The second value should overwrite the first + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "too"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[this][2]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[this][2]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'too', saw '$(test.ary[this][1])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readstringarray_introduce_nonparsed_comment.cf b/tests/acceptance/01_vars/02_functions/staging/readstringarray_introduce_nonparsed_comment.cf index 70f20decea..3f3ce666a7 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readstringarray_introduce_nonparsed_comment.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readstringarray_introduce_nonparsed_comment.cf @@ -7,29 +7,26 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "g", default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "g", default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "testfile" string => "/tmp/TEST.cfengine"; + "testfile" string => "/tmp/TEST.cfengine"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -37,83 +34,79 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 # Not parsed as a comment this:is:a:test 1:2:3"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarray("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "4"; + "cnt" + int => readstringarray( + "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 + ); + + "num" int => "4"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "good" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[# Not parsed as a comment][0])", "# Not parsed as a comment"), - - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "is"), - strcmp("$(test.ary[this][2])", "a"), - strcmp("$(test.ary[this][3])", "test"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), + "good" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp( + "$(test.ary[# Not parsed as a comment][0])", + "# Not parsed as a comment" + ), + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "is"), + strcmp("$(test.ary[this][2])", "a"), + strcmp("$(test.ary[this][3])", "test"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), }; - # Make sure there are no trailing elements - "bad" or => { - isvariable("test.ary[0][3]"), - isvariable("test.ary[# Not parsed as a comment][1]"), - isvariable("test.ary[this][4]"), - isvariable("test.ary[1][3]"), + # Make sure there are no trailing elements + "bad" + or => { + isvariable("test.ary[0][3]"), + isvariable("test.ary[# Not parsed as a comment][1]"), + isvariable("test.ary[this][4]"), + isvariable("test.ary[1][3]"), }; - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[# Not parsed as a comment][0] = '# Not parsed as a comment', saw 'expected $(test.ary[# Not parsed as a comment][0])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'is', saw '$(test.ary[this][1])'"; "expected test.ary[this][2] = 'a', saw '$(test.ary[this][2])'"; "expected test.ary[this][3] = 'test', saw '$(test.ary[this][3])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices.cf b/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices.cf index 325053a707..64ae90e0b9 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,90 +36,84 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarray("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "8"; + "cnt" + int => readstringarray( + "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 + ); + + "num" int => "8"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[here is][0])", "here is"), - strcmp("$(test.ary[here is][1])", "a line"), - strcmp("$(test.ary[here is][2])", " with spaces "), - strcmp("$(test.ary[here is][3])", " in it"), - - strcmp("$(test.ary[blank][0])", "blank"), - strcmp("$(test.ary[blank][1])", "fields"), - strcmp("$(test.ary[blank][2])", ""), - strcmp("$(test.ary[blank][3])", ""), - strcmp("$(test.ary[blank][4])", "in here"), - strcmp("$(test.ary[blank][5])", ""), - strcmp("$(test.ary[blank][6])", ""), - - strcmp("$(test.ary[][0])", ""), - strcmp("$(test.ary[][1])", "leading blank field"), - - strcmp("$(test.ary[# A duplicate follows][0])", "# A duplicate follows"), - strcmp("$(test.ary[# A duplicate follows][1])", "this line is not always a comment"), - - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "also"), - strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), - strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), - - strcmp("$(test.ary[last][0])", "last"), - strcmp("$(test.ary[last][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[here is][0])", "here is"), + strcmp("$(test.ary[here is][1])", "a line"), + strcmp("$(test.ary[here is][2])", " with spaces "), + strcmp("$(test.ary[here is][3])", " in it"), + strcmp("$(test.ary[blank][0])", "blank"), + strcmp("$(test.ary[blank][1])", "fields"), + strcmp("$(test.ary[blank][2])", ""), + strcmp("$(test.ary[blank][3])", ""), + strcmp("$(test.ary[blank][4])", "in here"), + strcmp("$(test.ary[blank][5])", ""), + strcmp("$(test.ary[blank][6])", ""), + strcmp("$(test.ary[][0])", ""), + strcmp("$(test.ary[][1])", "leading blank field"), + strcmp( + "$(test.ary[# A duplicate follows][0])", "# A duplicate follows" + ), + strcmp( + "$(test.ary[# A duplicate follows][1])", + "this line is not always a comment" + ), + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "also"), + strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), + strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), + strcmp("$(test.ary[last][0])", "last"), + strcmp("$(test.ary[last][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[here is][0] = 'here is', saw '$(test.ary[here is][0])'"; "expected test.ary[here is][1] = 'a line', saw '$(test.ary[here is][1])'"; "expected test.ary[here is][2] = ' with spaces ', saw '$(test.ary[here is][2])'"; "expected test.ary[here is][3] = ' in it', saw '$(test.ary[here is][3])'"; - "expected test.ary[blank][0] = 'blank', saw '$(test.ary[blank][0])'"; "expected test.ary[blank][1] = 'fields', saw '$(test.ary[blank][1])'"; "expected test.ary[blank][2] = '', saw '$(test.ary[blank][2])'"; @@ -130,18 +121,14 @@ bundle agent check "expected test.ary[blank][4] = 'in here', saw '$(test.ary[blank][4])'"; "expected test.ary[blank][5] = '', saw '$(test.ary[blank][5])'"; "expected test.ary[blank][6] = '', saw '$(test.ary[blank][6])'"; - "expected test.ary[][0] = '', saw '$(test.ary[][0])'"; "expected test.ary[][1] = 'leading blank field', saw '$(test.ary[][1])'"; - "expected test.ary[# A duplicate follows][0] = '# A duplicate follows', saw '$(test.ary[# A duplicate follows][0])'"; "expected test.ary[# A duplicate follows][1] = 'this line is not always a comment', saw '$(test.ary[# A duplicate follows][1])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'also', saw '$(test.ary[this][1])'"; "expected test.ary[this][2] = '$(const.dollar)test.ary[this][2]', saw '$(test.ary[this][2])'"; "expected test.ary[this][3] = '$(const.dollar)test.ary[this][3]', saw '$(test.ary[this][3])'"; - "expected test.ary[last][0] = 'last', saw '$(test.ary[last][0])'"; "expected test.ary[last][1] = 'one', saw '$(test.ary[last][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices_change_comment_parsing.cf b/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices_change_comment_parsing.cf index d5bd76980a..9393831f22 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices_change_comment_parsing.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices_change_comment_parsing.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,90 +36,80 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarray("ary", "$(G.testfile)","",":",10,1000); - "num" int => "8"; + "cnt" int => readstringarray("ary", "$(G.testfile)", "", ":", 10, 1000); + "num" int => "8"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[here is][0])", "here is"), - strcmp("$(test.ary[here is][1])", "a line"), - strcmp("$(test.ary[here is][2])", " with spaces "), - strcmp("$(test.ary[here is][3])", " in it"), - - strcmp("$(test.ary[blank][0])", "blank"), - strcmp("$(test.ary[blank][1])", "fields"), - strcmp("$(test.ary[blank][2])", ""), - strcmp("$(test.ary[blank][3])", ""), - strcmp("$(test.ary[blank][4])", "in here"), - strcmp("$(test.ary[blank][5])", ""), - strcmp("$(test.ary[blank][6])", ""), - - strcmp("$(test.ary[][0])", ""), - strcmp("$(test.ary[][1])", "leading blank field"), - - strcmp("$(test.ary[# A duplicate follows][0])", "# A duplicate follows"), - strcmp("$(test.ary[# A duplicate follows][1])", "this line is not always a comment"), - - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "also"), - strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), - strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), - - strcmp("$(test.ary[last][0])", "last"), - strcmp("$(test.ary[last][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[here is][0])", "here is"), + strcmp("$(test.ary[here is][1])", "a line"), + strcmp("$(test.ary[here is][2])", " with spaces "), + strcmp("$(test.ary[here is][3])", " in it"), + strcmp("$(test.ary[blank][0])", "blank"), + strcmp("$(test.ary[blank][1])", "fields"), + strcmp("$(test.ary[blank][2])", ""), + strcmp("$(test.ary[blank][3])", ""), + strcmp("$(test.ary[blank][4])", "in here"), + strcmp("$(test.ary[blank][5])", ""), + strcmp("$(test.ary[blank][6])", ""), + strcmp("$(test.ary[][0])", ""), + strcmp("$(test.ary[][1])", "leading blank field"), + strcmp( + "$(test.ary[# A duplicate follows][0])", "# A duplicate follows" + ), + strcmp( + "$(test.ary[# A duplicate follows][1])", + "this line is not always a comment" + ), + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "also"), + strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), + strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), + strcmp("$(test.ary[last][0])", "last"), + strcmp("$(test.ary[last][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[here is][0] = 'here is', saw '$(test.ary[here is][0])'"; "expected test.ary[here is][1] = 'a line', saw '$(test.ary[here is][1])'"; "expected test.ary[here is][2] = ' with spaces ', saw '$(test.ary[here is][2])'"; "expected test.ary[here is][3] = ' in it', saw '$(test.ary[here is][3])'"; - "expected test.ary[blank][0] = 'blank', saw '$(test.ary[blank][0])'"; "expected test.ary[blank][1] = 'fields', saw '$(test.ary[blank][1])'"; "expected test.ary[blank][2] = '', saw '$(test.ary[blank][2])'"; @@ -130,18 +117,14 @@ bundle agent check "expected test.ary[blank][4] = 'in here', saw '$(test.ary[blank][4])'"; "expected test.ary[blank][5] = '', saw '$(test.ary[blank][5])'"; "expected test.ary[blank][6] = '', saw '$(test.ary[blank][6])'"; - "expected test.ary[][0] = '', saw '$(test.ary[][0])'"; "expected test.ary[][1] = 'leading blank field', saw '$(test.ary[][1])'"; - "expected test.ary[# A duplicate follows][0] = '# A duplicate follows', saw '$(test.ary[# A duplicate follows][0])'"; "expected test.ary[# A duplicate follows][1] = 'this line is not always a comment', saw '$(test.ary[# A duplicate follows][1])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'also', saw '$(test.ary[this][1])'"; "expected test.ary[this][2] = '$(const.dollar)test.ary[this][2]', saw '$(test.ary[this][2])'"; "expected test.ary[this][3] = '$(const.dollar)test.ary[this][3]', saw '$(test.ary[this][3])'"; - "expected test.ary[last][0] = 'last', saw '$(test.ary[last][0])'"; "expected test.ary[last][1] = 'one', saw '$(test.ary[last][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices_real_comments.cf b/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices_real_comments.cf index 9be0baf3e0..59cf4ceb65 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices_real_comments.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices_real_comments.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,87 +36,73 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarray("ary", "$(G.testfile)","^#.*",":",10,1000); - "num" int => "7"; + "cnt" int => readstringarray("ary", "$(G.testfile)", "^#.*", ":", 10, 1000); + "num" int => "7"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[here is][0])", "here is"), - strcmp("$(test.ary[here is][1])", "a line"), - strcmp("$(test.ary[here is][2])", " with spaces "), - strcmp("$(test.ary[here is][3])", " in it"), - - strcmp("$(test.ary[blank][0])", "blank"), - strcmp("$(test.ary[blank][0])", "fields"), - strcmp("$(test.ary[blank][0])", ""), - strcmp("$(test.ary[blank][0])", ""), - strcmp("$(test.ary[blank][0])", "in here"), - strcmp("$(test.ary[blank][0])", ""), - strcmp("$(test.ary[blank][0])", ""), - - strcmp("$(test.ary[][0])", ""), - strcmp("$(test.ary[][1])", "leading blank field"), - - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "also"), - strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), - strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), - - strcmp("$(test.ary[last][0])", "last"), - strcmp("$(test.ary[last][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[here is][0])", "here is"), + strcmp("$(test.ary[here is][1])", "a line"), + strcmp("$(test.ary[here is][2])", " with spaces "), + strcmp("$(test.ary[here is][3])", " in it"), + strcmp("$(test.ary[blank][0])", "blank"), + strcmp("$(test.ary[blank][0])", "fields"), + strcmp("$(test.ary[blank][0])", ""), + strcmp("$(test.ary[blank][0])", ""), + strcmp("$(test.ary[blank][0])", "in here"), + strcmp("$(test.ary[blank][0])", ""), + strcmp("$(test.ary[blank][0])", ""), + strcmp("$(test.ary[][0])", ""), + strcmp("$(test.ary[][1])", "leading blank field"), + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "also"), + strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), + strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), + strcmp("$(test.ary[last][0])", "last"), + strcmp("$(test.ary[last][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[here is][0] = 'here is', saw '$(test.ary[here is][0])'"; "expected test.ary[here is][1] = 'a line', saw '$(test.ary[here is][1])'"; "expected test.ary[here is][2] = ' with spaces ', saw '$(test.ary[here is][2])'"; "expected test.ary[here is][3] = ' in it', saw '$(test.ary[here is][3])'"; - "expected test.ary[blank][0] = 'blank', saw '$(test.ary[blank][0])'"; "expected test.ary[blank][0] = 'fields', saw '$(test.ary[blank][0])'"; "expected test.ary[blank][0] = '', saw '$(test.ary[blank][0])'"; @@ -127,18 +110,14 @@ bundle agent check "expected test.ary[blank][0] = 'in here', saw '$(test.ary[blank][0])'"; "expected test.ary[blank][0] = '', saw '$(test.ary[blank][0])'"; "expected test.ary[blank][0] = '', saw '$(test.ary[blank][0])'"; - "expected test.ary[][0] = '', saw '$(test.ary[][0])'"; "expected test.ary[][1] = 'leading blank field', saw '$(test.ary[][1])'"; - "expected test.ary[# A duplicate follows][0] = '# A duplicate follows', saw '$(test.ary[# A duplicate follows][0])'"; "expected test.ary[# A duplicate follows][1] = 'this line is not always a comment', saw '$(test.ary[# A duplicate follows][1])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'also', saw '$(test.ary[this][1])'"; "expected test.ary[this][2] = '$(const.dollar)test.ary[this][2]', saw '$(test.ary[this][2])'"; "expected test.ary[this][3] = '$(const.dollar)test.ary[this][3]', saw '$(test.ary[this][3])'"; - "expected test.ary[last][0] = 'last', saw '$(test.ary[last][0])'"; "expected test.ary[last][1] = 'one', saw '$(test.ary[last][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices_real_comments_noemptyfields.cf b/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices_real_comments_noemptyfields.cf index 9f6809a86d..2530cf0315 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices_real_comments_noemptyfields.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices_real_comments_noemptyfields.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,98 +36,82 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarray("ary", "$(G.testfile)","^#.*",":+",10,1000); - "num" int => "7"; + "cnt" + int => readstringarray("ary", "$(G.testfile)", "^#.*", ":+", 10, 1000); + + "num" int => "7"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[here is][0])", "here is"), - strcmp("$(test.ary[here is][1])", "a line"), - strcmp("$(test.ary[here is][2])", " with spaces "), - strcmp("$(test.ary[here is][3])", " in it"), - - strcmp("$(test.ary[blank][0])", "blank"), - strcmp("$(test.ary[blank][1])", "fields"), - strcmp("$(test.ary[blank][2])", "in here"), - - strcmp("$(test.ary[][0])", ""), - strcmp("$(test.ary[][1])", "leading blank field"), - - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "also"), - strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), - strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), - - strcmp("$(test.ary[last][0])", "last"), - strcmp("$(test.ary[last][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[here is][0])", "here is"), + strcmp("$(test.ary[here is][1])", "a line"), + strcmp("$(test.ary[here is][2])", " with spaces "), + strcmp("$(test.ary[here is][3])", " in it"), + strcmp("$(test.ary[blank][0])", "blank"), + strcmp("$(test.ary[blank][1])", "fields"), + strcmp("$(test.ary[blank][2])", "in here"), + strcmp("$(test.ary[][0])", ""), + strcmp("$(test.ary[][1])", "leading blank field"), + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "also"), + strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), + strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), + strcmp("$(test.ary[last][0])", "last"), + strcmp("$(test.ary[last][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[here is][0] = 'here is', saw '$(test.ary[here is][0])'"; "expected test.ary[here is][1] = 'a line', saw '$(test.ary[here is][1])'"; "expected test.ary[here is][2] = ' with spaces ', saw '$(test.ary[here is][2])'"; "expected test.ary[here is][3] = ' in it', saw '$(test.ary[here is][3])'"; - "expected test.ary[blank][0] = 'blank', saw '$(test.ary[blank][0])'"; "expected test.ary[blank][1] = 'fields', saw '$(test.ary[blank][1])'"; "expected test.ary[blank][2] = 'in here', saw '$(test.ary[blank][2])'"; - "expected test.ary[][0] = '', saw '$(test.ary[][0])'"; "expected test.ary[][1] = 'leading blank field', saw '$(test.ary[][1])'"; - "expected test.ary[# A duplicate follows][0] = '# A duplicate follows', saw '$(test.ary[# A duplicate follows][0])'"; "expected test.ary[# A duplicate follows][1] = 'this line is not always a comment', saw '$(test.ary[# A duplicate follows][1])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'also', saw '$(test.ary[this][1])'"; "expected test.ary[this][2] = '$(const.dollar)test.ary[this][2]', saw '$(test.ary[this][2])'"; "expected test.ary[this][3] = '$(const.dollar)test.ary[this][3]', saw '$(test.ary[this][3])'"; - "expected test.ary[last][0] = 'last', saw '$(test.ary[last][0])'"; "expected test.ary[last][1] = 'one', saw '$(test.ary[last][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices_trailing_newlines.cf b/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices_trailing_newlines.cf index 25491b1665..c3bbee1bb0 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices_trailing_newlines.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readstringarray_weird_indices_trailing_newlines.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -42,90 +39,84 @@ last:one "; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarray("ary", "$(G.testfile)","NoComment",":",10,1000); - "num" int => "8"; + "cnt" + int => readstringarray( + "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 + ); + + "num" int => "8"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0"), - strcmp("$(test.ary[0][1])", "1"), - strcmp("$(test.ary[0][2])", "2"), - - strcmp("$(test.ary[1][0])", "1"), - strcmp("$(test.ary[1][1])", "2"), - strcmp("$(test.ary[1][2])", "3"), - - strcmp("$(test.ary[here is][0])", "here is"), - strcmp("$(test.ary[here is][1])", "a line"), - strcmp("$(test.ary[here is][2])", " with spaces "), - strcmp("$(test.ary[here is][3])", " in it"), - - strcmp("$(test.ary[blank][0])", "blank"), - strcmp("$(test.ary[blank][1])", "fields"), - strcmp("$(test.ary[blank][2])", ""), - strcmp("$(test.ary[blank][3])", ""), - strcmp("$(test.ary[blank][4])", "in here"), - strcmp("$(test.ary[blank][5])", ""), - strcmp("$(test.ary[blank][6])", ""), - - strcmp("$(test.ary[][0])", ""), - strcmp("$(test.ary[][1])", "leading blank field"), - - strcmp("$(test.ary[# A duplicate follows][0])", "# A duplicate follows"), - strcmp("$(test.ary[# A duplicate follows][1])", "this line is not always a comment"), - - strcmp("$(test.ary[this][0])", "this"), - strcmp("$(test.ary[this][1])", "also"), - strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), - strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), - - strcmp("$(test.ary[last][0])", "last"), - strcmp("$(test.ary[last][1])", "one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0"), + strcmp("$(test.ary[0][1])", "1"), + strcmp("$(test.ary[0][2])", "2"), + strcmp("$(test.ary[1][0])", "1"), + strcmp("$(test.ary[1][1])", "2"), + strcmp("$(test.ary[1][2])", "3"), + strcmp("$(test.ary[here is][0])", "here is"), + strcmp("$(test.ary[here is][1])", "a line"), + strcmp("$(test.ary[here is][2])", " with spaces "), + strcmp("$(test.ary[here is][3])", " in it"), + strcmp("$(test.ary[blank][0])", "blank"), + strcmp("$(test.ary[blank][1])", "fields"), + strcmp("$(test.ary[blank][2])", ""), + strcmp("$(test.ary[blank][3])", ""), + strcmp("$(test.ary[blank][4])", "in here"), + strcmp("$(test.ary[blank][5])", ""), + strcmp("$(test.ary[blank][6])", ""), + strcmp("$(test.ary[][0])", ""), + strcmp("$(test.ary[][1])", "leading blank field"), + strcmp( + "$(test.ary[# A duplicate follows][0])", "# A duplicate follows" + ), + strcmp( + "$(test.ary[# A duplicate follows][1])", + "this line is not always a comment" + ), + strcmp("$(test.ary[this][0])", "this"), + strcmp("$(test.ary[this][1])", "also"), + strcmp("$(test.ary[this][2])", "$(const.dollar)test.ary[this][2]"), + strcmp("$(test.ary[this][3])", "$(const.dollar)test.ary[this][3]"), + strcmp("$(test.ary[last][0])", "last"), + strcmp("$(test.ary[last][1])", "one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0', saw '$(test.ary[0][0])'"; "expected test.ary[0][1] = '1', saw '$(test.ary[0][1])'"; "expected test.ary[0][2] = '2', saw '$(test.ary[0][2])'"; - "expected test.ary[1][0] = '1', saw '$(test.ary[1][0])'"; "expected test.ary[1][1] = '2', saw '$(test.ary[1][1])'"; "expected test.ary[1][2] = '3', saw '$(test.ary[1][2])'"; - "expected test.ary[here is][0] = 'here is', saw '$(test.ary[here is][0])'"; "expected test.ary[here is][1] = 'a line', saw '$(test.ary[here is][1])'"; "expected test.ary[here is][2] = ' with spaces ', saw '$(test.ary[here is][2])'"; "expected test.ary[here is][3] = ' in it', saw '$(test.ary[here is][3])'"; - "expected test.ary[blank][0] = 'blank', saw '$(test.ary[blank][0])'"; "expected test.ary[blank][1] = 'fields', saw '$(test.ary[blank][1])'"; "expected test.ary[blank][2] = '', saw '$(test.ary[blank][2])'"; @@ -133,18 +124,14 @@ bundle agent check "expected test.ary[blank][4] = 'in here', saw '$(test.ary[blank][4])'"; "expected test.ary[blank][5] = '', saw '$(test.ary[blank][5])'"; "expected test.ary[blank][6] = '', saw '$(test.ary[blank][6])'"; - "expected test.ary[][0] = '', saw '$(test.ary[][0])'"; "expected test.ary[][1] = 'leading blank field', saw '$(test.ary[][1])'"; - "expected test.ary[# A duplicate follows][0] = '# A duplicate follows', saw '$(test.ary[# A duplicate follows][0])'"; "expected test.ary[# A duplicate follows][1] = 'this line is not always a comment', saw '$(test.ary[# A duplicate follows][1])'"; - "expected test.ary[this][0] = 'this', saw '$(test.ary[this][0])'"; "expected test.ary[this][1] = 'also', saw '$(test.ary[this][1])'"; "expected test.ary[this][2] = '$(const.dollar)test.ary[this][2]', saw '$(test.ary[this][2])'"; "expected test.ary[this][3] = '$(const.dollar)test.ary[this][3]', saw '$(test.ary[this][3])'"; - "expected test.ary[last][0] = 'last', saw '$(test.ary[last][0])'"; "expected test.ary[last][1] = 'one', saw '$(test.ary[last][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readstringarrayidx_change_separator_to_s.cf b/tests/acceptance/01_vars/02_functions/staging/readstringarrayidx_change_separator_to_s.cf index 2da6c1a4a7..4a69454c9d 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readstringarrayidx_change_separator_to_s.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readstringarrayidx_change_separator_to_s.cf @@ -7,21 +7,19 @@ # 460-479 parsestringarrayidx # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -29,8 +27,7 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - - "0:1:2 + "0:1:2 1:2:3 here is:a line: with spaces : in it blank:fields:::in here:: @@ -39,91 +36,74 @@ this:is:a:test # A duplicate follows: this line is not always a comment this:also last:one"; - } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "cnt" int => readstringarrayidx("ary", "$(G.testfile)","^#.*","s+",10,1000); - "num" int => "8"; + "cnt" + int => readstringarrayidx("ary", "$(G.testfile)", "^#.*", "s+", 10, 1000); + + "num" int => "8"; } ####################################################### - bundle agent check { vars: - "idx" slist => getindices("test.ary"); + "idx" slist => getindices("test.ary"); classes: - "ok" and => { - strcmp("$(test.num)", "$(test.cnt)"), - - strcmp("$(test.ary[0][0])", "0:1:2"), - - strcmp("$(test.ary[1][0])", "1:2:3"), - - strcmp("$(test.ary[2][0])", "here i"), - strcmp("$(test.ary[2][1])", ":a line: with "), - strcmp("$(test.ary[2][2])", "pace"), - strcmp("$(test.ary[2][3])", " : in it"), - - strcmp("$(test.ary[3][0])", "blank:field"), - strcmp("$(test.ary[3][1])", ":::in here::"), - - strcmp("$(test.ary[4][0])", ":leading blank field"), - - strcmp("$(test.ary[5][0])", "thi"), - strcmp("$(test.ary[5][1])", ":i"), - strcmp("$(test.ary[5][2])", ":a:te"), - strcmp("$(test.ary[5][3])", "t"), - - strcmp("$(test.ary[6][0])", "thi"), - strcmp("$(test.ary[6][1])", ":al"), - strcmp("$(test.ary[6][2])", "o"), - - strcmp("$(test.ary[7][0])", "la"), - strcmp("$(test.ary[7][1])", "t:one"), + "ok" + and => { + strcmp("$(test.num)", "$(test.cnt)"), + strcmp("$(test.ary[0][0])", "0:1:2"), + strcmp("$(test.ary[1][0])", "1:2:3"), + strcmp("$(test.ary[2][0])", "here i"), + strcmp("$(test.ary[2][1])", ":a line: with "), + strcmp("$(test.ary[2][2])", "pace"), + strcmp("$(test.ary[2][3])", " : in it"), + strcmp("$(test.ary[3][0])", "blank:field"), + strcmp("$(test.ary[3][1])", ":::in here::"), + strcmp("$(test.ary[4][0])", ":leading blank field"), + strcmp("$(test.ary[5][0])", "thi"), + strcmp("$(test.ary[5][1])", ":i"), + strcmp("$(test.ary[5][2])", ":a:te"), + strcmp("$(test.ary[5][3])", "t"), + strcmp("$(test.ary[6][0])", "thi"), + strcmp("$(test.ary[6][1])", ":al"), + strcmp("$(test.ary[6][2])", "o"), + strcmp("$(test.ary[7][0])", "la"), + strcmp("$(test.ary[7][1])", "t:one"), }; reports: DEBUG:: "expected $(test.num) entries, saw $(test.cnt)"; - "saw array indices '$(idx)'"; - "expected test.ary[0][0] = '0:1:2', saw '$(test.ary[0][0])'"; - "expected test.ary[1][0] = '1:2:3', saw '$(test.ary[1][0])'"; - "expected test.ary[2][0] = 'here i', saw '$(test.ary[2][0])'"; "expected test.ary[2][1] = ':a line: with ', saw '$(test.ary[2][1])'"; "expected test.ary[2][2] = 'pace', saw '$(test.ary[2][2])'"; "expected test.ary[2][3] = ' : in it', saw '$(test.ary[2][3])'"; - "expected test.ary[3][0] = 'blank:field', saw '$(test.ary[3][0])'"; "expected test.ary[3][1] = ':::in here::', saw '$(test.ary[3][1])'"; - "expected test.ary[4][0] = ':leading blank field', saw '$(test.ary[4][0])'"; - "expected test.ary[5][0] = 'thi', saw '$(test.ary[5][0])'"; "expected test.ary[5][1] = ':i', saw '$(test.ary[5][1])'"; "expected test.ary[5][2] = ':a:te', saw '$(test.ary[5][2])'"; "expected test.ary[5][3] = 't', saw '$(test.ary[5][3])'"; - "expected test.ary[6][0] = 'thi', saw '$(test.ary[6][0])'"; "expected test.ary[6][1] = ':al', saw '$(test.ary[6][1])'"; "expected test.ary[6][2] = 'o', saw '$(test.ary[6][2])'"; - "expected test.ary[7][0] = 'la', saw '$(test.ary[7][0])'"; "expected test.ary[7][1] = 't:one', saw '$(test.ary[7][1])'"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readstringlist.cf b/tests/acceptance/01_vars/02_functions/staging/readstringlist.cf index 2fdc59dcf3..46adf0da29 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readstringlist.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readstringlist.cf @@ -3,21 +3,19 @@ # Test readstringlist() issue 364, also 366 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,45 +23,52 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123, ,456,789"; # "empty" fields + "123, ,456,789"; + + # "empty" fields } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)","NoComment",",",5,100); - "sum" real => sum("nums"); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", ",", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" slist => { @{test.nums} }; + "nums" slist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/staging/readstringlist2.cf b/tests/acceptance/01_vars/02_functions/staging/readstringlist2.cf index 390ddb8aea..1d8fe3dade 100644 --- a/tests/acceptance/01_vars/02_functions/staging/readstringlist2.cf +++ b/tests/acceptance/01_vars/02_functions/staging/readstringlist2.cf @@ -3,21 +3,19 @@ # Test readstringlist() issue 364, also 366 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" delete => init_delete; + + "$(G.testfile)" create => "true", edit_line => init_fill_in; } @@ -25,45 +23,52 @@ bundle agent init bundle edit_line init_fill_in { insert_lines: - "123,broken,456,789"; # non-numeric fields + "123,broken,456,789"; + + # non-numeric fields } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)","NoComment",",",5,100); - "sum" real => sum("nums"); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", ",", 5, 100); + "sum" real => sum("nums"); } ####################################################### - bundle agent check { vars: - "nums" slist => { @{test.nums} }; + "nums" slist => { @{test.nums} }; classes: - "ok_list" not => strcmp("won't match", "$(nums)"); - "ok123" expression => strcmp("123", "$(nums)"); - "ok456" expression => strcmp("456", "$(nums)"); - "ok789" expression => strcmp("789", "$(nums)"); - "ok" and => { "ok_list", "ok123", "ok456", "ok789", - islessthan("$(test.sum)", "1368.1"), - isgreaterthan("$(test.sum)", "1367.9") + "ok_list" not => strcmp("won't match", "$(nums)"); + "ok123" expression => strcmp("123", "$(nums)"); + "ok456" expression => strcmp("456", "$(nums)"); + "ok789" expression => strcmp("789", "$(nums)"); + + "ok" + and => { + "ok_list", + "ok123", + "ok456", + "ok789", + islessthan("$(test.sum)", "1368.1"), + isgreaterthan("$(test.sum)", "1367.9"), }; reports: DEBUG:: "nums: $(nums)"; "sum: $(test.sum)"; + ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/storejson.cf b/tests/acceptance/01_vars/02_functions/storejson.cf index 913a566822..018fdccf09 100644 --- a/tests/acceptance/01_vars/02_functions/storejson.cf +++ b/tests/acceptance/01_vars/02_functions/storejson.cf @@ -1,36 +1,35 @@ # Test that the storejson() function will convert a data container back to JSON - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { vars: - "mylist" slist => { "x", "y" }; - "data" data => parsejson('{ + "mylist" slist => { "x", "y" }; + "data" data => parsejson('{ "x": [ 1, 2, 3 ] }'); - - "datas" string => storejson(data); - - "data_from_slist" string => storejson(mylist); - "data_from_inline" string => storejson('{ "a": "b" }'); + "datas" string => storejson(data); + "data_from_slist" string => storejson(mylist); + "data_from_inline" string => storejson('{ "a": "b" }'); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/storejson_edge_case.cf b/tests/acceptance/01_vars/02_functions/storejson_edge_case.cf index ca3acdb701..b51b3223e8 100644 --- a/tests/acceptance/01_vars/02_functions/storejson_edge_case.cf +++ b/tests/acceptance/01_vars/02_functions/storejson_edge_case.cf @@ -1,22 +1,28 @@ # Test fix for previous bug that truncates JSON data greater than 4096 bytes - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ########################################################## - -bundle agent test { +bundle agent test +{ vars: - "data" string => storejson('{ "A very long text": "Hello, everyone! This is the LONGEST TEXT EVER! I was inspired by the various other longest texts ever on the internet, and I wanted to make my own. So here it is! This is going to be a WORLD RECORD! This is actually my third attempt at doing this. The first time, I didnt save it. The second time, the Neocities editor crashed. Now Im writing this in Notepad, then copying it into the Neocities editor instead of typing it directly in the Neocities editor to avoid crashing. It sucks that my past two attempts are gone now. Those actually got pretty long. Not the longest, but still pretty long. I hope this one wont get lost somehow. Anyways, lets talk about WAFFLES! I like waffles. Waffles are cool. Waffles is a funny word. Theres a Teen Titans Go episode called Waffles where the word Waffles is said a hundred-something times. Its pretty annoying. Theres also a Teen Titans Go episode about Pig Latin. Dont know what Pig Latin is? Its a language where you take all the consonants before the first vowel, move them to the end, and add -ay to the end. If the word begins with a vowel, you just add -way to the end. For example, Waffles becomes Afflesway. Ive been speaking Pig Latin fluently since the fourth grade, so it surprised me when I saw the episode for the first time. I speak Pig Latin with my sister sometimes. Its pretty fun. I like speaking it in public so that everyone around us gets confused. Thats never actually happened before, but if it ever does, twill be pretty funny. By the way, twill is a word I invented recently, and its a contraction of it will. I really hope it gains popularity in the near future, because twill is WAY more fun than saying itll. Itll is too boring. Nobody likes boring. This is nowhere near being the longest text ever, but eventually it will be! I might still be writing this a decade later, who knows? But right now, its not very long. But Ill just keep writing until it is the longest! Have you ever heard the song Dau Dau by Awesome Scampis? Its an amazing song. Look it up on YouTube! I play that song all the time around my sister! It drives her crazy, and I love it. Another way I like driving my sister crazy is by speaking my own made up language to her. She hates the languages I make! The only language that we both speak besides English is Pig Latin. I think you already knew that. Whatever. I think Im gonna go for now. Bye! Hi, Im back now. Im gonna contribute more to this soon-to-be giant wall of text. I just realised I have a giant stuffed frog on my bed. I forgot his name. Im pretty sure it was something stupid though. I think it was FROG in Morse Code or something. Morse Code is cool. I know a bit of it, but Im not very good at it. Im also not very good at French. I barely know anything in French, and my pronunciation probably sucks. But Im learning it, at least. Im also learning Esperanto. Its this language that was made up by some guy a long time ago to be the universal language. A lot of people speak it. I am such a language nerd. Half of this text is probably gonna be about languages. But hey, as long as its long! Ha, get it? As LONG as its LONG? Im so funny, right? No, Im not. I should probably get some sleep. Goodnight! Hello, Im back again. I basically have only two interests nowadays: languages and furries. What? Oh, sorry, I thought you knew I was a furry. Haha, oops. Anyway, yeah, Im a furry, but since Im a young furry, I cant really do as much as I would like to do in the fandom. When Im older, I would like to have a fursuit, go to furry conventions, all that stuff. But for now I can only dream of that. Sorry you had to deal with me talking about furries, but Im honestly very desperate for this to be the longest text ever. Last night I was watching nothing but fursuit unboxings. I think I need help. This one time, me and my mom were going to go to a furry Christmas party, but we didnt end up going because of the fact that there was alcohol on the premises, and that she didnt wanna have to be a mom dragging her son through a crowd of furries. Both of those reasons were understandable. Okay, hopefully I wont have to talk about furries anymore. I dont care if youre a furry reading this right now, I just dont wanna have to torture everyone else."}'); + "data" + string => storejson( + '{ "A very long text": "Hello, everyone! This is the LONGEST TEXT EVER! I was inspired by the various other longest texts ever on the internet, and I wanted to make my own. So here it is! This is going to be a WORLD RECORD! This is actually my third attempt at doing this. The first time, I didnt save it. The second time, the Neocities editor crashed. Now Im writing this in Notepad, then copying it into the Neocities editor instead of typing it directly in the Neocities editor to avoid crashing. It sucks that my past two attempts are gone now. Those actually got pretty long. Not the longest, but still pretty long. I hope this one wont get lost somehow. Anyways, lets talk about WAFFLES! I like waffles. Waffles are cool. Waffles is a funny word. Theres a Teen Titans Go episode called Waffles where the word Waffles is said a hundred-something times. Its pretty annoying. Theres also a Teen Titans Go episode about Pig Latin. Dont know what Pig Latin is? Its a language where you take all the consonants before the first vowel, move them to the end, and add -ay to the end. If the word begins with a vowel, you just add -way to the end. For example, Waffles becomes Afflesway. Ive been speaking Pig Latin fluently since the fourth grade, so it surprised me when I saw the episode for the first time. I speak Pig Latin with my sister sometimes. Its pretty fun. I like speaking it in public so that everyone around us gets confused. Thats never actually happened before, but if it ever does, twill be pretty funny. By the way, twill is a word I invented recently, and its a contraction of it will. I really hope it gains popularity in the near future, because twill is WAY more fun than saying itll. Itll is too boring. Nobody likes boring. This is nowhere near being the longest text ever, but eventually it will be! I might still be writing this a decade later, who knows? But right now, its not very long. But Ill just keep writing until it is the longest! Have you ever heard the song Dau Dau by Awesome Scampis? Its an amazing song. Look it up on YouTube! I play that song all the time around my sister! It drives her crazy, and I love it. Another way I like driving my sister crazy is by speaking my own made up language to her. She hates the languages I make! The only language that we both speak besides English is Pig Latin. I think you already knew that. Whatever. I think Im gonna go for now. Bye! Hi, Im back now. Im gonna contribute more to this soon-to-be giant wall of text. I just realised I have a giant stuffed frog on my bed. I forgot his name. Im pretty sure it was something stupid though. I think it was FROG in Morse Code or something. Morse Code is cool. I know a bit of it, but Im not very good at it. Im also not very good at French. I barely know anything in French, and my pronunciation probably sucks. But Im learning it, at least. Im also learning Esperanto. Its this language that was made up by some guy a long time ago to be the universal language. A lot of people speak it. I am such a language nerd. Half of this text is probably gonna be about languages. But hey, as long as its long! Ha, get it? As LONG as its LONG? Im so funny, right? No, Im not. I should probably get some sleep. Goodnight! Hello, Im back again. I basically have only two interests nowadays: languages and furries. What? Oh, sorry, I thought you knew I was a furry. Haha, oops. Anyway, yeah, Im a furry, but since Im a young furry, I cant really do as much as I would like to do in the fandom. When Im older, I would like to have a fursuit, go to furry conventions, all that stuff. But for now I can only dream of that. Sorry you had to deal with me talking about furries, but Im honestly very desperate for this to be the longest text ever. Last night I was watching nothing but fursuit unboxings. I think I need help. This one time, me and my mom were going to go to a furry Christmas party, but we didnt end up going because of the fact that there was alcohol on the premises, and that she didnt wanna have to be a mom dragging her son through a crowd of furries. Both of those reasons were understandable. Okay, hopefully I wont have to talk about furries anymore. I dont care if youre a furry reading this right now, I just dont wanna have to torture everyone else."}' + ); } -bundle agent check { +bundle agent check +{ methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/strftime.cf b/tests/acceptance/01_vars/02_functions/strftime.cf index 1d7c61a0df..27617620c0 100644 --- a/tests/acceptance/01_vars/02_functions/strftime.cf +++ b/tests/acceptance/01_vars/02_functions/strftime.cf @@ -3,39 +3,43 @@ # Test strftime() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - # we don't use locale-sensitive formats! - "results" slist => { "1973-03-03 09:46:40", "124 1 18 200000000", $(dow) }; + # we don't use locale-sensitive formats! + "results" slist => { "1973-03-03 09:46:40", "124 1 18 200000000", $(dow) }; Monday:: "dow" string => "1"; + Tuesday:: "dow" string => "2"; + Wednesday:: "dow" string => "3"; + Thursday:: "dow" string => "4"; + Friday:: "dow" string => "5"; + Saturday:: "dow" string => "6"; + Sunday:: "dow" string => "0"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert; } @@ -43,26 +47,27 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "$(init.results)"; + "$(init.results)"; } ####################################################### - bundle agent test { - meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10253" }; + meta: + "test_soft_fail" + string => "windows", + meta => { "ENT-10253" }; vars: - "vals" slist => { - strftime('gmtime', '%F %T', 100000000), - strftime('localtime', '%j %w %W %s', 200000000), - strftime('localtime', '%w', now()), + "vals" + slist => { + strftime('gmtime', '%F %T', 100000000), + strftime('localtime', '%j %w %W %s', 200000000), + strftime('localtime', '%w', now()), }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -70,15 +75,17 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(test.vals)"; + "$(test.vals)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/strftime_GMT.cf b/tests/acceptance/01_vars/02_functions/strftime_GMT.cf index 0369b19d56..725038e38b 100644 --- a/tests/acceptance/01_vars/02_functions/strftime_GMT.cf +++ b/tests/acceptance/01_vars/02_functions/strftime_GMT.cf @@ -3,26 +3,24 @@ # Test strftime() against some GMT classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - # These classes don't depend on the locale - # we require two digits to filter out GMT_Hr0 through 9 - # (note that %k has a leading space, so we can't use it below) - "results" slist => classesmatching("^GMT_(Hr|Min|Yr)\d\d+$"); + # These classes don't depend on the locale + # we require two digits to filter out GMT_Hr0 through 9 + # (note that %k has a leading space, so we can't use it below) + "results" slist => classesmatching("^GMT_(Hr|Min|Yr)\d\d+$"); files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert; } @@ -30,23 +28,23 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "$(init.results)"; + "$(init.results)"; } ####################################################### - bundle agent test { vars: - "vals" slist => { - # note that %k has a leading space, don't use it - strftime('gmtime', 'GMT_Hr%H', now()), - strftime('gmtime', 'GMT_Min%M', now()), - strftime('gmtime', 'GMT_Yr%Y', now()), + "vals" + slist => { + # note that %k has a leading space, don't use it + strftime('gmtime', 'GMT_Hr%H', now()), + strftime('gmtime', 'GMT_Min%M', now()), + strftime('gmtime', 'GMT_Yr%Y', now()), }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -54,15 +52,17 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(test.vals)"; + "$(test.vals)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/string.cf b/tests/acceptance/01_vars/02_functions/string.cf index bbbbd61c8e..9167c5ceb0 100644 --- a/tests/acceptance/01_vars/02_functions/string.cf +++ b/tests/acceptance/01_vars/02_functions/string.cf @@ -1,30 +1,36 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default( "$(this.promise_filename)" ) }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { classes: - "ExistingClass"; + "ExistingClass"; vars: - "a_int" int => "1k"; - "a_real" real => "6.066"; - "a_string" string => "Really interesting string"; - "a_data_container_1" data => '{"foo": "bar"}'; - "a_data_container_2" data => '[1, 2, 3]'; - "a_data_container_3" data => '{"list": [1, 2, 3, 4], "obj": {"key": ["b", "a", "r"]}}'; - - "string_of_int" string => string("$(a_int)"); - "string_of_real" string => string("$(a_real)"); - "string_of_string" string => string("$(a_string)"); - "string_of_bool_true" string => string(and("ExistingClass")); - "string_of_bool_false" string => string(and("NonExistingClass")); - "string_of_data_container_1" string => string(a_data_container_1); # Strings not interpretted as references - "string_of_data_container_2" string => string("a_data_container_2"); # Strings not interpretted as references - "string_of_data_container_3" string => string(@(a_data_container_3)); + "a_int" int => "1k"; + "a_real" real => "6.066"; + "a_string" string => "Really interesting string"; + "a_data_container_1" data => '{"foo": "bar"}'; + "a_data_container_2" data => '[1, 2, 3]'; + + "a_data_container_3" + data => '{"list": [1, 2, 3, 4], "obj": {"key": ["b", "a", "r"]}}'; + + "string_of_int" string => string("$(a_int)"); + "string_of_real" string => string("$(a_real)"); + "string_of_string" string => string("$(a_string)"); + "string_of_bool_true" string => string(and("ExistingClass")); + "string_of_bool_false" string => string(and("NonExistingClass")); + "string_of_data_container_1" string => string(a_data_container_1); + + # Strings not interpretted as references + "string_of_data_container_2" string => string("a_data_container_2"); + + # Strings not interpretted as references + "string_of_data_container_3" string => string(@(a_data_container_3)); # "test_args" string => string(); # This is caught by the parser } @@ -32,26 +38,54 @@ bundle agent init bundle agent check { meta: - "description" -> { "CFE-3476" } - string => "Test whether string() properly converts argument to string + "description" -> { "CFE-3476" } + string => "Test whether string() properly converts argument to string or string-serialises JSON *only* when explicitely passed as a '@()' reference"; classes: - "ok_int" expression => strcmp("1000", "$(init.string_of_int)"); - "ok_real" expression => strcmp("6.066000", "$(init.string_of_real)"); - "ok_string" expression => strcmp("Really interesting string", "$(init.string_of_string)"); - "ok_bool_true" expression => strcmp("any", "$(init.string_of_bool_true)"); - "ok_bool_false" expression => strcmp("!any", "$(init.string_of_bool_false)"); - "ok_data_container_1" expression => strcmp("a_data_container_1", "$(init.string_of_data_container_1)"); - "ok_data_container_2" expression => strcmp("a_data_container_2", "$(init.string_of_data_container_2)"); - "ok_data_container_3" expression => strcmp('{"list":[1,2,3,4],"obj":{"key":["b","a","r"]}}', - "$(init.string_of_data_container_3)"); - - "ok" expression => and("ok_int", "ok_real", "ok_string", "ok_bool_true", - "ok_bool_false", "ok_data_container_1", "ok_data_container_2", "ok_data_container_3"); + "ok_int" expression => strcmp("1000", "$(init.string_of_int)"); + "ok_real" expression => strcmp("6.066000", "$(init.string_of_real)"); + + "ok_string" + expression => strcmp( + "Really interesting string", "$(init.string_of_string)" + ); + + "ok_bool_true" expression => strcmp("any", "$(init.string_of_bool_true)"); + + "ok_bool_false" + expression => strcmp("!any", "$(init.string_of_bool_false)"); + + "ok_data_container_1" + expression => strcmp( + "a_data_container_1", "$(init.string_of_data_container_1)" + ); + + "ok_data_container_2" + expression => strcmp( + "a_data_container_2", "$(init.string_of_data_container_2)" + ); + + "ok_data_container_3" + expression => strcmp( + '{"list":[1,2,3,4],"obj":{"key":["b","a","r"]}}', + "$(init.string_of_data_container_3)" + ); + + "ok" + expression => and( + "ok_int", + "ok_real", + "ok_string", + "ok_bool_true", + "ok_bool_false", + "ok_data_container_1", + "ok_data_container_2", + "ok_data_container_3" + ); methods: - "Pass/Fail" - usebundle => dcs_passif( "ok", "$(this.promise_filename)" ), - inherit => "true"; + "Pass/Fail" + usebundle => dcs_passif("ok", "$(this.promise_filename)"), + inherit => "true"; } diff --git a/tests/acceptance/01_vars/02_functions/string_mustache.cf b/tests/acceptance/01_vars/02_functions/string_mustache.cf index e52c6dbff0..cae3d9a284 100644 --- a/tests/acceptance/01_vars/02_functions/string_mustache.cf +++ b/tests/acceptance/01_vars/02_functions/string_mustache.cf @@ -1,37 +1,49 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "desert" string => "Sahara"; - "state2" data => parsejson('{"x": 1, "y": [{"item": 2}, {"item": 3}, {"item": 4}]}'); + "desert" string => "Sahara"; + + "state2" + data => parsejson( + '{"x": 1, "y": [{"item": 2}, {"item": 3}, {"item": 4}]}' + ); } bundle agent test { vars: - "out11" string => string_mustache("desert = {{vars.init.desert}}"); + "out11" string => string_mustache("desert = {{vars.init.desert}}"); + + "out21" + string => string_mustache("desert = {{vars.init.desert}}", "init.state2"); - "out21" string => string_mustache("desert = {{vars.init.desert}}", "init.state2"); - "out22" string => string_mustache("x = {{x}}", "init.state2"); - "out23" string => string_mustache("{{#y}}{{item}} {{/y}}", "init.state2"); + "out22" string => string_mustache("x = {{x}}", "init.state2"); + "out23" string => string_mustache("{{#y}}{{item}} {{/y}}", "init.state2"); - "inline" string => string_mustache("{{#y}}{{item}} {{/y}}", '{ "y": [{"item": 2}, {"item": 3}, {"item": 4}]}'); + "inline" + string => string_mustache( + "{{#y}}{{item}} {{/y}}", + '{ "y": [{"item": 2}, {"item": 3}, {"item": 4}]}' + ); - "badref" string => string_mustache("desert = {{vars.init.desert}}", nosuch); + "badref" string => string_mustache("desert = {{vars.init.desert}}", nosuch); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/string_replace.cf b/tests/acceptance/01_vars/02_functions/string_replace.cf index 03b7009bcf..4aba179966 100644 --- a/tests/acceptance/01_vars/02_functions/string_replace.cf +++ b/tests/acceptance/01_vars/02_functions/string_replace.cf @@ -1,53 +1,50 @@ - ####################################################### # # Test string_replace function # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "test" string => "abcdefghij\t\n"; - "test2" string => "(){}[].*?"; - - # normal tests - "match_once" string => string_replace("abcd", "abc", "ABC"); - "match_twice" string => string_replace("abcdabcd", "abcd", "hello"); - "match_none" string => string_replace("abdc", "abcd", "nope"); - "match_none2" string => string_replace($(test), "nonesuch", "TEST"); - - "overlap" string => string_replace("aaaa", "aaa", "yes"); - - "replace" string => string_replace($(test), "\t", "\r"); - "replace2" string => string_replace($(test), "ghij\t", "tEsT"); - "replace3" string => string_replace($(test), "abcdefghij\t\n", "no"); - - # tests for regex special characters - "special" string => string_replace($(test2), "()", "1"); - "special2" string => string_replace($(test2), "{}", "\1"); - "special3" string => string_replace($(test2), ".*?", "\2"); - - # empty cases - "empty" string => string_replace("", "abc", "ABC"); - "empty2" string => string_replace("", "abc", ""); + "test" string => "abcdefghij\t\n"; + "test2" string => "(){}[].*?"; + + # normal tests + "match_once" string => string_replace("abcd", "abc", "ABC"); + "match_twice" string => string_replace("abcdabcd", "abcd", "hello"); + "match_none" string => string_replace("abdc", "abcd", "nope"); + "match_none2" string => string_replace($(test), "nonesuch", "TEST"); + "overlap" string => string_replace("aaaa", "aaa", "yes"); + "replace" string => string_replace($(test), "\t", "\r"); + "replace2" string => string_replace($(test), "ghij\t", "tEsT"); + "replace3" string => string_replace($(test), "abcdefghij\t\n", "no"); + + # tests for regex special characters + "special" string => string_replace($(test2), "()", "1"); + "special2" string => string_replace($(test2), "{}", "\1"); + "special3" string => string_replace($(test2), ".*?", "\2"); + + # empty cases + "empty" string => string_replace("", "abc", "ABC"); + "empty2" string => string_replace("", "abc", ""); } ####################################################### - bundle agent check { methods: - "" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/string_split_2k_variable.cf b/tests/acceptance/01_vars/02_functions/string_split_2k_variable.cf index 491896e44f..14e54a540d 100644 --- a/tests/acceptance/01_vars/02_functions/string_split_2k_variable.cf +++ b/tests/acceptance/01_vars/02_functions/string_split_2k_variable.cf @@ -1,12 +1,15 @@ -bundle agent main { +bundle agent main +{ vars: any:: "test_str" string => "147.228.4.62#443:www.afs2010.civ.zcu.cz www.agt.zcu.cz www.ah2015.zcu.cz www.ait.fdu.zcu.cz www.akv.zcu.cz www.albumjuristarum.zcu.cz www.amp.zcu.cz www.quiz.zcu.cz www.app.fdu.zcu.cz www.arnica.zcu.cz www.aud.zcu.cz www.audio.zcu.cz www.bedekr.fdu.zcu.cz www.beeronomics2019.zcu.cz www.beyondai.zcu.cz www.caduv.cz www.camop.zcu.cz www.canut.zcu.cz www.careercentre.zcu.cz www.cars.fdu.zcu.cz www.centem.zcu.cz www.chat2014.zcu.cz www.cidam.zcu.cz www.cvts.zcu.cz www.daah.zcu.cz www.dask.zcu.cz www.db-webz.zcu.cz www.dceryasynovenilu.zcu.cz www.dd-uwb-esiee.zcu.cz www.deti.zcu.cz www.diagnostika.zcu.cz www.didap.zcu.cz www.digipod.zcu.cz www.direct.zcu.cz www.disco.zcu.cz www.dispecink.zcu.cz www.dode.fek.zcu.cz www.eb-vyztymdp.zcu.cz www.economics.zcu.cz www.edom.zcu.cz www.eduproeu.zcu.cz www.edutest.zcu.cz www.ehotrod.zcu.cz www.elektromotorsport.zcu.cz www.elmon.fel.zcu.cz www.eltech.fel.zcu.cz www.envirogis.fpe.zcu.cz www.esecc.zcu.cz www.esf.kfi.zcu.cz www.esn.zcu.cz www.fel-utef.zcu.cz www.flab.zcu.cz www.florbal.zcu.cz www.frodja.zcu.cz www.futsal.zcu.cz www.gapps.zcu.cz www.gcindy.zcu.cz www.ha30.zcu.cz www.hb2014.ntc.zcu.cz www.hcenat.zcu.cz www.historie.zcu.cz www.hss.zcu.cz www.hsvv.zcu.cz www.icmd2016.zcu.cz www.inem.fek.zcu.cz www.info-studium.zcu.cz www.infoplatforma.zcu.cz www.informace.zcu.cz www.integrita.zcu.cz www.interdisciplinarita.zcu.cz www.ish2015.zcu.cz www.iso690.zcu.cz www.kee.zcu.cz www.kev.zcu.cz www.kohout.zcu.cz www.konstruktiv.zcu.cz www.kvk2.zcu.cz www.kvnt.zcu.cz www.kvpr.kks.zcu.cz www.lego.zcu.cz www.logickehry.zcu.cz www.lsfek.zcu.cz www.lsipc.zcu.cz www.masekjan.zcu.cz www.mobility.fpe.zcu.cz www.mobility.fpr.zcu.cz www.mojefavka.zcu.cz www.mojepc.zcu.cz www.multilab.fdu.zcu.cz www.mupic.eu www.nacelnik.civ.zcu.cz www.ocv.fzs.zcu.cz www.pc.fpe.zcu.cz www.pes.zcu.cz www.pf.zcu.cz www.pgs.zcu.cz www.pilinterreg.zcu.cz www.pilsencube.zcu.cz www.pir.fel.zcu.cz www.pldsdev.zcu.cz www.pohybovapruprava.zcu.cz www.poplatky.zcu.cz www.ppa2017.zcu.cz www.pracesdaty.zcu.cz www.profilzadavatele.zcu.cz www.projekt-minos.zcu.cz www.prvakoviny.zcu.cz www.radio.zcu.cz www.rcths.zcu.cz www.robotipk.zcu.cz www.ropovportal.zcu.cz www.rozvrhy.fpe.zcu.cz www.ruskecentrum.zcu.cz www.sauron6.zcu.cz www.scicom.zcu.cz www.ska.zcu.cz www.speedtest.zcu.cz www.stf2013.zcu.cz www.strojarna.zcu.cz www.studentskeotazniky.zcu.cz www.studykom.zcu.cz www.summon.zcu.cz www.sutnarka.zcu.cz www.svoc.fel.zcu.cz www.svoc.zcu.cz www.talent.zcu.cz www.technicka-ekologie.zcu.cz www.tfz.zcu.cz www.tvp.zcu.cz www.unipranet.zcu.cz www.usa.fek.zcu.cz www.usk.zcu.cz www.uspoint.zcu.cz www.veletrh.zcu.cz www.virtualbody.zcu.cz www.westernstars.zcu.cz www.wittgenstein.zcu.cz www.zkusebna.zcu.cz$(const.n)147.228.4.60#443:www.pit-plzen.zcu.cz"; - "test_list" -> { "CFE-3047" } # Promise to ticket that we don't crash - slist => string_split("$(test_str)", "\n", "5" ); # Segment 1 is truncated + "test_list" -> { "CFE-3047" } + # Promise to ticket that we don't crash + slist => string_split("$(test_str)", "\n", "5"); + # Segment 1 is truncated reports: any:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/string_trim.cf b/tests/acceptance/01_vars/02_functions/string_trim.cf index 4cd4e3c4a0..d3920135c4 100644 --- a/tests/acceptance/01_vars/02_functions/string_trim.cf +++ b/tests/acceptance/01_vars/02_functions/string_trim.cf @@ -1,47 +1,48 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "abcd1" string => string_trim("abcd"); - "abcd2" string => string_trim(" abcd"); - "abcd3" string => string_trim("abcd "); - "abcd4" string => string_trim(" abcd "); - "abcd5" string => string_trim("abcd + "abcd1" string => string_trim("abcd"); + "abcd2" string => string_trim(" abcd"); + "abcd3" string => string_trim("abcd "); + "abcd4" string => string_trim(" abcd "); + "abcd5" string => string_trim("abcd "); - "abcd6" string => string_trim(" + "abcd6" string => string_trim(" abcd"); - "abcd7" string => string_trim(" + "abcd7" string => string_trim(" abcd "); - "abcd_abcd" string => string_trim(" abcd abcd "); + "abcd_abcd" string => string_trim(" abcd abcd "); - # empty cases - "empty1" string => string_trim(""); - "empty2" string => string_trim(" "); - "empty3" string => string_trim(" + # empty cases + "empty1" string => string_trim(""); + "empty2" string => string_trim(" "); + "empty3" string => string_trim(" "); } ####################################################### - bundle agent check { methods: - "" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/sublist.cf b/tests/acceptance/01_vars/02_functions/sublist.cf index e59a5fe6a8..777f7d96f5 100644 --- a/tests/acceptance/01_vars/02_functions/sublist.cf +++ b/tests/acceptance/01_vars/02_functions/sublist.cf @@ -3,45 +3,41 @@ # Test sublist() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "test" slist => { - 1,2,3, - "one", "two", "three", - "long string", - "one", "two", "three", + "test" + slist => { + 1, 2, 3, "one", "two", "three", "long string", "one", "two", "three", }; - "test_head9999" slist => sublist("test", "head", 9999); - "test_head1" slist => sublist("test", "head", 1); - "test_head0" slist => sublist("test", "head", 0); - - "test_tail9999" slist => sublist("test", "tail", 9999); - "test_tail10" slist => sublist("test", "tail", 10); - "test_tail2" slist => sublist("test", "tail", 2); - "test_tail1" slist => sublist("test", "tail", 1); - "test_tail0" slist => sublist("test", "tail", 0); - - "test_inline" slist => sublist('[1,2,3,4,5,6,7]', "tail", 3); + "test_head9999" slist => sublist("test", "head", 9999); + "test_head1" slist => sublist("test", "head", 1); + "test_head0" slist => sublist("test", "head", 0); + "test_tail9999" slist => sublist("test", "tail", 9999); + "test_tail10" slist => sublist("test", "tail", 10); + "test_tail2" slist => sublist("test", "tail", 2); + "test_tail1" slist => sublist("test", "tail", 1); + "test_tail0" slist => sublist("test", "tail", 0); + "test_inline" slist => sublist('[1,2,3,4,5,6,7]', "tail", 3); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/sum_and_product.cf b/tests/acceptance/01_vars/02_functions/sum_and_product.cf index 62cbfe88bd..490f34f632 100644 --- a/tests/acceptance/01_vars/02_functions/sum_and_product.cf +++ b/tests/acceptance/01_vars/02_functions/sum_and_product.cf @@ -3,56 +3,73 @@ # Test 'sum' and 'product' functions # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { vars: - "normal_list" slist => { "1", "2", "3" }; - "empty_list" slist => { }; - "normal_object" data => parsejson('{ "a": 1, "b": 2 }'); - "empty_object" data => parsejson('{}'); - - "normal_list_sum" real => sum(normal_list); # 6 - "empty_list_sum" real => sum(empty_list); # 0 - "normal_object_sum" real => sum(normal_object); # 3 - "empty_object_sum" real => sum(empty_object); # 0 - - "inline_object_sum" real => sum('{ "a": 1, "b": 2 }'); # 3 - "inline_array_sum" real => sum('[ "a", 1, "b", 2 ]'); # 3 - - "normal_list_product" real => product(normal_list); # 6 - "empty_list_product" real => product(empty_list); # 1 - "normal_object_product" real => product(normal_object); # 2 - "empty_object_product" real => product(empty_object); # 1 - - "inline_object_product" real => product('{ "a": 1, "b": 2 }'); # 2 - "inline_array_product" real => product('[ "a", 1, "b", 2 ]'); # 0 -} + "normal_list" slist => { "1", "2", "3" }; + "empty_list" slist => {}; + "normal_object" data => parsejson('{ "a": 1, "b": 2 }'); + "empty_object" data => parsejson('{}'); + "normal_list_sum" real => sum(normal_list); + # 6 + "empty_list_sum" real => sum(empty_list); -####################################################### + # 0 + "normal_object_sum" real => sum(normal_object); -####################################################### + # 3 + "empty_object_sum" real => sum(empty_object); + + # 0 + "inline_object_sum" real => sum('{ "a": 1, "b": 2 }'); + + # 3 + "inline_array_sum" real => sum('[ "a", 1, "b", 2 ]'); + + # 3 + "normal_list_product" real => product(normal_list); + # 6 + "empty_list_product" real => product(empty_list); + + # 1 + "normal_object_product" real => product(normal_object); + + # 2 + "empty_object_product" real => product(empty_object); + + # 1 + "inline_object_product" real => product('{ "a": 1, "b": 2 }'); + + # 2 + "inline_array_product" real => product('[ "a", 1, "b", 2 ]'); + + # 0 +} + +####################################################### +####################################################### bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/sysctl.cf b/tests/acceptance/01_vars/02_functions/sysctl.cf index affe8aabaa..f07e624a36 100644 --- a/tests/acceptance/01_vars/02_functions/sysctl.cf +++ b/tests/acceptance/01_vars/02_functions/sysctl.cf @@ -1,17 +1,16 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "!linux"; + "test_skip_unsupported" string => "!linux"; commands: - "$(G.env) CFENGINE_TEST_OVERRIDE_PROCDIR=$(this.promise_dirname)/proc $(sys.cf_agent) -DAUTO -f $(this.promise_filename).sub"; + "$(G.env) CFENGINE_TEST_OVERRIDE_PROCDIR=$(this.promise_dirname)/proc $(sys.cf_agent) -DAUTO -f $(this.promise_filename).sub"; } diff --git a/tests/acceptance/01_vars/02_functions/text_xform.cf b/tests/acceptance/01_vars/02_functions/text_xform.cf index cabd791a5c..da47343419 100644 --- a/tests/acceptance/01_vars/02_functions/text_xform.cf +++ b/tests/acceptance/01_vars/02_functions/text_xform.cf @@ -1,42 +1,82 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { vars: - "tests" slist => { "q1", "q2", "q3", "q4" }; - "offsets" ilist => { "-1", "-2", "-5", "-10", "-20", "-26", "-27", "-28", "-10240", - "0", "1", "2", "5", "10", "20", "26", "27", "28", "10240" }; - "fn1" slist => { "string_head", "string_tail" }; - "data[q1]" string => "this is the Question"; - "data[q2]" string => ""; - "data[q3]" string => "some text is not $(const.t) simple + "tests" slist => { "q1", "q2", "q3", "q4" }; + + "offsets" + ilist => { + "-1", + "-2", + "-5", + "-10", + "-20", + "-26", + "-27", + "-28", + "-10240", + "0", + "1", + "2", + "5", + "10", + "20", + "26", + "27", + "28", + "10240", + }; + + "fn1" slist => { "string_head", "string_tail" }; + "data[q1]" string => "this is the Question"; + "data[q2]" string => ""; + "data[q3]" string => "some text is not $(const.t) simple "; - "data[q4]" string => readfile("$(this.promise_filename).txt", "inf"); - - "data[$(tests)_string_reverse]" string => string_reverse("$(data[$(tests)])"); - "data[$(tests)_string_length]" int => string_length("$(data[$(tests)])"); - "data[$(tests)_string_upcase]" string => string_upcase("$(data[$(tests)])"); - "data[$(tests)_string_downcase]" string => string_downcase("$(data[$(tests)])"); - "data[$(tests)_string_head_$(offsets)]" string => string_head("$(data[$(tests)])", $(offsets)); - "data[$(tests)_string_tail_$(offsets)]" string => string_tail("$(data[$(tests)])", $(offsets)); - "data[$(tests)_string_head_inline_pos]" string => string_head("$(data[$(tests)])", 3); - "data[$(tests)_string_tail_inline_pos]" string => string_tail("$(data[$(tests)])", 3); - "data[$(tests)_string_head_inline_neg]" string => string_head("$(data[$(tests)])", "-3"); - "data[$(tests)_string_tail_inline_neg]" string => string_tail("$(data[$(tests)])", "-3"); + "data[q4]" string => readfile("$(this.promise_filename).txt", "inf"); + + "data[$(tests)_string_reverse]" + string => string_reverse("$(data[$(tests)])"); + + "data[$(tests)_string_length]" int => string_length("$(data[$(tests)])"); + "data[$(tests)_string_upcase]" string => string_upcase("$(data[$(tests)])"); + + "data[$(tests)_string_downcase]" + string => string_downcase("$(data[$(tests)])"); + + "data[$(tests)_string_head_$(offsets)]" + string => string_head("$(data[$(tests)])", $(offsets)); + + "data[$(tests)_string_tail_$(offsets)]" + string => string_tail("$(data[$(tests)])", $(offsets)); + + "data[$(tests)_string_head_inline_pos]" + string => string_head("$(data[$(tests)])", 3); + + "data[$(tests)_string_tail_inline_pos]" + string => string_tail("$(data[$(tests)])", 3); + + "data[$(tests)_string_head_inline_neg]" + string => string_head("$(data[$(tests)])", "-3"); + + "data[$(tests)_string_tail_inline_neg]" + string => string_tail("$(data[$(tests)])", "-3"); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/type.cf b/tests/acceptance/01_vars/02_functions/type.cf index a6eda3c969..b8427897e9 100644 --- a/tests/acceptance/01_vars/02_functions/type.cf +++ b/tests/acceptance/01_vars/02_functions/type.cf @@ -8,7 +8,8 @@ body common control bundle agent init { vars: - "_data" data => ' + "_data" + data => ' { "_string": "abc", "_int": 123, @@ -19,74 +20,63 @@ bundle agent init "_array": [ 1, 2, 3 ], "_null": null }'; - "_string" string => "abc"; - "_int" int => "123"; - "_real" real => "123.4"; - "_slist" slist => { "a", "b", "c" }; - "_ilist" ilist => { "1", "2", "3" }; - "_rlist" rlist => { "1.2", "3.4", "5.6" }; + + "_string" string => "abc"; + "_int" int => "123"; + "_real" real => "123.4"; + "_slist" slist => { "a", "b", "c" }; + "_ilist" ilist => { "1", "2", "3" }; + "_rlist" rlist => { "1.2", "3.4", "5.6" }; } bundle agent test { meta: - "description" -> { "CFE-2240" } - string => "Test for expected results from policy function type"; + "description" -> { "CFE-2240" } + string => "Test for expected results from policy function type"; vars: - "test_00" string => type("init._data"); - "test_01" string => type("init._data", "true"); - - "test_02" string => type("init._data[_string]"); - "test_03" string => type("init._data[_string]", "true"); - - "test_04" string => type("init._data[_int]"); - "test_05" string => type("init._data[_int]", "true"); - - "test_06" string => type("init._data[_real]"); - "test_07" string => type("init._data[_real]", "true"); - - "test_08" string => type("init._data[_true]"); - "test_09" string => type("init._data[_true]", "true"); - - "test_10" string => type("init._data[_false]"); - "test_11" string => type("init._data[_false]", "true"); - - "test_12" string => type("init._data[_object]"); - "test_13" string => type("init._data[_object]", "true"); - - "test_14" string => type("init._data[_array]"); - "test_15" string => type("init._data[_array]", "true"); - - "test_16" string => type("init._data[_null]"); - "test_17" string => type("init._data[_null]", "true"); - - "test_18" string => type("init._string"); - "test_19" string => type("init._string", "true"); - - "test_20" string => type("init._int"); - "test_21" string => type("init._int", "true"); - - "test_22" string => type("init._real"); - "test_23" string => type("init._real", "true"); - - "test_24" string => type("init._slist", "false"); - "test_25" string => type("init._slist", "true"); - - "test_26" string => type("init._ilist", "no"); - "test_27" string => type("init._ilist", "yes"); - - "test_28" string => type("init._rlist", "off"); - "test_29" string => type("init._rlist", "on"); - - "test_30" string => type("undefined"); - "test_31" string => type("undefined", "true"); + "test_00" string => type("init._data"); + "test_01" string => type("init._data", "true"); + "test_02" string => type("init._data[_string]"); + "test_03" string => type("init._data[_string]", "true"); + "test_04" string => type("init._data[_int]"); + "test_05" string => type("init._data[_int]", "true"); + "test_06" string => type("init._data[_real]"); + "test_07" string => type("init._data[_real]", "true"); + "test_08" string => type("init._data[_true]"); + "test_09" string => type("init._data[_true]", "true"); + "test_10" string => type("init._data[_false]"); + "test_11" string => type("init._data[_false]", "true"); + "test_12" string => type("init._data[_object]"); + "test_13" string => type("init._data[_object]", "true"); + "test_14" string => type("init._data[_array]"); + "test_15" string => type("init._data[_array]", "true"); + "test_16" string => type("init._data[_null]"); + "test_17" string => type("init._data[_null]", "true"); + "test_18" string => type("init._string"); + "test_19" string => type("init._string", "true"); + "test_20" string => type("init._int"); + "test_21" string => type("init._int", "true"); + "test_22" string => type("init._real"); + "test_23" string => type("init._real", "true"); + "test_24" string => type("init._slist", "false"); + "test_25" string => type("init._slist", "true"); + "test_26" string => type("init._ilist", "no"); + "test_27" string => type("init._ilist", "yes"); + "test_28" string => type("init._rlist", "off"); + "test_29" string => type("init._rlist", "on"); + "test_30" string => type("undefined"); + "test_31" string => type("undefined", "true"); } bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - "$(this.promise_filename)"); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/02_functions/unsafe/findlocalusers_unsafe.cf b/tests/acceptance/01_vars/02_functions/unsafe/findlocalusers_unsafe.cf index 2787114af3..3510ebbe0f 100644 --- a/tests/acceptance/01_vars/02_functions/unsafe/findlocalusers_unsafe.cf +++ b/tests/acceptance/01_vars/02_functions/unsafe/findlocalusers_unsafe.cf @@ -1,73 +1,105 @@ -body common control +body common control { inputs => { "../../../default.sub.cf" }; bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } + bundle agent init { files: - "/tmp/test_folder1/." - create => "true"; - - "/tmp/test_folder2/." - create => "true"; + "/tmp/test_folder1/." create => "true"; + "/tmp/test_folder2/." create => "true"; users: - "testu1" - policy => "present", - home_dir => "/tmp/test_folder1", - description => "TestUser 1", - group_primary => "root", # we need a group which we know for sure the gid - shell => "/bin/sh", - uid => "12345"; - - "testu2" - policy => "present", - home_dir => "/tmp/test_folder2", - description => "TestUser 2", - group_primary => "root", - shell => "/bin/sh", - uid => "54321"; + "testu1" + policy => "present", + home_dir => "/tmp/test_folder1", + description => "TestUser 1", + group_primary => "root", + # we need a group which we know for sure the gid + shell => "/bin/sh", + uid => "12345"; + + "testu2" + policy => "present", + home_dir => "/tmp/test_folder2", + description => "TestUser 2", + group_primary => "root", + shell => "/bin/sh", + uid => "54321"; + vars: - "no" int => getfields("root:.*", "/etc/group", ":", "groupdata"); - "root_gid" string => "$(groupdata[3])"; - - # simple filters - "simple_filter" slist => { "name=testu1" }; - "number_filter" slist => { "uid=12345" }; - - # longer filters - "slist_filter" slist => { "gid=$(root_gid)", "name=testu1" }; - - # using data - "data_filter" data => '[ "gid=$(root_gid)", "name=testu1" ]'; - - # using regex - "simple_regex" slist => { "name=testu.*" }; - "number_regex" slist => { "uid=1234.*" }; - "longer_regex" slist => { "name=testu.*", "uid=1.*" }; - - # non-existent user - "unknown" slist => { "name=thisuserdoesntexist" }; + "no" int => getfields("root:.*", "/etc/group", ":", "groupdata"); + "root_gid" string => "$(groupdata[3])"; + + # simple filters + "simple_filter" slist => { "name=testu1" }; + "number_filter" slist => { "uid=12345" }; + + # longer filters + "slist_filter" slist => { "gid=$(root_gid)", "name=testu1" }; + + # using data + "data_filter" data => '[ "gid=$(root_gid)", "name=testu1" ]'; + + # using regex + "simple_regex" slist => { "name=testu.*" }; + "number_regex" slist => { "uid=1234.*" }; + "longer_regex" slist => { "name=testu.*", "uid=1.*" }; + + # non-existent user + "unknown" slist => { "name=thisuserdoesntexist" }; } -bundle agent test + +bundle agent test { vars: - "ulist1" data => mapdata(json, '"$(this.k)"', findlocalusers("@(init.simple_filter)")); - "ulist2" data => mapdata(json, '"$(this.k)"', findlocalusers("init.number_filter")); - "ulist3" data => mapdata(json, '"$(this.k)"', findlocalusers("@(init.data_filter)")); - "ulist4" data => mapdata(json, '"$(this.k)"', findlocalusers("@(init.slist_filter)")); - "ulist5" data => mapdata(json, '"$(this.k)"', findlocalusers("@(init.simple_regex)")); - "ulist6" data => mapdata(json, '"$(this.k)"', findlocalusers("@(init.number_regex)")); - "ulist7" data => mapdata(json, '"$(this.k)"', findlocalusers("@(init.longer_regex)")); - "ulist8" data => findlocalusers("@(init.unknown)"); + "ulist1" + data => mapdata( + json, '"$(this.k)"', findlocalusers("@(init.simple_filter)") + ); + + "ulist2" + data => mapdata( + json, '"$(this.k)"', findlocalusers("init.number_filter") + ); + + "ulist3" + data => mapdata( + json, '"$(this.k)"', findlocalusers("@(init.data_filter)") + ); + + "ulist4" + data => mapdata( + json, '"$(this.k)"', findlocalusers("@(init.slist_filter)") + ); + + "ulist5" + data => mapdata( + json, '"$(this.k)"', findlocalusers("@(init.simple_regex)") + ); + "ulist6" + data => mapdata( + json, '"$(this.k)"', findlocalusers("@(init.number_regex)") + ); + + "ulist7" + data => mapdata( + json, '"$(this.k)"', findlocalusers("@(init.longer_regex)") + ); + + "ulist8" data => findlocalusers("@(init.unknown)"); } + bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/url_get_local.cf b/tests/acceptance/01_vars/02_functions/url_get_local.cf index 066b9e79d1..9c946e0b2c 100644 --- a/tests/acceptance/01_vars/02_functions/url_get_local.cf +++ b/tests/acceptance/01_vars/02_functions/url_get_local.cf @@ -3,20 +3,19 @@ # Test url_get() locally # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent init { vars: - "options_limit" data => ' + "options_limit" + data => ' { "url.max_content": 200, "nosuchoption": 100, @@ -24,33 +23,39 @@ bundle agent init "url.headers": [ "Foo: bar" ] }'; - "options_clean" data => '{}'; - # local file: does it work on Windows? - "res4" data => url_get("file://$(this.promise_filename)", options_limit); + "options_clean" data => '{}'; + + # local file: does it work on Windows? + "res4" data => url_get("file://$(this.promise_filename)", options_limit); } bundle agent test { meta: - "test_skip_unsupported" string => "!feature_curl"; - "test_soft_fail" string => "windows", - meta => { "ENT-10254" }; + "test_skip_unsupported" string => "!feature_curl"; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10254" }; vars: - "kept" data => mergedata( - '{ "res4": init.res4[content] }', - '{ "res4/returncode": init.res4[returncode] }', - '{ "res4/rc": init.res4[rc] }', - '{ "res4/success": init.res4[success] }' + "kept" + data => mergedata( + '{ "res4": init.res4[content] }', + '{ "res4/returncode": init.res4[returncode] }', + '{ "res4/rc": init.res4[rc] }', + '{ "res4/success": init.res4[success] }' ); } ########################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/url_get_local.cf.expected.json b/tests/acceptance/01_vars/02_functions/url_get_local.cf.expected.json index 68b0d49204..1db6e75a20 100644 --- a/tests/acceptance/01_vars/02_functions/url_get_local.cf.expected.json +++ b/tests/acceptance/01_vars/02_functions/url_get_local.cf.expected.json @@ -1,6 +1,6 @@ { "kept": { - "res4": "###########################################################\n#\n# Test url_get() locally\n#\n###########################################################\n\nbody common control\n{\n inputs => { \"../../defau", + "res4": "###########################################################\n#\n# Test url_get() locally\n#\n###########################################################\nbody common control\n{\n inputs => { \"../../default.", "res4/rc": 0, "res4/returncode": 0, "res4/success": true diff --git a/tests/acceptance/01_vars/02_functions/validdata.cf b/tests/acceptance/01_vars/02_functions/validdata.cf index e12fa0c631..e48e1c5672 100644 --- a/tests/acceptance/01_vars/02_functions/validdata.cf +++ b/tests/acceptance/01_vars/02_functions/validdata.cf @@ -3,36 +3,42 @@ # Test validdata() with valid and invalid data files # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent test { vars: - "valid_json" string => "should appear", + "valid_json" + string => "should appear", if => validdata(readfile("$(this.promise_filename).json", inf), "JSON"); - "invalid_json" string => "should not appear", + + "invalid_json" + string => "should not appear", if => validdata(readfile("$(this.promise_filename).x.json", inf), "JSON"); - "valid_validjson" string => "should appear", + "valid_validjson" + string => "should appear", if => validjson(readfile("$(this.promise_filename).json", inf)); - "invalid_validjson" string => "should not appear", + + "invalid_validjson" + string => "should not appear", if => validjson(readfile("$(this.promise_filename).x.json", inf)); } ########################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/validdata.cf.json b/tests/acceptance/01_vars/02_functions/validdata.cf.json index 831e8e7b6d..b41349d0c8 100644 --- a/tests/acceptance/01_vars/02_functions/validdata.cf.json +++ b/tests/acceptance/01_vars/02_functions/validdata.cf.json @@ -1,7 +1,5 @@ { - "test": [1,2,3,4], - "test2": { - "test3": 1 - }, - "test3": "Yes" + "test": [1, 2, 3, 4], + "test2": { "test3": 1 }, + "test3": "Yes" } diff --git a/tests/acceptance/01_vars/02_functions/validjson_strict.cf b/tests/acceptance/01_vars/02_functions/validjson_strict.cf index 419729aca3..ab073f6102 100644 --- a/tests/acceptance/01_vars/02_functions/validjson_strict.cf +++ b/tests/acceptance/01_vars/02_functions/validjson_strict.cf @@ -1,11 +1,11 @@ -body common control +body common control { inputs => { "../../default.sub.cf" }; bundlesequence => { test, check }; version => "1.0"; } -bundle agent test +bundle agent test { meta: "description" -> { "CFE-4163" } @@ -16,49 +16,60 @@ bundle agent check { vars: "json" string => readfile("$(this.promise_dirname)/validdata.cf.json", inf); - "invjson" string => readfile("$(this.promise_dirname)/validdata.cf.x.json", inf); + + "invjson" + string => readfile("$(this.promise_dirname)/validdata.cf.x.json", inf); + "mystring" string => "\"foo\""; "mynumber" string => "3.14"; "mybool" string => "true"; "mynull" string => "null"; classes: - "isvalid_json" - expression => validjson("$(json)", "false"); - "isinvalid_json" - expression => not(validjson("$(invjson)", "false")); - "isvalid_string_primitive" - expression => validjson("$(mystring)", "false"); + "isvalid_json" expression => validjson("$(json)", "false"); + "isinvalid_json" expression => not(validjson("$(invjson)", "false")); + "isvalid_string_primitive" expression => validjson("$(mystring)", "false"); + "isvalid_number_primitive_strict" expression => validjson("$(mynumber)", "false"); - "isvalid_bool_primitive" - expression => validjson("$(mybool)", "false"); - "isvalid_null_primitive" - expression => validjson("$(mynull)", "false"); - "invalid_json_strict" - expression => validjson("$(json)", "true"); - "isinvalid_json_strict" - expression => not(validjson("$(invjson)", "true")); + "isvalid_bool_primitive" expression => validjson("$(mybool)", "false"); + "isvalid_null_primitive" expression => validjson("$(mynull)", "false"); + "invalid_json_strict" expression => validjson("$(json)", "true"); + "isinvalid_json_strict" expression => not(validjson("$(invjson)", "true")); + "isinvalid_string_primitive_strict" expression => not(validjson("$(mystring)", "true")); + "isinvalid_number_primitive_strict" expression => not(validjson("$(mynumber)", "true")); + "isinvalid_bool_primitive_strict" expression => not(validjson("$(mybool)", "true")); + "isinvalid_null_primitive_strict" expression => not(validjson("$(mynull)", "true")); "ok" - and => { "isvalid_json", "isvalid_string_primitive", "isvalid_number_primitive_strict", "isvalid_bool_primitive", - "isvalid_null_primitive", "invalid_json_strict", "isinvalid_string_primitive_strict", - "isinvalid_number_primitive_strict", "isinvalid_bool_primitive_strict", "isinvalid_null_primitive_strict", - "isinvalid_json", "isinvalid_json_strict" }; - + and => { + "isvalid_json", + "isvalid_string_primitive", + "isvalid_number_primitive_strict", + "isvalid_bool_primitive", + "isvalid_null_primitive", + "invalid_json_strict", + "isinvalid_string_primitive_strict", + "isinvalid_number_primitive_strict", + "isinvalid_bool_primitive_strict", + "isinvalid_null_primitive_strict", + "isinvalid_json", + "isinvalid_json_strict", + }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/validjson_trailing_bogus_data.cf b/tests/acceptance/01_vars/02_functions/validjson_trailing_bogus_data.cf index e1f6686f0e..e284eb62d1 100644 --- a/tests/acceptance/01_vars/02_functions/validjson_trailing_bogus_data.cf +++ b/tests/acceptance/01_vars/02_functions/validjson_trailing_bogus_data.cf @@ -4,7 +4,6 @@ # termination for JSON object. # ############################################################################## - body common control { bundlesequence => { "test", "check" }; @@ -12,45 +11,46 @@ body common control } ############################################################################## - bundle agent test { meta: - "description" -> { "CFE-4080" } - string => "Test validjson() with trailing bogus data"; - "test_soft_fail" string => "windows", - meta => { "ENT-10254" }; + "description" -> { "CFE-4080" } + string => "Test validjson() with trailing bogus data"; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10254" }; } ############################################################################## - bundle agent check { classes: - "ok" - and => { - not(validjson('""a')), - validjson('""'), - not(validjson('{}b')), - validjson('{}'), - not(validjson('[]c')), - not(validjson('{}}')), - not(validjson('{"d": "e"}}')), - not(validjson('[]]')), - not(validjson('[[]]]')), - not(validjson('[[[]]]]')), - not(validjson(' []]')), - not(validjson('"some": [ "json" ] }')), - not(validjson('{ "some": [ "json" ] } [')), - not(validjson('["some", "json"]!')), - not(validjson(' ["some", "json"]a')), - not(validjson('["some", "json"] {"foo": "var"} ')), - validjson('{"test": [1, 2, 3]}'), - }; + "ok" + and => { + not(validjson('""a')), + validjson('""'), + not(validjson('{}b')), + validjson('{}'), + not(validjson('[]c')), + not(validjson('{}}')), + not(validjson('{"d": "e"}}')), + not(validjson('[]]')), + not(validjson('[[]]]')), + not(validjson('[[[]]]]')), + not(validjson(' []]')), + not(validjson('"some": [ "json" ] }')), + not(validjson('{ "some": [ "json" ] } [')), + not(validjson('["some", "json"]!')), + not(validjson(' ["some", "json"]a')), + not(validjson('["some", "json"] {"foo": "var"} ')), + validjson('{"test": [1, 2, 3]}'), + }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/variable_references_from_function_that_never_succeeds.cf b/tests/acceptance/01_vars/02_functions/variable_references_from_function_that_never_succeeds.cf index 6acdaac767..9364bebb59 100644 --- a/tests/acceptance/01_vars/02_functions/variable_references_from_function_that_never_succeeds.cf +++ b/tests/acceptance/01_vars/02_functions/variable_references_from_function_that_never_succeeds.cf @@ -3,51 +3,61 @@ # Test that FnFailure results in unresolved references # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle common test { classes: - "resolved_found" expression => returnszero("$(command) resolved_a557d39e04d666075754b8f78ea17fbc175925d5 2>&1", "useshell"); - "unresolved_found" expression => returnszero("$(command) unresolved_76201d0eaac49a884308358aa487147b4db70e8a 2>&1", "useshell"); + "resolved_found" + expression => returnszero( + "$(command) resolved_a557d39e04d666075754b8f78ea17fbc175925d5 2>&1", + "useshell" + ); + + "unresolved_found" + expression => returnszero( + "$(command) unresolved_76201d0eaac49a884308358aa487147b4db70e8a 2>&1", + "useshell" + ); vars: - "command" string => "$(sys.cf_agent) -K -f $(this.promise_filename).sub | $(G.grep) MARKER | $(G.grep)"; + "command" + string => "$(sys.cf_agent) -K -f $(this.promise_filename).sub | $(G.grep) MARKER | $(G.grep)"; } - ####################################################### - bundle agent check { classes: - "ok" and => { "!resolved_found", "unresolved_found" }; + "ok" and => { "!resolved_found", "unresolved_found" }; reports: DEBUG.!resolved_found:: "Resolved variable not found"; + DEBUG.resolved_found:: "Resolved variable found?!?!"; + DEBUG.unresolved_found:: "Unresolved variable found"; + DEBUG.!unresolved_found:: "Unresolved variable not found?!?!"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/02_functions/variablesmatching.cf b/tests/acceptance/01_vars/02_functions/variablesmatching.cf index 4f6d3b5814..89794ff448 100644 --- a/tests/acceptance/01_vars/02_functions/variablesmatching.cf +++ b/tests/acceptance/01_vars/02_functions/variablesmatching.cf @@ -1,46 +1,88 @@ # Test that variablesmatching works correctly - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle common init { vars: - "test_fbeae67f3e347b5e0032302200141131" string => "abc", meta => { "x" }; - "test_fbeae67f3e347b5e0032302200141131_1" string => "def", meta => { "x" }; - "test_fbeae67f3e347b5e0032302200141131_2" string => "ghi", meta => { "y" }; + "test_fbeae67f3e347b5e0032302200141131" + string => "abc", + meta => { "x" }; + + "test_fbeae67f3e347b5e0032302200141131_1" + string => "def", + meta => { "x" }; + + "test_fbeae67f3e347b5e0032302200141131_2" + string => "ghi", + meta => { "y" }; - "test_b37ce1b03955522848f0a82d0b2b2e21_1" slist => { "a", "b" }, meta => { "x" }; - "test_b37ce1b03955522848f0a82d0b2b2e21_2" data => '{ "a": "b" }', meta => { "x" }; - "test_b37ce1b03955522848f0a82d0b2b2e21_3" string => 'mydata', meta => { "y" }; + "test_b37ce1b03955522848f0a82d0b2b2e21_1" + slist => { "a", "b" }, + meta => { "x" }; - "test_variable_with_weird_tag" string => 'some_data', meta => { "weird[tag]" }; + "test_b37ce1b03955522848f0a82d0b2b2e21_2" + data => '{ "a": "b" }', + meta => { "x" }; + + "test_b37ce1b03955522848f0a82d0b2b2e21_3" + string => 'mydata', + meta => { "y" }; + + "test_variable_with_weird_tag" + string => 'some_data', + meta => { "weird[tag]" }; } bundle agent test { vars: - "vars" slist => variablesmatching("default:init.test_fbeae67f3e347b5e0032302200141131.*"); - "x_vars" slist => variablesmatching("default:init.test_fbeae67f3e347b5e0032302200141131.*", "x"); - "z_vars" slist => variablesmatching("default:init.test_fbeae67f3e347b5e0032302200141131.*", "z"); - - "fullvars" data => variablesmatching_as_data("default:init.test_b37ce1b03955522848f0a82d0b2b2e21.*"); - "x_fullvars" data => variablesmatching_as_data("default:init.test_b37ce1b03955522848f0a82d0b2b2e21.*", "x"); - "z_fullvars" data => variablesmatching_as_data("default:init.test_b37ce1b03955522848f0a82d0b2b2e21.*", "z"); - - "tag_match" slist => variablesmatching(".*", "weird\[tag\]"); - "tag_no_match" slist => variablesmatching(".*", "weird[tag]"); - "tag_match_data" data => variablesmatching_as_data(".*", "weird\[tag\]"); - "tag_no_match_data" data => variablesmatching_as_data(".*", "weird[tag]"); + "vars" + slist => variablesmatching( + "default:init.test_fbeae67f3e347b5e0032302200141131.*" + ); + + "x_vars" + slist => variablesmatching( + "default:init.test_fbeae67f3e347b5e0032302200141131.*", "x" + ); + + "z_vars" + slist => variablesmatching( + "default:init.test_fbeae67f3e347b5e0032302200141131.*", "z" + ); + + "fullvars" + data => variablesmatching_as_data( + "default:init.test_b37ce1b03955522848f0a82d0b2b2e21.*" + ); + + "x_fullvars" + data => variablesmatching_as_data( + "default:init.test_b37ce1b03955522848f0a82d0b2b2e21.*", "x" + ); + + "z_fullvars" + data => variablesmatching_as_data( + "default:init.test_b37ce1b03955522848f0a82d0b2b2e21.*", "z" + ); + + "tag_match" slist => variablesmatching(".*", "weird\[tag\]"); + "tag_no_match" slist => variablesmatching(".*", "weird[tag]"); + "tag_match_data" data => variablesmatching_as_data(".*", "weird\[tag\]"); + "tag_no_match_data" data => variablesmatching_as_data(".*", "weird[tag]"); } bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/version_compare.cf b/tests/acceptance/01_vars/02_functions/version_compare.cf index 1424b587f5..c4e7bbfc8d 100644 --- a/tests/acceptance/01_vars/02_functions/version_compare.cf +++ b/tests/acceptance/01_vars/02_functions/version_compare.cf @@ -3,107 +3,67 @@ # Test version_compare function # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent test { vars: - "true_a" - string => version_compare("1.0.0", "=", "1.0.0"); - "true_b" - string => version_compare("0.1.0", "=", "0.1.0"); - "true_c" - string => version_compare("0.0.1", "=", "0.0.1"); - "true_d" - string => version_compare("1.0.1", "!=", "1.0.0"); - "true_e" - string => version_compare("0.0.0", "==", "0.0.0"); - "true_f" - string => version_compare("1.2.3", ">", "1.1.999"); - "true_g" - string => version_compare("1.2.3", ">", "1.1.999"); - "true_h" - string => version_compare("1.2.3", "!=", "1.1.999"); - "true_i" - string => version_compare("0.0.0", "<", "0.0.1"); - "true_j" - string => version_compare("0.0.0", "<=", "0.0.1"); - "true_k" - string => version_compare("0.0.0", "!=", "0.0.1"); - "true_l" - string => version_compare("0.0.0", "<=", "0.0.1"); - "true_m" - string => version_compare("7.7.7", "==", "7.7.7-1"); - "true_n" - string => version_compare("7.7.7-1", "==", "7.7.7-2"); - "true_o" - string => version_compare("7.7.7a", "==", "7.7.7"); - "true_p" - string => version_compare("7.7.7a", ">=", "7.7.7"); - "true_q" - string => version_compare("7.7.7a", "<=", "7.7.7"); - "true_r" - string => version_compare("3.2.1", "==", "3.2"); - "true_s" - string => version_compare("3", "=", "3.2.1"); - "true_t" - string => version_compare("3.2", "<=", "3"); - "false_a" - string => version_compare("1.0.0", "!=", "1.0.0"); - "false_b" - string => version_compare("0.1.0", "!=", "0.1.0"); - "false_c" - string => version_compare("0.0.1", "!=", "0.0.1"); - "false_d" - string => version_compare("1.0.1", "=", "1.0.0"); - "false_e" - string => version_compare("0.0.0", "!=", "0.0.0"); - "false_f" - string => version_compare("1.2.3", "<=", "1.1.999"); - "false_g" - string => version_compare("1.2.3", "<=", "1.1.999"); - "false_h" - string => version_compare("1.2.3", "=", "1.1.999"); - "false_i" - string => version_compare("0.0.0", ">=", "0.0.1"); - "false_j" - string => version_compare("0.0.0", ">", "0.0.1"); - "false_k" - string => version_compare("0.0.0", "==", "0.0.1"); - "false_l" - string => version_compare("0.0.0", ">", "0.0.1"); - "false_m" - string => version_compare("7.7.7", "!=", "7.7.7-1"); - "false_n" - string => version_compare("7.7.7-1", "!=", "7.7.7-2"); - "false_o" - string => version_compare("7.7.7a", "!=", "7.7.7"); - "false_p" - string => version_compare("7.7.7a", "<", "7.7.7"); - "false_q" - string => version_compare("7.7.7a", ">", "7.7.7"); - "false_r" - string => version_compare("3.2.1", "!=", "3.2"); - "false_s" - string => version_compare("3", "!=", "3.2.1"); - "false_t" - string => version_compare("3.2", ">", "3"); + "true_a" string => version_compare("1.0.0", "=", "1.0.0"); + "true_b" string => version_compare("0.1.0", "=", "0.1.0"); + "true_c" string => version_compare("0.0.1", "=", "0.0.1"); + "true_d" string => version_compare("1.0.1", "!=", "1.0.0"); + "true_e" string => version_compare("0.0.0", "==", "0.0.0"); + "true_f" string => version_compare("1.2.3", ">", "1.1.999"); + "true_g" string => version_compare("1.2.3", ">", "1.1.999"); + "true_h" string => version_compare("1.2.3", "!=", "1.1.999"); + "true_i" string => version_compare("0.0.0", "<", "0.0.1"); + "true_j" string => version_compare("0.0.0", "<=", "0.0.1"); + "true_k" string => version_compare("0.0.0", "!=", "0.0.1"); + "true_l" string => version_compare("0.0.0", "<=", "0.0.1"); + "true_m" string => version_compare("7.7.7", "==", "7.7.7-1"); + "true_n" string => version_compare("7.7.7-1", "==", "7.7.7-2"); + "true_o" string => version_compare("7.7.7a", "==", "7.7.7"); + "true_p" string => version_compare("7.7.7a", ">=", "7.7.7"); + "true_q" string => version_compare("7.7.7a", "<=", "7.7.7"); + "true_r" string => version_compare("3.2.1", "==", "3.2"); + "true_s" string => version_compare("3", "=", "3.2.1"); + "true_t" string => version_compare("3.2", "<=", "3"); + "false_a" string => version_compare("1.0.0", "!=", "1.0.0"); + "false_b" string => version_compare("0.1.0", "!=", "0.1.0"); + "false_c" string => version_compare("0.0.1", "!=", "0.0.1"); + "false_d" string => version_compare("1.0.1", "=", "1.0.0"); + "false_e" string => version_compare("0.0.0", "!=", "0.0.0"); + "false_f" string => version_compare("1.2.3", "<=", "1.1.999"); + "false_g" string => version_compare("1.2.3", "<=", "1.1.999"); + "false_h" string => version_compare("1.2.3", "=", "1.1.999"); + "false_i" string => version_compare("0.0.0", ">=", "0.0.1"); + "false_j" string => version_compare("0.0.0", ">", "0.0.1"); + "false_k" string => version_compare("0.0.0", "==", "0.0.1"); + "false_l" string => version_compare("0.0.0", ">", "0.0.1"); + "false_m" string => version_compare("7.7.7", "!=", "7.7.7-1"); + "false_n" string => version_compare("7.7.7-1", "!=", "7.7.7-2"); + "false_o" string => version_compare("7.7.7a", "!=", "7.7.7"); + "false_p" string => version_compare("7.7.7a", "<", "7.7.7"); + "false_q" string => version_compare("7.7.7a", ">", "7.7.7"); + "false_r" string => version_compare("3.2.1", "!=", "3.2"); + "false_s" string => version_compare("3", "!=", "3.2.1"); + "false_t" string => version_compare("3.2", ">", "3"); } ########################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/02_functions/wrap_container_fncalls.cf b/tests/acceptance/01_vars/02_functions/wrap_container_fncalls.cf index 07fab81aab..0cc06c9a4c 100644 --- a/tests/acceptance/01_vars/02_functions/wrap_container_fncalls.cf +++ b/tests/acceptance/01_vars/02_functions/wrap_container_fncalls.cf @@ -3,58 +3,94 @@ # Test wrapped fncalls that return data containers # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common init { classes: - "predefined" expression => "any"; + "predefined" expression => "any"; } bundle agent test { vars: - "base_list" slist => { "a", "b", "c", "aaa", "bbb", "ccc" }; - "base_data" data => '{ "x": 100, "y": "z" }'; - "mapdata_spec" string => "<<< $(this.k)=$(this.v) >>>"; - - "sort_mapdata_inline_json" slist => sort(mapdata('none', $(mapdata_spec), '[1,2,3]'), lex); - "sort_mapdata_slist" slist => sort(mapdata('none', $(mapdata_spec), base_list), lex); - "sort_mapdata_data" slist => sort(mapdata('none', $(mapdata_spec), base_data), lex); - - "sort_mapdata_mergedata_inline_json" slist => sort(mapdata('none', $(mapdata_spec), '[1,2,3]'), lex); - "sort_mapdata_mergedata_slist" slist => sort(mapdata('none', $(mapdata_spec), mergedata(base_list)), lex); - "sort_mapdata_mergedata_data" slist => sort(mapdata('none', $(mapdata_spec), mergedata(base_data)), lex); - - # we can nest functions that return slists too! - "sort_mapdata_sort_slist" slist => sort(mapdata('none', $(mapdata_spec), sort(base_list, int)), lex); - "sort_mapdata_mergedata_sort_slist" slist => sort(mapdata('none', $(mapdata_spec), mergedata(sort(base_list, int))), lex); - "reverse_sort_slist" slist => reverse(sort(base_list, int)); - - "concat_sort_mapdata_mergedata_inline_json" string => concat(sort(mapdata('none', $(mapdata_spec), '[1,2,3]'), lex)); - "concat_sort_mapdata_mergedata_slist" string => concat(sort(mapdata('none', $(mapdata_spec), mergedata(base_list)), lex)); - "concat_sort_mapdata_mergedata_data" string => concat(sort(mapdata('none', $(mapdata_spec), mergedata(base_data)), lex)); - - "nth_sort_mapdata_mergedata_inline_json" string => nth(sort(mapdata('none', $(mapdata_spec), '[1,2,3]'), lex), 0); - "nth_mapdata_mergedata_slist" string => nth(mapdata('none', $(mapdata_spec), mergedata(base_list)), 1); - "nth_inline_json" string => nth('{ "x": "88888888" }', "x"); - "nth_missing_inline_json" string => nth('{ "x": "88888888" }', "y"); - "nth_data" string => nth(base_data, "x"); - "nth_list" string => nth(base_list, 3); + "base_list" slist => { "a", "b", "c", "aaa", "bbb", "ccc" }; + "base_data" data => '{ "x": 100, "y": "z" }'; + "mapdata_spec" string => "<<< $(this.k)=$(this.v) >>>"; + + "sort_mapdata_inline_json" + slist => sort(mapdata('none', $(mapdata_spec), '[1,2,3]'), lex); + + "sort_mapdata_slist" + slist => sort(mapdata('none', $(mapdata_spec), base_list), lex); + + "sort_mapdata_data" + slist => sort(mapdata('none', $(mapdata_spec), base_data), lex); + + "sort_mapdata_mergedata_inline_json" + slist => sort(mapdata('none', $(mapdata_spec), '[1,2,3]'), lex); + + "sort_mapdata_mergedata_slist" + slist => sort( + mapdata('none', $(mapdata_spec), mergedata(base_list)), lex + ); + + "sort_mapdata_mergedata_data" + slist => sort( + mapdata('none', $(mapdata_spec), mergedata(base_data)), lex + ); + + # we can nest functions that return slists too! + "sort_mapdata_sort_slist" + slist => sort( + mapdata('none', $(mapdata_spec), sort(base_list, int)), lex + ); + + "sort_mapdata_mergedata_sort_slist" + slist => sort( + mapdata('none', $(mapdata_spec), mergedata(sort(base_list, int))), lex + ); + + "reverse_sort_slist" slist => reverse(sort(base_list, int)); + + "concat_sort_mapdata_mergedata_inline_json" + string => concat(sort(mapdata('none', $(mapdata_spec), '[1,2,3]'), lex)); + + "concat_sort_mapdata_mergedata_slist" + string => concat( + sort(mapdata('none', $(mapdata_spec), mergedata(base_list)), lex) + ); + + "concat_sort_mapdata_mergedata_data" + string => concat( + sort(mapdata('none', $(mapdata_spec), mergedata(base_data)), lex) + ); + + "nth_sort_mapdata_mergedata_inline_json" + string => nth(sort(mapdata('none', $(mapdata_spec), '[1,2,3]'), lex), 0); + + "nth_mapdata_mergedata_slist" + string => nth(mapdata('none', $(mapdata_spec), mergedata(base_list)), 1); + + "nth_inline_json" string => nth('{ "x": "88888888" }', "x"); + "nth_missing_inline_json" string => nth('{ "x": "88888888" }', "y"); + "nth_data" string => nth(base_data, "x"); + "nth_list" string => nth(base_list, 3); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/03_lists/001.cf b/tests/acceptance/01_vars/03_lists/001.cf index c257e07c76..a46c005f3a 100644 --- a/tests/acceptance/01_vars/03_lists/001.cf +++ b/tests/acceptance/01_vars/03_lists/001.cf @@ -3,25 +3,22 @@ # Nested iterations of slists (the ordering is not guaranteed, so we sort) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; + "actual" string => ""; - "actual" string => ""; - - "expected" string => - " + "expected" + string => " a x a y a z @@ -38,7 +35,7 @@ cf_null blah"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -47,63 +44,70 @@ blah"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert; - + "$(G.testfile).actual" edit_line => test_insert; } bundle edit_line test_insert { vars: - "one" slist => { "a", "b", "c" }; - "two" slist => { "x", "y", "z" }; - "empty" slist => {}; - "null" slist => { "cf_null" }; - "nulls" slist => { "cf_null", "cf_null", "cf_null" }; - - "not_an_array" string => "blah"; - "no_values" slist => getvalues("not_an_array"); + "one" slist => { "a", "b", "c" }; + "two" slist => { "x", "y", "z" }; + "empty" slist => {}; + "null" slist => { "cf_null" }; + "nulls" slist => { "cf_null", "cf_null", "cf_null" }; + "not_an_array" string => "blah"; + "no_values" slist => getvalues("not_an_array"); insert_lines: - "$(one) $(two)"; - # cf_null is no longer treated specially, they are regular list elements - "$(one) $(nulls)"; - "$(null)"; - "$(nulls)"; - # the following should do nothing - "$(one) $(two) $(empty)"; - "$(empty) $(one) $(null) $(two)"; - "$(null) $(empty)"; - "$(no_values)"; + "$(one) $(two)"; + + # cf_null is no longer treated specially, they are regular list elements + "$(one) $(nulls)"; + "$(null)"; + "$(nulls)"; + + # the following should do nothing + "$(one) $(two) $(empty)"; + "$(empty) $(one) $(null) $(two)"; + "$(null) $(empty)"; + "$(no_values)"; } ####################################################### - bundle agent check { - methods: - "any" usebundle => dcs_sort("$(G.testfile).actual", "$(G.testfile).actual.sorted"); - "any" usebundle => dcs_sort("$(G.testfile).expected", "$(G.testfile).expected.sorted"); - "any" usebundle => dcs_check_diff("$(G.testfile).actual.sorted", - "$(G.testfile).expected.sorted", - "$(this.promise_filename)"); + "any" + usebundle => dcs_sort( + "$(G.testfile).actual", "$(G.testfile).actual.sorted" + ); + + "any" + usebundle => dcs_sort( + "$(G.testfile).expected", "$(G.testfile).expected.sorted" + ); + + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual.sorted", + "$(G.testfile).expected.sorted", + "$(this.promise_filename)" + ); } body contain check_in_shell { - useshell => "true"; + useshell => "true"; } diff --git a/tests/acceptance/01_vars/03_lists/002.cf b/tests/acceptance/01_vars/03_lists/002.cf index 97cb6c111f..1c79f75629 100644 --- a/tests/acceptance/01_vars/03_lists/002.cf +++ b/tests/acceptance/01_vars/03_lists/002.cf @@ -3,31 +3,26 @@ # Iterations of slists # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => ""; - - "expected" string => - " + "states" slist => { "actual", "expected" }; + "actual" string => ""; + "expected" string => " a b c"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -36,46 +31,53 @@ c"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert; - + "$(G.testfile).actual" edit_line => test_insert; } bundle edit_line test_insert { vars: - "one" slist => { "a", "b", "c" }; + "one" slist => { "a", "b", "c" }; insert_lines: - "$(one)"; + "$(one)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_sort("$(G.testfile).actual", "$(G.testfile).actual.sorted"); - "any" usebundle => dcs_sort("$(G.testfile).expected", "$(G.testfile).expected.sorted"); - "any" usebundle => dcs_check_diff("$(G.testfile).actual.sorted", - "$(G.testfile).expected.sorted", - "$(this.promise_filename)"); + "any" + usebundle => dcs_sort( + "$(G.testfile).actual", "$(G.testfile).actual.sorted" + ); + + "any" + usebundle => dcs_sort( + "$(G.testfile).expected", "$(G.testfile).expected.sorted" + ); + + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual.sorted", + "$(G.testfile).expected.sorted", + "$(this.promise_filename)" + ); } body contain check_in_shell { - useshell => "true"; + useshell => "true"; } diff --git a/tests/acceptance/01_vars/03_lists/003.cf b/tests/acceptance/01_vars/03_lists/003.cf index d2077a86d5..477d65daf2 100644 --- a/tests/acceptance/01_vars/03_lists/003.cf +++ b/tests/acceptance/01_vars/03_lists/003.cf @@ -3,29 +3,24 @@ # Iteration on slist of size 1 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => ""; - - "expected" string => - " + "states" slist => { "actual", "expected" }; + "actual" string => ""; + "expected" string => " a"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -34,46 +29,53 @@ a"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert; - + "$(G.testfile).actual" edit_line => test_insert; } bundle edit_line test_insert { vars: - "one" slist => { "a" }; + "one" slist => { "a" }; insert_lines: - "$(one)"; + "$(one)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_sort("$(G.testfile).actual", "$(G.testfile).actual.sorted"); - "any" usebundle => dcs_sort("$(G.testfile).expected", "$(G.testfile).expected.sorted"); - "any" usebundle => dcs_check_diff("$(G.testfile).actual.sorted", - "$(G.testfile).expected.sorted", - "$(this.promise_filename)"); + "any" + usebundle => dcs_sort( + "$(G.testfile).actual", "$(G.testfile).actual.sorted" + ); + + "any" + usebundle => dcs_sort( + "$(G.testfile).expected", "$(G.testfile).expected.sorted" + ); + + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual.sorted", + "$(G.testfile).expected.sorted", + "$(this.promise_filename)" + ); } body contain check_in_shell { - useshell => "true"; + useshell => "true"; } diff --git a/tests/acceptance/01_vars/03_lists/004.cf b/tests/acceptance/01_vars/03_lists/004.cf index cb027a0ddf..e90c16c30d 100644 --- a/tests/acceptance/01_vars/03_lists/004.cf +++ b/tests/acceptance/01_vars/03_lists/004.cf @@ -3,31 +3,26 @@ # Iterations of non-local slists # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => ""; - - "expected" string => - " + "states" slist => { "actual", "expected" }; + "actual" string => ""; + "expected" string => " a b c"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -36,52 +31,59 @@ c"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert; - + "$(G.testfile).actual" edit_line => test_insert; } bundle agent otherbundle { vars: - "one" slist => { "a", "b", "c" }; + "one" slist => { "a", "b", "c" }; } bundle edit_line test_insert { vars: - "one" slist => { "c", "b", "a" }; + "one" slist => { "c", "b", "a" }; insert_lines: - "$(otherbundle.one)"; + "$(otherbundle.one)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_sort("$(G.testfile).actual", "$(G.testfile).actual.sorted"); - "any" usebundle => dcs_sort("$(G.testfile).expected", "$(G.testfile).expected.sorted"); - "any" usebundle => dcs_check_diff("$(G.testfile).actual.sorted", - "$(G.testfile).expected.sorted", - "$(this.promise_filename)"); + "any" + usebundle => dcs_sort( + "$(G.testfile).actual", "$(G.testfile).actual.sorted" + ); + + "any" + usebundle => dcs_sort( + "$(G.testfile).expected", "$(G.testfile).expected.sorted" + ); + + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual.sorted", + "$(G.testfile).expected.sorted", + "$(this.promise_filename)" + ); } body contain check_in_shell { - useshell => "true"; + useshell => "true"; } diff --git a/tests/acceptance/01_vars/03_lists/005.cf b/tests/acceptance/01_vars/03_lists/005.cf index b5a3a657b4..2dbb2394ff 100644 --- a/tests/acceptance/01_vars/03_lists/005.cf +++ b/tests/acceptance/01_vars/03_lists/005.cf @@ -3,31 +3,26 @@ # Iterations of non-local slists # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => ""; - - "expected" string => - " + "states" slist => { "actual", "expected" }; + "actual" string => ""; + "expected" string => " XX XXX XXXX"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -36,55 +31,62 @@ XXXX"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert; - + "$(G.testfile).actual" edit_line => test_insert; } bundle agent otherbundle { vars: - "list" slist => { "one", "two", "three" }; + "list" slist => { "one", "two", "three" }; } bundle edit_line test_insert { vars: - "array[one]" string => "XX"; - "array[two]" string => "XXX"; - "array[three]" string => "XXXX"; - "list" slist => { "three", "two", "one" }; + "array[one]" string => "XX"; + "array[two]" string => "XXX"; + "array[three]" string => "XXXX"; + "list" slist => { "three", "two", "one" }; insert_lines: - "$(array[$(otherbundle.list)])"; + "$(array[$(otherbundle.list)])"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_sort("$(G.testfile).actual", "$(G.testfile).actual.sorted"); - "any" usebundle => dcs_sort("$(G.testfile).expected", "$(G.testfile).expected.sorted"); - "any" usebundle => dcs_check_diff("$(G.testfile).actual.sorted", - "$(G.testfile).expected.sorted", - "$(this.promise_filename)"); + "any" + usebundle => dcs_sort( + "$(G.testfile).actual", "$(G.testfile).actual.sorted" + ); + + "any" + usebundle => dcs_sort( + "$(G.testfile).expected", "$(G.testfile).expected.sorted" + ); + + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual.sorted", + "$(G.testfile).expected.sorted", + "$(this.promise_filename)" + ); } body contain check_in_shell { - useshell => "true"; + useshell => "true"; } diff --git a/tests/acceptance/01_vars/03_lists/006.cf b/tests/acceptance/01_vars/03_lists/006.cf index c11cd0ea43..2237855537 100644 --- a/tests/acceptance/01_vars/03_lists/006.cf +++ b/tests/acceptance/01_vars/03_lists/006.cf @@ -1,38 +1,37 @@ # Test that reglist() does not match cf_null values - # NOTE: tests conditions have been reversed! cf_null is no longer # treated specially! - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => ""; + "dummy" string => ""; } bundle agent test { vars: - "dummy" string => ""; + "dummy" string => ""; } bundle agent check { vars: - "emptylist" slist => { "cf_null" }; + "emptylist" slist => { "cf_null" }; classes: - "ok" expression => reglist("@(emptylist)", ".+"); + "ok" expression => reglist("@(emptylist)", ".+"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/03_lists/007.cf b/tests/acceptance/01_vars/03_lists/007.cf index 80be1b27e0..1178948718 100644 --- a/tests/acceptance/01_vars/03_lists/007.cf +++ b/tests/acceptance/01_vars/03_lists/007.cf @@ -1,43 +1,43 @@ # Test that cf_null lists can be joined - # NOTE: tests conditions have been reversed! cf_null is no longer # treated specially! - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => ""; + "dummy" string => ""; } bundle agent test { vars: - "dummy" string => ""; + "dummy" string => ""; } bundle agent check { vars: - "emptylist" slist => { "cf_null" }; - "joined" string => join(":", "emptylist"); + "emptylist" slist => { "cf_null" }; + "joined" string => join(":", "emptylist"); classes: - "ok1" expression => strcmp($(joined), ""); - - "ok" not => "ok1"; # the list should contain cf_null + "ok1" expression => strcmp($(joined), ""); + "ok" not => "ok1"; + # the list should contain cf_null reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + DEBUG:: "Expected cf_null string, got $(joined)!"; } diff --git a/tests/acceptance/01_vars/03_lists/008.cf b/tests/acceptance/01_vars/03_lists/008.cf index a1f0f3cfea..82105afad4 100644 --- a/tests/acceptance/01_vars/03_lists/008.cf +++ b/tests/acceptance/01_vars/03_lists/008.cf @@ -5,74 +5,67 @@ # NOTE: tests conditions have been reversed! cf_null is no longer # treated specially! ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - - "expected" string => -"cf_null + "expected" string => "cf_null 1 2 3"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert("$(expected)"), edit_defaults => init_empty; - } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_list_null, edit_defaults => init_empty; - } bundle edit_line test_list_null { vars: - - "lines" slist => { "cf_null", "1", "2", "3" }; + "lines" slist => { "cf_null", "1", "2", "3" }; insert_lines: - "$(lines)" - whitespace_policy => { "exact_match" }; + "$(lines)" whitespace_policy => { "exact_match" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/03_lists/009.cf b/tests/acceptance/01_vars/03_lists/009.cf index 0ef63d9591..a76512b925 100644 --- a/tests/acceptance/01_vars/03_lists/009.cf +++ b/tests/acceptance/01_vars/03_lists/009.cf @@ -5,74 +5,67 @@ # NOTE: tests conditions have been reversed! cf_null is no longer # treated specially! ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - - "expected" string => -"1 + "expected" string => "1 cf_null 2 3"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert("$(expected)"), edit_defaults => init_empty; - } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_list_null, edit_defaults => init_empty; - } bundle edit_line test_list_null { vars: - - "lines" slist => { "1", "cf_null", "2", "3" }; + "lines" slist => { "1", "cf_null", "2", "3" }; insert_lines: - "$(lines)" - whitespace_policy => { "exact_match" }; + "$(lines)" whitespace_policy => { "exact_match" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/03_lists/010.cf b/tests/acceptance/01_vars/03_lists/010.cf index 63153e5f80..16eaca1ad3 100644 --- a/tests/acceptance/01_vars/03_lists/010.cf +++ b/tests/acceptance/01_vars/03_lists/010.cf @@ -5,74 +5,67 @@ # NOTE: tests conditions have been reversed! cf_null is no longer # treated specially! ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - - "expected" string => -"1 + "expected" string => "1 2 3 cf_null"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert("$(expected)"), edit_defaults => init_empty; - } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_list_null, edit_defaults => init_empty; - } bundle edit_line test_list_null { vars: - - "lines" slist => { "1", "2", "3", "cf_null" }; + "lines" slist => { "1", "2", "3", "cf_null" }; insert_lines: - "$(lines)" - whitespace_policy => { "exact_match" }; + "$(lines)" whitespace_policy => { "exact_match" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/03_lists/011.cf b/tests/acceptance/01_vars/03_lists/011.cf index 53a44e2e7e..852ed40362 100644 --- a/tests/acceptance/01_vars/03_lists/011.cf +++ b/tests/acceptance/01_vars/03_lists/011.cf @@ -5,22 +5,20 @@ # NOTE: tests conditions have been reversed! cf_null is no longer # treated specially! ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_defaults => init_empty, edit_line => init_insert("cf_null"); @@ -29,43 +27,41 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_list_null, edit_defaults => init_empty; - } bundle edit_line test_list_null { vars: - - "lines" slist => { "cf_null", "cf_null", "cf_null" }; + "lines" slist => { "cf_null", "cf_null", "cf_null" }; insert_lines: - "$(lines)" - whitespace_policy => { "exact_match" }; + "$(lines)" whitespace_policy => { "exact_match" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/03_lists/012.cf b/tests/acceptance/01_vars/03_lists/012.cf index 31f93b30bf..ad3e3d3075 100644 --- a/tests/acceptance/01_vars/03_lists/012.cf +++ b/tests/acceptance/01_vars/03_lists/012.cf @@ -3,31 +3,26 @@ # Iterations of non-local slists inside non-local (sclar) array # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => ""; - - "expected" string => - " + "states" slist => { "actual", "expected" }; + "actual" string => ""; + "expected" string => " XX XXX XXXX"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -36,52 +31,59 @@ XXXX"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert; - + "$(G.testfile).actual" edit_line => test_insert; } bundle agent otherbundle { vars: - "array[one]" string => "XX"; - "array[two]" string => "XXX"; - "array[three]" string => "XXXX"; - "list" slist => { "one", "two", "three" }; + "array[one]" string => "XX"; + "array[two]" string => "XXX"; + "array[three]" string => "XXXX"; + "list" slist => { "one", "two", "three" }; } bundle edit_line test_insert { insert_lines: - "$(otherbundle.array[$(otherbundle.list)])"; + "$(otherbundle.array[$(otherbundle.list)])"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_sort("$(G.testfile).actual", "$(G.testfile).actual.sorted"); - "any" usebundle => dcs_sort("$(G.testfile).expected", "$(G.testfile).expected.sorted"); - "any" usebundle => dcs_check_diff("$(G.testfile).actual.sorted", - "$(G.testfile).expected.sorted", - "$(this.promise_filename)"); + "any" + usebundle => dcs_sort( + "$(G.testfile).actual", "$(G.testfile).actual.sorted" + ); + + "any" + usebundle => dcs_sort( + "$(G.testfile).expected", "$(G.testfile).expected.sorted" + ); + + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual.sorted", + "$(G.testfile).expected.sorted", + "$(this.promise_filename)" + ); } body contain check_in_shell { - useshell => "true"; + useshell => "true"; } diff --git a/tests/acceptance/01_vars/03_lists/013.cf b/tests/acceptance/01_vars/03_lists/013.cf index bb93d5fcaf..52d4749bd1 100644 --- a/tests/acceptance/01_vars/03_lists/013.cf +++ b/tests/acceptance/01_vars/03_lists/013.cf @@ -1,36 +1,32 @@ # Test expansion of remote arrays containing lists - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - nova_edition:: - host_licenses_paid => "5"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; + + nova_edition:: + host_licenses_paid => "5"; } bundle agent init { vars: - "array[one]" string => "1"; - "array[two]" string => "2"; - "array[list]" slist => { "first", "second", "last" }; - - "keys" slist => { "one", "two", "list" }; - - "expected" string => " + "array[one]" string => "1"; + "array[two]" string => "2"; + "array[list]" slist => { "first", "second", "last" }; + "keys" slist => { "one", "two", "list" }; + "expected" string => " 1 2 first second last"; - - "actual" string => ""; - - "states" slist => { "expected", "actual" }; + "actual" string => ""; + "states" slist => { "expected", "actual" }; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$($(states))"), edit_defaults => init_empty; @@ -39,31 +35,35 @@ last"; bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert; - + "$(G.testfile).actual" edit_line => test_insert; } -bundle edit_line init_insert(str) { +bundle edit_line init_insert(str) +{ insert_lines: - "$(str)"; + "$(str)"; } -body edit_defaults init_empty { - empty_file_before_editing => "true"; +body edit_defaults init_empty +{ + empty_file_before_editing => "true"; } -bundle edit_line test_insert { - insert_lines: - "$(init.array[$(init.keys)])"; +bundle edit_line test_insert +{ + insert_lines: + "$(init.array[$(init.keys)])"; } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); reports: DEBUG:: diff --git a/tests/acceptance/01_vars/03_lists/014.cf b/tests/acceptance/01_vars/03_lists/014.cf index 66e6217b81..9001337e18 100644 --- a/tests/acceptance/01_vars/03_lists/014.cf +++ b/tests/acceptance/01_vars/03_lists/014.cf @@ -3,27 +3,23 @@ # Iteration on non-local empty slist # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => ""; - - "expected" string => ""; + "states" slist => { "actual", "expected" }; + "actual" string => ""; + "expected" string => ""; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -32,52 +28,59 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert; - + "$(G.testfile).actual" edit_line => test_insert; } bundle agent otherbundle { vars: - "list" slist => { }; + "list" slist => {}; } bundle edit_line test_insert { vars: - "list" slist => { "a", "b", "c" }; + "list" slist => { "a", "b", "c" }; insert_lines: - "$(otherbundle.list)"; + "$(otherbundle.list)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_sort("$(G.testfile).actual", "$(G.testfile).actual.sorted"); - "any" usebundle => dcs_sort("$(G.testfile).expected", "$(G.testfile).expected.sorted"); - "any" usebundle => dcs_check_diff("$(G.testfile).actual.sorted", - "$(G.testfile).expected.sorted", - "$(this.promise_filename)"); + "any" + usebundle => dcs_sort( + "$(G.testfile).actual", "$(G.testfile).actual.sorted" + ); + + "any" + usebundle => dcs_sort( + "$(G.testfile).expected", "$(G.testfile).expected.sorted" + ); + + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual.sorted", + "$(G.testfile).expected.sorted", + "$(this.promise_filename)" + ); } body contain check_in_shell { - useshell => "true"; + useshell => "true"; } diff --git a/tests/acceptance/01_vars/03_lists/015.cf b/tests/acceptance/01_vars/03_lists/015.cf index ce28fc30ac..00e51adeb8 100644 --- a/tests/acceptance/01_vars/03_lists/015.cf +++ b/tests/acceptance/01_vars/03_lists/015.cf @@ -3,27 +3,23 @@ # Iteration on slist of size 1 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => ""; - - "expected" string => ""; + "states" slist => { "actual", "expected" }; + "actual" string => ""; + "expected" string => ""; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -32,46 +28,53 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert; - + "$(G.testfile).actual" edit_line => test_insert; } bundle edit_line test_insert { vars: - "one" slist => { }; + "one" slist => {}; insert_lines: - "$(one)"; + "$(one)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_sort("$(G.testfile).actual", "$(G.testfile).actual.sorted"); - "any" usebundle => dcs_sort("$(G.testfile).expected", "$(G.testfile).expected.sorted"); - "any" usebundle => dcs_check_diff("$(G.testfile).actual.sorted", - "$(G.testfile).expected.sorted", - "$(this.promise_filename)"); + "any" + usebundle => dcs_sort( + "$(G.testfile).actual", "$(G.testfile).actual.sorted" + ); + + "any" + usebundle => dcs_sort( + "$(G.testfile).expected", "$(G.testfile).expected.sorted" + ); + + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual.sorted", + "$(G.testfile).expected.sorted", + "$(this.promise_filename)" + ); } body contain check_in_shell { - useshell => "true"; + useshell => "true"; } diff --git a/tests/acceptance/01_vars/03_lists/016.cf b/tests/acceptance/01_vars/03_lists/016.cf index 6c3e776126..adad439bd7 100644 --- a/tests/acceptance/01_vars/03_lists/016.cf +++ b/tests/acceptance/01_vars/03_lists/016.cf @@ -5,7 +5,6 @@ # but here we check it for files promises. # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; @@ -13,44 +12,42 @@ body common control version => "1.0"; } - bundle agent init { -# TODO delete the testfile + # TODO delete the testfile } - bundle agent test { -files: - "$(G.testfile).actual" - create => "true", - edit_defaults => init_empty, - edit_line => test_insert_macs; + files: + "$(G.testfile).actual" + create => "true", + edit_defaults => init_empty, + edit_line => test_insert_macs; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle edit_line test_insert_macs { -insert_lines: - "$(sys.hardware_addresses)"; + insert_lines: + "$(sys.hardware_addresses)"; } - bundle agent check { -# If the file contains the string "sys.hardware_addresses" then we -# failed to expand the variable! -classes: - "ok" not => regline(".*sys\.hardware_addresses.*", "$(G.testfile).actual"); + # If the file contains the string "sys.hardware_addresses" then we + # failed to expand the variable! + classes: + "ok" not => regline(".*sys\.hardware_addresses.*", "$(G.testfile).actual"); + + reports: + ok:: + "$(this.promise_filename) Pass"; -reports: - ok:: - "$(this.promise_filename) Pass"; - !ok:: - "$(this.promise_filename) FAIL"; + !ok:: + "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/03_lists/double_expand_remote_list.cf b/tests/acceptance/01_vars/03_lists/double_expand_remote_list.cf index d78807717a..cbee18691c 100644 --- a/tests/acceptance/01_vars/03_lists/double_expand_remote_list.cf +++ b/tests/acceptance/01_vars/03_lists/double_expand_remote_list.cf @@ -1,11 +1,10 @@ # Redmine#6866 # Test that varibles are fully expanded - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent check @@ -17,10 +16,11 @@ bundle agent check meta => { "redmine#6866" }, string => "any"; - vars: "command" string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub"; - "expected" string => "R: Direct: 1 + + "expected" + string => "R: Direct: 1 R: Direct: 2 R: Direct: 3 R: Indirect: 1 @@ -29,12 +29,13 @@ R: Indirect: 3"; methods: "check" - usebundle => dcs_passif_output(".*$(expected).*", "", $(command), $(this.promise_filename)); + usebundle => dcs_passif_output( + ".*$(expected).*", "", $(command), $(this.promise_filename) + ); reports: DEBUG:: "=== Expected === '$(expected)' ================"; - } diff --git a/tests/acceptance/01_vars/03_lists/extend_list.cf b/tests/acceptance/01_vars/03_lists/extend_list.cf index a70e362a99..2870fc2fe4 100644 --- a/tests/acceptance/01_vars/03_lists/extend_list.cf +++ b/tests/acceptance/01_vars/03_lists/extend_list.cf @@ -3,75 +3,98 @@ # Test that slists can be extended (redefined using its own previous value) # Redmine:4335 and 6541 ####################################################### - body common control { - version => "1.0"; - bundlesequence => { "init", "test", "check" }; + version => "1.0"; + bundlesequence => { "init", "test", "check" }; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { vars: - "x" slist => { "xyz" }, policy => "free"; - "x" slist => { @(x), "extended" }, policy => "free"; - "x" slist => { @(x), "more" }, policy => "free"; - - "x1" slist => { @(x), @(undefined1), @(undefined2) }, policy => "ifdefined"; - "x2" slist => { @(undefined1), @(x), @(undefined2) }, policy => "ifdefined"; - "x3" slist => { @(undefined1), @(undefined2), @(x) }, policy => "ifdefined"; - "x4" slist => { @(x), @(undefined1), @(undefined2), @(x) }, policy => "ifdefined"; - "x5" slist => { @(undefined1), "entry", @(undefined2) }, policy => "ifdefined"; + "x" + slist => { "xyz" }, + policy => "free"; + + "x" + slist => { @(x), "extended" }, + policy => "free"; + + "x" + slist => { @(x), "more" }, + policy => "free"; + + "x1" + slist => { @(x), @(undefined1), @(undefined2) }, + policy => "ifdefined"; + + "x2" + slist => { @(undefined1), @(x), @(undefined2) }, + policy => "ifdefined"; + + "x3" + slist => { @(undefined1), @(undefined2), @(x) }, + policy => "ifdefined"; + + "x4" + slist => { @(x), @(undefined1), @(undefined2), @(x) }, + policy => "ifdefined"; + + "x5" + slist => { @(undefined1), "entry", @(undefined2) }, + policy => "ifdefined"; } ####################################################### - bundle agent check { vars: - "expected" string => "xyz,extended,more"; - "joined_test_x" string => join(",", "test.x"); - "joined_test_x1" string => join(",", "test.x1"); - "joined_test_x2" string => join(",", "test.x2"); - "joined_test_x3" string => join(",", "test.x3"); - "joined_test_x4" string => join(",", "test.x4"); - "joined_test_x5" string => join(",", "test.x5"); + "expected" string => "xyz,extended,more"; + "joined_test_x" string => join(",", "test.x"); + "joined_test_x1" string => join(",", "test.x1"); + "joined_test_x2" string => join(",", "test.x2"); + "joined_test_x3" string => join(",", "test.x3"); + "joined_test_x4" string => join(",", "test.x4"); + "joined_test_x5" string => join(",", "test.x5"); classes: - "ok0" expression => strcmp($(expected), $(joined_test_x)); - "ok1" expression => strcmp($(expected), $(joined_test_x1)); - "ok2" expression => strcmp($(expected), $(joined_test_x2)); - "ok3" expression => strcmp($(expected), $(joined_test_x3)); - "ok4" expression => strcmp("$(expected),$(expected)", $(joined_test_x4)); - "ok5" expression => strcmp("entry", $(joined_test_x5)); - - "ok" and => { "ok0", "ok1", "ok2", "ok3", "ok4", "ok5" }; + "ok0" expression => strcmp($(expected), $(joined_test_x)); + "ok1" expression => strcmp($(expected), $(joined_test_x1)); + "ok2" expression => strcmp($(expected), $(joined_test_x2)); + "ok3" expression => strcmp($(expected), $(joined_test_x3)); + "ok4" expression => strcmp("$(expected),$(expected)", $(joined_test_x4)); + "ok5" expression => strcmp("entry", $(joined_test_x5)); + "ok" and => { "ok0", "ok1", "ok2", "ok3", "ok4", "ok5" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; DEBUG.!ok0:: "x: $(joined_test_x)"; + DEBUG.!ok1:: "expected x1: $(expected)"; " x1: $(joined_test_x1)"; + DEBUG.!ok2:: "x2: $(joined_test_x2)"; + DEBUG.!ok3:: "x3: $(joined_test_x3)"; + DEBUG.!ok4:: "x4: $(joined_test_x4)"; + DEBUG.!ok5:: "x5: $(joined_test_x5)"; } diff --git a/tests/acceptance/01_vars/03_lists/interpolation_order.cf b/tests/acceptance/01_vars/03_lists/interpolation_order.cf index 3c955f4ee3..47752b3f1a 100644 --- a/tests/acceptance/01_vars/03_lists/interpolation_order.cf +++ b/tests/acceptance/01_vars/03_lists/interpolation_order.cf @@ -1,34 +1,35 @@ # Redmine#3122: ensure lists are interpolated in the correct order - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "first_list" slist => { "item1", "item2", "item3", "item4", "item5" }; + "first_list" slist => { "item1", "item2", "item3", "item4", "item5" }; } bundle agent test { vars: - "local" slist => { @(second_list) }; - "second_list" slist => { @(init.first_list), "item6" }; + "local" slist => { @(second_list) }; + "second_list" slist => { @(init.first_list), "item6" }; } bundle agent check { vars: - "expected" string => '{ "item1", "item2", "item3", "item4", "item5", "item6" }'; - "joined" string => format("%S", "test.local"); + "expected" + string => '{ "item1", "item2", "item3", "item4", "item5", "item6" }'; + + "joined" string => format("%S", "test.local"); methods: - "check" usebundle => dcs_check_strcmp($(expected), - $(joined), - "$(this.promise_filename)", - "no"); + "check" + usebundle => dcs_check_strcmp( + $(expected), $(joined), "$(this.promise_filename)", "no" + ); } diff --git a/tests/acceptance/01_vars/03_lists/namespaced_list_including_list_expanded.cf b/tests/acceptance/01_vars/03_lists/namespaced_list_including_list_expanded.cf index 7519228d8a..a595f065ef 100644 --- a/tests/acceptance/01_vars/03_lists/namespaced_list_including_list_expanded.cf +++ b/tests/acceptance/01_vars/03_lists/namespaced_list_including_list_expanded.cf @@ -1,10 +1,9 @@ # Redmine#4445: Ensure that namespaced lists that include other lists are fully expanded - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -14,7 +13,10 @@ bundle agent init bundle agent test { vars: - "agent_output" string => execresult("$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell"); + "agent_output" + string => execresult( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell" + ); } bundle agent check @@ -36,12 +38,12 @@ bundle agent check and => { "found_from_packages", "found_from_server_packages" }, comment => "Found something good from both included lists"; - "ok" expression => "!unexpanded_list.found_expected_output"; reports: ok:: "$(this.promise_filename) Pass"; - !ok:: + + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/01_vars/03_lists/namespaces/passing_slists.cf b/tests/acceptance/01_vars/03_lists/namespaces/passing_slists.cf index ef8fa7101f..96aea5d511 100644 --- a/tests/acceptance/01_vars/03_lists/namespaces/passing_slists.cf +++ b/tests/acceptance/01_vars/03_lists/namespaces/passing_slists.cf @@ -1,19 +1,19 @@ body common control { - inputs => { "../../../default.sub.cf", "passing_slists.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf", "passing_slists.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } body agent control { - abortclasses => { "mylist___mylist_" }; + abortclasses => { "mylist___mylist_" }; } bundle common g { vars: - "slist_pass" slist => { "1", "2", "3" }; + "slist_pass" slist => { "1", "2", "3" }; } bundle agent init @@ -24,11 +24,14 @@ bundle agent init bundle agent test { methods: - "test_in_namespace" usebundle => b:test_in_namespace(@(g.slist_pass)); + "test_in_namespace" usebundle => b:test_in_namespace(@(g.slist_pass)); } bundle agent check { methods: - "check_in_namespace" usebundle => b:check_in_namespace(join(",", "g.slist_pass"), "$(this.promise_filename)"); + "check_in_namespace" + usebundle => b:check_in_namespace( + join(",", "g.slist_pass"), "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/03_lists/namespaces/passing_slists2.cf b/tests/acceptance/01_vars/03_lists/namespaces/passing_slists2.cf index 0af7dc4f01..7974987f50 100644 --- a/tests/acceptance/01_vars/03_lists/namespaces/passing_slists2.cf +++ b/tests/acceptance/01_vars/03_lists/namespaces/passing_slists2.cf @@ -1,13 +1,11 @@ # Redmine#4494 - # the agent should not abort when a bundle is passed a qualified slist # name that doesn't actually exist - body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -17,17 +15,17 @@ bundle agent init bundle agent test { methods: - "watch" usebundle => watch(@(run.watch)); + "watch" usebundle => watch(@(run.watch)); } bundle agent check { methods: - "pass" usebundle => dcs_passif("any", $(this.promise_filename)); + "pass" usebundle => dcs_passif("any", $(this.promise_filename)); } bundle agent watch(given_watch) { vars: - "watch" slist => { @(given_watch) }; + "watch" slist => { @(given_watch) }; } diff --git a/tests/acceptance/01_vars/03_lists/namespaces/passing_slists3.cf b/tests/acceptance/01_vars/03_lists/namespaces/passing_slists3.cf index 976511e3f4..695de82bd5 100644 --- a/tests/acceptance/01_vars/03_lists/namespaces/passing_slists3.cf +++ b/tests/acceptance/01_vars/03_lists/namespaces/passing_slists3.cf @@ -1,16 +1,13 @@ # Redmine#4494 - # the agent should not try to process files promises on the unexpanded # version of a passed list - # here, the error manifests as "Failed to chdir into @(given_watch)" # but it also generates a NOTKEPT compliance entry - body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -20,16 +17,24 @@ bundle agent init bundle agent test { vars: - "output" string => execresult("$(sys.cf_agent) -K -f $(this.promise_filename).sub | $(G.grep) 'Failed to chdir' 2>&1", "useshell"); + "output" + string => execresult( + "$(sys.cf_agent) -K -f $(this.promise_filename).sub | $(G.grep) 'Failed to chdir' 2>&1", + "useshell" + ); } bundle agent check { methods: - "pass" usebundle => dcs_check_regcmp(".*Failed to chdir into '@.given_watch.'.*", - $(test.output), - $(this.promise_filename), - "true"); + "pass" + usebundle => dcs_check_regcmp( + ".*Failed to chdir into '@.given_watch.'.*", + $(test.output), + $(this.promise_filename), + "true" + ); + reports: EXTRA:: "Output = $(test.output)"; diff --git a/tests/acceptance/01_vars/03_lists/nested_lists.cf b/tests/acceptance/01_vars/03_lists/nested_lists.cf index 980232cc45..3a97a3fc8f 100644 --- a/tests/acceptance/01_vars/03_lists/nested_lists.cf +++ b/tests/acceptance/01_vars/03_lists/nested_lists.cf @@ -3,25 +3,22 @@ # Nested iterations of slists (the ordering is not guaranteed, so we sort) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => ""; + "states" slist => { "actual", "expected" }; + "actual" string => ""; - "expected" string => - " + "expected" + string => " Nesting: 1 Nesting: 2 @@ -36,7 +33,7 @@ Sub nesting: 7 Sub nesting: 8"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => insert_line("$(init.$(states))"), edit_defaults => init_empty; @@ -45,81 +42,89 @@ Sub nesting: 8"; bundle edit_line insert_line(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent otherbundle { vars: - "list_a" slist => { }; - "list_b" slist => { "5", "6" }; - "lists" slist => { "a", "b" }; + "list_a" slist => {}; + "list_b" slist => { "5", "6" }; + "lists" slist => { "a", "b" }; } bundle edit_line test_insert { vars: - "list_a" slist => { "1", "2" }; - "list_b" slist => {}; - "lists" slist => { "a", "b" }; - "nothing" string => ""; + "list_a" slist => { "1", "2" }; + "list_b" slist => {}; + "lists" slist => { "a", "b" }; + "nothing" string => ""; insert_lines: - "Nesting: $(list_$(lists))"; - "Expanded: $(lists) $(list_a) $(list_b)"; - "$(nothing)" insert_type => "preserve_all_lines"; # ignore existing newline - "Nothing: $(nothing)"; - "Unknown: $(unknown)"; - "A list: @(lists)"; - "Other empty: $(otherbundle.list_$(otherbundle.lists))"; + "Nesting: $(list_$(lists))"; + "Expanded: $(lists) $(list_a) $(list_b)"; + "$(nothing)" insert_type => "preserve_all_lines"; + + # ignore existing newline + "Nothing: $(nothing)"; + "Unknown: $(unknown)"; + "A list: @(lists)"; + "Other empty: $(otherbundle.list_$(otherbundle.lists))"; } bundle agent sub(text) { files: - "$(G.testfile).actual" - edit_line => insert_line("Sub nesting: $(text)"); + "$(G.testfile).actual" edit_line => insert_line("Sub nesting: $(text)"); } bundle agent test { vars: - "list_a" slist => { }; - "list_b" slist => { "7", "8" }; - "lists" slist => { "a", "b" }; + "list_a" slist => {}; + "list_b" slist => { "7", "8" }; + "lists" slist => { "a", "b" }; files: - "$(G.testfile).actual" - edit_line => test_insert; + "$(G.testfile).actual" edit_line => test_insert; - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => insert_line("Parameter nesting: $(list_$(lists))"); methods: - "nesting" usebundle => sub("$(list_$(lists))"); + "nesting" usebundle => sub("$(list_$(lists))"); } ####################################################### - bundle agent check { - methods: - "any" usebundle => dcs_sort("$(G.testfile).actual", "$(G.testfile).actual.sorted"); - "any" usebundle => dcs_sort("$(G.testfile).expected", "$(G.testfile).expected.sorted"); - "any" usebundle => dcs_check_diff("$(G.testfile).actual.sorted", - "$(G.testfile).expected.sorted", - "$(this.promise_filename)"); + "any" + usebundle => dcs_sort( + "$(G.testfile).actual", "$(G.testfile).actual.sorted" + ); + + "any" + usebundle => dcs_sort( + "$(G.testfile).expected", "$(G.testfile).expected.sorted" + ); + + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual.sorted", + "$(G.testfile).expected.sorted", + "$(this.promise_filename)" + ); } body contain check_in_shell { - useshell => "true"; + useshell => "true"; } diff --git a/tests/acceptance/01_vars/03_lists/usebundle_naked.cf b/tests/acceptance/01_vars/03_lists/usebundle_naked.cf index f27ebcd81d..5ae93d4d53 100644 --- a/tests/acceptance/01_vars/03_lists/usebundle_naked.cf +++ b/tests/acceptance/01_vars/03_lists/usebundle_naked.cf @@ -1,30 +1,31 @@ # Test usebundle passing a naked list from local scope - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "expected" string => "1,2,3"; + "expected" string => "1,2,3"; } bundle agent test { vars: - "testlist" slist => {"1","2","3"}; + "testlist" slist => { "1", "2", "3" }; + methods: - "call sub" usebundle => sub(@{testlist}); + "call sub" usebundle => sub(@{testlist}); } bundle agent sub(sublist) { vars: - "joined" string => join(",", "sublist"); + "joined" string => join(",", "sublist"); + reports: DEBUG:: "sub joined $(joined)"; @@ -33,7 +34,11 @@ bundle agent sub(sublist) bundle agent check { methods: - "check results" usebundle => dcs_check_strcmp("$(init.expected)", "$(sub.joined)", "$(this.promise_filename)", "no"); + "check results" + usebundle => dcs_check_strcmp( + "$(init.expected)", "$(sub.joined)", "$(this.promise_filename)", "no" + ); + reports: DEBUG:: "comparing '$(init.expected)' with '$(sub.joined)'"; diff --git a/tests/acceptance/01_vars/04_containers/canonical_json.cf b/tests/acceptance/01_vars/04_containers/canonical_json.cf index cdb0451633..c18295cad0 100644 --- a/tests/acceptance/01_vars/04_containers/canonical_json.cf +++ b/tests/acceptance/01_vars/04_containers/canonical_json.cf @@ -3,20 +3,18 @@ # Test canonical JSON output # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "c" data => parsejson('{ + "c" data => parsejson('{ "q": 100, "a": 200, "c": [1,2,3,4] @@ -26,16 +24,18 @@ bundle agent init bundle agent test { vars: - "actual" string => format("%S", "init.c"); + "actual" string => format("%S", "init.c"); } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_strcmp($(test.actual), - '{"a":200,"c":[1,2,3,4],"q":100}', - $(this.promise_filename), - "no"); + "any" + usebundle => dcs_check_strcmp( + $(test.actual), + '{"a":200,"c":[1,2,3,4],"q":100}', + $(this.promise_filename), + "no" + ); } diff --git a/tests/acceptance/01_vars/04_containers/execresult_and_as_data.cf b/tests/acceptance/01_vars/04_containers/execresult_and_as_data.cf index b2ed136f54..ef637972cd 100644 --- a/tests/acceptance/01_vars/04_containers/execresult_and_as_data.cf +++ b/tests/acceptance/01_vars/04_containers/execresult_and_as_data.cf @@ -3,39 +3,40 @@ # Test the ability to call the same command with execresult and execresult_as_data # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - - bundle agent init { } ####################################################### - bundle agent test { vars: !windows:: - "res1" string => execresult("echo test", "useshell"); - "res2" data => execresult_as_data("echo test", "useshell", "stdout"); + "res1" string => execresult("echo test", "useshell"); + "res2" data => execresult_as_data("echo test", "useshell", "stdout"); + windows:: - "res1" string => execresult("echo test", "powershell"); - "res2" data => execresult_as_data("echo test", "powershell", "stdout"); + "res1" string => execresult("echo test", "powershell"); + "res2" data => execresult_as_data("echo test", "powershell", "stdout"); } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_strcmp("${test.res1}", "${test.res2[output]}", "$(this.promise_filename)", "no"); + "any" + usebundle => dcs_check_strcmp( + "${test.res1}", + "${test.res2[output]}", + "$(this.promise_filename)", + "no" + ); } diff --git a/tests/acceptance/01_vars/04_containers/extraction.cf b/tests/acceptance/01_vars/04_containers/extraction.cf index 76de98c3e2..f40fa2e847 100644 --- a/tests/acceptance/01_vars/04_containers/extraction.cf +++ b/tests/acceptance/01_vars/04_containers/extraction.cf @@ -3,51 +3,48 @@ # Redmine#4301: "Couldn't find extracted variable" # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { vars: - "config" data => parsejson('{"*.alert": "root"}'); + "config" data => parsejson('{"*.alert": "root"}'); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", - edit_line => test_set_line_based("test.config", " ", "\s+", ".*", "\s*#\s*"); + edit_line => test_set_line_based( + "test.config", " ", "\s+", ".*", "\s*#\s*" + ); } # this is the stdlib set_line_based cut down bundle edit_line test_set_line_based(v, sep, bp, kp, cp) { - vars: - # even though it's not used in the iteration, the vkeys variable - # is required for the test to fail - "vkeys" slist => getindices("$(v)"); - "i" slist => grep($(kp), vkeys); + # even though it's not used in the iteration, the vkeys variable + # is required for the test to fail + "vkeys" slist => getindices("$(v)"); + "i" slist => grep($(kp), vkeys); - # Escape the value (had a problem with special characters and regex's) - "ev[$(i)]" string => escape("$($(v)[$(i)])"); + # Escape the value (had a problem with special characters and regex's) + "ev[$(i)]" string => escape("$($(v)[$(i)])"); } ####################################################### - bundle agent check { reports: - "$(this.promise_filename) Pass"; + "$(this.promise_filename) Pass"; } diff --git a/tests/acceptance/01_vars/04_containers/inline_json.cf b/tests/acceptance/01_vars/04_containers/inline_json.cf index 3a25e3ec3a..de925cecee 100644 --- a/tests/acceptance/01_vars/04_containers/inline_json.cf +++ b/tests/acceptance/01_vars/04_containers/inline_json.cf @@ -3,50 +3,53 @@ # Test inline JSON and YAML data # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "included" string => "( included text )"; - "options1" data => ' + "included" string => "( included text )"; + + "options1" + data => ' { "max_content": 512, "verbose": 0, "headers": [ "Foo: bar" ] }'; - "options3" data => ' + "options3" + data => ' { "max_content": 512, "verbose": "$(included)", "headers": [ "Foo: bar" ] }'; - # same as options3 but with bareword keys - "options4" data => ' + # same as options3 but with bareword keys + "options4" + data => ' { max_content: 512, verbose: "$(included)", headers: [ "Foo: bar" ] }'; - } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/04_containers/inline_json_parse.cf b/tests/acceptance/01_vars/04_containers/inline_json_parse.cf index e8b59ca66b..3e557a04db 100644 --- a/tests/acceptance/01_vars/04_containers/inline_json_parse.cf +++ b/tests/acceptance/01_vars/04_containers/inline_json_parse.cf @@ -3,21 +3,22 @@ # Test inline JSON and YAML data # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_passif_output(".*e8hoeAM1UJC5xmqwCx9iJARKZ9qGk8GU.*", - "", - "$(sys.cf_promises) -p json $(this.promise_filename).sub", - $(this.promise_filename)); + "check" + usebundle => dcs_passif_output( + ".*e8hoeAM1UJC5xmqwCx9iJARKZ9qGk8GU.*", + "", + "$(sys.cf_promises) -p json $(this.promise_filename).sub", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/04_containers/inline_yaml.cf b/tests/acceptance/01_vars/04_containers/inline_yaml.cf index e74bf97426..43a2297209 100644 --- a/tests/acceptance/01_vars/04_containers/inline_yaml.cf +++ b/tests/acceptance/01_vars/04_containers/inline_yaml.cf @@ -3,16 +3,14 @@ # Test inline JSON and YAML data # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: @@ -25,7 +23,6 @@ e: - 1 - 2 '; - "options4" data => '--- a: $(included) c: d @@ -36,14 +33,17 @@ e: } ####################################################### - bundle agent check { methods: feature_yaml:: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); + !feature_yaml:: - "check" usebundle => dcs_pass($(this.promise_filename)); + "check" usebundle => dcs_pass($(this.promise_filename)); } diff --git a/tests/acceptance/01_vars/04_containers/iterate_over_data_array.cf b/tests/acceptance/01_vars/04_containers/iterate_over_data_array.cf index de74a7ad95..34c017bce9 100644 --- a/tests/acceptance/01_vars/04_containers/iterate_over_data_array.cf +++ b/tests/acceptance/01_vars/04_containers/iterate_over_data_array.cf @@ -1,37 +1,43 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => tidy; + "$(G.testfile)" delete => tidy; } bundle agent test { meta: - - "description" -> { "zendesk:3437" } - string => "Test that we can iterate over an array inside of + "description" -> { "zendesk:3437" } + string => "Test that we can iterate over an array inside of a data container without first extracting it. And that the order of iteration is preserved."; vars: - "data3" data => '{ "iteration_order":[ "b", "c", "a" ], "b":{ "key": "bkeyval" }, "c":{"key":"ckeyval"}, "a":{"key":"akeyval"}}'; + "data3" + data => '{ "iteration_order":[ "b", "c", "a" ], "b":{ "key": "bkeyval" }, "c":{"key":"ckeyval"}, "a":{"key":"akeyval"}}'; files: - "$(G.testfile)" - create => "true", - edit_line => append_if_no_line("$(data3[$(data3[iteration_order])][key])"); + "$(G.testfile)" + create => "true", + edit_line => append_if_no_line( + "$(data3[$(data3[iteration_order])][key])" + ); } bundle agent check { methods: - "Check" usebundle => dcs_check_diff( $(G.testfile), "$(this.promise_filename).expected", $(this.promise_filename) ); + "Check" + usebundle => dcs_check_diff( + $(G.testfile), + "$(this.promise_filename).expected", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/04_containers/iterate_over_data_container_with_nulls.cf b/tests/acceptance/01_vars/04_containers/iterate_over_data_container_with_nulls.cf index e228d9f2ac..25273dc040 100644 --- a/tests/acceptance/01_vars/04_containers/iterate_over_data_container_with_nulls.cf +++ b/tests/acceptance/01_vars/04_containers/iterate_over_data_container_with_nulls.cf @@ -1,8 +1,8 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -12,19 +12,19 @@ bundle agent init "$(G.dos2unix) $(this.promise_filename).expected" -> { "ENT-10433" }; files: - "$(G.testdir)/actual.txt" - delete => tidy; + "$(G.testdir)/actual.txt" delete => tidy; } bundle agent test { meta: - "description" -> { "CFE-2230" } - string => "Test that iteration over the getindices() of a data container + "description" -> { "CFE-2230" } + string => "Test that iteration over the getindices() of a data container is not interrupted by nulls."; vars: - "data" data => '{ + "data" + data => '{ "instanceId": "i-f444554e", "billingProducts": null, "instanceType": "m3.large", @@ -41,7 +41,8 @@ bundle agent test "devpayProductCodes": null }'; - "data2" data => '{ + "data2" + data => '{ "instanceId" : "i-f444554e", "instanceType" : "m3.large", "accountId" : "444444444444", @@ -55,26 +56,26 @@ bundle agent test "privateIp" : "10.44.44.4", }'; - "keys" slist => getindices("data"); - "$(keys)" string => "$(data[$(keys)])"; - - "keys2" slist => getindices("data2"); - "$(keys2)" string => "$(data2[$(keys2)])"; + "keys" slist => getindices("data"); + "$(keys)" string => "$(data[$(keys)])"; + "keys2" slist => getindices("data2"); + "$(keys2)" string => "$(data2[$(keys2)])"; reports: + "with nulls: $(keys) = $(data[$(keys)])" + report_to_file => "$(G.testdir)/actual.txt"; - "with nulls: $(keys) = $(data[$(keys)])" - report_to_file => "$(G.testdir)/actual.txt"; - - "without nulls: $(keys2) = $(data2[$(keys2)])" - report_to_file => "$(G.testdir)/actual.txt"; + "without nulls: $(keys2) = $(data2[$(keys2)])" + report_to_file => "$(G.testdir)/actual.txt"; } bundle agent check { methods: - "Pass/Fail" - usebundle => dcs_check_diff( "$(G.testdir)/actual.txt", - "$(this.promise_filename).expected", - $(this.promise_filename) ); + "Pass/Fail" + usebundle => dcs_check_diff( + "$(G.testdir)/actual.txt", + "$(this.promise_filename).expected", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/04_containers/mergecontainer.cf b/tests/acceptance/01_vars/04_containers/mergecontainer.cf index 1dbe38d995..606ab43acd 100644 --- a/tests/acceptance/01_vars/04_containers/mergecontainer.cf +++ b/tests/acceptance/01_vars/04_containers/mergecontainer.cf @@ -3,20 +3,18 @@ # Test mergedata() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert_lines; } @@ -24,31 +22,33 @@ bundle agent init bundle edit_line init_insert_lines { insert_lines: - 'a'; - 'b'; - 'c'; + 'a'; + 'b'; + 'c'; } ####################################################### - bundle agent test { vars: - "load1" data => parsejson('{"x": "y", "third": 123}'); + "load1" data => parsejson('{"x": "y", "third": 123}'); - "load2" data => parsejson(' + "load2" + data => parsejson( + ' { "first": 1, "seconds": 2, "third": [ "a", "b", "c" ], "fourth": null } -'); +' + ); - "load" data => mergedata("load1", "load2"); + "load" data => mergedata("load1", "load2"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -56,15 +56,17 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(test.load[third])"; + "$(test.load[third])"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/04_containers/mergecontainer_arrays.cf b/tests/acceptance/01_vars/04_containers/mergecontainer_arrays.cf index c263527efe..51cad785c7 100644 --- a/tests/acceptance/01_vars/04_containers/mergecontainer_arrays.cf +++ b/tests/acceptance/01_vars/04_containers/mergecontainer_arrays.cf @@ -3,20 +3,18 @@ # Test mergejson() with two JSON arrays # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert_lines; } @@ -24,22 +22,21 @@ bundle agent init bundle edit_line init_insert_lines { insert_lines: - 'a'; - 'b'; - 'c'; + 'a'; + 'b'; + 'c'; } ####################################################### - bundle agent test { vars: - "load1" data => parsejson('["a", "b"]'); - "load2" data => parsejson('["c"]'); - "load" data => mergedata("load1", "load2"); + "load1" data => parsejson('["a", "b"]'); + "load2" data => parsejson('["c"]'); + "load" data => mergedata("load1", "load2"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -47,15 +44,17 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(test.load)"; + "$(test.load)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/04_containers/mergecontainer_conflict.cf b/tests/acceptance/01_vars/04_containers/mergecontainer_conflict.cf index d559e54630..64c72b206a 100644 --- a/tests/acceptance/01_vars/04_containers/mergecontainer_conflict.cf +++ b/tests/acceptance/01_vars/04_containers/mergecontainer_conflict.cf @@ -3,20 +3,18 @@ # Test mergejson() with mismatched datas # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert_lines; } @@ -24,30 +22,32 @@ bundle agent init bundle edit_line init_insert_lines { insert_lines: - "$(const.dollar)(test.load[third])"; + "$(const.dollar)(test.load[third])"; } ####################################################### - bundle agent test { vars: - "load1" data => parsejson('["x": "y", "third"]'); + "load1" data => parsejson('["x": "y", "third"]'); - "load2" data => parsejson(' + "load2" + data => parsejson( + ' { "first": 1, "seconds": 2, "third": [ "a", "b", "c" ], "fourth": null } -'); +' + ); - # this should fail - "load" data => mergedata("load1", "load2"); + # this should fail + "load" data => mergedata("load1", "load2"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -55,15 +55,17 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(test.load[third])"; + "$(test.load[third])"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/04_containers/mergedata_with_unresolved_variables_does_not_define_datacontainer.cf b/tests/acceptance/01_vars/04_containers/mergedata_with_unresolved_variables_does_not_define_datacontainer.cf index 6291609f1b..64d0e3bed3 100644 --- a/tests/acceptance/01_vars/04_containers/mergedata_with_unresolved_variables_does_not_define_datacontainer.cf +++ b/tests/acceptance/01_vars/04_containers/mergedata_with_unresolved_variables_does_not_define_datacontainer.cf @@ -1,39 +1,34 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common test_meta { vars: - "description" string => "Test that data containers are NOT defined when mergedata is used with a non-existing data container"; + "description" + string => "Test that data containers are NOT defined when mergedata is used with a non-existing data container"; } bundle agent check { vars: - "data" - data => mergedata("missing_ns:missing_bundle.missing_var"); + "data" data => mergedata("missing_ns:missing_bundle.missing_var"); classes: - "fail" - expression => isvariable("data"); - - "ok" - not => isvariable("data"); - - "exception" - and => { "fail", "ok" }; + "fail" expression => isvariable("data"); + "ok" not => isvariable("data"); + "exception" and => { "fail", "ok" }; reports: - fail:: - "$(this.promise_filename) FAIL"; + fail:: + "$(this.promise_filename) FAIL"; - ok.!fail:: - "$(this.promise_filename) Pass"; + ok.!fail:: + "$(this.promise_filename) Pass"; - exception:: - "$(this.promise_filename) EXCEPTION"; + exception:: + "$(this.promise_filename) EXCEPTION"; } diff --git a/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_dynamic.cf b/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_dynamic.cf index 0a0d44dd84..5128d66744 100644 --- a/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_dynamic.cf +++ b/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_dynamic.cf @@ -1,7 +1,6 @@ # This policy is synthetic, but represents a real life pattern where data is # published from multiple bundles and then merged before use. # Note: The multiple_cmerge_variable_static.cf test is nearly identical. It simply uses hard coded variables instead of variable variables. - #@@ -97,7 +102,7 @@ # # vars: @@ -18,32 +17,28 @@ #- data => readjson( "$(this.promise_filename).policy_2.cron.json"), #+ data => readjson( "$(this.promise_filename).$(this.bundle).$(this.promiser).json"), # meta => { "cron_rules" }; - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "autorun" slist => bundlesmatching(".*", "autorun"); + "autorun" slist => bundlesmatching(".*", "autorun"); commands: windows:: "$(G.dos2unix) $(this.promise_filename).expected" -> { "ENT-10433" }; files: - "$(G.testfile)" - edit_line => empty; + "$(G.testfile)" edit_line => empty; methods: - - "$(autorun)" - - comment => "Bundles tagged with 'autorun' expect to be automatically + "$(autorun)" + comment => "Bundles tagged with 'autorun' expect to be automatically actuated. Some of the policies publish data by tagging it for other policies to use later in the bundlesequence. This allows for the implementation of automatic cleanup when a @@ -53,82 +48,82 @@ bundle agent init bundle agent test { meta: - - "description" - string => "Test that this real life pattern for loading data based on a + "description" + string => "Test that this real life pattern for loading data based on a bundle name and merging it for later use works."; methods: - - "cron" - comment => "Manage /etc/crontab using published cron rules"; + "cron" comment => "Manage /etc/crontab using published cron rules"; } bundle agent check { - methods: - "" usebundle => dcs_check_diff( $(G.testfile), "$(this.promise_filename).expected", $(this.promise_filename) ); + "" + usebundle => dcs_check_diff( + $(G.testfile), + "$(this.promise_filename).expected", + $(this.promise_filename) + ); } bundle agent cron { vars: - "published_rules" - slist => variablesmatching( ".*", "cron_rules" ), - comment => "We find all variables tagged with cron_rules so that we can + "published_rules" + slist => variablesmatching(".*", "cron_rules"), + comment => "We find all variables tagged with cron_rules so that we can merge them together and manage /etc/crontab from a single policy. Allowing other polices to easily subscribe to the service."; - "sorted" - slist => sort( published_rules, "lex" ); - # It is possible to perform some data validation at this point. filtering - # or restricting what areas of policy are allowed to subscribe to the - # cron implementation. + "sorted" slist => sort(published_rules, "lex"); + # It is possible to perform some data validation at this point. filtering + # or restricting what areas of policy are allowed to subscribe to the + # cron implementation. methods: - # We use the cmerge bundle from the standard library to merge all of the - # data containers into a single container that will be used to render - # /etc/crontab - "" usebundle => cmerge("merged_cron_rules", @(sorted) ); - "" usebundle => cron_entries( @(cmerge.merged_cron_rules) ); + # We use the cmerge bundle from the standard library to merge all of the + # data containers into a single container that will be used to render + # /etc/crontab + "" usebundle => cmerge("merged_cron_rules", @(sorted)); + "" usebundle => cron_entries(@(cmerge.merged_cron_rules)); } bundle agent cron_entries(rules) { vars: - "s" string => format("%S", rules ); + "s" string => format("%S", rules); reports: - "$(this.bundle): '$(s)'" - report_to_file => "$(G.testfile)"; + "$(this.bundle): '$(s)'" report_to_file => "$(G.testfile)"; } bundle edit_line empty { delete_lines: - ".*"; + ".*"; } + bundle agent policy_1 # This represents a bundle for some service. It might be some custom in house # written application. They publish information about some cron jobs they wish # to have run. That data originates in this case from a plain text file. { meta: - "tags" slist => { "autorun" }; + "tags" slist => { "autorun" }; vars: - "cron" - data => readjson( "$(this.promise_filename).$(this.bundle).$(this.promiser).json"), - meta => { "cron_rules" }; + "cron" + data => readjson( + "$(this.promise_filename).$(this.bundle).$(this.promiser).json" + ), + meta => { "cron_rules" }; - "s" string => format( "%S", cron ); + "s" string => format("%S", cron); reports: - "$(this.bundle): cron = '$(s)'" - report_to_file => "$(G.testfile)"; - + "$(this.bundle): cron = '$(s)'" report_to_file => "$(G.testfile)"; } bundle agent policy_2 @@ -137,26 +132,35 @@ bundle agent policy_2 # to have run. That data originates in this case from a plain text file. { meta: - "tags" slist => { "autorun" }; + "tags" slist => { "autorun" }; vars: - # # For example: Cron entries - "cron" - - data => readjson( "$(this.promise_filename).$(this.bundle).$(this.promiser).json"), - meta => { "cron_rules" }; + # # For example: Cron entries + "cron" + data => readjson( + "$(this.promise_filename).$(this.bundle).$(this.promiser).json" + ), + meta => { "cron_rules" }; - "s" string => format( "%S", cron ); + "s" string => format("%S", cron); reports: - "$(this.bundle): cron = '$(s)'" - report_to_file => "$(G.testfile)"; + "$(this.bundle): cron = '$(s)'" report_to_file => "$(G.testfile)"; } bundle agent cmerge(name, varlist) { vars: - "$(name)" data => parsejson('[]'), policy => "free"; - "$(name)" data => mergedata($(name), $(varlist)), policy => "free"; # iterates! - "$(name)_str" string => format("%S", $(name)), policy => "free"; + "$(name)" + data => parsejson('[]'), + policy => "free"; + + "$(name)" + data => mergedata($(name), $(varlist)), + policy => "free"; + + # iterates! + "$(name)_str" + string => format("%S", $(name)), + policy => "free"; } diff --git a/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_dynamic.cf.policy_1.cron.json b/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_dynamic.cf.policy_1.cron.json index 494e64c993..f77ed1f099 100644 --- a/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_dynamic.cf.policy_1.cron.json +++ b/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_dynamic.cf.policy_1.cron.json @@ -1,10 +1,10 @@ [ - { - "hour": "1", - "minute": "1", - "day": "1", - "month": "1", - "comment": "a backup job that runs", - "command": "/bin/echo 'back me up!'" - } + { + "hour": "1", + "minute": "1", + "day": "1", + "month": "1", + "comment": "a backup job that runs", + "command": "/bin/echo 'back me up!'" + } ] diff --git a/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_dynamic.cf.policy_2.cron.json b/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_dynamic.cf.policy_2.cron.json index c8e8ce99ac..089fe7a054 100644 --- a/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_dynamic.cf.policy_2.cron.json +++ b/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_dynamic.cf.policy_2.cron.json @@ -1,10 +1,10 @@ [ - { - "hour": "*", - "minute": "*", - "day": "*", - "month": "*", - "comment": "This job is a failsafe to keep cfengine services running", - "command": "/bin/echo 'Hi there'" - } + { + "hour": "*", + "minute": "*", + "day": "*", + "month": "*", + "comment": "This job is a failsafe to keep cfengine services running", + "command": "/bin/echo 'Hi there'" + } ] diff --git a/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_static.cf b/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_static.cf index 81d8954d83..157ecf51b4 100644 --- a/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_static.cf +++ b/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_static.cf @@ -2,29 +2,26 @@ # published from multiple bundles and then merged before use. body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "autorun" slist => bundlesmatching(".*", "autorun"); + "autorun" slist => bundlesmatching(".*", "autorun"); commands: windows:: "$(G.dos2unix) $(this.promise_filename).expected" -> { "ENT-10433" }; files: - "$(G.testfile)" - edit_line => empty; + "$(G.testfile)" edit_line => empty; methods: - - "$(autorun)" - - comment => "Bundles tagged with 'autorun' expect to be automatically + "$(autorun)" + comment => "Bundles tagged with 'autorun' expect to be automatically actuated. Some of the policies publish data by tagging it for other policies to use later in the bundlesequence. This allows for the implementation of automatic cleanup when a @@ -34,82 +31,80 @@ bundle agent init bundle agent test { meta: - - "description" - string => "Test that this real life pattern for loading data based on a + "description" + string => "Test that this real life pattern for loading data based on a bundle name and merging it for later use works."; methods: - - "cron" - comment => "Manage /etc/crontab using published cron rules"; + "cron" comment => "Manage /etc/crontab using published cron rules"; } bundle agent check { - methods: - "" usebundle => dcs_check_diff( $(G.testfile), "$(this.promise_filename).expected", $(this.promise_filename) ); + "" + usebundle => dcs_check_diff( + $(G.testfile), + "$(this.promise_filename).expected", + $(this.promise_filename) + ); } bundle agent cron { vars: - "published_rules" - slist => variablesmatching( ".*", "cron_rules" ), - comment => "We find all variables tagged with cron_rules so that we can + "published_rules" + slist => variablesmatching(".*", "cron_rules"), + comment => "We find all variables tagged with cron_rules so that we can merge them together and manage /etc/crontab from a single policy. Allowing other polices to easily subscribe to the service."; - "sorted" - slist => sort( published_rules, "lex" ); - # It is possible to perform some data validation at this point. filtering - # or restricting what areas of policy are allowed to subscribe to the - # cron implementation. + "sorted" slist => sort(published_rules, "lex"); + # It is possible to perform some data validation at this point. filtering + # or restricting what areas of policy are allowed to subscribe to the + # cron implementation. methods: - # We use the cmerge bundle from the standard library to merge all of the - # data containers into a single container that will be used to render - # /etc/crontab - "" usebundle => cmerge("merged_cron_rules", @(sorted) ); - "" usebundle => cron_entries( @(cmerge.merged_cron_rules) ); + # We use the cmerge bundle from the standard library to merge all of the + # data containers into a single container that will be used to render + # /etc/crontab + "" usebundle => cmerge("merged_cron_rules", @(sorted)); + "" usebundle => cron_entries(@(cmerge.merged_cron_rules)); } bundle agent cron_entries(rules) { vars: - "s" string => format("%S", rules ); + "s" string => format("%S", rules); reports: - "$(this.bundle): '$(s)'" - report_to_file => "$(G.testfile)"; + "$(this.bundle): '$(s)'" report_to_file => "$(G.testfile)"; } bundle edit_line empty { delete_lines: - ".*"; + ".*"; } + bundle agent policy_1 # This represents a bundle for some service. It might be some custom in house # written application. They publish information about some cron jobs they wish # to have run. That data originates in this case from a plain text file. { meta: - "tags" slist => { "autorun" }; + "tags" slist => { "autorun" }; vars: - "cron" - data => readjson( "$(this.promise_filename).policy_1.cron.json"), - meta => { "cron_rules" }; + "cron" + data => readjson("$(this.promise_filename).policy_1.cron.json"), + meta => { "cron_rules" }; - "s" string => format( "%S", cron ); + "s" string => format("%S", cron); reports: - "$(this.bundle): cron = '$(s)'" - report_to_file => "$(G.testfile)"; - + "$(this.bundle): cron = '$(s)'" report_to_file => "$(G.testfile)"; } bundle agent policy_2 @@ -118,26 +113,33 @@ bundle agent policy_2 # to have run. That data originates in this case from a plain text file. { meta: - "tags" slist => { "autorun" }; + "tags" slist => { "autorun" }; vars: - # # For example: Cron entries - "cron" - - data => readjson( "$(this.promise_filename).policy_2.cron.json"), - meta => { "cron_rules" }; + # # For example: Cron entries + "cron" + data => readjson("$(this.promise_filename).policy_2.cron.json"), + meta => { "cron_rules" }; - "s" string => format( "%S", cron ); + "s" string => format("%S", cron); reports: - "$(this.bundle): cron = '$(s)'" - report_to_file => "$(G.testfile)"; + "$(this.bundle): cron = '$(s)'" report_to_file => "$(G.testfile)"; } bundle agent cmerge(name, varlist) { vars: - "$(name)" data => parsejson('[]'), policy => "free"; - "$(name)" data => mergedata($(name), $(varlist)), policy => "free"; # iterates! - "$(name)_str" string => format("%S", $(name)), policy => "free"; + "$(name)" + data => parsejson('[]'), + policy => "free"; + + "$(name)" + data => mergedata($(name), $(varlist)), + policy => "free"; + + # iterates! + "$(name)_str" + string => format("%S", $(name)), + policy => "free"; } diff --git a/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_static.cf.policy_1.cron.json b/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_static.cf.policy_1.cron.json index 494e64c993..f77ed1f099 100644 --- a/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_static.cf.policy_1.cron.json +++ b/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_static.cf.policy_1.cron.json @@ -1,10 +1,10 @@ [ - { - "hour": "1", - "minute": "1", - "day": "1", - "month": "1", - "comment": "a backup job that runs", - "command": "/bin/echo 'back me up!'" - } + { + "hour": "1", + "minute": "1", + "day": "1", + "month": "1", + "comment": "a backup job that runs", + "command": "/bin/echo 'back me up!'" + } ] diff --git a/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_static.cf.policy_2.cron.json b/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_static.cf.policy_2.cron.json index c8e8ce99ac..089fe7a054 100644 --- a/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_static.cf.policy_2.cron.json +++ b/tests/acceptance/01_vars/04_containers/multiple_cmerge_variable_static.cf.policy_2.cron.json @@ -1,10 +1,10 @@ [ - { - "hour": "*", - "minute": "*", - "day": "*", - "month": "*", - "comment": "This job is a failsafe to keep cfengine services running", - "command": "/bin/echo 'Hi there'" - } + { + "hour": "*", + "minute": "*", + "day": "*", + "month": "*", + "comment": "This job is a failsafe to keep cfengine services running", + "command": "/bin/echo 'Hi there'" + } ] diff --git a/tests/acceptance/01_vars/04_containers/parsejson.cf b/tests/acceptance/01_vars/04_containers/parsejson.cf index 9d4ee528da..9842cc9a09 100644 --- a/tests/acceptance/01_vars/04_containers/parsejson.cf +++ b/tests/acceptance/01_vars/04_containers/parsejson.cf @@ -3,20 +3,18 @@ # Test parsejson() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert_lines; } @@ -24,20 +22,19 @@ bundle agent init bundle edit_line init_insert_lines { insert_lines: - 'a'; - 'b'; - 'c'; + 'a'; + 'b'; + 'c'; } ####################################################### - bundle agent test { vars: - "load" data => parsejson('["a", "b", "c"]'); + "load" data => parsejson('["a", "b", "c"]'); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -45,15 +42,17 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(test.load)"; + "$(test.load)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/04_containers/parsejson_indexed.cf b/tests/acceptance/01_vars/04_containers/parsejson_indexed.cf index 75f089c26b..cb2a284c93 100644 --- a/tests/acceptance/01_vars/04_containers/parsejson_indexed.cf +++ b/tests/acceptance/01_vars/04_containers/parsejson_indexed.cf @@ -3,20 +3,18 @@ # Test parsejson() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert_lines; } @@ -24,27 +22,29 @@ bundle agent init bundle edit_line init_insert_lines { insert_lines: - 'a'; - 'b'; - 'c'; + 'a'; + 'b'; + 'c'; } ####################################################### - bundle agent test { vars: - "load" data => parsejson(' + "load" + data => parsejson( + ' { "first": 1, "seconds": 2, "third": [ "a", "b", "c" ], "fourth": null } -'); +' + ); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -52,15 +52,17 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(test.load[third])"; + "$(test.load[third])"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/04_containers/parsejson_storejson_with_missing_container_does_not_create_new_container.cf b/tests/acceptance/01_vars/04_containers/parsejson_storejson_with_missing_container_does_not_create_new_container.cf index 254d121211..ed7ce77531 100644 --- a/tests/acceptance/01_vars/04_containers/parsejson_storejson_with_missing_container_does_not_create_new_container.cf +++ b/tests/acceptance/01_vars/04_containers/parsejson_storejson_with_missing_container_does_not_create_new_container.cf @@ -1,14 +1,15 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common test_meta { vars: - "description" string => "Test that a data container defined by using parsejson(storejson()) against a non existing data container will not define a new data container."; + "description" + string => "Test that a data container defined by using parsejson(storejson()) against a non existing data container will not define a new data container."; } bundle agent init @@ -21,28 +22,23 @@ bundle agent init reports: DEBUG:: - "DEBUG $(this.bundle): serialized_data: '$(serialized_data)'"; + "DEBUG $(this.bundle): serialized_data: '$(serialized_data)'"; } bundle agent check { classes: - "fail" - expression => isvariable("init.data"); - - "ok" - not => isvariable("init.data"); - - "exception" - and => { "fail", "ok" }; + "fail" expression => isvariable("init.data"); + "ok" not => isvariable("init.data"); + "exception" and => { "fail", "ok" }; reports: - fail:: - "$(this.promise_filename) FAIL"; + fail:: + "$(this.promise_filename) FAIL"; - ok.!fail:: - "$(this.promise_filename) Pass"; + ok.!fail:: + "$(this.promise_filename) Pass"; - exception:: - "$(this.promise_filename) EXCEPTION"; + exception:: + "$(this.promise_filename) EXCEPTION"; } diff --git a/tests/acceptance/01_vars/04_containers/parsejson_unicode.cf b/tests/acceptance/01_vars/04_containers/parsejson_unicode.cf index 7e68c1544a..d99ac800be 100644 --- a/tests/acceptance/01_vars/04_containers/parsejson_unicode.cf +++ b/tests/acceptance/01_vars/04_containers/parsejson_unicode.cf @@ -3,22 +3,22 @@ # Test that we don't barf on unicode escapes in JSON # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent check { methods: - "" usebundle => - dcs_passif_output(".*R: response index: unicode\b.*", - ".*Error parsing JSON.*", - "$(sys.cf_agent) -KIf $(this.promise_filename).sub", - $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + ".*R: response index: unicode\b.*", + ".*Error parsing JSON.*", + "$(sys.cf_agent) -KIf $(this.promise_filename).sub", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/01_vars/04_containers/parsejson_with_unresolved_varibales_does_not_define_datacontainer.cf b/tests/acceptance/01_vars/04_containers/parsejson_with_unresolved_varibales_does_not_define_datacontainer.cf index 22e51a9650..48eed742c6 100644 --- a/tests/acceptance/01_vars/04_containers/parsejson_with_unresolved_varibales_does_not_define_datacontainer.cf +++ b/tests/acceptance/01_vars/04_containers/parsejson_with_unresolved_varibales_does_not_define_datacontainer.cf @@ -1,41 +1,40 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common test_meta { vars: - "description" string => "Test that data containers defined with parsejson that conatains unexpanded variables does NOT define a new datacontainer"; + "description" + string => "Test that data containers defined with parsejson that conatains unexpanded variables does NOT define a new datacontainer"; } bundle agent check { vars: "data" - data => parsejson('{ + data => parsejson( + '{ "key1": "$(sys.fqhost)", "key2" : "$(undefined_namespace:undefined_bundle.undefined_variable)" - }'); - classes: - "fail" - expression => isvariable("data"); - - "ok" - not => isvariable("data"); + }' + ); - "exception" - and => { "fail", "ok" }; + classes: + "fail" expression => isvariable("data"); + "ok" not => isvariable("data"); + "exception" and => { "fail", "ok" }; reports: - fail:: - "$(this.promise_filename) FAIL"; + fail:: + "$(this.promise_filename) FAIL"; - ok.!fail:: - "$(this.promise_filename) Pass"; + ok.!fail:: + "$(this.promise_filename) Pass"; - exception:: - "$(this.promise_filename) EXCEPTION"; + exception:: + "$(this.promise_filename) EXCEPTION"; } diff --git a/tests/acceptance/01_vars/04_containers/parseyaml.cf b/tests/acceptance/01_vars/04_containers/parseyaml.cf index a5f4bbcf16..dfea8a3dc1 100644 --- a/tests/acceptance/01_vars/04_containers/parseyaml.cf +++ b/tests/acceptance/01_vars/04_containers/parseyaml.cf @@ -3,30 +3,31 @@ # Test parseyaml() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle common yaml_check { classes: - "no_yaml_support" - not => regline(" *# *define *HAVE_LIBYAML.*", "$(this.promise_dirname)/../../../../libutils/config.h"); + "no_yaml_support" + not => regline( + " *# *define *HAVE_LIBYAML.*", + "$(this.promise_dirname)/../../../../libutils/config.h" + ); } bundle agent init { meta: - "test_skip_unsupported" string => "no_yaml_support"; + "test_skip_unsupported" string => "no_yaml_support"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert_lines; } @@ -34,7 +35,7 @@ bundle agent init bundle edit_line init_insert_lines { insert_lines: - '{ + '{ "a": "b", "c": "d", "e": [ @@ -79,11 +80,12 @@ bundle edit_line init_insert_lines } ####################################################### - bundle agent test { vars: - "load" data => parseyaml('a: b + "load" + data => parseyaml( + 'a: b c: d e: - where: 1 @@ -107,12 +109,13 @@ f: - root - john - debbie -'); +' + ); - "load_s" string => storejson(load); + "load_s" string => storejson(load); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -120,15 +123,17 @@ f: bundle edit_line test_insert { insert_lines: - "$(test.load_s)"; + "$(test.load_s)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/04_containers/parseyaml_abuse.cf b/tests/acceptance/01_vars/04_containers/parseyaml_abuse.cf index 8e5bd8e7f5..316b0ac757 100644 --- a/tests/acceptance/01_vars/04_containers/parseyaml_abuse.cf +++ b/tests/acceptance/01_vars/04_containers/parseyaml_abuse.cf @@ -3,20 +3,20 @@ # Abuse parseyaml() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "strings" data => parsejson(' + "strings" + data => parsejson( + ' [ "- valid", "xyzzz", @@ -25,13 +25,12 @@ bundle agent test "- { xyzzz: }", "xyzzz: { p: 100 }", "- p class=\\"some class\\" id=\\"some-id\\": abusing the free naming of properties in YAML.", -]'); - - "n" slist => getindices(strings); - - "load_$(n)" data => parseyaml("$(strings[$(n)])"); +]' + ); - "load_s_$(n)" string => format("%S", "load_$(n)"); + "n" slist => getindices(strings); + "load_$(n)" data => parseyaml("$(strings[$(n)])"); + "load_s_$(n)" string => format("%S", "load_$(n)"); reports: EXTRA:: @@ -42,5 +41,5 @@ bundle agent test bundle agent check { methods: - "any" usebundle => dcs_pass("$(this.promise_filename)"); + "any" usebundle => dcs_pass("$(this.promise_filename)"); } diff --git a/tests/acceptance/01_vars/04_containers/pass_variable_container.cf b/tests/acceptance/01_vars/04_containers/pass_variable_container.cf index 7a5947470a..4429fae170 100644 --- a/tests/acceptance/01_vars/04_containers/pass_variable_container.cf +++ b/tests/acceptance/01_vars/04_containers/pass_variable_container.cf @@ -3,16 +3,14 @@ # Test datacontainers can be passed with a variable name. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { meta: @@ -23,51 +21,68 @@ bundle agent init "$(G.dos2unix) $(this.promise_filename).expected" -> { "ENT-10433" }; vars: -# We want to be sure we can reference this data subsequently - "d" data => parsejson( '{ + # We want to be sure we can reference this data subsequently + "d" + data => parsejson( + '{ "hosts": { "path": "/etc/hosts" }, "auto_master" { "path": "/etc/auto.master" } -}'); - +}' + ); } -bundle agent test +bundle agent test { - meta: "description" -> { "CFE-2434" } string => "Test that variable data containers can be passed."; vars: - "found" slist => bundlesmatching(".*", "find"); + "found" slist => bundlesmatching(".*", "find"); + # "ns_bundle" string => "default:init"; # This is the same content as the # "found" variable, so we just use that instead. - "bundle_name" string => "init"; "bundle_name_suffix" string => "it"; methods: "" usebundle => report_data("Pass by name:", @(init.d)); "" usebundle => report_data("Pass by namespace:name:", @(default:init.d)); - "" usebundle => report_data("Pass by variable name:", "@($(bundle_name).d)"); - "" usebundle => report_data("Pass by variable name including namespace:", "@($(found).d)"); - "" usebundle => report_data("Pass by variable name with prefix:", "@(in$(bundle_name_suffix).d)"); - "" usebundle => report_data("Pass by variable name with namespace:", "@(default:$(bundle_name).d)"); + + "" + usebundle => report_data("Pass by variable name:", "@($(bundle_name).d)"); + + "" + usebundle => report_data( + "Pass by variable name including namespace:", "@($(found).d)" + ); + + "" + usebundle => report_data( + "Pass by variable name with prefix:", "@(in$(bundle_name_suffix).d)" + ); + + "" + usebundle => report_data( + "Pass by variable name with namespace:", "@(default:$(bundle_name).d)" + ); } bundle agent check { methods: - "" usebundle => dcs_check_diff( $(G.testfile), - "$(this.promise_filename).expected", - $(this.promise_filename)); + "" + usebundle => dcs_check_diff( + $(G.testfile), + "$(this.promise_filename).expected", + $(this.promise_filename) + ); } - bundle agent report_data(id, datacontainer) { vars: @@ -78,13 +93,10 @@ bundle agent report_data(id, datacontainer) reports: DEBUG:: - "$(id) found keys in data container" - if => "some_keys"; - - "$(id) did *not* find keys in data container" - unless => "some_keys"; + "$(id) found keys in data container" if => "some_keys"; + "$(id) did *not* find keys in data container" unless => "some_keys"; any:: - "$(id) $(keys)=$(datacontainer[$(keys)][path])" - report_to_file => "$(G.testfile)"; + "$(id) $(keys)=$(datacontainer[$(keys)][path])" + report_to_file => "$(G.testfile)"; } diff --git a/tests/acceptance/01_vars/04_containers/pass_variable_container_index.cf b/tests/acceptance/01_vars/04_containers/pass_variable_container_index.cf index 6b1befd1ae..5241302d4a 100644 --- a/tests/acceptance/01_vars/04_containers/pass_variable_container_index.cf +++ b/tests/acceptance/01_vars/04_containers/pass_variable_container_index.cf @@ -3,74 +3,72 @@ # Test datacontainers can be passed with a variable name. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { meta: - "tags" slist => { "find" }; + "tags" slist => { "find" }; + commands: windows:: "$(G.dos2unix) $(this.promise_filename).expected" -> { "ENT-10433" }; - } bundle agent test - { meta: "description" -> { "CFE-3299" } string => "Test that lists and data containers with variable index can be passed."; vars: - "data" - data => parsejson('{ "key1" : { "list" : [ "a", "b", "c" ], "scalar" : "value1" }, - "key2" : { "list" : [ "x", "y", "z" ], "scalar" : "value2" } }') ; - - "array[key1][list]" slist => { "a", "b", "c" } ; - "array[key1][scalar]" string => "value1" ; - "array[key2][list]" slist => { "x", "y", "z" } ; - "array[key2][scalar]" string => "value2" ; - - "datakey" slist => getindices("data") ; - "arraykey" slist => getindices("array") ; + "data" + data => parsejson( + '{ "key1" : { "list" : [ "a", "b", "c" ], "scalar" : "value1" }, + "key2" : { "list" : [ "x", "y", "z" ], "scalar" : "value2" } }' + ); + + "array[key1][list]" slist => { "a", "b", "c" }; + "array[key1][scalar]" string => "value1"; + "array[key2][list]" slist => { "x", "y", "z" }; + "array[key2][scalar]" string => "value2"; + "datakey" slist => getindices("data"); + "arraykey" slist => getindices("array"); methods: - "test_data" - usebundle => launcher_data("test.data[${datakey}][list]") ; - - "test_array" - usebundle => launcher_array("test.array[${arraykey}][list]") ; + "test_data" usebundle => launcher_data("test.data[${datakey}][list]"); + "test_array" usebundle => launcher_array("test.array[${arraykey}][list]"); - "test_executor_data" - usebundle => executor("@{test.data[${datakey}][list]}") ; + "test_executor_data" + usebundle => executor("@{test.data[${datakey}][list]}"); - "test_executor_array" - usebundle => executor("@{test.data[${arraykey}][list]}") ; + "test_executor_array" + usebundle => executor("@{test.data[${arraykey}][list]}"); } bundle agent check { methods: - "" usebundle => dcs_check_diff( $(G.testfile), - "$(this.promise_filename).expected", - $(this.promise_filename)); + "" + usebundle => dcs_check_diff( + $(G.testfile), + "$(this.promise_filename).expected", + $(this.promise_filename) + ); } bundle agent launcher_data(list_name) { vars: any:: - "expanded_list" slist => getvalues("${list_name}") ; - "callers" string => join(":", callstack_promisers()) ; + "expanded_list" slist => getvalues("${list_name}"); + "callers" string => join(":", callstack_promisers()); methods: any:: @@ -81,15 +79,15 @@ bundle agent launcher_data(list_name) # time we pass it a different list. "run_list" usebundle => executor(@{launcher_data.expanded_list}), - handle => "run_list_${list_name}" ; + handle => "run_list_${list_name}"; } bundle agent launcher_array(list_name) { vars: any:: - "expanded_list" slist => { "@{${list_name}}"} ; - "callers" string => join(":", callstack_promisers()) ; + "expanded_list" slist => { "@{${list_name}}" }; + "callers" string => join(":", callstack_promisers()); methods: any:: @@ -100,15 +98,14 @@ bundle agent launcher_array(list_name) # time we pass it a different list. "run_list" usebundle => executor(@{launcher_array.expanded_list}), - handle => "run_list_${list_name}" ; + handle => "run_list_${list_name}"; } bundle agent executor(list) { vars: - "callers" string => join(":", callstack_promisers()) ; + "callers" string => join(":", callstack_promisers()); reports: - "[${callers}:${this.bundle}] ${list}" - report_to_file => "$(G.testfile)"; + "[${callers}:${this.bundle}] ${list}" report_to_file => "$(G.testfile)"; } diff --git a/tests/acceptance/01_vars/04_containers/passing_containers.cf b/tests/acceptance/01_vars/04_containers/passing_containers.cf index 5bf954fc1b..2bd0680b82 100644 --- a/tests/acceptance/01_vars/04_containers/passing_containers.cf +++ b/tests/acceptance/01_vars/04_containers/passing_containers.cf @@ -3,20 +3,18 @@ # Test passing of datas with @(ref) notation # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert_lines; } @@ -24,21 +22,23 @@ bundle agent init bundle edit_line init_insert_lines { insert_lines: - '1'; - '2'; + '1'; + '2'; } ####################################################### - bundle agent test { vars: - "load" data => parsejson(' + "load" + data => parsejson( + ' { "first": 1, "seconds": 2, "third": [ "a", "b", "c" ], "fourth": null} -'); +' + ); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert(@(load)); } @@ -46,15 +46,17 @@ bundle agent test bundle edit_line test_insert(data) { insert_lines: - "$(data)"; + "$(data)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/04_containers/readjson.cf b/tests/acceptance/01_vars/04_containers/readjson.cf index 7716dd4bf9..a4a1998f31 100644 --- a/tests/acceptance/01_vars/04_containers/readjson.cf +++ b/tests/acceptance/01_vars/04_containers/readjson.cf @@ -3,24 +3,22 @@ # Test datas creation through readjson() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert_lines; - "$(G.testfile).json" + "$(G.testfile).json" create => "true", edit_line => init_insert_json; } @@ -28,25 +26,24 @@ bundle agent init bundle edit_line init_insert_json { insert_lines: - '[ "hello", "there" ]'; + '[ "hello", "there" ]'; } bundle edit_line init_insert_lines { insert_lines: - "hello"; - "there"; + "hello"; + "there"; } ####################################################### - bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024); + "load" data => readjson("$(G.testfile).json", 1024); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -54,15 +51,17 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(test.load)"; + "$(test.load)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/04_containers/readjson_arrays.cf b/tests/acceptance/01_vars/04_containers/readjson_arrays.cf index dedda67110..004676f31d 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_arrays.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_arrays.cf @@ -3,24 +3,22 @@ # Test nested datas iteration through readjson() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert_lines; - "$(G.testfile).json" + "$(G.testfile).json" create => "true", edit_line => init_insert_json; } @@ -28,28 +26,27 @@ bundle agent init bundle edit_line init_insert_json { insert_lines: - '[ 1, 2, 3, [ "a", "b", "c" ], "d", 5, null]'; + '[ 1, 2, 3, [ "a", "b", "c" ], "d", 5, null]'; } bundle edit_line init_insert_lines { insert_lines: - '1'; - '2'; - '3'; - 'd'; - '5'; + '1'; + '2'; + '3'; + 'd'; + '5'; } ####################################################### - bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024); + "load" data => readjson("$(G.testfile).json", 1024); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -57,15 +54,17 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(test.load)"; + "$(test.load)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/04_containers/readjson_new.cf b/tests/acceptance/01_vars/04_containers/readjson_new.cf index 3e92b0f048..6d453e4a67 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_new.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_new.cf @@ -3,24 +3,22 @@ # Test data creation through readjson() with just 1 arg # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert_lines; - "$(G.testfile).json" + "$(G.testfile).json" create => "true", edit_line => init_insert_json; } @@ -28,25 +26,24 @@ bundle agent init bundle edit_line init_insert_json { insert_lines: - '[ "hello", "there" ]'; + '[ "hello", "there" ]'; } bundle edit_line init_insert_lines { insert_lines: - "hello"; - "there"; + "hello"; + "there"; } ####################################################### - bundle agent test { vars: - "load" data => readjson("$(G.testfile).json"); + "load" data => readjson("$(G.testfile).json"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -54,15 +51,17 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(test.load)"; + "$(test.load)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/04_containers/readjson_null.cf b/tests/acceptance/01_vars/04_containers/readjson_null.cf index 18af1645bb..fed055cb2e 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_null.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_null.cf @@ -3,24 +3,22 @@ # Test datas creation from a null through readjson() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert_lines; - "$(G.testfile).json" + "$(G.testfile).json" create => "true", edit_line => init_insert_json; } @@ -28,24 +26,23 @@ bundle agent init bundle edit_line init_insert_json { insert_lines: - 'null'; + 'null'; } bundle edit_line init_insert_lines { insert_lines: - "$(const.dollar)(test.load)"; + "$(const.dollar)(test.load)"; } ####################################################### - bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024); + "load" data => readjson("$(G.testfile).json", 1024); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -53,15 +50,17 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(test.load)"; + "$(test.load)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/04_containers/readjson_objects.cf b/tests/acceptance/01_vars/04_containers/readjson_objects.cf index 26a67733dc..137670afd0 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_objects.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_objects.cf @@ -3,24 +3,22 @@ # Test nested datas iteration through readjson() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert_lines; - "$(G.testfile).json" + "$(G.testfile).json" create => "true", edit_line => init_insert_json; } @@ -28,25 +26,24 @@ bundle agent init bundle edit_line init_insert_json { insert_lines: - '{ "first": 1, "seconds": 2, "third": [ "a", "b", "c" ], "fourth": null}'; + '{ "first": 1, "seconds": 2, "third": [ "a", "b", "c" ], "fourth": null}'; } bundle edit_line init_insert_lines { insert_lines: - '1'; - '2'; + '1'; + '2'; } ####################################################### - bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024); + "load" data => readjson("$(G.testfile).json", 1024); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -54,15 +51,17 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(test.load)"; + "$(test.load)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/04_containers/readjson_scalar.cf b/tests/acceptance/01_vars/04_containers/readjson_scalar.cf index 94270374cd..f1fe8bc917 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_scalar.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_scalar.cf @@ -3,24 +3,22 @@ # Test datas creation from a scalar through readjson() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert_lines; - "$(G.testfile).json" + "$(G.testfile).json" create => "true", edit_line => init_insert_json; } @@ -28,24 +26,23 @@ bundle agent init bundle edit_line init_insert_json { insert_lines: - '123456'; + '123456'; } bundle edit_line init_insert_lines { insert_lines: - "$(const.dollar)(test.load)"; + "$(const.dollar)(test.load)"; } ####################################################### - bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024); + "load" data => readjson("$(G.testfile).json", 1024); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -53,15 +50,17 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(test.load)"; + "$(test.load)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/04_containers/readjson_subindex.cf b/tests/acceptance/01_vars/04_containers/readjson_subindex.cf index 8060187cc4..7cbdf379d2 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_subindex.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_subindex.cf @@ -3,24 +3,22 @@ # Test subreferencing of datas loaded through readjson() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert_lines; - "$(G.testfile).json" + "$(G.testfile).json" create => "true", edit_line => init_insert_json; } @@ -28,26 +26,25 @@ bundle agent init bundle edit_line init_insert_json { insert_lines: - '{ "first": 1, "seconds": 2, "third": [ "a", "b", "c" ], "fourth": null}'; + '{ "first": 1, "seconds": 2, "third": [ "a", "b", "c" ], "fourth": null}'; } bundle edit_line init_insert_lines { insert_lines: - 'a'; - 'b'; - 'c'; + 'a'; + 'b'; + 'c'; } ####################################################### - bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024); + "load" data => readjson("$(G.testfile).json", 1024); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -55,15 +52,17 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(test.load[third])"; + "$(test.load[third])"; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/04_containers/readjson_subindex_quoted.cf b/tests/acceptance/01_vars/04_containers/readjson_subindex_quoted.cf index 9eb569bc96..39e203f37d 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_subindex_quoted.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_subindex_quoted.cf @@ -3,24 +3,22 @@ # Test subreferencing with quoted keys of datas loaded through readjson() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert_lines; - "$(G.testfile).json" + "$(G.testfile).json" create => "true", edit_line => init_insert_json; } @@ -28,26 +26,25 @@ bundle agent init bundle edit_line init_insert_json { insert_lines: - '{ "first": 1, "seconds": 2, "third key! can? almost be anything& but no dollar or bracket yet": [ "a", "b", "c" ]}'; + '{ "first": 1, "seconds": 2, "third key! can? almost be anything& but no dollar or bracket yet": [ "a", "b", "c" ]}'; } bundle edit_line init_insert_lines { insert_lines: - 'a'; - 'b'; - 'c'; + 'a'; + 'b'; + 'c'; } ####################################################### - bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024); + "load" data => readjson("$(G.testfile).json", 1024); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -55,15 +52,17 @@ bundle agent test bundle edit_line test_insert { insert_lines: - '$(test.load[third key! can? almost be anything& but no dollar or bracket yet])'; + '$(test.load[third key! can? almost be anything& but no dollar or bracket yet])'; } ####################################################### - bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/04_containers/readyaml.cf b/tests/acceptance/01_vars/04_containers/readyaml.cf index a63e5d8cc3..97a34f4618 100644 --- a/tests/acceptance/01_vars/04_containers/readyaml.cf +++ b/tests/acceptance/01_vars/04_containers/readyaml.cf @@ -3,34 +3,35 @@ # Test datas creation through readyaml() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle common yaml_check { classes: - "no_yaml_support" - not => regline(" *# *define *HAVE_LIBYAML.*", "$(this.promise_dirname)/../../../../libutils/config.h"); + "no_yaml_support" + not => regline( + " *# *define *HAVE_LIBYAML.*", + "$(this.promise_dirname)/../../../../libutils/config.h" + ); } bundle agent init { meta: - "test_skip_unsupported" string => "no_yaml_support"; + "test_skip_unsupported" string => "no_yaml_support"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert_lines; - "$(G.testfile).yaml" + "$(G.testfile).yaml" create => "true", edit_line => init_insert_yaml; } @@ -38,7 +39,7 @@ bundle agent init bundle edit_line init_insert_yaml { insert_lines: - "- hello + "- hello - there - where: 1 - where_else: 1.0023E2 @@ -51,7 +52,7 @@ bundle edit_line init_insert_yaml bundle edit_line init_insert_lines { insert_lines: - '[ + '[ "hello", "there", { @@ -70,15 +71,14 @@ bundle edit_line init_insert_lines } ####################################################### - bundle agent test { vars: - "load" data => readyaml("$(G.testfile).yaml", 1024); - "load_s" string => storejson(load); + "load" data => readyaml("$(G.testfile).yaml", 1024); + "load_s" string => storejson(load); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -86,15 +86,17 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(test.load_s)"; + "$(test.load_s)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/04_containers/readyaml_new.cf b/tests/acceptance/01_vars/04_containers/readyaml_new.cf index 6d5746b94d..7443a54240 100644 --- a/tests/acceptance/01_vars/04_containers/readyaml_new.cf +++ b/tests/acceptance/01_vars/04_containers/readyaml_new.cf @@ -3,34 +3,35 @@ # Test data creation through readyaml() with just 1 arg # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle common yaml_check { classes: - "no_yaml_support" - not => regline(" *# *define *HAVE_LIBYAML.*", "$(this.promise_dirname)/../../../../libutils/config.h"); + "no_yaml_support" + not => regline( + " *# *define *HAVE_LIBYAML.*", + "$(this.promise_dirname)/../../../../libutils/config.h" + ); } bundle agent init { meta: - "test_skip_unsupported" string => "no_yaml_support"; + "test_skip_unsupported" string => "no_yaml_support"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert_lines; - "$(G.testfile).yaml" + "$(G.testfile).yaml" create => "true", edit_line => init_insert_yaml; } @@ -38,7 +39,7 @@ bundle agent init bundle edit_line init_insert_yaml { insert_lines: - "- hello + "- hello - there - where: 1 - where_else: 1.0023E2 @@ -51,7 +52,7 @@ bundle edit_line init_insert_yaml bundle edit_line init_insert_lines { insert_lines: - '[ + '[ "hello", "there", { @@ -70,15 +71,14 @@ bundle edit_line init_insert_lines } ####################################################### - bundle agent test { vars: - "load" data => readyaml("$(G.testfile).yaml"); - "load_s" string => storejson(load); + "load" data => readyaml("$(G.testfile).yaml"); + "load_s" string => storejson(load); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -86,15 +86,17 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(test.load_s)"; + "$(test.load_s)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/01_vars/04_containers/test_json_with_and_without_nulls.cf b/tests/acceptance/01_vars/04_containers/test_json_with_and_without_nulls.cf index e41abaee5b..9bba7e1603 100644 --- a/tests/acceptance/01_vars/04_containers/test_json_with_and_without_nulls.cf +++ b/tests/acceptance/01_vars/04_containers/test_json_with_and_without_nulls.cf @@ -1,15 +1,14 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } bundle agent test @@ -24,26 +23,27 @@ bundle agent test meta => { "redmine7821" }; methods: - "ec2" - comment => "We activate the bundle so that we can grab its state"; + "ec2" comment => "We activate the bundle so that we can grab its state"; } bundle agent check { methods: - "check" - usebundle => dcs_check_state("ec2", - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + "ec2", + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } + bundle agent ec2 { vars: - - # This data has nulls in it, and consists of a single data type for - # values (strings) - "data" - data => '{ + # This data has nulls in it, and consists of a single data type for + # values (strings) + "data" + data => '{ "instanceId" : "i-f444554e", "billingProducts" : null, "instanceType" : "m3.large", @@ -60,14 +60,13 @@ bundle agent ec2 "devpayProductCodes" : null }'; - "keys" slist => getindices("data"); - "data_$(keys)" string => "$(data[$(keys)])"; - + "keys" slist => getindices("data"); + "data_$(keys)" string => "$(data[$(keys)])"; - # This data has no nulls in it and consists of a single type for values - # (strings) - "data2" - data => '{ + # This data has no nulls in it and consists of a single type for values + # (strings) + "data2" + data => '{ "instanceId" : "i-f444554e", "instanceType" : "m3.large", "accountId" : "444444444444", @@ -81,32 +80,32 @@ bundle agent ec2 "privateIp" : "10.44.44.4", }'; - "keys2" slist => getindices("data2"); - "data2_$(keys2)" string => "$(data2[$(keys2)])"; + "keys2" slist => getindices("data2"); + "data2_$(keys2)" string => "$(data2[$(keys2)])"; - - # The values in this data contain nulls and are of mixed types - # (strings, lists) - "data3" - data => '{ + # The values in this data contain nulls and are of mixed types + # (strings, lists) + "data3" + data => '{ "a": [], "b": ["one", "two"], "c": null, "d": "should be here" }'; - "keys3" slist => getindices("data3"); - # I expect that data3_a will not be defined - # - because the list is empty and there is nothing to iterate over - # - potentially it would make sense to be cf_null (thats what - # iterating over empty slist does) or null - # I expect that data3_b will contain 'two' - # - because the list will be iterated over and two is the last - # element. - # I expect data3_c to not be defined - # - potentially cf_null or null would make sense as with data3_a - # I expect data3_d to be 'should be here' - "data3_$(keys3)" string => "$(data3[$(keys3)])"; + "keys3" slist => getindices("data3"); + + # I expect that data3_a will not be defined + # - because the list is empty and there is nothing to iterate over + # - potentially it would make sense to be cf_null (thats what + # iterating over empty slist does) or null + # I expect that data3_b will contain 'two' + # - because the list will be iterated over and two is the last + # element. + # I expect data3_c to not be defined + # - potentially cf_null or null would make sense as with data3_a + # I expect data3_d to be 'should be here' + "data3_$(keys3)" string => "$(data3[$(keys3)])"; reports: DEBUG:: diff --git a/tests/acceptance/01_vars/05_defaults/basics.cf b/tests/acceptance/01_vars/05_defaults/basics.cf index a4ab835f93..5a58bf2baf 100644 --- a/tests/acceptance/01_vars/05_defaults/basics.cf +++ b/tests/acceptance/01_vars/05_defaults/basics.cf @@ -1,58 +1,70 @@ body common control { -bundlesequence => { "main" }; + bundlesequence => { "main" }; } bundle agent main { methods: - "example" usebundle => class_default, - useresult => "value"; - "example" usebundle => no_class_default, - useresult => "value"; + "example" + usebundle => class_default, + useresult => "value"; + + "example" + usebundle => no_class_default, + useresult => "value"; classes: "fail1" expression => strcmp("$(value[1])", "one"); "fail2" expression => strcmp("$(value[2])", "two"); "fail" or => { "fail1", "fail2" }; - "ok" and => { strcmp("$(value[1])", "default"), strcmp("$(value[2])", "default") }; + + "ok" + and => { + strcmp("$(value[1])", "default"), strcmp("$(value[2])", "default") + }; reports: fail1.!ok:: "value 1: $(value[1])"; + fail2.!ok:: "value 2: $(value[2])"; !fail.ok:: "$(this.promise_filename) Pass"; + fail.!ok:: "$(this.promise_filename) FAIL"; } bundle agent class_default { - vars: - "a" string => "one"; + vars: + "a" string => "one"; - defaults: - "a" string => "default", if_match_regex => "one"; + defaults: + "a" + string => "default", + if_match_regex => "one"; - classes: - "test" expression => "any"; + classes: + "test" expression => "any"; - reports: - "${a}" bundle_return_value_index => "1"; + reports: + "${a}" bundle_return_value_index => "1"; } bundle agent no_class_default { - vars: - "b" string => "two"; + vars: + "b" string => "two"; - defaults: - "b" string => "default", if_match_regex => "two"; + defaults: + "b" + string => "default", + if_match_regex => "two"; - reports: - "${b}" bundle_return_value_index => "2"; + reports: + "${b}" bundle_return_value_index => "2"; } - diff --git a/tests/acceptance/01_vars/deep_delayed_expansion/def.json b/tests/acceptance/01_vars/deep_delayed_expansion/def.json index cdb7cff99e..fa2d229388 100644 --- a/tests/acceptance/01_vars/deep_delayed_expansion/def.json +++ b/tests/acceptance/01_vars/deep_delayed_expansion/def.json @@ -1,6 +1,4 @@ { - "vars": { - "policy_root": "$(this.promise_dirname)" - }, - "inputs": ["my_globals.cf.sub"] + "vars": { "policy_root": "$(this.promise_dirname)" }, + "inputs": ["my_globals.cf.sub"] } diff --git a/tests/acceptance/01_vars/deep_delayed_expansion/main.cf b/tests/acceptance/01_vars/deep_delayed_expansion/main.cf index 94d945d470..3f4842e257 100644 --- a/tests/acceptance/01_vars/deep_delayed_expansion/main.cf +++ b/tests/acceptance/01_vars/deep_delayed_expansion/main.cf @@ -7,8 +7,11 @@ body common control bundle agent test { meta: - "description" string => "Test that variables containing other variales are de-referenced"; - "test_soft_fail" string => "windows", + "description" + string => "Test that variables containing other variales are de-referenced"; + + "test_soft_fail" + string => "windows", meta => { "ENT-10256" }; } @@ -16,12 +19,12 @@ bundle agent check { reports: "$(this.promise_filename) Pass" - if => strcmp( $(this.promise_dirname), $(my_globals.policy_root) ); + if => strcmp($(this.promise_dirname), $(my_globals.policy_root)); "$(this.promise_filename) FAIL" - unless => strcmp( $(this.promise_dirname), $(my_globals.policy_root) ); + unless => strcmp($(this.promise_dirname), $(my_globals.policy_root)); - EXTRA:: - "my_globals.policy_root = $(my_globals.policy_root)"; - "def.policy_root = $(def.policy_root)"; + EXTRA:: + "my_globals.policy_root = $(my_globals.policy_root)"; + "def.policy_root = $(def.policy_root)"; } diff --git a/tests/acceptance/02_classes/01_basic/001.cf b/tests/acceptance/02_classes/01_basic/001.cf index e0d9dcbd7a..4999682979 100644 --- a/tests/acceptance/02_classes/01_basic/001.cf +++ b/tests/acceptance/02_classes/01_basic/001.cf @@ -3,40 +3,37 @@ # Test not # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" not => "class_never_defined"; + "ok" not => "class_never_defined"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/002.cf b/tests/acceptance/02_classes/01_basic/002.cf index 4e81750e8d..077f765b3b 100644 --- a/tests/acceptance/02_classes/01_basic/002.cf +++ b/tests/acceptance/02_classes/01_basic/002.cf @@ -3,41 +3,38 @@ # Test not # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "not_ok" not => "any"; - "ok" not => "not_ok"; + "not_ok" not => "any"; + "ok" not => "not_ok"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/003.cf b/tests/acceptance/02_classes/01_basic/003.cf index 647ea6f929..56c3cc4825 100644 --- a/tests/acceptance/02_classes/01_basic/003.cf +++ b/tests/acceptance/02_classes/01_basic/003.cf @@ -3,42 +3,37 @@ # Test and # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" and => { - "cfengine_3" - }; + "ok" and => { "cfengine_3" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/004.cf b/tests/acceptance/02_classes/01_basic/004.cf index 7797aee8c8..58bcb13e29 100644 --- a/tests/acceptance/02_classes/01_basic/004.cf +++ b/tests/acceptance/02_classes/01_basic/004.cf @@ -3,43 +3,37 @@ # Test and # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" and => { - "any", - "cfengine_3" - }; + "ok" and => { "any", "cfengine_3" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/005.cf b/tests/acceptance/02_classes/01_basic/005.cf index b8a8f6404c..751dc7cf76 100644 --- a/tests/acceptance/02_classes/01_basic/005.cf +++ b/tests/acceptance/02_classes/01_basic/005.cf @@ -3,45 +3,38 @@ # Test and # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "not_ok" and => { - "any", - "cfengine_3", - "this_was_not_defined" - }; - "ok" not => "ok"; + "not_ok" and => { "any", "cfengine_3", "this_was_not_defined" }; + "ok" not => "ok"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/006.cf b/tests/acceptance/02_classes/01_basic/006.cf index db3d51ec56..55bd0be04c 100644 --- a/tests/acceptance/02_classes/01_basic/006.cf +++ b/tests/acceptance/02_classes/01_basic/006.cf @@ -3,43 +3,38 @@ # Test and # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "not_ok" and => { - "this_was_not_defined" - }; - "ok" not => "ok"; + "not_ok" and => { "this_was_not_defined" }; + "ok" not => "ok"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/007.cf b/tests/acceptance/02_classes/01_basic/007.cf index 05b4a378bb..2662f590e0 100644 --- a/tests/acceptance/02_classes/01_basic/007.cf +++ b/tests/acceptance/02_classes/01_basic/007.cf @@ -3,43 +3,38 @@ # Test or # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "not_ok" or => { - "this_was_not_defined" - }; - "ok" not => "ok"; + "not_ok" or => { "this_was_not_defined" }; + "ok" not => "ok"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/008.cf b/tests/acceptance/02_classes/01_basic/008.cf index da1fd77986..1b20fa53f6 100644 --- a/tests/acceptance/02_classes/01_basic/008.cf +++ b/tests/acceptance/02_classes/01_basic/008.cf @@ -3,44 +3,38 @@ # Test or # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "not_ok" or => { - "this_was_not_defined", - "neither_was_this", - }; - "ok" not => "ok"; + "not_ok" or => { "this_was_not_defined", "neither_was_this" }; + "ok" not => "ok"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/009.cf b/tests/acceptance/02_classes/01_basic/009.cf index 6fa27637d3..86cb46084d 100644 --- a/tests/acceptance/02_classes/01_basic/009.cf +++ b/tests/acceptance/02_classes/01_basic/009.cf @@ -3,44 +3,37 @@ # Test or # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" or => { - "this_was_not_defined", - "cfengine_3", - "neither_was_this", - }; + "ok" or => { "this_was_not_defined", "cfengine_3", "neither_was_this" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/010.cf b/tests/acceptance/02_classes/01_basic/010.cf index a949c98ea4..efbcf4740c 100644 --- a/tests/acceptance/02_classes/01_basic/010.cf +++ b/tests/acceptance/02_classes/01_basic/010.cf @@ -3,43 +3,37 @@ # Test or # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" or => { - "cfengine_3", - "any", - }; + "ok" or => { "cfengine_3", "any" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/011.cf b/tests/acceptance/02_classes/01_basic/011.cf index 01c7a2d7ce..4023240985 100644 --- a/tests/acceptance/02_classes/01_basic/011.cf +++ b/tests/acceptance/02_classes/01_basic/011.cf @@ -3,44 +3,38 @@ # Test xor # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "not_ok" xor => { - "cfengine_3", - "any", - }; - "ok" not => "not_ok"; + "not_ok" xor => { "cfengine_3", "any" }; + "ok" not => "not_ok"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/012.cf b/tests/acceptance/02_classes/01_basic/012.cf index 089cf7f1a2..bd5764d246 100644 --- a/tests/acceptance/02_classes/01_basic/012.cf +++ b/tests/acceptance/02_classes/01_basic/012.cf @@ -3,44 +3,38 @@ # Test xor # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "not_ok" xor => { - "this_was_not_defined", - "neither_was_this", - }; - "ok" not => "not_ok"; + "not_ok" xor => { "this_was_not_defined", "neither_was_this" }; + "ok" not => "not_ok"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/013.cf b/tests/acceptance/02_classes/01_basic/013.cf index 48ecd7ba7e..8f00d10ecf 100644 --- a/tests/acceptance/02_classes/01_basic/013.cf +++ b/tests/acceptance/02_classes/01_basic/013.cf @@ -3,43 +3,37 @@ # Test xor # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" xor => { - "cfengine_3", - "this_was_not_defined", - }; + "ok" xor => { "cfengine_3", "this_was_not_defined" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/014.cf b/tests/acceptance/02_classes/01_basic/014.cf index 69a242f0e6..b0b2c8f55d 100644 --- a/tests/acceptance/02_classes/01_basic/014.cf +++ b/tests/acceptance/02_classes/01_basic/014.cf @@ -3,43 +3,37 @@ # Test xor # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" xor => { - "cfengine_3", - "!any", - }; + "ok" xor => { "cfengine_3", "!any" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/015.cf b/tests/acceptance/02_classes/01_basic/015.cf index acf5a57247..af1299419d 100644 --- a/tests/acceptance/02_classes/01_basic/015.cf +++ b/tests/acceptance/02_classes/01_basic/015.cf @@ -3,44 +3,37 @@ # Test xor # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" xor => { - "!any", - "!any", - "any", - }; + "ok" xor => { "!any", "!any", "any" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/016.cf b/tests/acceptance/02_classes/01_basic/016.cf index 67b26604d4..cd47cdb55a 100644 --- a/tests/acceptance/02_classes/01_basic/016.cf +++ b/tests/acceptance/02_classes/01_basic/016.cf @@ -3,44 +3,37 @@ # Test xor # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" xor => { - "any", - "any", - "any", - }; + "ok" xor => { "any", "any", "any" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/017.cf b/tests/acceptance/02_classes/01_basic/017.cf index a390fa991a..8b1d90655f 100644 --- a/tests/acceptance/02_classes/01_basic/017.cf +++ b/tests/acceptance/02_classes/01_basic/017.cf @@ -3,44 +3,40 @@ # Test brackets on "and" (Issue 234) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" and => { userexists("root") }; - + "ok" and => { userexists("root") }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/018.cf b/tests/acceptance/02_classes/01_basic/018.cf index a00e4d599e..6ace2c4c9f 100644 --- a/tests/acceptance/02_classes/01_basic/018.cf +++ b/tests/acceptance/02_classes/01_basic/018.cf @@ -3,44 +3,40 @@ # Test brackets on "or" (Issue 234) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" or => { userexists("root") }; - + "ok" or => { userexists("root") }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/019.cf b/tests/acceptance/02_classes/01_basic/019.cf index 3ec93bc520..9e14548d9a 100644 --- a/tests/acceptance/02_classes/01_basic/019.cf +++ b/tests/acceptance/02_classes/01_basic/019.cf @@ -3,43 +3,40 @@ # Test brackets on "xor" (Issue 234) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" xor => { userexists("root") }; + "ok" xor => { userexists("root") }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/023.cf b/tests/acceptance/02_classes/01_basic/023.cf index 570b6c5edc..79fde65750 100644 --- a/tests/acceptance/02_classes/01_basic/023.cf +++ b/tests/acceptance/02_classes/01_basic/023.cf @@ -3,39 +3,35 @@ # Test complex expression (issue 487) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "class1" expression => "any"; - "class2" expression => "any"; - "class3" expression => "any"; - "class4" expression => "any"; + "class1" expression => "any"; + "class2" expression => "any"; + "class3" expression => "any"; + "class4" expression => "any"; class1.(class2|(class3.class4)):: "ok" expression => "any"; @@ -43,6 +39,7 @@ bundle agent check reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/024.cf b/tests/acceptance/02_classes/01_basic/024.cf index 096b81e560..ce99a74688 100644 --- a/tests/acceptance/02_classes/01_basic/024.cf +++ b/tests/acceptance/02_classes/01_basic/024.cf @@ -3,39 +3,35 @@ # Test complex expression (issue 487) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "class1" expression => "any"; - "class2" expression => "any"; - "class3" expression => "any"; - "class4" expression => "any"; + "class1" expression => "any"; + "class2" expression => "any"; + "class3" expression => "any"; + "class4" expression => "any"; class1.(class2|class3.class4):: "ok" expression => "any"; @@ -43,6 +39,7 @@ bundle agent check reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/025.cf b/tests/acceptance/02_classes/01_basic/025.cf index b1a7b5569d..01fa1c021f 100644 --- a/tests/acceptance/02_classes/01_basic/025.cf +++ b/tests/acceptance/02_classes/01_basic/025.cf @@ -3,50 +3,48 @@ # Check if with array # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { classes: - "classtotest" expression => "any"; + "classtotest" expression => "any"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "foobar[0]" string => "classtotest"; + "foobar[0]" string => "classtotest"; classes: - "ok" expression => "any", + "ok" + expression => "any", if => "$(foobar[0])"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/026.cf b/tests/acceptance/02_classes/01_basic/026.cf index 1c062f64f6..0481981e6c 100644 --- a/tests/acceptance/02_classes/01_basic/026.cf +++ b/tests/acceptance/02_classes/01_basic/026.cf @@ -3,47 +3,45 @@ # Check if with qualified variable # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { classes: - "classtotest" expression => "any"; + "classtotest" expression => "any"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "foobar" string => "classtotest"; + "foobar" string => "classtotest"; } ####################################################### - bundle agent check { classes: - "ok" expression => "any", + "ok" + expression => "any", if => "$(test.foobar)"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/027.cf b/tests/acceptance/02_classes/01_basic/027.cf index 279eb96ce9..30f199207a 100644 --- a/tests/acceptance/02_classes/01_basic/027.cf +++ b/tests/acceptance/02_classes/01_basic/027.cf @@ -3,41 +3,37 @@ # Check canonification in if # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { commands: - "$(G.true)" - classes => if_repaired("/test"); + "$(G.true)" classes => if_repaired("/test"); } ####################################################### - bundle agent check { classes: - "ok" expression => "_test"; + "ok" expression => "_test"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/028.cf b/tests/acceptance/02_classes/01_basic/028.cf index dc05c0f826..d954abbebf 100644 --- a/tests/acceptance/02_classes/01_basic/028.cf +++ b/tests/acceptance/02_classes/01_basic/028.cf @@ -3,42 +3,40 @@ # Check that we can use || in class expressions # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - any||something:: "oklhs" expression => "any"; + something||any:: "okrhs" expression => "any"; + any||any:: "okboth" expression => "any"; + something||something:: "okno" expression => "any"; @@ -48,6 +46,7 @@ bundle agent check reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/030.cf b/tests/acceptance/02_classes/01_basic/030.cf index 814adfe97b..62adf6af08 100644 --- a/tests/acceptance/02_classes/01_basic/030.cf +++ b/tests/acceptance/02_classes/01_basic/030.cf @@ -1,34 +1,32 @@ body common control { - inputs => { "../../default.sub.cf", "030.cf.namespaced.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "030.cf.namespaced.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; + methods: - "call" usebundle => test_namespace:classchecker; + "call" usebundle => test_namespace:classchecker; } ####################################################### - bundle agent check { classes: - "ok1" expression => strcmp("$(test_namespace:classchecker.var1)", "data1"); + "ok1" expression => strcmp("$(test_namespace:classchecker.var1)", "data1"); any:: "ok" and => { "ok1" }; @@ -36,8 +34,10 @@ bundle agent check reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + DEBUG:: "Expected data1, got $(test_namespace:classchecker.var1)"; } diff --git a/tests/acceptance/02_classes/01_basic/031.cf b/tests/acceptance/02_classes/01_basic/031.cf index 258a75c37e..c12bc55249 100644 --- a/tests/acceptance/02_classes/01_basic/031.cf +++ b/tests/acceptance/02_classes/01_basic/031.cf @@ -1,41 +1,38 @@ body common control { - inputs => { "../../default.sub.cf", "031.cf.namespaced.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "031.cf.namespaced.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle common globalclasses { classes: - "GLOBALCLASS" expression => "any"; + "GLOBALCLASS" expression => "any"; } bundle agent test { methods: - "globals" usebundle => globalclasses; - "call" usebundle => test_namespace:classchecker; + "globals" usebundle => globalclasses; + "call" usebundle => test_namespace:classchecker; } ####################################################### - bundle agent check { classes: - "ok1" expression => strcmp("$(test_namespace:classchecker.var1)", "data1"); - "ok2" expression => strcmp("$(test_namespace:classchecker.var2)", "data2"); - "ok3" expression => strcmp("$(test_namespace:classchecker.var3)", "data3"); + "ok1" expression => strcmp("$(test_namespace:classchecker.var1)", "data1"); + "ok2" expression => strcmp("$(test_namespace:classchecker.var2)", "data2"); + "ok3" expression => strcmp("$(test_namespace:classchecker.var3)", "data3"); any:: "ok" and => { "ok1", "ok2", "ok3" }; @@ -43,12 +40,16 @@ bundle agent check reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + !ok1||DEBUG:: "Expected data1, got $(test_namespace:classchecker.var1)"; + !ok2||DEBUG:: "Expected data2, got $(test_namespace:classchecker.var2)"; + !ok3||DEBUG:: "Expected data3, got $(test_namespace:classchecker.var3)"; } diff --git a/tests/acceptance/02_classes/01_basic/032.cf b/tests/acceptance/02_classes/01_basic/032.cf index 27b007a30a..3673d8b68f 100644 --- a/tests/acceptance/02_classes/01_basic/032.cf +++ b/tests/acceptance/02_classes/01_basic/032.cf @@ -1,54 +1,51 @@ -# # Test whether classes defined by promises end up in right namespace -# - body common control { - inputs => { "../../default.sub.cf", "031.cf.namespaced.sub", "032.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "031.cf.namespaced.sub", "032.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { methods: - "call" usebundle => xxx:localclass; + "call" usebundle => xxx:localclass; reports: - cfengine:: "testing class 1" - classes => xxx:always("another_class_global_from_command"); - + classes => xxx:always("another_class_global_from_command"); } ####################################################### - bundle agent check { classes: - "ok" and => { "xxx:a_class_global_from_command", "default:another_class_global_from_command" }; + "ok" + and => { + "xxx:a_class_global_from_command", + "default:another_class_global_from_command", + }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + DEBUG:: "xxx:a_class_global_from_command is set" - if => "xxx:a_class_global_from_command"; + if => "xxx:a_class_global_from_command"; DEBUG.another_class_global_from_command:: "another_class_global_from_command is set"; - } diff --git a/tests/acceptance/02_classes/01_basic/040.cf b/tests/acceptance/02_classes/01_basic/040.cf index 0a6111623c..c9d0c4120e 100644 --- a/tests/acceptance/02_classes/01_basic/040.cf +++ b/tests/acceptance/02_classes/01_basic/040.cf @@ -3,47 +3,41 @@ # Check that countclassesmatching() works # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - - "num" int => countclassesmatching("any"); + "num" int => countclassesmatching("any"); classes: - - # One and only one match - - "ok" and => { isgreaterthan("$(num)", "0"), islessthan("$(num)", "2") }; + # One and only one match + "ok" and => { isgreaterthan("$(num)", "0"), islessthan("$(num)", "2") }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/041.cf b/tests/acceptance/02_classes/01_basic/041.cf index b99e738c17..a4f7ea3203 100644 --- a/tests/acceptance/02_classes/01_basic/041.cf +++ b/tests/acceptance/02_classes/01_basic/041.cf @@ -3,53 +3,48 @@ # Check that weekday classes make sense # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - - # Only one of these should be set at a time - - "num" int => countclassesmatching("(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday)"); + # Only one of these should be set at a time + "num" + int => countclassesmatching( + "(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday)" + ); classes: - - # One and only one match - - "ok" and => { isgreaterthan("$(num)", "0"), islessthan("$(num)", "2") }; + # One and only one match + "ok" and => { isgreaterthan("$(num)", "0"), islessthan("$(num)", "2") }; reports: - cfengine:: "Found val $(num) matches when there should be 1"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/042.cf b/tests/acceptance/02_classes/01_basic/042.cf index 5bd7a55e89..184d91fe2b 100644 --- a/tests/acceptance/02_classes/01_basic/042.cf +++ b/tests/acceptance/02_classes/01_basic/042.cf @@ -3,45 +3,40 @@ # Check that weekday classes make sense # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - - # Only one of these should be set at a time - - "num" int => countclassesmatching("(Min00_05|Min05_10|Min10_15|Min15_20|Min20_25|Min25_30|Min30_35|Min35_40|Min40_45|Min45_50|Min50_55|Min55_00)"); + # Only one of these should be set at a time + "num" + int => countclassesmatching( + "(Min00_05|Min05_10|Min10_15|Min15_20|Min20_25|Min25_30|Min30_35|Min35_40|Min40_45|Min45_50|Min50_55|Min55_00)" + ); classes: - - # One and only one match - - "ok" and => { isgreaterthan("$(num)", "0"), islessthan("$(num)", "2") }; + # One and only one match + "ok" and => { isgreaterthan("$(num)", "0"), islessthan("$(num)", "2") }; reports: cfengine:: @@ -49,6 +44,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/109.cf b/tests/acceptance/02_classes/01_basic/109.cf index fd1dea0a44..f7a4fac636 100644 --- a/tests/acceptance/02_classes/01_basic/109.cf +++ b/tests/acceptance/02_classes/01_basic/109.cf @@ -1,41 +1,42 @@ # Test that classes in common bundles can be passed across bundles and namespaces - body common control { - inputs => { "../../default.sub.cf", "109.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "109.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle common shared { classes: - "shared_class" expression => "any"; + "shared_class" expression => "any"; } bundle agent test { methods: - "shared" usebundle => shared; - "namespaced" usebundle => ns109:pass(); + "shared" usebundle => shared; + "namespaced" usebundle => ns109:pass(); } bundle agent check { classes: - "ok" expression => strcmp("works", "$(ns109:pass.shared_dependent)"); + "ok" expression => strcmp("works", "$(ns109:pass.shared_dependent)"); reports: DEBUG:: "The class expression in ns109:pass() was $(ns109:pass.class_needed)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/action_policy_warn_sets_classes.cf b/tests/acceptance/02_classes/01_basic/action_policy_warn_sets_classes.cf index fe16ae6579..661faddd7c 100644 --- a/tests/acceptance/02_classes/01_basic/action_policy_warn_sets_classes.cf +++ b/tests/acceptance/02_classes/01_basic/action_policy_warn_sets_classes.cf @@ -3,72 +3,70 @@ # Test not # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { - files: - "/tmp/dont_create_me" - create => 'true', - classes => classes_generic( "test_files" ), - action => warnonly; + files: + "/tmp/dont_create_me" + create => 'true', + classes => classes_generic("test_files"), + action => warnonly; - commands: - "$(G.echo) 'dont_print_me'" - classes => classes_generic( "test_commands" ), - action => warnonly; + commands: + "$(G.echo) 'dont_print_me'" + classes => classes_generic("test_commands"), + action => warnonly; - processes: - "cf-agent-x" - restart_class => "restart_cf_agent", - classes => classes_generic( "test_processes" ), - action => warnonly; + processes: + "cf-agent-x" + restart_class => "restart_cf_agent", + classes => classes_generic("test_processes"), + action => warnonly; reports: - "Test output" - classes => classes_generic("test_reports"), - action => warnonly; + "Test output" + classes => classes_generic("test_reports"), + action => warnonly; } body action warnonly { - action_policy => "warn"; + action_policy => "warn"; } ####################################################### - bundle agent check { - vars: - "classes" slist => classesmatching( "test_.*" ); + vars: + "classes" slist => classesmatching("test_.*"); - classes: - "ok" and => { - "test_files_not_kept", - "test_commands_not_kept", - "test_processes_not_kept", - "test_reports_not_kept" + classes: + "ok" + and => { + "test_files_not_kept", + "test_commands_not_kept", + "test_processes_not_kept", + "test_reports_not_kept", }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; diff --git a/tests/acceptance/02_classes/01_basic/agent_class_scope.cf b/tests/acceptance/02_classes/01_basic/agent_class_scope.cf index d51277f425..e810db494f 100644 --- a/tests/acceptance/02_classes/01_basic/agent_class_scope.cf +++ b/tests/acceptance/02_classes/01_basic/agent_class_scope.cf @@ -4,31 +4,41 @@ # from agent bundles # ####################################################### - -body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; +body common control +{ + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -bundle agent init { +bundle agent init +{ vars: - "classes" slist => { "global_c", "local_c", "unglobal_c", "unlocal_c" }; + "classes" slist => { "global_c", "local_c", "unglobal_c", "unlocal_c" }; } -bundle agent test { +bundle agent test +{ classes: - "global_c" expression => "any", scope => "namespace"; - "unglobal_c" expression => "!any", scope => "namespace"; - "local_c" expression => "any"; - "unlocal_c" expression => "!any"; + "global_c" + expression => "any", + scope => "namespace"; + + "unglobal_c" + expression => "!any", + scope => "namespace"; + + "local_c" expression => "any"; + "unlocal_c" expression => "!any"; + reports: DEBUG:: "$(init.classes) defined from test" if => "${init.classes}"; "$(init.classes) not defined from test" if => "!${init.classes}"; } -bundle agent check { +bundle agent check +{ classes: global_c.!local_c.!unglobal_c.!unlocal_c:: "ok" expression => "any"; @@ -40,6 +50,7 @@ bundle agent check { ok:: "${this.promise_filename} Pass"; + !ok:: "${this.promise_filename} FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/array_key_with_space_isvariable.cf b/tests/acceptance/02_classes/01_basic/array_key_with_space_isvariable.cf index ba26fd8efd..47f8e8a312 100644 --- a/tests/acceptance/02_classes/01_basic/array_key_with_space_isvariable.cf +++ b/tests/acceptance/02_classes/01_basic/array_key_with_space_isvariable.cf @@ -1,9 +1,9 @@ # isvariable should be able to check array indexes that have spaces body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test @@ -24,6 +24,7 @@ bundle agent test reports: have_one.DEBUG:: "Have array key 'one' as expected containing value '$(array[one])'"; + have_twenty_one.DEBUG:: "Have array key 'twenty one' as expected containing value '$(array[twenty one])'"; } diff --git a/tests/acceptance/02_classes/01_basic/avoid_reevaluation.cf b/tests/acceptance/02_classes/01_basic/avoid_reevaluation.cf index 5797ea5947..eb43e26b71 100644 --- a/tests/acceptance/02_classes/01_basic/avoid_reevaluation.cf +++ b/tests/acceptance/02_classes/01_basic/avoid_reevaluation.cf @@ -3,21 +3,22 @@ # Redmine#5241: do not reevaluate classes if they are known already # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_output(".*", - ".*loquacious quaalude.*|.*/etc/debian_version.*", - "$(sys.cf_agent) -KI -f $(this.promise_filename).sub -Dloquacious", - $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + ".*", + ".*loquacious quaalude.*|.*/etc/debian_version.*", + "$(sys.cf_agent) -KI -f $(this.promise_filename).sub -Dloquacious", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/02_classes/01_basic/cancel_attribute.cf b/tests/acceptance/02_classes/01_basic/cancel_attribute.cf index 92005f61ef..1065f14b84 100644 --- a/tests/acceptance/02_classes/01_basic/cancel_attribute.cf +++ b/tests/acceptance/02_classes/01_basic/cancel_attribute.cf @@ -9,65 +9,77 @@ # defined. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { meta: - "description" -> { "CFE-4686" } - string => "classes promise 'cancel' attribute (cfbool) undefines a defined class when the promise guard is met"; + "description" -> { "CFE-4686" } + string => "classes promise 'cancel' attribute (cfbool) undefines a defined class when the promise guard is met"; classes: - # Define global classes so the check bundle can observe the outcome. - "to_cancel" expression => "any", scope => "namespace"; - "to_cancel_alias" expression => "any", scope => "namespace"; - "to_keep_guard" expression => "any", scope => "namespace"; - "to_keep_false" expression => "any", scope => "namespace"; - "trigger" expression => "any", scope => "namespace"; + # Define global classes so the check bundle can observe the outcome. + "to_cancel" + expression => "any", + scope => "namespace"; + + "to_cancel_alias" + expression => "any", + scope => "namespace"; + + "to_keep_guard" + expression => "any", + scope => "namespace"; + + "to_keep_false" + expression => "any", + scope => "namespace"; + + "trigger" + expression => "any", + scope => "namespace"; trigger:: # Guard satisfied and cancel => "true": to_cancel must be undefined. - "to_cancel" cancel => "true"; + "to_cancel" cancel => "true"; # "yes" is an accepted boolean alias for "true". "to_cancel_alias" cancel => "yes"; class_that_is_not_defined:: # Guard not satisfied: to_keep_guard must be retained. - "to_keep_guard" cancel => "true"; + "to_keep_guard" cancel => "true"; any:: # Guard satisfied but cancel => "false": no-op, to_keep_false retained. - "to_keep_false" cancel => "false"; + "to_keep_false" cancel => "false"; # Cancelling a class that was never defined is a harmless no-op. - "never_defined" cancel => "true"; + "never_defined" cancel => "true"; } ####################################################### - bundle agent check { classes: - "ok" expression => "!to_cancel.!to_cancel_alias.to_keep_guard.to_keep_false.!never_defined.trigger"; + "ok" + expression => "!to_cancel.!to_cancel_alias.to_keep_guard.to_keep_false.!never_defined.trigger"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/cancel_attribute_hardclass.cf b/tests/acceptance/02_classes/01_basic/cancel_attribute_hardclass.cf index d784d02961..297dd95b36 100644 --- a/tests/acceptance/02_classes/01_basic/cancel_attribute_hardclass.cf +++ b/tests/acceptance/02_classes/01_basic/cancel_attribute_hardclass.cf @@ -6,43 +6,40 @@ # class left in place, consistent with the cancel_* classes body attributes. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { meta: - "description" -> { "CFE-4686" } - string => "classes promise 'cancel' attribute must not undefine a hard class"; + "description" -> { "CFE-4686" } + string => "classes promise 'cancel' attribute must not undefine a hard class"; classes: - # cfengine is a reserved hard class - the cancel must be ignored. - "cfengine" cancel => "true"; + # cfengine is a reserved hard class - the cancel must be ignored. + "cfengine" cancel => "true"; } ####################################################### - bundle agent check { classes: - "ok" expression => "cfengine"; + "ok" expression => "cfengine"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/cancel_attribute_modifier_mutex.cf b/tests/acceptance/02_classes/01_basic/cancel_attribute_modifier_mutex.cf index c9bd3847eb..4972a15a08 100644 --- a/tests/acceptance/02_classes/01_basic/cancel_attribute_modifier_mutex.cf +++ b/tests/acceptance/02_classes/01_basic/cancel_attribute_modifier_mutex.cf @@ -9,35 +9,34 @@ # in the agent output. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { meta: - "description" -> { "CFE-4686" } - string => "'cancel' must reject 'persistence', 'scope', and 'timer_policy'"; + "description" -> { "CFE-4686" } + string => "'cancel' must reject 'persistence', 'scope', and 'timer_policy'"; } ####################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_output1(".*'cancel' attribute cannot be combined with.*", - "$(sys.cf_agent) -Kf $(this.promise_filename).sub 2>&1", - $(this.promise_filename)); + "" + usebundle => dcs_passif_output1( + ".*'cancel' attribute cannot be combined with.*", + "$(sys.cf_agent) -Kf $(this.promise_filename).sub 2>&1", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/02_classes/01_basic/cancel_attribute_mutex.cf b/tests/acceptance/02_classes/01_basic/cancel_attribute_mutex.cf index fded2a150f..744b0499e4 100644 --- a/tests/acceptance/02_classes/01_basic/cancel_attribute_mutex.cf +++ b/tests/acceptance/02_classes/01_basic/cancel_attribute_mutex.cf @@ -9,35 +9,34 @@ # test asserts the rejection appears in the agent output. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { meta: - "description" -> { "CFE-4686" } - string => "'cancel' must be mutually exclusive with the class-defining attributes"; + "description" -> { "CFE-4686" } + string => "'cancel' must be mutually exclusive with the class-defining attributes"; } ####################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_output1(".*Irreconcilable constraints in classes.*", - "$(sys.cf_agent) -Kf $(this.promise_filename).sub 2>&1", - $(this.promise_filename)); + "" + usebundle => dcs_passif_output1( + ".*Irreconcilable constraints in classes.*", + "$(sys.cf_agent) -Kf $(this.promise_filename).sub 2>&1", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/02_classes/01_basic/cancel_attribute_persistent_lmdb.cf b/tests/acceptance/02_classes/01_basic/cancel_attribute_persistent_lmdb.cf index 2f6030ef8f..27f7843825 100644 --- a/tests/acceptance/02_classes/01_basic/cancel_attribute_persistent_lmdb.cf +++ b/tests/acceptance/02_classes/01_basic/cancel_attribute_persistent_lmdb.cf @@ -15,36 +15,32 @@ # text (cf. persistent_timer_policy_default_lmdb.cf). # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { # Remove the persistent class DB to ensure a clean state. files: - "$(sys.workdir)/state/cf_state.lmdb" - delete => tidy; - "$(sys.workdir)/state/cf_state.lmdb-lock" - delete => tidy; - "$(sys.workdir)/state/cf_state.lmdb.lock" - delete => tidy; + "$(sys.workdir)/state/cf_state.lmdb" delete => tidy; + "$(sys.workdir)/state/cf_state.lmdb-lock" delete => tidy; + "$(sys.workdir)/state/cf_state.lmdb.lock" delete => tidy; } bundle agent test { meta: - "description" -> { "CFE-4686" } - string => "classes promise 'cancel' removes the persistent class record from the cf_state LMDB"; + "description" -> { "CFE-4686" } + string => "classes promise 'cancel' removes the persistent class record from the cf_state LMDB"; vars: - "state" string => "$(sys.workdir)/state/cf_state.lmdb"; - "sub" string => "$(this.promise_filename).sub"; - "sub2" string => "$(this.promise_filename).sub2"; + "state" string => "$(sys.workdir)/state/cf_state.lmdb"; + "sub" string => "$(this.promise_filename).sub"; + "sub2" string => "$(this.promise_filename).sub2"; commands: # One shell invocation runs the whole sequence: @@ -62,22 +58,24 @@ bundle agent test bundle agent check { vars: - "before" string => readfile("$(G.testdir)/cancel_lmdb_before", 4096); - "after" string => readfile("$(G.testdir)/cancel_lmdb_after", 4096); + "before" string => readfile("$(G.testdir)/cancel_lmdb_before", 4096); + "after" string => readfile("$(G.testdir)/cancel_lmdb_after", 4096); classes: - # The class was stored in the LMDB by run 1 ... - "present_before" expression => regcmp("[1-9][0-9]*", "$(before)"); - # ... and removed by the cancel in run 2. - "absent_after" expression => strcmp("$(after)", "0"); + # The class was stored in the LMDB by run 1 ... + "present_before" expression => regcmp("[1-9][0-9]*", "$(before)"); - "ok" expression => "present_before.absent_after"; + # ... and removed by the cancel in run 2. + "absent_after" expression => strcmp("$(after)", "0"); + "ok" expression => "present_before.absent_after"; reports: DEBUG:: "LMDB record count before cancel = '$(before)' (expect >= 1), after = '$(after)' (expect 0)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/cancel_hardclass.cf b/tests/acceptance/02_classes/01_basic/cancel_hardclass.cf index 39b8d95ef3..93ed796573 100644 --- a/tests/acceptance/02_classes/01_basic/cancel_hardclass.cf +++ b/tests/acceptance/02_classes/01_basic/cancel_hardclass.cf @@ -3,7 +3,6 @@ # Test that undefining hardclasses is not be permitted. # ############################################################################# - body common control { bundlesequence => { "init", "test", "check" }; @@ -11,36 +10,34 @@ body common control bundle agent init { - } body classes undefine(class) { - cancel_kept => { "$(class)" }; - cancel_repaired => { "$(class)" }; - cancel_notkept => { "$(class)" }; + cancel_kept => { "$(class)" }; + cancel_repaired => { "$(class)" }; + cancel_notkept => { "$(class)" }; } bundle agent test { meta: - "description" -> { "ENT-7718" } - string => "Test that undefining hardclasses is not be permitted."; + "description" -> { "ENT-7718" } + string => "Test that undefining hardclasses is not be permitted."; commands: - "/bin/true" - classes => undefine("cfengine"); + "/bin/true" classes => undefine("cfengine"); } bundle agent check { classes: - "passed" - expression => "cfengine"; + "passed" expression => "cfengine"; reports: passed:: "$(this.promise_filename) Pass"; + !passed:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/classes_comments_emitted_in_show_classes.cf b/tests/acceptance/02_classes/01_basic/classes_comments_emitted_in_show_classes.cf index b16e99095b..a5413ed481 100644 --- a/tests/acceptance/02_classes/01_basic/classes_comments_emitted_in_show_classes.cf +++ b/tests/acceptance/02_classes/01_basic/classes_comments_emitted_in_show_classes.cf @@ -1,22 +1,27 @@ # Test $(sys.inputdir), $(sys.masterdir), $(sys.libdir), $(sys.bindir), $(sys.failsafe_policy_path), $(sys.update_policy_path), $(sys.local_libdir) body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent test { meta: - "description" string => "Test that comments on classes are emitted in --show-evaluated-classes output."; + "description" + string => "Test that comments on classes are emitted in --show-evaluated-classes output."; } ####################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_output(".*test_class.*This is a comment about test_class.*", "", "$(sys.cf_agent) -Kf $(this.promise_filename).sub --show-evaluated-classes", $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + ".*test_class.*This is a comment about test_class.*", + "", + "$(sys.cf_agent) -Kf $(this.promise_filename).sub --show-evaluated-classes", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/02_classes/01_basic/classes_comments_emitted_in_verbose.cf b/tests/acceptance/02_classes/01_basic/classes_comments_emitted_in_verbose.cf index 3bfcef9dc3..777624f219 100644 --- a/tests/acceptance/02_classes/01_basic/classes_comments_emitted_in_verbose.cf +++ b/tests/acceptance/02_classes/01_basic/classes_comments_emitted_in_verbose.cf @@ -1,24 +1,28 @@ # Test $(sys.inputdir), $(sys.masterdir), $(sys.libdir), $(sys.bindir), $(sys.failsafe_policy_path), $(sys.update_policy_path), $(sys.local_libdir) body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent test { meta: - "description" - string => "Test that comments on classes are emitted in verbose output.", - meta => { "CFE-2443" }; + "description" + string => "Test that comments on classes are emitted in verbose output.", + meta => { "CFE-2443" }; } ####################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_output(".*This is a comment about test_class.*", "", "$(sys.cf_agent) -Kvf $(this.promise_filename).sub", $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + ".*This is a comment about test_class.*", + "", + "$(sys.cf_agent) -Kvf $(this.promise_filename).sub", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/02_classes/01_basic/classes_from_modules_available_to_subsequent_bundles_in_first_pass.cf b/tests/acceptance/02_classes/01_basic/classes_from_modules_available_to_subsequent_bundles_in_first_pass.cf index 677321a57e..92ce84be27 100644 --- a/tests/acceptance/02_classes/01_basic/classes_from_modules_available_to_subsequent_bundles_in_first_pass.cf +++ b/tests/acceptance/02_classes/01_basic/classes_from_modules_available_to_subsequent_bundles_in_first_pass.cf @@ -4,16 +4,14 @@ # from module protocol right away # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent check { meta: @@ -22,8 +20,11 @@ bundle agent check meta => { "redmine#6689", "zendesk#1548" }; methods: - "" usebundle => dcs_passif_output("should be set", - "should not be set", - "$(sys.cf_agent) -KI -f $(this.promise_filename).sub", - $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + "should be set", + "should not be set", + "$(sys.cf_agent) -KI -f $(this.promise_filename).sub", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/02_classes/01_basic/classes_promises_with_classes_bodies.cf b/tests/acceptance/02_classes/01_basic/classes_promises_with_classes_bodies.cf index 77371a0633..3df9ee8cc4 100644 --- a/tests/acceptance/02_classes/01_basic/classes_promises_with_classes_bodies.cf +++ b/tests/acceptance/02_classes/01_basic/classes_promises_with_classes_bodies.cf @@ -3,16 +3,14 @@ # Classes type promises should work with classes bodies # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent check { meta: @@ -21,8 +19,7 @@ bundle agent check meta => { "redmine#7537" }; vars: - "classes" - slist => classesmatching("checked_for_file.*"); + "classes" slist => classesmatching("checked_for_file.*"); classes: "have_file" @@ -31,10 +28,11 @@ bundle agent check methods: "pass or fail" - usebundle => dcs_passif("checked_for_file_reached", $(this.promise_filename)); + usebundle => dcs_passif( + "checked_for_file_reached", $(this.promise_filename) + ); reports: DEBUG|EXTRA:: "Found class: $(classes)"; - } diff --git a/tests/acceptance/02_classes/01_basic/classes_without_expression.cf b/tests/acceptance/02_classes/01_basic/classes_without_expression.cf index c8edaa9072..99dfde9c43 100644 --- a/tests/acceptance/02_classes/01_basic/classes_without_expression.cf +++ b/tests/acceptance/02_classes/01_basic/classes_without_expression.cf @@ -3,28 +3,31 @@ # test that classes without expressions are defined # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common test { classes: - "myclass1"; - "myclass2" meta => { "good" }; - "myclass3" persistence => "120"; - "myclass4" meta => { "good" }, persistence => "120"; + "myclass1"; + "myclass2" meta => { "good" }; + "myclass3" persistence => "120"; + + "myclass4" + meta => { "good" }, + persistence => "120"; } -####################################################### +####################################################### bundle agent check { methods: - "" usebundle => dcs_passif_expected("myclass1,myclass2,myclass3,myclass4", - "", - $(this.promise_filename)); + "" + usebundle => dcs_passif_expected( + "myclass1,myclass2,myclass3,myclass4", "", $(this.promise_filename) + ); } diff --git a/tests/acceptance/02_classes/01_basic/common_bundle_select_class_empty_list.cf b/tests/acceptance/02_classes/01_basic/common_bundle_select_class_empty_list.cf index 18d65b38a3..d8e0d02a92 100644 --- a/tests/acceptance/02_classes/01_basic/common_bundle_select_class_empty_list.cf +++ b/tests/acceptance/02_classes/01_basic/common_bundle_select_class_empty_list.cf @@ -1,35 +1,33 @@ # Test that select_class is skipped when no classes are given -body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; +body common control +{ + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -bundle common test +bundle common test { -# meta: -# "test_soft_fail" string => "any", -# meta => { "redmine7482" }; - + # meta: + # "test_soft_fail" string => "any", + # meta => { "redmine7482" }; vars: any:: "common_classes" slist => { "common_1", "common_2" }; - common_class_selected:: + common_class_selected:: "class_selected" string => "$(common_classes)", if => "$(common_classes)"; - - classes: - "common_class_selected" - select_class => { }; + classes: + "common_class_selected" select_class => {}; } bundle agent check { methods: - "any" usebundle => dcs_passif("any", - "$(this.promise_filename)"), - unless => "common_class_selected"; + "any" + usebundle => dcs_passif("any", "$(this.promise_filename)"), + unless => "common_class_selected"; } diff --git a/tests/acceptance/02_classes/01_basic/common_bundle_select_class_multiple_classes_as_scalar_variable.cf b/tests/acceptance/02_classes/01_basic/common_bundle_select_class_multiple_classes_as_scalar_variable.cf index 894914377c..58fc7204a6 100644 --- a/tests/acceptance/02_classes/01_basic/common_bundle_select_class_multiple_classes_as_scalar_variable.cf +++ b/tests/acceptance/02_classes/01_basic/common_bundle_select_class_multiple_classes_as_scalar_variable.cf @@ -1,37 +1,36 @@ # Test that select class is actuated when it has multiple classes given as a # variable -body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; +body common control +{ + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -bundle common test +bundle common test { vars: any:: "common_classes" slist => { "common_1", "common_2" }; - common_class_selected:: + common_class_selected:: "class_selected" string => "$(common_classes)", if => "$(common_classes)"; - - classes: - # When you iterate on a list using $() it should iterate in the order of - # the list. So the first time this is actuated, the value of - # $(common_classes) should be "common_1". "common_2" should never be - # defined, because the promise will be skipped on subsequent passes since - # the "common_class_selected" is already defined. - "common_class_selected" - select_class => { $(common_classes) }; + classes: + # When you iterate on a list using $() it should iterate in the order of + # the list. So the first time this is actuated, the value of + # $(common_classes) should be "common_1". "common_2" should never be + # defined, because the promise will be skipped on subsequent passes since + # the "common_class_selected" is already defined. + "common_class_selected" select_class => { $(common_classes) }; } bundle agent check { methods: - "any" usebundle => dcs_passif("common_1", - "$(this.promise_filename)"), - unless => "common_2"; + "any" + usebundle => dcs_passif("common_1", "$(this.promise_filename)"), + unless => "common_2"; } diff --git a/tests/acceptance/02_classes/01_basic/common_bundle_select_class_single_class.cf b/tests/acceptance/02_classes/01_basic/common_bundle_select_class_single_class.cf index 6421ac50d3..63e9c78130 100644 --- a/tests/acceptance/02_classes/01_basic/common_bundle_select_class_single_class.cf +++ b/tests/acceptance/02_classes/01_basic/common_bundle_select_class_single_class.cf @@ -1,30 +1,28 @@ # Test that select class is actuated when it has only a single class given -body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; +body common control +{ + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -bundle common test +bundle common test { vars: any:: - "common_classes" slist => { }; + "common_classes" slist => {}; - common_class_selected:: + common_class_selected:: "class_selected" string => "$(common_classes)", if => "$(common_classes)"; - - classes: - "common_class_selected" - select_class => { "common_1" }; + classes: + "common_class_selected" select_class => { "common_1" }; } bundle agent check { methods: - "any" usebundle => dcs_passif("common_1", - "$(this.promise_filename)"); + "any" usebundle => dcs_passif("common_1", "$(this.promise_filename)"); } diff --git a/tests/acceptance/02_classes/01_basic/common_bundle_select_class_single_class_as_variable.cf b/tests/acceptance/02_classes/01_basic/common_bundle_select_class_single_class_as_variable.cf index a4222816e5..cc810eabc2 100644 --- a/tests/acceptance/02_classes/01_basic/common_bundle_select_class_single_class_as_variable.cf +++ b/tests/acceptance/02_classes/01_basic/common_bundle_select_class_single_class_as_variable.cf @@ -1,31 +1,29 @@ # Test that select class is actuated when it has only a single class given as a # variable -body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; +body common control +{ + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -bundle common test +bundle common test { vars: any:: "common_class" string => "common_1"; - common_class_selected:: + common_class_selected:: "class_selected" string => "$(common_classes)", if => "$(common_classes)"; - - classes: - "common_class_selected" - select_class => { $(common_class) }; + classes: + "common_class_selected" select_class => { $(common_class) }; } bundle agent check { methods: - "any" usebundle => dcs_passif("common_1", - "$(this.promise_filename)"); + "any" usebundle => dcs_passif("common_1", "$(this.promise_filename)"); } diff --git a/tests/acceptance/02_classes/01_basic/common_bundle_select_class_variable_expands_empty_list.cf b/tests/acceptance/02_classes/01_basic/common_bundle_select_class_variable_expands_empty_list.cf index 17e6ee6c9c..833304f512 100644 --- a/tests/acceptance/02_classes/01_basic/common_bundle_select_class_variable_expands_empty_list.cf +++ b/tests/acceptance/02_classes/01_basic/common_bundle_select_class_variable_expands_empty_list.cf @@ -1,31 +1,30 @@ # Test that select class is skipped when the list of classes is empty -body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; +body common control +{ + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -bundle common test +bundle common test { vars: any:: - "common_classes" slist => { }; + "common_classes" slist => {}; - common_class_selected:: + common_class_selected:: "class_selected" string => "$(common_classes)", if => "$(common_classes)"; - - classes: - "common_class_selected" - select_class => { @(common_classes) }; + classes: + "common_class_selected" select_class => { @(common_classes) }; } bundle agent check { methods: - "any" usebundle => dcs_passif("any", - "$(this.promise_filename)"), - unless => "common_class_selected"; + "any" + usebundle => dcs_passif("any", "$(this.promise_filename)"), + unless => "common_class_selected"; } diff --git a/tests/acceptance/02_classes/01_basic/common_class_scope.cf b/tests/acceptance/02_classes/01_basic/common_class_scope.cf index 04949a7bb6..a50706fe9d 100644 --- a/tests/acceptance/02_classes/01_basic/common_class_scope.cf +++ b/tests/acceptance/02_classes/01_basic/common_class_scope.cf @@ -4,31 +4,41 @@ # from common bundles # ####################################################### - -body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; +body common control +{ + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -bundle agent init { +bundle agent init +{ vars: - "classes" slist => { "global_c", "local_c", "unglobal_c", "unlocal_c" }; + "classes" slist => { "global_c", "local_c", "unglobal_c", "unlocal_c" }; } -bundle common test { +bundle common test +{ classes: - "global_c" expression => "any"; - "unglobal_c" expression => "!any"; - "local_c" expression => "any", scope => "bundle"; - "unlocal_c" expression => "!any", scope => "bundle"; + "global_c" expression => "any"; + "unglobal_c" expression => "!any"; + + "local_c" + expression => "any", + scope => "bundle"; + + "unlocal_c" + expression => "!any", + scope => "bundle"; + reports: DEBUG:: "$(init.classes) defined from test" if => "${init.classes}"; "$(init.classes) not defined from test" if => "!${init.classes}"; } -bundle agent check { +bundle agent check +{ classes: global_c.!local_c.!unglobal_c.!unlocal_c:: "ok" expression => "any"; @@ -40,6 +50,7 @@ bundle agent check { ok:: "${this.promise_filename} Pass"; + !ok:: "${this.promise_filename} FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/depends_on_proper_ordering.cf b/tests/acceptance/02_classes/01_basic/depends_on_proper_ordering.cf index 37ee6d1d0e..ab6431e49f 100644 --- a/tests/acceptance/02_classes/01_basic/depends_on_proper_ordering.cf +++ b/tests/acceptance/02_classes/01_basic/depends_on_proper_ordering.cf @@ -1,6 +1,5 @@ # Redmine#5462 # Redmine#6484 - body common control { inputs => { "../../default.sub.cf" }; @@ -12,9 +11,7 @@ bundle agent test { vars: "states" slist => { "actual", "expected" }; - - "expected_content" string => - "second_line + "expected_content" string => "second_line first_line"; files: @@ -36,13 +33,16 @@ first_line"; bundle edit_line test_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/02_classes/01_basic/depends_on_respected.cf b/tests/acceptance/02_classes/01_basic/depends_on_respected.cf index d65a4e9a83..7edb8d4eba 100644 --- a/tests/acceptance/02_classes/01_basic/depends_on_respected.cf +++ b/tests/acceptance/02_classes/01_basic/depends_on_respected.cf @@ -1,12 +1,11 @@ # Redmine#5462 # Redmine#6484 # respect depends_on restriction - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -15,18 +14,18 @@ bundle agent init "$(G.testfile)_present_if_test_commands_false_considered_kept_or_repaired" delete => tidy; - "$(G.testfile)_present_if_test_commands_echo_ran" - delete => tidy; + "$(G.testfile)_present_if_test_commands_echo_ran" delete => tidy; } bundle agent test { - files: "$(G.testfile)_present_if_test_commands_false_considered_kept_or_repaired" create => "true", handle => "test_files", - classes => scoped_classes_generic("namespace", "test_commands_files_testfile"), + classes => scoped_classes_generic( + "namespace", "test_commands_files_testfile" + ), depends_on => { "test_commands_false", "test_commands_false2" }; commands: @@ -56,8 +55,6 @@ bundle agent test handle => "test_reports", classes => scoped_classes_generic("namespace", "test_reports"), depends_on => { "test_commands_false", "test_commands_false2" }; - - } bundle agent check @@ -65,41 +62,41 @@ bundle agent check vars: "fail_classes" slist => { - "test_commands_true_reached", - "test_files_reached", - "test_reports_reached", - "test_packages_reached", - }; + "test_commands_true_reached", + "test_files_reached", + "test_reports_reached", + "test_packages_reached", + }; classes: - "fail" or => { @(fail_classes) }; + "fail" or => { @(fail_classes) }; reports: DEBUG:: "'test_commands_false' was ok unexpectedly" if => "test_commands_false_ok"; - "'test_commands_false' was kept unexpectedly" + "'test_commands_false' was kept unexpectedly" if => "test_commands_false_kept"; "'test_commands_false' was repaired unexpectedly" if => "test_commands_false_repaired"; - "'test_commands_false' was not_ok as expected" + "'test_commands_false' was not_ok as expected" if => "test_commands_false_not_ok"; - - "'test_commands_false2' was ok unexpectedly" + + "'test_commands_false2' was ok unexpectedly" if => "test_commands_false2_ok"; - "'test_commands_false2' was kept unexpectedly" + "'test_commands_false2' was kept unexpectedly" if => "test_commands_false2_kept"; - "'test_commands_false2' was repaired unexpectedly" + "'test_commands_false2' was repaired unexpectedly" if => "test_commands_false2_repaired"; - "'test_commands_false2' was not_ok as expected" + "'test_commands_false2' was not_ok as expected" if => "test_commands_false2_not_ok"; - + "'$(fail_classes)' erroneously thought 'test_commands_false' and or 'test_commands_false2' was ok aka (kept or repaired)." if => "$(fail_classes)"; @@ -112,14 +109,13 @@ bundle agent check body package_method mock { - package_changes => "individual"; - package_list_command => "$(G.echo) --list-installed"; - package_list_name_regex => "^[^:]*"; - package_list_version_regex => ":(?<=:).*(?=:)"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(G.echo) --add "; - package_update_command => "$(G.echo) --update "; - package_delete_command => "$(G.echo) --delete "; - package_verify_command => "$(G.echo) --verify "; + package_changes => "individual"; + package_list_command => "$(G.echo) --list-installed"; + package_list_name_regex => "^[^:]*"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(G.echo) --add "; + package_update_command => "$(G.echo) --update "; + package_delete_command => "$(G.echo) --delete "; + package_verify_command => "$(G.echo) --verify "; } diff --git a/tests/acceptance/02_classes/01_basic/expected_os_classes.cf b/tests/acceptance/02_classes/01_basic/expected_os_classes.cf index bda5118bf7..0fc3a40046 100644 --- a/tests/acceptance/02_classes/01_basic/expected_os_classes.cf +++ b/tests/acceptance/02_classes/01_basic/expected_os_classes.cf @@ -6,8 +6,8 @@ body common control bundle agent test { meta: - "description" -> { "CFE-3608" } - string => "Make sure at least one of the expected os hard classes are defined"; + "description" -> { "CFE-3608" } + string => "Make sure at least one of the expected os hard classes are defined"; vars: DEBUG:: @@ -16,30 +16,35 @@ bundle agent test bundle agent check { - classes: - "passed" or => { "debian", - "ubuntu", - "redhat", - "centos", - "fedora", - "aix", - "hpux", - "suse", - "opensuse", - "manjaro", - "archlinux", - "windows", - "freebsd", - "macos", - "solaris" }; - - reports: - DEBUG&!passed:: - "None of the expected classes were defined."; - "Here is a list of defined classes:"; - "$(test.defined_classes)"; - passed:: - "$(this.promise_filename) Pass"; - !passed:: - "$(this.promise_filename) FAIL"; + classes: + "passed" + or => { + "debian", + "ubuntu", + "redhat", + "centos", + "fedora", + "aix", + "hpux", + "suse", + "opensuse", + "manjaro", + "archlinux", + "windows", + "freebsd", + "macos", + "solaris", + }; + + reports: + DEBUG&!passed:: + "None of the expected classes were defined."; + "Here is a list of defined classes:"; + "$(test.defined_classes)"; + + passed:: + "$(this.promise_filename) Pass"; + + !passed:: + "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/from_json_booleans.cf b/tests/acceptance/02_classes/01_basic/from_json_booleans.cf index e5c43b86e4..82f5cb6dad 100644 --- a/tests/acceptance/02_classes/01_basic/from_json_booleans.cf +++ b/tests/acceptance/02_classes/01_basic/from_json_booleans.cf @@ -3,36 +3,49 @@ # Test expansion of JSON booleans # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle agent test { classes: - "canary" expression => "any", meta => { "collect" }; # just a baseline test - "from_$(json)" expression => "$(json)", meta => { "collect" }; # iterates through non-nulls - "from_null" expression => "$(json[maybe])", meta => { "collect" }; - "from_missing" expression => "$(json[nonesuch])", meta => { "collect" }; + "canary" + expression => "any", + meta => { "collect" }; + + # just a baseline test + "from_$(json)" + expression => "$(json)", + meta => { "collect" }; + + # iterates through non-nulls + "from_null" + expression => "$(json[maybe])", + meta => { "collect" }; + + "from_missing" + expression => "$(json[nonesuch])", + meta => { "collect" }; vars: - "json" data => '{ "yes": true, "no": false, "maybe": null }'; - "var_$(json)" string => "$(json)"; - "collected" slist => sort(classesmatching(".*", "collect")); + "json" data => '{ "yes": true, "no": false, "maybe": null }'; + "var_$(json)" string => "$(json)"; + "collected" slist => sort(classesmatching(".*", "collect")); } ########################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/02_classes/01_basic/hp_ux_major.cf b/tests/acceptance/02_classes/01_basic/hp_ux_major.cf index 5c96775a23..23cd4e54cc 100644 --- a/tests/acceptance/02_classes/01_basic/hp_ux_major.cf +++ b/tests/acceptance/02_classes/01_basic/hp_ux_major.cf @@ -6,8 +6,8 @@ body common control bundle agent test { meta: - "description" -> { "CFE-3609" } - string => "Make sure the class 'hpux_' is defined on HP-UX"; + "description" -> { "CFE-3609" } + string => "Make sure the class 'hpux_' is defined on HP-UX"; vars: DEBUG:: @@ -20,6 +20,7 @@ bundle agent check # if 'hpux': make sure 'hpux_10' or 'hpux_11' is defined hpux:: "passed" expression => "hpux_10|hpux_11"; + # if not 'hpux': make sure neither 'hpux_10' nor 'hpux_11' is defined !hpux:: "passed" expression => "!(hpux_10|hpux_11)"; @@ -29,10 +30,13 @@ bundle agent check "No class containing OS- name & version major is defined on HP-UX."; "Here is a list of defined classes:"; "$(test.defined_classes)"; + DEBUG&!hpux&!passed:: "A class containing 'hpux_' was defined on a non HP-UX system"; + passed:: "$(this.promise_filename) Pass"; + !passed:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/if_resolving_classexpression_from_datacontainer.cf b/tests/acceptance/02_classes/01_basic/if_resolving_classexpression_from_datacontainer.cf index ba14969dd7..5d2072a8d9 100644 --- a/tests/acceptance/02_classes/01_basic/if_resolving_classexpression_from_datacontainer.cf +++ b/tests/acceptance/02_classes/01_basic/if_resolving_classexpression_from_datacontainer.cf @@ -1,21 +1,20 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "description" -> { "CFE-3319" } + "description" -> { "CFE-3319" } string => "Test that if can check class expressions from within a data container"; vars: - - "d" data => '{ + "d" + data => '{ "things": [ { "Title": "NOPE", @@ -32,15 +31,15 @@ bundle agent test ] }'; - "di" slist => getindices( "d[things]" ); + "di" slist => getindices("d[things]"); - "selected" - string => "$(d[things][$(di)][Title])", - if => "$(d[things][$(di)][classexpr])"; + "selected" + string => "$(d[things][$(di)][Title])", + if => "$(d[things][$(di)][classexpr])"; - "sanity_check" - string => "You are sane", - if => "$(sys.class)"; + "sanity_check" + string => "You are sane", + if => "$(sys.class)"; reports: EXTRA|DEBUG:: @@ -52,15 +51,14 @@ bundle agent test } ####################################################### - bundle agent check { vars: - "expected_selection" string => "ExpectedPick"; + "expected_selection" string => "ExpectedPick"; methods: - "Pass/Fail" - usebundle => dcs_check_strcmp($(expected_selection), $(test.selected), - $(this.promise_filename), "no"); - + "Pass/Fail" + usebundle => dcs_check_strcmp( + $(expected_selection), $(test.selected), $(this.promise_filename), "no" + ); } diff --git a/tests/acceptance/02_classes/01_basic/ifvarclass_common_bundles.cf b/tests/acceptance/02_classes/01_basic/ifvarclass_common_bundles.cf index 566b45e790..d6af39fb24 100644 --- a/tests/acceptance/02_classes/01_basic/ifvarclass_common_bundles.cf +++ b/tests/acceptance/02_classes/01_basic/ifvarclass_common_bundles.cf @@ -3,37 +3,38 @@ # Check that we can use ifvarclass in common bundle class expressions # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle common init { classes: - "initclass" expression => "any"; + "initclass" expression => "any"; } ####################################################### - bundle common test { classes: - "shouldset" expression => "any", ifvarclass => "initclass"; - "shouldnot" expression => "any", ifvarclass => "notaclass"; + "shouldset" + expression => "any", + ifvarclass => "initclass"; + + "shouldnot" + expression => "any", + ifvarclass => "notaclass"; } ####################################################### - bundle agent check { vars: - "classes" slist => { "shouldset", "shouldnot" }; + "classes" slist => { "shouldset", "shouldnot" }; classes: shouldset.!shouldnot:: @@ -46,6 +47,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/invalid_function_in_list.cf b/tests/acceptance/02_classes/01_basic/invalid_function_in_list.cf index ffc43de2bf..654340869f 100644 --- a/tests/acceptance/02_classes/01_basic/invalid_function_in_list.cf +++ b/tests/acceptance/02_classes/01_basic/invalid_function_in_list.cf @@ -1,20 +1,20 @@ # Testcase for Redmine 6569 - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -bundle agent check +bundle agent check { - classes: - "PASS" or => { "any", classify( "${never}" ) }; + classes: + "PASS" or => { "any", classify("${never}") }; + + reports: + PASS:: + "$(this.promise_filename) Pass"; - reports: - PASS:: - "$(this.promise_filename) Pass"; - !PASS:: - "$(this.promise_filename) FAIL"; + !PASS:: + "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/ipaddr_classes.cf b/tests/acceptance/02_classes/01_basic/ipaddr_classes.cf index d3c6402e75..4c9dd6bf21 100644 --- a/tests/acceptance/02_classes/01_basic/ipaddr_classes.cf +++ b/tests/acceptance/02_classes/01_basic/ipaddr_classes.cf @@ -1,17 +1,20 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent check { vars: - "ipv6_classes" slist => classesmatching("ipv6_.*"); + "ipv6_classes" slist => classesmatching("ipv6_.*"); classes: - "has_ipv6" expression => returnszero("ifconfig -a | grep 'inet6 [a-z0-9].*'", "useshell"); + "has_ipv6" + expression => returnszero( + "ifconfig -a | grep 'inet6 [a-z0-9].*'", "useshell" + ); has_ipv6:: "ok" expression => some(".*", "ipv6_classes"); diff --git a/tests/acceptance/02_classes/01_basic/log_mode_debug.cf b/tests/acceptance/02_classes/01_basic/log_mode_debug.cf index 3a77ff03e6..21439842c5 100644 --- a/tests/acceptance/02_classes/01_basic/log_mode_debug.cf +++ b/tests/acceptance/02_classes/01_basic/log_mode_debug.cf @@ -3,16 +3,14 @@ # Test mode_debug hard class # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: @@ -21,12 +19,13 @@ bundle agent test } ####################################################### - bundle agent check { methods: "Check Agent Output" - usebundle => dcs_passif_output1(".*R: is debug mode.*", - "$(sys.cf_agent) --log-level debug -Kf $(this.promise_dirname)/log_mode.cf.sub", - "$(this.promise_filename)"); + usebundle => dcs_passif_output1( + ".*R: is debug mode.*", + "$(sys.cf_agent) --log-level debug -Kf $(this.promise_dirname)/log_mode.cf.sub", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/02_classes/01_basic/log_mode_error.cf b/tests/acceptance/02_classes/01_basic/log_mode_error.cf index 359083ac68..3772a5ebd5 100644 --- a/tests/acceptance/02_classes/01_basic/log_mode_error.cf +++ b/tests/acceptance/02_classes/01_basic/log_mode_error.cf @@ -3,16 +3,14 @@ # Test mode_error hard class # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: @@ -21,13 +19,14 @@ bundle agent test } ####################################################### - bundle agent check { methods: "Check Agent Output" - usebundle => dcs_passif_output(".*R: is error mode.*", - ".*R: is (debug|verbose|inform|notice|warning) mode.*", - "$(sys.cf_agent) --log-level error -Kf $(this.promise_dirname)/log_mode.cf.sub", - "$(this.promise_filename)"); + usebundle => dcs_passif_output( + ".*R: is error mode.*", + ".*R: is (debug|verbose|inform|notice|warning) mode.*", + "$(sys.cf_agent) --log-level error -Kf $(this.promise_dirname)/log_mode.cf.sub", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/02_classes/01_basic/log_mode_inform.cf b/tests/acceptance/02_classes/01_basic/log_mode_inform.cf index 6eea13b60c..b5a8f60c25 100644 --- a/tests/acceptance/02_classes/01_basic/log_mode_inform.cf +++ b/tests/acceptance/02_classes/01_basic/log_mode_inform.cf @@ -3,16 +3,14 @@ # Test mode_inform hard class # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: @@ -21,13 +19,14 @@ bundle agent test } ####################################################### - bundle agent check { methods: "Check Agent Output" - usebundle => dcs_passif_output(".*R: is inform mode.*", - ".*R: is (debug|verbose) mode.*", - "$(sys.cf_agent) --log-level inform -Kf $(this.promise_dirname)/log_mode.cf.sub", - "$(this.promise_filename)"); + usebundle => dcs_passif_output( + ".*R: is inform mode.*", + ".*R: is (debug|verbose) mode.*", + "$(sys.cf_agent) --log-level inform -Kf $(this.promise_dirname)/log_mode.cf.sub", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/02_classes/01_basic/log_mode_notice.cf b/tests/acceptance/02_classes/01_basic/log_mode_notice.cf index ce0b1b34b8..e1e5b7906f 100644 --- a/tests/acceptance/02_classes/01_basic/log_mode_notice.cf +++ b/tests/acceptance/02_classes/01_basic/log_mode_notice.cf @@ -3,16 +3,14 @@ # Test mode_notice hard class # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: @@ -21,13 +19,14 @@ bundle agent test } ####################################################### - bundle agent check { methods: "Check Agent Output" - usebundle => dcs_passif_output(".*R: is notice mode.*", - ".*R: is (debug|verbose|inform) mode.*", - "$(sys.cf_agent) --log-level notice -Kf $(this.promise_dirname)/log_mode.cf.sub", - "$(this.promise_filename)"); + usebundle => dcs_passif_output( + ".*R: is notice mode.*", + ".*R: is (debug|verbose|inform) mode.*", + "$(sys.cf_agent) --log-level notice -Kf $(this.promise_dirname)/log_mode.cf.sub", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/02_classes/01_basic/log_mode_verbose.cf b/tests/acceptance/02_classes/01_basic/log_mode_verbose.cf index e3bee325dc..be91000358 100644 --- a/tests/acceptance/02_classes/01_basic/log_mode_verbose.cf +++ b/tests/acceptance/02_classes/01_basic/log_mode_verbose.cf @@ -3,16 +3,14 @@ # Test mode_verbose hard class # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: @@ -21,13 +19,14 @@ bundle agent test } ####################################################### - bundle agent check { methods: "Check Agent Output" - usebundle => dcs_passif_output(".*R: is verbose mode.*", - ".*R: is debug mode.*", - "$(sys.cf_agent) --log-level verbose -Kf $(this.promise_dirname)/log_mode.cf.sub", - "$(this.promise_filename)"); + usebundle => dcs_passif_output( + ".*R: is verbose mode.*", + ".*R: is debug mode.*", + "$(sys.cf_agent) --log-level verbose -Kf $(this.promise_dirname)/log_mode.cf.sub", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/02_classes/01_basic/log_mode_warning.cf b/tests/acceptance/02_classes/01_basic/log_mode_warning.cf index 4129a41489..2d6daad588 100644 --- a/tests/acceptance/02_classes/01_basic/log_mode_warning.cf +++ b/tests/acceptance/02_classes/01_basic/log_mode_warning.cf @@ -3,16 +3,14 @@ # Test mode_warning hard class # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: @@ -21,13 +19,14 @@ bundle agent test } ####################################################### - bundle agent check { methods: "Check Agent Output" - usebundle => dcs_passif_output(".*R: is warning mode.*", - ".*R: is (debug|verbose|inform|notice) mode.*", - "$(sys.cf_agent) --log-level warning -Kf $(this.promise_dirname)/log_mode.cf.sub", - "$(this.promise_filename)"); + usebundle => dcs_passif_output( + ".*R: is warning mode.*", + ".*R: is (debug|verbose|inform|notice) mode.*", + "$(sys.cf_agent) --log-level warning -Kf $(this.promise_dirname)/log_mode.cf.sub", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/02_classes/01_basic/n_cpusockets.cf b/tests/acceptance/02_classes/01_basic/n_cpusockets.cf index f03a220c70..79f35692dd 100644 --- a/tests/acceptance/02_classes/01_basic/n_cpusockets.cf +++ b/tests/acceptance/02_classes/01_basic/n_cpusockets.cf @@ -3,7 +3,6 @@ # Test that n_cpusocket(s) class exists on Linux # ####################################################### - body common control { inputs => { "../../default.sub.cf" }; @@ -12,7 +11,6 @@ body common control } ####################################################### - bundle agent test { meta: @@ -24,17 +22,14 @@ bundle agent test meta => { "CFE-30" }; vars: - "num_matching" - int => countclassesmatching("[0-9]+_cpusockets?"); + "num_matching" int => countclassesmatching("[0-9]+_cpusockets?"); } ####################################################### - bundle agent check { classes: - "ok" - expression => eval("$(test.num_matching) == 1", "class", "infix"); + "ok" expression => eval("$(test.num_matching) == 1", "class", "infix"); methods: "any" diff --git a/tests/acceptance/02_classes/01_basic/persistent_negate.cf b/tests/acceptance/02_classes/01_basic/persistent_negate.cf index 67ba900e9f..0c7c18cdc1 100644 --- a/tests/acceptance/02_classes/01_basic/persistent_negate.cf +++ b/tests/acceptance/02_classes/01_basic/persistent_negate.cf @@ -3,48 +3,52 @@ # ENT-5886 -- -N/--negate should prevent persistent classes from being defined # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dflags" string => ifelse("EXTRA", "-DDEBUG,EXTRA", "-DDEBUG"); + "dflags" string => ifelse("EXTRA", "-DDEBUG,EXTRA", "-DDEBUG"); } bundle agent test { meta: - "description" -> {"ENT-5886"} - string => "-N/--negate should prevent persistent classes from being defined"; + "description" -> { "ENT-5886" } + string => "-N/--negate should prevent persistent classes from being defined"; commands: - "$(sys.cf_agent) -K $(init.dflags) -f $(this.promise_filename).sub" - classes => test_always("done_persisting"); + "$(sys.cf_agent) -K $(init.dflags) -f $(this.promise_filename).sub" + classes => test_always("done_persisting"); } body classes test_always(x) { - promise_repaired => { "$(x)" }; - promise_kept => { "$(x)" }; - repair_failed => { "$(x)" }; - repair_denied => { "$(x)" }; - repair_timeout => { "$(x)" }; + promise_repaired => { "$(x)" }; + promise_kept => { "$(x)" }; + repair_failed => { "$(x)" }; + repair_denied => { "$(x)" }; + repair_timeout => { "$(x)" }; } bundle agent check { vars: done_persisting:: - "subout" string => execresult("$(sys.cf_agent) -N test_class -K $(init.dflags) -f $(this.promise_filename).sub2", "noshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -N test_class -K $(init.dflags) -f $(this.promise_filename).sub2", + "noshell" + ); methods: - "" usebundle => dcs_check_strcmp($(subout), "R: Pass", - $(this.promise_filename), - "no"); + "" + usebundle => dcs_check_strcmp( + $(subout), "R: Pass", $(this.promise_filename), "no" + ); } diff --git a/tests/acceptance/02_classes/01_basic/persistent_tags.cf b/tests/acceptance/02_classes/01_basic/persistent_tags.cf index e62bb75e5b..7e002f78e7 100644 --- a/tests/acceptance/02_classes/01_basic/persistent_tags.cf +++ b/tests/acceptance/02_classes/01_basic/persistent_tags.cf @@ -3,51 +3,55 @@ # Redmine#5017: persistent classes should keep their tags # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dflags" string => ifelse("EXTRA", "-DDEBUG,EXTRA", "-DDEBUG"); + "dflags" string => ifelse("EXTRA", "-DDEBUG,EXTRA", "-DDEBUG"); commands: - "$(G.echo)" classes => init_cancel_always; + "$(G.echo)" classes => init_cancel_always; } body classes init_cancel_always { - cancel_repaired => { "myclass" }; - cancel_notkept => { "myclass" }; - cancel_kept => { "myclass" }; + cancel_repaired => { "myclass" }; + cancel_notkept => { "myclass" }; + cancel_kept => { "myclass" }; } bundle agent test { commands: - "$(sys.cf_agent) -K $(init.dflags) -f $(this.promise_filename).sub" - classes => test_always("done_persisting"); + "$(sys.cf_agent) -K $(init.dflags) -f $(this.promise_filename).sub" + classes => test_always("done_persisting"); } body classes test_always(x) { - promise_repaired => { "$(x)" }; - promise_kept => { "$(x)" }; - repair_failed => { "$(x)" }; - repair_denied => { "$(x)" }; - repair_timeout => { "$(x)" }; -} + promise_repaired => { "$(x)" }; + promise_kept => { "$(x)" }; + repair_failed => { "$(x)" }; + repair_denied => { "$(x)" }; + repair_timeout => { "$(x)" }; +} bundle agent check { vars: done_persisting:: - "subout" string => execresult("$(sys.cf_agent) -K $(init.dflags) -f $(this.promise_filename).sub2", "noshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -K $(init.dflags) -f $(this.promise_filename).sub2", + "noshell" + ); + reports: - "$(subout)"; + "$(subout)"; } diff --git a/tests/acceptance/02_classes/01_basic/persistent_timer_policy.cf b/tests/acceptance/02_classes/01_basic/persistent_timer_policy.cf index 30997d2a92..ce4af93117 100644 --- a/tests/acceptance/02_classes/01_basic/persistent_timer_policy.cf +++ b/tests/acceptance/02_classes/01_basic/persistent_timer_policy.cf @@ -21,31 +21,27 @@ # FAIL report during the agent's convergence passes. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { # Remove the persistent class DB to ensure a clean state. files: - "$(sys.workdir)/state/cf_state.lmdb" - delete => tidy; - "$(sys.workdir)/state/cf_state.lmdb-lock" - delete => tidy; - "$(sys.workdir)/state/cf_state.lmdb.lock" - delete => tidy; + "$(sys.workdir)/state/cf_state.lmdb" delete => tidy; + "$(sys.workdir)/state/cf_state.lmdb-lock" delete => tidy; + "$(sys.workdir)/state/cf_state.lmdb.lock" delete => tidy; } bundle agent test { meta: - "description" -> { "CFE-4681" } - string => "timer_policy => absolute (default) on classes: promises preserves the timer; the promise is skipped (not evaluated) when the class is already defined"; + "description" -> { "CFE-4681" } + string => "timer_policy => absolute (default) on classes: promises preserves the timer; the promise is skipped (not evaluated) when the class is already defined"; commands: # First run: define the persistent class with timer_policy => "absolute". @@ -67,26 +63,42 @@ bundle agent test bundle agent check { classes: - # Run 1 creates the persistent class with the preserve (absolute) policy. - "create_ok" expression => regline(".*Creating persistent class.*timer_policy_test_class.*policy preserve.*", - "$(G.testdir)/timer_policy_run1.log"); - # Run 2 must skip the promise because the class is already defined. - "skip_ok" expression => regline(".*Skipping evaluation of classes promise as class.*timer_policy_test_class.*is already set.*", - "$(G.testdir)/timer_policy_run2.log"); - # Run 2 must NOT reset the timer (no EvalContextHeapPersistentSave call). - "reset_seen" expression => regline(".*Resetting persistent class.*timer_policy_test_class.*", - "$(G.testdir)/timer_policy_run2.log"); - "ok" expression => "create_ok.skip_ok.!reset_seen"; + # Run 1 creates the persistent class with the preserve (absolute) policy. + "create_ok" + expression => regline( + ".*Creating persistent class.*timer_policy_test_class.*policy preserve.*", + "$(G.testdir)/timer_policy_run1.log" + ); + + # Run 2 must skip the promise because the class is already defined. + "skip_ok" + expression => regline( + ".*Skipping evaluation of classes promise as class.*timer_policy_test_class.*is already set.*", + "$(G.testdir)/timer_policy_run2.log" + ); + + # Run 2 must NOT reset the timer (no EvalContextHeapPersistentSave call). + "reset_seen" + expression => regline( + ".*Resetting persistent class.*timer_policy_test_class.*", + "$(G.testdir)/timer_policy_run2.log" + ); + + "ok" expression => "create_ok.skip_ok.!reset_seen"; reports: DEBUG.!create_ok:: "FAIL: first run did not log 'Creating persistent class ... policy preserve'"; + DEBUG.!skip_ok:: "FAIL: second run did not skip the classes promise (expected 'Skipping evaluation of classes promise ... is already set')"; + DEBUG.reset_seen:: "FAIL: second run reset the timer despite timer_policy => absolute"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/persistent_timer_policy_default.cf b/tests/acceptance/02_classes/01_basic/persistent_timer_policy_default.cf index fca2f2cda6..492c9088f9 100644 --- a/tests/acceptance/02_classes/01_basic/persistent_timer_policy_default.cf +++ b/tests/acceptance/02_classes/01_basic/persistent_timer_policy_default.cf @@ -20,31 +20,27 @@ # report during the agent's convergence passes. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { # Remove the persistent class DB to ensure a clean state. files: - "$(sys.workdir)/state/cf_state.lmdb" - delete => tidy; - "$(sys.workdir)/state/cf_state.lmdb-lock" - delete => tidy; - "$(sys.workdir)/state/cf_state.lmdb.lock" - delete => tidy; + "$(sys.workdir)/state/cf_state.lmdb" delete => tidy; + "$(sys.workdir)/state/cf_state.lmdb-lock" delete => tidy; + "$(sys.workdir)/state/cf_state.lmdb.lock" delete => tidy; } bundle agent test { meta: - "description" -> { "CFE-4681" } - string => "classes: promises default to timer_policy => reset, resetting the persistence timer on subsequent runs"; + "description" -> { "CFE-4681" } + string => "classes: promises default to timer_policy => reset, resetting the persistence timer on subsequent runs"; commands: # First run: define the persistent class (no timer_policy). @@ -65,25 +61,36 @@ bundle agent test bundle agent check { classes: - "first_ok" expression => regline(".*Creating persistent class.*timer_default_test_class.*", - "$(G.testdir)/timer_default_run1.log"); - # Match the EvalContextHeapPersistentSave message specifically (it - # reports "... timer to N minutes (was M remaining)"). This only - # appears when the existing DB record is actually found, so it would - # NOT match the "C: + Resetting persistent class timer: ..." progress - # line that VerifyClassPromise logs regardless. This distinction is - # what makes the test catch a broken existing-record lookup. - "second_ok" expression => regline(".*Resetting persistent class 'timer_default_test_class' timer to.*", - "$(G.testdir)/timer_default_run2.log"); - "ok" expression => "first_ok.second_ok"; + "first_ok" + expression => regline( + ".*Creating persistent class.*timer_default_test_class.*", + "$(G.testdir)/timer_default_run1.log" + ); + + # Match the EvalContextHeapPersistentSave message specifically (it + # reports "... timer to N minutes (was M remaining)"). This only + # appears when the existing DB record is actually found, so it would + # NOT match the "C: + Resetting persistent class timer: ..." progress + # line that VerifyClassPromise logs regardless. This distinction is + # what makes the test catch a broken existing-record lookup. + "second_ok" + expression => regline( + ".*Resetting persistent class 'timer_default_test_class' timer to.*", + "$(G.testdir)/timer_default_run2.log" + ); + + "ok" expression => "first_ok.second_ok"; reports: DEBUG.!first_ok:: "FAIL: first run did not log 'Creating persistent class'"; + DEBUG.!second_ok:: "FAIL: second run did not log 'Resetting persistent class' (default reset not applied)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/persistent_timer_policy_default_lmdb.cf b/tests/acceptance/02_classes/01_basic/persistent_timer_policy_default_lmdb.cf index da2050e9d1..775c583ef0 100644 --- a/tests/acceptance/02_classes/01_basic/persistent_timer_policy_default_lmdb.cf +++ b/tests/acceptance/02_classes/01_basic/persistent_timer_policy_default_lmdb.cf @@ -29,35 +29,31 @@ # and "policy" fields (cf-check/dump.c, print_struct_persistent_class). # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { # Remove the persistent class DB to ensure a clean state. files: - "$(sys.workdir)/state/cf_state.lmdb" - delete => tidy; - "$(sys.workdir)/state/cf_state.lmdb-lock" - delete => tidy; - "$(sys.workdir)/state/cf_state.lmdb.lock" - delete => tidy; + "$(sys.workdir)/state/cf_state.lmdb" delete => tidy; + "$(sys.workdir)/state/cf_state.lmdb-lock" delete => tidy; + "$(sys.workdir)/state/cf_state.lmdb.lock" delete => tidy; } bundle agent test { meta: - "description" -> { "CFE-4681" } - string => "classes: promises default to timer_policy => reset, observable in the cf_state LMDB (stored policy RESET; persistence-timer expiry advances on re-evaluation)"; + "description" -> { "CFE-4681" } + string => "classes: promises default to timer_policy => reset, observable in the cf_state LMDB (stored policy RESET; persistence-timer expiry advances on re-evaluation)"; vars: - "state" string => "$(sys.workdir)/state/cf_state.lmdb"; - "sub" string => "$(this.promise_filename).sub"; + "state" string => "$(sys.workdir)/state/cf_state.lmdb"; + "sub" string => "$(this.promise_filename).sub"; commands: # One shell invocation runs the whole sequence so it converges in a @@ -82,36 +78,41 @@ bundle agent test bundle agent check { vars: - "policy" string => readfile("$(G.testdir)/lmdb_policy", 4096); - "e1" string => readfile("$(G.testdir)/lmdb_expires1", 4096); - "e2" string => readfile("$(G.testdir)/lmdb_expires2", 4096); + "policy" string => readfile("$(G.testdir)/lmdb_policy", 4096); + "e1" string => readfile("$(G.testdir)/lmdb_expires1", 4096); + "e2" string => readfile("$(G.testdir)/lmdb_expires2", 4096); classes: - # #1 The default classes: promise stored its persistent class with - # policy RESET (an explicit "absolute" would store PRESERVE). - "policy_is_reset" expression => strcmp("$(policy)", "RESET"); + # #1 The default classes: promise stored its persistent class with + # policy RESET (an explicit "absolute" would store PRESERVE). + "policy_is_reset" expression => strcmp("$(policy)", "RESET"); - # Guard the numeric compare: both snapshots must be non-empty integers. - "have_expiries" expression => and(regcmp("[0-9]+", "$(e1)"), - regcmp("[0-9]+", "$(e2)")); + # Guard the numeric compare: both snapshots must be non-empty integers. + "have_expiries" + expression => and(regcmp("[0-9]+", "$(e1)"), regcmp("[0-9]+", "$(e2)")); - # #2 The stored expiry advanced between the two runs -> the persistence - # timer was actually reset (PRESERVE would leave it identical). - "timer_advanced" expression => eval("$(e2) > $(e1)", "class", "infix"), - if => "have_expiries"; + # #2 The stored expiry advanced between the two runs -> the persistence + # timer was actually reset (PRESERVE would leave it identical). + "timer_advanced" + expression => eval("$(e2) > $(e1)", "class", "infix"), + if => "have_expiries"; - "ok" expression => "policy_is_reset.timer_advanced"; + "ok" expression => "policy_is_reset.timer_advanced"; reports: DEBUG:: "stored policy = '$(policy)' (expect RESET)"; "expiry run1 = '$(e1)', run2 = '$(e2)' (expect run2 > run1)"; + DEBUG.!policy_is_reset:: "FAIL: persistent class not stored with policy RESET (default reset not applied)"; + DEBUG.!timer_advanced:: "FAIL: persistence-timer expiry did not advance (timer not reset)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/persistent_timer_policy_reset.cf b/tests/acceptance/02_classes/01_basic/persistent_timer_policy_reset.cf index 925fb38c9e..fc38138f3c 100644 --- a/tests/acceptance/02_classes/01_basic/persistent_timer_policy_reset.cf +++ b/tests/acceptance/02_classes/01_basic/persistent_timer_policy_reset.cf @@ -15,31 +15,27 @@ # report during the agent's convergence passes. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { # Remove the persistent class DB to ensure a clean state. files: - "$(sys.workdir)/state/cf_state.lmdb" - delete => tidy; - "$(sys.workdir)/state/cf_state.lmdb-lock" - delete => tidy; - "$(sys.workdir)/state/cf_state.lmdb.lock" - delete => tidy; + "$(sys.workdir)/state/cf_state.lmdb" delete => tidy; + "$(sys.workdir)/state/cf_state.lmdb-lock" delete => tidy; + "$(sys.workdir)/state/cf_state.lmdb.lock" delete => tidy; } bundle agent test { meta: - "description" -> { "CFE-4681" } - string => "timer_policy => reset on classes: promises resets the persistence timer on subsequent runs"; + "description" -> { "CFE-4681" } + string => "timer_policy => reset on classes: promises resets the persistence timer on subsequent runs"; commands: # First run: define the persistent class. @@ -59,25 +55,36 @@ bundle agent test bundle agent check { classes: - "first_ok" expression => regline(".*Creating persistent class.*timer_reset_test_class.*", - "$(G.testdir)/timer_reset_run1.log"); - # Match the EvalContextHeapPersistentSave message specifically (it - # reports "... timer to N minutes (was M remaining)"). This only - # appears when the existing DB record is actually found, so it would - # NOT match the "C: + Resetting persistent class timer: ..." progress - # line that VerifyClassPromise logs regardless. This distinction is - # what makes the test catch a broken existing-record lookup. - "second_ok" expression => regline(".*Resetting persistent class 'timer_reset_test_class' timer to.*", - "$(G.testdir)/timer_reset_run2.log"); - "ok" expression => "first_ok.second_ok"; + "first_ok" + expression => regline( + ".*Creating persistent class.*timer_reset_test_class.*", + "$(G.testdir)/timer_reset_run1.log" + ); + + # Match the EvalContextHeapPersistentSave message specifically (it + # reports "... timer to N minutes (was M remaining)"). This only + # appears when the existing DB record is actually found, so it would + # NOT match the "C: + Resetting persistent class timer: ..." progress + # line that VerifyClassPromise logs regardless. This distinction is + # what makes the test catch a broken existing-record lookup. + "second_ok" + expression => regline( + ".*Resetting persistent class 'timer_reset_test_class' timer to.*", + "$(G.testdir)/timer_reset_run2.log" + ); + + "ok" expression => "first_ok.second_ok"; reports: DEBUG.!first_ok:: "FAIL: first run did not log 'Creating persistent class'"; + DEBUG.!second_ok:: "FAIL: second run did not log 'Resetting persistent class' (short-circuit not bypassed)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/rbtree_collisions-redmine7912.cf b/tests/acceptance/02_classes/01_basic/rbtree_collisions-redmine7912.cf index 4050a5ff4e..87dd0185c3 100644 --- a/tests/acceptance/02_classes/01_basic/rbtree_collisions-redmine7912.cf +++ b/tests/acceptance/02_classes/01_basic/rbtree_collisions-redmine7912.cf @@ -1,63 +1,62 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { - classes: + "legumes" expression => "any"; + "kumiss" expression => "any"; - "legumes" expression => "any"; - "kumiss" expression => "any"; - "range_class_prod_ltx1_seas_groupdiscussions_indexer_4_PRODUCTVERSION__0_1_86_" expression => "any"; - - "right_classes_set" expression => "legumes.kumiss.range_class_prod_ltx1_seas_groupdiscussions_indexer_4_PRODUCTVERSION__0_1_86_"; - "wrong_classes_set" expression => "goosey|ungoverned|ipv4_10_132_60"; + "range_class_prod_ltx1_seas_groupdiscussions_indexer_4_PRODUCTVERSION__0_1_86_" + expression => "any"; - "ok" expression => "right_classes_set.!wrong_classes_set"; + "right_classes_set" + expression => "legumes.kumiss.range_class_prod_ltx1_seas_groupdiscussions_indexer_4_PRODUCTVERSION__0_1_86_"; + "wrong_classes_set" expression => "goosey|ungoverned|ipv4_10_132_60"; + "ok" expression => "right_classes_set.!wrong_classes_set"; reports: - DEBUG.legumes:: "Pass legumes"; + DEBUG.goosey:: "FAIL goosey"; DEBUG.kumiss:: "Pass kumiss"; + DEBUG.ungoverned:: "FAIL ungoverned"; DEBUG.range_class_prod_ltx1_seas_groupdiscussions_indexer_4_PRODUCTVERSION__0_1_86_:: "PASS range_class_prod_ltx1_seas_groupdiscussions_indexer_4_PRODUCTVERSION__0_1_86_"; + DEBUG.ipv4_10_132_60:: "FAIL ipv4_10_132_60"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; - } diff --git a/tests/acceptance/02_classes/01_basic/simplistic_ipaddr_classes.cf b/tests/acceptance/02_classes/01_basic/simplistic_ipaddr_classes.cf index 784225d3e9..a7fc1b27a7 100644 --- a/tests/acceptance/02_classes/01_basic/simplistic_ipaddr_classes.cf +++ b/tests/acceptance/02_classes/01_basic/simplistic_ipaddr_classes.cf @@ -3,15 +3,13 @@ # Test that simplistic IP-address classes are set (e.g., 192_168_56_10) # ############################################################################## - body common control { - bundlesequence => { "test", "check" }; - version => "1.0"; + bundlesequence => { "test", "check" }; + version => "1.0"; } ############################################################################## - bundle agent test { meta: @@ -19,17 +17,14 @@ bundle agent test string => "Test that simplistic IP classes are set"; vars: - "ip_classes" - slist => maplist(canonify("$(this)"), "@(sys.ip_addresses)"); + "ip_classes" slist => maplist(canonify("$(this)"), "@(sys.ip_addresses)"); } ############################################################################## - bundle agent check { classes: - "ok" - and => { "@(test.ip_classes)" }; + "ok" and => { "@(test.ip_classes)" }; reports: ok:: @@ -39,6 +34,5 @@ bundle agent check "$(this.promise_filename) FAIL"; DEBUG:: - "IP Classes: $(with)" - with => join(", ", "test.ip_classes"); + "IP Classes: $(with)" with => join(", ", "test.ip_classes"); } diff --git a/tests/acceptance/02_classes/01_basic/staging/028.cf b/tests/acceptance/02_classes/01_basic/staging/028.cf index caff713f96..b558d274fa 100644 --- a/tests/acceptance/02_classes/01_basic/staging/028.cf +++ b/tests/acceptance/02_classes/01_basic/staging/028.cf @@ -4,337 +4,623 @@ # See associated C file to generate mutually exclusive classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { classes: - "classtotest" expression => "any"; + "classtotest" expression => "any"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - # The program 028.c generates this list, and exactly 1 class will - # be True at any time of day - "ok" xor => { - splayclass("AT","daily"), # Box 0 - splayclass("AA","daily"), # Box 1 - splayclass("AH","daily"), # Box 2 - splayclass("AZ","daily"), # Box 3 - splayclass("Cd","daily"), # Box 4 - splayclass("CV","daily"), # Box 5 - splayclass("Am","daily"), # Box 6 - splayclass("EH","daily"), # Box 7 - splayclass("Bh","daily"), # Box 8 - splayclass("HF","daily"), # Box 9 - splayclass("Bz","daily"), # Box 10 - splayclass("CM","daily"), # Box 11 - splayclass("OR","daily"), # Box 12 - splayclass("FK","daily"), # Box 13 - splayclass("Ay","daily"), # Box 14 - splayclass("Cc","daily"), # Box 15 - splayclass("IF","daily"), # Box 16 - splayclass("IA","daily"), # Box 17 - splayclass("HP","daily"), # Box 18 - splayclass("Et","daily"), # Box 19 - splayclass("Ga","daily"), # Box 20 - splayclass("EF","daily"), # Box 21 - splayclass("DS","daily"), # Box 22 - splayclass("Ee","daily"), # Box 23 - splayclass("BI","daily"), # Box 24 - splayclass("CH","daily"), # Box 25 - splayclass("AS","daily"), # Box 26 - splayclass("Gd","daily"), # Box 27 - splayclass("Dm","daily"), # Box 28 - splayclass("CA","daily"), # Box 29 - splayclass("FZ","daily"), # Box 30 - splayclass("Gv","daily"), # Box 31 - splayclass("ES","daily"), # Box 32 - splayclass("Db","daily"), # Box 33 - splayclass("BS","daily"), # Box 34 - splayclass("KP","daily"), # Box 35 - splayclass("EZ","daily"), # Box 36 - splayclass("Ax","daily"), # Box 37 - splayclass("An","daily"), # Box 38 - splayclass("Mq","daily"), # Box 39 - splayclass("Bw","daily"), # Box 40 - splayclass("BL","daily"), # Box 41 - splayclass("AI","daily"), # Box 42 - splayclass("CN","daily"), # Box 43 - splayclass("Aw","daily"), # Box 44 - splayclass("Ce","daily"), # Box 45 - splayclass("Mh","daily"), # Box 46 - splayclass("Gs","daily"), # Box 47 - splayclass("He","daily"), # Box 48 - splayclass("Ex","daily"), # Box 49 - splayclass("KJ","daily"), # Box 50 - splayclass("GN","daily"), # Box 51 - splayclass("Bm","daily"), # Box 52 - splayclass("Iy","daily"), # Box 53 - splayclass("JG","daily"), # Box 54 - splayclass("Po","daily"), # Box 55 - splayclass("CF","daily"), # Box 56 - splayclass("Fg","daily"), # Box 57 - splayclass("KQ","daily"), # Box 58 - splayclass("AB","daily"), # Box 59 - splayclass("Cq","daily"), # Box 60 - splayclass("KX","daily"), # Box 61 - splayclass("ER","daily"), # Box 62 - splayclass("De","daily"), # Box 63 - splayclass("Fn","daily"), # Box 64 - splayclass("Bn","daily"), # Box 65 - splayclass("DZ","daily"), # Box 66 - splayclass("DA","daily"), # Box 67 - splayclass("Ag","daily"), # Box 68 - splayclass("Bi","daily"), # Box 69 - splayclass("Ki","daily"), # Box 70 - splayclass("Kw","daily"), # Box 71 - splayclass("Ed","daily"), # Box 72 - splayclass("In","daily"), # Box 73 - splayclass("CC","daily"), # Box 74 - splayclass("Dy","daily"), # Box 75 - splayclass("OB","daily"), # Box 76 - splayclass("DU","daily"), # Box 77 - splayclass("Cj","daily"), # Box 78 - splayclass("EC","daily"), # Box 79 - splayclass("Gr","daily"), # Box 80 - splayclass("AO","daily"), # Box 81 - splayclass("Bf","daily"), # Box 82 - splayclass("Gk","daily"), # Box 83 - splayclass("AX","daily"), # Box 84 - splayclass("Ar","daily"), # Box 85 - splayclass("Hq","daily"), # Box 86 - splayclass("Ac","daily"), # Box 87 - splayclass("BG","daily"), # Box 88 - splayclass("Dq","daily"), # Box 89 - splayclass("AY","daily"), # Box 90 - splayclass("BY","daily"), # Box 91 - splayclass("Cn","daily"), # Box 92 - splayclass("BJ","daily"), # Box 93 - splayclass("Yu","daily"), # Box 94 - splayclass("DC","daily"), # Box 95 - splayclass("Dd","daily"), # Box 96 - splayclass("Ca","daily"), # Box 97 - splayclass("Kc","daily"), # Box 98 - splayclass("Op","daily"), # Box 99 - splayclass("PV","daily"), # Box 100 - splayclass("MJ","daily"), # Box 101 - splayclass("GE","daily"), # Box 102 - splayclass("EJ","daily"), # Box 103 - splayclass("Hh","daily"), # Box 104 - splayclass("CJ","daily"), # Box 105 - splayclass("Ev","daily"), # Box 106 - splayclass("Cw","daily"), # Box 107 - splayclass("Cb","daily"), # Box 108 - splayclass("Eh","daily"), # Box 109 - splayclass("Bt","daily"), # Box 110 - splayclass("EB","daily"), # Box 111 - splayclass("Fo","daily"), # Box 112 - splayclass("Nb","daily"), # Box 113 - splayclass("HG","daily"), # Box 114 - splayclass("KD","daily"), # Box 115 - splayclass("DW","daily"), # Box 116 - splayclass("Ak","daily"), # Box 117 - splayclass("Cp","daily"), # Box 118 - splayclass("Ae","daily"), # Box 119 - splayclass("Bg","daily"), # Box 120 - splayclass("Qq","daily"), # Box 121 - splayclass("PC","daily"), # Box 122 - splayclass("CL","daily"), # Box 123 - splayclass("HA","daily"), # Box 124 - splayclass("Aq","daily"), # Box 125 - splayclass("Ef","daily"), # Box 126 - splayclass("PJ","daily"), # Box 127 - splayclass("BA","daily"), # Box 128 - splayclass("Dp","daily"), # Box 129 - splayclass("DK","daily"), # Box 130 - splayclass("Gq","daily"), # Box 131 - splayclass("GW","daily"), # Box 132 - splayclass("Hp","daily"), # Box 133 - splayclass("BK","daily"), # Box 134 - splayclass("NY","daily"), # Box 135 - splayclass("NP","daily"), # Box 136 - splayclass("CB","daily"), # Box 137 - splayclass("CI","daily"), # Box 138 - splayclass("AR","daily"), # Box 139 - splayclass("Pb","daily"), # Box 140 - splayclass("Co","daily"), # Box 141 - splayclass("Ms","daily"), # Box 142 - splayclass("Oq","daily"), # Box 143 - splayclass("Pt","daily"), # Box 144 - splayclass("RQ","daily"), # Box 145 - splayclass("AF","daily"), # Box 146 - splayclass("Fs","daily"), # Box 147 - splayclass("DO","daily"), # Box 148 - splayclass("Cu","daily"), # Box 149 - splayclass("Ds","daily"), # Box 150 - splayclass("Tv","daily"), # Box 151 - splayclass("Ys","daily"), # Box 152 - splayclass("BW","daily"), # Box 153 - splayclass("BP","daily"), # Box 154 - splayclass("cV","daily"), # Box 155 - splayclass("DE","daily"), # Box 156 - splayclass("Fz","daily"), # Box 157 - splayclass("EM","daily"), # Box 158 - splayclass("DL","daily"), # Box 159 - splayclass("cM","daily"), # Box 160 - splayclass("BD","daily"), # Box 161 - splayclass("Bd","daily"), # Box 162 - splayclass("GC","daily"), # Box 163 - splayclass("AE","daily"), # Box 164 - splayclass("Ho","daily"), # Box 165 - splayclass("JE","daily"), # Box 166 - splayclass("CZ","daily"), # Box 167 - splayclass("RG","daily"), # Box 168 - splayclass("As","daily"), # Box 169 - splayclass("Ai","daily"), # Box 170 - splayclass("IT","daily"), # Box 171 - splayclass("Cg","daily"), # Box 172 - splayclass("Cl","daily"), # Box 173 - splayclass("JS","daily"), # Box 174 - splayclass("FO","daily"), # Box 175 - splayclass("HO","daily"), # Box 176 - splayclass("Bq","daily"), # Box 177 - splayclass("OH","daily"), # Box 178 - splayclass("DN","daily"), # Box 179 - splayclass("Hx","daily"), # Box 180 - splayclass("CK","daily"), # Box 181 - splayclass("NC","daily"), # Box 182 - splayclass("PO","daily"), # Box 183 - splayclass("Dz","daily"), # Box 184 - splayclass("Eq","daily"), # Box 185 - splayclass("AG","daily"), # Box 186 - splayclass("Ke","daily"), # Box 187 - splayclass("DT","daily"), # Box 188 - splayclass("EY","daily"), # Box 189 - splayclass("BE","daily"), # Box 190 - splayclass("Br","daily"), # Box 191 - splayclass("Qk","daily"), # Box 192 - splayclass("Jw","daily"), # Box 193 - splayclass("KM","daily"), # Box 194 - splayclass("AP","daily"), # Box 195 - splayclass("DY","daily"), # Box 196 - splayclass("Jz","daily"), # Box 197 - splayclass("Hi","daily"), # Box 198 - splayclass("AM","daily"), # Box 199 - splayclass("WQ","daily"), # Box 200 - splayclass("Cv","daily"), # Box 201 - splayclass("BQ","daily"), # Box 202 - splayclass("Fu","daily"), # Box 203 - splayclass("CR","daily"), # Box 204 - splayclass("JQ","daily"), # Box 205 - splayclass("FN","daily"), # Box 206 - splayclass("QW","daily"), # Box 207 - splayclass("Fb","daily"), # Box 208 - splayclass("DB","daily"), # Box 209 - splayclass("OI","daily"), # Box 210 - splayclass("Ei","daily"), # Box 211 - splayclass("FY","daily"), # Box 212 - splayclass("Cm","daily"), # Box 213 - splayclass("IE","daily"), # Box 214 - splayclass("HM","daily"), # Box 215 - splayclass("BN","daily"), # Box 216 - splayclass("BT","daily"), # Box 217 - splayclass("HD","daily"), # Box 218 - splayclass("GK","daily"), # Box 219 - splayclass("BB","daily"), # Box 220 - splayclass("Bo","daily"), # Box 221 - splayclass("EV","daily"), # Box 222 - splayclass("Ht","daily"), # Box 223 - splayclass("BM","daily"), # Box 224 - splayclass("Lk","daily"), # Box 225 - splayclass("Er","daily"), # Box 226 - splayclass("AD","daily"), # Box 227 - splayclass("GI","daily"), # Box 228 - splayclass("SX","daily"), # Box 229 - splayclass("JH","daily"), # Box 230 - splayclass("IZ","daily"), # Box 231 - splayclass("Cs","daily"), # Box 232 - splayclass("Ym","daily"), # Box 233 - splayclass("DI","daily"), # Box 234 - splayclass("Oo","daily"), # Box 235 - splayclass("LK","daily"), # Box 236 - splayclass("DX","daily"), # Box 237 - splayclass("HR","daily"), # Box 238 - splayclass("Fj","daily"), # Box 239 - splayclass("XC","daily"), # Box 240 - splayclass("AV","daily"), # Box 241 - splayclass("AC","daily"), # Box 242 - splayclass("CW","daily"), # Box 243 - splayclass("AJ","daily"), # Box 244 - splayclass("Av","daily"), # Box 245 - splayclass("CX","daily"), # Box 246 - splayclass("ED","daily"), # Box 247 - splayclass("HE","daily"), # Box 248 - splayclass("Ao","daily"), # Box 249 - splayclass("Gm","daily"), # Box 250 - splayclass("BC","daily"), # Box 251 - splayclass("EN","daily"), # Box 252 - splayclass("EP","daily"), # Box 253 - splayclass("FQ","daily"), # Box 254 - splayclass("Dt","daily"), # Box 255 - splayclass("RC","daily"), # Box 256 - splayclass("Ib","daily"), # Box 257 - splayclass("JI","daily"), # Box 258 - splayclass("BU","daily"), # Box 259 - splayclass("BV","daily"), # Box 260 - splayclass("Xp","daily"), # Box 261 - splayclass("GA","daily"), # Box 262 - splayclass("NE","daily"), # Box 263 - splayclass("Mo","daily"), # Box 264 - splayclass("CE","daily"), # Box 265 - splayclass("AL","daily"), # Box 266 - splayclass("Es","daily"), # Box 267 - splayclass("Py","daily"), # Box 268 - splayclass("Hl","daily"), # Box 269 - splayclass("IC","daily"), # Box 270 - splayclass("Bp","daily"), # Box 271 - splayclass("Iz","daily"), # Box 272 - splayclass("HU","daily"), # Box 273 - splayclass("DQ","daily"), # Box 274 - splayclass("EI","daily"), # Box 275 - splayclass("Cf","daily"), # Box 276 - splayclass("GH","daily"), # Box 277 - splayclass("Aa","daily"), # Box 278 - splayclass("EG","daily"), # Box 279 - splayclass("Ct","daily"), # Box 280 - splayclass("Gl","daily"), # Box 281 - splayclass("AW","daily"), # Box 282 - splayclass("CP","daily"), # Box 283 - splayclass("CO","daily"), # Box 284 - splayclass("AK","daily"), # Box 285 - splayclass("BZ","daily"), # Box 286 - splayclass("Fk","daily"), # Box 287 + # The program 028.c generates this list, and exactly 1 class will + # be True at any time of day + "ok" + xor => { + splayclass("AT", "daily"), + # Box 0 + splayclass("AA", "daily"), + # Box 1 + splayclass("AH", "daily"), + # Box 2 + splayclass("AZ", "daily"), + # Box 3 + splayclass("Cd", "daily"), + # Box 4 + splayclass("CV", "daily"), + # Box 5 + splayclass("Am", "daily"), + # Box 6 + splayclass("EH", "daily"), + # Box 7 + splayclass("Bh", "daily"), + # Box 8 + splayclass("HF", "daily"), + # Box 9 + splayclass("Bz", "daily"), + # Box 10 + splayclass("CM", "daily"), + # Box 11 + splayclass("OR", "daily"), + # Box 12 + splayclass("FK", "daily"), + # Box 13 + splayclass("Ay", "daily"), + # Box 14 + splayclass("Cc", "daily"), + # Box 15 + splayclass("IF", "daily"), + # Box 16 + splayclass("IA", "daily"), + # Box 17 + splayclass("HP", "daily"), + # Box 18 + splayclass("Et", "daily"), + # Box 19 + splayclass("Ga", "daily"), + # Box 20 + splayclass("EF", "daily"), + # Box 21 + splayclass("DS", "daily"), + # Box 22 + splayclass("Ee", "daily"), + # Box 23 + splayclass("BI", "daily"), + # Box 24 + splayclass("CH", "daily"), + # Box 25 + splayclass("AS", "daily"), + # Box 26 + splayclass("Gd", "daily"), + # Box 27 + splayclass("Dm", "daily"), + # Box 28 + splayclass("CA", "daily"), + # Box 29 + splayclass("FZ", "daily"), + # Box 30 + splayclass("Gv", "daily"), + # Box 31 + splayclass("ES", "daily"), + # Box 32 + splayclass("Db", "daily"), + # Box 33 + splayclass("BS", "daily"), + # Box 34 + splayclass("KP", "daily"), + # Box 35 + splayclass("EZ", "daily"), + # Box 36 + splayclass("Ax", "daily"), + # Box 37 + splayclass("An", "daily"), + # Box 38 + splayclass("Mq", "daily"), + # Box 39 + splayclass("Bw", "daily"), + # Box 40 + splayclass("BL", "daily"), + # Box 41 + splayclass("AI", "daily"), + # Box 42 + splayclass("CN", "daily"), + # Box 43 + splayclass("Aw", "daily"), + # Box 44 + splayclass("Ce", "daily"), + # Box 45 + splayclass("Mh", "daily"), + # Box 46 + splayclass("Gs", "daily"), + # Box 47 + splayclass("He", "daily"), + # Box 48 + splayclass("Ex", "daily"), + # Box 49 + splayclass("KJ", "daily"), + # Box 50 + splayclass("GN", "daily"), + # Box 51 + splayclass("Bm", "daily"), + # Box 52 + splayclass("Iy", "daily"), + # Box 53 + splayclass("JG", "daily"), + # Box 54 + splayclass("Po", "daily"), + # Box 55 + splayclass("CF", "daily"), + # Box 56 + splayclass("Fg", "daily"), + # Box 57 + splayclass("KQ", "daily"), + # Box 58 + splayclass("AB", "daily"), + # Box 59 + splayclass("Cq", "daily"), + # Box 60 + splayclass("KX", "daily"), + # Box 61 + splayclass("ER", "daily"), + # Box 62 + splayclass("De", "daily"), + # Box 63 + splayclass("Fn", "daily"), + # Box 64 + splayclass("Bn", "daily"), + # Box 65 + splayclass("DZ", "daily"), + # Box 66 + splayclass("DA", "daily"), + # Box 67 + splayclass("Ag", "daily"), + # Box 68 + splayclass("Bi", "daily"), + # Box 69 + splayclass("Ki", "daily"), + # Box 70 + splayclass("Kw", "daily"), + # Box 71 + splayclass("Ed", "daily"), + # Box 72 + splayclass("In", "daily"), + # Box 73 + splayclass("CC", "daily"), + # Box 74 + splayclass("Dy", "daily"), + # Box 75 + splayclass("OB", "daily"), + # Box 76 + splayclass("DU", "daily"), + # Box 77 + splayclass("Cj", "daily"), + # Box 78 + splayclass("EC", "daily"), + # Box 79 + splayclass("Gr", "daily"), + # Box 80 + splayclass("AO", "daily"), + # Box 81 + splayclass("Bf", "daily"), + # Box 82 + splayclass("Gk", "daily"), + # Box 83 + splayclass("AX", "daily"), + # Box 84 + splayclass("Ar", "daily"), + # Box 85 + splayclass("Hq", "daily"), + # Box 86 + splayclass("Ac", "daily"), + # Box 87 + splayclass("BG", "daily"), + # Box 88 + splayclass("Dq", "daily"), + # Box 89 + splayclass("AY", "daily"), + # Box 90 + splayclass("BY", "daily"), + # Box 91 + splayclass("Cn", "daily"), + # Box 92 + splayclass("BJ", "daily"), + # Box 93 + splayclass("Yu", "daily"), + # Box 94 + splayclass("DC", "daily"), + # Box 95 + splayclass("Dd", "daily"), + # Box 96 + splayclass("Ca", "daily"), + # Box 97 + splayclass("Kc", "daily"), + # Box 98 + splayclass("Op", "daily"), + # Box 99 + splayclass("PV", "daily"), + # Box 100 + splayclass("MJ", "daily"), + # Box 101 + splayclass("GE", "daily"), + # Box 102 + splayclass("EJ", "daily"), + # Box 103 + splayclass("Hh", "daily"), + # Box 104 + splayclass("CJ", "daily"), + # Box 105 + splayclass("Ev", "daily"), + # Box 106 + splayclass("Cw", "daily"), + # Box 107 + splayclass("Cb", "daily"), + # Box 108 + splayclass("Eh", "daily"), + # Box 109 + splayclass("Bt", "daily"), + # Box 110 + splayclass("EB", "daily"), + # Box 111 + splayclass("Fo", "daily"), + # Box 112 + splayclass("Nb", "daily"), + # Box 113 + splayclass("HG", "daily"), + # Box 114 + splayclass("KD", "daily"), + # Box 115 + splayclass("DW", "daily"), + # Box 116 + splayclass("Ak", "daily"), + # Box 117 + splayclass("Cp", "daily"), + # Box 118 + splayclass("Ae", "daily"), + # Box 119 + splayclass("Bg", "daily"), + # Box 120 + splayclass("Qq", "daily"), + # Box 121 + splayclass("PC", "daily"), + # Box 122 + splayclass("CL", "daily"), + # Box 123 + splayclass("HA", "daily"), + # Box 124 + splayclass("Aq", "daily"), + # Box 125 + splayclass("Ef", "daily"), + # Box 126 + splayclass("PJ", "daily"), + # Box 127 + splayclass("BA", "daily"), + # Box 128 + splayclass("Dp", "daily"), + # Box 129 + splayclass("DK", "daily"), + # Box 130 + splayclass("Gq", "daily"), + # Box 131 + splayclass("GW", "daily"), + # Box 132 + splayclass("Hp", "daily"), + # Box 133 + splayclass("BK", "daily"), + # Box 134 + splayclass("NY", "daily"), + # Box 135 + splayclass("NP", "daily"), + # Box 136 + splayclass("CB", "daily"), + # Box 137 + splayclass("CI", "daily"), + # Box 138 + splayclass("AR", "daily"), + # Box 139 + splayclass("Pb", "daily"), + # Box 140 + splayclass("Co", "daily"), + # Box 141 + splayclass("Ms", "daily"), + # Box 142 + splayclass("Oq", "daily"), + # Box 143 + splayclass("Pt", "daily"), + # Box 144 + splayclass("RQ", "daily"), + # Box 145 + splayclass("AF", "daily"), + # Box 146 + splayclass("Fs", "daily"), + # Box 147 + splayclass("DO", "daily"), + # Box 148 + splayclass("Cu", "daily"), + # Box 149 + splayclass("Ds", "daily"), + # Box 150 + splayclass("Tv", "daily"), + # Box 151 + splayclass("Ys", "daily"), + # Box 152 + splayclass("BW", "daily"), + # Box 153 + splayclass("BP", "daily"), + # Box 154 + splayclass("cV", "daily"), + # Box 155 + splayclass("DE", "daily"), + # Box 156 + splayclass("Fz", "daily"), + # Box 157 + splayclass("EM", "daily"), + # Box 158 + splayclass("DL", "daily"), + # Box 159 + splayclass("cM", "daily"), + # Box 160 + splayclass("BD", "daily"), + # Box 161 + splayclass("Bd", "daily"), + # Box 162 + splayclass("GC", "daily"), + # Box 163 + splayclass("AE", "daily"), + # Box 164 + splayclass("Ho", "daily"), + # Box 165 + splayclass("JE", "daily"), + # Box 166 + splayclass("CZ", "daily"), + # Box 167 + splayclass("RG", "daily"), + # Box 168 + splayclass("As", "daily"), + # Box 169 + splayclass("Ai", "daily"), + # Box 170 + splayclass("IT", "daily"), + # Box 171 + splayclass("Cg", "daily"), + # Box 172 + splayclass("Cl", "daily"), + # Box 173 + splayclass("JS", "daily"), + # Box 174 + splayclass("FO", "daily"), + # Box 175 + splayclass("HO", "daily"), + # Box 176 + splayclass("Bq", "daily"), + # Box 177 + splayclass("OH", "daily"), + # Box 178 + splayclass("DN", "daily"), + # Box 179 + splayclass("Hx", "daily"), + # Box 180 + splayclass("CK", "daily"), + # Box 181 + splayclass("NC", "daily"), + # Box 182 + splayclass("PO", "daily"), + # Box 183 + splayclass("Dz", "daily"), + # Box 184 + splayclass("Eq", "daily"), + # Box 185 + splayclass("AG", "daily"), + # Box 186 + splayclass("Ke", "daily"), + # Box 187 + splayclass("DT", "daily"), + # Box 188 + splayclass("EY", "daily"), + # Box 189 + splayclass("BE", "daily"), + # Box 190 + splayclass("Br", "daily"), + # Box 191 + splayclass("Qk", "daily"), + # Box 192 + splayclass("Jw", "daily"), + # Box 193 + splayclass("KM", "daily"), + # Box 194 + splayclass("AP", "daily"), + # Box 195 + splayclass("DY", "daily"), + # Box 196 + splayclass("Jz", "daily"), + # Box 197 + splayclass("Hi", "daily"), + # Box 198 + splayclass("AM", "daily"), + # Box 199 + splayclass("WQ", "daily"), + # Box 200 + splayclass("Cv", "daily"), + # Box 201 + splayclass("BQ", "daily"), + # Box 202 + splayclass("Fu", "daily"), + # Box 203 + splayclass("CR", "daily"), + # Box 204 + splayclass("JQ", "daily"), + # Box 205 + splayclass("FN", "daily"), + # Box 206 + splayclass("QW", "daily"), + # Box 207 + splayclass("Fb", "daily"), + # Box 208 + splayclass("DB", "daily"), + # Box 209 + splayclass("OI", "daily"), + # Box 210 + splayclass("Ei", "daily"), + # Box 211 + splayclass("FY", "daily"), + # Box 212 + splayclass("Cm", "daily"), + # Box 213 + splayclass("IE", "daily"), + # Box 214 + splayclass("HM", "daily"), + # Box 215 + splayclass("BN", "daily"), + # Box 216 + splayclass("BT", "daily"), + # Box 217 + splayclass("HD", "daily"), + # Box 218 + splayclass("GK", "daily"), + # Box 219 + splayclass("BB", "daily"), + # Box 220 + splayclass("Bo", "daily"), + # Box 221 + splayclass("EV", "daily"), + # Box 222 + splayclass("Ht", "daily"), + # Box 223 + splayclass("BM", "daily"), + # Box 224 + splayclass("Lk", "daily"), + # Box 225 + splayclass("Er", "daily"), + # Box 226 + splayclass("AD", "daily"), + # Box 227 + splayclass("GI", "daily"), + # Box 228 + splayclass("SX", "daily"), + # Box 229 + splayclass("JH", "daily"), + # Box 230 + splayclass("IZ", "daily"), + # Box 231 + splayclass("Cs", "daily"), + # Box 232 + splayclass("Ym", "daily"), + # Box 233 + splayclass("DI", "daily"), + # Box 234 + splayclass("Oo", "daily"), + # Box 235 + splayclass("LK", "daily"), + # Box 236 + splayclass("DX", "daily"), + # Box 237 + splayclass("HR", "daily"), + # Box 238 + splayclass("Fj", "daily"), + # Box 239 + splayclass("XC", "daily"), + # Box 240 + splayclass("AV", "daily"), + # Box 241 + splayclass("AC", "daily"), + # Box 242 + splayclass("CW", "daily"), + # Box 243 + splayclass("AJ", "daily"), + # Box 244 + splayclass("Av", "daily"), + # Box 245 + splayclass("CX", "daily"), + # Box 246 + splayclass("ED", "daily"), + # Box 247 + splayclass("HE", "daily"), + # Box 248 + splayclass("Ao", "daily"), + # Box 249 + splayclass("Gm", "daily"), + # Box 250 + splayclass("BC", "daily"), + # Box 251 + splayclass("EN", "daily"), + # Box 252 + splayclass("EP", "daily"), + # Box 253 + splayclass("FQ", "daily"), + # Box 254 + splayclass("Dt", "daily"), + # Box 255 + splayclass("RC", "daily"), + # Box 256 + splayclass("Ib", "daily"), + # Box 257 + splayclass("JI", "daily"), + # Box 258 + splayclass("BU", "daily"), + # Box 259 + splayclass("BV", "daily"), + # Box 260 + splayclass("Xp", "daily"), + # Box 261 + splayclass("GA", "daily"), + # Box 262 + splayclass("NE", "daily"), + # Box 263 + splayclass("Mo", "daily"), + # Box 264 + splayclass("CE", "daily"), + # Box 265 + splayclass("AL", "daily"), + # Box 266 + splayclass("Es", "daily"), + # Box 267 + splayclass("Py", "daily"), + # Box 268 + splayclass("Hl", "daily"), + # Box 269 + splayclass("IC", "daily"), + # Box 270 + splayclass("Bp", "daily"), + # Box 271 + splayclass("Iz", "daily"), + # Box 272 + splayclass("HU", "daily"), + # Box 273 + splayclass("DQ", "daily"), + # Box 274 + splayclass("EI", "daily"), + # Box 275 + splayclass("Cf", "daily"), + # Box 276 + splayclass("GH", "daily"), + # Box 277 + splayclass("Aa", "daily"), + # Box 278 + splayclass("EG", "daily"), + # Box 279 + splayclass("Ct", "daily"), + # Box 280 + splayclass("Gl", "daily"), + # Box 281 + splayclass("AW", "daily"), + # Box 282 + splayclass("CP", "daily"), + # Box 283 + splayclass("CO", "daily"), + # Box 284 + splayclass("AK", "daily"), + # Box 285 + splayclass("BZ", "daily"), + # Box 286 + splayclass("Fk", "daily"), + # Box 287 }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/timer_policy_requires_persistence.cf b/tests/acceptance/02_classes/01_basic/timer_policy_requires_persistence.cf index 3e8359c40f..6739d8a36b 100644 --- a/tests/acceptance/02_classes/01_basic/timer_policy_requires_persistence.cf +++ b/tests/acceptance/02_classes/01_basic/timer_policy_requires_persistence.cf @@ -11,19 +11,18 @@ # evaluates assertions against its captured output. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "description" -> { "CFE-4681" } - string => "Using timer_policy without persistence on a classes: promise is an error"; + "description" -> { "CFE-4681" } + string => "Using timer_policy without persistence on a classes: promise is an error"; commands: !done:: @@ -35,15 +34,21 @@ bundle agent test bundle agent check { classes: - "error_ok" expression => regline(".*Cannot use 'timer_policy' without 'persistence'.*timer_policy_no_persistence_class.*", - "$(G.testdir)/timer_policy_no_persistence.log"); - "ok" expression => "error_ok"; + "error_ok" + expression => regline( + ".*Cannot use 'timer_policy' without 'persistence'.*timer_policy_no_persistence_class.*", + "$(G.testdir)/timer_policy_no_persistence.log" + ); + + "ok" expression => "error_ok"; reports: DEBUG.!error_ok:: "FAIL: did not log the expected 'timer_policy without persistence' error"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/01_basic/variable_class_expressions_with_if.cf b/tests/acceptance/02_classes/01_basic/variable_class_expressions_with_if.cf index e1d5b3714d..5a1d3a75f0 100644 --- a/tests/acceptance/02_classes/01_basic/variable_class_expressions_with_if.cf +++ b/tests/acceptance/02_classes/01_basic/variable_class_expressions_with_if.cf @@ -1,36 +1,32 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - - "description" - string => "Test that variable class expressions and the if alias work together as expected.", - meta => { "CFE-2615" }; + "description" + string => "Test that variable class expressions and the if alias work together as expected.", + meta => { "CFE-2615" }; vars: - "x" string => "x"; + "x" string => "x"; classes: - "DEBUG" expression => "any"; - "one$(x)" expression => "any"; - - # These expressions are here purely for illustration. The classes two and - # three are never set. - - "two" expression => "!any"; - "three" expression => "!any"; + "DEBUG" expression => "any"; + "one$(x)" expression => "any"; - # Here, after the variable class expression "one$(x)":: is where all of the - # test cases are described. + # These expressions are here purely for illustration. The classes two and + # three are never set. + "two" expression => "!any"; + "three" expression => "!any"; + # Here, after the variable class expression "one$(x)":: is where all of the + # test cases are described. "one$(x)":: - "FAIL_if" expression => "any", meta => { "failtest" }, @@ -67,23 +63,20 @@ bundle agent test unless => not("two|three"); vars: - "FAIL_classes" slist => classesmatching( ".*", "failtest" ); + "FAIL_classes" slist => classesmatching(".*", "failtest"); commands: - - "$(G.true)" - handle => "delay", - comment => "This is a benign promise that is used to delay detection of + "$(G.true)" + handle => "delay", + comment => "This is a benign promise that is used to delay detection of failure classes until after normal order begins."; classes: - "no_FAIL_classes" - expression => none(".*", FAIL_classes), - depends_on => { "delay" }; - - "FAIL_classes" - expression => some(".*", FAIL_classes); + "no_FAIL_classes" + expression => none(".*", FAIL_classes), + depends_on => { "delay" }; + "FAIL_classes" expression => some(".*", FAIL_classes); reports: DEBUG|EXTRA:: diff --git a/tests/acceptance/02_classes/02_functions/001.cf b/tests/acceptance/02_classes/02_functions/001.cf index 4351d3a63b..9c76785751 100644 --- a/tests/acceptance/02_classes/02_functions/001.cf +++ b/tests/acceptance/02_classes/02_functions/001.cf @@ -3,50 +3,48 @@ # Test isgreaterthan() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" and => { - isgreaterthan("1", "0"), - isgreaterthan("2.7e3", "1"), - isgreaterthan("2", "1.1"), - isgreaterthan("2.7e3", "9e1"), - isgreaterthan("3b", "2z"), - isgreaterthan("beta", "alpha"), - isgreaterthan("beta", ""), - isgreaterthan("beta", "-75"), - isgreaterthan("3", ""), + "ok" + and => { + isgreaterthan("1", "0"), + isgreaterthan("2.7e3", "1"), + isgreaterthan("2", "1.1"), + isgreaterthan("2.7e3", "9e1"), + isgreaterthan("3b", "2z"), + isgreaterthan("beta", "alpha"), + isgreaterthan("beta", ""), + isgreaterthan("beta", "-75"), + isgreaterthan("3", ""), }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/002.cf b/tests/acceptance/02_classes/02_functions/002.cf index 9ff0436585..da319a4395 100644 --- a/tests/acceptance/02_classes/02_functions/002.cf +++ b/tests/acceptance/02_classes/02_functions/002.cf @@ -3,59 +3,73 @@ # Test islessthan() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok1" expression => islessthan("0", "1"); - "ok2" expression => islessthan("1", "2.7e3"); - "ok3" expression => islessthan("1.1", "2"); - "ok4" expression => islessthan("2.7e3", "1e9"); - "ok5" expression => islessthan("2z", "3b"); - "ok6" expression => islessthan("alpha", "beta"); - "ok7" expression => islessthan("", "beta"); - "ok8" expression => islessthan("-75", "beta"); - "ok9" expression => islessthan("", "3"); - - "ok" and => { ok1, ok2, ok3, ok4, ok5, ok6, ok7, ok8, ok9 }; + "ok1" expression => islessthan("0", "1"); + "ok2" expression => islessthan("1", "2.7e3"); + "ok3" expression => islessthan("1.1", "2"); + "ok4" expression => islessthan("2.7e3", "1e9"); + "ok5" expression => islessthan("2z", "3b"); + "ok6" expression => islessthan("alpha", "beta"); + "ok7" expression => islessthan("", "beta"); + "ok8" expression => islessthan("-75", "beta"); + "ok9" expression => islessthan("", "3"); + "ok" and => { ok1, ok2, ok3, ok4, ok5, ok6, ok7, ok8, ok9 }; reports: - DEBUG.ok1:: "ok1"; - DEBUG.ok2:: "ok2"; - DEBUG.ok3:: "ok3"; - DEBUG.ok4:: "ok4"; - DEBUG.ok5:: "ok5"; - DEBUG.ok6:: "ok6"; - DEBUG.ok7:: "ok7"; - DEBUG.ok8:: "ok8"; - DEBUG.ok9:: "ok9"; + DEBUG.ok1:: + "ok1"; + + DEBUG.ok2:: + "ok2"; + + DEBUG.ok3:: + "ok3"; + + DEBUG.ok4:: + "ok4"; + + DEBUG.ok5:: + "ok5"; + + DEBUG.ok6:: + "ok6"; + + DEBUG.ok7:: + "ok7"; + + DEBUG.ok8:: + "ok8"; + + DEBUG.ok9:: + "ok9"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/003.cf b/tests/acceptance/02_classes/02_functions/003.cf index b977d01a20..f2bfaca83b 100644 --- a/tests/acceptance/02_classes/02_functions/003.cf +++ b/tests/acceptance/02_classes/02_functions/003.cf @@ -3,52 +3,44 @@ # Test isvariable() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "present" int => "1"; + "present" int => "1"; classes: - "should_fail" or => { - isvariable("x"), - isvariable("init.x") - }; - "should_pass" not => "should_fail"; - "ok" and => { - "should_pass", - isvariable("present"), - isvariable("init.dummy") - }; + "should_fail" or => { isvariable("x"), isvariable("init.x") }; + "should_pass" not => "should_fail"; + + "ok" + and => { "should_pass", isvariable("present"), isvariable("init.dummy") }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/004.cf b/tests/acceptance/02_classes/02_functions/004.cf index e4364a53f8..25e1d16255 100644 --- a/tests/acceptance/02_classes/02_functions/004.cf +++ b/tests/acceptance/02_classes/02_functions/004.cf @@ -3,55 +3,56 @@ # Test strcmp() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "null" string => ""; - "one" int => "1"; + "null" string => ""; + "one" int => "1"; classes: - "should_fail" or => { - strcmp("$(null)", "$(one)"), - strcmp("01", "$(one)"), - strcmp("init.x", "$(init.x)") + "should_fail" + or => { + strcmp("$(null)", "$(one)"), + strcmp("01", "$(one)"), + strcmp("init.x", "$(init.x)"), }; - "should_pass" not => "should_fail"; - "ok" and => { - "should_pass", - strcmp("", "$(null)"), - strcmp("1", "$(one)"), - strcmp("dummy", "$(init.dummy)") + + "should_pass" not => "should_fail"; + + "ok" + and => { + "should_pass", + strcmp("", "$(null)"), + strcmp("1", "$(one)"), + strcmp("dummy", "$(init.dummy)"), }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/005.cf b/tests/acceptance/02_classes/02_functions/005.cf index 6db7c70990..395db8549b 100644 --- a/tests/acceptance/02_classes/02_functions/005.cf +++ b/tests/acceptance/02_classes/02_functions/005.cf @@ -3,74 +3,78 @@ # Test join() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "zeros" slist => { "solo" }; - "zero" string => join("NOISE", "zeros"); + "zeros" slist => { "solo" }; + "zero" string => join("NOISE", "zeros"); + "ones" slist => { "a", "bb", "ccc" }; + "one" string => join(":", "ones"); + "twos" slist => { "xx", "xx", "xx" }; + "two" string => join("..", "twos"); + "threes" slist => { "" }; + "three" string => join("", "threes"); + "fours" slist => { "1", "", "3" }; + "four" string => join("", "fours"); + "fives" slist => { "1", "", "3" }; + "five" string => join(",", "fives"); + "sixs" slist => { "one ", " two ", " three" }; + "six" string => join(" and ", "sixs"); - "ones" slist => { "a", "bb", "ccc" }; - "one" string => join(":", "ones"); + classes: + "ok1" expression => strcmp("solo", "$(zero)"); + "ok2" expression => strcmp("a:bb:ccc", "$(one)"); + "ok3" expression => strcmp("xx..xx..xx", "$(two)"); + "ok4" expression => strcmp("", "$(three)"); + "ok5" expression => strcmp("13", "$(four)"); + "ok6" expression => strcmp("1,,3", "$(five)"); + "ok7" expression => strcmp("one and two and three", "$(six)"); + "ok" and => { ok1, ok2, ok3, ok4, ok5, ok6, ok7 }; - "twos" slist => { "xx", "xx", "xx" }; - "two" string => join("..", "twos"); + reports: + DEBUG.ok1:: + "ok1"; - "threes" slist => { "" }; - "three" string => join("", "threes"); + DEBUG.ok2:: + "ok2"; - "fours" slist => { "1", "", "3" }; - "four" string => join("", "fours"); + DEBUG.ok3:: + "ok3"; - "fives" slist => { "1", "", "3" }; - "five" string => join(",", "fives"); + DEBUG.ok4:: + "ok4"; - "sixs" slist => { "one ", " two ", " three" }; - "six" string => join(" and ", "sixs"); + DEBUG.ok5:: + "ok5"; - classes: - "ok1" expression => strcmp("solo", "$(zero)"); - "ok2" expression => strcmp("a:bb:ccc", "$(one)"); - "ok3" expression => strcmp("xx..xx..xx", "$(two)"); - "ok4" expression => strcmp("", "$(three)"); - "ok5" expression => strcmp("13", "$(four)"); - "ok6" expression => strcmp("1,,3", "$(five)"); - "ok7" expression => strcmp("one and two and three", "$(six)"); - "ok" and => { ok1, ok2, ok3, ok4, ok5, ok6, ok7 }; + DEBUG.ok6:: + "ok6"; + + DEBUG.ok7:: + "ok7"; - reports: - DEBUG.ok1:: "ok1"; - DEBUG.ok2:: "ok2"; - DEBUG.ok3:: "ok3"; - DEBUG.ok4:: "ok4"; - DEBUG.ok5:: "ok5"; - DEBUG.ok6:: "ok6"; - DEBUG.ok7:: "ok7"; DEBUG:: 'strcmp("solo", "$(zero)")'; 'strcmp("a:bb:ccc", "$(one)")'; @@ -79,8 +83,10 @@ bundle agent check 'strcmp("13", "$(four)")'; 'strcmp("1,,3", "$(five)")'; 'strcmp("one and two and three", "$(six)")'; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/006.cf b/tests/acceptance/02_classes/02_functions/006.cf index 58546f9825..ded62a335a 100644 --- a/tests/acceptance/02_classes/02_functions/006.cf +++ b/tests/acceptance/02_classes/02_functions/006.cf @@ -3,97 +3,101 @@ # Test grep() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "zeros" slist => { "", "a", "bb", "ccc", "dddd" }; - "zeroz" slist => grep('\d.*', "zeros"); - "zero" string => join(",", "zeroz"); + "zeros" slist => { "", "a", "bb", "ccc", "dddd" }; + "zeroz" slist => grep('\d.*', "zeros"); + "zero" string => join(",", "zeroz"); + "ones" slist => { "", "a", "bb", "ccc", "dddd" }; + "onez" slist => grep("c.*", "ones"); + "one" string => join(",", "onez"); + "twos" slist => { "", "a", "bb", "ccc", "dddd" }; + "twoz" slist => grep(".{1,2}", "twos"); + "two" string => join(",", "twoz"); + "threes" slist => { "", "a", "bb", "ccc", "dddd" }; + "threez" slist => grep("ccc", "threes"); + "three" string => join(",", "threez"); + "fours" slist => { "", "a", "bb", "ccc", "dddd" }; + "fourz" slist => grep(".+", "fours"); + "four" string => join(",", "fourz"); + "fives" slist => { "", "a", "bb", "ccc", "dddd" }; + "fivez" slist => grep(".*", "fives"); + "five" string => join(",", "fivez"); + "sixs" slist => { "", "a", "bb", "ccc", "dddd", '' }; + "sixz" slist => grep("^$", "sixs"); + "six" string => join(",", "sixz"); - "ones" slist => { "", "a", "bb", "ccc", "dddd" }; - "onez" slist => grep("c.*", "ones"); - "one" string => join(",", "onez"); + classes: + "ok1" expression => strcmp("", "$(zero)"); + "ok2" expression => strcmp("ccc", "$(one)"); + "ok3" expression => strcmp("a,bb", "$(two)"); + "ok4" expression => strcmp("ccc", "$(three)"); + "ok5" expression => strcmp("a,bb,ccc,dddd", "$(four)"); + "ok6" expression => strcmp(",a,bb,ccc,dddd", "$(five)"); + "ok7" expression => strcmp(",", "$(six)"); + "ok" and => { ok1, ok2, ok3, ok4, ok5, ok6, ok7 }; - "twos" slist => { "", "a", "bb", "ccc", "dddd" }; - "twoz" slist => grep(".{1,2}", "twos"); - "two" string => join(",", "twoz"); + reports: + DEBUG.ok1:: + "ok1"; - "threes" slist => { "", "a", "bb", "ccc", "dddd" }; - "threez" slist => grep("ccc", "threes"); - "three" string => join(",", "threez"); + DEBUG.ok2:: + "ok2"; - "fours" slist => { "", "a", "bb", "ccc", "dddd" }; - "fourz" slist => grep(".+", "fours"); - "four" string => join(",", "fourz"); + DEBUG.ok3:: + "ok3"; - "fives" slist => { "", "a", "bb", "ccc", "dddd" }; - "fivez" slist => grep(".*", "fives"); - "five" string => join(",", "fivez"); + DEBUG.ok4:: + "ok4"; - "sixs" slist => { "", "a", "bb", "ccc", "dddd", '' }; - "sixz" slist => grep("^$", "sixs"); - "six" string => join(",", "sixz"); + DEBUG.ok5:: + "ok5"; - classes: - "ok1" expression => strcmp("", "$(zero)"); - "ok2" expression => strcmp("ccc", "$(one)"); - "ok3" expression => strcmp("a,bb", "$(two)"); - "ok4" expression => strcmp("ccc", "$(three)"); - "ok5" expression => strcmp("a,bb,ccc,dddd", "$(four)"); - "ok6" expression => strcmp(",a,bb,ccc,dddd", "$(five)"); - "ok7" expression => strcmp(",", "$(six)"); - "ok" and => { ok1, ok2, ok3, ok4, ok5, ok6, ok7 }; + DEBUG.ok6:: + "ok6"; + + DEBUG.ok7:: + "ok7"; - reports: - DEBUG.ok1:: "ok1"; - DEBUG.ok2:: "ok2"; - DEBUG.ok3:: "ok3"; - DEBUG.ok4:: "ok4"; - DEBUG.ok5:: "ok5"; - DEBUG.ok6:: "ok6"; - DEBUG.ok7:: "ok7"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } ####################################################### - bundle agent fini { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } diff --git a/tests/acceptance/02_classes/02_functions/008.cf b/tests/acceptance/02_classes/02_functions/008.cf index 9574d043a9..9c4982e36b 100644 --- a/tests/acceptance/02_classes/02_functions/008.cf +++ b/tests/acceptance/02_classes/02_functions/008.cf @@ -3,46 +3,40 @@ # Test userexists() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" xor => { - userexists("root"), - userexists("xxxscrabbleroot"), - }; + "ok" xor => { userexists("root"), userexists("xxxscrabbleroot") }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/009.cf b/tests/acceptance/02_classes/02_functions/009.cf index 116ffb4bce..a0a33d47f0 100644 --- a/tests/acceptance/02_classes/02_functions/009.cf +++ b/tests/acceptance/02_classes/02_functions/009.cf @@ -3,46 +3,40 @@ # Test groupexists() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" xor => { - groupexists("bin"), - groupexists("xxxscrabblebin"), - }; + "ok" xor => { groupexists("bin"), groupexists("xxxscrabblebin") }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/010.cf b/tests/acceptance/02_classes/02_functions/010.cf index f110cf1688..58a5daebcf 100644 --- a/tests/acceptance/02_classes/02_functions/010.cf +++ b/tests/acceptance/02_classes/02_functions/010.cf @@ -3,43 +3,37 @@ # Test isdir() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" xor => { - isdir("/"), - isdir("$(G.etc_passwd)"), - }; + "ok" xor => { isdir("/"), isdir("$(G.etc_passwd)") }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/011.cf b/tests/acceptance/02_classes/02_functions/011.cf index 51e9d3c688..ba93dbf94a 100644 --- a/tests/acceptance/02_classes/02_functions/011.cf +++ b/tests/acceptance/02_classes/02_functions/011.cf @@ -3,43 +3,37 @@ # Test isplain() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" xor => { - isplain("$(G.etc_passwd)"), - isplain("$(G.etc)"), - }; + "ok" xor => { isplain("$(G.etc_passwd)"), isplain("$(G.etc)") }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/012.cf b/tests/acceptance/02_classes/02_functions/012.cf index 215a96f385..bf92990ff8 100644 --- a/tests/acceptance/02_classes/02_functions/012.cf +++ b/tests/acceptance/02_classes/02_functions/012.cf @@ -3,40 +3,37 @@ # Test isdir() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" not => isdir("/xxgobbleroot"); + "ok" not => isdir("/xxgobbleroot"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/013.cf b/tests/acceptance/02_classes/02_functions/013.cf index a1e443d3b7..45fe1821d9 100644 --- a/tests/acceptance/02_classes/02_functions/013.cf +++ b/tests/acceptance/02_classes/02_functions/013.cf @@ -3,40 +3,37 @@ # Test isplain() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" not => isplain("/xxgobbleroot"); + "ok" not => isplain("/xxgobbleroot"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/014.cf b/tests/acceptance/02_classes/02_functions/014.cf index c213d6aaba..1ed5ff577b 100644 --- a/tests/acceptance/02_classes/02_functions/014.cf +++ b/tests/acceptance/02_classes/02_functions/014.cf @@ -3,40 +3,38 @@ # Test hostinnetgroup # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { classes: - "ng_host" expression => hostinnetgroup("netgroup2"); + "ng_host" expression => hostinnetgroup("netgroup2"); } ####################################################### - bundle agent check { classes: - "ok" expression => "any"; # check not crashed + "ok" expression => "any"; + # check not crashed reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/015.cf b/tests/acceptance/02_classes/02_functions/015.cf index 402f8683d1..2a7cc7f41b 100644 --- a/tests/acceptance/02_classes/02_functions/015.cf +++ b/tests/acceptance/02_classes/02_functions/015.cf @@ -3,86 +3,79 @@ # Test islink() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "testfile" string => "/tmp/TEST.cfengine"; + "testfile" string => "/tmp/TEST.cfengine"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - create => "true"; - - "$(G.testfile).dir/." - create => "true"; - - "$(G.testfile).link" - link_from => test_link("$(G.testfile)"); + "$(G.testfile)" create => "true"; + "$(G.testfile).dir/." create => "true"; + "$(G.testfile).link" link_from => test_link("$(G.testfile)"); } body link_from test_link(original) { - source => "$(original)"; - link_type => "symlink"; + source => "$(original)"; + link_type => "symlink"; } ####################################################### - bundle agent test { meta: - "test_suppress_fail" string => "windows", - meta => { "redmine4608" }; + "test_suppress_fail" + string => "windows", + meta => { "redmine4608" }; vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "good" and => { - islink("$(G.testfile).link"), + "good" and => { islink("$(G.testfile).link") }; + + "bad" + or => { + islink("$(G.testfile).dir"), + islink("$(G.testfile).dir/"), + islink("$(G.testfile)"), + islink("$(G.testfile).does-not-exist"), }; - "bad" or => { - islink("$(G.testfile).dir"), - islink("$(G.testfile).dir/"), - islink("$(G.testfile)"), - islink("$(G.testfile).does-not-exist"), - }; - - "ok" expression => "good&!bad"; + "ok" expression => "good&!bad"; reports: DEBUG.good:: "As expected, $(G.testfile).link is a symlink to $(G.testfile)"; + DEBUG.bad:: "One of these is detected as a symlink: $(G.testfile).dir, $(G.testfile), $(G.testfile).does-not-exist"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("$(G.testfile)"); + "any" usebundle => dcs_fini("$(G.testfile)"); } diff --git a/tests/acceptance/02_classes/02_functions/016.cf b/tests/acceptance/02_classes/02_functions/016.cf index 4eae139daa..82ed1b83ec 100644 --- a/tests/acceptance/02_classes/02_functions/016.cf +++ b/tests/acceptance/02_classes/02_functions/016.cf @@ -3,75 +3,74 @@ # Test isvariable() on arrays # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "a[b]" string => "c"; - "a[x][y]" string => "z"; + "a[b]" string => "c"; + "a[x][y]" string => "z"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "a[b]" string => "c"; - "a[x][y]" string => "z"; + "a[b]" string => "c"; + "a[x][y]" string => "z"; classes: - "should_fail" or => { - isvariable("g.a"), - isvariable("g.a[c]"), - isvariable("g.a[x]"), - isvariable("g.a[x][y][z]"), - isvariable("a"), - isvariable("a[c]"), - isvariable("a[x]"), - isvariable("a[x][y][z]"), + "should_fail" + or => { + isvariable("g.a"), + isvariable("g.a[c]"), + isvariable("g.a[x]"), + isvariable("g.a[x][y][z]"), + isvariable("a"), + isvariable("a[c]"), + isvariable("a[x]"), + isvariable("a[x][y][z]"), }; - "ok" and => { - "!should_fail", - isvariable("g.a[b]"), - isvariable("g.a[x][y]"), - isvariable("a[b]"), - isvariable("a[x][y]"), + + "ok" + and => { + "!should_fail", + isvariable("g.a[b]"), + isvariable("g.a[x][y]"), + isvariable("a[b]"), + isvariable("a[x][y]"), }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } ####################################################### - bundle agent fini { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } diff --git a/tests/acceptance/02_classes/02_functions/017.cf b/tests/acceptance/02_classes/02_functions/017.cf index 4474039324..22fafa902f 100644 --- a/tests/acceptance/02_classes/02_functions/017.cf +++ b/tests/acceptance/02_classes/02_functions/017.cf @@ -3,47 +3,45 @@ # Test classmatch() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" and => { - classmatch("any"), - classmatch("cfengine"), - classmatch("cf.*"), - classmatch("Hr.*"), - classmatch("Yr.*"), - classmatch("Min.*"), + "ok" + and => { + classmatch("any"), + classmatch("cfengine"), + classmatch("cf.*"), + classmatch("Hr.*"), + classmatch("Yr.*"), + classmatch("Min.*"), }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/020.cf b/tests/acceptance/02_classes/02_functions/020.cf index d71d52f47b..dbfca9e22a 100644 --- a/tests/acceptance/02_classes/02_functions/020.cf +++ b/tests/acceptance/02_classes/02_functions/020.cf @@ -3,56 +3,59 @@ # Test fileexists() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "f1" string => "$(G.etc_passwd)"; - "f2" string => "$(G.etc_group)"; - "f3" string => "/etc/NoFriggin'WayThisExi5ts"; + "f1" string => "$(G.etc_passwd)"; + "f2" string => "$(G.etc_group)"; + "f3" string => "/etc/NoFriggin'WayThisExi5ts"; } ####################################################### - bundle agent check { classes: - "ok1" expression => fileexists("$(test.f1)"); - "ok2" expression => fileexists("$(test.f2)"); - "ok3" not => fileexists("$(test.f3)"); - - "ok" and => { "ok1", "ok2", "ok3" }; + "ok1" expression => fileexists("$(test.f1)"); + "ok2" expression => fileexists("$(test.f2)"); + "ok3" not => fileexists("$(test.f3)"); + "ok" and => { "ok1", "ok2", "ok3" }; reports: DEBUG.ok1:: "File $(test.f1) exists as expected"; + DEBUG.!ok1:: "File $(test.f1) DOES NOT exist (and should)"; + DEBUG.ok2:: "File $(test.f2) exists as expected"; + DEBUG.!ok2:: "File $(test.f2) DOES NOT exist (and should)"; + DEBUG.ok3:: "File $(test.f3) does not exist as expected"; + DEBUG.!ok3:: "File $(test.f3) DOES exist (and shouldn't)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/021.cf b/tests/acceptance/02_classes/02_functions/021.cf index 99b7d6951a..8e41a6b3df 100644 --- a/tests/acceptance/02_classes/02_functions/021.cf +++ b/tests/acceptance/02_classes/02_functions/021.cf @@ -3,57 +3,57 @@ # Test filesexist() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "f1" string => "$(G.etc_passwd)"; - "f2" string => "$(G.etc_group)"; - "f3" string => "/etc/NoFriggin'WayThisExi5ts"; - - "s1" slist => { "$(f1)", "$(f2)" }; - "s2" slist => { "$(f1)", "$(f2)", "$(f3)" }; + "f1" string => "$(G.etc_passwd)"; + "f2" string => "$(G.etc_group)"; + "f3" string => "/etc/NoFriggin'WayThisExi5ts"; + "s1" slist => { "$(f1)", "$(f2)" }; + "s2" slist => { "$(f1)", "$(f2)", "$(f3)" }; classes: - "ok1" expression => filesexist("@(s1)"); - "ok2" not => filesexist("@(s2)"); - - "ok" and => { "ok1", "ok2" }; + "ok1" expression => filesexist("@(s1)"); + "ok2" not => filesexist("@(s2)"); + "ok" and => { "ok1", "ok2" }; reports: DEBUG.ok1:: "All files in list s1 $(s1) exist as expected"; + DEBUG.!ok1:: "All files in list s1 $(s1) DO NOT exist (and should)"; + DEBUG.ok2:: "All files in list s2 $(s2) do not exist as expected"; + DEBUG.!ok2:: "All files in list s2 $(s2) DO exist (and shouldn't)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/029.cf b/tests/acceptance/02_classes/02_functions/029.cf index 41ac157c5f..01ce313e6c 100644 --- a/tests/acceptance/02_classes/02_functions/029.cf +++ b/tests/acceptance/02_classes/02_functions/029.cf @@ -3,118 +3,138 @@ # Test logical functions in ifvarclass # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - - "and_yes_both" + "and_yes_both" expression => "any", ifvarclass => and("any", "any"); - "and_no_left" + + "and_no_left" expression => "any", ifvarclass => and("any", "none"); - "and_no_right" + + "and_no_right" expression => "any", ifvarclass => and("none", "any"); - "and_no_none" + + "and_no_none" expression => "any", ifvarclass => and("none", "none"); - "and_arg_fun" + "and_arg_fun" expression => "any", ifvarclass => and(isdir("/")); - "and_no_arg_fun" + + "and_no_arg_fun" expression => "any", ifvarclass => and(isdir("/bin/sh")); - "and_two_args_fun" + + "and_two_args_fun" expression => "any", ifvarclass => and(isdir("/"), isdir("/")); - "and_long" + "and_long" expression => "any", ifvarclass => and("any", "any", "any", "any", "any", "any", "any", "any"); - "and_ok" and => { "and_yes_both", "!and_no_left", "!and_no_right", "!and_no_none", - "and_arg_fun", "!and_no_arg_fun", "and_two_args_fun", "and_long" }; - + "and_ok" + and => { + "and_yes_both", + "!and_no_left", + "!and_no_right", + "!and_no_none", + "and_arg_fun", + "!and_no_arg_fun", + "and_two_args_fun", + "and_long", + }; - # - - "or_yes_both" + "or_yes_both" expression => "any", ifvarclass => or("any", "any"); - "or_yes_left" + + "or_yes_left" expression => "any", ifvarclass => or("any", "none"); - "or_yes_right" + + "or_yes_right" expression => "any", ifvarclass => or("none", "any"); - "or_no_none" + + "or_no_none" expression => "any", ifvarclass => or("none", "none"); - "or_arg_fun" + "or_arg_fun" expression => "any", ifvarclass => or(isdir("/")); - "or_no_arg_fun" + + "or_no_arg_fun" expression => "any", ifvarclass => or(isdir("/bin/sh")); - "or_two_args_fun" + + "or_two_args_fun" expression => "any", ifvarclass => or(isdir("/"), isexecutable("/")); - "or_long" + "or_long" expression => "any", ifvarclass => or("any", "any", "any", "any", "any", "any", "any", "any"); - "or_ok" and => { "or_yes_both", "or_yes_left", "or_yes_right", "!or_no_none", - "or_arg_fun", "!or_no_arg_fun", "or_two_args_fun", "or_long" }; + "or_ok" + and => { + "or_yes_both", + "or_yes_left", + "or_yes_right", + "!or_no_none", + "or_arg_fun", + "!or_no_arg_fun", + "or_two_args_fun", + "or_long", + }; - # - - "not_yes_no" + "not_yes_no" expression => "any", ifvarclass => not("none"); - "not_no_yes" + + "not_no_yes" expression => "any", ifvarclass => not("any"); - "not_arg_fun" + + "not_arg_fun" expression => "any", ifvarclass => not(islink("/")); - "not_ok" and => { "not_yes_no", "!not_no_yes", "not_arg_fun" }; - - "ok" and => { "and_ok", "or_ok", "not_ok" }; + "not_ok" and => { "not_yes_no", "!not_no_yes", "not_arg_fun" }; + "ok" and => { "and_ok", "or_ok", "not_ok" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/030.cf b/tests/acceptance/02_classes/02_functions/030.cf index 842fd885a0..6b2e03b296 100644 --- a/tests/acceptance/02_classes/02_functions/030.cf +++ b/tests/acceptance/02_classes/02_functions/030.cf @@ -3,54 +3,50 @@ # Test concat() function # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "a" string => "a"; - "b" string => "b"; - "c" string => "c"; - "str" string => "str"; - "nil" string => ""; + "a" string => "a"; + "b" string => "b"; + "c" string => "c"; + "str" string => "str"; + "nil" string => ""; classes: - "noarg" expression => strcmp(concat(), ""); - "a" expression => strcmp(concat("$(a)"), "a"); - "a_b" expression => strcmp(concat("$(a)", "$(b)"), "ab"); - "a_b_c" expression => strcmp(concat("$(a)", "$(b)", "$(c)"), "abc"); - "nil_nil" expression => strcmp(concat("$(nil)", "$(nil)"), ""); - "str_str" expression => strcmp(concat("$(str)", "$(str)"), "strstr"); - - "ok" and => { "noarg", "a", "a_b", "a_b_c", "nil_nil", "str_str" }; + "noarg" expression => strcmp(concat(), ""); + "a" expression => strcmp(concat("$(a)"), "a"); + "a_b" expression => strcmp(concat("$(a)", "$(b)"), "ab"); + "a_b_c" expression => strcmp(concat("$(a)", "$(b)", "$(c)"), "abc"); + "nil_nil" expression => strcmp(concat("$(nil)", "$(nil)"), ""); + "str_str" expression => strcmp(concat("$(str)", "$(str)"), "strstr"); + "ok" and => { "noarg", "a", "a_b", "a_b_c", "nil_nil", "str_str" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/classes_body_function_param.cf b/tests/acceptance/02_classes/02_functions/classes_body_function_param.cf index 887de7cbd4..b1469471b2 100644 --- a/tests/acceptance/02_classes/02_functions/classes_body_function_param.cf +++ b/tests/acceptance/02_classes/02_functions/classes_body_function_param.cf @@ -3,34 +3,31 @@ # Test that a classes body can take a function as a parameter # Redmine:4319 (https://cfengine.com/dev/issues/4319) ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { vars: "filename" string => "this is a filename"; methods: - "test" usebundle => noop, + "test" + usebundle => noop, classes => if_repaired(canonify("define_a_class_$(filename)")); } ####################################################### - bundle agent noop { reports: @@ -41,11 +38,12 @@ bundle agent noop bundle agent check { classes: - "ok" expression => "any"; + "ok" expression => "any"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/classesmatching.cf b/tests/acceptance/02_classes/02_functions/classesmatching.cf index 9f7e3ab461..fdf0599cbb 100644 --- a/tests/acceptance/02_classes/02_functions/classesmatching.cf +++ b/tests/acceptance/02_classes/02_functions/classesmatching.cf @@ -3,69 +3,80 @@ # Test classesmatching() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "known" slist => { "cfengine", "cfengine_3", "agent", "any", $(dow), $(dow) }; - "known_str" string => join(" ", "known"); + "known" + slist => { "cfengine", "cfengine_3", "agent", "any", $(dow), $(dow) }; + + "known_str" string => join(" ", "known"); Monday:: "dow" string => "Monday"; + Tuesday:: "dow" string => "Tuesday"; + Wednesday:: "dow" string => "Wednesday"; + Thursday:: "dow" string => "Thursday"; + Friday:: "dow" string => "Friday"; + Saturday:: "dow" string => "Saturday"; + Sunday:: "dow" string => "Sunday"; } ####################################################### - bundle agent test { vars: - "matched" slist => { classesmatching("^cfengine$"), # static string - # range of multiples - classesmatching("^cfengine_[0-9]$"), - # alternation/capture of single - classesmatching("^a(g)ent$"), - # range of single - classesmatching("^a[n]y$"), - # alternation of multiples - classesmatching("^(Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)day$"), - # interpolation - classesmatching("^$(init.dow)$"), + "matched" + slist => { + classesmatching("^cfengine$"), + # static string + # range of multiples + classesmatching("^cfengine_[0-9]$"), + # alternation/capture of single + classesmatching("^a(g)ent$"), + # range of single + classesmatching("^a[n]y$"), + # alternation of multiples + classesmatching("^(Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)day$"), + # interpolation + classesmatching("^$(init.dow)$"), }; - "matched_str" string => join(" ", "matched"); + + "matched_str" string => join(" ", "matched"); } ####################################################### - bundle agent check { classes: - "ok" expression => strcmp($(init.known_str), $(test.matched_str)); + "ok" expression => strcmp($(init.known_str), $(test.matched_str)); + reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + DEBUG.!ok:: "$(this.promise_filename) expected '$(init.known_str)', got '$(test.matched_str)'"; } diff --git a/tests/acceptance/02_classes/02_functions/classesmatching_inherit.cf b/tests/acceptance/02_classes/02_functions/classesmatching_inherit.cf index add7db3e85..fa0f7eca75 100644 --- a/tests/acceptance/02_classes/02_functions/classesmatching_inherit.cf +++ b/tests/acceptance/02_classes/02_functions/classesmatching_inherit.cf @@ -1,19 +1,19 @@ bundle agent __main__ { - classes: - "defined_in_parent" expression => "cfengine"; + classes: + "defined_in_parent" expression => "cfengine"; - methods: - "ENT-5850" - usebundle => ENT_5850, - inherit => "true"; + methods: + "ENT-5850" + usebundle => ENT_5850, + inherit => "true"; } bundle agent ENT_5850 { vars: - "c_matching" - slist => classesmatching(".*"); + "c_matching" slist => classesmatching(".*"); + "c_matching_defined_in_parent" slist => classesmatching("defined_in_parent"); @@ -21,18 +21,15 @@ bundle agent ENT_5850 "defined_here" expression => "cfengine"; reports: - "$(this.promise_filename) Pass" - if => some( "defined_in_parent", c_matching); + "$(this.promise_filename) Pass" if => some("defined_in_parent", c_matching); "$(this.promise_filename) FAIL $(this.promise_filename)$(const.n)Could not find class 'defined_in_parent' in classesmatching() but it's defined" - if => and( not( some( "defined_in_parent", c_matching) ), - defined_in_parent - ); + if => and(not(some("defined_in_parent", c_matching)), defined_in_parent); - "Classes found by classesmatching() starting with 'defined' $(with)" - with => join( ", ", classesmatching("defined.*") ); + "Classes found by classesmatching() starting with 'defined' $(with)" + with => join(", ", classesmatching("defined.*")); - "'defined_here' is defined" if => "defined_here"; - "'defined_in_parent' is defined" if => "defined_in_parent"; - "Running CFEngine: $(sys.cf_version)"; + "'defined_here' is defined" if => "defined_here"; + "'defined_in_parent' is defined" if => "defined_in_parent"; + "Running CFEngine: $(sys.cf_version)"; } diff --git a/tests/acceptance/02_classes/02_functions/classesmatching_inherit_2.cf b/tests/acceptance/02_classes/02_functions/classesmatching_inherit_2.cf index a493934021..f0b25fa068 100644 --- a/tests/acceptance/02_classes/02_functions/classesmatching_inherit_2.cf +++ b/tests/acceptance/02_classes/02_functions/classesmatching_inherit_2.cf @@ -1,12 +1,15 @@ bundle agent common { vars: - "logfile" string => "$(this.promise_dirname)$(const.dirsep)defined_classes.log"; + "logfile" + string => "$(this.promise_dirname)$(const.dirsep)defined_classes.log"; } bundle agent __main__ { - classes: "defined_in_main"; + classes: + "defined_in_main"; + methods: "init"; "first" inherit => "true"; @@ -16,20 +19,25 @@ bundle agent __main__ bundle agent init { files: - "$(common.logfile)" - delete => tidy; + "$(common.logfile)" delete => tidy; } bundle agent first { - classes: "defined_in_first"; - methods: "second" inherit => "true"; + classes: + "defined_in_first"; + + methods: + "second" inherit => "true"; } bundle agent second { - classes: "defined_in_second"; - methods: "third" inherit => "true"; + classes: + "defined_in_second"; + + methods: + "third" inherit => "true"; } bundle agent third @@ -38,28 +46,28 @@ bundle agent third "defined_classes" slist => classesmatching("defined.*"); reports: - "defined_classes: $(defined_classes)" - report_to_file => "$(common.logfile)"; + "defined_classes: $(defined_classes)" report_to_file => "$(common.logfile)"; } bundle agent check { vars: - "expected" string => concat("defined_classes: defined_in_main$(const.n)", - "defined_classes: defined_in_first$(const.n)", - "defined_classes: defined_in_second$(const.n)"); + "expected" + string => concat( + "defined_classes: defined_in_main$(const.n)", + "defined_classes: defined_in_first$(const.n)", + "defined_classes: defined_in_second$(const.n)" + ); + "actual" string => readfile("$(common.logfile)", inf); reports: - "$(this.promise_filename) Pass" - if => strcmp($(expected), $(actual)); - - "$(this.promise_filename) FAIL" - if => not(strcmp($(expected), $(actual))); + "$(this.promise_filename) Pass" if => strcmp($(expected), $(actual)); + "$(this.promise_filename) FAIL" if => not(strcmp($(expected), $(actual))); } body delete tidy { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } diff --git a/tests/acceptance/02_classes/02_functions/empty_list_or_data_doesnt_return_true_for_filesexist.cf b/tests/acceptance/02_classes/02_functions/empty_list_or_data_doesnt_return_true_for_filesexist.cf index a409105393..b95ee6b6bd 100644 --- a/tests/acceptance/02_classes/02_functions/empty_list_or_data_doesnt_return_true_for_filesexist.cf +++ b/tests/acceptance/02_classes/02_functions/empty_list_or_data_doesnt_return_true_for_filesexist.cf @@ -1,28 +1,25 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent test { meta: - "description" -> { "CFE-2631" } - string => "Test that empty lists or data containers do not return true with filesexist. There are no files provided to verify!"; + "description" -> { "CFE-2631" } + string => "Test that empty lists or data containers do not return true with filesexist. There are no files provided to verify!"; vars: - "emptylist" slist => {}; - "emptydata" data => '{}'; + "emptylist" slist => {}; + "emptydata" data => '{}'; classes: - "files_in_empty_list_exist" - expression => filesexist( @(emptylist) ); + "files_in_empty_list_exist" expression => filesexist(@(emptylist)); + "files_in_empty_data_exist" expression => filesexist(@(emptydata)); - "files_in_empty_data_exist" - expression => filesexist( @(emptydata) ); - - "pass" - expression => "!(files_in_empty_list_exist|files_in_empty_data_exist)"; + "pass" + expression => "!(files_in_empty_list_exist|files_in_empty_data_exist)"; reports: DEBUG|EXTRA:: diff --git a/tests/acceptance/02_classes/02_functions/function_args_flattening.cf b/tests/acceptance/02_classes/02_functions/function_args_flattening.cf index baec5b98a5..126089aeda 100644 --- a/tests/acceptance/02_classes/02_functions/function_args_flattening.cf +++ b/tests/acceptance/02_classes/02_functions/function_args_flattening.cf @@ -7,48 +7,53 @@ # Redmine:4320 (https://cfengine.com/dev/issues/4320) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle common init { classes: - "one" expression => "any"; } ####################################################### - bundle common test { classes: - "fail_direct" expression => "any", - if => and("one", "non_existing_class"); + "fail_direct" + expression => "any", + if => and("one", "non_existing_class"); - "fail_split" expression => "any", - if => and(splitstring("one,non_existing_class", ",", "20")); + "fail_split" + expression => "any", + if => and(splitstring("one,non_existing_class", ",", "20")); - "pass_direct" expression => "any", - if => or("one", "non_existing_class"); + "pass_direct" + expression => "any", + if => or("one", "non_existing_class"); - "pass_split" expression => "any", - if => or(splitstring("one,non_existing_class", ",", "20")); + "pass_split" + expression => "any", + if => or(splitstring("one,non_existing_class", ",", "20")); - "pass_split1" expression => "any", - if => not(splitstring("non_existing_class", ",", "20")); + "pass_split1" + expression => "any", + if => not(splitstring("non_existing_class", ",", "20")); } ####################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_expected("pass_direct,pass_split,pass_split1", "fail_direct,fail_split", $(this.promise_filename)); + "" + usebundle => dcs_passif_expected( + "pass_direct,pass_split,pass_split1", + "fail_direct,fail_split", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/02_classes/02_functions/getindices_containers.cf b/tests/acceptance/02_classes/02_functions/getindices_containers.cf index 21443ccd15..16147999ff 100644 --- a/tests/acceptance/02_classes/02_functions/getindices_containers.cf +++ b/tests/acceptance/02_classes/02_functions/getindices_containers.cf @@ -1,46 +1,45 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "obj" data => parsejson('{ "a": 1, "b": 2 }'); - "arr" data => parsejson('["a", "b"]'); + "obj" data => parsejson('{ "a": 1, "b": 2 }'); + "arr" data => parsejson('["a", "b"]'); } ####################################################### - bundle agent test { vars: - "obj_i" slist => getindices("init.obj"); - "arr_i" slist => getindices("init.arr"); + "obj_i" slist => getindices("init.obj"); + "arr_i" slist => getindices("init.arr"); -reports: - DEBUG:: - "obj_i $(obj_i)"; - "arr_i $(arr_i)"; + reports: + DEBUG:: + "obj_i $(obj_i)"; + "arr_i $(arr_i)"; } ####################################################### - bundle agent check { classes: - "ok" and => { - strcmp("a,b", join(",", "test.obj_i")), - strcmp("0,1", join(",", "test.arr_i")) + "ok" + and => { + strcmp("a,b", join(",", "test.obj_i")), + strcmp("0,1", join(",", "test.arr_i")), }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/getindices_returns_correct_indices_from_list.cf b/tests/acceptance/02_classes/02_functions/getindices_returns_correct_indices_from_list.cf index 4eaacd2492..f839e1ac58 100644 --- a/tests/acceptance/02_classes/02_functions/getindices_returns_correct_indices_from_list.cf +++ b/tests/acceptance/02_classes/02_functions/getindices_returns_correct_indices_from_list.cf @@ -1,35 +1,39 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { - meta: - "description" -> { "CFE-2930" } - string => "Test that getindices() returns the correct indices from a list"; + "description" -> { "CFE-2930" } + string => "Test that getindices() returns the correct indices from a list"; vars: - "list" slist => { "beta", "alpha", "gamma" }; - "getindices_list" slist => getindices( list ); + "list" slist => { "beta", "alpha", "gamma" }; + "getindices_list" slist => getindices(list); } ####################################################### bundle agent check { vars: - "expected_value" string => "beta"; - "first_index" string => nth( "test.getindices_list", 0 ); + "expected_value" string => "beta"; + "first_index" string => nth("test.getindices_list", 0); reports: - "$(this.promise_filename) Pass" - if => and( strcmp( $(first_index), 0 ), strcmp( nth( "test.list", $(first_index) ), $(expected_value) ) ); + "$(this.promise_filename) Pass" + if => and( + strcmp($(first_index), 0), + strcmp(nth("test.list", $(first_index)), $(expected_value)) + ); - "$(this.promise_filename) FAIL" - unless => and( strcmp( $(first_index), 0 ), strcmp( nth( "test.list", $(first_index) ), $(expected_value) ) ); + "$(this.promise_filename) FAIL" + unless => and( + strcmp($(first_index), 0), + strcmp(nth("test.list", $(first_index)), $(expected_value)) + ); } diff --git a/tests/acceptance/02_classes/02_functions/getindices_returns_positonal_indices_from_list.cf b/tests/acceptance/02_classes/02_functions/getindices_returns_positonal_indices_from_list.cf index 37d099d4cb..5b82201e49 100644 --- a/tests/acceptance/02_classes/02_functions/getindices_returns_positonal_indices_from_list.cf +++ b/tests/acceptance/02_classes/02_functions/getindices_returns_positonal_indices_from_list.cf @@ -1,45 +1,50 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { - meta: - "description" -> { "CFE-2930" } - string => "Test that getindices() returns the positional indices from a list"; + "description" -> { "CFE-2930" } + string => "Test that getindices() returns the positional indices from a list"; vars: - "list" slist => { "beta", "alpha", "gamma" }; - "getindices_list" slist => getindices( list ); + "list" slist => { "beta", "alpha", "gamma" }; + "getindices_list" slist => getindices(list); } ####################################################### bundle agent check { vars: - "expected_indices" - slist => { 0, 1, 2 }; + "expected_indices" slist => { 0, 1, 2 }; - "diff_getindices_vs_expected" - comment => "Expect to find no elements from getindices that differ from expected", - slist => difference( "test.getindices_list", "expected_indices" ); + "diff_getindices_vs_expected" + comment => "Expect to find no elements from getindices that differ from expected", + slist => difference("test.getindices_list", "expected_indices"); - "diff_expected_vs_getindices" - comment => "Expect to find no elements from expected that differ from getindices", - slist => difference( "expected_indices", "test.getindices_list" ); + "diff_expected_vs_getindices" + comment => "Expect to find no elements from expected that differ from getindices", + slist => difference("expected_indices", "test.getindices_list"); reports: - "$(this.promise_filename) Pass" - if => strcmp( join( ", ", sort( expected_indices, lex) ), join( ", ", sort( "test.getindices_list", lex) ) ); - - "$(this.promise_filename) FAIL" - if => not( strcmp( join( ", ", sort( expected_indices, lex) ), join( ", ", sort( "test.getindices_list", lex) ) )); + "$(this.promise_filename) Pass" + if => strcmp( + join(", ", sort(expected_indices, lex)), + join(", ", sort("test.getindices_list", lex)) + ); + + "$(this.promise_filename) FAIL" + if => not( + strcmp( + join(", ", sort(expected_indices, lex)), + join(", ", sort("test.getindices_list", lex)) + ) + ); DEBUG|EXTRA:: "diff_getindices_vs_expected"; diff --git a/tests/acceptance/02_classes/02_functions/iprange.cf b/tests/acceptance/02_classes/02_functions/iprange.cf index 1bf133dba2..a9bace6891 100644 --- a/tests/acceptance/02_classes/02_functions/iprange.cf +++ b/tests/acceptance/02_classes/02_functions/iprange.cf @@ -3,65 +3,77 @@ # Test iprange() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { classes: - "expected_missing" expression => iprange("8.8.8.8/31"), - meta => { "collect" }; + "expected_missing" + expression => iprange("8.8.8.8/31"), + meta => { "collect" }; - "expected_missing" expression => iprange("8.8.8.8/24"), - meta => { "collect" }; + "expected_missing" + expression => iprange("8.8.8.8/24"), + meta => { "collect" }; - "expected_missing" expression => iprange("8.8.8.8/31", $(sys.interfaces)), - meta => { "collect" }; + "expected_missing" + expression => iprange("8.8.8.8/31", $(sys.interfaces)), + meta => { "collect" }; - "expected_missing" expression => iprange("8.8.8.8/24", $(sys.interfaces)), - meta => { "collect" }; + "expected_missing" + expression => iprange("8.8.8.8/24", $(sys.interfaces)), + meta => { "collect" }; - "expected_missing" expression => iprange("0.0.0.0/0", "dummy"), - meta => { "collect" }; + "expected_missing" + expression => iprange("0.0.0.0/0", "dummy"), + meta => { "collect" }; - "all_zeroes" expression => iprange("0.0.0.0/0"), - meta => { "collect" }; + "all_zeroes" + expression => iprange("0.0.0.0/0"), + meta => { "collect" }; - "all_zeroes_some_interfaces" expression => iprange("0.0.0.0/0", $(sys.interfaces)), - meta => { "collect" }; + "all_zeroes_some_interfaces" + expression => iprange("0.0.0.0/0", $(sys.interfaces)), + meta => { "collect" }; - "local_range" expression => iprange("0.0.0.0/1"), - meta => { "collect" }; + "local_range" + expression => iprange("0.0.0.0/1"), + meta => { "collect" }; - "local_range" expression => iprange("128.0.0.0/1"), - meta => { "collect" }; + "local_range" + expression => iprange("128.0.0.0/1"), + meta => { "collect" }; - "local_range2" expression => iprange("0.0.0.0/1", $(sys.interfaces)), - meta => { "collect" }; + "local_range2" + expression => iprange("0.0.0.0/1", $(sys.interfaces)), + meta => { "collect" }; - "local_range2" expression => iprange("128.0.0.0/1", $(sys.interfaces)), - meta => { "collect" }; + "local_range2" + expression => iprange("128.0.0.0/1", $(sys.interfaces)), + meta => { "collect" }; - "just_locals" expression => iprange("$(sys.ip_addresses)/32"), - meta => { "collect" }; + "just_locals" + expression => iprange("$(sys.ip_addresses)/32"), + meta => { "collect" }; vars: - "found" slist => classesmatching(".*", "collect"); + "found" slist => classesmatching(".*", "collect"); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/02_classes/02_functions/isipinsubnet-valid-ip.cf b/tests/acceptance/02_classes/02_functions/isipinsubnet-valid-ip.cf index 57cd002a6b..c23da722ae 100644 --- a/tests/acceptance/02_classes/02_functions/isipinsubnet-valid-ip.cf +++ b/tests/acceptance/02_classes/02_functions/isipinsubnet-valid-ip.cf @@ -3,46 +3,42 @@ # Test isipinsubnet() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "description" -> { "CFE-3081" } - string => "Test that isipinsubnet() validates IP addresses as valid especially within the 0.0.0.0/0 range"; + "description" -> { "CFE-3081" } + string => "Test that isipinsubnet() validates IP addresses as valid especially within the 0.0.0.0/0 range"; vars: + "variable_value_from_varible" string => "$(nosuch.variable)"; + "candidates" slist => { "10.68.71.5", "10.168.171.5", "not-an-ip-address" }; - "variable_value_from_varible" string => "$(nosuch.variable)"; - - "candidates" slist => { "10.68.71.5", "10.168.171.5", "not-an-ip-address" }; + "validIPv4[$(candidates)]" + string => "$(candidates)", + if => isipinsubnet("0.0.0.0/0", "$(candidates)"); - "validIPv4[$(candidates)]" - string => "$(candidates)", - if => isipinsubnet( "0.0.0.0/0", "$(candidates)" ); - - "validIPv4_addresses" slist => getindices( validIPv4 ); + "validIPv4_addresses" slist => getindices(validIPv4); } bundle agent check { vars: - "reg_valid_ipv4" string => "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"; + "reg_valid_ipv4" + string => "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"; classes: - # We only pass if every one of the ip addresses within the subnet is actually a valid ipv4 string. - "pass" expression => every( $(reg_valid_ipv4), @(test.validIPv4_addresses) ); + # We only pass if every one of the ip addresses within the subnet is actually a valid ipv4 string. + "pass" expression => every($(reg_valid_ipv4), @(test.validIPv4_addresses)); reports: - pass:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/02_classes/02_functions/isipinsubnet.cf b/tests/acceptance/02_classes/02_functions/isipinsubnet.cf index 3e0afdd30d..ef5e333fe7 100644 --- a/tests/acceptance/02_classes/02_functions/isipinsubnet.cf +++ b/tests/acceptance/02_classes/02_functions/isipinsubnet.cf @@ -3,44 +3,49 @@ # Test isipinsubnet() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { classes: - "zeroes_range_match" expression => isipinsubnet("0.0.0.0/0", "1.2.3.4"), - meta => { "collect" }; + "zeroes_range_match" + expression => isipinsubnet("0.0.0.0/0", "1.2.3.4"), + meta => { "collect" }; - "exact_ip_match" expression => isipinsubnet("1.2.3.4/32", "1.2.3.4"), - meta => { "collect" }; + "exact_ip_match" + expression => isipinsubnet("1.2.3.4/32", "1.2.3.4"), + meta => { "collect" }; - "two_ips_match" expression => isipinsubnet("1.2.3.4/16", "4.5.6.7", "1.2.1.2"), - meta => { "collect" }; + "two_ips_match" + expression => isipinsubnet("1.2.3.4/16", "4.5.6.7", "1.2.1.2"), + meta => { "collect" }; - "two_ips_nomatch" expression => isipinsubnet("1.2.3.4/16", "4.5.6.7", "3.4.1.2"), - meta => { "collect" }; + "two_ips_nomatch" + expression => isipinsubnet("1.2.3.4/16", "4.5.6.7", "3.4.1.2"), + meta => { "collect" }; - "garbage_nomatch" expression => isipinsubnet("1.2.3.4/16", "blah", "blue", "bleh"), - meta => { "collect" }; + "garbage_nomatch" + expression => isipinsubnet("1.2.3.4/16", "blah", "blue", "bleh"), + meta => { "collect" }; vars: - "found" slist => classesmatching(".*", "collect"); + "found" slist => classesmatching(".*", "collect"); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/02_classes/02_functions/isnewerthantime.cf b/tests/acceptance/02_classes/02_functions/isnewerthantime.cf index 7185fae32c..32a07c7d97 100644 --- a/tests/acceptance/02_classes/02_functions/isnewerthantime.cf +++ b/tests/acceptance/02_classes/02_functions/isnewerthantime.cf @@ -4,61 +4,79 @@ body common control bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } -####################################################### +####################################################### bundle agent check { vars: - "test_file" - string => "$(this.promise_dirname)/isnewerthantime_file.txt"; + "test_file" string => "$(this.promise_dirname)/isnewerthantime_file.txt"; + "nonexistent_file" string => "$(this.promise_dirname)/thisfiledoesntexist_1747148781.txt"; - "test_file_mtime" - string => filestat("$(test_file)", mtime); + + "test_file_mtime" string => filestat("$(test_file)", mtime); + "test_file_time_just_before_mtime" int => int(eval("$(test_file_mtime) - 1")); - "minus_one" - int => "-1"; + + "minus_one" int => "-1"; + classes: - "ok1" - expression => isnewerthantime("$(test_file)", 0); - "ok2" - expression => isnewerthantime("$(nonexistent_file)", 0); + "ok1" expression => isnewerthantime("$(test_file)", 0); + "ok2" expression => isnewerthantime("$(nonexistent_file)", 0); + "ok3" - expression => isnewerthantime("$(test_file)", "$(test_file_time_just_before_mtime)"); - "ok4" - expression => isnewerthantime("$(test_file)", "$(test_file_mtime)"); + expression => isnewerthantime( + "$(test_file)", "$(test_file_time_just_before_mtime)" + ); + + "ok4" expression => isnewerthantime("$(test_file)", "$(test_file_mtime)"); + "ok5" - expression => isnewerthantime("$(nonexistent_file)", "$(test_file_mtime)"); + expression => isnewerthantime( + "$(nonexistent_file)", "$(test_file_mtime)" + ); + "ok6" # as "inf" corresponds to 999999999, this is actually not False expression => isnewerthantime("$(test_file)", "inf"); - "ok7" - expression => isnewerthantime("$(nonexistent_file)", "inf"); - "ok8" - expression => isnewerthantime("$(test_file)", "$(minus_one)"); + + "ok7" expression => isnewerthantime("$(nonexistent_file)", "inf"); + "ok8" expression => isnewerthantime("$(test_file)", "$(minus_one)"); + "ok" - expression => and("ok1", "!ok2", "ok3", "!ok4", "!ok5", "ok6", "!ok7", "ok8"); + expression => and( + "ok1", "!ok2", "ok3", "!ok4", "!ok5", "ok6", "!ok7", "ok8" + ); reports: DEBUG.ok1:: "1. pass"; + DEBUG.!ok2:: "2. pass"; + DEBUG.ok3:: "3. pass: $(test_file_time_just_before_mtime)"; + DEBUG.!ok4:: "4. pass: $(test_file_mtime)"; + DEBUG.!ok5:: "5. pass"; + DEBUG.ok6:: "6. pass"; + DEBUG.!ok7:: "7. pass"; + DEBUG.ok8:: "8. pass"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/laterthan.cf b/tests/acceptance/02_classes/02_functions/laterthan.cf index 77b376707b..e32141fe27 100644 --- a/tests/acceptance/02_classes/02_functions/laterthan.cf +++ b/tests/acceptance/02_classes/02_functions/laterthan.cf @@ -3,112 +3,135 @@ # Test laterthan() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { classes: - # On 32-bit systems, dates before 1901-12-13 aren't representable - "after_year_1902" expression => laterthan(1902,1,1,0,0,0), - scope => "namespace"; - - "after_year_1902_month" expression => laterthan(1902,12,1,0,0,0), - scope => "namespace"; - - "after_year_1902_day" expression => laterthan(1902,12,31,0,0,0), - scope => "namespace"; - - "after_year_1902_hour" expression => laterthan(1902,12,31,23,0,0), - scope => "namespace"; - - "after_year_1902_minute" expression => laterthan(1902,12,31,23,59,0), - scope => "namespace"; - - "after_year_1902_second" expression => laterthan(1902,12,31,23,59,59), - scope => "namespace"; - - # On 32-bit systems, dates after 2038-01-18 aren't representable - "after_year_2037" expression => laterthan(2037,1,1,0,0,0), - scope => "namespace"; - - "after_year_2037_month" expression => laterthan(2037,12,1,0,0,0), - scope => "namespace"; - - "after_year_2037_day" expression => laterthan(2037,12,31,0,0,0), - scope => "namespace"; - - "after_year_2037_hour" expression => laterthan(2037,12,31,23,0,0), - scope => "namespace"; - - "after_year_2037_minute" expression => laterthan(2037,12,31,23,59,0), - scope => "namespace"; - - "after_year_2037_second" expression => laterthan(2037,12,31,23,59,59), - scope => "namespace"; + # On 32-bit systems, dates before 1901-12-13 aren't representable + "after_year_1902" + expression => laterthan(1902, 1, 1, 0, 0, 0), + scope => "namespace"; + + "after_year_1902_month" + expression => laterthan(1902, 12, 1, 0, 0, 0), + scope => "namespace"; + + "after_year_1902_day" + expression => laterthan(1902, 12, 31, 0, 0, 0), + scope => "namespace"; + + "after_year_1902_hour" + expression => laterthan(1902, 12, 31, 23, 0, 0), + scope => "namespace"; + + "after_year_1902_minute" + expression => laterthan(1902, 12, 31, 23, 59, 0), + scope => "namespace"; + + "after_year_1902_second" + expression => laterthan(1902, 12, 31, 23, 59, 59), + scope => "namespace"; + + # On 32-bit systems, dates after 2038-01-18 aren't representable + "after_year_2037" + expression => laterthan(2037, 1, 1, 0, 0, 0), + scope => "namespace"; + + "after_year_2037_month" + expression => laterthan(2037, 12, 1, 0, 0, 0), + scope => "namespace"; + + "after_year_2037_day" + expression => laterthan(2037, 12, 31, 0, 0, 0), + scope => "namespace"; + + "after_year_2037_hour" + expression => laterthan(2037, 12, 31, 23, 0, 0), + scope => "namespace"; + + "after_year_2037_minute" + expression => laterthan(2037, 12, 31, 23, 59, 0), + scope => "namespace"; + + "after_year_2037_second" + expression => laterthan(2037, 12, 31, 23, 59, 59), + scope => "namespace"; } ####################################################### - bundle agent check { vars: DEBUG:: # The date and time now, in laterthan-compatible format: - "present" string => execresult("$(G.date) +(%Y,%m,%d,%H,%M,%S)", "noshell"); - # NB: shell would try to sub-shell on this (...), hence noshell. + "present" + string => execresult("$(G.date) +(%Y,%m,%d,%H,%M,%S)", "noshell"); + # NB: shell would try to sub-shell on this (...), hence noshell. classes: - "check_after_year_1902" and => { - "after_year_1902", - "after_year_1902_month", - "after_year_1902_day", - "after_year_1902_hour", - "after_year_1902_minute", - "after_year_1902_second" + "check_after_year_1902" + and => { + "after_year_1902", + "after_year_1902_month", + "after_year_1902_day", + "after_year_1902_hour", + "after_year_1902_minute", + "after_year_1902_second", }; - "check_after_year_2037" or => { - "after_year_2037", - "after_year_2037_month", - "after_year_2037_day", - "after_year_2037_hour", - "after_year_2037_minute", - "after_year_2037_second" + "check_after_year_2037" + or => { + "after_year_2037", + "after_year_2037_month", + "after_year_2037_day", + "after_year_2037_hour", + "after_year_2037_minute", + "after_year_2037_second", }; - "ok" expression => "check_after_year_1902.!check_after_year_2037"; + "ok" expression => "check_after_year_1902.!check_after_year_2037"; reports: DEBUG.!after_year_1902:: "Failed laterthan(1902,1,1,0,0,0); year"; + DEBUG.!after_year_1902_month:: "Failed laterthan(1902,12,1,0,0,0); month"; + DEBUG.!after_year_1902_day:: "Failed laterthan(1902,12,31,0,0,0); day"; + DEBUG.!after_year_1902_hour:: "Failed laterthan(1902,12,31,23,0,0); hour"; + DEBUG.!after_year_1902_minute:: "Failed laterthan(1902,12,31,23,59,0); minute"; + DEBUG.!after_year_1902_second:: "Failed laterthan(1902,12,31,23,59,59); second"; + DEBUG.after_year_2037:: "Satisfied laterthan(2037,1,1,0,0,0); year"; + DEBUG.after_year_2037_month:: "Satisfied laterthan(2037,12,1,0,0,0); month"; + DEBUG.after_year_2037_day:: "Satisfied laterthan(2037,12,31,0,0,0); day"; + DEBUG.after_year_2037_hour:: "Satisfied laterthan(2037,12,31,23,0,0); hour"; + DEBUG.after_year_2037_minute:: "Satisfied laterthan(2037,12,31,23,59,0); minute"; + DEBUG.after_year_2037_second:: "Satisfied laterthan(2037,12,31,23,59,59); second"; @@ -117,6 +140,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/makerule.cf b/tests/acceptance/02_classes/02_functions/makerule.cf index 23cd05b05c..3e4f4ed992 100644 --- a/tests/acceptance/02_classes/02_functions/makerule.cf +++ b/tests/acceptance/02_classes/02_functions/makerule.cf @@ -3,86 +3,83 @@ # Test makerule() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "lold" slist => { "$(G.etc_passwd)", "$(G.etc_group)" }; - "lnew" slist => { "$(G.etc_passwd)", "$(G.testfile)" }; - "lnon" slist => { "$(G.etc_passwd)", "/etc/NoFriggin'WayThisExi5ts" }; - - files: - - "$(G.testfile)" - create => "true"; + "lold" slist => { "$(G.etc_passwd)", "$(G.etc_group)" }; + "lnew" slist => { "$(G.etc_passwd)", "$(G.testfile)" }; + "lnon" slist => { "$(G.etc_passwd)", "/etc/NoFriggin'WayThisExi5ts" }; - "$(G.testfile).nosuchfile" - - delete => tidy; + files: + "$(G.testfile)" create => "true"; + "$(G.testfile).nosuchfile" delete => tidy; } ####################################################### - bundle agent check { classes: + # A new file does not need to be rebuilt from an older file (fails) + "ok1" expression => makerule("$(G.testfile)", "$(G.etc_passwd)"); - # A new file does not need to be rebuilt from an older file (fails) - "ok1" expression => makerule("$(G.testfile)", "$(G.etc_passwd)"); - - # An older file does need to be rebuilt from a newer file - "ok2" expression => makerule("$(G.etc_passwd)", "$(G.testfile)"); - - # An older file cannot be rebuilt from a non existent file (fails) - "ok3" expression => makerule("$(G.etc_passwd)", "$(G.testfile).nosuchfile"); + # An older file does need to be rebuilt from a newer file + "ok2" expression => makerule("$(G.etc_passwd)", "$(G.testfile)"); - # An non existent file does need to be rebuilt from a source file - "ok4" expression => makerule("$(G.testfile).nosuchfile", "$(G.etc_passwd)"); + # An older file cannot be rebuilt from a non existent file (fails) + "ok3" expression => makerule("$(G.etc_passwd)", "$(G.testfile).nosuchfile"); - # A new file does not need to be rebuilt from an older file (fails) - "ok5" expression => makerule("$(G.testfile)", "test.lold"); + # An non existent file does need to be rebuilt from a source file + "ok4" expression => makerule("$(G.testfile).nosuchfile", "$(G.etc_passwd)"); - # An old file does need to be rebuilt from an newer file in a list - "ok6" expression => makerule("$(G.etc_passwd)", "test.lnew"); + # A new file does not need to be rebuilt from an older file (fails) + "ok5" expression => makerule("$(G.testfile)", "test.lold"); - # An old file does not need to be rebuilt from sources with a missing file (fails) - "ok7" expression => makerule("$(G.etc_passwd)", "test.lnon"); + # An old file does need to be rebuilt from an newer file in a list + "ok6" expression => makerule("$(G.etc_passwd)", "test.lnew"); - "ok" and => { "!ok1", "ok2", "!ok3", "ok4", "!ok5", "ok6", "!ok7" }; + # An old file does not need to be rebuilt from sources with a missing file (fails) + "ok7" expression => makerule("$(G.etc_passwd)", "test.lnon"); + "ok" and => { "!ok1", "ok2", "!ok3", "ok4", "!ok5", "ok6", "!ok7" }; reports: DEBUG.ok1:: "1. pass"; + DEBUG.ok2:: "2. pass"; + DEBUG.ok3:: "3. pass"; + DEBUG.ok4:: "4. pass"; + DEBUG.ok5:: "5. pass"; + DEBUG.ok6:: "6. pass"; + DEBUG.ok7:: "7. pass"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/returnszero.cf b/tests/acceptance/02_classes/02_functions/returnszero.cf index bf1ec0a333..f7bb5f5c43 100644 --- a/tests/acceptance/02_classes/02_functions/returnszero.cf +++ b/tests/acceptance/02_classes/02_functions/returnszero.cf @@ -3,55 +3,67 @@ # Test returnszero() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; meta: - "test_suppress_fail" string => "windows", - meta => { "redmine4687" }; + "test_suppress_fail" + string => "windows", + meta => { "redmine4687" }; } ####################################################### - bundle agent check { vars: windows:: - "zero_rel" string => "fc $(this.promise_filename) $(this.promise_filename)"; - "one_rel" string => "fc $(this.promise_filename) $(this.promise_filename).doesnotexist"; + "zero_rel" + string => "fc $(this.promise_filename) $(this.promise_filename)"; + + "one_rel" + string => "fc $(this.promise_filename) $(this.promise_filename).doesnotexist"; + "nxe_rel" string => "nosuchprogramexists"; - "zero_abs" string => "c:\windows\system32\fc.exe $(this.promise_filename) $(this.promise_filename)"; - "one_abs" string => "c:\windows\system32\fc.exe $(this.promise_filename) $(this.promise_filename).doesnotexist"; + + "zero_abs" + string => "c:\windows\system32\fc.exe $(this.promise_filename) $(this.promise_filename)"; + + "one_abs" + string => "c:\windows\system32\fc.exe $(this.promise_filename) $(this.promise_filename).doesnotexist"; + "nxe_abs" string => "c:\xbin\nosuchprogramexists"; - "zero_powershell" string => "if (diff $(this.promise_filename) $(this.promise_filename)) { exit 1 } else { exit 0 }"; - "one_powershell" string => "if (diff $(this.promise_filename) $(this.promise_filename).doesnotexit) { exit 1 } else { exit 0 }"; + + "zero_powershell" + string => "if (diff $(this.promise_filename) $(this.promise_filename)) { exit 1 } else { exit 0 }"; + + "one_powershell" + string => "if (diff $(this.promise_filename) $(this.promise_filename).doesnotexit) { exit 1 } else { exit 0 }"; + "nxe_powershell" string => "nosuchprogramexists"; + !windows:: "zero_rel" string => "grep root $(G.etc_passwd)"; "one_rel" string => "grep gluequaggaunlikely $(G.etc_passwd)"; @@ -61,41 +73,53 @@ bundle agent check "nxe_abs" string => "/xbin/nosuchprogramexists"; classes: - "rawshell_no_prefix" expression => returnszero("ls /", "useshell"); - "rawnoshell_no_prefix" expression => returnszero("ls /", "noshell"); - - "zero_noshell_rel" expression => returnszero("$(zero_rel)", "noshell"); - "zero_useshell_rel" expression => returnszero("$(zero_rel)", "useshell"); - "zero_noshell_abs" expression => returnszero("$(zero_abs)", "noshell"); - "zero_useshell_abs" expression => returnszero("$(zero_abs)", "useshell"); - - "one_noshell_rel" expression => returnszero("$(one_rel)", "noshell"); - "one_useshell_rel" expression => returnszero("$(one_rel)", "useshell"); - "one_noshell_abs" expression => returnszero("$(one_abs)", "noshell"); - "one_useshell_abs" expression => returnszero("$(one_abs)", "useshell"); - - "nxe_noshell_rel" expression => returnszero("$(nxe_rel)", "noshell"); - "nxe_useshell_rel" expression => returnszero("$(nxe_rel)", "useshell"); - "nxe_noshell_abs" expression => returnszero("$(nxe_abs)", "noshell"); - "nxe_useshell_abs" expression => returnszero("$(nxe_abs)", "useshell"); + "rawshell_no_prefix" expression => returnszero("ls /", "useshell"); + "rawnoshell_no_prefix" expression => returnszero("ls /", "noshell"); + "zero_noshell_rel" expression => returnszero("$(zero_rel)", "noshell"); + "zero_useshell_rel" expression => returnszero("$(zero_rel)", "useshell"); + "zero_noshell_abs" expression => returnszero("$(zero_abs)", "noshell"); + "zero_useshell_abs" expression => returnszero("$(zero_abs)", "useshell"); + "one_noshell_rel" expression => returnszero("$(one_rel)", "noshell"); + "one_useshell_rel" expression => returnszero("$(one_rel)", "useshell"); + "one_noshell_abs" expression => returnszero("$(one_abs)", "noshell"); + "one_useshell_abs" expression => returnszero("$(one_abs)", "useshell"); + "nxe_noshell_rel" expression => returnszero("$(nxe_rel)", "noshell"); + "nxe_useshell_rel" expression => returnszero("$(nxe_rel)", "useshell"); + "nxe_noshell_abs" expression => returnszero("$(nxe_abs)", "noshell"); + "nxe_useshell_abs" expression => returnszero("$(nxe_abs)", "useshell"); + windows:: - "zero_powershell" expression => returnszero("$(zero_powershell)", "powershell"); - "one_powershell" expression => returnszero("$(one_powershell)", "powershell"); - "nxe_powershell" expression => returnszero("$(nxe_powershell)", "powershell"); + "zero_powershell" + expression => returnszero("$(zero_powershell)", "powershell"); + + "one_powershell" + expression => returnszero("$(one_powershell)", "powershell"); + + "nxe_powershell" + expression => returnszero("$(nxe_powershell)", "powershell"); any:: - "ok_common" and => { - "!zero_noshell_rel", "zero_useshell_rel", "zero_noshell_abs", "zero_useshell_abs", - "!one_noshell_rel", "!one_useshell_rel", "!one_noshell_abs", "!one_useshell_abs", - "!nxe_noshell_rel", "!nxe_useshell_rel", "!nxe_noshell_abs", "!nxe_useshell_abs", - }; + "ok_common" + and => { + "!zero_noshell_rel", + "zero_useshell_rel", + "zero_noshell_abs", + "zero_useshell_abs", + "!one_noshell_rel", + "!one_useshell_rel", + "!one_noshell_abs", + "!one_useshell_abs", + "!nxe_noshell_rel", + "!nxe_useshell_rel", + "!nxe_noshell_abs", + "!nxe_useshell_abs", + }; + windows:: - "ok_windows" and => { - "zero_powershell", "!one_powershell", "!nxe_powershell", - }; - "ok" and => { - "ok_common", "ok_windows", - }; + "ok_windows" + and => { "zero_powershell", "!one_powershell", "!nxe_powershell" }; + + "ok" and => { "ok_common", "ok_windows" }; !windows:: "ok" and => { "ok_common" }; @@ -103,85 +127,97 @@ bundle agent check reports: DEBUG.zero_noshell_rel:: "'$(zero_rel)' erroneously returns 0 with noshell"; + DEBUG.!zero_noshell_rel:: "'$(zero_rel)' returns non-zero with noshell"; DEBUG.zero_useshell_rel:: "'$(zero_rel)' returns 0 with useshell"; + DEBUG.!zero_useshell_rel:: "'$(zero_rel)' erroneously returns non-zero with useshell"; - DEBUG.!one_noshell_rel:: "'$(one_rel)' returns non-zero with noshell"; + DEBUG.one_noshell_rel:: "'$(one_rel)' erroneously returns 0 with noshell"; DEBUG.!one_useshell_rel:: "'$(one_rel)' returns non-zero with useshell"; + DEBUG.one_useshell_rel:: "'$(one_rel)' erroneously returns 0 with useshell"; - DEBUG.!nxe_noshell_rel:: "'$(nxe_rel)' returns non-zero with noshell"; + DEBUG.nxe_noshell_rel:: "'$(nxe_rel)' erroneously returns 0 with noshell"; DEBUG.!nxe_useshell_rel:: "'$(nxe_rel)' returns non-zero with useshell"; + DEBUG.nxe_useshell_rel:: "'$(nxe_rel)' erroneously returns 0 with useshell"; DEBUG.zero_noshell_abs:: "'$(zero_abs)' returns 0 with noshell"; + DEBUG.!zero_noshell_abs:: "'$(zero_abs)' erroneously returns non-zero with noshell"; DEBUG.zero_useshell_abs:: "'$(zero_abs)' returns 0 with useshell"; + DEBUG.!zero_useshell_abs:: "'$(zero_abs)' erroneously returns non-zero with useshell"; - DEBUG.!one_noshell_abs:: "'$(one_abs)' returns non-zero with noshell"; + DEBUG.one_noshell_abs:: "'$(one_abs)' erroneously returns 0 with noshell"; DEBUG.!one_useshell_abs:: "'$(one_abs)' returns non-zero with useshell"; + DEBUG.one_useshell_abs:: "'$(one_abs)' erroneously returns 0 with useshell"; - DEBUG.!nxe_noshell_abs:: "'$(nxe_abs)' returns non-zero with noshell"; + DEBUG.nxe_noshell_abs:: "'$(nxe_abs)' erroneously returns 0 with noshell"; DEBUG.!nxe_useshell_abs:: "'$(nxe_abs)' returns non-zero with useshell"; + DEBUG.nxe_useshell_abs:: "'$(nxe_abs)' erroneously returns 0 with useshell"; windows.DEBUG.!zero_powershell:: "'$(zero_powershell)' erroneously returns non-zero with powershell"; + windows.DEBUG.zero_powershell:: "'$(zero_powershell)' returns 0 with powershell"; windows.DEBUG.!one_powershell:: "'$(one_powershell)' returns non-zero with powershell"; + windows.DEBUG.one_powershell:: "'$(one_powershell)' erroneously returns 0 with powershell"; windows.DEBUG.!nxe_powershell:: "'$(nxe_powershell)' returns non-zero with powershell"; + windows.DEBUG.nxe_powershell:: "'$(nxe_powershell)' erroneously returns 0 with powershell"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/silent_returnszero.cf b/tests/acceptance/02_classes/02_functions/silent_returnszero.cf index e340f9f1db..5682734baa 100644 --- a/tests/acceptance/02_classes/02_functions/silent_returnszero.cf +++ b/tests/acceptance/02_classes/02_functions/silent_returnszero.cf @@ -1,18 +1,27 @@ body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } -bundle agent check { +bundle agent check +{ vars: - "command" string => "$(sys.cf_agent) -KIf $(this.promise_filename).sub -DAUTO"; - "silent_command" string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -DAUTO"; + "command" + string => "$(sys.cf_agent) -KIf $(this.promise_filename).sub -DAUTO"; + + "silent_command" + string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -DAUTO"; methods: "check" - usebundle => dcs_passif_output(".*Pass.*", "", $(command), $(this.promise_filename)); + usebundle => dcs_passif_output( + ".*Pass.*", "", $(command), $(this.promise_filename) + ); + "check" - usebundle => dcs_passif_output("", ".*Pass.*", $(silent_command), $(this.promise_filename)); + usebundle => dcs_passif_output( + "", ".*Pass.*", $(silent_command), $(this.promise_filename) + ); } diff --git a/tests/acceptance/02_classes/02_functions/splayclass_hourly.cf b/tests/acceptance/02_classes/02_functions/splayclass_hourly.cf index cf264e6f4c..dbf726be11 100644 --- a/tests/acceptance/02_classes/02_functions/splayclass_hourly.cf +++ b/tests/acceptance/02_classes/02_functions/splayclass_hourly.cf @@ -1,8 +1,8 @@ # Test that hourly splay class works as expected body common control { - inputs => { "../../default.sub.cf" }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + version => "1.0"; } bundle agent main @@ -27,16 +27,14 @@ bundle agent main "hourly[Min55_00]" string => "24"; "hourly_idx" slist => getindices(hourly); "hourly_inputs" slist => getvalues(hourly); - "splay_classes" slist => classesmatching("splayclass_hourly_.*"); classes: - "splayclass_hourly_$(hourly_inputs)" - expression => splayclass( $(hourly_inputs), hourly); + expression => splayclass($(hourly_inputs), hourly); - "ok" - and => { "$(hourly_idx)", "splayclass_hourly_$(hourly[$(hourly_idx)])"}; + "ok" + and => { "$(hourly_idx)", "splayclass_hourly_$(hourly[$(hourly_idx)])" }; reports: DEBUG:: @@ -49,7 +47,9 @@ bundle agent main # Show the class expression that is satisfied "DEBUG $(this.bundle): $(hourly_idx).splayclass_hourly_$(hourly[$(hourly_idx)])" - if => and("$(hourly_idx)", "splayclass_hourly_$(hourly[$(hourly_idx)])"); + if => and( + "$(hourly_idx)", "splayclass_hourly_$(hourly[$(hourly_idx)])" + ); # Show the time with the splay class defined "DEBUG $(this.bundle): $(sys.date) splayclass_hourly_$(hourly_inputs) defined" @@ -58,7 +58,7 @@ bundle agent main ok:: # We pass when the splay class is defined during the expected window "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; - } diff --git a/tests/acceptance/02_classes/02_functions/staging/017.cf b/tests/acceptance/02_classes/02_functions/staging/017.cf index 334782f54e..9b08a97914 100644 --- a/tests/acceptance/02_classes/02_functions/staging/017.cf +++ b/tests/acceptance/02_classes/02_functions/staging/017.cf @@ -3,68 +3,59 @@ # Test select_class - partial test only, hard to prove persistence # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "sel1" select_class => { "one" }; - "sel2" select_class => { "alpha", "beta" }; - "sel3" select_class => { "able", "baker", "charlie" }; - "sel4" select_class => { "foo", "baz", "gar", "bletch" }; + "sel1" select_class => { "one" }; + "sel2" select_class => { "alpha", "beta" }; + "sel3" select_class => { "able", "baker", "charlie" }; + "sel4" select_class => { "foo", "baz", "gar", "bletch" }; + "ok2" xor => { "alpha", "beta" }; + "ok3" xor => { "able", "baker", "charlie" }; + "ok4" xor => { "foo", "baz", "gar", "bletch" }; - "ok2" xor => { "alpha", "beta" }; - "ok3" xor => { "able", "baker", "charlie" }; - "ok4" xor => { "foo", "baz", "gar", "bletch" }; - - "ok" and => { - "sel1", "one", - "sel2", "xor2", - "sel3", "xor3", - "sel4", "xor4", - }; + "ok" + and => { "sel1", "one", "sel2", "xor2", "sel3", "xor3", "sel4", "xor4" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } ####################################################### - bundle agent fini { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } diff --git a/tests/acceptance/02_classes/02_functions/staging/usemodule.cf b/tests/acceptance/02_classes/02_functions/staging/usemodule.cf index 202d89d691..26928fe64b 100644 --- a/tests/acceptance/02_classes/02_functions/staging/usemodule.cf +++ b/tests/acceptance/02_classes/02_functions/staging/usemodule.cf @@ -3,34 +3,33 @@ # Test usemodule() # ####################################################### - body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "script_location" string => dirname("$(this.promise_filename)"); + "script_location" string => dirname("$(this.promise_filename)"); + classes: - "ok_to_run" not => regcmp("/var/cfengine|.*\.cf-agent", "$(sys.workdir)"); + "ok_to_run" not => regcmp("/var/cfengine|.*\.cf-agent", "$(sys.workdir)"); files: ok_to_run:: "$(sys.workdir)/modules/usemodule.cf.bat" - create => "true", - perms => usemodule_perms, - edit_line => usemodule_lines; + create => "true", + perms => usemodule_perms, + edit_line => usemodule_lines; "$(sys.workdir)/modules/usemodule-neg.cf.bat" - create => "true", - perms => usemodule_perms, - edit_line => usemodule_lines_neg; + create => "true", + perms => usemodule_perms, + edit_line => usemodule_lines_neg; } bundle edit_line usemodule_lines_neg @@ -42,7 +41,7 @@ bundle edit_line usemodule_lines_neg "exit 1"; delete_lines: - ".*"; + ".*"; } bundle edit_line usemodule_lines @@ -51,36 +50,47 @@ bundle edit_line usemodule_lines windows:: "@echo off"; "\"$(init.script_location)\usemodule.cf.bat\""; + !windows:: "#!/bin/sh"; ". \"$(init.script_location)/usemodule.cf.bat\""; delete_lines: - ".*"; + ".*"; } body perms usemodule_perms { - mode => "755"; + mode => "755"; } ####################################################### - bundle agent test { classes: - "ok_to_run" not => regcmp("/var/cfengine|.*\.cf-agent", "$(sys.workdir)"); + "ok_to_run" not => regcmp("/var/cfengine|.*\.cf-agent", "$(sys.workdir)"); classes: ok_to_run:: # Should be undefined by the following script. "undefined_class" expression => "any"; "function_ok" expression => usemodule("usemodule.cf.bat", ""); + "function_neg_ok" - comment => "Negative test. Class set if module returns non-zero", - not => usemodule("usemodule-neg.cf.bat", ""); - "defined_variable" expression => strcmp("$(usemodule_cf_bat.defined_variable)", "yes"); - "ok" and => { "function_neg_ok", "function_ok", "defined_class", "!undefined_class", "defined_variable" }; + comment => "Negative test. Class set if module returns non-zero", + not => usemodule("usemodule-neg.cf.bat", ""); + + "defined_variable" + expression => strcmp("$(usemodule_cf_bat.defined_variable)", "yes"); + + "ok" + and => { + "function_neg_ok", + "function_ok", + "defined_class", + "!undefined_class", + "defined_variable", + }; vars: ok:: @@ -89,39 +99,48 @@ bundle agent test reports: !ok_to_run:: "Must be run using testall script"; + ok_to_run.DEBUG.!function_ok:: "usemodule did not execute correctly."; + ok_to_run.DEBUG.!function_neg_ok:: "usemodule returned non-zero, class function_neg_ok was not set, but should be set."; + ok_to_run.DEBUG.!defined_class:: "defined_class was not set, but should be."; + ok_to_run.DEBUG.undefined_class:: "undefined_class was set, but shouldn't be."; + ok_to_run.DEBUG.!defined_variable:: "defined_variable was not set, but should be."; ok_to_run.DEBUG.function_ok:: "usemodule executed correctly."; + ok_to_run.DEBUG.function_neg_ok:: "usemodule returned non-zero and class function_neg_ok was set."; + ok_to_run.DEBUG.defined_class:: "defined_class was set."; + ok_to_run.DEBUG.!undefined_class:: "undefined_class was not set."; + ok_to_run.DEBUG.defined_variable:: "defined_variable was set."; } ####################################################### - bundle agent check { classes: - "ok" expression => strcmp("$(test.ok)", "yes"); + "ok" expression => strcmp("$(test.ok)", "yes"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/02_functions/usemodule-returns-nonzero.cf b/tests/acceptance/02_classes/02_functions/usemodule-returns-nonzero.cf index 1cb3f59381..5c0bfd2daf 100644 --- a/tests/acceptance/02_classes/02_functions/usemodule-returns-nonzero.cf +++ b/tests/acceptance/02_classes/02_functions/usemodule-returns-nonzero.cf @@ -1,39 +1,40 @@ #!/var/cfengine/bin/cf-agent -f- body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } + bundle agent init { vars: - "foo_usemodule" string => -"#!/bin/sh + "foo_usemodule" + string => "#!/bin/sh echo '=mystring=foo99' echo '+class_from_classes_usemodule' exit 1 "; - "foo_commands_module" string => -"#!/bin/sh + "foo_commands_module" + string => "#!/bin/sh echo '=mystring=foo99' echo '+class_from_commands_module' exit 1 "; files: - "${sys.workdir}/modules/foo-usemodule" - create => 'true', - perms => m( 700 ), - edit_defaults => empty, - edit_line => append_if_no_line( ${foo_usemodule} ); - - "${sys.workdir}/modules/foo-commands_module" - create => 'true', - perms => m( 700 ), - edit_defaults => empty, - edit_line => append_if_no_line( ${foo_commands_module} ); + "${sys.workdir}/modules/foo-usemodule" + create => 'true', + perms => m(700), + edit_defaults => empty, + edit_line => append_if_no_line(${foo_usemodule}); + + "${sys.workdir}/modules/foo-commands_module" + create => 'true', + perms => m(700), + edit_defaults => empty, + edit_line => append_if_no_line(${foo_commands_module}); } bundle agent test @@ -42,42 +43,40 @@ bundle agent test "description" -> { "CFE-942" } string => "Test that when a module executed by usemodule() returns nonzero, it's not interpreted as successful"; - "test_soft_fail" - string => "any", - meta => { "CFE-942" }, - comment => "usemodule seems to return true no matter if the module exists returning 0 or nonzero"; + "test_soft_fail" + string => "any", + meta => { "CFE-942" }, + comment => "usemodule seems to return true no matter if the module exists returning 0 or nonzero"; classes: - - # Since the module exits with non zero, we should not get this class - - "usemodule_expect_no_class_defined_because_return_nonzero" - expression => usemodule( "foo-usemodule", "" ), - scope => "namespace", - if => isexecutable( "$(sys.workdir)/foo-usemodule" ); - - # Since the module exists non zero, we should get this class - "usemodule_expect_class_defined_because_return_nonzero" - not => usemodule( "foo-usemodule", "" ), - scope => "namespace", - if => isexecutable( "$(sys.workdir)/foo-usemodule" ); + # Since the module exits with non zero, we should not get this class + "usemodule_expect_no_class_defined_because_return_nonzero" + expression => usemodule("foo-usemodule", ""), + scope => "namespace", + if => isexecutable("$(sys.workdir)/foo-usemodule"); + + # Since the module exists non zero, we should get this class + "usemodule_expect_class_defined_because_return_nonzero" + not => usemodule("foo-usemodule", ""), + scope => "namespace", + if => isexecutable("$(sys.workdir)/foo-usemodule"); commands: - "$(sys.workdir)/modules/foo-commands_module" - module => "true", - if => isexecutable( $(this.promiser) ); + "$(sys.workdir)/modules/foo-commands_module" + module => "true", + if => isexecutable($(this.promiser)); } + bundle agent check { methods: usemodule_expect_no_class_defined_because_return_nonzero.!usemodule_expect_class_defined_because_return_nonzero:: - "FAIL" usebundle => dcs_fail( $(this.promise_filename) ); + "FAIL" usebundle => dcs_fail($(this.promise_filename)); !usemodule_expect_class_defined_because_return_nonzero.usemodule_expect_class_defined_because_return_nonzero:: - "Pass" usebundle => dcs_pass( $(this.promise_filename) ); + "Pass" usebundle => dcs_pass($(this.promise_filename)); reports: - DEBUG:: # Since the module exists nonzero, we don't expect that it communicated things back to the agent "The command execution executed as a module that did not return 0 defined a class (unexpectedly)" @@ -88,5 +87,4 @@ bundle agent check "expected class to be defined based on negative result from usemodule classes promise" if => "usemodule_expect_class_defined_because_return_nonzero"; - } diff --git a/tests/acceptance/02_classes/02_functions/usemodule.cf b/tests/acceptance/02_classes/02_functions/usemodule.cf index dfc2f3b5f9..38868d5046 100644 --- a/tests/acceptance/02_classes/02_functions/usemodule.cf +++ b/tests/acceptance/02_classes/02_functions/usemodule.cf @@ -3,29 +3,28 @@ # Test usemodule() # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "script_location" string => dirname("$(this.promise_filename)"); + "script_location" string => dirname("$(this.promise_filename)"); + classes: - "ok_to_run" not => regcmp("/var/cfengine|.*\.cf-agent", "$(sys.workdir)"); + "ok_to_run" not => regcmp("/var/cfengine|.*\.cf-agent", "$(sys.workdir)"); files: ok_to_run:: "$(sys.workdir)/modules/usemodule.cf.bat" - create => "true", - perms => usemodule_perms, - edit_line => usemodule_lines; + create => "true", + perms => usemodule_perms, + edit_line => usemodule_lines; } bundle edit_line usemodule_lines @@ -34,33 +33,42 @@ bundle edit_line usemodule_lines windows:: "@echo off"; "\"$(init.script_location)\usemodule.cf.bat\""; + !windows:: "#!/bin/sh"; ". \"$(init.script_location)/usemodule.cf.bat\""; delete_lines: - ".*"; + ".*"; } body perms usemodule_perms { - mode => "755"; + mode => "755"; } ####################################################### - bundle agent test { classes: - "ok_to_run" not => regcmp("/var/cfengine|.*\.cf-agent", "$(sys.workdir)"); + "ok_to_run" not => regcmp("/var/cfengine|.*\.cf-agent", "$(sys.workdir)"); classes: ok_to_run:: # Should be undefined by the following script. "undefined_class" expression => "any"; "function_ok" expression => usemodule("usemodule.cf.bat", ""); - "defined_variable" expression => strcmp("$(usemodule_cf_bat.defined_variable)", "yes"); - "ok" and => { "function_ok", "defined_class", "!undefined_class", "defined_variable" }; + + "defined_variable" + expression => strcmp("$(usemodule_cf_bat.defined_variable)", "yes"); + + "ok" + and => { + "function_ok", + "defined_class", + "!undefined_class", + "defined_variable", + }; vars: ok:: @@ -69,35 +77,42 @@ bundle agent test reports: !ok_to_run:: "Must be run using testall script"; + ok_to_run.DEBUG.!function_ok:: "usemodule did not execute correctly."; + ok_to_run.DEBUG.!defined_class:: "defined_class was not set, but should be."; + ok_to_run.DEBUG.undefined_class:: "undefined_class was set, but shouldn't be."; + ok_to_run.DEBUG.!defined_variable:: "defined_variable was not set, but should be."; ok_to_run.DEBUG.function_ok:: "usemodule executed correctly."; + ok_to_run.DEBUG.defined_class:: "defined_class was set."; + ok_to_run.DEBUG.!undefined_class:: "undefined_class was not set."; + ok_to_run.DEBUG.defined_variable:: "defined_variable was set."; } ####################################################### - bundle agent check { classes: - "ok" expression => strcmp("$(test.ok)", "yes"); + "ok" expression => strcmp("$(test.ok)", "yes"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/03_os/powershell.cf b/tests/acceptance/02_classes/03_os/powershell.cf index fe196a72bb..073f37a32b 100644 --- a/tests/acceptance/02_classes/03_os/powershell.cf +++ b/tests/acceptance/02_classes/03_os/powershell.cf @@ -3,57 +3,69 @@ # Test powershell class # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; + vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: - "ok" and => { "!windows", "!powershell" }; - # This relies on powershell being in the path, which it should be for a standard install. - "detected_powershell" expression => regcmp(".*Succeeded.*", execresult("powershell Get-Content $(G.cwd)$(const.dirsep)text.txt", "useshell")); - "ok" and => { "windows", "powershell", "detected_powershell" }; - "ok" and => { "windows", "!powershell", "!detected_powershell" }; + "ok" and => { "!windows", "!powershell" }; + + # This relies on powershell being in the path, which it should be for a standard install. + "detected_powershell" + expression => regcmp( + ".*Succeeded.*", + execresult( + "powershell Get-Content $(G.cwd)$(const.dirsep)text.txt", "useshell" + ) + ); + + "ok" and => { "windows", "powershell", "detected_powershell" }; + "ok" and => { "windows", "!powershell", "!detected_powershell" }; reports: DEBUG.windows.powershell.!detected_powershell:: "Powershell was detected by CFEngine, but not by the test."; + DEBUG.windows.!powershell.detected_powershell:: "Powershell was detected by the test, but not by CFEngine."; + DEBUG.windows.powershell.detected_powershell:: "Powershell was detected by CFEngine and the test."; + DEBUG.windows.!powershell.!detected_powershell:: "Powershell was not detected by the test, nor by CFEngine."; + DEBUG.!windows.powershell:: "Powershell was detected on a non-Windows system."; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/02_classes/03_os/ubuntu.cf b/tests/acceptance/02_classes/03_os/ubuntu.cf index 7d76a6c747..987867723f 100644 --- a/tests/acceptance/02_classes/03_os/ubuntu.cf +++ b/tests/acceptance/02_classes/03_os/ubuntu.cf @@ -3,49 +3,50 @@ # Test ubuntu classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { classes: ubuntu_18_04.ubuntu_18_4:: - "not_ok"; + "not_ok"; + ubuntu_16_04.ubuntu_16_4:: - "not_ok"; + "not_ok"; + ubuntu_14_04.ubuntu_14_4:: - "not_ok"; + "not_ok"; + ubuntu_12_04.ubuntu_12_4:: - "not_ok"; + "not_ok"; + any:: "ok" not => "not_ok"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/04_examples/mock_stdlib.cf b/tests/acceptance/04_examples/mock_stdlib.cf index b44f473f65..1813507ab6 100644 --- a/tests/acceptance/04_examples/mock_stdlib.cf +++ b/tests/acceptance/04_examples/mock_stdlib.cf @@ -7,60 +7,213 @@ # NOTE: Syntax doesn't allow empty body, but body with 1 class guard is OK # NOTE: It would be nice if this was auto-generated, but it isn't, # just add another body / bundle if you need to use it in an example. +body package_method yum +{ +} + +body package_method generic +{ +} + +body classes enumerate(x) +{ +} + +body perms p(user, mode) +{ +} + +body changes tripwire +{ +} + +body depth_search recurse(d) +{ +} + +body delete tidy +{ +} + +body file_select days_old(days) +{ +} + +body edit_defaults empty +{ +} + +body acl ntfs(acl) +{ +} + +body action if_elapsed(x) +{ +} + +body action warn_only +{ +} + +body classes if_ok(x) +{ +} + +body classes if_repaired(x) +{ +} + +body contain setuid(owner) +{ +} + +body copy_from local_cp(from) +{ +} + +body copy_from remote_cp(from, server) +{ +} + +body copy_from secure_cp(from, server) +{ +} + +body depth_search include_base +{ +} + +body package_method solaris(pkgname, spoolfile, adminfile) +{ +} + +body package_method zypper +{ +} + +body perms mo(mode, user) +{ +} + +body perms mog(mode, user, group) +{ +} + +body perms owner(user) +{ +} + +body rename disable +{ +} + +body rename rotate(level) +{ +} -body package_method yum {} -body package_method generic {} -body classes enumerate(x) {} -body perms p(user,mode) {} -body changes tripwire {} -body depth_search recurse(d) {} -body delete tidy {} -body file_select days_old(days) {} -body edit_defaults empty {} -body acl ntfs(acl) {} -body action if_elapsed(x) {} -body action warn_only {} -body classes if_ok(x) {} -body classes if_repaired(x) {} -body contain setuid(owner) {} -body copy_from local_cp(from) {} -body copy_from remote_cp(from, server) {} -body copy_from secure_cp(from,server) {} -body depth_search include_base {} -body package_method solaris(pkgname, spoolfile, adminfile) {} -body package_method zypper {} -body perms mo(mode, user) {} -body perms mog(mode, user, group) {} -body perms owner(user) {} -body rename disable {} -body rename rotate(level) {} -body rename to(file) {} -body replace_with value(x) {} -body acl strict {} -body changes detect_content {} -body classes if_else (yes, no) {} -body contain in_shell {} -body copy_from remote_dcp(from,server) {} -body package_method msi_explicit(repo) {} -body package_method msi_implicit(repo) {} - -bundle edit_line insert_lines(lines) {} -bundle edit_line append_if_no_line(lines) {} -bundle edit_line prepend_if_no_line(string) {} -bundle edit_line append_user_field(group,field,allusers) {} -bundle edit_line set_user_field(user,field,val) {} -bundle agent package_absent(package) {} -bundle agent package_present(package) {} -bundle agent package_latest(package) {} -bundle agent package_specific_present(packageorfile, package_version, package_arch) {} -bundle agent package_specific_latest(packageorfile, package_version, package_arch) {} -bundle edit_xml xml_insert_tree_nopath(treestring) {} -bundle edit_xml xml_set_value(value, xpath) {} -bundle edit_xml xml_set_attribute(attr, value, xpath) {} -bundle edit_line set_variable_values(v) {} -bundle edit_line expand_template(templatefile) {} -bundle edit_line create_solaris_admin_file {} -bundle common paths {} +body rename to(file) +{ +} + +body replace_with value(x) +{ +} + +body acl strict +{ +} + +body changes detect_content +{ +} + +body classes if_else(yes, no) +{ +} + +body contain in_shell +{ +} + +body copy_from remote_dcp(from, server) +{ +} + +body package_method msi_explicit(repo) +{ +} + +body package_method msi_implicit(repo) +{ +} + +bundle edit_line insert_lines(lines) +{ +} + +bundle edit_line append_if_no_line(lines) +{ +} + +bundle edit_line prepend_if_no_line(string) +{ +} + +bundle edit_line append_user_field(group, field, allusers) +{ +} + +bundle edit_line set_user_field(user, field, val) +{ +} + +bundle agent package_absent(package) +{ +} + +bundle agent package_present(package) +{ +} + +bundle agent package_latest(package) +{ +} + +bundle agent package_specific_present(packageorfile, package_version, package_arch) +{ +} + +bundle agent package_specific_latest(packageorfile, package_version, package_arch) +{ +} + +bundle edit_xml xml_insert_tree_nopath(treestring) +{ +} + +bundle edit_xml xml_set_value(value, xpath) +{ +} + +bundle edit_xml xml_set_attribute(attr, value, xpath) +{ +} + +bundle edit_line set_variable_values(v) +{ +} + +bundle edit_line expand_template(templatefile) +{ +} + +bundle edit_line create_solaris_admin_file +{ +} + +bundle common paths +{ +} # This "test" always passes, it is meant to be included from examples: bundle agent __main__ diff --git a/tests/acceptance/04_examples/outputs/check_outputs.cf b/tests/acceptance/04_examples/outputs/check_outputs.cf index 7f4c108319..ae16ee32fa 100644 --- a/tests/acceptance/04_examples/outputs/check_outputs.cf +++ b/tests/acceptance/04_examples/outputs/check_outputs.cf @@ -3,21 +3,19 @@ # Check the example outputs # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { vars: - "basedir" string => "$(G.cwd)/../../examples"; - "checker" string => "$(basedir)/remake_outputs.pl"; - "all_examples" slist => findfiles("$(basedir)/*.cf"); + "basedir" string => "$(G.cwd)/../../examples"; + "checker" string => "$(basedir)/remake_outputs.pl"; + "all_examples" slist => findfiles("$(basedir)/*.cf"); reports: DEBUG_LOTS:: @@ -25,25 +23,25 @@ bundle agent init } ####################################################### - bundle agent test { meta: - # It's unrealistic to keep this test perfectly stable on all non-Linux platforms. - # It would require examples that quickly get very cluttered. - "test_skip_unsupported" string => "!linux"; + # It's unrealistic to keep this test perfectly stable on all non-Linux platforms. + # It would require examples that quickly get very cluttered. + "test_skip_unsupported" string => "!linux"; vars: - "examples" slist => { @(init.all_examples) }; - "canon[$(examples)]" string => canonify($(examples)); + "examples" slist => { @(init.all_examples) }; + "canon[$(examples)]" string => canonify($(examples)); classes: - "has_output_block_$(canon[$(examples)])" - expression => regline(".*example_output.*", $(examples)); + "has_output_block_$(canon[$(examples)])" + expression => regline(".*example_output.*", $(examples)); methods: - "$(examples)" usebundle => test_example($(examples)), - if => "has_output_block_$(canon[$(examples)])"; + "$(examples)" + usebundle => test_example($(examples)), + if => "has_output_block_$(canon[$(examples)])"; reports: DEBUG:: @@ -54,20 +52,24 @@ bundle agent test bundle agent test_example(file) { vars: - "cfile" string => canonify($(file)); + "cfile" string => canonify($(file)); - "checker" string => "$(G.perl) $(init.checker) --cfagent=$(sys.cf_agent) --workdir=$(G.testdir) -c"; + "checker" + string => "$(G.perl) $(init.checker) --cfagent=$(sys.cf_agent) --workdir=$(G.testdir) -c"; classes: - "failure_$(cfile)" not => returnszero("$(checker) $(file)", "noshell"), scope => "namespace"; + "failure_$(cfile)" + not => returnszero("$(checker) $(file)", "noshell"), + scope => "namespace"; methods: - "with verbose" usebundle => verbose_output("$(checker) -v $(file)"), - if => "failure_$(cfile)"; + "with verbose" + usebundle => verbose_output("$(checker) -v $(file)"), + if => "failure_$(cfile)"; reports: - "$(this.bundle): checker '$(checker) $(file)' returned error" - if => "failure_$(cfile)"; + "$(this.bundle): checker '$(checker) $(file)' returned error" + if => "failure_$(cfile)"; DEBUG:: "$(this.bundle): ran checker '$(checker) $(file)'"; @@ -76,19 +78,19 @@ bundle agent test_example(file) bundle agent verbose_output(runme) { commands: - "$(runme)"; + "$(runme)"; } ####################################################### - bundle agent check { classes: - "ok" not => classmatch("failure.*"); + "ok" not => classmatch("failure.*"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/04_examples/syntax/check_syntax.cf b/tests/acceptance/04_examples/syntax/check_syntax.cf index 88e87faf07..347329a35a 100644 --- a/tests/acceptance/04_examples/syntax/check_syntax.cf +++ b/tests/acceptance/04_examples/syntax/check_syntax.cf @@ -8,15 +8,13 @@ # $ ./testall 04_examples/syntax/check_syntax.cf ; less test.log # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { vars: @@ -28,25 +26,38 @@ bundle agent init methods: "stdlib_symlink" usebundle => lib_maybe_symlink( - "$(mock)", "$(G.testdir)/inputs/lib/stdlib.cf"); + "$(mock)", "$(G.testdir)/inputs/lib/stdlib.cf" + ); + "paths_symlink" usebundle => lib_maybe_symlink( - "$(mock)", "$(G.testdir)/inputs/lib/paths.cf"); + "$(mock)", "$(G.testdir)/inputs/lib/paths.cf" + ); + "users_symlink" usebundle => lib_maybe_symlink( - "$(mock)", "$(G.testdir)/inputs/lib/users.cf"); + "$(mock)", "$(G.testdir)/inputs/lib/users.cf" + ); + "services_symlink" usebundle => lib_maybe_symlink( - "$(mock)", "$(G.testdir)/inputs/lib/services.cf"); + "$(mock)", "$(G.testdir)/inputs/lib/services.cf" + ); + "packages_symlink" usebundle => lib_maybe_symlink( - "$(mock)", "$(G.testdir)/inputs/lib/packages.cf"); + "$(mock)", "$(G.testdir)/inputs/lib/packages.cf" + ); + "commands_symlink" usebundle => lib_maybe_symlink( - "$(mock)", "$(G.testdir)/inputs/lib/commands.cf"); + "$(mock)", "$(G.testdir)/inputs/lib/commands.cf" + ); + "files_symlink" usebundle => lib_maybe_symlink( - "$(mock)", "$(G.testdir)/inputs/lib/files.cf"); + "$(mock)", "$(G.testdir)/inputs/lib/files.cf" + ); DEBUG_LOTS:: "$(this.bundle): will consider example $(all_examples)"; @@ -57,26 +68,21 @@ bundle agent lib_maybe_symlink(src, dst) # If dst already exists, assume it's correct (testing with masterfiles) { classes: - "file_missing" - if => not(fileexists("$(dst)")); + "file_missing" if => not(fileexists("$(dst)")); + methods: file_missing:: - "symlink" - usebundle => symlink("$(src)", "$(dst)"); + "symlink" usebundle => symlink("$(src)", "$(dst)"); } bundle agent symlink(src, dst) { vars: - "dir" - string => dirname("$(dst)"); + "dir" string => dirname("$(dst)"); files: - "$(dir)/." - create => "true"; - - "$(dst)" - link_from => ln_s("$(src)"); + "$(dir)/." create => "true"; + "$(dst)" link_from => ln_s("$(src)"); } body link_from ln_s(x) @@ -86,23 +92,20 @@ body link_from ln_s(x) } ####################################################### - bundle agent test { meta: - # It's unrealistic to keep this test perfectly stable on all non-Linux platforms. - # It would require examples that quickly get very cluttered. - "test_skip_unsupported" - string => "!linux"; - "description" - string => "Syntax check each policy (.cf) file in examples"; + # It's unrealistic to keep this test perfectly stable on all non-Linux platforms. + # It would require examples that quickly get very cluttered. + "test_skip_unsupported" string => "!linux"; + "description" string => "Syntax check each policy (.cf) file in examples"; vars: - "examples" slist => { @(init.all_examples) }; - "canon[$(examples)]" string => canonify($(examples)); + "examples" slist => { @(init.all_examples) }; + "canon[$(examples)]" string => canonify($(examples)); methods: - "$(examples)" usebundle => test_example($(examples)); + "$(examples)" usebundle => test_example($(examples)); reports: DEBUG:: @@ -113,21 +116,22 @@ bundle agent test bundle agent test_example(file) { vars: - "cfile" string => canonify($(file)); - "checker" - # -c option is omitted, because it enforces bundlesequence / main - string => "$(sys.cf_promises) --workdir=$(G.testdir)"; + "cfile" string => canonify($(file)); + + "checker" + # -c option is omitted, because it enforces bundlesequence / main + string => "$(sys.cf_promises) --workdir=$(G.testdir)"; classes: - "failure_$(cfile)" - not => returnszero("$(checker) $(file)", "noshell"), - scope => "namespace"; + "failure_$(cfile)" + not => returnszero("$(checker) $(file)", "noshell"), + scope => "namespace"; reports: DEBUG:: - "Syntax error in example: '$(file)'" - if => "failure_$(cfile)", - handle => "reported_error_$(cfile)"; + "Syntax error in example: '$(file)'" + if => "failure_$(cfile)", + handle => "reported_error_$(cfile)"; methods: "verbose_$(cfile)" @@ -143,24 +147,24 @@ bundle agent run_with_output(runme) { vars: "c" string => canonify("$(runme)"); + reports: - "Running: $(runme)" - handle => "printed_$(c)"; + "Running: $(runme)" handle => "printed_$(c)"; + commands: - "$(runme)" - depends_on => { "printed_$(c)" }; + "$(runme)" depends_on => { "printed_$(c)" }; } ####################################################### - bundle agent check { classes: - "ok" not => classmatch("failure_.*"); + "ok" not => classmatch("failure_.*"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/00_hpux_ps_setup_serial.cf b/tests/acceptance/05_processes/00_hpux_ps_setup_serial.cf index 5b17bc5297..5128e3cf76 100644 --- a/tests/acceptance/05_processes/00_hpux_ps_setup_serial.cf +++ b/tests/acceptance/05_processes/00_hpux_ps_setup_serial.cf @@ -2,46 +2,46 @@ # DEFAULT_CMD_LINE_WIDTH is too low ps output may be truncated, leading to test # failures. We adjust it here if we are running in unsafe mode, else we simply # check that it is correct and fail if it isn't. - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent test { meta: - "test_skip_unsupported" string => "!hpux"; + "test_skip_unsupported" string => "!hpux"; classes: - "unsafe_mode" - expression => strcmp(getenv("UNSAFE_TESTS", "10"), "1"), - scope => "namespace"; + "unsafe_mode" + expression => strcmp(getenv("UNSAFE_TESTS", "10"), "1"), + scope => "namespace"; files: unsafe_mode:: - "/etc/default/ps" - edit_line => ps_edit; + "/etc/default/ps" edit_line => ps_edit; } bundle edit_line ps_edit { delete_lines: - "\s*DEFAULT_CMD_LINE_WIDTH\s*=\s*[0-9]+\s*"; + "\s*DEFAULT_CMD_LINE_WIDTH\s*=\s*[0-9]+\s*"; + insert_lines: - "DEFAULT_CMD_LINE_WIDTH=1024"; + "DEFAULT_CMD_LINE_WIDTH=1024"; } bundle agent check { classes: - "ok" expression => regline("DEFAULT_CMD_LINE_WIDTH=1024", - "/etc/default/ps"); + "ok" + expression => regline("DEFAULT_CMD_LINE_WIDTH=1024", "/etc/default/ps"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/01_matching/inverse_ttime_classes_body_params.cf b/tests/acceptance/05_processes/01_matching/inverse_ttime_classes_body_params.cf index bc90bacd6c..47cde3b53a 100644 --- a/tests/acceptance/05_processes/01_matching/inverse_ttime_classes_body_params.cf +++ b/tests/acceptance/05_processes/01_matching/inverse_ttime_classes_body_params.cf @@ -3,56 +3,57 @@ # Set a class if a process does exist, more complex matches # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { processes: - ".*" + ".*" process_select => test_select_high_users, classes => test_set_class("found", "not_found"); } -body classes test_set_class(t,f) +body classes test_set_class(t, f) { - promise_kept => { "$(t)" }; - promise_repaired => { "$(t)" }; - repair_failed => { "$(f)" }; + promise_kept => { "$(t)" }; + promise_repaired => { "$(t)" }; + repair_failed => { "$(f)" }; } body process_select test_select_high_users { - ttime_range => irange(0, accumulated(9,0,0,0,0,0)); # Anything - process_result => "!ttime"; # Nothing -} + ttime_range => irange(0, accumulated(9, 0, 0, 0, 0, 0)); + # Anything + process_result => "!ttime"; -####################################################### + # Nothing +} +####################################################### bundle agent check { classes: - "ok" expression => "found.!not_found"; # Nothing found is "kept" + "ok" expression => "found.!not_found"; + # Nothing found is "kept" reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/01_matching/inverse_ttime_inverse_found.cf b/tests/acceptance/05_processes/01_matching/inverse_ttime_inverse_found.cf index be4d240471..23fe2da7d3 100644 --- a/tests/acceptance/05_processes/01_matching/inverse_ttime_inverse_found.cf +++ b/tests/acceptance/05_processes/01_matching/inverse_ttime_inverse_found.cf @@ -4,66 +4,68 @@ # we wanted not to (irange(0,0)) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "test_flakey_fail" string => "aix_7_1", - meta => { "CFE-3313" }; + "test_flakey_fail" + string => "aix_7_1", + meta => { "CFE-3313" }; processes: - ".*" + ".*" process_count => test_range, process_select => test_select_high_users; } body process_count test_range { - in_range_define => { "none_found" }; - out_of_range_define => { "some_found" }; + in_range_define => { "none_found" }; + out_of_range_define => { "some_found" }; - aix:: - # Allow one process with CPU time not between 0 seconds and 99 years on - # AIX because a process with TIME '-' sometimes appears there. - match_range => irange(0, 1); - !aix:: - match_range => irange(0, 0); + aix:: + # Allow one process with CPU time not between 0 seconds and 99 years on + # AIX because a process with TIME '-' sometimes appears there. + match_range => irange(0, 1); + + !aix:: + match_range => irange(0, 0); } body process_select test_select_high_users { - ttime_range => irange(0, accumulated(99,0,0,0,0,0)); # Anything - process_result => "!ttime"; # Nothing -} + ttime_range => irange(0, accumulated(99, 0, 0, 0, 0, 0)); + # Anything + process_result => "!ttime"; -####################################################### + # Nothing +} +####################################################### bundle agent check { classes: - "ok" expression => "none_found.!some_found"; + "ok" expression => "none_found.!some_found"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/01_matching/negative_restart_class.cf b/tests/acceptance/05_processes/01_matching/negative_restart_class.cf index f484453778..d126f923c3 100644 --- a/tests/acceptance/05_processes/01_matching/negative_restart_class.cf +++ b/tests/acceptance/05_processes/01_matching/negative_restart_class.cf @@ -3,44 +3,40 @@ # Set a class if a process exists # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { processes: - "\bcf-agent\b" - restart_class => "not_ok"; + "\bcf-agent\b" restart_class => "not_ok"; classes: - "ok" not => "not_ok"; + "ok" not => "not_ok"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/01_matching/owner.cf b/tests/acceptance/05_processes/01_matching/owner.cf index 96fcc8b764..c32c2c2e15 100644 --- a/tests/acceptance/05_processes/01_matching/owner.cf +++ b/tests/acceptance/05_processes/01_matching/owner.cf @@ -4,85 +4,88 @@ # We test both expected success and expected failure. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { - meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10217" }; + meta: + "test_soft_fail" + string => "windows", + meta => { "ENT-10217" }; vars: - "ok_list" slist => { - "pass_root_1", "pass_root_2", "pass_nouser_3", "pass_nouser_4", - "!fail_root_1", "!fail_root_2", "!fail_nouser_3", "!fail_nouser_4" + "ok_list" + slist => { + "pass_root_1", + "pass_root_2", + "pass_nouser_3", + "pass_nouser_4", + "!fail_root_1", + "!fail_root_2", + "!fail_nouser_3", + "!fail_nouser_4", }; processes: - ### 'root' processes: - # finding many processes is good - ".*" - process_select => test_select_owners("root"), - process_count => test_range("2", "inf", "pass_root_1", "fail_root_1"); - - # looking for a tiny number should fail - ".*" - process_select => test_select_owners("root"), - process_count => test_range("0", "1", "fail_root_2", "pass_root_2"); - - ### A hopefully non-existent user: - # finding zero processes is good - ".*" - process_select => test_select_owners("NoSuchUserWeHope"), - process_count => test_range("0", "0", "pass_nouser_3", "fail_nouser_3"); - - # looking for one or more should fail - ".*" - process_select => test_select_owners("NoSuchUserWeHope"), - process_count => test_range("1", "inf", "fail_nouser_4", "pass_nouser_4"); - + ### 'root' processes: + # finding many processes is good + ".*" + process_select => test_select_owners("root"), + process_count => test_range("2", "inf", "pass_root_1", "fail_root_1"); + + # looking for a tiny number should fail + ".*" + process_select => test_select_owners("root"), + process_count => test_range("0", "1", "fail_root_2", "pass_root_2"); + + ### A hopefully non-existent user: + # finding zero processes is good + ".*" + process_select => test_select_owners("NoSuchUserWeHope"), + process_count => test_range("0", "0", "pass_nouser_3", "fail_nouser_3"); + + # looking for one or more should fail + ".*" + process_select => test_select_owners("NoSuchUserWeHope"), + process_count => test_range("1", "inf", "fail_nouser_4", "pass_nouser_4"); } body process_count test_range(min, max, class_good, class_bad) { - match_range => irange("$(min)", "$(max)"); - in_range_define => { "$(class_good)" }; - out_of_range_define => { "$(class_bad)" }; + match_range => irange("$(min)", "$(max)"); + in_range_define => { "$(class_good)" }; + out_of_range_define => { "$(class_bad)" }; } body process_select test_select_owners(owner) { - process_owner => { "$(owner)" }; - process_result => "process_owner"; + process_owner => { "$(owner)" }; + process_result => "process_owner"; } - ####################################################### - bundle agent check { classes: - "ok" and => { @(test.ok_list) }; + "ok" and => { @(test.ok_list) }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/01_matching/partial_name_inverse_found.cf b/tests/acceptance/05_processes/01_matching/partial_name_inverse_found.cf index 971c5d10e6..62a8b21708 100644 --- a/tests/acceptance/05_processes/01_matching/partial_name_inverse_found.cf +++ b/tests/acceptance/05_processes/01_matching/partial_name_inverse_found.cf @@ -4,48 +4,46 @@ # but partial match name fails # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { processes: - "cf-agen$" - process_count => test_no_such; + "cf-agen$" process_count => test_no_such; } body process_count test_no_such { - in_range_define => { "none_found" }; - out_of_range_define => { "some_found" }; - match_range => irange(0,0); + in_range_define => { "none_found" }; + out_of_range_define => { "some_found" }; + match_range => irange(0, 0); } ####################################################### - bundle agent check { classes: - "ok" expression => "none_found.!some_found"; + "ok" expression => "none_found.!some_found"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 30 diff --git a/tests/acceptance/05_processes/01_matching/partial_name_inverse_not_found.cf b/tests/acceptance/05_processes/01_matching/partial_name_inverse_not_found.cf index f9465d26de..f6a1c87e0c 100644 --- a/tests/acceptance/05_processes/01_matching/partial_name_inverse_not_found.cf +++ b/tests/acceptance/05_processes/01_matching/partial_name_inverse_not_found.cf @@ -4,48 +4,44 @@ # and partial name match succeeds but we wanted zero found # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { processes: - "-agent" - process_count => test_no_such; + "-agent" process_count => test_no_such; } body process_count test_no_such { - in_range_define => { "none_found" }; - out_of_range_define => { "some_found" }; - match_range => irange(0,0); + in_range_define => { "none_found" }; + out_of_range_define => { "some_found" }; + match_range => irange(0, 0); } ####################################################### - bundle agent check { classes: - "ok" expression => "!none_found.some_found"; + "ok" expression => "!none_found.some_found"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/01_matching/process_count_fncalls.cf b/tests/acceptance/05_processes/01_matching/process_count_fncalls.cf index ee6f476fb2..8942e8f098 100644 --- a/tests/acceptance/05_processes/01_matching/process_count_fncalls.cf +++ b/tests/acceptance/05_processes/01_matching/process_count_fncalls.cf @@ -1,18 +1,17 @@ bundle agent main { meta: - "description" -> { "CFE-2067" } - string => "Test that process_count body can have (failing) function calls"; + "description" -> { "CFE-2067" } + string => "Test that process_count body can have (failing) function calls"; processes: - # Test that this doesn't cause a crash / abort: - "cf-execd" - process_count => process_count_one("$(nosuchvar)"); - # Error will be printed since variable won't expand, expected behavior + # Test that this doesn't cause a crash / abort: + "cf-execd" process_count => process_count_one("$(nosuchvar)"); + # Error will be printed since variable won't expand, expected behavior reports: - # Nothing to check, running without crashing is good enough - "$(this.promise_filename) Pass"; + # Nothing to check, running without crashing is good enough + "$(this.promise_filename) Pass"; } body process_count process_count_one(suffix) diff --git a/tests/acceptance/05_processes/01_matching/process_count_found.cf b/tests/acceptance/05_processes/01_matching/process_count_found.cf index 5f1211e21c..cb53252b7b 100644 --- a/tests/acceptance/05_processes/01_matching/process_count_found.cf +++ b/tests/acceptance/05_processes/01_matching/process_count_found.cf @@ -3,48 +3,44 @@ # Set a class if a process does exist # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { processes: - "\bcf-agent\b" - process_count => test_no_such; + "\bcf-agent\b" process_count => test_no_such; } body process_count test_no_such { - in_range_define => { "found" }; - out_of_range_define => { "not_found" }; - match_range => irange(1,"inf"); + in_range_define => { "found" }; + out_of_range_define => { "not_found" }; + match_range => irange(1, "inf"); } ####################################################### - bundle agent check { classes: - "ok" expression => "found.!not_found"; + "ok" expression => "found.!not_found"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/01_matching/process_count_inverse_found.cf b/tests/acceptance/05_processes/01_matching/process_count_inverse_found.cf index 6db3540cf9..d4f17385cf 100644 --- a/tests/acceptance/05_processes/01_matching/process_count_inverse_found.cf +++ b/tests/acceptance/05_processes/01_matching/process_count_inverse_found.cf @@ -3,48 +3,44 @@ # Set a class if a process does not exist # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { processes: - "There-is-NoPrOCess-with-this-name" - process_count => test_no_such; + "There-is-NoPrOCess-with-this-name" process_count => test_no_such; } body process_count test_no_such { - in_range_define => { "found" }; - out_of_range_define => { "not_found" }; - match_range => irange(0,0); + in_range_define => { "found" }; + out_of_range_define => { "not_found" }; + match_range => irange(0, 0); } ####################################################### - bundle agent check { classes: - "ok" expression => "found.!not_found"; + "ok" expression => "found.!not_found"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/01_matching/process_count_inverse_not_found.cf b/tests/acceptance/05_processes/01_matching/process_count_inverse_not_found.cf index 75218abbf7..993ffc02fc 100644 --- a/tests/acceptance/05_processes/01_matching/process_count_inverse_not_found.cf +++ b/tests/acceptance/05_processes/01_matching/process_count_inverse_not_found.cf @@ -3,48 +3,44 @@ # Set a class if a process does exist # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { processes: - "\bcf-agent\b" - process_count => test_no_such; + "\bcf-agent\b" process_count => test_no_such; } body process_count test_no_such { - in_range_define => { "none_found" }; - out_of_range_define => { "some_found" }; - match_range => irange(0,0); + in_range_define => { "none_found" }; + out_of_range_define => { "some_found" }; + match_range => irange(0, 0); } ####################################################### - bundle agent check { classes: - "ok" expression => "!none_found.some_found"; + "ok" expression => "!none_found.some_found"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/01_matching/process_count_not_found.cf b/tests/acceptance/05_processes/01_matching/process_count_not_found.cf index aae5b702d4..acd09532b7 100644 --- a/tests/acceptance/05_processes/01_matching/process_count_not_found.cf +++ b/tests/acceptance/05_processes/01_matching/process_count_not_found.cf @@ -3,48 +3,44 @@ # Set a class if a process does not exist # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { processes: - "There-is-NoPrOCess-with-this-name" - process_count => test_no_such; + "There-is-NoPrOCess-with-this-name" process_count => test_no_such; } body process_count test_no_such { - in_range_define => { "found" }; - out_of_range_define => { "not_found" }; - match_range => irange(1,"inf"); + in_range_define => { "found" }; + out_of_range_define => { "not_found" }; + match_range => irange(1, "inf"); } ####################################################### - bundle agent check { classes: - "ok" expression => "!found.not_found"; + "ok" expression => "!found.not_found"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/01_matching/process_select_fncalls.cf b/tests/acceptance/05_processes/01_matching/process_select_fncalls.cf index 8a9d96abea..027efcc282 100644 --- a/tests/acceptance/05_processes/01_matching/process_select_fncalls.cf +++ b/tests/acceptance/05_processes/01_matching/process_select_fncalls.cf @@ -1,36 +1,37 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "description" -> { "CFE-1968" } - string => "Test that process_select body can have (failing) function calls"; - "test_soft_fail" string => "windows", - meta => { "ENT-10217" }; + "description" -> { "CFE-1968" } + string => "Test that process_select body can have (failing) function calls"; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10217" }; vars: - "canonified_uid" - string => canonify(getuid("nosuchuser")); + "canonified_uid" string => canonify(getuid("nosuchuser")); processes: any:: "cf-agent" process_select => by_owner_no_fncall("nosuchuser", "$(canonified_uid)"), process_count => proc_found_one_or_more("nosuchuser_no_fncall"); + "cf-agent" process_select => by_owner("nosuchuser"), process_count => proc_found_one_or_more("nosuchuser"); - "nosuchproc" - process_count => proc_found_one_or_more("nosuchproc"); - "cf-agent" - process_count => proc_found_one_or_more("agent"); + + "nosuchproc" process_count => proc_found_one_or_more("nosuchproc"); + "cf-agent" process_count => proc_found_one_or_more("agent"); + ".*" process_select => by_owner("root"), process_count => proc_found_one_or_more("root"); @@ -39,9 +40,9 @@ bundle agent test body process_count proc_found_one_or_more(prefix) # defines _found / _not_found if there are 1 or more / 0 matches, respectively { - in_range_define => { "$(prefix)_found" }; - out_of_range_define => { "$(prefix)_not_found" }; - match_range => irange(1,"inf"); + in_range_define => { "$(prefix)_found" }; + out_of_range_define => { "$(prefix)_not_found" }; + match_range => irange(1, "inf"); } body process_select by_owner(u) @@ -54,43 +55,51 @@ body process_select by_owner(u) # @note: if getuid fails (because there is no user) the canonify call will # not resolve, and that part of the list will be skipped. { - process_owner => { "$(u)", canonify(getuid("$(u)")) }; - process_result => "process_owner"; + process_owner => { "$(u)", canonify(getuid("$(u)")) }; + process_result => "process_owner"; } body process_select by_owner_no_fncall(u, cgu) # Compare behavior to this backwards compatible body { - process_owner => { "$(u)", "$(cgu)" }; - process_result => "process_owner"; + process_owner => { "$(u)", "$(cgu)" }; + process_result => "process_owner"; } - ####################################################### - bundle agent check { classes: - "ok" - and => { - "!nosuchuser_no_fncall_found", "nosuchuser_no_fncall_not_found", - "!nosuchuser_found", "nosuchuser_not_found", - "!nosuchproc_found", "nosuchproc_not_found", - "agent_found", "!agent_not_found", - "root_found", "!root_not_found" - }; + "ok" + and => { + "!nosuchuser_no_fncall_found", + "nosuchuser_no_fncall_not_found", + "!nosuchuser_found", + "nosuchuser_not_found", + "!nosuchproc_found", + "nosuchproc_not_found", + "agent_found", + "!agent_not_found", + "root_found", + "!root_not_found", + }; reports: DEBUG.agent_found:: "ok - found agent"; + DEBUG.nosuchproc_found:: "not ok - found nosuchproc"; + DEBUG.nosuchuser_found:: "not ok - found nosuchuser"; + DEBUG.root_found:: "ok - found root!"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/01_matching/promiser_match_is_correct.cf b/tests/acceptance/05_processes/01_matching/promiser_match_is_correct.cf index 6839e0fe7b..54bdc6a365 100644 --- a/tests/acceptance/05_processes/01_matching/promiser_match_is_correct.cf +++ b/tests/acceptance/05_processes/01_matching/promiser_match_is_correct.cf @@ -1,23 +1,22 @@ # Test that process promise only matches the promiser against the command line # not the full ps line output. Also verify that a command line longer than 80 # characters can be matched using the promiser. Created for Redmine #7627. - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "debug_info", default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "debug_info", default("$(this.promise_filename)") }; } bundle common userinfo { vars: - "cmd" string => "id | sed -e 's/.*uid=\([0-9][0-9]*\).*/\1/'"; + "cmd" string => "id | sed -e 's/.*uid=\([0-9][0-9]*\).*/\1/'"; any:: "current_user" string => execresult($(cmd), "useshell"); classes: - "root_user" expression => strcmp("$(current_user)", "0"); + "root_user" expression => strcmp("$(current_user)", "0"); } bundle agent debug_info @@ -30,65 +29,62 @@ bundle agent debug_info bundle agent init { meta: - # Using background commands, this won't work correctly on Windows. - # Also, we need to be root user to test this correctly, since we need to - # match against the user in the ps output. - # And we can't use no_fds under fakeroot. - "test_skip_needs_work" string => "windows|!root_user|using_fakeroot"; + # Using background commands, this won't work correctly on Windows. + # Also, we need to be root user to test this correctly, since we need to + # match against the user in the ps output. + # And we can't use no_fds under fakeroot. + "test_skip_needs_work" string => "windows|!root_user|using_fakeroot"; commands: - "$(G.no_fds) --no-std $(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_underscore_marks_the_81st_character_of_this_string___STRINGBEYOND80CHARS &" - contain => in_shell; + "$(G.no_fds) --no-std $(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_underscore_marks_the_81st_character_of_this_string___STRINGBEYOND80CHARS &" + contain => in_shell; - # give the process a chance to actually start - "$(G.sleep) 1"; + # give the process a chance to actually start + "$(G.sleep) 1"; } body process_count at_least_one(class) { - match_range => irange("1", "1000"); - in_range_define => { "$(class)" }; + match_range => irange("1", "1000"); + in_range_define => { "$(class)" }; } bundle agent test { processes: - "$(this.promise_filename).sub" - process_count => at_least_one("cf_agent"); - "STRINGBEYOND80CHARS" - process_count => at_least_one("string"); - # This is intended to look for a username in the process matching, which - # is wrong, we only want it to match the command string. However, "root" - # might be in the home path of the executing user, which is valid, so - # avoid that match. - "root[^/].*$(this.promise_filename).sub" - process_count => at_least_one("root"); + "$(this.promise_filename).sub" process_count => at_least_one("cf_agent"); + "STRINGBEYOND80CHARS" process_count => at_least_one("string"); + + # This is intended to look for a username in the process matching, which + # is wrong, we only want it to match the command string. However, "root" + # might be in the home path of the executing user, which is valid, so + # avoid that match. + "root[^/].*$(this.promise_filename).sub" + process_count => at_least_one("root"); } bundle agent check { vars: - "expected_classes" slist => { - "cf_agent", - "string", - "!root", - }; + "expected_classes" slist => { "cf_agent", "string", "!root" }; classes: - "ok" and => { @(expected_classes) }; + "ok" and => { @(expected_classes) }; commands: - # Just sleep a little to make sure our background command has finished. - "$(G.sleep) 6"; + # Just sleep a little to make sure our background command has finished. + "$(G.sleep) 6"; reports: DEBUG:: "expected_classes = $(expected_classes)"; + "Expression evaluated to false, should be true: $(expected_classes)" unless => "$(expected_classes)"; !root_user|!ok:: "$(this.promise_filename) FAIL"; + root_user.ok:: "$(this.promise_filename) Pass"; } diff --git a/tests/acceptance/05_processes/01_matching/restart_class.cf b/tests/acceptance/05_processes/01_matching/restart_class.cf index 74b4dfdec7..d152de5f4d 100644 --- a/tests/acceptance/05_processes/01_matching/restart_class.cf +++ b/tests/acceptance/05_processes/01_matching/restart_class.cf @@ -3,41 +3,37 @@ # Set a class if a process does not exist # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { processes: - "There-is-NoPrOCess-with-this-name" - restart_class => "ok"; + "There-is-NoPrOCess-with-this-name" restart_class => "ok"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/01_matching/select_without_result.cf b/tests/acceptance/05_processes/01_matching/select_without_result.cf index 51d1f190e5..a248c05be5 100644 --- a/tests/acceptance/05_processes/01_matching/select_without_result.cf +++ b/tests/acceptance/05_processes/01_matching/select_without_result.cf @@ -13,76 +13,77 @@ # all processes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - # This test exposes a known issue with processes on the Windows platform. - "test_soft_fail" - string => "windows|solaris|hpux", - meta => { "ENT-12751", "ENT-13505" }; + # This test exposes a known issue with processes on the Windows platform. + "test_soft_fail" + string => "windows|solaris|hpux", + meta => { "ENT-12751", "ENT-13505" }; - "description" -> {"CFE-4511"} - string => "process_select body without process_result"; + "description" -> { "CFE-4511" } + string => "process_select body without process_result"; processes: - ### Expect zero processes on a tty with a highly unlikely name. - ".*" - handle => "expect_none", - process_select => test_without_process_result("1"), - process_count => test_range("0", "0", "pass_bad_vsize", "fail_bad_vsize"); - - ### Expect to find one or more processes on these ttys. - ".*" - handle => "expect_some", - process_select => test_without_process_result("inf"), - process_count => test_range("1", "inf", "pass_good_vsize", "fail_good_vsize"); + ### Expect zero processes on a tty with a highly unlikely name. + ".*" + handle => "expect_none", + process_select => test_without_process_result("1"), + process_count => test_range("0", "0", "pass_bad_vsize", "fail_bad_vsize"); + ### Expect to find one or more processes on these ttys. + ".*" + handle => "expect_some", + process_select => test_without_process_result("inf"), + process_count => test_range( + "1", "inf", "pass_good_vsize", "fail_good_vsize" + ); } body process_select test_without_process_result(vsize) { - vsize => "1,$(vsize)"; - ppid => "1,1"; + vsize => "1,$(vsize)"; + ppid => "1,1"; } body process_count test_range(min, max, class_good, class_bad) { - match_range => irange("$(min)", "$(max)"); - in_range_define => { "$(class_good)" }; - out_of_range_define => { "$(class_bad)" }; + match_range => irange("$(min)", "$(max)"); + in_range_define => { "$(class_good)" }; + out_of_range_define => { "$(class_bad)" }; } ####################################################### - bundle agent check { classes: - "ok" and => { - "pass_good_vsize", "pass_bad_vsize", - "!fail_good_vsize", "!fail_bad_vsize", + "ok" + and => { + "pass_good_vsize", + "pass_bad_vsize", + "!fail_good_vsize", + "!fail_bad_vsize", }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/01_matching/stime_range.cf b/tests/acceptance/05_processes/01_matching/stime_range.cf index 06d5135509..4b9ee4157a 100644 --- a/tests/acceptance/05_processes/01_matching/stime_range.cf +++ b/tests/acceptance/05_processes/01_matching/stime_range.cf @@ -24,29 +24,35 @@ # which to notice the failure). # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "now_raw" string => execresult("$(G.ps) -o stime $$", "useshell"); + "now_raw" string => execresult("$(G.ps) -o stime $$", "useshell"); + got_ps.got_now:: # Get pid and parsed etime for processes whose stime isn't # actually a time; use sed to munge ps's output into a csv # format for ease of ingestion: - "ps_list" string => execresult("$(G.ps) -eo pid,stime,etime | sed -n -e 's/[ \t]*\([0-9][0-9]*\)[ \t][ \t]*[A-Z][a-z0-9]*[ \t][ \t]*\(\([0-9][0-9]*\)-\)\?\([0-9][0-9]*\):\([0-9][0-9]*\):\([0-9][0-9]*\)/\1,\3,\4,\5,\6/p'", "useshell"); + "ps_list" + string => execresult( + "$(G.ps) -eo pid,stime,etime | sed -n -e 's/[ \t]*\([0-9][0-9]*\)[ \t][ \t]*[A-Z][a-z0-9]*[ \t][ \t]*\(\([0-9][0-9]*\)-\)\?\([0-9][0-9]*\):\([0-9][0-9]*\):\([0-9][0-9]*\)/\1,\3,\4,\5,\6/p'", + "useshell" + ); + # Ingest the results, save in procs[i][j]: - "count" int => parsestringarrayidx("procs", "$(ps_list)", - "no comment", ",", - "1000", "100000"); + "count" + int => parsestringarrayidx( + "procs", "$(ps_list)", "no comment", ",", "1000", "100000" + ); + # procs[i][j] for each i describe one process; # for j = 0, ..., 4, entries are a pid and its age in days, hrs, mins, secs "pndx" slist => getindices("procs"); @@ -54,126 +60,151 @@ bundle agent init # Now flatten h:m:s to total seconds, for each proc-index: "hrassec[$(pndx)]" ilist => { "$(procs[$(pndx)][2])", "3600" }; "min2sec[$(pndx)]" ilist => { "$(procs[$(pndx)][3])", "60" }; - "hms[$(pndx)]" rlist => { product("hrassec[$(pndx)]"), - product("min2sec[$(pndx)]"), - "$(procs[$(pndx)][4])" }; + + "hms[$(pndx)]" + rlist => { + product("hrassec[$(pndx)]"), + product("min2sec[$(pndx)]"), + "$(procs[$(pndx)][4])", + }; + # Map pids to seconds before a whole number of days ago: - "when[$(procs[$(pndx)][0])]" string => format("%.0f", sum("hms[$(pndx)]")); + "when[$(procs[$(pndx)][0])]" + string => format("%.0f", sum("hms[$(pndx)]")); # Likewise reduce "now" to a number of seconds into today: "hrassec[now]" ilist => { "$(now[1])", "3600" }; "min2sec[now]" ilist => { "$(now[2])", "60" }; - "hms[now]" rlist => { product("hrassec[now]"), - product("min2sec[now]") }; + "hms[now]" rlist => { product("hrassec[now]"), product("min2sec[now]") }; "present" string => format("%.0f", sum("hms[now]")); + # Allow for up to 10s delay between when we asked for now_raw # and when bundle agent test runs: "pausing" rlist => { @(hms[now]), "10" }; "paused" string => format("%.0f", sum("pausing")); + # Naturally, this doesn't work so well if the interval between # present and paused straddles midnight; see bad_timing, below. - # How many days back is each pid ? - "past[$(pndx)]" slist => { + "past[$(pndx)]" + slist => { # Number of days from elapsed time, 0 if none specified: ifelse("got_day_$(pndx)", "$(proc_day[$(pndx)][0])", "0"), # Plus one for those started late in their days: - ifelse("late_$(procs[$(pndx)][0])", "1", "0") }; - "days[$(procs[$(pndx)][0])]" string => format("%.0f", sum("past[$(pndx)]")); + ifelse("late_$(procs[$(pndx)][0])", "1", "0"), + }; + + "days[$(procs[$(pndx)][0])]" + string => format("%.0f", sum("past[$(pndx)]")); + "pid" slist => getindices("days"); classes: - # Give up on test unless these are set: - "got_now" expression => regextract("^(\d+):(\d+)$", "$(now_raw)", "now"); - "got_ps" expression => isexecutable("$(G.ps)"); + # Give up on test unless these are set: + "got_now" expression => regextract("^(\d+):(\d+)$", "$(now_raw)", "now"); + "got_ps" expression => isexecutable("$(G.ps)"); + got_ps.got_now:: "got_data" expression => isgreaterthan(length("pndx"), 0); - # Filtering processes + + # Filtering processes got_data:: # Are we too close to midnight ? - "bad_timing" expression => isgreaterthan("$(paused)", 86400); # 24*60*60 + "bad_timing" expression => isgreaterthan("$(paused)", 86400); + + # 24*60*60 # Which procs[$(pndx)] have non-empty days, procs[$(pndx)][1] ? "got_day_$(pndx)" - expression => regextract("(\d+)", "$(procs[$(pndx)][1])", - "proc_day[$(pndx)]"); + expression => regextract( + "(\d+)", "$(procs[$(pndx)][1])", "proc_day[$(pndx)]" + ); + # A process started late in its day if less than $(present) # seconds before a whole number of days ago: "late_$(procs[$(pndx)][0])" - expression => isgreaterthan("$(present)", "$(when[$(procs[$(pndx)][0])])"), + expression => isgreaterthan( + "$(present)", "$(when[$(procs[$(pndx)][0])])" + ), scope => "namespace"; + # ... and early in its day if more than $(paused) seconds before # a whole number of days ago: "early_$(procs[$(pndx)][0])" - and => { isgreaterthan("$(when[$(procs[$(pndx)][0])])", "$(paused)"), - "got_day_$(pndx)" }, + and => { + isgreaterthan("$(when[$(procs[$(pndx)][0])])", "$(paused)"), + "got_day_$(pndx)", + }, scope => "namespace"; - "got_early" or => { classmatch("early_\d+") }, scope => "namespace"; - "got_late" or => { classmatch("late_\d+") }, scope => "namespace"; - - # So now a search for pid=$(pid) within the last $(days[$(pid)]) - # days should fail if early_$(pid) is set and succeed if - # late_$(pid) is set; if neither is set, it may go either way. - -# reports: -# DEBUG.got_early:: -# "Early: $(pid) from $(days[$(pid)]) days ago" if => "early_$(pid)"; -# DEBUG.got_late:: -# "Late: $(pid) from $(days[$(pid)]) days ago" if => "late_$(pid)"; + + "got_early" + or => { classmatch("early_\d+") }, + scope => "namespace"; + + "got_late" + or => { classmatch("late_\d+") }, + scope => "namespace"; + + # So now a search for pid=$(pid) within the last $(days[$(pid)]) + # days should fail if early_$(pid) is set and succeed if + # late_$(pid) is set; if neither is set, it may go either way. + # reports: + # DEBUG.got_early:: + # "Early: $(pid) from $(days[$(pid)]) days ago" if => "early_$(pid)"; + # DEBUG.got_late:: + # "Late: $(pid) from $(days[$(pid)]) days ago" if => "late_$(pid)"; } ####################################################### - bundle agent test { vars: - "pid" ilist => { @(init.pid) }; + "pid" ilist => { @(init.pid) }; processes: - "" - process_select => pid_is_newer_than($(pid), "$(init.days[$(pid)])"), - process_count => any_procs("early_$(pid)"), - if => "early_$(pid)"; - - "" - process_select => pid_is_newer_than($(pid), "$(init.days[$(pid)])"), - process_count => any_procs("late_$(pid)"), - if => "late_$(pid)"; + "" + process_select => pid_is_newer_than($(pid), "$(init.days[$(pid)])"), + process_count => any_procs("early_$(pid)"), + if => "early_$(pid)"; + + "" + process_select => pid_is_newer_than($(pid), "$(init.days[$(pid)])"), + process_count => any_procs("late_$(pid)"), + if => "late_$(pid)"; } body process_select pid_is_newer_than(pid, days) { - pid => irange($(pid), $(pid)); - stime_range => irange(ago(0, 0, $(days), 0, 0, 0), now()); - process_result => "pid.stime"; + pid => irange($(pid), $(pid)); + stime_range => irange(ago(0, 0, $(days), 0, 0, 0), now()); + process_result => "pid.stime"; } body process_count any_procs(prefix) { - match_range => "1,1"; - in_range_define => { "$(prefix)_in" }; - out_of_range_define => { "$(prefix)_out" }; + match_range => "1,1"; + in_range_define => { "$(prefix)_in" }; + out_of_range_define => { "$(prefix)_out" }; } ####################################################### - bundle agent check { vars: - "pid" ilist => { @(init.pid) }; + "pid" ilist => { @(init.pid) }; + classes: - "bad_$(pid)_in" and => { "early_$(pid)", "early_$(pid)_in" }; - "good_$(pid)_out" and => { "early_$(pid)", "early_$(pid)_out" }; - "good_$(pid)_in" and => { "late_$(pid)", "late_$(pid)_in" }; - "bad_$(pid)_out" and => { "late_$(pid)", "late_$(pid)_out" }; - - "early_in" or => { classmatch("bad_\d+_in") }; - "early_out" or => { classmatch("good_\d+_out") }; - "late_in" or => { classmatch("good_\d+_in") }; - "late_out" or => { classmatch("bad_\d+_out") }; - "early_ok" or => { "!got_early", "!early_in.early_out" }; - "late_ok" or => { "!got_late", "late_in.!late_out" }; - "pass" and => { "late_ok", "early_ok" }; - "ok" or => { "pass", "bad_timing" }; + "bad_$(pid)_in" and => { "early_$(pid)", "early_$(pid)_in" }; + "good_$(pid)_out" and => { "early_$(pid)", "early_$(pid)_out" }; + "good_$(pid)_in" and => { "late_$(pid)", "late_$(pid)_in" }; + "bad_$(pid)_out" and => { "late_$(pid)", "late_$(pid)_out" }; + "early_in" or => { classmatch("bad_\d+_in") }; + "early_out" or => { classmatch("good_\d+_out") }; + "late_in" or => { classmatch("good_\d+_in") }; + "late_out" or => { classmatch("bad_\d+_out") }; + "early_ok" or => { "!got_early", "!early_in.early_out" }; + "late_ok" or => { "!got_late", "late_in.!late_out" }; + "pass" and => { "late_ok", "early_ok" }; + "ok" or => { "pass", "bad_timing" }; reports: bad_timing:: @@ -181,28 +212,37 @@ bundle agent check DEBUG.!got_early:: "Found no processes, early in past days, to test"; + DEBUG.!got_late:: "Found no processes, late in past days, to test"; DEBUG.got_early.early_in:: "Early processes reported as in range"; + "Process $(pid), reported within $(init.days[$(pid)]) days, is older" if => "bad_$(pid)_in"; + DEBUG.got_early.!early_out:: "Early processes not reported as out of range"; + "Process $(pid), not reported outside $(init.days[$(pid)]) days, is so old" if => "early_$(pid).!early_$(pid)_out"; + DEBUG.got_late.!late_in:: "Late processes not reported as in range"; + "Process $(pid), not reported within $(init.days[$(pid)]) days, is so new" if => "late_$(pid).!late_$(pid)_in"; + DEBUG.got_late.late_out:: "Late processes reported as out of range"; + "Process $(pid), reported outside $(init.days[$(pid)]) days, is newer" if => "bad_$(pid)_out"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/01_matching/timed/stime.cf b/tests/acceptance/05_processes/01_matching/timed/stime.cf index fc07eff444..111558e773 100644 --- a/tests/acceptance/05_processes/01_matching/timed/stime.cf +++ b/tests/acceptance/05_processes/01_matching/timed/stime.cf @@ -1,28 +1,30 @@ # Test that using process cmd line matching works in a process promise. - body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { meta: - # Adding the test case revealed that these platforms do not work, but we - # don't know why. - "test_skip_needs_work" string => "solaris|hpux"; - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + # Adding the test case revealed that these platforms do not work, but we + # don't know why. + "test_skip_needs_work" string => "solaris|hpux"; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; vars: - # Random, but unique string for this test case. - "unique" string => "Ni8Goobi"; + # Random, but unique string for this test case. + "unique" string => "Ni8Goobi"; commands: test_pass_1.!windows:: "$(G.no_fds) --no-std $(G.sh) $(this.promise_filename).bat $(unique) &" contain => in_shell; + test_pass_1.windows:: "$(this.promise_dirname)/../../../elevate.exe $(this.promise_filename).bat $(unique)" contain => in_shell; @@ -31,18 +33,17 @@ bundle agent init bundle agent test { vars: - "escaped_process" string => escape("$(this.promise_filename).bat"); + "escaped_process" string => escape("$(this.promise_filename).bat"); processes: - ".*$(init.unique).*" - process_count => test_range; + ".*$(init.unique).*" process_count => test_range; } body process_count test_range { - in_range_define => { "found" }; - out_of_range_define => { "not_found" }; - match_range => irange(1,100); + in_range_define => { "found" }; + out_of_range_define => { "not_found" }; + match_range => irange(1, 100); } bundle agent check @@ -53,11 +54,13 @@ bundle agent check test_pass_2.(!found|not_found):: "any" usebundle => dcs_fail("$(this.promise_filename)"); + test_pass_2.found.!not_found:: "any" usebundle => dcs_wait("$(this.promise_filename)", 65); test_pass_3.(found|!not_found):: "any" usebundle => dcs_fail("$(this.promise_filename)"); + test_pass_3.!found.not_found:: "any" usebundle => dcs_pass("$(this.promise_filename)"); } diff --git a/tests/acceptance/05_processes/01_matching/ttime_classes_body_params.cf b/tests/acceptance/05_processes/01_matching/ttime_classes_body_params.cf index 1bb60c822a..33b1faf429 100644 --- a/tests/acceptance/05_processes/01_matching/ttime_classes_body_params.cf +++ b/tests/acceptance/05_processes/01_matching/ttime_classes_body_params.cf @@ -3,56 +3,56 @@ # Set a class if a process does exist, more complex matches # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { processes: - ".*" + ".*" process_select => test_select_high_users, classes => test_set_class("found", "not_found"); } -body classes test_set_class(t,f) +body classes test_set_class(t, f) { - promise_kept => { "$(t)" }; - promise_repaired => { "$(t)" }; - repair_failed => { "$(f)" }; + promise_kept => { "$(t)" }; + promise_repaired => { "$(t)" }; + repair_failed => { "$(f)" }; } body process_select test_select_high_users { - ttime_range => irange(0, accumulated(9,0,0,0,0,0)); # Anything - process_result => "ttime"; # Everything -} + ttime_range => irange(0, accumulated(9, 0, 0, 0, 0, 0)); + # Anything + process_result => "ttime"; -####################################################### + # Everything +} +####################################################### bundle agent check { classes: - "ok" expression => "found.!not_found"; + "ok" expression => "found.!not_found"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/01_matching/ttime_inverse_found.cf b/tests/acceptance/05_processes/01_matching/ttime_inverse_found.cf index 4d70f0dd46..cad010a1de 100644 --- a/tests/acceptance/05_processes/01_matching/ttime_inverse_found.cf +++ b/tests/acceptance/05_processes/01_matching/ttime_inverse_found.cf @@ -4,56 +4,56 @@ # we wanted not to (irange(0,0)), more complex matches # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { processes: - ".*" + ".*" process_count => test_range, process_select => test_select_high_users; } body process_count test_range { - in_range_define => { "none_found" }; - out_of_range_define => { "some_found" }; - match_range => irange(0,0); + in_range_define => { "none_found" }; + out_of_range_define => { "some_found" }; + match_range => irange(0, 0); } body process_select test_select_high_users { - ttime_range => irange(0, accumulated(9,0,0,0,0,0)); # Anything - process_result => "ttime"; # Everything -} + ttime_range => irange(0, accumulated(9, 0, 0, 0, 0, 0)); + # Anything + process_result => "ttime"; -####################################################### + # Everything +} +####################################################### bundle agent check { classes: - "ok" expression => "!none_found.some_found"; + "ok" expression => "!none_found.some_found"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/01_matching/tty.cf b/tests/acceptance/05_processes/01_matching/tty.cf index d5a5522ee1..04ac0a4a6d 100644 --- a/tests/acceptance/05_processes/01_matching/tty.cf +++ b/tests/acceptance/05_processes/01_matching/tty.cf @@ -25,81 +25,77 @@ # David Lee, 2019 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "test_skip_needs_work" -> {"CFE-3025"} - string => "!linux.!hpux", - comment => "TTY-based process filtering doesn't work well on other platforms"; + "test_skip_needs_work" -> { "CFE-3025" } + string => "!linux.!hpux", + comment => "TTY-based process filtering doesn't work well on other platforms"; vars: # Maintenance note: Aim to cover as many OSes as possible # and mimimise the ".+" catch-all. linux:: "dev_pattern" string => "(pts/[0-9]+)|(ttyS?[0-9]+)"; + !linux:: "dev_pattern" string => ".+"; processes: - ### Expect zero processes on a tty with a highly unlikely name. - ".*" - handle => "expect_none", - process_select => test_select_tty("No-Such-Major/No-Such-Minor"), - process_count => test_range("0", "0", "pass_bad_dev", "fail_bad_dev"); - - ### Expect to find one or more processes on these ttys. - ".*" - handle => "expect_some", - process_select => test_select_tty("$(dev_pattern)"), - process_count => test_range("1", "inf", "pass_good_dev", "fail_good_dev"); - + ### Expect zero processes on a tty with a highly unlikely name. + ".*" + handle => "expect_none", + process_select => test_select_tty("No-Such-Major/No-Such-Minor"), + process_count => test_range("0", "0", "pass_bad_dev", "fail_bad_dev"); + + ### Expect to find one or more processes on these ttys. + ".*" + handle => "expect_some", + process_select => test_select_tty("$(dev_pattern)"), + process_count => test_range("1", "inf", "pass_good_dev", "fail_good_dev"); } body process_count test_range(min, max, class_good, class_bad) { - match_range => irange("$(min)", "$(max)"); - in_range_define => { "$(class_good)" }; - out_of_range_define => { "$(class_bad)" }; + match_range => irange("$(min)", "$(max)"); + in_range_define => { "$(class_good)" }; + out_of_range_define => { "$(class_bad)" }; } body process_select test_select_tty(tty_pattern) { - tty => "$(tty_pattern)"; - process_result => "tty"; + tty => "$(tty_pattern)"; + process_result => "tty"; } - ####################################################### - bundle agent check { classes: - "ok" and => { - "pass_good_dev", "pass_bad_dev", - "!fail_good_dev", "!fail_bad_dev", + "ok" + and => { + "pass_good_dev", "pass_bad_dev", "!fail_good_dev", "!fail_bad_dev", }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/05_processes/02_functions/findprocesses.cf b/tests/acceptance/05_processes/02_functions/findprocesses.cf index 8edab159a5..05bc5a4cf1 100644 --- a/tests/acceptance/05_processes/02_functions/findprocesses.cf +++ b/tests/acceptance/05_processes/02_functions/findprocesses.cf @@ -6,32 +6,34 @@ # 00_hpux_ps_setup_serial.cf setup test having run first. # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle common test { classes: - # this will be set only if we find our own exact PID - "descartes" expression => strcmp($(found_pids), $(this.promiser_pid)); + # this will be set only if we find our own exact PID + "descartes" expression => strcmp($(found_pids), $(this.promiser_pid)); + vars: - # find our own PID, using \b to make sure we match whole words - "found" data => findprocesses("\bfindprocesses\.cf\b"); - # pluck the "pid" field out into a list - "found_pids" data => mapdata("none", "$(found[$(this.k)][pid])", found); + # find our own PID, using \b to make sure we match whole words + "found" data => findprocesses("\bfindprocesses\.cf\b"); + + # pluck the "pid" field out into a list + "found_pids" data => mapdata("none", "$(found[$(this.k)][pid])", found); } ########################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_expected("descartes", "", $(this.promise_filename)); + "" + usebundle => dcs_passif_expected( + "descartes", "", $(this.promise_filename) + ); } diff --git a/tests/acceptance/05_processes/02_functions/processexists.cf b/tests/acceptance/05_processes/02_functions/processexists.cf index d67c430721..3b0b471757 100644 --- a/tests/acceptance/05_processes/02_functions/processexists.cf +++ b/tests/acceptance/05_processes/02_functions/processexists.cf @@ -6,26 +6,26 @@ # 00_hpux_ps_setup_serial.cf setup test having run first. # ########################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; + version => "1.0"; } ########################################################### - bundle common test { classes: - "descartes" expression => processexists(".+agent.+"); + "descartes" expression => processexists(".+agent.+"); } ########################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_expected("descartes", "", $(this.promise_filename)); + "" + usebundle => dcs_passif_expected( + "descartes", "", $(this.promise_filename) + ); } diff --git a/tests/acceptance/05_processes/process_stop.cf b/tests/acceptance/05_processes/process_stop.cf index 3d0476cf1f..c126b8b232 100644 --- a/tests/acceptance/05_processes/process_stop.cf +++ b/tests/acceptance/05_processes/process_stop.cf @@ -1,76 +1,72 @@ body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent test { meta: - "description" -> { "ENT-4988" } - string => "Test some basic expectations when using process_stop in processes type promises"; - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "description" -> { "ENT-4988" } + string => "Test some basic expectations when using process_stop in processes type promises"; - processes: - - # The policy file itself is not expected to be executable, this promise is - # expected to fail and be notkept. - - "." - process_stop => "$(this.promise_filename)", - handle => "process_stop_not_executable_expect_failed", - classes => explicit_results( "namespace", "$(this.handle)_is" ); - - # G.true is expected to return true, and the promise is expected to be - # repaired. Note: At the time of authorship there is no validation that - # the selected pids were killed by process_stop. We are only using the - # return code. - - "." - process_stop => "$(G.true)", - handle => "process_stop_return_zero_expect_repaired", - classes => explicit_results( "namespace", "$(this.handle)_is" ); + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; - # G.false is expected to return false, and the promise is expected to be - # repaired. Note: At the time of authorship there is no validation that - # the selected pids were killed by process_stop. We are only using the - # return code. - - "." - process_stop => "$(G.false)", - handle => "process_stop_return_nonzero_expect_failed", - classes => explicit_results( "namespace", "$(this.handle)_is" ); - - # G.echo is expected to return true, and the promise is expected to be - # repaired. Note: At the time of authorship there is no validation that - # the selected pids were killed by process_stop. We are only using the - # return code. - - "." - process_stop => "$(G.echo) pretend stop servicename", - handle => "process_stop_with_args_return_nonzero_expect_repaired", - classes => explicit_results( "namespace", "$(this.handle)_is" ); + processes: + # The policy file itself is not expected to be executable, this promise is + # expected to fail and be notkept. + "." + process_stop => "$(this.promise_filename)", + handle => "process_stop_not_executable_expect_failed", + classes => explicit_results("namespace", "$(this.handle)_is"); + + # G.true is expected to return true, and the promise is expected to be + # repaired. Note: At the time of authorship there is no validation that + # the selected pids were killed by process_stop. We are only using the + # return code. + "." + process_stop => "$(G.true)", + handle => "process_stop_return_zero_expect_repaired", + classes => explicit_results("namespace", "$(this.handle)_is"); + + # G.false is expected to return false, and the promise is expected to be + # repaired. Note: At the time of authorship there is no validation that + # the selected pids were killed by process_stop. We are only using the + # return code. + "." + process_stop => "$(G.false)", + handle => "process_stop_return_nonzero_expect_failed", + classes => explicit_results("namespace", "$(this.handle)_is"); + + # G.echo is expected to return true, and the promise is expected to be + # repaired. Note: At the time of authorship there is no validation that + # the selected pids were killed by process_stop. We are only using the + # return code. + "." + process_stop => "$(G.echo) pretend stop servicename", + handle => "process_stop_with_args_return_nonzero_expect_repaired", + classes => explicit_results("namespace", "$(this.handle)_is"); } bundle agent check { vars: - - "expected_classes" slist => { - "process_stop_with_args_return_nonzero_expect_repaired_is_repaired", - "process_stop_return_nonzero_expect_failed_is_failed", - "process_stop_return_zero_expect_repaired_is_repaired", - "process_stop_not_executable_expect_failed_is_failed", + "expected_classes" + slist => { + "process_stop_with_args_return_nonzero_expect_repaired_is_repaired", + "process_stop_return_nonzero_expect_failed_is_failed", + "process_stop_return_zero_expect_repaired_is_repaired", + "process_stop_not_executable_expect_failed_is_failed", }; - DEBUG:: - "found_classes" slist => classesmatching( "process_stop_.*"); - "difference" slist => difference( found_classes, expected_classes ); + "found_classes" slist => classesmatching("process_stop_.*"); + "difference" slist => difference(found_classes, expected_classes); classes: - "ok" and => { @(expected_classes) }; + "ok" and => { @(expected_classes) }; reports: DEBUG:: @@ -78,6 +74,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } @@ -136,14 +133,9 @@ body classes explicit_results(scope, class_prefix) # **See also:** `scope`, `scoped_classes_generic`, `classes_generic` { scope => "$(scope)"; - promise_kept => { "$(class_prefix)_kept" }; - promise_repaired => { "$(class_prefix)_repaired" }; - repair_failed => { "$(class_prefix)_failed" }; - repair_denied => { "$(class_prefix)_denied" }; - repair_timeout => { "$(class_prefix)_timeout" }; } diff --git a/tests/acceptance/06_storage/01_local/001.cf b/tests/acceptance/06_storage/01_local/001.cf index 636e22fe9a..4490906e1c 100644 --- a/tests/acceptance/06_storage/01_local/001.cf +++ b/tests/acceptance/06_storage/01_local/001.cf @@ -3,64 +3,63 @@ # Test simple storage promises - free space in range # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "sunos_5_11|sunos_5_10", - meta => { "redmine5234" }; + "test_soft_fail" + string => "sunos_5_11|sunos_5_10", + meta => { "redmine5234" }; vars: windows:: "path" string => "C:\\"; + !windows:: "path" string => "/var"; storage: - "$(path)" + "$(path)" volume => test_volume, - classes => test_set_class("pass","fail"); + classes => test_set_class("pass", "fail"); } body volume test_volume { - freespace => "1k"; + freespace => "1k"; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { classes: - "ok" expression => "pass.!fail"; + "ok" expression => "pass.!fail"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/06_storage/01_local/staging/002.cf b/tests/acceptance/06_storage/01_local/staging/002.cf index 5e121e8f29..a851cc1fd5 100644 --- a/tests/acceptance/06_storage/01_local/staging/002.cf +++ b/tests/acceptance/06_storage/01_local/staging/002.cf @@ -3,54 +3,53 @@ # Test simple storage promises - free space not in range # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { storage: - "/var" + "/var" volume => test_volume, - classes => test_set_class("fail","pass"); + classes => test_set_class("fail", "pass"); } body volume test_volume { - freespace => "1000G"; + freespace => "1000G"; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { classes: - "ok" expression => "pass.!fail"; + "ok" expression => "pass.!fail"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 31 diff --git a/tests/acceptance/07_packages/001.cf b/tests/acceptance/07_packages/001.cf index 90036368c9..01835e28e4 100644 --- a/tests/acceptance/07_packages/001.cf +++ b/tests/acceptance/07_packages/001.cf @@ -3,19 +3,18 @@ # Test add a package # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { "G", "g", default("$(this.promise_filename)") }; - version => "1.0"; - cache_system_functions => "false"; + inputs => { "../default.sub.cf" }; + bundlesequence => { "G", "g", default("$(this.promise_filename)") }; + version => "1.0"; + cache_system_functions => "false"; } bundle common g { classes: - "mpm_declared" not => strcmp(getenv("MOCK_PACKAGE_MANAGER", "65535"), ""); + "mpm_declared" not => strcmp(getenv("MOCK_PACKAGE_MANAGER", "65535"), ""); vars: mpm_declared:: @@ -26,81 +25,77 @@ bundle common g } ####################################################### - bundle agent init { commands: - "$(g.pm) --clear-installed"; - "$(g.pm) --clear-available"; - "$(g.pm) --populate-available imagisoft:1.0i:teapot"; + "$(g.pm) --clear-installed"; + "$(g.pm) --clear-available"; + "$(g.pm) --populate-available imagisoft:1.0i:teapot"; } ####################################################### - bundle agent test { - meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + meta: + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "name" string => "imagisoft"; - "version" string => "1.0i"; - "arch" string => "teapot"; + "name" string => "imagisoft"; + "version" string => "1.0i"; + "arch" string => "teapot"; packages: - "$(name):$(version):$(arch)" + "$(name):$(version):$(arch)" package_policy => "add", package_method => mock, - classes => test_set_class("pass","fail"); + classes => test_set_class("pass", "fail"); } body package_method mock { - package_changes => "individual"; - package_list_command => "$(g.pm) --list-installed"; - - package_list_name_regex => "^[^:]*"; - package_list_version_regex => ":(?<=:).*(?=:)"; - package_list_arch_regex => "[^:]\w+$"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(g.pm) --add "; - package_update_command => "$(g.pm) --update "; - package_delete_command => "$(g.pm) --delete "; - package_verify_command => "$(g.pm) --verify "; + package_changes => "individual"; + package_list_command => "$(g.pm) --list-installed"; + package_list_name_regex => "^[^:]*"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_list_arch_regex => "[^:]\w+$"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(g.pm) --add "; + package_update_command => "$(g.pm) --update "; + package_delete_command => "$(g.pm) --delete "; + package_verify_command => "$(g.pm) --verify "; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { vars: - "pkgs" string => execresult("$(g.pm) --list-installed", "noshell"); + "pkgs" string => execresult("$(g.pm) --list-installed", "noshell"); classes: - "has_pkg" expression => regcmp("imagisoft:1\.0i:teapot", "$(pkgs)"); - - "ok" expression => "pass.!fail.has_pkg"; + "has_pkg" expression => regcmp("imagisoft:1\.0i:teapot", "$(pkgs)"); + "ok" expression => "pass.!fail.has_pkg"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } body classes successfully_executed(class) { - kept_returncodes => { "0" }; - promise_kept => { "$(class)" }; + kept_returncodes => { "0" }; + promise_kept => { "$(class)" }; } ### PROJECT_ID: core diff --git a/tests/acceptance/07_packages/002.cf b/tests/acceptance/07_packages/002.cf index bd81814e92..ec57316fe1 100644 --- a/tests/acceptance/07_packages/002.cf +++ b/tests/acceptance/07_packages/002.cf @@ -3,19 +3,18 @@ # Test add a package using a "default" architecture # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { "G", "g", default("$(this.promise_filename)") }; - version => "1.0"; - cache_system_functions => "false"; + inputs => { "../default.sub.cf" }; + bundlesequence => { "G", "g", default("$(this.promise_filename)") }; + version => "1.0"; + cache_system_functions => "false"; } bundle common g { classes: - "mpm_declared" not => strcmp(getenv("MOCK_PACKAGE_MANAGER", "65535"), ""); + "mpm_declared" not => strcmp(getenv("MOCK_PACKAGE_MANAGER", "65535"), ""); vars: mpm_declared:: @@ -26,83 +25,81 @@ bundle common g } ####################################################### - bundle agent init { commands: - "$(g.pm) --clear-installed"; - "$(g.pm) --clear-available"; - "$(g.pm) --populate-available imagisoft:1.0i:x666"; + "$(g.pm) --clear-installed"; + "$(g.pm) --clear-available"; + "$(g.pm) --populate-available imagisoft:1.0i:x666"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "name" string => "imagisoft"; - "version" string => "1.0i"; + "name" string => "imagisoft"; + "version" string => "1.0i"; packages: - "$(name):$(version)" + "$(name):$(version)" package_policy => "add", package_method => mock, - classes => test_set_class("pass","fail"); + classes => test_set_class("pass", "fail"); } body package_method mock { - package_changes => "individual"; - package_list_command => "$(g.pm) --list-installed"; - package_list_name_regex => "^[^:]*"; - package_list_version_regex => ":(?<=:).*(?=:)"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(g.pm) --add "; - package_update_command => "$(g.pm) --update "; - package_delete_command => "$(g.pm) --delete "; - package_verify_command => "$(g.pm) --verify "; + package_changes => "individual"; + package_list_command => "$(g.pm) --list-installed"; + package_list_name_regex => "^[^:]*"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(g.pm) --add "; + package_update_command => "$(g.pm) --update "; + package_delete_command => "$(g.pm) --delete "; + package_verify_command => "$(g.pm) --verify "; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { vars: - "pkgs" string => execresult("$(g.pm) --list-installed", "noshell"); + "pkgs" string => execresult("$(g.pm) --list-installed", "noshell"); classes: - "has_pkg" expression => regcmp("imagisoft:1\.0i:x666", "$(pkgs)"); - - "ok" expression => "pass.!fail.has_pkg"; + "has_pkg" expression => regcmp("imagisoft:1\.0i:x666", "$(pkgs)"); + "ok" expression => "pass.!fail.has_pkg"; reports: DEBUG.pass:: "pass"; + DEBUG.has_pkg:: "has_pkg"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } body classes successfully_executed(class) { - kept_returncodes => { "0" }; - promise_kept => { "$(class)" }; + kept_returncodes => { "0" }; + promise_kept => { "$(class)" }; } ### PROJECT_ID: core diff --git a/tests/acceptance/07_packages/003.cf b/tests/acceptance/07_packages/003.cf index 89fda9cfed..83e64fca4b 100644 --- a/tests/acceptance/07_packages/003.cf +++ b/tests/acceptance/07_packages/003.cf @@ -3,19 +3,18 @@ # Test adding a package using separate package_version attribute # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { "G", "g", default("$(this.promise_filename)") }; - version => "1.0"; - cache_system_functions => "false"; + inputs => { "../default.sub.cf" }; + bundlesequence => { "G", "g", default("$(this.promise_filename)") }; + version => "1.0"; + cache_system_functions => "false"; } bundle common g { classes: - "mpm_declared" not => strcmp(getenv("MOCK_PACKAGE_MANAGER", "65535"), ""); + "mpm_declared" not => strcmp(getenv("MOCK_PACKAGE_MANAGER", "65535"), ""); vars: mpm_declared:: @@ -26,83 +25,81 @@ bundle common g } ####################################################### - bundle agent init { commands: - "$(g.pm) --clear-installed"; - "$(g.pm) --clear-available"; - "$(g.pm) --populate-available imagisoft:1.0i:x666"; + "$(g.pm) --clear-installed"; + "$(g.pm) --clear-available"; + "$(g.pm) --populate-available imagisoft:1.0i:x666"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "name" string => "imagisoft"; + "name" string => "imagisoft"; packages: - "$(name)" + "$(name)" package_policy => "add", package_method => mock, package_version => "1.0i", - classes => test_set_class("pass","fail"); + classes => test_set_class("pass", "fail"); } body package_method mock { - package_changes => "individual"; - package_list_command => "$(g.pm) --list-installed"; - package_list_name_regex => "^[^:]*"; - package_list_version_regex => ":(?<=:).*(?=:)"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(g.pm) --add "; - package_update_command => "$(g.pm) --update "; - package_delete_command => "$(g.pm) --delete "; - package_verify_command => "$(g.pm) --verify "; + package_changes => "individual"; + package_list_command => "$(g.pm) --list-installed"; + package_list_name_regex => "^[^:]*"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(g.pm) --add "; + package_update_command => "$(g.pm) --update "; + package_delete_command => "$(g.pm) --delete "; + package_verify_command => "$(g.pm) --verify "; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { vars: - "pkgs" string => execresult("$(g.pm) --list-installed", "noshell"); + "pkgs" string => execresult("$(g.pm) --list-installed", "noshell"); classes: - "has_pkg" expression => regcmp("imagisoft:1\.0i:x666", "$(pkgs)"); - - "ok" expression => "pass.!fail.has_pkg"; + "has_pkg" expression => regcmp("imagisoft:1\.0i:x666", "$(pkgs)"); + "ok" expression => "pass.!fail.has_pkg"; reports: DEBUG.pass:: "pass"; + DEBUG.has_pkg:: "has_pkg"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } body classes successfully_executed(class) { - kept_returncodes => { "0" }; - promise_kept => { "$(class)" }; + kept_returncodes => { "0" }; + promise_kept => { "$(class)" }; } ### PROJECT_ID: core diff --git a/tests/acceptance/07_packages/004.cf b/tests/acceptance/07_packages/004.cf index faf34322d9..e6763d444d 100644 --- a/tests/acceptance/07_packages/004.cf +++ b/tests/acceptance/07_packages/004.cf @@ -3,19 +3,18 @@ # Test adding *second* package # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { "G", "g", default("$(this.promise_filename)") }; - version => "1.0"; - cache_system_functions => "false"; + inputs => { "../default.sub.cf" }; + bundlesequence => { "G", "g", default("$(this.promise_filename)") }; + version => "1.0"; + cache_system_functions => "false"; } bundle common g { classes: - "mpm_declared" not => strcmp(getenv("MOCK_PACKAGE_MANAGER", "65535"), ""); + "mpm_declared" not => strcmp(getenv("MOCK_PACKAGE_MANAGER", "65535"), ""); vars: mpm_declared:: @@ -26,86 +25,83 @@ bundle common g } ####################################################### - bundle agent init { commands: - "$(g.pm) --clear-installed"; - "$(g.pm) --clear-available"; - "$(g.pm) --populate-available imagisoft:1.0i:x666"; - "$(g.pm) --populate-available bluesky:3.1:x666"; - "$(g.pm) --add bluesky:*:*"; + "$(g.pm) --clear-installed"; + "$(g.pm) --clear-available"; + "$(g.pm) --populate-available imagisoft:1.0i:x666"; + "$(g.pm) --populate-available bluesky:3.1:x666"; + "$(g.pm) --add bluesky:*:*"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "name" string => "imagisoft"; + "name" string => "imagisoft"; packages: - "$(name)" + "$(name)" package_policy => "add", package_method => mock, package_version => "1.0i", - classes => test_set_class("pass","fail"); + classes => test_set_class("pass", "fail"); } body package_method mock { - package_changes => "individual"; - package_list_command => "$(g.pm) --list-installed"; - package_list_name_regex => "^[^:]*"; - package_list_version_regex => ":(?<=:).*(?=:)"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(g.pm) --add "; - package_update_command => "$(g.pm) --update "; - package_delete_command => "$(g.pm) --delete "; - package_verify_command => "$(g.pm) --verify "; - + package_changes => "individual"; + package_list_command => "$(g.pm) --list-installed"; + package_list_name_regex => "^[^:]*"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(g.pm) --add "; + package_update_command => "$(g.pm) --update "; + package_delete_command => "$(g.pm) --delete "; + package_verify_command => "$(g.pm) --verify "; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { vars: - "pkgs" string => execresult("$(g.pm) --list-installed", "noshell"); + "pkgs" string => execresult("$(g.pm) --list-installed", "noshell"); classes: - "has_pkg" expression => regcmp(".*imagisoft:1\.0i:x666.*", "$(pkgs)"); - - "ok" expression => "pass.!fail.has_pkg"; + "has_pkg" expression => regcmp(".*imagisoft:1\.0i:x666.*", "$(pkgs)"); + "ok" expression => "pass.!fail.has_pkg"; reports: DEBUG.pass:: "pass"; + DEBUG.has_pkg:: "has_pkg"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } body classes successfully_executed(class) { - kept_returncodes => { "0" }; - promise_kept => { "$(class)" }; + kept_returncodes => { "0" }; + promise_kept => { "$(class)" }; } ### PROJECT_ID: core diff --git a/tests/acceptance/07_packages/005.cf b/tests/acceptance/07_packages/005.cf index c6c810897a..c39a44f974 100644 --- a/tests/acceptance/07_packages/005.cf +++ b/tests/acceptance/07_packages/005.cf @@ -3,19 +3,18 @@ # Test trying to actually specify versions of packages # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { "G", "g", default("$(this.promise_filename)") }; - version => "1.0"; - cache_system_functions => "false"; + inputs => { "../default.sub.cf" }; + bundlesequence => { "G", "g", default("$(this.promise_filename)") }; + version => "1.0"; + cache_system_functions => "false"; } bundle common g { classes: - "mpm_declared" not => strcmp(getenv("MOCK_PACKAGE_MANAGER", "65535"), ""); + "mpm_declared" not => strcmp(getenv("MOCK_PACKAGE_MANAGER", "65535"), ""); vars: mpm_declared:: @@ -26,87 +25,84 @@ bundle common g } ####################################################### - bundle agent init { commands: - "$(g.pm) --clear-installed"; - "$(g.pm) --clear-available"; - "$(g.pm) --populate-available imagisoft:1.0i:x666"; - "$(g.pm) --populate-available bluesky:3.1:x666"; - "$(g.pm) --add bluesky:*:*"; + "$(g.pm) --clear-installed"; + "$(g.pm) --clear-available"; + "$(g.pm) --populate-available imagisoft:1.0i:x666"; + "$(g.pm) --populate-available bluesky:3.1:x666"; + "$(g.pm) --add bluesky:*:*"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "name" string => "imagisoft"; + "name" string => "imagisoft"; packages: - "$(name)" + "$(name)" package_policy => "add", package_method => mock, package_version => "1.0i", - classes => test_set_class("pass","fail"); + classes => test_set_class("pass", "fail"); } body package_method mock { - package_changes => "individual"; - package_list_command => "$(g.pm) --list-installed"; - package_list_name_regex => "^[^:]*"; - package_list_version_regex => ":(?<=:).*(?=:)"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(g.pm) --add "; - package_update_command => "$(g.pm) --update "; - package_delete_command => "$(g.pm) --delete "; - package_verify_command => "$(g.pm) --verify "; - - package_name_convention => "$(name):$(version):$(arch)"; + package_changes => "individual"; + package_list_command => "$(g.pm) --list-installed"; + package_list_name_regex => "^[^:]*"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(g.pm) --add "; + package_update_command => "$(g.pm) --update "; + package_delete_command => "$(g.pm) --delete "; + package_verify_command => "$(g.pm) --verify "; + package_name_convention => "$(name):$(version):$(arch)"; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { vars: - "pkgs" string => execresult("$(g.pm) --list-installed", "noshell"); + "pkgs" string => execresult("$(g.pm) --list-installed", "noshell"); classes: - "has_pkg" expression => regcmp(".*imagisoft:1\.0i:x666.*", "$(pkgs)"); - - "ok" expression => "pass.!fail.has_pkg"; + "has_pkg" expression => regcmp(".*imagisoft:1\.0i:x666.*", "$(pkgs)"); + "ok" expression => "pass.!fail.has_pkg"; reports: DEBUG.pass:: "pass"; + DEBUG.has_pkg:: "has_pkg"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } body classes successfully_executed(class) { - kept_returncodes => { "0" }; - promise_kept => { "$(class)" }; + kept_returncodes => { "0" }; + promise_kept => { "$(class)" }; } ### PROJECT_ID: core diff --git a/tests/acceptance/07_packages/006.cf b/tests/acceptance/07_packages/006.cf index bd7d463404..cf103fb098 100644 --- a/tests/acceptance/07_packages/006.cf +++ b/tests/acceptance/07_packages/006.cf @@ -3,19 +3,18 @@ # Test trying to avoid parsing promiser # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { "G", "g", default("$(this.promise_filename)") }; - version => "1.0"; - cache_system_functions => "false"; + inputs => { "../default.sub.cf" }; + bundlesequence => { "G", "g", default("$(this.promise_filename)") }; + version => "1.0"; + cache_system_functions => "false"; } bundle common g { classes: - "mpm_declared" not => strcmp(getenv("MOCK_PACKAGE_MANAGER", "65535"), ""); + "mpm_declared" not => strcmp(getenv("MOCK_PACKAGE_MANAGER", "65535"), ""); vars: mpm_declared:: @@ -26,87 +25,84 @@ bundle common g } ####################################################### - bundle agent init { commands: - "$(g.pm) --clear-installed"; - "$(g.pm) --clear-available"; - "$(g.pm) --populate-available imagisoft:1.0i:x666"; - "$(g.pm) --populate-available bluesky:3.1:x666"; - "$(g.pm) --add bluesky:*:*"; + "$(g.pm) --clear-installed"; + "$(g.pm) --clear-available"; + "$(g.pm) --populate-available imagisoft:1.0i:x666"; + "$(g.pm) --populate-available bluesky:3.1:x666"; + "$(g.pm) --add bluesky:*:*"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "name" string => "imagisoft"; + "name" string => "imagisoft"; packages: - "$(name)" + "$(name)" package_policy => "add", package_method => mock, package_version => "1.0i", - classes => test_set_class("pass","fail"); + classes => test_set_class("pass", "fail"); } body package_method mock { - package_changes => "individual"; - package_list_command => "$(g.pm) --list-installed"; - package_list_name_regex => "^[^:]*"; - package_list_version_regex => ":(?<=:).*(?=:)"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(g.pm) --add "; - package_update_command => "$(g.pm) --update "; - package_delete_command => "$(g.pm) --delete "; - package_verify_command => "$(g.pm) --verify "; - - package_name_convention => "$(name):$(version):$(arch)"; + package_changes => "individual"; + package_list_command => "$(g.pm) --list-installed"; + package_list_name_regex => "^[^:]*"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(g.pm) --add "; + package_update_command => "$(g.pm) --update "; + package_delete_command => "$(g.pm) --delete "; + package_verify_command => "$(g.pm) --verify "; + package_name_convention => "$(name):$(version):$(arch)"; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { vars: - "pkgs" string => execresult("$(g.pm) --list-installed", "noshell"); + "pkgs" string => execresult("$(g.pm) --list-installed", "noshell"); classes: - "has_pkg" expression => regcmp(".*imagisoft:1\.0i:x666.*", "$(pkgs)"); - - "ok" expression => "pass.!fail.has_pkg"; + "has_pkg" expression => regcmp(".*imagisoft:1\.0i:x666.*", "$(pkgs)"); + "ok" expression => "pass.!fail.has_pkg"; reports: DEBUG.pass:: "pass"; + DEBUG.has_pkg:: "has_pkg"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } body classes successfully_executed(class) { - kept_returncodes => { "0" }; - promise_kept => { "$(class)" }; + kept_returncodes => { "0" }; + promise_kept => { "$(class)" }; } ### PROJECT_ID: core diff --git a/tests/acceptance/07_packages/800.cf b/tests/acceptance/07_packages/800.cf index 91b4dc030e..ef517f62e9 100644 --- a/tests/acceptance/07_packages/800.cf +++ b/tests/acceptance/07_packages/800.cf @@ -1,30 +1,29 @@ ####################################################### # Test that classes are set on individual installation (Mantis #829) ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { packages: - "a:b:c" + "a:b:c" package_policy => "add", package_method => mock, if => "!a", classes => ok("a"); - "d:e:f" + "d:e:f" package_policy => "add", package_method => mock, if => "!d", @@ -33,24 +32,22 @@ bundle agent test body package_method mock { - package_changes => "individual"; - package_list_command => "$(G.true)"; - - package_list_name_regex => "^[^:]*"; - package_list_version_regex => ":(?<=:).*(?=:)"; - package_list_arch_regex => "[^:]\w+$"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(G.true)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.true)"; - package_verify_command => "$(G.true)"; + package_changes => "individual"; + package_list_command => "$(G.true)"; + package_list_name_regex => "^[^:]*"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_list_arch_regex => "[^:]\w+$"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(G.true)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.true)"; + package_verify_command => "$(G.true)"; } body classes ok(classname) { - promise_repaired => { "$(classname)" }; - promise_kept => { "$(classname)" }; + promise_repaired => { "$(classname)" }; + promise_kept => { "$(classname)" }; } bundle agent check @@ -58,8 +55,10 @@ bundle agent check reports: a.d:: "$(this.promise_filename) Pass"; + !a|!d:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/900.cf b/tests/acceptance/07_packages/900.cf index a7c6cc19db..8570e32590 100644 --- a/tests/acceptance/07_packages/900.cf +++ b/tests/acceptance/07_packages/900.cf @@ -3,50 +3,44 @@ # Test no-op works # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { packages: - "a:b:c" + "a:b:c" package_policy => "add", package_method => mock; } body package_method mock { - package_changes => "individual"; - package_list_command => "$(G.true)"; - - package_list_name_regex => "^[^:]*"; - package_list_version_regex => ":(?<=:).*(?=:)"; - package_list_arch_regex => "[^:]\w+$"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(G.true)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.true)"; - package_verify_command => "$(G.true)"; + package_changes => "individual"; + package_list_command => "$(G.true)"; + package_list_name_regex => "^[^:]*"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_list_arch_regex => "[^:]\w+$"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(G.true)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.true)"; + package_verify_command => "$(G.true)"; } ####################################################### - bundle agent check { reports: @@ -54,6 +48,5 @@ bundle agent check "$(this.promise_filename) Pass"; } - ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/901.cf b/tests/acceptance/07_packages/901.cf index 34e195ceb8..a2ae0272cf 100644 --- a/tests/acceptance/07_packages/901.cf +++ b/tests/acceptance/07_packages/901.cf @@ -3,70 +3,64 @@ # Test missing version regex fails # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - # Windows has its own mechanism to list packages, and doesn't use the package body. - "test_skip_unsupported" string => "windows"; + # Windows has its own mechanism to list packages, and doesn't use the package body. + "test_skip_unsupported" string => "windows"; packages: - "a:b:c" + "a:b:c" package_policy => "add", package_method => mock, - classes => test_set_class("fail","ok"); + classes => test_set_class("fail", "ok"); } body package_method mock { - package_changes => "individual"; - package_list_command => "$(G.true)"; - - package_list_name_regex => "^[^:]*"; - package_list_arch_regex => "[^:]\w+$"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(G.true)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.true)"; - package_verify_command => "$(G.true)"; + package_changes => "individual"; + package_list_command => "$(G.true)"; + package_list_name_regex => "^[^:]*"; + package_list_arch_regex => "[^:]\w+$"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(G.true)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.true)"; + package_verify_command => "$(G.true)"; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { reports: ok.!fail:: "$(this.promise_filename) Pass"; + !ok|fail:: "$(this.promise_filename) FAIL"; } - ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/902.cf b/tests/acceptance/07_packages/902.cf index ef9e7a500d..acdad47944 100644 --- a/tests/acceptance/07_packages/902.cf +++ b/tests/acceptance/07_packages/902.cf @@ -3,70 +3,64 @@ # Test missing name regex fails # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - # Windows has its own mechanism to list packages, and doesn't use the package body. - "test_skip_unsupported" string => "windows"; + # Windows has its own mechanism to list packages, and doesn't use the package body. + "test_skip_unsupported" string => "windows"; packages: - "a:b:c" + "a:b:c" package_policy => "add", package_method => mock, - classes => test_set_class("fail","ok"); + classes => test_set_class("fail", "ok"); } body package_method mock { - package_changes => "individual"; - package_list_command => "$(G.true)"; - - package_list_version_regex => ":(?<=:).*(?=:)"; - package_list_arch_regex => "[^:]\w+$"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(G.true)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.true)"; - package_verify_command => "$(G.true)"; + package_changes => "individual"; + package_list_command => "$(G.true)"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_list_arch_regex => "[^:]\w+$"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(G.true)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.true)"; + package_verify_command => "$(G.true)"; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { reports: ok.!fail:: "$(this.promise_filename) Pass"; + !ok|fail:: "$(this.promise_filename) FAIL"; } - ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/903.cf b/tests/acceptance/07_packages/903.cf index 4bd3b945d3..bce6b17670 100644 --- a/tests/acceptance/07_packages/903.cf +++ b/tests/acceptance/07_packages/903.cf @@ -3,70 +3,64 @@ # Test missing package listing fails # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - # Windows has its own mechanism to list packages, and doesn't use the package body. - "test_skip_unsupported" string => "windows"; + # Windows has its own mechanism to list packages, and doesn't use the package body. + "test_skip_unsupported" string => "windows"; packages: - "a:b:c" + "a:b:c" package_policy => "add", package_method => mock, - classes => test_set_class("fail","ok"); + classes => test_set_class("fail", "ok"); } body package_method mock { - package_changes => "individual"; - - package_list_name_regex => "^[^:]*"; - package_list_version_regex => ":(?<=:).*(?=:)"; - package_list_arch_regex => "[^:]\w+$"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(G.true)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.true)"; - package_verify_command => "$(G.true)"; + package_changes => "individual"; + package_list_name_regex => "^[^:]*"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_list_arch_regex => "[^:]\w+$"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(G.true)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.true)"; + package_verify_command => "$(G.true)"; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { reports: ok.!fail:: "$(this.promise_filename) Pass"; + !ok|fail:: "$(this.promise_filename) FAIL"; } - ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/904.cf b/tests/acceptance/07_packages/904.cf index 750ca68716..63784063c3 100644 --- a/tests/acceptance/07_packages/904.cf +++ b/tests/acceptance/07_packages/904.cf @@ -3,66 +3,60 @@ # Test missing basic package commands # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { packages: - "a:b:c" + "a:b:c" package_policy => "add", package_method => mock, - classes => test_set_class("fail","ok"); + classes => test_set_class("fail", "ok"); } body package_method mock { - package_changes => "individual"; - package_list_command => "$(G.true)"; - - package_list_name_regex => "^[^:]*"; - package_list_version_regex => ":(?<=:).*(?=:)"; - package_list_arch_regex => "[^:]\w+$"; - package_installed_regex => "^[^:]*"; - - package_update_command => "$(G.true)"; - package_delete_command => "$(G.true)"; - package_verify_command => "$(G.true)"; + package_changes => "individual"; + package_list_command => "$(G.true)"; + package_list_name_regex => "^[^:]*"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_list_arch_regex => "[^:]\w+$"; + package_installed_regex => "^[^:]*"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.true)"; + package_verify_command => "$(G.true)"; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { reports: ok.!fail:: "$(this.promise_filename) Pass"; + !ok|fail:: "$(this.promise_filename) FAIL"; } - ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/905.cf b/tests/acceptance/07_packages/905.cf index fd2863a7e7..bbc074b4c4 100644 --- a/tests/acceptance/07_packages/905.cf +++ b/tests/acceptance/07_packages/905.cf @@ -3,66 +3,60 @@ # Test missing "installed" regex # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { packages: - "a:b:c" + "a:b:c" package_policy => "add", package_method => mock, - classes => test_set_class("fail","ok"); + classes => test_set_class("fail", "ok"); } body package_method mock { - package_changes => "individual"; - package_list_command => "$(G.true)"; - - package_list_name_regex => "^[^:]*"; - package_list_version_regex => ":(?<=:).*(?=:)"; - package_list_arch_regex => "[^:]\w+$"; - - package_add_command => "$(G.true)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.true)"; - package_verify_command => "$(G.true)"; + package_changes => "individual"; + package_list_command => "$(G.true)"; + package_list_name_regex => "^[^:]*"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_list_arch_regex => "[^:]\w+$"; + package_add_command => "$(G.true)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.true)"; + package_verify_command => "$(G.true)"; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { reports: ok.!fail:: "$(this.promise_filename) Pass"; + !ok|fail:: "$(this.promise_filename) FAIL"; } - ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/906.cf b/tests/acceptance/07_packages/906.cf index ad5c5d1768..a92a23ffed 100644 --- a/tests/acceptance/07_packages/906.cf +++ b/tests/acceptance/07_packages/906.cf @@ -3,67 +3,64 @@ # Test too long repository directory # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { packages: - "a:b:c" + "a:b:c" package_policy => "add", package_method => mock, - classes => test_set_class("fail","ok"); + classes => test_set_class("fail", "ok"); } body package_method mock { - package_changes => "individual"; - package_file_repositories => { "/tmp", "/fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu/" }; - - package_list_name_regex => "^[^:]*"; - package_list_version_regex => ":(?<=:).*(?=:)"; - package_list_arch_regex => "[^:]\w+$"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(G.true)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.true)"; - package_verify_command => "$(G.true)"; + package_changes => "individual"; + package_file_repositories => { + "/tmp", + "/fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu/", + }; + package_list_name_regex => "^[^:]*"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_list_arch_regex => "[^:]\w+$"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(G.true)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.true)"; + package_verify_command => "$(G.true)"; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { reports: ok.!fail:: "$(this.promise_filename) Pass"; + !ok|fail:: "$(this.promise_filename) FAIL"; } - ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/907.cf b/tests/acceptance/07_packages/907.cf index c471d7ee82..de59027726 100644 --- a/tests/acceptance/07_packages/907.cf +++ b/tests/acceptance/07_packages/907.cf @@ -3,50 +3,44 @@ # Test no-op with with "package_repositories" works # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { packages: - "a:b:c" + "a:b:c" package_policy => "add", package_method => mock; } body package_method mock { - package_changes => "individual"; - package_file_repositories => { "/tmp" }; - - package_list_name_regex => "^[^:]*"; - package_list_version_regex => ":(?<=:).*(?=:)"; - package_list_arch_regex => "[^:]\w+$"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(G.true)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.true)"; - package_verify_command => "$(G.true)"; + package_changes => "individual"; + package_file_repositories => { "/tmp" }; + package_list_name_regex => "^[^:]*"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_list_arch_regex => "[^:]\w+$"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(G.true)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.true)"; + package_verify_command => "$(G.true)"; } ####################################################### - bundle agent check { reports: @@ -54,6 +48,5 @@ bundle agent check "$(this.promise_filename) Pass"; } - ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/908.cf b/tests/acceptance/07_packages/908.cf index 96682dc93c..84bd7abcae 100644 --- a/tests/acceptance/07_packages/908.cf +++ b/tests/acceptance/07_packages/908.cf @@ -3,67 +3,61 @@ # Test broken list_command # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { packages: - "a:b:c" + "a:b:c" package_policy => "add", package_method => mock, - classes => test_set_class("fail","ok"); + classes => test_set_class("fail", "ok"); } body package_method mock { - package_changes => "individual"; - package_list_command => "/nonexisting"; - - package_list_name_regex => "^[^:]*"; - package_list_version_regex => ":(?<=:).*(?=:)"; - package_list_arch_regex => "[^:]\w+$"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(G.true)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.true)"; - package_verify_command => "$(G.true)"; + package_changes => "individual"; + package_list_command => "/nonexisting"; + package_list_name_regex => "^[^:]*"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_list_arch_regex => "[^:]\w+$"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(G.true)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.true)"; + package_verify_command => "$(G.true)"; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { reports: ok.!fail:: "$(this.promise_filename) Pass"; + !ok|fail:: "$(this.promise_filename) FAIL"; } - ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/contradicting-bodies-and-promises.cf b/tests/acceptance/07_packages/contradicting-bodies-and-promises.cf index 8c55b709b2..ec346ac5a0 100644 --- a/tests/acceptance/07_packages/contradicting-bodies-and-promises.cf +++ b/tests/acceptance/07_packages/contradicting-bodies-and-promises.cf @@ -2,154 +2,154 @@ # Test that specifying two incompatible ways to get package version is detected # and reported ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { packages: - "bash-1.0-amd64" + "bash-1.0-amd64" package_policy => "add", package_method => mock, package_version => "2.0", package_architectures => { "amd64" }, - classes => test_set_class("overlapping_version_arch_regex_succ", - "overlapping_version_arch_regex_fail"); + classes => test_set_class( + "overlapping_version_arch_regex_succ", + "overlapping_version_arch_regex_fail" + ); - "bash-1.0-i386" + "bash-1.0-i386" package_policy => "add", package_method => mock_no_name_regex_but_version_regex, - classes => test_set_class("no_name_regex_version_succ", "no_name_regex_version_fail"); + classes => test_set_class( + "no_name_regex_version_succ", "no_name_regex_version_fail" + ); - "bash-1.0-i386" + "bash-1.0-i386" package_policy => "add", package_method => mock_no_name_regex_but_arch_regex, - classes => test_set_class("no_name_regex_arch_succ", "no_name_regex_arch_fail"); + classes => test_set_class( + "no_name_regex_arch_succ", "no_name_regex_arch_fail" + ); - "bash-1.0-sparc" + "bash-1.0-sparc" package_policy => "add", package_method => mock_overlapping_version_regex, package_version => "2.0", - classes => test_set_class("overlapping_version_regex_succ", - "overlapping_version_regex_fail"); + classes => test_set_class( + "overlapping_version_regex_succ", "overlapping_version_regex_fail" + ); } body package_method mock_overlapping_version_regex { - package_changes => "individual"; - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - - package_list_command => "$(G.printf) 'bash-1.0-amd64'"; - package_installed_regex => ".*"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_add_command => "$(G.true) $(this.name)-$(this.version):$(this.arch)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.true)"; - package_verify_command => "$(G.true)"; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_list_command => "$(G.printf) 'bash-1.0-amd64'"; + package_installed_regex => ".*"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_add_command => "$(G.true) $(this.name)-$(this.version):$(this.arch)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.true)"; + package_verify_command => "$(G.true)"; } body package_method mock_no_name_regex_but_arch_regex { - package_changes => "individual"; - - package_arch_regex => ".*"; - # but no package_name_regex! - - package_list_command => "$(G.printf) 'bash-1.0-amd64'"; - package_installed_regex => ".*"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; + package_changes => "individual"; + package_arch_regex => ".*"; + + # but no package_name_regex! + package_list_command => "$(G.printf) 'bash-1.0-amd64'"; + package_installed_regex => ".*"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; } body package_method mock_no_name_regex_but_version_regex { - package_changes => "individual"; - - package_version_regex => ".*"; - # but no package_name_regex! - - package_list_command => "$(G.printf) 'bash-1.0-amd64'"; - package_installed_regex => ".*"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; + package_changes => "individual"; + package_version_regex => ".*"; + + # but no package_name_regex! + package_list_command => "$(G.printf) 'bash-1.0-amd64'"; + package_installed_regex => ".*"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; } body package_method mock { - package_changes => "individual"; - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - package_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_list_command => "$(G.printf) 'bash-1.0-amd64'"; - package_installed_regex => ".*"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_list_command => "$(G.printf) 'bash-1.0-amd64'"; + package_installed_regex => ".*"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { classes: - "ok" and => { "!no_name_regex_version_succ", "no_name_regex_version_fail", - "!no_name_regex_arch_succ", "no_name_regex_arch_fail", - "!overlapping_version_arch_regex_succ", "overlapping_version_arch_regex_fail", - "!overlapping_version_regex_succ", "overlapping_version_regex_fail"}; + "ok" + and => { + "!no_name_regex_version_succ", + "no_name_regex_version_fail", + "!no_name_regex_arch_succ", + "no_name_regex_arch_fail", + "!overlapping_version_arch_regex_succ", + "overlapping_version_arch_regex_fail", + "!overlapping_version_regex_succ", + "overlapping_version_regex_fail", + }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } - ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/custom-version-compare.cf b/tests/acceptance/07_packages/custom-version-compare.cf index eac74b342f..438ae14f43 100644 --- a/tests/acceptance/07_packages/custom-version-compare.cf +++ b/tests/acceptance/07_packages/custom-version-compare.cf @@ -1,38 +1,35 @@ ####################################################### # Test custom version comparator ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - # Windows has its own mechanism to list packages, and doesn't use the package body. - "test_skip_needs_work" string => "windows"; + # Windows has its own mechanism to list packages, and doesn't use the package body. + "test_skip_needs_work" string => "windows"; packages: - # Test that overriding 'equal' works. Installed is 01, requested is 1. Overridden eq compares numeric values. - "bash-1-amd64" + # Test that overriding 'equal' works. Installed is 01, requested is 1. Overridden eq compares numeric values. + "bash-1-amd64" package_policy => "addupdate", package_method => mock_zeroone_installed, classes => test_set_class("custom_eq_succ", "custom_eq_fail"); - "bash-2-amd64" + "bash-2-amd64" package_policy => "addupdate", package_method => mock_zeroone_installed_can_install, classes => test_set_class("custom_eq_2_succ", "custom_eq_2_fail"); @@ -40,70 +37,68 @@ bundle agent test body package_method mock_zeroone_installed { - package_changes => "individual"; - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - package_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_list_command => "$(G.printf) 'bash-01-amd64'"; - package_installed_regex => ".*"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; - - package_version_less_command => "test $(v1) -lt $(v2)"; - package_version_equal_command => "test $(v1) -eq $(v2)"; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_list_command => "$(G.printf) 'bash-01-amd64'"; + package_installed_regex => ".*"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; + package_version_less_command => "test $(v1) -lt $(v2)"; + package_version_equal_command => "test $(v1) -eq $(v2)"; } body package_method mock_zeroone_installed_can_install { - package_changes => "individual"; - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - package_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_list_command => "$(G.printf) 'bash-01-amd64'"; - package_installed_regex => ".*"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; - - package_version_less_command => "test $(v1) -lt $(v2)"; - package_version_equal_command => "test $(v1) -eq $(v2)"; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_list_command => "$(G.printf) 'bash-01-amd64'"; + package_installed_regex => ".*"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; + package_version_less_command => "test $(v1) -lt $(v2)"; + package_version_equal_command => "test $(v1) -eq $(v2)"; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { classes: - "ok" and => { "custom_eq_succ", "!custom_eq_fail", - "custom_eq_2_succ", "!custom_eq_2_fail" }; + "ok" + and => { + "custom_eq_succ", + "!custom_eq_fail", + "custom_eq_2_succ", + "!custom_eq_2_fail", + }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/default-list-architectures-different.cf b/tests/acceptance/07_packages/default-list-architectures-different.cf index 50229b5873..c86f85b706 100644 --- a/tests/acceptance/07_packages/default-list-architectures-different.cf +++ b/tests/acceptance/07_packages/default-list-architectures-different.cf @@ -1,67 +1,51 @@ -# # Test matching packages with explicit default architecture set and the same # architecture in list of installed packages. Should work similar to the case # there are no architectures at all. # # List of installed packages contains a single package with the default # architecture specified. -# - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { packages: - - # - # Test that package is matched by a promise with no package_architectures - # constraint, as it means "any architecture" - # - - "foobar" + # Test that package is matched by a promise with no package_architectures + # constraint, as it means "any architecture" + "foobar" package_version => "1", package_policy => "addupdate", package_method => mock, classes => kept("ok_1"); - # - # Test that specifying default architecture does not match the - # - - "foobar" + # Test that specifying default architecture does not match the + "foobar" package_version => "1", package_architectures => { "setun" }, package_policy => "addupdate", package_method => mock, classes => fail("ok_2"); - # - # Test that specifying proper architecture explicitly matches the package. - # - - "foobar" + # Test that specifying proper architecture explicitly matches the package. + "foobar" package_version => "1", package_architectures => { "besm6" }, package_policy => "addupdate", package_method => mock, classes => kept("ok_3"); - # - # Test that specifying wrong architecture explicitly does not match the package. - # - - "foobar" + # Test that specifying wrong architecture explicitly does not match the package. + "foobar" package_version => "1", package_architectures => { "aldan" }, package_policy => "addupdate", @@ -71,43 +55,41 @@ bundle agent test body package_method mock { - package_changes => "individual"; - - package_default_arch_command => "$(G.printf) 'setun'"; - - package_list_command => "$(G.printf) 'foobar-1-besm6'"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-([\S]+)"; - - package_installed_regex => ".*"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; + package_changes => "individual"; + package_default_arch_command => "$(G.printf) 'setun'"; + package_list_command => "$(G.printf) 'foobar-1-besm6'"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-([\S]+)"; + package_installed_regex => ".*"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; } body classes kept(classname) { - promise_kept => { "$(classname)" }; + promise_kept => { "$(classname)" }; } body classes fail(classname) { - repair_failed => { "$(classname)" }; + repair_failed => { "$(classname)" }; } bundle agent check { classes: - "ok" and => { "ok_1", "ok_2", "ok_3", "ok_4"}; + "ok" and => { "ok_1", "ok_2", "ok_3", "ok_4" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/default-list-architectures-same.cf b/tests/acceptance/07_packages/default-list-architectures-same.cf index f71fd771ca..fe238447cd 100644 --- a/tests/acceptance/07_packages/default-list-architectures-same.cf +++ b/tests/acceptance/07_packages/default-list-architectures-same.cf @@ -1,56 +1,43 @@ -# # Test matching packages with explicit default architecture set and the same # architecture in list of installed packages. Should work similar to the case # there are no architectures at all. # # List of installed packages contains a single package with the default # architecture specified. -# - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { packages: - - # - # Test that package is matched by a promise with no package_architectures - # constraint, as it means "any architecture" - # - - "foobar" + # Test that package is matched by a promise with no package_architectures + # constraint, as it means "any architecture" + "foobar" package_version => "1", package_policy => "addupdate", package_method => mock, classes => kept("ok_1"); - # - # Test that specifying proper architecture explicitly matches the package. - # - - "foobar" + # Test that specifying proper architecture explicitly matches the package. + "foobar" package_version => "1", package_architectures => { "setun" }, package_policy => "addupdate", package_method => mock, classes => kept("ok_2"); - # - # Test that specifying wrong architecture explicitly does not match the package. - # - - "foobar" + # Test that specifying wrong architecture explicitly does not match the package. + "foobar" package_version => "1", package_architectures => { "aldan" }, package_policy => "addupdate", @@ -60,43 +47,41 @@ bundle agent test body package_method mock { - package_changes => "individual"; - - package_default_arch_command => "$(G.printf) 'setun'"; - - package_list_command => "$(G.printf) 'foobar-1-setun'"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-([\S]+)"; - - package_installed_regex => ".*"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; + package_changes => "individual"; + package_default_arch_command => "$(G.printf) 'setun'"; + package_list_command => "$(G.printf) 'foobar-1-setun'"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-([\S]+)"; + package_installed_regex => ".*"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; } body classes kept(classname) { - promise_kept => { "$(classname)" }; + promise_kept => { "$(classname)" }; } body classes fail(classname) { - repair_failed => { "$(classname)" }; + repair_failed => { "$(classname)" }; } bundle agent check { classes: - "ok" and => { "ok_1", "ok_2", "ok_3" }; + "ok" and => { "ok_1", "ok_2", "ok_3" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/default_package_module.cf b/tests/acceptance/07_packages/default_package_module.cf index 187ffb06e9..5c7b94eac8 100644 --- a/tests/acceptance/07_packages/default_package_module.cf +++ b/tests/acceptance/07_packages/default_package_module.cf @@ -1,48 +1,54 @@ # Based on 07_package/package_module_path.cf - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - package_module => test_module; # important! part of this specific test + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + package_module => test_module; + + # important! part of this specific test } bundle agent init { files: - "$(sys.workdir)/modules/packages/." - create => "true"; - "$(sys.workdir)/modules/packages/test_module_script.sh" - copy_from => local_cp("$(this.promise_filename).module"), - perms => m("ugo+x"); + "$(sys.workdir)/modules/packages/." create => "true"; + + "$(sys.workdir)/modules/packages/test_module_script.sh" + copy_from => local_cp("$(this.promise_filename).module"), + perms => m("ugo+x"); } body package_module test_module { - query_installed_ifelapsed => "60"; - query_updates_ifelapsed => "14400"; - default_options => { "$(G.testfile)" }; - module_path => "$(sys.workdir)/modules/packages/test_module_script.sh"; + query_installed_ifelapsed => "60"; + query_updates_ifelapsed => "14400"; + default_options => { "$(G.testfile)" }; + module_path => "$(sys.workdir)/modules/packages/test_module_script.sh"; } bundle agent test { meta: - "description" - string => "Test that a package with no attributes uses a configured common control package_module", - meta => { "CFE-4408" }; - "test_soft_fail" string => "windows", - meta => { "ENT-10217" }; + "description" + string => "Test that a package with no attributes uses a configured common control package_module", + meta => { "CFE-4408" }; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10217" }; packages: - "first_pkg"; - "second_pkg"; + "first_pkg"; + "second_pkg"; } bundle agent check { methods: - "any" usebundle => dcs_check_diff($(G.testfile), - "$(this.promise_filename).expected", - $(this.promise_filename)); + "any" + usebundle => dcs_check_diff( + $(G.testfile), + "$(this.promise_filename).expected", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/07_packages/dependency-checks-package_delete_command.cf b/tests/acceptance/07_packages/dependency-checks-package_delete_command.cf index 53301c2a9b..a51f20881c 100644 --- a/tests/acceptance/07_packages/dependency-checks-package_delete_command.cf +++ b/tests/acceptance/07_packages/dependency-checks-package_delete_command.cf @@ -6,73 +6,74 @@ # dependent attributes: # package_delete_convention ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { packages: - "bash-1.0-amd64" + "bash-1.0-amd64" package_policy => "add", package_method => mock_no_delete_command_delete_convention, - classes => test_set_class("no_delete_command_delete_convention_succ", - "no_delete_command_delete_convention_fail"); + classes => test_set_class( + "no_delete_command_delete_convention_succ", + "no_delete_command_delete_convention_fail" + ); } body package_method mock_no_delete_command_delete_convention { - package_changes => "individual"; - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - package_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_list_command => "$(G.printf) 'bash-1.0-amd64'"; - package_installed_regex => ".*"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_list_command => "$(G.printf) 'bash-1.0-amd64'"; + package_installed_regex => ".*"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - # package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; - - package_delete_convention => "$(name)"; - + # package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; + package_delete_convention => "$(name)"; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { classes: - "ok" and => { "!no_delete_command_delete_convention_succ", "no_delete_command_delete_convention_fail", + "ok" + and => { + "!no_delete_command_delete_convention_succ", + "no_delete_command_delete_convention_fail", }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/dependency-checks-package_list_command.cf b/tests/acceptance/07_packages/dependency-checks-package_list_command.cf index e9d61ef528..57b93d466d 100644 --- a/tests/acceptance/07_packages/dependency-checks-package_list_command.cf +++ b/tests/acceptance/07_packages/dependency-checks-package_list_command.cf @@ -10,168 +10,170 @@ # package_list_version_regex # package_multiline_start ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { meta: - # Windows has its own mechanism to list packages, and doesn't use the package body. - "test_skip_unsupported" string => "windows"; + # Windows has its own mechanism to list packages, and doesn't use the package body. + "test_skip_unsupported" string => "windows"; packages: - "bash-1.0-amd64" + "bash-1.0-amd64" package_policy => "add", package_method => mock_no_list_command_package_installed_regex, - classes => test_set_class("no_list_command_package_installed_regex_succ", - "no_list_command_package_installed_regex_fail"); + classes => test_set_class( + "no_list_command_package_installed_regex_succ", + "no_list_command_package_installed_regex_fail" + ); - "bash-2.0-amd64" + "bash-2.0-amd64" package_policy => "add", package_method => mock_no_list_command_package_arch_regex, - classes => test_set_class("no_list_command_package_arch_regex_succ", - "no_list_command_package_arch_regex_fail"); + classes => test_set_class( + "no_list_command_package_arch_regex_succ", + "no_list_command_package_arch_regex_fail" + ); - "bash-1.0-i386" + "bash-1.0-i386" package_policy => "add", package_method => mock_no_list_command_package_name_regex, - classes => test_set_class("no_list_command_package_name_regex_succ", - "no_list_command_package_name_regex_fail"); + classes => test_set_class( + "no_list_command_package_name_regex_succ", + "no_list_command_package_name_regex_fail" + ); - "bash-1.0-sparc" + "bash-1.0-sparc" package_policy => "add", package_method => mock_no_list_command_package_version_regex, - classes => test_set_class("no_list_command_package_version_regex_succ", - "no_list_command_package_version_regex_fail"); + classes => test_set_class( + "no_list_command_package_version_regex_succ", + "no_list_command_package_version_regex_fail" + ); } body package_method mock_no_list_command_package_version_regex { - package_changes => "individual"; - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - package_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_file_repositories => { "/package/repos1", "package/repos2" }; - # but no package_list_command! - # package_installed_regex => ".*"; - # package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; - # package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - # package_multiline_start => - - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_file_repositories => { "/package/repos1", "package/repos2" }; + + # but no package_list_command! + # package_installed_regex => ".*"; + # package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + # package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + + # package_multiline_start => + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; } body package_method mock_no_list_command_package_name_regex { - package_changes => "individual"; - - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - package_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_file_repositories => { "/package/repos1", "package/repos2" }; - # but no package_list_command! - # package_installed_regex => ".*"; - # package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; - package_list_name_regex => "^([^-]+)"; - # package_list_version_regex => "^[^-]+-([^-]+)"; - # package_multiline_start => - - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_file_repositories => { "/package/repos1", "package/repos2" }; + + # but no package_list_command! + # package_installed_regex => ".*"; + # package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_list_name_regex => "^([^-]+)"; + + # package_list_version_regex => "^[^-]+-([^-]+)"; + # package_multiline_start => + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; } body package_method mock_no_list_command_package_arch_regex { - package_changes => "individual"; - - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - package_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_file_repositories => { "/package/repos1", "package/repos2" }; - # but no package_list_command! - # package_installed_regex => ".*"; - package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; - # package_list_name_regex => "^([^-]+)"; - # package_list_version_regex => "^[^-]+-([^-]+)"; - # package_multiline_start => - - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_file_repositories => { "/package/repos1", "package/repos2" }; + + # but no package_list_command! + # package_installed_regex => ".*"; + package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + + # package_list_name_regex => "^([^-]+)"; + # package_list_version_regex => "^[^-]+-([^-]+)"; + # package_multiline_start => + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; } body package_method mock_no_list_command_package_installed_regex { - package_changes => "individual"; - - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - package_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_file_repositories => { "/package/repos1", "package/repos2" }; - # but no package_list_command! - package_installed_regex => ".*"; - # package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; - # package_list_name_regex => "^([^-]+)"; - # package_list_version_regex => "^[^-]+-([^-]+)"; - # package_multiline_start => - - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_file_repositories => { "/package/repos1", "package/repos2" }; + + # but no package_list_command! + package_installed_regex => ".*"; + + # package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + # package_list_name_regex => "^([^-]+)"; + # package_list_version_regex => "^[^-]+-([^-]+)"; + # package_multiline_start => + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { classes: - "ok" and => { "!no_list_command_package_installed_regex_succ", "no_list_command_package_installed_regex_fail", - "!no_list_command_package_arch_regex_succ", "no_list_command_package_arch_regex_fail", - "!no_list_command_package_name_regex_succ", "no_list_command_package_name_regex_fail", - "!no_list_command_package_version_regex_succ", "no_list_command_package_version_regex_fail", + "ok" + and => { + "!no_list_command_package_installed_regex_succ", + "no_list_command_package_installed_regex_fail", + "!no_list_command_package_arch_regex_succ", + "no_list_command_package_arch_regex_fail", + "!no_list_command_package_name_regex_succ", + "no_list_command_package_name_regex_fail", + "!no_list_command_package_version_regex_succ", + "no_list_command_package_version_regex_fail", }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/07_packages/dependency-checks-package_patch_command.cf b/tests/acceptance/07_packages/dependency-checks-package_patch_command.cf index 699883497e..67c8a6e429 100644 --- a/tests/acceptance/07_packages/dependency-checks-package_patch_command.cf +++ b/tests/acceptance/07_packages/dependency-checks-package_patch_command.cf @@ -8,130 +8,129 @@ # package_patch_name_regex # package_patch_version_regex ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { packages: - "bash-1.0-amd64" + "bash-1.0-amd64" package_policy => "add", package_method => mock_no_patch_command_patch_arch_regex, - classes => test_set_class("no_patch_command_patch_arch_regex_succ", - "no_patch_command_patch_arch_regex_fail"); + classes => test_set_class( + "no_patch_command_patch_arch_regex_succ", + "no_patch_command_patch_arch_regex_fail" + ); - "bash-1.0-i386" + "bash-1.0-i386" package_policy => "add", package_method => mock_no_patch_command_patch_name_regex, - classes => test_set_class("no_patch_command_patch_name_regex_succ", - "no_patch_command_patch_name_regex_fail"); + classes => test_set_class( + "no_patch_command_patch_name_regex_succ", + "no_patch_command_patch_name_regex_fail" + ); - "bash-1.0-sparc" + "bash-1.0-sparc" package_policy => "add", package_method => mock_no_patch_command_patch_version_regex, - classes => test_set_class("no_patch_command_patch_version_regex_succ", - "no_patch_command_patch_version_regex_fail"); + classes => test_set_class( + "no_patch_command_patch_version_regex_succ", + "no_patch_command_patch_version_regex_fail" + ); } body package_method mock_no_patch_command_patch_arch_regex { - package_changes => "individual"; - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - package_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_list_command => "$(G.printf) 'bash-1.0-amd64'"; - package_installed_regex => ".*"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; - - package_patch_arch_regex => ""; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_list_command => "$(G.printf) 'bash-1.0-amd64'"; + package_installed_regex => ".*"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; + package_patch_arch_regex => ""; } body package_method mock_no_patch_command_patch_name_regex { - package_changes => "individual"; - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - package_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_list_command => "$(G.printf) 'bash-1.0-amd64'"; - package_installed_regex => ".*"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; - - package_patch_name_regex => ""; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_list_command => "$(G.printf) 'bash-1.0-amd64'"; + package_installed_regex => ".*"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; + package_patch_name_regex => ""; } body package_method mock_no_patch_command_patch_version_regex { - package_changes => "individual"; - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - package_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_list_command => "$(G.printf) 'bash-1.0-amd64'"; - package_installed_regex => ".*"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; - - package_patch_version_regex => ""; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_list_command => "$(G.printf) 'bash-1.0-amd64'"; + package_installed_regex => ".*"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; + package_patch_version_regex => ""; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { classes: - "ok" and => { "!no_patch_command_patch_arch_regex_succ", "no_patch_command_patch_arch_regex_fail", - "!no_patch_command_patch_name_regex_succ", "no_patch_command_patch_name_regex_fail", - "!no_patch_command_patch_version_regex_succ", "no_patch_command_patch_version_regex_fail", + "ok" + and => { + "!no_patch_command_patch_arch_regex_succ", + "no_patch_command_patch_arch_regex_fail", + "!no_patch_command_patch_name_regex_succ", + "no_patch_command_patch_name_regex_fail", + "!no_patch_command_patch_version_regex_succ", + "no_patch_command_patch_version_regex_fail", }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/dependency-checks-package_patch_list_command.cf b/tests/acceptance/07_packages/dependency-checks-package_patch_list_command.cf index c86e4c2bcc..39cef2b2ad 100644 --- a/tests/acceptance/07_packages/dependency-checks-package_patch_list_command.cf +++ b/tests/acceptance/07_packages/dependency-checks-package_patch_list_command.cf @@ -6,72 +6,73 @@ # dependent attributes: # package_patch_installed_regex ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { packages: - "bash-1.0-amd64" + "bash-1.0-amd64" package_policy => "add", package_method => mock_no_patch_list_command_patch_installed_regex, - classes => test_set_class("no_patch_list_command_patch_installed_regex_succ", - "no_patch_list_command_patch_installed_regex_fail"); + classes => test_set_class( + "no_patch_list_command_patch_installed_regex_succ", + "no_patch_list_command_patch_installed_regex_fail" + ); } body package_method mock_no_patch_list_command_patch_installed_regex { - package_changes => "individual"; - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - package_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_list_command => "$(G.printf) 'bash-1.0-amd64'"; - package_installed_regex => ".*"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; - - package_patch_installed_regex => ""; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_list_command => "$(G.printf) 'bash-1.0-amd64'"; + package_installed_regex => ".*"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; + package_patch_installed_regex => ""; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { classes: - "ok" and => { "!no_patch_list_command_patch_installed_regex_succ", "no_patch_list_command_patch_installed_regex_fail", + "ok" + and => { + "!no_patch_list_command_patch_installed_regex_succ", + "no_patch_list_command_patch_installed_regex_fail", }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/dependency-checks-package_verify_command.cf b/tests/acceptance/07_packages/dependency-checks-package_verify_command.cf index 8cd768c215..c6b24ee18a 100644 --- a/tests/acceptance/07_packages/dependency-checks-package_verify_command.cf +++ b/tests/acceptance/07_packages/dependency-checks-package_verify_command.cf @@ -7,105 +7,105 @@ # package_noverify_regex # package_noverify_returncode ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { packages: - "bash-1.0-amd64" + "bash-1.0-amd64" package_policy => "add", package_method => mock_no_verify_command_noverify_regex, - classes => test_set_class("no_verify_command_noverify_regex_succ", - "no_verify_command_noverify_regex_fail"); + classes => test_set_class( + "no_verify_command_noverify_regex_succ", + "no_verify_command_noverify_regex_fail" + ); - "bash-1.0-i386" + "bash-1.0-i386" package_policy => "add", package_method => mock_no_verify_command_noverify_returncode, - classes => test_set_class("no_verify_command_noverify_returncode_succ", - "no_verify_command_noverify_returncode_fail"); + classes => test_set_class( + "no_verify_command_noverify_returncode_succ", + "no_verify_command_noverify_returncode_fail" + ); } body package_method mock_no_verify_command_noverify_regex { - package_changes => "individual"; - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - package_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_list_command => "$(G.printf) 'bash-1.0-amd64'"; - package_installed_regex => ".*"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_add_command => "$(G.true)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.true)"; - # package_verify_command => "$(G.true)"; - - package_noverify_regex => "."; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_list_command => "$(G.printf) 'bash-1.0-amd64'"; + package_installed_regex => ".*"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_add_command => "$(G.true)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.true)"; + + # package_verify_command => "$(G.true)"; + package_noverify_regex => "."; } body package_method mock_no_verify_command_noverify_returncode { - package_changes => "individual"; - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - package_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_list_command => "$(G.printf) 'bash-1.0-amd64'"; - package_installed_regex => ".*"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_add_command => "$(G.true)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.true)"; - # package_verify_command => "$(G.true)"; - - package_noverify_returncode => "-1"; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_list_command => "$(G.printf) 'bash-1.0-amd64'"; + package_installed_regex => ".*"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_add_command => "$(G.true)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.true)"; + + # package_verify_command => "$(G.true)"; + package_noverify_returncode => "-1"; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { classes: - "ok" and => { "!no_verify_command_noverify_regex_succ", "no_verify_command_noverify_regex_fail", - "!no_verify_command_noverify_returncode_succ", "no_verify_command_noverify_returncode_fail", + "ok" + and => { + "!no_verify_command_noverify_regex_succ", + "no_verify_command_noverify_regex_fail", + "!no_verify_command_noverify_returncode_succ", + "no_verify_command_noverify_returncode_fail", }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/dry-run-install.cf b/tests/acceptance/07_packages/dry-run-install.cf index a35865bff0..f852921e36 100644 --- a/tests/acceptance/07_packages/dry-run-install.cf +++ b/tests/acceptance/07_packages/dry-run-install.cf @@ -1,36 +1,42 @@ # Test that if the action => 'warn' is specified, no packages are installed. - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { vars: - "subout" string => execresult("$(sys.cf_agent) -Kv -f $(this.promise_filename).sub | $(G.grep) should-not-be-called", "useshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -Kv -f $(this.promise_filename).sub | $(G.grep) should-not-be-called", + "useshell" + ); } bundle agent check { classes: - "ok" not => regcmp(".*should-not-be-called.*", "$(test.subout)"); + "ok" not => regcmp(".*should-not-be-called.*", "$(test.subout)"); reports: DEBUG:: "$(test.subout)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/has-default-no-list-architectures.cf b/tests/acceptance/07_packages/has-default-no-list-architectures.cf index 60dbc78f86..1030f80e34 100644 --- a/tests/acceptance/07_packages/has-default-no-list-architectures.cf +++ b/tests/acceptance/07_packages/has-default-no-list-architectures.cf @@ -1,56 +1,43 @@ -# # Test matching packages with explicit default architecture set and no # architecture in list of installed packages. Should work similar to the case # there are no architectures at all. # # List of installed packages contains a single package with no architecture # specified. -# - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { packages: - - # - # Test that package is matched by a promise with no package_architectures - # constraint, as it means "any architecture" - # - - "foobar" + # Test that package is matched by a promise with no package_architectures + # constraint, as it means "any architecture" + "foobar" package_version => "1", package_policy => "addupdate", package_method => mock, classes => kept("ok_1"); - # - # Test that specifying proper architecture explicitly matches the package. - # - - "foobar" + # Test that specifying proper architecture explicitly matches the package. + "foobar" package_version => "1", package_architectures => { "setun" }, package_policy => "addupdate", package_method => mock, classes => kept("ok_2"); - # - # Test that specifying wrong architecture explicitly does not match the package. - # - - "foobar" + # Test that specifying wrong architecture explicitly does not match the package. + "foobar" package_version => "1", package_architectures => { "aldan" }, package_policy => "addupdate", @@ -60,42 +47,40 @@ bundle agent test body package_method mock { - package_changes => "individual"; - - package_default_arch_command => "$(G.printf) 'setun'"; - - package_list_command => "$(G.printf) 'foobar-1'"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([\S+])"; - - package_installed_regex => ".*"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; + package_changes => "individual"; + package_default_arch_command => "$(G.printf) 'setun'"; + package_list_command => "$(G.printf) 'foobar-1'"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([\S+])"; + package_installed_regex => ".*"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; } body classes kept(classname) { - promise_kept => { "$(classname)" }; + promise_kept => { "$(classname)" }; } body classes fail(classname) { - repair_failed => { "$(classname)" }; + repair_failed => { "$(classname)" }; } bundle agent check { classes: - "ok" and => { "ok_1", "ok_2", "ok_3" }; + "ok" and => { "ok_1", "ok_2", "ok_3" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/list-architecture.cf b/tests/acceptance/07_packages/list-architecture.cf index 169eff1e59..3ee8b87832 100644 --- a/tests/acceptance/07_packages/list-architecture.cf +++ b/tests/acceptance/07_packages/list-architecture.cf @@ -1,54 +1,41 @@ -# # Test matching packages with no explicit default architecture set, but with # architecture reported by the list of installed packages. # # List of installed packages contains a single package with explicit architecture set. -# - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { packages: - - # - # Test that package with explicit architecture is matched by promise with no - # package_architectures constraint, as no constraint means "any architecture". - # - - "foobar" + # Test that package with explicit architecture is matched by promise with no + # package_architectures constraint, as no constraint means "any architecture". + "foobar" package_version => "1", package_policy => "addupdate", package_method => mock, classes => kept("ok_1"); - # - # Test that specifying architecture explicitly matches. - # - - "foobar" + # Test that specifying architecture explicitly matches. + "foobar" package_version => "1", package_architectures => { "besm6" }, package_policy => "addupdate", package_method => mock, classes => kept("ok_2"); - # - # Test that specifying wrong architecture does not match. - # - - "foobar" + # Test that specifying wrong architecture does not match. + "foobar" package_version => "1", package_architectures => { "aldan" }, package_policy => "addupdate", @@ -58,41 +45,40 @@ bundle agent test body package_method mock { - package_changes => "individual"; - - package_list_command => "$(G.printf) 'foobar-1-besm6'"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-([\S]+)"; - - package_installed_regex => ".*"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; + package_changes => "individual"; + package_list_command => "$(G.printf) 'foobar-1-besm6'"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-([\S]+)"; + package_installed_regex => ".*"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; } body classes kept(classname) { - promise_kept => { "$(classname)" }; + promise_kept => { "$(classname)" }; } body classes fail(classname) { - repair_failed => { "$(classname)" }; + repair_failed => { "$(classname)" }; } bundle agent check { classes: - "ok" and => { "ok_1", "ok_2", "ok_3" }; + "ok" and => { "ok_1", "ok_2", "ok_3" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/no-architectures.cf b/tests/acceptance/07_packages/no-architectures.cf index fa0f8e34f0..f1f98bafed 100644 --- a/tests/acceptance/07_packages/no-architectures.cf +++ b/tests/acceptance/07_packages/no-architectures.cf @@ -1,45 +1,35 @@ -# # Test matching packages with no explicit default architecture set and no # architectures in list of installed packages. # # List of installed packages contains a single package with no architecture # specified. -# - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { packages: - - # - # Test that package is matched by a promise with no package_architectures - # constraint. - # - - "foobar" + # Test that package is matched by a promise with no package_architectures + # constraint. + "foobar" package_version => "1", package_policy => "addupdate", package_method => mock, classes => kept("ok_1"); - # - # Test that specifying architecture explicitly does not match the package with - # default architecture. - # - - "foobar" + # Test that specifying architecture explicitly does not match the package with + # default architecture. + "foobar" package_version => "1", package_architectures => { "aldan" }, package_policy => "addupdate", @@ -49,40 +39,39 @@ bundle agent test body package_method mock { - package_changes => "individual"; - - package_list_command => "$(G.printf) 'foobar-1'"; - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([\S+])"; - - package_installed_regex => ".*"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.false)"; - package_verify_command => "$(G.false)"; + package_changes => "individual"; + package_list_command => "$(G.printf) 'foobar-1'"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([\S+])"; + package_installed_regex => ".*"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.false)"; + package_verify_command => "$(G.false)"; } body classes kept(classname) { - promise_kept => { "$(classname)" }; + promise_kept => { "$(classname)" }; } body classes fail(classname) { - repair_failed => { "$(classname)" }; + repair_failed => { "$(classname)" }; } bundle agent check { classes: - "ok" and => { "ok_1", "ok_2" }; + "ok" and => { "ok_1", "ok_2" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/package_commands_useshell.cf b/tests/acceptance/07_packages/package_commands_useshell.cf index fa3f87edf3..55a396b1b2 100644 --- a/tests/acceptance/07_packages/package_commands_useshell.cf +++ b/tests/acceptance/07_packages/package_commands_useshell.cf @@ -3,139 +3,125 @@ # Test package_commands_useshell works # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { meta: - # Windows has its own mechanism to list packages, and doesn't use the package body. - "test_skip_needs_work" string => "windows"; + # Windows has its own mechanism to list packages, and doesn't use the package body. + "test_skip_needs_work" string => "windows"; vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { packages: - "bash-1.0-amd64" + "bash-1.0-amd64" package_policy => "add", package_method => mock_useshell_true, - classes => test_set_class("useshell_true_succ", - "useshell_true_fail"); + classes => test_set_class("useshell_true_succ", "useshell_true_fail"); - "bash-1.0-i386" + "bash-1.0-i386" package_policy => "add", package_method => mock_useshell_false, - classes => test_set_class("useshell_false_succ", - "useshell_false_fail"); + classes => test_set_class("useshell_false_succ", "useshell_false_fail"); - "bash-1.0-spark" + "bash-1.0-spark" package_policy => "add", package_method => mock_useshell_unset, - classes => test_set_class("useshell_unset_succ", - "useshell_unset_fail"); + classes => test_set_class("useshell_unset_succ", "useshell_unset_fail"); } body package_method mock_useshell_true { - package_changes => "individual"; - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - package_arch_regex => "^[^-]+-[^-]+-(.*)"; - - - package_list_command => "if true; then true; else false; fi"; - - package_list_name_regex => ".*"; - package_list_version_regex => ".*"; - package_list_arch_regex => ".*"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(G.true)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.true)"; - package_verify_command => "$(G.true)"; - - package_commands_useshell => "true"; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_list_command => "if true; then true; else false; fi"; + package_list_name_regex => ".*"; + package_list_version_regex => ".*"; + package_list_arch_regex => ".*"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(G.true)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.true)"; + package_verify_command => "$(G.true)"; + package_commands_useshell => "true"; } body package_method mock_useshell_false { - package_changes => "individual"; - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - package_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_list_command => "if true; then true; else false; fi"; - - package_list_name_regex => "^[^:]*"; - package_list_version_regex => ":(?<=:).*(?=:)"; - package_list_arch_regex => "[^:]\w+$"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(G.true)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.true)"; - package_verify_command => "$(G.true)"; - - package_commands_useshell => "false"; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_list_command => "if true; then true; else false; fi"; + package_list_name_regex => "^[^:]*"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_list_arch_regex => "[^:]\w+$"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(G.true)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.true)"; + package_verify_command => "$(G.true)"; + package_commands_useshell => "false"; } body package_method mock_useshell_unset { - package_changes => "individual"; - - package_name_regex => "^([^-]+)"; - package_version_regex => "^[^-]+-([^-]+)"; - package_arch_regex => "^[^-]+-[^-]+-(.*)"; - - package_list_command => "echo 'a:b:c\n'"; - - package_list_name_regex => "^[^:]*"; - package_list_version_regex => ":(?<=:).*(?=:)"; - package_list_arch_regex => "[^:]\w+$"; - package_installed_regex => "^[^:]*"; - - package_add_command => "$(G.true)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.true)"; - package_verify_command => "$(G.true)"; + package_changes => "individual"; + package_name_regex => "^([^-]+)"; + package_version_regex => "^[^-]+-([^-]+)"; + package_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_list_command => "echo 'a:b:c\n'"; + package_list_name_regex => "^[^:]*"; + package_list_version_regex => ":(?<=:).*(?=:)"; + package_list_arch_regex => "[^:]\w+$"; + package_installed_regex => "^[^:]*"; + package_add_command => "$(G.true)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.true)"; + package_verify_command => "$(G.true)"; } -body classes test_set_class(ok_class,notok_class) +body classes test_set_class(ok_class, notok_class) { - promise_kept => { "$(ok_class)" }; - promise_repaired => { "$(ok_class)" }; - repair_failed => { "$(notok_class)" }; + promise_kept => { "$(ok_class)" }; + promise_repaired => { "$(ok_class)" }; + repair_failed => { "$(notok_class)" }; } ####################################################### - bundle agent check { classes: - "ok" and => { "useshell_true_succ", "!useshell_true_fail", - "!useshell_false_succ", "useshell_false_fail", - "useshell_unset_succ", "!useshell_unset_fail", + "ok" + and => { + "useshell_true_succ", + "!useshell_true_fail", + "!useshell_false_succ", + "useshell_false_fail", + "useshell_unset_succ", + "!useshell_unset_fail", }; + reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/package_module_interpreter.cf b/tests/acceptance/07_packages/package_module_interpreter.cf index ec19aea99a..4db08bbc74 100644 --- a/tests/acceptance/07_packages/package_module_interpreter.cf +++ b/tests/acceptance/07_packages/package_module_interpreter.cf @@ -1,50 +1,57 @@ # Based on 00_basics/ifelapsed_and_expireafter/timed/package_lock.cf - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { files: - "$(sys.workdir)/modules/packages/." - create => "true"; - "$(sys.workdir)/modules/packages/test_module" - copy_from => local_cp("$(this.promise_filename).module"); + "$(sys.workdir)/modules/packages/." create => "true"; + + "$(sys.workdir)/modules/packages/test_module" + copy_from => local_cp("$(this.promise_filename).module"); } body package_module test_module { - query_installed_ifelapsed => "60"; - query_updates_ifelapsed => "14400"; - default_options => { "$(G.testfile)" }; - interpreter => "$(G.sh)"; # /bin/sh; NOTE: no hashbang in the test_module script + query_installed_ifelapsed => "60"; + query_updates_ifelapsed => "14400"; + default_options => { "$(G.testfile)" }; + interpreter => "$(G.sh)"; + + # /bin/sh; NOTE: no hashbang in the test_module script } bundle agent test { meta: - "description" - string => "Test that the interpreter for the package module script can be set", - meta => { "CFE-2880" }; - "test_soft_fail" string => "windows", - meta => { "ENT-10254" }; + "description" + string => "Test that the interpreter for the package module script can be set", + meta => { "CFE-2880" }; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10254" }; packages: - "first_pkg" - policy => "present", - package_module => test_module; - "second_pkg" - policy => "present", - package_module => test_module; + "first_pkg" + policy => "present", + package_module => test_module; + + "second_pkg" + policy => "present", + package_module => test_module; } bundle agent check { methods: - "any" usebundle => dcs_check_diff($(G.testfile), - "$(this.promise_filename).expected", - $(this.promise_filename)); + "any" + usebundle => dcs_check_diff( + $(G.testfile), + "$(this.promise_filename).expected", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/07_packages/package_module_path.cf b/tests/acceptance/07_packages/package_module_path.cf index 00b9080446..6362986fb1 100644 --- a/tests/acceptance/07_packages/package_module_path.cf +++ b/tests/acceptance/07_packages/package_module_path.cf @@ -1,51 +1,56 @@ # Based on 00_basics/ifelapsed_and_expireafter/timed/package_lock.cf - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { files: - "$(sys.workdir)/modules/packages/." - create => "true"; - "$(sys.workdir)/modules/packages/test_module_script.sh" - copy_from => local_cp("$(this.promise_filename).module"), - perms => m("ugo+x"); + "$(sys.workdir)/modules/packages/." create => "true"; + + "$(sys.workdir)/modules/packages/test_module_script.sh" + copy_from => local_cp("$(this.promise_filename).module"), + perms => m("ugo+x"); } body package_module test_module { - query_installed_ifelapsed => "60"; - query_updates_ifelapsed => "14400"; - default_options => { "$(G.testfile)" }; - module_path => "$(sys.workdir)/modules/packages/test_module_script.sh"; + query_installed_ifelapsed => "60"; + query_updates_ifelapsed => "14400"; + default_options => { "$(G.testfile)" }; + module_path => "$(sys.workdir)/modules/packages/test_module_script.sh"; } bundle agent test { meta: - "description" - string => "Test that the interpreter for the package module script can be set", - meta => { "CFE-2880" }; - "test_soft_fail" string => "windows", - meta => { "ENT-10217" }; + "description" + string => "Test that the interpreter for the package module script can be set", + meta => { "CFE-2880" }; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10217" }; packages: - "first_pkg" - policy => "present", - package_module => test_module; - "second_pkg" - policy => "present", - package_module => test_module; + "first_pkg" + policy => "present", + package_module => test_module; + + "second_pkg" + policy => "present", + package_module => test_module; } bundle agent check { methods: - "any" usebundle => dcs_check_diff($(G.testfile), - "$(this.promise_filename).expected", - $(this.promise_filename)); + "any" + usebundle => dcs_check_diff( + $(G.testfile), + "$(this.promise_filename).expected", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/07_packages/packages_command.cf b/tests/acceptance/07_packages/packages_command.cf index e0303c075c..52cb4f2604 100644 --- a/tests/acceptance/07_packages/packages_command.cf +++ b/tests/acceptance/07_packages/packages_command.cf @@ -3,11 +3,10 @@ # See ticket ENT-13536 for info # ####################################################### - body common control { inputs => { "../default.sub.cf" }; - bundlesequence => { "G", "g", default("$(this.promise_filename)") }; + bundlesequence => { "G", "g", default("$(this.promise_filename)") }; version => "1.0"; cache_system_functions => "false"; } @@ -16,12 +15,10 @@ body package_method mock { package_changes => "individual"; package_list_command => "$(g.pm) --list-installed"; - package_list_name_regex => "^[^:]*"; package_list_version_regex => ":(?<=:).*(?=:)"; package_list_arch_regex => "[^:]\w+$"; package_installed_regex => "^[^:]*"; - package_add_command => "$(g.pm) --add "; package_update_command => "$(g.pm) --update "; package_delete_command => "$(g.pm) --delete "; @@ -31,7 +28,7 @@ body package_method mock bundle common g { classes: - "mpm_declared" not => strcmp(getenv("MOCK_PACKAGE_MANAGER", "65535"), ""); + "mpm_declared" not => strcmp(getenv("MOCK_PACKAGE_MANAGER", "65535"), ""); vars: mpm_declared:: @@ -42,51 +39,47 @@ bundle common g } ####################################################### - bundle agent init { commands: - "$(g.pm) --clear-installed"; - "$(g.pm) --clear-available"; - "$(g.pm) --populate-available imagisoft:1.0i:teapot"; + "$(g.pm) --clear-installed"; + "$(g.pm) --clear-available"; + "$(g.pm) --populate-available imagisoft:1.0i:teapot"; files: - "$(G.testfile)" - delete => tidy; + "$(G.testfile)" delete => tidy; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows", - meta => { "ENT-10215" }; + "test_skip_unsupported" + string => "windows", + meta => { "ENT-10215" }; vars: - "name" string => "imagisoft"; - "version" string => "1.0i"; - "arch" string => "teapot"; + "name" string => "imagisoft"; + "version" string => "1.0i"; + "arch" string => "teapot"; packages: - "imagisoft; echo 'Hello CFEngine' > '$(G.testfile)';" - package_policy => "add", - package_method => mock; + "imagisoft; echo 'Hello CFEngine' > '$(G.testfile)';" + package_policy => "add", + package_method => mock; } ####################################################### - bundle agent check { reports: - "$(this.promise_filename) $(with)" - with => ifelse(fileexists("$(G.testfile)"), "FAIL", "Pass"); + "$(this.promise_filename) $(with)" + with => ifelse(fileexists("$(G.testfile)"), "FAIL", "Pass"); } ####################################################### - bundle agent clean { methods: - "init"; + "init"; } diff --git a/tests/acceptance/07_packages/repositories.cf b/tests/acceptance/07_packages/repositories.cf index 80b352bd3e..8cc64f8f6d 100644 --- a/tests/acceptance/07_packages/repositories.cf +++ b/tests/acceptance/07_packages/repositories.cf @@ -1,31 +1,33 @@ # Tests that package upgrade works properly - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "d" string => "$(const.dirsep)"; + "d" string => "$(const.dirsep)"; + # Due to shell rules, windows includes certain characters on certain commands, # while Unix does not. windows:: "single_quote" string => "'"; "q" string => '"'; "s" string => ' '; + !windows:: "single_quote" string => ''; "q" string => ''; "s" string => ''; methods: - "make" usebundle => file_make("$(G.testfile).expected", - " + "make" + usebundle => file_make( + "$(G.testfile).expected", + " $(s)filerepo DELETE $(single_quote)delete-exact-version-2.2.3.i386.rpm$(single_quote) $(s)filerepo ADD $(q)$(G.cwd)$(d).$(d)07_packages$(d)test_repository$(d)install-greaterthan-version-2.2.3.i386.rpm$(q) $(s)filerepo ADD $(q)$(G.cwd)$(d).$(d)07_packages$(d)test_repository$(d)install-greaterorequal-version-2.2.3.i386.rpm$(q) @@ -38,20 +40,24 @@ $(s)filerepo UPDATE $(q)$(G.cwd)$(d).$(d)07_packages$(d)test_repository$(d)updat $(s)filerepo UPDATE $(q)$(G.cwd)$(d).$(d)07_packages$(d)test_repository$(d)update-to-greaterorequal-version-2.2.3.i386.rpm$(q) $(s)filerepo UPDATE $(q)$(G.cwd)$(d).$(d)07_packages$(d)test_repository$(d)update-to-lessthan-version-2.2.3.i386.rpm$(q) $(s)filerepo UPDATE $(q)$(G.cwd)$(d).$(d)07_packages$(d)test_repository$(d)update-to-lessorequal-version-2.2.3.i386.rpm$(q) -$(s)filerepo UPDATE $(q)$(G.cwd)$(d).$(d)07_packages$(d)test_repository$(d)update-to-exact-version-2.2.3.i386.rpm$(q)"); - +$(s)filerepo UPDATE $(q)$(G.cwd)$(d).$(d)07_packages$(d)test_repository$(d)update-to-exact-version-2.2.3.i386.rpm$(q)" + ); } bundle agent test { methods: - "run" usebundle => dcs_runagent("$(this.promise_filename).sub"); + "run" usebundle => dcs_runagent("$(this.promise_filename).sub"); } bundle agent check { methods: - "any" usebundle => sorted_check_diff("$(G.testfile)", "$(G.testfile).expected", "$(this.promise_filename)"); + "any" + usebundle => sorted_check_diff( + "$(G.testfile)", "$(G.testfile).expected", "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/upgrade-package-version.cf b/tests/acceptance/07_packages/upgrade-package-version.cf index 4d4b0e592a..56c76e2640 100644 --- a/tests/acceptance/07_packages/upgrade-package-version.cf +++ b/tests/acceptance/07_packages/upgrade-package-version.cf @@ -1,43 +1,38 @@ # Tests that package upgrade works properly with "more than" version - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { meta: - # Windows has its own mechanism to list packages, and doesn't use the package body. - "test_skip_needs_work" string => "windows"; + # Windows has its own mechanism to list packages, and doesn't use the package body. + "test_skip_needs_work" string => "windows"; vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } body package_method yum_rpm { - package_changes => "individual"; - package_list_command => "$(G.printf) 'which 1 i386'"; - - package_list_name_regex => "^(\S+?)\s\S+?\s\S+$"; - package_list_version_regex => "^\S+?\s(\S+?)\s\S+$"; - package_list_arch_regex => "^\S+?\s\S+?\s(\S+)$"; - - package_installed_regex => ".*"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.false)"; + package_changes => "individual"; + package_list_command => "$(G.printf) 'which 1 i386'"; + package_list_name_regex => "^(\S+?)\s\S+?\s\S+$"; + package_list_version_regex => "^\S+?\s(\S+?)\s\S+$"; + package_list_arch_regex => "^\S+?\s\S+?\s(\S+)$"; + package_installed_regex => ".*"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.false)"; } bundle agent test { packages: - "which" + "which" package_policy => "addupdate", package_select => ">", package_version => "2", @@ -50,8 +45,10 @@ bundle agent check reports: whichrepaired:: "$(this.promise_filename) Pass"; + !whichrepaired:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/upgrade-package.cf b/tests/acceptance/07_packages/upgrade-package.cf index 1ff89c5216..b0fd32f22a 100644 --- a/tests/acceptance/07_packages/upgrade-package.cf +++ b/tests/acceptance/07_packages/upgrade-package.cf @@ -1,43 +1,38 @@ # Tests that package upgrade works properly - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { meta: - # Windows has its own mechanism to list packages, and doesn't use the package body. - "test_skip_needs_work" string => "windows"; + # Windows has its own mechanism to list packages, and doesn't use the package body. + "test_skip_needs_work" string => "windows"; vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } body package_method yum_rpm { - package_changes => "individual"; - package_list_command => "$(G.printf) 'which 1 i386'"; - - package_list_name_regex => "^(\S+?)\s\S+?\s\S+$"; - package_list_version_regex => "^\S+?\s(\S+?)\s\S+$"; - package_list_arch_regex => "^\S+?\s\S+?\s(\S+)$"; - - package_installed_regex => ".*"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.true)"; - package_delete_command => "$(G.false)"; + package_changes => "individual"; + package_list_command => "$(G.printf) 'which 1 i386'"; + package_list_name_regex => "^(\S+?)\s\S+?\s\S+$"; + package_list_version_regex => "^\S+?\s(\S+?)\s\S+$"; + package_list_arch_regex => "^\S+?\s\S+?\s(\S+)$"; + package_installed_regex => ".*"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.true)"; + package_delete_command => "$(G.false)"; } bundle agent test { packages: - "which" + "which" package_policy => "addupdate", package_select => "==", package_version => "2", @@ -50,8 +45,10 @@ bundle agent check reports: whichrepaired:: "$(this.promise_filename) Pass"; + !whichrepaired:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/warn-package-delete-non-existing.cf b/tests/acceptance/07_packages/warn-package-delete-non-existing.cf index db4424bce5..6354d3a052 100644 --- a/tests/acceptance/07_packages/warn-package-delete-non-existing.cf +++ b/tests/acceptance/07_packages/warn-package-delete-non-existing.cf @@ -3,28 +3,25 @@ # Test delete a package that does not exist # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { packages: - "nosuchpackageinstalled" + "nosuchpackageinstalled" package_method => mock_warn_delete_pkg, package_policy => "delete", classes => kept_repaired_notkept("kept", "repaired", "notkept"); @@ -32,38 +29,35 @@ bundle agent test body package_method mock_warn_delete_pkg { - package_changes => "individual"; - - package_list_command => "$(G.printf) 'bash-4.2.8-x86_64'"; - - package_list_name_regex => "^([^-]+)"; - package_list_version_regex => "^[^-]+-([^-]+)"; - package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; - package_installed_regex => ".*"; - - package_add_command => "$(G.false)"; - package_update_command => "$(G.false)"; - package_delete_command => "$(G.true)"; - package_verify_command => "$(G.false)"; + package_changes => "individual"; + package_list_command => "$(G.printf) 'bash-4.2.8-x86_64'"; + package_list_name_regex => "^([^-]+)"; + package_list_version_regex => "^[^-]+-([^-]+)"; + package_list_arch_regex => "^[^-]+-[^-]+-(.*)"; + package_installed_regex => ".*"; + package_add_command => "$(G.false)"; + package_update_command => "$(G.false)"; + package_delete_command => "$(G.true)"; + package_verify_command => "$(G.false)"; } body classes kept_repaired_notkept(kept, repaired, notkept) { - promise_kept => { "$(kept)" }; - promise_repaired => { "$(repaired)" }; - repair_failed => { "$(notkept)" }; + promise_kept => { "$(kept)" }; + promise_repaired => { "$(repaired)" }; + repair_failed => { "$(notkept)" }; } ####################################################### - bundle agent check { - reports: kept:: "$(this.promise_filename) Pass"; + !kept:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/07_packages/warn-package-delete.cf b/tests/acceptance/07_packages/warn-package-delete.cf index 4a375910de..d303699f2b 100644 --- a/tests/acceptance/07_packages/warn-package-delete.cf +++ b/tests/acceptance/07_packages/warn-package-delete.cf @@ -3,44 +3,46 @@ # Test delete a package # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "subout" string => execresult("$(sys.cf_agent) -KI -f $(this.promise_filename).sub --dry-run", "useshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -KI -f $(this.promise_filename).sub --dry-run", + "useshell" + ); } ####################################################### - bundle agent check { classes: - "ok" expression => regcmp(".*Deleting.*", "$(test.subout)"); + "ok" expression => regcmp(".*Deleting.*", "$(test.subout)"); reports: - # DEBUG:: - # "$(test.subout)"; + # DEBUG:: + # "$(test.subout)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 29 diff --git a/tests/acceptance/08_commands/01_modules/001.cf b/tests/acceptance/08_commands/01_modules/001.cf index 788934d5b8..0205f47750 100644 --- a/tests/acceptance/08_commands/01_modules/001.cf +++ b/tests/acceptance/08_commands/01_modules/001.cf @@ -3,57 +3,54 @@ # Test command modules # ####################################################### - body common control { - inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "script_name" string => "$(this.promise_filename).txt"; + "script_name" string => "$(this.promise_filename).txt"; } ####################################################### - bundle agent test { vars: !windows:: "cat_prefix" string => "cat"; + windows:: "cat_prefix" string => "cat_exe"; commands: - "$(G.cat) $(init.script_name)" - contain => in_shell, - module => "true"; + "$(G.cat) $(init.script_name)" + contain => in_shell, + module => "true"; } ####################################################### - bundle agent check { classes: - CLASSTOBEDEFINED.!UNDEFINEDCLASS:: "classok" expression => "any"; any:: "varok" expression => strcmp("${$(test.cat_prefix).answer}", "42"); - "ok" and => { "classok", "varok" }; reports: DEBUG:: "${$(test.cat_prefix).answer} =?= 42"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/08_commands/01_modules/002.cf b/tests/acceptance/08_commands/01_modules/002.cf index 6028aa897e..8d5c7577ce 100644 --- a/tests/acceptance/08_commands/01_modules/002.cf +++ b/tests/acceptance/08_commands/01_modules/002.cf @@ -3,54 +3,55 @@ # Test setting associative array in module (Issue 714) # ####################################################### - body common control { - inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - bundle agent init { vars: - "script_name" string => "$(this.promise_filename).txt"; + "script_name" string => "$(this.promise_filename).txt"; } ####################################################### - bundle agent test { vars: !windows:: "cat_prefix" string => "cat"; + windows:: "cat_prefix" string => "cat_exe"; commands: - "$(G.cat) $(init.script_name)" - contain => in_shell, - module => "true"; + "$(G.cat) $(init.script_name)" + contain => in_shell, + module => "true"; } ####################################################### - bundle agent check { vars: - "generated_indices" slist => getindices("$(test.cat_prefix).answer"); + "generated_indices" slist => getindices("$(test.cat_prefix).answer"); classes: - - "ok" and => { strcmp("${$(test.cat_prefix).answer[42]}", "Yes"), - strcmp("${$(test.cat_prefix).answer[41]}", "No") }; + "ok" + and => { + strcmp("${$(test.cat_prefix).answer[42]}", "Yes"), + strcmp("${$(test.cat_prefix).answer[41]}", "No"), + }; reports: DEBUG:: "${$(test.cat_prefix).answer[${generated_indices}]}"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/08_commands/01_modules/003.cf b/tests/acceptance/08_commands/01_modules/003.cf index 2d7e50f9ff..859f2b973c 100644 --- a/tests/acceptance/08_commands/01_modules/003.cf +++ b/tests/acceptance/08_commands/01_modules/003.cf @@ -3,50 +3,50 @@ # Test command modules # ####################################################### - body common control { - inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "script_name" string => "$(this.promise_filename).txt"; + "script_name" string => "$(this.promise_filename).txt"; } ####################################################### - bundle agent test { vars: !windows:: "cat_prefix" string => "cat"; + windows:: "cat_prefix" string => "cat_exe"; commands: - "$(G.cat) $(init.script_name)" - contain => in_shell, - module => "true"; + "$(G.cat) $(init.script_name)" + contain => in_shell, + module => "true"; } ####################################################### - bundle agent check { classes: - "ok" expression => strcmp("$($(test.cat_prefix).myvar[dot.dash-test])", "42"); + "ok" + expression => strcmp("$($(test.cat_prefix).myvar[dot.dash-test])", "42"); reports: DEBUG:: "${$(test.cat_prefix).myvar[dot.dash-test]} =?= 42"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL "; } diff --git a/tests/acceptance/08_commands/01_modules/004.cf b/tests/acceptance/08_commands/01_modules/004.cf index 72a18a4a5b..def074decb 100644 --- a/tests/acceptance/08_commands/01_modules/004.cf +++ b/tests/acceptance/08_commands/01_modules/004.cf @@ -3,74 +3,68 @@ # Test command modules # ####################################################### - body common control { - inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "script_name" string => "$(this.promise_filename).txt"; - + "script_name" string => "$(this.promise_filename).txt"; } ####################################################### - bundle agent test { vars: !windows:: "cat_prefix" string => "cat"; + windows:: "cat_prefix" string => "cat_exe"; commands: - "$(G.cat) $(init.script_name)" - contain => in_shell, - module => "true"; + "$(G.cat) $(init.script_name)" + contain => in_shell, + module => "true"; } ####################################################### - bundle agent check { vars: - "list0" slist => {"abc", "def", "ghi"}; - "list1" slist => {"{{abc}}", " ' def}", "ghi'''"}; - "list2" slist => {'{{a,bc}}', ' " de,f}', 'gh,,i"""'}; - "list3" slist => {"{{a'bc',,}}", ' ",, d"ef}', "ghi,},'''"}; - - "actual0" string => join(":", "list0"); - "actual1" string => join(":", "list1"); - "actual2" string => join(":", "list2"); - "actual3" string => join(":", "list3"); - - "joined0" string => join(":", "$(test.cat_prefix).mylist"); - "joined1" string => join(":", "$(test.cat_prefix).myalist"); - "joined2" string => join(":", "$(test.cat_prefix).myblist"); - "joined3" string => join(":", "$(test.cat_prefix).myclist"); + "list0" slist => { "abc", "def", "ghi" }; + "list1" slist => { "{{abc}}", " ' def}", "ghi'''" }; + "list2" slist => { '{{a,bc}}', ' " de,f}', 'gh,,i"""' }; + "list3" slist => { "{{a'bc',,}}", ' ",, d"ef}', "ghi,},'''" }; + "actual0" string => join(":", "list0"); + "actual1" string => join(":", "list1"); + "actual2" string => join(":", "list2"); + "actual3" string => join(":", "list3"); + "joined0" string => join(":", "$(test.cat_prefix).mylist"); + "joined1" string => join(":", "$(test.cat_prefix).myalist"); + "joined2" string => join(":", "$(test.cat_prefix).myblist"); + "joined3" string => join(":", "$(test.cat_prefix).myclist"); classes: - any:: - "var0ok" expression => strcmp("${this.joined0}" , "${this.actual0}"); - "var1ok" expression => strcmp("${this.joined1}" , "${this.actual1}"); - "var2ok" expression => strcmp("${this.joined2}" , "${this.actual2}"); - "var3ok" expression => strcmp("${this.joined3}" , "${this.actual3}"); - + "var0ok" expression => strcmp("${this.joined0}", "${this.actual0}"); + "var1ok" expression => strcmp("${this.joined1}", "${this.actual1}"); + "var2ok" expression => strcmp("${this.joined2}", "${this.actual2}"); + "var3ok" expression => strcmp("${this.joined3}", "${this.actual3}"); "ok" and => { "var0ok", "var1ok", "var2ok", "var3ok" }; reports: !DEBUG:: "joined3 = [${this.joined3}] vs actual3 = [${this.actual3}]"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/08_commands/01_modules/classes-automatically-canonified.cf b/tests/acceptance/08_commands/01_modules/classes-automatically-canonified.cf index cfdbde8727..32450b2076 100644 --- a/tests/acceptance/08_commands/01_modules/classes-automatically-canonified.cf +++ b/tests/acceptance/08_commands/01_modules/classes-automatically-canonified.cf @@ -1,26 +1,24 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - - "description" - string => "Test that classes defined via the module protocol are + "description" + string => "Test that classes defined via the module protocol are automatically canonified."; classes: - "my-invalid-class" - expression => "any", - scope => "namespace"; + "my-invalid-class" + expression => "any", + scope => "namespace"; commands: - "$(G.echo) +invalid-class@module" - module => "true"; + "$(G.echo) +invalid-class@module" module => "true"; reports: (EXTRA|DEBUG).invalid_class_module:: @@ -35,10 +33,11 @@ bundle agent test (EXTRA|DEBUG).!my_invalid_class:: "My class was NOT automatically canonified"; } + bundle agent check { classes: - "pass" and => { "my_invalid_class", "invalid_class_module" }; + "pass" and => { "my_invalid_class", "invalid_class_module" }; reports: pass:: diff --git a/tests/acceptance/08_commands/01_modules/long-module-lines.cf b/tests/acceptance/08_commands/01_modules/long-module-lines.cf index 39784b3064..059320ebe0 100644 --- a/tests/acceptance/08_commands/01_modules/long-module-lines.cf +++ b/tests/acceptance/08_commands/01_modules/long-module-lines.cf @@ -4,107 +4,142 @@ # Redmine#4170: segfault on long lines # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "script_name" string => "$(G.cat) $(this.promise_filename).txt"; - + "script_name" string => "$(G.cat) $(this.promise_filename).txt"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-1623" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-1623" }; commands: - "$(init.script_name)" module => "true"; - + "$(init.script_name)" module => "true"; } ####################################################### - bundle agent check { vars: - "scalars" slist => { "x4095", "x4094", "x4093" }; - "lists" slist => { "zshort", "z4095" }; - - "bytes1024" string => "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"; - "bytes1000" string => "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567"; - - "expected[x4095]" string => concat($(bytes1024),$(bytes1024),$(bytes1024),$(bytes1000),"89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789x4095"); - "expected[x4094]" string => concat($(bytes1024),$(bytes1024),$(bytes1024),$(bytes1000),"89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012345678x4094"); - "expected[x4093]" string => concat($(bytes1024),$(bytes1024),$(bytes1024),$(bytes1000),"89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567x4093"); - - "longclass" string => "class678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012"; - - "expected_length[zshort]" int => "227"; - "expected_length[z4095]" int => "293"; - "actual_length[$(lists)]" int => length("cat.$(lists)"); - - "longclass_length" int => string_length($(longclass)); - "expected_length[$(scalars)]" int => string_length("$(expected[$(scalars)])"); - "actual_length[$(scalars)]" int => string_length("$(cat.$(scalars))"); - "tail[$(scalars)]" string => string_tail("$(cat.$(scalars))", 256); + "scalars" slist => { "x4095", "x4094", "x4093" }; + "lists" slist => { "zshort", "z4095" }; + + "bytes1024" + string => "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"; + + "bytes1000" + string => "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567"; + + "expected[x4095]" + string => concat( + $(bytes1024), + $(bytes1024), + $(bytes1024), + $(bytes1000), + "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789x4095" + ); + + "expected[x4094]" + string => concat( + $(bytes1024), + $(bytes1024), + $(bytes1024), + $(bytes1000), + "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012345678x4094" + ); + + "expected[x4093]" + string => concat( + $(bytes1024), + $(bytes1024), + $(bytes1024), + $(bytes1000), + "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567x4093" + ); + + "longclass" + string => "class678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012"; + + "expected_length[zshort]" int => "227"; + "expected_length[z4095]" int => "293"; + "actual_length[$(lists)]" int => length("cat.$(lists)"); + "longclass_length" int => string_length($(longclass)); + + "expected_length[$(scalars)]" + int => string_length("$(expected[$(scalars)])"); + + "actual_length[$(scalars)]" int => string_length("$(cat.$(scalars))"); + "tail[$(scalars)]" string => string_tail("$(cat.$(scalars))", 256); classes: - "match_$(scalars)" expression => strcmp("$(expected[$(scalars)])", - "$(cat.$(scalars))"); - "match_length_$(scalars)" expression => strcmp("$(expected_length[$(scalars)])", - "$(actual_length[$(scalars)])"); - - "match_length_$(lists)" expression => strcmp("$(expected_length[$(lists)])", - "$(actual_length[$(lists)])"); - "ok" and => { "$(longclass)", - "match_x4095", "match_length_x4095", - "match_x4094", "match_length_x4094", - "match_x4093", "match_length_x4093", - "match_length_zshort", "match_length_z4095", + "match_$(scalars)" + expression => strcmp("$(expected[$(scalars)])", "$(cat.$(scalars))"); + + "match_length_$(scalars)" + expression => strcmp( + "$(expected_length[$(scalars)])", "$(actual_length[$(scalars)])" + ); + + "match_length_$(lists)" + expression => strcmp( + "$(expected_length[$(lists)])", "$(actual_length[$(lists)])" + ); + + "ok" + and => { + "$(longclass)", + "match_x4095", + "match_length_x4095", + "match_x4094", + "match_length_x4094", + "match_x4093", + "match_length_x4093", + "match_length_zshort", + "match_length_z4095", }; reports: DEBUG:: "tail(256) of $(scalars) = $(tail[$(scalars)])"; - - "Got the long class, $(longclass_length) bytes" - if => "$(longclass)"; + "Got the long class, $(longclass_length) bytes" if => "$(longclass)"; "Did NOT get the long class, $(longclass_length) bytes" - if => "!$(longclass)"; + if => "!$(longclass)"; "Got the length for list $(lists): $(actual_length[$(lists)])" - if => "match_length_$(lists)"; + if => "match_length_$(lists)"; "Did NOT get the length for list $(lists): actual $(actual_length[$(lists)]) vs expected $(expected_length[$(lists)])" - if => "!match_length_$(lists)"; + if => "!match_length_$(lists)"; "Got the length for scalar $(scalars): $(actual_length[$(scalars)])" - if => "match_length_$(scalars)"; + if => "match_length_$(scalars)"; "Did NOT get the length for scalar $(scalars): actual $(actual_length[$(scalars)]) vs expected $(expected_length[$(scalars)])" - if => "!match_length_$(scalars)"; + if => "!match_length_$(scalars)"; "Got the long $(scalars), actual $(actual_length[$(scalars)]) bytes, actual tail($(scalars), 256) = $(tail[$(scalars)])" - if => "match_$(scalars)"; + if => "match_$(scalars)"; "Did NOT get the long $(scalars), actual $(actual_length[$(scalars)]) bytes, actual tail($(scalars), 256) = $(tail[$(scalars)])" - if => "!match_$(scalars)"; + if => "!match_$(scalars)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/08_commands/01_modules/module-array-allows-at.cf b/tests/acceptance/08_commands/01_modules/module-array-allows-at.cf index 322122d775..0d581b31e1 100644 --- a/tests/acceptance/08_commands/01_modules/module-array-allows-at.cf +++ b/tests/acceptance/08_commands/01_modules/module-array-allows-at.cf @@ -1,36 +1,33 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "description" -> { "CFE-3099" } - string => "Test that arrays defined by modules can contain @ just like classic arrays."; - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "description" -> { "CFE-3099" } + string => "Test that arrays defined by modules can contain @ just like classic arrays."; - commands: + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; + commands: # Define a simple classic array using the module protocol. - - "$(G.echo)" - args => "=array[key]=array_key_value", - module => "true"; + "$(G.echo)" + args => "=array[key]=array_key_value", + module => "true"; # Define a classic array where the key contains an @ using the module protocol. - - "$(G.echo)" - args => "=array[key@1]=array_path_key_value", - module => "true"; + "$(G.echo)" + args => "=array[key@1]=array_path_key_value", + module => "true"; vars: - # Define a classic array where the key contains an @. - "array[key@1]" string => "another_array_path_key_value"; #Find all the array entries defined by the module commands. @@ -38,23 +35,25 @@ bundle agent test reports: DEBUG:: - "Found variable '$(v)'"; + "Found variable '$(v)'"; } ####################################################### - bundle agent check { vars: # Construct strings from the array values for comparison and test pass/fail - "expected" string => "array_key_value array_path_key_value another_array_path_key_value"; - "actual" string => "$(echo.array[key]) $(echo.array[key@1]) $(test.array[key@1])"; + "expected" + string => "array_key_value array_path_key_value another_array_path_key_value"; + + "actual" + string => "$(echo.array[key]) $(echo.array[key@1]) $(test.array[key@1])"; methods: - "" usebundle => dcs_check_strcmp($(expected), - $(actual), - $(this.promise_filename), - "no"); + "" + usebundle => dcs_check_strcmp( + $(expected), $(actual), $(this.promise_filename), "no" + ); reports: DEBUG:: diff --git a/tests/acceptance/08_commands/01_modules/module-array-allows-slash.cf b/tests/acceptance/08_commands/01_modules/module-array-allows-slash.cf index f561d2d12e..8f88890ded 100644 --- a/tests/acceptance/08_commands/01_modules/module-array-allows-slash.cf +++ b/tests/acceptance/08_commands/01_modules/module-array-allows-slash.cf @@ -1,36 +1,33 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "description" -> { "CFE-2768" } - string => "Test that arrays defined by modules can contain slashes just like classic arrays."; - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "description" -> { "CFE-2768" } + string => "Test that arrays defined by modules can contain slashes just like classic arrays."; - commands: + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; + commands: # Define a simple classic array using the module protocol. - - "$(G.echo)" - args => "=array[key]=array_key_value", - module => "true"; + "$(G.echo)" + args => "=array[key]=array_key_value", + module => "true"; # Define a classic array where the key contains a backslash using the module protocol. - - "$(G.echo)" - args => "=array[/path/key]=array_path_key_value", - module => "true"; + "$(G.echo)" + args => "=array[/path/key]=array_path_key_value", + module => "true"; vars: - # Define a classic array where the key contains a backslash. - "array[/path/key]" string => "another_array_path_key_value"; #Find all the array entries defined by the module commands. @@ -38,23 +35,25 @@ bundle agent test reports: DEBUG:: - "Found variable '$(v)'"; + "Found variable '$(v)'"; } ####################################################### - bundle agent check { vars: # Construct strings from the array values for comparison and test pass/fail - "expected" string => "array_key_value array_path_key_value another_array_path_key_value"; - "actual" string => "$(echo.array[key]) $(echo.array[/path/key]) $(test.array[/path/key])"; + "expected" + string => "array_key_value array_path_key_value another_array_path_key_value"; + + "actual" + string => "$(echo.array[key]) $(echo.array[/path/key]) $(test.array[/path/key])"; methods: - "" usebundle => dcs_check_strcmp($(expected), - $(actual), - $(this.promise_filename), - "no"); + "" + usebundle => dcs_check_strcmp( + $(expected), $(actual), $(this.promise_filename), "no" + ); reports: DEBUG:: diff --git a/tests/acceptance/08_commands/01_modules/module-array-indexing.cf b/tests/acceptance/08_commands/01_modules/module-array-indexing.cf index 5402c0b0f5..c48a1643a5 100644 --- a/tests/acceptance/08_commands/01_modules/module-array-indexing.cf +++ b/tests/acceptance/08_commands/01_modules/module-array-indexing.cf @@ -4,18 +4,17 @@ # Test command modules with given array indices # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { commands: - "$(G.cat) $(this.promise_filename).txt" module => "true"; + "$(G.cat) $(this.promise_filename).txt" module => "true"; reports: EXTRA:: @@ -24,22 +23,29 @@ bundle agent test } ####################################################### - bundle agent check { vars: - "foo_$(arrays.foo_idx)" string => "$(arrays.foo[$(arrays.foo_idx)])"; - "merged_foo" data => mergedata("arrays.foo"); - "sfoo" string => "foo_a=$(foo_a), foo_b=$(foo_b)"; - "actual" string => format("foo = %S, foo_idx = %S, sfoo = %s", merged_foo, "arrays.foo_idx", $(sfoo)); - "expected" string => 'foo = {"a":"a_foo","b":"b_foo"}, foo_idx = { "a", "b" }, sfoo = foo_a=a_foo, foo_b=b_foo'; + "foo_$(arrays.foo_idx)" string => "$(arrays.foo[$(arrays.foo_idx)])"; + "merged_foo" data => mergedata("arrays.foo"); + "sfoo" string => "foo_a=$(foo_a), foo_b=$(foo_b)"; - methods: - "" usebundle => dcs_check_strcmp($(expected), - $(actual), - $(this.promise_filename), - "no"); + "actual" + string => format( + "foo = %S, foo_idx = %S, sfoo = %s", + merged_foo, + "arrays.foo_idx", + $(sfoo) + ); + "expected" + string => 'foo = {"a":"a_foo","b":"b_foo"}, foo_idx = { "a", "b" }, sfoo = foo_a=a_foo, foo_b=b_foo'; + + methods: + "" + usebundle => dcs_check_strcmp( + $(expected), $(actual), $(this.promise_filename), "no" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/08_commands/01_modules/module_allows_empty_lists.cf b/tests/acceptance/08_commands/01_modules/module_allows_empty_lists.cf index 4bf8b64b85..9854d148a2 100644 --- a/tests/acceptance/08_commands/01_modules/module_allows_empty_lists.cf +++ b/tests/acceptance/08_commands/01_modules/module_allows_empty_lists.cf @@ -3,36 +3,33 @@ # Test that modules are allowed to emit empty lists # Redmine: 7577 ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "any", - meta => { "redmine7577" }; + "test_soft_fail" + string => "any", + meta => { "redmine7577" }; commands: - "$(G.cat)" - args => "$(this.promise_filename).txt", - module => "true", - comment => "Module output found in this file"; + "$(G.cat)" + args => "$(this.promise_filename).txt", + module => "true", + comment => "Module output found in this file"; } ####################################################### - bundle agent check { vars: - "length_of_list_from_module" - int => length("default:cat.list_from_module"); + "length_of_list_from_module" int => length("default:cat.list_from_module"); classes: "have_list_from_module" @@ -40,7 +37,7 @@ bundle agent check comment => "Modules should be able to define empty/null lists."; "list_from_module_length_0" - expression => strcmp( 0, $(length_of_list_from_module) ); + expression => strcmp(0, $(length_of_list_from_module)); "ok" and => { "have_list_from_module", "list_from_module_length_0" }, @@ -48,24 +45,23 @@ bundle agent check reports: DEBUG|DEBUG_check:: - "DEBUG $(this.bundle): Module defined 'default:cat.list_from_module'" - if => "have_list_from_module"; + "DEBUG $(this.bundle): Module defined 'default:cat.list_from_module'" + if => "have_list_from_module"; - "DEBUG $(this.bundle): Module did not define the expected list 'default:cat.list_from_module'" - unless => "have_list_from_module"; + "DEBUG $(this.bundle): Module did not define the expected list 'default:cat.list_from_module'" + unless => "have_list_from_module"; + "DEBUG $(this.bundle): The list defined from the module had the expected length of 0" + if => "list_from_module_length_0"; - "DEBUG $(this.bundle): The list defined from the module had the expected length of 0" - if => "list_from_module_length_0"; + "DEBUG $(this.bundle): The the list defined from the module did not have the expected length or was undefined" + unless => "list_from_module_length_0"; - "DEBUG $(this.bundle): The the list defined from the module did not have the expected length or was undefined" - unless => "list_from_module_length_0"; - - - "DEBUG $(this.bundle): length of list from module '$(length_of_list_from_module)'"; + "DEBUG $(this.bundle): length of list from module '$(length_of_list_from_module)'"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/08_commands/01_modules/module_allows_trailing_comma.cf b/tests/acceptance/08_commands/01_modules/module_allows_trailing_comma.cf index 26e70d648d..4e294a877e 100644 --- a/tests/acceptance/08_commands/01_modules/module_allows_trailing_comma.cf +++ b/tests/acceptance/08_commands/01_modules/module_allows_trailing_comma.cf @@ -3,35 +3,32 @@ # Test that modules are allowed to define lists with trailing commas # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "any", - meta => { "redmine7578" }; + "test_soft_fail" + string => "any", + meta => { "redmine7578" }; commands: - "$(G.cat)" - args => "$(this.promise_filename).txt", - module => "true"; + "$(G.cat)" + args => "$(this.promise_filename).txt", + module => "true"; } ####################################################### - bundle agent check { vars: - "length_of_list_from_module" - int => length("default:cat.list_from_module"); + "length_of_list_from_module" int => length("default:cat.list_from_module"); classes: "have_list_from_module" @@ -48,19 +45,19 @@ bundle agent check reports: DEBUG|DEBUG_check:: - "DEBUG $(this.bundle): Module defined 'default:cat.list_from_module'" - if => "have_list_from_module"; + "DEBUG $(this.bundle): Module defined 'default:cat.list_from_module'" + if => "have_list_from_module"; - "DEBUG $(this.bundle): The list defined from the module had the expected length of 0" - if => "list_from_module_length_1"; + "DEBUG $(this.bundle): The list defined from the module had the expected length of 0" + if => "list_from_module_length_1"; - "DEBUG $(this.bundle): length of list from module '$(length_of_list_from_module)'"; + "DEBUG $(this.bundle): length of list from module '$(length_of_list_from_module)'"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; - } ### PROJECT_ID: core diff --git a/tests/acceptance/08_commands/01_modules/module_file_test.cf b/tests/acceptance/08_commands/01_modules/module_file_test.cf index c001a6e8e4..3834bb4017 100644 --- a/tests/acceptance/08_commands/01_modules/module_file_test.cf +++ b/tests/acceptance/08_commands/01_modules/module_file_test.cf @@ -1,8 +1,8 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -10,29 +10,28 @@ bundle agent init files: any:: "$(G.testfile).json" - create => "true", - edit_line => init_insert_json; + create => "true", + edit_line => init_insert_json; } bundle edit_line init_insert_json { insert_lines: - '{ "hello": "world" }'; + '{ "hello": "world" }'; } - bundle agent test { meta: - "description" - string => "Test module file protocol"; - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "description" string => "Test module file protocol"; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; commands: any:: - "$(G.echo) &data=$(G.testfile).json" - module => "true"; + "$(G.echo) &data=$(G.testfile).json" module => "true"; reports: DEBUG:: @@ -42,7 +41,7 @@ bundle agent test bundle agent check { classes: - "pass" expression => strcmp("$(echo.data[hello])", "world"); + "pass" expression => strcmp("$(echo.data[hello])", "world"); reports: pass:: diff --git a/tests/acceptance/08_commands/01_modules/module_with_no_output.cf b/tests/acceptance/08_commands/01_modules/module_with_no_output.cf index 456b52f144..25b2d72f70 100644 --- a/tests/acceptance/08_commands/01_modules/module_with_no_output.cf +++ b/tests/acceptance/08_commands/01_modules/module_with_no_output.cf @@ -1,36 +1,51 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; } bundle agent init { methods: - "init" usebundle => file_make("$(G.testdir)/module.output.txt", - "=myvar=good_output_1"); + "init" + usebundle => file_make( + "$(G.testdir)/module.output.txt", "=myvar=good_output_1" + ); - "init" usebundle => file_make("$(G.testdir)/module.no_output.txt", - "=myvar=bad_output"); + "init" + usebundle => file_make( + "$(G.testdir)/module.no_output.txt", "=myvar=bad_output" + ); - "init" usebundle => file_make("$(G.testdir)/module.default.txt", - "=myvar=bad_output"); + "init" + usebundle => file_make( + "$(G.testdir)/module.default.txt", "=myvar=bad_output" + ); - "init" usebundle => file_make("$(G.testdir)/no_module.output.txt", - "=myvar=good_output_2"); + "init" + usebundle => file_make( + "$(G.testdir)/no_module.output.txt", "=myvar=good_output_2" + ); - "init" usebundle => file_make("$(G.testdir)/no_module.no_output.txt", - "=myvar=bad_output"); + "init" + usebundle => file_make( + "$(G.testdir)/no_module.no_output.txt", "=myvar=bad_output" + ); - "init" usebundle => file_make("$(G.testdir)/no_module.default.txt", - "=myvar=good_output_3"); + "init" + usebundle => file_make( + "$(G.testdir)/no_module.default.txt", "=myvar=good_output_3" + ); } bundle agent check { methods: - "check" usebundle => dcs_passif_output(".*good_output_1.*good_output_2.*good_output_3.*", - ".*bad_output.*", - "$(sys.cf_agent) -D AUTO -Kf $(this.promise_filename).sub", - $(this.promise_filename)); + "check" + usebundle => dcs_passif_output( + ".*good_output_1.*good_output_2.*good_output_3.*", + ".*bad_output.*", + "$(sys.cf_agent) -D AUTO -Kf $(this.promise_filename).sub", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/08_commands/01_modules/set-context.cf b/tests/acceptance/08_commands/01_modules/set-context.cf index 41d3485099..e2ae3b95f4 100644 --- a/tests/acceptance/08_commands/01_modules/set-context.cf +++ b/tests/acceptance/08_commands/01_modules/set-context.cf @@ -4,104 +4,113 @@ # Redmine#3991: support data containers # ####################################################### - body common control { - inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "script_name" string => "$(this.promise_filename).txt"; - + "script_name" string => "$(this.promise_filename).txt"; } ####################################################### - bundle agent test { commands: - "$(G.cat) $(init.script_name)" - contain => in_shell, - module => "true"; + "$(G.cat) $(init.script_name)" + contain => in_shell, + module => "true"; } ####################################################### - bundle agent check { vars: - "list0" slist => {"abc", "def", "ghi"}; - "list1" slist => {"{{abc}}", " ' def}", "ghi'''"}; - "list2" slist => {'{{a,bc}}', ' " de,f}', 'gh,,i"""'}; - "list3" slist => {"{{a'bc',,}}", ' ",, d"ef}', "ghi,},'''"}; - - "actual0" string => join(":", "list0"); - "actual1" string => join(":", "list1"); - "actual2" string => join(":", "list2"); - "actual3" string => join(":", "list3"); - - "joined0" string => join(":", "xyz_123___456.mylist"); - "joined1" string => join(":", "xyz_123___456.myalist"); - "joined2" string => join(":", "xyz_123___456.myblist"); - "joined3" string => join(":", "xyz_123___456.myclist"); - - "c" slist => { "1", "2", "3", "4", "5", "6" }; - "c$(c)" string => format("%S", "xyz_123___456.mycontainer$(c)"); - - "e1" string => '{"x":[456,789]}'; - "e5" string => '["read","some","strings"]'; - "e6" string => '{"mix":["match"],"nothing":null,"paddle":true,"ping":"pong"}'; - - "hello_contexts" slist => { "xyz_123___456", "_456", "456", "_", "a__456__", "__a__", }; + "list0" slist => { "abc", "def", "ghi" }; + "list1" slist => { "{{abc}}", " ' def}", "ghi'''" }; + "list2" slist => { '{{a,bc}}', ' " de,f}', 'gh,,i"""' }; + "list3" slist => { "{{a'bc',,}}", ' ",, d"ef}', "ghi,},'''" }; + "actual0" string => join(":", "list0"); + "actual1" string => join(":", "list1"); + "actual2" string => join(":", "list2"); + "actual3" string => join(":", "list3"); + "joined0" string => join(":", "xyz_123___456.mylist"); + "joined1" string => join(":", "xyz_123___456.myalist"); + "joined2" string => join(":", "xyz_123___456.myblist"); + "joined3" string => join(":", "xyz_123___456.myclist"); + "c" slist => { "1", "2", "3", "4", "5", "6" }; + "c$(c)" string => format("%S", "xyz_123___456.mycontainer$(c)"); + "e1" string => '{"x":[456,789]}'; + "e5" string => '["read","some","strings"]'; + + "e6" + string => '{"mix":["match"],"nothing":null,"paddle":true,"ping":"pong"}'; + + "hello_contexts" + slist => { "xyz_123___456", "_456", "456", "_", "a__456__", "__a__" }; classes: - any:: - "var0ok" expression => strcmp("${this.joined0}" , "${this.actual0}"); - "var1ok" expression => strcmp("${this.joined1}" , "${this.actual1}"); - "var2ok" expression => strcmp("${this.joined2}" , "${this.actual2}"); - "var3ok" expression => strcmp("${this.joined3}" , "${this.actual3}"); - "var4ok" expression => strcmp("hello there" , "${xyz_123___456.myvar}"); + "var0ok" expression => strcmp("${this.joined0}", "${this.actual0}"); + "var1ok" expression => strcmp("${this.joined1}", "${this.actual1}"); + "var2ok" expression => strcmp("${this.joined2}", "${this.actual2}"); + "var3ok" expression => strcmp("${this.joined3}", "${this.actual3}"); + "var4ok" expression => strcmp("hello there", "${xyz_123___456.myvar}"); - "hello_$(hello_contexts)_ok" expression => strcmp("hello there" , "${$(hello_contexts).myvar}"); + "hello_$(hello_contexts)_ok" + expression => strcmp("hello there", "${$(hello_contexts).myvar}"); - "ok_c1" expression => strcmp($(e1) , $(c1)); + "ok_c1" expression => strcmp($(e1), $(c1)); "ok_c2" not => isvariable("c2"); "ok_c3" not => isvariable("c3"); "ok_c4" not => isvariable("c4"); - "ok_c5" expression => strcmp($(e5) , $(c5)); - "ok_c6" expression => strcmp($(e6) , $(c6)); + "ok_c5" expression => strcmp($(e5), $(c5)); + "ok_c6" expression => strcmp($(e6), $(c6)); "ok_injected_var" -> { "CFE-1915" } expression => strcmp($(test.myvar), "hello there"), comment => "This remote variable injection should work, BUT IS A DIRTY HACK!"; - "ok" and => { "myclass", "var0ok", "var1ok", "var2ok", "var3ok", "var4ok", - "hello_xyz_123___456_ok", "hello__456_ok", "hello_456_ok", "hello___ok", "hello_a__456___ok", "hello___a___ok", - "ok_c1", "ok_c2", "ok_c3", "ok_c4", "ok_c5", "ok_c6", - "ok_injected_var" }; + "ok" + and => { + "myclass", + "var0ok", + "var1ok", + "var2ok", + "var3ok", + "var4ok", + "hello_xyz_123___456_ok", + "hello__456_ok", + "hello_456_ok", + "hello___ok", + "hello_a__456___ok", + "hello___a___ok", + "ok_c1", + "ok_c2", + "ok_c3", + "ok_c4", + "ok_c5", + "ok_c6", + "ok_injected_var", + }; reports: DEBUG:: - "container $(c): $(e$(c)) != $(c$(c))" - if => "!ok_c$(c)"; - + "container $(c): $(e$(c)) != $(c$(c))" if => "!ok_c$(c)"; "context $(hello_contexts) failed" if => "!hello_$(hello_contexts)_ok"; - - "test.myvar = $(test.myvar)" - if => "!ok_injected_var"; + "test.myvar = $(test.myvar)" if => "!ok_injected_var"; EXTRA:: "context $(hello_contexts) worked" if => "hello_$(hello_contexts)_ok"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/08_commands/01_modules/set-persistent-class.cf b/tests/acceptance/08_commands/01_modules/set-persistent-class.cf index ba008cd556..237e5e6f20 100644 --- a/tests/acceptance/08_commands/01_modules/set-persistent-class.cf +++ b/tests/acceptance/08_commands/01_modules/set-persistent-class.cf @@ -4,35 +4,40 @@ # Redmine#7302: support persistent classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { - meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + meta: + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; } bundle agent check { vars: - "command" string => "($(sys.cf_agent) -Kvf $(this.promise_filename).sub; $(sys.cf_promises) -v)| $(G.grep) 'x4eXfWrHT0zsSbrAXh5jFnRnDLKqNsP'"; + "command" + string => "($(sys.cf_agent) -Kvf $(this.promise_filename).sub; $(sys.cf_promises) -v)| $(G.grep) 'x4eXfWrHT0zsSbrAXh5jFnRnDLKqNsP'"; methods: - # sample output - - # verbose: Module set persistent class 'Cx4eXfWrHT0zsSbrAXh5jFnRnDLKqNsP' for 20 minutes - # verbose: Adding persistent class 'Cx4eXfWrHT0zsSbrAXh5jFnRnDLKqNsP' to heap - - # note we check that Ax4eXfWrHT0zsSbrAXh5jFnRnDLKqNsP and Bx4eXfWrHT0zsSbrAXh5jFnRnDLKqNsP are not set persistently! - "check" usebundle => dcs_passif_output(".*Module set persistent class 'Cx4eXfWrHT0zsSbrAXh5jFnRnDLKqNsP' for 20 minutes.*", ".*Module set persistent class '[AB]x4eXfWrHT0zsSbrAXh5jFnRnDLKqNsP'.*", $(command), $(this.promise_filename)); - + # sample output + # verbose: Module set persistent class 'Cx4eXfWrHT0zsSbrAXh5jFnRnDLKqNsP' for 20 minutes + # verbose: Adding persistent class 'Cx4eXfWrHT0zsSbrAXh5jFnRnDLKqNsP' to heap + # note we check that Ax4eXfWrHT0zsSbrAXh5jFnRnDLKqNsP and Bx4eXfWrHT0zsSbrAXh5jFnRnDLKqNsP are not set persistently! + "check" + usebundle => dcs_passif_output( + ".*Module set persistent class 'Cx4eXfWrHT0zsSbrAXh5jFnRnDLKqNsP' for 20 minutes.*", + ".*Module set persistent class '[AB]x4eXfWrHT0zsSbrAXh5jFnRnDLKqNsP'.*", + $(command), + $(this.promise_filename) + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/08_commands/01_modules/set-tags.cf b/tests/acceptance/08_commands/01_modules/set-tags.cf index 321728d498..ed48f66055 100644 --- a/tests/acceptance/08_commands/01_modules/set-tags.cf +++ b/tests/acceptance/08_commands/01_modules/set-tags.cf @@ -3,99 +3,102 @@ # Test the ^meta module protocol extension # ####################################################### - body common control { - inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle common init { vars: - "script_name" string => "$(this.promise_filename).txt"; - + "script_name" string => "$(this.promise_filename).txt"; } ####################################################### - bundle agent test { meta: - "test_flakey_fail" string => "windows", - meta => { "ENT-10257" }; + "test_flakey_fail" + string => "windows", + meta => { "ENT-10257" }; + commands: - "$(G.cat) $(init.script_name)" - contain => in_shell, - module => "true"; + "$(G.cat) $(init.script_name)" + contain => in_shell, + module => "true"; } ####################################################### - bundle agent check { vars: - "xyzvars" slist => variablesmatching("default:xyz.*"); - - "list0" slist => {"abc", "def", "ghi"}; - "list1" slist => {"{{abc}}", " ' def}", "ghi'''"}; - "list2" slist => {'{{a,bc}}', ' " de,f}', 'gh,,i"""'}; - "list3" slist => {"{{a'bc',,}}", ' ",, d"ef}', "ghi,},'''"}; - - "actual0" string => join(":", "list0"); - "actual1" string => join(":", "list1"); - "actual2" string => join(":", "list2"); - "actual3" string => join(":", "list3"); - - "joined0" string => join(":", "xyz.mylist"); - "joined1" string => join(":", "xyz.myalist"); - "joined2" string => join(":", "xyz.myblist"); - "joined3" string => join(":", "xyz.myclist"); - - "tags0" slist => getvariablemetatags("xyz.mylist"); - "tags1" slist => getvariablemetatags("xyz.myalist"); - "tags2" slist => getvariablemetatags("xyz.myblist"); - "tags3" slist => getclassmetatags("mycclass"); - - "jtags0" string => join(",", "tags0"); - "jtags1" string => join(",", "tags1"); - "jtags2" string => join(",", "tags2"); - "jtags3" string => join(",", "tags3"); - - "etags0" string => "xyz,abc=def,,\?\?what is this\?\?,source=module,derived_from=.*"; - "etags1" string => "xyz,abc=def,,\?\?what is this\?\?,source=module,derived_from=.*"; - "etags2" string => "1,2,3,source=module,derived_from=.*"; - "etags3" string => "a,b,c,source=module,derived_from=.*"; + "xyzvars" slist => variablesmatching("default:xyz.*"); + "list0" slist => { "abc", "def", "ghi" }; + "list1" slist => { "{{abc}}", " ' def}", "ghi'''" }; + "list2" slist => { '{{a,bc}}', ' " de,f}', 'gh,,i"""' }; + "list3" slist => { "{{a'bc',,}}", ' ",, d"ef}', "ghi,},'''" }; + "actual0" string => join(":", "list0"); + "actual1" string => join(":", "list1"); + "actual2" string => join(":", "list2"); + "actual3" string => join(":", "list3"); + "joined0" string => join(":", "xyz.mylist"); + "joined1" string => join(":", "xyz.myalist"); + "joined2" string => join(":", "xyz.myblist"); + "joined3" string => join(":", "xyz.myclist"); + "tags0" slist => getvariablemetatags("xyz.mylist"); + "tags1" slist => getvariablemetatags("xyz.myalist"); + "tags2" slist => getvariablemetatags("xyz.myblist"); + "tags3" slist => getclassmetatags("mycclass"); + "jtags0" string => join(",", "tags0"); + "jtags1" string => join(",", "tags1"); + "jtags2" string => join(",", "tags2"); + "jtags3" string => join(",", "tags3"); + + "etags0" + string => "xyz,abc=def,,\?\?what is this\?\?,source=module,derived_from=.*"; + + "etags1" + string => "xyz,abc=def,,\?\?what is this\?\?,source=module,derived_from=.*"; + + "etags2" string => "1,2,3,source=module,derived_from=.*"; + "etags3" string => "a,b,c,source=module,derived_from=.*"; classes: - any:: - "var0ok" expression => strcmp("${this.joined0}" , "${this.actual0}"); - "var1ok" expression => strcmp("${this.joined1}" , "${this.actual1}"); - "var2ok" expression => strcmp("${this.joined2}" , "${this.actual2}"); - "var3ok" expression => strcmp("${this.joined3}" , "${this.actual3}"); - "var4ok" expression => strcmp("hello there" , "${xyz.myvar}"); - + "var0ok" expression => strcmp("${this.joined0}", "${this.actual0}"); + "var1ok" expression => strcmp("${this.joined1}", "${this.actual1}"); + "var2ok" expression => strcmp("${this.joined2}", "${this.actual2}"); + "var3ok" expression => strcmp("${this.joined3}", "${this.actual3}"); + "var4ok" expression => strcmp("hello there", "${xyz.myvar}"); "tags0ok" expression => regcmp($(etags0), $(jtags0)); "tags1ok" expression => regcmp($(etags1), $(jtags1)); "tags2ok" expression => regcmp($(etags2), $(jtags2)); "tags3ok" expression => regcmp($(etags3), $(jtags3)); - "ok" and => { "myclass", "var0ok", "var1ok", "var2ok", "var3ok", "var4ok", - "tags0ok", "tags1ok", "tags2ok", "tags3ok", }; + "ok" + and => { + "myclass", + "var0ok", + "var1ok", + "var2ok", + "var3ok", + "var4ok", + "tags0ok", + "tags1ok", + "tags2ok", + "tags3ok", + }; reports: DEBUG:: "xyzvars = $(xyzvars)"; - "tags0ok => regcmp('$(etags0)', '$(jtags0)')" if => "tags0ok"; "tags1ok => regcmp('$(etags1)', '$(jtags1)')" if => "tags1ok"; "tags2ok => regcmp('$(etags2)', '$(jtags2)')" if => "tags2ok"; "tags3ok => regcmp('$(etags3)', '$(jtags3)')" if => "tags3ok"; - "tags0 NOT ok => regcmp('$(etags0)', '$(jtags0)')" if => "!tags0ok"; "tags1 NOT ok => regcmp('$(etags1)', '$(jtags1)')" if => "!tags1ok"; "tags2 NOT ok => regcmp('$(etags2)', '$(jtags2)')" if => "!tags2ok"; @@ -103,6 +106,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/08_commands/01_modules/vars-from-module-have-source-and-derived_from-tags.cf b/tests/acceptance/08_commands/01_modules/vars-from-module-have-source-and-derived_from-tags.cf index c0fdf6750a..ef1312bebd 100644 --- a/tests/acceptance/08_commands/01_modules/vars-from-module-have-source-and-derived_from-tags.cf +++ b/tests/acceptance/08_commands/01_modules/vars-from-module-have-source-and-derived_from-tags.cf @@ -1,46 +1,46 @@ body common control { - inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "description" -> { "ENT-7725" } - string => "Test that vars defined by modules without explicit tags still have automatic tags identifying the source"; + "description" -> { "ENT-7725" } + string => "Test that vars defined by modules without explicit tags still have automatic tags identifying the source"; - "test_soft_fail" - string => "windows", - meta => { "ENT-10217" }, - comment => "The subtest policy uses /bin/echo"; + "test_soft_fail" + string => "windows", + meta => { "ENT-10217" }, + comment => "The subtest policy uses /bin/echo"; commands: - "/bin/echo" - args => "=my_var_from_module= my val from module", - module => "true"; + "/bin/echo" + args => "=my_var_from_module= my val from module", + module => "true"; } bundle agent check { vars: - "my_var_from_module_tags" - slist => getvariablemetatags( "echo.my_var_from_module" ); + "my_var_from_module_tags" + slist => getvariablemetatags("echo.my_var_from_module"); reports: + # Every variable should have a source=SOMETHING tag + "$(this.promise_filename) Pass" + if => and( + reglist(@(my_var_from_module_tags), "source=.*"), + reglist(@(my_var_from_module_tags), "derived_from=.*") + ); - # Every variable should have a source=SOMETHING tag - "$(this.promise_filename) Pass" - if => and( - reglist( @(my_var_from_module_tags), "source=.*" ), - reglist( @(my_var_from_module_tags), "derived_from=.*" ) - ); - "$(this.promise_filename) FAIL" - unless => and( - reglist( @(my_var_from_module_tags), "source=.*" ), - reglist( @(my_var_from_module_tags), "derived_from=.*" ) - ); + "$(this.promise_filename) FAIL" + unless => and( + reglist(@(my_var_from_module_tags), "source=.*"), + reglist(@(my_var_from_module_tags), "derived_from=.*") + ); EXTRA|DEBUG:: "my_var_from_module_tags == $(my_var_from_module_tags)"; diff --git a/tests/acceptance/08_commands/01_modules/vars-without-explicit-tags-do-not-segfault.cf b/tests/acceptance/08_commands/01_modules/vars-without-explicit-tags-do-not-segfault.cf index 81addecc20..ec6206252c 100644 --- a/tests/acceptance/08_commands/01_modules/vars-without-explicit-tags-do-not-segfault.cf +++ b/tests/acceptance/08_commands/01_modules/vars-without-explicit-tags-do-not-segfault.cf @@ -1,33 +1,35 @@ body common control { - inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "description" -> { "ENT-7724", "ENT-7678" } - string => "Test that vars defined by modules without explicit tags does not crash the agent when there are vars defined by the module protocol that do not have explicit tags defined."; + "description" -> { "ENT-7724", "ENT-7678" } + string => "Test that vars defined by modules without explicit tags does not crash the agent when there are vars defined by the module protocol that do not have explicit tags defined."; - "test_skip_unsupported" - string => "windows", - comment => "The subtest policy uses /bin/echo"; + "test_skip_unsupported" + string => "windows", + comment => "The subtest policy uses /bin/echo"; commands: - "$(sys.cf_agent) -Kvf $(this.promise_filename).sub" - classes => results( "namespace", "sub_agent"); - + "$(sys.cf_agent) -Kvf $(this.promise_filename).sub" + classes => results("namespace", "sub_agent"); } + bundle agent check { methods: - "Pass/Fail" - usebundle => dcs_passif_expected( "sub_agent_repaired", "sub_agent_not_kept", - "$(this.promise_filename)"); + "Pass/Fail" + usebundle => dcs_passif_expected( + "sub_agent_repaired", "sub_agent_not_kept", "$(this.promise_filename)" + ); reports: - EXTRA|DEBUG:: - "sub_agent_.* classes: $(with)" with => join( ",", classesmatching( "sub_agent_.*" )); + EXTRA|DEBUG:: + "sub_agent_.* classes: $(with)" + with => join(",", classesmatching("sub_agent_.*")); } diff --git a/tests/acceptance/08_commands/02_syntax/arglist.cf b/tests/acceptance/08_commands/02_syntax/arglist.cf index caec4c2634..e074b7400c 100644 --- a/tests/acceptance/08_commands/02_syntax/arglist.cf +++ b/tests/acceptance/08_commands/02_syntax/arglist.cf @@ -3,33 +3,41 @@ # Test that arglist works properly # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; + commands: - "$(G.echo)" arglist => { "=abc=2'3\"4" }, module => "true"; - # this will generate the command `echo =def=567 =ghi=8'9"a` - "$(G.echo)" args => "=def=567", arglist => { "=ghi=8'9\"a" }, module => "true"; + "$(G.echo)" + arglist => { "=abc=2'3\"4" }, + module => "true"; + + # this will generate the command `echo =def=567 =ghi=8'9"a` + "$(G.echo)" + args => "=def=567", + arglist => { "=ghi=8'9\"a" }, + module => "true"; } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(echo, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + echo, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/08_commands/02_syntax/staging/001.cf b/tests/acceptance/08_commands/02_syntax/staging/001.cf index d86978c00e..1776a822e2 100644 --- a/tests/acceptance/08_commands/02_syntax/staging/001.cf +++ b/tests/acceptance/08_commands/02_syntax/staging/001.cf @@ -3,20 +3,18 @@ # Test that backslashes are correctly passed to commands (Issue 471) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_defaults => empty, edit_line => setup_lines; @@ -24,38 +22,46 @@ bundle agent init body edit_defaults empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle edit_line setup_lines { insert_lines: - "a test"; - "a.test"; - "nottest"; + "a test"; + "a.test"; + "nottest"; } ####################################################### - bundle agent test { vars: - "all_lines" string => execresult("$(G.egrep) -c '.' $(G.testfile)", "useshell"); - "re_lines" string => execresult("$(G.egrep) -c 'a.test' $(G.testfile)", "useshell"); - "lit_lines" string => execresult("$(G.egrep) -c 'a\.test' $(G.testfile)", "useshell"); - "doubleslash_lit_lines" string => execresult("$(G.egrep) -c 'a\\.test' $(G.testfile)", "useshell"); + "all_lines" + string => execresult("$(G.egrep) -c '.' $(G.testfile)", "useshell"); + + "re_lines" + string => execresult("$(G.egrep) -c 'a.test' $(G.testfile)", "useshell"); + + "lit_lines" + string => execresult("$(G.egrep) -c 'a\.test' $(G.testfile)", "useshell"); + + "doubleslash_lit_lines" + string => execresult( + "$(G.egrep) -c 'a\\.test' $(G.testfile)", "useshell" + ); } ####################################################### - bundle agent check { classes: - "ok" and => { - strcmp("$(test.all_lines)", "3"), - strcmp("$(test.re_lines)", "2"), - strcmp("$(test.lit_lines)", "1"), - strcmp("$(test.doubleslash_lit_lines)", "1") + "ok" + and => { + strcmp("$(test.all_lines)", "3"), + strcmp("$(test.re_lines)", "2"), + strcmp("$(test.lit_lines)", "1"), + strcmp("$(test.doubleslash_lit_lines)", "1"), }; reports: @@ -64,8 +70,10 @@ bundle agent check "re_lines: $(test.re_lines) =?= 2"; "lit_lines: $(test.lit_lines) =?= 1"; "doubleslash_lit_lines: $(test.doubleslash_lit_lines) =?= 1"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/08_commands/03_shells/shelltypes.cf b/tests/acceptance/08_commands/03_shells/shelltypes.cf index d3368b5c62..9efa57f079 100644 --- a/tests/acceptance/08_commands/03_shells/shelltypes.cf +++ b/tests/acceptance/08_commands/03_shells/shelltypes.cf @@ -3,44 +3,52 @@ # Test command useshell parameters # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "origtestdir" string => dirname("$(this.promise_filename)"); + "origtestdir" string => dirname("$(this.promise_filename)"); - "shelltypes" slist => { "useshell_true", - "useshell_false", - "useshell_yes", - "useshell_no", - "useshell_on", - "useshell_off", - "useshell_noshell", - "useshell_useshell", - "useshell_powershell" + "shelltypes" + slist => { + "useshell_true", + "useshell_false", + "useshell_yes", + "useshell_no", + "useshell_on", + "useshell_off", + "useshell_noshell", + "useshell_useshell", + "useshell_powershell", }; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; + classes: - "$(init.shelltypes)" expression => regcmp(".*(Succeeded|Powershell is only supported on Windows).*", execresult("$(sys.cf_agent) -D $(init.shelltypes) -Kf $(init.origtestdir)$(const.dirsep)tryshell.cf.sub", "noshell")); + "$(init.shelltypes)" + expression => regcmp( + ".*(Succeeded|Powershell is only supported on Windows).*", + execresult( + "$(sys.cf_agent) -D $(init.shelltypes) -Kf $(init.origtestdir)$(const.dirsep)tryshell.cf.sub", + "noshell" + ) + ); - "ok" and => { "@(init.shelltypes)" }; + "ok" and => { "@(init.shelltypes)" }; vars: ok:: @@ -48,22 +56,22 @@ bundle agent test reports: DEBUG:: - "$(init.shelltypes) test failed" - if => "!$(init.shelltypes)"; + "$(init.shelltypes) test failed" if => "!$(init.shelltypes)"; } ####################################################### - bundle agent check { classes: - "ok" expression => strcmp("$(test.ok)", "ok"); + "ok" expression => strcmp("$(test.ok)", "ok"); reports: DEBUG:: "Tests powershell in commands promises."; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL "; } diff --git a/tests/acceptance/08_commands/arglist.cf b/tests/acceptance/08_commands/arglist.cf index c1de8e7a7b..c86411e717 100644 --- a/tests/acceptance/08_commands/arglist.cf +++ b/tests/acceptance/08_commands/arglist.cf @@ -3,21 +3,19 @@ # CFE-2724: Test that arglist attribute preserves white-spaces # ############################################################################## - body common control { inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } ############################################################################## - bundle agent init { files: - "$(G.testfile).actual" - delete => tidy; + "$(G.testfile).actual" delete => tidy; + "$(G.testfile).sh" perms => mog("700", "root", "root"), content => '#!/bin/sh @@ -28,12 +26,12 @@ done'; } ############################################################################## - bundle agent test { meta: "description" -> { "CFE-2724" } string => "Test that arglist attribute preserves white-spaces"; + "test_skip_unsupported" string => "windows", comment => "See ticket CFE-4294"; @@ -45,14 +43,11 @@ bundle agent test } ############################################################################## - bundle agent check { vars: - "actual" - string => readfile("$(G.testfile).actual"); - "expected" - string => "one + "actual" string => readfile("$(G.testfile).actual"); + "expected" string => "one two three four @@ -62,6 +57,7 @@ five six methods: "any" - usebundle => dcs_check_strcmp("$(actual)", "$(expected)", - "$(this.promise_filename)", "no"); + usebundle => dcs_check_strcmp( + "$(actual)", "$(expected)", "$(this.promise_filename)", "no" + ); } diff --git a/tests/acceptance/08_commands/staging/default_failed_returncodes.cf b/tests/acceptance/08_commands/staging/default_failed_returncodes.cf index ea3f389ccd..3b1a8b26d6 100644 --- a/tests/acceptance/08_commands/staging/default_failed_returncodes.cf +++ b/tests/acceptance/08_commands/staging/default_failed_returncodes.cf @@ -7,7 +7,6 @@ body common control bundle agent test { commands: - "/bin/false" classes => scoped_classes_generic("namespace", "default"), comment => "Test that by default non zero commands return promise failure"; @@ -21,19 +20,53 @@ bundle agent check { methods: "report" - usebundle => dcs_passif_expected("default_not_kept,specify_kept_not_kept", "", "$(this.promise_filename)"), + usebundle => dcs_passif_expected( + "default_not_kept,specify_kept_not_kept", + "", + "$(this.promise_filename)" + ), inherit => "true"; } body classes scoped_classes_generic_kept_0(scope, x) { - scope => "$(scope)"; - promise_repaired => { "promise_repaired_$(x)", "$(x)_repaired", "$(x)_ok", "$(x)_reached" }; - repair_failed => { "repair_failed_$(x)", "$(x)_failed", "$(x)_not_ok", "$(x)_not_kept", "$(x)_not_repaired", "$(x)_reached" }; - repair_denied => { "repair_denied_$(x)", "$(x)_denied", "$(x)_not_ok", "$(x)_not_kept", "$(x)_not_repaired", "$(x)_reached" }; - repair_timeout => { "repair_timeout_$(x)", "$(x)_timeout", "$(x)_not_ok", "$(x)_not_kept", "$(x)_not_repaired", "$(x)_reached" }; - promise_kept => { "promise_kept_$(x)", "$(x)_kept", "$(x)_ok", "$(x)_not_repaired", "$(x)_reached" }; - kept_returncodes => { "0" }; - #repaired_returncodes => { "2" }; - #failed_returncodes => { "1" }; + scope => "$(scope)"; + promise_repaired => { + "promise_repaired_$(x)", "$(x)_repaired", "$(x)_ok", "$(x)_reached" + }; + repair_failed => { + "repair_failed_$(x)", + "$(x)_failed", + "$(x)_not_ok", + "$(x)_not_kept", + "$(x)_not_repaired", + "$(x)_reached", + }; + repair_denied => { + "repair_denied_$(x)", + "$(x)_denied", + "$(x)_not_ok", + "$(x)_not_kept", + "$(x)_not_repaired", + "$(x)_reached", + }; + repair_timeout => { + "repair_timeout_$(x)", + "$(x)_timeout", + "$(x)_not_ok", + "$(x)_not_kept", + "$(x)_not_repaired", + "$(x)_reached", + }; + promise_kept => { + "promise_kept_$(x)", + "$(x)_kept", + "$(x)_ok", + "$(x)_not_repaired", + "$(x)_reached", + }; + kept_returncodes => { "0" }; + + #repaired_returncodes => { "2" }; + #failed_returncodes => { "1" }; } diff --git a/tests/acceptance/09_services/custom.cf b/tests/acceptance/09_services/custom.cf index 947b832678..efa2abf9a5 100644 --- a/tests/acceptance/09_services/custom.cf +++ b/tests/acceptance/09_services/custom.cf @@ -3,56 +3,55 @@ # Test services custom keyword # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "CFE-2402" }; + "test_soft_fail" + string => "windows", + meta => { "CFE-2402" }; services: - "myservice" + "myservice" service_policy => "custom", service_method => service_test; } -body service_method service_test { - service_bundle => test_services("$(this.promiser)","$(this.service_policy)"); +body service_method service_test +{ + service_bundle => test_services("$(this.promiser)", "$(this.service_policy)"); } -bundle agent test_services(service, state) { +bundle agent test_services(service, state) +{ vars: - "service_state" string => "$(state)"; + "service_state" string => "$(state)"; } - ####################################################### - bundle agent check { classes: - "ok" expression => strcmp("custom", "$(test_services.service_state)"); + "ok" expression => strcmp("custom", "$(test_services.service_state)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/09_services/disable.cf b/tests/acceptance/09_services/disable.cf index 45f5403f5a..3a311be946 100644 --- a/tests/acceptance/09_services/disable.cf +++ b/tests/acceptance/09_services/disable.cf @@ -3,56 +3,55 @@ # Test services disable keyword # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "CFE-2402" }; + "test_soft_fail" + string => "windows", + meta => { "CFE-2402" }; services: - "myservice" + "myservice" service_policy => "disable", service_method => service_test; } -body service_method service_test { - service_bundle => test_services("$(this.promiser)","$(this.service_policy)"); +body service_method service_test +{ + service_bundle => test_services("$(this.promiser)", "$(this.service_policy)"); } -bundle agent test_services(service, state) { +bundle agent test_services(service, state) +{ vars: - "service_state" string => "$(state)"; + "service_state" string => "$(state)"; } - ####################################################### - bundle agent check { classes: - "ok" expression => strcmp("disable", "$(test_services.service_state)"); + "ok" expression => strcmp("disable", "$(test_services.service_state)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/09_services/enable.cf b/tests/acceptance/09_services/enable.cf index 8af371a1dd..2388d7ba31 100644 --- a/tests/acceptance/09_services/enable.cf +++ b/tests/acceptance/09_services/enable.cf @@ -3,56 +3,55 @@ # Test services enable keyword # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "CFE-2402" }; + "test_soft_fail" + string => "windows", + meta => { "CFE-2402" }; services: - "myservice" + "myservice" service_policy => "enable", service_method => service_test; } -body service_method service_test { - service_bundle => test_services("$(this.promiser)","$(this.service_policy)"); +body service_method service_test +{ + service_bundle => test_services("$(this.promiser)", "$(this.service_policy)"); } -bundle agent test_services(service, state) { +bundle agent test_services(service, state) +{ vars: - "service_state" string => "$(state)"; + "service_state" string => "$(state)"; } - ####################################################### - bundle agent check { classes: - "ok" expression => strcmp("enable", "$(test_services.service_state)"); + "ok" expression => strcmp("enable", "$(test_services.service_state)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/09_services/outcomes.cf b/tests/acceptance/09_services/outcomes.cf index a3601c43fc..719aed1f52 100644 --- a/tests/acceptance/09_services/outcomes.cf +++ b/tests/acceptance/09_services/outcomes.cf @@ -1,21 +1,26 @@ body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-2161" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-2161" }; vars: - "services" slist => { "single" }; - "policies" slist => { "enable", "disable", "start", "stop", "restart", "reload", "custom" }; + "services" slist => { "single" }; + + "policies" + slist => { + "enable", "disable", "start", "stop", "restart", "reload", "custom" + }; services: - "$(services)" + "$(services)" service_policy => "$(policies)", classes => scoped_classes_generic("namespace", "$(services)_$(policies)"); } @@ -30,22 +35,27 @@ bundle agent standard_services(service, state) bundle agent check { vars: - "s" slist => { @(test.services) }; - "p" slist => { @(test.policies) }; + "s" slist => { @(test.services) }; + "p" slist => { @(test.policies) }; methods: - "collect" usebundle => dcs_all_classes_to_string("$(s)_$(p)"), + "collect" + usebundle => dcs_all_classes_to_string("$(s)_$(p)"), inherit => "true", useresult => "$(s)_$(p)"; EXTRA:: - "" usebundle => dcs_report_generic_classes("$(s)_$(p)"), - inherit => "true"; + "" + usebundle => dcs_report_generic_classes("$(s)_$(p)"), + inherit => "true"; any:: - "report" usebundle => dcs_passif_expected('single_enable_kept,single_disable_kept,single_start_kept,single_stop_kept,single_restart_kept,single_reload_kept,single_custom_kept', - 'single_enable_repaired,single_enable_failed,single_enable_denied,single_enable_timeout,single_disable_repaired,single_disable_failed,single_disable_denied,single_disable_timeout,single_start_repaired,single_start_failed,single_start_denied,single_start_timeout,single_stop_repaired,single_stop_failed,single_stop_denied,single_stop_timeout,single_restart_repaired,single_restart_failed,single_restart_denied,single_restart_timeout,single_reload_repaired,single_reload_failed,single_reload_denied,single_reload_timeout,single_custom_repaired,single_custom_failed,single_custom_denied,single_custom_timeout', - $(this.promise_filename)); + "report" + usebundle => dcs_passif_expected( + 'single_enable_kept,single_disable_kept,single_start_kept,single_stop_kept,single_restart_kept,single_reload_kept,single_custom_kept', + 'single_enable_repaired,single_enable_failed,single_enable_denied,single_enable_timeout,single_disable_repaired,single_disable_failed,single_disable_denied,single_disable_timeout,single_start_repaired,single_start_failed,single_start_denied,single_start_timeout,single_stop_repaired,single_stop_failed,single_stop_denied,single_stop_timeout,single_restart_repaired,single_restart_failed,single_restart_denied,single_restart_timeout,single_reload_repaired,single_reload_failed,single_reload_denied,single_reload_timeout,single_custom_repaired,single_custom_failed,single_custom_denied,single_custom_timeout', + $(this.promise_filename) + ); reports: EXTRA:: diff --git a/tests/acceptance/09_services/reload.cf b/tests/acceptance/09_services/reload.cf index 796c15dc43..5305bd1b19 100644 --- a/tests/acceptance/09_services/reload.cf +++ b/tests/acceptance/09_services/reload.cf @@ -3,56 +3,55 @@ # Test services reload keyword # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "redmine4772,ENT-2161" }; + "test_soft_fail" + string => "windows", + meta => { "redmine4772,ENT-2161" }; services: - "myservice" + "myservice" service_policy => "reload", service_method => service_test; } -body service_method service_test { - service_bundle => test_services("$(this.promiser)","$(this.service_policy)"); +body service_method service_test +{ + service_bundle => test_services("$(this.promiser)", "$(this.service_policy)"); } -bundle agent test_services(service, state) { +bundle agent test_services(service, state) +{ vars: - "service_state" string => "$(state)"; + "service_state" string => "$(state)"; } - ####################################################### - bundle agent check { classes: - "ok" expression => strcmp("reload", "$(test_services.service_state)"); + "ok" expression => strcmp("reload", "$(test_services.service_state)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/09_services/restart.cf b/tests/acceptance/09_services/restart.cf index 66bb308999..4147c28463 100644 --- a/tests/acceptance/09_services/restart.cf +++ b/tests/acceptance/09_services/restart.cf @@ -3,56 +3,55 @@ # Test services restart keyword # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "redmine4772,ENT-2161" }; + "test_soft_fail" + string => "windows", + meta => { "redmine4772,ENT-2161" }; services: - "myservice" + "myservice" service_policy => "restart", service_method => service_test; } -body service_method service_test { - service_bundle => test_services("$(this.promiser)","$(this.service_policy)"); +body service_method service_test +{ + service_bundle => test_services("$(this.promiser)", "$(this.service_policy)"); } -bundle agent test_services(service, state) { +bundle agent test_services(service, state) +{ vars: - "service_state" string => "$(state)"; + "service_state" string => "$(state)"; } - ####################################################### - bundle agent check { classes: - "ok" expression => strcmp("restart", "$(test_services.service_state)"); + "ok" expression => strcmp("restart", "$(test_services.service_state)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/09_services/service_cannot_be_resolved.cf b/tests/acceptance/09_services/service_cannot_be_resolved.cf index 2df6bd3f9f..55dab7b89b 100644 --- a/tests/acceptance/09_services/service_cannot_be_resolved.cf +++ b/tests/acceptance/09_services/service_cannot_be_resolved.cf @@ -3,16 +3,14 @@ # catch "Service ... cannot be resolved" inform message # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } @@ -20,35 +18,48 @@ bundle agent init bundle common test { meta: - "test_soft_fail" string => "windows", - meta => { "redmine4772,ENT-2161" }; + "test_soft_fail" + string => "windows", + meta => { "redmine4772,ENT-2161" }; classes: - "resolution_warning" expression => returnszero("$(command) Service | $(G.grep) 'cannot be resolved' 2>&1", "useshell"); - "myservice_found" expression => returnszero("$(command) 4441a73c9b58ff7f2285c018ee7449f35ec89712 2>&1", "useshell"); + "resolution_warning" + expression => returnszero( + "$(command) Service | $(G.grep) 'cannot be resolved' 2>&1", "useshell" + ); + + "myservice_found" + expression => returnszero( + "$(command) 4441a73c9b58ff7f2285c018ee7449f35ec89712 2>&1", "useshell" + ); vars: - "command" string => "$(sys.cf_agent) -KI -f $(this.promise_filename).sub | $(G.grep)"; + "command" + string => "$(sys.cf_agent) -KI -f $(this.promise_filename).sub | $(G.grep)"; } ####################################################### - bundle agent check { classes: - "ok" and => { "!resolution_warning", "myservice_found" }; + "ok" and => { "!resolution_warning", "myservice_found" }; reports: DEBUG.resolution_warning:: "failure: service bundle 'cannot be resolved' error WAS found"; + DEBUG.!resolution_warning:: "success: service bundle 'cannot be resolved' error was not found"; + DEBUG.myservice_found:: "success: myservice report 4441a73c9b58ff7f2285c018ee7449f35ec89712 was found"; + DEBUG.!myservice_found:: "failure: myservice report 4441a73c9b58ff7f2285c018ee7449f35ec89712 was NOT found"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/09_services/standard_services-from-non-default-namespace.cf b/tests/acceptance/09_services/standard_services-from-non-default-namespace.cf index 2d318b03cb..0bbb49650f 100644 --- a/tests/acceptance/09_services/standard_services-from-non-default-namespace.cf +++ b/tests/acceptance/09_services/standard_services-from-non-default-namespace.cf @@ -1,23 +1,23 @@ body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "description" -> { "ENT-5406" } - string => "Test that standard_services can be used from non-default namespace"; + "description" -> { "ENT-5406" } + string => "Test that standard_services can be used from non-default namespace"; - "test_soft_fail" string => "windows", - meta => { "ENT-2161" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-2161" }; methods: - "Test" usebundle => ENT_5406:ns_test; + "Test" usebundle => ENT_5406:ns_test; } bundle agent standard_services(service, state) @@ -27,34 +27,31 @@ bundle agent standard_services(service, state) # to test starting and stopping services, we only want to test that the correct # bundle is selected. { - files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } ####################################################### - bundle agent check { classes: - "ok" expression => fileexists( $(G.testfile) ); + "ok" expression => fileexists($(G.testfile)); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } body file control { - namespace => "ENT_5406"; + namespace => "ENT_5406"; } bundle agent ns_test { services: - "myservice" - service_policy => "start"; + "myservice" service_policy => "start"; } diff --git a/tests/acceptance/09_services/start.cf b/tests/acceptance/09_services/start.cf index f4230d03de..5a61786490 100644 --- a/tests/acceptance/09_services/start.cf +++ b/tests/acceptance/09_services/start.cf @@ -3,56 +3,55 @@ # Test services start keyword # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "redmine4772,ENT-2161" }; + "test_soft_fail" + string => "windows", + meta => { "redmine4772,ENT-2161" }; services: - "myservice" + "myservice" service_policy => "start", service_method => service_test; } -body service_method service_test { - service_bundle => test_services("$(this.promiser)","$(this.service_policy)"); +body service_method service_test +{ + service_bundle => test_services("$(this.promiser)", "$(this.service_policy)"); } -bundle agent test_services(service, state) { +bundle agent test_services(service, state) +{ vars: - "service_state" string => "$(state)"; + "service_state" string => "$(state)"; } - ####################################################### - bundle agent check { classes: - "ok" expression => strcmp("start", "$(test_services.service_state)"); + "ok" expression => strcmp("start", "$(test_services.service_state)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/09_services/stop.cf b/tests/acceptance/09_services/stop.cf index 845d6deea1..6bb3459fd5 100644 --- a/tests/acceptance/09_services/stop.cf +++ b/tests/acceptance/09_services/stop.cf @@ -3,56 +3,55 @@ # Test services stop keyword # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "redmine4772,ENT-2161" }; + "test_soft_fail" + string => "windows", + meta => { "redmine4772,ENT-2161" }; services: - "myservice" + "myservice" service_policy => "stop", service_method => service_test; } -body service_method service_test { - service_bundle => test_services("$(this.promiser)","$(this.service_policy)"); +body service_method service_test +{ + service_bundle => test_services("$(this.promiser)", "$(this.service_policy)"); } -bundle agent test_services(service, state) { +bundle agent test_services(service, state) +{ vars: - "service_state" string => "$(state)"; + "service_state" string => "$(state)"; } - ####################################################### - bundle agent check { classes: - "ok" expression => strcmp("stop", "$(test_services.service_state)"); + "ok" expression => strcmp("stop", "$(test_services.service_state)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/001.cf b/tests/acceptance/10_files/01_create/001.cf index 2505144f9a..636128a5ee 100644 --- a/tests/acceptance/10_files/01_create/001.cf +++ b/tests/acceptance/10_files/01_create/001.cf @@ -3,64 +3,60 @@ # Create a file, check defaults # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } ####################################################### - bundle agent check { vars: # We want default 0600, 1 link, zero size !windows:: "expect[permoct]" string => "600"; + any:: "expect[nlink]" string => "1"; "expect[uid]" string => "\d+"; "expect[gid]" string => "\d+"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); - + classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/002.cf b/tests/acceptance/10_files/01_create/002.cf index 32b69866c8..fd99bbc3bd 100644 --- a/tests/acceptance/10_files/01_create/002.cf +++ b/tests/acceptance/10_files/01_create/002.cf @@ -3,72 +3,69 @@ # Create a file, check initial permissions (predictable mode) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" int => "0641"; + "mode" int => "0641"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms; } body perms test_perms { - mode => "$(test.mode)"; + mode => "$(test.mode)"; } ####################################################### - bundle agent check { vars: !windows:: "expect[permoct]" string => "$(test.mode)"; + any:: "expect[nlink]" string => "1"; "expect[uid]" string => "\d+"; "expect[gid]" string => "\d+"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/003.cf b/tests/acceptance/10_files/01_create/003.cf index 7ac3c55738..57b3fcdd31 100644 --- a/tests/acceptance/10_files/01_create/003.cf +++ b/tests/acceptance/10_files/01_create/003.cf @@ -3,72 +3,69 @@ # Create a file, check initial permissions (odd mode) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" int => "0146"; + "mode" int => "0146"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms; } body perms test_perms { - mode => "$(test.mode)"; + mode => "$(test.mode)"; } ####################################################### - bundle agent check { vars: !windows:: "expect[permoct]" string => "$(test.mode)"; + any:: "expect[nlink]" string => "1"; "expect[uid]" string => "\d+"; "expect[gid]" string => "\d+"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/004.cf b/tests/acceptance/10_files/01_create/004.cf index 125fd53b2a..041916f9a8 100644 --- a/tests/acceptance/10_files/01_create/004.cf +++ b/tests/acceptance/10_files/01_create/004.cf @@ -3,76 +3,71 @@ # Create a file, check initial permissions (strange mode) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" int => "01010"; + "mode" int => "01010"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms; } body perms test_perms { - mode => "$(test.mode)"; + mode => "$(test.mode)"; } ####################################################### - bundle agent check { vars: !freebsd.!solaris.!windows:: "expect[modeoct]" string => "[0-9]+$(test.mode)"; + any:: "expect[nlink]" string => "1"; "expect[uid]" string => "\d+"; "expect[gid]" string => "\d+"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); - # # OS X refuses to open(2) file you have no permissions for (which is required for safe_chmod), # so this test is temporarily disabled there. - # reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok|darwin:: "$(this.promise_filename) Pass"; + not_ok&!darwin:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/005.cf b/tests/acceptance/10_files/01_create/005.cf index cd7101886a..58327d5e52 100644 --- a/tests/acceptance/10_files/01_create/005.cf +++ b/tests/acceptance/10_files/01_create/005.cf @@ -3,76 +3,71 @@ # Create a file, check initial permissions (strange setgid mode) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" int => "02001"; + "mode" int => "02001"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms; } body perms test_perms { - mode => "$(test.mode)"; + mode => "$(test.mode)"; } ####################################################### - bundle agent check { vars: !windows:: "expect[modeoct]" string => "[0-9]+$(test.mode)"; + any:: "expect[nlink]" string => "1"; "expect[uid]" string => "\d+"; "expect[gid]" string => "\d+"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); - # # OS X refuses to open(2) file you have no permissions for (which is required for safe_chmod), # so this test is temporarily disabled there. - # reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok|darwin:: "$(this.promise_filename) Pass"; + not_ok&!darwin:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/006.cf b/tests/acceptance/10_files/01_create/006.cf index 475dfd4b2d..e28bc97df1 100644 --- a/tests/acceptance/10_files/01_create/006.cf +++ b/tests/acceptance/10_files/01_create/006.cf @@ -3,72 +3,69 @@ # Create a file, check initial permissions (strange setuid mode) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" int => "04777"; + "mode" int => "04777"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms; } body perms test_perms { - mode => "$(test.mode)"; + mode => "$(test.mode)"; } ####################################################### - bundle agent check { vars: !windows:: "expect[modeoct]" string => "[0-9]+$(test.mode)"; + any:: "expect[nlink]" string => "1"; "expect[uid]" string => "\d+"; "expect[gid]" string => "\d+"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/007.cf b/tests/acceptance/10_files/01_create/007.cf index 4f6df4d3c3..518cd3548c 100644 --- a/tests/acceptance/10_files/01_create/007.cf +++ b/tests/acceptance/10_files/01_create/007.cf @@ -3,74 +3,71 @@ # Create a file, check owners/mode # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" int => "0644"; + "mode" int => "0644"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms($(mode)); } body perms test_perms(m) { - mode => "$(m)"; - owners => { "0" }; - groups => { "0" }; + mode => "$(m)"; + owners => { "0" }; + groups => { "0" }; } ####################################################### - bundle agent check { vars: !windows:: "expect[permoct]" string => "$(test.mode)"; + any:: "expect[nlink]" string => "1"; "expect[uid]" string => "\d+"; "expect[gid]" string => "\d+"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/008.cf b/tests/acceptance/10_files/01_create/008.cf index 8410d13ae8..04319676aa 100644 --- a/tests/acceptance/10_files/01_create/008.cf +++ b/tests/acceptance/10_files/01_create/008.cf @@ -4,74 +4,71 @@ # by root (see notes below) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" int => "0644"; + "mode" int => "0644"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms($(mode)); } body perms test_perms(m) { - mode => "$(m)"; - owners => { "0" }; - groups => { "0" }; + mode => "$(m)"; + owners => { "0" }; + groups => { "0" }; } ####################################################### - bundle agent check { vars: !windows:: "expect[permoct]" string => "$(test.mode)"; + any:: "expect[nlink]" string => "1"; "expect[uid]" string => "\d+"; "expect[gid]" string => "\d+"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/009.cf b/tests/acceptance/10_files/01_create/009.cf index 944cce6835..b68f26afb4 100644 --- a/tests/acceptance/10_files/01_create/009.cf +++ b/tests/acceptance/10_files/01_create/009.cf @@ -4,78 +4,76 @@ # by root (see notes below) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" int => "0644"; + "mode" int => "0644"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms; } body perms test_perms { - mode => "$(test.mode)"; - # In the POSIX model, one cannot create a file for another user, one can only - # create a file as you, and then change owners. This test file will be created - # by root, but then changed to sys - and thus the promise to be owned by sys - # is kept. - owners => { "3", "1" }; - groups => { "3", "1" }; + mode => "$(test.mode)"; + + # In the POSIX model, one cannot create a file for another user, one can only + # create a file as you, and then change owners. This test file will be created + # by root, but then changed to sys - and thus the promise to be owned by sys + # is kept. + owners => { "3", "1" }; + groups => { "3", "1" }; } ####################################################### - bundle agent check { vars: !windows:: "expect[permoct]" string => "$(test.mode)"; + any:: "expect[nlink]" string => "1"; "expect[uid]" string => "\d+"; "expect[gid]" string => "\d+"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/010.cf b/tests/acceptance/10_files/01_create/010.cf index 26ad14ecf0..ff1505bd05 100644 --- a/tests/acceptance/10_files/01_create/010.cf +++ b/tests/acceptance/10_files/01_create/010.cf @@ -3,74 +3,71 @@ # Create a file, check owner/group (single choice) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" int => "0644"; + "mode" int => "0644"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms; } body perms test_perms { - mode => "$(test.mode)"; - owners => { "3" }; - groups => { "3" }; + mode => "$(test.mode)"; + owners => { "3" }; + groups => { "3" }; } ####################################################### - bundle agent check { vars: !windows:: "expect[permoct]" string => "$(test.mode)"; + any:: "expect[nlink]" string => "1"; "expect[uid]" string => "\d+"; "expect[gid]" string => "\d+"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/011.cf b/tests/acceptance/10_files/01_create/011.cf index 26fd7c1e36..f37656abbd 100644 --- a/tests/acceptance/10_files/01_create/011.cf +++ b/tests/acceptance/10_files/01_create/011.cf @@ -3,34 +3,32 @@ # Create a fifo, check defaults # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } bundle agent test { vars: - "mode" int => "0644"; + "mode" int => "0644"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", file_type => "fifo"; } @@ -40,24 +38,26 @@ bundle agent check vars: !windows:: "expect[permoct]" string => "600"; + any:: "expect[nlink]" string => "1"; "expect[uid]" string => "\d+"; "expect[gid]" string => "\d+"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/012.cf b/tests/acceptance/10_files/01_create/012.cf index 7ec52ffc13..f0e1ed81d8 100644 --- a/tests/acceptance/10_files/01_create/012.cf +++ b/tests/acceptance/10_files/01_create/012.cf @@ -3,34 +3,32 @@ # Create a file, change perms # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } bundle agent test { vars: - "mode" int => "0644"; + "mode" int => "0644"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", file_type => "fifo", perms => test_perms; @@ -38,9 +36,9 @@ bundle agent test body perms test_perms { - mode => "$(test.mode)"; - owners => { "3" }; - groups => { "3" }; + mode => "$(test.mode)"; + owners => { "3" }; + groups => { "3" }; } bundle agent check @@ -48,24 +46,26 @@ bundle agent check vars: !windows:: "expect[permoct]" string => "$(test.mode)"; + any:: "expect[nlink]" string => "1"; "expect[uid]" string => "\d+"; "expect[gid]" string => "\d+"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/013.cf b/tests/acceptance/10_files/01_create/013.cf index 2bf28e7161..65a049f6bc 100644 --- a/tests/acceptance/10_files/01_create/013.cf +++ b/tests/acceptance/10_files/01_create/013.cf @@ -4,31 +4,27 @@ # but witout create attribute, check owner # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { meta: @@ -36,38 +32,39 @@ bundle agent test string => "hpux|aix"; vars: - "owner" string => "nobody"; + "owner" string => "nobody"; files: - "$(G.testfile)" - content => "", - perms => test_perms($(owner)); + "$(G.testfile)" + content => "", + perms => test_perms($(owner)); } body perms test_perms(o) { - rxdirs => "false"; - mode => "644"; - owners => { "$(o)" }; - groups => { "0" }; + rxdirs => "false"; + mode => "644"; + owners => { "$(o)" }; + groups => { "0" }; } ####################################################### - bundle agent check { vars: - "ui" data => getuserinfo(filestat($(G.testfile), "uid")); + "ui" data => getuserinfo(filestat($(G.testfile), "uid")); classes: - "not_ok" not => strcmp($(test.owner), $(ui[username])); + "not_ok" not => strcmp($(test.owner), $(ui[username])); reports: DEBUG:: "expected: username = '$(test.owner)'"; "got: username = '$(ui[username])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/cfengine_create_by_default.cf b/tests/acceptance/10_files/01_create/cfengine_create_by_default.cf index 9bd4dafc3f..3603970383 100644 --- a/tests/acceptance/10_files/01_create/cfengine_create_by_default.cf +++ b/tests/acceptance/10_files/01_create/cfengine_create_by_default.cf @@ -4,126 +4,121 @@ # `create => "false"` is specified. # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } ############################################################################## - bundle agent init { vars: - "range" - slist => { expandrange("[1-4]", 1) }; + "range" slist => { expandrange("[1-4]", 1) }; files: - "$(G.testfile).test_$(range)" - delete => tidy; - - "$(G.testfile).test_5" - create => "true"; + "$(G.testfile).test_$(range)" delete => tidy; + "$(G.testfile).test_5" create => "true"; - "$(G.testfile).valid_template" - content => "[%CFEngine BEGIN %] + "$(G.testfile).valid_template" + content => "[%CFEngine BEGIN %] I have $(const.dollar)(sys.cpus) CPU's! [%CFEngine END %] "; - "$(G.testfile).invalid_template" - content => "[%CFEngine BEGIN %] + "$(G.testfile).invalid_template" + content => "[%CFEngine BEGIN %] I have $(const.dollar)(sys.cpus) CPU's! [%CFEngine END %) "; } ############################################################################## - bundle agent test { meta: - "description" -> { "CFE-3955" } - string => "template_method cfengine creates promiser by default"; + "description" -> { "CFE-3955" } + string => "template_method cfengine creates promiser by default"; - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; files: # File should be created by default and rendered with content - "$(G.testfile).test_1" - template_method => "cfengine", - edit_template => "$(G.testfile).valid_template", - if => fileexists("$(G.testfile).valid_template"); + "$(G.testfile).test_1" + template_method => "cfengine", + edit_template => "$(G.testfile).valid_template", + if => fileexists("$(G.testfile).valid_template"); # File should not be created due to invalid template - "$(G.testfile).test_2" - template_method => "cfengine", - edit_template => "$(G.testfile).invalid_template", - if => fileexists("$(G.testfile).invalid_template"); + "$(G.testfile).test_2" + template_method => "cfengine", + edit_template => "$(G.testfile).invalid_template", + if => fileexists("$(G.testfile).invalid_template"); # File should be created even though template is invalid - "$(G.testfile).test_3" - create => "true", - template_method => "cfengine", - edit_template => "$(G.testfile).invalid_template", - if => fileexists("$(G.testfile).invalid_template"); + "$(G.testfile).test_3" + create => "true", + template_method => "cfengine", + edit_template => "$(G.testfile).invalid_template", + if => fileexists("$(G.testfile).invalid_template"); # File should not be created even though template is valid - "$(G.testfile).test_4" - create => "false", - template_method => "cfengine", - edit_template => "$(G.testfile).valid_template", - if => fileexists("$(G.testfile).valid_template"); + "$(G.testfile).test_4" + create => "false", + template_method => "cfengine", + edit_template => "$(G.testfile).valid_template", + if => fileexists("$(G.testfile).valid_template"); # File should be rendered with content, since it already exists - "$(G.testfile).test_5" - create => "false", - template_method => "cfengine", - edit_template => "$(G.testfile).valid_template", - if => fileexists("$(G.testfile).valid_template"); + "$(G.testfile).test_5" + create => "false", + template_method => "cfengine", + edit_template => "$(G.testfile).valid_template", + if => fileexists("$(G.testfile).valid_template"); } ############################################################################## - bundle agent check { vars: # Get lists of successful / failed checks so we can report them - "checks" - slist => { expandrange("check_[1-5]", 1) }; - "successful_checks" - slist => sort(classesmatching("check_[1-5]"), "lex"); - "failed_checks" - slist => sort(difference("checks", "successful_checks"), "lex"); + "checks" slist => { expandrange("check_[1-5]", 1) }; + "successful_checks" slist => sort(classesmatching("check_[1-5]"), "lex"); + + "failed_checks" + slist => sort(difference("checks", "successful_checks"), "lex"); classes: - "check_1" - expression => regcmp("I have [0-9]+ CPU's!", - readfile("$(G.testfile).test_1")), - if => fileexists("$(G.testfile).test_1"); - "check_2" - expression => not(fileexists("$(G.testfile).test_2")); - "check_3" - expression => fileexists("$(G.testfile).test_3"); - "check_4" - expression => not(fileexists("$(G.testfile).test_4")); - "check_5" - expression => regcmp("I have [0-9]+ CPU's!", - readfile("$(G.testfile).test_5")), - if => fileexists("$(G.testfile).test_5"); - "ok" - expression => and("check_1", "check_2", "check_3", "check_4", - "check_5"); + "check_1" + expression => regcmp( + "I have [0-9]+ CPU's!", readfile("$(G.testfile).test_1") + ), + if => fileexists("$(G.testfile).test_1"); + + "check_2" expression => not(fileexists("$(G.testfile).test_2")); + "check_3" expression => fileexists("$(G.testfile).test_3"); + "check_4" expression => not(fileexists("$(G.testfile).test_4")); + + "check_5" + expression => regcmp( + "I have [0-9]+ CPU's!", readfile("$(G.testfile).test_5") + ), + if => fileexists("$(G.testfile).test_5"); + + "ok" + expression => and("check_1", "check_2", "check_3", "check_4", "check_5"); reports: DEBUG:: "'$(successful_checks)' succeded!"; "'$(failed_checks)' failed!"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/content_create_by_default.cf b/tests/acceptance/10_files/01_create/content_create_by_default.cf index 6f5d63501e..4a6667b25a 100644 --- a/tests/acceptance/10_files/01_create/content_create_by_default.cf +++ b/tests/acceptance/10_files/01_create/content_create_by_default.cf @@ -4,107 +4,102 @@ # "false"` is specified. # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } ############################################################################## - bundle agent init { vars: - "delete_range" - slist => { expandrange("[1-3]", 1) }; - "create_range" - slist => { expandrange("[4-6]", 1) }; + "delete_range" slist => { expandrange("[1-3]", 1) }; + "create_range" slist => { expandrange("[4-6]", 1) }; files: - "$(G.testfile)_$(delete_range)" - delete => tidy; - "$(G.testfile)_$(create_range)" - create => "true"; + "$(G.testfile)_$(delete_range)" delete => tidy; + "$(G.testfile)_$(create_range)" create => "true"; } ############################################################################## - bundle agent test { meta: - "description" -> { "CFE-3916" } - string => "files with content attribute shall create promiser by default"; + "description" -> { "CFE-3916" } + string => "files with content attribute shall create promiser by default"; files: # File should be created by default - "$(G.testfile)_1" - content => "Hello World!"; + "$(G.testfile)_1" content => "Hello World!"; - "$(G.testfile)_2" - create => "true", - content => "Hello World!"; + "$(G.testfile)_2" + create => "true", + content => "Hello World!"; - "$(G.testfile)_3" - create => "false", - content => "Hello World!"; + "$(G.testfile)_3" + create => "false", + content => "Hello World!"; - "$(G.testfile)_4" - content => "Hello World!"; + "$(G.testfile)_4" content => "Hello World!"; - "$(G.testfile)_5" - create => "true", - content => "Hello World!"; + "$(G.testfile)_5" + create => "true", + content => "Hello World!"; - "$(G.testfile)_6" - create => "false", - content => "Hello World!"; + "$(G.testfile)_6" + create => "false", + content => "Hello World!"; } ############################################################################## - bundle agent check { vars: # Get lists of successful / failed checks so we can report them - "checks" - slist => { expandrange("check_[1-6]", 1) }; - "successful_checks" - slist => sort(classesmatching("check_[1-6]"), "lex"); - "failed_checks" - slist => sort(difference("checks", "successful_checks"), "lex"); + "checks" slist => { expandrange("check_[1-6]", 1) }; + "successful_checks" slist => sort(classesmatching("check_[1-6]"), "lex"); + + "failed_checks" + slist => sort(difference("checks", "successful_checks"), "lex"); classes: - "check_1" - expression => strcmp(readfile("$(G.testfile)_1"), "Hello World!"), - if => fileexists("$(G.testfile)_1"); - "check_2" - expression => strcmp(readfile("$(G.testfile)_2"), "Hello World!"), - if => fileexists("$(G.testfile)_2"); - "check_3" - expression => not(fileexists("$(G.testfile)_3")); - "check_4" - expression => strcmp(readfile("$(G.testfile)_4"), "Hello World!"), - if => fileexists("$(G.testfile)_4"); - "check_5" - expression => strcmp(readfile("$(G.testfile)_5"), "Hello World!"), - if => fileexists("$(G.testfile)_5"); - "check_6" - expression => strcmp(readfile("$(G.testfile)_6"), "Hello World!"), - if => fileexists("$(G.testfile)_6"); - "ok" - expression => and("check_1", "check_2", "check_3", "check_4", - "check_5", "check_6"); + "check_1" + expression => strcmp(readfile("$(G.testfile)_1"), "Hello World!"), + if => fileexists("$(G.testfile)_1"); + + "check_2" + expression => strcmp(readfile("$(G.testfile)_2"), "Hello World!"), + if => fileexists("$(G.testfile)_2"); + + "check_3" expression => not(fileexists("$(G.testfile)_3")); + + "check_4" + expression => strcmp(readfile("$(G.testfile)_4"), "Hello World!"), + if => fileexists("$(G.testfile)_4"); + + "check_5" + expression => strcmp(readfile("$(G.testfile)_5"), "Hello World!"), + if => fileexists("$(G.testfile)_5"); + + "check_6" + expression => strcmp(readfile("$(G.testfile)_6"), "Hello World!"), + if => fileexists("$(G.testfile)_6"); + + "ok" + expression => and( + "check_1", "check_2", "check_3", "check_4", "check_5", "check_6" + ); methods: "Pass/Fail" usebundle => dcs_passif("ok", $(this.promise_filename)), - inherit => "true"; # We want dcs_passif to inhert bundle scoped classes from our check bundle - + inherit => "true"; + + # We want dcs_passif to inhert bundle scoped classes from our check bundle reports: DEBUG:: "'$(successful_checks)' succeded!"; "'$(failed_checks)' failed!"; - } diff --git a/tests/acceptance/10_files/01_create/copy_and_purge.cf b/tests/acceptance/10_files/01_create/copy_and_purge.cf index 651c8fd379..7e9ca083ec 100644 --- a/tests/acceptance/10_files/01_create/copy_and_purge.cf +++ b/tests/acceptance/10_files/01_create/copy_and_purge.cf @@ -3,12 +3,11 @@ # Redmine #3429: copy and purge files and directories should purge empty directories too # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g @@ -16,43 +15,37 @@ bundle common g } ####################################################### - bundle agent init { methods: - "1" usebundle => init1; - "2" usebundle => init2; + "1" usebundle => init1; + "2" usebundle => init2; } bundle agent init1 { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } bundle agent init2 { files: - "$(G.testfile)/source/1/2/3/." - create => "true"; - - "$(G.testfile)/dest/1/2/should-be-removed/3/." - create => "true"; + "$(G.testfile)/source/1/2/3/." create => "true"; + "$(G.testfile)/dest/1/2/should-be-removed/3/." create => "true"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile)/dest/." + "$(G.testfile)/dest/." create => "true", depth_search => test_recurse("inf"), action => test_immediate, @@ -60,37 +53,37 @@ bundle agent test } body depth_search test_recurse(d) - { - depth => "$(d)"; - xdev => "true"; + depth => "$(d)"; + xdev => "true"; } body action test_immediate { - ifelapsed => "0"; + ifelapsed => "0"; } body copy_from test_sync(from) { - source => "$(from)"; - purge => "true"; - preserve => "false"; - type_check => "false"; - compare => "digest"; + source => "$(from)"; + purge => "true"; + preserve => "false"; + type_check => "false"; + compare => "digest"; } ####################################################### - bundle agent check { classes: - "ok_copy" expression => fileexists("$(G.testfile)/dest/1/2/3"); - "ok_purge" not => fileexists("$(G.testfile)/dest/1/2/should-be-removed"); - "bad_copy" not => fileexists("$(G.testfile)/dest/1/2/3"); - "bad_purge" expression => fileexists("$(G.testfile)/dest/1/2/should-be-removed"); + "ok_copy" expression => fileexists("$(G.testfile)/dest/1/2/3"); + "ok_purge" not => fileexists("$(G.testfile)/dest/1/2/should-be-removed"); + "bad_copy" not => fileexists("$(G.testfile)/dest/1/2/3"); + + "bad_purge" + expression => fileexists("$(G.testfile)/dest/1/2/should-be-removed"); - "ok" and => { ok_copy, ok_purge }; + "ok" and => { ok_copy, ok_purge }; reports: DEBUG:: @@ -98,8 +91,10 @@ bundle agent check "The purge worked" if => "ok_purge"; "The copy failed" if => "bad_copy"; "The purge failed" if => "bad_purge"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/directory_with_trailing_slash.cf b/tests/acceptance/10_files/01_create/directory_with_trailing_slash.cf index 67acca2daf..1deb91bc47 100644 --- a/tests/acceptance/10_files/01_create/directory_with_trailing_slash.cf +++ b/tests/acceptance/10_files/01_create/directory_with_trailing_slash.cf @@ -3,48 +3,48 @@ # Redmine#3905: Create a directory, set permissions using a trailing slash # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; vars: - "mode" string => "751"; + "mode" string => "751"; methods: - "1" usebundle => test1; # create the directory - "1" usebundle => test2($(mode)); # promise the directory with a trailing slash + "1" usebundle => test1; + + # create the directory + "1" usebundle => test2($(mode)); + + # promise the directory with a trailing slash } bundle agent test1 { files: - "$(G.testfile)/." + "$(G.testfile)/." create => "true", perms => test_perms("700"); } @@ -52,31 +52,31 @@ bundle agent test1 bundle agent test2(mode) { files: - "$(G.testfile)/" - perms => test_perms($(mode)); + "$(G.testfile)/" perms => test_perms($(mode)); } body perms test_perms(m) { - mode => "$(m)"; + mode => "$(m)"; } ####################################################### - bundle agent check { vars: - "result" string => filestat($(G.testfile), "permoct"); + "result" string => filestat($(G.testfile), "permoct"); classes: - "ok" expression => strcmp($(test.mode), "$(result)"); + "ok" expression => strcmp($(test.mode), "$(result)"); reports: DEBUG:: "expected: '$(test.mode)'"; "got: '$(result)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/mustache_create_by_default.cf b/tests/acceptance/10_files/01_create/mustache_create_by_default.cf index 8284660292..9adab32490 100644 --- a/tests/acceptance/10_files/01_create/mustache_create_by_default.cf +++ b/tests/acceptance/10_files/01_create/mustache_create_by_default.cf @@ -5,147 +5,138 @@ # is not kept. # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } ############################################################################## - bundle agent init { vars: - "range" - slist => { expandrange("[1-8]", 1) }; + "range" slist => { expandrange("[1-8]", 1) }; files: - "$(G.testfile).test_$(range)" - delete => tidy; - - "$(G.testfile).valid_template" - content => "Hello {{{name}}}"; - - "$(G.testfile).invalid_template" - content => "Hello {{{name"; + "$(G.testfile).test_$(range)" delete => tidy; + "$(G.testfile).valid_template" content => "Hello {{{name}}}"; + "$(G.testfile).invalid_template" content => "Hello {{{name"; } ############################################################################## - bundle agent test { meta: - "description" -> { "ENT-4792" } - string => "mustache and inline_mustache creates promiser by default"; + "description" -> { "ENT-4792" } + string => "mustache and inline_mustache creates promiser by default"; vars: - "d" - data => '{ "name": "Lars" }'; + "d" data => '{ "name": "Lars" }'; files: # File should be created by default - "$(G.testfile).test_1" - template_method => "mustache", - edit_template => "$(G.testfile).valid_template", - if => fileexists("$(G.testfile).valid_template"), - template_data => @(d); + "$(G.testfile).test_1" + template_method => "mustache", + edit_template => "$(G.testfile).valid_template", + if => fileexists("$(G.testfile).valid_template"), + template_data => @(d); # File should not be created due to invalid template - "$(G.testfile).test_2" - template_method => "mustache", - edit_template => "$(G.testfile).invalid_template", - if => fileexists("$(G.testfile).invalid_template"), - template_data => @(d); + "$(G.testfile).test_2" + template_method => "mustache", + edit_template => "$(G.testfile).invalid_template", + if => fileexists("$(G.testfile).invalid_template"), + template_data => @(d); # File should be created even though template is invalid - "$(G.testfile).test_3" - create => "true", - template_method => "mustache", - edit_template => "$(G.testfile).invalid_template", - if => fileexists("$(G.testfile).invalid_template"), - template_data => @(d); + "$(G.testfile).test_3" + create => "true", + template_method => "mustache", + edit_template => "$(G.testfile).invalid_template", + if => fileexists("$(G.testfile).invalid_template"), + template_data => @(d); # File should not be created even though template is valid - "$(G.testfile).test_4" - create => "false", - template_method => "mustache", - edit_template => "$(G.testfile).valid_template", - if => fileexists("$(G.testfile).valid_template"), - template_data => @(d); + "$(G.testfile).test_4" + create => "false", + template_method => "mustache", + edit_template => "$(G.testfile).valid_template", + if => fileexists("$(G.testfile).valid_template"), + template_data => @(d); # File should be created by default - "$(G.testfile).test_5" - template_method => "inline_mustache", - edit_template_string => readfile("$(G.testfile).valid_template"), - if => fileexists("$(G.testfile).valid_template"), - template_data => @(d); + "$(G.testfile).test_5" + template_method => "inline_mustache", + edit_template_string => readfile("$(G.testfile).valid_template"), + if => fileexists("$(G.testfile).valid_template"), + template_data => @(d); # File should not be created due to invalid template - "$(G.testfile).test_6" - template_method => "inline_mustache", - edit_template_string => readfile("$(G.testfile).invalid_template"), - if => fileexists("$(G.testfile).invalid_template"), - template_data => @(d); + "$(G.testfile).test_6" + template_method => "inline_mustache", + edit_template_string => readfile("$(G.testfile).invalid_template"), + if => fileexists("$(G.testfile).invalid_template"), + template_data => @(d); # File should be created even though template is invalid - "$(G.testfile).test_7" - create => "true", - template_method => "inline_mustache", - edit_template_string => readfile("$(G.testfile).invalid_template"), - if => fileexists("$(G.testfile).invalid_template"), - template_data => @(d); + "$(G.testfile).test_7" + create => "true", + template_method => "inline_mustache", + edit_template_string => readfile("$(G.testfile).invalid_template"), + if => fileexists("$(G.testfile).invalid_template"), + template_data => @(d); # File should not be created even though template is valid - "$(G.testfile).test_8" - create => "false", - template_method => "inline_mustache", - edit_template_string => readfile("$(G.testfile).valid_template"), - if => fileexists("$(G.testfile).valid_template"), - template_data => @(d); + "$(G.testfile).test_8" + create => "false", + template_method => "inline_mustache", + edit_template_string => readfile("$(G.testfile).valid_template"), + if => fileexists("$(G.testfile).valid_template"), + template_data => @(d); } ############################################################################## - bundle agent check { vars: # Get lists of successful / failed checks so we can report them - "checks" - slist => { expandrange("check_[1-8]", 1) }; - "successful_checks" - slist => sort(classesmatching("check_[1-8]"), "lex"); - "failed_checks" - slist => sort(difference("checks", "successful_checks"), "lex"); + "checks" slist => { expandrange("check_[1-8]", 1) }; + "successful_checks" slist => sort(classesmatching("check_[1-8]"), "lex"); + + "failed_checks" + slist => sort(difference("checks", "successful_checks"), "lex"); classes: - "check_1" - expression => fileexists("$(G.testfile).test_1"); - "check_2" - expression => not(fileexists("$(G.testfile).test_2")); - "check_3" - expression => fileexists("$(G.testfile).test_3"); - "check_4" - expression => not(fileexists("$(G.testfile).test_4")); - "check_5" - expression => fileexists("$(G.testfile).test_5"); - "check_6" - expression => not(fileexists("$(G.testfile).test_6")); - "check_7" - expression => fileexists("$(G.testfile).test_7"); - "check_8" - expression => not(fileexists("$(G.testfile).test_8")); - "ok" - expression => and("check_1", "check_2", "check_3", "check_4", - "check_5", "check_6", "check_7", "check_8"); + "check_1" expression => fileexists("$(G.testfile).test_1"); + "check_2" expression => not(fileexists("$(G.testfile).test_2")); + "check_3" expression => fileexists("$(G.testfile).test_3"); + "check_4" expression => not(fileexists("$(G.testfile).test_4")); + "check_5" expression => fileexists("$(G.testfile).test_5"); + "check_6" expression => not(fileexists("$(G.testfile).test_6")); + "check_7" expression => fileexists("$(G.testfile).test_7"); + "check_8" expression => not(fileexists("$(G.testfile).test_8")); + + "ok" + expression => and( + "check_1", + "check_2", + "check_3", + "check_4", + "check_5", + "check_6", + "check_7", + "check_8" + ); reports: DEBUG:: "'$(successful_checks)' succeded!"; "'$(failed_checks)' failed!"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/01_create/perms-mode.cf b/tests/acceptance/10_files/01_create/perms-mode.cf index cf8c5c2b13..31ff6d1744 100644 --- a/tests/acceptance/10_files/01_create/perms-mode.cf +++ b/tests/acceptance/10_files/01_create/perms-mode.cf @@ -3,47 +3,79 @@ # Redmine #4791: body perms mode # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; vars: freebsd|solaris:: - "modes" slist => { "1", "333", "100", "200", "777", "o=x", "ugo=wx", "u=x", "u=w", "ugo=rwx" }; + "modes" + slist => { + "1", + "333", + "100", + "200", + "777", + "o=x", + "ugo=wx", + "u=x", + "u=w", + "ugo=rwx", + }; + !freebsd.!solaris:: - "modes" slist => { "1", "333", "100", "200", "777", "1111", "1010", "13400", "22222", "o=x", "ugo=wx", "u=x", "u=w", "ugo=rwx" }; + "modes" + slist => { + "1", + "333", + "100", + "200", + "777", + "1111", + "1010", + "13400", + "22222", + "o=x", + "ugo=wx", + "u=x", + "u=w", + "ugo=rwx", + }; files: - "$(G.testdir)/$(modes)" + "$(G.testdir)/$(modes)" create => "true", perms => test_mode($(modes)); } body perms test_mode(m) { - mode => "$(m)"; + mode => "$(m)"; } bundle agent check { vars: - "modes" slist => { @(test.modes) }; + "modes" slist => { @(test.modes) }; + windows:: "win_r" string => "100444"; "win_w" string => "100666"; - "expected" data => parsejson(' + + "expected" + data => parsejson( + ' { "1": "$(win_r)", "333": "$(win_w)", @@ -59,10 +91,13 @@ bundle agent check "u=x": "$(win_r)", "u=w": "$(win_w)", "ugo=rwx": "$(win_w)", -}'); +}' + ); freebsd|solaris:: - "expected" data => parsejson(' + "expected" + data => parsejson( + ' { "1": "100001", "333": "100333", @@ -74,10 +109,13 @@ bundle agent check "u=x": "100100", "u=w": "100200", "ugo=rwx": "100777", -}'); +}' + ); !freebsd.!solaris.!windows:: - "expected" data => parsejson(' + "expected" + data => parsejson( + ' { "1": "100001", "333": "100333", @@ -93,27 +131,62 @@ bundle agent check "u=x": "100100", "u=w": "100200", "ugo=rwx": "100777", -}'); +}' + ); any:: "actual[$(modes)]" string => filestat("$(G.testdir)/$(modes)", "modeoct"); "canonified[$(modes)]" string => canonify("$(modes)"); classes: - "ok_$(canonified[$(modes)])" expression => strcmp("$(expected[$(modes)])", "$(actual[$(modes)])"); + "ok_$(canonified[$(modes)])" + expression => strcmp("$(expected[$(modes)])", "$(actual[$(modes)])"); - freebsd|solaris:: - "ok" and => { "ok_1", "ok_333", "ok_100", "ok_200", "ok_777", classify("ok_o=x"), classify("ok_ugo=wx"), classify("ok_u=x"), classify("ok_u=w"), classify("ok_ugo=rwx") }; + freebsd|solaris:: + "ok" + and => { + "ok_1", + "ok_333", + "ok_100", + "ok_200", + "ok_777", + classify("ok_o=x"), + classify("ok_ugo=wx"), + classify("ok_u=x"), + classify("ok_u=w"), + classify("ok_ugo=rwx"), + }; - !freebsd.!solaris:: - "ok" and => { "ok_1", "ok_333", "ok_100", "ok_200", "ok_777", "ok_1111", "ok_1010", "ok_13400", "ok_22222", classify("ok_o=x"), classify("ok_ugo=wx"), classify("ok_u=x"), classify("ok_u=w"), classify("ok_ugo=rwx") }; + !freebsd.!solaris:: + "ok" + and => { + "ok_1", + "ok_333", + "ok_100", + "ok_200", + "ok_777", + "ok_1111", + "ok_1010", + "ok_13400", + "ok_22222", + classify("ok_o=x"), + classify("ok_ugo=wx"), + classify("ok_u=x"), + classify("ok_u=w"), + classify("ok_ugo=rwx"), + }; reports: DEBUG:: - "Permission $(modes) worked, got $(expected[$(modes)])" if => "ok_$(canonified[$(modes)])"; - "Permission $(modes) failed, expected $(expected[$(modes)]) != actual $(actual[$(modes)])" if => "!ok_$(canonified[$(modes)])"; + "Permission $(modes) worked, got $(expected[$(modes)])" + if => "ok_$(canonified[$(modes)])"; + + "Permission $(modes) failed, expected $(expected[$(modes)]) != actual $(actual[$(modes)])" + if => "!ok_$(canonified[$(modes)])"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/001.cf b/tests/acceptance/10_files/02_maintain/001.cf index 405af8791b..9034ed4785 100644 --- a/tests/acceptance/10_files/02_maintain/001.cf +++ b/tests/acceptance/10_files/02_maintain/001.cf @@ -3,38 +3,34 @@ # Create a file, expect simultaneous copy with default compare to fail # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" int => "600"; + "mode" int => "600"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms($(mode)), copy_from => test_copy; @@ -42,18 +38,17 @@ bundle agent test body copy_from test_copy { - source => "$(G.etc_group)"; + source => "$(G.etc_group)"; } body perms test_perms(m) { - mode => "$(m)"; - owners => { "0" }; - groups => { "0" }; + mode => "$(m)"; + owners => { "0" }; + groups => { "0" }; } ####################################################### - bundle agent check { vars: @@ -61,22 +56,24 @@ bundle agent check "expect[permoct]" string => "$(test.mode)"; "expect[uid]" string => "0"; "expect[gid]" string => "0"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/002.cf b/tests/acceptance/10_files/02_maintain/002.cf index ad4993f339..0b0b203ff3 100644 --- a/tests/acceptance/10_files/02_maintain/002.cf +++ b/tests/acceptance/10_files/02_maintain/002.cf @@ -3,38 +3,34 @@ # Create a file, expect simultaneous copy with mtime compare to fail # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" int => "0600"; + "mode" int => "0600"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms($(mode)), copy_from => test_copy; @@ -42,19 +38,18 @@ bundle agent test body copy_from test_copy { - source => "$(G.etc_group)"; - compare => "mtime"; + source => "$(G.etc_group)"; + compare => "mtime"; } body perms test_perms(m) { - mode => "$(m)"; - owners => { "0" }; - groups => { "0" }; + mode => "$(m)"; + owners => { "0" }; + groups => { "0" }; } ####################################################### - bundle agent check { vars: @@ -62,22 +57,24 @@ bundle agent check "expect[permoct]" string => "$(test.mode)"; "expect[uid]" string => "0"; "expect[gid]" string => "0"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/003.cf b/tests/acceptance/10_files/02_maintain/003.cf index 19d5bc9542..7e1e77e419 100644 --- a/tests/acceptance/10_files/02_maintain/003.cf +++ b/tests/acceptance/10_files/02_maintain/003.cf @@ -3,38 +3,34 @@ # Create a file, expect simultaneous copy with ctime compare to fail # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" int => "0600"; + "mode" int => "0600"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms($(mode)), copy_from => test_copy; @@ -42,19 +38,18 @@ bundle agent test body copy_from test_copy { - source => "$(G.etc_group)"; - compare => "ctime"; + source => "$(G.etc_group)"; + compare => "ctime"; } body perms test_perms(m) { - mode => "$(m)"; - owners => { "0" }; - groups => { "0" }; + mode => "$(m)"; + owners => { "0" }; + groups => { "0" }; } ####################################################### - bundle agent check { vars: @@ -62,22 +57,24 @@ bundle agent check "expect[permoct]" string => "$(test.mode)"; "expect[uid]" string => "0"; "expect[gid]" string => "0"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/004.cf b/tests/acceptance/10_files/02_maintain/004.cf index cfd97f8438..37f85e204e 100644 --- a/tests/acceptance/10_files/02_maintain/004.cf +++ b/tests/acceptance/10_files/02_maintain/004.cf @@ -4,38 +4,34 @@ # but not change owner/group # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" string => filestat("$(G.etc_group)", "modeoct"); + "mode" string => filestat("$(G.etc_group)", "modeoct"); files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_og, copy_from => test_copy; @@ -43,19 +39,18 @@ bundle agent test body perms test_og { - owners => { "3" }; - groups => { "3" }; + owners => { "3" }; + groups => { "3" }; } body copy_from test_copy { - preserve => "true"; - source => "$(G.etc_group)"; - compare => "atime"; + preserve => "true"; + source => "$(G.etc_group)"; + compare => "atime"; } ####################################################### - bundle agent check { vars: @@ -63,22 +58,24 @@ bundle agent check "expect[modeoct]" string => "$(test.mode)"; "expect[uid]" string => "3"; "expect[gid]" string => "3"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => filestat("$(G.etc_group)", "size"); - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/005.cf b/tests/acceptance/10_files/02_maintain/005.cf index fef9c2dd8d..d0e7a1e574 100644 --- a/tests/acceptance/10_files/02_maintain/005.cf +++ b/tests/acceptance/10_files/02_maintain/005.cf @@ -4,36 +4,33 @@ # but not change owner/group # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" string => filestat("$(G.etc_group)", "modeoct"); + "mode" string => filestat("$(G.etc_group)", "modeoct"); files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_og, copy_from => test_copy; @@ -41,19 +38,18 @@ bundle agent test body perms test_og { - owners => { "3" }; - groups => { "3" }; + owners => { "3" }; + groups => { "3" }; } body copy_from test_copy { - preserve => "true"; - source => "$(G.etc_group)"; - compare => "hash"; + preserve => "true"; + source => "$(G.etc_group)"; + compare => "hash"; } ####################################################### - bundle agent check { vars: @@ -61,22 +57,24 @@ bundle agent check "expect[modeoct]" string => "$(test.mode)"; "expect[uid]" string => "3"; "expect[gid]" string => "3"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => filestat("$(G.etc_group)", "size"); - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/006.cf b/tests/acceptance/10_files/02_maintain/006.cf index 8bdac10f73..4af1533e65 100644 --- a/tests/acceptance/10_files/02_maintain/006.cf +++ b/tests/acceptance/10_files/02_maintain/006.cf @@ -4,38 +4,34 @@ # but not change owner/group # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" string => filestat("$(G.etc_group)", "modeoct"); + "mode" string => filestat("$(G.etc_group)", "modeoct"); files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_og, copy_from => test_copy; @@ -43,19 +39,18 @@ bundle agent test body perms test_og { - owners => { "3" }; - groups => { "3" }; + owners => { "3" }; + groups => { "3" }; } body copy_from test_copy { - preserve => "true"; - source => "$(G.etc_group)"; - compare => "digest"; + preserve => "true"; + source => "$(G.etc_group)"; + compare => "digest"; } ####################################################### - bundle agent check { vars: @@ -63,22 +58,24 @@ bundle agent check "expect[modeoct]" string => "$(test.mode)"; "expect[uid]" string => "3"; "expect[gid]" string => "3"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => filestat("$(G.etc_group)", "size"); - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/007.cf b/tests/acceptance/10_files/02_maintain/007.cf index 3e995a7fb3..6d082a0387 100644 --- a/tests/acceptance/10_files/02_maintain/007.cf +++ b/tests/acceptance/10_files/02_maintain/007.cf @@ -4,40 +4,35 @@ # but not change owner/group # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - "$(G.testdir)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; + "$(G.testdir)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" string => filestat("$(G.etc_group)", "modeoct"); + "mode" string => filestat("$(G.etc_group)", "modeoct"); files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_og, copy_from => test_copy; @@ -45,18 +40,17 @@ bundle agent test body perms test_og { - owners => { "3" }; - groups => { "3" }; + owners => { "3" }; + groups => { "3" }; } body copy_from test_copy { - source => "$(G.etc_group)"; - compare => "binary"; + source => "$(G.etc_group)"; + compare => "binary"; } ####################################################### - bundle agent check { vars: @@ -64,22 +58,24 @@ bundle agent check "expect[modeoct]" string => "$(test.mode)"; "expect[uid]" string => "3"; "expect[gid]" string => "3"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => filestat("$(G.etc_group)", "size"); - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testdir)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/008.cf b/tests/acceptance/10_files/02_maintain/008.cf index 233268c85a..0162ca5de8 100644 --- a/tests/acceptance/10_files/02_maintain/008.cf +++ b/tests/acceptance/10_files/02_maintain/008.cf @@ -3,38 +3,34 @@ # Create a file, expect simultaneous copy with exists compare to fail # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" int => "0600"; + "mode" int => "0600"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms($(mode)), copy_from => test_copy; @@ -42,19 +38,18 @@ bundle agent test body copy_from test_copy { - source => "$(G.etc_group)"; - compare => "exists"; + source => "$(G.etc_group)"; + compare => "exists"; } body perms test_perms(m) { - mode => "$(m)"; - owners => { "0" }; - groups => { "0" }; + mode => "$(m)"; + owners => { "0" }; + groups => { "0" }; } ####################################################### - bundle agent check { vars: @@ -62,22 +57,24 @@ bundle agent check "expect[permoct]" string => "$(test.mode)"; "expect[uid]" string => "0"; "expect[gid]" string => "0"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/009.cf b/tests/acceptance/10_files/02_maintain/009.cf index 364dd11e56..4ba8939e91 100644 --- a/tests/acceptance/10_files/02_maintain/009.cf +++ b/tests/acceptance/10_files/02_maintain/009.cf @@ -3,66 +3,65 @@ # Test that copying file by relative symlink works # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testdir)/linkdir/" - comment => "Create a directory."; - "$(G.testdir)/linkdir/another/" - comment => "Create another directory."; - "$(G.testdir)/linkdir/another/target" + "$(G.testdir)/linkdir/" comment => "Create a directory."; + "$(G.testdir)/linkdir/another/" comment => "Create another directory."; + + "$(G.testdir)/linkdir/another/target" comment => "A target file.", create => "true"; - "$(G.testdir)/linkdir/link" + + "$(G.testdir)/linkdir/link" comment => "Create a relative link to the target.", link_from => ln_s("$(G.testdir)/linkdir/another/target"); } ####################################################### - bundle agent test { vars: - "mode" int => "0600"; + "mode" int => "0600"; files: - "$(G.testdir)/copy_file" + "$(G.testdir)/copy_file" comment => "Copy the file behind the link.", perms => test_perms($(mode)), copy_from => cp_2_file("$(G.testdir)/linkdir/link"); } -body link_from ln_s(x) { - link_type => "relative"; - source => "$(x)"; - when_no_source => "nop"; +body link_from ln_s(x) +{ + link_type => "relative"; + source => "$(x)"; + when_no_source => "nop"; } -body copy_from cp_2_file(x) { - source => "$(x)"; - compare => "binary"; - copy_backup => "false"; - copylink_patterns => { ".*" }; +body copy_from cp_2_file(x) +{ + source => "$(x)"; + compare => "binary"; + copy_backup => "false"; + copylink_patterns => { ".*" }; } -body perms test_perms(m) { - mode => "$(m)"; - owners => { "0" }; - groups => { "0" }; +body perms test_perms(m) +{ + mode => "$(m)"; + owners => { "0" }; + groups => { "0" }; } ####################################################### - bundle agent check { vars: @@ -70,24 +69,31 @@ bundle agent check "expect[modeoct]" string => "\d+$(test.mode)"; "expect[uid]" string => "0"; "expect[gid]" string => "0"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); - "result[$(fields)]" string => filestat("$(G.testfile)$(const.dirsep)copy_file", "$(fields)"); + + "result[$(fields)]" + string => filestat( + "$(G.testfile)$(const.dirsep)copy_file", "$(fields)" + ); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/02_maintain/010.cf b/tests/acceptance/10_files/02_maintain/010.cf index 0b2225aa4e..e90da3f225 100644 --- a/tests/acceptance/10_files/02_maintain/010.cf +++ b/tests/acceptance/10_files/02_maintain/010.cf @@ -3,44 +3,40 @@ # Test that symlinks are set aside while copying trees of directories (Issue 569) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testdir)/srcdir/foo" - create => "true"; - "$(G.testdir)/realdestdir/" - create => "true"; - "$(G.testdir)/destdir" + "$(G.testdir)/srcdir/foo" create => "true"; + "$(G.testdir)/realdestdir/" create => "true"; + + "$(G.testdir)/destdir" comment => "Create a relative link to the target.", link_from => ln_s("$(G.testdir)/realdestdir"); } - -body link_from ln_s(x) { - link_type => "relative"; - source => "$(x)"; - when_no_source => "nop"; +body link_from ln_s(x) +{ + link_type => "relative"; + source => "$(x)"; + when_no_source => "nop"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; files: - "$(G.testdir)/destdir/" + "$(G.testdir)/destdir/" copy_from => test_sync_cp("$(G.testdir)/srcdir"), depth_search => recurse("inf"), move_obstructions => "true", @@ -49,31 +45,33 @@ bundle agent test body copy_from test_sync_cp(from) { - source => "$(from)"; - purge => "true"; - preserve => "true"; - type_check => "true"; + source => "$(from)"; + purge => "true"; + preserve => "true"; + type_check => "true"; } ####################################################### - bundle agent check { vars: - "expect" string => "directory"; - "result" string => filestat("$(G.testdir)/destdir", "type"); + "expect" string => "directory"; + "result" string => filestat("$(G.testdir)/destdir", "type"); classes: - "ok" expression => strcmp("$(expect)", "$(result)"); + "ok" expression => strcmp("$(expect)", "$(result)"); reports: DEBUG:: "expected: '$(expect)'"; "got: '$(result)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/02_maintain/011.cf b/tests/acceptance/10_files/02_maintain/011.cf index dc651c6130..5bd95ae165 100644 --- a/tests/acceptance/10_files/02_maintain/011.cf +++ b/tests/acceptance/10_files/02_maintain/011.cf @@ -3,73 +3,70 @@ # Test that symlinks outside of copying root are NOT set aside while copying trees of directorise (Issue 585) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testdir)/srcdir/" - create => "true"; - "$(G.testdir)/srcdir/foo" - create => "true"; - "$(G.testdir)/realdestdir/" - create => "true"; - "$(G.testdir)/destdir" + "$(G.testdir)/srcdir/" create => "true"; + "$(G.testdir)/srcdir/foo" create => "true"; + "$(G.testdir)/realdestdir/" create => "true"; + + "$(G.testdir)/destdir" comment => "Create a relative link to the target.", link_from => ln_s("$(G.testdir)/realdestdir"); } - -body link_from ln_s(x) { - link_type => "relative"; - source => "$(x)"; - when_no_source => "nop"; +body link_from ln_s(x) +{ + link_type => "relative"; + source => "$(x)"; + when_no_source => "nop"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; files: - "$(G.testdir)/destdir/foo" + "$(G.testdir)/destdir/foo" copy_from => test_sync_cp("$(G.testdir)/srcdir/foo"); } body copy_from test_sync_cp(from) { - source => "$(from)"; + source => "$(from)"; } ####################################################### - bundle agent check { vars: - "expect" string => "symlink"; - "result" string => filestat("$(G.testdir)/destdir", "type"); + "expect" string => "symlink"; + "result" string => filestat("$(G.testdir)/destdir", "type"); classes: - "ok" expression => strcmp("$(expect)", "$(result)"); + "ok" expression => strcmp("$(expect)", "$(result)"); reports: DEBUG:: "expected: '$(expect)'"; "got: '$(result)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/02_maintain/012.cf b/tests/acceptance/10_files/02_maintain/012.cf index 7ec8384ef9..ad8aa71ef7 100644 --- a/tests/acceptance/10_files/02_maintain/012.cf +++ b/tests/acceptance/10_files/02_maintain/012.cf @@ -1,80 +1,74 @@ ####################################################### # -# -# ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testdir)/srcdir/" - create => "true"; - "$(G.testdir)/srcdir/intermediate/" - create => "true"; - "$(G.testdir)/srcdir/intermediate/intermediate2/" - create => "true"; - "$(G.testdir)/srcdir/intermediate/intermediate2/foo" - create => "true"; + "$(G.testdir)/srcdir/" create => "true"; + "$(G.testdir)/srcdir/intermediate/" create => "true"; + "$(G.testdir)/srcdir/intermediate/intermediate2/" create => "true"; + "$(G.testdir)/srcdir/intermediate/intermediate2/foo" create => "true"; + "$(G.testdir)/realdestdir/" create => "true"; - "$(G.testdir)/realdestdir/" - create => "true"; - "$(G.testdir)/destdir" + "$(G.testdir)/destdir" comment => "Create a relative link to the target.", link_from => ln_s("$(G.testdir)/realdestdir"); } - -body link_from ln_s(x) { - link_type => "relative"; - source => "$(x)"; - when_no_source => "nop"; +body link_from ln_s(x) +{ + link_type => "relative"; + source => "$(x)"; + when_no_source => "nop"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; files: - "$(G.testdir)/destdir/intermediate/intermediate2/foo" - copy_from => test_sync_cp("$(G.testdir)/srcdir/intermediate/intermediate2/foo"); + "$(G.testdir)/destdir/intermediate/intermediate2/foo" + copy_from => test_sync_cp( + "$(G.testdir)/srcdir/intermediate/intermediate2/foo" + ); } body copy_from test_sync_cp(from) { - source => "$(from)"; + source => "$(from)"; } ####################################################### - bundle agent check { vars: - "expect" string => "symlink"; - "result" string => filestat("$(G.testdir)/destdir", "type"); + "expect" string => "symlink"; + "result" string => filestat("$(G.testdir)/destdir", "type"); classes: - "ok" expression => strcmp("$(expect)", "$(result)"); + "ok" expression => strcmp("$(expect)", "$(result)"); reports: DEBUG:: "expected: '$(expect)'"; "got: '$(result)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/02_maintain/013.cf b/tests/acceptance/10_files/02_maintain/013.cf index 8d2fc3543d..a8a8ae2e8a 100644 --- a/tests/acceptance/10_files/02_maintain/013.cf +++ b/tests/acceptance/10_files/02_maintain/013.cf @@ -1,83 +1,75 @@ ####################################################### # -# -# ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testdir)/srcdir/" - create => "true"; - "$(G.testdir)/srcdir/intermediate/" - create => "true"; - "$(G.testdir)/srcdir/intermediate/intermediate2/" - create => "true"; - "$(G.testdir)/srcdir/intermediate/intermediate2/foo" - create => "true"; + "$(G.testdir)/srcdir/" create => "true"; + "$(G.testdir)/srcdir/intermediate/" create => "true"; + "$(G.testdir)/srcdir/intermediate/intermediate2/" create => "true"; + "$(G.testdir)/srcdir/intermediate/intermediate2/foo" create => "true"; + "$(G.testdir)/realdestdir/" create => "true"; - "$(G.testdir)/realdestdir/" - create => "true"; - "$(G.testdir)/destdir" + "$(G.testdir)/destdir" comment => "Create a relative link to the target.", link_from => ln_s("$(G.testdir)/realdestdir"); } - -body link_from ln_s(x) { - link_type => "relative"; - source => "$(x)"; - when_no_source => "nop"; +body link_from ln_s(x) +{ + link_type => "relative"; + source => "$(x)"; + when_no_source => "nop"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; files: - "$(G.testdir)/destdir" + "$(G.testdir)/destdir" copy_from => test_sync_cp("$(G.testdir)/srcdir"), depth_search => recurse("inf"); } body copy_from test_sync_cp(from) { - source => "$(from)"; - purge => "true"; - preserve => "true"; + source => "$(from)"; + purge => "true"; + preserve => "true"; } ####################################################### - bundle agent check { vars: - "expect" string => "symlink"; - "result" string => filestat("$(G.testdir)/destdir", "type"); + "expect" string => "symlink"; + "result" string => filestat("$(G.testdir)/destdir", "type"); classes: - "ok" expression => strcmp("$(expect)", "$(result)"); + "ok" expression => strcmp("$(expect)", "$(result)"); reports: DEBUG:: "expected: '$(expect)'"; "got: '$(result)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/02_maintain/015.cf b/tests/acceptance/10_files/02_maintain/015.cf index eb327a409f..13936218a0 100644 --- a/tests/acceptance/10_files/02_maintain/015.cf +++ b/tests/acceptance/10_files/02_maintain/015.cf @@ -3,48 +3,45 @@ # Test that we can supply relative filename to link_from # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { files: - "$(G.testdir)/destdir" - link_from => sync_cp("./srcdirrr"); + "$(G.testdir)/destdir" link_from => sync_cp("./srcdirrr"); } body link_from sync_cp(from) { - source => "$(from)"; + source => "$(from)"; } ####################################################### - bundle agent check { classes: - "ok" expression => "any"; + "ok" expression => "any"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/02_maintain/016.cf b/tests/acceptance/10_files/02_maintain/016.cf index 83a03f64f2..3a796ac853 100644 --- a/tests/acceptance/10_files/02_maintain/016.cf +++ b/tests/acceptance/10_files/02_maintain/016.cf @@ -3,65 +3,61 @@ # Test that timestamped copying adds .cfsaved suffix (Issue 666) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testdir)/afile" - create => "true"; + "$(G.testdir)/afile" create => "true"; - # We can't use files promise here as it will remember we have created the file - # and will not generate backup file which we are trying to get. + # We can't use files promise here as it will remember we have created the file + # and will not generate backup file which we are trying to get. commands: - "$(G.echo) LimpBizkit > $(G.testdir)/destfile" - contain => shell; + "$(G.echo) LimpBizkit > $(G.testdir)/destfile" contain => shell; } body contain shell { - useshell => "true"; + useshell => "true"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; files: - "$(G.testdir)/destfile" - copy_from => cp_2_file("$(G.testdir)/afile"); + "$(G.testdir)/destfile" copy_from => cp_2_file("$(G.testdir)/afile"); } -body copy_from cp_2_file(x) { - source => "$(x)"; - copy_backup => "timestamp"; - compare => "digest"; +body copy_from cp_2_file(x) +{ + source => "$(x)"; + copy_backup => "timestamp"; + compare => "digest"; } ####################################################### - bundle agent check { files: - "$(G.testdir)/destfile.*\.cfsaved" + "$(G.testdir)/destfile.*\.cfsaved" touch => "true", classes => if_repaired("ok"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/017.cf b/tests/acceptance/10_files/02_maintain/017.cf index dd8c627b02..3c16d4f743 100644 --- a/tests/acceptance/10_files/02_maintain/017.cf +++ b/tests/acceptance/10_files/02_maintain/017.cf @@ -3,28 +3,25 @@ # Test that copy_from body with source does not crash (Issue 687) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { files: - "$(G.testdir)/." + "$(G.testdir)/." create => "true", move_obstructions => "true", copy_from => update_nobackup; @@ -32,16 +29,16 @@ bundle agent test body copy_from update_nobackup() { - copy_backup => "false"; + copy_backup => "false"; } ####################################################### - bundle agent check { reports: cfengine_3:: "$(this.promise_filename) Pass"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/02_maintain/018.cf b/tests/acceptance/10_files/02_maintain/018.cf index 7b58b3fb51..20822acd7a 100644 --- a/tests/acceptance/10_files/02_maintain/018.cf +++ b/tests/acceptance/10_files/02_maintain/018.cf @@ -3,62 +3,61 @@ # Test that disable_mode => "000" in body rename works (Issue 688) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; files: - "$(G.testfile)" - rename => disable_file; + "$(G.testfile)" rename => disable_file; } -body rename disable_file { - disable_mode => "000"; - disable => "true"; +body rename disable_file +{ + disable_mode => "000"; + disable => "true"; } ####################################################### - bundle agent check { vars: - "expect[permoct]" string => "0"; - "expect[nlink]" string => "1"; + "expect[permoct]" string => "0"; + "expect[nlink]" string => "1"; + "fields" slist => getindices("expect"); - "fields" slist => getindices("expect"); - "result[$(fields)]" string => filestat("$(G.testfile).cfdisabled", "$(fields)"); + "result[$(fields)]" + string => filestat("$(G.testfile).cfdisabled", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } + ## PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/02_maintain/019.cf b/tests/acceptance/10_files/02_maintain/019.cf index 5cbe1a4772..33b1e78f3d 100644 --- a/tests/acceptance/10_files/02_maintain/019.cf +++ b/tests/acceptance/10_files/02_maintain/019.cf @@ -3,62 +3,61 @@ # Test that disable_mode => "333" in body rename works (Issue 688) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; files: - "$(G.testfile)" - rename => disable_file; + "$(G.testfile)" rename => disable_file; } -body rename disable_file { - disable_mode => "333"; - disable => "true"; +body rename disable_file +{ + disable_mode => "333"; + disable => "true"; } ####################################################### - bundle agent check { vars: - "expect[permoct]" string => "333"; - "expect[nlink]" string => "1"; + "expect[permoct]" string => "333"; + "expect[nlink]" string => "1"; + "fields" slist => getindices("expect"); - "fields" slist => getindices("expect"); - "result[$(fields)]" string => filestat("$(G.testfile).cfdisabled", "$(fields)"); + "result[$(fields)]" + string => filestat("$(G.testfile).cfdisabled", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/02_maintain/101.cf b/tests/acceptance/10_files/02_maintain/101.cf index addbc4677f..6ee3cd5fda 100644 --- a/tests/acceptance/10_files/02_maintain/101.cf +++ b/tests/acceptance/10_files/02_maintain/101.cf @@ -3,38 +3,34 @@ # Create a file, expect simultaneous default link to fail # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" int => "0600"; + "mode" int => "0600"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms($(mode)), link_from => test_link; @@ -42,18 +38,17 @@ bundle agent test body link_from test_link { - source => "$(G.etc_group)"; + source => "$(G.etc_group)"; } body perms test_perms(m) { - mode => "$(m)"; - owners => { "0" }; - groups => { "0" }; + mode => "$(m)"; + owners => { "0" }; + groups => { "0" }; } ####################################################### - bundle agent check { vars: @@ -61,22 +56,24 @@ bundle agent check "expect[permoct]" string => "$(test.mode)"; "expect[uid]" string => "0"; "expect[gid]" string => "0"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/102.cf b/tests/acceptance/10_files/02_maintain/102.cf index 2e07a7881a..291d008bec 100644 --- a/tests/acceptance/10_files/02_maintain/102.cf +++ b/tests/acceptance/10_files/02_maintain/102.cf @@ -3,38 +3,34 @@ # Create a file, expect simultaneous hard link to fail # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "mode" int => "0600"; + "mode" int => "0600"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms($(mode)), link_from => test_link; @@ -42,19 +38,18 @@ bundle agent test body link_from test_link { - source => "$(G.etc_group)"; - link_type => "hardlink"; + source => "$(G.etc_group)"; + link_type => "hardlink"; } body perms test_perms(m) { - mode => "$(m)"; - owners => { "0" }; - groups => { "0" }; + mode => "$(m)"; + owners => { "0" }; + groups => { "0" }; } ####################################################### - bundle agent check { vars: @@ -62,22 +57,24 @@ bundle agent check "expect[permoct]" string => "$(test.mode)"; "expect[uid]" string => "0"; "expect[gid]" string => "0"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/103.cf b/tests/acceptance/10_files/02_maintain/103.cf index 016dcc70cf..2bc7ec4bc0 100644 --- a/tests/acceptance/10_files/02_maintain/103.cf +++ b/tests/acceptance/10_files/02_maintain/103.cf @@ -3,41 +3,37 @@ # Create a file, expect simultaneous symbolic link to fail # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; vars: - "mode" int => "0600"; + "mode" int => "0600"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms($(mode)), link_from => test_link; @@ -45,40 +41,40 @@ bundle agent test body link_from test_link { - source => "$(G.etc_group)"; - link_type => "symlink"; + source => "$(G.etc_group)"; + link_type => "symlink"; } body perms test_perms(m) { - mode => "$(m)"; - owners => { "0" }; - groups => { "0" }; + mode => "$(m)"; + owners => { "0" }; + groups => { "0" }; } ####################################################### - bundle agent check { vars: - "expect[permoct]" string => "$(test.mode)"; - "expect[nlink]" string => "1"; - "expect[uid]" string => "0"; - "expect[gid]" string => "0"; - "expect[size]" string => "0"; - - "fields" slist => getindices("expect"); - "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); + "expect[permoct]" string => "$(test.mode)"; + "expect[nlink]" string => "1"; + "expect[uid]" string => "0"; + "expect[gid]" string => "0"; + "expect[size]" string => "0"; + "fields" slist => getindices("expect"); + "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/104.cf b/tests/acceptance/10_files/02_maintain/104.cf index f98fc1dbae..2d461460d0 100644 --- a/tests/acceptance/10_files/02_maintain/104.cf +++ b/tests/acceptance/10_files/02_maintain/104.cf @@ -3,41 +3,37 @@ # Create a file, expect simultaneous relative symbolic link to fail # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; vars: - "mode" int => "0600"; + "mode" int => "0600"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms($(mode)), link_from => test_link; @@ -45,40 +41,40 @@ bundle agent test body link_from test_link { - source => "$(G.etc_group)"; - link_type => "relative"; + source => "$(G.etc_group)"; + link_type => "relative"; } body perms test_perms(m) { - mode => "$(m)"; - owners => { "0" }; - groups => { "0" }; + mode => "$(m)"; + owners => { "0" }; + groups => { "0" }; } ####################################################### - bundle agent check { vars: - "expect[permoct]" string => "$(test.mode)"; - "expect[nlink]" string => "1"; - "expect[uid]" string => "0"; - "expect[gid]" string => "0"; - "expect[size]" string => "0"; - - "fields" slist => getindices("expect"); - "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); + "expect[permoct]" string => "$(test.mode)"; + "expect[nlink]" string => "1"; + "expect[uid]" string => "0"; + "expect[gid]" string => "0"; + "expect[size]" string => "0"; + "fields" slist => getindices("expect"); + "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/105.cf b/tests/acceptance/10_files/02_maintain/105.cf index 0a0d5b63dd..0762dd09f7 100644 --- a/tests/acceptance/10_files/02_maintain/105.cf +++ b/tests/acceptance/10_files/02_maintain/105.cf @@ -3,44 +3,38 @@ # Create a file, expect simultaneous absolute symbolic link to fail # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile).SOURCE" - create => "true"; + "$(G.testfile)" delete => init_delete; + "$(G.testfile).SOURCE" create => "true"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; vars: - "mode" int => "0600"; + "mode" int => "0600"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms($(test.mode)), link_from => test_link; @@ -48,40 +42,40 @@ bundle agent test body link_from test_link { - link_type => "absolute"; - source => "$(G.testfile).SOURCE"; + link_type => "absolute"; + source => "$(G.testfile).SOURCE"; } body perms test_perms(m) { - mode => "$(m)"; - owners => { "0" }; - groups => { "0" }; + mode => "$(m)"; + owners => { "0" }; + groups => { "0" }; } ####################################################### - bundle agent check { vars: - "expect[permoct]" string => "$(test.mode)"; - "expect[nlink]" string => "1"; - "expect[uid]" string => "0"; - "expect[gid]" string => "0"; - "expect[size]" string => "0"; - - "fields" slist => getindices("expect"); - "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); + "expect[permoct]" string => "$(test.mode)"; + "expect[nlink]" string => "1"; + "expect[uid]" string => "0"; + "expect[gid]" string => "0"; + "expect[size]" string => "0"; + "fields" slist => getindices("expect"); + "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/112.cf b/tests/acceptance/10_files/02_maintain/112.cf index e9dec3ec1e..7835c8841f 100644 --- a/tests/acceptance/10_files/02_maintain/112.cf +++ b/tests/acceptance/10_files/02_maintain/112.cf @@ -4,41 +4,37 @@ # to succeed # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; vars: - "inode" string => filestat("$(G.etc_group)", "ino"); + "inode" string => filestat("$(G.etc_group)", "ino"); files: - "$(G.testfile)" + "$(G.testfile)" create => "true", move_obstructions => "true", link_from => test_link; @@ -46,25 +42,26 @@ bundle agent test body link_from test_link { - source => "$(G.etc_group)"; + source => "$(G.etc_group)"; } ####################################################### - bundle agent check { vars: - "result" string => filestat(filestat("$(G.testfile)", "linktarget"), "ino"); + "result" string => filestat(filestat("$(G.testfile)", "linktarget"), "ino"); classes: - "ok" expression => strcmp("$(test.inode)", "$(result)"); + "ok" expression => strcmp("$(test.inode)", "$(result)"); reports: DEBUG:: "expected: '$(test.inode)'"; "got: '$(result)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/113.cf b/tests/acceptance/10_files/02_maintain/113.cf index eac1549425..1f6e44ef2a 100644 --- a/tests/acceptance/10_files/02_maintain/113.cf +++ b/tests/acceptance/10_files/02_maintain/113.cf @@ -4,41 +4,35 @@ # to succeed # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; - - "$(G.testfile).SOURCE" - create => "true"; + "$(G.testfile)" delete => init_delete; + "$(G.testfile).SOURCE" create => "true"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", move_obstructions => "true", link_from => test_link; @@ -46,27 +40,28 @@ bundle agent test body link_from test_link { - source => "$(G.testfile).SOURCE"; - link_type => "hardlink"; + source => "$(G.testfile).SOURCE"; + link_type => "hardlink"; } ####################################################### - bundle agent check { vars: - "expect" string => filestat("$(G.testfile).SOURCE", "ino"); - "result" string => filestat("$(G.testfile)", "ino"); + "expect" string => filestat("$(G.testfile).SOURCE", "ino"); + "result" string => filestat("$(G.testfile)", "ino"); classes: - "ok" expression => strcmp("$(expect)", "$(result)"); + "ok" expression => strcmp("$(expect)", "$(result)"); reports: DEBUG:: "expected: '$(expect)'"; "got: '$(result)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/114.cf b/tests/acceptance/10_files/02_maintain/114.cf index b389a0884c..9cb2a9f2e2 100644 --- a/tests/acceptance/10_files/02_maintain/114.cf +++ b/tests/acceptance/10_files/02_maintain/114.cf @@ -4,41 +4,37 @@ # to succeed # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; vars: - "inode" string => filestat("$(G.etc_group)", "ino"); + "inode" string => filestat("$(G.etc_group)", "ino"); files: - "$(G.testfile)" + "$(G.testfile)" create => "true", move_obstructions => "true", link_from => test_link; @@ -46,28 +42,29 @@ bundle agent test body link_from test_link { - source => "$(G.etc_group)"; - link_type => "symlink"; + source => "$(G.etc_group)"; + link_type => "symlink"; } ####################################################### - bundle agent check { vars: - "result" string => filestat(filestat("$(G.testfile)", "linktarget"), "ino"); - "Lresult" string => filestat("$(G.testfile)", "ino"); + "result" string => filestat(filestat("$(G.testfile)", "linktarget"), "ino"); + "Lresult" string => filestat("$(G.testfile)", "ino"); classes: - "okL" not => strcmp("$(test.inode)", "$(Lresult)"); - "ok" and => { "okL", strcmp("$(test.inode)", "$(result)") }; + "okL" not => strcmp("$(test.inode)", "$(Lresult)"); + "ok" and => { "okL", strcmp("$(test.inode)", "$(result)") }; reports: DEBUG:: "expected: '$(test.inode)'"; "got: '$(Lresult)' => '$(result)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/201.cf b/tests/acceptance/10_files/02_maintain/201.cf index 673839cc5b..feaf7692fd 100644 --- a/tests/acceptance/10_files/02_maintain/201.cf +++ b/tests/acceptance/10_files/02_maintain/201.cf @@ -4,16 +4,14 @@ # overwrite mode, size # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: @@ -32,7 +30,7 @@ bundle agent init "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); files: - "$(G.testfile)" + "$(G.testfile)" copy_from => init_copy("$(G.etc_group)"), perms => init_perms("$(mode)"), classes => init_set_class("pass2"); @@ -40,38 +38,35 @@ bundle agent init body copy_from init_copy(file) { - source => "$(file)"; + source => "$(file)"; } body perms init_perms(m) { - mode => "$(m)"; + mode => "$(m)"; } body classes init_set_class(class) { - promise_kept => { "$(class)" }; - promise_repaired => { "$(class)" }; + promise_kept => { "$(class)" }; + promise_repaired => { "$(class)" }; } ####################################################### - bundle agent test { - files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms("$(init.mode)"); } body perms test_perms(m) { - mode => "$(m)"; + mode => "$(m)"; } ####################################################### - bundle agent check { vars: @@ -79,23 +74,25 @@ bundle agent check "expect[permoct]" string => "$(test.mode)"; "expect[uid]" string => "0"; "expect[gid]" string => "0"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "ok" expression => strcmp("$(init.result)", "$(result)"); - "not_ok" not => regcmp("$(init.result[$(fields)])", "$(result[$(fields)])"); + "ok" expression => strcmp("$(init.result)", "$(result)"); + "not_ok" not => regcmp("$(init.result[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(init.result[$(fields)])'"; "got: $(fields) = '$(check.result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/202.cf b/tests/acceptance/10_files/02_maintain/202.cf index e77de0fc9f..8c0e0e3d95 100644 --- a/tests/acceptance/10_files/02_maintain/202.cf +++ b/tests/acceptance/10_files/02_maintain/202.cf @@ -4,27 +4,28 @@ # overwrite mode, size, owner, group # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: any:: "mode" int => "01751"; + linux:: "owner" string => "sys"; "group" string => "sys"; + freebsd:: "owner" string => "bin"; "group" string => "sys"; + !(linux|freebsd):: "owner" string => "undefined-please-fix"; "group" string => "undefined-please-fix"; @@ -41,7 +42,7 @@ bundle agent init "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); files: - "$(G.testfile)" + "$(G.testfile)" copy_from => init_copy("$(G.etc_group)"), perms => init_perms("$(mode)", "$(owner)", "$(group)"), classes => init_set_class("pass2"); @@ -49,45 +50,44 @@ bundle agent init body copy_from init_copy(file) { - source => "$(file)"; + source => "$(file)"; } body perms init_perms(m, o, g) { - mode => "$(m)"; - owners => { "$(o)" }; - groups => { "$(g)" }; + mode => "$(m)"; + owners => { "$(o)" }; + groups => { "$(g)" }; } body classes init_set_class(class) { - promise_kept => { "$(class)" }; - promise_repaired => { "$(class)" }; + promise_kept => { "$(class)" }; + promise_repaired => { "$(class)" }; } ####################################################### - bundle agent test { - files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms("$(init.mode)", "$(init.owner)", "$(init.group)"); } body perms test_perms(m, o, g) { - mode => "$(m)"; - owners => { "$(o)", "root" }; - linux:: - groups => { "$(g)", "root" }; - freebsd:: - groups => { "$(g)", "wheel" }; + mode => "$(m)"; + owners => { "$(o)", "root" }; + + linux:: + groups => { "$(g)", "root" }; + + freebsd:: + groups => { "$(g)", "wheel" }; } ####################################################### - bundle agent check { vars: @@ -95,23 +95,25 @@ bundle agent check "expect[permoct]" string => "$(test.mode)"; "expect[uid]" string => "0"; "expect[gid]" string => "0"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "ok" expression => strcmp("$(init.result)", "$(result)"); - "not_ok" not => regcmp("$(init.result[$(fields)])", "$(result[$(fields)])"); + "ok" expression => strcmp("$(init.result)", "$(result)"); + "not_ok" not => regcmp("$(init.result[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(init.result[$(fields)])'"; "got: $(fields) = '$(check.result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/203.cf b/tests/acceptance/10_files/02_maintain/203.cf index 1af5be9879..0267763f65 100644 --- a/tests/acceptance/10_files/02_maintain/203.cf +++ b/tests/acceptance/10_files/02_maintain/203.cf @@ -4,27 +4,28 @@ # overwrite mode, size, owner, group (different ordering of groups) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: any:: "mode" int => "01751"; + linux:: "owner" string => "sys"; "group" string => "sys"; + freebsd:: "owner" string => "bin"; "group" string => "sys"; + !(linux|freebsd):: "owner" string => "undefined-please-fix"; "group" string => "undefined-please-fix"; @@ -41,7 +42,7 @@ bundle agent init "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); files: - "$(G.testfile)" + "$(G.testfile)" copy_from => init_copy("$(G.etc_group)"), perms => init_perms("$(mode)", "$(owner)", "$(group)"), classes => init_set_class("pass2"); @@ -49,45 +50,44 @@ bundle agent init body copy_from init_copy(file) { - source => "$(file)"; + source => "$(file)"; } body perms init_perms(m, o, g) { - mode => "$(m)"; - owners => { "$(o)" }; - groups => { "$(g)" }; + mode => "$(m)"; + owners => { "$(o)" }; + groups => { "$(g)" }; } body classes init_set_class(class) { - promise_kept => { "$(class)" }; - promise_repaired => { "$(class)" }; + promise_kept => { "$(class)" }; + promise_repaired => { "$(class)" }; } ####################################################### - bundle agent test { - files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms("$(init.mode)", "$(init.owner)", "$(init.group)"); } body perms test_perms(m, o, g) { - mode => "$(m)"; - owners => { "root", "$(o)" }; - linux:: - groups => { "root", "$(g)" }; - freebsd:: - groups => { "wheel", "$(g)" }; + mode => "$(m)"; + owners => { "root", "$(o)" }; + + linux:: + groups => { "root", "$(g)" }; + + freebsd:: + groups => { "wheel", "$(g)" }; } ####################################################### - bundle agent check { vars: @@ -95,23 +95,25 @@ bundle agent check "expect[permoct]" string => "$(test.mode)"; "expect[uid]" string => "0"; "expect[gid]" string => "0"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "ok" expression => strcmp("$(init.result)", "$(result)"); - "not_ok" not => regcmp("$(init.result[$(fields)])", "$(result[$(fields)])"); + "ok" expression => strcmp("$(init.result)", "$(result)"); + "not_ok" not => regcmp("$(init.result[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(init.result[$(fields)])'"; "got: $(fields) = '$(check.result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/204.cf b/tests/acceptance/10_files/02_maintain/204.cf index 0927a0568a..a5d7a6e764 100644 --- a/tests/acceptance/10_files/02_maintain/204.cf +++ b/tests/acceptance/10_files/02_maintain/204.cf @@ -4,27 +4,28 @@ # overwrite mode, size or change owner/group (different ordering of groups) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: any:: "mode" int => "01751"; + linux:: "owner" string => "sys"; "group" string => "sys"; + freebsd:: "owner" string => "bin"; "group" string => "sys"; + !(linux|freebsd):: "owner" string => "undefined-please-fix"; "group" string => "undefined-please-fix"; @@ -41,7 +42,7 @@ bundle agent init "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); files: - "$(G.testfile)" + "$(G.testfile)" copy_from => init_copy("$(G.etc_group)"), perms => init_perms("$(mode)", "$(owner)", "$(group)"), classes => init_set_class("pass2"); @@ -49,40 +50,37 @@ bundle agent init body copy_from init_copy(file) { - source => "$(file)"; + source => "$(file)"; } body perms init_perms(m, o, g) { - mode => "$(m)"; - owners => { "$(o)" }; - groups => { "$(g)" }; + mode => "$(m)"; + owners => { "$(o)" }; + groups => { "$(g)" }; } body classes init_set_class(class) { - promise_kept => { "$(class)" }; - promise_repaired => { "$(class)" }; + promise_kept => { "$(class)" }; + promise_repaired => { "$(class)" }; } ####################################################### - bundle agent test { - files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms("$(init.mode)"); } body perms test_perms(m) { - mode => "$(m)"; + mode => "$(m)"; } ####################################################### - bundle agent check { vars: @@ -90,23 +88,25 @@ bundle agent check "expect[permoct]" string => "$(test.mode)"; "expect[uid]" string => "0"; "expect[gid]" string => "0"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "ok" expression => strcmp("$(init.result)", "$(result)"); - "not_ok" not => regcmp("$(init.result[$(fields)])", "$(result[$(fields)])"); + "ok" expression => strcmp("$(init.result)", "$(result)"); + "not_ok" not => regcmp("$(init.result[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(init.result[$(fields)])'"; "got: $(fields) = '$(check.result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/205.cf b/tests/acceptance/10_files/02_maintain/205.cf index c0d01cbf7c..4bd5e226b6 100644 --- a/tests/acceptance/10_files/02_maintain/205.cf +++ b/tests/acceptance/10_files/02_maintain/205.cf @@ -4,30 +4,32 @@ # overwrite mode, size, but DOES change owner, group (symbolic IDs) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - cache_system_functions => "false"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; + cache_system_functions => "false"; } ####################################################### - bundle agent init { vars: freebsd|solaris:: "mode" int => "04751"; + !freebsd.!solaris:: "mode" int => "01751"; + linux:: "owner" string => "sys"; "group" string => "sys"; + freebsd:: "owner" string => "bin"; "group" string => "sys"; + !(linux|freebsd):: "owner" string => "undefined-please-fix"; "group" string => "undefined-please-fix"; @@ -48,7 +50,7 @@ bundle agent init "fields" slist => getindices("expect"); files: - "$(G.testfile)" + "$(G.testfile)" copy_from => init_copy("$(G.etc_group)"), perms => init_perms("$(mode)", "$(owner)", "$(group)"), classes => init_set_class("pass2"); @@ -56,75 +58,82 @@ bundle agent init body copy_from init_copy(file) { - source => "$(file)"; + source => "$(file)"; } body perms init_perms(m, o, g) { - mode => "$(m)"; - owners => { "$(o)" }; - groups => { "$(g)" }; + mode => "$(m)"; + owners => { "$(o)" }; + groups => { "$(g)" }; } body classes init_set_class(class) { - promise_kept => { "$(class)" }; - promise_repaired => { "$(class)" }; + promise_kept => { "$(class)" }; + promise_repaired => { "$(class)" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms("a+r"); } body perms test_perms(m) { - mode => "$(m)"; - owners => { "root" }; - linux|hpux|solaris|qnx:: - groups => { "root" }; - freebsd|netbsd|openbsd|darwin|dragonfly:: - groups => { "wheel" }; - aix:: - groups => { "system" }; - cray:: - groups => { "sys" }; - # Still need unix_sv, sco, vmware + mode => "$(m)"; + owners => { "root" }; + + linux|hpux|solaris|qnx:: + groups => { "root" }; + + freebsd|netbsd|openbsd|darwin|dragonfly:: + groups => { "wheel" }; + + aix:: + groups => { "system" }; + + cray:: + groups => { "sys" }; + + # Still need unix_sv, sco, vmware } ####################################################### - bundle agent check { vars: freebsd|solaris:: "expect[modeoct]" string => "104755"; + !freebsd.!solaris.!windows:: "expect[modeoct]" string => "101755"; + !windows:: "expect[uid]" string => "0"; "expect[gid]" string => "0"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => filestat("$(G.etc_group)", "size"); - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "result: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/206.cf b/tests/acceptance/10_files/02_maintain/206.cf index 54c0d483c3..f45ec4e587 100644 --- a/tests/acceptance/10_files/02_maintain/206.cf +++ b/tests/acceptance/10_files/02_maintain/206.cf @@ -4,30 +4,32 @@ # overwrite mode, size, but DOES change owner, group - numeric UID/GID # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - cache_system_functions => "false"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; + cache_system_functions => "false"; } ####################################################### - bundle agent init { vars: freebsd|solaris:: "mode" int => "04751"; + !freebsd.!solaris:: "mode" int => "01751"; + linux:: "owner" string => "sys"; "group" string => "sys"; + freebsd:: "owner" string => "bin"; "group" string => "sys"; + !(linux|freebsd):: "owner" string => "undefined-please-fix"; "group" string => "undefined-please-fix"; @@ -48,7 +50,7 @@ bundle agent init "fields" slist => getindices("expect"); files: - "$(G.testfile)" + "$(G.testfile)" copy_from => init_copy("$(G.etc_group)"), perms => init_perms("$(mode)", "$(owner)", "$(group)"), classes => init_set_class("pass2"); @@ -56,68 +58,69 @@ bundle agent init body copy_from init_copy(file) { - source => "$(file)"; + source => "$(file)"; } body perms init_perms(m, o, g) { - mode => "$(m)"; - owners => { "$(o)" }; - groups => { "$(g)" }; + mode => "$(m)"; + owners => { "$(o)" }; + groups => { "$(g)" }; } - body classes init_set_class(class) { - promise_kept => { "$(class)" }; - promise_repaired => { "$(class)" }; + promise_kept => { "$(class)" }; + promise_repaired => { "$(class)" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms("a+r"); } body perms test_perms(m) { - mode => "$(m)"; - owners => { "456" }; - groups => { "567" }; + mode => "$(m)"; + owners => { "456" }; + groups => { "567" }; } ####################################################### - bundle agent check { vars: freebsd|solaris:: "expect[modeoct]" string => "104755"; + !freebsd.!solaris.!windows:: "expect[modeoct]" string => "101755"; + !windows:: "expect[uid]" string => "456"; "expect[gid]" string => "567"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => filestat("$(G.etc_group)", "size"); - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "result: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/207.cf b/tests/acceptance/10_files/02_maintain/207.cf index c08e51f08a..124a14b264 100644 --- a/tests/acceptance/10_files/02_maintain/207.cf +++ b/tests/acceptance/10_files/02_maintain/207.cf @@ -4,30 +4,32 @@ # overwrite mode, size, but DOES change owner, group (numeric IDs) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - cache_system_functions => "false"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; + cache_system_functions => "false"; } ####################################################### - bundle agent init { vars: freebsd|solaris:: "mode" int => "04751"; + !freebsd.!solaris:: "mode" int => "01751"; + linux:: "owner" string => "sys"; "group" string => "sys"; + freebsd:: "owner" string => "bin"; "group" string => "sys"; + !(linux|freebsd):: "owner" string => "undefined-please-fix"; "group" string => "undefined-please-fix"; @@ -48,7 +50,7 @@ bundle agent init "fields" slist => getindices("expect"); files: - "$(G.testfile)" + "$(G.testfile)" copy_from => init_copy("$(G.etc_group)"), perms => init_perms("$(mode)", "$(owner)", "$(group)"), classes => init_set_class("pass2"); @@ -56,67 +58,69 @@ bundle agent init body copy_from init_copy(file) { - source => "$(file)"; + source => "$(file)"; } body perms init_perms(m, o, g) { - mode => "$(m)"; - owners => { "$(o)" }; - groups => { "$(g)" }; + mode => "$(m)"; + owners => { "$(o)" }; + groups => { "$(g)" }; } body classes init_set_class(class) { - promise_kept => { "$(class)" }; - promise_repaired => { "$(class)" }; + promise_kept => { "$(class)" }; + promise_repaired => { "$(class)" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms("a+r"); } body perms test_perms(m) { - mode => "$(m)"; - owners => { "333" }; - groups => { "444" }; + mode => "$(m)"; + owners => { "333" }; + groups => { "444" }; } ####################################################### - bundle agent check { vars: freebsd|solaris:: "expect[modeoct]" string => "104755"; + !freebsd.!solaris.!windows:: "expect[modeoct]" string => "101755"; + !windows:: "expect[uid]" string => "333"; "expect[gid]" string => "444"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => filestat("$(G.etc_group)", "size"); - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "result: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/208.cf b/tests/acceptance/10_files/02_maintain/208.cf index 63bacdc9e2..adc53894bd 100644 --- a/tests/acceptance/10_files/02_maintain/208.cf +++ b/tests/acceptance/10_files/02_maintain/208.cf @@ -5,24 +5,24 @@ # we start with a non-registered user/group name. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - cache_system_functions => "false"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; + cache_system_functions => "false"; } ####################################################### - bundle agent init { vars: freebsd|solaris:: "mode" int => "04751"; + !freebsd.!solaris:: "mode" int => "01751"; + any:: "owner" string => "786756"; "group" string => "786756"; @@ -38,7 +38,7 @@ bundle agent init "fields" slist => getindices("expect"); files: - "$(G.testfile)" + "$(G.testfile)" copy_from => init_copy("$(G.etc_group)"), perms => init_perms("$(mode)", "$(owner)", "$(group)"), classes => init_set_class("pass2"); @@ -46,43 +46,42 @@ bundle agent init body copy_from init_copy(file) { - source => "$(file)"; - compare => "mtime"; + source => "$(file)"; + compare => "mtime"; } body perms init_perms(m, o, g) { - mode => "$(m)"; - owners => { "$(o)" }; - groups => { "$(g)" }; + mode => "$(m)"; + owners => { "$(o)" }; + groups => { "$(g)" }; } body classes init_set_class(class) { - promise_kept => { "$(class)" }; - promise_repaired => { "$(class)" }; + promise_kept => { "$(class)" }; + promise_repaired => { "$(class)" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms; } body perms test_perms { - # Mode is unspecified - should not change anything - owners => { "12349", "none" }; # Should change to 12349 - # Group is unspecified - should not change anything -} + # Mode is unspecified - should not change anything + owners => { "12349", "none" }; + # Should change to 12349 + # Group is unspecified - should not change anything +} ####################################################### - bundle agent check { vars: @@ -90,22 +89,24 @@ bundle agent check "expect[modeoct]" string => "\d+$(init.mode)"; "expect[uid]" string => "12349"; "expect[gid]" string => "$(init.group)"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => filestat("$(G.etc_group)", "size"); - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "result: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/209.cf b/tests/acceptance/10_files/02_maintain/209.cf index ace14c10e9..210af66e15 100644 --- a/tests/acceptance/10_files/02_maintain/209.cf +++ b/tests/acceptance/10_files/02_maintain/209.cf @@ -5,24 +5,24 @@ # we start with a non-registered user/group name. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - cache_system_functions => "false"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; + cache_system_functions => "false"; } ####################################################### - bundle agent init { vars: freebsd|solaris:: "mode" int => "04751"; + !freebsd.!solaris:: "mode" int => "01751"; + any:: "owner" string => "786756"; "group" string => "786756"; @@ -38,7 +38,7 @@ bundle agent init "fields" slist => getindices("expect"); files: - "$(G.testfile)" + "$(G.testfile)" copy_from => init_copy("$(G.etc_group)"), perms => init_perms("$(mode)", "$(owner)", "$(group)"), classes => init_set_class("pass2"); @@ -46,41 +46,41 @@ bundle agent init body copy_from init_copy(file) { - source => "$(file)"; - compare => "mtime"; + source => "$(file)"; + compare => "mtime"; } body perms init_perms(m, o, g) { - mode => "$(m)"; - owners => { "$(o)" }; - groups => { "$(g)" }; + mode => "$(m)"; + owners => { "$(o)" }; + groups => { "$(g)" }; } body classes init_set_class(class) { - promise_kept => { "$(class)" }; - promise_repaired => { "$(class)" }; + promise_kept => { "$(class)" }; + promise_repaired => { "$(class)" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_perms; } body perms test_perms { - # Mode, owner is unspecified - should not change anything - groups => { "23459", "none" }; # Should change to 23459 + # Mode, owner is unspecified - should not change anything + groups => { "23459", "none" }; + + # Should change to 23459 } ####################################################### - bundle agent check { vars: @@ -88,22 +88,24 @@ bundle agent check "expect[modeoct]" string => "\d+$(init.mode)"; "expect[uid]" string => "$(init.owner)"; "expect[gid]" string => "23459"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => filestat("$(G.etc_group)", "size"); - "fields" slist => getindices("expect"); "result[$(fields)]" string => filestat("$(G.testfile)", "$(fields)"); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "result: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/301.cf b/tests/acceptance/10_files/02_maintain/301.cf index b233a258d1..ea4f3ac7d6 100644 --- a/tests/acceptance/10_files/02_maintain/301.cf +++ b/tests/acceptance/10_files/02_maintain/301.cf @@ -3,93 +3,106 @@ # Create a file using copy, expect second copy to have "promise_kept" # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { classes: - "cxl_succ" expression => "any"; - "cxl_fail" expression => "any"; + "cxl_succ" expression => "any"; + "cxl_fail" expression => "any"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" + "$(G.testfile)" perms => init_mog, copy_from => init_copy("$(G.etc_group)"); } body perms init_mog { - mode => "751"; - owners => { "0" }; - groups => { "0" }; + mode => "751"; + owners => { "0" }; + groups => { "0" }; } body copy_from init_copy(fn) { - source => "$(fn)"; - compare => "digest"; + source => "$(fn)"; + compare => "digest"; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" perms => init_mog, copy_from => init_copy("$(G.etc_group)"), - classes => test_classes("success", "failure", "failure", "failure", "cxl_succ", "cxl_fail", "cxl_fail"); + classes => test_classes( + "success", + "failure", + "failure", + "failure", + "cxl_succ", + "cxl_fail", + "cxl_fail" + ); } body classes test_classes(kep, rep, fai, xxx, cxl_kep, cxl_rep, cxl_nkp) { - promise_kept => { "$(kep)" }; - promise_repaired => { "$(rep)" }; - repair_failed => { "$(fai)" }; - repair_denied => { "$(fai)" }; - repair_timeout => { "$(fai)" }; - cancel_kept => { "$(cxl_kep)" }; - cancel_repaired => { "$(cxl_rep)" }; - cancel_notkept => { "$(cxl_nkp)" }; + promise_kept => { "$(kep)" }; + promise_repaired => { "$(rep)" }; + repair_failed => { "$(fai)" }; + repair_denied => { "$(fai)" }; + repair_timeout => { "$(fai)" }; + cancel_kept => { "$(cxl_kep)" }; + cancel_repaired => { "$(cxl_rep)" }; + cancel_notkept => { "$(cxl_nkp)" }; } ####################################################### - bundle agent check { classes: - "ok" and => { "success", "!cxl_succ", "!failure", "cxl_fail" }; + "ok" and => { "success", "!cxl_succ", "!failure", "cxl_fail" }; reports: DEBUG.success:: "class 'success' was set (should be)"; + DEBUG.!success:: "class 'success' was not set (should be)"; + DEBUG.cxl_succ:: "class 'cxl_succ' was still set (should not be)"; + DEBUG.!cxl_succ:: "class 'cxl_succ' was not still set (should not be)"; + DEBUG.failure:: "class 'failure' was set (should not be)"; + DEBUG.!failure:: "class 'failure' was not set (should not be)"; + DEBUG.cxl_fail:: "class 'cxl_fail' was still set (should be)"; + DEBUG.!cxl_fail:: "class 'cxl_fail' was not still set (should not be)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/408.cf b/tests/acceptance/10_files/02_maintain/408.cf index fcba88aed3..b0fec1cea9 100644 --- a/tests/acceptance/10_files/02_maintain/408.cf +++ b/tests/acceptance/10_files/02_maintain/408.cf @@ -3,81 +3,77 @@ # Copy symlink over file, test that file is correctly saved aside. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - bundle common g { vars: - "srcfile" string => "$(G.testfile).source"; + "srcfile" string => "$(G.testfile).source"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" + "$(G.testfile)" move_obstructions => "true", copy_from => init_copy; - "$(g.srcfile)" + "$(g.srcfile)" move_obstructions => "true", link_from => init_link; } body copy_from init_copy { - source => "$(G.etc_group)"; - compare => "digest"; + source => "$(G.etc_group)"; + compare => "digest"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } body link_from init_link { - source => "$(G.true)"; + source => "$(G.true)"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; files: - "$(G.testfile)" + "$(G.testfile)" move_obstructions => "true", copy_from => test_copy; } body copy_from test_copy { - source => "$(g.srcfile)"; - compare => "digest"; + source => "$(g.srcfile)"; + compare => "digest"; } ####################################################### - bundle agent check { classes: - "ok" expression => fileexists("$(G.testfile).cfsaved"); + "ok" expression => fileexists("$(G.testfile).cfsaved"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/409.cf b/tests/acceptance/10_files/02_maintain/409.cf index 0633bb4692..787546e1d4 100644 --- a/tests/acceptance/10_files/02_maintain/409.cf +++ b/tests/acceptance/10_files/02_maintain/409.cf @@ -3,59 +3,54 @@ # Test that action => "warn" works correctly for rename => disable (Issue 841) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - ####################################################### - bundle agent init { files: - "$(G.testfile)" + "$(G.testfile)" move_obstructions => "true", copy_from => init_copy; } body copy_from init_copy { - source => "$(G.etc_null)"; - compare => "digest"; + source => "$(G.etc_null)"; + compare => "digest"; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" rename => disable, action => warn_only; } body rename disable { - disable => "true"; + disable => "true"; } ####################################################### - bundle agent check { classes: - "filestillthere" expression => fileexists("$(G.testfile)"); - "fileisnotdisabled" not => fileexists("$(G.testfile).cfdisabled"); - - "ok" and => { "filestillthere", "fileisnotdisabled" }; + "filestillthere" expression => fileexists("$(G.testfile)"); + "fileisnotdisabled" not => fileexists("$(G.testfile).cfdisabled"); + "ok" and => { "filestillthere", "fileisnotdisabled" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/410.cf b/tests/acceptance/10_files/02_maintain/410.cf index ed178c8a4e..0178493a4b 100644 --- a/tests/acceptance/10_files/02_maintain/410.cf +++ b/tests/acceptance/10_files/02_maintain/410.cf @@ -3,59 +3,54 @@ # Test that action => "warn" works correctly for rename { rotate => 1 } (Issue 841) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - ####################################################### - bundle agent init { files: - "$(G.testfile)" + "$(G.testfile)" move_obstructions => "true", copy_from => init_copy; } body copy_from init_copy { - source => "$(G.etc_null)"; - compare => "digest"; + source => "$(G.etc_null)"; + compare => "digest"; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" rename => rotate, action => warn_only; } body rename rotate { - rotate => "1"; + rotate => "1"; } ####################################################### - bundle agent check { classes: - "filestillthere" expression => fileexists("$(G.testfile)"); - "fileisnotrotated" not => fileexists("$(G.testfile).1"); - - "ok" and => { "filestillthere", "fileisnotrotated" }; + "filestillthere" expression => fileexists("$(G.testfile)"); + "fileisnotrotated" not => fileexists("$(G.testfile).1"); + "ok" and => { "filestillthere", "fileisnotrotated" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/411.cf b/tests/acceptance/10_files/02_maintain/411.cf index 7151204fe2..22164cff00 100644 --- a/tests/acceptance/10_files/02_maintain/411.cf +++ b/tests/acceptance/10_files/02_maintain/411.cf @@ -3,27 +3,23 @@ # Test that action => "warn" works correctly for rename { rotate => 0 } (Issue 841) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => "someline"; - "expected" string => "someline"; + "states" slist => { "actual", "expected" }; + "actual" string => "someline"; + "expected" string => "someline"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -32,37 +28,38 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" + "$(G.testfile).actual" rename => rotate, action => warn_only; } body rename rotate { - rotate => "0"; + rotate => "0"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/02_maintain/412.cf b/tests/acceptance/10_files/02_maintain/412.cf index a70ee9fc35..a329d6dbdf 100644 --- a/tests/acceptance/10_files/02_maintain/412.cf +++ b/tests/acceptance/10_files/02_maintain/412.cf @@ -3,47 +3,44 @@ # Test that action => "warn" works correctly for rename { rotate => 1 } (Issue 841) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - ####################################################### - bundle agent init { commands: - "$(G.touch) $(G.testfile)"; + "$(G.touch) $(G.testfile)"; } ####################################################### - bundle agent test { vars: - "cmd" string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub"; + "cmd" string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub"; + commands: - "$(cmd)"; - "$(cmd) -D superfluous"; + "$(cmd)"; + "$(cmd) -D superfluous"; } -####################################################### +####################################################### bundle agent check { classes: - "filestillthere" expression => fileexists("$(G.testfile)"); - "fileisrotated" expression => fileexists("$(G.testfile).cf-before-edit.1"); - "nounnamedbackup" not => fileexists("$(G.testfile).cf-before-edit"); - - "ok" and => { "filestillthere", "fileisrotated", "nounnamedbackup" }; + "filestillthere" expression => fileexists("$(G.testfile)"); + "fileisrotated" expression => fileexists("$(G.testfile).cf-before-edit.1"); + "nounnamedbackup" not => fileexists("$(G.testfile).cf-before-edit"); + "ok" and => { "filestillthere", "fileisrotated", "nounnamedbackup" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/413.cf b/tests/acceptance/10_files/02_maintain/413.cf index 654475cfe7..7257b352bc 100644 --- a/tests/acceptance/10_files/02_maintain/413.cf +++ b/tests/acceptance/10_files/02_maintain/413.cf @@ -3,50 +3,47 @@ # Test that action => "warn" works correctly for rename { rotate => 1 } (Issue 841) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - ####################################################### - bundle agent init { commands: - "$(G.touch) $(G.testfile)"; + "$(G.touch) $(G.testfile)"; } ####################################################### - bundle agent test { vars: - "cmd" string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub"; + "cmd" string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub"; + commands: - "$(cmd) -D useless0"; - "$(cmd) -D useless1"; - "$(cmd) -D useless2"; - "$(cmd) -D useless3"; - "$(cmd) -D useless4"; + "$(cmd) -D useless0"; + "$(cmd) -D useless1"; + "$(cmd) -D useless2"; + "$(cmd) -D useless3"; + "$(cmd) -D useless4"; } -####################################################### +####################################################### bundle agent check { classes: - "filestillthere" expression => fileexists("$(G.testfile)"); - "fileisrotated" expression => fileexists("$(G.testfile).cf-before-edit.4"); - "nooverflow" not => fileexists("$(G.testfile).cf-before-edit.5"); - - "ok" and => { "filestillthere", "fileisrotated", "nooverflow" }; + "filestillthere" expression => fileexists("$(G.testfile)"); + "fileisrotated" expression => fileexists("$(G.testfile).cf-before-edit.4"); + "nooverflow" not => fileexists("$(G.testfile).cf-before-edit.5"); + "ok" and => { "filestillthere", "fileisrotated", "nooverflow" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/414.cf b/tests/acceptance/10_files/02_maintain/414.cf index b81012c621..6ec7dc5374 100644 --- a/tests/acceptance/10_files/02_maintain/414.cf +++ b/tests/acceptance/10_files/02_maintain/414.cf @@ -3,50 +3,47 @@ # Test that action => "warn" works correctly for rename { rotate => 1 } (Issue 841) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - ####################################################### - bundle agent init { commands: - "$(G.touch) $(G.testfile)"; + "$(G.touch) $(G.testfile)"; } ####################################################### - bundle agent test { vars: - "cmd" string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub"; + "cmd" string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub"; + commands: - "$(cmd)"; - "$(cmd) -D useless1"; - "$(cmd) -D useless2"; - "$(cmd) -D useless3"; - "$(cmd) -D useless4"; + "$(cmd)"; + "$(cmd) -D useless1"; + "$(cmd) -D useless2"; + "$(cmd) -D useless3"; + "$(cmd) -D useless4"; } -####################################################### +####################################################### bundle agent check { classes: - "filestillthere" expression => fileexists("$(G.testfile)"); - "fileisrotated" expression => fileexists("$(G.testfile).cf-before-edit.1"); - "nooverflow" not => fileexists("$(G.testfile).cf-before-edit.2"); - - "ok" and => { "filestillthere", "fileisrotated", "nooverflow" }; + "filestillthere" expression => fileexists("$(G.testfile)"); + "fileisrotated" expression => fileexists("$(G.testfile).cf-before-edit.1"); + "nooverflow" not => fileexists("$(G.testfile).cf-before-edit.2"); + "ok" and => { "filestillthere", "fileisrotated", "nooverflow" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/RM5411.cf b/tests/acceptance/10_files/02_maintain/RM5411.cf index 0ab26a282e..10dba545a1 100644 --- a/tests/acceptance/10_files/02_maintain/RM5411.cf +++ b/tests/acceptance/10_files/02_maintain/RM5411.cf @@ -1,31 +1,32 @@ # RedMine 5411: segfaults. -*- Mode: cfengine -*- body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testdir)/src" create => "true"; + "$(G.testdir)/src" create => "true"; } bundle agent test { files: - "$(G.testdir)/dst" copy_from => chained("$(G.testdir)/src"); + "$(G.testdir)/dst" copy_from => chained("$(G.testdir)/src"); } body copy_from chained(sourcedir) { - source => "$(sourcedir)"; - servers => { "x", "localhost" }; + source => "$(sourcedir)"; + servers => { "x", "localhost" }; } bundle agent check { - reports: # If we made it this far, we didn't segfault. - "$(this.promise_filename) Pass"; + reports: + # If we made it this far, we didn't segfault. + "$(this.promise_filename) Pass"; } diff --git a/tests/acceptance/10_files/02_maintain/absolute_link_and_move_obstructions.cf b/tests/acceptance/10_files/02_maintain/absolute_link_and_move_obstructions.cf index 81339e24d0..f70f506ea2 100644 --- a/tests/acceptance/10_files/02_maintain/absolute_link_and_move_obstructions.cf +++ b/tests/acceptance/10_files/02_maintain/absolute_link_and_move_obstructions.cf @@ -4,41 +4,37 @@ # to succeed # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; vars: - "inode" string => filestat("$(G.etc_group)", "ino"); + "inode" string => filestat("$(G.etc_group)", "ino"); files: - "$(G.testfile)" + "$(G.testfile)" create => "true", move_obstructions => "true", link_from => test_link; @@ -46,27 +42,29 @@ bundle agent test body link_from test_link { - source => "$(G.etc_group)"; - link_type => "absolute"; + source => "$(G.etc_group)"; + link_type => "absolute"; } ####################################################### - bundle agent check { vars: - "result" string => filestat(filestat("$(G.testfile)", "linktarget"), "ino"); - "Lresult" string => filestat("$(G.testfile)", "ino"); + "result" string => filestat(filestat("$(G.testfile)", "linktarget"), "ino"); + "Lresult" string => filestat("$(G.testfile)", "ino"); - # This tells us where the link points - "link_target" string => filestat("$(G.testfile)", "linktarget"); + # This tells us where the link points + "link_target" string => filestat("$(G.testfile)", "linktarget"); classes: - "okL" not => strcmp("$(test.inode)", "$(Lresult)"); - "ok" and => { "okL", - strcmp("$(test.inode)", "$(result)"), - # Might be slightly different from link_target because of redundant '../../'. - regcmp("/.*/group", "$(link_target)") + "okL" not => strcmp("$(test.inode)", "$(Lresult)"); + + "ok" + and => { + "okL", + strcmp("$(test.inode)", "$(result)"), + # Might be slightly different from link_target because of redundant '../../'. + regcmp("/.*/group", "$(link_target)"), }; reports: @@ -74,8 +72,10 @@ bundle agent check "expected: '$(test.inode)'"; "got: '$(Lresult)' => '$(result)'"; "got this too: '$(G.etc_group)' => '$(link_target)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/absolute_link_and_no_move_obstructions.cf b/tests/acceptance/10_files/02_maintain/absolute_link_and_no_move_obstructions.cf index f1107c9155..77385c9bdd 100644 --- a/tests/acceptance/10_files/02_maintain/absolute_link_and_no_move_obstructions.cf +++ b/tests/acceptance/10_files/02_maintain/absolute_link_and_no_move_obstructions.cf @@ -4,20 +4,18 @@ # to change it to an absolute link (but fail to) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", move_obstructions => "true", link_from => init_link; @@ -25,67 +23,73 @@ bundle agent init body link_from init_link { - source => "$(G.etc_group)"; - link_type => "relative"; + source => "$(G.etc_group)"; + link_type => "relative"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; - "test_suppress_fail" string => "freebsd", - meta => { "redmine5261" }; + "test_skip_unsupported" string => "windows"; + "test_suppress_fail" + string => "freebsd", + meta => { "redmine5261" }; vars: - "inode" string => filestat("$(G.etc_group)", "ino"); + "inode" string => filestat("$(G.etc_group)", "ino"); files: - "$(G.testfile)" + "$(G.testfile)" classes => init_if_failed("test_ok"), link_from => test_link; } body link_from test_link { - source => "$(G.etc_group)"; - link_type => "absolute"; + source => "$(G.etc_group)"; + link_type => "absolute"; } body classes init_if_failed(c) { - repair_failed => { "$(c)" }; + repair_failed => { "$(c)" }; } ####################################################### - bundle agent check { vars: - "result" string => filestat(filestat("$(G.testfile)", "linktarget"), "ino"); - "Lresult" string => filestat("$(G.testfile)", "ino"); + "result" string => filestat(filestat("$(G.testfile)", "linktarget"), "ino"); + "Lresult" string => filestat("$(G.testfile)", "ino"); - # Tell us where the link points, but don't follow it - "link_target" string => filestat("$(G.testfile)", "linktarget_shallow"); + # Tell us where the link points, but don't follow it + "link_target" string => filestat("$(G.testfile)", "linktarget_shallow"); classes: - "okL" not => strcmp("$(test.inode)", "$(Lresult)"); - "okT" not => strcmp("$(link_target)", "$(G.etc_group)"); - "ok" and => { "test_ok", "okL", "okT", - strcmp("$(test.inode)", "$(result)"), - # Test that the symlink target starts with dot - regcmp("\..*", "$(link_target)") - }; + "okL" not => strcmp("$(test.inode)", "$(Lresult)"); + "okT" not => strcmp("$(link_target)", "$(G.etc_group)"); + + "ok" + and => { + "test_ok", + "okL", + "okT", + strcmp("$(test.inode)", "$(result)"), + # Test that the symlink target starts with dot + regcmp("\..*", "$(link_target)"), + }; reports: DEBUG:: "expected: '$(test.inode)'"; "got: '$(Lresult)' => '$(result)'"; "got this too: '$(G.etc_group)' => '$(link_target)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/backup_repository.cf b/tests/acceptance/10_files/02_maintain/backup_repository.cf index 8b55e9a1f7..ea81d7ef29 100644 --- a/tests/acceptance/10_files/02_maintain/backup_repository.cf +++ b/tests/acceptance/10_files/02_maintain/backup_repository.cf @@ -1,41 +1,41 @@ # Test that repository contains backup of file after updating it. - body common control { - bundlesequence => { default("$(this.promise_filename)") }; - inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; } body agent control { - default_repository => $(init.repodir); + default_repository => $(init.repodir); } bundle agent init { vars: - "repodir" string => "$(sys.workdir)/repository"; + "repodir" string => "$(sys.workdir)/repository"; methods: - "" usebundle => dcs_fini($(repodir)); - "" usebundle => file_make("$(G.testfile).orig", "Original content"); - "" usebundle => file_make("$(G.testfile).new", "Updated content"); - "" usebundle => file_make("$(G.testfile).copy", "Original content"); + "" usebundle => dcs_fini($(repodir)); + "" usebundle => file_make("$(G.testfile).orig", "Original content"); + "" usebundle => file_make("$(G.testfile).new", "Updated content"); + "" usebundle => file_make("$(G.testfile).copy", "Original content"); } bundle agent test { methods: - "" usebundle => file_copy("$(G.testfile).new", "$(G.testfile).copy"); + "" usebundle => file_copy("$(G.testfile).new", "$(G.testfile).copy"); } bundle agent check { vars: - "backups" slist => findfiles("$(init.repodir)/*cfsaved"); + "backups" slist => findfiles("$(init.repodir)/*cfsaved"); methods: - "any" usebundle => dcs_check_diff("$(G.testfile).orig", - $(backups), - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).orig", $(backups), "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/10_files/02_maintain/changes_depth_search.cf b/tests/acceptance/10_files/02_maintain/changes_depth_search.cf index 173538b87e..804d309e15 100644 --- a/tests/acceptance/10_files/02_maintain/changes_depth_search.cf +++ b/tests/acceptance/10_files/02_maintain/changes_depth_search.cf @@ -1,26 +1,29 @@ # Checks whether a whole directory is monitored correctly with # a file changes promise. - body common control { - inputs => { "../../dcs.sub.cf", - "../../plucked.sub.cf", - "check_file_changes_log.cf.sub", - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { + "../../dcs.sub.cf", + "../../plucked.sub.cf", + "check_file_changes_log.cf.sub", + }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - "any" usebundle => setup_files; + "any" usebundle => setup_files; } bundle agent setup_files { methods: - # Note: sorted, not in actual order, due to file system order sensitivity. - "any" usebundle => file_make("$(G.testfile).expected", "file.content,C,Content changed + # Note: sorted, not in actual order, due to file system order sensitivity. + "any" + usebundle => file_make( + "$(G.testfile).expected", + "file.content,C,Content changed file.content,C,Content changed file.content,C,Content changed file.content,C,Content changed @@ -84,35 +87,41 @@ subfile.removed,N,New file found subfile.removed,R,File removed subfile.removed,R,File removed subfile.removed,R,File removed -subfile.same,N,New file found"); +subfile.same,N,New file found" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10254" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10254" }; commands: - "$(sys.cf_agent) -Dpass1 -Kf $(this.promise_filename).sub"; - "$(sys.cf_agent) -Dpass2 -Kf $(this.promise_filename).sub"; - "$(sys.cf_agent) -Dpass3 -Kf $(this.promise_filename).sub"; + "$(sys.cf_agent) -Dpass1 -Kf $(this.promise_filename).sub"; + "$(sys.cf_agent) -Dpass2 -Kf $(this.promise_filename).sub"; + "$(sys.cf_agent) -Dpass3 -Kf $(this.promise_filename).sub"; } bundle agent check { methods: - "any" usebundle => check_file_changes_log("$(G.testfile).expected", "test_changes_log_ok", - "test_changes_log_fail", "sorted"); + "any" + usebundle => check_file_changes_log( + "$(G.testfile).expected", + "test_changes_log_ok", + "test_changes_log_fail", + "sorted" + ); classes: - "ok" and => { "test_changes_log_ok", - "!test_changes_log_fail", - }; + "ok" and => { "test_changes_log_ok", "!test_changes_log_fail" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/changes_depth_search_last_file.cf b/tests/acceptance/10_files/02_maintain/changes_depth_search_last_file.cf index a148ff4a91..1e5758bb6b 100644 --- a/tests/acceptance/10_files/02_maintain/changes_depth_search_last_file.cf +++ b/tests/acceptance/10_files/02_maintain/changes_depth_search_last_file.cf @@ -1,57 +1,66 @@ # Checks whether a whole directory is monitored correctly with # a file changes promise even when all files are removed. - body common control { - inputs => { "../../dcs.sub.cf", - "../../plucked.sub.cf", - "check_file_changes_log.cf.sub", - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { + "../../dcs.sub.cf", + "../../plucked.sub.cf", + "check_file_changes_log.cf.sub", + }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - "any" usebundle => setup_files; + "any" usebundle => setup_files; } bundle agent setup_files { methods: - "any" usebundle => file_make("$(G.testfile).expected", "file,N,New file found + "any" + usebundle => file_make( + "$(G.testfile).expected", + "file,N,New file found file,R,File removed file,N,New file found -file,R,File removed"); +file,R,File removed" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10254" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10254" }; commands: - "$(sys.cf_agent) -Dpass1 -Kf $(this.promise_filename).sub"; - "$(sys.cf_agent) -Dpass2 -Kf $(this.promise_filename).sub"; - "$(sys.cf_agent) -Dpass3 -Kf $(this.promise_filename).sub"; - "$(sys.cf_agent) -Dpass4 -Kf $(this.promise_filename).sub"; + "$(sys.cf_agent) -Dpass1 -Kf $(this.promise_filename).sub"; + "$(sys.cf_agent) -Dpass2 -Kf $(this.promise_filename).sub"; + "$(sys.cf_agent) -Dpass3 -Kf $(this.promise_filename).sub"; + "$(sys.cf_agent) -Dpass4 -Kf $(this.promise_filename).sub"; } bundle agent check { methods: - "any" usebundle => check_file_changes_log("$(G.testfile).expected", "test_changes_log_ok", - "test_changes_log_fail", ""); + "any" + usebundle => check_file_changes_log( + "$(G.testfile).expected", + "test_changes_log_ok", + "test_changes_log_fail", + "" + ); classes: - "ok" and => { "test_changes_log_ok", - "!test_changes_log_fail", - }; + "ok" and => { "test_changes_log_ok", "!test_changes_log_fail" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/changes_promise_status.cf b/tests/acceptance/10_files/02_maintain/changes_promise_status.cf index 88be1d28ca..fd2ed20162 100644 --- a/tests/acceptance/10_files/02_maintain/changes_promise_status.cf +++ b/tests/acceptance/10_files/02_maintain/changes_promise_status.cf @@ -1,15 +1,14 @@ # Test that monitoring file status gives the right promise status - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { files: - "$(G.testdir)/existingfile" + "$(G.testdir)/existingfile" create => "true", changes => test_changes; } @@ -17,74 +16,94 @@ bundle agent init bundle agent test { files: - "$(G.testdir)/nosuchfile" + "$(G.testdir)/nosuchfile" changes => test_changes, - classes => kept_repaired_notkept("nosuchfile_kept", "nosuchfile_repaired", "nosuchfile_notkept"); - "$(G.testdir)/newfile" + classes => kept_repaired_notkept( + "nosuchfile_kept", "nosuchfile_repaired", "nosuchfile_notkept" + ); + + "$(G.testdir)/newfile" create => "true", changes => test_changes, - classes => kept_repaired_notkept("newfile_kept", "newfile_repaired", "newfile_notkept"); - "$(G.testdir)/existingfile" + classes => kept_repaired_notkept( + "newfile_kept", "newfile_repaired", "newfile_notkept" + ); + + "$(G.testdir)/existingfile" changes => test_changes, - classes => kept_repaired_notkept("existingfile_kept", "existingfile_repaired", "existingfile_notkept"); + classes => kept_repaired_notkept( + "existingfile_kept", "existingfile_repaired", "existingfile_notkept" + ); } body changes test_changes { - hash => "sha256"; - report_changes => "all"; - update_hashes => "yes"; + hash => "sha256"; + report_changes => "all"; + update_hashes => "yes"; } body classes kept_repaired_notkept(kept, repaired, notkept) { - promise_kept => { "$(kept)" }; - promise_repaired => { "$(repaired)" }; - repair_failed => { "$(notkept)" }; - repair_denied => { "$(notkept)" }; - repair_timeout => { "$(notkept)" }; + promise_kept => { "$(kept)" }; + promise_repaired => { "$(repaired)" }; + repair_failed => { "$(notkept)" }; + repair_denied => { "$(notkept)" }; + repair_timeout => { "$(notkept)" }; } bundle agent check { - classes: - "ok" and => { "!nosuchfile_kept", - "!nosuchfile_repaired", - "nosuchfile_notkept", - # Kept state can be either set or unset depending on number of passes. - # Let's not depend on either. - #"!newfile_kept", - "newfile_repaired", - "!newfile_notkept", - "existingfile_kept", - "!existingfile_repaired", - "!existingfile_notkept", + "ok" + and => { + "!nosuchfile_kept", + "!nosuchfile_repaired", + "nosuchfile_notkept", + # Kept state can be either set or unset depending on number of passes. + # Let's not depend on either. + #"!newfile_kept", + "newfile_repaired", + "!newfile_notkept", + "existingfile_kept", + "!existingfile_repaired", + "!existingfile_notkept", }; reports: DEBUG.nosuchfile_kept:: "nosuchfile_kept is set, but shouldn't be."; + DEBUG.nosuchfile_repaired:: "nosuchfile_repaired is set, but shouldn't be."; + DEBUG.!nosuchfile_notkept:: "nosuchfile_notkept is not set, but should be."; + DEBUG.newfile_kept:: "newfile_kept is set, but shouldn't be. (tolerated, for now)"; + DEBUG.!newfile_repaired:: "newfile_repaired is not set, but should be."; + DEBUG.newfile_notkept:: "newfile_notkept is set, but shouldn't be."; + DEBUG.!existingfile_kept:: "existingfile_kept is not set, but should be."; + DEBUG.existingfile_repaired:: "existingfile_repaired is set, but shouldn't be."; + DEBUG.existingfile_notkept:: "existingfile_notkept is set, but shouldn't be."; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/02_maintain/changes_update_hashes.cf b/tests/acceptance/10_files/02_maintain/changes_update_hashes.cf index e650f6ead3..a022d7656f 100644 --- a/tests/acceptance/10_files/02_maintain/changes_update_hashes.cf +++ b/tests/acceptance/10_files/02_maintain/changes_update_hashes.cf @@ -1,244 +1,308 @@ # Test that monitoring file status of an updated file gives right promises # status. - body common control { - inputs => { "../../default.sub.cf", "check_file_changes_log.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "check_file_changes_log.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { files: - # Not in database. - "$(G.testfile).update.new" - create => "true"; - # Should be in database. - "$(G.testfile).update.same" - create => "true", - changes => test_changes_update; - "$(G.testfile).update.updated" - create => "true", - changes => test_changes_update; - - # Not in database. - "$(G.testfile).noupdate.new" - create => "true"; - # Should be in database. - "$(G.testfile).noupdate.same" - create => "true", - changes => test_changes_nohasheupdate_report_changes_all; - "$(G.testfile).noupdate.updated" - create => "true", - changes => test_changes_nohasheupdate_report_changes_all; + # Not in database. + "$(G.testfile).update.new" create => "true"; + + # Should be in database. + "$(G.testfile).update.same" + create => "true", + changes => test_changes_update; + + "$(G.testfile).update.updated" + create => "true", + changes => test_changes_update; + + # Not in database. + "$(G.testfile).noupdate.new" create => "true"; + + # Should be in database. + "$(G.testfile).noupdate.same" + create => "true", + changes => test_changes_nohasheupdate_report_changes_all; + + "$(G.testfile).noupdate.updated" + create => "true", + changes => test_changes_nohasheupdate_report_changes_all; } bundle agent test { - meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10254" }; + meta: + "test_soft_fail" + string => "windows", + meta => { "ENT-10254" }; files: - "$(G.testfile).update.updated" - edit_line => insert_text; - "$(G.testfile).noupdate.updated" - edit_line => insert_text; + "$(G.testfile).update.updated" edit_line => insert_text; + "$(G.testfile).noupdate.updated" edit_line => insert_text; methods: - # Update each file twice. We cannot reuse the bundles because CFEngine - # will skip bundles it has done before. - "test_update_new" usebundle => test_update_new; - "test_update_same" usebundle => test_update_same; - "test_update_updated" usebundle => test_update_updated; - "test_update_new_again" usebundle => test_update_new_again; - "test_update_same_again" usebundle => test_update_same_again; - "test_update_updated_again" usebundle => test_update_updated_again; - - "test_noupdate_new" usebundle => test_noupdate_new; - "test_noupdate_same" usebundle => test_noupdate_same; - "test_noupdate_updated" usebundle => test_noupdate_updated; - "test_noupdate_new_again" usebundle => test_noupdate_new_again; - "test_noupdate_same_again" usebundle => test_noupdate_same_again; - "test_noupdate_updated_again" usebundle => test_noupdate_updated_again; + # Update each file twice. We cannot reuse the bundles because CFEngine + # will skip bundles it has done before. + "test_update_new" usebundle => test_update_new; + "test_update_same" usebundle => test_update_same; + "test_update_updated" usebundle => test_update_updated; + "test_update_new_again" usebundle => test_update_new_again; + "test_update_same_again" usebundle => test_update_same_again; + "test_update_updated_again" usebundle => test_update_updated_again; + "test_noupdate_new" usebundle => test_noupdate_new; + "test_noupdate_same" usebundle => test_noupdate_same; + "test_noupdate_updated" usebundle => test_noupdate_updated; + "test_noupdate_new_again" usebundle => test_noupdate_new_again; + "test_noupdate_same_again" usebundle => test_noupdate_same_again; + "test_noupdate_updated_again" usebundle => test_noupdate_updated_again; } bundle edit_line insert_text { insert_lines: - "Text"; + "Text"; } bundle agent test_update_new { files: - "$(G.testfile).update.new" - changes => test_changes_update, - classes => kept_repaired_notkept("test_update_new_kept", "test_update_new_repaired", "test_update_new_notkept"); + "$(G.testfile).update.new" + changes => test_changes_update, + classes => kept_repaired_notkept( + "test_update_new_kept", + "test_update_new_repaired", + "test_update_new_notkept" + ); } bundle agent test_update_same { files: - "$(G.testfile).update.same" - changes => test_changes_update, - classes => kept_repaired_notkept("test_update_same_kept", "test_update_same_repaired", "test_update_same_notkept"); + "$(G.testfile).update.same" + changes => test_changes_update, + classes => kept_repaired_notkept( + "test_update_same_kept", + "test_update_same_repaired", + "test_update_same_notkept" + ); } bundle agent test_update_updated { files: - "$(G.testfile).update.updated" - changes => test_changes_update, - classes => kept_repaired_notkept("test_update_updated_kept", "test_update_updated_repaired", "test_update_updated_notkept"); + "$(G.testfile).update.updated" + changes => test_changes_update, + classes => kept_repaired_notkept( + "test_update_updated_kept", + "test_update_updated_repaired", + "test_update_updated_notkept" + ); } bundle agent test_update_new_again { files: - "$(G.testfile).update.new" - changes => test_changes_update, - classes => kept_repaired_notkept("test_update_new_kept", "test_update_new_repaired", "test_update_new_notkept"); + "$(G.testfile).update.new" + changes => test_changes_update, + classes => kept_repaired_notkept( + "test_update_new_kept", + "test_update_new_repaired", + "test_update_new_notkept" + ); } bundle agent test_update_same_again { files: - "$(G.testfile).update.same" - changes => test_changes_update, - classes => kept_repaired_notkept("test_update_same_kept", "test_update_same_repaired", "test_update_same_notkept"); + "$(G.testfile).update.same" + changes => test_changes_update, + classes => kept_repaired_notkept( + "test_update_same_kept", + "test_update_same_repaired", + "test_update_same_notkept" + ); } bundle agent test_update_updated_again { files: - "$(G.testfile).update.updated" - changes => test_changes_update, - classes => kept_repaired_notkept("test_update_updated_kept", "test_update_updated_repaired", "test_update_updated_notkept"); + "$(G.testfile).update.updated" + changes => test_changes_update, + classes => kept_repaired_notkept( + "test_update_updated_kept", + "test_update_updated_repaired", + "test_update_updated_notkept" + ); } bundle agent test_noupdate_new { files: - "$(G.testfile).noupdate.new" - changes => test_changes_nohasheupdate_report_changes_all, - classes => kept_repaired_notkept("test_noupdate_new_kept", "test_noupdate_new_repaired", "test_noupdate_new_notkept"); + "$(G.testfile).noupdate.new" + changes => test_changes_nohasheupdate_report_changes_all, + classes => kept_repaired_notkept( + "test_noupdate_new_kept", + "test_noupdate_new_repaired", + "test_noupdate_new_notkept" + ); } bundle agent test_noupdate_same { files: - "$(G.testfile).noupdate.same" - changes => test_changes_nohasheupdate_report_changes_all, - classes => kept_repaired_notkept("test_noupdate_same_kept", "test_noupdate_same_repaired", "test_noupdate_same_notkept"); + "$(G.testfile).noupdate.same" + changes => test_changes_nohasheupdate_report_changes_all, + classes => kept_repaired_notkept( + "test_noupdate_same_kept", + "test_noupdate_same_repaired", + "test_noupdate_same_notkept" + ); } bundle agent test_noupdate_updated { files: - "$(G.testfile).noupdate.updated" - changes => test_changes_nohasheupdate_report_changes_all, - classes => kept_repaired_notkept("test_noupdate_updated_kept", "test_noupdate_updated_repaired", "test_noupdate_updated_notkept"); + "$(G.testfile).noupdate.updated" + changes => test_changes_nohasheupdate_report_changes_all, + classes => kept_repaired_notkept( + "test_noupdate_updated_kept", + "test_noupdate_updated_repaired", + "test_noupdate_updated_notkept" + ); } bundle agent test_noupdate_new_again { files: - "$(G.testfile).noupdate.new" - changes => test_changes_nohasheupdate_report_changes_all, - classes => kept_repaired_notkept("test_noupdate_new_kept", "test_noupdate_new_repaired", "test_noupdate_new_notkept"); + "$(G.testfile).noupdate.new" + changes => test_changes_nohasheupdate_report_changes_all, + classes => kept_repaired_notkept( + "test_noupdate_new_kept", + "test_noupdate_new_repaired", + "test_noupdate_new_notkept" + ); } bundle agent test_noupdate_same_again { files: - "$(G.testfile).noupdate.same" - changes => test_changes_nohasheupdate_report_changes_all, - classes => kept_repaired_notkept("test_noupdate_same_kept", "test_noupdate_same_repaired", "test_noupdate_same_notkept"); + "$(G.testfile).noupdate.same" + changes => test_changes_nohasheupdate_report_changes_all, + classes => kept_repaired_notkept( + "test_noupdate_same_kept", + "test_noupdate_same_repaired", + "test_noupdate_same_notkept" + ); } bundle agent test_noupdate_updated_again { files: - "$(G.testfile).noupdate.updated" - changes => test_changes_nohasheupdate_report_changes_all, - classes => kept_repaired_notkept("test_noupdate_updated_kept", "test_noupdate_updated_repaired", "test_noupdate_updated_notkept"); + "$(G.testfile).noupdate.updated" + changes => test_changes_nohasheupdate_report_changes_all, + classes => kept_repaired_notkept( + "test_noupdate_updated_kept", + "test_noupdate_updated_repaired", + "test_noupdate_updated_notkept" + ); } body changes test_changes_update { - hash => "sha256"; - report_changes => "all"; - update_hashes => "yes"; + hash => "sha256"; + report_changes => "all"; + update_hashes => "yes"; } body changes test_changes_nohasheupdate_report_changes_all { - hash => "sha256"; - report_changes => "all"; - update_hashes => "no"; + hash => "sha256"; + report_changes => "all"; + update_hashes => "no"; } body classes kept_repaired_notkept(kept, repaired, notkept) { - promise_kept => { "$(kept)" }; - promise_repaired => { "$(repaired)" }; - repair_failed => { "$(notkept)" }; - repair_denied => { "$(notkept)" }; - repair_timeout => { "$(notkept)" }; + promise_kept => { "$(kept)" }; + promise_repaired => { "$(repaired)" }; + repair_failed => { "$(notkept)" }; + repair_denied => { "$(notkept)" }; + repair_timeout => { "$(notkept)" }; } bundle agent check { vars: - "classes_set" slist => classesmatching("test_.*"); + "classes_set" slist => classesmatching("test_.*"); methods: - # Seems like CFEngine does two passes over files where we don't update - # hash, so the last four entries should really be two entries. - # If the number of "Content changed" lines is wrong, this is the first - # place to look. - "any" usebundle => file_make("$(G.testfile).file_changes_log", "TEST.cfengine.update.updated,C,Content changed + # Seems like CFEngine does two passes over files where we don't update + # hash, so the last four entries should really be two entries. + # If the number of "Content changed" lines is wrong, this is the first + # place to look. + "any" + usebundle => file_make( + "$(G.testfile).file_changes_log", + "TEST.cfengine.update.updated,C,Content changed TEST.cfengine.noupdate.updated,C,Content changed TEST.cfengine.noupdate.updated,C,Content changed TEST.cfengine.noupdate.updated,C,Content changed -TEST.cfengine.noupdate.updated,C,Content changed"); +TEST.cfengine.noupdate.updated,C,Content changed" + ); - "any" usebundle => check_file_changes_log("$(G.testfile).file_changes_log", "test_changes_log_ok", - "test_changes_log_fail", ""); + "any" + usebundle => check_file_changes_log( + "$(G.testfile).file_changes_log", + "test_changes_log_ok", + "test_changes_log_fail", + "" + ); classes: - "ok" and => { - "checksum_alerts", - "test_update_new_repaired", - "!test_update_new_notkept", - "!test_update_same_repaired", - "test_update_same_kept", - "!test_update_same_notkept", - "test_update_updated_repaired", - "!test_update_updated_notkept", - "test_noupdate_new_repaired", - "!test_noupdate_new_notkept", - "!test_noupdate_same_repaired", - "test_noupdate_same_kept", - "!test_noupdate_same_notkept", - "test_noupdate_updated_repaired", # because changes are recorded in the changes log - "test_noupdate_updated_notkept", # because hashes are not updated - "test_changes_log_ok", - "!test_changes_log_fail", + "ok" + and => { + "checksum_alerts", + "test_update_new_repaired", + "!test_update_new_notkept", + "!test_update_same_repaired", + "test_update_same_kept", + "!test_update_same_notkept", + "test_update_updated_repaired", + "!test_update_updated_notkept", + "test_noupdate_new_repaired", + "!test_noupdate_new_notkept", + "!test_noupdate_same_repaired", + "test_noupdate_same_kept", + "!test_noupdate_same_notkept", + "test_noupdate_updated_repaired", + # because changes are recorded in the changes log + "test_noupdate_updated_notkept", + # because hashes are not updated + "test_changes_log_ok", + "!test_changes_log_fail", }; reports: DEBUG:: "Set classes: $(classes_set)"; + !checksum_alerts.DEBUG:: "The checksum_alerts class was NOT set as expected."; + checksum_alerts.EXTRA:: "The checksum_alerts class was set as expected."; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/02_maintain/classes_on_delete.cf b/tests/acceptance/10_files/02_maintain/classes_on_delete.cf index bb2267b157..0a08f49c78 100644 --- a/tests/acceptance/10_files/02_maintain/classes_on_delete.cf +++ b/tests/acceptance/10_files/02_maintain/classes_on_delete.cf @@ -3,25 +3,20 @@ # Redmine#6509: repairs from delete bodies should not be seen as kept # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testdir)/redmine_6509_1/." - create => "true"; - - "$(G.testdir)/redmine_6509_2" - delete => tidy; + "$(G.testdir)/redmine_6509_1/." create => "true"; + "$(G.testdir)/redmine_6509_2" delete => tidy; } - bundle agent test { files: @@ -39,32 +34,30 @@ bundle agent check vars: "expected_ok" slist => { - "dir1_absent_ok", - "dir1_absent_repaired", - "dir1_absent_reached", - "dir2_absent_ok", - "dir2_absent_kept", - "dir2_absent_reached", - }; + "dir1_absent_ok", + "dir1_absent_repaired", + "dir1_absent_reached", + "dir2_absent_ok", + "dir2_absent_kept", + "dir2_absent_reached", + }; "seen_fail" slist => { - "dir1_absent_error", - "dir1_absent_repair_failed", - "dir1_absent_repair_denied", - "dir1_absent_repair_timeout", - "dir1_absent_kept", - }; + "dir1_absent_error", + "dir1_absent_repair_failed", + "dir1_absent_repair_denied", + "dir1_absent_repair_timeout", + "dir1_absent_kept", + }; classes: "ok" and => { @(expected_ok) }; - "fail" or => { @(seen_fail) }; reports: DEBUG.fail:: - "Found $(expected_ok) defined as expected" - if => "$(expected_ok)"; + "Found $(expected_ok) defined as expected" if => "$(expected_ok)"; "Found $(seen_fail) which is not expected and causes the test to fail" if => "$(seen_fail)"; @@ -77,14 +70,13 @@ bundle agent check fail:: "$(this.promise_filename) FAIL"; - } body classes mygeneric(x) { - promise_kept => { "$(x)_ok", "$(x)_kept", "$(x)_reached" }; + promise_kept => { "$(x)_ok", "$(x)_kept", "$(x)_reached" }; promise_repaired => { "$(x)_ok", "$(x)_repaired", "$(x)_reached" }; - repair_failed => { "$(x)_error", "$(x)_repair_failed", "$(x)_reached" }; - repair_denied => { "$(x)_error", "$(x)_repair_denied", "$(x)_reached" }; - repair_timeout => { "$(x)_error", "$(x)_repair_timeout", "$(x)_reached" }; + repair_failed => { "$(x)_error", "$(x)_repair_failed", "$(x)_reached" }; + repair_denied => { "$(x)_error", "$(x)_repair_denied", "$(x)_reached" }; + repair_timeout => { "$(x)_error", "$(x)_repair_timeout", "$(x)_reached" }; } diff --git a/tests/acceptance/10_files/02_maintain/copy-relative-link-existing.cf b/tests/acceptance/10_files/02_maintain/copy-relative-link-existing.cf index 19b5a5e31f..76e61d3adb 100644 --- a/tests/acceptance/10_files/02_maintain/copy-relative-link-existing.cf +++ b/tests/acceptance/10_files/02_maintain/copy-relative-link-existing.cf @@ -5,33 +5,30 @@ # # When verifying "link-currdir" is copy of "link", it is ok # to correct it (to be link-currdir -> dest), but after this, the promise must be kept. - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { commands: - "$(G.mkdir) -p $(G.testdir)"; - "$(G.touch) $(G.testdir)/dest"; - "$(G.ln) -s dest link" - contain => in_dir("$(G.testdir)"); - "$(G.ln) -s ./dest link-currdir" - contain => in_dir("$(G.testdir)"); + "$(G.mkdir) -p $(G.testdir)"; + "$(G.touch) $(G.testdir)/dest"; + "$(G.ln) -s dest link" contain => in_dir("$(G.testdir)"); + "$(G.ln) -s ./dest link-currdir" contain => in_dir("$(G.testdir)"); } bundle agent test { files: - "$(G.testdir)/link-currdir" + "$(G.testdir)/link-currdir" copy_from => local_cp("$(G.testdir)/link"), move_obstructions => "true"; - "$(G.testdir)/link-currdir" + "$(G.testdir)/link-currdir" copy_from => local_cp("$(G.testdir)/link"), classes => if_kept("copy_link_kept"); } @@ -39,24 +36,24 @@ bundle agent test bundle agent check { classes: - "ok" or => { "copy_link_kept" }; + "ok" or => { "copy_link_kept" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } - body contain in_dir(s) { - chdir => "$(s)"; + chdir => "$(s)"; } body classes if_kept(x) { - promise_kept => { "$(x)" }; + promise_kept => { "$(x)" }; } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/02_maintain/copy-relative-link.cf b/tests/acceptance/10_files/02_maintain/copy-relative-link.cf index 5c0eebe244..90aa121d92 100644 --- a/tests/acceptance/10_files/02_maintain/copy-relative-link.cf +++ b/tests/acceptance/10_files/02_maintain/copy-relative-link.cf @@ -1,27 +1,26 @@ # Test that copying relative link does not mangle it (Mantis #1117) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { commands: - "$(G.mkdir) -p $(G.testdir)/a"; - "$(G.touch) $(G.testdir)/a/dest"; - "$(G.ln) -s dest $(G.testdir)/a/link"; + "$(G.mkdir) -p $(G.testdir)/a"; + "$(G.touch) $(G.testdir)/a/dest"; + "$(G.ln) -s dest $(G.testdir)/a/link"; } bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; files: - "$(G.testdir)/b" + "$(G.testdir)/b" copy_from => local_cp("$(G.testdir)/a"), depth_search => recurse("inf"); } @@ -29,18 +28,20 @@ bundle agent test bundle agent check { vars: - "expect" string => "dest"; - "result" string => filestat("$(G.testdir)/b/link", "linktarget_shallow"); + "expect" string => "dest"; + "result" string => filestat("$(G.testdir)/b/link", "linktarget_shallow"); classes: - "ok" expression => strcmp("$(result)", "$(expect)"); + "ok" expression => strcmp("$(result)", "$(expect)"); reports: DEBUG:: "expected: '$(expect)'"; "got: '$(result)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/copy_from_depth_search.cf b/tests/acceptance/10_files/02_maintain/copy_from_depth_search.cf index 94116e9aad..031b056218 100644 --- a/tests/acceptance/10_files/02_maintain/copy_from_depth_search.cf +++ b/tests/acceptance/10_files/02_maintain/copy_from_depth_search.cf @@ -4,38 +4,34 @@ # Redmine 6027 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "source_dirs" slist => { ".", "a.dir/.", "a.dir/b.dir/." }; - "source_files" slist => { "a.file", "a.dir/b.file" }; - files: - "$(G.testdir)_source/$(source_dirs)" - create => "true"; + "source_dirs" slist => { ".", "a.dir/.", "a.dir/b.dir/." }; + "source_files" slist => { "a.file", "a.dir/b.file" }; - "$(G.testdir)_source/$(source_files)" - create => "true"; + files: + "$(G.testdir)_source/$(source_dirs)" create => "true"; + "$(G.testdir)_source/$(source_files)" create => "true"; } bundle agent test { files: - "$(G.testdir)_destination" + "$(G.testdir)_destination" create => "true", copy_from => local_cp("$(G.testdir)_source"), depth_search => recurse("inf"); - "$(G.testdir)_destination_dir/." + "$(G.testdir)_destination_dir/." create => "true", copy_from => local_cp("$(G.testdir)_source"), depth_search => recurse("inf"); @@ -45,17 +41,36 @@ bundle agent check { # test that selected destination file system entries exist with the correct type classes: - "files_ok" and => { strcmp(filestat("$(G.testdir)_destination/a.dir/b.file", "type"), "regular file"), - strcmp(filestat("$(G.testdir)_destination_dir/a.dir/b.file", "type"), "regular file") }; - "dirs_ok" and => { strcmp(filestat("$(G.testdir)_destination", "type"), "directory"), - strcmp(filestat("$(G.testdir)_destination/a.dir/b.dir", "type"), "directory"), - strcmp(filestat("$(G.testdir)_destination_dir/a.dir/b.dir", "type"), "directory") }; + "files_ok" + and => { + strcmp( + filestat("$(G.testdir)_destination/a.dir/b.file", "type"), + "regular file" + ), + strcmp( + filestat("$(G.testdir)_destination_dir/a.dir/b.file", "type"), + "regular file" + ), + }; + + "dirs_ok" + and => { + strcmp(filestat("$(G.testdir)_destination", "type"), "directory"), + strcmp( + filestat("$(G.testdir)_destination/a.dir/b.dir", "type"), "directory" + ), + strcmp( + filestat("$(G.testdir)_destination_dir/a.dir/b.dir", "type"), + "directory" + ), + }; "ok" and => { "files_ok", "dirs_ok" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/copy_from_translatepath.cf b/tests/acceptance/10_files/02_maintain/copy_from_translatepath.cf index f97be13062..72313040ca 100644 --- a/tests/acceptance/10_files/02_maintain/copy_from_translatepath.cf +++ b/tests/acceptance/10_files/02_maintain/copy_from_translatepath.cf @@ -4,12 +4,11 @@ # separators work # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -25,8 +24,7 @@ bundle agent test "path" string => join("$(const.dirsep)$(const.dirsep)", "path_list"); files: - "$(G.testfile)" - copy_from => copy_body("$(path)"); + "$(G.testfile)" copy_from => copy_body("$(path)"); } body copy_from copy_body(file) @@ -41,6 +39,8 @@ bundle agent check "Tested pathname: '$(test.path)'"; methods: - "check" usebundle => dcs_check_diff("$(this.promise_filename)", - "$(G.testfile)", "$(this.promise_filename)"); + "check" + usebundle => dcs_check_diff( + "$(this.promise_filename)", "$(G.testfile)", "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/10_files/02_maintain/copy_linkpattern_from_contains_dots.cf b/tests/acceptance/10_files/02_maintain/copy_linkpattern_from_contains_dots.cf index 16c3b93416..279e27f855 100644 --- a/tests/acceptance/10_files/02_maintain/copy_linkpattern_from_contains_dots.cf +++ b/tests/acceptance/10_files/02_maintain/copy_linkpattern_from_contains_dots.cf @@ -3,72 +3,71 @@ # Test copylink_pattern can handle source symlink that contains '/../' # CFE-2960 ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testdir)/linkdir/" - comment => "Create a directory."; - "$(G.testdir)/linkdir/another/" - comment => "Create another directory."; - "$(G.testdir)/linkdir/another/target" + "$(G.testdir)/linkdir/" comment => "Create a directory."; + "$(G.testdir)/linkdir/another/" comment => "Create another directory."; + + "$(G.testdir)/linkdir/another/target" comment => "A target file.", create => "true"; - "$(G.testdir)/linkdir/link" + + "$(G.testdir)/linkdir/link" comment => "Create a relative link to the target.", link_from => ln_s("$(G.testdir)/linkdir/another/target"); } ####################################################### - bundle agent test { meta: - "description" - string => "Test copylink_pattern can handle source symlink that contains'/../'", - meta => { "CFE-2960" }; + "description" + string => "Test copylink_pattern can handle source symlink that contains'/../'", + meta => { "CFE-2960" }; vars: - "mode" int => "0600"; - "from" string => "$(G.testdir)/linkdir/../linkdir/link"; + "mode" int => "0600"; + "from" string => "$(G.testdir)/linkdir/../linkdir/link"; files: - "$(G.testdir)/copy_file" + "$(G.testdir)/copy_file" comment => "Copy the file behind the link.", perms => test_perms($(mode)), copy_from => cp_2_file("$(from)"); } -body link_from ln_s(x) { - link_type => "relative"; - source => "$(x)"; - when_no_source => "nop"; +body link_from ln_s(x) +{ + link_type => "relative"; + source => "$(x)"; + when_no_source => "nop"; } -body copy_from cp_2_file(x) { - source => "$(x)"; - compare => "binary"; - copy_backup => "false"; - copylink_patterns => { ".*" }; +body copy_from cp_2_file(x) +{ + source => "$(x)"; + compare => "binary"; + copy_backup => "false"; + copylink_patterns => { ".*" }; } -body perms test_perms(m) { - mode => "$(m)"; - owners => { "0" }; - groups => { "0" }; +body perms test_perms(m) +{ + mode => "$(m)"; + owners => { "0" }; + groups => { "0" }; } ####################################################### - bundle agent check { vars: @@ -76,22 +75,28 @@ bundle agent check "expect[modeoct]" string => "\d+$(test.mode)"; "expect[uid]" string => "0"; "expect[gid]" string => "0"; + any:: "expect[nlink]" string => "1"; "expect[size]" string => "0"; - "fields" slist => getindices("expect"); - "result[$(fields)]" string => filestat("$(G.testfile)$(const.dirsep)copy_file", "$(fields)"); + + "result[$(fields)]" + string => filestat( + "$(G.testfile)$(const.dirsep)copy_file", "$(fields)" + ); classes: - "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); + "not_ok" not => regcmp("$(expect[$(fields)])", "$(result[$(fields)])"); reports: DEBUG:: "expected: $(fields) = '$(expect[$(fields)])'"; "got: $(fields) = '$(result[$(fields)])'"; + !not_ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/fifos.cf b/tests/acceptance/10_files/02_maintain/fifos.cf index 8996c5856d..9e6b30b5dd 100644 --- a/tests/acceptance/10_files/02_maintain/fifos.cf +++ b/tests/acceptance/10_files/02_maintain/fifos.cf @@ -1,42 +1,40 @@ # https://dev.cfengine.com/issues/7030 -# - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } bundle agent init { vars: - "test_fifo" string => "$(G.testfile).fifo"; + "test_fifo" string => "$(G.testfile).fifo"; commands: - "$(G.mkfifo) $(test_fifo)"; + "$(G.mkfifo) $(test_fifo)"; } bundle agent test { meta: - "test_skip_unsupported" string => "!has_mkfifo|windows"; + "test_skip_unsupported" string => "!has_mkfifo|windows"; files: - "$(init.test_fifo)" - create => "false", - perms => m("0700"); + "$(init.test_fifo)" + create => "false", + perms => m("0700"); } bundle agent check { classes: - "ok" expression => isexecutable("$(init.test_fifo)"); + "ok" expression => isexecutable("$(init.test_fifo)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; - } diff --git a/tests/acceptance/10_files/02_maintain/line_truncation_at_4096_chars.cf b/tests/acceptance/10_files/02_maintain/line_truncation_at_4096_chars.cf index f72112abf8..f551a5043f 100644 --- a/tests/acceptance/10_files/02_maintain/line_truncation_at_4096_chars.cf +++ b/tests/acceptance/10_files/02_maintain/line_truncation_at_4096_chars.cf @@ -6,82 +6,81 @@ # Ticket: https://cfengine.com/dev/issues/3882 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("${this.promise_filename}") }; - version => "1.0"; - cache_system_functions => "off"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("${this.promise_filename}") }; + version => "1.0"; + cache_system_functions => "off"; } ####################################################### - bundle agent init { vars: any:: - "file_mode" int => "0644"; - "char_number" int => "6144"; - "line_to_add" string => "This is a nice short line."; + "file_mode" int => "0644"; + "char_number" int => "6144"; + "line_to_add" string => "This is a nice short line."; files: - "${G.testfile}" - create => "true", - perms => m("${file_mode}"); + "${G.testfile}" + create => "true", + perms => m("${file_mode}"); # Using system command instead of CFEngine itself to # prevent the bug to be here at file creation too. # It would create a false negative. commands: - "${G.perl}" - args => "-e 'print \"#\" x ${char_number}; print \"ENDMARK\n\"' > ${G.testfile}", - contain => in_shell; + "${G.perl}" + args => "-e 'print \"#\" x ${char_number}; print \"ENDMARK\n\"' > ${G.testfile}", + contain => in_shell; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; files: - "${G.testfile}" - create => "false", - edit_line => insert_lines("${init.line_to_add}"); + "${G.testfile}" + create => "false", + edit_line => insert_lines("${init.line_to_add}"); } ####################################################### - bundle agent check { - classes: !solaris:: # ok is defined if the file still contains ENDMARK, meaning the end of the sample very # long line did not get truncated during file editing - "ok" expression => returnszero("${G.grep} ENDMARK ${G.testfile}", "noshell"); + "ok" + expression => returnszero("${G.grep} ENDMARK ${G.testfile}", "noshell"); + solaris:: # Bug in xpg4 version of Solaris. grep internally has a limit of 4096 chars per line, # which is the very thing we're testing. Use /bin/grep. - "ok" expression => returnszero("/bin/grep ENDMARK ${G.testfile}", "noshell"); + "ok" + expression => returnszero("/bin/grep ENDMARK ${G.testfile}", "noshell"); reports: DEBUG.!ok:: "${this.promise_filename} FAILed as the generated file got at least a line truncated to 4096 characters"; + ok:: "${this.promise_filename} Pass"; + !ok:: "${this.promise_filename} FAIL"; } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("${G.testfile}"); + "any" usebundle => dcs_fini("${G.testfile}"); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/02_maintain/perms_recurse.cf b/tests/acceptance/10_files/02_maintain/perms_recurse.cf index 17b8ea91ca..08e2105690 100644 --- a/tests/acceptance/10_files/02_maintain/perms_recurse.cf +++ b/tests/acceptance/10_files/02_maintain/perms_recurse.cf @@ -1,96 +1,100 @@ # https://dev.cfengine.com/issues/7808 -# - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } bundle agent init { meta: - # Permissions test doesn't work with fakeroot. - # It also doesn't work on non-Linux due to the use of GNU specific find - # options. - "test_skip_needs_work" string => "using_fakeroot|!linux"; + # Permissions test doesn't work with fakeroot. + # It also doesn't work on non-Linux due to the use of GNU specific find + # options. + "test_skip_needs_work" string => "using_fakeroot|!linux"; vars: - "directory" string => "$(G.testdir)"; - - "mode" string => "750"; - "owner" string => "bin"; - "group" string => "bin"; + "directory" string => "$(G.testdir)"; + "mode" string => "750"; + "owner" string => "bin"; + "group" string => "bin"; files: - "$(directory)/." - perms => mog("000", "root", "0"), - create => "true"; + "$(directory)/." + perms => mog("000", "root", "0"), + create => "true"; - "$(directory)/dir1/." - perms => mog("000", "root", "0"), - create => "true"; - - "$(directory)/dir2/." - perms => mog("000", "root", "0"), - create => "true"; + "$(directory)/dir1/." + perms => mog("000", "root", "0"), + create => "true"; + "$(directory)/dir2/." + perms => mog("000", "root", "0"), + create => "true"; } bundle agent test { files: - "$(init.directory)" - create => "false", - perms => mog("${init.mode}", "${init.owner}", "${init.group}"), - depth_search => recurse_with_base("inf"), - file_select => dirs; + "$(init.directory)" + create => "false", + perms => mog("${init.mode}", "${init.owner}", "${init.group}"), + depth_search => recurse_with_base("inf"), + file_select => dirs; } body file_select dirs # @brief Select directories { - file_types => { "dir" }; - file_result => "file_types"; + file_types => { "dir" }; + file_result => "file_types"; } - bundle agent check { - vars: - "permissions_test_mode" string => "/usr/bin/test \"`/usr/bin/find ${init.directory} -perm ${init.mode} | wc -l`\" = \"3\""; - "permissions_test_owner" string => "/usr/bin/test \"`/usr/bin/find ${init.directory} -user ${init.owner} | wc -l`\" = \"3\""; - "permissions_test_group" string => "/usr/bin/test \"`/usr/bin/find ${init.directory} -group ${init.group} | wc -l`\" = \"3\""; + "permissions_test_mode" + string => "/usr/bin/test \"`/usr/bin/find ${init.directory} -perm ${init.mode} | wc -l`\" = \"3\""; + + "permissions_test_owner" + string => "/usr/bin/test \"`/usr/bin/find ${init.directory} -user ${init.owner} | wc -l`\" = \"3\""; + + "permissions_test_group" + string => "/usr/bin/test \"`/usr/bin/find ${init.directory} -group ${init.group} | wc -l`\" = \"3\""; commands: "${permissions_test_mode}" - contain => in_shell, - classes => ok("permissions_test_mode_ok"); + contain => in_shell, + classes => ok("permissions_test_mode_ok"); + "${permissions_test_owner}" - contain => in_shell, - classes => ok("permissions_test_owner_ok"); + contain => in_shell, + classes => ok("permissions_test_owner_ok"); + "${permissions_test_group}" - contain => in_shell, - classes => ok("permissions_test_group_ok"); + contain => in_shell, + classes => ok("permissions_test_group_ok"); reports: DEBUG.!permissions_test_mode_ok:: "Didn't find 3 files with mode ${init.mode}"; + DEBUG.!permissions_test_owner_ok:: "Didn't find 3 files with owner${init.owner}"; + DEBUG.!permissions_test_group_ok:: "Didn't find 3 files with group ${init.group}"; + permissions_test_mode_ok.permissions_test_owner_ok.permissions_test_group_ok:: "$(this.promise_filename) Pass"; + !(permissions_test_mode_ok.permissions_test_owner_ok.permissions_test_group_ok):: "$(this.promise_filename) FAIL"; - } body classes ok(classname) { - promise_repaired => { "$(classname)" }; - promise_kept => { "$(classname)" }; + promise_repaired => { "$(classname)" }; + promise_kept => { "$(classname)" }; } diff --git a/tests/acceptance/10_files/02_maintain/relative_link_and_move_obstructions.cf b/tests/acceptance/10_files/02_maintain/relative_link_and_move_obstructions.cf index 36f8ba6090..6d0879a6df 100644 --- a/tests/acceptance/10_files/02_maintain/relative_link_and_move_obstructions.cf +++ b/tests/acceptance/10_files/02_maintain/relative_link_and_move_obstructions.cf @@ -4,43 +4,41 @@ # to succeed # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; - "test_suppress_fail" string => "freebsd", - meta => { "redmine5261" }; + "test_skip_unsupported" string => "windows"; + + "test_suppress_fail" + string => "freebsd", + meta => { "redmine5261" }; vars: - "inode" string => filestat("$(G.etc_group)", "ino"); + "inode" string => filestat("$(G.etc_group)", "ino"); files: - "$(G.testfile)" + "$(G.testfile)" create => "true", move_obstructions => "true", link_from => test_link; @@ -48,37 +46,42 @@ bundle agent test body link_from test_link { - source => "$(G.etc_group)"; - link_type => "relative"; + source => "$(G.etc_group)"; + link_type => "relative"; } ####################################################### - bundle agent check { vars: - "result" string => filestat(filestat("$(G.testfile)", "linktarget"), "ino"); - "Lresult" string => filestat("$(G.testfile)", "ino"); + "result" string => filestat(filestat("$(G.testfile)", "linktarget"), "ino"); + "Lresult" string => filestat("$(G.testfile)", "ino"); - # This tells us where the link points, but don't follow it - "link_target" string => filestat("$(G.testfile)", "linktarget_shallow"); + # This tells us where the link points, but don't follow it + "link_target" string => filestat("$(G.testfile)", "linktarget_shallow"); classes: - "okL" not => strcmp("$(test.inode)", "$(Lresult)"); - "okT" not => strcmp("$(link_target)", "$(G.etc_group)"); - "ok" and => { "okL", "okT", - strcmp("$(test.inode)", "$(result)"), - # Test that the symlink target starts with dot - regcmp("\..*", "$(link_target)") - }; + "okL" not => strcmp("$(test.inode)", "$(Lresult)"); + "okT" not => strcmp("$(link_target)", "$(G.etc_group)"); + + "ok" + and => { + "okL", + "okT", + strcmp("$(test.inode)", "$(result)"), + # Test that the symlink target starts with dot + regcmp("\..*", "$(link_target)"), + }; reports: DEBUG:: "expected: '$(test.inode)'"; "got: '$(Lresult)' => '$(result)'"; "got this too: '$(G.etc_group)' => '$(link_target)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/relative_link_and_no_move_obstructions.cf b/tests/acceptance/10_files/02_maintain/relative_link_and_no_move_obstructions.cf index 9c4b57c639..6f97b32a03 100644 --- a/tests/acceptance/10_files/02_maintain/relative_link_and_no_move_obstructions.cf +++ b/tests/acceptance/10_files/02_maintain/relative_link_and_no_move_obstructions.cf @@ -4,20 +4,18 @@ # to change it to an relative link (but fail to) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", move_obstructions => "true", link_from => init_link; @@ -25,54 +23,56 @@ bundle agent init body link_from init_link { - source => "$(G.etc_group)"; - link_type => "absolute"; + source => "$(G.etc_group)"; + link_type => "absolute"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; vars: - "inode" string => filestat("$(G.etc_group)", "ino"); + "inode" string => filestat("$(G.etc_group)", "ino"); files: - "$(G.testfile)" + "$(G.testfile)" classes => init_if_failed("test_ok"), link_from => test_link; } body link_from test_link { - source => "$(G.etc_group)"; - link_type => "relative"; + source => "$(G.etc_group)"; + link_type => "relative"; } body classes init_if_failed(c) { - repair_failed => { "$(c)" }; + repair_failed => { "$(c)" }; } ####################################################### - bundle agent check { vars: - "result" string => filestat(filestat("$(G.testfile)", "linktarget"), "ino"); - "Lresult" string => filestat("$(G.testfile)", "ino"); + "result" string => filestat(filestat("$(G.testfile)", "linktarget"), "ino"); + "Lresult" string => filestat("$(G.testfile)", "ino"); - # This tells us where the link points - "link_target" string => filestat("$(G.testfile)", "linktarget"); + # This tells us where the link points + "link_target" string => filestat("$(G.testfile)", "linktarget"); classes: - "okL" not => strcmp("$(test.inode)", "$(Lresult)"); - "ok" and => { "test_ok", "okL", - strcmp("$(test.inode)", "$(result)"), - # Might be slightly different from link_target because of redundant '../../'. - regcmp("/.*/group", "$(link_target)") + "okL" not => strcmp("$(test.inode)", "$(Lresult)"); + + "ok" + and => { + "test_ok", + "okL", + strcmp("$(test.inode)", "$(result)"), + # Might be slightly different from link_target because of redundant '../../'. + regcmp("/.*/group", "$(link_target)"), }; reports: @@ -80,8 +80,10 @@ bundle agent check "expected: '$(test.inode)'"; "got: '$(Lresult)' => '$(result)'"; "got this too: '$(G.etc_group)' => '$(link_target)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/staging/302.cf b/tests/acceptance/10_files/02_maintain/staging/302.cf index a97baaa9ab..c4315d2ada 100644 --- a/tests/acceptance/10_files/02_maintain/staging/302.cf +++ b/tests/acceptance/10_files/02_maintain/staging/302.cf @@ -4,106 +4,119 @@ # have "promise_repaired" # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "testfile" string => "/tmp/TEST.cfengine"; + "testfile" string => "/tmp/TEST.cfengine"; classes: - "cxl_succ" expression => "any"; - "cxl_fail" expression => "any"; + "cxl_succ" expression => "any"; + "cxl_fail" expression => "any"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" + "$(G.testfile)" perms => init_mog, copy_from => init_copy("$(G.etc_group)"); } body perms init_mog { - mode => "751"; - owners => { "bin" }; - groups => { "bin" }; + mode => "751"; + owners => { "bin" }; + groups => { "bin" }; } body copy_from init_copy(fn) { - source => "$(fn)"; - compare => "digest"; + source => "$(fn)"; + compare => "digest"; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" perms => init_mog, copy_from => init_copy("$(G.etc_passwd)"), - classes => test_classes("failure", "success", "failure", "failure", "cxl_fail", "cxl_succ", "cxl_fail"); + classes => test_classes( + "failure", + "success", + "failure", + "failure", + "cxl_fail", + "cxl_succ", + "cxl_fail" + ); } body classes test_classes(kep, rep, fai, xxx, cxl_kep, cxl_rep, cxl_nkp) { - promise_kept => { "$(kep)" }; - promise_repaired => { "$(rep)" }; - repair_failed => { "$(fai)" }; - repair_denied => { "$(fai)" }; - repair_timeout => { "$(fai)" }; - cancel_kept => { "$(cxl_kep)" }; - cancel_repaired => { "$(cxl_rep)" }; - cancel_notkept => { "$(cxl_nkp)" }; + promise_kept => { "$(kep)" }; + promise_repaired => { "$(rep)" }; + repair_failed => { "$(fai)" }; + repair_denied => { "$(fai)" }; + repair_timeout => { "$(fai)" }; + cancel_kept => { "$(cxl_kep)" }; + cancel_repaired => { "$(cxl_rep)" }; + cancel_notkept => { "$(cxl_nkp)" }; } ####################################################### - bundle agent check { classes: - "ok" and => { "success", "!cxl_succ", "!failure", "cxl_fail" }; + "ok" and => { "success", "!cxl_succ", "!failure", "cxl_fail" }; reports: DEBUG.success:: "class 'success' was set (should be)"; + DEBUG.!success:: "class 'success' was not set (should be)"; + DEBUG.cxl_succ:: "class 'cxl_succ' was still set (should not be)"; + DEBUG.!cxl_succ:: "class 'cxl_succ' was not still set (should not be)"; + DEBUG.failure:: "class 'failure' was set (should not be)"; + DEBUG.!failure:: "class 'failure' was not set (should not be)"; + DEBUG.cxl_fail:: "class 'cxl_fail' was still set (should be)"; + DEBUG.!cxl_fail:: "class 'cxl_fail' was not still set (should not be)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("$(G.testfile)"); + "any" usebundle => dcs_fini("$(G.testfile)"); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/02_maintain/staging/401.cf b/tests/acceptance/10_files/02_maintain/staging/401.cf index c4d35681e3..303972a2ed 100644 --- a/tests/acceptance/10_files/02_maintain/staging/401.cf +++ b/tests/acceptance/10_files/02_maintain/staging/401.cf @@ -1,84 +1,77 @@ ####################################################### # -# -# ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - bundle common g { vars: - "testfile" string => "/tmp/TEST.cfengine"; + "testfile" string => "/tmp/TEST.cfengine"; } ####################################################### - bundle agent init { files: - "$(G.testfile).*" - delete => init_delete; + "$(G.testfile).*" delete => init_delete; - "$(G.testfile)" + "$(G.testfile)" move_obstructions => "true", copy_from => init_copy; } body copy_from init_copy { - source => "$(G.etc_group)"; - compare => "digest"; + source => "$(G.etc_group)"; + compare => "digest"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" move_obstructions => "true", copy_from => test_copy; } body copy_from test_copy { - source => "$(G.etc_motd)"; - compare => "digest"; + source => "$(G.etc_motd)"; + compare => "digest"; } ####################################################### - bundle agent check { classes: - "ok" expression => fileexists("$(G.testfile).cfsaved"); + "ok" expression => fileexists("$(G.testfile).cfsaved"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("$(G.testfile)"); + "any" usebundle => dcs_fini("$(G.testfile)"); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/02_maintain/staging/402.cf b/tests/acceptance/10_files/02_maintain/staging/402.cf index 0fc20b4058..5c84043986 100644 --- a/tests/acceptance/10_files/02_maintain/staging/402.cf +++ b/tests/acceptance/10_files/02_maintain/staging/402.cf @@ -1,91 +1,85 @@ ####################################################### # -# -# ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } body agent control { - default_repository => "/var/tmp"; + default_repository => "/var/tmp"; } bundle common g { vars: - "testfile" string => "/tmp/TEST.cfengine"; - "repofile" string => "_tmp_TEST.cfengine"; - "repo" string => "/var/tmp"; + "testfile" string => "/tmp/TEST.cfengine"; + "repofile" string => "_tmp_TEST.cfengine"; + "repo" string => "/var/tmp"; } ####################################################### - bundle agent init { files: - "$(g.repofile).*" - delete => init_delete; + "$(g.repofile).*" delete => init_delete; + "$(G.testfile).*" delete => init_delete; - "$(G.testfile).*" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" move_obstructions => "true", copy_from => init_copy; } body copy_from init_copy { - source => "$(G.etc_group)"; - compare => "digest"; + source => "$(G.etc_group)"; + compare => "digest"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" move_obstructions => "true", copy_from => test_copy; } body copy_from test_copy { - source => "$(G.etc_motd)"; - compare => "digest"; + source => "$(G.etc_motd)"; + compare => "digest"; } ####################################################### - bundle agent check { classes: - "test" not => fileexists("$(G.testfile).cfsaved"); - "repo" expression => fileexists("$(g.repo)/$(g.repofile).cfsaved"); - "ok" and => { "test", "repo" }; + "test" not => fileexists("$(G.testfile).cfsaved"); + "repo" expression => fileexists("$(g.repo)/$(g.repofile).cfsaved"); + "ok" and => { "test", "repo" }; reports: DEBUG:: "testfile = $(G.testfile)"; "repo = $(g.repo)"; "repofile = $(g.repofile)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/02_maintain/staging/405.cf b/tests/acceptance/10_files/02_maintain/staging/405.cf index a95f641a4c..f6e125fb9d 100644 --- a/tests/acceptance/10_files/02_maintain/staging/405.cf +++ b/tests/acceptance/10_files/02_maintain/staging/405.cf @@ -1,58 +1,50 @@ ####################################################### # -# -# ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "testfile" string => "/tmp/TEST.cfengine"; - "repofile" string => "_tmp_TEST.cfengine"; - "repo" string => "/var/tmp"; + "testfile" string => "/tmp/TEST.cfengine"; + "repofile" string => "_tmp_TEST.cfengine"; + "repo" string => "/var/tmp"; } ####################################################### - bundle agent init { files: - "$(g.repo)/$(g.repofile).*" - delete => init_delete; + "$(g.repo)/$(g.repofile).*" delete => init_delete; + "$(G.testfile).*" delete => init_delete; - "$(G.testfile).*" - delete => init_delete; - - "$(G.testfile)" + "$(G.testfile)" move_obstructions => "true", copy_from => init_copy; } body copy_from init_copy { - source => "$(G.etc_group)"; - compare => "digest"; + source => "$(G.etc_group)"; + compare => "digest"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" move_obstructions => "true", repository => "$(g.repo)", copy_from => test_copy; @@ -60,37 +52,38 @@ bundle agent test body copy_from test_copy { - source => "$(G.etc_motd)"; - compare => "digest"; + source => "$(G.etc_motd)"; + compare => "digest"; } ####################################################### - bundle agent check { classes: - "test" not => fileexists("$(G.testfile).cfsaved"); - "repo" expression => fileexists("$(g.repo)/$(g.repofile).cfsaved"); - "ok" and => { "test", "repo" }; + "test" not => fileexists("$(G.testfile).cfsaved"); + "repo" expression => fileexists("$(g.repo)/$(g.repofile).cfsaved"); + "ok" and => { "test", "repo" }; reports: DEBUG:: "testfile = $(G.testfile)"; "repo = $(g.repo)"; "repofile = $(g.repofile)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("$(G.testfile)"); - "any" usebundle => dcs_fini("$(g.repo)/$(g.repofile)"); + "any" usebundle => dcs_fini("$(G.testfile)"); + "any" usebundle => dcs_fini("$(g.repo)/$(g.repofile)"); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/02_maintain/staging/copy-select-link-dereference.cf b/tests/acceptance/10_files/02_maintain/staging/copy-select-link-dereference.cf index 723916e80e..b60766faf3 100644 --- a/tests/acceptance/10_files/02_maintain/staging/copy-select-link-dereference.cf +++ b/tests/acceptance/10_files/02_maintain/staging/copy-select-link-dereference.cf @@ -4,89 +4,81 @@ # link -> dir1 # # We want to copy only what link points to, without explicitly specifying the link name. - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { commands: - "$(G.mkdir) -p $(G.testdir)/from/dir1"; - "$(G.mkdir) -p $(G.testdir)/from/dir2"; - "$(G.echo) 'indir1' > $(G.testdir)/from/dir1/file1" - contain => in_shell; - "$(G.echo) 'indir2' > $(G.testdir)/from/dir2/file2" - contain => in_shell; - "$(G.ln) -s dir1 link", - contain => in_dir("$(G.testdir)/from"); + "$(G.mkdir) -p $(G.testdir)/from/dir1"; + "$(G.mkdir) -p $(G.testdir)/from/dir2"; + "$(G.echo) 'indir1' > $(G.testdir)/from/dir1/file1" contain => in_shell; + "$(G.echo) 'indir2' > $(G.testdir)/from/dir2/file2" contain => in_shell; + "$(G.ln) -s dir1 link" contain => in_dir("$(G.testdir)/from"); } - -bundle agent test +bundle agent test { vars: - "regular_dirs" slist => { ".*dir1",".*dir2" }; + "regular_dirs" slist => { ".*dir1", ".*dir2" }; files: - - "$(G.testdir)/to" + "$(G.testdir)/to" copy_from => dereference_all("$(G.testdir)/from"), depth_search => recurse("inf"), - file_select => links_to( "@(regular_dirs)" ); + file_select => links_to("@(regular_dirs)"); } - bundle agent check { vars: - "file1_contents" string => readfile("$(G.testdir)/to/dir1/file1", 100); + "file1_contents" string => readfile("$(G.testdir)/to/dir1/file1", 100); classes: - "file1_contents_correct" expression => strcmp("$(file1_contents)", "indir1"); - "file2_exists" expression => fileexists("$(G.testdir)/to/dir2/file2"); + "file1_contents_correct" + expression => strcmp("$(file1_contents)", "indir1"); - "ok" expression => "file1_contents_correct.(!file2_exists)"; + "file2_exists" expression => fileexists("$(G.testdir)/to/dir2/file2"); + "ok" expression => "file1_contents_correct.(!file2_exists)"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; - - } - body contain in_dir(s) { - chdir => "$(s)"; + chdir => "$(s)"; } body contain in_shell { - useshell => "true"; + useshell => "true"; } body copy_from dereference_all(from) { - source => "$(from)"; - copylink_patterns => { ".*" }; + source => "$(from)"; + copylink_patterns => { ".*" }; } body file_select links_to(list) { - issymlinkto => { @(list) }; - file_result => "issymlinkto"; + issymlinkto => { @(list) }; + file_result => "issymlinkto"; } body depth_search recurse(d) { - depth => "$(d)"; - xdev => "true"; + depth => "$(d)"; + xdev => "true"; } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/02_maintain/staging/edit_immutable.cf b/tests/acceptance/10_files/02_maintain/staging/edit_immutable.cf index 47d863c42e..7e9f0fa2fe 100644 --- a/tests/acceptance/10_files/02_maintain/staging/edit_immutable.cf +++ b/tests/acceptance/10_files/02_maintain/staging/edit_immutable.cf @@ -4,47 +4,45 @@ # Redmine#2100: Test chmod of an immutable file # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle common chattr { vars: - "chattr" string => "/usr/bin/chattr"; + "chattr" string => "/usr/bin/chattr"; classes: - "have_chattr" expression => fileexists($(chattr)); + "have_chattr" expression => fileexists($(chattr)); } bundle agent init { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } bundle agent test { methods: - "1" usebundle => test_setup($(G.testfile)); - "2" usebundle => test_edit($(G.testfile)); - "2" usebundle => test_chmod($(G.testfile)); - "3" usebundle => test_teardown($(G.testfile)); + "1" usebundle => test_setup($(G.testfile)); + "2" usebundle => test_edit($(G.testfile)); + "2" usebundle => test_chmod($(G.testfile)); + "3" usebundle => test_teardown($(G.testfile)); } bundle agent test_setup(file) { commands: have_chattr:: - "$(chattr.chattr)" args => "+i $(file)", - classes => scoped_classes_generic("namespace", "chattr"); + "$(chattr.chattr)" + args => "+i $(file)", + classes => scoped_classes_generic("namespace", "chattr"); } bundle agent test_edit(file) @@ -52,8 +50,8 @@ bundle agent test_edit(file) files: have_chattr:: "$(file)" - edit_line => test_edit_line(), - classes => scoped_classes_generic("namespace", "test"); + edit_line => test_edit_line(), + classes => scoped_classes_generic("namespace", "test"); } bundle agent test_chmod(file) @@ -61,53 +59,57 @@ bundle agent test_chmod(file) files: have_chattr:: "$(file)" - perms => m("755"), - classes => scoped_classes_generic("namespace", "chmod"); + perms => m("755"), + classes => scoped_classes_generic("namespace", "chmod"); } body perms m(mode) { - mode => "$(mode)"; + mode => "$(mode)"; } bundle agent test_teardown(file) { commands: have_chattr:: - "$(chattr.chattr)" args => "-i $(file)", - classes => scoped_classes_generic("namespace", "chattr"); + "$(chattr.chattr)" + args => "-i $(file)", + classes => scoped_classes_generic("namespace", "chattr"); } bundle edit_line test_edit_line() { insert_lines: - "blah"; + "blah"; } ####################################################### - bundle agent check { classes: - # we're OK if: - # - we don't have chattr - # - chattr failed to DTRT (e.g. we're not root) - # - the test failed to edit - # - the test denied the chmod (TODO: should it be "denied" or "failed"? - "ok" expression => "!have_chattr|chattr_failed|(test_failed.!test_kept.!test_denied.!test_timeout.!test_repaired.!chmod_failed.!chmod_kept.chmod_denied.!chmod_timeout.!chmod_repaired)"; + # we're OK if: + # - we don't have chattr + # - chattr failed to DTRT (e.g. we're not root) + # - the test failed to edit + # - the test denied the chmod (TODO: should it be "denied" or "failed"? + "ok" + expression => "!have_chattr|chattr_failed|(test_failed.!test_kept.!test_denied.!test_timeout.!test_repaired.!chmod_failed.!chmod_kept.chmod_denied.!chmod_timeout.!chmod_repaired)"; methods: - "report" usebundle => dcs_report_generic_classes("test"); - "report" usebundle => dcs_report_generic_classes("chmod"); - "report" usebundle => dcs_report_generic_classes("chattr"); + "report" usebundle => dcs_report_generic_classes("test"); + "report" usebundle => dcs_report_generic_classes("chmod"); + "report" usebundle => dcs_report_generic_classes("chattr"); reports: DEBUG.!have_chattr:: "Without $(chattr.chattr), the test will always pass"; + DEBUG.chattr_failed:: "Since you can't run $(chattr.chattr) to set attributes, the test will always pass"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/staging/line_truncation_at_4096_chars.cf b/tests/acceptance/10_files/02_maintain/staging/line_truncation_at_4096_chars.cf index ffeaf564e5..78d80d4453 100644 --- a/tests/acceptance/10_files/02_maintain/staging/line_truncation_at_4096_chars.cf +++ b/tests/acceptance/10_files/02_maintain/staging/line_truncation_at_4096_chars.cf @@ -6,92 +6,90 @@ # Ticket: https://cfengine.com/dev/issues/3882 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("${this.promise_filename}") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("${this.promise_filename}") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: any:: - "file_mode" int => "0644"; - "char_number" int => "6144"; - "line_to_add" string => "This is a nice short line."; + "file_mode" int => "0644"; + "char_number" int => "6144"; + "line_to_add" string => "This is a nice short line."; files: - "${G.testfile}" - create => "true", - perms => m("${file_mode}"); + "${G.testfile}" + create => "true", + perms => m("${file_mode}"); # Using system command instead of CFEngine itself to # prevent the bug to be here at file creation too. # It would create a false negative. commands: - "${G.perl}" - args => "-e 'print \"#\" x ${char_number}; print \"ENDMARK\n\"' > ${G.testfile}", - contain => in_shell; + "${G.perl}" + args => "-e 'print \"#\" x ${char_number}; print \"ENDMARK\n\"' > ${G.testfile}", + contain => in_shell; } body perms m(mode) { - mode => "${mode}"; + mode => "${mode}"; } body contain in_shell { - useshell => "true"; # canonical "useshell" but this is backwards-compatible + useshell => "true"; + + # canonical "useshell" but this is backwards-compatible } ####################################################### - bundle agent test { - files: - "${G.testfile}" - create => "false", - edit_line => insert_lines("${init.line_to_add}"); + "${G.testfile}" + create => "false", + edit_line => insert_lines("${init.line_to_add}"); } bundle edit_line insert_lines(lines) { -insert_lines: - - "${lines}" - comment => "Append lines if they don't exist"; + insert_lines: + "${lines}" comment => "Append lines if they don't exist"; } ####################################################### - bundle agent check { - classes: - # ok is defined if the file still contains ENDMARK, meaning the end of the sample very - # long line did not get truncated during file editing - "ok" expression => returnszero("${G.grep} -q ENDMARK ${G.testfile}", "noshell"); + # ok is defined if the file still contains ENDMARK, meaning the end of the sample very + # long line did not get truncated during file editing + "ok" + expression => returnszero( + "${G.grep} -q ENDMARK ${G.testfile}", "noshell" + ); reports: DEBUG.!ok:: "${this.promise_filename} FAILed as the generated file got at least a line truncated to 4096 characters"; + ok:: "${this.promise_filename} Pass"; + !ok:: "${this.promise_filename} FAIL"; } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("${G.testfile}"); + "any" usebundle => dcs_fini("${G.testfile}"); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/02_maintain/symlink_link_and_no_move_obstructions.cf b/tests/acceptance/10_files/02_maintain/symlink_link_and_no_move_obstructions.cf index 539b3dbf48..e3c889a941 100644 --- a/tests/acceptance/10_files/02_maintain/symlink_link_and_no_move_obstructions.cf +++ b/tests/acceptance/10_files/02_maintain/symlink_link_and_no_move_obstructions.cf @@ -4,20 +4,18 @@ # be unhappy with that (symlink is supposed to be synonymous with absolute) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", move_obstructions => "true", link_from => init_link; @@ -25,66 +23,73 @@ bundle agent init body link_from init_link { - source => "$(G.etc_group)"; - link_type => "relative"; + source => "$(G.etc_group)"; + link_type => "relative"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; - "test_suppress_fail" string => "freebsd", - meta => { "redmine5261" }; + "test_skip_unsupported" string => "windows"; + + "test_suppress_fail" + string => "freebsd", + meta => { "redmine5261" }; vars: - "inode" string => filestat("$(G.etc_group)", "ino"); + "inode" string => filestat("$(G.etc_group)", "ino"); files: - "$(G.testfile)" + "$(G.testfile)" classes => test_if_ok("test_ok"), link_from => test_link; } body link_from test_link { - source => "$(G.etc_group)"; - link_type => "symlink"; + source => "$(G.etc_group)"; + link_type => "symlink"; } body classes test_if_ok(c) { - repair_failed => { "$(c)" }; + repair_failed => { "$(c)" }; } ####################################################### - bundle agent check { vars: - "result" string => filestat(filestat("$(G.testfile)", "linktarget"), "ino"); - "Lresult" string => filestat("$(G.testfile)", "ino"); + "result" string => filestat(filestat("$(G.testfile)", "linktarget"), "ino"); + "Lresult" string => filestat("$(G.testfile)", "ino"); - # This tells us where the link points - "link_target" string => filestat("$(G.testfile)", "linktarget_shallow"); + # This tells us where the link points + "link_target" string => filestat("$(G.testfile)", "linktarget_shallow"); classes: - "okL" not => strcmp("$(test.inode)", "$(Lresult)"); - "okT" not => strcmp("$(link_target)", "$(G.etc_group)"); - "ok" and => { "test_ok", "okL", "okT", - strcmp("$(test.inode)", "$(result)"), - # Test that the symlink target starts with dot - regcmp("\..*", "$(link_target)") - }; + "okL" not => strcmp("$(test.inode)", "$(Lresult)"); + "okT" not => strcmp("$(link_target)", "$(G.etc_group)"); + + "ok" + and => { + "test_ok", + "okL", + "okT", + strcmp("$(test.inode)", "$(result)"), + # Test that the symlink target starts with dot + regcmp("\..*", "$(link_target)"), + }; reports: DEBUG:: "expected: '$(test.inode)'"; "got: '$(Lresult)' => '$(result)'"; "got this too: '$(G.etc_group)' => '$(link_target)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/symlink_link_kept.cf b/tests/acceptance/10_files/02_maintain/symlink_link_kept.cf index 3d3ba346cf..c96f6057dc 100644 --- a/tests/acceptance/10_files/02_maintain/symlink_link_kept.cf +++ b/tests/acceptance/10_files/02_maintain/symlink_link_kept.cf @@ -4,76 +4,76 @@ # be happy with that # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).linked_to" - create => "true"; - "$(G.testfile)" - create => "true", - move_obstructions => "true", - link_from => init_link; + "$(G.testfile).linked_to" create => "true"; + + "$(G.testfile)" + create => "true", + move_obstructions => "true", + link_from => init_link; } body link_from init_link { - source => "$(G.testfile).linked_to"; - link_type => "absolute"; + source => "$(G.testfile).linked_to"; + link_type => "absolute"; } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; vars: - "inode" string => filestat("$(G.testfile).linked_to", "ino"); + "inode" string => filestat("$(G.testfile).linked_to", "ino"); files: - "$(G.testfile)" + "$(G.testfile)" classes => test_if_ok("test_ok"), link_from => test_link; } body link_from test_link { - source => "$(G.testfile).linked_to"; - link_type => "symlink"; + source => "$(G.testfile).linked_to"; + link_type => "symlink"; } body classes test_if_ok(c) { - promise_kept => { "$(c)" }; + promise_kept => { "$(c)" }; } ####################################################### - bundle agent check { vars: - "result" string => filestat(filestat("$(G.testfile)", "linktarget"), "ino"); - "Lresult" string => filestat("$(G.testfile)", "ino"); + "result" string => filestat(filestat("$(G.testfile)", "linktarget"), "ino"); + "Lresult" string => filestat("$(G.testfile)", "ino"); - # This tells us where the link points - "link_target" string => filestat("$(G.testfile)", "linktarget"); + # This tells us where the link points + "link_target" string => filestat("$(G.testfile)", "linktarget"); classes: - "okL" not => strcmp("$(test.inode)", "$(Lresult)"); - "ok" and => { "test_ok", "okL", - strcmp("$(test.inode)", "$(result)"), - strcmp("$(link_target)", "$(G.testfile).linked_to") + "okL" not => strcmp("$(test.inode)", "$(Lresult)"); + + "ok" + and => { + "test_ok", + "okL", + strcmp("$(test.inode)", "$(result)"), + strcmp("$(link_target)", "$(G.testfile).linked_to"), }; reports: @@ -81,8 +81,10 @@ bundle agent check "expected: '$(test.inode)'"; "got: '$(Lresult)' => '$(result)'"; "got this too: '$(G.testfile).linked_to' => '$(link_target)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/02_maintain/touch.cf b/tests/acceptance/10_files/02_maintain/touch.cf index f5da1c0cb1..c1f1e5af19 100644 --- a/tests/acceptance/10_files/02_maintain/touch.cf +++ b/tests/acceptance/10_files/02_maintain/touch.cf @@ -4,50 +4,48 @@ # Redmine 3172 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" touch => "true", action => warn_only, classes => if_repaired("wrong_class_set"); - "$(G.testfile)_not_there" + "$(G.testfile)_not_there" touch => "true", action => warn_only; - "$(G.testfile)_there" - touch => "true"; + "$(G.testfile)_there" touch => "true"; } bundle agent check { vars: - "wrong_classes" slist => classesmatching("wrong_.*"); - classes: - "wrong_file_there" expression => fileexists("$(G.testfile)_not_there"); - "right_file_there" expression => fileexists("$(G.testfile)_there"); + "wrong_classes" slist => classesmatching("wrong_.*"); - "ok" and => { "right_file_there", "!wrong_file_there", "!wrong_class_set" }; + classes: + "wrong_file_there" expression => fileexists("$(G.testfile)_not_there"); + "right_file_there" expression => fileexists("$(G.testfile)_there"); + "ok" and => { "right_file_there", "!wrong_file_there", "!wrong_class_set" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; diff --git a/tests/acceptance/10_files/03_transform/001.cf b/tests/acceptance/10_files/03_transform/001.cf index 4feec0f1e4..9a974265ee 100644 --- a/tests/acceptance/10_files/03_transform/001.cf +++ b/tests/acceptance/10_files/03_transform/001.cf @@ -3,16 +3,14 @@ # Ensure that the transformer runs for every file in a recursive tree # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: @@ -20,30 +18,26 @@ bundle agent init "files" slist => { "1", "2", "3" }; files: - "$(G.testdir)/." - create => "true"; - - "$(G.testdir)/$(files)" - copy_from => init_copy("$(G.etc_group)"); + "$(G.testdir)/." create => "true"; + "$(G.testdir)/$(files)" copy_from => init_copy("$(G.etc_group)"); } body copy_from init_copy(file) { - source => "$(file)"; + source => "$(file)"; } body classes init_set_class(class) { - promise_kept => { "$(class)" }; - promise_repaired => { "$(class)" }; + promise_kept => { "$(class)" }; + promise_repaired => { "$(class)" }; } ####################################################### - bundle agent test { files: - "$(G.testdir)" + "$(G.testdir)" transformer => "$(G.gzip) $(this.promiser)", file_select => test_plain, depth_search => test_recurse; @@ -51,36 +45,36 @@ bundle agent test body file_select test_plain { - file_types => { "plain" }; - file_result => "file_types"; + file_types => { "plain" }; + file_result => "file_types"; } body depth_search test_recurse { - depth => "inf"; + depth => "inf"; } ####################################################### - bundle agent check { vars: - "files" slist => { @{init.files} }; + "files" slist => { @{init.files} }; classes: - "ok$(files)" expression => fileexists("$(G.testdir)/$(files).gz"); - "ok" and => { "ok1", "ok2", "ok3" }; + "ok$(files)" expression => fileexists("$(G.testdir)/$(files).gz"); + "ok" and => { "ok1", "ok2", "ok3" }; reports: DEBUG:: - "$(G.testdir)/$(files).gz exists as expected" - if => "ok$(files)"; - "$(G.testdir)/$(files).gz was not created!" - if => "!ok$(files)"; + "$(G.testdir)/$(files).gz exists as expected" if => "ok$(files)"; + "$(G.testdir)/$(files).gz was not created!" if => "!ok$(files)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/03_transform/002.cf b/tests/acceptance/10_files/03_transform/002.cf index 7fb227822d..d9c9c5bf21 100644 --- a/tests/acceptance/10_files/03_transform/002.cf +++ b/tests/acceptance/10_files/03_transform/002.cf @@ -3,16 +3,14 @@ # Ensure that the transformer does not run when --dry-run is used # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: @@ -20,42 +18,38 @@ bundle agent init "files" slist => { "1", "2", "3" }; files: - "$(G.testdir)/." - create => "true"; - - "$(G.testdir)/$(files)" - copy_from => init_copy("$(G.etc_group)"); + "$(G.testdir)/." create => "true"; + "$(G.testdir)/$(files)" copy_from => init_copy("$(G.etc_group)"); } body copy_from init_copy(file) { - source => "$(file)"; + source => "$(file)"; } body classes init_set_class(class) { - promise_kept => { "$(class)" }; - promise_repaired => { "$(class)" }; + promise_kept => { "$(class)" }; + promise_repaired => { "$(class)" }; } ####################################################### - bundle agent test { commands: - "$(sys.cf_agent) -f $(this.promise_filename) -D AUTO -K -b init,test_dry_run --dry-run" + "$(sys.cf_agent) -f $(this.promise_filename) -D AUTO -K -b init,test_dry_run --dry-run" contain => start_from_cwd; } body contain start_from_cwd { - chdir => "$(G.cwd)"; + chdir => "$(G.cwd)"; } bundle agent test_dry_run { files: - "$(G.testdir)" + "$(G.testdir)" transformer => "$(G.gzip) $(this.promiser)", file_select => test_plain, depth_search => test_recurse; @@ -67,40 +61,40 @@ bundle agent test_dry_run body file_select test_plain { - file_types => { "plain" }; - file_result => "file_types"; + file_types => { "plain" }; + file_result => "file_types"; } body depth_search test_recurse { - depth => "inf"; + depth => "inf"; } ####################################################### - bundle agent check { vars: - "files" slist => { @{init.files} }; + "files" slist => { @{init.files} }; classes: - "ok$(files)" expression => fileexists("$(G.testdir)/$(files)"); - "no$(files)" expression => fileexists("$(G.testdir)/$(files).gz"); - "ok" and => { - "ok1", "ok2", "ok3", - "!no1", "!no2", "!no3", - }; + "ok$(files)" expression => fileexists("$(G.testdir)/$(files)"); + "no$(files)" expression => fileexists("$(G.testdir)/$(files).gz"); + "ok" and => { "ok1", "ok2", "ok3", "!no1", "!no2", "!no3" }; reports: DEBUG:: "$(G.testdir)/$(files) exists with no $(G.testdir)/$(files).gz" - if => "ok$(files).!no$(files)"; + if => "ok$(files).!no$(files)"; + "$(G.testdir)/$(files).gz was created during --dry-run!" - if => "no$(files)"; + if => "no$(files)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/03_transform/003.cf b/tests/acceptance/10_files/03_transform/003.cf index 7c311b3df1..594c9c5c14 100644 --- a/tests/acceptance/10_files/03_transform/003.cf +++ b/tests/acceptance/10_files/03_transform/003.cf @@ -3,92 +3,92 @@ # Ensure that the transformer runs only once for every file in a recursive tree # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - cache_system_functions => "off"; # for execresult in check bundle + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; + cache_system_functions => "off"; + + # for execresult in check bundle } ####################################################### - bundle agent init { vars: - "files" slist => { "1", "2", "3" }; + "files" slist => { "1", "2", "3" }; files: - "$(G.testdir)/files/." - create => "true"; - - "$(G.testdir)/files/$(files)" - copy_from => init_copy; + "$(G.testdir)/files/." create => "true"; + "$(G.testdir)/files/$(files)" copy_from => init_copy; } body copy_from init_copy { - source => "$(G.etc_group)"; + source => "$(G.etc_group)"; } body classes init_set_class(class) { - promise_kept => { "$(class)" }; - promise_repaired => { "$(class)" }; + promise_kept => { "$(class)" }; + promise_repaired => { "$(class)" }; } ####################################################### - bundle agent test { vars: - "counter" string => "$(G.testdir)/counter"; + "counter" string => "$(G.testdir)/counter"; files: windows:: "$(G.testdir)/files" - transformer => "$(G.echo) $(this.promiser) >> $(counter)", - file_select => test_plain, - depth_search => test_recurse; + transformer => "$(G.echo) $(this.promiser) >> $(counter)", + file_select => test_plain, + depth_search => test_recurse; + !windows:: "$(G.testdir)/files" - transformer => "/bin/sh -c 'echo $(this.promiser) >> $(counter)'", - file_select => test_plain, - depth_search => test_recurse; + transformer => "/bin/sh -c 'echo $(this.promiser) >> $(counter)'", + file_select => test_plain, + depth_search => test_recurse; } body file_select test_plain { - file_types => { "plain" }; - file_result => "file_types"; + file_types => { "plain" }; + file_result => "file_types"; } body depth_search test_recurse { - depth => "inf"; + depth => "inf"; } ####################################################### - bundle agent check { vars: - "count" string => execresult("$(G.wc) -l $(test.counter)", "noshell"); + "count" string => execresult("$(G.wc) -l $(test.counter)", "noshell"); + DEBUG:: "list" string => execresult("$(G.ls) -1 $(G.testdir)/files", "noshell"); classes: - "ok" expression => regcmp("^\s*3\s.*", "$(count)"); + "ok" expression => regcmp("^\s*3\s.*", "$(count)"); reports: DEBUG.!ok:: "3 transformations expected, saw (wc): '$(count)'"; "3 copies of $(G.etc_group) expected, saw (ls): '$(list)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/04_match/001.cf b/tests/acceptance/10_files/04_match/001.cf index d27df4e5c3..2705bdbaaa 100644 --- a/tests/acceptance/10_files/04_match/001.cf +++ b/tests/acceptance/10_files/04_match/001.cf @@ -3,49 +3,43 @@ # Create a file and delete it - hoping that it matches (issue 365) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } ####################################################### - bundle agent test { - files: - "$(G.testfile)" - delete => test_delete; + "$(G.testfile)" delete => test_delete; } body delete test_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent check { classes: - "ok" not => fileexists("$(G.testfile)"); + "ok" not => fileexists("$(G.testfile)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/04_match/004.cf b/tests/acceptance/10_files/04_match/004.cf index fd8eb327ff..94aeee1e0c 100644 --- a/tests/acceptance/10_files/04_match/004.cf +++ b/tests/acceptance/10_files/04_match/004.cf @@ -3,22 +3,21 @@ # Test exec_program on file_select (issue 294) - test negative match on existing file # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "find_this" string => "bibbetygargle"; + "find_this" string => "bibbetygargle"; + files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_data; } @@ -26,51 +25,52 @@ bundle agent init bundle edit_line init_data { insert_lines: - "Gabba gabba hey!"; - "yibbity $(find_this) bletch"; - "torchecol bum adder"; + "Gabba gabba hey!"; + "yibbity $(find_this) bletch"; + "torchecol bum adder"; } ####################################################### - bundle agent test { vars: linux:: "prefix" string => ""; + freebsd:: "prefix" string => "/usr"; + !(linux|freebsd):: "prefix" string => "FIX ME"; files: - "$(G.testroot)" + "$(G.testroot)" file_select => test_hunt("$(prefix)"), delete => test_delete; } body file_select test_hunt(prefix) { - exec_program => "$(G.grep) XX$(init.find_this)XX $(this.promiser)"; - file_result => "exec_program"; + exec_program => "$(G.grep) XX$(init.find_this)XX $(this.promiser)"; + file_result => "exec_program"; } body delete test_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent check { classes: - "ok" expression => fileexists("$(G.testfile)"); + "ok" expression => fileexists("$(G.testfile)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/04_match/008.cf b/tests/acceptance/10_files/04_match/008.cf index 9cb3c7139c..3887806329 100644 --- a/tests/acceptance/10_files/04_match/008.cf +++ b/tests/acceptance/10_files/04_match/008.cf @@ -3,47 +3,50 @@ # Delete a file in a nonexistent directory. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "1"; + "dummy" string => "1"; } ####################################################### - bundle agent test { vars: - "agent" string => execresult("$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO 2>&1", "useshell"); + "agent" + string => execresult( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO 2>&1", + "useshell" + ); } ####################################################### - bundle agent check { classes: - "chdir" expression => regcmp(".*chdir.*", $(test.agent)); - "checkpoint" expression => regcmp(".*CHECKPOINT.*", $(test.agent)); - "ok" and => { "!chdir", "checkpoint" }; + "chdir" expression => regcmp(".*chdir.*", $(test.agent)); + "checkpoint" expression => regcmp(".*CHECKPOINT.*", $(test.agent)); + "ok" and => { "!chdir", "checkpoint" }; reports: DEBUG:: "This should only pass if $(this.promise_filename).sub does not output anything about failing to chdir"; "Output from $(this.promise_filename).sub: $(test.agent)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/04_match/directory_can_not_readlink.cf b/tests/acceptance/10_files/04_match/directory_can_not_readlink.cf index 1a9ddbd9c9..5a009177dc 100644 --- a/tests/acceptance/10_files/04_match/directory_can_not_readlink.cf +++ b/tests/acceptance/10_files/04_match/directory_can_not_readlink.cf @@ -3,54 +3,62 @@ # Delete a file in a nonexistent directory. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - cache_system_functions => "false"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; + cache_system_functions => "false"; } ####################################################### - bundle agent init { vars: - "checkdir" string => "$(G.testdir)/should-not-show-up-in-output"; + "checkdir" string => "$(G.testdir)/should-not-show-up-in-output"; files: - "$(checkdir)/." create => "true"; + "$(checkdir)/." create => "true"; } ####################################################### - bundle agent test { vars: - "agent" string => execresult("$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO 2>&1", "useshell"); + "agent" + string => execresult( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub -D AUTO 2>&1", + "useshell" + ); } ####################################################### - bundle agent check { classes: - "checkpoint_fail" not => regcmp(".*CHECKPOINT.*", $(test.agent)); - "fail" or => { checkpoint_fail, - regcmp(".*Unable to read link.*", $(test.agent)), - regcmp(".*$(init.checkdir).*", $(test.agent)) }; + "checkpoint_fail" not => regcmp(".*CHECKPOINT.*", $(test.agent)); + + "fail" + or => { + checkpoint_fail, + regcmp(".*Unable to read link.*", $(test.agent)), + regcmp(".*$(init.checkdir).*", $(test.agent)), + }; reports: DEBUG:: "This should only pass if $(this.promise_filename).sub does not output anything about failing to readlink"; "Output from $(this.promise_filename).sub: $(test.agent)"; + DEBUG.checkpoint_fail:: "The secondary policy in $(this.promise_filename).sub did not checkpoint correctly"; + !fail:: "$(this.promise_filename) Pass"; + fail:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/04_match/kept_promise.cf b/tests/acceptance/10_files/04_match/kept_promise.cf index f61e9b4033..2aa63f7cca 100644 --- a/tests/acceptance/10_files/04_match/kept_promise.cf +++ b/tests/acceptance/10_files/04_match/kept_promise.cf @@ -4,79 +4,84 @@ # kept. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { vars: - "array[1]" string => "one"; - "array[2]" string => "two"; - "array[3]" string => "three"; + "array[1]" string => "one"; + "array[2]" string => "two"; + "array[3]" string => "three"; files: - "$(G.testfile)" - create => "true", - edit_line => init_edit; + "$(G.testfile)" + create => "true", + edit_line => init_edit; } bundle agent test { files: - "$(G.testfile)" - create => "true", - edit_line => test_edit; + "$(G.testfile)" + create => "true", + edit_line => test_edit; } bundle edit_line init_edit { vars: - "index" slist => getindices("init.array"); + "index" slist => getindices("init.array"); insert_lines: - "${init.array[${index}]}"; + "${init.array[${index}]}"; } bundle edit_line test_edit { vars: - "index" slist => getindices("init.array"); + "index" slist => getindices("init.array"); insert_lines: - "${init.array[${index}]}" - classes => kept_if_else("line_${index}_kept", "line_${index}_added", "line_${index}_failed"); + "${init.array[${index}]}" + classes => kept_if_else( + "line_${index}_kept", "line_${index}_added", "line_${index}_failed" + ); } bundle agent check { classes: - "ok" and => { "line_1_kept", "line_2_kept", "line_3_kept" }; + "ok" and => { "line_1_kept", "line_2_kept", "line_3_kept" }; reports: DEBUG.!line_1_kept:: "Line 1 promise should have been kept, but was not."; + DEBUG.!line_2_kept:: "Line 2 promise should have been kept, but was not."; + DEBUG.!line_3_kept:: "Line 3 promise should have been kept, but was not."; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } body classes kept_if_else(kept, yes, no) - { - promise_kept => { "${kept}" }; - promise_repaired => { "${yes}" }; - repair_failed => { "${no}" }; - repair_denied => { "${no}" }; - repair_timeout => { "${no}" }; + promise_kept => { "${kept}" }; + promise_repaired => { "${yes}" }; + repair_failed => { "${no}" }; + repair_denied => { "${no}" }; + repair_timeout => { "${no}" }; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/04_match/match_scope.cf b/tests/acceptance/10_files/04_match/match_scope.cf index 8793e27a10..2b7757f32b 100644 --- a/tests/acceptance/10_files/04_match/match_scope.cf +++ b/tests/acceptance/10_files/04_match/match_scope.cf @@ -3,24 +3,21 @@ # Check that $(match.1) works # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "testfile" string => concat("$(G.testdir)", "/dummy_file"); + "testfile" string => concat("$(G.testdir)", "/dummy_file"); files: - "$(testfile)" - create => "true"; + "$(testfile)" create => "true"; reports: DEBUG:: @@ -28,45 +25,46 @@ bundle agent init } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; vars: - "foo" string => "foo"; + "foo" string => "foo"; files: - "$(G.testdir)/([^_]*)_(.*)" + "$(G.testdir)/([^_]*)_(.*)" delete => test_delete, classes => test_classes; } body classes test_classes { - promise_repaired => { "$(match.1)", "$(match.2)" }; + promise_repaired => { "$(match.1)", "$(match.2)" }; } body delete test_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent check { classes: - "ok" and => { "dummy", "file" }; + "ok" and => { "dummy", "file" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/04_match/not_selected_dirs_are_skipped.cf b/tests/acceptance/10_files/04_match/not_selected_dirs_are_skipped.cf index 5a30a0cc7f..58fa697575 100644 --- a/tests/acceptance/10_files/04_match/not_selected_dirs_are_skipped.cf +++ b/tests/acceptance/10_files/04_match/not_selected_dirs_are_skipped.cf @@ -4,16 +4,14 @@ # it, even when depth_search is off. # ######################################################################## - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - body perms perms1 { mode => "732"; @@ -32,20 +30,17 @@ body delete del body file_select by_name(names) { - leaf_name => { @(names) }; + leaf_name => { @(names) }; file_result => "leaf_name"; } bundle agent init { files: - # Create a directory and some files in there - "$(G.testroot)/srcdir/." - create => "true"; - "$(G.testroot)/srcdir/testfile1" - create => "true"; - "$(G.testroot)/srcdir/testfile2" - create => "true"; + # Create a directory and some files in there + "$(G.testroot)/srcdir/." create => "true"; + "$(G.testroot)/srcdir/testfile1" create => "true"; + "$(G.testroot)/srcdir/testfile2" create => "true"; # The destination should already exist and have specific # permissions, so that it's excluded by the body files_select later @@ -61,7 +56,6 @@ bundle agent init } ####################################################### - body file_select test_select { # Select will fail because the dir is mode 732 @@ -71,37 +65,32 @@ body file_select test_select body link_from ln_s_children(x) { - link_type => "symlink"; - link_children => "true"; - source => "$(x)"; + link_type => "symlink"; + link_children => "true"; + source => "$(x)"; } bundle agent test { - - # We promise that if destdir has specific permissions, then it must - # contain links to all children from srcdir. - - files: + # We promise that if destdir has specific permissions, then it must + # contain links to all children from srcdir. + files: "$(G.testroot)/destdir" file_select => test_select, link_from => ln_s_children("$(G.testroot)/srcdir"); - } ####################################################### - bundle agent check { - # Since body select fails, the files in target directory should *not* # be created - classes: - "files_created" and => { - fileexists("$(G.testroot)/destdir/testfile1"), - fileexists("$(G.testroot)/destdir/testfile2") - }; + "files_created" + and => { + fileexists("$(G.testroot)/destdir/testfile1"), + fileexists("$(G.testroot)/destdir/testfile2"), + }; reports: !files_created:: @@ -109,5 +98,4 @@ bundle agent check files_created:: "$(this.promise_filename) FAIL"; - } diff --git a/tests/acceptance/10_files/04_match/staging/002.cf b/tests/acceptance/10_files/04_match/staging/002.cf index 350dcbcafe..ac38df3517 100644 --- a/tests/acceptance/10_files/04_match/staging/002.cf +++ b/tests/acceptance/10_files/04_match/staging/002.cf @@ -3,49 +3,45 @@ # Create a file and delete it - hoping that it matches (issue 365) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } ####################################################### - bundle agent test { - files: - "/tmp/TEST\.cfengine" - delete => test_delete; + "/tmp/TEST\.cfengine" delete => test_delete; } body delete test_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent check { classes: - "ok" not => fileexists("$(G.testfile)"); + "ok" not => fileexists("$(G.testfile)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/04_match/staging/003.cf b/tests/acceptance/10_files/04_match/staging/003.cf index d12fb0553d..62720d52d0 100644 --- a/tests/acceptance/10_files/04_match/staging/003.cf +++ b/tests/acceptance/10_files/04_match/staging/003.cf @@ -3,20 +3,20 @@ # Test exec_program on file_select (issue 294) - test positive match on existing file # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "find_this" string => "bibbetygargle"; + "find_this" string => "bibbetygargle"; + files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_data; } @@ -24,53 +24,55 @@ bundle agent init bundle edit_line init_data { insert_lines: - "Gabba gabba hey!"; - "yibbity $(find_this) bletch"; - "torchecol bum adder"; + "Gabba gabba hey!"; + "yibbity $(find_this) bletch"; + "torchecol bum adder"; } ####################################################### - bundle agent test { vars: linux:: "prefix" string => ""; + freebsd:: "prefix" string => "/usr"; + !(linux|freebsd):: "prefix" string => "FIX ME"; files: - "/tmp" + "/tmp" file_select => test_hunt("$(prefix)"), delete => test_delete; } body file_select test_hunt(prefix) { - exec_program => "$(G.grep) $(init.find_this) $(this.promiser)"; - file_result => "exec_program"; + exec_program => "$(G.grep) $(init.find_this) $(this.promiser)"; + file_result => "exec_program"; } body delete test_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent check { classes: - "ok" not => fileexists("$(G.testfile)"); + "ok" not => fileexists("$(G.testfile)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/04_match/staging/005.cf b/tests/acceptance/10_files/04_match/staging/005.cf index 34f1544d86..951f7f25f4 100644 --- a/tests/acceptance/10_files/04_match/staging/005.cf +++ b/tests/acceptance/10_files/04_match/staging/005.cf @@ -3,20 +3,20 @@ # Test exec_program on file_select (issue 294) - test positive match on existing file # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "find_this" string => "bibbetygargle"; + "find_this" string => "bibbetygargle"; + files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_data; } @@ -24,46 +24,46 @@ bundle agent init bundle edit_line init_data { insert_lines: - "Gabba gabba hey!"; - "yibbity $(find_this) bletch"; - "torchecol bum adder"; + "Gabba gabba hey!"; + "yibbity $(find_this) bletch"; + "torchecol bum adder"; } ####################################################### - bundle agent test { files: - "/tmp" + "/tmp" file_select => test_hunt, delete => test_delete; } body file_select test_hunt { - exec_regex => ".*$(test.find_this).*"; - exec_program => "/bin/cat $(this.promiser)"; - file_result => "exec_program.exec_regex"; + exec_regex => ".*$(test.find_this).*"; + exec_program => "/bin/cat $(this.promiser)"; + file_result => "exec_program.exec_regex"; } body delete test_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent check { classes: - "ok" not => fileexists("$(G.testfile)"); + "ok" not => fileexists("$(G.testfile)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/04_match/staging/006.cf b/tests/acceptance/10_files/04_match/staging/006.cf index 54b42acdc9..a556a8ee4f 100644 --- a/tests/acceptance/10_files/04_match/staging/006.cf +++ b/tests/acceptance/10_files/04_match/staging/006.cf @@ -3,20 +3,20 @@ # Test exec_program on file_select (issue 294) - test negative match on existing file # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "find_this" string => "bibbetygargle"; + "find_this" string => "bibbetygargle"; + files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_data; } @@ -24,46 +24,46 @@ bundle agent init bundle edit_line init_data { insert_lines: - "Gabba gabba hey!"; - "yibbity $(find_this) bletch"; - "torchecol bum adder"; + "Gabba gabba hey!"; + "yibbity $(find_this) bletch"; + "torchecol bum adder"; } ####################################################### - bundle agent test { files: - "/tmp" + "/tmp" file_select => test_hunt, delete => test_delete; } body file_select test_hunt { - exec_regex => ".*XX$(test.find_this)XX.*"; - exec_program => "/bin/cat $(this.promiser)"; - file_result => "exec_program.exec_regex"; + exec_regex => ".*XX$(test.find_this)XX.*"; + exec_program => "/bin/cat $(this.promiser)"; + file_result => "exec_program.exec_regex"; } body delete test_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent check { classes: - "ok" not => fileexists("$(G.testfile)"); + "ok" not => fileexists("$(G.testfile)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/04_match/staging/007.cf b/tests/acceptance/10_files/04_match/staging/007.cf index 23b996dddd..f5513ad448 100644 --- a/tests/acceptance/10_files/04_match/staging/007.cf +++ b/tests/acceptance/10_files/04_match/staging/007.cf @@ -3,20 +3,20 @@ # Test exec_program on file_select (issue 294) - test negative match on existing file # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "find_this" string => "bibbetygargle"; + "find_this" string => "bibbetygargle"; + files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_data; } @@ -24,46 +24,48 @@ bundle agent init bundle edit_line init_data { insert_lines: - "Gabba gabba hey!"; - "yibbity $(find_this) bletch"; - "torchecol bum adder"; + "Gabba gabba hey!"; + "yibbity $(find_this) bletch"; + "torchecol bum adder"; } ####################################################### - bundle agent test { files: - "/tmp" + "/tmp" file_select => test_hunt, delete => test_delete; } body file_select test_hunt { - exec_regex => "$(test.find_this)"; # Partial regex shouldn't match - exec_program => "/bin/cat $(this.promiser)"; - file_result => "exec_program.exec_regex"; + exec_regex => "$(test.find_this)"; + + # Partial regex shouldn't match + exec_program => "/bin/cat $(this.promiser)"; + file_result => "exec_program.exec_regex"; } body delete test_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent check { classes: - "ok" not => fileexists("$(G.testfile)"); + "ok" not => fileexists("$(G.testfile)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/05_classes/001.cf b/tests/acceptance/10_files/05_classes/001.cf index 09bf0d5dd0..75bb456b2a 100644 --- a/tests/acceptance/10_files/05_classes/001.cf +++ b/tests/acceptance/10_files/05_classes/001.cf @@ -3,34 +3,28 @@ # Delete a line, ensure that a promise_repaired class gets set # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => - "keep this + "states" slist => { "actual", "expected" }; + "actual" string => "keep this and this but delete one line keep this too"; - - "expected" string => - "keep this + "expected" string => "keep this and this keep this too"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -39,53 +33,50 @@ keep this too"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => ".*delete.*"; + "tstr" string => ".*delete.*"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - classes => full_set; + "$(str)" classes => full_set; } body classes full_set { - promise_kept => { "fail" }; - promise_repaired => { "pass" }; - repair_failed => { "fail" }; - repair_denied => { "fail" }; - repair_timeout => { "fail" }; + promise_kept => { "fail" }; + promise_repaired => { "pass" }; + repair_failed => { "fail" }; + repair_denied => { "fail" }; + repair_timeout => { "fail" }; } - ####################################################### - bundle agent check { methods: pass.!fail:: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); reports: !pass|fail:: diff --git a/tests/acceptance/10_files/05_classes/002.cf b/tests/acceptance/10_files/05_classes/002.cf index 39ae45fef1..0cffe79dae 100644 --- a/tests/acceptance/10_files/05_classes/002.cf +++ b/tests/acceptance/10_files/05_classes/002.cf @@ -3,33 +3,27 @@ # Delete a line that isn't there, ensure that a promise_kept class gets set # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => - "keep this + "states" slist => { "actual", "expected" }; + "actual" string => "keep this and this keep this too"; - - "expected" string => - "keep this + "expected" string => "keep this and this keep this too"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -38,53 +32,50 @@ keep this too"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => ".*delete.*"; + "tstr" string => ".*delete.*"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - classes => full_set; + "$(str)" classes => full_set; } body classes full_set { - promise_kept => { "pass" }; - promise_repaired => { "fail" }; - repair_failed => { "fail" }; - repair_denied => { "fail" }; - repair_timeout => { "fail" }; + promise_kept => { "pass" }; + promise_repaired => { "fail" }; + repair_failed => { "fail" }; + repair_denied => { "fail" }; + repair_timeout => { "fail" }; } - ####################################################### - bundle agent check { methods: pass.!fail:: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); reports: !pass|fail:: diff --git a/tests/acceptance/10_files/05_classes/004.cf b/tests/acceptance/10_files/05_classes/004.cf index f1538e3f81..e4a3886afc 100644 --- a/tests/acceptance/10_files/05_classes/004.cf +++ b/tests/acceptance/10_files/05_classes/004.cf @@ -3,33 +3,27 @@ # Delete a line that isn't there, action_policy=>"warn", ensure that a promise_kept class gets set # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => - "keep this + "states" slist => { "actual", "expected" }; + "actual" string => "keep this and this keep this too"; - - "expected" string => - "keep this + "expected" string => "keep this and this keep this too"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -38,59 +32,57 @@ keep this too"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => ".*delete.*"; + "tstr" string => ".*delete.*"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" action => test_warn_only, classes => full_set; } body action test_warn_only { - action_policy => "warn"; + action_policy => "warn"; } body classes full_set { - promise_kept => { "pass" }; - promise_repaired => { "fail" }; - repair_failed => { "fail" }; - repair_denied => { "fail" }; - repair_timeout => { "fail" }; + promise_kept => { "pass" }; + promise_repaired => { "fail" }; + repair_failed => { "fail" }; + repair_denied => { "fail" }; + repair_timeout => { "fail" }; } - ####################################################### - bundle agent check { methods: pass.!fail:: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); reports: !pass|fail:: diff --git a/tests/acceptance/10_files/05_classes/006.cf b/tests/acceptance/10_files/05_classes/006.cf index 77e56832a2..33b64a3a36 100644 --- a/tests/acceptance/10_files/05_classes/006.cf +++ b/tests/acceptance/10_files/05_classes/006.cf @@ -3,33 +3,27 @@ # Delete a line that isn't there, action_policy=>"nop", ensure that a promise_kept class gets set # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => - "keep this + "states" slist => { "actual", "expected" }; + "actual" string => "keep this and this keep this too"; - - "expected" string => - "keep this + "expected" string => "keep this and this keep this too"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -38,59 +32,57 @@ keep this too"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => ".*delete.*"; + "tstr" string => ".*delete.*"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" action => test_warn_only, classes => full_set; } body action test_warn_only { - action_policy => "nop"; + action_policy => "nop"; } body classes full_set { - promise_kept => { "pass" }; - promise_repaired => { "fail" }; - repair_failed => { "fail" }; - repair_denied => { "fail" }; - repair_timeout => { "fail" }; + promise_kept => { "pass" }; + promise_repaired => { "fail" }; + repair_failed => { "fail" }; + repair_denied => { "fail" }; + repair_timeout => { "fail" }; } - ####################################################### - bundle agent check { methods: pass.!fail:: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); reports: !pass|fail:: diff --git a/tests/acceptance/10_files/05_classes/102.cf b/tests/acceptance/10_files/05_classes/102.cf index c3d9e5fa88..b97cf23f52 100644 --- a/tests/acceptance/10_files/05_classes/102.cf +++ b/tests/acceptance/10_files/05_classes/102.cf @@ -6,19 +6,18 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -26,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty, @@ -36,93 +35,97 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_repaired => { "promise_repaired", "p2_repaired" }; - cancel_repaired => { "cancel_repaired", "cancel_kept", "cancel_notkept" }; + promise_repaired => { "promise_repaired", "p2_repaired" }; + cancel_repaired => { "cancel_repaired", "cancel_kept", "cancel_notkept" }; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => "ON"; - "expect[p2_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => ""; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => ""; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "p2_repaired", - "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => "ON"; + "expect[p2_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => ""; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => ""; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "p2_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/05_classes/staging/003.cf b/tests/acceptance/10_files/05_classes/staging/003.cf index bd9b70033c..4af21be960 100644 --- a/tests/acceptance/10_files/05_classes/staging/003.cf +++ b/tests/acceptance/10_files/05_classes/staging/003.cf @@ -3,41 +3,35 @@ # Try to delete a line, action_policy=>"warn", ensure that a repair_denied class gets set (issue 441) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "testfile" string => "/tmp/TEST.cfengine"; + "testfile" string => "/tmp/TEST.cfengine"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => - "keep this + "states" slist => { "actual", "expected" }; + "actual" string => "keep this and this but delete one line keep this too"; - - "expected" string => - "keep this + "expected" string => "keep this and this but delete one line keep this too"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -46,67 +40,64 @@ keep this too"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => ".*delete.*"; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" string => ".*delete.*"; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - classes => full_set; + "$(str)" classes => full_set; } body classes full_set { - promise_kept => { "fail" }; - promise_repaired => { "fail" }; - repair_failed => { "fail" }; - repair_denied => { "pass" }; - repair_timeout => { "fail" }; + promise_kept => { "fail" }; + promise_repaired => { "fail" }; + repair_failed => { "fail" }; + repair_denied => { "pass" }; + repair_timeout => { "fail" }; } - ####################################################### - bundle agent check { classes: - "no_difference" expression => returnszero( - "$(G.diff) -q $(G.testfile).actual $(G.testfile).expected", - "noshell"); - "ok" and => { "pass", "!fail", "no_difference" }; + "no_difference" + expression => returnszero( + "$(G.diff) -q $(G.testfile).actual $(G.testfile).expected", "noshell" + ); + + "ok" and => { "pass", "!fail", "no_difference" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("$(G.testfile).*"); + "any" usebundle => dcs_fini("$(G.testfile).*"); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/05_classes/staging/005.cf b/tests/acceptance/10_files/05_classes/staging/005.cf index 2a22875b47..6d8602eec9 100644 --- a/tests/acceptance/10_files/05_classes/staging/005.cf +++ b/tests/acceptance/10_files/05_classes/staging/005.cf @@ -3,41 +3,35 @@ # Attempt to delete a line, action_policy=>"nop", ensure that a repair_denied class gets set (issue 441) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "testfile" string => "/tmp/TEST.cfengine"; + "testfile" string => "/tmp/TEST.cfengine"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => - "keep this + "states" slist => { "actual", "expected" }; + "actual" string => "keep this and this but delete one line keep this too"; - - "expected" string => - "keep this + "expected" string => "keep this and this but delete one line keep this too"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -46,73 +40,71 @@ keep this too"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => ".*delete.*"; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" string => ".*delete.*"; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" action => warn_only, classes => full_set; } body action warn_only { - action_policy => "nop"; + action_policy => "nop"; } body classes full_set { - promise_kept => { "fail" }; - promise_repaired => { "fail" }; - repair_failed => { "fail" }; - repair_denied => { "pass" }; - repair_timeout => { "fail" }; + promise_kept => { "fail" }; + promise_repaired => { "fail" }; + repair_failed => { "fail" }; + repair_denied => { "pass" }; + repair_timeout => { "fail" }; } - ####################################################### - bundle agent check { classes: - "no_difference" expression => returnszero( - "$(G.diff) -q $(G.testfile).actual $(G.testfile).expected", - "noshell"); - "ok" and => { "pass", "!fail", "no_difference" }; + "no_difference" + expression => returnszero( + "$(G.diff) -q $(G.testfile).actual $(G.testfile).expected", "noshell" + ); + + "ok" and => { "pass", "!fail", "no_difference" }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } ####################################################### - bundle agent fini { methods: - "any" usebundle => dcs_fini("$(G.testfile).*"); + "any" usebundle => dcs_fini("$(G.testfile).*"); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/05_classes/staging/007.cf b/tests/acceptance/10_files/05_classes/staging/007.cf index 6e86be0979..db2df58b70 100644 --- a/tests/acceptance/10_files/05_classes/staging/007.cf +++ b/tests/acceptance/10_files/05_classes/staging/007.cf @@ -3,95 +3,100 @@ # Delete a line that isn't there, action_policy=>"nop", ensure that a promise_kept class gets set # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g { vars: - "testfile" string => "/tmp/TEST.cfengine"; + "testfile" string => "/tmp/TEST.cfengine"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_mode("0644"); - "$(G.testfile).link" - link_from => init_link("$(G.testfile)"); + "$(G.testfile).link" link_from => init_link("$(G.testfile)"); } body link_from init_link(src) { - source => "$(src)"; + source => "$(src)"; } ####################################################### - bundle agent test { files: - "$(G.testfile).link" + "$(G.testfile).link" perms => test_mode("0600"), classes => fail_check; - "$(G.testfile)" + "$(G.testfile)" perms => test_mode("0644"), classes => kept_check; } body perms test_mode(m) { - mode => "$(m)"; + mode => "$(m)"; } body classes fail_check { - promise_kept => { "fail1" }; - promise_repaired => { "fail1" }; - repair_failed => { "pass1" }; # Cannot chmod a sylink! - repair_denied => { "fail1" }; - repair_timeout => { "fail1" }; + promise_kept => { "fail1" }; + promise_repaired => { "fail1" }; + repair_failed => { "pass1" }; + + # Cannot chmod a sylink! + repair_denied => { "fail1" }; + repair_timeout => { "fail1" }; } body classes kept_check { - promise_kept => { "pass2" }; # Original mode should not have changed - promise_repaired => { "fail2" }; - repair_failed => { "fail2" }; - repair_denied => { "fail2" }; - repair_timeout => { "fail2" }; + promise_kept => { "pass2" }; + + # Original mode should not have changed + promise_repaired => { "fail2" }; + repair_failed => { "fail2" }; + repair_denied => { "fail2" }; + repair_timeout => { "fail2" }; } ####################################################### - bundle agent check { classes: - "ok" and => { "pass1", "pass2", "!fail1", "!fail2" }; + "ok" and => { "pass1", "pass2", "!fail1", "!fail2" }; reports: DEBUG.!pass1:: "Trying to chmod a symlink did not fail like it should"; + DEBUG.fail1:: "Trying to chmod a symlink gave a return other than repair_failed"; + DEBUG.!pass2:: "Something was funky with the target of a symlink"; + DEBUG.fail2:: "Doing a chmod on a symlink changed the target file instead!"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/05_classes/staging/101.cf b/tests/acceptance/10_files/05_classes/staging/101.cf index cd3803a8d5..b3dcbd5ef9 100644 --- a/tests/acceptance/10_files/05_classes/staging/101.cf +++ b/tests/acceptance/10_files/05_classes/staging/101.cf @@ -6,19 +6,18 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -26,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty, @@ -36,97 +35,101 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/05_classes/staging/103.cf b/tests/acceptance/10_files/05_classes/staging/103.cf index 83b34526cd..c4c1b459a3 100644 --- a/tests/acceptance/10_files/05_classes/staging/103.cf +++ b/tests/acceptance/10_files/05_classes/staging/103.cf @@ -6,19 +6,18 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -26,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -35,98 +34,101 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)" - classes => all_classes; + "$(str)" classes => all_classes; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/05_classes/staging/104.cf b/tests/acceptance/10_files/05_classes/staging/104.cf index d710b97852..f7825b8a63 100644 --- a/tests/acceptance/10_files/05_classes/staging/104.cf +++ b/tests/acceptance/10_files/05_classes/staging/104.cf @@ -6,19 +6,18 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -26,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"); } @@ -34,100 +33,104 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" edit_line => init_insert("$(init.body)"), edit_defaults => init_empty, classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => "ON"; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => ""; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => "ON"; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => ""; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/05_classes/staging/105.cf b/tests/acceptance/10_files/05_classes/staging/105.cf index a952a85362..0625d9e51b 100644 --- a/tests/acceptance/10_files/05_classes/staging/105.cf +++ b/tests/acceptance/10_files/05_classes/staging/105.cf @@ -5,19 +5,18 @@ # promise is kept (which sets/clears more classes) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -25,7 +24,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"); } @@ -33,103 +32,106 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)" - classes => all_classes; + "$(str)" classes => all_classes; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" edit_line => init_insert("$(init.body)"), edit_defaults => init_empty; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it - # is mentioned in init and test, it is only executed ONCE, so it only - # sets the repaired promises. - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it + # is mentioned in init and test, it is only executed ONCE, so it only + # sets the repaired promises. + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/05_classes/staging/106.cf b/tests/acceptance/10_files/05_classes/staging/106.cf index 9840e5d573..870811e476 100644 --- a/tests/acceptance/10_files/05_classes/staging/106.cf +++ b/tests/acceptance/10_files/05_classes/staging/106.cf @@ -6,19 +6,18 @@ # promise is kept (which sets/clears more classes) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -26,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"); } @@ -34,34 +33,32 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)" - classes => all_classes; + "$(str)" classes => all_classes; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => test_insert("$(init.body)"), edit_defaults => init_empty; @@ -70,76 +67,80 @@ bundle agent test bundle edit_line test_insert(str) { insert_lines: - "$(str)" - classes => all_classes; + "$(str)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it - # is mentioned in init and we call test_insert from test, the promises are - # the same, and are only executed ONCE, so it only sets the repaired - # promises. - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it + # is mentioned in init and we call test_insert from test, the promises are + # the same, and are only executed ONCE, so it only sets the repaired + # promises. + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/05_classes/staging/107.cf b/tests/acceptance/10_files/05_classes/staging/107.cf index ba60816d47..333861f11c 100644 --- a/tests/acceptance/10_files/05_classes/staging/107.cf +++ b/tests/acceptance/10_files/05_classes/staging/107.cf @@ -6,34 +6,32 @@ # promise is kept (which sets/clears more classes) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes Four END"; - "body2" string => - "BEGIN + "body2" string => "BEGIN One potato Three potatoes Four END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"); } @@ -41,34 +39,32 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)" - classes => all_classes; + "$(str)" classes => all_classes; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => test_insert, edit_defaults => init_empty; @@ -77,76 +73,80 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(init.body2)" - classes => all_classes; + "$(init.body2)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it - # is mentioned in init and we call test_insert from test, the promises are - # the same, and are only executed ONCE, so it only sets the repaired - # promises. - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it + # is mentioned in init and we call test_insert from test, the promises are + # the same, and are only executed ONCE, so it only sets the repaired + # promises. + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/05_classes/staging/108.cf b/tests/acceptance/10_files/05_classes/staging/108.cf index d980b9b8fc..cf3fb53238 100644 --- a/tests/acceptance/10_files/05_classes/staging/108.cf +++ b/tests/acceptance/10_files/05_classes/staging/108.cf @@ -6,34 +6,32 @@ # promise is kept (which sets/clears more classes) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes Four END"; - "body2" string => - "BEGIN + "body2" string => "BEGIN One potato Three potatoes Four END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"); } @@ -41,34 +39,32 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)" - classes => all_classes; + "$(str)" classes => all_classes; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" edit_line => test_insert, edit_defaults => init_empty; } @@ -76,76 +72,80 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(init.body2)" - classes => all_classes; + "$(init.body2)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it - # is mentioned in init and we call test_insert from test, the promises are - # the same, and are only executed ONCE, so it only sets the repaired - # promises. - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it + # is mentioned in init and we call test_insert from test, the promises are + # the same, and are only executed ONCE, so it only sets the repaired + # promises. + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/05_classes/staging/109.cf b/tests/acceptance/10_files/05_classes/staging/109.cf index c33390cbbc..4de039b69d 100644 --- a/tests/acceptance/10_files/05_classes/staging/109.cf +++ b/tests/acceptance/10_files/05_classes/staging/109.cf @@ -8,34 +8,32 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes Four END"; - "body2" string => - "BEGIN + "body2" string => "BEGIN One potato Three potatoes Four END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"); } @@ -43,34 +41,32 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)" - classes => all_classes; + "$(str)" classes => all_classes; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => test_insert; } @@ -78,76 +74,80 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(init.body2)" - classes => all_classes; + "$(init.body2)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it - # is mentioned in init and we call test_insert from test, the promises are - # the same, and are only executed ONCE, so it only sets the repaired - # promises. - "expect[promise_kept]" string => "ON"; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => ""; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it + # is mentioned in init and we call test_insert from test, the promises are + # the same, and are only executed ONCE, so it only sets the repaired + # promises. + "expect[promise_kept]" string => "ON"; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => ""; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/05_classes/staging/110.cf b/tests/acceptance/10_files/05_classes/staging/110.cf index 115c5c1a2a..2093484312 100644 --- a/tests/acceptance/10_files/05_classes/staging/110.cf +++ b/tests/acceptance/10_files/05_classes/staging/110.cf @@ -6,34 +6,32 @@ # promise is kept (which sets/clears more classes) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes Four END"; - "body2" string => - "BEGIN + "body2" string => "BEGIN One potato Three potatoes Four END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"); } @@ -41,110 +39,111 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)" - classes => all_classes; + "$(str)" classes => all_classes; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" - edit_line => test_insert; + "$(G.testfile)" edit_line => test_insert; } bundle edit_line test_insert { insert_lines: - "$(init.body2)" - classes => all_classes; + "$(init.body2)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it - # is mentioned in init and we call test_insert from test, the promises are - # the same, and are only executed ONCE, so it only sets the repaired - # promises. - "expect[promise_kept]" string => "ON"; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => ""; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it + # is mentioned in init and we call test_insert from test, the promises are + # the same, and are only executed ONCE, so it only sets the repaired + # promises. + "expect[promise_kept]" string => "ON"; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => ""; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/05_classes/staging/111.cf b/tests/acceptance/10_files/05_classes/staging/111.cf index 8ff460a474..f583e30815 100644 --- a/tests/acceptance/10_files/05_classes/staging/111.cf +++ b/tests/acceptance/10_files/05_classes/staging/111.cf @@ -6,34 +6,32 @@ # promise is kept (which sets/clears more classes) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes Four END"; - "body2" string => - "BEGIN + "body2" string => "BEGIN One potato Three potatoes Four END"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_line => init_insert("$(body)"); } @@ -41,34 +39,32 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)" - classes => all_classes; + "$(str)" classes => all_classes; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" edit_line => test_insert, edit_defaults => init_empty; } @@ -76,76 +72,80 @@ bundle agent test bundle edit_line test_insert { insert_lines: - "$(init.body2)" - classes => all_classes; + "$(init.body2)" classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it - # is mentioned in init and we call test_insert from test, the promises are - # the same, and are only executed ONCE, so it only sets the repaired - # promises. - "expect[promise_kept]" string => "ON"; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => ""; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + # NOTE: bundle edit_line init_insert(str) is CACHED, so even though it + # is mentioned in init and we call test_insert from test, the promises are + # the same, and are only executed ONCE, so it only sets the repaired + # promises. + "expect[promise_kept]" string => "ON"; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => ""; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/05_classes/staging/112.cf b/tests/acceptance/10_files/05_classes/staging/112.cf index 90e3e01003..7f08339a7d 100644 --- a/tests/acceptance/10_files/05_classes/staging/112.cf +++ b/tests/acceptance/10_files/05_classes/staging/112.cf @@ -6,19 +6,18 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -26,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" # create => "true", # file will not exist! edit_line => init_insert("$(body)"), edit_defaults => init_empty, @@ -36,97 +35,101 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => "ON"; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => ""; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => "ON"; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => ""; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/05_classes/staging/113.cf b/tests/acceptance/10_files/05_classes/staging/113.cf index d1002461cb..194420d8ba 100644 --- a/tests/acceptance/10_files/05_classes/staging/113.cf +++ b/tests/acceptance/10_files/05_classes/staging/113.cf @@ -6,19 +6,18 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "body" string => - "BEGIN + "body" + string => "BEGIN One potato Two potato Three potatoes @@ -26,7 +25,7 @@ bundle agent init END"; files: - "$(G.testfile)" + "$(G.testfile)" # create => "true", # file will not exist! edit_line => init_insert("$(body)"), edit_defaults => init_empty; @@ -35,99 +34,103 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)", + "$(str)", # Promise never executed, so classes not set! classes => all_classes; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => ""; - "expect[promise_repaired]" string => ""; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => "ON"; - "expect[cancel_repaired]" string => "ON"; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => ""; + "expect[promise_repaired]" string => ""; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => "ON"; + "expect[cancel_repaired]" string => "ON"; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; + + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/05_classes/staging/114.cf b/tests/acceptance/10_files/05_classes/staging/114.cf index 7b9553095f..2af28765e2 100644 --- a/tests/acceptance/10_files/05_classes/staging/114.cf +++ b/tests/acceptance/10_files/05_classes/staging/114.cf @@ -6,121 +6,126 @@ # Present in both 00_basics/03_bodies and 10_files/05_classes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; files: - "$(G.testfile)" + "$(G.testfile)" copy_from => local("$(G.etc_group)"), perms => mode("666"); } body copy_from local(f) { - source => "$(f)"; + source => "$(f)"; } body perms mode(m) { - mode => "$(m)"; + mode => "$(m)"; } # These set/clear global classes, so they can be tested in another bundle body classes all_classes { - promise_kept => { "promise_kept" }; - promise_repaired => { "promise_repaired" }; - repair_failed => { "repair_failed" }; - repair_denied => { "repair_denied" }; - repair_timeout => { "repair_timeout" }; - cancel_kept => { "cancel_kept" }; - cancel_repaired => { "cancel_repaired" }; - cancel_notkept => { "cancel_notkept" }; + promise_kept => { "promise_kept" }; + promise_repaired => { "promise_repaired" }; + repair_failed => { "repair_failed" }; + repair_denied => { "repair_denied" }; + repair_timeout => { "repair_timeout" }; + cancel_kept => { "cancel_kept" }; + cancel_repaired => { "cancel_repaired" }; + cancel_notkept => { "cancel_notkept" }; } ####################################################### - bundle agent test { files: - "$(G.testfile)" - copy_from => local("$(G.etc_group)"), # Same file - perms => mode("644"), # Different mode + "$(G.testfile)" + copy_from => local("$(G.etc_group)"), + # Same file + perms => mode("644"), + # Different mode classes => all_classes; } ####################################################### - bundle agent check { - # These variables determine the conditions being tested + # These variables determine the conditions being tested vars: - "expect[promise_kept]" string => "ON"; - "expect[promise_repaired]" string => "ON"; - "expect[repair_failed]" string => ""; - "expect[repair_denied]" string => ""; - "expect[repair_timeout]" string => ""; - "expect[cancel_kept]" string => ""; - "expect[cancel_repaired]" string => ""; - "expect[cancel_notkept]" string => "ON"; - - # Everything from here down is "boilerplate" to these 1xx.cf tests - "lookfor" slist => { - "promise_kept", "promise_repaired", "repair_failed", "repair_denied", - "repair_timeout", "cancel_kept", "cancel_repaired", "cancel_notkept", + "expect[promise_kept]" string => "ON"; + "expect[promise_repaired]" string => "ON"; + "expect[repair_failed]" string => ""; + "expect[repair_denied]" string => ""; + "expect[repair_timeout]" string => ""; + "expect[cancel_kept]" string => ""; + "expect[cancel_repaired]" string => ""; + "expect[cancel_notkept]" string => "ON"; + + # Everything from here down is "boilerplate" to these 1xx.cf tests + "lookfor" + slist => { + "promise_kept", + "promise_repaired", + "repair_failed", + "repair_denied", + "repair_timeout", + "cancel_kept", + "cancel_repaired", + "cancel_notkept", }; classes: - "p1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "$(lookfor)", - }; - "p2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "!$(lookfor)", - }; - "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; - - "f1_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", "ON"), - "!$(lookfor)", - }; - "f2_$(lookfor)" and => { - strcmp("$(expect[$(lookfor)])", ""), - "$(lookfor)", - }; - "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); - "fail_$(lookfor)" or => {"f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)"}; + "p1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "$(lookfor)" }; + + "p2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "!$(lookfor)" }; - "oops" expression => classmatch("fail.*"); - "ok" and => { classmatch("pass.*"), "!oops" }; + "pass_$(lookfor)" xor => { "p1_$(lookfor)", "p2_$(lookfor)" }; + + "f1_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", "ON"), "!$(lookfor)" }; + + "f2_$(lookfor)" + and => { strcmp("$(expect[$(lookfor)])", ""), "$(lookfor)" }; + + "f3_$(lookfor)" not => isvariable("expect[$(lookfor)]"); + + "fail_$(lookfor)" + or => { "f1_$(lookfor)", "f2_$(lookfor)", "f3_$(lookfor)" }; + + "oops" expression => classmatch("fail.*"); + "ok" and => { classmatch("pass.*"), "!oops" }; reports: DEBUG:: - "ok: class '$(lookfor)' was set (should be)" - if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was set (should be)" if => "p1_$(lookfor)"; + "ok: class '$(lookfor)' was not set (should not be)" - if => "p2_$(lookfor)"; - "ERROR: class '$(lookfor)' WAS NOT set (should be)" - if => "f1_$(lookfor)"; - "ERROR: class '$(lookfor)' was set (should NOT be)" - if => "f2_$(lookfor)"; - "ERROR: missing variable expect['$(lookfor)']" - if => "f3_$(lookfor)"; + if => "p2_$(lookfor)"; + + "ERROR: class '$(lookfor)' WAS NOT set (should be)" if => "f1_$(lookfor)"; + "ERROR: class '$(lookfor)' was set (should NOT be)" if => "f2_$(lookfor)"; + "ERROR: missing variable expect['$(lookfor)']" if => "f3_$(lookfor)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/001.cf b/tests/acceptance/10_files/07_delete_lines/001.cf index ef72d8f8c2..6a38c1b2ee 100644 --- a/tests/acceptance/10_files/07_delete_lines/001.cf +++ b/tests/acceptance/10_files/07_delete_lines/001.cf @@ -3,23 +3,21 @@ # Delete a line # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,41 +49,40 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)"; + "$(str)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/002.cf b/tests/acceptance/10_files/07_delete_lines/002.cf index 12a79b3692..49d7209909 100644 --- a/tests/acceptance/10_files/07_delete_lines/002.cf +++ b/tests/acceptance/10_files/07_delete_lines/002.cf @@ -3,23 +3,21 @@ # Don't delete a line # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,41 +50,41 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe "; # NOTE, DOES NOT MATCH! + "tstr" string => " Three potatoe "; + # NOTE, DOES NOT MATCH! files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)"; + "$(str)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/003.cf b/tests/acceptance/10_files/07_delete_lines/003.cf index bc9cc67ab0..27f6cfd721 100644 --- a/tests/acceptance/10_files/07_delete_lines/003.cf +++ b/tests/acceptance/10_files/07_delete_lines/003.cf @@ -3,23 +3,21 @@ # Delete a contiguous group of three lines # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN Three potatoe @@ -27,14 +25,13 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -43,44 +40,42 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - "BEGIN + "tstr" string => "BEGIN Three potatoe END"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)"; + "$(str)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/004.cf b/tests/acceptance/10_files/07_delete_lines/004.cf index cb58f8f646..b76725a639 100644 --- a/tests/acceptance/10_files/07_delete_lines/004.cf +++ b/tests/acceptance/10_files/07_delete_lines/004.cf @@ -3,23 +3,21 @@ # Delete a contiguous group of three lines, different way # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN Three potatoe @@ -27,14 +25,13 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -43,41 +40,40 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "BEGIN$(const.n)$(str)$(const.n)END"; + "BEGIN$(const.n)$(str)$(const.n)END"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/005.cf b/tests/acceptance/10_files/07_delete_lines/005.cf index 9e9bac83e1..ed2c0d321b 100644 --- a/tests/acceptance/10_files/07_delete_lines/005.cf +++ b/tests/acceptance/10_files/07_delete_lines/005.cf @@ -3,21 +3,20 @@ # Delete a number of lines via an slist # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -27,18 +26,18 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header One potato Two potato Four trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -47,41 +46,41 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "BEGIN", " Three potatoe", "END" }; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" slist => { "BEGIN", " Three potatoe", "END" }; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)"; + "$(str)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/006.cf b/tests/acceptance/10_files/07_delete_lines/006.cf index 07cedcf3dc..419917bd67 100644 --- a/tests/acceptance/10_files/07_delete_lines/006.cf +++ b/tests/acceptance/10_files/07_delete_lines/006.cf @@ -3,23 +3,21 @@ # Delete a number of lines as separate lines # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -40,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,40 +47,39 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "BEGIN"; - " Three potatoe"; - "END"; + "BEGIN"; + " Three potatoe"; + "END"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/007.cf b/tests/acceptance/10_files/07_delete_lines/007.cf index 7130aa6256..dbb4748765 100644 --- a/tests/acceptance/10_files/07_delete_lines/007.cf +++ b/tests/acceptance/10_files/07_delete_lines/007.cf @@ -3,23 +3,21 @@ # Delete a number of lines as separate lines, using regexes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -40,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,40 +47,39 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "BEGIN"; - "\s+Three.*"; - "END"; + "BEGIN"; + "\s+Three.*"; + "END"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/008.cf b/tests/acceptance/10_files/07_delete_lines/008.cf index c3dd4dde94..a139a0600b 100644 --- a/tests/acceptance/10_files/07_delete_lines/008.cf +++ b/tests/acceptance/10_files/07_delete_lines/008.cf @@ -3,23 +3,21 @@ # Delete a number of lines via an slist, different way # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -40,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,41 +47,40 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { "BEGIN", " Three potatoe", "END" }; + "str" slist => { "BEGIN", " Three potatoe", "END" }; delete_lines: - "$(str)"; + "$(str)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/009.cf b/tests/acceptance/10_files/07_delete_lines/009.cf index c3dd4dde94..a139a0600b 100644 --- a/tests/acceptance/10_files/07_delete_lines/009.cf +++ b/tests/acceptance/10_files/07_delete_lines/009.cf @@ -3,23 +3,21 @@ # Delete a number of lines via an slist, different way # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -40,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,41 +47,40 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { "BEGIN", " Three potatoe", "END" }; + "str" slist => { "BEGIN", " Three potatoe", "END" }; delete_lines: - "$(str)"; + "$(str)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/010.cf b/tests/acceptance/10_files/07_delete_lines/010.cf index 66f4351742..4624ec3bb7 100644 --- a/tests/acceptance/10_files/07_delete_lines/010.cf +++ b/tests/acceptance/10_files/07_delete_lines/010.cf @@ -3,23 +3,21 @@ # Delete a number of lines via an slist, different way, different patterns # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -40,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,41 +47,40 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; + "str" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; delete_lines: - "$(str)"; + "$(str)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/011.cf b/tests/acceptance/10_files/07_delete_lines/011.cf index 0fa91c8e1c..ff256f78c9 100644 --- a/tests/acceptance/10_files/07_delete_lines/011.cf +++ b/tests/acceptance/10_files/07_delete_lines/011.cf @@ -3,23 +3,21 @@ # Delete a number of lines via an slist, original way, different patterns # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -40,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,41 +47,40 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; + "tstr" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; files: - "$(G.testfile).actual" - edit_line => test_delete("$(tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)"; + "$(str)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/012.cf b/tests/acceptance/10_files/07_delete_lines/012.cf index 65bfe1ce59..1ea4c5b1b4 100644 --- a/tests/acceptance/10_files/07_delete_lines/012.cf +++ b/tests/acceptance/10_files/07_delete_lines/012.cf @@ -3,23 +3,21 @@ # Don't delete multiple lines if they are not in the exact order # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,10 +28,10 @@ END trailer trailer"; - "expected" string => "$(actual)"; + "expected" string => "$(actual)"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,44 +40,42 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - "BEGIN + "tstr" string => "BEGIN Three potatoe END"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)"; + "$(str)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/013.cf b/tests/acceptance/10_files/07_delete_lines/013.cf index b087e380e7..0c26f1d126 100644 --- a/tests/acceptance/10_files/07_delete_lines/013.cf +++ b/tests/acceptance/10_files/07_delete_lines/013.cf @@ -3,23 +3,21 @@ # Don't delete multiple lines if they are not in the exact order # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,10 +28,10 @@ END trailer trailer"; - "expected" string => "$(actual)"; + "expected" string => "$(actual)"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,42 +40,40 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "BEGIN$(const.n)$(str)$(const.n)END"; + "BEGIN$(const.n)$(str)$(const.n)END"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/014.cf b/tests/acceptance/10_files/07_delete_lines/014.cf index 95fb8b7e7b..cdc8db8ba2 100644 --- a/tests/acceptance/10_files/07_delete_lines/014.cf +++ b/tests/acceptance/10_files/07_delete_lines/014.cf @@ -3,21 +3,20 @@ # Delete a number of lines via an slist (different order than in original) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -27,18 +26,18 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header One potato Two potato Four trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -47,41 +46,41 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " Three potatoe", "BEGIN", "END" }; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" slist => { " Three potatoe", "BEGIN", "END" }; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)"; + "$(str)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/015.cf b/tests/acceptance/10_files/07_delete_lines/015.cf index 2a5405351e..20234e7e05 100644 --- a/tests/acceptance/10_files/07_delete_lines/015.cf +++ b/tests/acceptance/10_files/07_delete_lines/015.cf @@ -3,23 +3,21 @@ # Delete a number of lines as separate lines (different order than in original) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -40,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,40 +47,39 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - " Three potatoe"; - "BEGIN"; - "END"; + " Three potatoe"; + "BEGIN"; + "END"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/016.cf b/tests/acceptance/10_files/07_delete_lines/016.cf index e17bf759fc..c0fa2323be 100644 --- a/tests/acceptance/10_files/07_delete_lines/016.cf +++ b/tests/acceptance/10_files/07_delete_lines/016.cf @@ -3,23 +3,21 @@ # Delete a number of lines as separate lines, using regexes (different order than in original) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -40,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,40 +47,39 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "\s+Three.*"; - "BEGIN"; - "END"; + "\s+Three.*"; + "BEGIN"; + "END"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/017.cf b/tests/acceptance/10_files/07_delete_lines/017.cf index d542d51a26..2b2e9c1b90 100644 --- a/tests/acceptance/10_files/07_delete_lines/017.cf +++ b/tests/acceptance/10_files/07_delete_lines/017.cf @@ -3,23 +3,21 @@ # Delete a number of lines, using regexes different way (different order than in original) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -40,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,40 +47,41 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "^\s+Three.*$"; # Anchors should make no difference - "BEGIN"; - "END"; + "^\s+Three.*$"; + + # Anchors should make no difference + "BEGIN"; + "END"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/018.cf b/tests/acceptance/10_files/07_delete_lines/018.cf index 470ce355e8..54763da03c 100644 --- a/tests/acceptance/10_files/07_delete_lines/018.cf +++ b/tests/acceptance/10_files/07_delete_lines/018.cf @@ -3,23 +3,21 @@ # Delete a number of lines via an slist, different way (different order than original) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -40,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,41 +47,40 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { " Three potatoe", "BEGIN", "END" }; + "str" slist => { " Three potatoe", "BEGIN", "END" }; delete_lines: - "$(str)"; + "$(str)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/019.cf b/tests/acceptance/10_files/07_delete_lines/019.cf index d6e5d403d4..16f2813ba8 100644 --- a/tests/acceptance/10_files/07_delete_lines/019.cf +++ b/tests/acceptance/10_files/07_delete_lines/019.cf @@ -3,23 +3,21 @@ # Delete a number of lines via an slist, different way, different patterns (different order than original) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -40,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,41 +47,40 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; + "str" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; delete_lines: - "$(str)"; + "$(str)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/020.cf b/tests/acceptance/10_files/07_delete_lines/020.cf index 60a1e1c995..f8722590d0 100644 --- a/tests/acceptance/10_files/07_delete_lines/020.cf +++ b/tests/acceptance/10_files/07_delete_lines/020.cf @@ -3,23 +3,21 @@ # Delete a number of lines via an slist, original way, different patterns (different order than original) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -40,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,40 +47,40 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; + "tstr" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; files: - "$(G.testfile).actual" - edit_line => test_delete("$(tstr)"); + "$(G.testfile).actual" edit_line => test_delete("$(tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)"; + "$(str)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/022.cf b/tests/acceptance/10_files/07_delete_lines/022.cf index 472c155ef2..10023639d8 100644 --- a/tests/acceptance/10_files/07_delete_lines/022.cf +++ b/tests/acceptance/10_files/07_delete_lines/022.cf @@ -3,23 +3,21 @@ # Delete a line, set a class # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,47 +49,42 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - classes => test_class("ok"); + "$(str)" classes => test_class("ok"); } body classes test_class(a) { - promise_repaired => { "$(a)" }; + promise_repaired => { "$(a)" }; } - ####################################################### - bundle agent check { reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/07_delete_lines/023.cf b/tests/acceptance/10_files/07_delete_lines/023.cf index ea57e4195c..f870dcfb59 100644 --- a/tests/acceptance/10_files/07_delete_lines/023.cf +++ b/tests/acceptance/10_files/07_delete_lines/023.cf @@ -3,23 +3,21 @@ # Don't delete a line, set a class # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,46 +50,43 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe "; # NOTE, DOES NOT MATCH! + "tstr" string => " Three potatoe "; + # NOTE, DOES NOT MATCH! files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - classes => test_class("ok"); + "$(str)" classes => test_class("ok"); } body classes test_class(a) { - promise_kept => { "$(a)" }; + promise_kept => { "$(a)" }; } ####################################################### - bundle agent check { reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/07_delete_lines/024.cf b/tests/acceptance/10_files/07_delete_lines/024.cf index cdfaa345c4..1e136ad5e8 100644 --- a/tests/acceptance/10_files/07_delete_lines/024.cf +++ b/tests/acceptance/10_files/07_delete_lines/024.cf @@ -3,23 +3,21 @@ # Delete a line using a list # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,47 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " Three potatoe" }; + "tstr" slist => { " Three potatoe" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/025.cf b/tests/acceptance/10_files/07_delete_lines/025.cf index 23acffadaa..ca646d5154 100644 --- a/tests/acceptance/10_files/07_delete_lines/025.cf +++ b/tests/acceptance/10_files/07_delete_lines/025.cf @@ -3,23 +3,21 @@ # Delete a line using a list, some of which don't match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,48 +49,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - # Note - regex doesn't qualify for "starts_with"! - "tstr" slist => { " Three potatoe", " Two.*", "BEGIN", "END" }; + # Note - regex doesn't qualify for "starts_with"! + "tstr" slist => { " Three potatoe", " Two.*", "BEGIN", "END" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/026.cf b/tests/acceptance/10_files/07_delete_lines/026.cf index 54f893a436..a72e9d49e1 100644 --- a/tests/acceptance/10_files/07_delete_lines/026.cf +++ b/tests/acceptance/10_files/07_delete_lines/026.cf @@ -3,23 +3,21 @@ # Delete a line using a list, all of which don't match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,47 +50,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "header", " Two.*", "BEGIN", "END" }; + "tstr" slist => { "header", " Two.*", "BEGIN", "END" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/027.cf b/tests/acceptance/10_files/07_delete_lines/027.cf index fcbc8f1f6e..d22af0158c 100644 --- a/tests/acceptance/10_files/07_delete_lines/027.cf +++ b/tests/acceptance/10_files/07_delete_lines/027.cf @@ -3,23 +3,21 @@ # Delete a line using a list, all of which match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -40,7 +37,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,47 +46,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O" }; + "tstr" slist => { " T", " O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/028.cf b/tests/acceptance/10_files/07_delete_lines/028.cf index 31c6098f71..4a0e287f93 100644 --- a/tests/acceptance/10_files/07_delete_lines/028.cf +++ b/tests/acceptance/10_files/07_delete_lines/028.cf @@ -3,23 +3,21 @@ # Delete a line using a singleton list which matches # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,47 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T" }; + "tstr" slist => { " T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/029.cf b/tests/acceptance/10_files/07_delete_lines/029.cf index 8b2a1395c5..7229d622d9 100644 --- a/tests/acceptance/10_files/07_delete_lines/029.cf +++ b/tests/acceptance/10_files/07_delete_lines/029.cf @@ -3,23 +3,21 @@ # Delete a line using a list, some of which match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,47 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O.*" }; + "tstr" slist => { " T", " O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/030.cf b/tests/acceptance/10_files/07_delete_lines/030.cf index 0d37ddf1a6..4502fc8325 100644 --- a/tests/acceptance/10_files/07_delete_lines/030.cf +++ b/tests/acceptance/10_files/07_delete_lines/030.cf @@ -3,23 +3,21 @@ # Delete a line using a list, all of which match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,47 +50,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O" }; + "tstr" slist => { " T", " O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/031.cf b/tests/acceptance/10_files/07_delete_lines/031.cf index c46414700e..c4036d5cf7 100644 --- a/tests/acceptance/10_files/07_delete_lines/031.cf +++ b/tests/acceptance/10_files/07_delete_lines/031.cf @@ -3,23 +3,21 @@ # Delete a line using a list # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,47 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*" }; + "tstr" slist => { ".*Three.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/032.cf b/tests/acceptance/10_files/07_delete_lines/032.cf index fe67baf975..92e67d377e 100644 --- a/tests/acceptance/10_files/07_delete_lines/032.cf +++ b/tests/acceptance/10_files/07_delete_lines/032.cf @@ -3,23 +3,21 @@ # Delete a line using a list, some of which don't match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,47 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*", ".*GI.*", ".*ND" }; + "tstr" slist => { ".*Three.*", ".*GI.*", ".*ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/033.cf b/tests/acceptance/10_files/07_delete_lines/033.cf index 43c9fc639d..163e4e6359 100644 --- a/tests/acceptance/10_files/07_delete_lines/033.cf +++ b/tests/acceptance/10_files/07_delete_lines/033.cf @@ -3,23 +3,21 @@ # Delete a line using a list, all of which don't match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,47 +50,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*eade.*", ".*EGI.*", ".*ND" }; + "tstr" slist => { ".*eade.*", ".*EGI.*", ".*ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/034.cf b/tests/acceptance/10_files/07_delete_lines/034.cf index d251a6d582..b4afe41ba0 100644 --- a/tests/acceptance/10_files/07_delete_lines/034.cf +++ b/tests/acceptance/10_files/07_delete_lines/034.cf @@ -3,23 +3,21 @@ # Delete a line using a list, all of which match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -40,7 +37,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,47 +46,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*O.*" }; + "tstr" slist => { ".*T.*", ".*O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/035.cf b/tests/acceptance/10_files/07_delete_lines/035.cf index 1b7baebbe0..faff03bd57 100644 --- a/tests/acceptance/10_files/07_delete_lines/035.cf +++ b/tests/acceptance/10_files/07_delete_lines/035.cf @@ -3,23 +3,21 @@ # Delete a line using a singleton list which matches # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,47 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*" }; + "tstr" slist => { ".*T.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/036.cf b/tests/acceptance/10_files/07_delete_lines/036.cf index ecc4768859..17b769dddf 100644 --- a/tests/acceptance/10_files/07_delete_lines/036.cf +++ b/tests/acceptance/10_files/07_delete_lines/036.cf @@ -3,23 +3,21 @@ # Delete a line using a list, some of which match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,47 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*C.*" }; + "tstr" slist => { ".*T.*", ".*C.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/037.cf b/tests/acceptance/10_files/07_delete_lines/037.cf index d3447110aa..e5bb05efd1 100644 --- a/tests/acceptance/10_files/07_delete_lines/037.cf +++ b/tests/acceptance/10_files/07_delete_lines/037.cf @@ -3,23 +3,21 @@ # Delete a line using a list, all of which match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,47 +50,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*O.*" }; + "tstr" slist => { ".*T.*", ".*O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/038.cf b/tests/acceptance/10_files/07_delete_lines/038.cf index 32aed05e2a..bb7028daa4 100644 --- a/tests/acceptance/10_files/07_delete_lines/038.cf +++ b/tests/acceptance/10_files/07_delete_lines/038.cf @@ -3,23 +3,21 @@ # Delete a line using a list # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,47 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "Three" }; + "tstr" slist => { "Three" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/039.cf b/tests/acceptance/10_files/07_delete_lines/039.cf index 93771d3a97..3f08262c33 100644 --- a/tests/acceptance/10_files/07_delete_lines/039.cf +++ b/tests/acceptance/10_files/07_delete_lines/039.cf @@ -3,23 +3,21 @@ # Delete a line using a list, some of which don't match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,47 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "Three", "GI", "ND" }; + "tstr" slist => { "Three", "GI", "ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/040.cf b/tests/acceptance/10_files/07_delete_lines/040.cf index 56605a24da..66a9583dc1 100644 --- a/tests/acceptance/10_files/07_delete_lines/040.cf +++ b/tests/acceptance/10_files/07_delete_lines/040.cf @@ -3,23 +3,21 @@ # Delete a line using a list, all of which don't match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,47 +50,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "eade", "EGI", "ND" }; + "tstr" slist => { "eade", "EGI", "ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/041.cf b/tests/acceptance/10_files/07_delete_lines/041.cf index 5e8db08aef..8ebe1df941 100644 --- a/tests/acceptance/10_files/07_delete_lines/041.cf +++ b/tests/acceptance/10_files/07_delete_lines/041.cf @@ -3,23 +3,21 @@ # Delete a line using a list, all of which match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -40,7 +37,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,47 +46,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "O" }; + "tstr" slist => { "T", "O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/042.cf b/tests/acceptance/10_files/07_delete_lines/042.cf index ca88919539..daa959d6d1 100644 --- a/tests/acceptance/10_files/07_delete_lines/042.cf +++ b/tests/acceptance/10_files/07_delete_lines/042.cf @@ -3,23 +3,21 @@ # Delete a line using a singleton list which matches # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,47 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T" }; + "tstr" slist => { "T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/043.cf b/tests/acceptance/10_files/07_delete_lines/043.cf index 91826ab3a8..b770cb02f0 100644 --- a/tests/acceptance/10_files/07_delete_lines/043.cf +++ b/tests/acceptance/10_files/07_delete_lines/043.cf @@ -3,23 +3,21 @@ # Delete a line using a list, some of which match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,47 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "C" }; + "tstr" slist => { "T", "C" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/044.cf b/tests/acceptance/10_files/07_delete_lines/044.cf index 4e9da1d90e..7d7c651409 100644 --- a/tests/acceptance/10_files/07_delete_lines/044.cf +++ b/tests/acceptance/10_files/07_delete_lines/044.cf @@ -3,23 +3,21 @@ # Delete a line using a list, all of which match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,47 +50,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "O" }; + "tstr" slist => { "T", "O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" - delete_select => test_match(@{match}); + "$(str)" delete_select => test_match(@{match}); } body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/045.cf b/tests/acceptance/10_files/07_delete_lines/045.cf index c73343b993..75e71c323e 100644 --- a/tests/acceptance/10_files/07_delete_lines/045.cf +++ b/tests/acceptance/10_files/07_delete_lines/045.cf @@ -3,23 +3,21 @@ # Delete a line using a list # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,13 +28,12 @@ END trailer trailer"; - "expected" string => - " One potato + "expected" string => " One potato Two potato Three potatoe"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -45,39 +42,37 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete(".*potat.*"); - + "$(G.testfile).actual" edit_line => test_delete(".*potat.*"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - not_matching => "true"; + "$(str)" not_matching => "true"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/046.cf b/tests/acceptance/10_files/07_delete_lines/046.cf index 512bf5f0c6..b14af2c9be 100644 --- a/tests/acceptance/10_files/07_delete_lines/046.cf +++ b/tests/acceptance/10_files/07_delete_lines/046.cf @@ -3,23 +3,21 @@ # Delete a line using a list # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -40,7 +37,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,39 +46,37 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete(".*potat.*"); - + "$(G.testfile).actual" edit_line => test_delete(".*potat.*"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - not_matching => "false"; + "$(str)" not_matching => "false"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/047.cf b/tests/acceptance/10_files/07_delete_lines/047.cf index 14a31789f7..0c5ca1b029 100644 --- a/tests/acceptance/10_files/07_delete_lines/047.cf +++ b/tests/acceptance/10_files/07_delete_lines/047.cf @@ -3,23 +3,21 @@ # Delete a line using a list # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,8 +28,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -41,7 +39,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,48 +48,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T" }; + "tstr" slist => { "T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@{test.tstr}"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), not_matching => "false"; } body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/101.cf b/tests/acceptance/10_files/07_delete_lines/101.cf index a896debb2b..9e8bc1d4d6 100644 --- a/tests/acceptance/10_files/07_delete_lines/101.cf +++ b/tests/acceptance/10_files/07_delete_lines/101.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,51 +50,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/102.cf b/tests/acceptance/10_files/07_delete_lines/102.cf index 8c81d6c2e0..a57187fd55 100644 --- a/tests/acceptance/10_files/07_delete_lines/102.cf +++ b/tests/acceptance/10_files/07_delete_lines/102.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,51 +51,49 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe "; # NOTE, DOES NOT MATCH! + "tstr" string => " Three potatoe "; + # NOTE, DOES NOT MATCH! files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/103.cf b/tests/acceptance/10_files/07_delete_lines/103.cf index 3d403b5ec0..68dee3f5ae 100644 --- a/tests/acceptance/10_files/07_delete_lines/103.cf +++ b/tests/acceptance/10_files/07_delete_lines/103.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN Three potatoe @@ -28,14 +26,13 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -44,54 +41,50 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - "BEGIN + "tstr" string => "BEGIN Three potatoe END"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/104.cf b/tests/acceptance/10_files/07_delete_lines/104.cf index 5be303f7f4..aa8dcaeaa2 100644 --- a/tests/acceptance/10_files/07_delete_lines/104.cf +++ b/tests/acceptance/10_files/07_delete_lines/104.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN Three potatoe @@ -28,14 +26,13 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -44,51 +41,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "BEGIN$(const.n)$(str)$(const.n)END" - select_region => test_select; + "BEGIN$(const.n)$(str)$(const.n)END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/105.cf b/tests/acceptance/10_files/07_delete_lines/105.cf index 63a128261d..d4d242bca5 100644 --- a/tests/acceptance/10_files/07_delete_lines/105.cf +++ b/tests/acceptance/10_files/07_delete_lines/105.cf @@ -6,21 +6,20 @@ # start_delimiter is deleted, the region will not be matched again. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,9 +29,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header One potato Two potato @@ -41,9 +40,9 @@ header END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,51 +51,49 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "BEGIN", " Three potatoe", "END" }; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" slist => { "BEGIN", " Three potatoe", "END" }; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/106.cf b/tests/acceptance/10_files/07_delete_lines/106.cf index c172c6f43f..675aeb4806 100644 --- a/tests/acceptance/10_files/07_delete_lines/106.cf +++ b/tests/acceptance/10_files/07_delete_lines/106.cf @@ -5,23 +5,21 @@ # Region is destroyed by first edit # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -32,8 +30,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,53 +51,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - # Region is destroyed by first edit - "BEGIN" - select_region => test_select; - " Three potatoe" - select_region => test_select; - "END" - select_region => test_select; + # Region is destroyed by first edit + "BEGIN" select_region => test_select; + " Three potatoe" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/107.cf b/tests/acceptance/10_files/07_delete_lines/107.cf index c4e000a185..dd43a5475f 100644 --- a/tests/acceptance/10_files/07_delete_lines/107.cf +++ b/tests/acceptance/10_files/07_delete_lines/107.cf @@ -5,23 +5,21 @@ # Region is destroyed by first edit # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -32,8 +30,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,53 +51,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - # Region is destroyed by first edit - "BEGIN" - select_region => test_select; - "\s+Three.*" - select_region => test_select; - "END" - select_region => test_select; + # Region is destroyed by first edit + "BEGIN" select_region => test_select; + "\s+Three.*" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/108.cf b/tests/acceptance/10_files/07_delete_lines/108.cf index ed89f1e494..fe37dcfa41 100644 --- a/tests/acceptance/10_files/07_delete_lines/108.cf +++ b/tests/acceptance/10_files/07_delete_lines/108.cf @@ -5,23 +5,21 @@ # Region is destroyed by first edit # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -32,8 +30,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,53 +51,52 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - # Region is destroyed by first edit - "BEGIN" - select_region => test_select; - "^\s+Three.*$" # Anchors should make no difference - select_region => test_select; - "END" + # Region is destroyed by first edit + "BEGIN" select_region => test_select; + + "^\s+Three.*$" + # Anchors should make no difference select_region => test_select; + + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/109.cf b/tests/acceptance/10_files/07_delete_lines/109.cf index 7ff1adac4b..e6308f75fa 100644 --- a/tests/acceptance/10_files/07_delete_lines/109.cf +++ b/tests/acceptance/10_files/07_delete_lines/109.cf @@ -5,23 +5,21 @@ # Region is destroyed by first edit # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -32,8 +30,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,52 +51,49 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { "BEGIN", " Three potatoe", "END" }; + "str" slist => { "BEGIN", " Three potatoe", "END" }; delete_lines: - # Region is destroyed by first edit - "$(str)" - select_region => test_select; + # Region is destroyed by first edit + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/110.cf b/tests/acceptance/10_files/07_delete_lines/110.cf index 75e6b421de..50db17ae88 100644 --- a/tests/acceptance/10_files/07_delete_lines/110.cf +++ b/tests/acceptance/10_files/07_delete_lines/110.cf @@ -5,23 +5,21 @@ # Region is destroyed by first edit # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -32,8 +30,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,52 +51,49 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; + "str" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; delete_lines: - # Region is destroyed by first edit - "$(str)" - select_region => test_select; + # Region is destroyed by first edit + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/111.cf b/tests/acceptance/10_files/07_delete_lines/111.cf index 5621a1dcbf..13593164fc 100644 --- a/tests/acceptance/10_files/07_delete_lines/111.cf +++ b/tests/acceptance/10_files/07_delete_lines/111.cf @@ -5,23 +5,21 @@ # Region is destroyed by first edit # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -32,8 +30,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,52 +51,49 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; + "tstr" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; files: - "$(G.testfile).actual" - edit_line => test_delete("$(tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(tstr)"); } bundle edit_line test_delete(str) { delete_lines: - # Region is destroyed by first edit - "$(str)" - select_region => test_select; + # Region is destroyed by first edit + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/112.cf b/tests/acceptance/10_files/07_delete_lines/112.cf index e2dacab017..1706c88fa4 100644 --- a/tests/acceptance/10_files/07_delete_lines/112.cf +++ b/tests/acceptance/10_files/07_delete_lines/112.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,10 +29,10 @@ END trailer trailer"; - "expected" string => "$(actual)"; + "expected" string => "$(actual)"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -43,54 +41,50 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " Three potatoe + "tstr" string => " Three potatoe BEGIN END"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/113.cf b/tests/acceptance/10_files/07_delete_lines/113.cf index 2458976b9d..2a6bc2cfc7 100644 --- a/tests/acceptance/10_files/07_delete_lines/113.cf +++ b/tests/acceptance/10_files/07_delete_lines/113.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,10 +29,10 @@ END trailer trailer"; - "expected" string => "$(actual)"; + "expected" string => "$(actual)"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -43,52 +41,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)$(const.n)BEGIN$(const.n)END" - select_region => test_select; + "$(str)$(const.n)BEGIN$(const.n)END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/114.cf b/tests/acceptance/10_files/07_delete_lines/114.cf index 76308c7123..318b47f033 100644 --- a/tests/acceptance/10_files/07_delete_lines/114.cf +++ b/tests/acceptance/10_files/07_delete_lines/114.cf @@ -5,21 +5,20 @@ # Second edit destroys the region # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -29,9 +28,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header One potato Two potato @@ -39,9 +38,9 @@ header END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,52 +49,50 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " Three potatoe", "BEGIN", "END" }; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" slist => { " Three potatoe", "BEGIN", "END" }; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - # Second edit destroys the region - "$(str)" - select_region => test_select; + # Second edit destroys the region + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/115.cf b/tests/acceptance/10_files/07_delete_lines/115.cf index 1a609973fe..6757c1e5e2 100644 --- a/tests/acceptance/10_files/07_delete_lines/115.cf +++ b/tests/acceptance/10_files/07_delete_lines/115.cf @@ -5,23 +5,21 @@ # Second edit destroys the region # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -32,8 +30,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,53 +50,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - # Second edit destroys the region - " Three potatoe" - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" - select_region => test_select; + # Second edit destroys the region + " Three potatoe" select_region => test_select; + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/116.cf b/tests/acceptance/10_files/07_delete_lines/116.cf index 5396f0466f..76eda9171a 100644 --- a/tests/acceptance/10_files/07_delete_lines/116.cf +++ b/tests/acceptance/10_files/07_delete_lines/116.cf @@ -5,23 +5,21 @@ # Second edit destroys the region # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -32,8 +30,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,53 +50,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - # Second edit destroys the region - "\s+Three.*" - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" - select_region => test_select; + # Second edit destroys the region + "\s+Three.*" select_region => test_select; + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/117.cf b/tests/acceptance/10_files/07_delete_lines/117.cf index 79beec8010..f6e4763222 100644 --- a/tests/acceptance/10_files/07_delete_lines/117.cf +++ b/tests/acceptance/10_files/07_delete_lines/117.cf @@ -5,23 +5,21 @@ # Second edit destroys the region # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -32,8 +30,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,53 +50,51 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - # Second edit destroys the region - "^\s+Three.*$" # Anchors should make no difference - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" + # Second edit destroys the region + "^\s+Three.*$" + # Anchors should make no difference select_region => test_select; + + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/118.cf b/tests/acceptance/10_files/07_delete_lines/118.cf index 7ef3db17c5..4a7f7d6e08 100644 --- a/tests/acceptance/10_files/07_delete_lines/118.cf +++ b/tests/acceptance/10_files/07_delete_lines/118.cf @@ -5,23 +5,21 @@ # Second edit destroys the region # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -32,8 +30,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,52 +50,49 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { " Three potatoe", "BEGIN", "END" }; + "str" slist => { " Three potatoe", "BEGIN", "END" }; delete_lines: - # Second edit destroys the region - "$(str)" - select_region => test_select; + # Second edit destroys the region + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/119.cf b/tests/acceptance/10_files/07_delete_lines/119.cf index 3049337617..5d209e942a 100644 --- a/tests/acceptance/10_files/07_delete_lines/119.cf +++ b/tests/acceptance/10_files/07_delete_lines/119.cf @@ -5,21 +5,20 @@ # Second edit destroys the region and therefore the third edit will not be possible. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -29,9 +28,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header One potato Two potato @@ -39,9 +38,9 @@ header END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,52 +49,50 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; - + "str" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; + delete_lines: - # Second edit destroys the region - "$(str)" - select_region => test_select; + # Second edit destroys the region + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/120.cf b/tests/acceptance/10_files/07_delete_lines/120.cf index f573e3a80b..0d58823465 100644 --- a/tests/acceptance/10_files/07_delete_lines/120.cf +++ b/tests/acceptance/10_files/07_delete_lines/120.cf @@ -5,23 +5,21 @@ # Second edit destroys the region # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -32,8 +30,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,51 +50,49 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; + "tstr" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; files: - "$(G.testfile).actual" - edit_line => test_delete("$(tstr)"); + "$(G.testfile).actual" edit_line => test_delete("$(tstr)"); } bundle edit_line test_delete(str) { delete_lines: - # Second edit destroys the region - "$(str)" - select_region => test_select; + # Second edit destroys the region + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/122.cf b/tests/acceptance/10_files/07_delete_lines/122.cf index 709c2e504d..eb0dd97816 100644 --- a/tests/acceptance/10_files/07_delete_lines/122.cf +++ b/tests/acceptance/10_files/07_delete_lines/122.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,57 +50,52 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" classes => test_class("ok"), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body classes test_class(a) { - promise_repaired => { "$(a)" }; + promise_repaired => { "$(a)" }; } - ####################################################### - bundle agent check { reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/07_delete_lines/123.cf b/tests/acceptance/10_files/07_delete_lines/123.cf index dc74912b7b..cd93e4cf56 100644 --- a/tests/acceptance/10_files/07_delete_lines/123.cf +++ b/tests/acceptance/10_files/07_delete_lines/123.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,56 +51,53 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe "; # NOTE, DOES NOT MATCH! + "tstr" string => " Three potatoe "; + # NOTE, DOES NOT MATCH! files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" classes => test_class("ok"), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body classes test_class(a) { - promise_kept => { "$(a)" }; + promise_kept => { "$(a)" }; } ####################################################### - bundle agent check { reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/07_delete_lines/124.cf b/tests/acceptance/10_files/07_delete_lines/124.cf index ec03f96e5b..4dd83af3a0 100644 --- a/tests/acceptance/10_files/07_delete_lines/124.cf +++ b/tests/acceptance/10_files/07_delete_lines/124.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,57 +50,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " Three potatoe" }; + "tstr" slist => { " Three potatoe" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/125.cf b/tests/acceptance/10_files/07_delete_lines/125.cf index 5eba55949c..9abde0e269 100644 --- a/tests/acceptance/10_files/07_delete_lines/125.cf +++ b/tests/acceptance/10_files/07_delete_lines/125.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,58 +50,57 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - # Note - regex doesn't qualify for "starts_with"! - "tstr" slist => { " Three potatoe", " Two.*", "BEGIN", "END" }; + # Note - regex doesn't qualify for "starts_with"! + "tstr" slist => { " Three potatoe", " Two.*", "BEGIN", "END" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/126.cf b/tests/acceptance/10_files/07_delete_lines/126.cf index c73cadd2c0..6a12a1fb67 100644 --- a/tests/acceptance/10_files/07_delete_lines/126.cf +++ b/tests/acceptance/10_files/07_delete_lines/126.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,57 +51,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "header", " Two.*", "BEGIN", "END" }; + "tstr" slist => { "header", " Two.*", "BEGIN", "END" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/127.cf b/tests/acceptance/10_files/07_delete_lines/127.cf index 59c262fc61..35357a7ee5 100644 --- a/tests/acceptance/10_files/07_delete_lines/127.cf +++ b/tests/acceptance/10_files/07_delete_lines/127.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -41,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,57 +47,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O" }; + "tstr" slist => { " T", " O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/128.cf b/tests/acceptance/10_files/07_delete_lines/128.cf index 5e85412c3a..a4288fb8ac 100644 --- a/tests/acceptance/10_files/07_delete_lines/128.cf +++ b/tests/acceptance/10_files/07_delete_lines/128.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,57 +50,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T" }; + "tstr" slist => { " T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/129.cf b/tests/acceptance/10_files/07_delete_lines/129.cf index 9b7669f5d0..8652263b5e 100644 --- a/tests/acceptance/10_files/07_delete_lines/129.cf +++ b/tests/acceptance/10_files/07_delete_lines/129.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,57 +50,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O.*" }; + "tstr" slist => { " T", " O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/130.cf b/tests/acceptance/10_files/07_delete_lines/130.cf index dd580dd485..ef02a4cba5 100644 --- a/tests/acceptance/10_files/07_delete_lines/130.cf +++ b/tests/acceptance/10_files/07_delete_lines/130.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,57 +51,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O" }; + "tstr" slist => { " T", " O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/131.cf b/tests/acceptance/10_files/07_delete_lines/131.cf index 899ccee53a..6ae8afa3e9 100644 --- a/tests/acceptance/10_files/07_delete_lines/131.cf +++ b/tests/acceptance/10_files/07_delete_lines/131.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,57 +50,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*" }; + "tstr" slist => { ".*Three.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/132.cf b/tests/acceptance/10_files/07_delete_lines/132.cf index 717b837784..051fb618de 100644 --- a/tests/acceptance/10_files/07_delete_lines/132.cf +++ b/tests/acceptance/10_files/07_delete_lines/132.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,57 +50,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*", ".*GI.*", ".*ND" }; + "tstr" slist => { ".*Three.*", ".*GI.*", ".*ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/133.cf b/tests/acceptance/10_files/07_delete_lines/133.cf index d7c1a7cc2d..0150ef9e57 100644 --- a/tests/acceptance/10_files/07_delete_lines/133.cf +++ b/tests/acceptance/10_files/07_delete_lines/133.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,57 +51,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*eade.*", ".*EGI.*", ".*ND" }; + "tstr" slist => { ".*eade.*", ".*EGI.*", ".*ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/134.cf b/tests/acceptance/10_files/07_delete_lines/134.cf index f13040584d..f7bd21c45b 100644 --- a/tests/acceptance/10_files/07_delete_lines/134.cf +++ b/tests/acceptance/10_files/07_delete_lines/134.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -41,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,57 +47,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*O.*" }; + "tstr" slist => { ".*T.*", ".*O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/135.cf b/tests/acceptance/10_files/07_delete_lines/135.cf index 10d59bb3c9..91ebad8c45 100644 --- a/tests/acceptance/10_files/07_delete_lines/135.cf +++ b/tests/acceptance/10_files/07_delete_lines/135.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,57 +50,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*" }; + "tstr" slist => { ".*T.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/136.cf b/tests/acceptance/10_files/07_delete_lines/136.cf index 74b1b7512b..a26735af9f 100644 --- a/tests/acceptance/10_files/07_delete_lines/136.cf +++ b/tests/acceptance/10_files/07_delete_lines/136.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,57 +50,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*C.*" }; + "tstr" slist => { ".*T.*", ".*C.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/137.cf b/tests/acceptance/10_files/07_delete_lines/137.cf index 5bfd211021..4f242de43c 100644 --- a/tests/acceptance/10_files/07_delete_lines/137.cf +++ b/tests/acceptance/10_files/07_delete_lines/137.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,57 +51,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*O.*" }; + "tstr" slist => { ".*T.*", ".*O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/138.cf b/tests/acceptance/10_files/07_delete_lines/138.cf index e9a16b7109..de2af8055a 100644 --- a/tests/acceptance/10_files/07_delete_lines/138.cf +++ b/tests/acceptance/10_files/07_delete_lines/138.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,57 +50,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "Three" }; + "tstr" slist => { "Three" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/139.cf b/tests/acceptance/10_files/07_delete_lines/139.cf index a5ae416565..afb5b9e2bf 100644 --- a/tests/acceptance/10_files/07_delete_lines/139.cf +++ b/tests/acceptance/10_files/07_delete_lines/139.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,57 +50,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "Three", "GI", "ND" }; + "tstr" slist => { "Three", "GI", "ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/140.cf b/tests/acceptance/10_files/07_delete_lines/140.cf index 8511d54392..43ed2894a8 100644 --- a/tests/acceptance/10_files/07_delete_lines/140.cf +++ b/tests/acceptance/10_files/07_delete_lines/140.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,57 +51,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "eade", "EGI", "ND" }; + "tstr" slist => { "eade", "EGI", "ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/141.cf b/tests/acceptance/10_files/07_delete_lines/141.cf index c973934212..2f4b9e402b 100644 --- a/tests/acceptance/10_files/07_delete_lines/141.cf +++ b/tests/acceptance/10_files/07_delete_lines/141.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -41,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,57 +47,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "O" }; + "tstr" slist => { "T", "O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/142.cf b/tests/acceptance/10_files/07_delete_lines/142.cf index e7c0cf4e34..4ead56ed83 100644 --- a/tests/acceptance/10_files/07_delete_lines/142.cf +++ b/tests/acceptance/10_files/07_delete_lines/142.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,57 +50,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T" }; + "tstr" slist => { "T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/143.cf b/tests/acceptance/10_files/07_delete_lines/143.cf index 52544b8e50..25cfb3d9b0 100644 --- a/tests/acceptance/10_files/07_delete_lines/143.cf +++ b/tests/acceptance/10_files/07_delete_lines/143.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,57 +50,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "C" }; + "tstr" slist => { "T", "C" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/144.cf b/tests/acceptance/10_files/07_delete_lines/144.cf index 70af9fefa6..a6d334a16a 100644 --- a/tests/acceptance/10_files/07_delete_lines/144.cf +++ b/tests/acceptance/10_files/07_delete_lines/144.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,57 +51,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "O" }; + "tstr" slist => { "T", "O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/145.cf b/tests/acceptance/10_files/07_delete_lines/145.cf index daf2bb028a..4ba58b2083 100644 --- a/tests/acceptance/10_files/07_delete_lines/145.cf +++ b/tests/acceptance/10_files/07_delete_lines/145.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -41,7 +39,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,49 +48,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete(".*potat.*"); - + "$(G.testfile).actual" edit_line => test_delete(".*potat.*"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" not_matching => "true", select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/146.cf b/tests/acceptance/10_files/07_delete_lines/146.cf index 016717c08a..3a939289b3 100644 --- a/tests/acceptance/10_files/07_delete_lines/146.cf +++ b/tests/acceptance/10_files/07_delete_lines/146.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -41,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,49 +47,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete(".*potat.*"); - + "$(G.testfile).actual" edit_line => test_delete(".*potat.*"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" not_matching => "false", select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/147.cf b/tests/acceptance/10_files/07_delete_lines/147.cf index e7f80ea867..06ef174e4b 100644 --- a/tests/acceptance/10_files/07_delete_lines/147.cf +++ b/tests/acceptance/10_files/07_delete_lines/147.cf @@ -4,23 +4,21 @@ # Region editing, include_start_delimiter and include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,31 +49,29 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T" }; + "tstr" slist => { "T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@{test.tstr}"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), not_matching => "false", select_region => test_select; @@ -83,25 +79,27 @@ bundle edit_line test_delete(str, match) body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; } body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/201.cf b/tests/acceptance/10_files/07_delete_lines/201.cf index 841c7990ba..87c50c1f85 100644 --- a/tests/acceptance/10_files/07_delete_lines/201.cf +++ b/tests/acceptance/10_files/07_delete_lines/201.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,50 +50,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/202.cf b/tests/acceptance/10_files/07_delete_lines/202.cf index cba82a4822..9f1992fefe 100644 --- a/tests/acceptance/10_files/07_delete_lines/202.cf +++ b/tests/acceptance/10_files/07_delete_lines/202.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,50 +51,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe "; # NOTE, DOES NOT MATCH! + "tstr" string => " Three potatoe "; + # NOTE, DOES NOT MATCH! files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/203.cf b/tests/acceptance/10_files/07_delete_lines/203.cf index 2cebd6ff30..60e0e12097 100644 --- a/tests/acceptance/10_files/07_delete_lines/203.cf +++ b/tests/acceptance/10_files/07_delete_lines/203.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN Three potatoe @@ -28,15 +26,14 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -45,52 +42,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " Three potatoe + "tstr" string => " Three potatoe END"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/204.cf b/tests/acceptance/10_files/07_delete_lines/204.cf index a7312115bc..6c9b37714c 100644 --- a/tests/acceptance/10_files/07_delete_lines/204.cf +++ b/tests/acceptance/10_files/07_delete_lines/204.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN Three potatoe @@ -28,15 +26,14 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -45,50 +42,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)$(const.n)END" - select_region => test_select; + "$(str)$(const.n)END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/205.cf b/tests/acceptance/10_files/07_delete_lines/205.cf index aac50f10e9..f88628bb35 100644 --- a/tests/acceptance/10_files/07_delete_lines/205.cf +++ b/tests/acceptance/10_files/07_delete_lines/205.cf @@ -4,21 +4,20 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -28,9 +27,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -38,9 +37,9 @@ BEGIN Four trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,50 +48,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " Three potatoe", "END" }; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" slist => { " Three potatoe", "END" }; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/206.cf b/tests/acceptance/10_files/07_delete_lines/206.cf index aa206d1f6e..8434e4ca40 100644 --- a/tests/acceptance/10_files/07_delete_lines/206.cf +++ b/tests/acceptance/10_files/07_delete_lines/206.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,51 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "BEGIN" - select_region => test_select; - " Three potatoe" - select_region => test_select; - "END" - select_region => test_select; + "BEGIN" select_region => test_select; + " Three potatoe" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/207.cf b/tests/acceptance/10_files/07_delete_lines/207.cf index ed42aeb4e4..704d7540b1 100644 --- a/tests/acceptance/10_files/07_delete_lines/207.cf +++ b/tests/acceptance/10_files/07_delete_lines/207.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,51 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "BEGIN" - select_region => test_select; - "\s+Three.*" - select_region => test_select; - "END" - select_region => test_select; + "BEGIN" select_region => test_select; + "\s+Three.*" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/208.cf b/tests/acceptance/10_files/07_delete_lines/208.cf index 7f4fd53d33..c65421282a 100644 --- a/tests/acceptance/10_files/07_delete_lines/208.cf +++ b/tests/acceptance/10_files/07_delete_lines/208.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,51 +49,50 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "BEGIN" - select_region => test_select; - "^\s+Three.*$" # Anchors should make no difference - select_region => test_select; - "END" + "BEGIN" select_region => test_select; + + "^\s+Three.*$" + # Anchors should make no difference select_region => test_select; + + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/209.cf b/tests/acceptance/10_files/07_delete_lines/209.cf index 44d29b0334..868b8fd89b 100644 --- a/tests/acceptance/10_files/07_delete_lines/209.cf +++ b/tests/acceptance/10_files/07_delete_lines/209.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,50 +49,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { "BEGIN", " Three potatoe", "END" }; + "str" slist => { "BEGIN", " Three potatoe", "END" }; delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/210.cf b/tests/acceptance/10_files/07_delete_lines/210.cf index 9ae8cf55bd..2646ffddd2 100644 --- a/tests/acceptance/10_files/07_delete_lines/210.cf +++ b/tests/acceptance/10_files/07_delete_lines/210.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,50 +49,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; + "str" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/211.cf b/tests/acceptance/10_files/07_delete_lines/211.cf index a946f2dce8..ff5eecdd88 100644 --- a/tests/acceptance/10_files/07_delete_lines/211.cf +++ b/tests/acceptance/10_files/07_delete_lines/211.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,50 +49,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; + "tstr" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; files: - "$(G.testfile).actual" - edit_line => test_delete("$(tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/212.cf b/tests/acceptance/10_files/07_delete_lines/212.cf index 66994b0104..f436a7ec58 100644 --- a/tests/acceptance/10_files/07_delete_lines/212.cf +++ b/tests/acceptance/10_files/07_delete_lines/212.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,10 +29,10 @@ END trailer trailer"; - "expected" string => "$(actual)"; + "expected" string => "$(actual)"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -43,53 +41,49 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " Three potatoe + "tstr" string => " Three potatoe BEGIN END"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/213.cf b/tests/acceptance/10_files/07_delete_lines/213.cf index 4cb1debc3b..c19f081b39 100644 --- a/tests/acceptance/10_files/07_delete_lines/213.cf +++ b/tests/acceptance/10_files/07_delete_lines/213.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,10 +29,10 @@ END trailer trailer"; - "expected" string => "$(actual)"; + "expected" string => "$(actual)"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -43,51 +41,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)$(const.n)BEGIN$(const.n)END" - select_region => test_select; + "$(str)$(const.n)BEGIN$(const.n)END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/214.cf b/tests/acceptance/10_files/07_delete_lines/214.cf index deebe6d4d9..f1eabedbae 100644 --- a/tests/acceptance/10_files/07_delete_lines/214.cf +++ b/tests/acceptance/10_files/07_delete_lines/214.cf @@ -4,21 +4,20 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -28,9 +27,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -38,9 +37,9 @@ BEGIN Four trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,50 +48,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " Three potatoe", "BEGIN", "END" }; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" slist => { " Three potatoe", "BEGIN", "END" }; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/215.cf b/tests/acceptance/10_files/07_delete_lines/215.cf index 9b6b3972dd..c821e78fea 100644 --- a/tests/acceptance/10_files/07_delete_lines/215.cf +++ b/tests/acceptance/10_files/07_delete_lines/215.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,51 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - " Three potatoe" - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" - select_region => test_select; + " Three potatoe" select_region => test_select; + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/216.cf b/tests/acceptance/10_files/07_delete_lines/216.cf index c60a7f359a..ce2b4633e3 100644 --- a/tests/acceptance/10_files/07_delete_lines/216.cf +++ b/tests/acceptance/10_files/07_delete_lines/216.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,51 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "\s+Three.*" - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" - select_region => test_select; + "\s+Three.*" select_region => test_select; + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/217.cf b/tests/acceptance/10_files/07_delete_lines/217.cf index affc22ade1..58d5be6ebf 100644 --- a/tests/acceptance/10_files/07_delete_lines/217.cf +++ b/tests/acceptance/10_files/07_delete_lines/217.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,51 +49,49 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "^\s+Three.*$" # Anchors should make no difference - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" + "^\s+Three.*$" + # Anchors should make no difference select_region => test_select; + + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/218.cf b/tests/acceptance/10_files/07_delete_lines/218.cf index be7b8955b6..348b195eed 100644 --- a/tests/acceptance/10_files/07_delete_lines/218.cf +++ b/tests/acceptance/10_files/07_delete_lines/218.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,50 +49,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { " Three potatoe", "BEGIN", "END" }; + "str" slist => { " Three potatoe", "BEGIN", "END" }; delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/219.cf b/tests/acceptance/10_files/07_delete_lines/219.cf index ce9a684c37..1735b7ec77 100644 --- a/tests/acceptance/10_files/07_delete_lines/219.cf +++ b/tests/acceptance/10_files/07_delete_lines/219.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,50 +49,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; + "str" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/220.cf b/tests/acceptance/10_files/07_delete_lines/220.cf index dd691b454d..92e7e22dfd 100644 --- a/tests/acceptance/10_files/07_delete_lines/220.cf +++ b/tests/acceptance/10_files/07_delete_lines/220.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,49 +49,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; + "tstr" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; files: - "$(G.testfile).actual" - edit_line => test_delete("$(tstr)"); + "$(G.testfile).actual" edit_line => test_delete("$(tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/222.cf b/tests/acceptance/10_files/07_delete_lines/222.cf index 9584bd766a..08ca706029 100644 --- a/tests/acceptance/10_files/07_delete_lines/222.cf +++ b/tests/acceptance/10_files/07_delete_lines/222.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,51 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" classes => test_class("ok"), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body classes test_class(a) { - promise_repaired => { "$(a)" }; + promise_repaired => { "$(a)" }; } - ####################################################### - bundle agent check { reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/07_delete_lines/223.cf b/tests/acceptance/10_files/07_delete_lines/223.cf index 0f7bb215dd..57f0c17d16 100644 --- a/tests/acceptance/10_files/07_delete_lines/223.cf +++ b/tests/acceptance/10_files/07_delete_lines/223.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,55 +51,52 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe "; # NOTE, DOES NOT MATCH! + "tstr" string => " Three potatoe "; + # NOTE, DOES NOT MATCH! files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" classes => test_class("ok"), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body classes test_class(a) { - promise_kept => { "$(a)" }; + promise_kept => { "$(a)" }; } ####################################################### - bundle agent check { reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/07_delete_lines/224.cf b/tests/acceptance/10_files/07_delete_lines/224.cf index 405cd1949b..227792f9e5 100644 --- a/tests/acceptance/10_files/07_delete_lines/224.cf +++ b/tests/acceptance/10_files/07_delete_lines/224.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " Three potatoe" }; + "tstr" slist => { " Three potatoe" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/225.cf b/tests/acceptance/10_files/07_delete_lines/225.cf index cf7385cf34..d64720b76b 100644 --- a/tests/acceptance/10_files/07_delete_lines/225.cf +++ b/tests/acceptance/10_files/07_delete_lines/225.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,57 +50,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - # Note - regex doesn't qualify for "starts_with"! - "tstr" slist => { " Three potatoe", " Two.*", "BEGIN", "END" }; + # Note - regex doesn't qualify for "starts_with"! + "tstr" slist => { " Three potatoe", " Two.*", "BEGIN", "END" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/226.cf b/tests/acceptance/10_files/07_delete_lines/226.cf index 7a530e09b6..0d0c11761a 100644 --- a/tests/acceptance/10_files/07_delete_lines/226.cf +++ b/tests/acceptance/10_files/07_delete_lines/226.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,56 +51,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "header", " Two.*", "BEGIN", "END" }; + "tstr" slist => { "header", " Two.*", "BEGIN", "END" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/227.cf b/tests/acceptance/10_files/07_delete_lines/227.cf index eed8969794..5bdb9edb4c 100644 --- a/tests/acceptance/10_files/07_delete_lines/227.cf +++ b/tests/acceptance/10_files/07_delete_lines/227.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -41,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,56 +47,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O" }; + "tstr" slist => { " T", " O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/228.cf b/tests/acceptance/10_files/07_delete_lines/228.cf index 91eed4e96d..2426454d29 100644 --- a/tests/acceptance/10_files/07_delete_lines/228.cf +++ b/tests/acceptance/10_files/07_delete_lines/228.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T" }; + "tstr" slist => { " T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/229.cf b/tests/acceptance/10_files/07_delete_lines/229.cf index f39508dde4..16ee2307ca 100644 --- a/tests/acceptance/10_files/07_delete_lines/229.cf +++ b/tests/acceptance/10_files/07_delete_lines/229.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O.*" }; + "tstr" slist => { " T", " O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/230.cf b/tests/acceptance/10_files/07_delete_lines/230.cf index 3fb0f9e4e3..fb87437396 100644 --- a/tests/acceptance/10_files/07_delete_lines/230.cf +++ b/tests/acceptance/10_files/07_delete_lines/230.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,56 +51,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O" }; + "tstr" slist => { " T", " O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/231.cf b/tests/acceptance/10_files/07_delete_lines/231.cf index 9e85c15802..556c01baf0 100644 --- a/tests/acceptance/10_files/07_delete_lines/231.cf +++ b/tests/acceptance/10_files/07_delete_lines/231.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*" }; + "tstr" slist => { ".*Three.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/232.cf b/tests/acceptance/10_files/07_delete_lines/232.cf index 7b32d84047..2e8cfa25c7 100644 --- a/tests/acceptance/10_files/07_delete_lines/232.cf +++ b/tests/acceptance/10_files/07_delete_lines/232.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*", ".*GI.*", ".*ND" }; + "tstr" slist => { ".*Three.*", ".*GI.*", ".*ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/233.cf b/tests/acceptance/10_files/07_delete_lines/233.cf index 0ae937f3ef..6539b1be0b 100644 --- a/tests/acceptance/10_files/07_delete_lines/233.cf +++ b/tests/acceptance/10_files/07_delete_lines/233.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,56 +51,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*eade.*", ".*EGI.*", ".*ND" }; + "tstr" slist => { ".*eade.*", ".*EGI.*", ".*ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/234.cf b/tests/acceptance/10_files/07_delete_lines/234.cf index 10283e18e8..62536a767d 100644 --- a/tests/acceptance/10_files/07_delete_lines/234.cf +++ b/tests/acceptance/10_files/07_delete_lines/234.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -41,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,56 +47,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*O.*" }; + "tstr" slist => { ".*T.*", ".*O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/235.cf b/tests/acceptance/10_files/07_delete_lines/235.cf index 786d251ee9..33f0bf7b60 100644 --- a/tests/acceptance/10_files/07_delete_lines/235.cf +++ b/tests/acceptance/10_files/07_delete_lines/235.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*" }; + "tstr" slist => { ".*T.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/236.cf b/tests/acceptance/10_files/07_delete_lines/236.cf index e2fbbd4c77..7eb32ed08f 100644 --- a/tests/acceptance/10_files/07_delete_lines/236.cf +++ b/tests/acceptance/10_files/07_delete_lines/236.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*C.*" }; + "tstr" slist => { ".*T.*", ".*C.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/237.cf b/tests/acceptance/10_files/07_delete_lines/237.cf index 98d686985d..aea9d7ad03 100644 --- a/tests/acceptance/10_files/07_delete_lines/237.cf +++ b/tests/acceptance/10_files/07_delete_lines/237.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,56 +51,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*O.*" }; + "tstr" slist => { ".*T.*", ".*O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/238.cf b/tests/acceptance/10_files/07_delete_lines/238.cf index c8b7c81c05..a7cd11da58 100644 --- a/tests/acceptance/10_files/07_delete_lines/238.cf +++ b/tests/acceptance/10_files/07_delete_lines/238.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "Three" }; + "tstr" slist => { "Three" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/239.cf b/tests/acceptance/10_files/07_delete_lines/239.cf index 013755f7aa..034ed1b23e 100644 --- a/tests/acceptance/10_files/07_delete_lines/239.cf +++ b/tests/acceptance/10_files/07_delete_lines/239.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "Three", "GI", "ND" }; + "tstr" slist => { "Three", "GI", "ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/240.cf b/tests/acceptance/10_files/07_delete_lines/240.cf index 9ef890c1d0..8f6244ac07 100644 --- a/tests/acceptance/10_files/07_delete_lines/240.cf +++ b/tests/acceptance/10_files/07_delete_lines/240.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,56 +51,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "eade", "EGI", "ND" }; + "tstr" slist => { "eade", "EGI", "ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/241.cf b/tests/acceptance/10_files/07_delete_lines/241.cf index ef396f251e..431c35e00a 100644 --- a/tests/acceptance/10_files/07_delete_lines/241.cf +++ b/tests/acceptance/10_files/07_delete_lines/241.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -41,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,56 +47,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "O" }; + "tstr" slist => { "T", "O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/242.cf b/tests/acceptance/10_files/07_delete_lines/242.cf index 439a535f74..eba18db040 100644 --- a/tests/acceptance/10_files/07_delete_lines/242.cf +++ b/tests/acceptance/10_files/07_delete_lines/242.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T" }; + "tstr" slist => { "T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/243.cf b/tests/acceptance/10_files/07_delete_lines/243.cf index 073875b21c..fecf3aa25b 100644 --- a/tests/acceptance/10_files/07_delete_lines/243.cf +++ b/tests/acceptance/10_files/07_delete_lines/243.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "C" }; + "tstr" slist => { "T", "C" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/244.cf b/tests/acceptance/10_files/07_delete_lines/244.cf index 9728d35c9b..4c01d6e0f2 100644 --- a/tests/acceptance/10_files/07_delete_lines/244.cf +++ b/tests/acceptance/10_files/07_delete_lines/244.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,56 +51,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "O" }; + "tstr" slist => { "T", "O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/245.cf b/tests/acceptance/10_files/07_delete_lines/245.cf index 5d8c330da2..eb80263cd4 100644 --- a/tests/acceptance/10_files/07_delete_lines/245.cf +++ b/tests/acceptance/10_files/07_delete_lines/245.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,48 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete(".*potat.*"); - + "$(G.testfile).actual" edit_line => test_delete(".*potat.*"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" not_matching => "true", select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/246.cf b/tests/acceptance/10_files/07_delete_lines/246.cf index d3895b9172..4b4d6113f9 100644 --- a/tests/acceptance/10_files/07_delete_lines/246.cf +++ b/tests/acceptance/10_files/07_delete_lines/246.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -41,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,48 +47,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete(".*potat.*"); - + "$(G.testfile).actual" edit_line => test_delete(".*potat.*"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" not_matching => "false", select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/247.cf b/tests/acceptance/10_files/07_delete_lines/247.cf index 72a618cae3..c9c3f1f96b 100644 --- a/tests/acceptance/10_files/07_delete_lines/247.cf +++ b/tests/acceptance/10_files/07_delete_lines/247.cf @@ -4,23 +4,21 @@ # select_region, include_start_delimiter, include_end_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,31 +49,29 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T" }; + "tstr" slist => { "T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@{test.tstr}"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), not_matching => "false", select_region => test_select; @@ -83,24 +79,26 @@ bundle edit_line test_delete(str, match) body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_end_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_end_delimiter => "true"; } body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/301.cf b/tests/acceptance/10_files/07_delete_lines/301.cf index a4231849c5..45dc69eb5f 100644 --- a/tests/acceptance/10_files/07_delete_lines/301.cf +++ b/tests/acceptance/10_files/07_delete_lines/301.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,50 +50,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/302.cf b/tests/acceptance/10_files/07_delete_lines/302.cf index 1a549e6691..361d304662 100644 --- a/tests/acceptance/10_files/07_delete_lines/302.cf +++ b/tests/acceptance/10_files/07_delete_lines/302.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,50 +51,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe "; # NOTE, DOES NOT MATCH! + "tstr" string => " Three potatoe "; + # NOTE, DOES NOT MATCH! files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/303.cf b/tests/acceptance/10_files/07_delete_lines/303.cf index 190be23f9b..bef727c93e 100644 --- a/tests/acceptance/10_files/07_delete_lines/303.cf +++ b/tests/acceptance/10_files/07_delete_lines/303.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN Three potatoe @@ -28,10 +26,10 @@ END trailer trailer"; - "expected" string => "$(actual)"; + "expected" string => "$(actual)"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -40,53 +38,49 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - "BEGIN + "tstr" string => "BEGIN Three potatoe END"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/304.cf b/tests/acceptance/10_files/07_delete_lines/304.cf index 38746a0cfb..3b0b3bfe38 100644 --- a/tests/acceptance/10_files/07_delete_lines/304.cf +++ b/tests/acceptance/10_files/07_delete_lines/304.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN Three potatoe @@ -28,10 +26,10 @@ END trailer trailer"; - "expected" string => "$(actual)"; + "expected" string => "$(actual)"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -40,51 +38,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "BEGIN$(const.n)$(str)$(const.n)END" - select_region => test_select; + "BEGIN$(const.n)$(str)$(const.n)END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/305.cf b/tests/acceptance/10_files/07_delete_lines/305.cf index ebf8a059ee..1948578451 100644 --- a/tests/acceptance/10_files/07_delete_lines/305.cf +++ b/tests/acceptance/10_files/07_delete_lines/305.cf @@ -6,21 +6,20 @@ # be matched again because the start marker does not exist anymore. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,9 +29,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header One potato Two potato @@ -41,9 +40,9 @@ header END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,50 +51,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "BEGIN", " Three potatoe", "END" }; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" slist => { "BEGIN", " Three potatoe", "END" }; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/306.cf b/tests/acceptance/10_files/07_delete_lines/306.cf index 3ea545eb3e..1dffb45ee0 100644 --- a/tests/acceptance/10_files/07_delete_lines/306.cf +++ b/tests/acceptance/10_files/07_delete_lines/306.cf @@ -6,21 +6,20 @@ # first line will be considered. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,9 +29,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -41,9 +40,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,49 +51,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - " Three potatoe" - select_region => test_select; - "END" - select_region => test_select; + " Three potatoe" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/307.cf b/tests/acceptance/10_files/07_delete_lines/307.cf index ce3fd1a1a4..4a40ce171f 100644 --- a/tests/acceptance/10_files/07_delete_lines/307.cf +++ b/tests/acceptance/10_files/07_delete_lines/307.cf @@ -6,21 +6,20 @@ # will be selected. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,9 +29,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -41,9 +40,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,49 +51,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "\s+Three.*" - select_region => test_select; - "END" - select_region => test_select; + "\s+Three.*" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/308.cf b/tests/acceptance/10_files/07_delete_lines/308.cf index 9d9953a00e..a9164972b6 100644 --- a/tests/acceptance/10_files/07_delete_lines/308.cf +++ b/tests/acceptance/10_files/07_delete_lines/308.cf @@ -6,21 +6,20 @@ # as 306 and 307. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,9 +29,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -41,9 +40,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,49 +51,49 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "^\s+Three.*$" # Anchors should make no difference - select_region => test_select; - "END" + "^\s+Three.*$" + # Anchors should make no difference select_region => test_select; + + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/309.cf b/tests/acceptance/10_files/07_delete_lines/309.cf index cf1c04584b..b56d4dff96 100644 --- a/tests/acceptance/10_files/07_delete_lines/309.cf +++ b/tests/acceptance/10_files/07_delete_lines/309.cf @@ -6,21 +6,20 @@ # delimiter is not included in the region. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,9 +29,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -41,9 +40,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,50 +51,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { " Three potatoe", "END" }; - + "str" slist => { " Three potatoe", "END" }; + delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/310.cf b/tests/acceptance/10_files/07_delete_lines/310.cf index 7a7e2c25f7..f715dc349d 100644 --- a/tests/acceptance/10_files/07_delete_lines/310.cf +++ b/tests/acceptance/10_files/07_delete_lines/310.cf @@ -6,21 +6,20 @@ # selected region. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,9 +29,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -41,9 +40,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,50 +51,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { ".*Three.*", ".*END.*" }; - + "str" slist => { ".*Three.*", ".*END.*" }; + delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/311.cf b/tests/acceptance/10_files/07_delete_lines/311.cf index 159a5a820a..38862a5d79 100644 --- a/tests/acceptance/10_files/07_delete_lines/311.cf +++ b/tests/acceptance/10_files/07_delete_lines/311.cf @@ -5,21 +5,20 @@ # Same as with 310 and 309, "END" is not deleted. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -29,9 +28,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -40,9 +39,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,50 +50,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*", ".*END.*" }; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(tstr)"); + "tstr" slist => { ".*Three.*", ".*END.*" }; + files: + "$(G.testfile).actual" edit_line => test_delete("$(tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/312.cf b/tests/acceptance/10_files/07_delete_lines/312.cf index b0d7fb040e..a2b3be07db 100644 --- a/tests/acceptance/10_files/07_delete_lines/312.cf +++ b/tests/acceptance/10_files/07_delete_lines/312.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,10 +29,10 @@ END trailer trailer"; - "expected" string => "$(actual)"; + "expected" string => "$(actual)"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -43,53 +41,49 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " Three potatoe + "tstr" string => " Three potatoe BEGIN END"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/313.cf b/tests/acceptance/10_files/07_delete_lines/313.cf index 7206b3d3f3..17a086db86 100644 --- a/tests/acceptance/10_files/07_delete_lines/313.cf +++ b/tests/acceptance/10_files/07_delete_lines/313.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,10 +29,10 @@ END trailer trailer"; - "expected" string => "$(actual)"; + "expected" string => "$(actual)"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -43,51 +41,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)$(const.n)BEGIN$(const.n)END" - select_region => test_select; + "$(str)$(const.n)BEGIN$(const.n)END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/314.cf b/tests/acceptance/10_files/07_delete_lines/314.cf index a47ed3cf5c..ce1cc9cf05 100644 --- a/tests/acceptance/10_files/07_delete_lines/314.cf +++ b/tests/acceptance/10_files/07_delete_lines/314.cf @@ -6,21 +6,20 @@ # before, therefore the region will not be selected when "END" is used. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -30,9 +29,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header One potato Two potato @@ -40,9 +39,9 @@ header END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,50 +50,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " Three potatoe", "BEGIN", "END" }; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" slist => { " Three potatoe", "BEGIN", "END" }; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/315.cf b/tests/acceptance/10_files/07_delete_lines/315.cf index 531ba22264..88a6a00c4d 100644 --- a/tests/acceptance/10_files/07_delete_lines/315.cf +++ b/tests/acceptance/10_files/07_delete_lines/315.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,51 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - " Three potatoe" - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" - select_region => test_select; + " Three potatoe" select_region => test_select; + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/316.cf b/tests/acceptance/10_files/07_delete_lines/316.cf index 6080e6986d..9b7ac09327 100644 --- a/tests/acceptance/10_files/07_delete_lines/316.cf +++ b/tests/acceptance/10_files/07_delete_lines/316.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,51 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "\s+Three.*" - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" - select_region => test_select; + "\s+Three.*" select_region => test_select; + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/317.cf b/tests/acceptance/10_files/07_delete_lines/317.cf index 469917f53a..677a3557a2 100644 --- a/tests/acceptance/10_files/07_delete_lines/317.cf +++ b/tests/acceptance/10_files/07_delete_lines/317.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,51 +49,49 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "^\s+Three.*$" # Anchors should make no difference - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" + "^\s+Three.*$" + # Anchors should make no difference select_region => test_select; + + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/318.cf b/tests/acceptance/10_files/07_delete_lines/318.cf index 7b821e7998..5bb19525d1 100644 --- a/tests/acceptance/10_files/07_delete_lines/318.cf +++ b/tests/acceptance/10_files/07_delete_lines/318.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,50 +49,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { " Three potatoe", "BEGIN", "END" }; + "str" slist => { " Three potatoe", "BEGIN", "END" }; delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/319.cf b/tests/acceptance/10_files/07_delete_lines/319.cf index 7feea14f9f..805123b042 100644 --- a/tests/acceptance/10_files/07_delete_lines/319.cf +++ b/tests/acceptance/10_files/07_delete_lines/319.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,50 +49,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; + "str" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/320.cf b/tests/acceptance/10_files/07_delete_lines/320.cf index 8da87d060f..e5168ed4be 100644 --- a/tests/acceptance/10_files/07_delete_lines/320.cf +++ b/tests/acceptance/10_files/07_delete_lines/320.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,49 +49,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; + "tstr" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; files: - "$(G.testfile).actual" - edit_line => test_delete("$(tstr)"); + "$(G.testfile).actual" edit_line => test_delete("$(tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/322.cf b/tests/acceptance/10_files/07_delete_lines/322.cf index dc9c6df118..776c028b68 100644 --- a/tests/acceptance/10_files/07_delete_lines/322.cf +++ b/tests/acceptance/10_files/07_delete_lines/322.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,51 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" classes => test_class("ok"), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body classes test_class(a) { - promise_repaired => { "$(a)" }; + promise_repaired => { "$(a)" }; } - ####################################################### - bundle agent check { reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/07_delete_lines/323.cf b/tests/acceptance/10_files/07_delete_lines/323.cf index 80802d99bf..9bc106fc16 100644 --- a/tests/acceptance/10_files/07_delete_lines/323.cf +++ b/tests/acceptance/10_files/07_delete_lines/323.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,55 +51,52 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe "; # NOTE, DOES NOT MATCH! + "tstr" string => " Three potatoe "; + # NOTE, DOES NOT MATCH! files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" classes => test_class("ok"), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body classes test_class(a) { - promise_kept => { "$(a)" }; + promise_kept => { "$(a)" }; } ####################################################### - bundle agent check { reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/07_delete_lines/324.cf b/tests/acceptance/10_files/07_delete_lines/324.cf index c0c494acaa..991e27f9a6 100644 --- a/tests/acceptance/10_files/07_delete_lines/324.cf +++ b/tests/acceptance/10_files/07_delete_lines/324.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " Three potatoe" }; + "tstr" slist => { " Three potatoe" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/325.cf b/tests/acceptance/10_files/07_delete_lines/325.cf index 8a671f9e1c..43fc12006b 100644 --- a/tests/acceptance/10_files/07_delete_lines/325.cf +++ b/tests/acceptance/10_files/07_delete_lines/325.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,57 +50,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - # Note - regex doesn't qualify for "starts_with"! - "tstr" slist => { " Three potatoe", " Two.*", "BEGIN", "END" }; + # Note - regex doesn't qualify for "starts_with"! + "tstr" slist => { " Three potatoe", " Two.*", "BEGIN", "END" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/326.cf b/tests/acceptance/10_files/07_delete_lines/326.cf index 116f5bb920..d1d966fe61 100644 --- a/tests/acceptance/10_files/07_delete_lines/326.cf +++ b/tests/acceptance/10_files/07_delete_lines/326.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,56 +51,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "header", " Two.*", "BEGIN", "END" }; + "tstr" slist => { "header", " Two.*", "BEGIN", "END" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/327.cf b/tests/acceptance/10_files/07_delete_lines/327.cf index 0eefd02457..2d11c3347b 100644 --- a/tests/acceptance/10_files/07_delete_lines/327.cf +++ b/tests/acceptance/10_files/07_delete_lines/327.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -41,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,56 +47,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O" }; + "tstr" slist => { " T", " O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/328.cf b/tests/acceptance/10_files/07_delete_lines/328.cf index 42a2920509..7dcb4b7441 100644 --- a/tests/acceptance/10_files/07_delete_lines/328.cf +++ b/tests/acceptance/10_files/07_delete_lines/328.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T" }; + "tstr" slist => { " T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/329.cf b/tests/acceptance/10_files/07_delete_lines/329.cf index c451a530cf..ef967a3cf3 100644 --- a/tests/acceptance/10_files/07_delete_lines/329.cf +++ b/tests/acceptance/10_files/07_delete_lines/329.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O.*" }; + "tstr" slist => { " T", " O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/330.cf b/tests/acceptance/10_files/07_delete_lines/330.cf index e105ed45b9..1bf3ba5a2c 100644 --- a/tests/acceptance/10_files/07_delete_lines/330.cf +++ b/tests/acceptance/10_files/07_delete_lines/330.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,56 +51,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O" }; + "tstr" slist => { " T", " O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/331.cf b/tests/acceptance/10_files/07_delete_lines/331.cf index 5d1924da7e..b78d468e01 100644 --- a/tests/acceptance/10_files/07_delete_lines/331.cf +++ b/tests/acceptance/10_files/07_delete_lines/331.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*" }; + "tstr" slist => { ".*Three.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/332.cf b/tests/acceptance/10_files/07_delete_lines/332.cf index d64087efc1..10ca12aa0c 100644 --- a/tests/acceptance/10_files/07_delete_lines/332.cf +++ b/tests/acceptance/10_files/07_delete_lines/332.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*", ".*GI.*", ".*ND" }; + "tstr" slist => { ".*Three.*", ".*GI.*", ".*ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/333.cf b/tests/acceptance/10_files/07_delete_lines/333.cf index 4c73483796..d6159989da 100644 --- a/tests/acceptance/10_files/07_delete_lines/333.cf +++ b/tests/acceptance/10_files/07_delete_lines/333.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,56 +51,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*eade.*", ".*EGI.*", ".*ND" }; + "tstr" slist => { ".*eade.*", ".*EGI.*", ".*ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/334.cf b/tests/acceptance/10_files/07_delete_lines/334.cf index bafc5da84a..ee8b0ae4f6 100644 --- a/tests/acceptance/10_files/07_delete_lines/334.cf +++ b/tests/acceptance/10_files/07_delete_lines/334.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -41,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,56 +47,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*O.*" }; + "tstr" slist => { ".*T.*", ".*O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/335.cf b/tests/acceptance/10_files/07_delete_lines/335.cf index 4f9ef07095..8772075cf3 100644 --- a/tests/acceptance/10_files/07_delete_lines/335.cf +++ b/tests/acceptance/10_files/07_delete_lines/335.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*" }; + "tstr" slist => { ".*T.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/336.cf b/tests/acceptance/10_files/07_delete_lines/336.cf index 936e5426dc..f1c337c938 100644 --- a/tests/acceptance/10_files/07_delete_lines/336.cf +++ b/tests/acceptance/10_files/07_delete_lines/336.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*C.*" }; + "tstr" slist => { ".*T.*", ".*C.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/337.cf b/tests/acceptance/10_files/07_delete_lines/337.cf index 7a6cf48a7e..1c6b50d314 100644 --- a/tests/acceptance/10_files/07_delete_lines/337.cf +++ b/tests/acceptance/10_files/07_delete_lines/337.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,56 +51,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*O.*" }; + "tstr" slist => { ".*T.*", ".*O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/338.cf b/tests/acceptance/10_files/07_delete_lines/338.cf index f907a46228..3daa1e9549 100644 --- a/tests/acceptance/10_files/07_delete_lines/338.cf +++ b/tests/acceptance/10_files/07_delete_lines/338.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "Three" }; + "tstr" slist => { "Three" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/339.cf b/tests/acceptance/10_files/07_delete_lines/339.cf index d7918195e7..441f971eca 100644 --- a/tests/acceptance/10_files/07_delete_lines/339.cf +++ b/tests/acceptance/10_files/07_delete_lines/339.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "Three", "GI", "ND" }; + "tstr" slist => { "Three", "GI", "ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/340.cf b/tests/acceptance/10_files/07_delete_lines/340.cf index fb4ecdbe5d..746648f692 100644 --- a/tests/acceptance/10_files/07_delete_lines/340.cf +++ b/tests/acceptance/10_files/07_delete_lines/340.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,56 +51,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "eade", "EGI", "ND" }; + "tstr" slist => { "eade", "EGI", "ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/341.cf b/tests/acceptance/10_files/07_delete_lines/341.cf index 8afa66c0f4..60c4b87df7 100644 --- a/tests/acceptance/10_files/07_delete_lines/341.cf +++ b/tests/acceptance/10_files/07_delete_lines/341.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -41,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,56 +47,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "O" }; + "tstr" slist => { "T", "O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/342.cf b/tests/acceptance/10_files/07_delete_lines/342.cf index d818855383..1af5b7e627 100644 --- a/tests/acceptance/10_files/07_delete_lines/342.cf +++ b/tests/acceptance/10_files/07_delete_lines/342.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T" }; + "tstr" slist => { "T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/343.cf b/tests/acceptance/10_files/07_delete_lines/343.cf index 34c05e50a5..f20934fbae 100644 --- a/tests/acceptance/10_files/07_delete_lines/343.cf +++ b/tests/acceptance/10_files/07_delete_lines/343.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,56 +50,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "C" }; + "tstr" slist => { "T", "C" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/344.cf b/tests/acceptance/10_files/07_delete_lines/344.cf index 804bfee7e4..cf6d75b45b 100644 --- a/tests/acceptance/10_files/07_delete_lines/344.cf +++ b/tests/acceptance/10_files/07_delete_lines/344.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,56 +51,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "O" }; + "tstr" slist => { "T", "O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/345.cf b/tests/acceptance/10_files/07_delete_lines/345.cf index b660f07326..35cb669db8 100644 --- a/tests/acceptance/10_files/07_delete_lines/345.cf +++ b/tests/acceptance/10_files/07_delete_lines/345.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,48 +49,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete(".*potat.*"); - + "$(G.testfile).actual" edit_line => test_delete(".*potat.*"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" not_matching => "true", select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/346.cf b/tests/acceptance/10_files/07_delete_lines/346.cf index c13eb3d834..b14bf06fb4 100644 --- a/tests/acceptance/10_files/07_delete_lines/346.cf +++ b/tests/acceptance/10_files/07_delete_lines/346.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -41,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,48 +47,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete(".*potat.*"); - + "$(G.testfile).actual" edit_line => test_delete(".*potat.*"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" not_matching => "false", select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/347.cf b/tests/acceptance/10_files/07_delete_lines/347.cf index aa3b24588e..ffaea8fd38 100644 --- a/tests/acceptance/10_files/07_delete_lines/347.cf +++ b/tests/acceptance/10_files/07_delete_lines/347.cf @@ -4,23 +4,21 @@ # select_region, only include_start_delimiter # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,31 +49,29 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T" }; + "tstr" slist => { "T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@{test.tstr}"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), not_matching => "false", select_region => test_select; @@ -83,24 +79,26 @@ bundle edit_line test_delete(str, match) body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; - include_start_delimiter => "true"; + select_start => "BEGIN"; + select_end => "END"; + include_start_delimiter => "true"; } body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/401.cf b/tests/acceptance/10_files/07_delete_lines/401.cf index 802b92deac..564eafec8c 100644 --- a/tests/acceptance/10_files/07_delete_lines/401.cf +++ b/tests/acceptance/10_files/07_delete_lines/401.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,49 +50,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/402.cf b/tests/acceptance/10_files/07_delete_lines/402.cf index 14eb4c5e4f..77712a2849 100644 --- a/tests/acceptance/10_files/07_delete_lines/402.cf +++ b/tests/acceptance/10_files/07_delete_lines/402.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,49 +51,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe "; # NOTE, DOES NOT MATCH! + "tstr" string => " Three potatoe "; + # NOTE, DOES NOT MATCH! files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/403.cf b/tests/acceptance/10_files/07_delete_lines/403.cf index e72fc6e13e..f478c35a67 100644 --- a/tests/acceptance/10_files/07_delete_lines/403.cf +++ b/tests/acceptance/10_files/07_delete_lines/403.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN Three potatoe @@ -28,10 +26,10 @@ END trailer trailer"; - "expected" string => "$(actual)"; + "expected" string => "$(actual)"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -40,52 +38,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - "BEGIN + "tstr" string => "BEGIN Three potatoe END"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/404.cf b/tests/acceptance/10_files/07_delete_lines/404.cf index 1fc48cb02c..9e47cf37dd 100644 --- a/tests/acceptance/10_files/07_delete_lines/404.cf +++ b/tests/acceptance/10_files/07_delete_lines/404.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN Three potatoe @@ -28,10 +26,10 @@ END trailer trailer"; - "expected" string => "$(actual)"; + "expected" string => "$(actual)"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -40,50 +38,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "BEGIN$(const.n)$(str)$(const.n)END" - select_region => test_select; + "BEGIN$(const.n)$(str)$(const.n)END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/405.cf b/tests/acceptance/10_files/07_delete_lines/405.cf index 11e05f13e4..f00c89b497 100644 --- a/tests/acceptance/10_files/07_delete_lines/405.cf +++ b/tests/acceptance/10_files/07_delete_lines/405.cf @@ -4,21 +4,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -28,9 +27,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -39,9 +38,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,49 +49,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "BEGIN", " Three potatoe", "END" }; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" slist => { "BEGIN", " Three potatoe", "END" }; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/406.cf b/tests/acceptance/10_files/07_delete_lines/406.cf index ca28c52eec..627232aee2 100644 --- a/tests/acceptance/10_files/07_delete_lines/406.cf +++ b/tests/acceptance/10_files/07_delete_lines/406.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,50 +50,45 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "BEGIN" - select_region => test_select; - " Three potatoe" - select_region => test_select; - "END" - select_region => test_select; + "BEGIN" select_region => test_select; + " Three potatoe" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/407.cf b/tests/acceptance/10_files/07_delete_lines/407.cf index 2b3007648a..145c7f806f 100644 --- a/tests/acceptance/10_files/07_delete_lines/407.cf +++ b/tests/acceptance/10_files/07_delete_lines/407.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,50 +50,45 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "BEGIN" - select_region => test_select; - "\s+Three.*" - select_region => test_select; - "END" - select_region => test_select; + "BEGIN" select_region => test_select; + "\s+Three.*" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/408.cf b/tests/acceptance/10_files/07_delete_lines/408.cf index 0bc97cb0a7..dca75beb7e 100644 --- a/tests/acceptance/10_files/07_delete_lines/408.cf +++ b/tests/acceptance/10_files/07_delete_lines/408.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,50 +50,49 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "BEGIN" - select_region => test_select; - "^\s+Three.*$" # Anchors should make no difference - select_region => test_select; - "END" + "BEGIN" select_region => test_select; + + "^\s+Three.*$" + # Anchors should make no difference select_region => test_select; + + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/409.cf b/tests/acceptance/10_files/07_delete_lines/409.cf index c8a0ba1b58..353bba4a22 100644 --- a/tests/acceptance/10_files/07_delete_lines/409.cf +++ b/tests/acceptance/10_files/07_delete_lines/409.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,49 +50,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { "BEGIN", " Three potatoe", "END" }; + "str" slist => { "BEGIN", " Three potatoe", "END" }; delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/410.cf b/tests/acceptance/10_files/07_delete_lines/410.cf index a859fdced3..0094084cde 100644 --- a/tests/acceptance/10_files/07_delete_lines/410.cf +++ b/tests/acceptance/10_files/07_delete_lines/410.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,49 +50,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; + "str" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/411.cf b/tests/acceptance/10_files/07_delete_lines/411.cf index 7c55c440f0..5cec80f0eb 100644 --- a/tests/acceptance/10_files/07_delete_lines/411.cf +++ b/tests/acceptance/10_files/07_delete_lines/411.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,49 +50,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; + "tstr" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; files: - "$(G.testfile).actual" - edit_line => test_delete("$(tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/412.cf b/tests/acceptance/10_files/07_delete_lines/412.cf index be22d574fc..a42cba0099 100644 --- a/tests/acceptance/10_files/07_delete_lines/412.cf +++ b/tests/acceptance/10_files/07_delete_lines/412.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,10 +29,10 @@ END trailer trailer"; - "expected" string => "$(actual)"; + "expected" string => "$(actual)"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -43,52 +41,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " Three potatoe + "tstr" string => " Three potatoe BEGIN END"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/413.cf b/tests/acceptance/10_files/07_delete_lines/413.cf index 8dbe48323e..60dbb47583 100644 --- a/tests/acceptance/10_files/07_delete_lines/413.cf +++ b/tests/acceptance/10_files/07_delete_lines/413.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,10 +29,10 @@ END trailer trailer"; - "expected" string => "$(actual)"; + "expected" string => "$(actual)"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -43,50 +41,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)$(const.n)BEGIN$(const.n)END" - select_region => test_select; + "$(str)$(const.n)BEGIN$(const.n)END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/414.cf b/tests/acceptance/10_files/07_delete_lines/414.cf index 4bb27bd23e..2683ca41cc 100644 --- a/tests/acceptance/10_files/07_delete_lines/414.cf +++ b/tests/acceptance/10_files/07_delete_lines/414.cf @@ -4,21 +4,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -28,9 +27,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -39,9 +38,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,49 +49,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " Three potatoe", "BEGIN", "END" }; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" slist => { " Three potatoe", "BEGIN", "END" }; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/415.cf b/tests/acceptance/10_files/07_delete_lines/415.cf index 18cb6147da..40512c43ed 100644 --- a/tests/acceptance/10_files/07_delete_lines/415.cf +++ b/tests/acceptance/10_files/07_delete_lines/415.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,50 +50,45 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - " Three potatoe" - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" - select_region => test_select; + " Three potatoe" select_region => test_select; + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/416.cf b/tests/acceptance/10_files/07_delete_lines/416.cf index 9a6c917c23..c26efd247f 100644 --- a/tests/acceptance/10_files/07_delete_lines/416.cf +++ b/tests/acceptance/10_files/07_delete_lines/416.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,50 +50,45 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "\s+Three.*" - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" - select_region => test_select; + "\s+Three.*" select_region => test_select; + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/417.cf b/tests/acceptance/10_files/07_delete_lines/417.cf index f18da0686c..af115374f9 100644 --- a/tests/acceptance/10_files/07_delete_lines/417.cf +++ b/tests/acceptance/10_files/07_delete_lines/417.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,50 +50,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "^\s+Three.*$" # Anchors should make no difference - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" + "^\s+Three.*$" + # Anchors should make no difference select_region => test_select; + + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/418.cf b/tests/acceptance/10_files/07_delete_lines/418.cf index 88525e2ea8..7a3faf1368 100644 --- a/tests/acceptance/10_files/07_delete_lines/418.cf +++ b/tests/acceptance/10_files/07_delete_lines/418.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,49 +50,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { " Three potatoe", "BEGIN", "END" }; + "str" slist => { " Three potatoe", "BEGIN", "END" }; delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/419.cf b/tests/acceptance/10_files/07_delete_lines/419.cf index fa9a24812c..81a922d65a 100644 --- a/tests/acceptance/10_files/07_delete_lines/419.cf +++ b/tests/acceptance/10_files/07_delete_lines/419.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,49 +50,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; + "str" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/420.cf b/tests/acceptance/10_files/07_delete_lines/420.cf index a08b1668e9..dad084107a 100644 --- a/tests/acceptance/10_files/07_delete_lines/420.cf +++ b/tests/acceptance/10_files/07_delete_lines/420.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,48 +50,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; + "tstr" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; files: - "$(G.testfile).actual" - edit_line => test_delete("$(tstr)"); + "$(G.testfile).actual" edit_line => test_delete("$(tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/422.cf b/tests/acceptance/10_files/07_delete_lines/422.cf index 1ddfad15e4..511ad5908b 100644 --- a/tests/acceptance/10_files/07_delete_lines/422.cf +++ b/tests/acceptance/10_files/07_delete_lines/422.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,55 +50,50 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" classes => test_class("ok"), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body classes test_class(a) { - promise_repaired => { "$(a)" }; + promise_repaired => { "$(a)" }; } - ####################################################### - bundle agent check { reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/07_delete_lines/423.cf b/tests/acceptance/10_files/07_delete_lines/423.cf index 73ab5e556d..ecdd40e256 100644 --- a/tests/acceptance/10_files/07_delete_lines/423.cf +++ b/tests/acceptance/10_files/07_delete_lines/423.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,54 +51,51 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe "; # NOTE, DOES NOT MATCH! + "tstr" string => " Three potatoe "; + # NOTE, DOES NOT MATCH! files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" classes => test_class("ok"), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body classes test_class(a) { - promise_kept => { "$(a)" }; + promise_kept => { "$(a)" }; } ####################################################### - bundle agent check { reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/07_delete_lines/424.cf b/tests/acceptance/10_files/07_delete_lines/424.cf index 72f3aa2e14..2f30440754 100644 --- a/tests/acceptance/10_files/07_delete_lines/424.cf +++ b/tests/acceptance/10_files/07_delete_lines/424.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,55 +50,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " Three potatoe" }; + "tstr" slist => { " Three potatoe" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/425.cf b/tests/acceptance/10_files/07_delete_lines/425.cf index 79c6c7b6df..ecd7570bef 100644 --- a/tests/acceptance/10_files/07_delete_lines/425.cf +++ b/tests/acceptance/10_files/07_delete_lines/425.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,55 +50,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " Three potatoe", " Two.*", "BEGIN", "END" }; + "tstr" slist => { " Three potatoe", " Two.*", "BEGIN", "END" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/426.cf b/tests/acceptance/10_files/07_delete_lines/426.cf index 676eee8fdc..95e0d964bd 100644 --- a/tests/acceptance/10_files/07_delete_lines/426.cf +++ b/tests/acceptance/10_files/07_delete_lines/426.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,55 +51,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "header", " Two.*", "BEGIN", "END" }; + "tstr" slist => { "header", " Two.*", "BEGIN", "END" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/427.cf b/tests/acceptance/10_files/07_delete_lines/427.cf index 9e4798af07..d89bbe0a6e 100644 --- a/tests/acceptance/10_files/07_delete_lines/427.cf +++ b/tests/acceptance/10_files/07_delete_lines/427.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -41,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,55 +47,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O" }; + "tstr" slist => { " T", " O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/428.cf b/tests/acceptance/10_files/07_delete_lines/428.cf index eedd2c62b8..7b12ddba2d 100644 --- a/tests/acceptance/10_files/07_delete_lines/428.cf +++ b/tests/acceptance/10_files/07_delete_lines/428.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,55 +50,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T" }; + "tstr" slist => { " T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/429.cf b/tests/acceptance/10_files/07_delete_lines/429.cf index 3a07b5f907..7445046f87 100644 --- a/tests/acceptance/10_files/07_delete_lines/429.cf +++ b/tests/acceptance/10_files/07_delete_lines/429.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,55 +50,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O.*" }; + "tstr" slist => { " T", " O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/430.cf b/tests/acceptance/10_files/07_delete_lines/430.cf index 8dbe0c7a46..91c3bee925 100644 --- a/tests/acceptance/10_files/07_delete_lines/430.cf +++ b/tests/acceptance/10_files/07_delete_lines/430.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,55 +51,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O" }; + "tstr" slist => { " T", " O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/431.cf b/tests/acceptance/10_files/07_delete_lines/431.cf index a1f54e2959..12d484d9b8 100644 --- a/tests/acceptance/10_files/07_delete_lines/431.cf +++ b/tests/acceptance/10_files/07_delete_lines/431.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,55 +50,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*" }; + "tstr" slist => { ".*Three.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/432.cf b/tests/acceptance/10_files/07_delete_lines/432.cf index 29083e55b8..332a8ab088 100644 --- a/tests/acceptance/10_files/07_delete_lines/432.cf +++ b/tests/acceptance/10_files/07_delete_lines/432.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,55 +50,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*", ".*GI.*", ".*ND" }; + "tstr" slist => { ".*Three.*", ".*GI.*", ".*ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/433.cf b/tests/acceptance/10_files/07_delete_lines/433.cf index 831003d60a..ec0b08dc80 100644 --- a/tests/acceptance/10_files/07_delete_lines/433.cf +++ b/tests/acceptance/10_files/07_delete_lines/433.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,55 +51,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*eade.*", ".*EGI.*", ".*ND" }; + "tstr" slist => { ".*eade.*", ".*EGI.*", ".*ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/434.cf b/tests/acceptance/10_files/07_delete_lines/434.cf index d33b2437cd..31266d31bf 100644 --- a/tests/acceptance/10_files/07_delete_lines/434.cf +++ b/tests/acceptance/10_files/07_delete_lines/434.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -41,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,55 +47,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*O.*" }; + "tstr" slist => { ".*T.*", ".*O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/435.cf b/tests/acceptance/10_files/07_delete_lines/435.cf index ca91c3f9df..1e05e69cb3 100644 --- a/tests/acceptance/10_files/07_delete_lines/435.cf +++ b/tests/acceptance/10_files/07_delete_lines/435.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,55 +50,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*" }; + "tstr" slist => { ".*T.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/436.cf b/tests/acceptance/10_files/07_delete_lines/436.cf index 4b839dddf2..047222999a 100644 --- a/tests/acceptance/10_files/07_delete_lines/436.cf +++ b/tests/acceptance/10_files/07_delete_lines/436.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,55 +50,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*C.*" }; + "tstr" slist => { ".*T.*", ".*C.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/437.cf b/tests/acceptance/10_files/07_delete_lines/437.cf index a9ec00b150..76b62c84a9 100644 --- a/tests/acceptance/10_files/07_delete_lines/437.cf +++ b/tests/acceptance/10_files/07_delete_lines/437.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,55 +51,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*O.*" }; + "tstr" slist => { ".*T.*", ".*O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/438.cf b/tests/acceptance/10_files/07_delete_lines/438.cf index 2b7f2da9b2..fcfb1e2351 100644 --- a/tests/acceptance/10_files/07_delete_lines/438.cf +++ b/tests/acceptance/10_files/07_delete_lines/438.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,55 +50,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "Three" }; + "tstr" slist => { "Three" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/439.cf b/tests/acceptance/10_files/07_delete_lines/439.cf index 8847bdf261..26f326e629 100644 --- a/tests/acceptance/10_files/07_delete_lines/439.cf +++ b/tests/acceptance/10_files/07_delete_lines/439.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,55 +50,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "Three", "GI", "ND" }; + "tstr" slist => { "Three", "GI", "ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/440.cf b/tests/acceptance/10_files/07_delete_lines/440.cf index 25c9c76c2b..f22b24ab84 100644 --- a/tests/acceptance/10_files/07_delete_lines/440.cf +++ b/tests/acceptance/10_files/07_delete_lines/440.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,55 +51,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "eade", "EGI", "ND" }; + "tstr" slist => { "eade", "EGI", "ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/441.cf b/tests/acceptance/10_files/07_delete_lines/441.cf index f693242888..9c530782ed 100644 --- a/tests/acceptance/10_files/07_delete_lines/441.cf +++ b/tests/acceptance/10_files/07_delete_lines/441.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -41,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,55 +47,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "O" }; + "tstr" slist => { "T", "O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/442.cf b/tests/acceptance/10_files/07_delete_lines/442.cf index 35a20a4ee6..4a2034a45a 100644 --- a/tests/acceptance/10_files/07_delete_lines/442.cf +++ b/tests/acceptance/10_files/07_delete_lines/442.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,55 +50,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T" }; + "tstr" slist => { "T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/443.cf b/tests/acceptance/10_files/07_delete_lines/443.cf index 3a71857c29..2c65a3be0f 100644 --- a/tests/acceptance/10_files/07_delete_lines/443.cf +++ b/tests/acceptance/10_files/07_delete_lines/443.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN Two potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,55 +50,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "C" }; + "tstr" slist => { "T", "C" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/444.cf b/tests/acceptance/10_files/07_delete_lines/444.cf index 456b9c9992..a93864ce41 100644 --- a/tests/acceptance/10_files/07_delete_lines/444.cf +++ b/tests/acceptance/10_files/07_delete_lines/444.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -44,7 +42,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,55 +51,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "O" }; + "tstr" slist => { "T", "O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/445.cf b/tests/acceptance/10_files/07_delete_lines/445.cf index 7e10fdb7b4..0c4b4915a0 100644 --- a/tests/acceptance/10_files/07_delete_lines/445.cf +++ b/tests/acceptance/10_files/07_delete_lines/445.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -43,7 +41,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,47 +50,45 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete(".*potat.*"); - + "$(G.testfile).actual" edit_line => test_delete(".*potat.*"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" not_matching => "true", select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/446.cf b/tests/acceptance/10_files/07_delete_lines/446.cf index c65ef20a4a..ffeab982e5 100644 --- a/tests/acceptance/10_files/07_delete_lines/446.cf +++ b/tests/acceptance/10_files/07_delete_lines/446.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,7 @@ END trailer trailer"; - "expected" string => - "header + "expected" string => "header header BEGIN Four @@ -41,7 +38,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,47 +47,45 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete(".*potat.*"); - + "$(G.testfile).actual" edit_line => test_delete(".*potat.*"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" not_matching => "false", select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/447.cf b/tests/acceptance/10_files/07_delete_lines/447.cf index fb540a6aac..f5a849dad9 100644 --- a/tests/acceptance/10_files/07_delete_lines/447.cf +++ b/tests/acceptance/10_files/07_delete_lines/447.cf @@ -4,23 +4,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -31,8 +29,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -42,7 +40,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,31 +49,29 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T" }; + "tstr" slist => { "T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@{test.tstr}"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), not_matching => "false", select_region => test_select; @@ -83,23 +79,25 @@ bundle edit_line test_delete(str, match) body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/501.cf b/tests/acceptance/10_files/07_delete_lines/501.cf index 5ec3f87ff2..a7ae7aef1f 100644 --- a/tests/acceptance/10_files/07_delete_lines/501.cf +++ b/tests/acceptance/10_files/07_delete_lines/501.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -47,7 +45,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,49 +54,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/502.cf b/tests/acceptance/10_files/07_delete_lines/502.cf index b70ab5746d..02c71bcc65 100644 --- a/tests/acceptance/10_files/07_delete_lines/502.cf +++ b/tests/acceptance/10_files/07_delete_lines/502.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -48,7 +46,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -57,49 +55,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe "; # NOTE, DOES NOT MATCH! + "tstr" string => " Three potatoe "; + # NOTE, DOES NOT MATCH! files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/503.cf b/tests/acceptance/10_files/07_delete_lines/503.cf index 9713d6913f..0bc9ed0fef 100644 --- a/tests/acceptance/10_files/07_delete_lines/503.cf +++ b/tests/acceptance/10_files/07_delete_lines/503.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -30,8 +28,7 @@ trailer END trailer"; - "expected" string => - "header + "expected" string => "header BEGIN header trailer @@ -39,7 +36,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -48,52 +45,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - "BEGIN + "tstr" string => "BEGIN Three potatoe END"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/504.cf b/tests/acceptance/10_files/07_delete_lines/504.cf index 2658e6a956..3ae9bc1963 100644 --- a/tests/acceptance/10_files/07_delete_lines/504.cf +++ b/tests/acceptance/10_files/07_delete_lines/504.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -30,8 +28,7 @@ trailer END trailer"; - "expected" string => - "header + "expected" string => "header BEGIN header trailer @@ -39,7 +36,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -48,49 +45,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "BEGIN$(const.n)$(str)$(const.n)END" - select_region => test_select; + "BEGIN$(const.n)$(str)$(const.n)END" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/505.cf b/tests/acceptance/10_files/07_delete_lines/505.cf index a324ce9980..b354732da0 100644 --- a/tests/acceptance/10_files/07_delete_lines/505.cf +++ b/tests/acceptance/10_files/07_delete_lines/505.cf @@ -4,21 +4,20 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -30,9 +29,9 @@ END trailer END trailer"; - - "expected" string => - "header + + "expected" + string => "header header One potato Two potato @@ -40,9 +39,9 @@ header trailer END trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,49 +50,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "BEGIN", " Three potatoe", "END" }; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" slist => { "BEGIN", " Three potatoe", "END" }; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/506.cf b/tests/acceptance/10_files/07_delete_lines/506.cf index 8da661c9a1..186526c798 100644 --- a/tests/acceptance/10_files/07_delete_lines/506.cf +++ b/tests/acceptance/10_files/07_delete_lines/506.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,50 +51,45 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "BEGIN" - select_region => test_select; - " Three potatoe" - select_region => test_select; - "END" - select_region => test_select; + "BEGIN" select_region => test_select; + " Three potatoe" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/507.cf b/tests/acceptance/10_files/07_delete_lines/507.cf index 1aa4a39ed1..351ad64d21 100644 --- a/tests/acceptance/10_files/07_delete_lines/507.cf +++ b/tests/acceptance/10_files/07_delete_lines/507.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,50 +51,45 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "BEGIN" - select_region => test_select; - "\s+Three.*" - select_region => test_select; - "END" - select_region => test_select; + "BEGIN" select_region => test_select; + "\s+Three.*" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/508.cf b/tests/acceptance/10_files/07_delete_lines/508.cf index e16a7454aa..9fa37d34a4 100644 --- a/tests/acceptance/10_files/07_delete_lines/508.cf +++ b/tests/acceptance/10_files/07_delete_lines/508.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,50 +51,49 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "BEGIN" - select_region => test_select; - "^\s+Three.*$" # Anchors should make no difference - select_region => test_select; - "END" + "BEGIN" select_region => test_select; + + "^\s+Three.*$" + # Anchors should make no difference select_region => test_select; + + "END" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/509.cf b/tests/acceptance/10_files/07_delete_lines/509.cf index bc53f127ee..4c64af9cb3 100644 --- a/tests/acceptance/10_files/07_delete_lines/509.cf +++ b/tests/acceptance/10_files/07_delete_lines/509.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,49 +51,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { "BEGIN", " Three potatoe", "END" }; + "str" slist => { "BEGIN", " Three potatoe", "END" }; delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/510.cf b/tests/acceptance/10_files/07_delete_lines/510.cf index 355cfa3785..eab3cb00cc 100644 --- a/tests/acceptance/10_files/07_delete_lines/510.cf +++ b/tests/acceptance/10_files/07_delete_lines/510.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,49 +51,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; + "str" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/511.cf b/tests/acceptance/10_files/07_delete_lines/511.cf index 337eca4ce6..1d54d5514f 100644 --- a/tests/acceptance/10_files/07_delete_lines/511.cf +++ b/tests/acceptance/10_files/07_delete_lines/511.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,49 +51,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; + "tstr" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; files: - "$(G.testfile).actual" - edit_line => test_delete("$(tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/512.cf b/tests/acceptance/10_files/07_delete_lines/512.cf index 9e83ef8b0a..2359db5196 100644 --- a/tests/acceptance/10_files/07_delete_lines/512.cf +++ b/tests/acceptance/10_files/07_delete_lines/512.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,10 +31,10 @@ trailer END trailer"; - "expected" string => "$(actual)"; + "expected" string => "$(actual)"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -45,52 +43,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " Three potatoe + "tstr" string => " Three potatoe BEGIN END"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/513.cf b/tests/acceptance/10_files/07_delete_lines/513.cf index 4b5e4be4da..05ee36ab77 100644 --- a/tests/acceptance/10_files/07_delete_lines/513.cf +++ b/tests/acceptance/10_files/07_delete_lines/513.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,10 +31,10 @@ trailer END trailer"; - "expected" string => "$(actual)"; + "expected" string => "$(actual)"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -45,50 +43,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)$(const.n)BEGIN$(const.n)END" - select_region => test_select; + "$(str)$(const.n)BEGIN$(const.n)END" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/514.cf b/tests/acceptance/10_files/07_delete_lines/514.cf index 7c72c33361..b815a26912 100644 --- a/tests/acceptance/10_files/07_delete_lines/514.cf +++ b/tests/acceptance/10_files/07_delete_lines/514.cf @@ -4,21 +4,20 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -30,9 +29,9 @@ END trailer END trailer"; - - "expected" string => - "header + + "expected" + string => "header header One potato Two potato @@ -40,9 +39,9 @@ header trailer END trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -51,49 +50,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " Three potatoe", "BEGIN", "END" }; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" slist => { " Three potatoe", "BEGIN", "END" }; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/515.cf b/tests/acceptance/10_files/07_delete_lines/515.cf index 1b27a73c85..e6e718c40e 100644 --- a/tests/acceptance/10_files/07_delete_lines/515.cf +++ b/tests/acceptance/10_files/07_delete_lines/515.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,50 +51,45 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - " Three potatoe" - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" - select_region => test_select; + " Three potatoe" select_region => test_select; + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/516.cf b/tests/acceptance/10_files/07_delete_lines/516.cf index 88440ad272..7babc6609d 100644 --- a/tests/acceptance/10_files/07_delete_lines/516.cf +++ b/tests/acceptance/10_files/07_delete_lines/516.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,50 +51,45 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "\s+Three.*" - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" - select_region => test_select; + "\s+Three.*" select_region => test_select; + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/517.cf b/tests/acceptance/10_files/07_delete_lines/517.cf index fbcae8eb38..ddddb9654c 100644 --- a/tests/acceptance/10_files/07_delete_lines/517.cf +++ b/tests/acceptance/10_files/07_delete_lines/517.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,50 +51,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "^\s+Three.*$" # Anchors should make no difference - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" + "^\s+Three.*$" + # Anchors should make no difference select_region => test_select; + + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/518.cf b/tests/acceptance/10_files/07_delete_lines/518.cf index 5829beb4ac..ec14529cba 100644 --- a/tests/acceptance/10_files/07_delete_lines/518.cf +++ b/tests/acceptance/10_files/07_delete_lines/518.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,49 +51,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { " Three potatoe", "BEGIN", "END" }; + "str" slist => { " Three potatoe", "BEGIN", "END" }; delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/519.cf b/tests/acceptance/10_files/07_delete_lines/519.cf index 2b5ce333dd..8ef5fc5f88 100644 --- a/tests/acceptance/10_files/07_delete_lines/519.cf +++ b/tests/acceptance/10_files/07_delete_lines/519.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,49 +51,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; + "str" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/520.cf b/tests/acceptance/10_files/07_delete_lines/520.cf index 97f0e4b604..66b55c119c 100644 --- a/tests/acceptance/10_files/07_delete_lines/520.cf +++ b/tests/acceptance/10_files/07_delete_lines/520.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header header One potato Two potato @@ -44,7 +42,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,48 +51,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; + "tstr" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; files: - "$(G.testfile).actual" - edit_line => test_delete("$(tstr)"); + "$(G.testfile).actual" edit_line => test_delete("$(tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/522.cf b/tests/acceptance/10_files/07_delete_lines/522.cf index 51c0b7878b..303622b3b3 100644 --- a/tests/acceptance/10_files/07_delete_lines/522.cf +++ b/tests/acceptance/10_files/07_delete_lines/522.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -47,7 +45,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,55 +54,50 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" classes => test_class("ok"), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body classes test_class(a) { - promise_repaired => { "$(a)" }; + promise_repaired => { "$(a)" }; } - ####################################################### - bundle agent check { reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/07_delete_lines/523.cf b/tests/acceptance/10_files/07_delete_lines/523.cf index 492ea2e210..98a5da5dc6 100644 --- a/tests/acceptance/10_files/07_delete_lines/523.cf +++ b/tests/acceptance/10_files/07_delete_lines/523.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -48,7 +46,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -57,54 +55,51 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe "; # NOTE, DOES NOT MATCH! + "tstr" string => " Three potatoe "; + # NOTE, DOES NOT MATCH! files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" classes => test_class("ok"), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body classes test_class(a) { - promise_kept => { "$(a)" }; + promise_kept => { "$(a)" }; } ####################################################### - bundle agent check { reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/07_delete_lines/524.cf b/tests/acceptance/10_files/07_delete_lines/524.cf index e1e48f6c89..f92bc6d141 100644 --- a/tests/acceptance/10_files/07_delete_lines/524.cf +++ b/tests/acceptance/10_files/07_delete_lines/524.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -47,7 +45,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,55 +54,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " Three potatoe" }; + "tstr" slist => { " Three potatoe" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/525.cf b/tests/acceptance/10_files/07_delete_lines/525.cf index e8d6761cd9..faf1118ec9 100644 --- a/tests/acceptance/10_files/07_delete_lines/525.cf +++ b/tests/acceptance/10_files/07_delete_lines/525.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -47,7 +45,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,56 +54,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - # Note - regex doesn't qualify for "starts_with"! - "tstr" slist => { " Three potatoe", " Two.*", "BEGIN", "END" }; + # Note - regex doesn't qualify for "starts_with"! + "tstr" slist => { " Three potatoe", " Two.*", "BEGIN", "END" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/526.cf b/tests/acceptance/10_files/07_delete_lines/526.cf index 69f38d958e..c37b044fc8 100644 --- a/tests/acceptance/10_files/07_delete_lines/526.cf +++ b/tests/acceptance/10_files/07_delete_lines/526.cf @@ -5,21 +5,20 @@ # No line will be removed. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -31,9 +30,9 @@ END trailer END trailer"; - - "expected" string => - "header + + "expected" + string => "header BEGIN header BEGIN @@ -45,9 +44,9 @@ END trailer END trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,55 +55,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "header", " Two.*", "BEGIN", "END" }; - + "tstr" slist => { "header", " Two.*", "BEGIN", "END" }; + files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/527.cf b/tests/acceptance/10_files/07_delete_lines/527.cf index fa95d671dd..8dd2bb0bc6 100644 --- a/tests/acceptance/10_files/07_delete_lines/527.cf +++ b/tests/acceptance/10_files/07_delete_lines/527.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -45,7 +43,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -54,55 +52,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O" }; + "tstr" slist => { " T", " O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/528.cf b/tests/acceptance/10_files/07_delete_lines/528.cf index 91d67258f1..f997f47bd7 100644 --- a/tests/acceptance/10_files/07_delete_lines/528.cf +++ b/tests/acceptance/10_files/07_delete_lines/528.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -47,7 +45,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,55 +54,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T" }; + "tstr" slist => { " T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/529.cf b/tests/acceptance/10_files/07_delete_lines/529.cf index a045c41a47..39f31698b6 100644 --- a/tests/acceptance/10_files/07_delete_lines/529.cf +++ b/tests/acceptance/10_files/07_delete_lines/529.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -47,7 +45,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,55 +54,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O.*" }; + "tstr" slist => { " T", " O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/530.cf b/tests/acceptance/10_files/07_delete_lines/530.cf index 4e03155ff4..9f6789fa51 100644 --- a/tests/acceptance/10_files/07_delete_lines/530.cf +++ b/tests/acceptance/10_files/07_delete_lines/530.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -48,7 +46,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -57,55 +55,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O" }; + "tstr" slist => { " T", " O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/531.cf b/tests/acceptance/10_files/07_delete_lines/531.cf index 4f00106bbb..05d84326aa 100644 --- a/tests/acceptance/10_files/07_delete_lines/531.cf +++ b/tests/acceptance/10_files/07_delete_lines/531.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -47,7 +45,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,55 +54,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*" }; + "tstr" slist => { ".*Three.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/532.cf b/tests/acceptance/10_files/07_delete_lines/532.cf index b50da662f9..1a33960f9f 100644 --- a/tests/acceptance/10_files/07_delete_lines/532.cf +++ b/tests/acceptance/10_files/07_delete_lines/532.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -47,7 +45,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,55 +54,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*", ".*GI.*", ".*ND" }; + "tstr" slist => { ".*Three.*", ".*GI.*", ".*ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/533.cf b/tests/acceptance/10_files/07_delete_lines/533.cf index 5e57a42dda..63f2192aad 100644 --- a/tests/acceptance/10_files/07_delete_lines/533.cf +++ b/tests/acceptance/10_files/07_delete_lines/533.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -48,7 +46,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -57,55 +55,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*eade.*", ".*EGI.*", ".*ND" }; + "tstr" slist => { ".*eade.*", ".*EGI.*", ".*ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/534.cf b/tests/acceptance/10_files/07_delete_lines/534.cf index aece9126bb..2fb56e741f 100644 --- a/tests/acceptance/10_files/07_delete_lines/534.cf +++ b/tests/acceptance/10_files/07_delete_lines/534.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -45,7 +43,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -54,55 +52,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*O.*" }; + "tstr" slist => { ".*T.*", ".*O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/535.cf b/tests/acceptance/10_files/07_delete_lines/535.cf index fdd2b4a362..1011707f9d 100644 --- a/tests/acceptance/10_files/07_delete_lines/535.cf +++ b/tests/acceptance/10_files/07_delete_lines/535.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -47,7 +45,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,55 +54,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*" }; + "tstr" slist => { ".*T.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/536.cf b/tests/acceptance/10_files/07_delete_lines/536.cf index 56c49015c0..13b3cb2b14 100644 --- a/tests/acceptance/10_files/07_delete_lines/536.cf +++ b/tests/acceptance/10_files/07_delete_lines/536.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -47,7 +45,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,55 +54,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*C.*" }; + "tstr" slist => { ".*T.*", ".*C.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/537.cf b/tests/acceptance/10_files/07_delete_lines/537.cf index 3ad2c279a2..c2a257a312 100644 --- a/tests/acceptance/10_files/07_delete_lines/537.cf +++ b/tests/acceptance/10_files/07_delete_lines/537.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -48,7 +46,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -57,55 +55,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*O.*" }; + "tstr" slist => { ".*T.*", ".*O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/538.cf b/tests/acceptance/10_files/07_delete_lines/538.cf index ae35921d9f..6d27178a48 100644 --- a/tests/acceptance/10_files/07_delete_lines/538.cf +++ b/tests/acceptance/10_files/07_delete_lines/538.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -47,7 +45,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,55 +54,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "Three" }; + "tstr" slist => { "Three" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/539.cf b/tests/acceptance/10_files/07_delete_lines/539.cf index ddac118708..c7b3aa10b8 100644 --- a/tests/acceptance/10_files/07_delete_lines/539.cf +++ b/tests/acceptance/10_files/07_delete_lines/539.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -47,7 +45,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,55 +54,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "Three", "GI", "ND" }; + "tstr" slist => { "Three", "GI", "ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/540.cf b/tests/acceptance/10_files/07_delete_lines/540.cf index a388424927..6eaf43c1ec 100644 --- a/tests/acceptance/10_files/07_delete_lines/540.cf +++ b/tests/acceptance/10_files/07_delete_lines/540.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -48,7 +46,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -57,55 +55,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "eade", "EGI", "ND" }; + "tstr" slist => { "eade", "EGI", "ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/541.cf b/tests/acceptance/10_files/07_delete_lines/541.cf index ac65b2f102..2a8c459ceb 100644 --- a/tests/acceptance/10_files/07_delete_lines/541.cf +++ b/tests/acceptance/10_files/07_delete_lines/541.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -45,7 +43,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -54,55 +52,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "O" }; + "tstr" slist => { "T", "O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/542.cf b/tests/acceptance/10_files/07_delete_lines/542.cf index 6ae0f218b0..cf44f3a44d 100644 --- a/tests/acceptance/10_files/07_delete_lines/542.cf +++ b/tests/acceptance/10_files/07_delete_lines/542.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -47,7 +45,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,55 +54,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T" }; + "tstr" slist => { "T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/543.cf b/tests/acceptance/10_files/07_delete_lines/543.cf index dcd5078014..e48df148e1 100644 --- a/tests/acceptance/10_files/07_delete_lines/543.cf +++ b/tests/acceptance/10_files/07_delete_lines/543.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -47,7 +45,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,55 +54,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "C" }; + "tstr" slist => { "T", "C" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/544.cf b/tests/acceptance/10_files/07_delete_lines/544.cf index 1a667c50b0..00b2d11fff 100644 --- a/tests/acceptance/10_files/07_delete_lines/544.cf +++ b/tests/acceptance/10_files/07_delete_lines/544.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -48,7 +46,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -57,55 +55,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "O" }; + "tstr" slist => { "T", "O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/545.cf b/tests/acceptance/10_files/07_delete_lines/545.cf index 5f6d97a03d..8ec86fbd2a 100644 --- a/tests/acceptance/10_files/07_delete_lines/545.cf +++ b/tests/acceptance/10_files/07_delete_lines/545.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header One potato Two potato Three potatoe @@ -43,7 +41,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,47 +50,45 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete(".*potat.*"); - + "$(G.testfile).actual" edit_line => test_delete(".*potat.*"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" not_matching => "true", select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/546.cf b/tests/acceptance/10_files/07_delete_lines/546.cf index 459da8021d..5fa31c2751 100644 --- a/tests/acceptance/10_files/07_delete_lines/546.cf +++ b/tests/acceptance/10_files/07_delete_lines/546.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -45,7 +43,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -54,47 +52,45 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete(".*potat.*"); - + "$(G.testfile).actual" edit_line => test_delete(".*potat.*"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" not_matching => "false", select_region => test_select; } body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/547.cf b/tests/acceptance/10_files/07_delete_lines/547.cf index 87cd8f8240..b6c92ec09b 100644 --- a/tests/acceptance/10_files/07_delete_lines/547.cf +++ b/tests/acceptance/10_files/07_delete_lines/547.cf @@ -4,23 +4,21 @@ # Double (nested) header/trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header BEGIN header BEGIN @@ -33,8 +31,8 @@ trailer END trailer"; - "expected" string => - "header + "expected" + string => "header BEGIN header BEGIN @@ -46,7 +44,7 @@ END trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -55,31 +53,29 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T" }; + "tstr" slist => { "T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@{test.tstr}"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), not_matching => "false", select_region => test_select; @@ -87,23 +83,25 @@ bundle edit_line test_delete(str, match) body select_region test_select { - select_start => "header"; - select_end => "trailer"; + select_start => "header"; + select_end => "trailer"; } body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/601.cf b/tests/acceptance/10_files/07_delete_lines/601.cf index 5fff307618..5334c7569d 100644 --- a/tests/acceptance/10_files/07_delete_lines/601.cf +++ b/tests/acceptance/10_files/07_delete_lines/601.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,49 +66,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" string => " Three potatoe"; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/602.cf b/tests/acceptance/10_files/07_delete_lines/602.cf index af930633dd..71abbe4c3e 100644 --- a/tests/acceptance/10_files/07_delete_lines/602.cf +++ b/tests/acceptance/10_files/07_delete_lines/602.cf @@ -5,23 +5,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -40,8 +38,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -61,7 +59,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -70,49 +68,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe "; # NOTE, DOES NOT MATCH! + "tstr" string => " Three potatoe "; + # NOTE, DOES NOT MATCH! files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/603.cf b/tests/acceptance/10_files/07_delete_lines/603.cf index b6d785ac77..8b37c5677f 100644 --- a/tests/acceptance/10_files/07_delete_lines/603.cf +++ b/tests/acceptance/10_files/07_delete_lines/603.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -55,9 +54,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -66,51 +65,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " Three potatoe + "tstr" string => " Three potatoe Four"; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/604.cf b/tests/acceptance/10_files/07_delete_lines/604.cf index 63a3633b27..80f4ba47ed 100644 --- a/tests/acceptance/10_files/07_delete_lines/604.cf +++ b/tests/acceptance/10_files/07_delete_lines/604.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -55,9 +54,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -66,49 +65,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" string => " Three potatoe"; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)$(const.n) Four" - select_region => test_select; + "$(str)$(const.n) Four" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/605.cf b/tests/acceptance/10_files/07_delete_lines/605.cf index 6df90f0bc9..18dcb8c632 100644 --- a/tests/acceptance/10_files/07_delete_lines/605.cf +++ b/tests/acceptance/10_files/07_delete_lines/605.cf @@ -8,21 +8,20 @@ # deleted. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -40,9 +39,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -59,9 +58,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -70,49 +69,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "BEGIN", " Three potatoe", "END" }; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" slist => { "BEGIN", " Three potatoe", "END" }; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/606.cf b/tests/acceptance/10_files/07_delete_lines/606.cf index fbd8e61803..3c7886df81 100644 --- a/tests/acceptance/10_files/07_delete_lines/606.cf +++ b/tests/acceptance/10_files/07_delete_lines/606.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,50 +66,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "BEGIN" - select_region => test_select; - " Three potatoe" - select_region => test_select; - "END" - select_region => test_select; + "BEGIN" select_region => test_select; + " Three potatoe" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/607.cf b/tests/acceptance/10_files/07_delete_lines/607.cf index 9c5dd25ed6..4c0af2fa3c 100644 --- a/tests/acceptance/10_files/07_delete_lines/607.cf +++ b/tests/acceptance/10_files/07_delete_lines/607.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,50 +66,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "BEGIN" - select_region => test_select; - "\s+Three.*" - select_region => test_select; - "END" - select_region => test_select; + "BEGIN" select_region => test_select; + "\s+Three.*" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/608.cf b/tests/acceptance/10_files/07_delete_lines/608.cf index 765fd69c90..4e31ea3d68 100644 --- a/tests/acceptance/10_files/07_delete_lines/608.cf +++ b/tests/acceptance/10_files/07_delete_lines/608.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,50 +66,50 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "BEGIN" - select_region => test_select; - "^\s+Three.*$" # Anchors should make no difference - select_region => test_select; - "END" + "BEGIN" select_region => test_select; + + "^\s+Three.*$" + # Anchors should make no difference select_region => test_select; + + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/609.cf b/tests/acceptance/10_files/07_delete_lines/609.cf index 605ed5a1b3..3c00fd1596 100644 --- a/tests/acceptance/10_files/07_delete_lines/609.cf +++ b/tests/acceptance/10_files/07_delete_lines/609.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,49 +66,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { "BEGIN", " Three potatoe", "END" }; - + "str" slist => { "BEGIN", " Three potatoe", "END" }; + delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/610.cf b/tests/acceptance/10_files/07_delete_lines/610.cf index 174d71eaaf..d110be13b6 100644 --- a/tests/acceptance/10_files/07_delete_lines/610.cf +++ b/tests/acceptance/10_files/07_delete_lines/610.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,49 +66,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; - + "str" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; + delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/611.cf b/tests/acceptance/10_files/07_delete_lines/611.cf index 141f50843e..66522ff1e9 100644 --- a/tests/acceptance/10_files/07_delete_lines/611.cf +++ b/tests/acceptance/10_files/07_delete_lines/611.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,49 +66,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(tstr)"); + "tstr" slist => { ".*BEGIN.*", ".*Three.*", ".*END.*" }; + files: + "$(G.testfile).actual" edit_line => test_delete("$(tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/612.cf b/tests/acceptance/10_files/07_delete_lines/612.cf index 110d1cc8f8..5f8c247399 100644 --- a/tests/acceptance/10_files/07_delete_lines/612.cf +++ b/tests/acceptance/10_files/07_delete_lines/612.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -38,9 +37,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -59,9 +58,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -70,51 +69,48 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " Three potatoe + "tstr" string => " Three potatoe Four"; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/613.cf b/tests/acceptance/10_files/07_delete_lines/613.cf index 103c44b6af..6a26660fae 100644 --- a/tests/acceptance/10_files/07_delete_lines/613.cf +++ b/tests/acceptance/10_files/07_delete_lines/613.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -38,9 +37,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -59,9 +58,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -70,50 +69,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " Three potatoe"; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" string => " Three potatoe"; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)$(const.n) Four" - select_region => test_select; + "$(str)$(const.n) Four" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/614.cf b/tests/acceptance/10_files/07_delete_lines/614.cf index 4c5a8b7164..6857f077f9 100644 --- a/tests/acceptance/10_files/07_delete_lines/614.cf +++ b/tests/acceptance/10_files/07_delete_lines/614.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,49 +66,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " Three potatoe", "BEGIN", "END" }; - - files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); + "tstr" slist => { " Three potatoe", "BEGIN", "END" }; + files: + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/615.cf b/tests/acceptance/10_files/07_delete_lines/615.cf index 401be24bf1..b21c91888d 100644 --- a/tests/acceptance/10_files/07_delete_lines/615.cf +++ b/tests/acceptance/10_files/07_delete_lines/615.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,50 +66,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - " Three potatoe" - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" - select_region => test_select; + " Three potatoe" select_region => test_select; + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/616.cf b/tests/acceptance/10_files/07_delete_lines/616.cf index a434037536..2d1e68878a 100644 --- a/tests/acceptance/10_files/07_delete_lines/616.cf +++ b/tests/acceptance/10_files/07_delete_lines/616.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,50 +66,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "\s+Three.*" - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" - select_region => test_select; + "\s+Three.*" select_region => test_select; + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/617.cf b/tests/acceptance/10_files/07_delete_lines/617.cf index c0feb34d3e..4618927593 100644 --- a/tests/acceptance/10_files/07_delete_lines/617.cf +++ b/tests/acceptance/10_files/07_delete_lines/617.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,50 +66,49 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { delete_lines: - "^\s+Three.*$" # Anchors should make no difference - select_region => test_select; - "BEGIN" - select_region => test_select; - "END" + "^\s+Three.*$" + # Anchors should make no difference select_region => test_select; + + "BEGIN" select_region => test_select; + "END" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/618.cf b/tests/acceptance/10_files/07_delete_lines/618.cf index 7ae7e2fa03..7ff76cc9f6 100644 --- a/tests/acceptance/10_files/07_delete_lines/618.cf +++ b/tests/acceptance/10_files/07_delete_lines/618.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,49 +66,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { " Three potatoe", "BEGIN", "END" }; - + "str" slist => { " Three potatoe", "BEGIN", "END" }; + delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/619.cf b/tests/acceptance/10_files/07_delete_lines/619.cf index 1fad875c6f..472d4ec843 100644 --- a/tests/acceptance/10_files/07_delete_lines/619.cf +++ b/tests/acceptance/10_files/07_delete_lines/619.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,49 +66,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete; - + "$(G.testfile).actual" edit_line => test_delete; } bundle edit_line test_delete { vars: - "str" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; - + "str" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; + delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/620.cf b/tests/acceptance/10_files/07_delete_lines/620.cf index 5bf819dea9..45b51cbc52 100644 --- a/tests/acceptance/10_files/07_delete_lines/620.cf +++ b/tests/acceptance/10_files/07_delete_lines/620.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,48 +66,47 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; - + "tstr" slist => { ".*Three.*", ".*BEGIN.*", ".*END.*" }; + files: - "$(G.testfile).actual" - edit_line => test_delete("$(tstr)"); + "$(G.testfile).actual" edit_line => test_delete("$(tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/622.cf b/tests/acceptance/10_files/07_delete_lines/622.cf index b2c557f7e6..e38b3b830b 100644 --- a/tests/acceptance/10_files/07_delete_lines/622.cf +++ b/tests/acceptance/10_files/07_delete_lines/622.cf @@ -5,23 +5,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -40,8 +38,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -59,7 +57,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -68,55 +66,50 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe"; + "tstr" string => " Three potatoe"; files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" classes => test_class("ok"), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body classes test_class(a) { - promise_repaired => { "$(a)" }; + promise_repaired => { "$(a)" }; } - ####################################################### - bundle agent check { reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/07_delete_lines/623.cf b/tests/acceptance/10_files/07_delete_lines/623.cf index 4081ca42ff..56e7d7b5ae 100644 --- a/tests/acceptance/10_files/07_delete_lines/623.cf +++ b/tests/acceptance/10_files/07_delete_lines/623.cf @@ -5,23 +5,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -40,8 +38,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -61,7 +59,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -70,54 +68,51 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => " Three potatoe "; # NOTE, DOES NOT MATCH! + "tstr" string => " Three potatoe "; + # NOTE, DOES NOT MATCH! files: - "$(G.testfile).actual" - edit_line => test_delete("$(test.tstr)"); - + "$(G.testfile).actual" edit_line => test_delete("$(test.tstr)"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" classes => test_class("ok"), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body classes test_class(a) { - promise_kept => { "$(a)" }; + promise_kept => { "$(a)" }; } ####################################################### - bundle agent check { reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/07_delete_lines/624.cf b/tests/acceptance/10_files/07_delete_lines/624.cf index e10cdccec8..6cb62d0d8b 100644 --- a/tests/acceptance/10_files/07_delete_lines/624.cf +++ b/tests/acceptance/10_files/07_delete_lines/624.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,55 +66,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " Three potatoe" }; - + "tstr" slist => { " Three potatoe" }; + files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/625.cf b/tests/acceptance/10_files/07_delete_lines/625.cf index 71798f87b6..b7d9b9352a 100644 --- a/tests/acceptance/10_files/07_delete_lines/625.cf +++ b/tests/acceptance/10_files/07_delete_lines/625.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -55,9 +54,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -66,55 +65,56 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " Three potatoe", " Five", " Two", "BEGIN", "END" }; - + "tstr" + slist => { " Three potatoe", " Five", " Two", "BEGIN", "END" }; + files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/626.cf b/tests/acceptance/10_files/07_delete_lines/626.cf index 8609b8c397..fb63cb1d66 100644 --- a/tests/acceptance/10_files/07_delete_lines/626.cf +++ b/tests/acceptance/10_files/07_delete_lines/626.cf @@ -5,23 +5,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -40,8 +38,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -61,7 +59,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -70,55 +68,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "header", " Two.*", "BEGIN", "END" }; + "tstr" slist => { "header", " Two.*", "BEGIN", "END" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/627.cf b/tests/acceptance/10_files/07_delete_lines/627.cf index 588042394d..9174488d73 100644 --- a/tests/acceptance/10_files/07_delete_lines/627.cf +++ b/tests/acceptance/10_files/07_delete_lines/627.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN Four @@ -54,9 +53,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -65,55 +64,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O" }; - + "tstr" slist => { " T", " O" }; + files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_startwith_from_list => { @{m} }; + delete_if_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/628.cf b/tests/acceptance/10_files/07_delete_lines/628.cf index 0aeba304d0..c94bb243ba 100644 --- a/tests/acceptance/10_files/07_delete_lines/628.cf +++ b/tests/acceptance/10_files/07_delete_lines/628.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN Two potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,55 +66,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T" }; - + "tstr" slist => { " T" }; + files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/629.cf b/tests/acceptance/10_files/07_delete_lines/629.cf index 00d130b83f..f7799440dd 100644 --- a/tests/acceptance/10_files/07_delete_lines/629.cf +++ b/tests/acceptance/10_files/07_delete_lines/629.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN Two potato @@ -55,9 +54,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -66,55 +65,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O.*" }; - + "tstr" slist => { " T", " O.*" }; + files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/630.cf b/tests/acceptance/10_files/07_delete_lines/630.cf index 7611c4cbce..5bc2a23f27 100644 --- a/tests/acceptance/10_files/07_delete_lines/630.cf +++ b/tests/acceptance/10_files/07_delete_lines/630.cf @@ -5,23 +5,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -40,8 +38,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -61,7 +59,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -70,55 +68,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { " T", " O" }; + "tstr" slist => { " T", " O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_startwith_from_list => { @{m} }; + delete_if_not_startwith_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/631.cf b/tests/acceptance/10_files/07_delete_lines/631.cf index b58177141d..376500ce6d 100644 --- a/tests/acceptance/10_files/07_delete_lines/631.cf +++ b/tests/acceptance/10_files/07_delete_lines/631.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,55 +66,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*" }; - + "tstr" slist => { ".*Three.*" }; + files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/632.cf b/tests/acceptance/10_files/07_delete_lines/632.cf index 006df4170a..ca71d73ed9 100644 --- a/tests/acceptance/10_files/07_delete_lines/632.cf +++ b/tests/acceptance/10_files/07_delete_lines/632.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,55 +66,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*Three.*", ".*GI.*", ".*ND" }; - + "tstr" slist => { ".*Three.*", ".*GI.*", ".*ND" }; + files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/633.cf b/tests/acceptance/10_files/07_delete_lines/633.cf index 85656bdbf4..0822403615 100644 --- a/tests/acceptance/10_files/07_delete_lines/633.cf +++ b/tests/acceptance/10_files/07_delete_lines/633.cf @@ -5,23 +5,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -40,8 +38,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -61,7 +59,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -70,55 +68,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*eade.*", ".*EGI.*", ".*ND" }; + "tstr" slist => { ".*eade.*", ".*EGI.*", ".*ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/634.cf b/tests/acceptance/10_files/07_delete_lines/634.cf index 64d5f0d6c9..8dff6ef979 100644 --- a/tests/acceptance/10_files/07_delete_lines/634.cf +++ b/tests/acceptance/10_files/07_delete_lines/634.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN Four @@ -54,9 +53,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -65,55 +64,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*O.*" }; - + "tstr" slist => { ".*T.*", ".*O.*" }; + files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_match_from_list => { @{m} }; + delete_if_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/635.cf b/tests/acceptance/10_files/07_delete_lines/635.cf index c8d41dbd67..de01999a3c 100644 --- a/tests/acceptance/10_files/07_delete_lines/635.cf +++ b/tests/acceptance/10_files/07_delete_lines/635.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN Two potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,55 +66,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*" }; - + "tstr" slist => { ".*T.*" }; + files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/636.cf b/tests/acceptance/10_files/07_delete_lines/636.cf index 9bd3d683f2..2c4128f002 100644 --- a/tests/acceptance/10_files/07_delete_lines/636.cf +++ b/tests/acceptance/10_files/07_delete_lines/636.cf @@ -7,21 +7,20 @@ # over. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -39,9 +38,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN Two potato @@ -58,9 +57,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -69,55 +68,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*C.*" }; - + "tstr" slist => { ".*T.*", ".*C.*" }; + files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/637.cf b/tests/acceptance/10_files/07_delete_lines/637.cf index 947a625379..98999275d0 100644 --- a/tests/acceptance/10_files/07_delete_lines/637.cf +++ b/tests/acceptance/10_files/07_delete_lines/637.cf @@ -5,23 +5,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -40,8 +38,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -61,7 +59,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -70,55 +68,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { ".*T.*", ".*O.*" }; + "tstr" slist => { ".*T.*", ".*O.*" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_match_from_list => { @{m} }; + delete_if_not_match_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/638.cf b/tests/acceptance/10_files/07_delete_lines/638.cf index dc3d6eee54..c4d03a6e8d 100644 --- a/tests/acceptance/10_files/07_delete_lines/638.cf +++ b/tests/acceptance/10_files/07_delete_lines/638.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,55 +66,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "Three" }; - + "tstr" slist => { "Three" }; + files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/639.cf b/tests/acceptance/10_files/07_delete_lines/639.cf index c8bcd772bc..f329167846 100644 --- a/tests/acceptance/10_files/07_delete_lines/639.cf +++ b/tests/acceptance/10_files/07_delete_lines/639.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,55 +66,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "hre", "GI", "ND" }; - + "tstr" slist => { "hre", "GI", "ND" }; + files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/640.cf b/tests/acceptance/10_files/07_delete_lines/640.cf index aafb51c638..efcba51f52 100644 --- a/tests/acceptance/10_files/07_delete_lines/640.cf +++ b/tests/acceptance/10_files/07_delete_lines/640.cf @@ -5,23 +5,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -40,8 +38,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -61,7 +59,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -70,55 +68,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "eade", "EGI", "ND" }; + "tstr" slist => { "eade", "EGI", "ND" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/641.cf b/tests/acceptance/10_files/07_delete_lines/641.cf index 3557641ccb..ff4995296e 100644 --- a/tests/acceptance/10_files/07_delete_lines/641.cf +++ b/tests/acceptance/10_files/07_delete_lines/641.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN Four @@ -54,9 +53,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -65,55 +64,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "O" }; - + "tstr" slist => { "T", "O" }; + files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/642.cf b/tests/acceptance/10_files/07_delete_lines/642.cf index 144151a57e..9dcb7e742b 100644 --- a/tests/acceptance/10_files/07_delete_lines/642.cf +++ b/tests/acceptance/10_files/07_delete_lines/642.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN Two potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,55 +66,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T" }; - + "tstr" slist => { "T" }; + files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/643.cf b/tests/acceptance/10_files/07_delete_lines/643.cf index 7c62478cd7..c7c39b28cb 100644 --- a/tests/acceptance/10_files/07_delete_lines/643.cf +++ b/tests/acceptance/10_files/07_delete_lines/643.cf @@ -7,21 +7,20 @@ # several iterations. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -39,9 +38,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN Two potato @@ -58,9 +57,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -69,55 +68,55 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "C" }; - + "tstr" slist => { "T", "C" }; + files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/644.cf b/tests/acceptance/10_files/07_delete_lines/644.cf index 555ddd0b25..623cb9be50 100644 --- a/tests/acceptance/10_files/07_delete_lines/644.cf +++ b/tests/acceptance/10_files/07_delete_lines/644.cf @@ -5,23 +5,21 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -40,8 +38,8 @@ END trailer trailer"; - "expected" string => - "header + "expected" + string => "header header BEGIN One potato @@ -61,7 +59,7 @@ trailer trailer"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -70,55 +68,54 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T", "O" }; + "tstr" slist => { "T", "O" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@(test.tstr)"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - body delete_select test_match(m) { - delete_if_not_contains_from_list => { @{m} }; + delete_if_not_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/07_delete_lines/645.cf b/tests/acceptance/10_files/07_delete_lines/645.cf index bd44f56193..c65f86dc73 100644 --- a/tests/acceptance/10_files/07_delete_lines/645.cf +++ b/tests/acceptance/10_files/07_delete_lines/645.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -56,9 +55,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,47 +66,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete(".*potat.*"); - + "$(G.testfile).actual" edit_line => test_delete(".*potat.*"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" not_matching => "true", select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/646.cf b/tests/acceptance/10_files/07_delete_lines/646.cf index 741118512e..b10ee5a19d 100644 --- a/tests/acceptance/10_files/07_delete_lines/646.cf +++ b/tests/acceptance/10_files/07_delete_lines/646.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN Four @@ -54,9 +53,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -65,47 +64,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete(".*potat.*"); - + "$(G.testfile).actual" edit_line => test_delete(".*potat.*"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" + "$(str)" not_matching => "false", select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/647.cf b/tests/acceptance/10_files/07_delete_lines/647.cf index bf8b9af9de..9db5df4cee 100644 --- a/tests/acceptance/10_files/07_delete_lines/647.cf +++ b/tests/acceptance/10_files/07_delete_lines/647.cf @@ -5,21 +5,20 @@ # select_region, doesn't include header or trailer # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "header + "actual" + string => "header header BEGIN One potato @@ -37,9 +36,9 @@ BEGIN END trailer trailer"; - - "expected" string => - "header + + "expected" + string => "header header BEGIN One potato @@ -55,9 +54,9 @@ BEGIN END trailer trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -66,31 +65,29 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" slist => { "T" }; + "tstr" slist => { "T" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => test_delete(".*potat.*", "@{test.tstr}"); - } bundle edit_line test_delete(str, match) { delete_lines: - "$(str)" + "$(str)" delete_select => test_match(@{match}), not_matching => "false", select_region => test_select; @@ -98,23 +95,26 @@ bundle edit_line test_delete(str, match) body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } body delete_select test_match(m) { - delete_if_contains_from_list => { @{m} }; + delete_if_contains_from_list => { @{m} }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/700.cf b/tests/acceptance/10_files/07_delete_lines/700.cf index 2e68ce27cb..43b9aeb701 100644 --- a/tests/acceptance/10_files/07_delete_lines/700.cf +++ b/tests/acceptance/10_files/07_delete_lines/700.cf @@ -1,8 +1,8 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -21,7 +21,7 @@ bundle agent test bundle edit_line init_delete(str) { delete_lines: - "$(str)"; + "$(str)"; } bundle agent check @@ -33,6 +33,7 @@ bundle agent check reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/07_delete_lines/no_matching_end.cf b/tests/acceptance/10_files/07_delete_lines/no_matching_end.cf index 62980f147c..cd59d48025 100644 --- a/tests/acceptance/10_files/07_delete_lines/no_matching_end.cf +++ b/tests/acceptance/10_files/07_delete_lines/no_matching_end.cf @@ -4,21 +4,20 @@ # Redmine #6589 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => -"header + "actual" + string => "header BEGIN One potato Two potato @@ -26,8 +25,9 @@ BEGIN Four END trailer"; - "expected" string => -"header + + "expected" + string => "header BEGIN One potato Two potato @@ -35,9 +35,9 @@ BEGIN Four END trailer"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -46,44 +46,46 @@ trailer"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete(".*"); + "$(G.testfile).actual" edit_line => test_delete(".*"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; # anchored regex doesn't match due to whitespace + select_start => "BEGIN"; + select_end => "END"; + + # anchored regex doesn't match due to whitespace } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/07_delete_lines/select_end_match_eof_true.cf b/tests/acceptance/10_files/07_delete_lines/select_end_match_eof_true.cf index 2c8e946fb6..2c502816fd 100644 --- a/tests/acceptance/10_files/07_delete_lines/select_end_match_eof_true.cf +++ b/tests/acceptance/10_files/07_delete_lines/select_end_match_eof_true.cf @@ -5,21 +5,20 @@ # CFE-2263 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => -"header + "actual" + string => "header BEGIN One potato Two potato @@ -27,12 +26,12 @@ BEGIN Four END trailer"; - "expected" string => -"header + + "expected" string => "header BEGIN"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -41,46 +40,48 @@ BEGIN"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_delete(".*"); + "$(G.testfile).actual" edit_line => test_delete(".*"); } bundle edit_line test_delete(str) { delete_lines: - "$(str)" - select_region => test_select; + "$(str)" select_region => test_select; } body select_region test_select { - select_start => "BEGIN"; - select_end => "END"; # anchored regex doesn't match due to whitespace, but - # 'select_end_match_eof' is true. - select_end_match_eof => "true"; + select_start => "BEGIN"; + select_end => "END"; + + # anchored regex doesn't match due to whitespace, but + # 'select_end_match_eof' is true. + select_end_match_eof => "true"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/08_field_edits/001.cf b/tests/acceptance/10_files/08_field_edits/001.cf index 6377a27cc5..8e08f6fd70 100644 --- a/tests/acceptance/10_files/08_field_edits/001.cf +++ b/tests/acceptance/10_files/08_field_edits/001.cf @@ -3,37 +3,35 @@ # Replace fields, simple case # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - "expected" string => - "able:XXX:charlie:delta:echo + "expected" + string => "able:XXX:charlie:delta:echo apple:XXX:carrot:dogfood aardvark:XXX:colugo:dingo::fox ampallang:XXX: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,50 +40,48 @@ ampallang:XXX: :dydoe:,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "set"; - field_separator => ":"; - field_value => "XXX"; - select_field => "2"; - value_separator => ","; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "set"; + field_separator => ":"; + field_value => "XXX"; + select_field => "2"; + value_separator => ","; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/08_field_edits/002.cf b/tests/acceptance/10_files/08_field_edits/002.cf index 7f78267d87..0e1ec11636 100644 --- a/tests/acceptance/10_files/08_field_edits/002.cf +++ b/tests/acceptance/10_files/08_field_edits/002.cf @@ -3,37 +3,35 @@ # Replace fields, simple case, index 0 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - "expected" string => - "able:XXX:charlie:delta:echo + "expected" + string => "able:XXX:charlie:delta:echo apple:XXX:carrot:dogfood aardvark:XXX:colugo:dingo::fox ampallang:XXX: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,51 +40,49 @@ ampallang:XXX: :dydoe:,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "set"; - field_separator => ":"; - field_value => "XXX"; - select_field => "1"; - start_fields_from_zero => "true"; - value_separator => ","; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "set"; + field_separator => ":"; + field_value => "XXX"; + select_field => "1"; + start_fields_from_zero => "true"; + value_separator => ","; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/08_field_edits/003.cf b/tests/acceptance/10_files/08_field_edits/003.cf index 7c13985c5e..538dd01242 100644 --- a/tests/acceptance/10_files/08_field_edits/003.cf +++ b/tests/acceptance/10_files/08_field_edits/003.cf @@ -3,37 +3,35 @@ # Replace fields, simple case index 1 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - "expected" string => - "able:XXX:charlie:delta:echo + "expected" + string => "able:XXX:charlie:delta:echo apple:XXX:carrot:dogfood aardvark:XXX:colugo:dingo::fox ampallang:XXX: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,52 +40,51 @@ ampallang:XXX: :dydoe:,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - create => "true", + "$(G.testfile).actual" + create => "true", edit_line => test_edit; - } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "set"; - field_separator => ":"; - field_value => "XXX"; - select_field => "2"; - start_fields_from_zero => "false"; - value_separator => ","; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "set"; + field_separator => ":"; + field_value => "XXX"; + select_field => "2"; + start_fields_from_zero => "false"; + value_separator => ","; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/08_field_edits/005.cf b/tests/acceptance/10_files/08_field_edits/005.cf index 529a7e704d..1107544f0d 100644 --- a/tests/acceptance/10_files/08_field_edits/005.cf +++ b/tests/acceptance/10_files/08_field_edits/005.cf @@ -3,35 +3,34 @@ # Replace fields, illegal select_field # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - - "expected" string => - "able:baker,booker,banker:charlie:delta:echo + + "expected" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -40,51 +39,52 @@ ampallang:: :dydoe:,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "set"; - field_separator => ":"; - field_value => "XXX"; - select_field => "0"; # Must be greater than 1 to be legal - start_fields_from_zero => "false"; - value_separator => ","; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "set"; + field_separator => ":"; + field_value => "XXX"; + select_field => "0"; + + # Must be greater than 1 to be legal + start_fields_from_zero => "false"; + value_separator => ","; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/08_field_edits/009.cf b/tests/acceptance/10_files/08_field_edits/009.cf index f58644df37..c8966e8944 100644 --- a/tests/acceptance/10_files/08_field_edits/009.cf +++ b/tests/acceptance/10_files/08_field_edits/009.cf @@ -3,37 +3,35 @@ # Append field # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - "expected" string => - "able:baker,booker,banker,XXX:charlie:delta:echo + "expected" + string => "able:baker,booker,banker,XXX:charlie:delta:echo apple:banana,XXX:carrot:dogfood aardvark:baboon,XXX:colugo:dingo::fox ampallang:XXX: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,51 +40,49 @@ ampallang:XXX: :dydoe:,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "append"; - field_separator => ":"; - field_value => "XXX"; - select_field => "2"; - start_fields_from_zero => "false"; - value_separator => ","; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "append"; + field_separator => ":"; + field_value => "XXX"; + select_field => "2"; + start_fields_from_zero => "false"; + value_separator => ","; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/08_field_edits/010.cf b/tests/acceptance/10_files/08_field_edits/010.cf index 18d1cbeec5..b3066ca78f 100644 --- a/tests/acceptance/10_files/08_field_edits/010.cf +++ b/tests/acceptance/10_files/08_field_edits/010.cf @@ -3,37 +3,35 @@ # Append field, different value_separator # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - "expected" string => - "able:baker,booker,banker+XXX:charlie:delta:echo + "expected" + string => "able:baker,booker,banker+XXX:charlie:delta:echo apple:banana+XXX:carrot:dogfood aardvark:baboon+XXX:colugo:dingo::fox ampallang:XXX: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,51 +40,49 @@ ampallang:XXX: :dydoe:,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "append"; - field_separator => ":"; - field_value => "XXX"; - select_field => "2"; - start_fields_from_zero => "false"; - value_separator => "+"; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "append"; + field_separator => ":"; + field_value => "XXX"; + select_field => "2"; + start_fields_from_zero => "false"; + value_separator => "+"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/08_field_edits/015.cf b/tests/acceptance/10_files/08_field_edits/015.cf index faeec4f16b..7540294a38 100644 --- a/tests/acceptance/10_files/08_field_edits/015.cf +++ b/tests/acceptance/10_files/08_field_edits/015.cf @@ -3,37 +3,35 @@ # Prepend field # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - "expected" string => - "able:XXX,baker,booker,banker:charlie:delta:echo + "expected" + string => "able:XXX,baker,booker,banker:charlie:delta:echo apple:XXX,banana:carrot:dogfood aardvark:XXX,baboon:colugo:dingo::fox ampallang:XXX: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,51 +40,49 @@ ampallang:XXX: :dydoe:,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "prepend"; - field_separator => ":"; - field_value => "XXX"; - select_field => "2"; - start_fields_from_zero => "false"; - value_separator => ","; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "prepend"; + field_separator => ":"; + field_value => "XXX"; + select_field => "2"; + start_fields_from_zero => "false"; + value_separator => ","; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/08_field_edits/016.cf b/tests/acceptance/10_files/08_field_edits/016.cf index f21fd5a5dd..90c75f379d 100644 --- a/tests/acceptance/10_files/08_field_edits/016.cf +++ b/tests/acceptance/10_files/08_field_edits/016.cf @@ -3,37 +3,35 @@ # Prepend field # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - "expected" string => - "able:XXX+baker,booker,banker:charlie:delta:echo + "expected" + string => "able:XXX+baker,booker,banker:charlie:delta:echo apple:XXX+banana:carrot:dogfood aardvark:XXX+baboon:colugo:dingo::fox ampallang:XXX: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,51 +40,49 @@ ampallang:XXX: :dydoe:,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "prepend"; - field_separator => ":"; - field_value => "XXX"; - select_field => "2"; - start_fields_from_zero => "false"; - value_separator => "+"; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "prepend"; + field_separator => ":"; + field_value => "XXX"; + select_field => "2"; + start_fields_from_zero => "false"; + value_separator => "+"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/08_field_edits/017.cf b/tests/acceptance/10_files/08_field_edits/017.cf index 759a0b729c..ee3b371217 100644 --- a/tests/acceptance/10_files/08_field_edits/017.cf +++ b/tests/acceptance/10_files/08_field_edits/017.cf @@ -3,35 +3,34 @@ # Append field, testing blank values # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - - "expected" string => - "able:baker,booker,banker:charlie:delta:echo+XXX + + "expected" + string => "able:baker,booker,banker:charlie:delta:echo+XXX apple:banana:carrot:dogfood:XXX aardvark:baboon:colugo:dingo:XXX:fox ampallang:: :dydoe:,+XXX::::: :blowfish:conger:dogfish:eel:flounder"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -40,51 +39,50 @@ ampallang:: :dydoe:,+XXX::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "append"; - field_separator => ":"; - field_value => "XXX"; - select_field => "5"; - start_fields_from_zero => "false"; - value_separator => "+"; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "append"; + field_separator => ":"; + field_value => "XXX"; + select_field => "5"; + start_fields_from_zero => "false"; + value_separator => "+"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/08_field_edits/018.cf b/tests/acceptance/10_files/08_field_edits/018.cf index 5598b5a500..2ca9abece7 100644 --- a/tests/acceptance/10_files/08_field_edits/018.cf +++ b/tests/acceptance/10_files/08_field_edits/018.cf @@ -3,35 +3,34 @@ # Prepend field, testing blank values # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - - "expected" string => - "able:baker,booker,banker:charlie:delta:XXX+echo + + "expected" + string => "able:baker,booker,banker:charlie:delta:XXX+echo apple:banana:carrot:dogfood:XXX aardvark:baboon:colugo:dingo:XXX:fox ampallang:: :dydoe:XXX+,::::: :blowfish:conger:dogfish:eel:flounder"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -40,51 +39,50 @@ ampallang:: :dydoe:XXX+,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "prepend"; - field_separator => ":"; - field_value => "XXX"; - select_field => "5"; - start_fields_from_zero => "false"; - value_separator => "+"; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "prepend"; + field_separator => ":"; + field_value => "XXX"; + select_field => "5"; + start_fields_from_zero => "false"; + value_separator => "+"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/08_field_edits/019.cf b/tests/acceptance/10_files/08_field_edits/019.cf index c2c6960bb7..5140d453e4 100644 --- a/tests/acceptance/10_files/08_field_edits/019.cf +++ b/tests/acceptance/10_files/08_field_edits/019.cf @@ -3,37 +3,35 @@ # Append field, testing blank values (spaces, not completely blank) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe: , ::::: :blowfish:conger:dogfish:eel:flounder"; - "expected" string => - "able:baker,booker,banker:charlie:delta:echo,XXX + "expected" + string => "able:baker,booker,banker:charlie:delta:echo,XXX apple:banana:carrot:dogfood:XXX aardvark:baboon:colugo:dingo:XXX:fox ampallang:: :dydoe: , ,XXX::::: :blowfish:conger:dogfish:eel:flounder"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,51 +40,49 @@ ampallang:: :dydoe: , ,XXX::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "append"; - field_separator => ":"; - field_value => "XXX"; - select_field => "5"; - start_fields_from_zero => "false"; - value_separator => ","; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "append"; + field_separator => ":"; + field_value => "XXX"; + select_field => "5"; + start_fields_from_zero => "false"; + value_separator => ","; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/08_field_edits/020.cf b/tests/acceptance/10_files/08_field_edits/020.cf index a0598f6ea5..92368b1d99 100644 --- a/tests/acceptance/10_files/08_field_edits/020.cf +++ b/tests/acceptance/10_files/08_field_edits/020.cf @@ -3,37 +3,35 @@ # Prepend field, testing blank values (spaces, not completely blank) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe: , ::::: :blowfish:conger:dogfish:eel:flounder"; - "expected" string => - "able:baker,booker,banker:charlie:delta:XXX,echo + "expected" + string => "able:baker,booker,banker:charlie:delta:XXX,echo apple:banana:carrot:dogfood:XXX aardvark:baboon:colugo:dingo:XXX:fox ampallang:: :dydoe:XXX, , ::::: :blowfish:conger:dogfish:eel:flounder"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,51 +40,49 @@ ampallang:: :dydoe:XXX, , ::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "prepend"; - field_separator => ":"; - field_value => "XXX"; - select_field => "5"; - start_fields_from_zero => "false"; - value_separator => ","; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "prepend"; + field_separator => ":"; + field_value => "XXX"; + select_field => "5"; + start_fields_from_zero => "false"; + value_separator => ","; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/08_field_edits/023.cf b/tests/acceptance/10_files/08_field_edits/023.cf index ef2d701039..b26d95ff9e 100644 --- a/tests/acceptance/10_files/08_field_edits/023.cf +++ b/tests/acceptance/10_files/08_field_edits/023.cf @@ -3,37 +3,35 @@ # Alphanum field # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - "expected" string => - "able:XXX,baker,banker,booker:charlie:delta:echo + "expected" + string => "able:XXX,baker,banker,booker:charlie:delta:echo apple:XXX,banana:carrot:dogfood aardvark:XXX,baboon:colugo:dingo::fox ampallang:XXX: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,51 +40,49 @@ ampallang:XXX: :dydoe:,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "alphanum"; - field_separator => ":"; - field_value => "XXX"; - select_field => "2"; - start_fields_from_zero => "false"; - value_separator => ","; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "alphanum"; + field_separator => ":"; + field_value => "XXX"; + select_field => "2"; + start_fields_from_zero => "false"; + value_separator => ","; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/08_field_edits/024.cf b/tests/acceptance/10_files/08_field_edits/024.cf index ec28cc87c4..12c0af6192 100644 --- a/tests/acceptance/10_files/08_field_edits/024.cf +++ b/tests/acceptance/10_files/08_field_edits/024.cf @@ -3,37 +3,35 @@ # Alphanum field # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,bo0ker,bonker:charlie:delta:echo + "actual" + string => "able:baker,bo0ker,bonker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - "expected" string => - "able:XXX+baker,bo0ker,bonker:charlie:delta:echo + "expected" + string => "able:XXX+baker,bo0ker,bonker:charlie:delta:echo apple:XXX+banana:carrot:dogfood aardvark:XXX+baboon:colugo:dingo::fox ampallang:XXX: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,51 +40,49 @@ ampallang:XXX: :dydoe:,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "alphanum"; - field_separator => ":"; - field_value => "XXX"; - select_field => "2"; - start_fields_from_zero => "false"; - value_separator => "+"; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "alphanum"; + field_separator => ":"; + field_value => "XXX"; + select_field => "2"; + start_fields_from_zero => "false"; + value_separator => "+"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/08_field_edits/027.cf b/tests/acceptance/10_files/08_field_edits/027.cf index 01b33b6256..cd1c267d68 100644 --- a/tests/acceptance/10_files/08_field_edits/027.cf +++ b/tests/acceptance/10_files/08_field_edits/027.cf @@ -3,37 +3,35 @@ # Set field, after end of some lists # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - "expected" string => - "able:baker,booker,banker:charlie:delta:echo:XXX + "expected" + string => "able:baker,booker,banker:charlie:delta:echo:XXX apple:banana:carrot:dogfood::XXX aardvark:baboon:colugo:dingo::XXX ampallang:: :dydoe:,:XXX:::: :blowfish:conger:dogfish:eel:flounder"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,50 +40,48 @@ ampallang:: :dydoe:,:XXX:::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "set"; - field_separator => ":"; - field_value => "XXX"; - select_field => "6"; - value_separator => ","; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "set"; + field_separator => ":"; + field_value => "XXX"; + select_field => "6"; + value_separator => ","; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/08_field_edits/028.cf b/tests/acceptance/10_files/08_field_edits/028.cf index 34c7b2cb29..0a4f9db720 100644 --- a/tests/acceptance/10_files/08_field_edits/028.cf +++ b/tests/acceptance/10_files/08_field_edits/028.cf @@ -3,37 +3,35 @@ # Alphanum field, lowercase # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - "expected" string => - "able:baker,booker,banker+xxx:charlie:delta:echo + "expected" + string => "able:baker,booker,banker+xxx:charlie:delta:echo apple:banana+xxx:carrot:dogfood aardvark:baboon+xxx:colugo:dingo::fox ampallang:xxx: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,51 +40,49 @@ ampallang:xxx: :dydoe:,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "alphanum"; - field_separator => ":"; - field_value => "xxx"; - select_field => "2"; - start_fields_from_zero => "false"; - value_separator => "+"; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "alphanum"; + field_separator => ":"; + field_value => "xxx"; + select_field => "2"; + start_fields_from_zero => "false"; + value_separator => "+"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/08_field_edits/029.cf b/tests/acceptance/10_files/08_field_edits/029.cf index b0e7ff1abc..e4c4799f02 100644 --- a/tests/acceptance/10_files/08_field_edits/029.cf +++ b/tests/acceptance/10_files/08_field_edits/029.cf @@ -3,37 +3,35 @@ # Alphanum field, lowercase # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - "expected" string => - "able:baker,banker,booker,xxx:charlie:delta:echo + "expected" + string => "able:baker,banker,booker,xxx:charlie:delta:echo apple:banana,xxx:carrot:dogfood aardvark:baboon,xxx:colugo:dingo::fox ampallang:xxx: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,51 +40,49 @@ ampallang:xxx: :dydoe:,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "alphanum"; - field_separator => ":"; - field_value => "xxx"; - select_field => "2"; - start_fields_from_zero => "false"; - value_separator => ","; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "alphanum"; + field_separator => ":"; + field_value => "xxx"; + select_field => "2"; + start_fields_from_zero => "false"; + value_separator => ","; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/08_field_edits/030.cf b/tests/acceptance/10_files/08_field_edits/030.cf index 39b8e2d100..92cebbb254 100644 --- a/tests/acceptance/10_files/08_field_edits/030.cf +++ b/tests/acceptance/10_files/08_field_edits/030.cf @@ -3,37 +3,35 @@ # Set field, after end of some lists without extend_fields # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - "expected" string => - "able:baker,booker,banker:charlie:delta:echo + "expected" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::XXX ampallang:: :dydoe:,:XXX:::: :blowfish:conger:dogfish:eel:flounder"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,50 +40,48 @@ ampallang:: :dydoe:,:XXX:::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "false"; - field_operation => "set"; - field_separator => ":"; - field_value => "XXX"; - select_field => "6"; - value_separator => ","; + allow_blank_fields => "true"; + extend_fields => "false"; + field_operation => "set"; + field_separator => ":"; + field_value => "XXX"; + select_field => "6"; + value_separator => ","; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/08_field_edits/031.cf b/tests/acceptance/10_files/08_field_edits/031.cf index bef5dcc063..38bdd4fbf9 100644 --- a/tests/acceptance/10_files/08_field_edits/031.cf +++ b/tests/acceptance/10_files/08_field_edits/031.cf @@ -3,35 +3,34 @@ # Set field, not allowing blanks (test needs to be double-checked for accuracy) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - - "expected" string => - "able:baker,booker,banker:charlie:delta:echo:XXX + + "expected" + string => "able:baker,booker,banker:charlie:delta:echo:XXX apple:banana:carrot:dogfood::XXX aardvark:baboon:colugo:dingo:fox:XXX ampallang: :dydoe:,::XXX :blowfish:conger:dogfish:eel:flounder"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -40,50 +39,49 @@ ampallang: :dydoe:,::XXX bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "false"; - extend_fields => "true"; - field_operation => "set"; - field_separator => ":"; - field_value => "XXX"; - select_field => "6"; - value_separator => ","; + allow_blank_fields => "false"; + extend_fields => "true"; + field_operation => "set"; + field_separator => ":"; + field_value => "XXX"; + select_field => "6"; + value_separator => ","; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/08_field_edits/032.cf b/tests/acceptance/10_files/08_field_edits/032.cf index 1c9cf1e079..9941bdaaeb 100644 --- a/tests/acceptance/10_files/08_field_edits/032.cf +++ b/tests/acceptance/10_files/08_field_edits/032.cf @@ -4,35 +4,34 @@ # Bug, tracked on https://cfengine.com/dev/issues/3506 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,XXX,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,XXX,banker:charlie:delta:echo apple:XXX,banana:carrot:dogfood aardvark:baboon,XXX:colugo:dingo::fox ampallang:XXX: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - - "expected" string => - "able:baker,booker,banker:charlie:delta:echo + + "expected" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -41,50 +40,49 @@ ampallang:: :dydoe:,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "delete"; - field_separator => ":"; - field_value => "XXX"; - select_field => "2"; - value_separator => ","; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "delete"; + field_separator => ":"; + field_value => "XXX"; + select_field => "2"; + value_separator => ","; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/08_field_edits/033.cf b/tests/acceptance/10_files/08_field_edits/033.cf index 34b3f2630e..93598d07fc 100644 --- a/tests/acceptance/10_files/08_field_edits/033.cf +++ b/tests/acceptance/10_files/08_field_edits/033.cf @@ -3,37 +3,35 @@ # Append field (default field_operation) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - "expected" string => - "able:baker,booker,banker,XXX:charlie:delta:echo + "expected" + string => "able:baker,booker,banker,XXX:charlie:delta:echo apple:banana,XXX:carrot:dogfood aardvark:baboon,XXX:colugo:dingo::fox ampallang:XXX: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,51 +40,50 @@ ampallang:XXX: :dydoe:,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - # field_operation => "append"; # Default value - field_separator => ":"; - field_value => "XXX"; - select_field => "2"; - start_fields_from_zero => "false"; - value_separator => ","; + allow_blank_fields => "true"; + extend_fields => "true"; + + # field_operation => "append"; # Default value + field_separator => ":"; + field_value => "XXX"; + select_field => "2"; + start_fields_from_zero => "false"; + value_separator => ","; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/08_field_edits/036.cf b/tests/acceptance/10_files/08_field_edits/036.cf index 61ccc30442..2e26f9731a 100644 --- a/tests/acceptance/10_files/08_field_edits/036.cf +++ b/tests/acceptance/10_files/08_field_edits/036.cf @@ -3,35 +3,34 @@ # Append field, testing blank values (default field_operation) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - - "expected" string => - "able:baker,booker,banker:charlie:delta:echo+XXX + + "expected" + string => "able:baker,booker,banker:charlie:delta:echo+XXX apple:banana:carrot:dogfood:XXX aardvark:baboon:colugo:dingo:XXX:fox ampallang:: :dydoe:,+XXX::::: :blowfish:conger:dogfish:eel:flounder"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -40,51 +39,51 @@ ampallang:: :dydoe:,+XXX::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - # field_operation => "append"; # Default value - field_separator => ":"; - field_value => "XXX"; - select_field => "5"; - start_fields_from_zero => "false"; - value_separator => "+"; + allow_blank_fields => "true"; + extend_fields => "true"; + + # field_operation => "append"; # Default value + field_separator => ":"; + field_value => "XXX"; + select_field => "5"; + start_fields_from_zero => "false"; + value_separator => "+"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/08_field_edits/037.cf b/tests/acceptance/10_files/08_field_edits/037.cf index b6795488b9..54f78d20c2 100644 --- a/tests/acceptance/10_files/08_field_edits/037.cf +++ b/tests/acceptance/10_files/08_field_edits/037.cf @@ -3,35 +3,34 @@ # Append field, testing blank values (spaces, not completely blank) (default field_operation) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe: , ::::: :blowfish:conger:dogfish:eel:flounder"; - - "expected" string => - "able:baker,booker,banker:charlie:delta:echo+XXX + + "expected" + string => "able:baker,booker,banker:charlie:delta:echo+XXX apple:banana:carrot:dogfood:XXX aardvark:baboon:colugo:dingo:XXX:fox ampallang:: :dydoe: , +XXX::::: :blowfish:conger:dogfish:eel:flounder"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -40,51 +39,51 @@ ampallang:: :dydoe: , +XXX::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - # field_operation => "append"; # Default value - field_separator => ":"; - field_value => "XXX"; - select_field => "5"; - start_fields_from_zero => "false"; - value_separator => "+"; + allow_blank_fields => "true"; + extend_fields => "true"; + + # field_operation => "append"; # Default value + field_separator => ":"; + field_value => "XXX"; + select_field => "5"; + start_fields_from_zero => "false"; + value_separator => "+"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/08_field_edits/file_content.cf b/tests/acceptance/10_files/08_field_edits/file_content.cf index 524f5ed69b..c665443dad 100644 --- a/tests/acceptance/10_files/08_field_edits/file_content.cf +++ b/tests/acceptance/10_files/08_field_edits/file_content.cf @@ -1,80 +1,82 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "expected.singleline" string => "content in file"; - "expected.multiline" string => "multiline + "expected.singleline" string => "content in file"; + "expected.multiline" string => "multiline content in file"; # Create the expected files using insert_lines files: - "$(G.testfile).expected.singleline" - create => "true", - edit_line => init_insert("$(expected.singleline)"), - edit_defaults => init_empty; + "$(G.testfile).expected.singleline" + create => "true", + edit_line => init_insert("$(expected.singleline)"), + edit_defaults => init_empty; - "$(G.testfile).expected.multiline" - create => "true", - edit_line => init_insert("$(expected.multiline)"), - edit_defaults => init_empty; + "$(G.testfile).expected.multiline" + create => "true", + edit_line => init_insert("$(expected.multiline)"), + edit_defaults => init_empty; } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10254" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10254" }; files: - "$(G.testfile).actual.singleline" - create => "true", - content => "content in file + "$(G.testfile).actual.singleline" + create => "true", + content => "content in file "; - "$(G.testfile).actual.multiline" - create => "true", - content => "multiline + "$(G.testfile).actual.multiline" + create => "true", + content => "multiline content in file "; - } ####################################################### - bundle agent check { methods: - "" usebundle => dcs_check_diff("$(G.testfile).actual.singleline", - "$(G.testfile).expected.singleline", - "$(this.promise_filename)"); - - "" usebundle => dcs_check_diff("$(G.testfile).actual.multiline", - "$(G.testfile).expected.multiline", - "$(this.promise_filename)"); + "" + usebundle => dcs_check_diff( + "$(G.testfile).actual.singleline", + "$(G.testfile).expected.singleline", + "$(this.promise_filename)" + ); + "" + usebundle => dcs_check_diff( + "$(G.testfile).actual.multiline", + "$(G.testfile).expected.multiline", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/10_files/08_field_edits/file_content.error.cf b/tests/acceptance/10_files/08_field_edits/file_content.error.cf index ec783cd998..71fd9467fe 100644 --- a/tests/acceptance/10_files/08_field_edits/file_content.error.cf +++ b/tests/acceptance/10_files/08_field_edits/file_content.error.cf @@ -1,89 +1,93 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { # Create a blank file to compare files: - "$(G.testfile).expected.blank" - create => "true", - edit_defaults => init_empty; + "$(G.testfile).expected.blank" + create => "true", + edit_defaults => init_empty; } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).error.edit_line" - create => "true", - content => "whatever", - edit_line => whatever_line; - - "$(G.testfile).error.edit_xml" - create => "true", - content => "whatever", - edit_xml => whatever_xml; - - "$(G.testfile).error.edit_template" - create => "true", - content => "whatever", - edit_template => "/path/to/whatever"; - - "$(G.testfile).error.edit_template_string" - create => "true", - content => "whatever", - edit_template_string => "whatever"; - - + "$(G.testfile).error.edit_line" + create => "true", + content => "whatever", + edit_line => whatever_line; + + "$(G.testfile).error.edit_xml" + create => "true", + content => "whatever", + edit_xml => whatever_xml; + + "$(G.testfile).error.edit_template" + create => "true", + content => "whatever", + edit_template => "/path/to/whatever"; + + "$(G.testfile).error.edit_template_string" + create => "true", + content => "whatever", + edit_template_string => "whatever"; } bundle edit_line whatever_line { - } bundle edit_xml whatever_xml { - } ####################################################### - bundle agent check { methods: - - "" usebundle => dcs_check_diff("$(G.testfile).error.edit_line", - "$(G.testfile).expected.blank", - "$(this.promise_filename)"); - - "" usebundle => dcs_check_diff("$(G.testfile).error.edit_xml", - "$(G.testfile).expected.blank", - "$(this.promise_filename)"); - - "" usebundle => dcs_check_diff("$(G.testfile).error.edit_template", - "$(G.testfile).expected.blank", - "$(this.promise_filename)"); - - "" usebundle => dcs_check_diff("$(G.testfile).error.edit_template_string", - "$(G.testfile).expected.blank", - "$(this.promise_filename)"); + "" + usebundle => dcs_check_diff( + "$(G.testfile).error.edit_line", + "$(G.testfile).expected.blank", + "$(this.promise_filename)" + ); + + "" + usebundle => dcs_check_diff( + "$(G.testfile).error.edit_xml", + "$(G.testfile).expected.blank", + "$(this.promise_filename)" + ); + + "" + usebundle => dcs_check_diff( + "$(G.testfile).error.edit_template", + "$(G.testfile).expected.blank", + "$(this.promise_filename)" + ); + + "" + usebundle => dcs_check_diff( + "$(G.testfile).error.edit_template_string", + "$(G.testfile).expected.blank", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/10_files/08_field_edits/set_classes_in_warn_only.cf b/tests/acceptance/10_files/08_field_edits/set_classes_in_warn_only.cf index 5e399e99e2..cfada0169d 100644 --- a/tests/acceptance/10_files/08_field_edits/set_classes_in_warn_only.cf +++ b/tests/acceptance/10_files/08_field_edits/set_classes_in_warn_only.cf @@ -3,112 +3,104 @@ #Tries to edit a file in warn_only, and must have a kept class defined # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "filename_kept" string => "shadow.kept"; - "filename_failed" string => "shadow.failed"; - - "content" string => - "nicolas:$1$NoSH4e.u$U4uEzaOuC0tmQThtI3hj00:16988:0:99999:7:::"; + "filename_kept" string => "shadow.kept"; + "filename_failed" string => "shadow.failed"; - "name" string => - "nicolas"; + "content" + string => "nicolas:$1$NoSH4e.u$U4uEzaOuC0tmQThtI3hj00:16988:0:99999:7:::"; - "field_kept" string => - "$1$NoSH4e.u$U4uEzaOuC0tmQThtI3hj00"; - - "field_failed" string => - "bad"; + "name" string => "nicolas"; + "field_kept" string => "$1$NoSH4e.u$U4uEzaOuC0tmQThtI3hj00"; + "field_failed" string => "bad"; files: - "$(G.testfile).$(init.filename_kept)" - create => "true", - edit_line => init_insert("$(init.content)"), - edit_defaults => init_empty; - - "$(G.testfile).$(init.filename_failed)" - create => "true", - edit_line => init_insert("$(init.content)"), - edit_defaults => init_empty; + "$(G.testfile).$(init.filename_kept)" + create => "true", + edit_line => init_insert("$(init.content)"), + edit_defaults => init_empty; + + "$(G.testfile).$(init.filename_failed)" + create => "true", + edit_line => init_insert("$(init.content)"), + edit_defaults => init_empty; } bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).$(init.filename_kept)" - create => "false", - edit_line => test_set_user_field("${init.name}", 2, "${init.field_kept}"), - action => test_warn_only, - classes => test_classes_generic("test_result_kept"); - - "$(G.testfile).$(init.filename_failed)" - create => "false", - edit_line => test_set_user_field("${init.name}", 2, "${init.field_failed}"), - action => test_warn_only, - classes => test_classes_generic("test_result_failed"); + "$(G.testfile).$(init.filename_kept)" + create => "false", + edit_line => test_set_user_field("${init.name}", 2, "${init.field_kept}"), + action => test_warn_only, + classes => test_classes_generic("test_result_kept"); + + "$(G.testfile).$(init.filename_failed)" + create => "false", + edit_line => test_set_user_field( + "${init.name}", 2, "${init.field_failed}" + ), + action => test_warn_only, + classes => test_classes_generic("test_result_failed"); } -bundle edit_line test_set_user_field(user,field,val) +bundle edit_line test_set_user_field(user, field, val) { field_edits: - "$(user):.*" + "$(user):.*" comment => "Edit a user attribute in the password file", - edit_field => test_col(":","$(field)","$(val)","set"); + edit_field => test_col(":", "$(field)", "$(val)", "set"); } -body edit_field test_col(split,col,newval,method) +body edit_field test_col(split, col, newval, method) { - field_separator => "$(split)"; - select_field => "$(col)"; - value_separator => ","; - field_value => "$(newval)"; - field_operation => "$(method)"; - extend_fields => "true"; - allow_blank_fields => "true"; + field_separator => "$(split)"; + select_field => "$(col)"; + value_separator => ","; + field_value => "$(newval)"; + field_operation => "$(method)"; + extend_fields => "true"; + allow_blank_fields => "true"; } body action test_warn_only { - action_policy => "warn"; - ifelapsed => "60"; + action_policy => "warn"; + ifelapsed => "60"; } body classes test_classes_generic(x) { - promise_repaired => { "$(x)_repaired" }; - repair_failed => { "$(x)_failed" }; - repair_denied => { "$(x)_denied" }; - repair_timeout => { "$(x)_timeout" }; - promise_kept => { "$(x)_ok" }; + promise_repaired => { "$(x)_repaired" }; + repair_failed => { "$(x)_failed" }; + repair_denied => { "$(x)_denied" }; + repair_timeout => { "$(x)_timeout" }; + promise_kept => { "$(x)_ok" }; } - ####################################################### - bundle agent check { reports: diff --git a/tests/acceptance/10_files/08_field_edits/set_empty_field_erroneous_message.cf b/tests/acceptance/10_files/08_field_edits/set_empty_field_erroneous_message.cf index bfcc745227..875194bad9 100644 --- a/tests/acceptance/10_files/08_field_edits/set_empty_field_erroneous_message.cf +++ b/tests/acceptance/10_files/08_field_edits/set_empty_field_erroneous_message.cf @@ -3,24 +3,26 @@ # catch spurious editing messages in field editing # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent check { methods: - "" usebundle => file_make($(G.testfile), "root:sikrt:16104::::::"); - "" usebundle => dcs_passif_output("", - ".*(Edited|Setting).*", - "$(sys.cf_agent) -KI -f $(this.promise_filename).sub | $(G.grep) field", - $(this.promise_filename)); + "" usebundle => file_make($(G.testfile), "root:sikrt:16104::::::"); + + "" + usebundle => dcs_passif_output( + "", + ".*(Edited|Setting).*", + "$(sys.cf_agent) -KI -f $(this.promise_filename).sub | $(G.grep) field", + $(this.promise_filename) + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/08_field_edits/set_value_line_long.cf b/tests/acceptance/10_files/08_field_edits/set_value_line_long.cf index f8279d0301..0b313bb632 100644 --- a/tests/acceptance/10_files/08_field_edits/set_value_line_long.cf +++ b/tests/acceptance/10_files/08_field_edits/set_value_line_long.cf @@ -3,27 +3,26 @@ # Test setting a field in a line longer than 4k # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; + + "actual" + string => "a:a:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaend"; + + "expected" + string => "a:b:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaend"; - "actual" string => - "a:a:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaend"; - - "expected" string => - "a:b:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaend"; - files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -32,49 +31,47 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "set"; - field_separator => ":"; - field_value => "b"; - select_field => "2"; - start_fields_from_zero => "false"; - value_separator => "+"; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "set"; + field_separator => ":"; + field_value => "b"; + select_field => "2"; + start_fields_from_zero => "false"; + value_separator => "+"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/10_files/08_field_edits/staging/025.cf b/tests/acceptance/10_files/08_field_edits/staging/025.cf index b47158233b..81b02b6664 100644 --- a/tests/acceptance/10_files/08_field_edits/staging/025.cf +++ b/tests/acceptance/10_files/08_field_edits/staging/025.cf @@ -3,35 +3,34 @@ # Alphanum field, testing blank values # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - - "expected" string => - "able:baker,booker,banker:charlie:delta:XXX,echo + + "expected" + string => "able:baker,booker,banker:charlie:delta:XXX,echo apple:banana:carrot:dogfood:XXX aardvark:baboon:colugo:dingo:XXX:fox ampallang:: :dydoe:XXX,,::::: :blowfish:conger:dogfish:eel:flounder"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -40,51 +39,50 @@ ampallang:: :dydoe:XXX,,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "alphanum"; - field_separator => ":"; - field_value => "XXX"; - select_field => "5"; - start_fields_from_zero => "false"; - value_separator => ","; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "alphanum"; + field_separator => ":"; + field_value => "XXX"; + select_field => "5"; + start_fields_from_zero => "false"; + value_separator => ","; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/08_field_edits/staging/026.cf b/tests/acceptance/10_files/08_field_edits/staging/026.cf index 2c648a139f..7617e6d95b 100644 --- a/tests/acceptance/10_files/08_field_edits/staging/026.cf +++ b/tests/acceptance/10_files/08_field_edits/staging/026.cf @@ -3,35 +3,34 @@ # Alphanum field, testing blank values (spaces, not completely blank) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe: , ::::: :blowfish:conger:dogfish:eel:flounder"; - - "expected" string => - "able:baker,booker,banker:charlie:delta:XXX,echo + + "expected" + string => "able:baker,booker,banker:charlie:delta:XXX,echo apple:banana:carrot:dogfood:XXX aardvark:baboon:colugo:dingo:XXX:fox ampallang:: :dydoe:XXX, , ::::: :blowfish:conger:dogfish:eel:flounder"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -40,51 +39,50 @@ ampallang:: :dydoe:XXX, , ::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "alphanum"; - field_separator => ":"; - field_value => "XXX"; - select_field => "5"; - start_fields_from_zero => "false"; - value_separator => ","; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "alphanum"; + field_separator => ":"; + field_value => "XXX"; + select_field => "5"; + start_fields_from_zero => "false"; + value_separator => ","; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/08_field_edits/staging/039.cf b/tests/acceptance/10_files/08_field_edits/staging/039.cf index 0943048bd3..eaaad0f1e1 100644 --- a/tests/acceptance/10_files/08_field_edits/staging/039.cf +++ b/tests/acceptance/10_files/08_field_edits/staging/039.cf @@ -3,35 +3,34 @@ # Replace fields, regex separator # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - - "expected" string => - "able:baker,booker,banker:XXX:delta:echo + + "expected" + string => "able:baker,booker,banker:XXX:delta:echo apple:banana:carrot:dogfood:XXX aardvark:baboon:colugo:dingo:XXX:fox ampallang:: :dydoe:XXX,::::: :blowfish:conger:dogfish:eel:flounder"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -40,49 +39,48 @@ ampallang:: :dydoe:XXX,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "set"; - field_separator => "[:,]"; - field_value => "XXX"; - select_field => "5"; + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "set"; + field_separator => "[:,]"; + field_value => "XXX"; + select_field => "5"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/08_field_edits/staging/040.cf b/tests/acceptance/10_files/08_field_edits/staging/040.cf index 942e5d0228..4fd0b28ab8 100644 --- a/tests/acceptance/10_files/08_field_edits/staging/040.cf +++ b/tests/acceptance/10_files/08_field_edits/staging/040.cf @@ -3,35 +3,34 @@ # Replace fields, regex separator value_separator not included in it # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "able:baker,booker,banker:charlie:delta:echo + "actual" + string => "able:baker,booker,banker:charlie:delta:echo apple:banana:carrot:dogfood aardvark:baboon:colugo:dingo::fox ampallang:: :dydoe:,::::: :blowfish:conger:dogfish:eel:flounder"; - - "expected" string => - "able:baker,booker,banker:XXX:delta:echo + + "expected" + string => "able:baker,booker,banker:XXX:delta:echo apple:banana:carrot:dogfood:XXX aardvark:baboon:colugo:dingo:XXX:fox ampallang:: :dydoe:XXX,::::: :blowfish:conger:dogfish:eel:flounder"; - + files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -40,50 +39,51 @@ ampallang:: :dydoe:XXX,::::: bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_edit; - + "$(G.testfile).actual" edit_line => test_edit; } bundle edit_line test_edit { field_edits: - "a.*" - edit_field => test_col; + "a.*" edit_field => test_col; } body edit_field test_col { - allow_blank_fields => "true"; - extend_fields => "true"; - field_operation => "set"; - field_separator => "[:,]"; - field_value => "XXX"; - select_field => "5"; - value_separator => "/"; # This is not included in the field_separator + allow_blank_fields => "true"; + extend_fields => "true"; + field_operation => "set"; + field_separator => "[:,]"; + field_value => "XXX"; + select_field => "5"; + value_separator => "/"; + + # This is not included in the field_separator } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/09_insert_lines/001.cf b/tests/acceptance/10_files/09_insert_lines/001.cf index 808fb18bbb..4b19616cca 100644 --- a/tests/acceptance/10_files/09_insert_lines/001.cf +++ b/tests/acceptance/10_files/09_insert_lines/001.cf @@ -3,30 +3,26 @@ # Insert a number of lines # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => - "BEGIN + "states" slist => { "actual", "expected" }; + "actual" string => "BEGIN One potato Two potato Four END"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Four @@ -34,7 +30,7 @@ END Three potatoe"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -43,46 +39,45 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " One potato + "tstr" string => " One potato Two potato Three potatoe Four"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert("$(test.tstr)"); - } bundle edit_line test_insert(str) { insert_lines: - "BEGIN$(const.n)$(str)$(const.n)END"; + "BEGIN$(const.n)$(str)$(const.n)END"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/002.cf b/tests/acceptance/10_files/09_insert_lines/002.cf index f58919b8cf..8119de560e 100644 --- a/tests/acceptance/10_files/09_insert_lines/002.cf +++ b/tests/acceptance/10_files/09_insert_lines/002.cf @@ -3,30 +3,26 @@ # Insert a number of lines at the end of a fully bounded region # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => - "BEGIN + "states" slist => { "actual", "expected" }; + "actual" string => "BEGIN One potato Two potato Four END"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Four @@ -34,7 +30,7 @@ END"; END"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -43,53 +39,51 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " One potato + "tstr" string => " One potato Two potato Three potatoe Four"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert("$(test.tstr)"); - } bundle edit_line test_insert(str) { insert_lines: - "$(str)" - select_region => test_region; + "$(str)" select_region => test_region; } body select_region test_region { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/003.cf b/tests/acceptance/10_files/09_insert_lines/003.cf index a3c0ba15cc..64269a2710 100644 --- a/tests/acceptance/10_files/09_insert_lines/003.cf +++ b/tests/acceptance/10_files/09_insert_lines/003.cf @@ -3,30 +3,26 @@ # Insert a number of lines at the end of a partially bounded region # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => - "BEGIN + "states" slist => { "actual", "expected" }; + "actual" string => "BEGIN One potato Two potato Four END"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Four @@ -34,7 +30,7 @@ END Three potatoe"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -43,52 +39,50 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " One potato + "tstr" string => " One potato Two potato Three potatoe Four"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert("$(test.tstr)"); - } bundle edit_line test_insert(str) { insert_lines: - "$(str)" - select_region => test_region; + "$(str)" select_region => test_region; } body select_region test_region { - select_start => "BEGIN"; + select_start => "BEGIN"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/004.cf b/tests/acceptance/10_files/09_insert_lines/004.cf index 58b5e488df..2864202f6b 100644 --- a/tests/acceptance/10_files/09_insert_lines/004.cf +++ b/tests/acceptance/10_files/09_insert_lines/004.cf @@ -4,23 +4,21 @@ # region, before the first instance of a line # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " big potatoes + "actual" + string => " big potatoes BEGIN One potato Two potato @@ -29,8 +27,8 @@ BEGIN END small potatoes"; - "expected" string => - " big potatoes + "expected" + string => " big potatoes BEGIN Three potatoe One potato @@ -41,7 +39,7 @@ END small potatoes"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,61 +48,60 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " One potato + "tstr" string => " One potato Two potato Three potatoe Four"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert("$(test.tstr)"); - } bundle edit_line test_insert(str) { insert_lines: - "$(str)" + "$(str)" select_region => test_region, location => test_before_first(".*potato.*"); } body select_region test_region { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } body location test_before_first(line) { - before_after => "before"; - first_last => "first"; - select_line_matching => "$(line)"; + before_after => "before"; + first_last => "first"; + select_line_matching => "$(line)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/005.cf b/tests/acceptance/10_files/09_insert_lines/005.cf index 0ed6f4fd36..cae19a1c6f 100644 --- a/tests/acceptance/10_files/09_insert_lines/005.cf +++ b/tests/acceptance/10_files/09_insert_lines/005.cf @@ -4,23 +4,21 @@ # region, after the last instance of a line # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " big potatoes + "actual" + string => " big potatoes BEGIN One potato Two potato @@ -29,8 +27,8 @@ BEGIN END small potatoes"; - "expected" string => - " big potatoes + "expected" + string => " big potatoes BEGIN One potato Two potato @@ -41,7 +39,7 @@ END small potatoes"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,61 +48,60 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " One potato + "tstr" string => " One potato Two potato Three potatoe Four"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert("$(test.tstr)"); - } bundle edit_line test_insert(str) { insert_lines: - "$(str)" + "$(str)" select_region => test_region, location => test_after_last(".*potato.*"); } body select_region test_region { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } body location test_after_last(line) { - before_after => "after"; - first_last => "last"; - select_line_matching => "$(line)"; + before_after => "after"; + first_last => "last"; + select_line_matching => "$(line)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/006.cf b/tests/acceptance/10_files/09_insert_lines/006.cf index 9fff5f8448..06a650104a 100644 --- a/tests/acceptance/10_files/09_insert_lines/006.cf +++ b/tests/acceptance/10_files/09_insert_lines/006.cf @@ -4,23 +4,21 @@ # region, after the first instance of a line # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " big potatoes + "actual" + string => " big potatoes BEGIN One potato Two potato @@ -29,8 +27,8 @@ BEGIN END small potatoes"; - "expected" string => - " big potatoes + "expected" + string => " big potatoes BEGIN One potato Three potatoe @@ -41,7 +39,7 @@ END small potatoes"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,61 +48,60 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " One potato + "tstr" string => " One potato Two potato Three potatoe Four"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert("$(test.tstr)"); - } bundle edit_line test_insert(str) { insert_lines: - "$(str)" + "$(str)" select_region => test_region, location => test_after_first(".*potato.*"); } body select_region test_region { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } body location test_after_first(line) { - before_after => "after"; - first_last => "first"; - select_line_matching => "$(line)"; + before_after => "after"; + first_last => "first"; + select_line_matching => "$(line)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/007.cf b/tests/acceptance/10_files/09_insert_lines/007.cf index 17258e1981..2af8e860b3 100644 --- a/tests/acceptance/10_files/09_insert_lines/007.cf +++ b/tests/acceptance/10_files/09_insert_lines/007.cf @@ -4,23 +4,21 @@ # region, before the last instance of a line # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " big potatoes + "actual" + string => " big potatoes BEGIN One potato Two potato @@ -29,8 +27,8 @@ BEGIN END small potatoes"; - "expected" string => - " big potatoes + "expected" + string => " big potatoes BEGIN One potato Two potato @@ -41,7 +39,7 @@ END small potatoes"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,61 +48,60 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " One potato + "tstr" string => " One potato Two potato Three potatoe Four"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert("$(test.tstr)"); - } bundle edit_line test_insert(str) { insert_lines: - "$(str)" + "$(str)" select_region => test_region, location => test_before_last(".*potato.*"); } body select_region test_region { - select_start => "BEGIN"; - select_end => "END"; + select_start => "BEGIN"; + select_end => "END"; } body location test_before_last(line) { - before_after => "before"; - first_last => "last"; - select_line_matching => "$(line)"; + before_after => "before"; + first_last => "last"; + select_line_matching => "$(line)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/008.cf b/tests/acceptance/10_files/09_insert_lines/008.cf index 0edc4d1b10..70252f6425 100644 --- a/tests/acceptance/10_files/09_insert_lines/008.cf +++ b/tests/acceptance/10_files/09_insert_lines/008.cf @@ -3,31 +3,29 @@ # Insert a number of lines before the first instance of a line # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes Four END"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN Three potatoe One potato Two potato @@ -36,7 +34,7 @@ END"; END"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -45,54 +43,52 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " One potato + "tstr" string => " One potato Two potato Three potatoe Four"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert("$(test.tstr)"); - } bundle edit_line test_insert(str) { insert_lines: - "$(str)" - location => test_before_first(".*potato.*"); + "$(str)" location => test_before_first(".*potato.*"); } body location test_before_first(line) { - before_after => "before"; - first_last => "first"; - select_line_matching => "$(line)"; + before_after => "before"; + first_last => "first"; + select_line_matching => "$(line)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/009.cf b/tests/acceptance/10_files/09_insert_lines/009.cf index 381074d0a6..38eb781ac9 100644 --- a/tests/acceptance/10_files/09_insert_lines/009.cf +++ b/tests/acceptance/10_files/09_insert_lines/009.cf @@ -3,31 +3,29 @@ # Insert a number of lines after the last instance of a line # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes Four END"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -36,7 +34,7 @@ END"; END"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -45,54 +43,52 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " One potato + "tstr" string => " One potato Two potato Three potatoe Four"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert("$(test.tstr)"); - } bundle edit_line test_insert(str) { insert_lines: - "$(str)" - location => test_after_last(".*potato.*"); + "$(str)" location => test_after_last(".*potato.*"); } body location test_after_last(line) { - before_after => "after"; - first_last => "last"; - select_line_matching => "$(line)"; + before_after => "after"; + first_last => "last"; + select_line_matching => "$(line)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/010.cf b/tests/acceptance/10_files/09_insert_lines/010.cf index 470f5b32cc..c985183278 100644 --- a/tests/acceptance/10_files/09_insert_lines/010.cf +++ b/tests/acceptance/10_files/09_insert_lines/010.cf @@ -3,31 +3,29 @@ # Insert a number of lines after the first instance of a line # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes Four END"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Three potatoe Two potato @@ -36,7 +34,7 @@ END"; END"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -45,54 +43,52 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " One potato + "tstr" string => " One potato Two potato Three potatoe Four"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert("$(test.tstr)"); - } bundle edit_line test_insert(str) { insert_lines: - "$(str)" - location => test_after_first(".*potato.*"); + "$(str)" location => test_after_first(".*potato.*"); } body location test_after_first(line) { - before_after => "after"; - first_last => "first"; - select_line_matching => "$(line)"; + before_after => "after"; + first_last => "first"; + select_line_matching => "$(line)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/011.cf b/tests/acceptance/10_files/09_insert_lines/011.cf index 624734a4a9..98944be72a 100644 --- a/tests/acceptance/10_files/09_insert_lines/011.cf +++ b/tests/acceptance/10_files/09_insert_lines/011.cf @@ -3,31 +3,29 @@ # Insert a number of lines before the last instance of a line # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes Four END"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Three potatoe @@ -36,7 +34,7 @@ END"; END"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -45,54 +43,52 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "tstr" string => - " One potato + "tstr" string => " One potato Two potato Three potatoe Four"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert("$(test.tstr)"); - } bundle edit_line test_insert(str) { insert_lines: - "$(str)" - location => test_before_last(".*potato.*"); + "$(str)" location => test_before_last(".*potato.*"); } body location test_before_last(line) { - before_after => "before"; - first_last => "last"; - select_line_matching => "$(line)"; + before_after => "before"; + first_last => "last"; + select_line_matching => "$(line)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/012.cf b/tests/acceptance/10_files/09_insert_lines/012.cf index cb2a6d3044..9a8fc12f55 100644 --- a/tests/acceptance/10_files/09_insert_lines/012.cf +++ b/tests/acceptance/10_files/09_insert_lines/012.cf @@ -3,38 +3,36 @@ # Insert a number of lines before the last instance of a line # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Spuds spuds spuds Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Three potatoe @@ -44,7 +42,7 @@ END"; END"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,47 +51,46 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); - + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(str) { insert_lines: - "$(str)" + "$(str)" insert_type => "file", location => test_before_last(".*potato.*"); } body location test_before_last(line) { - before_after => "before"; - first_last => "last"; - select_line_matching => "$(line)"; + before_after => "before"; + first_last => "last"; + select_line_matching => "$(line)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/013.cf b/tests/acceptance/10_files/09_insert_lines/013.cf index e6aee1c1ed..0b107ed3b1 100644 --- a/tests/acceptance/10_files/09_insert_lines/013.cf +++ b/tests/acceptance/10_files/09_insert_lines/013.cf @@ -3,38 +3,36 @@ # Insert a number of lines before the last instance of a line # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Spuds spuds spuds Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -44,7 +42,7 @@ END Spuds spuds spuds"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,39 +51,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); - + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(str) { insert_lines: - "$(str)" - insert_type => "file"; + "$(str)" insert_type => "file"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/014.cf b/tests/acceptance/10_files/09_insert_lines/014.cf index 60881eb392..8a31c1769f 100644 --- a/tests/acceptance/10_files/09_insert_lines/014.cf +++ b/tests/acceptance/10_files/09_insert_lines/014.cf @@ -3,38 +3,36 @@ # Insert a number of lines before the last instance of a line # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Spuds spuds spuds Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -44,7 +42,7 @@ END Spuds spuds spuds"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,45 +51,44 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); - + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(str) { insert_lines: - "$(str)" + "$(str)" insert_type => "file", insert_select => test_insert_exclude("Xhree"); } body insert_select test_insert_exclude(r) { - insert_if_not_match_from_list => { "$(r)" }; + insert_if_not_match_from_list => { "$(r)" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/015.cf b/tests/acceptance/10_files/09_insert_lines/015.cf index c330212284..0cd327fece 100644 --- a/tests/acceptance/10_files/09_insert_lines/015.cf +++ b/tests/acceptance/10_files/09_insert_lines/015.cf @@ -3,38 +3,36 @@ # Insert a number of lines before the last instance of a line # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Spuds spuds spuds Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -44,7 +42,7 @@ END Spuds spuds spuds"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,45 +51,44 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); - + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", insert_select => test_insert_exclude("Three"); } body insert_select test_insert_exclude(r) { - insert_if_not_match_from_list => { "$(r)" }; + insert_if_not_match_from_list => { "$(r)" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/016.cf b/tests/acceptance/10_files/09_insert_lines/016.cf index 07023a561e..15f1a30214 100644 --- a/tests/acceptance/10_files/09_insert_lines/016.cf +++ b/tests/acceptance/10_files/09_insert_lines/016.cf @@ -3,38 +3,36 @@ # Insert a number of lines before the last instance of a line # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Spuds spuds spuds Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -43,7 +41,7 @@ END Spuds spuds spuds"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -52,45 +50,44 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); - + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", insert_select => test_insert_exclude(".*Three.*"); } body insert_select test_insert_exclude(r) { - insert_if_not_match_from_list => { "$(r)" }; + insert_if_not_match_from_list => { "$(r)" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/017.cf b/tests/acceptance/10_files/09_insert_lines/017.cf index 7ce56636df..75bcc06295 100644 --- a/tests/acceptance/10_files/09_insert_lines/017.cf +++ b/tests/acceptance/10_files/09_insert_lines/017.cf @@ -3,39 +3,40 @@ # Try to insert lines from a file that is really a directory. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - - -bundle agent test { +bundle agent test +{ files: - "$(G.testfile)" + "$(G.testfile)" edit_line => insert_dir, create => "true"; } -bundle edit_line insert_dir { +bundle edit_line insert_dir +{ insert_lines: - "$(G.testroot)" insert_type => "file", + "$(G.testroot)" + insert_type => "file", classes => if_notkept("ok"); } ####################################################### - bundle agent check { reports: DEBUG:: "This should only pass if inserting lines from a directory fails"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/09_insert_lines/019.cf b/tests/acceptance/10_files/09_insert_lines/019.cf index be68ef9383..0d6265558b 100644 --- a/tests/acceptance/10_files/09_insert_lines/019.cf +++ b/tests/acceptance/10_files/09_insert_lines/019.cf @@ -3,39 +3,34 @@ # Files read in as templates, check class handling # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_expected, edit_defaults => init_empty; files: - "$(G.testfile).template" + "$(G.testfile).template" create => "true", edit_line => init_template, edit_defaults => init_empty; - } ####### - bundle edit_line init_template { -insert_lines: - -"[%CFEngine BEGIN %] + insert_lines: + "[%CFEngine BEGIN %] WARNING No unauthorized logins. All logins are recorded. Property of Example.com @@ -52,17 +47,14 @@ phone: 555-555-4444 [%CFEngine any:: %] AAAAAAAA " - -insert_type => "preserve_all_lines"; + insert_type => "preserve_all_lines"; } ####### - bundle edit_line init_expected { -insert_lines: - -"WARNING + insert_lines: + "WARNING No unauthorized logins. All logins are recorded. Property of Example.com @@ -71,38 +63,36 @@ phone: 555-555-4444 AAAAAAAA " - -insert_type => "preserve_block"; + insert_type => "preserve_block"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { -classes: - - "fishy" expression => "any"; - -files: + classes: + "fishy" expression => "any"; - "$(G.testfile).actual" - create => "true", - edit_template => "$(G.testfile).template"; + files: + "$(G.testfile).actual" + create => "true", + edit_template => "$(G.testfile).template"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).expected", - "$(G.testfile).actual", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).expected", + "$(G.testfile).actual", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/020.cf b/tests/acceptance/10_files/09_insert_lines/020.cf index c6011cba56..0337a8526c 100644 --- a/tests/acceptance/10_files/09_insert_lines/020.cf +++ b/tests/acceptance/10_files/09_insert_lines/020.cf @@ -3,39 +3,34 @@ # Files read in as templates, check variable expansion # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_expected, edit_defaults => init_empty; files: - "$(G.testfile).template" + "$(G.testfile).template" create => "true", edit_line => init_template, edit_defaults => init_empty; - } ####### - bundle edit_line init_template { -insert_lines: - -"BEGIN + insert_lines: + "BEGIN $(const.dollar)(test.scalar) CCCCCCCC @@ -47,17 +42,14 @@ DDDDDDDD $(const.dollar)(test.list) [%CFEngine END %] " - -insert_type => "preserve_all_lines"; + insert_type => "preserve_all_lines"; } ####### - bundle edit_line init_expected { -insert_lines: - -"BEGIN + insert_lines: + "BEGIN One upon a time... CCCCCCCC @@ -68,43 +60,40 @@ DDDDDDDD Many times Upon a star " - -insert_type => "preserve_all_lines"; + insert_type => "preserve_all_lines"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { -vars: - - "scalar" string => "One upon a time..."; - "list" slist => { "Many times", "Upon a star" }; - -classes: + vars: + "scalar" string => "One upon a time..."; + "list" slist => { "Many times", "Upon a star" }; - "fishy" expression => "any"; + classes: + "fishy" expression => "any"; -files: - - "$(G.testfile).actual" - create => "true", - edit_template => "$(G.testfile).template"; + files: + "$(G.testfile).actual" + create => "true", + edit_template => "$(G.testfile).template"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).expected", - "$(G.testfile).actual", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).expected", + "$(G.testfile).actual", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/021.cf b/tests/acceptance/10_files/09_insert_lines/021.cf index 4f07b03491..43e6eb92b8 100644 --- a/tests/acceptance/10_files/09_insert_lines/021.cf +++ b/tests/acceptance/10_files/09_insert_lines/021.cf @@ -3,83 +3,72 @@ # Test idempotency of preserve_block # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_expected, edit_defaults => init_empty; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => init_file, edit_defaults => init_empty; - } ####### - bundle edit_line init_file { -insert_lines: - -"auto eth0.1190 + insert_lines: + "auto eth0.1190 iface eth0.1190 inet manual up ifconfig eth0.1190 up" - -insert_type => "preserve_block"; + insert_type => "preserve_block"; } ####### - bundle edit_line init_expected { -insert_lines: - -"auto eth0.1190 + insert_lines: + "auto eth0.1190 iface eth0.1190 inet manual up ifconfig eth0.1190 up" - -insert_type => "preserve_block"; + insert_type => "preserve_block"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { -files: - - # Do the same again to test idempotency of preserve_block - - "$(G.testfile).actual" - edit_line => init_expected; + files: + # Do the same again to test idempotency of preserve_block + "$(G.testfile).actual" edit_line => init_expected; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).expected", - "$(G.testfile).actual", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).expected", + "$(G.testfile).actual", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/101.cf b/tests/acceptance/10_files/09_insert_lines/101.cf index 663225a66a..c6ca61001d 100644 --- a/tests/acceptance/10_files/09_insert_lines/101.cf +++ b/tests/acceptance/10_files/09_insert_lines/101.cf @@ -4,23 +4,21 @@ # exact match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -46,7 +44,7 @@ END Three potatoe"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -55,38 +53,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "exact_match" }; + "$(lines)" whitespace_policy => { "exact_match" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/102.cf b/tests/acceptance/10_files/09_insert_lines/102.cf index 713846198c..aa08826fa7 100644 --- a/tests/acceptance/10_files/09_insert_lines/102.cf +++ b/tests/acceptance/10_files/09_insert_lines/102.cf @@ -4,23 +4,21 @@ # not-exact match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,38 +54,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "exact_match" }; + "$(lines)" whitespace_policy => { "exact_match" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/103.cf b/tests/acceptance/10_files/09_insert_lines/103.cf index 65decb118f..e0029a1e42 100644 --- a/tests/acceptance/10_files/09_insert_lines/103.cf +++ b/tests/acceptance/10_files/09_insert_lines/103.cf @@ -4,23 +4,21 @@ # ignore_trailing works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,38 +54,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "ignore_embedded" }; + "$(lines)" whitespace_policy => { "ignore_embedded" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/104.cf b/tests/acceptance/10_files/09_insert_lines/104.cf index 78132e75ed..651217a135 100644 --- a/tests/acceptance/10_files/09_insert_lines/104.cf +++ b/tests/acceptance/10_files/09_insert_lines/104.cf @@ -4,23 +4,21 @@ # ignore_trailing works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,38 +54,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ###################################################### -# bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "ignore_leading", "ignore_embedded" }; + "$(lines)" whitespace_policy => { "ignore_leading", "ignore_embedded" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/105.cf b/tests/acceptance/10_files/09_insert_lines/105.cf index 5e8bd3b455..b25b1453ae 100644 --- a/tests/acceptance/10_files/09_insert_lines/105.cf +++ b/tests/acceptance/10_files/09_insert_lines/105.cf @@ -3,23 +3,21 @@ # Insert lines from a variable, verify that pairs of whitespace_policy work # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -27,15 +25,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -46,7 +44,7 @@ END Leading embedded and trailing spaces"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -55,38 +53,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "ignore_leading", "ignore_trailing" }; + "$(lines)" whitespace_policy => { "ignore_leading", "ignore_trailing" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/106.cf b/tests/acceptance/10_files/09_insert_lines/106.cf index 4d1cfe6382..a418227294 100644 --- a/tests/acceptance/10_files/09_insert_lines/106.cf +++ b/tests/acceptance/10_files/09_insert_lines/106.cf @@ -3,23 +3,21 @@ # Insert lines from a variable, verify that pairs of whitespace_policy work # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -27,15 +25,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -46,7 +44,7 @@ END Leading embedded and trailing spaces"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -55,38 +53,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "ignore_leading", "ignore_embedded" }; + "$(lines)" whitespace_policy => { "ignore_leading", "ignore_embedded" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/107.cf b/tests/acceptance/10_files/09_insert_lines/107.cf index e5484b324e..c5b47930e8 100644 --- a/tests/acceptance/10_files/09_insert_lines/107.cf +++ b/tests/acceptance/10_files/09_insert_lines/107.cf @@ -3,23 +3,21 @@ # Insert lines from a variable, verify that pairs of whitespace_policy work # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -27,15 +25,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -46,7 +44,7 @@ END Leading embedded and trailing spaces"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -55,38 +53,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "ignore_trailing", "ignore_embedded" }; + "$(lines)" whitespace_policy => { "ignore_trailing", "ignore_embedded" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/108.cf b/tests/acceptance/10_files/09_insert_lines/108.cf index 5854494fbf..f445bdb679 100644 --- a/tests/acceptance/10_files/09_insert_lines/108.cf +++ b/tests/acceptance/10_files/09_insert_lines/108.cf @@ -3,23 +3,21 @@ # Insert lines from a variable, verify that pairs of whitespace_policy work # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -27,15 +25,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -45,7 +43,7 @@ END Three potatoe"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -54,38 +52,40 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "ignore_leading", "ignore_trailing", "ignore_embedded" }; + "$(lines)" + whitespace_policy => { + "ignore_leading", "ignore_trailing", "ignore_embedded" + }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/109.cf b/tests/acceptance/10_files/09_insert_lines/109.cf index 071f8fda9a..49dd60786e 100644 --- a/tests/acceptance/10_files/09_insert_lines/109.cf +++ b/tests/acceptance/10_files/09_insert_lines/109.cf @@ -3,25 +3,22 @@ # Insert lines with preserve_block "after" and check convergence # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => "START"; + "states" slist => { "actual", "expected" }; + "actual" string => "START"; - "expected" string => -"START + "expected" + string => "START 1 x2x xx3xx @@ -45,7 +42,7 @@ xxxxxxxxx15xxxxxxxxx xxxxxxxxx21xxxxxxx"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -54,28 +51,25 @@ xxxxxxxxx21xxxxxxx"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { -insert_lines: - -" 1 + insert_lines: + " 1 x2x xx3xx x4x @@ -96,26 +90,26 @@ xxxxxxxxx15xxxxxxxxx xxx19xx xxx20xx xxxxxxxxx21xxxxxxx" - location => prepend, - insert_type => "preserve_block"; + insert_type => "preserve_block"; } body location prepend { -before_after => "after"; + before_after => "after"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } - ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/09_insert_lines/112.cf b/tests/acceptance/10_files/09_insert_lines/112.cf index b2e4ae2cda..cf6a66ad34 100644 --- a/tests/acceptance/10_files/09_insert_lines/112.cf +++ b/tests/acceptance/10_files/09_insert_lines/112.cf @@ -4,23 +4,21 @@ # ignore_trailing works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,38 +54,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "ignore_leading" }; + "$(lines)" whitespace_policy => { "ignore_leading" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/113.cf b/tests/acceptance/10_files/09_insert_lines/113.cf index 570aa677cc..e4b42d121b 100644 --- a/tests/acceptance/10_files/09_insert_lines/113.cf +++ b/tests/acceptance/10_files/09_insert_lines/113.cf @@ -4,23 +4,21 @@ # ignore_embedded works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,38 +54,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "ignore_trailing" }; + "$(lines)" whitespace_policy => { "ignore_trailing" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/114.cf b/tests/acceptance/10_files/09_insert_lines/114.cf index a3316a0ae2..c7ebcd1607 100644 --- a/tests/acceptance/10_files/09_insert_lines/114.cf +++ b/tests/acceptance/10_files/09_insert_lines/114.cf @@ -4,23 +4,21 @@ # ignore_embedded works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,38 +54,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "ignore_leading", "ignore_trailing" }; + "$(lines)" whitespace_policy => { "ignore_leading", "ignore_trailing" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/115.cf b/tests/acceptance/10_files/09_insert_lines/115.cf index 5871cc3d16..6349cb5fe2 100644 --- a/tests/acceptance/10_files/09_insert_lines/115.cf +++ b/tests/acceptance/10_files/09_insert_lines/115.cf @@ -4,23 +4,21 @@ # works when given a close-enough exact match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,38 +54,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "ignore_trailing" }; + "$(lines)" whitespace_policy => { "ignore_trailing" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/116.cf b/tests/acceptance/10_files/09_insert_lines/116.cf index ec1191c7aa..427359fb22 100644 --- a/tests/acceptance/10_files/09_insert_lines/116.cf +++ b/tests/acceptance/10_files/09_insert_lines/116.cf @@ -4,23 +4,21 @@ # works when given a close-enough exact match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -46,7 +44,7 @@ END Three potatoe"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -55,38 +53,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "ignore_leading" }; + "$(lines)" whitespace_policy => { "ignore_leading" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/117.cf b/tests/acceptance/10_files/09_insert_lines/117.cf index 5635975e25..1b0aab3cae 100644 --- a/tests/acceptance/10_files/09_insert_lines/117.cf +++ b/tests/acceptance/10_files/09_insert_lines/117.cf @@ -4,23 +4,21 @@ # ignore_leading works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -46,7 +44,7 @@ END Three potatoe"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -55,38 +53,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "ignore_embedded" }; + "$(lines)" whitespace_policy => { "ignore_embedded" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/118.cf b/tests/acceptance/10_files/09_insert_lines/118.cf index 383c4c5063..7f707575c3 100644 --- a/tests/acceptance/10_files/09_insert_lines/118.cf +++ b/tests/acceptance/10_files/09_insert_lines/118.cf @@ -4,23 +4,21 @@ # ignore_leading works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,38 +54,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "ignore_trailing" }; + "$(lines)" whitespace_policy => { "ignore_trailing" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/119.cf b/tests/acceptance/10_files/09_insert_lines/119.cf index aede846a71..3540672243 100644 --- a/tests/acceptance/10_files/09_insert_lines/119.cf +++ b/tests/acceptance/10_files/09_insert_lines/119.cf @@ -4,23 +4,21 @@ # ignore_leading works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -46,7 +44,7 @@ END Three potatoe"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -55,38 +53,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "ignore_embedded", "ignore_trailing" }; + "$(lines)" whitespace_policy => { "ignore_embedded", "ignore_trailing" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/121.cf b/tests/acceptance/10_files/09_insert_lines/121.cf index 87fbc937e5..ff26ebb38e 100644 --- a/tests/acceptance/10_files/09_insert_lines/121.cf +++ b/tests/acceptance/10_files/09_insert_lines/121.cf @@ -4,23 +4,21 @@ # works when given a close-enough exact match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -46,7 +44,7 @@ END Three potatoe"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -55,38 +53,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "ignore_embedded" }; + "$(lines)" whitespace_policy => { "ignore_embedded" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/122.cf b/tests/acceptance/10_files/09_insert_lines/122.cf index 593b1e27a1..ad0b17e4a3 100644 --- a/tests/acceptance/10_files/09_insert_lines/122.cf +++ b/tests/acceptance/10_files/09_insert_lines/122.cf @@ -4,23 +4,21 @@ # ignore_embedded works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,38 +54,37 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(init.insert)"); + "$(G.testfile).actual" edit_line => test_insert("$(init.insert)"); } bundle edit_line test_insert(lines) { insert_lines: - "$(lines)" - whitespace_policy => { "ignore_leading" }; + "$(lines)" whitespace_policy => { "ignore_leading" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/201.cf b/tests/acceptance/10_files/09_insert_lines/201.cf index dc3914a53f..d1057f51c9 100644 --- a/tests/acceptance/10_files/09_insert_lines/201.cf +++ b/tests/acceptance/10_files/09_insert_lines/201.cf @@ -4,23 +4,21 @@ # exact match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -46,7 +44,7 @@ END Three potatoe"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -55,39 +53,39 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", whitespace_policy => { "exact_match" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/202.cf b/tests/acceptance/10_files/09_insert_lines/202.cf index 261b8f3dbf..8dc2072631 100644 --- a/tests/acceptance/10_files/09_insert_lines/202.cf +++ b/tests/acceptance/10_files/09_insert_lines/202.cf @@ -4,23 +4,21 @@ # not-exact match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,39 +54,39 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", whitespace_policy => { "exact_match" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/203.cf b/tests/acceptance/10_files/09_insert_lines/203.cf index a4ffac8904..7d8fc0a5e5 100644 --- a/tests/acceptance/10_files/09_insert_lines/203.cf +++ b/tests/acceptance/10_files/09_insert_lines/203.cf @@ -4,23 +4,21 @@ # ignore_trailing works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,39 +54,39 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", whitespace_policy => { "ignore_embedded" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/204.cf b/tests/acceptance/10_files/09_insert_lines/204.cf index 83a8d4cf87..8599531acd 100644 --- a/tests/acceptance/10_files/09_insert_lines/204.cf +++ b/tests/acceptance/10_files/09_insert_lines/204.cf @@ -4,23 +4,21 @@ # ignore_trailing works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,39 +54,39 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", whitespace_policy => { "ignore_leading", "ignore_embedded" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/205.cf b/tests/acceptance/10_files/09_insert_lines/205.cf index e17c1541d0..f81eb580fb 100644 --- a/tests/acceptance/10_files/09_insert_lines/205.cf +++ b/tests/acceptance/10_files/09_insert_lines/205.cf @@ -3,23 +3,21 @@ # Insert lines from a file, verify that pairs of whitespace_policy work # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -27,15 +25,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -46,7 +44,7 @@ END Leading embedded and trailing spaces"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -55,39 +53,39 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", whitespace_policy => { "ignore_leading", "ignore_trailing" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/206.cf b/tests/acceptance/10_files/09_insert_lines/206.cf index bf9efa1671..98b812c50d 100644 --- a/tests/acceptance/10_files/09_insert_lines/206.cf +++ b/tests/acceptance/10_files/09_insert_lines/206.cf @@ -3,23 +3,21 @@ # Insert lines from a file, verify that pairs of whitespace_policy work # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -27,15 +25,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -46,7 +44,7 @@ END Leading embedded and trailing spaces"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -55,39 +53,39 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", whitespace_policy => { "ignore_leading", "ignore_embedded" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/207.cf b/tests/acceptance/10_files/09_insert_lines/207.cf index 219a367cf4..c280316446 100644 --- a/tests/acceptance/10_files/09_insert_lines/207.cf +++ b/tests/acceptance/10_files/09_insert_lines/207.cf @@ -3,23 +3,21 @@ # Insert lines from a file, verify that pairs of whitespace_policy work # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -27,15 +25,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -46,7 +44,7 @@ END Leading embedded and trailing spaces"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -55,39 +53,39 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", whitespace_policy => { "ignore_trailing", "ignore_embedded" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/208.cf b/tests/acceptance/10_files/09_insert_lines/208.cf index e2e1a0f72e..6f154470a0 100644 --- a/tests/acceptance/10_files/09_insert_lines/208.cf +++ b/tests/acceptance/10_files/09_insert_lines/208.cf @@ -3,23 +3,21 @@ # Insert lines from a file, verify that pairs of whitespace_policy work # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -27,15 +25,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -45,7 +43,7 @@ END Three potatoe"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -54,39 +52,41 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", - whitespace_policy => { "ignore_leading", "ignore_trailing", "ignore_embedded" }; + whitespace_policy => { + "ignore_leading", "ignore_trailing", "ignore_embedded" + }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/212.cf b/tests/acceptance/10_files/09_insert_lines/212.cf index d4d8badc7b..991453a0dc 100644 --- a/tests/acceptance/10_files/09_insert_lines/212.cf +++ b/tests/acceptance/10_files/09_insert_lines/212.cf @@ -4,23 +4,21 @@ # ignore_trailing works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,39 +54,39 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", whitespace_policy => { "ignore_leading" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/213.cf b/tests/acceptance/10_files/09_insert_lines/213.cf index b345fd0ca8..0bfdf8ce3c 100644 --- a/tests/acceptance/10_files/09_insert_lines/213.cf +++ b/tests/acceptance/10_files/09_insert_lines/213.cf @@ -4,23 +4,21 @@ # ignore_embedded works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,39 +54,39 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", whitespace_policy => { "ignore_trailing" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/214.cf b/tests/acceptance/10_files/09_insert_lines/214.cf index e6bf01223c..92fc768536 100644 --- a/tests/acceptance/10_files/09_insert_lines/214.cf +++ b/tests/acceptance/10_files/09_insert_lines/214.cf @@ -4,23 +4,21 @@ # ignore_embedded works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,39 +54,39 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", whitespace_policy => { "ignore_leading", "ignore_trailing" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/215.cf b/tests/acceptance/10_files/09_insert_lines/215.cf index 9ba9137f75..501bb61725 100644 --- a/tests/acceptance/10_files/09_insert_lines/215.cf +++ b/tests/acceptance/10_files/09_insert_lines/215.cf @@ -4,23 +4,21 @@ # works when given a close-enough exact match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -46,7 +44,7 @@ END Three potatoe"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -55,39 +53,39 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", whitespace_policy => { "ignore_trailing" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/216.cf b/tests/acceptance/10_files/09_insert_lines/216.cf index f1aadedcfd..6fa820c82b 100644 --- a/tests/acceptance/10_files/09_insert_lines/216.cf +++ b/tests/acceptance/10_files/09_insert_lines/216.cf @@ -4,23 +4,21 @@ # works when given a close-enough exact match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -46,7 +44,7 @@ END Three potatoe"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -55,39 +53,39 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", whitespace_policy => { "ignore_leading" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/217.cf b/tests/acceptance/10_files/09_insert_lines/217.cf index b4885f3a99..c9fc1febee 100644 --- a/tests/acceptance/10_files/09_insert_lines/217.cf +++ b/tests/acceptance/10_files/09_insert_lines/217.cf @@ -4,23 +4,21 @@ # ignore_leading works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,39 +54,39 @@ Leading embedded and trailing spaces"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", whitespace_policy => { "ignore_embedded" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/218.cf b/tests/acceptance/10_files/09_insert_lines/218.cf index 36e31238d5..1c5dd14208 100644 --- a/tests/acceptance/10_files/09_insert_lines/218.cf +++ b/tests/acceptance/10_files/09_insert_lines/218.cf @@ -4,23 +4,21 @@ # ignore_leading works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,39 +54,39 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", whitespace_policy => { "ignore_trailing" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/219.cf b/tests/acceptance/10_files/09_insert_lines/219.cf index 1240046f65..989a2a56bb 100644 --- a/tests/acceptance/10_files/09_insert_lines/219.cf +++ b/tests/acceptance/10_files/09_insert_lines/219.cf @@ -4,23 +4,21 @@ # ignore_leading works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,40 +54,40 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", whitespace_policy => { "ignore_embedded", "ignore_trailing" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff_expected("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", - "yes"); + "any" + usebundle => dcs_check_diff_expected( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "yes" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/221.cf b/tests/acceptance/10_files/09_insert_lines/221.cf index dae1ce96fa..94de383567 100644 --- a/tests/acceptance/10_files/09_insert_lines/221.cf +++ b/tests/acceptance/10_files/09_insert_lines/221.cf @@ -4,23 +4,21 @@ # works when given a close-enough exact match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -46,7 +44,7 @@ END Three potatoe"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -55,39 +53,39 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", whitespace_policy => { "ignore_embedded" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/222.cf b/tests/acceptance/10_files/09_insert_lines/222.cf index f527cf73af..2108fc4978 100644 --- a/tests/acceptance/10_files/09_insert_lines/222.cf +++ b/tests/acceptance/10_files/09_insert_lines/222.cf @@ -4,23 +4,21 @@ # ignore_embedded works when given a not-close-enough match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected", "insert" }; + "states" slist => { "actual", "expected", "insert" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Two potatoes @@ -28,15 +26,15 @@ bundle agent init Four END"; - "insert" string => - " One potato + "insert" + string => " One potato Two potato Three potatoe Leading embedded and trailing spaces Four"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN One potato Two potato Two potatoes @@ -47,7 +45,7 @@ END Leading embedded and trailing spaces "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -56,39 +54,39 @@ END bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_insert("$(G.testfile).insert"); + "$(G.testfile).actual" edit_line => test_insert("$(G.testfile).insert"); } bundle edit_line test_insert(filename) { insert_lines: - "$(filename)" + "$(filename)" insert_type => "file", whitespace_policy => { "ignore_leading" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/300.cf b/tests/acceptance/10_files/09_insert_lines/300.cf index 86b361da0e..8e872a3954 100644 --- a/tests/acceptance/10_files/09_insert_lines/300.cf +++ b/tests/acceptance/10_files/09_insert_lines/300.cf @@ -3,23 +3,21 @@ # Test insertion of newlines (Issue 555) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "template", "expected" }; + "states" slist => { "template", "expected" }; - "template" string => - "## + "template" + string => "## # Sendmail Alias File # @(#)B11.23_LRaliases $Revision: 1.1.212.1 $ $Date: 99/09/13 15:13:16 $ # @@ -57,8 +55,8 @@ oracle : dcpds.dba@dcpds.cpms.osd.mil exinfac : dcpds.exits@dcpds.cpms.osd.mil applmgr : dcpds.dba@dcpds.cpms.osd.mil"; - "expected" string => - "## + "expected" + string => "## # Sendmail Alias File # @(#)B11.23_LRaliases $Revision: 1.1.212.1 $ $Date: 99/09/13 15:13:16 $ # @@ -98,7 +96,7 @@ applmgr : dcpds.dba@dcpds.cpms.osd.mil stgmgmt : :include:/etc/mail/aliases.stgmgmt"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -107,50 +105,46 @@ stgmgmt : :include:/etc/mail/aliases.stgmgmt"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { vars: - "MailAliases" slist => { "stgmgmt : :include:/etc/mail/aliases.stgmgmt" }; + "MailAliases" slist => { "stgmgmt : :include:/etc/mail/aliases.stgmgmt" }; files: - "$(G.testfile).actual" - edit_line => copy_and_append_lines("$(G.testfile).template", - "@(this.MailAliases)"), + "$(G.testfile).actual" + edit_line => copy_and_append_lines( + "$(G.testfile).template", "@(this.MailAliases)" + ), edit_defaults => empty, create => "true"; } - -bundle edit_line copy_and_append_lines(file,lines) +bundle edit_line copy_and_append_lines(file, lines) { insert_lines: - - "$(file)" - insert_type => "file"; - - "$(lines)" - insert_type => "string"; - + "$(file)" insert_type => "file"; + "$(lines)" insert_type => "string"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/301.cf b/tests/acceptance/10_files/09_insert_lines/301.cf index c72478cd02..1bb429491d 100644 --- a/tests/acceptance/10_files/09_insert_lines/301.cf +++ b/tests/acceptance/10_files/09_insert_lines/301.cf @@ -3,23 +3,21 @@ # Test that specifying whitespace_policy escapes meta-characters (Issue 644) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "expected" string => "*foobar*"; + "expected" string => "*foobar*"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert("$(init.expected)"), edit_defaults => init_empty; @@ -28,21 +26,19 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - - "$(G.testfile).actual" + "$(G.testfile).actual" edit_line => set_value_rev, create => "true"; } @@ -50,18 +46,19 @@ bundle agent test bundle edit_line set_value_rev { insert_lines: - "*foobar*" - whitespace_policy => { "ignore_embedded" }; + "*foobar*" whitespace_policy => { "ignore_embedded" }; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/302.cf b/tests/acceptance/10_files/09_insert_lines/302.cf index bbb188062b..f4161f9cf8 100644 --- a/tests/acceptance/10_files/09_insert_lines/302.cf +++ b/tests/acceptance/10_files/09_insert_lines/302.cf @@ -4,31 +4,27 @@ # This will cause content won't be added to file. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "actual" string => "[quux] + "actual" string => "[quux] bar "; - - "expected" string => "[quux] + "expected" string => "[quux] bar "; - - "files" slist => { "actual", "expected" }; + "files" slist => { "actual", "expected" }; files: - "$(G.testfile).$(files)" + "$(G.testfile).$(files)" create => "true", edit_line => init_insert("$(init.$(files))"), edit_defaults => init_empty; @@ -37,51 +33,51 @@ bar bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => example_edit_line; + "$(G.testfile).actual" edit_line => example_edit_line; } bundle edit_line example_edit_line { insert_lines: - "foo" + "foo" select_region => example_select, location => example_location; } body select_region example_select { - select_start => "\[quux\]"; - select_end => "\[.*\]"; + select_start => "\[quux\]"; + select_end => "\[.*\]"; } body location example_location { - select_line_matching => "bar"; - before_after => "after"; + select_line_matching => "bar"; + before_after => "after"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/303.cf b/tests/acceptance/10_files/09_insert_lines/303.cf index d467ea5620..6a50f64e06 100644 --- a/tests/acceptance/10_files/09_insert_lines/303.cf +++ b/tests/acceptance/10_files/09_insert_lines/303.cf @@ -3,43 +3,48 @@ # ISSUE 1023 # ######################################################## - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ######################################################## - bundle agent init { vars: - "actual1qaz" string => ""; - "actual2qaz" string => ""; - "actual3qaz" string => ""; + "actual1qaz" string => ""; + "actual2qaz" string => ""; + "actual3qaz" string => ""; + "expected1qaz" string => "AAAA"; + "expected2qaz" string => "AAAA"; + "expected3qaz" string => "AAAA"; - "expected1qaz" string => "AAAA"; - "expected2qaz" string => "AAAA"; - "expected3qaz" string => "AAAA"; + "files" + slist => { + "actual1qaz", + "expected1qaz", + "actual2qaz", + "expected2qaz", + "actual3qaz", + "expected3qaz", + }; - "files" slist => { "actual1qaz", "expected1qaz", "actual2qaz", "expected2qaz", - "actual3qaz", "expected3qaz" }; - - files: - "$(G.testfile).actual1qaz" touch => "true"; - "$(G.testfile).actual2qaz" touch => "true"; - "$(G.testfile).actual3qaz" touch => "true"; + "$(G.testfile).actual1qaz" touch => "true"; + "$(G.testfile).actual2qaz" touch => "true"; + "$(G.testfile).actual3qaz" touch => "true"; - "$(G.testfile).expected1qaz" + "$(G.testfile).expected1qaz" touch => "true", edit_line => init_insert("$(expected1qaz)"); - "$(G.testfile).expected2qaz" + + "$(G.testfile).expected2qaz" touch => "true", edit_line => init_insert("$(expected1qaz)"); - "$(G.testfile).expected3qaz" + + "$(G.testfile).expected3qaz" touch => "true", edit_line => init_insert("$(expected1qaz)"); } @@ -47,22 +52,23 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle agent test { meta: - "test_suppress_fail" string => "windows", - meta => { "redmine5120" }; + "test_suppress_fail" + string => "windows", + meta => { "redmine5120" }; files: - "$(G.testfile).(actual)?\dq.*" + "$(G.testfile).(actual)?\dq.*" pathtype => "regex", edit_line => example_edit_line; } @@ -70,21 +76,33 @@ bundle agent test bundle edit_line example_edit_line { insert_lines: - "AAAA"; + "AAAA"; } bundle agent check { methods: - "first" usebundle => dcs_check_diff("$(G.testfile).actual1qaz", - "$(G.testfile).expected1qaz", - "$(this.promise_filename)"); - "second" usebundle => dcs_check_diff("$(G.testfile).actual2qaz", - "$(G.testfile).expected2qaz", - "$(this.promise_filename)"); - "third" usebundle => dcs_check_diff("$(G.testfile).actual3qaz", - "$(G.testfile).expected3qaz", - "$(this.promise_filename)"); + "first" + usebundle => dcs_check_diff( + "$(G.testfile).actual1qaz", + "$(G.testfile).expected1qaz", + "$(this.promise_filename)" + ); + + "second" + usebundle => dcs_check_diff( + "$(G.testfile).actual2qaz", + "$(G.testfile).expected2qaz", + "$(this.promise_filename)" + ); + + "third" + usebundle => dcs_check_diff( + "$(G.testfile).actual3qaz", + "$(G.testfile).expected3qaz", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/09_insert_lines/400.cf b/tests/acceptance/10_files/09_insert_lines/400.cf index e38c52fa49..e0935f25e5 100644 --- a/tests/acceptance/10_files/09_insert_lines/400.cf +++ b/tests/acceptance/10_files/09_insert_lines/400.cf @@ -1,8 +1,8 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -21,12 +21,12 @@ bundle agent test bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle agent check @@ -38,6 +38,7 @@ bundle agent check reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/09_insert_lines/block_insert_duplicate.cf b/tests/acceptance/10_files/09_insert_lines/block_insert_duplicate.cf index d97d8f04c1..6a61286002 100644 --- a/tests/acceptance/10_files/09_insert_lines/block_insert_duplicate.cf +++ b/tests/acceptance/10_files/09_insert_lines/block_insert_duplicate.cf @@ -4,51 +4,52 @@ # verify that insertion is convergent - Redmine #1525 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "header" string => "############### + "header" + string => "############### ### This file is managed by CFEngine ### Do not update it manually, oh no ### do not ###############"; files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => insert_header; commands: - !windows:: + !windows:: "$(G.echo)" - args => "\"${init.header}\" > \"$(G.testfile).actual\"", + args => "\"${init.header}\" > \"$(G.testfile).actual\"", contain => in_shell; - windows:: # newlines in shell are not handled properly on Windows... + + windows:: + # newlines in shell are not handled properly on Windows... "$(G.printf)" args => '"###############\n### This file is managed by CFEngine\n### Do not update it manually, oh no\n### do not\n###############\n" > "$(G.testfile).actual"', contain => in_shell; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10254" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10254" }; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => insert_header; } @@ -61,15 +62,16 @@ bundle edit_line insert_header insert_type => "preserve_block"; } - ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/block_insert_order.cf b/tests/acceptance/10_files/09_insert_lines/block_insert_order.cf index 036097f4e5..d6a4490ad7 100644 --- a/tests/acceptance/10_files/09_insert_lines/block_insert_order.cf +++ b/tests/acceptance/10_files/09_insert_lines/block_insert_order.cf @@ -4,20 +4,18 @@ # works when given a close-enough exact match # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert, edit_defaults => init_empty; @@ -26,21 +24,20 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "line1 + "line1 line2"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; } @@ -48,23 +45,25 @@ bundle agent test bundle edit_line test_insert { delete_lines: - ".*"; + ".*"; insert_lines: - "line1 + "line1 line2" insert_type => "preserve_block", location => start; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/crlf-in-cftemplate.cf b/tests/acceptance/10_files/09_insert_lines/crlf-in-cftemplate.cf index dd32a9cf66..209c40cd85 100644 --- a/tests/acceptance/10_files/09_insert_lines/crlf-in-cftemplate.cf +++ b/tests/acceptance/10_files/09_insert_lines/crlf-in-cftemplate.cf @@ -1,7 +1,6 @@ ############################################################################## # Test that CRLF is handled correctly on Windows. ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; @@ -10,24 +9,22 @@ body common control } ####################################################### - bundle agent init { meta: - "test_skip_unsupported" string => "!windows"; + "test_skip_unsupported" string => "!windows"; vars: - "datadir" string => "$(this.promise_dirname)/crlf_data"; - "filelist" slist => { "file-with-lf.txt", - "file-with-crlf.txt", - "file-with-mixed-eol.txt" - }; + "datadir" string => "$(this.promise_dirname)/crlf_data"; + + "filelist" + slist => { + "file-with-lf.txt", "file-with-crlf.txt", "file-with-mixed-eol.txt" + }; files: - "$(G.testdir)/." - create => "yes"; - "$(G.testdir)/$(filelist)" - copy_from => copy_file("$(filelist)"); + "$(G.testdir)/." create => "yes"; + "$(G.testdir)/$(filelist)" copy_from => copy_file("$(filelist)"); } body copy_from copy_file(file) @@ -36,47 +33,58 @@ body copy_from copy_file(file) } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; files: - "$(G.testdir)/$(init.filelist)" - edit_template => "$(init.datadir)/$(init.filelist).cftemplate", - template_method => "cfengine"; + "$(G.testdir)/$(init.filelist)" + edit_template => "$(init.datadir)/$(init.filelist).cftemplate", + template_method => "cfengine"; } ####################################################### - bundle agent check { vars: - "ok_classes" slist => { "diff_ok_file_with_lf_txt", - "diff_ok_file_with_crlf_txt", - "diff_ok_file_with_mixed_eol_txt", - "size_ok_file_with_lf_txt", - "size_ok_file_with_crlf_txt", - "size_ok_file_with_mixed_eol_txt" - }; - "classes_set" slist => classesmatching("(diff|size)_ok.*"); + "ok_classes" + slist => { + "diff_ok_file_with_lf_txt", + "diff_ok_file_with_crlf_txt", + "diff_ok_file_with_mixed_eol_txt", + "size_ok_file_with_lf_txt", + "size_ok_file_with_crlf_txt", + "size_ok_file_with_mixed_eol_txt", + }; + + "classes_set" slist => classesmatching("(diff|size)_ok.*"); + classes: - "diff_ok_$(init.filelist)" expression => returnszero( - "$(G.diff) $(G.testdir)/$(init.filelist) $(init.datadir)/$(init.filelist).expected >$(G.dev_null) 2>&1", - "useshell"); - "size_ok_$(init.filelist)" expression => strcmp(filestat("$(G.testdir)/$(init.filelist)", "size"), - filestat("$(init.datadir)/$(init.filelist).expected", "size")); + "diff_ok_$(init.filelist)" + expression => returnszero( + "$(G.diff) $(G.testdir)/$(init.filelist) $(init.datadir)/$(init.filelist).expected >$(G.dev_null) 2>&1", + "useshell" + ); + + "size_ok_$(init.filelist)" + expression => strcmp( + filestat("$(G.testdir)/$(init.filelist)", "size"), + filestat("$(init.datadir)/$(init.filelist).expected", "size") + ); - "ok" and => { @(ok_classes) }; + "ok" and => { @(ok_classes) }; reports: DEBUG.!ok:: "Classes expected: $(ok_classes)"; "Classes actually set: $(classes_set)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/09_insert_lines/crlf-in-edit_line-insert-file.cf b/tests/acceptance/10_files/09_insert_lines/crlf-in-edit_line-insert-file.cf index c046897af1..ef42d77a6a 100644 --- a/tests/acceptance/10_files/09_insert_lines/crlf-in-edit_line-insert-file.cf +++ b/tests/acceptance/10_files/09_insert_lines/crlf-in-edit_line-insert-file.cf @@ -1,7 +1,6 @@ ############################################################################## # Test that CRLF is handled correctly on Windows. ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; @@ -10,24 +9,22 @@ body common control } ####################################################### - bundle agent init { meta: - "test_skip_unsupported" string => "!windows"; + "test_skip_unsupported" string => "!windows"; vars: - "datadir" string => "$(this.promise_dirname)/crlf_data"; - "filelist" slist => { "file-with-lf.txt", - "file-with-crlf.txt", - "file-with-mixed-eol.txt" - }; + "datadir" string => "$(this.promise_dirname)/crlf_data"; + + "filelist" + slist => { + "file-with-lf.txt", "file-with-crlf.txt", "file-with-mixed-eol.txt" + }; files: - "$(G.testdir)/." - create => "yes"; - "$(G.testdir)/$(filelist)" - copy_from => copy_file("$(filelist)"); + "$(G.testdir)/." create => "yes"; + "$(G.testdir)/$(filelist)" copy_from => copy_file("$(filelist)"); } body copy_from copy_file(file) @@ -36,68 +33,78 @@ body copy_from copy_file(file) } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; files: - "$(G.testdir)/$(init.filelist)" - edit_line => insert_line; + "$(G.testdir)/$(init.filelist)" edit_line => insert_line; } bundle edit_line insert_line { insert_lines: - "Inserted line" - select_region => second_line; - "$(init.datadir)/insert_file.txt" - insert_type => "file", - select_region => third_line; + "Inserted line" select_region => second_line; + + "$(init.datadir)/insert_file.txt" + insert_type => "file", + select_region => third_line; } body select_region second_line { select_start => "alpha"; - select_end => "beta"; + select_end => "beta"; } body select_region third_line { select_start => "beta"; - select_end => "charlie"; + select_end => "charlie"; } ####################################################### - bundle agent check { vars: - "ok_classes" slist => { "diff_ok_file_with_lf_txt", - "diff_ok_file_with_crlf_txt", - "diff_ok_file_with_mixed_eol_txt", - "size_ok_file_with_lf_txt", - "size_ok_file_with_crlf_txt", - "size_ok_file_with_mixed_eol_txt" - }; - "classes_set" slist => classesmatching("(diff|size)_ok.*"); + "ok_classes" + slist => { + "diff_ok_file_with_lf_txt", + "diff_ok_file_with_crlf_txt", + "diff_ok_file_with_mixed_eol_txt", + "size_ok_file_with_lf_txt", + "size_ok_file_with_crlf_txt", + "size_ok_file_with_mixed_eol_txt", + }; + + "classes_set" slist => classesmatching("(diff|size)_ok.*"); + classes: - "diff_ok_$(init.filelist)" expression => returnszero( - "$(G.diff) $(G.testdir)/$(init.filelist) $(init.datadir)/$(init.filelist).expected >$(G.dev_null) 2>&1", - "useshell"); - "size_ok_$(init.filelist)" expression => strcmp(filestat("$(G.testdir)/$(init.filelist)", "size"), - filestat("$(init.datadir)/$(init.filelist).expected", "size")); + "diff_ok_$(init.filelist)" + expression => returnszero( + "$(G.diff) $(G.testdir)/$(init.filelist) $(init.datadir)/$(init.filelist).expected >$(G.dev_null) 2>&1", + "useshell" + ); + + "size_ok_$(init.filelist)" + expression => strcmp( + filestat("$(G.testdir)/$(init.filelist)", "size"), + filestat("$(init.datadir)/$(init.filelist).expected", "size") + ); - "ok" and => { @(ok_classes) }; + "ok" and => { @(ok_classes) }; reports: DEBUG.!ok:: "Classes expected: $(ok_classes)"; "Classes actually set: $(classes_set)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/09_insert_lines/crlf-in-edit_line.cf b/tests/acceptance/10_files/09_insert_lines/crlf-in-edit_line.cf index a565418857..24eeaa317f 100644 --- a/tests/acceptance/10_files/09_insert_lines/crlf-in-edit_line.cf +++ b/tests/acceptance/10_files/09_insert_lines/crlf-in-edit_line.cf @@ -1,7 +1,6 @@ ############################################################################## # Test that CRLF is handled correctly on Windows. ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; @@ -10,24 +9,22 @@ body common control } ####################################################### - bundle agent init { meta: - "test_skip_unsupported" string => "!windows"; + "test_skip_unsupported" string => "!windows"; vars: - "datadir" string => "$(this.promise_dirname)/crlf_data"; - "filelist" slist => { "file-with-lf.txt", - "file-with-crlf.txt", - "file-with-mixed-eol.txt" - }; + "datadir" string => "$(this.promise_dirname)/crlf_data"; + + "filelist" + slist => { + "file-with-lf.txt", "file-with-crlf.txt", "file-with-mixed-eol.txt" + }; files: - "$(G.testdir)/." - create => "yes"; - "$(G.testdir)/$(filelist)" - copy_from => copy_file("$(filelist)"); + "$(G.testdir)/." create => "yes"; + "$(G.testdir)/$(filelist)" copy_from => copy_file("$(filelist)"); } body copy_from copy_file(file) @@ -36,69 +33,77 @@ body copy_from copy_file(file) } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; files: - "$(G.testdir)/$(init.filelist)" - edit_line => insert_line; + "$(G.testdir)/$(init.filelist)" edit_line => insert_line; } bundle edit_line insert_line { insert_lines: - "Inserted line" - select_region => second_line; - "Inserted block + "Inserted line" select_region => second_line; + "Inserted block Block line 1 -Block line 2" - select_region => third_line; +Block line 2" select_region => third_line; } body select_region second_line { select_start => "alpha"; - select_end => "beta"; + select_end => "beta"; } body select_region third_line { select_start => "beta"; - select_end => "charlie"; + select_end => "charlie"; } ####################################################### - bundle agent check { vars: - "ok_classes" slist => { "diff_ok_file_with_lf_txt", - "diff_ok_file_with_crlf_txt", - "diff_ok_file_with_mixed_eol_txt", - "size_ok_file_with_lf_txt", - "size_ok_file_with_crlf_txt", - "size_ok_file_with_mixed_eol_txt" - }; - "classes_set" slist => classesmatching("(diff|size)_ok.*"); + "ok_classes" + slist => { + "diff_ok_file_with_lf_txt", + "diff_ok_file_with_crlf_txt", + "diff_ok_file_with_mixed_eol_txt", + "size_ok_file_with_lf_txt", + "size_ok_file_with_crlf_txt", + "size_ok_file_with_mixed_eol_txt", + }; + + "classes_set" slist => classesmatching("(diff|size)_ok.*"); + classes: - "diff_ok_$(init.filelist)" expression => returnszero( - "$(G.diff) $(G.testdir)/$(init.filelist) $(init.datadir)/$(init.filelist).expected >$(G.dev_null) 2>&1", - "useshell"); - "size_ok_$(init.filelist)" expression => strcmp(filestat("$(G.testdir)/$(init.filelist)", "size"), - filestat("$(init.datadir)/$(init.filelist).expected", "size")); + "diff_ok_$(init.filelist)" + expression => returnszero( + "$(G.diff) $(G.testdir)/$(init.filelist) $(init.datadir)/$(init.filelist).expected >$(G.dev_null) 2>&1", + "useshell" + ); + + "size_ok_$(init.filelist)" + expression => strcmp( + filestat("$(G.testdir)/$(init.filelist)", "size"), + filestat("$(init.datadir)/$(init.filelist).expected", "size") + ); - "ok" and => { @(ok_classes) }; + "ok" and => { @(ok_classes) }; reports: DEBUG.!ok:: "Classes expected: $(ok_classes)"; "Classes actually set: $(classes_set)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/09_insert_lines/crlf-in-mustache.cf b/tests/acceptance/10_files/09_insert_lines/crlf-in-mustache.cf index fb3043512f..1bdadc775b 100644 --- a/tests/acceptance/10_files/09_insert_lines/crlf-in-mustache.cf +++ b/tests/acceptance/10_files/09_insert_lines/crlf-in-mustache.cf @@ -1,7 +1,6 @@ ############################################################################## # Test that CRLF is handled correctly on Windows. ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; @@ -10,24 +9,22 @@ body common control } ####################################################### - bundle agent init { meta: - "test_skip_unsupported" string => "!windows"; + "test_skip_unsupported" string => "!windows"; vars: - "datadir" string => "$(this.promise_dirname)/crlf_data"; - "filelist" slist => { "file-with-lf.txt", - "file-with-crlf.txt", - "file-with-mixed-eol.txt" - }; + "datadir" string => "$(this.promise_dirname)/crlf_data"; + + "filelist" + slist => { + "file-with-lf.txt", "file-with-crlf.txt", "file-with-mixed-eol.txt" + }; files: - "$(G.testdir)/." - create => "yes"; - "$(G.testdir)/$(filelist)" - copy_from => copy_file("$(filelist)"); + "$(G.testdir)/." create => "yes"; + "$(G.testdir)/$(filelist)" copy_from => copy_file("$(filelist)"); } body copy_from copy_file(file) @@ -36,47 +33,58 @@ body copy_from copy_file(file) } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; files: - "$(G.testdir)/$(init.filelist)" - edit_template => "$(init.datadir)/$(init.filelist).mustache", - template_method => "mustache"; + "$(G.testdir)/$(init.filelist)" + edit_template => "$(init.datadir)/$(init.filelist).mustache", + template_method => "mustache"; } ####################################################### - bundle agent check { vars: - "ok_classes" slist => { "diff_ok_file_with_lf_txt", - "diff_ok_file_with_crlf_txt", - "diff_ok_file_with_mixed_eol_txt", - "size_ok_file_with_lf_txt", - "size_ok_file_with_crlf_txt", - "size_ok_file_with_mixed_eol_txt" - }; - "classes_set" slist => classesmatching("(diff|size)_ok.*"); + "ok_classes" + slist => { + "diff_ok_file_with_lf_txt", + "diff_ok_file_with_crlf_txt", + "diff_ok_file_with_mixed_eol_txt", + "size_ok_file_with_lf_txt", + "size_ok_file_with_crlf_txt", + "size_ok_file_with_mixed_eol_txt", + }; + + "classes_set" slist => classesmatching("(diff|size)_ok.*"); + classes: - "diff_ok_$(init.filelist)" expression => returnszero( - "$(G.diff) $(G.testdir)/$(init.filelist) $(init.datadir)/$(init.filelist).expected >$(G.dev_null) 2>&1", - "useshell"); - "size_ok_$(init.filelist)" expression => strcmp(filestat("$(G.testdir)/$(init.filelist)", "size"), - filestat("$(init.datadir)/$(init.filelist).expected", "size")); + "diff_ok_$(init.filelist)" + expression => returnszero( + "$(G.diff) $(G.testdir)/$(init.filelist) $(init.datadir)/$(init.filelist).expected >$(G.dev_null) 2>&1", + "useshell" + ); + + "size_ok_$(init.filelist)" + expression => strcmp( + filestat("$(G.testdir)/$(init.filelist)", "size"), + filestat("$(init.datadir)/$(init.filelist).expected", "size") + ); - "ok" and => { @(ok_classes) }; + "ok" and => { @(ok_classes) }; reports: DEBUG.!ok:: "Classes expected: $(ok_classes)"; "Classes actually set: $(classes_set)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/09_insert_lines/edit_line_bundle_called_from_namespace.cf b/tests/acceptance/10_files/09_insert_lines/edit_line_bundle_called_from_namespace.cf index d6df1b7c42..4fe058550a 100644 --- a/tests/acceptance/10_files/09_insert_lines/edit_line_bundle_called_from_namespace.cf +++ b/tests/acceptance/10_files/09_insert_lines/edit_line_bundle_called_from_namespace.cf @@ -3,20 +3,20 @@ # Call an edit_line bundle from another namespace # ####################################################### - body common control { - inputs => { "../../default.sub.cf", "edit_line_bundle_called_from_namespace.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { + "../../default.sub.cf", "edit_line_bundle_called_from_namespace.cf.sub" + }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert, edit_defaults => init_empty; @@ -25,36 +25,38 @@ bundle agent init bundle edit_line init_insert { insert_lines: - "Hello"; + "Hello"; } bundle edit_line simple_insert(line) { insert_lines: - "$(line)"; + "$(line)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { methods: - "jump" usebundle => testing_namespace:namespaced_test("$(G.testfile).actual"); + "jump" + usebundle => testing_namespace:namespaced_test("$(G.testfile).actual"); } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/insert-large-lines.cf b/tests/acceptance/10_files/09_insert_lines/insert-large-lines.cf index 35faab8fa4..411572685c 100644 --- a/tests/acceptance/10_files/09_insert_lines/insert-large-lines.cf +++ b/tests/acceptance/10_files/09_insert_lines/insert-large-lines.cf @@ -1,8 +1,7 @@ - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } @@ -10,6 +9,7 @@ bundle agent test { vars: "data" string => readfile("$(this.promise_filename).txt", "16431"); + files: "$(G.testfile).actual" create => "true", @@ -31,7 +31,10 @@ body edit_defaults init_empty bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(this.promise_filename).txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(this.promise_filename).txt", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/10_files/09_insert_lines/insert_line_end_do_not_match_eof_control_body.cf b/tests/acceptance/10_files/09_insert_lines/insert_line_end_do_not_match_eof_control_body.cf index bc15bfe4e0..a7ffd0d472 100644 --- a/tests/acceptance/10_files/09_insert_lines/insert_line_end_do_not_match_eof_control_body.cf +++ b/tests/acceptance/10_files/09_insert_lines/insert_line_end_do_not_match_eof_control_body.cf @@ -5,38 +5,34 @@ # overriding global body common control. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } body agent control { - select_end_match_eof => "true"; + select_end_match_eof => "true"; } ####################################################### - bundle agent init { vars: - "actual" string => "[quux] + "actual" string => "[quux] bar foo "; - - "expected" string => "[quux] + "expected" string => "[quux] bar foo "; - - "files" slist => { "actual", "expected" }; + "files" slist => { "actual", "expected" }; files: - "$(G.testfile).$(files)" + "$(G.testfile).$(files)" create => "true", edit_line => init_insert("$(init.$(files))"), edit_defaults => init_empty; @@ -45,52 +41,52 @@ foo bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => example_edit_line; + "$(G.testfile).actual" edit_line => example_edit_line; } bundle edit_line example_edit_line { insert_lines: - "foo" + "foo" select_region => example_select, location => example_location; } body select_region example_select { - select_start => "\[quux\]"; - select_end => "\[.*\]"; - select_end_match_eof => "false"; + select_start => "\[quux\]"; + select_end => "\[.*\]"; + select_end_match_eof => "false"; } body location example_location { - select_line_matching => "bar"; - before_after => "after"; + select_line_matching => "bar"; + before_after => "after"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/insert_line_end_match_eof.cf b/tests/acceptance/10_files/09_insert_lines/insert_line_end_match_eof.cf index 6070a93858..34101933fa 100644 --- a/tests/acceptance/10_files/09_insert_lines/insert_line_end_match_eof.cf +++ b/tests/acceptance/10_files/09_insert_lines/insert_line_end_match_eof.cf @@ -4,32 +4,28 @@ # anything but select_end_match_eof is true. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "actual" string => "[quux] + "actual" string => "[quux] bar "; - - "expected" string => "[quux] + "expected" string => "[quux] bar foo "; - - "files" slist => { "actual", "expected" }; + "files" slist => { "actual", "expected" }; files: - "$(G.testfile).$(files)" + "$(G.testfile).$(files)" create => "true", edit_line => init_insert("$(init.$(files))"), edit_defaults => init_empty; @@ -38,52 +34,52 @@ foo bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => example_edit_line; + "$(G.testfile).actual" edit_line => example_edit_line; } bundle edit_line example_edit_line { insert_lines: - "foo" + "foo" select_region => example_select, location => example_location; } body select_region example_select { - select_start => "\[quux\]"; - select_end => "\[.*\]"; - select_end_match_eof => "true"; + select_start => "\[quux\]"; + select_end => "\[.*\]"; + select_end_match_eof => "true"; } body location example_location { - select_line_matching => "bar"; - before_after => "after"; + select_line_matching => "bar"; + before_after => "after"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/insert_line_end_match_eof_control_body.cf b/tests/acceptance/10_files/09_insert_lines/insert_line_end_match_eof_control_body.cf index 845c3dd94d..db104b516a 100644 --- a/tests/acceptance/10_files/09_insert_lines/insert_line_end_match_eof_control_body.cf +++ b/tests/acceptance/10_files/09_insert_lines/insert_line_end_match_eof_control_body.cf @@ -4,37 +4,33 @@ # anything and control body 'select_end_match_eof' is true. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } body agent control { - select_end_match_eof => "true"; + select_end_match_eof => "true"; } ####################################################### - bundle agent init { vars: - "actual" string => "[quux] + "actual" string => "[quux] bar "; - - "expected" string => "[quux] + "expected" string => "[quux] bar foo "; - - "files" slist => { "actual", "expected" }; + "files" slist => { "actual", "expected" }; files: - "$(G.testfile).$(files)" + "$(G.testfile).$(files)" create => "true", edit_line => init_insert("$(init.$(files))"), edit_defaults => init_empty; @@ -43,51 +39,51 @@ foo bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => example_edit_line; + "$(G.testfile).actual" edit_line => example_edit_line; } bundle edit_line example_edit_line { insert_lines: - "foo" + "foo" select_region => example_select, location => example_location; } body select_region example_select { - select_start => "\[quux\]"; - select_end => "\[.*\]"; + select_start => "\[quux\]"; + select_end => "\[.*\]"; } body location example_location { - select_line_matching => "bar"; - before_after => "after"; + select_line_matching => "bar"; + before_after => "after"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/insert_line_end_match_eof_default.cf b/tests/acceptance/10_files/09_insert_lines/insert_line_end_match_eof_default.cf index 5234111a91..20835e59be 100644 --- a/tests/acceptance/10_files/09_insert_lines/insert_line_end_match_eof_default.cf +++ b/tests/acceptance/10_files/09_insert_lines/insert_line_end_match_eof_default.cf @@ -2,35 +2,30 @@ # # Test matching EOF default value for select region. # -# ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "actual" string => "[quux] + "actual" string => "[quux] bar foo "; - - "expected" string => "[quux] + "expected" string => "[quux] bar foo "; - - "files" slist => { "actual", "expected" }; + "files" slist => { "actual", "expected" }; files: - "$(G.testfile).$(files)" + "$(G.testfile).$(files)" create => "true", edit_line => init_insert("$(init.$(files))"), edit_defaults => init_empty; @@ -39,51 +34,51 @@ foo bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" - edit_line => example_edit_line; + "$(G.testfile).actual" edit_line => example_edit_line; } bundle edit_line example_edit_line { insert_lines: - "foo" + "foo" select_region => example_select, location => example_location; } body select_region example_select { - select_start => "\[quux\]"; - select_end => "\[.*\]"; + select_start => "\[quux\]"; + select_end => "\[.*\]"; } body location example_location { - select_line_matching => "bar"; - before_after => "after"; + select_line_matching => "bar"; + before_after => "after"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/insertion-order-reversal.cf b/tests/acceptance/10_files/09_insert_lines/insertion-order-reversal.cf index 1507dd458f..2a006c8dbc 100644 --- a/tests/acceptance/10_files/09_insert_lines/insertion-order-reversal.cf +++ b/tests/acceptance/10_files/09_insert_lines/insertion-order-reversal.cf @@ -3,40 +3,37 @@ # Insert a number of lines, insuring they are not printed in reverse order (Issue 809) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN One potato Two potato Three potatoes Four END"; - - "insert" string => - "BEGIN + "insert" + string => "BEGIN Five potato Six potato Seven potatoe More! END"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN Five potato Six potato Seven potatoe @@ -44,7 +41,7 @@ END"; END"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -53,20 +50,19 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert("$(init.insert)"); } @@ -74,22 +70,25 @@ bundle agent test bundle edit_line test_insert(str) { delete_lines: - ".*"; + ".*"; insert_lines: - "$(str)" + "$(str)" insert_type => "preserve_block", location => start; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/09_insert_lines/multi-files-dirs.cf b/tests/acceptance/10_files/09_insert_lines/multi-files-dirs.cf index 955945ac98..310c8a6855 100644 --- a/tests/acceptance/10_files/09_insert_lines/multi-files-dirs.cf +++ b/tests/acceptance/10_files/09_insert_lines/multi-files-dirs.cf @@ -3,45 +3,42 @@ # Insert a line into variously named files, in various directories (Issue 888) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "expected", "$(results)" }; - "testdirs" slist => { "dirA/", "dirB/", "dirC/" }; - "testfiles" slist => { "dirA/testfa", "dirB/testfb", "dirC/testfc" }; + "states" slist => { "expected", "$(results)" }; + "testdirs" slist => { "dirA/", "dirB/", "dirC/" }; + "testfiles" slist => { "dirA/testfa", "dirB/testfb", "dirC/testfc" }; files: - "$(G.testdir)/$(testdirs)" - comment => "Create directory: $(testdirs)."; + "$(G.testdir)/$(testdirs)" comment => "Create directory: $(testdirs)."; - "$(G.testdir)/$(testfiles)" + "$(G.testdir)/$(testfiles)" comment => "Create target file: $(testfiles).", create => "true"; } ####################################################### - bundle agent test { meta: - "test_suppress_fail" string => "windows", - meta => { "redmine4853" }; + "test_suppress_fail" + string => "windows", + meta => { "redmine4853" }; files: any:: "$(G.testdir)/.*/testf.*" - create => "true", - edit_line => myedit; + create => "true", + edit_line => myedit; } bundle edit_line myedit @@ -52,26 +49,20 @@ bundle edit_line myedit } ####################################################### - bundle agent check { vars: - "expect" string => "one two three test"; - "results" slist => { "resultA", "resultB", "resultC" }; - - "resultA" string => readfile( - "$(G.testdir)/dirA/testfa", "33"); - "resultB" string => readfile( - "$(G.testdir)/dirB/testfb", "33"); - "resultC" string => readfile( - "$(G.testdir)/dirC/testfc", "33"); + "expect" string => "one two three test"; + "results" slist => { "resultA", "resultB", "resultC" }; + "resultA" string => readfile("$(G.testdir)/dirA/testfa", "33"); + "resultB" string => readfile("$(G.testdir)/dirB/testfb", "33"); + "resultC" string => readfile("$(G.testdir)/dirC/testfc", "33"); classes: - "ok_A" expression => strcmp("$(expect)", "$(resultA)"); - "ok_B" expression => strcmp("$(expect)", "$(resultB)"); - "ok_C" expression => strcmp("$(expect)", "$(resultC)"); - - "ok" and => { "ok_A", "ok_B", "ok_C" }; + "ok_A" expression => strcmp("$(expect)", "$(resultA)"); + "ok_B" expression => strcmp("$(expect)", "$(resultB)"); + "ok_C" expression => strcmp("$(expect)", "$(resultC)"); + "ok" and => { "ok_A", "ok_B", "ok_C" }; reports: DEBUG:: @@ -83,6 +74,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/09_insert_lines/namespaced_edit_line_bundle.cf b/tests/acceptance/10_files/09_insert_lines/namespaced_edit_line_bundle.cf index 54949f1a59..b0dfd42c2c 100644 --- a/tests/acceptance/10_files/09_insert_lines/namespaced_edit_line_bundle.cf +++ b/tests/acceptance/10_files/09_insert_lines/namespaced_edit_line_bundle.cf @@ -3,20 +3,18 @@ # Call an edit_line bundle from another namespace # ####################################################### - body common control { - inputs => { "../../default.sub.cf", "namespaced_edit_line_bundle.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "namespaced_edit_line_bundle.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert, edit_defaults => init_empty; @@ -25,33 +23,34 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "Hello"; + "Hello"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent test { files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_defaults => init_empty, edit_line => testing_namespace:simple_insert; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/nothing_to_repeat_error.cf b/tests/acceptance/10_files/09_insert_lines/nothing_to_repeat_error.cf index a986a4e971..4ea532a7fe 100644 --- a/tests/acceptance/10_files/09_insert_lines/nothing_to_repeat_error.cf +++ b/tests/acceptance/10_files/09_insert_lines/nothing_to_repeat_error.cf @@ -3,23 +3,24 @@ # catch "nothing to repeat" error in file editing # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_output(".*info: Inserted the promised line.*", - ".*nothing to repeat.*", - "$(sys.cf_agent) -KI -f $(this.promise_filename).sub | $(G.grep) nofile", - $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + ".*info: Inserted the promised line.*", + ".*nothing to repeat.*", + "$(sys.cf_agent) -KI -f $(this.promise_filename).sub | $(G.grep) nofile", + $(this.promise_filename) + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/09_insert_lines/preserve_block_blank_lines.cf b/tests/acceptance/10_files/09_insert_lines/preserve_block_blank_lines.cf index 5df1cafc57..7981004797 100644 --- a/tests/acceptance/10_files/09_insert_lines/preserve_block_blank_lines.cf +++ b/tests/acceptance/10_files/09_insert_lines/preserve_block_blank_lines.cf @@ -1,10 +1,8 @@ # https://dev.cfengine.com/issues/7094 -# - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } @@ -28,11 +26,8 @@ bundle agent init bundle agent test { files: - "$(init.test_file)" - edit_line => add_bad(); - - "$(init.test_file)" - edit_line => add_bad2(); + "$(init.test_file)" edit_line => add_bad(); + "$(init.test_file)" edit_line => add_bad2(); } bundle agent check @@ -43,7 +38,6 @@ bundle agent check Bad 3 "; - "actual" string => readfile("$(init.test_file)", "inf"); classes: @@ -51,33 +45,29 @@ bundle agent check reports: DEBUG:: - "OK: Expected '$(expected)' == '$(actual)'" - if => "ok"; - - "FAIL: Expected '$(expected)' <> '$(actual)'" - if => "!ok"; + "OK: Expected '$(expected)' == '$(actual)'" if => "ok"; + "FAIL: Expected '$(expected)' <> '$(actual)'" if => "!ok"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; - } -bundle edit_line add_bad() { +bundle edit_line add_bad() +{ insert_lines: "Bad 1 Bad 2 - Bad 3" - insert_type => "preserve_block"; + Bad 3" insert_type => "preserve_block"; } -bundle edit_line add_bad2() { +bundle edit_line add_bad2() +{ insert_lines: " Bad 2 - Bad 3" - insert_type => "preserve_block"; - + Bad 3" insert_type => "preserve_block"; } diff --git a/tests/acceptance/10_files/09_insert_lines/same_text_in_two_regions.cf b/tests/acceptance/10_files/09_insert_lines/same_text_in_two_regions.cf index bbc70892c3..c1a8059d26 100644 --- a/tests/acceptance/10_files/09_insert_lines/same_text_in_two_regions.cf +++ b/tests/acceptance/10_files/09_insert_lines/same_text_in_two_regions.cf @@ -1,59 +1,60 @@ # Tests whether you can insert the same text into two regions. - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - "any" usebundle => file_make("$(G.testfile)", "block1 + "any" + usebundle => file_make("$(G.testfile)", "block1 block2 block3 block4"); - "any" usebundle => file_make("$(G.testfile).expected", "block1 + "any" + usebundle => file_make( + "$(G.testfile).expected", "block1 test1 block2 block3 test1 -block4"); +block4" + ); } bundle agent test { files: - "$(G.testfile)" - edit_line => insert_in_two_regions; + "$(G.testfile)" edit_line => insert_in_two_regions; } bundle edit_line insert_in_two_regions { insert_lines: - "test1" - select_region => sel1; - "test1" - select_region => sel2; + "test1" select_region => sel1; + "test1" select_region => sel2; } body select_region sel1 { - select_start => "block1"; - select_end => "block2"; + select_start => "block1"; + select_end => "block2"; } body select_region sel2 { - select_start => "block3"; - select_end => "block4"; + select_start => "block3"; + select_end => "block4"; } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile)", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile)", "$(G.testfile).expected", "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/10_files/09_insert_lines/selectlinematching.cf b/tests/acceptance/10_files/09_insert_lines/selectlinematching.cf index 292b1539ec..85a46cbf12 100644 --- a/tests/acceptance/10_files/09_insert_lines/selectlinematching.cf +++ b/tests/acceptance/10_files/09_insert_lines/selectlinematching.cf @@ -24,7 +24,6 @@ # December 2013 # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; @@ -33,14 +32,11 @@ body common control } ####################################################### - bundle agent init { - } ####################################################### - bundle agent test { vars: @@ -48,8 +44,17 @@ bundle agent test # Run subtests. Need to be in verbose mode to see the output. # The full verbose output is too big for variable assignment here. # So extract (grep) only potentially interesting lines. - "subout_1" string => execresult("$(sys.cf_agent) -Kv -f $(this.promise_filename).sub_1 2>&1 | $(G.egrep) -i 'select_line_matching'", "useshell"); - "subout_2" string => execresult("$(sys.cf_agent) -Kv -f $(this.promise_filename).sub_2 2>&1 | $(G.egrep) -i 'select_line_matching'", "useshell"); + "subout_1" + string => execresult( + "$(sys.cf_agent) -Kv -f $(this.promise_filename).sub_1 2>&1 | $(G.egrep) -i 'select_line_matching'", + "useshell" + ); + + "subout_2" + string => execresult( + "$(sys.cf_agent) -Kv -f $(this.promise_filename).sub_2 2>&1 | $(G.egrep) -i 'select_line_matching'", + "useshell" + ); reports: DEBUG:: @@ -60,9 +65,7 @@ bundle agent test "bundle test: subout_2: $(subout_2)"; } - ####################################################### - bundle agent check { vars: @@ -91,6 +94,7 @@ bundle agent check ok_pattern_1.ok_pattern_2:: "$(this.promise_filename) Pass"; + !(ok_pattern_1.ok_pattern_2):: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/09_insert_lines/staging/304.cf b/tests/acceptance/10_files/09_insert_lines/staging/304.cf index f1f5645e39..21be875a20 100644 --- a/tests/acceptance/10_files/09_insert_lines/staging/304.cf +++ b/tests/acceptance/10_files/09_insert_lines/staging/304.cf @@ -1,23 +1,21 @@ body common control { - inputs => { "../../default.sub.cf", "304.cf.namespaced.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "304.cf.namespaced.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ######################################################## - bundle agent init { vars: - "expected" slist => { "var1=value1" }; - - "files" slist => { "actual", "expected" }; + "expected" slist => { "var1=value1" }; + "files" slist => { "actual", "expected" }; files: - "$(G.testfile).actual" touch => "true"; + "$(G.testfile).actual" touch => "true"; - "$(G.testfile).expected" + "$(G.testfile).expected" touch => "true", edit_defaults => init_empty, edit_line => init_insert("$(expected)"); @@ -26,27 +24,31 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } bundle agent test { methods: - "call" usebundle => cfdc_yumclient:config("$(G.testfile).actual", "2"); - "call" usebundle => cfdc_yumclient:config("$(G.testfile).actual", "1"); + "call" usebundle => cfdc_yumclient:config("$(G.testfile).actual", "2"); + "call" usebundle => cfdc_yumclient:config("$(G.testfile).actual", "1"); } bundle agent check { methods: - "first" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "first" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/10_links/001.cf b/tests/acceptance/10_files/10_links/001.cf index b3fe50bccc..ce8b769dcb 100644 --- a/tests/acceptance/10_files/10_links/001.cf +++ b/tests/acceptance/10_files/10_links/001.cf @@ -4,49 +4,45 @@ # warn. Related to bug #926. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: } ####################################################### - bundle agent test { files: - "$(G.testdir)/subdir/mylink" + "$(G.testdir)/subdir/mylink" link_from => ln_s("$(G.testdir)/sourcefile"), action => test_warn_only; } body action test_warn_only { - action_policy => "warn"; + action_policy => "warn"; } body link_from ln_s(x) { - link_type => "symlink"; - source => "$(x)"; - when_no_source => "force"; + link_type => "symlink"; + source => "$(x)"; + when_no_source => "force"; } ####################################################### - bundle agent check { classes: - "subdir_created" expression => fileexists("$(G.testdir)/subdir"); + "subdir_created" expression => fileexists("$(G.testdir)/subdir"); reports: !subdir_created:: diff --git a/tests/acceptance/10_files/10_links/002.cf b/tests/acceptance/10_files/10_links/002.cf index 97e5e546ba..a069de9bfc 100644 --- a/tests/acceptance/10_files/10_links/002.cf +++ b/tests/acceptance/10_files/10_links/002.cf @@ -4,42 +4,38 @@ # the current namespace. # ####################################################### - body common control { - inputs => { "../../default.sub.cf", "002-namespaced_links.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "002-namespaced_links.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: } ####################################################### - bundle agent test { methods: - "run" usebundle => testing_links:namespaced_test(); + "run" usebundle => testing_links:namespaced_test(); } body link_from ln_s(x) { - link_type => "symlink"; - source => "$(x)"; - when_no_source => "force"; + link_type => "symlink"; + source => "$(x)"; + when_no_source => "force"; } ####################################################### - bundle agent check { classes: - "subdir_created" expression => fileexists("$(G.testdir)/subdir"); + "subdir_created" expression => fileexists("$(G.testdir)/subdir"); reports: !subdir_created:: diff --git a/tests/acceptance/10_files/10_links/delete_dangling_symlink.cf b/tests/acceptance/10_files/10_links/delete_dangling_symlink.cf index 88be894aa2..92304bf15a 100644 --- a/tests/acceptance/10_files/10_links/delete_dangling_symlink.cf +++ b/tests/acceptance/10_files/10_links/delete_dangling_symlink.cf @@ -4,39 +4,33 @@ # https://dev.cfengine.com/issues/6582 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { files: - "$(G.testdir)/mylink" - link_from => ln_s("$(G.testdir)/sourcefile"); - - "$(G.testdir)/mylink" - delete => tidy; + "$(G.testdir)/mylink" link_from => ln_s("$(G.testdir)/sourcefile"); + "$(G.testdir)/mylink" delete => tidy; } body link_from ln_s(x) { - link_type => "symlink"; - source => "$(x)"; - when_no_source => "force"; + link_type => "symlink"; + source => "$(x)"; + when_no_source => "force"; } ####################################################### - bundle agent check { classes: - "link_absent" not => fileexists("$(G.testdir)/mylink"); + "link_absent" not => fileexists("$(G.testdir)/mylink"); reports: link_absent:: diff --git a/tests/acceptance/10_files/10_links/edit_linked_file.cf b/tests/acceptance/10_files/10_links/edit_linked_file.cf index e485bce20d..a664006b02 100644 --- a/tests/acceptance/10_files/10_links/edit_linked_file.cf +++ b/tests/acceptance/10_files/10_links/edit_linked_file.cf @@ -1,66 +1,81 @@ # Test that editing a symlink does not mangle it - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testdir)/file_dir/file" + "$(G.testdir)/file_dir/file" create => "true", edit_line => edit_init; - "$(G.testdir)/link_dir/." - create => "true"; - "$(G.testdir)/link_dir/link" - link_from => link_init; + + "$(G.testdir)/link_dir/." create => "true"; + "$(G.testdir)/link_dir/link" link_from => link_init; } bundle edit_line edit_init { insert_lines: - "Initial line"; + "Initial line"; } body link_from link_init { - link_type => "symlink"; - source => "../file_dir/file"; + link_type => "symlink"; + source => "../file_dir/file"; } bundle agent test { meta: - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; files: - "$(G.testdir)/link_dir/link" - edit_line => edit_test; + "$(G.testdir)/link_dir/link" edit_line => edit_test; } bundle edit_line edit_test { insert_lines: - "Added line"; + "Added line"; } bundle agent check { classes: - "link_ok" expression => islink("$(G.testdir)/link_dir/link"); - "file_ok" not => islink("$(G.testdir)/file_dir/file"); - "link_line_one_ok" expression => regline("Initial line", "$(G.testdir)/link_dir/link"); - "file_line_one_ok" expression => regline("Initial line", "$(G.testdir)/file_dir/file"); - "link_line_two_ok" expression => regline("Added line", "$(G.testdir)/link_dir/link"); - "file_line_two_ok" expression => regline("Added line", "$(G.testdir)/file_dir/file"); - "ok" and => { "link_ok", "file_ok", "link_line_one_ok", "file_line_one_ok", "link_line_two_ok", "file_line_two_ok" }; + "link_ok" expression => islink("$(G.testdir)/link_dir/link"); + "file_ok" not => islink("$(G.testdir)/file_dir/file"); + + "link_line_one_ok" + expression => regline("Initial line", "$(G.testdir)/link_dir/link"); + + "file_line_one_ok" + expression => regline("Initial line", "$(G.testdir)/file_dir/file"); + + "link_line_two_ok" + expression => regline("Added line", "$(G.testdir)/link_dir/link"); + + "file_line_two_ok" + expression => regline("Added line", "$(G.testdir)/file_dir/file"); + + "ok" + and => { + "link_ok", + "file_ok", + "link_line_one_ok", + "file_line_one_ok", + "link_line_two_ok", + "file_line_two_ok", + }; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/10_links/owner-mismatch-link-and-target.cf b/tests/acceptance/10_files/10_links/owner-mismatch-link-and-target.cf index bdb4cb7445..b000135e05 100755 --- a/tests/acceptance/10_files/10_links/owner-mismatch-link-and-target.cf +++ b/tests/acceptance/10_files/10_links/owner-mismatch-link-and-target.cf @@ -1,63 +1,64 @@ #!/var/cfengine/bin/cf-agent -f- body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - # The symlink is initially created with uid 0, the uid we expect in the end. # This tests that promising the uid of a symlink is not confused by the symlink target having a different uid # - We do not expect to see any REPAIR related to the UID of the symlink - "/tmp/symlink-target" - create => "true", - perms => uid(2); + "/tmp/symlink-target" + create => "true", + perms => uid(2); - "/tmp/symlink" - link_from => ln_s( "/tmp/symlink-target" ), - perms => uid(0); + "/tmp/symlink" + link_from => ln_s("/tmp/symlink-target"), + perms => uid(0); } bundle agent test { meta: - "description" -> { "CFE-3116" } - string => "Test that promising ownership of symlinks is not confused by target"; + "description" -> { "CFE-3116" } + string => "Test that promising ownership of symlinks is not confused by target"; - "test_skip_unsupported" string => "windows"; + "test_skip_unsupported" string => "windows"; files: - "/tmp/symlink" - handle => "link_1", - classes => results( "namespace", "link_1_uid" ), - perms => uid(0); - - "/tmp/symlink" - handle => "link_2", - classes => results( "namespace", "link_2_uid" ), - perms => uid(0); + "/tmp/symlink" + handle => "link_1", + classes => results("namespace", "link_1_uid"), + perms => uid(0); + + "/tmp/symlink" + handle => "link_2", + classes => results("namespace", "link_2_uid"), + perms => uid(0); } bundle agent check { classes: - "symlink_owner_ok" expression => strcmp( "0", filestat( "/tmp/symlink", "uid" ) ); - "pass" and => { "symlink_owner_ok" }; - "fail" or => { "link_1_uid_repaired", "link_2_uid_repaired" }; - reports: + "symlink_owner_ok" + expression => strcmp("0", filestat("/tmp/symlink", "uid")); + + "pass" and => { "symlink_owner_ok" }; + "fail" or => { "link_1_uid_repaired", "link_2_uid_repaired" }; - link_1_uid_repaired:: - "We think we repaired the UID of the symlink for promise with handle link_1"; + reports: + link_1_uid_repaired:: + "We think we repaired the UID of the symlink for promise with handle link_1"; - link_2_uid_repaired:: - "We think we repaired the UID of the symlink for promise with handle link_2"; + link_2_uid_repaired:: + "We think we repaired the UID of the symlink for promise with handle link_2"; - link_1_uid_repaired.link_2_uid_repaired:: - "We think we repaired the UID of the symlink multiple times"; + link_1_uid_repaired.link_2_uid_repaired:: + "We think we repaired the UID of the symlink multiple times"; symlink_owner_ok:: "The symlink is owned by uid 0 as expected"; @@ -67,10 +68,12 @@ bundle agent check pass.!fail:: "$(this.promise_filename) Pass"; + !pass|fail:: "$(this.promise_filename) FAIL"; } -body perms uid( uid ) + +body perms uid(uid) { owners => { "$(uid)" }; } @@ -80,15 +83,15 @@ body link_from ln_s(x) # The link is created even if the source of the link does not exist. # @param x The source of the link { - link_type => "symlink"; - source => "$(x)"; - when_no_source => "force"; + link_type => "symlink"; + source => "$(x)"; + when_no_source => "force"; } bundle agent __main__ { methods: - "init"; - "test"; - "check"; + "init"; + "test"; + "check"; } diff --git a/tests/acceptance/10_files/10_links/select_file_by_symlink_target.cf b/tests/acceptance/10_files/10_links/select_file_by_symlink_target.cf index 1c9b564867..30c9b0c9ea 100644 --- a/tests/acceptance/10_files/10_links/select_file_by_symlink_target.cf +++ b/tests/acceptance/10_files/10_links/select_file_by_symlink_target.cf @@ -4,16 +4,14 @@ # Ref: https://dev.cfengine.com/issues/6878 # ######################################################## - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: @@ -21,8 +19,7 @@ bundle agent init "target" string => "$(G.testdir)/target"; files: - "$(target)/." - create => "true"; + "$(target)/." create => "true"; "$(symlink)" link_from => linkfrom("$(target)", "symlink"), @@ -30,12 +27,10 @@ bundle agent init } ####################################################### - bundle agent test { meta: - "test_skip_unsupported" - string => "windows"; + "test_skip_unsupported" string => "windows"; # Delete the file only if it is a symlink pointing to the expected target files: @@ -45,12 +40,12 @@ bundle agent test pathtype => "literal", classes => scoped_classes_generic("namespace", "test_symlink"); } -####################################################### +####################################################### bundle agent check { classes: - "OK" not => fileexists("$(init.symlink)"); + "OK" not => fileexists("$(init.symlink)"); reports: OK:: @@ -62,15 +57,14 @@ bundle agent check ### PROJECT_ID: core ### CATEGORY_ID: 27 - body file_select symlinked_to(name) { - file_types => { "symlink" }; - issymlinkto => { "$(name)" }; - file_result => "issymlinkto"; + file_types => { "symlink" }; + issymlinkto => { "$(name)" }; + file_result => "issymlinkto"; } body delete nodir { - rmdirs => "false"; + rmdirs => "false"; } diff --git a/tests/acceptance/10_files/10_links/select_file_by_type.cf b/tests/acceptance/10_files/10_links/select_file_by_type.cf index 7cb83d3a6d..08c9567bfe 100644 --- a/tests/acceptance/10_files/10_links/select_file_by_type.cf +++ b/tests/acceptance/10_files/10_links/select_file_by_type.cf @@ -4,16 +4,14 @@ # # Ref: https://dev.cfengine.com/issues/6878 ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: @@ -21,11 +19,8 @@ bundle agent init "target" string => "$(G.testdir)/target"; files: - "$(target)/." - create => "true"; - - "$(symlink)" - delete => tidy; + "$(target)/." create => "true"; + "$(symlink)" delete => tidy; "$(symlink)" link_from => linkfrom("$(target)", "symlink"), @@ -35,19 +30,19 @@ bundle agent init ####################################################### bundle agent test { - files: - "$(init.symlink)" - file_select => select_type("symlink"), - delete => nodir, - pathtype => "literal", - classes => scoped_classes_generic("namespace", "test_symlink"); + files: + "$(init.symlink)" + file_select => select_type("symlink"), + delete => nodir, + pathtype => "literal", + classes => scoped_classes_generic("namespace", "test_symlink"); } -####################################################### +####################################################### bundle agent check { classes: - "OK" not => fileexists("$(init.symlink)"); + "OK" not => fileexists("$(init.symlink)"); reports: OK:: @@ -61,11 +56,11 @@ bundle agent check ### CATEGORY_ID: 27 body delete nodir { - rmdirs => "false"; + rmdirs => "false"; } body file_select select_type(type) { - file_types => { "$(type)" }; - file_result => "file_types"; + file_types => { "$(type)" }; + file_result => "file_types"; } diff --git a/tests/acceptance/10_files/11_xml_edits/CFE-3806.cf b/tests/acceptance/10_files/11_xml_edits/CFE-3806.cf index 7b04df0980..63edd449a1 100644 --- a/tests/acceptance/10_files/11_xml_edits/CFE-3806.cf +++ b/tests/acceptance/10_files/11_xml_edits/CFE-3806.cf @@ -1,14 +1,15 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "starting_xml" string => ' + "starting_xml" + string => ' Public For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted. @@ -17,59 +18,61 @@ bundle agent init '; files: - "$(G.testfile)-1.xml" - content => "$(starting_xml)"; - - "$(G.testfile)-2.xml" - content => "$(starting_xml)"; + "$(G.testfile)-1.xml" content => "$(starting_xml)"; + "$(G.testfile)-2.xml" content => "$(starting_xml)"; } + bundle agent test { meta: - "description" -> { "CFE-3806" } - string => "Test that trailing newline on insert_tree promisers do not remove ending tag for select_xpath"; + "description" -> { "CFE-3806" } + string => "Test that trailing newline on insert_tree promisers do not remove ending tag for select_xpath"; files: + "$(G.testfile)-1.xml" + edit_xml => insert_tree_with_trailing_newline("1.1.1.1", "tcp", "9443"); - "$(G.testfile)-1.xml" - edit_xml => insert_tree_with_trailing_newline("1.1.1.1", "tcp", "9443"); - - "$(G.testfile)-2.xml" - edit_xml => insert_tree_without_trailing_newline("1.1.1.1", "tcp", "9443"); + "$(G.testfile)-2.xml" + edit_xml => insert_tree_without_trailing_newline( + "1.1.1.1", "tcp", "9443" + ); } bundle agent check { methods: - "Pass/Fail" - usebundle => dcs_check_strcmp( readfile( "$(G.testfile)-1.xml"), - readfile( "$(G.testfile)-2.xml"), - $(this.promise_filename), "no" ); + "Pass/Fail" + usebundle => dcs_check_strcmp( + readfile("$(G.testfile)-1.xml"), + readfile("$(G.testfile)-2.xml"), + $(this.promise_filename), + "no" + ); } bundle edit_xml insert_tree_with_trailing_newline(source, protocol, port) { build_xpath: - "/zone"; + "/zone"; insert_tree: - ' + ' ' - select_xpath => "/zone"; - + select_xpath => "/zone"; } + bundle edit_xml insert_tree_without_trailing_newline(source, protocol, port) { build_xpath: - "/zone"; + "/zone"; insert_tree: - ' + ' ' - select_xpath => "/zone"; + select_xpath => "/zone"; } diff --git a/tests/acceptance/10_files/11_xml_edits/build_xpath_001.cf b/tests/acceptance/10_files/11_xml_edits/build_xpath_001.cf index b8b1d7d359..aae487bbdc 100644 --- a/tests/acceptance/10_files/11_xml_edits/build_xpath_001.cf +++ b/tests/acceptance/10_files/11_xml_edits/build_xpath_001.cf @@ -3,31 +3,29 @@ # File editing edit_xml - example for building an XPath in an empty file # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "expected" string => - " + "expected" + string => " cfe_alias"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_defaults => init_empty; - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert("$(init.expected)"), edit_defaults => init_empty; @@ -36,27 +34,28 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "xpath" string => - "/Server/Service/Engine/Host[ @name=\"cfe_host\" | Alias = cfe_alias ]"; + "xpath" + string => "/Server/Service/Engine/Host[ @name=\"cfe_host\" | Alias = cfe_alias ]"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_build("$(test.xpath)"); } @@ -64,17 +63,20 @@ bundle agent test bundle edit_xml test_build(str) { build_xpath: - "$(str)"; + "$(str)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/11_xml_edits/build_xpath_002.cf b/tests/acceptance/10_files/11_xml_edits/build_xpath_002.cf index 0a2e3dcaf3..7d3c80f373 100644 --- a/tests/acceptance/10_files/11_xml_edits/build_xpath_002.cf +++ b/tests/acceptance/10_files/11_xml_edits/build_xpath_002.cf @@ -3,31 +3,29 @@ # File editing edit_xml - example for building an XPath in a node in a non-empty file # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " "; - "expected" string => - " + "expected" + string => " cfe_alias"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -36,27 +34,28 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "xpath" string => - "/Server/Service/Engine/Host[ Alias = cfe_alias | @name=\"cfe_host\" ]"; + "xpath" + string => "/Server/Service/Engine/Host[ Alias = cfe_alias | @name=\"cfe_host\" ]"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_build("$(test.xpath)"); } @@ -64,17 +63,21 @@ bundle agent test bundle edit_xml test_build(str) { build_xpath: - "$(str)"; + "$(str)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/11_xml_edits/build_xpath_003.cf b/tests/acceptance/10_files/11_xml_edits/build_xpath_003.cf index 1f93badfd2..e013a6b5da 100644 --- a/tests/acceptance/10_files/11_xml_edits/build_xpath_003.cf +++ b/tests/acceptance/10_files/11_xml_edits/build_xpath_003.cf @@ -3,31 +3,29 @@ # File editing edit_xml - example for building an XPath in a node in a non-empty file # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " "; - "expected" string => - " + "expected" + string => " cfe_alias"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -36,27 +34,28 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "xpath" string => - "/Server/Service/Engine/OneFish/TwoFish/RedFish/BlueFish/Host[ Alias = cfe_alias | @name=\"cfe_host\" ]"; + "xpath" + string => "/Server/Service/Engine/OneFish/TwoFish/RedFish/BlueFish/Host[ Alias = cfe_alias | @name=\"cfe_host\" ]"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_build("$(test.xpath)"); } @@ -64,17 +63,21 @@ bundle agent test bundle edit_xml test_build(str) { build_xpath: - "$(str)"; + "$(str)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/11_xml_edits/delete_attribute_001.cf b/tests/acceptance/10_files/11_xml_edits/delete_attribute_001.cf index 83b90719f2..f05317cd34 100644 --- a/tests/acceptance/10_files/11_xml_edits/delete_attribute_001.cf +++ b/tests/acceptance/10_files/11_xml_edits/delete_attribute_001.cf @@ -3,23 +3,21 @@ # File editing edit_xml # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " @@ -29,8 +27,8 @@ bundle agent init "; - "expected" string => - " + "expected" + string => " @@ -41,7 +39,7 @@ bundle agent init "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,26 +48,27 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "attribute_name" string => "topping"; + "attribute_name" string => "topping"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_delete_attribute("$(test.attribute_name)"); } @@ -77,18 +76,20 @@ bundle agent test bundle edit_xml test_delete_attribute(str) { delete_attribute: - "$(str)" - select_xpath => "/Potatoes/Potato[@topping=\'brocolli\']"; + "$(str)" select_xpath => "/Potatoes/Potato[@topping=\'brocolli\']"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/11_xml_edits/delete_attribute_002.cf b/tests/acceptance/10_files/11_xml_edits/delete_attribute_002.cf index b59a7c475d..ce1dd874c5 100644 --- a/tests/acceptance/10_files/11_xml_edits/delete_attribute_002.cf +++ b/tests/acceptance/10_files/11_xml_edits/delete_attribute_002.cf @@ -3,31 +3,29 @@ # File editing edit_xml # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " Nemo"; - "expected" string => - " + "expected" + string => " Nemo"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -36,26 +34,27 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "attribute_name" string => "type"; + "attribute_name" string => "type"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_delete("$(test.attribute_name)"); } @@ -63,19 +62,22 @@ bundle agent test bundle edit_xml test_delete(str) { delete_attribute: - "$(str)" + "$(str)" build_xpath => "/Server/Service/Engine/OneFish/TwoFish/RedFish/BlueFish", select_xpath => "/Server/Service/Engine/OneFish"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/11_xml_edits/delete_text_001.cf b/tests/acceptance/10_files/11_xml_edits/delete_text_001.cf index 2350d88376..60b1ab1289 100644 --- a/tests/acceptance/10_files/11_xml_edits/delete_text_001.cf +++ b/tests/acceptance/10_files/11_xml_edits/delete_text_001.cf @@ -3,23 +3,21 @@ # File editing edit_xml # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " Hot Potatoes!!! @@ -28,8 +26,8 @@ bundle agent init "; - "expected" string => - " + "expected" + string => " @@ -39,7 +37,7 @@ bundle agent init "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -48,26 +46,27 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "text" string => "Hot Potatoes!!!"; + "text" string => "Hot Potatoes!!!"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_delete("$(test.text)"); } @@ -75,18 +74,20 @@ bundle agent test bundle edit_xml test_delete(str) { delete_text: - "$(str)" - select_xpath => "/Potatoes/Potato[@name=\'OnePotato\']"; + "$(str)" select_xpath => "/Potatoes/Potato[@name=\'OnePotato\']"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/11_xml_edits/delete_text_002.cf b/tests/acceptance/10_files/11_xml_edits/delete_text_002.cf index c51144ee4b..bea29d5a9e 100644 --- a/tests/acceptance/10_files/11_xml_edits/delete_text_002.cf +++ b/tests/acceptance/10_files/11_xml_edits/delete_text_002.cf @@ -3,31 +3,29 @@ # File editing edit_xml # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " Nemo"; - "expected" string => - " + "expected" + string => " "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -36,26 +34,27 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "text" string => "Nemo"; + "text" string => "Nemo"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_delete("$(test.text)"); } @@ -63,19 +62,22 @@ bundle agent test bundle edit_xml test_delete(str) { delete_text: - "$(str)" + "$(str)" build_xpath => "/Server/Service/Engine/OneFish[@type=\'clownfish\']/TwoFish/RedFish/BlueFish", select_xpath => "/Server/Service/Engine/OneFish[@type=\'clownfish\']"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/11_xml_edits/delete_tree_001.cf b/tests/acceptance/10_files/11_xml_edits/delete_tree_001.cf index 8706dc3653..e08d8fa2a5 100644 --- a/tests/acceptance/10_files/11_xml_edits/delete_tree_001.cf +++ b/tests/acceptance/10_files/11_xml_edits/delete_tree_001.cf @@ -3,23 +3,21 @@ # File editing edit_xml # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " @@ -38,8 +36,8 @@ bundle agent init "; - "expected" string => - " + "expected" + string => " @@ -58,7 +56,7 @@ bundle agent init "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,28 +65,28 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "tree" string => - " + "tree" string => " "; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_delete("$(test.tree)"); } @@ -96,18 +94,21 @@ bundle agent test bundle edit_xml test_delete(str) { delete_tree: - "$(str)" - select_xpath => "/Potatoes/Potato[@name='OnePotato']"; + "$(str)" select_xpath => "/Potatoes/Potato[@name='OnePotato']"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/11_xml_edits/delete_tree_002.cf b/tests/acceptance/10_files/11_xml_edits/delete_tree_002.cf index 549271ffff..45cf6252eb 100644 --- a/tests/acceptance/10_files/11_xml_edits/delete_tree_002.cf +++ b/tests/acceptance/10_files/11_xml_edits/delete_tree_002.cf @@ -3,23 +3,21 @@ # File editing edit_xml # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " @@ -27,12 +25,12 @@ bundle agent init cfe_alias "; - "expected" string => - " + "expected" + string => " "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -41,24 +39,25 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "tree" string => - " " @@ -69,7 +68,7 @@ directory=\"logs\" prefix=\"cfe_host\_log.\" suffix=\".txt\" timestamp=\"true\" "; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_delete("$(test.tree)"); } @@ -77,19 +76,23 @@ directory=\"logs\" prefix=\"cfe_host\_log.\" suffix=\".txt\" timestamp=\"true\" bundle edit_xml test_delete(str) { delete_tree: - "$(str)" + "$(str)" build_xpath => "/Server/Service/Engine/OneFish/TwoFish/RedFish/BlueFish", select_xpath => "/Server/Service/Engine"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/11_xml_edits/insert_host_example.cf b/tests/acceptance/10_files/11_xml_edits/insert_host_example.cf index d5548f8fcb..47a7907c09 100644 --- a/tests/acceptance/10_files/11_xml_edits/insert_host_example.cf +++ b/tests/acceptance/10_files/11_xml_edits/insert_host_example.cf @@ -3,23 +3,21 @@ # File editing edit_xml - example for inserting a host into a Tomcat configuration file # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " @@ -53,8 +51,8 @@ bundle agent init "; - "expected" string => - " + "expected" + string => " "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -99,24 +97,25 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "host" string => - " " @@ -127,7 +126,7 @@ directory=\"logs\" prefix=\"cfe_host\_log.\" suffix=\".txt\" timestamp=\"true\" "; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_insert("$(test.host)"); } @@ -135,18 +134,20 @@ directory=\"logs\" prefix=\"cfe_host\_log.\" suffix=\".txt\" timestamp=\"true\" bundle edit_xml test_insert(str) { insert_tree: - "$(str)" - select_xpath => "/Server/Service/Engine"; + "$(str)" select_xpath => "/Server/Service/Engine"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/11_xml_edits/insert_text_001.cf b/tests/acceptance/10_files/11_xml_edits/insert_text_001.cf index 94704d635e..2372706202 100644 --- a/tests/acceptance/10_files/11_xml_edits/insert_text_001.cf +++ b/tests/acceptance/10_files/11_xml_edits/insert_text_001.cf @@ -3,23 +3,21 @@ # File editing edit_xml # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " @@ -29,8 +27,8 @@ bundle agent init "; - "expected" string => - " + "expected" + string => " Hot Potatoes!!! @@ -41,7 +39,7 @@ bundle agent init "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,26 +48,27 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "text" string => "Hot Potatoes!!!"; + "text" string => "Hot Potatoes!!!"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_insert("$(test.text)"); } @@ -77,18 +76,20 @@ bundle agent test bundle edit_xml test_insert(str) { insert_text: - "$(str)" - select_xpath => "/Potatoes/Potato[@name=\'OnePotato\']"; + "$(str)" select_xpath => "/Potatoes/Potato[@name=\'OnePotato\']"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/11_xml_edits/insert_text_002.cf b/tests/acceptance/10_files/11_xml_edits/insert_text_002.cf index 7cd39bf054..2b69e8b312 100644 --- a/tests/acceptance/10_files/11_xml_edits/insert_text_002.cf +++ b/tests/acceptance/10_files/11_xml_edits/insert_text_002.cf @@ -3,31 +3,29 @@ # File editing edit_xml # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " Marlin"; - "expected" string => - " + "expected" + string => " MarlinNemo"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -36,26 +34,27 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "text" string => "Nemo"; + "text" string => "Nemo"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_insert("$(test.text)"); } @@ -63,19 +62,22 @@ bundle agent test bundle edit_xml test_insert(str) { insert_text: - "$(str)" + "$(str)" build_xpath => "/Server/Service/Engine/OneFish/TwoFish[@type=\'clownfish\']/RedFish/BlueFish", select_xpath => "/Server/Service/Engine/OneFish/TwoFish[@type=\'clownfish\']"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/11_xml_edits/insert_tree_001.cf b/tests/acceptance/10_files/11_xml_edits/insert_tree_001.cf index 932bb6f4c1..47ef9f5355 100644 --- a/tests/acceptance/10_files/11_xml_edits/insert_tree_001.cf +++ b/tests/acceptance/10_files/11_xml_edits/insert_tree_001.cf @@ -3,23 +3,21 @@ # File editing edit_xml # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " @@ -37,8 +35,8 @@ bundle agent init "; - "expected" string => - " + "expected" + string => " @@ -58,7 +56,7 @@ bundle agent init "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -67,28 +65,28 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "tree" string => - " + "tree" string => " "; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_insert("$(test.tree)"); } @@ -96,18 +94,20 @@ bundle agent test bundle edit_xml test_insert(str) { insert_tree: - "$(str)" - select_xpath => "/Potatoes/Potato[@name=\'OnePotato\']"; + "$(str)" select_xpath => "/Potatoes/Potato[@name=\'OnePotato\']"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/11_xml_edits/insert_tree_003.cf b/tests/acceptance/10_files/11_xml_edits/insert_tree_003.cf index 859c16a587..7ecb8ff702 100644 --- a/tests/acceptance/10_files/11_xml_edits/insert_tree_003.cf +++ b/tests/acceptance/10_files/11_xml_edits/insert_tree_003.cf @@ -3,27 +3,25 @@ # File editing edit_xml - Inserting a tree into a non-empty file, using build_xpath body attribute # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " "; - "expected" string => - " + "expected" + string => " @@ -32,7 +30,7 @@ bundle agent init "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -41,24 +39,25 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "content" string => - " " @@ -69,7 +68,7 @@ directory=\"logs\" prefix=\"cfe_host\_log.\" suffix=\".txt\" timestamp=\"true\" "; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_insert("$(test.content)"); } @@ -77,19 +76,23 @@ directory=\"logs\" prefix=\"cfe_host\_log.\" suffix=\".txt\" timestamp=\"true\" bundle edit_xml test_insert(str) { insert_tree: - "$(str)" + "$(str)" build_xpath => "/Server/Service/Engine/OneFish/TwoFish/RedFish/BlueFish", select_xpath => "/Server/Service/Engine"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/11_xml_edits/set_attribute_001.cf b/tests/acceptance/10_files/11_xml_edits/set_attribute_001.cf index 05c6e535c2..8a8ca8bb1b 100644 --- a/tests/acceptance/10_files/11_xml_edits/set_attribute_001.cf +++ b/tests/acceptance/10_files/11_xml_edits/set_attribute_001.cf @@ -3,23 +3,21 @@ # File editing edit_xml # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " @@ -29,8 +27,8 @@ bundle agent init "; - "expected" string => - " + "expected" + string => " @@ -41,7 +39,7 @@ bundle agent init "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,26 +48,27 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "attribute_name" string => "topping"; + "attribute_name" string => "topping"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_insert("$(test.attribute_name)"); } @@ -77,19 +76,22 @@ bundle agent test bundle edit_xml test_insert(str) { set_attribute: - "$(str)" + "$(str)" select_xpath => "/Potatoes/Potato[@name=\'OnePotato\']", attribute_value => "brocolli"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/11_xml_edits/set_attribute_002.cf b/tests/acceptance/10_files/11_xml_edits/set_attribute_002.cf index ce0c9a35a1..0c99c53c80 100644 --- a/tests/acceptance/10_files/11_xml_edits/set_attribute_002.cf +++ b/tests/acceptance/10_files/11_xml_edits/set_attribute_002.cf @@ -3,31 +3,29 @@ # File editing edit_xml # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " "; - "expected" string => - " + "expected" + string => " "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -36,26 +34,27 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "attribute_name" string => "type"; + "attribute_name" string => "type"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_insert("$(test.attribute_name)"); } @@ -63,20 +62,23 @@ bundle agent test bundle edit_xml test_insert(str) { set_attribute: - "$(str)" + "$(str)" build_xpath => "/Server/Service/Engine/OneFish/TwoFish/RedFish/BlueFish", select_xpath => "/Server/Service/Engine/OneFish", attribute_value => "clownfish"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/11_xml_edits/set_attribute_003.cf b/tests/acceptance/10_files/11_xml_edits/set_attribute_003.cf index 968a96285c..e4eb09f095 100644 --- a/tests/acceptance/10_files/11_xml_edits/set_attribute_003.cf +++ b/tests/acceptance/10_files/11_xml_edits/set_attribute_003.cf @@ -3,23 +3,21 @@ # File editing edit_xml - test changing an existing attribute of a node # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " @@ -29,8 +27,8 @@ bundle agent init "; - "expected" string => - " + "expected" + string => " @@ -41,7 +39,7 @@ bundle agent init "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -50,26 +48,27 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "attribute_name" string => "topping"; + "attribute_name" string => "topping"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_set("$(test.attribute_name)"); } @@ -77,19 +76,22 @@ bundle agent test bundle edit_xml test_set(str) { set_attribute: - "$(str)" + "$(str)" select_xpath => "/Potatoes/Potato[@name=\'OnePotato\']", attribute_value => "sourcream"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/11_xml_edits/set_text_001.cf b/tests/acceptance/10_files/11_xml_edits/set_text_001.cf index bdc4c53bad..4de55ba7e7 100644 --- a/tests/acceptance/10_files/11_xml_edits/set_text_001.cf +++ b/tests/acceptance/10_files/11_xml_edits/set_text_001.cf @@ -3,23 +3,21 @@ # File editing edit_xml # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " @@ -29,8 +27,8 @@ bundle agent init "; - "expected" string => - " + "expected" + string => " Hot Potatoes!!! @@ -40,7 +38,7 @@ bundle agent init "; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -49,26 +47,27 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "text" string => "Hot Potatoes!!!"; + "text" string => "Hot Potatoes!!!"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_insert("$(test.text)"); } @@ -76,18 +75,20 @@ bundle agent test bundle edit_xml test_insert(str) { set_text: - "$(str)" - select_xpath => "/Potatoes/Potato[@name=\'OnePotato\']"; + "$(str)" select_xpath => "/Potatoes/Potato[@name=\'OnePotato\']"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/11_xml_edits/set_text_002.cf b/tests/acceptance/10_files/11_xml_edits/set_text_002.cf index d68a93b8e0..0a141a607b 100644 --- a/tests/acceptance/10_files/11_xml_edits/set_text_002.cf +++ b/tests/acceptance/10_files/11_xml_edits/set_text_002.cf @@ -3,31 +3,29 @@ # File editing edit_xml # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - " + "actual" + string => " Marlin"; - "expected" string => - " + "expected" + string => " Nemo"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -36,26 +34,27 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; vars: - "text" string => "Nemo"; + "text" string => "Nemo"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_insert("$(test.text)"); } @@ -63,19 +62,22 @@ bundle agent test bundle edit_xml test_insert(str) { set_text: - "$(str)" + "$(str)" build_xpath => "/Server/Service/Engine/OneFish[@type=\'clownfish\']/TwoFish/RedFish/BlueFish", select_xpath => "/Server/Service/Engine/OneFish[@type=\'clownfish\']"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } ### PROJECT_ID: core diff --git a/tests/acceptance/10_files/11_xml_edits/staging/insert_tree_002.cf b/tests/acceptance/10_files/11_xml_edits/staging/insert_tree_002.cf index 5166493d24..49c351eebd 100644 --- a/tests/acceptance/10_files/11_xml_edits/staging/insert_tree_002.cf +++ b/tests/acceptance/10_files/11_xml_edits/staging/insert_tree_002.cf @@ -3,23 +3,21 @@ # File editing edit_xml - Inserting a tree into an empty file # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "expected" string => - " + "expected" + string => " @@ -28,11 +26,11 @@ bundle agent init "; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_defaults => init_empty; - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert("$(init.expected)"), edit_defaults => init_empty; @@ -41,20 +39,20 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { vars: - "content" string => - " " @@ -65,7 +63,7 @@ directory=\"logs\" prefix=\"cfe_host\_log.\" suffix=\".txt\" timestamp=\"true\" "; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_create("$(test.content)"); } @@ -73,17 +71,21 @@ directory=\"logs\" prefix=\"cfe_host\_log.\" suffix=\".txt\" timestamp=\"true\" bundle edit_xml test_create(str) { insert_tree: - "$(str)"; + "$(str)"; } ####################################################### - bundle agent check { methods: - "any" usebundle => xml_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => xml_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/11_xml_edits/staging/insert_tree_004.cf b/tests/acceptance/10_files/11_xml_edits/staging/insert_tree_004.cf index 56433d2033..db9eb5e200 100644 --- a/tests/acceptance/10_files/11_xml_edits/staging/insert_tree_004.cf +++ b/tests/acceptance/10_files/11_xml_edits/staging/insert_tree_004.cf @@ -4,23 +4,21 @@ # Note that selext_xpath must still be specified, as file will no longer be empty after build_xpath is verified. # ###################################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "expected" string => - " + "expected" + string => " @@ -29,11 +27,11 @@ bundle agent init "; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_defaults => init_empty; - "$(G.testfile).expected" + "$(G.testfile).expected" create => "true", edit_line => init_insert("$(init.expected)"), edit_defaults => init_empty; @@ -42,20 +40,20 @@ bundle agent init bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### bundle agent test { vars: - "content" string => - " " @@ -66,7 +64,7 @@ directory=\"logs\" prefix=\"cfe_host\_log.\" suffix=\".txt\" timestamp=\"true\" "; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_xml => test_create("$(test.content)"); } @@ -74,19 +72,23 @@ directory=\"logs\" prefix=\"cfe_host\_log.\" suffix=\".txt\" timestamp=\"true\" bundle edit_xml test_create(str) { insert_tree: - "$(str)" + "$(str)" build_xpath => "/Server/Service/Engine/OneFish/TwoFish/RedFish/BlueFish", select_xpath => "/Server/Service/Engine"; } ####################################################### - bundle agent check { methods: - "any" usebundle => check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)", "no"); + "any" + usebundle => check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)", + "no" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/12_acl/acl.cf b/tests/acceptance/10_files/12_acl/acl.cf index 5a3b898b31..10a1cdf2c6 100644 --- a/tests/acceptance/10_files/12_acl/acl.cf +++ b/tests/acceptance/10_files/12_acl/acl.cf @@ -5,54 +5,66 @@ ##################################################### body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { classes: - "cfengine_internal_getfacl" expression => fileexists("/var/cfengine/bin/getfacl"); - "system_getfacl" expression => fileexists("/usr/bin/getfacl"); + "cfengine_internal_getfacl" + expression => fileexists("/var/cfengine/bin/getfacl"); + + "system_getfacl" expression => fileexists("/usr/bin/getfacl"); vars: linux.cfengine_internal_getfacl:: "cmd" string => "/var/cfengine/bin/getfacl"; + linux.!cfengine_internal_getfacl.system_getfacl:: "cmd" string => "/usr/bin/getfacl"; files: - "$(G.testdir)$(const.dirsep)file" + "$(G.testdir)$(const.dirsep)file" create => "true", acl => acl_sanity_check; } body acl acl_sanity_check { - acl_method => "append"; - aces => { "all:=rwx:allow" }; + acl_method => "append"; + aces => { "all:=rwx:allow" }; } ####################################################### - bundle agent test { meta: - "test_skip_needs_work" string => "windows"; + "test_skip_needs_work" string => "windows"; vars: linux:: - "sanity_perms" string => execresult("$(init.cmd) $(G.testdir)$(const.dirsep)file 2>&1 | $(G.grep) -v 'Removing leading'", "noshell"); + "sanity_perms" + string => execresult( + "$(init.cmd) $(G.testdir)$(const.dirsep)file 2>&1 | $(G.grep) -v 'Removing leading'", + "noshell" + ); + classes: linux:: # Some filesystems don't have ACL capability, so we do this sanity check. - "linux_go_ahead" expression => regcmp(".*other::rwx.*", "$(sanity_perms)"); + "linux_go_ahead" + expression => regcmp(".*other::rwx.*", "$(sanity_perms)"); + vars: linux_go_ahead|windows:: - "result" string => execresult("$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell"); + "result" + string => execresult( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell" + ); + !linux_go_ahead.!windows:: "result" string => ""; @@ -62,30 +74,33 @@ bundle agent test } ####################################################### - bundle agent check { classes: - "ok" not => regcmp(".*(error|failed).*", "$(test.result)"); + "ok" not => regcmp(".*(error|failed).*", "$(test.result)"); + reports: DEBUG:: "Tests various ACL features"; + DEBUG.!ok:: "Subtest(s) failing: $(test.result)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; files: - "$(G.testdir)$(const.dirsep)file" - acl => acl_sanity_check_reset; + "$(G.testdir)$(const.dirsep)file" acl => acl_sanity_check_reset; } body acl acl_sanity_check_reset { - acl_method => "append"; - aces => { "all:-rwx:allow" }; + acl_method => "append"; + aces => { "all:-rwx:allow" }; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/12_acl/file_copy_acl.cf b/tests/acceptance/10_files/12_acl/file_copy_acl.cf index cd53cdc65f..64527590da 100644 --- a/tests/acceptance/10_files/12_acl/file_copy_acl.cf +++ b/tests/acceptance/10_files/12_acl/file_copy_acl.cf @@ -3,117 +3,170 @@ # ACL tests for file copying. # ##################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { classes: - "cfengine_internal_getfacl" expression => fileexists("/var/cfengine/bin/getfacl"); - "system_getfacl" expression => fileexists("/usr/bin/getfacl"); + "cfengine_internal_getfacl" + expression => fileexists("/var/cfengine/bin/getfacl"); + + "system_getfacl" expression => fileexists("/usr/bin/getfacl"); vars: linux.cfengine_internal_getfacl:: "cmd" string => "/var/cfengine/bin/getfacl"; + linux.!cfengine_internal_getfacl.system_getfacl:: "cmd" string => "/usr/bin/getfacl"; + windows:: "cmd" string => "C:\windows\system32\cmd.exe /C cacls"; files: - "$(G.testdir)/source_plain" - create => "true"; - "$(G.testdir)/source_ext" + "$(G.testdir)/source_plain" create => "true"; + + "$(G.testdir)/source_ext" create => "true", acl => testacl; } body acl testacl { - !windows:: - acl_method => "append"; - aces => { "user:root:wx" }; - windows:: - acl_method => "overwrite"; - aces => { "user:Administrator:r" }; - acl_inherit => "false"; + !windows:: + acl_method => "append"; + aces => { "user:root:wx" }; + + windows:: + acl_method => "overwrite"; + aces => { "user:Administrator:r" }; + acl_inherit => "false"; } bundle agent test { meta: - "test_skip_needs_work" string => "windows"; + "test_skip_needs_work" string => "windows"; files: - "$(G.testdir)/destination_plain" - copy_from => source_plain; - "$(G.testdir)/destination_ext_preserve" - copy_from => source_ext_preserve; - "$(G.testdir)/destination_ext_no_preserve" + "$(G.testdir)/destination_plain" copy_from => source_plain; + "$(G.testdir)/destination_ext_preserve" copy_from => source_ext_preserve; + + "$(G.testdir)/destination_ext_no_preserve" copy_from => source_ext_no_preserve; } body copy_from source_plain { - source => "$(G.testdir)/source_plain"; + source => "$(G.testdir)/source_plain"; } body copy_from source_ext_preserve { - source => "$(G.testdir)/source_ext"; - preserve => "yes"; + source => "$(G.testdir)/source_ext"; + preserve => "yes"; } body copy_from source_ext_no_preserve { - source => "$(G.testdir)/source_ext"; - preserve => "no"; + source => "$(G.testdir)/source_ext"; + preserve => "no"; } bundle agent check { vars: - "destination_ext_preserve_output" string => execresult("$(init.cmd) $(G.testdir)$(const.dirsep)destination_ext_preserve", "noshell"); - "destination_ext_no_preserve_output" string => execresult("$(init.cmd) $(G.testdir)$(const.dirsep)destination_ext_no_preserve", "noshell"); + "destination_ext_preserve_output" + string => execresult( + "$(init.cmd) $(G.testdir)$(const.dirsep)destination_ext_preserve", + "noshell" + ); + + "destination_ext_no_preserve_output" + string => execresult( + "$(init.cmd) $(G.testdir)$(const.dirsep)destination_ext_no_preserve", + "noshell" + ); !windows:: - "destination_plain_output" string => execresult("/bin/ls -lZ $(G.testdir)$(const.dirsep)destination_plain", "noshell"); - "source_ext_output" string => execresult("$(init.cmd) $(G.testdir)$(const.dirsep)source_ext", "noshell"); + "destination_plain_output" + string => execresult( + "/bin/ls -lZ $(G.testdir)$(const.dirsep)destination_plain", "noshell" + ); + + "source_ext_output" + string => execresult( + "$(init.cmd) $(G.testdir)$(const.dirsep)source_ext", "noshell" + ); classes: !windows:: - "destination_plain_ok" not => regcmp(".*[-rwx]{10}\+.*", "$(destination_plain_output)"); - "source_ext_ok" expression => regcmp(".*user:root:-wx.*", "$(source_ext_output)"); - "destination_ext_preserve_ok" expression => regcmp(".*user:root:-wx.*", "$(destination_ext_preserve_output)"); - "destination_ext_no_preserve_ok" not => regcmp(".*user:root:-wx.*", "$(destination_ext_no_preserve_output)"); - "targets_ok" and => { "destination_plain_ok", "destination_ext_preserve_ok", "destination_ext_no_preserve_ok" }; + "destination_plain_ok" + not => regcmp(".*[-rwx]{10}\+.*", "$(destination_plain_output)"); + + "source_ext_ok" + expression => regcmp(".*user:root:-wx.*", "$(source_ext_output)"); + + "destination_ext_preserve_ok" + expression => regcmp( + ".*user:root:-wx.*", "$(destination_ext_preserve_output)" + ); + + "destination_ext_no_preserve_ok" + not => regcmp( + ".*user:root:-wx.*", "$(destination_ext_no_preserve_output)" + ); + + "targets_ok" + and => { + "destination_plain_ok", + "destination_ext_preserve_ok", + "destination_ext_no_preserve_ok", + }; + # The !source_ext_ok test is in case the underlying file system does not support ACLs. "ok" or => { "!source_ext_ok", "targets_ok" }; windows:: - "destination_ext_preserve_ok" expression => regcmp(".*Administrator:.*READ_CONTROL.*FILE_GENERIC_READ.*FILE_READ_DATA.*FILE_READ_EA.*FILE_READ_ATTRIBUTES.*", "$(destination_ext_preserve_output)"); - "destination_ext_no_preserve_ok" not => regcmp(".*Administrator:.*READ_CONTROL.*FILE_GENERIC_READ.*FILE_READ_DATA.*FILE_READ_EA.*FILE_READ_ATTRIBUTES.*", "$(destination_ext_no_preserve_output)"); - "ok" and => { "destination_ext_preserve_ok", "destination_ext_no_preserve_ok" }; + "destination_ext_preserve_ok" + expression => regcmp( + ".*Administrator:.*READ_CONTROL.*FILE_GENERIC_READ.*FILE_READ_DATA.*FILE_READ_EA.*FILE_READ_ATTRIBUTES.*", + "$(destination_ext_preserve_output)" + ); + + "destination_ext_no_preserve_ok" + not => regcmp( + ".*Administrator:.*READ_CONTROL.*FILE_GENERIC_READ.*FILE_READ_DATA.*FILE_READ_EA.*FILE_READ_ATTRIBUTES.*", + "$(destination_ext_no_preserve_output)" + ); + + "ok" + and => { + "destination_ext_preserve_ok", "destination_ext_no_preserve_ok" + }; reports: DEBUG.!windows:: "Destination file permissions (should not contain a '+'): $(destination_plain_output)"; "Destination file permissions (should contain \"user:root:-wx\"): $(destination_ext_preserve_output)"; "Destination file permissions (should not contain \"user:root:-wx\"): $(destination_ext_no_preserve_output)"; + DEBUG.windows:: "Destination file permissions (should contain read attributes): $(destination_ext_preserve_output)"; "Destination file permissions (should not contain read attributes): $(destination_ext_no_preserve_output)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/12_acl/file_edit_acl.cf b/tests/acceptance/10_files/12_acl/file_edit_acl.cf index b05d64ff22..a0f0ceef16 100644 --- a/tests/acceptance/10_files/12_acl/file_edit_acl.cf +++ b/tests/acceptance/10_files/12_acl/file_edit_acl.cf @@ -3,102 +3,128 @@ # ACL tests for file editing. # ##################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { classes: - "cfengine_internal_getfacl" expression => fileexists("/var/cfengine/bin/getfacl"); - "system_getfacl" expression => fileexists("/usr/bin/getfacl"); + "cfengine_internal_getfacl" + expression => fileexists("/var/cfengine/bin/getfacl"); + + "system_getfacl" expression => fileexists("/usr/bin/getfacl"); vars: linux.cfengine_internal_getfacl:: "cmd" string => "/var/cfengine/bin/getfacl"; + linux.!cfengine_internal_getfacl.system_getfacl:: "cmd" string => "/usr/bin/getfacl"; + windows:: "cmd" string => "C:\windows\system32\cmd.exe /C cacls"; files: - "$(G.testdir)/file_plain" - create => "true"; - "$(G.testdir)/basetest_ext" + "$(G.testdir)/file_plain" create => "true"; + + "$(G.testdir)/basetest_ext" create => "true", acl => testacl; - "$(G.testdir)/file_ext" + + "$(G.testdir)/file_ext" create => "true", acl => testacl; } body acl testacl { - !windows:: - acl_method => "append"; - aces => { "user:root:wx" }; - windows:: - acl_method => "overwrite"; - aces => { "user:Administrator:r" }; - acl_inherit => "false"; + !windows:: + acl_method => "append"; + aces => { "user:root:wx" }; + + windows:: + acl_method => "overwrite"; + aces => { "user:Administrator:r" }; + acl_inherit => "false"; } bundle agent test { meta: - "test_skip_needs_work" string => "windows"; + "test_skip_needs_work" string => "windows"; files: - "$(G.testdir)/file_plain" - edit_line => file_edit; + "$(G.testdir)/file_plain" edit_line => file_edit; + files: - "$(G.testdir)/file_ext" - edit_line => file_edit; + "$(G.testdir)/file_ext" edit_line => file_edit; } bundle edit_line file_edit { insert_lines: - "New line!"; + "New line!"; } bundle agent check { vars: - "file_ext_output" string => execresult("$(init.cmd) $(G.testdir)$(const.dirsep)file_ext", "noshell"); + "file_ext_output" + string => execresult( + "$(init.cmd) $(G.testdir)$(const.dirsep)file_ext", "noshell" + ); !windows:: - "file_plain_output" string => execresult("/bin/ls -lZ $(G.testdir)$(const.dirsep)file_plain", "noshell"); - "basetest_ext_output" string => execresult("$(init.cmd) $(G.testdir)$(const.dirsep)basetest_ext", "noshell"); + "file_plain_output" + string => execresult( + "/bin/ls -lZ $(G.testdir)$(const.dirsep)file_plain", "noshell" + ); + + "basetest_ext_output" + string => execresult( + "$(init.cmd) $(G.testdir)$(const.dirsep)basetest_ext", "noshell" + ); classes: !windows:: "file_plain_ok" not => regcmp(".*[-rwx]{10}\+.*", "$(file_plain_output)"); - "basetest_ext_ok" expression => regcmp(".*user:root:-wx.*", "$(basetest_ext_output)"); - "file_ext_ok" expression => regcmp(".*user:root:-wx.*", "$(file_ext_output)"); + + "basetest_ext_ok" + expression => regcmp(".*user:root:-wx.*", "$(basetest_ext_output)"); + + "file_ext_ok" + expression => regcmp(".*user:root:-wx.*", "$(file_ext_output)"); + # The !basetest_ext_ok test is in case the underlying file system does not support ACLs. "ext_ok" or => { "!basetest_ext_ok", "file_ext_ok" }; "ok" and => { "file_plain_ok", "ext_ok" }; windows:: - "ok" expression => regcmp(".*Administrator:.*READ_CONTROL.*FILE_GENERIC_READ.*FILE_READ_DATA.*FILE_READ_EA.*FILE_READ_ATTRIBUTES.*", "$(file_ext_output)"); + "ok" + expression => regcmp( + ".*Administrator:.*READ_CONTROL.*FILE_GENERIC_READ.*FILE_READ_DATA.*FILE_READ_EA.*FILE_READ_ATTRIBUTES.*", + "$(file_ext_output)" + ); reports: DEBUG.!windows:: "Destination file permissions (should not contain a '+'): $(file_plain_output)"; "Destination file permissions (should contain \"user:root:-wx\"): $(file_ext_output)"; + DEBUG.windows:: "Destination file permissions (should contain read attributes): $(file_ext_output)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/12_acl/getacls.cf b/tests/acceptance/10_files/12_acl/getacls.cf index 86e5ac6d26..98604902dd 100644 --- a/tests/acceptance/10_files/12_acl/getacls.cf +++ b/tests/acceptance/10_files/12_acl/getacls.cf @@ -3,16 +3,14 @@ # Test policy function getacls() # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } ############################################################################## - body acl user_root_rwx_acl { acl_method => "append"; @@ -21,68 +19,69 @@ body acl user_root_rwx_acl } ############################################################################## - bundle agent init { files: - "$(G.testdir)/." - create => "true", - acl => user_root_rwx_acl, - handle => "Default ACLs is set"; - "$(G.testdir)/foo" - create => "true", - depends_on => { "Default ACLs is set" }, - comment => "Inherits ACLs from parent directory"; + "$(G.testdir)/." + create => "true", + acl => user_root_rwx_acl, + handle => "Default ACLs is set"; + + "$(G.testdir)/foo" + create => "true", + depends_on => { "Default ACLs is set" }, + comment => "Inherits ACLs from parent directory"; } ############################################################################## - bundle agent test { meta: - "description" -> { "CFE-4529" } - string => "Test policy function getacls()"; + "description" -> { "CFE-4529" } + string => "Test policy function getacls()"; - "test_soft_fail" - string => "windows", - meta => { "ENT-13019" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-13019" }; vars: - "default_acls" - slist => getacls("$(G.testdir)", "default"), - if => fileexists("$(G.testdir)"); - "access_acls" - slist => getacls("$(G.testdir)/foo", "access"), - if => fileexists("$(G.testdir)/foo"); + "default_acls" + slist => getacls("$(G.testdir)", "default"), + if => fileexists("$(G.testdir)"); + + "access_acls" + slist => getacls("$(G.testdir)/foo", "access"), + if => fileexists("$(G.testdir)/foo"); } ############################################################################## - bundle agent check { classes: - "acls_not_supported" - expression => eval("$(with) == 0", "class", "infix"), - with => length("test.default_acls"), - comment => "getacls() returns empty list if unsupported"; - "default_ok" - expression => some("$(expected)", "test.default_acls"); - "access_ok" - expression => some("$(expected)", "test.access_acls"); + "acls_not_supported" + expression => eval("$(with) == 0", "class", "infix"), + with => length("test.default_acls"), + comment => "getacls() returns empty list if unsupported"; + + "default_ok" expression => some("$(expected)", "test.default_acls"); + "access_ok" expression => some("$(expected)", "test.access_acls"); vars: - "expected" - string => ".*user:root:rwx.*"; + "expected" string => ".*user:root:rwx.*"; reports: acls_not_supported:: "$(this.promise_filename) Skip/unsupported"; + default_ok&access_ok:: "$(this.promise_filename) Pass"; + !(default_ok&access_ok):: "$(this.promise_filename) FAIL"; + "Expecting one match of '$(expected)' in default ACLs [$(with)]" with => join(", ", "test.default_acls"); + "Expecting one match of '$(expected)' in access ACLs [$(with)]" with => join(", ", "test.access_acls"); } diff --git a/tests/acceptance/10_files/13_file_dir/001.cf b/tests/acceptance/10_files/13_file_dir/001.cf index 4f6b394e6e..79e62bf7ce 100644 --- a/tests/acceptance/10_files/13_file_dir/001.cf +++ b/tests/acceptance/10_files/13_file_dir/001.cf @@ -12,26 +12,21 @@ # confusion. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - ####################################################### - bundle agent init { - - ####################################### - #Clean up test directory before testing - ####################################### - + ####################################### + #Clean up test directory before testing + ####################################### files: - "$(G.testdir)/." + "$(G.testdir)/." depth_search => recurse("inf"), delete => tidy, file_select => all, @@ -39,56 +34,51 @@ bundle agent init commands: dir_purged:: - "$(G.mkdir) -p" - args => "$(G.testdir)/backup/_tmp_TEST_cfengine_test"; + "$(G.mkdir) -p" args => "$(G.testdir)/backup/_tmp_TEST_cfengine_test"; } bundle edit_line test_insert(str) { insert_lines: - "$(sys.date)"; + "$(sys.date)"; } ####################################################### - bundle agent test { files: agent_ran:: "$(G.testdir)/test" - edit_line => test_insert("inserted text"), - classes => if_ok("file_edited"); + edit_line => test_insert("inserted text"), + classes => if_ok("file_edited"); commands: - "$(sys.cf_agent)" + "$(sys.cf_agent)" args => "-f $(this.promise_filename).sub -K", classes => if_ok("agent_ran"); file_edited:: "$(sys.cf_agent)" - args => "-f $(this.promise_filename).sub -K -D SECOND_RUN", - classes => classes_generic("agent_ran_test"), - contain => test_timeout; - + args => "-f $(this.promise_filename).sub -K -D SECOND_RUN", + classes => classes_generic("agent_ran_test"), + contain => test_timeout; } body contain test_timeout { - exec_timeout => "30"; + exec_timeout => "30"; } ####################################################### - bundle agent check { - classes: - "ok" expression => fileexists("$(G.testdir)/SECOND_RUN"); + "ok" expression => fileexists("$(G.testdir)/SECOND_RUN"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; - } diff --git a/tests/acceptance/10_files/13_file_dir/never_delete_nonempty_dir.cf b/tests/acceptance/10_files/13_file_dir/never_delete_nonempty_dir.cf index 614d6b5959..b402dcfee0 100644 --- a/tests/acceptance/10_files/13_file_dir/never_delete_nonempty_dir.cf +++ b/tests/acceptance/10_files/13_file_dir/never_delete_nonempty_dir.cf @@ -5,68 +5,62 @@ # Ref: https://dev.cfengine.com/issues/6331 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dir" string => "$(G.testdir)/dir/."; - "subdir1" string => "$(dir)/subdir1/."; - "subdir2" string => "$(dir)/subdir2/."; + "dir" string => "$(G.testdir)/dir/."; + "subdir1" string => "$(dir)/subdir1/."; + "subdir2" string => "$(dir)/subdir2/."; files: - "$(dir)" create => "true"; - "$(subdir1)" create => "true"; - "$(subdir2)" create => "true"; - "$(subdir2)/blah" create => "true"; + "$(dir)" create => "true"; + "$(subdir1)" create => "true"; + "$(subdir2)" create => "true"; + "$(subdir2)/blah" create => "true"; } ####################################################### - bundle agent test { # When trying to recursively delete "dir", it will be unable to delete # "dir/subdir2" because it's not empty, but it should be skipped # silently, and the whole promise will be success. - files: "$(init.dir)" depth_search => recurse_include_basedir("inf"), - file_select => not_blah, - delete => tidy, + file_select => not_blah, + delete => tidy, # success is being set despite skipping non-empty dir - classes => if_ok("success"); + classes => if_ok("success"); } ####################################################### - bundle agent check { classes: - "dir_exists" expression => isdir($(init.dir)); - "subdir1_deleted" not => isdir($(init.subdir1)); + "dir_exists" expression => isdir($(init.dir)); + "subdir1_deleted" not => isdir($(init.subdir1)); "subdir2_exists" expression => isdir($(init.subdir2)); - "ok" expression => "success.dir_exists.subdir1_deleted.subdir2_exists"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } - - body depth_search recurse_include_basedir(d) { - depth => "$(d)"; + depth => "$(d)"; include_basedir => "true"; } @@ -76,6 +70,5 @@ body file_select not_blah file_result => "!leaf_name"; } - ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/13_file_dir/never_delete_parent_dir.cf b/tests/acceptance/10_files/13_file_dir/never_delete_parent_dir.cf index 1676f0aaca..bac813f22b 100644 --- a/tests/acceptance/10_files/13_file_dir/never_delete_parent_dir.cf +++ b/tests/acceptance/10_files/13_file_dir/never_delete_parent_dir.cf @@ -3,70 +3,62 @@ # Test rmdirs => true never deletes parent directory, i.e. the promiser. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { # Create a bunch of subdirectories and files. All will be deleted later. - vars: - "dir" string => "$(G.testdir)/dir"; - "subdir1" string => "$(dir)/subdir1/."; - "subdir2" string => "$(dir)/subdir2/."; + "dir" string => "$(G.testdir)/dir"; + "subdir1" string => "$(dir)/subdir1/."; + "subdir2" string => "$(dir)/subdir2/."; files: - "$(dir)/." create => "true"; - "$(subdir1)" create => "true"; - "$(subdir2)" create => "true"; - "$(subdir2)/blah" create => "true"; + "$(dir)/." create => "true"; + "$(subdir1)" create => "true"; + "$(subdir2)" create => "true"; + "$(subdir2)/blah" create => "true"; } ####################################################### - bundle agent test { # Delete everything under "dir", but the promiser itself should never # be removed. - files: "$(init.dir)" depth_search => recurse_include_basedir("inf"), - file_select => all, - delete => tidy, + file_select => all, + delete => tidy, # success should be set after removing all subdirs - classes => if_ok("success"); + classes => if_ok("success"); } ####################################################### - bundle agent check { classes: - "dir_exists" expression => isdir($(init.dir)); - + "dir_exists" expression => isdir($(init.dir)); "ok" expression => "success.dir_exists"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } - - body depth_search recurse_include_basedir(d) { - depth => "$(d)"; + depth => "$(d)"; include_basedir => "true"; } - ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/FIM/monitoring_symlinks_does_not_constantly_report_change.cf b/tests/acceptance/10_files/FIM/monitoring_symlinks_does_not_constantly_report_change.cf index 8a19297ded..205dd723dc 100644 --- a/tests/acceptance/10_files/FIM/monitoring_symlinks_does_not_constantly_report_change.cf +++ b/tests/acceptance/10_files/FIM/monitoring_symlinks_does_not_constantly_report_change.cf @@ -1,16 +1,14 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { - files: - "$(G.testfile)" - link_from => ln_s( $(this.promise_filename) ); + "$(G.testfile)" link_from => ln_s($(this.promise_filename)); } bundle agent test @@ -23,13 +21,12 @@ bundle agent test string => "windows", comment => "Windows does not support symlinks, so it makes no sense to test there"; - + "test_soft_fail" string => "!windows", meta => { "redmine7692" }; } - bundle agent check { vars: @@ -46,7 +43,12 @@ bundle agent check first_agent_run_reached:: # We fail if we see Permissions, inode or mtime changes "Check second run" - usebundle => dcs_passif_output(".*fim_kept.*", ".*(Permissions for|inode for|Last modified time for).*$(G.testfile).*changed.*", $(command), $(this.promise_filename)); + usebundle => dcs_passif_output( + ".*fim_kept.*", + ".*(Permissions for|inode for|Last modified time for).*$(G.testfile).*changed.*", + $(command), + $(this.promise_filename) + ); } body link_from ln_s(x) @@ -54,7 +56,7 @@ body link_from ln_s(x) # The link is created even if the source of the link does not exist. # @param x The source of the link { - link_type => "symlink"; - source => "$(x)"; - when_no_source => "force"; + link_type => "symlink"; + source => "$(x)"; + when_no_source => "force"; } diff --git a/tests/acceptance/10_files/agent_control_default_directory_create_mode.cf b/tests/acceptance/10_files/agent_control_default_directory_create_mode.cf index a4112966e5..f9fac73418 100644 --- a/tests/acceptance/10_files/agent_control_default_directory_create_mode.cf +++ b/tests/acceptance/10_files/agent_control_default_directory_create_mode.cf @@ -3,24 +3,26 @@ # Test overriding default directory create mode (CFE-4590, ENT-13239). # ############################################################################## - - body common control { inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } -body agent control { +body agent control +{ # Override the default directory create mode to 0755 (it defaults to 0700 if # not specified) - default_directory_create_mode => "0777"; # Make sure the last one wins - default_directory_create_mode => "a+rx"; # Can also use octets 0755 + default_directory_create_mode => "0777"; + + # Make sure the last one wins + default_directory_create_mode => "a+rx"; + + # Can also use octets 0755 } ############################################################################## - bundle agent init { methods: @@ -28,7 +30,6 @@ bundle agent init } ############################################################################## - bundle agent test { meta: @@ -42,27 +43,26 @@ bundle agent test } ############################################################################## - bundle agent check { vars: "expected" string => "[0-9]*755", comment => "We only care about the last three octets (i.e., 755)"; - "actual" - string => filestat("$(G.testdir)/foo/", "modeoct"); + + "actual" string => filestat("$(G.testdir)/foo/", "modeoct"); methods: "Pass/FAIL" - usebundle => dcs_check_regcmp("$(expected)", "$(actual)", - "$(this.promise_filename)", "false"); + usebundle => dcs_check_regcmp( + "$(expected)", "$(actual)", "$(this.promise_filename)", "false" + ); reports: "Expected $(expected), actual $(actual)"; } ############################################################################## - bundle agent clean { files: diff --git a/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files.cf b/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files.cf index 1bc8186c64..d8a5084424 100644 --- a/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files.cf +++ b/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files.cf @@ -1,25 +1,24 @@ ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - body agent control { files_single_copy => { @(def.control_agent_files_single_copy) }; } + # NOTE that def.control_agent_files_single_copy DOES NOT EXIST bundle agent init { vars: "copy_files" slist => { "one", "two" }; - files: + files: "$(G.testdir)/$(copy_files)" create => "true", edit_line => insert_lines("$(copy_files)"); @@ -28,27 +27,26 @@ bundle agent init bundle agent test { meta: - "description" string => "Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times."; + "description" + string => "Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times."; - "test_soft_fail" - string => "any", - meta => { "CFE-2459" }; + "test_soft_fail" + string => "any", + meta => { "CFE-2459" }; files: - # Here we iterate over each copy_file to promise the content # of the testfile. We expect that with files_single_copy in # effect only the first file should be copied. - - "$(G.testfile)" - copy_from => local_dcp( "$(G.testdir)/$(init.copy_files)" ); + "$(G.testfile)" copy_from => local_dcp("$(G.testdir)/$(init.copy_files)"); } ####################################################### - bundle agent check { - methods: - "" usebundle => dcs_check_diff($(G.testfile), "$(G.testdir)/two", $(this.promise_filename)); + "" + usebundle => dcs_check_diff( + $(G.testfile), "$(G.testdir)/two", $(this.promise_filename) + ); } diff --git a/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_1.cf b/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_1.cf index 5f83bf438a..a532ac33a8 100644 --- a/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_1.cf +++ b/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_1.cf @@ -1,21 +1,18 @@ ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - body agent control { # (?!) should always fail to match. It is the zero-width negative # look-ahead. If what is in the parentheses matches then the whole # match fails. Given that it has nothing in it, it will fail the # match for anything (including nothing). - files_single_copy => { "(?!)" }; } @@ -24,7 +21,7 @@ bundle agent init vars: "copy_files" slist => { "one", "two" }; - files: + files: "$(G.testdir)/$(copy_files)" create => "true", edit_line => insert_lines("$(copy_files)"); @@ -33,27 +30,26 @@ bundle agent init bundle agent test { meta: - "description" string => "Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times."; + "description" + string => "Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times."; - "test_soft_fail" - string => "any", - meta => { "CFE-2459" }; + "test_soft_fail" + string => "any", + meta => { "CFE-2459" }; files: - # Here we iterate over each copy_file to promise the content # of the testfile. We expect that with files_single_copy in # effect only the first file should be copied. - - "$(G.testfile)" - copy_from => local_dcp( "$(G.testdir)/$(init.copy_files)" ); + "$(G.testfile)" copy_from => local_dcp("$(G.testdir)/$(init.copy_files)"); } ####################################################### - bundle agent check { - methods: - "" usebundle => dcs_check_diff($(G.testfile), "$(G.testdir)/two", $(this.promise_filename)); + "" + usebundle => dcs_check_diff( + $(G.testfile), "$(G.testdir)/two", $(this.promise_filename) + ); } diff --git a/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_2.cf b/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_2.cf index ed57c99bc7..bfc61ff79f 100644 --- a/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_2.cf +++ b/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_2.cf @@ -1,14 +1,12 @@ ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - body agent control { # $^ should match an empty string which should never be a way to @@ -21,7 +19,7 @@ bundle agent init vars: "copy_files" slist => { "one", "two" }; - files: + files: "$(G.testdir)/$(copy_files)" create => "true", edit_line => insert_lines("$(copy_files)"); @@ -30,27 +28,26 @@ bundle agent init bundle agent test { meta: - "description" string => "Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times."; + "description" + string => "Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times."; - "test_soft_fail" - string => "any", - meta => { "CFE-2459" }; + "test_soft_fail" + string => "any", + meta => { "CFE-2459" }; files: - # Here we iterate over each copy_file to promise the content # of the testfile. We expect that with files_single_copy in # effect only the first file should be copied. - - "$(G.testfile)" - copy_from => local_dcp( "$(G.testdir)/$(init.copy_files)" ); + "$(G.testfile)" copy_from => local_dcp("$(G.testdir)/$(init.copy_files)"); } ####################################################### - bundle agent check { - methods: - "" usebundle => dcs_check_diff($(G.testfile), "$(G.testdir)/two", $(this.promise_filename)); + "" + usebundle => dcs_check_diff( + $(G.testfile), "$(G.testdir)/two", $(this.promise_filename) + ); } diff --git a/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_3.cf b/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_3.cf index 80dea9e81c..e1ef5a664a 100644 --- a/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_3.cf +++ b/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_3.cf @@ -1,14 +1,12 @@ ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - body agent control { # Here we test a sane filename pattern against a file we definitely @@ -21,7 +19,7 @@ bundle agent init vars: "copy_files" slist => { "one", "two" }; - files: + files: "$(G.testdir)/$(copy_files)" create => "true", edit_line => insert_lines("$(copy_files)"); @@ -30,27 +28,26 @@ bundle agent init bundle agent test { meta: - "description" string => "Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times."; + "description" + string => "Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times."; - "test_soft_fail" - string => "any", - meta => { "CFE-2459" }; + "test_soft_fail" + string => "any", + meta => { "CFE-2459" }; files: - # Here we iterate over each copy_file to promise the content # of the testfile. We expect that with files_single_copy in # effect only the first file should be copied. - - "$(G.testfile)" - copy_from => local_dcp( "$(G.testdir)/$(init.copy_files)" ); + "$(G.testfile)" copy_from => local_dcp("$(G.testdir)/$(init.copy_files)"); } ####################################################### - bundle agent check { - methods: - "" usebundle => dcs_check_diff($(G.testfile), "$(G.testdir)/two", $(this.promise_filename)); + "" + usebundle => dcs_check_diff( + $(G.testfile), "$(G.testdir)/two", $(this.promise_filename) + ); } diff --git a/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_4.cf b/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_4.cf index e8eb87eab4..6155e26605 100644 --- a/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_4.cf +++ b/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_4.cf @@ -1,14 +1,12 @@ ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - body agent control { # Here we test a sane filename pattern against a file we definitely @@ -22,7 +20,7 @@ bundle agent init vars: "copy_files" slist => { "one", "two" }; - files: + files: "$(G.testdir)/$(copy_files)" create => "true", edit_line => insert_lines("$(copy_files)"); @@ -31,27 +29,26 @@ bundle agent init bundle agent test { meta: - "description" string => "Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times."; + "description" + string => "Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times."; - "test_soft_fail" - string => "any", - meta => { "CFE-2459" }; + "test_soft_fail" + string => "any", + meta => { "CFE-2459" }; files: - # Here we iterate over each copy_file to promise the content # of the testfile. We expect that with files_single_copy in # effect only the first file should be copied. - - "$(G.testfile)" - copy_from => local_dcp( "$(G.testdir)/$(init.copy_files)" ); + "$(G.testfile)" copy_from => local_dcp("$(G.testdir)/$(init.copy_files)"); } ####################################################### - bundle agent check { - methods: - "" usebundle => dcs_check_diff($(G.testfile), "$(G.testdir)/two", $(this.promise_filename)); + "" + usebundle => dcs_check_diff( + $(G.testfile), "$(G.testdir)/two", $(this.promise_filename) + ); } diff --git a/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_5.cf b/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_5.cf index e704190d77..cdb6c9eaa2 100644 --- a/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_5.cf +++ b/tests/acceptance/10_files/agent_control_files_single_copy_does_not_apply_to_nonmatching_files_5.cf @@ -1,26 +1,23 @@ ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - # Body agent control is not defined, so files_single_copy should not match any files. #body agent control #{ # files_single_copy => { @(def.control_agent_files_single_copy) }; #} - bundle agent init { vars: "copy_files" slist => { "one", "two" }; - files: + files: "$(G.testdir)/$(copy_files)" create => "true", edit_line => insert_lines("$(copy_files)"); @@ -29,27 +26,26 @@ bundle agent init bundle agent test { meta: - "description" string => "Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times."; + "description" + string => "Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times."; - "test_skip_needs_work" - string => "windows", - meta => { "CFE-2459" }; + "test_skip_needs_work" + string => "windows", + meta => { "CFE-2459" }; files: - # Here we iterate over each copy_file to promise the content # of the testfile. We expect that with files_single_copy in # effect only the first file should be copied. - - "$(G.testfile)" - copy_from => local_dcp( "$(G.testdir)/$(init.copy_files)" ); + "$(G.testfile)" copy_from => local_dcp("$(G.testdir)/$(init.copy_files)"); } ####################################################### - bundle agent check { - methods: - "" usebundle => dcs_check_diff($(G.testfile), "$(G.testdir)/two", $(this.promise_filename)); + "" + usebundle => dcs_check_diff( + $(G.testfile), "$(G.testdir)/two", $(this.promise_filename) + ); } diff --git a/tests/acceptance/10_files/agent_control_files_single_copy_prevents_subsequent_copy_on_exact_match.cf b/tests/acceptance/10_files/agent_control_files_single_copy_prevents_subsequent_copy_on_exact_match.cf index 2ce983108f..86fd81a1fa 100644 --- a/tests/acceptance/10_files/agent_control_files_single_copy_prevents_subsequent_copy_on_exact_match.cf +++ b/tests/acceptance/10_files/agent_control_files_single_copy_prevents_subsequent_copy_on_exact_match.cf @@ -1,14 +1,12 @@ ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - body agent control { # Here we explicitly target the testfile. @@ -20,7 +18,7 @@ bundle agent init vars: "copy_files" slist => { "one", "two" }; - files: + files: "$(G.testdir)/$(copy_files)" create => "true", edit_line => insert_lines("$(copy_files)"); @@ -29,27 +27,26 @@ bundle agent init bundle agent test { meta: - "description" string => "Test that files_single_copy prevents subsequnt copy of a file when there is an exact match."; + "description" + string => "Test that files_single_copy prevents subsequnt copy of a file when there is an exact match."; - "test_skip_needs_work" - string => "windows", - meta => { "CFE-2459" }; + "test_skip_needs_work" + string => "windows", + meta => { "CFE-2459" }; files: - # Here we iterate over each copy_file to promise the content # of the testfile. We expect that with files_single_copy in # effect only the first file should be copied. - - "$(G.testfile)" - copy_from => local_dcp( "$(G.testdir)/$(init.copy_files)" ); + "$(G.testfile)" copy_from => local_dcp("$(G.testdir)/$(init.copy_files)"); } ####################################################### - bundle agent check { - methods: - "" usebundle => dcs_check_diff($(G.testfile), "$(G.testdir)/one", $(this.promise_filename)); + "" + usebundle => dcs_check_diff( + $(G.testfile), "$(G.testdir)/one", $(this.promise_filename) + ); } diff --git a/tests/acceptance/10_files/agent_control_files_single_copy_prevents_subsequent_copy_on_regular_expression_match.cf b/tests/acceptance/10_files/agent_control_files_single_copy_prevents_subsequent_copy_on_regular_expression_match.cf index 68c06ce5b5..a4aa624afe 100644 --- a/tests/acceptance/10_files/agent_control_files_single_copy_prevents_subsequent_copy_on_regular_expression_match.cf +++ b/tests/acceptance/10_files/agent_control_files_single_copy_prevents_subsequent_copy_on_regular_expression_match.cf @@ -1,19 +1,16 @@ ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - body agent control { # Here we cast a wide net (any file) to make sure regular expression # matching works. - files_single_copy => { ".*" }; } @@ -22,7 +19,7 @@ bundle agent init vars: "copy_files" slist => { "one", "two" }; - files: + files: "$(G.testdir)/$(copy_files)" create => "true", edit_line => insert_lines("$(copy_files)"); @@ -31,27 +28,26 @@ bundle agent init bundle agent test { meta: - "description" string => "Test that files_single_copy prevents subsequnt copy of a file when there is a matching regular expression."; + "description" + string => "Test that files_single_copy prevents subsequnt copy of a file when there is a matching regular expression."; - "test_skip_needs_work" - string => "windows", - meta => { "CFE-2459" }; + "test_skip_needs_work" + string => "windows", + meta => { "CFE-2459" }; files: - # Here we iterate over each copy_file to promise the content # of the testfile. We expect that with files_single_copy in # effect only the first file should be copied. - - "$(G.testfile)" - copy_from => local_dcp( "$(G.testdir)/$(init.copy_files)" ); + "$(G.testfile)" copy_from => local_dcp("$(G.testdir)/$(init.copy_files)"); } ####################################################### - bundle agent check { - methods: - "" usebundle => dcs_check_diff($(G.testfile), "$(G.testdir)/one", $(this.promise_filename)); + "" + usebundle => dcs_check_diff( + $(G.testfile), "$(G.testdir)/one", $(this.promise_filename) + ); } diff --git a/tests/acceptance/10_files/can_set_sticky_bits_without_root_owning_directory.cf b/tests/acceptance/10_files/can_set_sticky_bits_without_root_owning_directory.cf index af9516c023..df97a9f82f 100644 --- a/tests/acceptance/10_files/can_set_sticky_bits_without_root_owning_directory.cf +++ b/tests/acceptance/10_files/can_set_sticky_bits_without_root_owning_directory.cf @@ -6,30 +6,24 @@ # is set on the directory # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - ####################################################### - bundle agent test { meta: - - "description" - string => "Test that the agent can set the sticky + "description" + string => "Test that the agent can set the sticky bit on a directory that root does not own."; - "test_skip_unsupported" - string => "windows"; - "test_skip_needs_work" - string => "!has_stat"; + "test_skip_unsupported" string => "windows"; + "test_skip_needs_work" string => "!has_stat"; vars: !windows:: @@ -41,24 +35,31 @@ bundle agent test files: !windows:: "$(G.testdir)/test_sgid/." - create => "true", - perms => mog( $(mode), $(owner), $(group) ), - classes => scoped_classes_generic("namespace", "test_sgid_dir"); + create => "true", + perms => mog($(mode), $(owner), $(group)), + classes => scoped_classes_generic("namespace", "test_sgid_dir"); } ####################################################### - bundle agent check { - vars: test_sgid_dir_reached:: "expect_permoct" string => "$(test.mode)"; - "result_permoct" string => execresult('$(G.stat) -c %a $(G.testdir)/test_sgid', "useshell"); + + "result_permoct" + string => execresult( + '$(G.stat) -c %a $(G.testdir)/test_sgid', "useshell" + ); methods: - "Compare Results" - usebundle => dcs_check_strcmp( "$(expect_permoct)", "$(result_permoct)", $(this.promise_filename), "false"); + "Compare Results" + usebundle => dcs_check_strcmp( + "$(expect_permoct)", + "$(result_permoct)", + $(this.promise_filename), + "false" + ); reports: DEBUG:: diff --git a/tests/acceptance/10_files/copy_from_convert.cf b/tests/acceptance/10_files/copy_from_convert.cf index 8f06723e23..111cce9fe6 100644 --- a/tests/acceptance/10_files/copy_from_convert.cf +++ b/tests/acceptance/10_files/copy_from_convert.cf @@ -2,25 +2,20 @@ # CFE-2216: Files converted to directories should be changed # back on recursive copy ############################################################ - body common control { inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } ############################################################ - bundle agent init { files: - "$(G.testdir)/src/." - create => "true"; - "$(G.testdir)/src/foo" - content => "Hello CFEngine!"; - "$(G.testdir)/src/bar/." - create => "true"; + "$(G.testdir)/src/." create => "true"; + "$(G.testdir)/src/foo" content => "Hello CFEngine!"; + "$(G.testdir)/src/bar/." create => "true"; # The .sub file needs to know the value of $(G.testdir). We can use a # template in order to hardcode it in before execution. @@ -32,7 +27,6 @@ bundle agent init } ############################################################ - bundle agent test { meta: @@ -62,7 +56,6 @@ bundle agent test } ############################################################ - bundle agent check { classes: @@ -70,8 +63,7 @@ bundle agent check # back to a directory "ok" expression => and( - not(isdir("$(G.testdir)/dst/foo")), - isdir("$(G.testdir)/dst/bar") + not(isdir("$(G.testdir)/dst/foo")), isdir("$(G.testdir)/dst/bar") ); methods: @@ -81,13 +73,10 @@ bundle agent check } ############################################################ - bundle agent clean { # Clean up the files generated from the template files: - "$(this.promise_filename).sub" - delete => tidy; - "$(this.promise_filename).sub.cf-before-edit" - delete => tidy; + "$(this.promise_filename).sub" delete => tidy; + "$(this.promise_filename).sub.cf-before-edit" delete => tidy; } diff --git a/tests/acceptance/10_files/copy_from_preserve_false.cf b/tests/acceptance/10_files/copy_from_preserve_false.cf index 25278f4e33..11ebf865ae 100644 --- a/tests/acceptance/10_files/copy_from_preserve_false.cf +++ b/tests/acceptance/10_files/copy_from_preserve_false.cf @@ -1,84 +1,80 @@ body file control { - inputs => { "../default.sub.cf" }; + inputs => { "../default.sub.cf" }; } bundle agent main { methods: - "Test" usebundle => default("$(this.promise_filename)") ; + "Test" usebundle => default("$(this.promise_filename)"); } bundle agent init { files: + # We set the permissions of our source file so that we can be sure they + # are not the permissions of the target file at the end. + "$(this.promise_filename).src" perms => m("$(check.expect[src])"); - # We set the permissions of our source file so that we can be sure they - # are not the permissions of the target file at the end. + # We make sure the target file exists and has permissions different from + # the source file. + "$(this.promise_filename).target" delete => tidy; - "$(this.promise_filename).src" - perms => m( "$(check.expect[src])" ); - - # We make sure the target file exists and has permissions different from - # the source file. - - "$(this.promise_filename).target" - delete => tidy; - - "$(this.promise_filename).target" - create => "true", - perms => m( "$(check.expect[target])" ); + "$(this.promise_filename).target" + create => "true", + perms => m("$(check.expect[target])"); } bundle agent test { meta: - - "description" - string => "Test that preserve false in body copy_from doesn't modify + "description" + string => "Test that preserve false in body copy_from doesn't modify permissions of the promised file"; - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; files: - - # We promise that the target is a copy of the source file Since preserve - # is set to false, we expect the original permissions on the target file - # to remain unchanged. - - "$(this.promise_filename).target" - copy_from => local_cp_digest_preserve_false( "$(this.promise_filename).src" ); - + # We promise that the target is a copy of the source file Since preserve + # is set to false, we expect the original permissions on the target file + # to remain unchanged. + "$(this.promise_filename).target" + copy_from => local_cp_digest_preserve_false( + "$(this.promise_filename).src" + ); } + bundle agent check { vars: - "expect[src]" string => "500"; - "expect[target]" string => "600"; + "expect[src]" string => "500"; + "expect[target]" string => "600"; + "observe[src]" string => filestat("$(this.promise_filename).src", permoct); - "observe[src]" string => filestat( "$(this.promise_filename).src", permoct); - "observe[target]" string => filestat( "$(this.promise_filename).target", permoct); + "observe[target]" + string => filestat("$(this.promise_filename).target", permoct); methods: - "Test Result" - usebundle => dcs_check_strcmp( - "$(expect[target])", - "$(observe[target])", - $(this.promise_filename), - "false"); + usebundle => dcs_check_strcmp( + "$(expect[target])", + "$(observe[target])", + $(this.promise_filename), + "false" + ); reports: - DEBUG|EXTRA:: + DEBUG|EXTRA:: ".src Expect $(expect[src]), observe $(observe[target])"; ".target Expect $(expect[target]), observe $(observe[target])"; - } -body copy_from local_cp_digest_preserve_false (from) + +body copy_from local_cp_digest_preserve_false(from) { - source => "$(from)"; - preserve => "false"; - compare => "digest"; - copy_backup => "false"; + source => "$(from)"; + preserve => "false"; + compare => "digest"; + copy_backup => "false"; } diff --git a/tests/acceptance/10_files/copy_from_this_promiser.cf b/tests/acceptance/10_files/copy_from_this_promiser.cf index 1c224300ff..3070054d39 100755 --- a/tests/acceptance/10_files/copy_from_this_promiser.cf +++ b/tests/acceptance/10_files/copy_from_this_promiser.cf @@ -1,92 +1,94 @@ #!/var/cfengine/bin/cf-agent -f- body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - -bundle agent init { +bundle agent init +{ vars: - "ROOT" string => "/tmp/CFE-2489"; - "SOURCE" string => "$(ROOT)/SOURCE"; - "use_bundles" - slist => { "bundle_uses_copy_from_without_param", - "bundle_uses_copy_from_with_param" }; + "ROOT" string => "/tmp/CFE-2489"; + "SOURCE" string => "$(ROOT)/SOURCE"; + + "use_bundles" + slist => { + "bundle_uses_copy_from_without_param", + "bundle_uses_copy_from_with_param", + }; files: - "$(init.ROOT)/$(use_bundles)/." create => "true"; + "$(init.ROOT)/$(use_bundles)/." create => "true"; - # Setup source files to copy_from - "$(init.ROOT)/SOURCE/$(init.ROOT)/$(use_bundles)/file.txt" - create => "true"; + # Setup source files to copy_from + "$(init.ROOT)/SOURCE/$(init.ROOT)/$(use_bundles)/file.txt" create => "true"; } -bundle agent test { + +bundle agent test +{ meta: - "description" -> { "CFE-2489" } - string => "Test that this.promiser holds the correct value in a copy_from body that uses parameters"; + "description" -> { "CFE-2489" } + string => "Test that this.promiser holds the correct value in a copy_from body that uses parameters"; - "test_soft_fail" - string => "any", - meta => { "CFE-2489" }; + "test_soft_fail" + string => "any", + meta => { "CFE-2489" }; methods: - "XXX" usebundle => $(init.use_bundles); + "XXX" usebundle => $(init.use_bundles); } -bundle agent bundle_uses_copy_from_without_param { - +bundle agent bundle_uses_copy_from_without_param +{ files: - - # As expected, when a copy_from promise uses a non-parameterized body the - # this.promiser context is as expected (points to the promised file). - - "$(init.ROOT)/$(this.bundle)/file.txt" - copy_from => my_copy_without_param(); - -} -body copy_from my_copy_without_param() { - source => "$(init.ROOT)/SOURCE/$(this.promiser)"; - compare => "digest"; + # As expected, when a copy_from promise uses a non-parameterized body the + # this.promiser context is as expected (points to the promised file). + "$(init.ROOT)/$(this.bundle)/file.txt" copy_from => my_copy_without_param(); } -bundle agent bundle_uses_copy_from_with_param { +body copy_from my_copy_without_param() +{ + source => "$(init.ROOT)/SOURCE/$(this.promiser)"; + compare => "digest"; +} +bundle agent bundle_uses_copy_from_with_param +{ files: - - # Oddly, when a copy_from promise uses a parameterized body, the - # this.promiser context does not contain the promised file, instead, it - # seems to contain the parents promiser. So, in this case, it wrongly gets - # XXX from the 'test' bundle. - - "$(init.ROOT)/$(this.bundle)/file.txt" - copy_from => my_copy_with_param( "use_of_paramater_should_not_change_this_promiser" ); - + # Oddly, when a copy_from promise uses a parameterized body, the + # this.promiser context does not contain the promised file, instead, it + # seems to contain the parents promiser. So, in this case, it wrongly gets + # XXX from the 'test' bundle. + "$(init.ROOT)/$(this.bundle)/file.txt" + copy_from => my_copy_with_param( + "use_of_paramater_should_not_change_this_promiser" + ); } -body copy_from my_copy_with_param(root) { - source => "$(init.ROOT)/SOURCE/$(this.promiser)"; - compare => "digest"; + +body copy_from my_copy_with_param(root) +{ + source => "$(init.ROOT)/SOURCE/$(this.promiser)"; + compare => "digest"; } bundle agent check { - classes: + "pass" + expression => filesexist( + '[ "$(init.ROOT)/bundle_uses_copy_from_with_param/file.txt", + "$(init.ROOT)/bundle_uses_copy_from_without_param/file.txt" ]' + ); - "pass" - expression => filesexist( '[ "$(init.ROOT)/bundle_uses_copy_from_with_param/file.txt", - "$(init.ROOT)/bundle_uses_copy_from_without_param/file.txt" ]' ); reports: - - "$(this.promise_filename) $(with)" - with => ifelse( "pass", "Pass", "FAIL"); + "$(this.promise_filename) $(with)" with => ifelse("pass", "Pass", "FAIL"); } bundle agent __main__ { methods: - "init"; - "test"; - "check"; + "init"; + "test"; + "check"; } diff --git a/tests/acceptance/10_files/copy_local_file.cf b/tests/acceptance/10_files/copy_local_file.cf index d1f55ff1f0..6586969ae7 100644 --- a/tests/acceptance/10_files/copy_local_file.cf +++ b/tests/acceptance/10_files/copy_local_file.cf @@ -1,30 +1,27 @@ bundle common test_meta { vars: - "description" string => "Test that copying a file locally works"; - "story_id" string => "5576"; - "covers" string => "operational_repaired"; + "description" string => "Test that copying a file locally works"; + "story_id" string => "5576"; + "covers" string => "operational_repaired"; } # Ref: https://dev.cfengine.com/issues/5576 - ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: "target" string => "$(G.testdir)/target"; - files: + files: "$(target)" create => "true", edit_line => insert_lines("Initial Content"); @@ -34,15 +31,15 @@ bundle agent test { files: # Ensure the target file is exactly the same as this file - "$(init.target)" - copy_from => local_dcp($(this.promise_filename)); + "$(init.target)" copy_from => local_dcp($(this.promise_filename)); } ####################################################### - bundle agent check { - methods: - "" usebundle => dcs_check_diff($(init.target), $(this.promise_filename), $(this.promise_filename)); + "" + usebundle => dcs_check_diff( + $(init.target), $(this.promise_filename), $(this.promise_filename) + ); } diff --git a/tests/acceptance/10_files/copy_local_file3.cf b/tests/acceptance/10_files/copy_local_file3.cf index 666bc5683b..2c7442bcfa 100644 --- a/tests/acceptance/10_files/copy_local_file3.cf +++ b/tests/acceptance/10_files/copy_local_file3.cf @@ -3,27 +3,28 @@ # Test local_cp # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { files: - "$(G.testfile).expected" + "$(G.testfile).expected" copy_from => local_cp("$(this.promise_filename).expected"); } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(this.promise_filename).expected", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(this.promise_filename).expected", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/10_files/file_select_attrs_consistent_behavior/main.cf b/tests/acceptance/10_files/file_select_attrs_consistent_behavior/main.cf index 4ae20d5770..79b93f9857 100644 --- a/tests/acceptance/10_files/file_select_attrs_consistent_behavior/main.cf +++ b/tests/acceptance/10_files/file_select_attrs_consistent_behavior/main.cf @@ -5,9 +5,9 @@ ####################################################### body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common g @@ -15,6 +15,7 @@ bundle common g vars: "datafile" string => "$(this.promise_dirname)/rules.json"; } + bundle agent init { vars: @@ -24,9 +25,8 @@ bundle agent init "tests" slist => { - "test_delete_with_spec_from_data", - "test_delete_with_spec_from_policy", - }, + "test_delete_with_spec_from_data", "test_delete_with_spec_from_policy", + }, comment => "We have two tests combined here because they should be kept in sync."; "data" data => readjson($(g.datafile), 1M); @@ -55,54 +55,66 @@ bundle agent test meta => { "redmine#6584", "zendesk#1466" }; methods: - "Test delete with spec from policy" - usebundle => test_delete_with_spec_from_policy; + "Test delete with spec from policy" + usebundle => test_delete_with_spec_from_policy; - "Test delete with spec from data" - usebundle => test_delete_with_spec_from_data($(g.datafile)); + "Test delete with spec from data" + usebundle => test_delete_with_spec_from_data($(g.datafile)); } -bundle agent test_delete_with_spec_from_policy { +bundle agent test_delete_with_spec_from_policy +{ files: # This promise should be an effictive mirror of the promise with handle 'test_delete_with_spec_from_data' - "$(G.testdir)/$(this.bundle)/tmp/logs/tidy" - delete => tidy, - file_select => - select_file_with_extension_retention_mtime(".*.log", # == 'filter' key in JSON - "plain", # == 'type' key in JSON - "2", # == 'retention' key in JSON - "$(G.testdir)/$(this.bundle)/tmp/logs/tidy"), # == 'location' key in JSON - depth_search => recurse("2"), # == 'depth' key in JSON - action => if_elapsed_inform("10"), # == 'frequency' key in JSON - if => "any"; # == 'context' key in JSON - + "$(G.testdir)/$(this.bundle)/tmp/logs/tidy" + delete => tidy, + file_select => select_file_with_extension_retention_mtime( + ".*.log", + # == 'filter' key in JSON + "plain", + # == 'type' key in JSON + "2", + # == 'retention' key in JSON + "$(G.testdir)/$(this.bundle)/tmp/logs/tidy" + ), + # == 'location' key in JSON + depth_search => recurse("2"), + # == 'depth' key in JSON + action => if_elapsed_inform("10"), + # == 'frequency' key in JSON + if => "any"; + + # == 'context' key in JSON reports: DEBUG:: - "'$(G.testdir)/$(this.bundle)/tmp/logs/tidy'"; + "'$(G.testdir)/$(this.bundle)/tmp/logs/tidy'"; } bundle agent test_delete_with_spec_from_data(ref) { vars: - "input_cleanup" - comment => "Read json file into container", - data => readjson("${ref}", 1024); + "input_cleanup" + comment => "Read json file into container", + data => readjson("${ref}", 1024); - "i" - comment => "Get index of json for iteration", - slist => getindices("input_cleanup"); + "i" + comment => "Get index of json for iteration", + slist => getindices("input_cleanup"); methods: - "do_cleanup" usebundle => do_cleanup("${input_cleanup[${i}][location]}", - "${input_cleanup[${i}][context]}", - "${input_cleanup[${i}][action]}", - "${input_cleanup[${i}][frequency]}", - "${input_cleanup[${i}][type]}", - "${input_cleanup[${i}][filter]}", - "${input_cleanup[${i}][retention]}", - "${input_cleanup[${i}][depth]}", - "${input_cleanup[${i}][size]}", - "${input_cleanup[${i}][reason]}"); + "do_cleanup" + usebundle => do_cleanup( + "${input_cleanup[${i}][location]}", + "${input_cleanup[${i}][context]}", + "${input_cleanup[${i}][action]}", + "${input_cleanup[${i}][frequency]}", + "${input_cleanup[${i}][type]}", + "${input_cleanup[${i}][filter]}", + "${input_cleanup[${i}][retention]}", + "${input_cleanup[${i}][depth]}", + "${input_cleanup[${i}][size]}", + "${input_cleanup[${i}][reason]}" + ); reports: DEBUG:: @@ -120,35 +132,27 @@ reason => ${input_cleanup[${i}][reason]} "; } - - -bundle agent do_cleanup(location, - context, - action, - frequency, - type, - filter, - retention, - depth, - size, - reason) { +bundle agent do_cleanup(location, context, action, frequency, type, filter, retention, depth, size, reason) +{ classes: - #"action_tidy" expression => strcmp("$(action)", "TIDY"); - #"action_rotate" expression => strcmp("$(action)", "ROTATE"); - #"requested_size" expression => regcmp("[0-9]*", "$(size)"); + #"action_tidy" expression => strcmp("$(action)", "TIDY"); + #"action_rotate" expression => strcmp("$(action)", "ROTATE"); + #"requested_size" expression => regcmp("[0-9]*", "$(size)"); files: #action_tidy:: - "$(G.testdir)/test_delete_with_spec_from_data/$(location)" - handle => "test_delete_with_spec_from_data", - delete => tidy, - file_select => select_file_with_extension_retention_mtime("$(filter)", - "$(type)", - "$(retention)", - "$(G.testdir)/test_delete_with_spec_from_data/$(location)"), - depth_search => recurse("$(depth)"), - action => if_elapsed_inform("$(frequency)"), - if => "$(context)"; + "$(G.testdir)/test_delete_with_spec_from_data/$(location)" + handle => "test_delete_with_spec_from_data", + delete => tidy, + file_select => select_file_with_extension_retention_mtime( + "$(filter)", + "$(type)", + "$(retention)", + "$(G.testdir)/test_delete_with_spec_from_data/$(location)" + ), + depth_search => recurse("$(depth)"), + action => if_elapsed_inform("$(frequency)"), + if => "$(context)"; reports: DEBUG:: @@ -158,16 +162,29 @@ bundle agent do_cleanup(location, bundle agent check { vars: - "files[test_delete_with_spec_from_data]" slist => lsdir("$(G.testdir)/test_delete_with_spec_from_data/tmp/logs/tidy", ".*.log", "false"); - "files[test_delete_with_spec_from_policy]" slist => lsdir("$(G.testdir)/test_delete_with_spec_from_policy/tmp/logs/tidy", ".*.log", "false"); + "files[test_delete_with_spec_from_data]" + slist => lsdir( + "$(G.testdir)/test_delete_with_spec_from_data/tmp/logs/tidy", + ".*.log", + "false" + ); + + "files[test_delete_with_spec_from_policy]" + slist => lsdir( + "$(G.testdir)/test_delete_with_spec_from_policy/tmp/logs/tidy", + ".*.log", + "false" + ); "count_files[test_delete_with_spec_from_data]" - int => length("files[test_delete_with_spec_from_data]") - ; + int => length("files[test_delete_with_spec_from_data]"); + "count_files[test_delete_with_spec_from_policy]" int => length("files[test_delete_with_spec_from_policy]"); - "files_in_tidy_dir_count_$(init.tests)" int => length("files_in_tidy_dir[$(init.tests)]"); + "files_in_tidy_dir_count_$(init.tests)" + int => length("files_in_tidy_dir[$(init.tests)]"); + "OK_tests" slist => maplist("OK_$(this)", @(init.tests)); classes: @@ -185,12 +202,8 @@ bundle agent check "files[test_delete_with_spec_from_policy] = $(files[test_delete_with_spec_from_policy])"; "count_files[test_delete_with_spec_from_data] = $(count_files[test_delete_with_spec_from_data])"; "count_files[test_delete_with_spec_from_policy] = $(count_files[test_delete_with_spec_from_policy])"; - - "$(init.tests) pass" - if => "OK_$(init.tests)"; - - "$(init.tests) fail" - if => "!OK_$(init.tests)"; + "$(init.tests) pass" if => "OK_$(init.tests)"; + "$(init.tests) fail" if => "!OK_$(init.tests)"; OK:: "$(this.promise_filename) Pass"; @@ -198,18 +211,24 @@ bundle agent check !OK:: "$(this.promise_filename) FAIL"; } -body file_select select_file_with_extension_retention_mtime(filter, type, days_old, location) { - mtime => irange(0, ago(0, 0, $(days_old), 0, 0, 0)); - path_name => { "$(location)/.*" }; - leaf_name => { "$(filter)" }; - file_types => { "$(type)" }; -# The intention is to select files older than x days (mtime between now and x days ago should be retained) I believe the second file_result is correct. -# file_result => "mtime.path_name.leaf_name.file_types"; # Oddly this works for test_delete_with_spec_from_policy, but not with test_delete_with_spec_from_data - file_result => "!mtime.path_name.leaf_name.file_types"; # Oddly this works for test_delete_with_spec_from_data, but not with test_delete_with_spec_from_policy + +body file_select select_file_with_extension_retention_mtime(filter, type, days_old, location) +{ + mtime => irange(0, ago(0, 0, $(days_old), 0, 0, 0)); + path_name => { "$(location)/.*" }; + leaf_name => { "$(filter)" }; + file_types => { "$(type)" }; + + # The intention is to select files older than x days (mtime between now and x days ago should be retained) I believe the second file_result is correct. + # file_result => "mtime.path_name.leaf_name.file_types"; # Oddly this works for test_delete_with_spec_from_policy, but not with test_delete_with_spec_from_data + file_result => "!mtime.path_name.leaf_name.file_types"; + + # Oddly this works for test_delete_with_spec_from_data, but not with test_delete_with_spec_from_policy } -body action if_elapsed_inform(x) { - report_level => "inform"; - ifelapsed => "$(x)"; - expireafter => "$(x)"; +body action if_elapsed_inform(x) +{ + report_level => "inform"; + ifelapsed => "$(x)"; + expireafter => "$(x)"; } diff --git a/tests/acceptance/10_files/file_select_attrs_consistent_behavior/rules.json b/tests/acceptance/10_files/file_select_attrs_consistent_behavior/rules.json index be311e4319..ae6c69198c 100644 --- a/tests/acceptance/10_files/file_select_attrs_consistent_behavior/rules.json +++ b/tests/acceptance/10_files/file_select_attrs_consistent_behavior/rules.json @@ -1,14 +1,14 @@ [ -{ -"location": "/tmp/logs/tidy", -"context": "any", -"action": "TIDY", -"frequency": "10", -"type": "plain", -"filter": ".*.log", -"retention": "2", -"depth": "2", -"size": "ANY", -"reason": "Tidy all logs" -} + { + "location": "/tmp/logs/tidy", + "context": "any", + "action": "TIDY", + "frequency": "10", + "type": "plain", + "filter": ".*.log", + "retention": "2", + "depth": "2", + "size": "ANY", + "reason": "Tidy all logs" + } ] diff --git a/tests/acceptance/10_files/files_with_spaces.cf b/tests/acceptance/10_files/files_with_spaces.cf index 85fe266680..00687d84ea 100644 --- a/tests/acceptance/10_files/files_with_spaces.cf +++ b/tests/acceptance/10_files/files_with_spaces.cf @@ -1,18 +1,17 @@ body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { - meta: - "description" string => "ensure clean starting point before test"; + meta: + "description" string => "ensure clean starting point before test"; - files: - "$(G.testdir)/$(test.file[$(test.idx)])" - delete => tidy; + files: + "$(G.testdir)/$(test.file[$(test.idx)])" delete => tidy; } bundle agent test @@ -24,8 +23,7 @@ bundle agent test vars: "file[1]" string => "file with space.txt"; "file[2]" string => "path with/a space.txt"; - - "idx" slist => getindices( file ); + "idx" slist => getindices(file); files: "$(G.testdir)/$(file[$(idx)])" @@ -36,32 +34,35 @@ bundle agent test bundle agent check { vars: - "expected_classes" slist => maplist( "file_$(this)_repaired", "test.idx" ); -# NOT WORKING -- variable not expanded "/tmp/TESTDIR.cfengine/$(test#file[2])" - "expected_files" slist => maplist( "$(G.testdir)/$(test.file[$(this)])", "test.idx"); -# NOT WORKING -- Only the first file is actually tested -# "expected_files" slist => { "$(G.testdir)/$(test.file[@(test.idx)])" }; -# NOT WORKING -- only the second file is created -# "expected_files" slist => { "$(G.testdir)/$(test.file[$(test.idx)])" }; + "expected_classes" slist => maplist("file_$(this)_repaired", "test.idx"); + + # NOT WORKING -- variable not expanded "/tmp/TESTDIR.cfengine/$(test#file[2])" + "expected_files" + slist => maplist("$(G.testdir)/$(test.file[$(this)])", "test.idx"); + # NOT WORKING -- Only the first file is actually tested + # "expected_files" slist => { "$(G.testdir)/$(test.file[@(test.idx)])" }; + # NOT WORKING -- only the second file is created + # "expected_files" slist => { "$(G.testdir)/$(test.file[$(test.idx)])" }; "classes" slist => classesmatching("file_.*"); + classes: "have_expected_classes" and => { @(expected_classes) }; - "have_expected_files" expression => filesexist( @(expected_files) ); + "have_expected_files" expression => filesexist(@(expected_files)); methods: "Report Test Result" - usebundle => dcs_passif_expected("have_expected_classes,have_expected_files", "FAIL", $(this.promise_filename) ), - inherit => "true"; + usebundle => dcs_passif_expected( + "have_expected_classes,have_expected_files", + "FAIL", + $(this.promise_filename) + ), + inherit => "true"; reports: DEBUG:: - "Expecting class: '$(expected_classes)'"; - "Expecting file: '$(expected_files)'"; - - "Have expected classes" - if => "have_expected_classes"; - - "Have expected files" - if => "have_expected_files"; + "Expecting class: '$(expected_classes)'"; + "Expecting file: '$(expected_files)'"; + "Have expected classes" if => "have_expected_classes"; + "Have expected files" if => "have_expected_files"; } diff --git a/tests/acceptance/10_files/locally_copied_sparse_file_preserves_sparseness.cf b/tests/acceptance/10_files/locally_copied_sparse_file_preserves_sparseness.cf index 43b59c5ca1..f6a3f48980 100644 --- a/tests/acceptance/10_files/locally_copied_sparse_file_preserves_sparseness.cf +++ b/tests/acceptance/10_files/locally_copied_sparse_file_preserves_sparseness.cf @@ -1,9 +1,9 @@ # Test that locally copied files keep their sparsness body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -17,18 +17,18 @@ bundle agent init delete => tidy, handle => "init_tidy_copy"; - commands: "/bin/dd" args => "if=/dev/zero of=$(test.file[sparse]) seek=1024 bs=1024 count=0", - if => not( fileexists( "$(test.file[sparse])" )), + if => not(fileexists("$(test.file[sparse])")), depends_on => { "init_tidy_sparse", "init_tidy_copy" }; } bundle agent test { meta: - "description" string => "ENT-2769: Test that when a sparse file is copied locally the sparseness is preserved"; + "description" + string => "ENT-2769: Test that when a sparse file is copied locally the sparseness is preserved"; # Various exotic filesystems don't support sparseness, see the unit # test "files_copy_test.c" for details. @@ -39,33 +39,35 @@ bundle agent test "file[copy]" string => "$(G.testdir)/copy"; files: - "$(file[copy])" - copy_from => local_dcp( "$(file[sparse])" ); + "$(file[copy])" copy_from => local_dcp("$(file[sparse])"); } bundle agent check { vars: "size[sparse]" - string => filestat( "$(test.file[sparse])", size ), - if => fileexists( "$(test.file[sparse])" ); + string => filestat("$(test.file[sparse])", size), + if => fileexists("$(test.file[sparse])"); "size[copy]" - string => filestat( "$(test.file[copy])", size ), - if => fileexists( "$(test.file[copy])" ); + string => filestat("$(test.file[copy])", size), + if => fileexists("$(test.file[copy])"); "du[sparse]" - string => execresult( "expr `du -k $(test.file[sparse]) | cut -f1` '*' 1024", useshell), - if => fileexists( "$(test.file[sparse])" ); + string => execresult( + "expr `du -k $(test.file[sparse]) | cut -f1` '*' 1024", useshell + ), + if => fileexists("$(test.file[sparse])"); "du[copy]" - string => execresult( "expr `du -k $(test.file[copy]) | cut -f1` '*' 1024", useshell), - if => fileexists( "$(test.file[copy])" ); + string => execresult( + "expr `du -k $(test.file[copy]) | cut -f1` '*' 1024", useshell + ), + if => fileexists("$(test.file[copy])"); classes: - "size_match" expression => strcmp( "$(size[sparse])", "$(size[copy])" ); - "du_less" expression => islessthan( "$(du[copy])", "$(size[copy])" ); - + "size_match" expression => strcmp("$(size[sparse])", "$(size[copy])"); + "du_less" expression => islessthan("$(du[copy])", "$(size[copy])"); "OK" and => { "size_match", "du_less" }; reports: @@ -80,9 +82,10 @@ bundle agent check "Sparse du -k: '$(du[sparse])'"; "Copy filestat.size: $(size[copy])"; "Copy du -k: '$(du[copy])'"; + DEBUG.size_match:: "Sparse file and copy match in apparent size."; + DEBUG.du_less:: "Copy of sparse file is using more bytes on disk than the real size of the file, in bytes, so it's probably non-sparse!"; - } diff --git a/tests/acceptance/10_files/move_obstruction_respects_warn_only.cf b/tests/acceptance/10_files/move_obstruction_respects_warn_only.cf index e957087359..695ed5cb7b 100644 --- a/tests/acceptance/10_files/move_obstruction_respects_warn_only.cf +++ b/tests/acceptance/10_files/move_obstruction_respects_warn_only.cf @@ -1,32 +1,28 @@ ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: "target" string => "$(G.testfile)"; - files: - "$(target)/." - create => "true"; + files: + "$(target)/." create => "true"; } body link_from ln_s(x) { - link_type => "symlink"; - source => "$(x)"; - when_no_source => "force"; + link_type => "symlink"; + source => "$(x)"; + when_no_source => "force"; } - bundle agent test { files: @@ -37,7 +33,6 @@ bundle agent test } ####################################################### - bundle agent check { classes: @@ -46,6 +41,7 @@ bundle agent check reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/move_obstructions-promiser-is-symlink.cf b/tests/acceptance/10_files/move_obstructions-promiser-is-symlink.cf index 4da0193bbf..29a1b18d24 100644 --- a/tests/acceptance/10_files/move_obstructions-promiser-is-symlink.cf +++ b/tests/acceptance/10_files/move_obstructions-promiser-is-symlink.cf @@ -1,4 +1,3 @@ - ############################################################################## # # Test that move_obstructions works consistently for various types of files @@ -6,7 +5,6 @@ # - copy_from # ############################################################################## - body file control { inputs => { "../default.sub.cf" }; @@ -16,187 +14,181 @@ body file control bundle agent __main__ { methods: - "init"; - "test"; - "check"; - "cleanup"; + "init"; + "test"; + "check"; + "cleanup"; } bundle agent cleanup { vars: - "potential_files_to_delete" - slist => { - # The files we tested - "@(init.test_files)", - "$(init.orig_ln_target_filename)", - # .cfsaved files get created as copy_from replaces files - maplist( "$(this).cfsaved", @(init.test_files) ), - # The special case source file to copy from - maplist( "$(this).source", @(init.test_files) ), - }; + "potential_files_to_delete" + slist => { + # The files we tested + "@(init.test_files)", + "$(init.orig_ln_target_filename)", + # .cfsaved files get created as copy_from replaces files + maplist("$(this).cfsaved", @(init.test_files)), + # The special case source file to copy from + maplist("$(this).source", @(init.test_files)), + }; files: - "$(potential_files_to_delete)" - delete => tidy, - if => fileexists( "$(this.promiser)" ); + "$(potential_files_to_delete)" + delete => tidy, + if => fileexists("$(this.promiser)"); } bundle agent init { vars: - # Create test files that will serve as obstructions - "test_files" slist => { - "$(G.testdir)/copy_from", - "$(G.testdir)/content", - "$(G.testdir)/edit_template_string_inline_mustache", - "$(G.testdir)/edit_template_cfengine", - "$(G.testdir)/edit_template_mustache", - #"$(G.testdir)/edit_line", + # Create test files that will serve as obstructions + "test_files" + slist => { + "$(G.testdir)/copy_from", + "$(G.testdir)/content", + "$(G.testdir)/edit_template_string_inline_mustache", + "$(G.testdir)/edit_template_cfengine", + "$(G.testdir)/edit_template_mustache", + #"$(G.testdir)/edit_line", }; - "orig_ln_target_filename" - string => "$(G.testdir)/orig_ln_target"; + "orig_ln_target_filename" string => "$(G.testdir)/orig_ln_target"; - "orig_ln_target_content" - string => "This content originally lived in a symlink target"; + "orig_ln_target_content" + string => "This content originally lived in a symlink target"; files: - # Here we initialize a file which will be a symlinks target - "$(orig_ln_target_filename)" - create => "true", - content => "$(orig_ln_target_content)"; + # Here we initialize a file which will be a symlinks target + "$(orig_ln_target_filename)" + create => "true", + content => "$(orig_ln_target_content)"; - # Here we have a symlink that we will be targeting with a content files promise - "$(test_files)" - create => "true", - move_obstructions => "true", - link_from => ln_s( "$(G.testdir)/orig_ln_target" ); + # Here we have a symlink that we will be targeting with a content files promise + "$(test_files)" + create => "true", + move_obstructions => "true", + link_from => ln_s("$(G.testdir)/orig_ln_target"); reports: - DEBUG:: + DEBUG:: "$(test_files) initalized" - if => and( fileexists( "$(test_files)" ), - islink( $(test_files) ) ); + if => and(fileexists("$(test_files)"), islink($(test_files))); } body link_from ln_s(x) { - link_type => "symlink"; - source => "$(x)"; - when_no_source => "force"; + link_type => "symlink"; + source => "$(x)"; + when_no_source => "force"; } -############################################################################## +############################################################################## bundle agent test { meta: - "description" - string => concat( - "Test move_obstructions with content, edit_template,", - " and edit_template_string" - ); + "description" + string => concat( + "Test move_obstructions with content, edit_template,", + " and edit_template_string" + ); files: - # Test move_obstructions with copy_from - # This isn't in init because it's specific to copy_from needing to have a source file. - "$(G.testdir)/copy_from.source" - content => "$(check.expected_content)", - if => fileexists( "$(G.testdir)/copy_from" ); - - "$(G.testdir)/copy_from" - move_obstructions => "true", - copy_from => local_dcp("$(G.testdir)/copy_from.source"), - if => fileexists( "$(this.promiser)" ); - - "$(G.testdir)/edit_template_cfengine" - move_obstructions => "true", - template_method => "cfengine", - edit_template => "$(G.testdir)/copy_from.source", - if => fileexists( "$(this.promiser)" ); - - "$(G.testdir)/edit_template_mustache" - move_obstructions => "true", - template_method => "mustache", - edit_template => "$(G.testdir)/copy_from.source", - if => fileexists( "$(this.promiser)" ); - - # Test move_obstructions with content attribute - "$(G.testdir)/content" - move_obstructions => "true", - content => "$(check.expected_content)", - if => fileexists( "$(this.promiser)" ); - - # Test move_obstructions with template_method inline_mustache - "$(G.testdir)/edit_template_string_inline_mustache" - move_obstructions => "true", - template_method => "inline_mustache", - edit_template_string => "$(check.expected_content)", - if => fileexists( "$(this.promiser)" ); + # Test move_obstructions with copy_from + # This isn't in init because it's specific to copy_from needing to have a source file. + "$(G.testdir)/copy_from.source" + content => "$(check.expected_content)", + if => fileexists("$(G.testdir)/copy_from"); + + "$(G.testdir)/copy_from" + move_obstructions => "true", + copy_from => local_dcp("$(G.testdir)/copy_from.source"), + if => fileexists("$(this.promiser)"); + + "$(G.testdir)/edit_template_cfengine" + move_obstructions => "true", + template_method => "cfengine", + edit_template => "$(G.testdir)/copy_from.source", + if => fileexists("$(this.promiser)"); + + "$(G.testdir)/edit_template_mustache" + move_obstructions => "true", + template_method => "mustache", + edit_template => "$(G.testdir)/copy_from.source", + if => fileexists("$(this.promiser)"); + + # Test move_obstructions with content attribute + "$(G.testdir)/content" + move_obstructions => "true", + content => "$(check.expected_content)", + if => fileexists("$(this.promiser)"); + + # Test move_obstructions with template_method inline_mustache + "$(G.testdir)/edit_template_string_inline_mustache" + move_obstructions => "true", + template_method => "inline_mustache", + edit_template_string => "$(check.expected_content)", + if => fileexists("$(this.promiser)"); # # Test move_obstructions with edit_line # "$(G.testdir)/edit_line" # move_obstructions => "true", # edit_line => insert_lines("$(check.expected_content)"), # if => fileexists( "$(this.promiser)" ); - } ############################################################################## - bundle agent check { vars: - "expected_content" string => "This is content promised targeting a symlink."; - "num_test_files" int => length( @(init.test_files) ); + "expected_content" + string => "This is content promised targeting a symlink."; - # We check the promised: - # - for each test file - # - content - # - type + "num_test_files" int => length(@(init.test_files)); - "num_expected_test_ok_classes" - int => int( eval( "$(num_test_files)*2", math, infix) ); + # We check the promised: + # - for each test file + # - content + # - type + "num_expected_test_ok_classes" + int => int(eval("$(num_test_files)*2", math, infix)); classes: - "DEBUG" expression => "any"; - "all_test_files_exist" - expression => filesexist( @(init.test_files) ); + "DEBUG" expression => "any"; + "all_test_files_exist" expression => filesexist(@(init.test_files)); all_test_files_exist:: # Once we verified that all the test files exist we can check all the expectations - # These class strings will be canonified as classes, they are tagged for easy identification - "$(init.test_files) type as expected" meta => { "test_ok_class" }, - if => isplain( "$(init.test_files)" ); + if => isplain("$(init.test_files)"); "$(init.test_files) content as expected" meta => { "test_ok_class" }, - if => strcmp( readfile("$(init.test_files)"), - "$(expected_content)"); + if => strcmp(readfile("$(init.test_files)"), "$(expected_content)"); "overall_success" - expression => strcmp( length( classesmatching( ".*", "test_ok_class" ) ), - "$(num_expected_test_ok_classes)" ); + expression => strcmp( + length(classesmatching(".*", "test_ok_class")), + "$(num_expected_test_ok_classes)" + ); reports: !all_test_files_exist:: "The test does not appear to have been initialized, the expected test files are missing $(with)" - with => concat( "(", join( ",", @(init.test_files) ), ")" ); + with => concat("(", join(",", @(init.test_files)), ")"); DEBUG:: - "Number of test files: $(num_test_files)"; - "Number of expected test ok classes to pass: $(num_expected_test_ok_classes)"; "$(with) test_ok_classes:" - with => length( classesmatching( ".*", "test_ok_class" ) ); + with => length(classesmatching(".*", "test_ok_class")); "$(with)" - with => join( "$(const.n)", classesmatching( ".*", "test_ok_class" ) ); + with => join("$(const.n)", classesmatching(".*", "test_ok_class")); overall_success:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/10_files/mustache_missing_variable_is_empty_string_by_default.cf b/tests/acceptance/10_files/mustache_missing_variable_is_empty_string_by_default.cf index 6bf7c50624..30fff957a0 100644 --- a/tests/acceptance/10_files/mustache_missing_variable_is_empty_string_by_default.cf +++ b/tests/acceptance/10_files/mustache_missing_variable_is_empty_string_by_default.cf @@ -1,20 +1,19 @@ bundle common test_meta { vars: - "description" -> { "Mustache Specification" } - string => "Missed variables should be empty strings by + "description" -> { "Mustache Specification" } + string => "Missed variables should be empty strings by default in rendered mustache templates as described in the Mustache Manual.", - comment => "https://mustache.github.io/mustache.5.html"; + comment => "https://mustache.github.io/mustache.5.html"; } ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -24,12 +23,10 @@ bundle agent init "template_data" data => '{ "key1": "value1", "key3": "value3" }'; files: - "$(template_target)" - create => "true"; + "$(template_target)" create => "true"; } ####################################################### - bundle agent test { files: @@ -42,13 +39,15 @@ bundle agent test bundle agent check { vars: - "command" string => "$(sys.cf_agent) -KIf $(this.promise_filename).sub -DAUTO"; + "command" + string => "$(sys.cf_agent) -KIf $(this.promise_filename).sub -DAUTO"; + "actual" string => "$(init.template_target)"; "expected" string => "$(this.promise_filename).mustache.expected"; "test" string => "$(this.promise_filename)"; methods: - "check" usebundle => dcs_check_diff( $(actual), $(expected), $(test) ); + "check" usebundle => dcs_check_diff($(actual), $(expected), $(test)); reports: DEBUG:: diff --git a/tests/acceptance/10_files/mustache_propagates_failure.cf b/tests/acceptance/10_files/mustache_propagates_failure.cf index 53a81cf630..39d2dad108 100644 --- a/tests/acceptance/10_files/mustache_propagates_failure.cf +++ b/tests/acceptance/10_files/mustache_propagates_failure.cf @@ -1,28 +1,26 @@ bundle common test_meta { vars: - "description" string => "Test that Mustache templates propagate classes to calling bundle"; + "description" + string => "Test that Mustache templates propagate classes to calling bundle"; } ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: "template_target" string => "$(G.testfile)"; files: - "$(template_target)" - create => "true"; + "$(template_target)" create => "true"; } bundle agent render_mustache @@ -36,17 +34,18 @@ bundle agent render_mustache bundle agent test { methods: - "any" usebundle => render_mustache, + "any" + usebundle => render_mustache, classes => if_repaired("mustache_propagated"); } ####################################################### - bundle agent check { reports: mustache_propagated:: "$(this.promise_filename) Pass"; + !mustache_propagated:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/mustache_render_multiline_template_data.cf b/tests/acceptance/10_files/mustache_render_multiline_template_data.cf index 15e3038764..410932e2b0 100644 --- a/tests/acceptance/10_files/mustache_render_multiline_template_data.cf +++ b/tests/acceptance/10_files/mustache_render_multiline_template_data.cf @@ -1,39 +1,44 @@ bundle common test_meta { vars: - "description" string => "Test that data passed to edit_template can be rendered as multiline JSON."; + "description" + string => "Test that data passed to edit_template can be rendered as multiline JSON."; } body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -bundle agent test +bundle agent test { vars: "template_target" string => "$(G.testfile)"; - "data" data => parsejson('{ "key": "value", "key2": [ "list", "elements" ], "key3": { "complex": { "data": "structure", "with": [ "deep", "data" ] } } }'); + "data" + data => parsejson( + '{ "key": "value", "key2": [ "list", "elements" ], "key3": { "complex": { "data": "structure", "with": [ "deep", "data" ] } } }' + ); files: - "$(template_target)" - create => "true"; + "$(template_target)" create => "true"; - - "$(template_target)" - edit_template => "$(this.promise_filename).mustache", - template_method => "mustache", - template_data => mergedata(data); + "$(template_target)" + edit_template => "$(this.promise_filename).mustache", + template_method => "mustache", + template_data => mergedata(data); } ####################################################### - bundle agent check { methods: "check" - usebundle => dcs_check_diff( $(test.template_target), "$(this.promise_filename).expected", $(this.promise_filename)); + usebundle => dcs_check_diff( + $(test.template_target), + "$(this.promise_filename).expected", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/10_files/mustache_respects_dryryn.cf b/tests/acceptance/10_files/mustache_respects_dryryn.cf index 458219d1e4..7ca70b2ce3 100644 --- a/tests/acceptance/10_files/mustache_respects_dryryn.cf +++ b/tests/acceptance/10_files/mustache_respects_dryryn.cf @@ -1,20 +1,20 @@ bundle common test_meta { vars: - "description" string => "Test that body agent control dryrun restricts mustache template rendering"; - "story_id" string => "5535"; - "covers" string => "dryrun_repaired"; + "description" + string => "Test that body agent control dryrun restricts mustache template rendering"; + + "story_id" string => "5535"; + "covers" string => "dryrun_repaired"; } # Ref: https://dev.cfengine.com/issues/6739 - ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -23,18 +23,19 @@ bundle agent init "template_target" string => "$(G.testfile)"; files: - "$(template_target)" - create => "true"; + "$(template_target)" create => "true"; } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_agent) -KIf $(this.promise_filename).sub -DAUTO"; + "command" + string => "$(sys.cf_agent) -KIf $(this.promise_filename).sub -DAUTO"; methods: "check" - usebundle => dcs_passif_output(".*Pass.*", ".*FAIL.*", $(command), $(this.promise_filename)); + usebundle => dcs_passif_output( + ".*Pass.*", ".*FAIL.*", $(command), $(this.promise_filename) + ); } diff --git a/tests/acceptance/10_files/mustache_respects_dryryn_option.cf b/tests/acceptance/10_files/mustache_respects_dryryn_option.cf index 673fe04f5c..50212703f0 100644 --- a/tests/acceptance/10_files/mustache_respects_dryryn_option.cf +++ b/tests/acceptance/10_files/mustache_respects_dryryn_option.cf @@ -1,20 +1,20 @@ bundle common test_meta { vars: - "description" string => "Test that --dry-run restricts mustache template rendering"; - "story_id" string => "5535"; - "covers" string => "dryrun_repaired"; + "description" + string => "Test that --dry-run restricts mustache template rendering"; + + "story_id" string => "5535"; + "covers" string => "dryrun_repaired"; } # Ref: https://dev.cfengine.com/issues/6739 - ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -23,18 +23,19 @@ bundle agent init "template_target" string => "$(G.testfile)"; files: - "$(template_target)" - create => "true"; + "$(template_target)" create => "true"; } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_agent) --dry-run -KIf $(this.promise_filename).sub -DAUTO"; + "command" + string => "$(sys.cf_agent) --dry-run -KIf $(this.promise_filename).sub -DAUTO"; methods: "check" - usebundle => dcs_passif_output(".*Pass.*", ".*FAIL.*", $(command), $(this.promise_filename)); + usebundle => dcs_passif_output( + ".*Pass.*", ".*FAIL.*", $(command), $(this.promise_filename) + ); } diff --git a/tests/acceptance/10_files/mustache_respects_warn_only.cf b/tests/acceptance/10_files/mustache_respects_warn_only.cf index 60e074a9f3..f17bb410d1 100644 --- a/tests/acceptance/10_files/mustache_respects_warn_only.cf +++ b/tests/acceptance/10_files/mustache_respects_warn_only.cf @@ -1,32 +1,30 @@ bundle common test_meta { vars: - "description" string => "Test that body action_policy warn restricts mustache template rendering"; - "story_id" string => "5535"; - "covers" string => "dryrun_repaired"; + "description" + string => "Test that body action_policy warn restricts mustache template rendering"; + + "story_id" string => "5535"; + "covers" string => "dryrun_repaired"; } # Ref: https://dev.cfengine.com/issues/6739 - ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: "template_target" string => "$(G.testfile)"; - files: - "$(template_target)" - create => "true"; + files: + "$(template_target)" create => "true"; } bundle agent test @@ -44,16 +42,16 @@ bundle agent test } ####################################################### - bundle agent check { classes: - "fail" expression => regline("SHOULD NOT RENDER", $(test.template_target) ); + "fail" expression => regline("SHOULD NOT RENDER", $(test.template_target)); "defined_class" expression => "mustache_warn_failed"; reports: !fail.defined_class:: "$(this.promise_filename) Pass"; + fail|!defined_class:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/no_error_archiving_previous_backup_using_copy_from_without_create_true.cf b/tests/acceptance/10_files/no_error_archiving_previous_backup_using_copy_from_without_create_true.cf index cd75ba5fcb..75fbabea84 100644 --- a/tests/acceptance/10_files/no_error_archiving_previous_backup_using_copy_from_without_create_true.cf +++ b/tests/acceptance/10_files/no_error_archiving_previous_backup_using_copy_from_without_create_true.cf @@ -1,36 +1,47 @@ body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "description" -> { "CFE-3640" } - string => "Test that automatically created backup copies of files promised via copy_from do not produce errors."; + "description" -> { "CFE-3640" } + string => "Test that automatically created backup copies of files promised via copy_from do not produce errors."; vars: - "agent_log_path" string => "$(sys.workdir)$(const.dirsep)state$(const.dirsep)agent.log"; - "cf_agent" string => ifelse(isvariable("sys.cf_agent"), "$(sys.cf_agent)", "/var/cfengine/bin/cf-agent"); + "agent_log_path" + string => "$(sys.workdir)$(const.dirsep)state$(const.dirsep)agent.log"; + + "cf_agent" + string => ifelse( + isvariable("sys.cf_agent"), + "$(sys.cf_agent)", + "/var/cfengine/bin/cf-agent" + ); commands: - "$(cf_agent) -Kf $(this.promise_filename).sub >$(test.agent_log_path) 2>&1" - contain => in_shell; + "$(cf_agent) -Kf $(this.promise_filename).sub >$(test.agent_log_path) 2>&1" + contain => in_shell; } bundle agent check { vars: - "result" - string => readfile($(test.agent_log_path)), - if => fileexists( $(test.agent_log_path) ); + "result" + string => readfile($(test.agent_log_path)), + if => fileexists($(test.agent_log_path)); methods: - "Pass/FAIL" - usebundle => dcs_check_regcmp(".*(error|Failed to clean backup).*", - $(result), - $(this.promise_filename), - "true"); # We do not expect to find an error in the agent output + "Pass/FAIL" + usebundle => dcs_check_regcmp( + ".*(error|Failed to clean backup).*", + $(result), + $(this.promise_filename), + "true" + ); + + # We do not expect to find an error in the agent output } diff --git a/tests/acceptance/10_files/purge_reports_as_repaired.cf b/tests/acceptance/10_files/purge_reports_as_repaired.cf index 949b03d7a9..40e9d3f31b 100644 --- a/tests/acceptance/10_files/purge_reports_as_repaired.cf +++ b/tests/acceptance/10_files/purge_reports_as_repaired.cf @@ -1,48 +1,49 @@ bundle common test_meta { vars: - "description" string => "Test that purging a directory in a target propagates promise as repaired"; + "description" + string => "Test that purging a directory in a target propagates promise as repaired"; } ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dirs" slist => { + "dirs" + slist => { "$(G.testdir)/source/.", "$(G.testdir)/target/.", - "$(G.testdir)/target/subdir/." - }; + "$(G.testdir)/target/subdir/.", + }; - files: + files: "$(dirs)" create => "true"; } bundle agent test { files: - "$(G.testdir)/target/" copy_from => copyfrom_sync("$(G.testdir)/source/."), - depth_search => recurse("inf"), - classes => if_repaired("purge_propagated"); + "$(G.testdir)/target/" + copy_from => copyfrom_sync("$(G.testdir)/source/."), + depth_search => recurse("inf"), + classes => if_repaired("purge_propagated"); } ####################################################### - bundle agent check { reports: purge_propagated:: "$(this.promise_filename) Pass"; + !purge_propagated:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/rename/main.cf b/tests/acceptance/10_files/rename/main.cf index f9b3efa8e9..4423dbc6b5 100644 --- a/tests/acceptance/10_files/rename/main.cf +++ b/tests/acceptance/10_files/rename/main.cf @@ -1,92 +1,84 @@ body file control { - inputs => { "../../default.sub.cf" }; + inputs => { "../../default.sub.cf" }; } bundle agent main { methods: - "init,test,check,cleanup" - usebundle => default("$(this.promise_filename)") ; + "init,test,check,cleanup" usebundle => default("$(this.promise_filename)"); } bundle agent init { files: - - # First we initialize some directories to iterate over and some files that - # will be renamed during the test - - "$(G.testdir)/test/$(check.dirs)/incoming/$(check.files)" - create => "true"; + # First we initialize some directories to iterate over and some files that + # will be renamed during the test + "$(G.testdir)/test/$(check.dirs)/incoming/$(check.files)" create => "true"; } bundle agent test { meta: - - "description" - string => "Test that files can be renamed using regular expression + "description" + string => "Test that files can be renamed using regular expression matches from the promiser"; - "test_soft_fail" - string => "any", - meta => { "CFE-2879" }; + "test_soft_fail" + string => "any", + meta => { "CFE-2879" }; files: - - # We promise that the target is a copy of the source file Since preserve - # is set to false, we expect the original permissions on the target file - # to remain unchanged. - - "$(G.testdir)/test/$(check.dirs)/incoming/((?!.*renamed)[a-z]*)" - rename => to( "$(G.testdir)/test/$(check.dirs)/incoming/$(match.1)_renamed" ); - + # We promise that the target is a copy of the source file Since preserve + # is set to false, we expect the original permissions on the target file + # to remain unchanged. + "$(G.testdir)/test/$(check.dirs)/incoming/((?!.*renamed)[a-z]*)" + rename => to( + "$(G.testdir)/test/$(check.dirs)/incoming/$(match.1)_renamed" + ); } body rename to(file) { - newname => "$(file)"; + newname => "$(file)"; } bundle agent check { vars: - "dirs" - slist => { "knuth", "lamport", "turing" }; - - "files" - slist => { "one", "two", "three" }; - - # Append _renamed to each of the files - "expected_files" slist => maplist( "$(this)_renamed", files ); - - "expected_paths" slist => { - "$(G.testdir)/test/knuth/incoming/one_renamed", - "$(G.testdir)/test/knuth/incoming/two_renamed", - "$(G.testdir)/test/knuth/incoming/three_renamed", - "$(G.testdir)/test/lamport/incoming/one_renamed", - "$(G.testdir)/test/lamport/incoming/two_renamed", - "$(G.testdir)/test/lamport/incoming/three_renamed", - "$(G.testdir)/test/turing/incoming/one_renamed", - "$(G.testdir)/test/turing/incoming/two_renamed", - "$(G.testdir)/test/turing/incoming/three_renamed", + "dirs" slist => { "knuth", "lamport", "turing" }; + "files" slist => { "one", "two", "three" }; + + # Append _renamed to each of the files + "expected_files" slist => maplist("$(this)_renamed", files); + + "expected_paths" + slist => { + "$(G.testdir)/test/knuth/incoming/one_renamed", + "$(G.testdir)/test/knuth/incoming/two_renamed", + "$(G.testdir)/test/knuth/incoming/three_renamed", + "$(G.testdir)/test/lamport/incoming/one_renamed", + "$(G.testdir)/test/lamport/incoming/two_renamed", + "$(G.testdir)/test/lamport/incoming/three_renamed", + "$(G.testdir)/test/turing/incoming/one_renamed", + "$(G.testdir)/test/turing/incoming/two_renamed", + "$(G.testdir)/test/turing/incoming/three_renamed", }; classes: - "all_expected_files_exist" - expression => filesexist( @(expected_paths) ); + "all_expected_files_exist" expression => filesexist(@(expected_paths)); methods: - - "Pass or Fail" - usebundle => dcs_passif( "all_expected_files_exist", - $(this.promise_filename)); + "Pass or Fail" + usebundle => dcs_passif( + "all_expected_files_exist", $(this.promise_filename) + ); reports: - DEBUG|EXTRA:: + DEBUG|EXTRA:: "Expected path exists '$(expected_paths)'" - if => fileexists( $(expected_paths) ); + if => fileexists($(expected_paths)); + "Expected path MISSING '$(expected_paths)'" - unless => fileexists( $(expected_paths) ); + unless => fileexists($(expected_paths)); } diff --git a/tests/acceptance/10_files/replace_patterns/allow_non_convergent.cf b/tests/acceptance/10_files/replace_patterns/allow_non_convergent.cf index 7d48a15a12..b07fe0aeee 100644 --- a/tests/acceptance/10_files/replace_patterns/allow_non_convergent.cf +++ b/tests/acceptance/10_files/replace_patterns/allow_non_convergent.cf @@ -3,26 +3,21 @@ # Replace a pattern using non-convergent regexes # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ###################################################### - bundle agent init { files: - "/tmp/example.txt" - content => "foo PORT=23 bar"; - + "/tmp/example.txt" content => "foo PORT=23 bar"; } ###################################################### - bundle agent test { meta: @@ -30,11 +25,10 @@ bundle agent test string => "Test that allow_non_convergent correctly replaces non-convergent regex"; files: - "/tmp/example.txt" - edit_line => _regex_replace( "PORT=[0-9]+", "PORT=22" ); + "/tmp/example.txt" edit_line => _regex_replace("PORT=[0-9]+", "PORT=22"); } -bundle edit_line _regex_replace(find,replace) +bundle edit_line _regex_replace(find, replace) { replace_patterns: "$(find)" @@ -45,28 +39,26 @@ bundle edit_line _regex_replace(find,replace) body replace_with _value(x) { - replace_value => "$(x)"; - occurrences => "all"; + replace_value => "$(x)"; + occurrences => "all"; } ###################################################### - bundle agent check { vars: - "file_content" - string => readfile( "/tmp/example.txt" , "999" ); + "file_content" string => readfile("/tmp/example.txt", "999"); classes: "ok" expression => strcmp("$(file_content)", "foo PORT=22 bar"); files: - "/tmp/example.txt" - delete => tidy; + "/tmp/example.txt" delete => tidy; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/replace_patterns/basic_replace.cf b/tests/acceptance/10_files/replace_patterns/basic_replace.cf index 6cefb38032..6352649d30 100644 --- a/tests/acceptance/10_files/replace_patterns/basic_replace.cf +++ b/tests/acceptance/10_files/replace_patterns/basic_replace.cf @@ -3,31 +3,25 @@ # Replace a pattern and use match.0 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; - - "actual" string => - "BEGIN + "states" slist => { "actual", "expected" }; + "actual" string => "BEGIN END"; - - "expected" string => - "BEGIN_REPLACED + "expected" string => "BEGIN_REPLACED END"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -36,37 +30,38 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ###################################################### -# bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_replace("$(init.parameters)"); + "$(G.testfile).actual" edit_line => test_replace("$(init.parameters)"); } bundle edit_line test_replace(parameters) { replace_patterns: - "^BEGIN$" replace_with => value("BEGIN_REPLACED"); + "^BEGIN$" replace_with => value("BEGIN_REPLACED"); } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/replace_patterns/noop_replace.cf b/tests/acceptance/10_files/replace_patterns/noop_replace.cf index 76e7cc678e..0f594243fd 100644 --- a/tests/acceptance/10_files/replace_patterns/noop_replace.cf +++ b/tests/acceptance/10_files/replace_patterns/noop_replace.cf @@ -3,35 +3,33 @@ # Replace a pattern and use match.0 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN kernel /vmlinuz-2.6.18-348.el5 ro noapic nolapic apci=off time process_timing=everything root=LABEL=/foo kernel /vmlinuz-2.6.18-348.el5 ro root=LABEL=/1 END"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN kernel /vmlinuz-2.6.18-348.el5 ro noapic nolapic apci=off time process_timing=everything root=LABEL=/foo kernel /vmlinuz-2.6.18-348.el5 ro root=LABEL=/1 END"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -40,40 +38,39 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ###################################################### -# bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_replace("$(init.parameters)"); + "$(G.testfile).actual" edit_line => test_replace("$(init.parameters)"); } bundle edit_line test_replace(parameters) { replace_patterns: - - # should not change anything - "^.+$" - replace_with => value("$(match.0)"); + # should not change anything + "^.+$" replace_with => value("$(match.0)"); } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/replace_patterns/staging/advanced_replace.cf b/tests/acceptance/10_files/replace_patterns/staging/advanced_replace.cf index e2e68c72ea..60ca740b2f 100644 --- a/tests/acceptance/10_files/replace_patterns/staging/advanced_replace.cf +++ b/tests/acceptance/10_files/replace_patterns/staging/advanced_replace.cf @@ -3,37 +3,36 @@ # Replace a pattern and use match.0 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "states" slist => { "actual", "expected" }; + "states" slist => { "actual", "expected" }; - "actual" string => - "BEGIN + "actual" + string => "BEGIN kernel /vmlinuz-2.6.18-348.el5 ro noapic nolapic apci=off time process_timing=everything root=LABEL=/foo kernel /vmlinuz-2.6.18-348.el5 ro root=LABEL=/1 END"; - "parameters" string => "noapic nolapic apci=off time process_timing=everything"; + "parameters" + string => "noapic nolapic apci=off time process_timing=everything"; - "expected" string => - "BEGIN + "expected" + string => "BEGIN kernel /vmlinuz-2.6.18-348.el5 ro root=LABEL=/1 noapic nolapic apci=off time process_timing=everything kernel /vmlinuz-2.6.18-348.el5 ro root=LABEL=/foo noapic nolapic apci=off time process_timing=everything END"; files: - "$(G.testfile).$(states)" + "$(G.testfile).$(states)" create => "true", edit_line => init_insert("$(init.$(states))"), edit_defaults => init_empty; @@ -42,56 +41,55 @@ END"; bundle edit_line init_insert(str) { insert_lines: - "$(str)"; + "$(str)"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ###################################################### -# bundle agent test { files: - "$(G.testfile).actual" - edit_line => test_replace("$(init.parameters)"); + "$(G.testfile).actual" edit_line => test_replace("$(init.parameters)"); } bundle edit_line test_replace(parameters) { replace_patterns: - - # replace the parameters with an empty string - "$(parameters)" + # replace the parameters with an empty string + "$(parameters)" handle => "test_replace_parameters", replace_with => value(""); - # should append $(parameters) to any line that begins with "kernel" - "^\s*(kernel.+)$" + # should append $(parameters) to any line that begins with "kernel" + "^\s*(kernel.+)$" depends_on => { "test_replace_parameters" }, replace_with => value("$(match.1) $(parameters)"); - # should not change anything - "^\s*(kernel.+)$" - replace_with => value("$(match.0)"); + # should not change anything + "^\s*(kernel.+)$" replace_with => value("$(match.0)"); } body replace_with value(x) { - replace_value => "$(x)"; - occurrences => "all"; + replace_value => "$(x)"; + occurrences => "all"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/templating/basic_classes.cf b/tests/acceptance/10_files/templating/basic_classes.cf index 43fe7f9f53..57a384d88e 100644 --- a/tests/acceptance/10_files/templating/basic_classes.cf +++ b/tests/acceptance/10_files/templating/basic_classes.cf @@ -4,53 +4,47 @@ # Redmine #2928 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { -files: - "$(G.testfile).expected" + files: + "$(G.testfile).expected" create => "true", -edit_defaults => init_empty, + edit_defaults => init_empty, edit_line => init_expect; - "$(G.testfile).template" + "$(G.testfile).template" create => "true", - edit_line => template, - edit_defaults => init_empty; + edit_line => template, + edit_defaults => init_empty; } ####################################################### - bundle agent test { classes: - "two" expression => "any"; - "three" expression => "any"; + "two" expression => "any"; + "three" expression => "any"; files: - "$(G.testfile).actual" - create => "true", - edit_defaults => init_empty, - edit_template => "$(G.testfile).template"; + "$(G.testfile).actual" + create => "true", + edit_defaults => init_empty, + edit_template => "$(G.testfile).template"; } ####################################################### - bundle edit_line template { -insert_lines: - -"[%CFEngine BEGIN %] + insert_lines: + "[%CFEngine BEGIN %] one [%CFEngine END %] @@ -60,38 +54,37 @@ two [%CFEngine default:three:: %] three " - - insert_type => "preserve_block"; + insert_type => "preserve_block"; } ####################################################### - bundle edit_line init_expect { -insert_lines: - -"one + insert_lines: + "one two three -" - insert_type => "preserve_block"; +" insert_type => "preserve_block"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/templating/cftemplate.cf b/tests/acceptance/10_files/templating/cftemplate.cf index d50188c610..87e6158ac2 100644 --- a/tests/acceptance/10_files/templating/cftemplate.cf +++ b/tests/acceptance/10_files/templating/cftemplate.cf @@ -4,60 +4,57 @@ # Redmine #1900 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### ####################################################### - bundle agent test { meta: + "description" -> { "CFE-270" } + string => "Test that classic templating does not insert extra newlines"; - "description" -> { "CFE-270" } - string => "Test that classic templating does not insert extra newlines"; - - "test_soft_fail" -> { "CFE-270" } - string => "any", - meta => { "CFE-270" }; - + "test_soft_fail" -> { "CFE-270" } + string => "any", + meta => { "CFE-270" }; files: - "$(G.testfile).expected" + "$(G.testfile).expected" copy_from => my_local_cp("$(this.promise_filename).expected"); - "$(G.testfile).actual" - create => "true", - edit_defaults => my_init_empty, - edit_template => "$(this.promise_filename).template"; + "$(G.testfile).actual" + create => "true", + edit_defaults => my_init_empty, + edit_template => "$(this.promise_filename).template"; } ####################################################### - body copy_from my_local_cp(from) { - source => "$(from)"; + source => "$(from)"; } body edit_defaults my_init_empty { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/templating/classic_template_wont_render_cf_null_with_empty_datacontainer.cf b/tests/acceptance/10_files/templating/classic_template_wont_render_cf_null_with_empty_datacontainer.cf index afbb9914fa..abedccb801 100644 --- a/tests/acceptance/10_files/templating/classic_template_wont_render_cf_null_with_empty_datacontainer.cf +++ b/tests/acceptance/10_files/templating/classic_template_wont_render_cf_null_with_empty_datacontainer.cf @@ -1,16 +1,15 @@ body common control { -# ignore_missing_bundles => "true"; - - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - + # ignore_missing_bundles => "true"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent test { meta: - "description" string => "Test that classic templates will not render + "description" + string => "Test that classic templates will not render cf_null when dereferencing an absent data container."; @@ -23,38 +22,41 @@ bundle agent test "matching_vars" slist => variablesmatching(".*", "nomatch"); methods: - "any" usebundle => cmerge( "absent_container", @(matching_vars) ); - "any" usebundle => template_file( $(G.testfile), - "$(this.promise_filename).tpl", - @(cmerge.absent_container)); + "any" usebundle => cmerge("absent_container", @(matching_vars)); + + "any" + usebundle => template_file( + $(G.testfile), + "$(this.promise_filename).tpl", + @(cmerge.absent_container) + ); } bundle agent check { classes: - "some_content" expression => regline( "This is a test file", $(G.testfile) ); - "cf_null_in_rendered_file" expression => regline( ".*cf_null.*", $(G.testfile) ); + "some_content" expression => regline("This is a test file", $(G.testfile)); - # The test should pass if the file is rendered without cf_null in the file + "cf_null_in_rendered_file" + expression => regline(".*cf_null.*", $(G.testfile)); + # The test should pass if the file is rendered without cf_null in the file "ok" expression => "some_content.!cf_null_in_rendered_file"; # The test should fail if the expected contnet is not rendered or if # cf_null is found in the rendered file. - "fail" expression => "!some_content|cf_null_in_rendered_file"; methods: ok:: - "" usebundle => dcs_pass( $(this.promise_filename) ); + "" usebundle => dcs_pass($(this.promise_filename)); fail:: - "" usebundle => dcs_fail( $(this.promise_filename) ); + "" usebundle => dcs_fail($(this.promise_filename)); reports: DEBUG:: - "Found some correct content in rendered file" - if => "some_content"; + "Found some correct content in rendered file" if => "some_content"; "Found cf_null in rendered file but should not have" if => "cf_null_in_rendered_file"; @@ -62,10 +64,8 @@ bundle agent check bundle agent template_file(file, template, data_container) { - -# Note: the classic template looks inside this bundle to dereference various -# values from data_container. - + # Note: the classic template looks inside this bundle to dereference various + # values from data_container. vars: "index" slist => getindices("data_container"); @@ -79,11 +79,19 @@ bundle agent template_file(file, template, data_container) } ### Picked from the STDLIB ### - bundle agent cmerge(name, varlist) { vars: - "$(name)" data => parsejson('[]'), policy => "free"; - "$(name)" data => mergedata($(name), $(varlist)), policy => "free"; # iterates! - "$(name)_str" string => format("%S", $(name)), policy => "free"; + "$(name)" + data => parsejson('[]'), + policy => "free"; + + "$(name)" + data => mergedata($(name), $(varlist)), + policy => "free"; + + # iterates! + "$(name)_str" + string => format("%S", $(name)), + policy => "free"; } diff --git a/tests/acceptance/10_files/templating/demo.json b/tests/acceptance/10_files/templating/demo.json index 8c668b3b1b..562204ba9b 100644 --- a/tests/acceptance/10_files/templating/demo.json +++ b/tests/acceptance/10_files/templating/demo.json @@ -1,9 +1,9 @@ { "header": "Colors", "items": [ - {"name": "red", "first": true, "url": "#Red"}, - {"name": "green", "link": true, "url": "#Green"}, - {"name": "blue", "link": true, "url": "#Blue"} + { "name": "red", "first": true, "url": "#Red" }, + { "name": "green", "link": true, "url": "#Green" }, + { "name": "blue", "link": true, "url": "#Blue" } ], "empty": false } diff --git a/tests/acceptance/10_files/templating/edit_template_string/mustache_edit_template_string_vs_edit_template.cf b/tests/acceptance/10_files/templating/edit_template_string/mustache_edit_template_string_vs_edit_template.cf index c5f23c8529..095c3a7692 100644 --- a/tests/acceptance/10_files/templating/edit_template_string/mustache_edit_template_string_vs_edit_template.cf +++ b/tests/acceptance/10_files/templating/edit_template_string/mustache_edit_template_string_vs_edit_template.cf @@ -1,30 +1,27 @@ body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - - "$(G.testdir)/pghba.conf-from-edit_template" - delete => tidy; - - "$(G.testdir)/pghba.conf-from-edit_template_string" - delete => tidy; + "$(G.testdir)/pghba.conf-from-edit_template" delete => tidy; + "$(G.testdir)/pghba.conf-from-edit_template_string" delete => tidy; } + bundle agent test { meta: - "description" -> { "CFE-2910" } - string => "Test that there is no difference when rendering the same + "description" -> { "CFE-2910" } + string => "Test that there is no difference when rendering the same mustache template with edit_template and edit_template_string"; vars: - - "pghbadirectives" data => '[ + "pghbadirectives" + data => '[ { "type": "local", "database": "all", @@ -48,50 +45,49 @@ bundle agent test } ]'; - # Reparent the config so that we have a named key to iterate over. - "conf" data => mergedata( '{ "pghba": pghbadirectives }' ); + # Reparent the config so that we have a named key to iterate over. + "conf" data => mergedata('{ "pghba": pghbadirectives }'); files: - + "$(G.testdir)/pghba.conf-from-edit_template" + create => "true", + template_method => "mustache", + template_data => @(conf), + edit_template => '$(this.promise_dirname)/pghba.conf.mustache'; + + "$(G.testdir)/pghba.conf-from-edit_template_string" + create => "true", + template_method => "inline_mustache", + template_data => @(conf), + edit_template_string => readfile( + '$(this.promise_dirname)/pghba.conf.mustache' + ); + + reports: + DEBUG|EXTRA:: "$(G.testdir)/pghba.conf-from-edit_template" - create => "true", - template_method => "mustache", - template_data => @(conf), - edit_template => '$(this.promise_dirname)/pghba.conf.mustache'; + printfile => cat("$(G.testdir)/pghba.conf-from-edit_template"); "$(G.testdir)/pghba.conf-from-edit_template_string" - create => "true", - template_method => "inline_mustache", - template_data => @(conf), - edit_template_string => readfile( '$(this.promise_dirname)/pghba.conf.mustache' ); - - -reports: - - DEBUG|EXTRA:: - "$(G.testdir)/pghba.conf-from-edit_template" - printfile => cat( "$(G.testdir)/pghba.conf-from-edit_template"); - - "$(G.testdir)/pghba.conf-from-edit_template_string" - printfile => cat( "$(G.testdir)/pghba.conf-from-edit_template_string"); - + printfile => cat("$(G.testdir)/pghba.conf-from-edit_template_string"); } bundle agent check { methods: - - "Pass/FAIL" - usebundle => dcs_check_diff_expected("$(G.testdir)/pghba.conf-from-edit_template", - "$(G.testdir)/pghba.conf-from-edit_template_string", - "$(this.promise_filename)", - "no"); + "Pass/FAIL" + usebundle => dcs_check_diff_expected( + "$(G.testdir)/pghba.conf-from-edit_template", + "$(G.testdir)/pghba.conf-from-edit_template_string", + "$(this.promise_filename)", + "no" + ); } body printfile cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } diff --git a/tests/acceptance/10_files/templating/edit_template_string/mustache_edit_template_string_vs_string_mustache.cf b/tests/acceptance/10_files/templating/edit_template_string/mustache_edit_template_string_vs_string_mustache.cf index 23219a4e10..09f038e72b 100644 --- a/tests/acceptance/10_files/templating/edit_template_string/mustache_edit_template_string_vs_string_mustache.cf +++ b/tests/acceptance/10_files/templating/edit_template_string/mustache_edit_template_string_vs_string_mustache.cf @@ -1,33 +1,31 @@ body common control { - inputs => { "../../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - - "$(G.testdir)/pghba.conf-from-edit_template_string" - delete => tidy; - - "$(G.testdir)/pghba.conf-from-string_mustache" - delete => tidy; + "$(G.testdir)/pghba.conf-from-edit_template_string" delete => tidy; + "$(G.testdir)/pghba.conf-from-string_mustache" delete => tidy; } + bundle agent test { meta: - "description" -> { "CFE-2910" } - string => "Test that there is no difference when rendering the same + "description" -> { "CFE-2910" } + string => "Test that there is no difference when rendering the same mustache template with edit_template and edit_template_string"; - "test_soft_fail" string => "windows", - meta => { "ENT-10254" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10254" }; vars: - - "pghbadirectives" data => '[ + "pghbadirectives" + data => '[ { "type": "local", "database": "all", @@ -51,54 +49,56 @@ bundle agent test } ]'; - # Reparent the config so that we have a named key to iterate over. - "conf" data => mergedata( '{ "pghba": pghbadirectives }' ); + # Reparent the config so that we have a named key to iterate over. + "conf" data => mergedata('{ "pghba": pghbadirectives }'); files: - - "$(G.testdir)/pghba.conf-from-edit_template_string" - create => "true", - template_method => "inline_mustache", - template_data => @(conf), - edit_template_string => readfile( '$(this.promise_dirname)/pghba.conf.mustache' ); - - "$(G.testdir)/pghba.conf-from-edit_template_string" - comment => "We need to append a blank line in order to match up with + "$(G.testdir)/pghba.conf-from-edit_template_string" + create => "true", + template_method => "inline_mustache", + template_data => @(conf), + edit_template_string => readfile( + '$(this.promise_dirname)/pghba.conf.mustache' + ); + + "$(G.testdir)/pghba.conf-from-edit_template_string" + comment => "We need to append a blank line in order to match up with report_to_file from string_mustache", - edit_line => lines_present( "" ); - -reports: - - # This is how we get a file from string_mustache - "$(with)" - with => string_mustache( readfile('$(this.promise_dirname)/pghba.conf.mustache'), @(conf) ), - report_to_file => "$(G.testdir)/pghba.conf-from-string_mustache", - if => not( fileexists( "$(G.testdir)/pghba.conf-from-string_mustache" )); - - DEBUG|EXTRA:: + edit_line => lines_present(""); + + reports: + # This is how we get a file from string_mustache + "$(with)" + with => string_mustache( + readfile('$(this.promise_dirname)/pghba.conf.mustache'), @(conf) + ), + report_to_file => "$(G.testdir)/pghba.conf-from-string_mustache", + if => not(fileexists("$(G.testdir)/pghba.conf-from-string_mustache")); + + DEBUG|EXTRA:: "$(G.testdir)/pghba.conf-from-edit_template_string" - printfile => cat( "$(G.testdir)/pghba.conf-from-edit_template_string"); + printfile => cat("$(G.testdir)/pghba.conf-from-edit_template_string"); "$(G.testdir)/pghba.conf-from-string_mustache" - printfile => cat( "$(G.testdir)/pghba.conf-from-string_mustache" ); + printfile => cat("$(G.testdir)/pghba.conf-from-string_mustache"); } bundle agent check { methods: - - "Pass/FAIL" - usebundle => dcs_check_diff_expected("$(G.testdir)/pghba.conf-from-string_mustache", - "$(G.testdir)/pghba.conf-from-edit_template_string", - "$(this.promise_filename)", - "no"); + "Pass/FAIL" + usebundle => dcs_check_diff_expected( + "$(G.testdir)/pghba.conf-from-string_mustache", + "$(G.testdir)/pghba.conf-from-edit_template_string", + "$(this.promise_filename)", + "no" + ); } - body printfile cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } diff --git a/tests/acceptance/10_files/templating/empty_template_empty_file.cf b/tests/acceptance/10_files/templating/empty_template_empty_file.cf index 937d1eb9ca..de9a28342b 100644 --- a/tests/acceptance/10_files/templating/empty_template_empty_file.cf +++ b/tests/acceptance/10_files/templating/empty_template_empty_file.cf @@ -3,21 +3,18 @@ # Redmine#3870: Test that an empty CFEngine template will empty the file. # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { files: - "$(G.testfile)" + "$(G.testfile)" edit_defaults => init_empty, create => "true", edit_line => init_insert_lines("TEXT NOT GOOD"); @@ -26,54 +23,52 @@ bundle agent init bundle edit_line init_insert_lines(lines) { insert_lines: - - "$(lines)" - comment => "Append lines if they don't exist"; + "$(lines)" comment => "Append lines if they don't exist"; } body edit_defaults init_empty { - empty_file_before_editing => "true"; - edit_backup => "false"; - #max_file_size => "300000"; + empty_file_before_editing => "true"; + edit_backup => "false"; + + #max_file_size => "300000"; } ####################################################### - bundle agent test { vars: - "template_file" string => "$(this.promise_filename).template"; + "template_file" string => "$(this.promise_filename).template"; files: - "$(G.testfile)" - edit_template => "$(template_file)"; + "$(G.testfile)" edit_template => "$(template_file)"; reports: DEBUG:: "Rendering template file $(template_file) to $(G.testfile)"; } - ####################################################### - bundle agent check { vars: - "expect" string => ""; - "actual" string => readfile("$(G.testfile)", 1000); + "expect" string => ""; + "actual" string => readfile("$(G.testfile)", 1000); classes: - "ok" expression => regcmp("$(expect)", "$(actual)"); + "ok" expression => regcmp("$(expect)", "$(actual)"); reports: DEBUG:: "expect: '$(expect)'"; "actual: '$(actual)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/templating/large_template_blocks.cf b/tests/acceptance/10_files/templating/large_template_blocks.cf index 812d8dc0b7..398a1f3028 100644 --- a/tests/acceptance/10_files/templating/large_template_blocks.cf +++ b/tests/acceptance/10_files/templating/large_template_blocks.cf @@ -4,45 +4,39 @@ # Redmine #3852 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "origtestdir" string => dirname("$(this.promise_filename)"); + "origtestdir" string => dirname("$(this.promise_filename)"); files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "template_file" string => "$(this.promise_filename).template"; + "template_file" string => "$(this.promise_filename).template"; classes: - files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_template => "$(template_file)"; @@ -51,25 +45,24 @@ bundle agent test "Rendering template file $(template_file) to $(G.testfile)"; } - - ####################################################### - bundle agent check { vars: - "expected" int => "110"; - "actual" int => countlinesmatching(".*0123456789.*", "$(G.testfile)"); + "expected" int => "110"; + "actual" int => countlinesmatching(".*0123456789.*", "$(G.testfile)"); classes: - "ok" expression => strcmp("$(expected)", "$(actual)"); + "ok" expression => strcmp("$(expected)", "$(actual)"); reports: DEBUG:: "expected: '$(expected)'"; "actual: '$(actual)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/templating/missing_file.cf b/tests/acceptance/10_files/templating/missing_file.cf index 745ee030a9..31ddfe6f3f 100644 --- a/tests/acceptance/10_files/templating/missing_file.cf +++ b/tests/acceptance/10_files/templating/missing_file.cf @@ -3,7 +3,6 @@ # Redmine #3573: establish message for missing target file with a template # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; @@ -12,14 +11,11 @@ body common control } ####################################################### - bundle agent init { - } ####################################################### - bundle agent test { vars: @@ -27,21 +23,25 @@ bundle agent test # Run subtests. Need to be in verbose mode to see the output. # The full verbose output is too big for variable assignment here. # So extract (grep) only potentially interesting lines. - "subout" string => execresult("$(sys.cf_agent) -KIv -b run -f $(this.promise_filename).sub 2>&1 | $(G.grep) '/no/such/file'", "useshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -KIv -b run -f $(this.promise_filename).sub 2>&1 | $(G.grep) '/no/such/file'", + "useshell" + ); } - ####################################################### - bundle agent check { vars: - "must_have" string => ".*Cannot render file '/no/such/file': file does not exist.*"; - "cant_have" string => ".*no longer access file.*"; + "must_have" + string => ".*Cannot render file '/no/such/file': file does not exist.*"; + + "cant_have" string => ".*no longer access file.*"; classes: - "ok_1" not => regcmp($(cant_have), "$(test.subout)"); - "ok_2" expression => regcmp($(must_have), "$(test.subout)"); + "ok_1" not => regcmp($(cant_have), "$(test.subout)"); + "ok_2" expression => regcmp($(must_have), "$(test.subout)"); reports: DEBUG:: @@ -56,6 +56,7 @@ bundle agent check ok_1.ok_2:: "$(this.promise_filename) Pass"; + !(ok_1.ok_2):: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/templating/missing_template_file.cf b/tests/acceptance/10_files/templating/missing_template_file.cf index f82757fabf..34145e96b4 100644 --- a/tests/acceptance/10_files/templating/missing_template_file.cf +++ b/tests/acceptance/10_files/templating/missing_template_file.cf @@ -3,7 +3,6 @@ # Redmine #4241: set correct classes if template is missing # ############################################################################## - body common control { inputs => { "../../default.sub.cf", "../../plucked.sub.cf" }; @@ -12,18 +11,15 @@ body common control } ####################################################### - bundle agent init { - } ####################################################### - bundle agent test { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_template => "$(this.promise_filename).nonexistent", classes => scoped_classes_generic("namespace", "test_file_template"); @@ -34,23 +30,30 @@ bundle agent test } ####################################################### - bundle agent check { classes: - "ok" and => { "!test_file_template_kept", - "test_file_template_repaired", # create => "true" - "test_file_template_failed", # edit_template - "!test_file_template_denied", - "!test_file_template_timeout" }; + "ok" + and => { + "!test_file_template_kept", + "test_file_template_repaired", + # create => "true" + "test_file_template_failed", + # edit_template + "!test_file_template_denied", + "!test_file_template_timeout", + }; reports: DEBUG.created:: "Correctly created the test file $(G.testfile)"; + DEBUG.!created:: "Erroneously did not create the test file $(G.testfile)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/templating/mustache_abuse.cf b/tests/acceptance/10_files/templating/mustache_abuse.cf index 474f7d25b5..a2b6eaa47d 100644 --- a/tests/acceptance/10_files/templating/mustache_abuse.cf +++ b/tests/acceptance/10_files/templating/mustache_abuse.cf @@ -3,22 +3,22 @@ # Abusive Mustache relationship # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "tests" slist => { "0", "1", "2", "3", "4", "5", "6" }; - "templates" data => parsejson(' + "tests" slist => { "0", "1", "2", "3", "4", "5", "6" }; + + "templates" + data => parsejson( + ' [ "{{x}}", "{{x}} {{y}}", @@ -27,10 +27,11 @@ bundle agent init "{{#boolean}}IT IS TRUE{{/boolean}}", "{{^boolean}}IT IS FALSE{{/boolean}}", "{{#list}}{{k}}={{v}}, {{/list}}" -]'); +]' + ); files: - "$(G.testfile).$(tests).tmpl" + "$(G.testfile).$(tests).tmpl" create => "true", edit_defaults => test_empty, edit_line => init_insert_lines("$(templates[$(tests)])"); @@ -39,17 +40,16 @@ bundle agent init bundle edit_line init_insert_lines(lines) { insert_lines: - - "$(lines)" - comment => "Append lines if they don't exist"; + "$(lines)" comment => "Append lines if they don't exist"; } ####################################################### - bundle agent test { vars: - "tdata" data => parsejson(' + "tdata" + data => parsejson( + ' [ "{ \\\"x\\\": 123 }", "{ \\\"x\\\": 123, \\\"y\\\": 456 }", @@ -58,10 +58,11 @@ bundle agent test "{\\\"boolean\\\": true}", "{\\\"boolean\\\": false}", "{ \\\"list\\\": [ { \\\"k\\\": 789, \\\"v\\\": 0 }, { \\\"k\\\": null, \\\"v\\\": true }, { \\\"k\\\": -1, \\\"v\\\": -2 } ] }", -]'); +]' + ); files: - "$(G.testfile).$(init.tests)" + "$(G.testfile).$(init.tests)" create => "true", edit_defaults => test_empty, edit_template => "$(G.testfile).$(init.tests).tmpl", @@ -75,17 +76,17 @@ bundle agent test body edit_defaults test_empty { - empty_file_before_editing => "true"; - edit_backup => "false"; + empty_file_before_editing => "true"; + edit_backup => "false"; } - ####################################################### - bundle agent check { vars: - "expected" data => parsejson(' + "expected" + data => parsejson( + ' [ "123", "123 456", @@ -94,28 +95,34 @@ bundle agent check "IT IS TRUE" "IT IS FALSE", "789=0, =true, -1=-2, " -]'); +]' + ); - "actual_$(init.tests)" string => readfile("$(G.testfile).$(init.tests)", 10000); + "actual_$(init.tests)" + string => readfile("$(G.testfile).$(init.tests)", 10000); classes: - "ok_$(init.tests)" expression => regcmp("$(expected[$(init.tests)])", - "$(actual_$(init.tests))"); + "ok_$(init.tests)" + expression => regcmp( + "$(expected[$(init.tests)])", "$(actual_$(init.tests))" + ); - "ok" and => { ok_0, ok_1, ok_2, ok_3, ok_4, ok_5 }; + "ok" and => { ok_0, ok_1, ok_2, ok_3, ok_4, ok_5 }; reports: DEBUG:: "OK $(init.tests): Expected '$(expected[$(init.tests)])' == '$(actual_$(init.tests))'" - if => "ok_$(init.tests)"; + if => "ok_$(init.tests)"; "FAIL $(init.tests): Expected '$(expected[$(init.tests)])' <> '$(actual_$(init.tests))'" - if => "!ok_$(init.tests)"; + if => "!ok_$(init.tests)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/templating/mustache_container_serialization.cf b/tests/acceptance/10_files/templating/mustache_container_serialization.cf index 4481217830..e6fdfb8cbe 100644 --- a/tests/acceptance/10_files/templating/mustache_container_serialization.cf +++ b/tests/acceptance/10_files/templating/mustache_container_serialization.cf @@ -3,51 +3,57 @@ # Demo of Mustache templates with no external JSON data # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "a" string => "[]"; - "b" string => "{}"; - "c" string => '{"a":100,"b":200}'; - "d" string => '[{"a":100,"b":200},null,true,false,"abcde"]'; - - "test" slist => { "a", "b", "c", "d" }; + "a" string => "[]"; + "b" string => "{}"; + "c" string => '{"a":100,"b":200}'; + "d" string => '[{"a":100,"b":200},null,true,false,"abcde"]'; + "test" slist => { "a", "b", "c", "d" }; methods: - "" usebundle => file_mustache_jsonstring("$(this.promise_filename).mustache", - '{ "name": "$(test)", "data": $($(test)) }', - "$(G.testdir)/$(test)"); + "" + usebundle => file_mustache_jsonstring( + "$(this.promise_filename).mustache", + '{ "name": "$(test)", "data": $($(test)) }', + "$(G.testdir)/$(test)" + ); - "" usebundle => test2; + "" usebundle => test2; } bundle agent test2 { files: - "$(G.testfile).expected" create => "true", edit_line => insertthem; - "$(G.testfile).actual" create => "true", edit_line => readthem; + "$(G.testfile).expected" + create => "true", + edit_line => insertthem; + + "$(G.testfile).actual" + create => "true", + edit_line => readthem; } bundle edit_line insertthem { vars: - "test" slist => { @(test.test) }; - "parsed_$(test)" data => parsejson("$(test.$(test))"); - "fulldump_$(test)" string => storejson("parsed_$(test)"); + "test" slist => { @(test.test) }; + "parsed_$(test)" data => parsejson("$(test.$(test))"); + "fulldump_$(test)" string => storejson("parsed_$(test)"); insert_lines: - "$(test)$(test.$(test))$(test) -$(test)$(fulldump_$(test))$(test)" insert_type => "preserve_block"; + "$(test)$(test.$(test))$(test) +$(test)$(fulldump_$(test))$(test)" + insert_type => "preserve_block"; reports: EXTRA:: @@ -57,10 +63,11 @@ $(test)$(fulldump_$(test))$(test)" insert_type => "preserve_block"; bundle edit_line readthem { vars: - "test" slist => { @(test.test) }; - "read_$(test)" string => readfile("$(G.testdir)/$(test)", 1k); + "test" slist => { @(test.test) }; + "read_$(test)" string => readfile("$(G.testdir)/$(test)", 1k); + insert_lines: - "$(read_$(test))"; + "$(read_$(test))"; reports: EXTRA:: @@ -68,14 +75,16 @@ bundle edit_line readthem } ####################################################### - bundle agent check { vars: - "test" slist => { @(test.test) }; + "test" slist => { @(test.test) }; methods: - "" usebundle => dcs_check_diff("$(G.testfile).expected", - "$(G.testfile).actual", - $(this.promise_filename)); + "" + usebundle => dcs_check_diff( + "$(G.testfile).expected", + "$(G.testfile).actual", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/10_files/templating/mustache_datastate_demo.cf b/tests/acceptance/10_files/templating/mustache_datastate_demo.cf index a92fbb0c34..3d86761bd3 100644 --- a/tests/acceptance/10_files/templating/mustache_datastate_demo.cf +++ b/tests/acceptance/10_files/templating/mustache_datastate_demo.cf @@ -3,52 +3,52 @@ # Demo of Mustache templates with no external JSON data # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "origtestdir" string => dirname("$(this.promise_filename)"); + "origtestdir" string => dirname("$(this.promise_filename)"); files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { classes: - "empty" expression => "any"; + "empty" expression => "any"; vars: - "template_file" string => "$(init.origtestdir)/demo.datastate.mustache"; - "header" string => "Colors"; - "items" slist => { "red", "green", "blue" }; - "d" data => parsejson('[4,5,6]'); - "h" data => parsejson('{ "a": "x", "b": "y"}'); - "h_under_q" data => mergedata('{ "q": h }'); # wrap h in a map - "h_in_array" data => mergedata('[ h ]'); # wrap h in an array - "h2_in_array" data => mergedata(h_in_array, h_in_array); # more arrays! + "template_file" string => "$(init.origtestdir)/demo.datastate.mustache"; + "header" string => "Colors"; + "items" slist => { "red", "green", "blue" }; + "d" data => parsejson('[4,5,6]'); + "h" data => parsejson('{ "a": "x", "b": "y"}'); + "h_under_q" data => mergedata('{ "q": h }'); + + # wrap h in a map + "h_in_array" data => mergedata('[ h ]'); + # wrap h in an array + "h2_in_array" data => mergedata(h_in_array, h_in_array); + + # more arrays! files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_template => "$(template_file)", template_method => "mustache"; @@ -59,11 +59,11 @@ bundle agent test } ####################################################### - bundle agent check { vars: - "expect" string => '

Colors

+ "expect" + string => '

Colors

red green @@ -107,10 +107,10 @@ bundle agent check }" '; - "actual" string => readfile("$(G.testfile)", inf); + "actual" string => readfile("$(G.testfile)", inf); classes: - "ok" expression => strcmp($(expect), $(actual)); + "ok" expression => strcmp($(expect), $(actual)); reports: DEBUG:: @@ -118,8 +118,10 @@ bundle agent check "'$(expect)' == '$(actual)'" if => "ok"; "expect: '$(expect)'"; "actual: '$(actual)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/templating/mustache_demo.cf b/tests/acceptance/10_files/templating/mustache_demo.cf index 305b613cbd..76bffa647e 100644 --- a/tests/acceptance/10_files/templating/mustache_demo.cf +++ b/tests/acceptance/10_files/templating/mustache_demo.cf @@ -3,42 +3,37 @@ # Demo from mustache.github.io # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "origtestdir" string => dirname("$(this.promise_filename)"); + "origtestdir" string => dirname("$(this.promise_filename)"); files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "template_file" string => "$(init.origtestdir)/demo.mustache"; + "template_file" string => "$(init.origtestdir)/demo.mustache"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_template => "$(template_file)", template_method => "mustache", @@ -50,24 +45,26 @@ bundle agent test } ####################################################### - bundle agent check { vars: - "expect" string => readfile("$(init.origtestdir)/demo.expected", 10000); - "actual" string => readfile("$(G.testfile)", 10000); + "expect" string => readfile("$(init.origtestdir)/demo.expected", 10000); + "actual" string => readfile("$(G.testfile)", 10000); classes: - "ok" expression => regcmp("$(expect)", "$(actual)"); + "ok" expression => regcmp("$(expect)", "$(actual)"); reports: DEBUG:: "expect: '$(expect)'"; "actual: '$(actual)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/templating/mustache_expect_list_find_string.cf b/tests/acceptance/10_files/templating/mustache_expect_list_find_string.cf index 622e906ccc..7c69a7d961 100644 --- a/tests/acceptance/10_files/templating/mustache_expect_list_find_string.cf +++ b/tests/acceptance/10_files/templating/mustache_expect_list_find_string.cf @@ -5,146 +5,189 @@ # (indicating you wrote to a different file and moved into place) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { methods: - "empty good" usebundle => file_empty("$(G.testfile).good"); - "empty bad" usebundle => file_empty("$(G.testfile).bad"); + "empty good" usebundle => file_empty("$(G.testfile).good"); + "empty bad" usebundle => file_empty("$(G.testfile).bad"); + + "first filestat good" + usebundle => init_filestat("good1", "$(G.testfile).good"); + + "first filestat bad" + usebundle => init_filestat("bad1", "$(G.testfile).bad"); - "first filestat good" usebundle => init_filestat("good1", "$(G.testfile).good"); - "first filestat bad" usebundle => init_filestat("bad1", "$(G.testfile).bad"); + "Remove good" usebundle => dcs_fini("$(G.testfile).good"); + "Remove bad" usebundle => dcs_fini("$(G.testfile).bad"); + "ready good" usebundle => file_make("$(G.testfile).good", "# Set good"); + "ready bad" usebundle => file_make("$(G.testfile).bad", "# Set bad"); - "Remove good" usebundle => dcs_fini("$(G.testfile).good"); - "Remove bad" usebundle => dcs_fini("$(G.testfile).bad"); + "link good" + usebundle => file_hardlink( + "$(G.testfile).good", "$(G.testfile).goodlink" + ); - "ready good" usebundle => file_make("$(G.testfile).good", "# Set good"); - "ready bad" usebundle => file_make("$(G.testfile).bad", "# Set bad"); + "link bad" + usebundle => file_hardlink("$(G.testfile).bad", "$(G.testfile).badlink"); - "link good" usebundle => file_hardlink("$(G.testfile).good", "$(G.testfile).goodlink"); - "link bad" usebundle => file_hardlink("$(G.testfile).bad", "$(G.testfile).badlink"); + "second filestat good" + usebundle => init_filestat("good2", "$(G.testfile).good"); - "second filestat good" usebundle => init_filestat("good2", "$(G.testfile).good"); - "second filestat bad" usebundle => init_filestat("bad2", "$(G.testfile).bad"); + "second filestat bad" + usebundle => init_filestat("bad2", "$(G.testfile).bad"); } bundle agent init_filestat(n, f) { vars: - "filestat_$(n)" string => format("%s,%s", filestat($(f), "basename"), filestat($(f), "nlink")); + "filestat_$(n)" + string => format( + "%s,%s", filestat($(f), "basename"), filestat($(f), "nlink") + ); } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10257" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10257" }; methods: - "mustache good" usebundle => file_mustache_jsonstring($(template), - '{"mykeys": ["template expects list of strings"]}', - "$(G.testfile).good"); - - "mustache bad" usebundle => file_mustache_jsonstring($(template), - '{"mykeys": "string but template expects list of strings"}', - "$(G.testfile).bad"); - - "third filestat good" usebundle => init_filestat("good3", "$(G.testfile).good"); - "third filestat bad" usebundle => init_filestat("bad3", "$(G.testfile).bad"); + "mustache good" + usebundle => file_mustache_jsonstring( + $(template), + '{"mykeys": ["template expects list of strings"]}', + "$(G.testfile).good" + ); + + "mustache bad" + usebundle => file_mustache_jsonstring( + $(template), + '{"mykeys": "string but template expects list of strings"}', + "$(G.testfile).bad" + ); + + "third filestat good" + usebundle => init_filestat("good3", "$(G.testfile).good"); + + "third filestat bad" + usebundle => init_filestat("bad3", "$(G.testfile).bad"); vars: - "template" string => "$(this.promise_filename).mustache"; - - "actual_good" string => readfile("$(G.testfile).good", 4096); - "actual_bad" string => readfile("$(G.testfile).bad", 4096); + "template" string => "$(this.promise_filename).mustache"; + "actual_good" string => readfile("$(G.testfile).good", 4096); + "actual_bad" string => readfile("$(G.testfile).bad", 4096); } - ####################################################### - bundle agent check { vars: - "expected_good" string => "#DO NOT EDIT - MANAGED FILE + "expected_good" + string => "#DO NOT EDIT - MANAGED FILE template expects list of strings "; - "expected_bad" string => "# Set bad"; + "expected_bad" string => "# Set bad"; - "filestats_good" slist => { "$(init_filestat.filestat_good1)", "$(init_filestat.filestat_good2)", "$(init_filestat.filestat_good3)" }; - "filestats_bad" slist => { "$(init_filestat.filestat_bad1)", "$(init_filestat.filestat_bad2)", "$(init_filestat.filestat_bad3)" }; + "filestats_good" + slist => { + "$(init_filestat.filestat_good1)", + "$(init_filestat.filestat_good2)", + "$(init_filestat.filestat_good3)", + }; - "filestats_good_str" string => format("%S", filestats_good); - "filestats_bad_str" string => format("%S", filestats_bad); + "filestats_bad" + slist => { + "$(init_filestat.filestat_bad1)", + "$(init_filestat.filestat_bad2)", + "$(init_filestat.filestat_bad3)", + }; + + "filestats_good_str" string => format("%S", filestats_good); + "filestats_bad_str" string => format("%S", filestats_bad); classes: - "ok_filestats_good_1_2" not => strcmp("$(init_filestat.filestat_good1)", "$(init_filestat.filestat_good2)"); - "ok_filestats_good_2_3" not => strcmp("$(init_filestat.filestat_good2)", "$(init_filestat.filestat_good3)"); + "ok_filestats_good_1_2" + not => strcmp( + "$(init_filestat.filestat_good1)", "$(init_filestat.filestat_good2)" + ); + + "ok_filestats_good_2_3" + not => strcmp( + "$(init_filestat.filestat_good2)", "$(init_filestat.filestat_good3)" + ); - "ok_filestats_bad_1_2" not => strcmp("$(init_filestat.filestat_bad1)", "$(init_filestat.filestat_bad2)"); - "ok_filestats_bad_2_3" expression => strcmp("$(init_filestat.filestat_bad2)", "$(init_filestat.filestat_bad3)"); + "ok_filestats_bad_1_2" + not => strcmp( + "$(init_filestat.filestat_bad1)", "$(init_filestat.filestat_bad2)" + ); - "ok_content_good" expression => strcmp($(expected_good), $(test.actual_good)); - "ok_content_bad" expression => strcmp($(expected_bad), $(test.actual_bad)); + "ok_filestats_bad_2_3" + expression => strcmp( + "$(init_filestat.filestat_bad2)", "$(init_filestat.filestat_bad3)" + ); + "ok_content_good" + expression => strcmp($(expected_good), $(test.actual_good)); + + "ok_content_bad" expression => strcmp($(expected_bad), $(test.actual_bad)); methods: - "" usebundle => dcs_passif_expected("ok_filestats_good_1_2,ok_filestats_good_2_3,ok_filestats_bad_1_2,ok_filestats_bad_2_3,ok_content_good,ok_content_bad", - "", - $(this.promise_filename)), + "" + usebundle => dcs_passif_expected( + "ok_filestats_good_1_2,ok_filestats_good_2_3,ok_filestats_bad_1_2,ok_filestats_bad_2_3,ok_content_good,ok_content_bad", + "", + $(this.promise_filename) + ), inherit => "true"; reports: EXTRA:: - "OK: As expected good '$(expected_good)'" - if => "ok_content_good"; - - "OK: As expected bad '$(expected_bad)'" - if => "ok_content_bad"; + "OK: As expected good '$(expected_good)'" if => "ok_content_good"; + "OK: As expected bad '$(expected_bad)'" if => "ok_content_bad"; "OK: good filestats $(filestats_good_str) change from step 1 to step 2" - if => "ok_filestats_good_1_2"; + if => "ok_filestats_good_1_2"; "OK: good filestats $(filestats_good_str) change from step 2 to step 3" - if => "ok_filestats_good_2_3"; + if => "ok_filestats_good_2_3"; "OK: bad filestats $(filestats_bad_str) change from step 1 to step 2" - if => "ok_filestats_bad_1_2"; + if => "ok_filestats_bad_1_2"; "OK: bad filestats $(filestats_bad_str) don't change from step 2 to step 3" - if => "ok_filestats_bad_2_3"; + if => "ok_filestats_bad_2_3"; DEBUG:: "FAIL: Expected '$(expected_good)' <> '$(test.actual_good)'" - if => "!ok_content_good"; + if => "!ok_content_good"; "FAIL: Expected '$(expected_bad)' <> '$(test.actual_bad)'" - if => "!ok_content_bad"; + if => "!ok_content_bad"; "FAIL: good filestats $(filestats_good_str) don't change enough from step 1 to step 2" - if => "!ok_filestats_good_1_2"; + if => "!ok_filestats_good_1_2"; "FAIL: good filestats $(filestats_good_str) don't change enough from step 2 to step 3" - if => "!ok_filestats_good_2_3"; + if => "!ok_filestats_good_2_3"; "FAIL: bad filestats $(filestats_bad_str) don't change enough from step 1 to step 2" - if => "!ok_filestats_bad_1_2"; + if => "!ok_filestats_bad_1_2"; "FAIL: bad filestats $(filestats_bad_str) change from step 2 to step 3" - if => "!ok_filestats_bad_2_3"; - + if => "!ok_filestats_bad_2_3"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/templating/mustache_from_json_or_classic_array.cf b/tests/acceptance/10_files/templating/mustache_from_json_or_classic_array.cf index b488785129..b84e457cbf 100644 --- a/tests/acceptance/10_files/templating/mustache_from_json_or_classic_array.cf +++ b/tests/acceptance/10_files/templating/mustache_from_json_or_classic_array.cf @@ -1,21 +1,20 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -bundle agent init { - +bundle agent init +{ methods: any:: "json_data"; "array_data"; } -bundle agent json_data { - +bundle agent json_data +{ vars: any:: "key_values" @@ -25,51 +24,42 @@ bundle agent json_data { "two": "2", "three": "3", }'; - } -bundle agent array_data { - +bundle agent array_data +{ vars: any:: - - "key_values[one]" - string => "1"; - - "key_values[two]" - string => "2"; - - "key_values[three]" - string => "3"; - + "key_values[one]" string => "1"; + "key_values[two]" string => "2"; + "key_values[three]" string => "3"; } -bundle agent test { - +bundle agent test +{ meta: - "description" -> { "CFE-3124" } - string => "Test that rendering mustache from classic arrays works like rendering from JSON data"; - "test_soft_fail" - string => "any", - meta => { "CFE-3124" }; + "description" -> { "CFE-3124" } + string => "Test that rendering mustache from classic arrays works like rendering from JSON data"; - vars: + "test_soft_fail" + string => "any", + meta => { "CFE-3124" }; - "cases" - slist => { - "from_json_with_explicit_data", - "from_array_with_explicit_data", - "from_json_with_implicit_datastate", - "from_array_with_implicit_datastate", - "from_json_with_bundlestate", - "from_array_with_bundlestate", - "from_json_with_explicit_datastate", - "from_array_with_explicit_datastate", - }; + vars: + "cases" + slist => { + "from_json_with_explicit_data", + "from_array_with_explicit_data", + "from_json_with_implicit_datastate", + "from_array_with_implicit_datastate", + "from_json_with_bundlestate", + "from_array_with_bundlestate", + "from_json_with_explicit_datastate", + "from_array_with_explicit_datastate", + }; files: any:: - "$(G.testdir)/$(this.handle)" create => "true", handle => "from_json_with_explicit_data", @@ -112,7 +102,7 @@ bundle agent test { create => "true", handle => "from_json_with_bundlestate", template_method => "inline_mustache", - template_data => bundlestate( "json_data" ), + template_data => bundlestate("json_data"), edit_template_string => "TEMPLATE=RENDERED {{#key_values}} {{@}}={{.}} @@ -122,7 +112,7 @@ bundle agent test { create => "true", handle => "from_array_with_bundlestate", template_method => "inline_mustache", - template_data => bundlestate( "array_data" ), + template_data => bundlestate("array_data"), edit_template_string => "TEMPLATE=RENDERED {{#key_values}} {{@}}={{.}} @@ -148,50 +138,46 @@ bundle agent test { {{@}}={{.}} {{/vars.array_data.key_values}}"; - # "datastate()$(const.n)$(with)" - # with => string_mustache("{{%-top-}}", datastate() ); + # "datastate()$(const.n)$(with)" + # with => string_mustache("{{%-top-}}", datastate() ); } + bundle agent check { vars: + # Here we read in the data file create by each test case so that we can + # check if it was rendered as expected. Reading in the data as an env file + # we can ignore ordering which classic arrays do not promise. + "env_$(test.cases)" data => readenvfile("$(G.testdir)/$(test.cases)"); + "passed_tests" slist => classesmatching(".*", "class_for_passing_case"); - # Here we read in the data file create by each test case so that we can - # check if it was rendered as expected. Reading in the data as an env file - # we can ignore ordering which classic arrays do not promise. - - "env_$(test.cases)" - data => readenvfile( "$(G.testdir)/$(test.cases)" ); - - "passed_tests" - slist => classesmatching( ".*", "class_for_passing_case" ); - - "implicitly_failed_tests" - slist => classesmatching( ".*", "class_for_failing_case" ); + "implicitly_failed_tests" + slist => classesmatching(".*", "class_for_failing_case"); - "expected_passing" - slist => maplist( "passed_$(this)", @(test.cases) ); + "expected_passing" slist => maplist("passed_$(this)", @(test.cases)); classes: - "passed_$(test.cases)" and => { - strcmp( "1", "$(env_$(test.cases)[one])" ), - strcmp( "2", "$(env_$(test.cases)[two])" ), - strcmp( "3", "$(env_$(test.cases)[three])" ), - strcmp( "TEMPLATE", "RENDERED" ), - }, + strcmp("1", "$(env_$(test.cases)[one])"), + strcmp("2", "$(env_$(test.cases)[two])"), + strcmp("3", "$(env_$(test.cases)[three])"), + strcmp("TEMPLATE", "RENDERED"), + }, meta => { "class_for_passing_case" }, comment => "We pass a test case if each expected key value pair is found in the rendered data"; - "implicitly_failed_$(test.cases)" not => "passed_$(test.cases)", meta => { "class_for_failing_case" }, comment => "With no passing class for the test case, we must have failed"; + "ok" and => { @(expected_passing) }; - "ok" and => { @(expected_passing) }; - "fail" expression => isgreaterthan( length( "$(this.bundle).implicitly_failed_tests" ), 0 ); + "fail" + expression => isgreaterthan( + length("$(this.bundle).implicitly_failed_tests"), 0 + ); reports: ok:: @@ -201,24 +187,25 @@ bundle agent check "$(this.promise_filename) FAIL"; DEBUG|EXTRA:: - "test cases passed: $(with)" with => join(", ", passed_tests ); - "test cases that failed implicitly: $(with)" with => join(", ", implicitly_failed_tests ); - "Output from each test case:"; - "$(G.testdir)/$(test.cases)" - printfile => my_cat( $(this.promiser) ); + "test cases passed: $(with)" with => join(", ", passed_tests); + + "test cases that failed implicitly: $(with)" + with => join(", ", implicitly_failed_tests); + "Output from each test case:"; + "$(G.testdir)/$(test.cases)" printfile => my_cat($(this.promiser)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } -bundle agent __main__ { - +bundle agent __main__ +{ methods: any:: "init"; diff --git a/tests/acceptance/10_files/templating/mustache_html_escape.cf b/tests/acceptance/10_files/templating/mustache_html_escape.cf index 1c03c16fc9..decc658f9f 100644 --- a/tests/acceptance/10_files/templating/mustache_html_escape.cf +++ b/tests/acceptance/10_files/templating/mustache_html_escape.cf @@ -3,46 +3,42 @@ # Test that characters are NOT escaped outside of variables # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "origtestdir" string => dirname("$(this.promise_filename)"); + "origtestdir" string => dirname("$(this.promise_filename)"); files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { meta: - "test_suppress_fail" string => "!any", - meta => { "redmine7620" }; + "test_suppress_fail" + string => "!any", + meta => { "redmine7620" }; vars: - "template_file" string => "$(this.promise_filename).mustache"; + "template_file" string => "$(this.promise_filename).mustache"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_template => "$(template_file)", template_method => "mustache", @@ -54,24 +50,26 @@ bundle agent test } ####################################################### - bundle agent check { vars: - "expect" string => readfile("$(this.promise_filename).expected", 10000); - "actual" string => readfile("$(G.testfile)", 10000); + "expect" string => readfile("$(this.promise_filename).expected", 10000); + "actual" string => readfile("$(G.testfile)", 10000); classes: - "ok" expression => strcmp("$(expect)", "$(actual)"); + "ok" expression => strcmp("$(expect)", "$(actual)"); reports: DEBUG:: "expect: '$(expect)'"; "actual: '$(actual)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/templating/mustache_html_escape.cf.json b/tests/acceptance/10_files/templating/mustache_html_escape.cf.json index 3b9e16b803..79d2f2b138 100644 --- a/tests/acceptance/10_files/templating/mustache_html_escape.cf.json +++ b/tests/acceptance/10_files/templating/mustache_html_escape.cf.json @@ -1,7 +1,3 @@ { - "vars": { - "test": { - "amp": "&" - } - } + "vars": { "test": { "amp": "&" } } } diff --git a/tests/acceptance/10_files/templating/mustache_inline_demo.cf b/tests/acceptance/10_files/templating/mustache_inline_demo.cf index afcab5da05..d03e2d9068 100644 --- a/tests/acceptance/10_files/templating/mustache_inline_demo.cf +++ b/tests/acceptance/10_files/templating/mustache_inline_demo.cf @@ -3,43 +3,38 @@ # Demo from mustache.github.io # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "origtestdir" string => dirname("$(this.promise_filename)"); + "origtestdir" string => dirname("$(this.promise_filename)"); files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "template_str" string => "This is a test: {{a}}"; - "d" data => parsejson('{ "a": "1" }'); + "template_str" string => "This is a test: {{a}}"; + "d" data => parsejson('{ "a": "1" }'); files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_template_string => "$(template_str)", template_method => "inline_mustache", @@ -51,24 +46,28 @@ bundle agent test } ####################################################### - bundle agent check { vars: - "expect" string => readfile("$(init.origtestdir)/inline_demo.expected", 10000); - "actual" string => readfile("$(G.testfile)", 10000); + "expect" + string => readfile("$(init.origtestdir)/inline_demo.expected", 10000); + + "actual" string => readfile("$(G.testfile)", 10000); classes: - "ok" expression => regcmp("$(expect)", "$(actual)"); + "ok" expression => regcmp("$(expect)", "$(actual)"); reports: DEBUG:: "expect: '$(expect)'"; "actual: '$(actual)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/templating/mustache_invalid_template.cf b/tests/acceptance/10_files/templating/mustache_invalid_template.cf index f667124dbf..2d0f344da6 100644 --- a/tests/acceptance/10_files/templating/mustache_invalid_template.cf +++ b/tests/acceptance/10_files/templating/mustache_invalid_template.cf @@ -3,69 +3,65 @@ # Test that invalid mustache template does not cause a segfault # Redmine:4702 (https://cfengine.com/dev/issues/4702) ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "template_content" string => ' + "template_content" + string => ' {{#vars.sys.interfaces}}{{.}} {{#vars.sys.interface_flags[{{.}}]}} {{/vars.sys.interfaces}}'; files: - "$(G.testfile).template" - create => "true", - edit_line => insert_lines($(template_content)), - edit_defaults => empty; + "$(G.testfile).template" + create => "true", + edit_line => insert_lines($(template_content)), + edit_defaults => empty; - "$(G.testfile).output" - delete => init_delete; + "$(G.testfile).output" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: "template_file" string => "$(G.testfile).template"; files: - "$(G.testfile).output" - create => "true", - edit_template => "$(template_file)", - template_method => "mustache"; + "$(G.testfile).output" + create => "true", + edit_template => "$(template_file)", + template_method => "mustache"; reports: DEBUG:: "Rendering template file $(template_file) to $(G.testfile).output"; } - ####################################################### - bundle agent check { classes: - "ok" expression => "any", - comment => "If we made it to here we didn't segfault"; + "ok" + expression => "any", + comment => "If we made it to here we didn't segfault"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/templating/mustache_invalid_template_data.cf b/tests/acceptance/10_files/templating/mustache_invalid_template_data.cf index 13e8750f7c..2bbc7fa6fb 100644 --- a/tests/acceptance/10_files/templating/mustache_invalid_template_data.cf +++ b/tests/acceptance/10_files/templating/mustache_invalid_template_data.cf @@ -3,50 +3,46 @@ # Test that invalid mustache template data is not replaced by datastate(). # CFE-2194 ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "template_content" string => ' + "template_content" string => ' template_data: {{%-top-}} '; files: - "$(G.testfile).template" - create => "true", - edit_line => insert_lines($(template_content)), - edit_defaults => empty; + "$(G.testfile).template" + create => "true", + edit_line => insert_lines($(template_content)), + edit_defaults => empty; - "$(G.testfile).output" - delete => init_delete; + "$(G.testfile).output" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: "template_file" string => "$(G.testfile).template"; "invalid_data" - data => parsejson('{ + data => parsejson( + '{ "port": 3508, "protocol": 2, "filepath": "$(no_such_variable)", @@ -57,38 +53,36 @@ bundle agent test {"user": "thomas", "level": "admin"}, {"user": "malin", "level": "guest"} ] - }'); + }' + ); files: - "$(G.testfile).output" - create => "true", - edit_template => "$(template_file)", - template_method => "mustache", - template_data => @(invalid_data); + "$(G.testfile).output" + create => "true", + edit_template => "$(template_file)", + template_method => "mustache", + template_data => @(invalid_data); classes: - "invalid_data_exists" expression => isvariable("invalid_data"); + "invalid_data_exists" expression => isvariable("invalid_data"); reports: DEBUG:: "Rendering template file $(template_file) to $(G.testfile).output"; - - "invalid_data defined!" - if => "invalid_data_exists"; + "invalid_data defined!" if => "invalid_data_exists"; } - ####################################################### - bundle agent check { classes: - "ok" -> {"CFE-2194"} - not => fileexists("$(G.testfile).output"); + "ok" -> { "CFE-2194" } + not => fileexists("$(G.testfile).output"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/templating/mustache_no_end.error.cf b/tests/acceptance/10_files/templating/mustache_no_end.error.cf index 96f49c6234..04bcc28d18 100644 --- a/tests/acceptance/10_files/templating/mustache_no_end.error.cf +++ b/tests/acceptance/10_files/templating/mustache_no_end.error.cf @@ -3,6 +3,5 @@ bundle agent main { reports: - "With: $(with)" - with => string_mustache("{{"); + "With: $(with)" with => string_mustache("{{"); } diff --git a/tests/acceptance/10_files/templating/mustache_no_fallback_to_datastate_with_undefined_direct_data.cf b/tests/acceptance/10_files/templating/mustache_no_fallback_to_datastate_with_undefined_direct_data.cf index 5f491a27f5..38663a82b0 100644 --- a/tests/acceptance/10_files/templating/mustache_no_fallback_to_datastate_with_undefined_direct_data.cf +++ b/tests/acceptance/10_files/templating/mustache_no_fallback_to_datastate_with_undefined_direct_data.cf @@ -1,24 +1,25 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common test_meta { vars: - "description" string => "Test that a mustache template does not fall back to datastate when its given an invalid container directly"; + "description" + string => "Test that a mustache template does not fall back to datastate when its given an invalid container directly"; } bundle agent init { - # First we make sure to start of with am emty target - files: + # First we make sure to start of with am emty target + files: "$(G.testfile)" handle => "init_testfile_absent", delete => tidy; - + "$(G.testfile)" handle => "init_testfile_present", create => "true", @@ -32,14 +33,18 @@ bundle agent test # Second we promise to render template passing data that does not exist via template_data vars: "classes" - slist => classesmatching("template_render_with_non_existing_data_container.*"); + slist => classesmatching( + "template_render_with_non_existing_data_container.*" + ); files: "$(G.testfile)" edit_template => "$(this.promise_filename).mustache", template_method => "mustache", template_data => @(missing_ns:missing_bundle.missing_data), - classes => scoped_classes_generic("bundle", "template_render_with_non_existing_data_container"); + classes => scoped_classes_generic( + "bundle", "template_render_with_non_existing_data_container" + ); reports: DEBUG:: @@ -49,29 +54,25 @@ bundle agent test bundle agent check { meta: - "test_soft_fail" string => "any", meta => { "redmine7699" }; + "test_soft_fail" + string => "any", + meta => { "redmine7699" }; # Finally we look to see what classes were defined, and look at the target file to see if it has changed. vars: - "expected" string => ""; - "actual" string => readfile($(G.testfile), inf); - + "expected" string => ""; + "actual" string => readfile($(G.testfile), inf); + classes: # I assume here that the promise should not even be actuated when invalid # data is provided thus we should have found 0 classes - "fail_classes" - expression => isgreaterthan(length("test.classes"), 0); + "fail_classes" expression => isgreaterthan(length("test.classes"), 0); # Another failure condition is if the rendered file is not empty as # expected - "fail_content" - not => strcmp($(expected), $(actual)); - - "fail" - or => { "fail_classes", "fail_content" }; - - "exception" - and => { "fail", "ok" }; + "fail_content" not => strcmp($(expected), $(actual)); + "fail" or => { "fail_classes", "fail_content" }; + "exception" and => { "fail", "ok" }; reports: DEBUG:: @@ -81,12 +82,12 @@ bundle agent check "DEBUG $(this.bundle): Found the content of $(G.testfile) was not as expected" if => "fail_content"; - fail:: - "$(this.promise_filename) FAIL"; + fail:: + "$(this.promise_filename) FAIL"; - !fail|exception:: - "$(this.promise_filename) Pass"; + !fail|exception:: + "$(this.promise_filename) Pass"; - exception:: - "$(this.promise_filename) EXCEPTION"; + exception:: + "$(this.promise_filename) EXCEPTION"; } diff --git a/tests/acceptance/10_files/templating/mustache_no_fallback_to_datastate_with_undefined_mergedata.cf b/tests/acceptance/10_files/templating/mustache_no_fallback_to_datastate_with_undefined_mergedata.cf index e4bc743ab2..179a63aada 100644 --- a/tests/acceptance/10_files/templating/mustache_no_fallback_to_datastate_with_undefined_mergedata.cf +++ b/tests/acceptance/10_files/templating/mustache_no_fallback_to_datastate_with_undefined_mergedata.cf @@ -1,24 +1,25 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common test_meta { vars: - "description" string => "Test that a mustache template does not fallback to datastate when its given an invalid container via mergedata"; + "description" + string => "Test that a mustache template does not fallback to datastate when its given an invalid container via mergedata"; } bundle agent init { - # First we make sure to start with an empty target file - files: + # First we make sure to start with an empty target file + files: "$(G.testfile)" handle => "init_testfile_absent", delete => tidy; - + "$(G.testfile)" handle => "init_testfile_present", create => "true", @@ -32,14 +33,18 @@ bundle agent test # Second we try to render the template using the result of mergedata with a non existing container vars: "classes" - slist => classesmatching("template_render_with_non_existing_data_container.*"); + slist => classesmatching( + "template_render_with_non_existing_data_container.*" + ); files: "$(G.testfile)" edit_template => "$(this.promise_filename).mustache", template_method => "mustache", template_data => mergedata("missing_ns:missing_bundle.missing_data"), - classes => scoped_classes_generic("bundle", "template_render_with_non_existing_data_container"); + classes => scoped_classes_generic( + "bundle", "template_render_with_non_existing_data_container" + ); reports: DEBUG:: @@ -49,29 +54,25 @@ bundle agent test bundle agent check { meta: - "test_soft_fail" string => "any", meta => { "redmine7699" }; + "test_soft_fail" + string => "any", + meta => { "redmine7699" }; # Finally we check to see what classes were defined, and inspect the target file for changes. vars: - "expected" string => ""; - "actual" string => readfile($(G.testfile), inf); - + "expected" string => ""; + "actual" string => readfile($(G.testfile), inf); + classes: # I assume here that the promise should not even be actuated when invalid # data is provided thus we should have found 0 classes - "fail_classes" - expression => isgreaterthan(length("test.classes"), 0); + "fail_classes" expression => isgreaterthan(length("test.classes"), 0); # Another failure condition is if the rendered file is not empty as # expected - "fail_content" - not => strcmp($(expected), $(actual)); - - "fail" - or => { "fail_classes", "fail_content" }; - - "exception" - and => { "fail", "ok" }; + "fail_content" not => strcmp($(expected), $(actual)); + "fail" or => { "fail_classes", "fail_content" }; + "exception" and => { "fail", "ok" }; reports: DEBUG:: @@ -81,12 +82,12 @@ bundle agent check "DEBUG $(this.bundle): Found the content of $(G.testfile) was not as expected" if => "fail_content"; - fail:: - "$(this.promise_filename) FAIL"; + fail:: + "$(this.promise_filename) FAIL"; - !fail|exception:: - "$(this.promise_filename) Pass"; + !fail|exception:: + "$(this.promise_filename) Pass"; - exception:: - "$(this.promise_filename) EXCEPTION"; + exception:: + "$(this.promise_filename) EXCEPTION"; } diff --git a/tests/acceptance/10_files/templating/mustache_no_fallback_to_datastate_with_undefined_parsejson_storejson.cf b/tests/acceptance/10_files/templating/mustache_no_fallback_to_datastate_with_undefined_parsejson_storejson.cf index 952f9f443b..72db4d95ce 100644 --- a/tests/acceptance/10_files/templating/mustache_no_fallback_to_datastate_with_undefined_parsejson_storejson.cf +++ b/tests/acceptance/10_files/templating/mustache_no_fallback_to_datastate_with_undefined_parsejson_storejson.cf @@ -1,32 +1,31 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common test_meta { vars: - "description" string => "Test that a mustache template does not try to render when its given an invalid container via parsejson(storejson())"; + "description" + string => "Test that a mustache template does not try to render when its given an invalid container via parsejson(storejson())"; } bundle agent init { - # First we make sure to start with an empty target file. - - files: + # First we make sure to start with an empty target file. + files: "$(G.testfile)" handle => "init_testfile_absent", delete => tidy; - + "$(G.testfile)" handle => "init_testfile_present", create => "true", depends_on => { "init_testfile_absent" }, comment => "We first remove the file, and then re-create it so that we know that it is empty to start with."; - } bundle agent test @@ -34,14 +33,20 @@ bundle agent test # Second we try to render the template while passing in an non existing data container to template_data via parsejson(storejson vars: "classes" - slist => classesmatching("template_render_with_non_existing_data_container.*"); + slist => classesmatching( + "template_render_with_non_existing_data_container.*" + ); files: "$(G.testfile)" edit_template => "$(this.promise_filename).mustache", template_method => "mustache", - template_data => parsejson(storejson('missing_ns:missing_bundle.missing_data')), - classes => scoped_classes_generic("bundle", "template_render_with_non_existing_data_container"); + template_data => parsejson( + storejson('missing_ns:missing_bundle.missing_data') + ), + classes => scoped_classes_generic( + "bundle", "template_render_with_non_existing_data_container" + ); reports: DEBUG:: @@ -51,29 +56,25 @@ bundle agent test bundle agent check { meta: - "test_soft_fail" string => "any", meta => { "redmine7699" }; + "test_soft_fail" + string => "any", + meta => { "redmine7699" }; # Finally we check to see what classes were defined, and inspect the target file for change vars: - "expected" string => ""; - "actual" string => readfile($(G.testfile), inf); - + "expected" string => ""; + "actual" string => readfile($(G.testfile), inf); + classes: # I assume here that the promise should not even be actuated when invalid # data is provided thus we should have found 0 classes - "fail_classes" - expression => isgreaterthan(length("test.classes"), 0); + "fail_classes" expression => isgreaterthan(length("test.classes"), 0); # Another failure condition is if the rendered file is not empty as # expected - "fail_content" - not => strcmp($(expected), $(actual)); - - "fail" - or => { "fail_classes", "fail_content" }; - - "exception" - and => { "fail", "ok" }; + "fail_content" not => strcmp($(expected), $(actual)); + "fail" or => { "fail_classes", "fail_content" }; + "exception" and => { "fail", "ok" }; reports: DEBUG:: @@ -83,12 +84,12 @@ bundle agent check "DEBUG $(this.bundle): Found the content of $(G.testfile) was not as expected" if => "fail_content"; - fail:: - "$(this.promise_filename) FAIL"; + fail:: + "$(this.promise_filename) FAIL"; - !fail|exception:: - "$(this.promise_filename) Pass"; + !fail|exception:: + "$(this.promise_filename) Pass"; - exception:: - "$(this.promise_filename) EXCEPTION"; + exception:: + "$(this.promise_filename) EXCEPTION"; } diff --git a/tests/acceptance/10_files/templating/mustache_no_render_with_undefined_direct_data.cf b/tests/acceptance/10_files/templating/mustache_no_render_with_undefined_direct_data.cf index 04ebadada5..ff09d5ecd9 100644 --- a/tests/acceptance/10_files/templating/mustache_no_render_with_undefined_direct_data.cf +++ b/tests/acceptance/10_files/templating/mustache_no_render_with_undefined_direct_data.cf @@ -1,24 +1,25 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common test_meta { vars: - "description" string => "Test that a mustache template does not try to render when its given an invalid container directly"; + "description" + string => "Test that a mustache template does not try to render when its given an invalid container directly"; } bundle agent init { - # First we make sure to start of with am emty target - files: + # First we make sure to start of with am emty target + files: "$(G.testfile)" handle => "init_testfile_absent", delete => tidy; - + "$(G.testfile)" handle => "init_testfile_present", create => "true", @@ -32,14 +33,18 @@ bundle agent test # Second we promise to render template passing data that does not exist via template_data vars: "classes" - slist => classesmatching("template_render_with_non_existing_data_container.*"); + slist => classesmatching( + "template_render_with_non_existing_data_container.*" + ); files: "$(G.testfile)" edit_template => "$(this.promise_filename).mustache", template_method => "mustache", template_data => @(missing_ns:missing_bundle.missing_data), - classes => scoped_classes_generic("bundle", "template_render_with_non_existing_data_container"); + classes => scoped_classes_generic( + "bundle", "template_render_with_non_existing_data_container" + ); reports: DEBUG:: @@ -49,29 +54,25 @@ bundle agent test bundle agent check { meta: - "test_soft_fail" string => "any", meta => { "redmine7699" }; + "test_soft_fail" + string => "any", + meta => { "redmine7699" }; # Finally we look to see what classes were defined, and look at the target file to see if it has changed. vars: - "expected" string => ""; - "actual" string => readfile($(G.testfile), inf); - + "expected" string => ""; + "actual" string => readfile($(G.testfile), inf); + classes: # I assume here that the promise should not even be actuated when invalid # data is provided thus we should have found 0 classes - "fail_classes" - expression => isgreaterthan(length("test.classes"), 0); + "fail_classes" expression => isgreaterthan(length("test.classes"), 0); # Another failure condition is if the rendered file is not empty as # expected - "fail_content" - not => strcmp($(expected), $(actual)); - - "fail" - or => { "fail_classes", "fail_content" }; - - "exception" - and => { "fail", "ok" }; + "fail_content" not => strcmp($(expected), $(actual)); + "fail" or => { "fail_classes", "fail_content" }; + "exception" and => { "fail", "ok" }; reports: DEBUG:: @@ -81,12 +82,12 @@ bundle agent check "DEBUG $(this.bundle): Found the content of $(G.testfile) was not as expected" if => "fail_content"; - fail:: - "$(this.promise_filename) FAIL"; + fail:: + "$(this.promise_filename) FAIL"; - !fail|exception:: - "$(this.promise_filename) Pass"; + !fail|exception:: + "$(this.promise_filename) Pass"; - exception:: - "$(this.promise_filename) EXCEPTION"; + exception:: + "$(this.promise_filename) EXCEPTION"; } diff --git a/tests/acceptance/10_files/templating/mustache_no_render_with_undefined_mergedata.cf b/tests/acceptance/10_files/templating/mustache_no_render_with_undefined_mergedata.cf index 090772568d..a7ca8ae360 100644 --- a/tests/acceptance/10_files/templating/mustache_no_render_with_undefined_mergedata.cf +++ b/tests/acceptance/10_files/templating/mustache_no_render_with_undefined_mergedata.cf @@ -1,24 +1,25 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common test_meta { vars: - "description" string => "Test that a mustache template does not try to render when its given an invalid container via mergedata"; + "description" + string => "Test that a mustache template does not try to render when its given an invalid container via mergedata"; } bundle agent init { - # First we make sure to start with an empty target file - files: + # First we make sure to start with an empty target file + files: "$(G.testfile)" handle => "init_testfile_absent", delete => tidy; - + "$(G.testfile)" handle => "init_testfile_present", create => "true", @@ -32,14 +33,18 @@ bundle agent test # Second we try to render the template using the result of mergedata with a non existing container vars: "classes" - slist => classesmatching("template_render_with_non_existing_data_container.*"); + slist => classesmatching( + "template_render_with_non_existing_data_container.*" + ); files: "$(G.testfile)" edit_template => "$(this.promise_filename).mustache", template_method => "mustache", template_data => mergedata("missing_ns:missing_bundle.missing_data"), - classes => scoped_classes_generic("bundle", "template_render_with_non_existing_data_container"); + classes => scoped_classes_generic( + "bundle", "template_render_with_non_existing_data_container" + ); reports: DEBUG:: @@ -49,29 +54,25 @@ bundle agent test bundle agent check { meta: - "test_soft_fail" string => "any", meta => { "redmine7699" }; + "test_soft_fail" + string => "any", + meta => { "redmine7699" }; # Finally we check to see what classes were defined, and inspect the target file for changes. vars: - "expected" string => ""; - "actual" string => readfile($(G.testfile), inf); - + "expected" string => ""; + "actual" string => readfile($(G.testfile), inf); + classes: # I assume here that the promise should not even be actuated when invalid # data is provided thus we should have found 0 classes - "fail_classes" - expression => isgreaterthan(length("test.classes"), 0); + "fail_classes" expression => isgreaterthan(length("test.classes"), 0); # Another failure condition is if the rendered file is not empty as # expected - "fail_content" - not => strcmp($(expected), $(actual)); - - "fail" - or => { "fail_classes", "fail_content" }; - - "exception" - and => { "fail", "ok" }; + "fail_content" not => strcmp($(expected), $(actual)); + "fail" or => { "fail_classes", "fail_content" }; + "exception" and => { "fail", "ok" }; reports: DEBUG:: @@ -81,12 +82,12 @@ bundle agent check "DEBUG $(this.bundle): Found the content of $(G.testfile) was not as expected" if => "fail_content"; - fail:: - "$(this.promise_filename) FAIL"; + fail:: + "$(this.promise_filename) FAIL"; - !fail|exception:: - "$(this.promise_filename) Pass"; + !fail|exception:: + "$(this.promise_filename) Pass"; - exception:: - "$(this.promise_filename) EXCEPTION"; + exception:: + "$(this.promise_filename) EXCEPTION"; } diff --git a/tests/acceptance/10_files/templating/mustache_no_render_with_undefined_parsejson_storejson.cf b/tests/acceptance/10_files/templating/mustache_no_render_with_undefined_parsejson_storejson.cf index 952f9f443b..72db4d95ce 100644 --- a/tests/acceptance/10_files/templating/mustache_no_render_with_undefined_parsejson_storejson.cf +++ b/tests/acceptance/10_files/templating/mustache_no_render_with_undefined_parsejson_storejson.cf @@ -1,32 +1,31 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle common test_meta { vars: - "description" string => "Test that a mustache template does not try to render when its given an invalid container via parsejson(storejson())"; + "description" + string => "Test that a mustache template does not try to render when its given an invalid container via parsejson(storejson())"; } bundle agent init { - # First we make sure to start with an empty target file. - - files: + # First we make sure to start with an empty target file. + files: "$(G.testfile)" handle => "init_testfile_absent", delete => tidy; - + "$(G.testfile)" handle => "init_testfile_present", create => "true", depends_on => { "init_testfile_absent" }, comment => "We first remove the file, and then re-create it so that we know that it is empty to start with."; - } bundle agent test @@ -34,14 +33,20 @@ bundle agent test # Second we try to render the template while passing in an non existing data container to template_data via parsejson(storejson vars: "classes" - slist => classesmatching("template_render_with_non_existing_data_container.*"); + slist => classesmatching( + "template_render_with_non_existing_data_container.*" + ); files: "$(G.testfile)" edit_template => "$(this.promise_filename).mustache", template_method => "mustache", - template_data => parsejson(storejson('missing_ns:missing_bundle.missing_data')), - classes => scoped_classes_generic("bundle", "template_render_with_non_existing_data_container"); + template_data => parsejson( + storejson('missing_ns:missing_bundle.missing_data') + ), + classes => scoped_classes_generic( + "bundle", "template_render_with_non_existing_data_container" + ); reports: DEBUG:: @@ -51,29 +56,25 @@ bundle agent test bundle agent check { meta: - "test_soft_fail" string => "any", meta => { "redmine7699" }; + "test_soft_fail" + string => "any", + meta => { "redmine7699" }; # Finally we check to see what classes were defined, and inspect the target file for change vars: - "expected" string => ""; - "actual" string => readfile($(G.testfile), inf); - + "expected" string => ""; + "actual" string => readfile($(G.testfile), inf); + classes: # I assume here that the promise should not even be actuated when invalid # data is provided thus we should have found 0 classes - "fail_classes" - expression => isgreaterthan(length("test.classes"), 0); + "fail_classes" expression => isgreaterthan(length("test.classes"), 0); # Another failure condition is if the rendered file is not empty as # expected - "fail_content" - not => strcmp($(expected), $(actual)); - - "fail" - or => { "fail_classes", "fail_content" }; - - "exception" - and => { "fail", "ok" }; + "fail_content" not => strcmp($(expected), $(actual)); + "fail" or => { "fail_classes", "fail_content" }; + "exception" and => { "fail", "ok" }; reports: DEBUG:: @@ -83,12 +84,12 @@ bundle agent check "DEBUG $(this.bundle): Found the content of $(G.testfile) was not as expected" if => "fail_content"; - fail:: - "$(this.promise_filename) FAIL"; + fail:: + "$(this.promise_filename) FAIL"; - !fail|exception:: - "$(this.promise_filename) Pass"; + !fail|exception:: + "$(this.promise_filename) Pass"; - exception:: - "$(this.promise_filename) EXCEPTION"; + exception:: + "$(this.promise_filename) EXCEPTION"; } diff --git a/tests/acceptance/10_files/templating/mustache_render_quote.cf b/tests/acceptance/10_files/templating/mustache_render_quote.cf index 6b900ecb44..5ba4ba3ae9 100644 --- a/tests/acceptance/10_files/templating/mustache_render_quote.cf +++ b/tests/acceptance/10_files/templating/mustache_render_quote.cf @@ -5,43 +5,41 @@ # # Redmine: https://dev.cfengine.com/issues/6516 ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "variable_containing_double_quote" string => 'Something "special" with quotes'; - "variable_containing_single_quote" string => "Something 'special' with quotes"; + "variable_containing_double_quote" + string => 'Something "special" with quotes'; + + "variable_containing_single_quote" + string => "Something 'special' with quotes"; files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "template_file" string => "$(this.promise_filename).mustache"; + "template_file" string => "$(this.promise_filename).mustache"; files: - "$(G.testfile)" + "$(G.testfile)" create => "true", edit_template => "$(template_file)", template_method => "mustache"; @@ -52,24 +50,26 @@ bundle agent test } ####################################################### - bundle agent check { vars: - "expect" string => readfile("$(this.promise_filename).expected", 4000); - "actual" string => readfile("$(G.testfile)", 4000); + "expect" string => readfile("$(this.promise_filename).expected", 4000); + "actual" string => readfile("$(G.testfile)", 4000); classes: - "ok" expression => regcmp("$(expect)", "$(actual)"); + "ok" expression => regcmp("$(expect)", "$(actual)"); reports: DEBUG:: "expect: '$(expect)'"; "actual: '$(actual)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/templating/mustache_repair_existing.cf b/tests/acceptance/10_files/templating/mustache_repair_existing.cf index 084ed4b2b0..e2a1991d97 100644 --- a/tests/acceptance/10_files/templating/mustache_repair_existing.cf +++ b/tests/acceptance/10_files/templating/mustache_repair_existing.cf @@ -3,43 +3,39 @@ # Test that _repaired classes are defined on template repair # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "origtestdir" string => dirname("$(this.promise_filename)"); + "origtestdir" string => dirname("$(this.promise_filename)"); files: - "$(G.testfile)" - create => "true", - comment => "Need to see if we define repair when file exists"; + "$(G.testfile)" + create => "true", + comment => "Need to see if we define repair when file exists"; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - bundle agent test { vars: - "template_file" string => "$(init.origtestdir)/demo.mustache"; + "template_file" string => "$(init.origtestdir)/demo.mustache"; files: - "$(G.testfile)" + "$(G.testfile)" edit_template => "$(template_file)", template_method => "mustache", classes => classes_generic("templated_file"), @@ -53,22 +49,25 @@ bundle agent test bundle agent check { vars: - "expect" string => readfile("$(init.origtestdir)/demo.expected", 4096); - "actual" string => readfile("$(G.testfile)", 4096); + "expect" string => readfile("$(init.origtestdir)/demo.expected", 4096); + "actual" string => readfile("$(G.testfile)", 4096); classes: - "content_ok" expression => regcmp("$(expect)", "$(actual)"); - "repair_ok" expression => "templated_file_repaired"; - "ok" and => { "content_ok", "repair_ok" }; + "content_ok" expression => regcmp("$(expect)", "$(actual)"); + "repair_ok" expression => "templated_file_repaired"; + "ok" and => { "content_ok", "repair_ok" }; reports: DEBUG:: "expect: '$(expect)'"; "actual: '$(actual)'"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/templating/mustache_section.cf b/tests/acceptance/10_files/templating/mustache_section.cf index 57fab8a942..ad1e4e688f 100644 --- a/tests/acceptance/10_files/templating/mustache_section.cf +++ b/tests/acceptance/10_files/templating/mustache_section.cf @@ -3,30 +3,31 @@ # Check that we warn about Mustache sections over non-iterables/non-booleans # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { methods: - "" usebundle => dcs_fini($(G.testfile)); + "" usebundle => dcs_fini($(G.testfile)); } ####################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_output1(".*Mustache sections can only take a boolean or a container.+value, but section 'x' isn't getting one of those.*", - "$(sys.cf_agent) -KI -f $(this.promise_filename).sub | grep Mustache", - $(this.promise_filename)); + "" + usebundle => dcs_passif_output1( + ".*Mustache sections can only take a boolean or a container.+value, but section 'x' isn't getting one of those.*", + "$(sys.cf_agent) -KI -f $(this.promise_filename).sub | grep Mustache", + $(this.promise_filename) + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/templating/mustache_top_level_iteration.cf b/tests/acceptance/10_files/templating/mustache_top_level_iteration.cf index 3c9ed6dc4d..2452fc67fb 100644 --- a/tests/acceptance/10_files/templating/mustache_top_level_iteration.cf +++ b/tests/acceptance/10_files/templating/mustache_top_level_iteration.cf @@ -3,33 +3,37 @@ # Demo of Mustache templates with top-level iteration # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent test { vars: - "mydata1" data => '{ "a": 100 }'; - "mydata2" data => '[ "p", "q" ]'; + "mydata1" data => '{ "a": 100 }'; + "mydata2" data => '[ "p", "q" ]'; - "actual1" string => string_mustache("{{#-top-}}key {{@}} value {{.}} {{/-top-}}", mydata1); - "actual2" string => string_mustache("{{#-top-}}value {{.}} {{/-top-}}", mydata2); + "actual1" + string => string_mustache( + "{{#-top-}}key {{@}} value {{.}} {{/-top-}}", mydata1 + ); + + "actual2" + string => string_mustache("{{#-top-}}value {{.}} {{/-top-}}", mydata2); } ####################################################### - bundle agent check { methods: - "check" usebundle => dcs_check_state(test, - "$(this.promise_filename).expected.json", - $(this.promise_filename)); + "check" + usebundle => dcs_check_state( + test, + "$(this.promise_filename).expected.json", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/10_files/templating/staging/array_expansion.cf b/tests/acceptance/10_files/templating/staging/array_expansion.cf index 83541c181d..00f5c71af8 100644 --- a/tests/acceptance/10_files/templating/staging/array_expansion.cf +++ b/tests/acceptance/10_files/templating/staging/array_expansion.cf @@ -4,61 +4,65 @@ # Redmine #3442 # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "data[user-a][home]" string => "/tmp/test/user-a"; + "data[user-a][home]" string => "/tmp/test/user-a"; methods: - "" usebundle => file_make("$(G.testfile).expected", - "CASE1: passed var /tmp/test/user-a .foo .bar -CASE2: local var /tmp/test/user-a .foo .bar"); + "" + usebundle => file_make( + "$(G.testfile).expected", + "CASE1: passed var /tmp/test/user-a .foo .bar +CASE2: local var /tmp/test/user-a .foo .bar" + ); - "" usebundle => file_make("$(G.testfile).template", - "CASE1: passed var $(const.dollar)($(const.dollar)(test2.info)[user-a][home]) .foo .bar -CASE2: local var $(const.dollar)($(const.dollar)(test2.local_info)[user-a][home]) .foo .bar"); + "" + usebundle => file_make( + "$(G.testfile).template", + "CASE1: passed var $(const.dollar)($(const.dollar)(test2.info)[user-a][home]) .foo .bar +CASE2: local var $(const.dollar)($(const.dollar)(test2.local_info)[user-a][home]) .foo .bar" + ); } ####################################################### - bundle agent test { methods: - "" usebundle => test2("init.data"); - + "" usebundle => test2("init.data"); } bundle agent test2(info) { vars: - "local_info" string => "init.data"; + "local_info" string => "init.data"; files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_defaults => empty, edit_template => "$(G.testfile).template"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/templating/timed/expired_edit_line_locks.cf b/tests/acceptance/10_files/templating/timed/expired_edit_line_locks.cf index caabbffd40..08ab52a51f 100644 --- a/tests/acceptance/10_files/templating/timed/expired_edit_line_locks.cf +++ b/tests/acceptance/10_files/templating/timed/expired_edit_line_locks.cf @@ -1,20 +1,18 @@ # Check whether file promises have a shorter expiry time than edit_line promises # resulting from templates. This will create an empty file because the file is # opened for editing, but all the edit_line promises have expired. - body common control { - inputs => { "../../../dcs.sub.cf", "../../../plucked.sub.cf" }; - bundlesequence => { default($(this.promise_filename)) }; + inputs => { "../../../dcs.sub.cf", "../../../plucked.sub.cf" }; + bundlesequence => { default($(this.promise_filename)) }; } bundle agent test { - commands: - # Note, no -K, we are testing locks. - "$(sys.cf_agent) -v -D AUTO,DEBUG -f $(this.promise_filename).sub" - contain => in_shell; + # Note, no -K, we are testing locks. + "$(sys.cf_agent) -v -D AUTO,DEBUG -f $(this.promise_filename).sub" + contain => in_shell; } bundle agent check @@ -26,19 +24,30 @@ bundle agent check vars: test_pass_2:: "content_edit_line" string => readfile("$(G.testfile).edit_line", 10000); - "content_cftemplate" string => readfile("$(G.testfile).cftemplate", 10000); + + "content_cftemplate" + string => readfile("$(G.testfile).cftemplate", 10000); + "content_mustache" string => readfile("$(G.testfile).mustache", 10000); classes: test_pass_2:: - "ok_edit_line" expression => strcmp($(content_edit_line), "text"), + "ok_edit_line" + expression => strcmp($(content_edit_line), "text"), scope => "namespace"; - "ok_cftemplate" expression => strcmp($(content_cftemplate), "text"), + + "ok_cftemplate" + expression => strcmp($(content_cftemplate), "text"), scope => "namespace"; - "ok_mustache" expression => strcmp($(content_mustache), "text"), + + "ok_mustache" + expression => strcmp($(content_mustache), "text"), scope => "namespace"; methods: test_pass_2:: - "any" usebundle => dcs_passif("ok_edit_line.ok_cftemplate.ok_mustache", $(this.promise_filename)); + "any" + usebundle => dcs_passif( + "ok_edit_line.ok_cftemplate.ok_mustache", $(this.promise_filename) + ); } diff --git a/tests/acceptance/10_files/this_promiser.cf b/tests/acceptance/10_files/this_promiser.cf index c1dc0ac1f1..4a4dc64d75 100644 --- a/tests/acceptance/10_files/this_promiser.cf +++ b/tests/acceptance/10_files/this_promiser.cf @@ -3,64 +3,63 @@ # Test this.promiser on files promises # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } body classes promiser0_generic { - promise_repaired => { "$(this.promiser)_repaired", "$(this.promiser)_0_ok" }; - promise_kept => { "$(this.promiser)_kept", "$(this.promiser)_0_ok" }; + promise_repaired => { "$(this.promiser)_repaired", "$(this.promiser)_0_ok" }; + promise_kept => { "$(this.promiser)_kept", "$(this.promiser)_0_ok" }; } body classes promiser1_generic { - promise_repaired => { "$(this.promiser)_repaired", "$(this.promiser)_1_ok" }; - promise_kept => { "$(this.promiser)_kept", "$(this.promiser)_1_ok" }; + promise_repaired => { "$(this.promiser)_repaired", "$(this.promiser)_1_ok" }; + promise_kept => { "$(this.promiser)_kept", "$(this.promiser)_1_ok" }; } body classes promiser2_generic { - promise_repaired => { "$(this.promiser)_repaired", "$(this.promiser)_2_ok" }; - promise_kept => { "$(this.promiser)_kept", "$(this.promiser)_2_ok" }; + promise_repaired => { "$(this.promiser)_repaired", "$(this.promiser)_2_ok" }; + promise_kept => { "$(this.promiser)_kept", "$(this.promiser)_2_ok" }; } body classes promiser3_generic { - promise_repaired => { "$(this.promiser)_repaired", "$(this.promiser)_3_ok" }; - promise_kept => { "$(this.promiser)_kept", "$(this.promiser)_3_ok" }; + promise_repaired => { "$(this.promiser)_repaired", "$(this.promiser)_3_ok" }; + promise_kept => { "$(this.promiser)_kept", "$(this.promiser)_3_ok" }; } body classes promiser4_generic { - promise_repaired => { "$(this.promiser)_repaired", "$(this.promiser)_4_ok" }; - promise_kept => { "$(this.promiser)_kept", "$(this.promiser)_4_ok" }; + promise_repaired => { "$(this.promiser)_repaired", "$(this.promiser)_4_ok" }; + promise_kept => { "$(this.promiser)_kept", "$(this.promiser)_4_ok" }; } bundle agent init { vars: - "files" slist => { "aa", "ab", "ac", "ba", "bb", "bc" }; + "files" slist => { "aa", "ab", "ac", "ba", "bb", "bc" }; files: - "$(G.testdir)/copy_me_source" - create => "true"; + "$(G.testdir)/copy_me_source" create => "true"; } ####################################################### - bundle agent test { meta: - "test_soft_fail" string => "windows", + "test_soft_fail" + string => "windows", meta => { "ENT-10257" }; + commands: - "$(G.true)" - classes => promiser0_generic; + "$(G.true)" classes => promiser0_generic; + files: # 6 promisers "$(G.testdir)/$(init.files)" @@ -88,8 +87,7 @@ bundle agent test delete => tidyfiles, classes => promiser3_generic; - "$(G.testdir)/copy_me" - copy_from => local_cp("$(this.promiser)_source"); + "$(G.testdir)/copy_me" copy_from => local_cp("$(this.promiser)_source"); methods: "template_test" usebundle => template_test; @@ -104,13 +102,9 @@ bundle agent template_test files: # create empty files so that we can test pattern and file_select cases - "$(testdir)/." - create => "true"; - - "$(testdir)/$(cfe_files)" - create => "true"; - "$(testdir)/$(mustache_files)" - create => "true"; + "$(testdir)/." create => "true"; + "$(testdir)/$(cfe_files)" create => "true"; + "$(testdir)/$(mustache_files)" create => "true"; "$(testdir)/$(cfe_files).cf-template" create => "true", @@ -136,62 +130,68 @@ bundle agent template_test body file_select mustache_files { - leaf_name => { "@(template_test.mustache_files)" }; - file_result => "leaf_name"; + leaf_name => { "@(template_test.mustache_files)" }; + file_result => "leaf_name"; } body delete tidyfiles { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } body file_select test_plain { - leaf_name => { "[a,b][a,b,c]" }; - file_types => { "plain" }; - file_result => "file_types.leaf_name"; + leaf_name => { "[a,b][a,b,c]" }; + file_types => { "plain" }; + file_result => "file_types.leaf_name"; } body file_select by_exec_cmd # Redmine #3530 { - leaf_name => {"ba"}; - exec_program => "$(G.ls) $(this.promiser)"; - file_result => "leaf_name.exec_program"; + leaf_name => { "ba" }; + exec_program => "$(G.ls) $(this.promiser)"; + file_result => "leaf_name.exec_program"; } body depth_search test_recurse { - depth => "inf"; + depth => "inf"; } - ####################################################### - bundle agent check { vars: - "ok_promisers" slist => classesmatching(".*_ok"); - "ok_0_count" int => countclassesmatching(".*_0_ok"); - "ok_1_count" int => countclassesmatching(".*_1_ok"); - "ok_2_count" int => countclassesmatching(".*_2_ok"); - "ok_3_count" int => countclassesmatching(".*_3_ok"); - "ok_4_count" int => countclassesmatching(".*_4_ok"); - "ok_pattern_promiser_count" int => countclassesmatching(".*__[01234]_ok"), - comment => "the patterns should be cannonified and classes for them should be defined"; + "ok_promisers" slist => classesmatching(".*_ok"); + "ok_0_count" int => countclassesmatching(".*_0_ok"); + "ok_1_count" int => countclassesmatching(".*_1_ok"); + "ok_2_count" int => countclassesmatching(".*_2_ok"); + "ok_3_count" int => countclassesmatching(".*_3_ok"); + "ok_4_count" int => countclassesmatching(".*_4_ok"); + + "ok_pattern_promiser_count" + int => countclassesmatching(".*__[01234]_ok"), + comment => "the patterns should be cannonified and classes for them should be defined"; classes: - "ok_expand" expression => none("__this_promiser_[0,1,2,3]_ok", ok_promisers); - "ok0" expression => strcmp("$(ok_0_count)", 1); - "ok1" expression => strcmp("$(ok_1_count)", 6); - "ok2" expression => strcmp("$(ok_2_count)", 6); - "ok3" expression => strcmp("$(ok_3_count)", 7); - "ok4" expression => strcmp("$(ok_4_count)", 6); - "ok5" expression => fileexists("$(G.testdir)/copy_me"); - "ok_pattern" expression => strcmp("$(ok_pattern_promiser_count)", 3); - - "ok" and => { "ok_expand", "ok0", "ok1", "ok2", "ok3", "ok4", "ok5", "ok_pattern" }; + "ok_expand" + expression => none("__this_promiser_[0,1,2,3]_ok", ok_promisers); + + "ok0" expression => strcmp("$(ok_0_count)", 1); + "ok1" expression => strcmp("$(ok_1_count)", 6); + "ok2" expression => strcmp("$(ok_2_count)", 6); + "ok3" expression => strcmp("$(ok_3_count)", 7); + "ok4" expression => strcmp("$(ok_4_count)", 6); + "ok5" expression => fileexists("$(G.testdir)/copy_me"); + "ok_pattern" expression => strcmp("$(ok_pattern_promiser_count)", 3); + + "ok" + and => { + "ok_expand", "ok0", "ok1", "ok2", "ok3", "ok4", "ok5", "ok_pattern" + }; + reports: DEBUG:: "$(ok_promisers)"; @@ -201,13 +201,16 @@ bundle agent check "3: $(ok_3_count) (expected 7)"; "4: $(ok_4_count) (expected 6)"; "pattern promiser classes: $(ok_pattern_promiser_count) (expected 3)"; + DEBUG.!ok5:: "5: file not copied"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 27 diff --git a/tests/acceptance/10_files/unsafe/00_immutable.cf b/tests/acceptance/10_files/unsafe/00_immutable.cf index a23acf5b73..d71fa2026a 100644 --- a/tests/acceptance/10_files/unsafe/00_immutable.cf +++ b/tests/acceptance/10_files/unsafe/00_immutable.cf @@ -3,19 +3,17 @@ # Test that agent can set the immutable bit on a file # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } bundle agent global { vars: - "testfile" - string => "/tmp/00_immutable.txt"; + "testfile" string => "/tmp/00_immutable.txt"; } body fsattrs set_immutable @@ -26,12 +24,10 @@ body fsattrs set_immutable bundle agent init { files: - "$(global.testfile)" - create => "true"; + "$(global.testfile)" create => "true"; commands: - "chattr -i $(global.testfile)" - contain => in_shell; + "chattr -i $(global.testfile)" contain => in_shell; } bundle agent test @@ -40,19 +36,22 @@ bundle agent test "description" -> { "CFE-1840", "ENT-10961" } string => "Test that agent can set the immutable bit on a file"; - "test_skip_unsupported" - string => "hpux|aix|solaris|windows"; + "test_skip_unsupported" string => "hpux|aix|solaris|windows"; files: - "$(global.testfile)" - fsattrs => set_immutable; + "$(global.testfile)" fsattrs => set_immutable; } bundle agent check { methods: "check" - usebundle => dcs_passif_output(".*Immutable.*", "", "lsattr -l $(global.testfile)", "$(this.promise_filename)"); + usebundle => dcs_passif_output( + ".*Immutable.*", + "", + "lsattr -l $(global.testfile)", + "$(this.promise_filename)" + ); } bundle agent destroy diff --git a/tests/acceptance/10_files/unsafe/01_immutable.cf b/tests/acceptance/10_files/unsafe/01_immutable.cf index c8f6ac590f..a4b6888f24 100644 --- a/tests/acceptance/10_files/unsafe/01_immutable.cf +++ b/tests/acceptance/10_files/unsafe/01_immutable.cf @@ -3,19 +3,17 @@ # Test that agent can clear the immutable bit on a file # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } bundle agent global { vars: - "testfile" - string => "/tmp/01_immutable.txt"; + "testfile" string => "/tmp/01_immutable.txt"; } body fsattrs clear_immutable @@ -26,12 +24,10 @@ body fsattrs clear_immutable bundle agent init { files: - "$(global.testfile)" - create => "true"; + "$(global.testfile)" create => "true"; commands: - "chattr +i $(global.testfile)" - contain => in_shell; + "chattr +i $(global.testfile)" contain => in_shell; } bundle agent test @@ -40,19 +36,22 @@ bundle agent test "description" -> { "CFE-1840", "ENT-10961" } string => "Test that agent can clear the immutable bit on a file"; - "test_skip_unsupported" - string => "hpux|aix|solaris|windows"; + "test_skip_unsupported" string => "hpux|aix|solaris|windows"; files: - "$(global.testfile)" - fsattrs => clear_immutable; + "$(global.testfile)" fsattrs => clear_immutable; } bundle agent check { methods: "check" - usebundle => dcs_passif_output(".*", ".*Immutable.*", "lsattr -l $(global.testfile)", "$(this.promise_filename)"); + usebundle => dcs_passif_output( + ".*", + ".*Immutable.*", + "lsattr -l $(global.testfile)", + "$(this.promise_filename)" + ); } bundle agent destroy diff --git a/tests/acceptance/10_files/unsafe/02_immutable.cf b/tests/acceptance/10_files/unsafe/02_immutable.cf index 2790575ee3..e078b05411 100644 --- a/tests/acceptance/10_files/unsafe/02_immutable.cf +++ b/tests/acceptance/10_files/unsafe/02_immutable.cf @@ -4,19 +4,17 @@ # content attribute # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } bundle agent global { vars: - "testfile" - string => "/tmp/02_immutable.txt"; + "testfile" string => "/tmp/02_immutable.txt"; } body fsattrs set_immutable @@ -27,12 +25,10 @@ body fsattrs set_immutable bundle agent init { files: - "$(global.testfile)" - content => "I'm immutable"; + "$(global.testfile)" content => "I'm immutable"; commands: - "chattr +i $(global.testfile)" - contain => in_shell; + "chattr +i $(global.testfile)" contain => in_shell; } bundle agent test @@ -41,8 +37,7 @@ bundle agent test "description" -> { "CFE-1840", "ENT-10961" } string => "Test that agent can override the immutable bit on a file while using the content attribute"; - "test_skip_unsupported" - string => "hpux|aix|solaris|windows"; + "test_skip_unsupported" string => "hpux|aix|solaris|windows"; files: "$(global.testfile)" @@ -53,20 +48,19 @@ bundle agent test bundle agent check { vars: - "expected" - string => "But agent can override"; - "actual" - string => readfile("$(global.testfile)"); + "expected" string => "But agent can override"; + "actual" string => readfile("$(global.testfile)"); classes: - "ok" - expression => strcmp("$(actual)", "$(expected)"); + "ok" expression => strcmp("$(actual)", "$(expected)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + any:: "Expected: '$(expected)', actual: '$(actual)'"; } diff --git a/tests/acceptance/10_files/unsafe/03_immutable.cf b/tests/acceptance/10_files/unsafe/03_immutable.cf index 420faa5d61..97c0f81d88 100644 --- a/tests/acceptance/10_files/unsafe/03_immutable.cf +++ b/tests/acceptance/10_files/unsafe/03_immutable.cf @@ -4,19 +4,17 @@ # attribute # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } bundle agent global { vars: - "testfile" - string => "/tmp/03_immutable.txt"; + "testfile" string => "/tmp/03_immutable.txt"; } body fsattrs set_immutable @@ -27,14 +25,11 @@ body fsattrs set_immutable bundle agent init { files: - "$(global.testfile)" - content => "I'm immutable"; - "/tmp/content.txt" - content => "But agent can override"; + "$(global.testfile)" content => "I'm immutable"; + "/tmp/content.txt" content => "But agent can override"; commands: - "chattr +i $(global.testfile)" - contain => in_shell; + "chattr +i $(global.testfile)" contain => in_shell; } bundle agent test @@ -43,8 +38,7 @@ bundle agent test "description" -> { "CFE-1840", "ENT-10961" } string => "Test that agent can override the immutable bit on a file while using the copy_from attribute"; - "test_skip_unsupported" - string => "hpux|aix|solaris|windows"; + "test_skip_unsupported" string => "hpux|aix|solaris|windows"; files: "$(global.testfile)" @@ -55,20 +49,19 @@ bundle agent test bundle agent check { vars: - "expected" - string => "But agent can override"; - "actual" - string => readfile("$(global.testfile)"); + "expected" string => "But agent can override"; + "actual" string => readfile("$(global.testfile)"); classes: - "ok" - expression => strcmp("$(actual)", "$(expected)"); + "ok" expression => strcmp("$(actual)", "$(expected)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + any:: "Expected: '$(expected)', actual: '$(actual)'"; } @@ -84,8 +77,7 @@ bundle agent destroy "$(global.testfile)" delete => tidy, depends_on => { "is mutable" }; - "$(global.testfile).cfsaved" - delete => tidy; - "/tmp/content.txt" - delete => tidy; + + "$(global.testfile).cfsaved" delete => tidy; + "/tmp/content.txt" delete => tidy; } diff --git a/tests/acceptance/10_files/unsafe/04_immutable.cf b/tests/acceptance/10_files/unsafe/04_immutable.cf index fcda4c0337..7c609eaeac 100644 --- a/tests/acceptance/10_files/unsafe/04_immutable.cf +++ b/tests/acceptance/10_files/unsafe/04_immutable.cf @@ -4,19 +4,17 @@ # attribute # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } bundle agent global { vars: - "testfile" - string => "/tmp/04_immutable.txt"; + "testfile" string => "/tmp/04_immutable.txt"; } body fsattrs set_immutable @@ -27,12 +25,10 @@ body fsattrs set_immutable bundle agent init { files: - "$(global.testfile)" - content => "I'm immutable"; + "$(global.testfile)" content => "I'm immutable"; commands: - "chattr +i $(global.testfile)" - contain => in_shell; + "chattr +i $(global.testfile)" contain => in_shell; } bundle agent test @@ -41,8 +37,7 @@ bundle agent test "description" -> { "CFE-1840", "ENT-10961" } string => "Test that agent can override the immutable bit on a file while using the delete attribute"; - "test_skip_unsupported" - string => "hpux|aix|solaris|windows"; + "test_skip_unsupported" string => "hpux|aix|solaris|windows"; files: "$(global.testfile)" @@ -53,12 +48,12 @@ bundle agent test bundle agent check { classes: - "ok" - expression => not(fileexists("$(global.testfile)")); + "ok" expression => not(fileexists("$(global.testfile)")); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/unsafe/05_immutable.cf b/tests/acceptance/10_files/unsafe/05_immutable.cf index 0d1aff2774..e96b3b9dba 100644 --- a/tests/acceptance/10_files/unsafe/05_immutable.cf +++ b/tests/acceptance/10_files/unsafe/05_immutable.cf @@ -4,19 +4,17 @@ # attribute # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } bundle agent global { vars: - "testfile" - string => "/tmp/05_immutable.txt"; + "testfile" string => "/tmp/05_immutable.txt"; } body fsattrs set_immutable @@ -27,12 +25,10 @@ body fsattrs set_immutable bundle agent init { files: - "$(global.testfile)" - content => "I'm immutable"; + "$(global.testfile)" content => "I'm immutable"; commands: - "chattr +i $(global.testfile)" - contain => in_shell; + "chattr +i $(global.testfile)" contain => in_shell; } bundle edit_line insert_line @@ -47,8 +43,7 @@ bundle agent test "description" -> { "CFE-1840", "ENT-10961" } string => "Test that agent can override the immutable bit on a file while using the edit_line attribute"; - "test_skip_unsupported" - string => "hpux|aix|solaris|windows"; + "test_skip_unsupported" string => "hpux|aix|solaris|windows"; files: "$(global.testfile)" @@ -61,18 +56,19 @@ bundle agent check vars: "expected" string => "I'm immutable$(const.n)But agent can override$(const.n)"; - "actual" - string => readfile("$(global.testfile)"); + + "actual" string => readfile("$(global.testfile)"); classes: - "ok" - expression => strcmp("$(actual)", "$(expected)"); + "ok" expression => strcmp("$(actual)", "$(expected)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + any:: "Expected:$(const.n)'$(expected)',$(const.n)actual:$(const.n)'$(actual)'"; } @@ -88,6 +84,6 @@ bundle agent destroy "$(global.testfile)" delete => tidy, depends_on => { "is mutable" }; - "$(global.testfile).cf-before-edit" - delete => tidy; + + "$(global.testfile).cf-before-edit" delete => tidy; } diff --git a/tests/acceptance/10_files/unsafe/06_immutable.cf b/tests/acceptance/10_files/unsafe/06_immutable.cf index fd29aa9aad..f105c62fcb 100644 --- a/tests/acceptance/10_files/unsafe/06_immutable.cf +++ b/tests/acceptance/10_files/unsafe/06_immutable.cf @@ -3,19 +3,17 @@ # Test that agent can override the immutable bit when using edit_xml attribute # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } bundle agent global { vars: - "testfile" - string => "/tmp/06_immutable.txt"; + "testfile" string => "/tmp/06_immutable.txt"; } body fsattrs set_immutable @@ -26,19 +24,16 @@ body fsattrs set_immutable bundle agent init { files: - "$(global.testfile)" - content => 'I\'m immutable'; + "$(global.testfile)" content => 'I\'m immutable'; commands: - "chattr +i $(global.testfile)" - contain => in_shell; + "chattr +i $(global.testfile)" contain => in_shell; } bundle edit_xml edit_foo { set_text: - "But agent can override" - select_xpath => "/foo"; + "But agent can override" select_xpath => "/foo"; } bundle agent test @@ -47,8 +42,7 @@ bundle agent test "description" -> { "CFE-1840", "ENT-10961" } string => "Test that agent can override the immutable bit on a file while using the edit_xml attribute"; - "test_skip_unsupported" - string => "hpux|aix|solaris|windows"; + "test_skip_unsupported" string => "hpux|aix|solaris|windows"; files: "$(global.testfile)" @@ -61,18 +55,19 @@ bundle agent check vars: "expected" string => '$(const.n)But agent can override$(const.n)'; - "actual" - string => readfile("$(global.testfile)"); + + "actual" string => readfile("$(global.testfile)"); classes: - "ok" - expression => strcmp("$(actual)", "$(expected)"); + "ok" expression => strcmp("$(actual)", "$(expected)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + any:: "Expected: '$(expected)', actual: '$(actual)'"; } @@ -88,6 +83,6 @@ bundle agent destroy "$(global.testfile)" delete => tidy, depends_on => { "is mutable" }; - "$(global.testfile).cf-before-edit" - delete => tidy; + + "$(global.testfile).cf-before-edit" delete => tidy; } diff --git a/tests/acceptance/10_files/unsafe/07_immutable.cf b/tests/acceptance/10_files/unsafe/07_immutable.cf index dbde4818e6..61d3a16d94 100644 --- a/tests/acceptance/10_files/unsafe/07_immutable.cf +++ b/tests/acceptance/10_files/unsafe/07_immutable.cf @@ -3,19 +3,17 @@ # Test that agent can override the immutable bit when using perms attribute # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } bundle agent global { vars: - "testfile" - string => "/tmp/07_immutable.txt"; + "testfile" string => "/tmp/07_immutable.txt"; } body fsattrs set_immutable @@ -31,8 +29,7 @@ bundle agent init perms => m("600"); commands: - "chattr +i $(global.testfile)" - contain => in_shell; + "chattr +i $(global.testfile)" contain => in_shell; } bundle agent test @@ -41,8 +38,7 @@ bundle agent test "description" -> { "CFE-1840", "ENT-10961" } string => "Test that agent can override the immutable bit on a file while using the perms attribute"; - "test_skip_unsupported" - string => "hpux|aix|solaris|windows"; + "test_skip_unsupported" string => "hpux|aix|solaris|windows"; files: "$(global.testfile)" @@ -53,20 +49,21 @@ bundle agent test bundle agent check { vars: - "expected" - string => "644"; + "expected" string => "644"; + "actual" string => string_tail(filestat("$(global.testfile)", "modeoct"), "3"); classes: - "ok" - expression => strcmp("$(actual)", "$(expected)"); + "ok" expression => strcmp("$(actual)", "$(expected)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + any:: "Expected: '$(expected)', actual: '$(actual)'"; } diff --git a/tests/acceptance/10_files/unsafe/08_immutable.cf b/tests/acceptance/10_files/unsafe/08_immutable.cf index 6163ccb596..c91121f5c8 100644 --- a/tests/acceptance/10_files/unsafe/08_immutable.cf +++ b/tests/acceptance/10_files/unsafe/08_immutable.cf @@ -3,19 +3,17 @@ # Test that agent can override the immutable bit when using touch attribute # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } bundle agent global { vars: - "testfile" - string => "/tmp/08_immutable.txt"; + "testfile" string => "/tmp/08_immutable.txt"; } body fsattrs set_immutable @@ -26,10 +24,8 @@ body fsattrs set_immutable bundle agent init { commands: - "touch -d @0 $(global.testfile)" - contain => in_shell; - "chattr +i $(global.testfile)" - contain => in_shell; + "touch -d @0 $(global.testfile)" contain => in_shell; + "chattr +i $(global.testfile)" contain => in_shell; } bundle agent test @@ -38,8 +34,7 @@ bundle agent test "description" -> { "CFE-1840", "ENT-10961" } string => "Test that agent can override the immutable bit on a file while using the touch attribute"; - "test_skip_unsupported" - string => "hpux|aix|solaris|windows"; + "test_skip_unsupported" string => "hpux|aix|solaris|windows"; files: "$(global.testfile)" @@ -50,20 +45,19 @@ bundle agent test bundle agent check { vars: - "not_expected" - string => "0"; - "actual" - string => filestat("$(global.testfile)", "mtime"); + "not_expected" string => "0"; + "actual" string => filestat("$(global.testfile)", "mtime"); classes: - "ok" - expression => not(strcmp("$(actual)", "$(not_expected)")); + "ok" expression => not(strcmp("$(actual)", "$(not_expected)")); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + any:: "Not expecting $(not_expected), got $(actual)"; } diff --git a/tests/acceptance/10_files/unsafe/09_immutable.cf b/tests/acceptance/10_files/unsafe/09_immutable.cf index 58587465b9..4b96b6acbe 100644 --- a/tests/acceptance/10_files/unsafe/09_immutable.cf +++ b/tests/acceptance/10_files/unsafe/09_immutable.cf @@ -4,19 +4,17 @@ # attribute with mustache # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } bundle agent global { vars: - "testfile" - string => "/tmp/09_immutable.txt"; + "testfile" string => "/tmp/09_immutable.txt"; } body fsattrs set_immutable @@ -32,8 +30,7 @@ bundle agent init content => "Hello olehermanse!"; commands: - "chattr +i $(global.testfile)" - contain => in_shell; + "chattr +i $(global.testfile)" contain => in_shell; } bundle agent test @@ -42,12 +39,10 @@ bundle agent test "description" -> { "CFE-1840", "ENT-10961" } string => "Test that agent can override the immutable bit on a file while using the edit_template attribute with mustache"; - "test_skip_unsupported" - string => "hpux|aix|solaris|windows"; + "test_skip_unsupported" string => "hpux|aix|solaris|windows"; vars: - "object" - data => '{ "user": "larsewi" }'; + "object" data => '{ "user": "larsewi" }'; files: "$(global.testfile)" @@ -60,20 +55,19 @@ bundle agent test bundle agent check { vars: - "expected" - string => "Hello larsewi!"; - "actual" - string => readfile("$(global.testfile)"); + "expected" string => "Hello larsewi!"; + "actual" string => readfile("$(global.testfile)"); classes: - "ok" - expression => strcmp("$(actual)", "$(expected)"); + "ok" expression => strcmp("$(actual)", "$(expected)"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + any:: "Expecting '$(expected)', got '$(actual)'"; } @@ -89,6 +83,6 @@ bundle agent destroy "$(global.testfile)" delete => tidy, depends_on => { "is mutable" }; - "$(global.testfile).cf-before-edit" - delete => tidy; + + "$(global.testfile).cf-before-edit" delete => tidy; } diff --git a/tests/acceptance/10_files/unsafe/10_immutable.cf b/tests/acceptance/10_files/unsafe/10_immutable.cf index b204b77bed..855e245f77 100644 --- a/tests/acceptance/10_files/unsafe/10_immutable.cf +++ b/tests/acceptance/10_files/unsafe/10_immutable.cf @@ -3,19 +3,17 @@ # Test that agent can override the immutable bit when using acl attribute # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } bundle agent global { vars: - "testfile" - string => "/tmp/10_immutable.txt"; + "testfile" string => "/tmp/10_immutable.txt"; } body fsattrs set_immutable @@ -43,8 +41,7 @@ bundle agent init acl => acl_user_root_rw; commands: - "chattr +i $(global.testfile)" - contain => in_shell; + "chattr +i $(global.testfile)" contain => in_shell; } bundle agent test @@ -53,33 +50,30 @@ bundle agent test "description" -> { "CFE-1840", "ENT-10961" } string => "Test that agent can override the immutable bit on a file while using the acl attribute"; - "test_skip_unsupported" - string => "hpux|aix|solaris|windows"; + "test_skip_unsupported" string => "hpux|aix|solaris|windows"; files: "$(global.testfile)" fsattrs => set_immutable, acl => acl_user_root_rwx; - } bundle agent check { vars: - "expected" - string => ".*user:root:rwx.*"; - "acls" - slist => getacls("$(global.testfile)", "access"); + "expected" string => ".*user:root:rwx.*"; + "acls" slist => getacls("$(global.testfile)", "access"); classes: - "ok" - expression => some("$(expected)", "acls"); + "ok" expression => some("$(expected)", "acls"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + any:: "Expecting output matching '$(expected)', got '$(acls)'"; } diff --git a/tests/acceptance/10_files/unsafe/11_immutable.cf b/tests/acceptance/10_files/unsafe/11_immutable.cf index 3b1282a3b1..44c59842e1 100644 --- a/tests/acceptance/10_files/unsafe/11_immutable.cf +++ b/tests/acceptance/10_files/unsafe/11_immutable.cf @@ -4,19 +4,17 @@ # attribute # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } bundle agent global { vars: - "testfile" - string => "/tmp/11_immutable.txt"; + "testfile" string => "/tmp/11_immutable.txt"; } body fsattrs set_immutable @@ -27,12 +25,10 @@ body fsattrs set_immutable bundle agent init { files: - "$(global.testfile)" - create => "true"; + "$(global.testfile)" create => "true"; commands: - "chattr +i $(global.testfile)" - contain => in_shell; + "chattr +i $(global.testfile)" contain => in_shell; } bundle agent test @@ -41,42 +37,36 @@ bundle agent test "description" -> { "CFE-1840", "ENT-10961" } string => "Test that agent can override the immutable bit on a file while using the transformer attribute"; - "test_skip_unsupported" - string => "hpux|aix|solaris|windows"; + "test_skip_unsupported" string => "hpux|aix|solaris|windows"; vars: "gzip_path" - string => ifelse( - isexecutable("/bin/gzip"), - "/bin/gzip", - "/usr/bin/gzip" - ); + string => ifelse(isexecutable("/bin/gzip"), "/bin/gzip", "/usr/bin/gzip"); files: "$(global.testfile)" fsattrs => set_immutable, transformer => "$(gzip_path) $(this.promiser)"; - } bundle agent check { classes: - "original_exists" - expression => fileexists("$(global.testfile)"); - "transformed_exists" - expression => fileexists("$(global.testfile).gz"); - "ok" - expression => "!original_exists&transformed_exists"; + "original_exists" expression => fileexists("$(global.testfile)"); + "transformed_exists" expression => fileexists("$(global.testfile).gz"); + "ok" expression => "!original_exists&transformed_exists"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + any:: "Expected file '$(global.testfile)' to not exists $(with)" with => ifelse("!original_exists", "and it does not", "but it does"); + "Expected file '$(global.testfile).gz' to exists $(with)" with => ifelse("transformed_exists", "and it does", "but it does not"); } @@ -88,6 +78,7 @@ bundle agent destroy contain => in_shell, handle => "is mutable 1", if => fileexists("$(global.testfile)"); + "chattr -i $(global.testfile).gz" contain => in_shell, handle => "is mutable 2", @@ -97,6 +88,7 @@ bundle agent destroy "$(global.testfile)" delete => tidy, depends_on => { "is mutable 1" }; + files: "$(global.testfile).gz" delete => tidy, diff --git a/tests/acceptance/10_files/unsafe/12_immutable.cf b/tests/acceptance/10_files/unsafe/12_immutable.cf index d0b5c99b68..c2e84eb2a3 100644 --- a/tests/acceptance/10_files/unsafe/12_immutable.cf +++ b/tests/acceptance/10_files/unsafe/12_immutable.cf @@ -3,19 +3,17 @@ # Test that agent can override the immutable bit when using rename attribute # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } bundle agent global { vars: - "testfile" - string => "/tmp/12_immutable.txt"; + "testfile" string => "/tmp/12_immutable.txt"; } body fsattrs set_immutable @@ -26,12 +24,10 @@ body fsattrs set_immutable bundle agent init { files: - "$(global.testfile)" - create => "true"; + "$(global.testfile)" create => "true"; commands: - "chattr +i $(global.testfile)" - contain => in_shell; + "chattr +i $(global.testfile)" contain => in_shell; } body rename nuke @@ -46,8 +42,7 @@ bundle agent test "description" -> { "CFE-1840", "ENT-10961" } string => "Test that agent can override the immutable bit on a file while using the rename attribute"; - "test_skip_unsupported" - string => "hpux|aix|solaris|windows"; + "test_skip_unsupported" string => "hpux|aix|solaris|windows"; files: "$(global.testfile)" @@ -58,21 +53,21 @@ bundle agent test bundle agent check { classes: - "original_exists" - expression => fileexists("$(global.testfile)"); - "nuked_exists" - expression => fileexists("$(global.testfile).nuked"); - "ok" - expression => "!original_exists&nuked_exists"; + "original_exists" expression => fileexists("$(global.testfile)"); + "nuked_exists" expression => fileexists("$(global.testfile).nuked"); + "ok" expression => "!original_exists&nuked_exists"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; + any:: "Expected file '$(global.testfile)' to not exists $(with)" with => ifelse("!original_exists", "and it does not", "but it does"); + "Expected file '$(global.testfile).nuked' to exists $(with)" with => ifelse("nuked_exists", "and it does", "but it does not"); } @@ -84,6 +79,7 @@ bundle agent destroy contain => in_shell, handle => "orig is mutable", if => fileexists("$(global.testfile)"); + "chattr -i $(global.testfile).nuked" contain => in_shell, handle => "nuked is mutable", @@ -93,6 +89,7 @@ bundle agent destroy "$(global.testfile)" delete => tidy, depends_on => { "orig is mutable" }; + "$(global.testfile).nuked" delete => tidy, depends_on => { "nuked is mutable" }; diff --git a/tests/acceptance/10_files/unsafe/13_immutable.cf b/tests/acceptance/10_files/unsafe/13_immutable.cf index d35ecdf7cd..9778dc4933 100644 --- a/tests/acceptance/10_files/unsafe/13_immutable.cf +++ b/tests/acceptance/10_files/unsafe/13_immutable.cf @@ -4,19 +4,17 @@ # content attribute (see CFE-4569). # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } bundle agent global { vars: - "testfile" - string => "/tmp/13_immutable.txt"; + "testfile" string => "/tmp/13_immutable.txt"; } body fsattrs immutable(value) @@ -44,8 +42,7 @@ bundle agent test "description" -> { "CFE-4569" } string => "Test that fsattrs validation is not skipped when combining it with the content attribute"; - "test_skip_unsupported" - string => "hpux|aix|solaris|windows"; + "test_skip_unsupported" string => "hpux|aix|solaris|windows"; files: "$(global.testfile)" @@ -57,7 +54,12 @@ bundle agent check { methods: "check" - usebundle => dcs_passif_output(".*Immutable.*", "", "lsattr -l $(global.testfile)", "$(this.promise_filename)"); + usebundle => dcs_passif_output( + ".*Immutable.*", + "", + "lsattr -l $(global.testfile)", + "$(this.promise_filename)" + ); } bundle agent destroy diff --git a/tests/acceptance/10_files/unsafe/can_set_sticky_bits_with_nonroot_owner_and_group.cf b/tests/acceptance/10_files/unsafe/can_set_sticky_bits_with_nonroot_owner_and_group.cf index 691b928062..de582b4556 100644 --- a/tests/acceptance/10_files/unsafe/can_set_sticky_bits_with_nonroot_owner_and_group.cf +++ b/tests/acceptance/10_files/unsafe/can_set_sticky_bits_with_nonroot_owner_and_group.cf @@ -1,31 +1,19 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - ####################################################### - bundle agent init { vars: "users" slist => { "user01", "user02" }; - "modes" slist => { - "2700", - "2750", - "2755", - "2770", - "2771", - "2775", - "2751", - }; + "modes" slist => { "2700", "2750", "2755", "2770", "2771", "2775", "2751" }; users: - "$(users)" - policy => "present"; - + "$(users)" policy => "present"; } bundle agent cleanup @@ -37,47 +25,47 @@ bundle agent cleanup } ####################################################### - bundle agent test -{ +{ meta: - "description" string => "Test that sgid can be set when ownership is non root"; + "description" + string => "Test that sgid can be set when ownership is non root"; + + "test_skip_unsupported" string => "windows"; - "test_skip_unsupported" - string => "windows"; "test_skip_needs_work" string => "!has_stat", meta => { "redmine7989", "zendesk2797" }; files: "$(G.testdir)/test_sgid/$(init.modes)/." - create => "true", - perms => test_perms( $(init.modes), "user01", "user02"), - classes => scoped_classes_generic("namespace", "file_$(init.modes)"), - comment => "Make sure a directory named for each desired mode we want to test exists."; + create => "true", + perms => test_perms($(init.modes), "user01", "user02"), + classes => scoped_classes_generic("namespace", "file_$(init.modes)"), + comment => "Make sure a directory named for each desired mode we want to test exists."; } body perms test_perms(m, o, g) { - mode => "$(m)"; - owners => { "$(o)" }; - groups => { "$(g)" }; + mode => "$(m)"; + owners => { "$(o)" }; + groups => { "$(g)" }; } ####################################################### - bundle agent check { - vars: - # We expect to find an ok_ prefixed class for each of the modes defined in - # init. - "expected_classes" slist => maplist("ok_$(this)", @(init.modes)); + # We expect to find an ok_ prefixed class for each of the modes defined in + # init. + "expected_classes" slist => maplist("ok_$(this)", @(init.modes)); - # Get the octal mode for each of the files - "result_permoct_$(init.modes)" - string => execresult('$(G.stat) -c %a $(G.testdir)/test_sgid/$(init.modes)', "useshell"), - if => "file_$(init.modes)_reached"; + # Get the octal mode for each of the files + "result_permoct_$(init.modes)" + string => execresult( + '$(G.stat) -c %a $(G.testdir)/test_sgid/$(init.modes)', "useshell" + ), + if => "file_$(init.modes)_reached"; DEBUG|DEBUG_check:: # We collect up the classes that match our expected pattern for debug @@ -85,14 +73,14 @@ bundle agent check "classes" slist => classesmatching("ok_.*"); classes: - # Define an ok_ prefixed class for each of the modes defined in init if it - # matches what we observed with stat. - "ok_$(init.modes)" expression => strcmp("$(init.modes)", "$(result_permoct_$(init.modes))"); + # Define an ok_ prefixed class for each of the modes defined in init if it + # matches what we observed with stat. + "ok_$(init.modes)" + expression => strcmp("$(init.modes)", "$(result_permoct_$(init.modes))"); - - # And here we define the class to pass or fail the test. - "ok" and => { @(expected_classes) }; - "not_ok" not => "ok"; + # And here we define the class to pass or fail the test. + "ok" and => { @(expected_classes) }; + "not_ok" not => "ok"; reports: DEBUG|DEBUG_check:: @@ -101,6 +89,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + not_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/10_files/unsafe/multiple-group-candidates-first-found-group-perms-if-no-listed-candidate-matches.cf b/tests/acceptance/10_files/unsafe/multiple-group-candidates-first-found-group-perms-if-no-listed-candidate-matches.cf index 07a4ab3bf7..00a8a5afc0 100644 --- a/tests/acceptance/10_files/unsafe/multiple-group-candidates-first-found-group-perms-if-no-listed-candidate-matches.cf +++ b/tests/acceptance/10_files/unsafe/multiple-group-candidates-first-found-group-perms-if-no-listed-candidate-matches.cf @@ -1,8 +1,8 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent _group_state(group, state) @@ -12,44 +12,40 @@ bundle agent _group_state(group, state) "test_skip_unsupported" string => "windows"; vars: - !aix:: - "groupadd" string => "/usr/sbin/groupadd"; - "groupdel" string => "/usr/sbin/groupdel"; - aix:: - "groupadd" string => "/usr/bin/mkgroup"; - "groupdel" string => "/usr/sbin/rmgroup"; + !aix:: + "groupadd" string => "/usr/sbin/groupadd"; + "groupdel" string => "/usr/sbin/groupdel"; + + aix:: + "groupadd" string => "/usr/bin/mkgroup"; + "groupdel" string => "/usr/sbin/rmgroup"; classes: - "_have_group" expression => groupexists( $(group) ); - "_want_$(state)" expression => "any"; + "_have_group" expression => groupexists($(group)); + "_want_$(state)" expression => "any"; commands: !_have_group._want_present:: - "$(groupadd)" - args => "$(group)"; + "$(groupadd)" args => "$(group)"; _have_group._want_absent:: - "$(groupdel)" - args => "$(group)"; + "$(groupdel)" args => "$(group)"; } + bundle agent init { vars: # Group lengths up to 8 chars because of AIX and HP-UX limitations "absent_groups" slist => { "abs_gr_1", "abs_gr_2" }; "present_groups" slist => { "pr_gr_1", "pr_gr_2" }; - - "groups" slist => { - @(absent_groups), - @(present_groups), - }; + "groups" slist => { @(absent_groups), @(present_groups) }; methods: "Ensure Groups Absent" - usebundle => _group_state( $(absent_groups), "absent" ); + usebundle => _group_state($(absent_groups), "absent"); "Ensure Groups Present" - usebundle => _group_state( $(present_groups), "present" ); + usebundle => _group_state($(present_groups), "present"); files: "$(G.testfile)" @@ -66,8 +62,7 @@ bundle agent test present owner."; files: - "$(G.testfile)" - perms => g( @(init.groups) ); + "$(G.testfile)" perms => g(@(init.groups)); } bundle agent check @@ -78,22 +73,21 @@ bundle agent check reports: "$(this.promise_filename) Pass" - if => strcmp( $(observed_gid), $(desired_gid) ); + if => strcmp($(observed_gid), $(desired_gid)); "$(this.promise_filename) FAIL" - if => not( strcmp( $(observed_gid), $(desired_gid) ) ); - + if => not(strcmp($(observed_gid), $(desired_gid))); } + bundle agent cleanup { methods: - - "Ensure Groups Absent" - usebundle => _group_state( $(init.groups), "absent" ); + "Ensure Groups Absent" usebundle => _group_state($(init.groups), "absent"); } + body perms g(g) # @brief Set the file's group to the first presnet group # @param g A list of candidate groups for the file { - groups => { "$(g)" }; + groups => { "$(g)" }; } diff --git a/tests/acceptance/10_files/unsafe/multiple-owner-candidates-first-found-user-perms-if-no-listed-candidate-matches.cf b/tests/acceptance/10_files/unsafe/multiple-owner-candidates-first-found-user-perms-if-no-listed-candidate-matches.cf index f942a6aa88..2d7325fc70 100644 --- a/tests/acceptance/10_files/unsafe/multiple-owner-candidates-first-found-user-perms-if-no-listed-candidate-matches.cf +++ b/tests/acceptance/10_files/unsafe/multiple-owner-candidates-first-found-user-perms-if-no-listed-candidate-matches.cf @@ -1,8 +1,8 @@ body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init @@ -11,18 +11,11 @@ bundle agent init # Username lengths up to 8 chars because of AIX and HP-UX limitations "absent_users" slist => { "abs_us_1", "abs_us_2" }; "present_users" slist => { "pr_us_1", "pr_us_2" }; - - "users" slist => { - @(absent_users), - @(present_users), - }; + "users" slist => { @(absent_users), @(present_users) }; users: - "$(absent_users)" - policy => "absent"; - - "$(present_users)" - policy => "present"; + "$(absent_users)" policy => "absent"; + "$(present_users)" policy => "present"; files: "$(G.testfile)" @@ -39,8 +32,7 @@ bundle agent test present owner."; files: - "$(G.testfile)" - perms => o( @(init.users) ); + "$(G.testfile)" perms => o(@(init.users)); } bundle agent check @@ -51,21 +43,21 @@ bundle agent check reports: "$(this.promise_filename) Pass" - if => strcmp( $(observed_uid), $(desired_uid) ); + if => strcmp($(observed_uid), $(desired_uid)); "$(this.promise_filename) FAIL" - if => not( strcmp( $(observed_uid), $(desired_uid) ) ); - + if => not(strcmp($(observed_uid), $(desired_uid))); } + bundle agent cleanup { users: - "$(init.users)" - policy => "absent"; + "$(init.users)" policy => "absent"; } + body perms o(u) # @brief Set the file's owner # @param u The username of the new owner { - owners => { "$(u)" }; + owners => { "$(u)" }; } diff --git a/tests/acceptance/10_files/zendesk_1776/zendesk_1776.cf b/tests/acceptance/10_files/zendesk_1776/zendesk_1776.cf index 347a8a2d34..10cfd7cbc9 100644 --- a/tests/acceptance/10_files/zendesk_1776/zendesk_1776.cf +++ b/tests/acceptance/10_files/zendesk_1776/zendesk_1776.cf @@ -1,24 +1,23 @@ bundle common test_meta { vars: - "description" string => "Test that seleting files based on symlink do not generate undesired errors"; - "story_id" string => ""; - "covers" string => ""; + "description" + string => "Test that seleting files based on symlink do not generate undesired errors"; + + "story_id" string => ""; + "covers" string => ""; } # Ref: https://dev.cfengine.com/issues/6996 - ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent check { meta: @@ -28,9 +27,15 @@ bundle agent check windows"; vars: - "command" string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -DAUTO"; + "command" + string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -DAUTO"; methods: "check" - usebundle => dcs_passif_output(".*Pass.*", ".*readlink: Invalid argument.*", $(command), $(this.promise_filename)); + usebundle => dcs_passif_output( + ".*Pass.*", + ".*readlink: Invalid argument.*", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/10_files/zendesk_1779/zendesk_1779.cf b/tests/acceptance/10_files/zendesk_1779/zendesk_1779.cf index b99177da62..6be7bd363f 100644 --- a/tests/acceptance/10_files/zendesk_1779/zendesk_1779.cf +++ b/tests/acceptance/10_files/zendesk_1779/zendesk_1779.cf @@ -1,24 +1,23 @@ bundle common test_meta { vars: - "description" string => "Test file_selection attributes are only checked as necessary"; - "story_id" string => ""; - "covers" string => ""; + "description" + string => "Test file_selection attributes are only checked as necessary"; + + "story_id" string => ""; + "covers" string => ""; } # Ref: https://dev.cfengine.com/issues/6997 - ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent check { meta: @@ -32,9 +31,15 @@ bundle agent check windows"; vars: - "command" string => "$(sys.cf_agent) -KIf $(this.promise_filename).sub -DAUTO"; + "command" + string => "$(sys.cf_agent) -KIf $(this.promise_filename).sub -DAUTO"; methods: "check" - usebundle => dcs_passif_output(".*Pass.*", ".*executed command for.*", $(command), $(this.promise_filename)); + usebundle => dcs_passif_output( + ".*Pass.*", + ".*executed command for.*", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/11_databases/00_syntax/missing_database_operation.cf b/tests/acceptance/11_databases/00_syntax/missing_database_operation.cf index c93325cbbe..e165e8fd8d 100644 --- a/tests/acceptance/11_databases/00_syntax/missing_database_operation.cf +++ b/tests/acceptance/11_databases/00_syntax/missing_database_operation.cf @@ -1,33 +1,32 @@ # Test that missing database_operation does not segfault (Mantis #1046) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } bundle agent test { databases: - "foobar" + "foobar" database_type => "sql", database_server => myserver; } body database_server myserver { - db_server_owner => "owner"; - db_server_password => "password"; - db_server_host => "localhost"; - db_server_type => "postgres"; - db_server_connection_db => "postgres"; + db_server_owner => "owner"; + db_server_password => "password"; + db_server_host => "localhost"; + db_server_type => "postgres"; + db_server_connection_db => "postgres"; } bundle agent check @@ -36,5 +35,6 @@ bundle agent check cfengine_3:: "$(this.promise_filename) Pass"; } + ### PROJECT_ID: core ### CATEGORY_ID: 33 diff --git a/tests/acceptance/14_reports/00_output/001.cf b/tests/acceptance/14_reports/00_output/001.cf index dd535df5e0..e1e1ea1ee0 100644 --- a/tests/acceptance/14_reports/00_output/001.cf +++ b/tests/acceptance/14_reports/00_output/001.cf @@ -3,37 +3,36 @@ # Test that printfile honors number_of_lines constraint (Issue 686) # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "subout" string => execresult("$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell" + ); } ####################################################### - bundle agent check { classes: - "firstline" expression => regcmp(".*firstline.*", "$(test.subout)"); - "nosecondline" not => regcmp(".*secondline.*", "$(test.subout)"); - "ok" and => { "firstline", "nosecondline" }; + "firstline" expression => regcmp(".*firstline.*", "$(test.subout)"); + "nosecondline" not => regcmp(".*secondline.*", "$(test.subout)"); + "ok" and => { "firstline", "nosecondline" }; reports: DEBUG:: @@ -41,6 +40,7 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/14_reports/00_output/002.cf b/tests/acceptance/14_reports/00_output/002.cf index 424825d2e0..c3c64a9f02 100644 --- a/tests/acceptance/14_reports/00_output/002.cf +++ b/tests/acceptance/14_reports/00_output/002.cf @@ -4,7 +4,6 @@ # as they should in reports promises. # ############################################################################## - body common control { inputs => { "../../default.sub.cf" }; @@ -14,13 +13,15 @@ body common control bundle agent init { - } bundle agent test { vars: - "subout" string => execresult("$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell" + ); } bundle agent check @@ -30,14 +31,16 @@ bundle agent check classes: "ok" not => regcmp(".*hardware_addresses.*", "$(test.subout)"); -reports: - DEBUG:: - "$(test.subout)"; + reports: + DEBUG:: + "$(test.subout)"; - ok:: - "$(this.promise_filename) Pass"; - !ok:: - "$(this.promise_filename) FAIL"; + ok:: + "$(this.promise_filename) Pass"; + + !ok:: + "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 2 diff --git a/tests/acceptance/14_reports/00_output/report_array.cf b/tests/acceptance/14_reports/00_output/report_array.cf index b7f930a2cd..ff4c942a37 100644 --- a/tests/acceptance/14_reports/00_output/report_array.cf +++ b/tests/acceptance/14_reports/00_output/report_array.cf @@ -1,5 +1,4 @@ # Check that reports are printed just once (Redmine#3446 https://cfengine.com/dev/issues/3446) - body common control { inputs => { "../../default.sub.cf" }; @@ -9,34 +8,47 @@ body common control bundle agent init { - } - bundle agent test { -vars: - "subout" string => execresult("$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell"); + vars: + "subout" + string => execresult( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell" + ); } - bundle agent check { -classes: - "ok1" expression => regcmp(".*9b70d955f7e126bc082e4a99eb2b3d08e4ebc29a.*", "$(test.subout)"); - "ok2" expression => regcmp(".*18a307169ff8a691607846c8a19c361a37695773.*", "$(test.subout)"); - "ok3" expression => regcmp(".*79815eefd0b619c6b875edf68adc7ef0e00c1ad3.*", "$(test.subout)"); + classes: + "ok1" + expression => regcmp( + ".*9b70d955f7e126bc082e4a99eb2b3d08e4ebc29a.*", "$(test.subout)" + ); - "ok" and => { "ok1", "ok2", "ok3" }; + "ok2" + expression => regcmp( + ".*18a307169ff8a691607846c8a19c361a37695773.*", "$(test.subout)" + ); -reports: - DEBUG:: - "Output from subtest: $(test.subout)"; + "ok3" + expression => regcmp( + ".*79815eefd0b619c6b875edf68adc7ef0e00c1ad3.*", "$(test.subout)" + ); - ok:: - "$(this.promise_filename) Pass"; - !ok:: - "$(this.promise_filename) FAIL"; + "ok" and => { "ok1", "ok2", "ok3" }; + + reports: + DEBUG:: + "Output from subtest: $(test.subout)"; + + ok:: + "$(this.promise_filename) Pass"; + + !ok:: + "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 2 diff --git a/tests/acceptance/14_reports/00_output/report_nested_variable.cf b/tests/acceptance/14_reports/00_output/report_nested_variable.cf index 6820c9255a..802f6dec9d 100644 --- a/tests/acceptance/14_reports/00_output/report_nested_variable.cf +++ b/tests/acceptance/14_reports/00_output/report_nested_variable.cf @@ -1,30 +1,39 @@ # Check that nested variables are reported (Redmine: https://cfengine.com/dev/issues/4247) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_soft_fail" string => "any", - meta => { "redmine4247" }; + "test_soft_fail" + string => "any", + meta => { "redmine4247" }; vars: !FAKE_PASS:: - "subout" string => execresult("$(sys.cf_agent) -b runme -Kf $(this.promise_filename).sub", "noshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -b runme -Kf $(this.promise_filename).sub", + "noshell" + ); + FAKE_PASS:: - "subout" string => execresult("$(sys.cf_agent) -b runme -Kf $(this.promise_filename).sub -DFAKE_PASS", "noshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -b runme -Kf $(this.promise_filename).sub -DFAKE_PASS", + "noshell" + ); } - bundle agent check { classes: - "ok" expression => regcmp(".*replaced-by=something_else.*", "$(test.subout)"); + "ok" + expression => regcmp(".*replaced-by=something_else.*", "$(test.subout)"); reports: DEBUG:: @@ -32,8 +41,10 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 2 diff --git a/tests/acceptance/14_reports/00_output/report_once.cf b/tests/acceptance/14_reports/00_output/report_once.cf index c2b4e1e78e..99aa68f52c 100644 --- a/tests/acceptance/14_reports/00_output/report_once.cf +++ b/tests/acceptance/14_reports/00_output/report_once.cf @@ -1,5 +1,4 @@ # Check that reports are printed just once (Redmine#3446 https://cfengine.com/dev/issues/3446) - body common control { inputs => { "../../default.sub.cf" }; @@ -9,31 +8,33 @@ body common control bundle agent init { - } - bundle agent test { -vars: - "subout" string => execresult("$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell"); + vars: + "subout" + string => execresult( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell" + ); } - bundle agent check { -# If the output contains the string "ONCE" twice then we fail -classes: - "ok" not => regcmp(".*ONCE.*ONCE.*", "$(test.subout)"); + # If the output contains the string "ONCE" twice then we fail + classes: + "ok" not => regcmp(".*ONCE.*ONCE.*", "$(test.subout)"); + + reports: + DEBUG:: + "$(test.subout)"; -reports: - DEBUG:: - "$(test.subout)"; + ok:: + "$(this.promise_filename) Pass"; - ok:: - "$(this.promise_filename) Pass"; - !ok:: - "$(this.promise_filename) FAIL"; + !ok:: + "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 2 diff --git a/tests/acceptance/14_reports/00_output/report_printfile_from_bot.cf b/tests/acceptance/14_reports/00_output/report_printfile_from_bot.cf index 7f140f924a..03170fdbcf 100644 --- a/tests/acceptance/14_reports/00_output/report_printfile_from_bot.cf +++ b/tests/acceptance/14_reports/00_output/report_printfile_from_bot.cf @@ -6,12 +6,17 @@ body common control bundle agent test { meta: - "description" -> { "CFE-3558" } - string => "Test reports printfile with number_of_lines as negative number"; + "description" -> { "CFE-3558" } + string => "Test reports printfile with number_of_lines as negative number"; vars: - "actual" string => execresult("$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell"); - "expected" string => "R: Last three: + "actual" + string => execresult( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell" + ); + + "expected" + string => "R: Last three: R: # Line 3 from bot R: # Line 2 from bot R: # Line 1 from bot"; @@ -21,14 +26,18 @@ bundle agent check { classes: "passed" expression => strcmp("$(test.expected)", "$(test.actual)"); + reports: windows:: "$(this.promise_filename) SFAIL/ENT-10433"; + DEBUG:: "Expected: '$(test.expected)'"; "Found: '$(test.actual)'"; + passed:: "$(this.promise_filename) Pass"; + !passed:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/14_reports/00_output/report_printfile_from_top.cf b/tests/acceptance/14_reports/00_output/report_printfile_from_top.cf index f0c0c3adf0..b6fdf1bc9d 100644 --- a/tests/acceptance/14_reports/00_output/report_printfile_from_top.cf +++ b/tests/acceptance/14_reports/00_output/report_printfile_from_top.cf @@ -6,12 +6,17 @@ body common control bundle agent test { meta: - "description" -> { "CFE-3558" } - string => "Test reports printfile with number_of_lines as positive number"; + "description" -> { "CFE-3558" } + string => "Test reports printfile with number_of_lines as positive number"; vars: - "actual" string => execresult("$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell"); - "expected" string => "R: First three: + "actual" + string => execresult( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell" + ); + + "expected" + string => "R: First three: R: # Line 1 from top R: # Line 2 from top R: # Line 3 from top"; @@ -21,14 +26,18 @@ bundle agent check { classes: "passed" expression => strcmp("$(test.expected)", "$(test.actual)"); + reports: windows:: "$(this.promise_filename) SFAIL/ENT-10433"; + DEBUG:: "Expected: '$(test.expected)'"; "Found: '$(test.actual)'"; + passed:: "$(this.promise_filename) Pass"; + !passed:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/14_reports/00_output/staging/report_in_common_bundle.cf b/tests/acceptance/14_reports/00_output/staging/report_in_common_bundle.cf index 10b58a7633..eb698ce830 100644 --- a/tests/acceptance/14_reports/00_output/staging/report_in_common_bundle.cf +++ b/tests/acceptance/14_reports/00_output/staging/report_in_common_bundle.cf @@ -1,29 +1,31 @@ # Check that reports are printed from common bundles (Redmine#3848 https://cfengine.com/dev/issues/3848) - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { - } - bundle agent test { vars: - "subout" string => execresult("$(sys.cf_agent) -b runme -Kf $(this.promise_filename).sub", "noshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -b runme -Kf $(this.promise_filename).sub", "noshell" + ); } - bundle agent check { classes: - "ok" expression => regcmp(".*rhino_9d85a7796746fb3e2e2ac95f74e4b981564803de.*", "$(test.subout)"); + "ok" + expression => regcmp( + ".*rhino_9d85a7796746fb3e2e2ac95f74e4b981564803de.*", "$(test.subout)" + ); reports: DEBUG:: @@ -31,8 +33,10 @@ bundle agent check ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 2 diff --git a/tests/acceptance/14_reports/00_output/unresolved_vars.cf b/tests/acceptance/14_reports/00_output/unresolved_vars.cf index d24f2f08d6..c6aa388b30 100644 --- a/tests/acceptance/14_reports/00_output/unresolved_vars.cf +++ b/tests/acceptance/14_reports/00_output/unresolved_vars.cf @@ -3,55 +3,58 @@ # Test that reports promises handle unresolved var refs in a sane way # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "expected_lines" slist => { - "R: var1: val1", - "R: var2: val2", - "R: var3: val3", - "R: var4: val4", - "R: var5: $(const.dollar)(var5)" - }; + "expected_lines" + slist => { + "R: var1: val1", + "R: var2: val2", + "R: var3: val3", + "R: var4: val4", + "R: var5: $(const.dollar)(var5)", + }; - "expected_output" string => join("$(const.n)", expected_lines); + "expected_output" string => join("$(const.n)", expected_lines); files: - "$(G.testfile).expected" content => "$(expected_output)$(const.n)"; + "$(G.testfile).expected" content => "$(expected_output)$(const.n)"; } bundle agent test { meta: - "description" -> { "CFE-3776" } - string => "Test that reports with unresolved variables are only emitted during the last pass of evaluation"; + "description" -> { "CFE-3776" } + string => "Test that reports with unresolved variables are only emitted during the last pass of evaluation"; - "test_soft_fail" string => "windows", - meta => { "ENT-10254" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10254" }; commands: - "$(sys.cf_agent) -Kf $(this.promise_filename).sub > $(G.testfile).actual" - contain => shell; + "$(sys.cf_agent) -Kf $(this.promise_filename).sub > $(G.testfile).actual" + contain => shell; } body contain shell { - useshell => "true"; + useshell => "true"; } - bundle agent check { methods: - "" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/14_reports/00_output/unresolved_with.cf b/tests/acceptance/14_reports/00_output/unresolved_with.cf index 3607df7d52..49107e42f6 100644 --- a/tests/acceptance/14_reports/00_output/unresolved_with.cf +++ b/tests/acceptance/14_reports/00_output/unresolved_with.cf @@ -3,47 +3,49 @@ # Test that reports promises handle unresolved var refs in '$(with)' # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { vars: - "expected_output" string => 'R: y: { "@{x}" }'; + "expected_output" string => 'R: y: { "@{x}" }'; files: - "$(G.testfile).expected" content => "$(expected_output)$(const.n)"; + "$(G.testfile).expected" content => "$(expected_output)$(const.n)"; } bundle agent test { meta: - "description" -> { "CFE-3776" } - string => "Test that with reports its content during the last pass even when that content has unresolved variables "; + "description" -> { "CFE-3776" } + string => "Test that with reports its content during the last pass even when that content has unresolved variables "; - "test_soft_fail" string => "windows", - meta => { "ENT-10254" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10254" }; commands: - "$(sys.cf_agent) -Kf $(this.promise_filename).sub > $(G.testfile).actual" - contain => shell; + "$(sys.cf_agent) -Kf $(this.promise_filename).sub > $(G.testfile).actual" + contain => shell; } body contain shell { - useshell => "true"; + useshell => "true"; } - bundle agent check { methods: - "" usebundle => dcs_check_diff("$(G.testfile).actual", - "$(G.testfile).expected", - "$(this.promise_filename)"); + "" + usebundle => dcs_check_diff( + "$(G.testfile).actual", + "$(G.testfile).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/14_reports/failed_reports_are_not_kept.cf b/tests/acceptance/14_reports/failed_reports_are_not_kept.cf index 00532ff6e3..e02190f919 100644 --- a/tests/acceptance/14_reports/failed_reports_are_not_kept.cf +++ b/tests/acceptance/14_reports/failed_reports_are_not_kept.cf @@ -1,5 +1,4 @@ # Check that reports are printed just once (Redmine#3446 https://cfengine.com/dev/issues/3446) - body common control { inputs => { "../default.sub.cf" }; @@ -37,11 +36,10 @@ bundle agent test classes => scoped_classes_generic("namespace", "report_to_file"); } - bundle agent check { classes: - "ok" not => "report_to_file_kept"; + "ok" not => "report_to_file_kept"; commands: "/usr/bin/chattr" @@ -58,8 +56,10 @@ bundle agent check reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } + ### PROJECT_ID: core ### CATEGORY_ID: 2 diff --git a/tests/acceptance/14_reports/report_to_file_suppresses_report_to_stdout.cf b/tests/acceptance/14_reports/report_to_file_suppresses_report_to_stdout.cf index 7ee9f40c50..eacc35ffe2 100644 --- a/tests/acceptance/14_reports/report_to_file_suppresses_report_to_stdout.cf +++ b/tests/acceptance/14_reports/report_to_file_suppresses_report_to_stdout.cf @@ -8,32 +8,35 @@ body common control bundle common test_meta { vars: - "description" string => "Test that report_to_file attribute suppresses report on stdout."; + "description" + string => "Test that report_to_file attribute suppresses report on stdout."; } bundle agent init { files: - "$(G.testfile)" - delete => tidy; + "$(G.testfile)" delete => tidy; } bundle agent test { vars: - "subout" string => execresult("$(sys.cf_agent) -Kf $(this.promise_filename).sub -DAUTO", "noshell"); + "subout" + string => execresult( + "$(sys.cf_agent) -Kf $(this.promise_filename).sub -DAUTO", "noshell" + ); } bundle agent check { - classes: "not_found_report_in_agent_output" - not => regcmp(".*This should not be reported to stdout.*", "$(test.subout)"); + not => regcmp( + ".*This should not be reported to stdout.*", "$(test.subout)" + ); "sub_ok" expression => regcmp(".*Pass", "$(test.subout)"); - - "ok" and => { "sub_ok", "not_found_report_in_agent_output" }; + "ok" and => { "sub_ok", "not_found_report_in_agent_output" }; reports: DEBUG:: diff --git a/tests/acceptance/14_reports/reports_comments_emitted_in_verbose.cf b/tests/acceptance/14_reports/reports_comments_emitted_in_verbose.cf index 56f16186a0..94bab503c3 100644 --- a/tests/acceptance/14_reports/reports_comments_emitted_in_verbose.cf +++ b/tests/acceptance/14_reports/reports_comments_emitted_in_verbose.cf @@ -1,22 +1,26 @@ body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent test { meta: - "description" string => "Test that comments on reports are emitted in verbose output."; - + "description" + string => "Test that comments on reports are emitted in verbose output."; } ####################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_output(".*This is a comment about a report.*", "", "$(sys.cf_agent) -Kvf $(this.promise_filename).sub", $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + ".*This is a comment about a report.*", + "", + "$(sys.cf_agent) -Kvf $(this.promise_filename).sub", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/15_control/01_common/003.cf b/tests/acceptance/15_control/01_common/003.cf index 948ca3f175..bc3e57819b 100644 --- a/tests/acceptance/15_control/01_common/003.cf +++ b/tests/acceptance/15_control/01_common/003.cf @@ -3,45 +3,41 @@ # Test ignore_missing_bundles, expect to pass # ####################################################### - body common control { - ignore_missing_bundles => "on"; - - inputs => { "../../default.sub.cf" }; - bundlesequence => { "missing", default("$(this.promise_filename)") }; - version => "1.0"; + ignore_missing_bundles => "on"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { "missing", default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; classes: - "ok" expression => "any"; + "ok" expression => "any"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/15_control/01_common/004.cf b/tests/acceptance/15_control/01_common/004.cf index 6cc0b9dd4f..68f8b22eaa 100644 --- a/tests/acceptance/15_control/01_common/004.cf +++ b/tests/acceptance/15_control/01_common/004.cf @@ -3,44 +3,43 @@ # Test ignore_missing_bundles, expect to pass, order independent # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { "missing", default("$(this.promise_filename)") }; - version => "1.0"; - ignore_missing_bundles => "on"; # Order should not matter! + inputs => { "../../default.sub.cf" }; + bundlesequence => { "missing", default("$(this.promise_filename)") }; + version => "1.0"; + ignore_missing_bundles => "on"; + + # Order should not matter! } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; classes: - "ok" expression => "any"; + "ok" expression => "any"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/15_control/01_common/007.cf b/tests/acceptance/15_control/01_common/007.cf index ed6edbac50..3b6be8268f 100644 --- a/tests/acceptance/15_control/01_common/007.cf +++ b/tests/acceptance/15_control/01_common/007.cf @@ -3,13 +3,12 @@ # Test ignore_missing_bundles, expect to pass, methods # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - ignore_missing_bundles => "on"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; + ignore_missing_bundles => "on"; } ####################################################### @@ -21,26 +20,25 @@ body common control # } # ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; classes: - "ok" expression => "any"; + "ok" expression => "any"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/15_control/01_common/013.cf b/tests/acceptance/15_control/01_common/013.cf index d27d7373b4..c22b22897f 100644 --- a/tests/acceptance/15_control/01_common/013.cf +++ b/tests/acceptance/15_control/01_common/013.cf @@ -3,45 +3,41 @@ # Test ignore_missing_inputs, expect to pass # ####################################################### - body common control { - ignore_missing_inputs => "on"; - - inputs => { "../../default.sub.cf", "missing" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + ignore_missing_inputs => "on"; + inputs => { "../../default.sub.cf", "missing" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; classes: - "ok" expression => "any"; + "ok" expression => "any"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/15_control/01_common/014.cf b/tests/acceptance/15_control/01_common/014.cf index 6f96bf356e..7b8ed550a0 100644 --- a/tests/acceptance/15_control/01_common/014.cf +++ b/tests/acceptance/15_control/01_common/014.cf @@ -3,44 +3,43 @@ # Test ignore_missing_inputs, expect to pass, order independent # ####################################################### - body common control { - inputs => { "../../default.sub.cf", "missing" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - ignore_missing_inputs => "on"; # Order should not matter! + inputs => { "../../default.sub.cf", "missing" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; + ignore_missing_inputs => "on"; + + # Order should not matter! } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; classes: - "ok" expression => "any"; + "ok" expression => "any"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/15_control/01_common/021.cf b/tests/acceptance/15_control/01_common/021.cf index 23ffcedf80..c255b26ece 100644 --- a/tests/acceptance/15_control/01_common/021.cf +++ b/tests/acceptance/15_control/01_common/021.cf @@ -3,44 +3,41 @@ # Test domain # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - domain => "puppetlabs.com"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; + domain => "puppetlabs.com"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; classes: - "ok" expression => "puppetlabs_com"; + "ok" expression => "puppetlabs_com"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/15_control/01_common/022.cf b/tests/acceptance/15_control/01_common/022.cf index 8e81f26615..9f8db95ea9 100644 --- a/tests/acceptance/15_control/01_common/022.cf +++ b/tests/acceptance/15_control/01_common/022.cf @@ -3,46 +3,44 @@ # Test domain - expect it to set the $(sys.domain) variable # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; - domain => "puppetlabs.com"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; + domain => "puppetlabs.com"; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; classes: - "ok" expression => strcmp("$(sys.domain)", "puppetlabs.com"); + "ok" expression => strcmp("$(sys.domain)", "puppetlabs.com"); reports: DEBUG:: "Expected $(sys.domain) to be puppetlabs.com"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/15_control/01_common/classic_evaluation_complex_policy.cf b/tests/acceptance/15_control/01_common/classic_evaluation_complex_policy.cf index 6022728864..b2e415081f 100644 --- a/tests/acceptance/15_control/01_common/classic_evaluation_complex_policy.cf +++ b/tests/acceptance/15_control/01_common/classic_evaluation_complex_policy.cf @@ -4,6 +4,7 @@ body common control bundlesequence => { "test" }; evaluation_order => "classic"; } + bundle agent test { classes: @@ -12,6 +13,7 @@ bundle agent test vars: first_class:: "first_var" string => "hello"; + !first_class:: "first_var" string => "bye"; @@ -21,6 +23,7 @@ bundle agent test vars: second_class:: "second_var" string => "foo"; + !second_class:: "second_var" string => "bar"; @@ -30,6 +33,7 @@ bundle agent test vars: third_class:: "third_var" string => "faz"; + !third_class:: "thid_var" string => "baz"; @@ -39,10 +43,10 @@ bundle agent test reports: !ok:: "$(this.promise_filename) Pass"; + ok:: "$(this.promise_filename) FAIL"; DEBUG:: "$(third_var)"; - } diff --git a/tests/acceptance/15_control/01_common/classic_evaluation_custom_promise_types.cf b/tests/acceptance/15_control/01_common/classic_evaluation_custom_promise_types.cf index 3dcc41c0c7..379663d0b9 100644 --- a/tests/acceptance/15_control/01_common/classic_evaluation_custom_promise_types.cf +++ b/tests/acceptance/15_control/01_common/classic_evaluation_custom_promise_types.cf @@ -14,36 +14,30 @@ promise agent dummy bundle agent init { files: - "/tmp/dummyfile" - create => "true"; + "/tmp/dummyfile" create => "true"; } bundle agent test { - dummy: - "/tmp/dummyfile" - smth => "hello"; + "/tmp/dummyfile" smth => "hello"; vars: - "content" - string => readfile("/tmp/dummyfile"); + "content" string => readfile("/tmp/dummyfile"); files: - "/tmp/dummyfile" - content => "ok"; + "/tmp/dummyfile" content => "ok"; vars: - "content" - string => readfile("/tmp/dummyfile"); + "content" string => readfile("/tmp/dummyfile"); classes: - "ok" - expression => strcmp("$(content)", "ok"); - + "ok" expression => strcmp("$(content)", "ok"); + reports: !ok:: "$(this.promise_filename) Pass"; + ok:: "$(this.promise_filename) FAIL"; @@ -54,6 +48,5 @@ bundle agent test bundle agent cleanup { files: - "/tmp/dummyfile" - delete => tidy; + "/tmp/dummyfile" delete => tidy; } diff --git a/tests/acceptance/15_control/01_common/classic_evaluation_long_policy.cf b/tests/acceptance/15_control/01_common/classic_evaluation_long_policy.cf index f2211687a7..077fffdbd9 100644 --- a/tests/acceptance/15_control/01_common/classic_evaluation_long_policy.cf +++ b/tests/acceptance/15_control/01_common/classic_evaluation_long_policy.cf @@ -8,86 +8,68 @@ body common control bundle agent init { files: - "/tmp/example" - create => "true"; - "/tmp/otherfile" - create => "true"; + "/tmp/example" create => "true"; + "/tmp/otherfile" create => "true"; } bundle agent test { vars: - "result" - string => "First"; - "foo" - string => "second"; - "result" - string => concat("$(result)", ", $(foo)"); - "sixth" - string => "sixth"; + "result" string => "First"; + "foo" string => "second"; + "result" string => concat("$(result)", ", $(foo)"); + "sixth" string => "sixth"; classes: - "bar" - if => "any"; + "bar" if => "any"; vars: - "foo" - string => "other"; - bar:: - "baz" - string => "third"; + "foo" string => "other"; - "result" - string => concat("$(result)", ", $(baz)"); + bar:: + "baz" string => "third"; + "result" string => concat("$(result)", ", $(baz)"); files: - "/tmp/example" - content => "fourth"; + "/tmp/example" content => "fourth"; vars: - "content" - string => readfile("/tmp/example"); - "result" - string => concat("$(result)", ", $(content)"); + "content" string => readfile("/tmp/example"); + "result" string => concat("$(result)", ", $(content)"); classes: - "test" - expression => strcmp("$(content)", "fourth"); - + "test" expression => strcmp("$(content)", "fourth"); + vars: test:: - "result" - string => concat("$(result)", ", fifth"); - + "result" string => concat("$(result)", ", fifth"); files: - "/tmp/otherfile" - content => "something"; + "/tmp/otherfile" content => "something"; vars: - "othercontent" - string => readfile("/tmp/otherfile"); + "othercontent" string => readfile("/tmp/otherfile"); files: - "/tmp/otherfile" - delete => tidy; + "/tmp/otherfile" delete => tidy; classes: - "myclass" - expression => strcmp("$(othercontent)", "something"); + "myclass" expression => strcmp("$(othercontent)", "something"); vars: myclass:: - "result" - string => concat("$(result)", ", $(sixth)"); + "result" string => concat("$(result)", ", $(sixth)"); classes: "ok" - expression => strcmp("$(result)", "First, second, third, fourth, fifth, sixth"); + expression => strcmp( + "$(result)", "First, second, third, fourth, fifth, sixth" + ); reports: !ok:: "$(this.promise_filename) Pass"; + ok:: "$(this.promise_filename) FAIL"; @@ -98,6 +80,5 @@ bundle agent test bundle agent cleanup { files: - "/tmp/example" - delete => tidy; + "/tmp/example" delete => tidy; } diff --git a/tests/acceptance/15_control/01_common/default_bundlesequence.cf b/tests/acceptance/15_control/01_common/default_bundlesequence.cf index 9140f77a08..e8ff492b77 100644 --- a/tests/acceptance/15_control/01_common/default_bundlesequence.cf +++ b/tests/acceptance/15_control/01_common/default_bundlesequence.cf @@ -1,18 +1,17 @@ # Redmine#4993: default bundlesequence calls main() - body common control { - inputs => { "../../default.sub.cf" }; + inputs => { "../../default.sub.cf" }; } bundle agent main { methods: - "" usebundle => default("$(this.promise_filename)"); + "" usebundle => default("$(this.promise_filename)"); } bundle agent check { methods: - "" usebundle => dcs_pass("$(this.promise_filename)"); + "" usebundle => dcs_pass("$(this.promise_filename)"); } diff --git a/tests/acceptance/15_control/01_common/inputs_directory.cf b/tests/acceptance/15_control/01_common/inputs_directory.cf index e0de1bb51c..a1427f7945 100644 --- a/tests/acceptance/15_control/01_common/inputs_directory.cf +++ b/tests/acceptance/15_control/01_common/inputs_directory.cf @@ -1,11 +1,10 @@ # Redmine#4683: ensure directories and missing files don't abort when # ignore_missing_inputs is set - body common control { - ignore_missing_inputs => "true"; - inputs => { "/x.cf", "/", "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + ignore_missing_inputs => "true"; + inputs => { "/x.cf", "/", "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init @@ -19,5 +18,5 @@ bundle agent test bundle agent check { reports: - "$(this.promise_filename) Pass"; + "$(this.promise_filename) Pass"; } diff --git a/tests/acceptance/15_control/01_common/inputs_from_json.cf b/tests/acceptance/15_control/01_common/inputs_from_json.cf index 9aba46fa41..82c0a44422 100644 --- a/tests/acceptance/15_control/01_common/inputs_from_json.cf +++ b/tests/acceptance/15_control/01_common/inputs_from_json.cf @@ -1,21 +1,20 @@ # Redmine#4683: dynamic inputs should work from a data container - body common control { - #ignore_missing_inputs => "true"; - inputs => { "../../default.sub.cf", "$(config.myfile)" }; - bundlesequence => { default("$(this.promise_filename)") }; + #ignore_missing_inputs => "true"; + inputs => { "../../default.sub.cf", "$(config.myfile)" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle common config { vars: - "c" data => parsejson('{ "file": "dynamic.sub" }'); - "myfile" string => "$(c[file])"; + "c" data => parsejson('{ "file": "dynamic.sub" }'); + "myfile" string => "$(c[file])"; reports: - DEBUG:: - "myfile $(myfile)"; + DEBUG:: + "myfile $(myfile)"; } bundle agent init @@ -29,5 +28,5 @@ bundle agent test bundle agent check { reports: - "$(this.promise_filename) Pass"; + "$(this.promise_filename) Pass"; } diff --git a/tests/acceptance/15_control/01_common/inputs_from_readstringlist.cf b/tests/acceptance/15_control/01_common/inputs_from_readstringlist.cf index 270edc17cd..8fd240e1f1 100644 --- a/tests/acceptance/15_control/01_common/inputs_from_readstringlist.cf +++ b/tests/acceptance/15_control/01_common/inputs_from_readstringlist.cf @@ -1,21 +1,23 @@ # Redmine#4683: dynamic inputs should work from readstringlist - body common control { - inputs => { "../../default.sub.cf", @(runlist.inputs) }; - bundlesequence => { prep_runlist, runlist, default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", @(runlist.inputs) }; + bundlesequence => { + prep_runlist, runlist, default("$(this.promise_filename)") + }; } # workaround: reading the data has to be separate from... bundle common prep_runlist { vars: - "generated_inputs" string => "$(this.promise_filename).txt"; - "inputs_pre" slist => readstringlist($(generated_inputs), - "\s*#[^\n]*", - "\n", - 99999, - 9999999); + "generated_inputs" string => "$(this.promise_filename).txt"; + + "inputs_pre" + slist => readstringlist( + $(generated_inputs), "\s*#[^\n]*", "\n", 99999, 9999999 + ); + reports: EXTRA:: "$(this.bundle) reading inputs from file $(generated_inputs)"; @@ -25,7 +27,10 @@ bundle common prep_runlist bundle common runlist { vars: - "inputs" slist => maplist("$(this.promise_dirname)/$(this)", "prep_runlist.inputs_pre"); + "inputs" + slist => maplist( + "$(this.promise_dirname)/$(this)", "prep_runlist.inputs_pre" + ); reports: EXTRA:: @@ -43,16 +48,18 @@ bundle agent test bundle agent check { classes: - "ok" and => { "included_info_global_class" }; + "ok" and => { "included_info_global_class" }; reports: DEBUG.!included_info_global_class:: "BAD: The global class from the included file was not defined"; + EXTRA.included_info_global_class:: "Good: The global class from the included file was defined"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/15_control/01_common/top_down_evaluation_complex_policy.cf b/tests/acceptance/15_control/01_common/top_down_evaluation_complex_policy.cf index 99f6a0b5c4..ecba7bcf97 100644 --- a/tests/acceptance/15_control/01_common/top_down_evaluation_complex_policy.cf +++ b/tests/acceptance/15_control/01_common/top_down_evaluation_complex_policy.cf @@ -4,6 +4,7 @@ body common control bundlesequence => { "test" }; evaluation_order => "top_down"; } + bundle agent test { classes: @@ -12,6 +13,7 @@ bundle agent test vars: first_class:: "first_var" string => "hello"; + !first_class:: "first_var" string => "bye"; @@ -21,6 +23,7 @@ bundle agent test vars: second_class:: "second_var" string => "foo"; + !second_class:: "second_var" string => "bar"; @@ -30,6 +33,7 @@ bundle agent test vars: third_class:: "third_var" string => "faz"; + !third_class:: "thid_var" string => "baz"; @@ -39,10 +43,10 @@ bundle agent test reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; DEBUG:: "$(third_var)"; - } diff --git a/tests/acceptance/15_control/01_common/top_down_evaluation_long_policy.cf b/tests/acceptance/15_control/01_common/top_down_evaluation_long_policy.cf index 9c91408f55..5d85ecbb5a 100644 --- a/tests/acceptance/15_control/01_common/top_down_evaluation_long_policy.cf +++ b/tests/acceptance/15_control/01_common/top_down_evaluation_long_policy.cf @@ -8,86 +8,68 @@ body common control bundle agent init { files: - "/tmp/example" - create => "true"; - "/tmp/otherfile" - create => "true"; + "/tmp/example" create => "true"; + "/tmp/otherfile" create => "true"; } bundle agent test { vars: - "result" - string => "First"; - "foo" - string => "second"; - "result" - string => concat("$(result)", ", $(foo)"); - "sixth" - string => "sixth"; + "result" string => "First"; + "foo" string => "second"; + "result" string => concat("$(result)", ", $(foo)"); + "sixth" string => "sixth"; classes: - "bar" - if => "any"; + "bar" if => "any"; vars: - "foo" - string => "other"; - bar:: - "baz" - string => "third"; + "foo" string => "other"; - "result" - string => concat("$(result)", ", $(baz)"); + bar:: + "baz" string => "third"; + "result" string => concat("$(result)", ", $(baz)"); files: - "/tmp/example" - content => "fourth"; + "/tmp/example" content => "fourth"; vars: - "content" - string => readfile("/tmp/example"); - "result" - string => concat("$(result)", ", $(content)"); + "content" string => readfile("/tmp/example"); + "result" string => concat("$(result)", ", $(content)"); classes: - "test" - expression => strcmp("$(content)", "fourth"); - + "test" expression => strcmp("$(content)", "fourth"); + vars: test:: - "result" - string => concat("$(result)", ", fifth"); - + "result" string => concat("$(result)", ", fifth"); files: - "/tmp/otherfile" - content => "something"; + "/tmp/otherfile" content => "something"; vars: - "othercontent" - string => readfile("/tmp/otherfile"); + "othercontent" string => readfile("/tmp/otherfile"); files: - "/tmp/otherfile" - delete => tidy; + "/tmp/otherfile" delete => tidy; classes: - "myclass" - expression => strcmp("$(othercontent)", "something"); + "myclass" expression => strcmp("$(othercontent)", "something"); vars: myclass:: - "result" - string => concat("$(result)", ", $(sixth)"); + "result" string => concat("$(result)", ", $(sixth)"); classes: "ok" - expression => strcmp("$(result)", "First, second, third, fourth, fifth, sixth"); + expression => strcmp( + "$(result)", "First, second, third, fourth, fifth, sixth" + ); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; @@ -98,6 +80,5 @@ bundle agent test bundle agent cleanup { files: - "/tmp/example" - delete => tidy; + "/tmp/example" delete => tidy; } diff --git a/tests/acceptance/15_control/02_agent/001.cf b/tests/acceptance/15_control/02_agent/001.cf index 332c3e3eb6..5cd2161c87 100644 --- a/tests/acceptance/15_control/02_agent/001.cf +++ b/tests/acceptance/15_control/02_agent/001.cf @@ -3,47 +3,45 @@ # Test abortclasses - control case 1, no abort # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -body agent control { - abortclasses => { "quitquit", "quit.*" }; +body agent control +{ + abortclasses => { "quitquit", "quit.*" }; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; classes: - "ok" expression => "any"; + "ok" expression => "any"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/15_control/02_agent/002.cf b/tests/acceptance/15_control/02_agent/002.cf index 716863599b..704c1eea02 100644 --- a/tests/acceptance/15_control/02_agent/002.cf +++ b/tests/acceptance/15_control/02_agent/002.cf @@ -3,56 +3,56 @@ # Test abortclasses - control case 2, no abort # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -body agent control { - abortclasses => { "quitquit", "quitquit.*" }; +body agent control +{ + abortclasses => { "quitquit", "quitquit.*" }; } bundle common g { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; classes: - "quit" expression => "any"; # Validate no submatch + "quit" expression => "any"; + + # Validate no submatch } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; classes: - "ok" expression => "any"; + "ok" expression => "any"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/15_control/02_agent/003.cf b/tests/acceptance/15_control/02_agent/003.cf index 0ff0b75ce8..991c2702bc 100644 --- a/tests/acceptance/15_control/02_agent/003.cf +++ b/tests/acceptance/15_control/02_agent/003.cf @@ -3,56 +3,56 @@ # Test abortclasses - control case 3, no abort # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -body agent control { - abortclasses => { "quit" }; +body agent control +{ + abortclasses => { "quit" }; } bundle common g { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; classes: - "quitquit" expression => "any"; # Validate no submatch, reverse + "quitquit" expression => "any"; + + # Validate no submatch, reverse } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; classes: - "ok" expression => "any"; + "ok" expression => "any"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/15_control/02_agent/021.cf b/tests/acceptance/15_control/02_agent/021.cf index 125e2f60f5..044ed692d8 100644 --- a/tests/acceptance/15_control/02_agent/021.cf +++ b/tests/acceptance/15_control/02_agent/021.cf @@ -3,47 +3,45 @@ # Test abortbundleclasses - control case 1, no abort # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -body agent control { - abortbundleclasses => { "quitquit", "quitquit.*" }; +body agent control +{ + abortbundleclasses => { "quitquit", "quitquit.*" }; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; classes: - "ok" expression => "any"; + "ok" expression => "any"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/15_control/02_agent/022.cf b/tests/acceptance/15_control/02_agent/022.cf index 0ce5c61b39..6d47c4c67c 100644 --- a/tests/acceptance/15_control/02_agent/022.cf +++ b/tests/acceptance/15_control/02_agent/022.cf @@ -3,48 +3,47 @@ # Test abortbundleclasses - control case 2, no abort # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -body agent control { - abortbundleclasses => { "quitquit", "quitquit.*" }; +body agent control +{ + abortbundleclasses => { "quitquit", "quitquit.*" }; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; classes: - "ok" expression => "any"; - "quit" expression => "any"; # Validate no submatch + "ok" expression => "any"; + "quit" expression => "any"; + # Validate no submatch reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/15_control/02_agent/023.cf b/tests/acceptance/15_control/02_agent/023.cf index 4e48fc9a85..b878a0d14f 100644 --- a/tests/acceptance/15_control/02_agent/023.cf +++ b/tests/acceptance/15_control/02_agent/023.cf @@ -3,56 +3,56 @@ # Test abortbundleclasses - control case 3, no abort # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -body agent control { - abortbundleclasses => { "quit" }; +body agent control +{ + abortbundleclasses => { "quit" }; } bundle common g { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; classes: - "quitquit" expression => "any"; # Validate no submatch, reverse + "quitquit" expression => "any"; + + # Validate no submatch, reverse } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; classes: - "ok" expression => "any"; + "ok" expression => "any"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/15_control/02_agent/031.cf b/tests/acceptance/15_control/02_agent/031.cf index 5da8bac564..5e0ed4b96f 100644 --- a/tests/acceptance/15_control/02_agent/031.cf +++ b/tests/acceptance/15_control/02_agent/031.cf @@ -3,47 +3,46 @@ # Test addclasses # ####################################################### - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } -body agent control { - addclasses => { "ok" }; +body agent control +{ + addclasses => { "ok" }; } ####################################################### - bundle agent init { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent test { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; } ####################################################### - bundle agent check { vars: - "dummy" string => "dummy"; + "dummy" string => "dummy"; classes: - "quitquit" expression => "any"; # Prevent reports from running + "quitquit" expression => "any"; + # Prevent reports from running reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/15_control/02_agent/abortbundle_classes.cf b/tests/acceptance/15_control/02_agent/abortbundle_classes.cf index c288d30739..be9e4cf615 100644 --- a/tests/acceptance/15_control/02_agent/abortbundle_classes.cf +++ b/tests/acceptance/15_control/02_agent/abortbundle_classes.cf @@ -5,24 +5,26 @@ # execution. # ########################################################################## - body common control { - inputs => { - "../../default.sub.cf", - }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -DAUTO"; + "command" + string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -DAUTO"; methods: "check" - usebundle => dcs_passif_output(".*aborted on defined class 'abort_bundle'.*PASS.*", ".*Should Never Reach.*", $(command), $(this.promise_filename)); + usebundle => dcs_passif_output( + ".*aborted on defined class 'abort_bundle'.*PASS.*", + ".*Should Never Reach.*", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/15_control/02_agent/abortbundle_classexpression.cf b/tests/acceptance/15_control/02_agent/abortbundle_classexpression.cf index 4e134908e8..bc133b95de 100644 --- a/tests/acceptance/15_control/02_agent/abortbundle_classexpression.cf +++ b/tests/acceptance/15_control/02_agent/abortbundle_classexpression.cf @@ -5,25 +5,26 @@ # not the entire agent execution. # ########################################################################## - - body common control { - inputs => { - "../../default.sub.cf", - }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -DAUTO"; + "command" + string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -DAUTO"; methods: "check" - usebundle => dcs_passif_output(".*Setting abort for 'abort_bundle.something_else' when setting class 'something_else'.*PASS.*", ".*Should Never Reach.*", $(command), $(this.promise_filename)); + usebundle => dcs_passif_output( + ".*Setting abort for 'abort_bundle.something_else' when setting class 'something_else'.*PASS.*", + ".*Should Never Reach.*", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/15_control/02_agent/abortbundle_nomatchclassexpression.cf b/tests/acceptance/15_control/02_agent/abortbundle_nomatchclassexpression.cf index a86bf567cc..cef3d6b118 100644 --- a/tests/acceptance/15_control/02_agent/abortbundle_nomatchclassexpression.cf +++ b/tests/acceptance/15_control/02_agent/abortbundle_nomatchclassexpression.cf @@ -3,25 +3,23 @@ # Test that bundles will not abort when a class expression used in # abortbundleclass does not match. ########################################################################## - - body common control { - inputs => { - "../../default.sub.cf", - }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -DAUTO"; + "command" + string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -DAUTO"; methods: "check" - usebundle => dcs_passif_output(".*PASS.*", "", $(command), $(this.promise_filename)); + usebundle => dcs_passif_output( + ".*PASS.*", "", $(command), $(this.promise_filename) + ); } diff --git a/tests/acceptance/15_control/02_agent/abortbundle_regex.cf b/tests/acceptance/15_control/02_agent/abortbundle_regex.cf index cbd19b5e7f..7cde16f670 100644 --- a/tests/acceptance/15_control/02_agent/abortbundle_regex.cf +++ b/tests/acceptance/15_control/02_agent/abortbundle_regex.cf @@ -5,25 +5,26 @@ # agent execution. # ########################################################################## - - body common control { - inputs => { - "../../default.sub.cf", - }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent check { vars: - "command" string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -DAUTO"; + "command" + string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub -DAUTO"; methods: "check" - usebundle => dcs_passif_output(".*aborted on defined class 'abort_bundle_please'.*PASS.*", ".*Should Never Reach.*", $(command), $(this.promise_filename)); + usebundle => dcs_passif_output( + ".*aborted on defined class 'abort_bundle_please'.*PASS.*", + ".*Should Never Reach.*", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/15_control/file/file_inputs.cf b/tests/acceptance/15_control/file/file_inputs.cf index 8ca9ed9723..5a9176c488 100644 --- a/tests/acceptance/15_control/file/file_inputs.cf +++ b/tests/acceptance/15_control/file/file_inputs.cf @@ -2,14 +2,14 @@ body common control { ignore_missing_bundles => "yes"; inputs => { "../../default.sub.cf" }; - bundlesequence => { "missing", default("$(this.promise_filename)") }; + bundlesequence => { "missing", default("$(this.promise_filename)") }; version => "1.0"; } bundle agent init { -vars: - "file" string => "$(this.promise_filename)"; + vars: + "file" string => "$(this.promise_filename)"; } bundle agent test diff --git a/tests/acceptance/16_cf-serverd/serial/001.cf b/tests/acceptance/16_cf-serverd/serial/001.cf index b78da08af5..24ae5d42c5 100644 --- a/tests/acceptance/16_cf-serverd/serial/001.cf +++ b/tests/acceptance/16_cf-serverd/serial/001.cf @@ -1,25 +1,30 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "This is the source file to copy $(sys.date) - always fresh"); - # ensure destination files are not there - "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "This is the source file to copy $(sys.date) - always fresh" + ); - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + # ensure destination files are not there + "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + "any" usebundle => generate_key; - "any" usebundle => run_test("$(this.promise_filename).sub"); + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/002.cf b/tests/acceptance/16_cf-serverd/serial/002.cf index 0fefabdd36..e572d1ec69 100644 --- a/tests/acceptance/16_cf-serverd/serial/002.cf +++ b/tests/acceptance/16_cf-serverd/serial/002.cf @@ -1,27 +1,40 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - "any" usebundle => file_make("$(G.testdir)/source_file", - "This is the source file to copy $(sys.date) - always fresh"); + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "This is the source file to copy $(sys.date) - always fresh" + ); - # We generate key in-between the two files on purpose, to - # introduce latency and make sure that destination file is newer - "any" usebundle => generate_key; + # We generate key in-between the two files on purpose, to + # introduce latency and make sure that destination file is newer + "any" usebundle => generate_key; - "any" usebundle => file_make("$(G.testdir)/destfile_classic", - "This is the source file to copy $(sys.date) - different!"); - "any" usebundle => file_make("$(G.testdir)/destfile_latest", - "This is the source file to copy $(sys.date) - different!"); + "any" + usebundle => file_make( + "$(G.testdir)/destfile_classic", + "This is the source file to copy $(sys.date) - different!" + ); - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => file_make( + "$(G.testdir)/destfile_latest", + "This is the source file to copy $(sys.date) - different!" + ); + + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/003.cf b/tests/acceptance/16_cf-serverd/serial/003.cf index a6848c915d..3cc2d25a46 100644 --- a/tests/acceptance/16_cf-serverd/serial/003.cf +++ b/tests/acceptance/16_cf-serverd/serial/003.cf @@ -1,24 +1,34 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "This is the source file to copy $(sys.date) - always fresh"); - # destination files - "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "This is the source file to copy $(sys.date) - always fresh" + ); - "any" usebundle => generate_key; + # destination files + "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_deny_connect.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_deny_connect.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/localhost_deny_connect.srv" + ); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/localhost_deny_connect.srv" + ); } diff --git a/tests/acceptance/16_cf-serverd/serial/005.cf b/tests/acceptance/16_cf-serverd/serial/005.cf index 01f8276968..3ca06631d3 100644 --- a/tests/acceptance/16_cf-serverd/serial/005.cf +++ b/tests/acceptance/16_cf-serverd/serial/005.cf @@ -1,24 +1,30 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "This is the source file to copy $(sys.date) - always fresh"); - # destination files - "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "This is the source file to copy $(sys.date) - always fresh" + ); - "any" usebundle => generate_key; + # destination files + "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/lan_deny_connect.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/lan_deny_connect.srv"); + "any" + usebundle => start_server("$(this.promise_dirname)/lan_deny_connect.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/lan_deny_connect.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/006.cf b/tests/acceptance/16_cf-serverd/serial/006.cf index 80ff70d79b..57f807ce28 100644 --- a/tests/acceptance/16_cf-serverd/serial/006.cf +++ b/tests/acceptance/16_cf-serverd/serial/006.cf @@ -1,24 +1,30 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "This is the source file to copy $(sys.date) - always fresh"); - # destination files - "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "This is the source file to copy $(sys.date) - always fresh" + ); - "any" usebundle => generate_key; + # destination files + "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/007.cf b/tests/acceptance/16_cf-serverd/serial/007.cf index 0b5507624d..f0ba7e0e82 100644 --- a/tests/acceptance/16_cf-serverd/serial/007.cf +++ b/tests/acceptance/16_cf-serverd/serial/007.cf @@ -1,28 +1,35 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10401" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10401" }; methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "This is the source file to copy $(sys.date) - always fresh"); - # destination files - "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "This is the source file to copy $(sys.date) - always fresh" + ); - "any" usebundle => generate_key; + # destination files + "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/008.cf b/tests/acceptance/16_cf-serverd/serial/008.cf index 0b5507624d..f0ba7e0e82 100644 --- a/tests/acceptance/16_cf-serverd/serial/008.cf +++ b/tests/acceptance/16_cf-serverd/serial/008.cf @@ -1,28 +1,35 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10401" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10401" }; methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "This is the source file to copy $(sys.date) - always fresh"); - # destination files - "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "This is the source file to copy $(sys.date) - always fresh" + ); - "any" usebundle => generate_key; + # destination files + "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/009.cf b/tests/acceptance/16_cf-serverd/serial/009.cf index 6b136ab916..96a02bcd87 100644 --- a/tests/acceptance/16_cf-serverd/serial/009.cf +++ b/tests/acceptance/16_cf-serverd/serial/009.cf @@ -1,19 +1,32 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - "any" usebundle => dcs_fini("$(G.testdir)/destination_file"); - "any" usebundle => file_make("$(G.testdir)/source_file", - "This is the source file to copy $(sys.date) - always fresh"); - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open_with_data_select.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open_with_data_select.srv"); + "any" usebundle => dcs_fini("$(G.testdir)/destination_file"); + + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "This is the source file to copy $(sys.date) - always fresh" + ); + + "any" usebundle => generate_key; + + "any" + usebundle => start_server( + "$(this.promise_dirname)/localhost_open_with_data_select.srv" + ); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/localhost_open_with_data_select.srv" + ); } diff --git a/tests/acceptance/16_cf-serverd/serial/010.cf b/tests/acceptance/16_cf-serverd/serial/010.cf index 0b5507624d..f0ba7e0e82 100644 --- a/tests/acceptance/16_cf-serverd/serial/010.cf +++ b/tests/acceptance/16_cf-serverd/serial/010.cf @@ -1,28 +1,35 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10401" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10401" }; methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "This is the source file to copy $(sys.date) - always fresh"); - # destination files - "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "This is the source file to copy $(sys.date) - always fresh" + ); - "any" usebundle => generate_key; + # destination files + "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/011.cf b/tests/acceptance/16_cf-serverd/serial/011.cf index 0b5507624d..f0ba7e0e82 100644 --- a/tests/acceptance/16_cf-serverd/serial/011.cf +++ b/tests/acceptance/16_cf-serverd/serial/011.cf @@ -1,28 +1,35 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10401" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10401" }; methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "This is the source file to copy $(sys.date) - always fresh"); - # destination files - "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "This is the source file to copy $(sys.date) - always fresh" + ); - "any" usebundle => generate_key; + # destination files + "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/allow_path1_then_deny_path2_a.cf b/tests/acceptance/16_cf-serverd/serial/allow_path1_then_deny_path2_a.cf index 8becf9a821..83ccc7b7fb 100644 --- a/tests/acceptance/16_cf-serverd/serial/allow_path1_then_deny_path2_a.cf +++ b/tests/acceptance/16_cf-serverd/serial/allow_path1_then_deny_path2_a.cf @@ -1,39 +1,55 @@ body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { create_directories, default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { create_directories, default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - # source file - on purpose in G.testroot instead of G.testdir - # since the former is admitted while the latter is denied. - "any" usebundle => file_make("$(G.testroot)/source_file", - "This is the source file to copy $(sys.date) - always fresh"); - # destination files - "any" usebundle => dcs_fini("$(G.testdir)/server1_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/server1_latest"); - "any" usebundle => dcs_fini("$(G.testdir)/server2_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/server2_latest"); - - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_deny_one_directory.srv"); - "any" usebundle => start_server("$(this.promise_dirname)/localhost_deny_one_directory_with_regex.srv"); - - "any" usebundle => run_test("$(this.promise_filename).sub"); - - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_deny_one_directory.srv"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_deny_one_directory_with_regex.srv"); + # source file - on purpose in G.testroot instead of G.testdir + # since the former is admitted while the latter is denied. + "any" + usebundle => file_make( + "$(G.testroot)/source_file", + "This is the source file to copy $(sys.date) - always fresh" + ); + + # destination files + "any" usebundle => dcs_fini("$(G.testdir)/server1_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/server1_latest"); + "any" usebundle => dcs_fini("$(G.testdir)/server2_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/server2_latest"); + "any" usebundle => generate_key; + + "any" + usebundle => start_server( + "$(this.promise_dirname)/localhost_deny_one_directory.srv" + ); + + "any" + usebundle => start_server( + "$(this.promise_dirname)/localhost_deny_one_directory_with_regex.srv" + ); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/localhost_deny_one_directory.srv" + ); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/localhost_deny_one_directory_with_regex.srv" + ); } # For the access rules in cf-serverd to work recursively, the paths must exist and be directories bundle agent create_directories { files: - "$(G.testroot)/." - create => "true"; - "$(G.testdir)/." - create => "true"; + "$(G.testroot)/." create => "true"; + "$(G.testdir)/." create => "true"; } diff --git a/tests/acceptance/16_cf-serverd/serial/allow_path1_then_deny_path2_b.cf b/tests/acceptance/16_cf-serverd/serial/allow_path1_then_deny_path2_b.cf index 7e8a26dd54..a7a66ac075 100644 --- a/tests/acceptance/16_cf-serverd/serial/allow_path1_then_deny_path2_b.cf +++ b/tests/acceptance/16_cf-serverd/serial/allow_path1_then_deny_path2_b.cf @@ -1,40 +1,54 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { create_directories, default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { create_directories, default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - # source file - G.testdir is denied. - "any" usebundle => file_make("$(G.testdir)/source_file", - "This is the source file to copy $(sys.date) - always fresh"); - # destination files - "any" usebundle => dcs_fini("$(G.testdir)/server1_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/server1_latest"); - "any" usebundle => dcs_fini("$(G.testdir)/server2_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/server2_latest"); - - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_deny_one_directory.srv"); - "any" usebundle => start_server("$(this.promise_dirname)/localhost_deny_one_directory_with_regex.srv"); - - "any" usebundle => run_test("$(this.promise_filename).sub"); - - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_deny_one_directory.srv"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_deny_one_directory_with_regex.srv"); -} + # source file - G.testdir is denied. + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "This is the source file to copy $(sys.date) - always fresh" + ); + + # destination files + "any" usebundle => dcs_fini("$(G.testdir)/server1_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/server1_latest"); + "any" usebundle => dcs_fini("$(G.testdir)/server2_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/server2_latest"); + "any" usebundle => generate_key; + + "any" + usebundle => start_server( + "$(this.promise_dirname)/localhost_deny_one_directory.srv" + ); + + "any" + usebundle => start_server( + "$(this.promise_dirname)/localhost_deny_one_directory_with_regex.srv" + ); + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/localhost_deny_one_directory.srv" + ); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/localhost_deny_one_directory_with_regex.srv" + ); +} # For the access rules in cf-serverd to work recursively, the paths must exist and be directories bundle agent create_directories { files: - "$(G.testroot)/." - create => "true"; - "$(G.testdir)/." - create => "true"; + "$(G.testroot)/." create => "true"; + "$(G.testdir)/." create => "true"; } diff --git a/tests/acceptance/16_cf-serverd/serial/copied_files_can_be_sparse.cf b/tests/acceptance/16_cf-serverd/serial/copied_files_can_be_sparse.cf index 2954415a25..760c7e1c96 100644 --- a/tests/acceptance/16_cf-serverd/serial/copied_files_can_be_sparse.cf +++ b/tests/acceptance/16_cf-serverd/serial/copied_files_can_be_sparse.cf @@ -1,17 +1,17 @@ # The agent writes sparse files when detecting chunks of zeros. Here we # verify that a NULL-filled file, is fully sparse when remotely copied. - body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { meta: - "description" string => "ENT-2769: Test that files written are sparse when possible"; + "description" + string => "ENT-2769: Test that files written are sparse when possible"; # Various exotic filesystems don't support sparseness, see the unit # test "files_copy_test.c" for details. @@ -26,26 +26,28 @@ bundle agent init # Create a 10MB sparse file "/bin/dd" args => "if=/dev/zero of=$(G.testdir)/source_file seek=1024 bs=1024 count=0", - if => not( fileexists( "$(G.testdir)/source_file" )), + if => not(fileexists("$(G.testdir)/source_file")), depends_on => { "init_tidy_sparse" }; } bundle agent test { methods: - # source file is created in "init" bundle + # source file is created in "init" bundle + # ensure destination files are not there + "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + "any" usebundle => generate_key; - # ensure destination files are not there - "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => run_test("$(this.promise_filename).sub"); + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); -# "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); -# "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); -# "any" usebundle => dcs_fini("$(G.testdir)/source_file"); + # "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); + # "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + # "any" usebundle => dcs_fini("$(G.testdir)/source_file"); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_ciphers_fail.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_ciphers_fail.cf index 2122c88c68..9960f9ec5c 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_ciphers_fail.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_ciphers_fail.cf @@ -1,26 +1,44 @@ body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "Source file to copy, always fresh, $(sys.date)"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "Source file to copy, always fresh, $(sys.date)" + ); - # ensure destination files are not there - "any" usebundle => dcs_fini("$(G.testdir)/destfile1"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile2"); + # ensure destination files are not there + "any" usebundle => dcs_fini("$(G.testdir)/destfile1"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile2"); + "any" usebundle => generate_key; - "any" usebundle => generate_key; + "any" + usebundle => start_server( + "$(this.promise_dirname)/nondefault_ciphers_tlsversion.srv" + ); - "any" usebundle => start_server("$(this.promise_dirname)/nondefault_ciphers_tlsversion.srv"); - "any" usebundle => start_server("$(this.promise_dirname)/default_ciphers_tlsversion.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/nondefault_ciphers_tlsversion.srv"); - "any" usebundle => stop_server("$(this.promise_dirname)/default_ciphers_tlsversion.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/default_ciphers_tlsversion.srv" + ); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/nondefault_ciphers_tlsversion.srv" + ); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/default_ciphers_tlsversion.srv" + ); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_ciphers_success.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_ciphers_success.cf index 7d66c4531b..ab1e2652f1 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_ciphers_success.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_ciphers_success.cf @@ -1,30 +1,49 @@ body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10401" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10401" }; methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "Source file to copy, always fresh, $(sys.date)"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "Source file to copy, always fresh, $(sys.date)" + ); - # ensure destination files are not there - "any" usebundle => dcs_fini("$(G.testdir)/destfile1"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile2"); + # ensure destination files are not there + "any" usebundle => dcs_fini("$(G.testdir)/destfile1"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile2"); + "any" usebundle => generate_key; - "any" usebundle => generate_key; + "any" + usebundle => start_server( + "$(this.promise_dirname)/nondefault_ciphers_tlsversion.srv" + ); - "any" usebundle => start_server("$(this.promise_dirname)/nondefault_ciphers_tlsversion.srv"); - "any" usebundle => start_server("$(this.promise_dirname)/default_ciphers_tlsversion.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/nondefault_ciphers_tlsversion.srv"); - "any" usebundle => stop_server("$(this.promise_dirname)/default_ciphers_tlsversion.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/default_ciphers_tlsversion.srv" + ); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/nondefault_ciphers_tlsversion.srv" + ); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/default_ciphers_tlsversion.srv" + ); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_classic_protocol_fail.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_classic_protocol_fail.cf index 3724d1955a..2ce9eafc4b 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_classic_protocol_fail.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_classic_protocol_fail.cf @@ -1,26 +1,44 @@ body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "Source file to copy, always fresh, $(sys.date)"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "Source file to copy, always fresh, $(sys.date)" + ); - # ensure destination files are not there - "any" usebundle => dcs_fini("$(G.testdir)/destfile"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile2"); + # ensure destination files are not there + "any" usebundle => dcs_fini("$(G.testdir)/destfile"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile2"); + "any" usebundle => generate_key; - "any" usebundle => generate_key; + "any" + usebundle => start_server( + "$(this.promise_dirname)/allowlegacyconnects_closed.srv" + ); - "any" usebundle => start_server("$(this.promise_dirname)/allowlegacyconnects_closed.srv"); - "any" usebundle => start_server("$(this.promise_dirname)/allowlegacyconnects_absent.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/allowlegacyconnects_closed.srv"); - "any" usebundle => stop_server("$(this.promise_dirname)/allowlegacyconnects_absent.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/allowlegacyconnects_absent.srv" + ); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/allowlegacyconnects_closed.srv" + ); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/allowlegacyconnects_absent.srv" + ); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_classic_protocol_success.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_classic_protocol_success.cf index 9dd6d5219d..ae3736a38c 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_classic_protocol_success.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_classic_protocol_success.cf @@ -1,23 +1,33 @@ body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "Source file to copy, always fresh, $(sys.date)"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "Source file to copy, always fresh, $(sys.date)" + ); - # ensure destination files are not there - "any" usebundle => dcs_fini("$(G.testdir)/destfile1"); + # ensure destination files are not there + "any" usebundle => dcs_fini("$(G.testdir)/destfile1"); + "any" usebundle => generate_key; - "any" usebundle => generate_key; + "any" + usebundle => start_server( + "$(this.promise_dirname)/allowlegacyconnects_open.srv" + ); - "any" usebundle => start_server("$(this.promise_dirname)/allowlegacyconnects_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/allowlegacyconnects_open.srv"); + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/allowlegacyconnects_open.srv" + ); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_digest_different.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_digest_different.cf index facc774dd6..0ab09beada 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_digest_different.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_digest_different.cf @@ -1,26 +1,42 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10401" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10401" }; methods: - "any" usebundle => file_make("$(G.testdir)/source_file", - "Source and Destination are DIFFERENT_A"); - "any" usebundle => file_make("$(G.testdir)/destfile_latest", - "Source and Destination are DIFFERENT_B"); - "any" usebundle => file_make("$(G.testdir)/destfile_classic", - "Source and Destination are DIFFERENT_C"); - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => file_make( + "$(G.testdir)/source_file", "Source and Destination are DIFFERENT_A" + ); + + "any" + usebundle => file_make( + "$(G.testdir)/destfile_latest", + "Source and Destination are DIFFERENT_B" + ); + + "any" + usebundle => file_make( + "$(G.testdir)/destfile_classic", + "Source and Destination are DIFFERENT_C" + ); + + "any" usebundle => generate_key; + + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_digest_different_expand_ip.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_digest_different_expand_ip.cf index 53c51970b1..b8bfaef310 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_digest_different_expand_ip.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_digest_different_expand_ip.cf @@ -1,24 +1,36 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10401" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10401" }; methods: - "any" usebundle => file_make("$(G.testdir)/127.0.0.1.txt", - "Source and Destination are different_A"); - "any" usebundle => file_make("$(G.testdir)/destination_file", - "Source and Destination are different_B"); - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => file_make( + "$(G.testdir)/127.0.0.1.txt", "Source and Destination are different_A" + ); + + "any" + usebundle => file_make( + "$(G.testdir)/destination_file", + "Source and Destination are different_B" + ); + + "any" usebundle => generate_key; + + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_digest_different_expand_ip_and_shortcut.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_digest_different_expand_ip_and_shortcut.cf index 53c51970b1..b8bfaef310 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_digest_different_expand_ip_and_shortcut.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_digest_different_expand_ip_and_shortcut.cf @@ -1,24 +1,36 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10401" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10401" }; methods: - "any" usebundle => file_make("$(G.testdir)/127.0.0.1.txt", - "Source and Destination are different_A"); - "any" usebundle => file_make("$(G.testdir)/destination_file", - "Source and Destination are different_B"); - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => file_make( + "$(G.testdir)/127.0.0.1.txt", "Source and Destination are different_A" + ); + + "any" + usebundle => file_make( + "$(G.testdir)/destination_file", + "Source and Destination are different_B" + ); + + "any" usebundle => generate_key; + + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_digest_different_expand_shortcut.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_digest_different_expand_shortcut.cf index 236cfe4d8e..2107bb8edf 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_digest_different_expand_shortcut.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_digest_different_expand_shortcut.cf @@ -1,29 +1,44 @@ body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10401" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10401" }; methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "Source and Destination are DIFFERENT_A"); - # destination files - "any" usebundle => file_make("$(G.testdir)/destfile_classic", - "Source and Destination are DIFFERENT_B"); - "any" usebundle => file_make("$(G.testdir)/destfile_latest", - "Source and Destination are DIFFERENT_B"); - - "any" usebundle => generate_key; - - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", "Source and Destination are DIFFERENT_A" + ); + + # destination files + "any" + usebundle => file_make( + "$(G.testdir)/destfile_classic", + "Source and Destination are DIFFERENT_B" + ); + + "any" + usebundle => file_make( + "$(G.testdir)/destfile_latest", + "Source and Destination are DIFFERENT_B" + ); + + "any" usebundle => generate_key; + + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_digest_same.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_digest_same.cf index c14d6cee33..e9577ba26b 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_digest_same.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_digest_same.cf @@ -1,26 +1,38 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - # source files - "any" usebundle => file_make("$(G.testdir)/source_file", - "Source and Destination are identical."); - # destination files - "any" usebundle => file_make("$(G.testdir)/destfile_latest", - "Source and Destination are identical."); - "any" usebundle => file_make("$(G.testdir)/destfile_classic", - "Source and Destination are identical."); + # source files + "any" + usebundle => file_make( + "$(G.testdir)/source_file", "Source and Destination are identical." + ); - "any" usebundle => generate_key; + # destination files + "any" + usebundle => file_make( + "$(G.testdir)/destfile_latest", "Source and Destination are identical." + ); - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => file_make( + "$(G.testdir)/destfile_classic", + "Source and Destination are identical." + ); + + "any" usebundle => generate_key; + + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_digest_same_expand_ip.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_digest_same_expand_ip.cf index d052ed9dbd..c145a240bd 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_digest_same_expand_ip.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_digest_same_expand_ip.cf @@ -1,20 +1,31 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - "any" usebundle => file_make("$(G.testdir)/127.0.0.1.txt", - "Source and Destination are identical."); - "any" usebundle => file_make("$(G.testdir)/destination_file", - "Source and Destination are identical."); - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => file_make( + "$(G.testdir)/127.0.0.1.txt", "Source and Destination are identical." + ); + + "any" + usebundle => file_make( + "$(G.testdir)/destination_file", + "Source and Destination are identical." + ); + + "any" usebundle => generate_key; + + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_digest_same_expand_ip_and_shortcut.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_digest_same_expand_ip_and_shortcut.cf index d052ed9dbd..c145a240bd 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_digest_same_expand_ip_and_shortcut.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_digest_same_expand_ip_and_shortcut.cf @@ -1,20 +1,31 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - "any" usebundle => file_make("$(G.testdir)/127.0.0.1.txt", - "Source and Destination are identical."); - "any" usebundle => file_make("$(G.testdir)/destination_file", - "Source and Destination are identical."); - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => file_make( + "$(G.testdir)/127.0.0.1.txt", "Source and Destination are identical." + ); + + "any" + usebundle => file_make( + "$(G.testdir)/destination_file", + "Source and Destination are identical." + ); + + "any" usebundle => generate_key; + + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_digest_same_expand_shortcut.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_digest_same_expand_shortcut.cf index 10e02d06f6..a9515f395d 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_digest_same_expand_shortcut.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_digest_same_expand_shortcut.cf @@ -1,26 +1,37 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "Source and Destination are identical"); - # destination files - "any" usebundle => file_make("$(G.testdir)/destfile_classic", - "Source and Destination are identical"); - "any" usebundle => file_make("$(G.testdir)/destfile_latest", - "Source and Destination are identical"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", "Source and Destination are identical" + ); - "any" usebundle => generate_key; + # destination files + "any" + usebundle => file_make( + "$(G.testdir)/destfile_classic", "Source and Destination are identical" + ); - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => file_make( + "$(G.testdir)/destfile_latest", "Source and Destination are identical" + ); + + "any" usebundle => generate_key; + + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_encrypted_md5_zero_length_file.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_encrypted_md5_zero_length_file.cf index c5fd0ae45b..d7eee9925e 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_encrypted_md5_zero_length_file.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_encrypted_md5_zero_length_file.cf @@ -1,28 +1,31 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10401" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10401" }; methods: - # source file - "any" usebundle => file_empty("$(G.testdir)/source_file"); - # destination files - "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + # source file + "any" usebundle => file_empty("$(G.testdir)/source_file"); - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + # destination files + "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + "any" usebundle => generate_key; - "any" usebundle => run_test("$(this.promise_filename).sub"); + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_expand_ip_admit_directory_deny_file.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_expand_ip_admit_directory_deny_file.cf index 62053248c6..7e5f52f036 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_expand_ip_admit_directory_deny_file.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_expand_ip_admit_directory_deny_file.cf @@ -1,33 +1,49 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testdir)/127.0.0.1_DIR1/." create => "true"; - "$(G.testdir)/127.0.0.1_DIR2/." create => "true"; + "$(G.testdir)/127.0.0.1_DIR1/." create => "true"; + "$(G.testdir)/127.0.0.1_DIR2/." create => "true"; } bundle agent test { methods: - "any" usebundle => file_make("$(G.testdir)/127.0.0.1_DIR1/ADMIT_FILE", - "ADMIT_FILE A CONTENTS"); - "any" usebundle => file_make("$(G.testdir)/127.0.0.1_DIR1/DENY_FILE", - "DENY_FILE A CONTENTS"); - "any" usebundle => file_make("$(G.testdir)/127.0.0.1_DIR2/ADMIT_FILE", - "ADMIT_FILE B CONTENTS"); - "any" usebundle => file_make("$(G.testdir)/127.0.0.1_DIR2/DENY_FILE", - "DENY_FILE B CONTENTS"); - "any" usebundle => dcs_fini("$(G.testdir)/destination_file1"); - "any" usebundle => dcs_fini("$(G.testdir)/destination_file2"); - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => file_make( + "$(G.testdir)/127.0.0.1_DIR1/ADMIT_FILE", "ADMIT_FILE A CONTENTS" + ); + + "any" + usebundle => file_make( + "$(G.testdir)/127.0.0.1_DIR1/DENY_FILE", "DENY_FILE A CONTENTS" + ); + + "any" + usebundle => file_make( + "$(G.testdir)/127.0.0.1_DIR2/ADMIT_FILE", "ADMIT_FILE B CONTENTS" + ); + + "any" + usebundle => file_make( + "$(G.testdir)/127.0.0.1_DIR2/DENY_FILE", "DENY_FILE B CONTENTS" + ); + + "any" usebundle => dcs_fini("$(G.testdir)/destination_file1"); + "any" usebundle => dcs_fini("$(G.testdir)/destination_file2"); + "any" usebundle => generate_key; + + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_expand_ip_directory.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_expand_ip_directory.cf index 759fa975f6..49befcec05 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_expand_ip_directory.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_expand_ip_directory.cf @@ -1,37 +1,54 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { files: - "$(G.testdir)/127.0.0.1_DIR1/." create => "true"; - "$(G.testdir)/127.0.0.1_DIR2/." create => "true"; + "$(G.testdir)/127.0.0.1_DIR1/." create => "true"; + "$(G.testdir)/127.0.0.1_DIR2/." create => "true"; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10401" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10401" }; methods: - "any" usebundle => file_make("$(G.testdir)/127.0.0.1_DIR1/ADMIT_FILE", - "ADMIT_FILE A CONTENTS"); - "any" usebundle => file_make("$(G.testdir)/127.0.0.1_DIR1/DENY_FILE", - "DENY_FILE A CONTENTS"); - "any" usebundle => file_make("$(G.testdir)/127.0.0.1_DIR2/ADMIT_FILE", - "ADMIT_FILE B CONTENTS"); - "any" usebundle => file_make("$(G.testdir)/127.0.0.1_DIR2/DENY_FILE", - "DENY_FILE B CONTENTS"); - "any" usebundle => dcs_fini("$(G.testdir)/destination_file1"); - "any" usebundle => dcs_fini("$(G.testdir)/destination_file2"); - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => file_make( + "$(G.testdir)/127.0.0.1_DIR1/ADMIT_FILE", "ADMIT_FILE A CONTENTS" + ); + + "any" + usebundle => file_make( + "$(G.testdir)/127.0.0.1_DIR1/DENY_FILE", "DENY_FILE A CONTENTS" + ); + + "any" + usebundle => file_make( + "$(G.testdir)/127.0.0.1_DIR2/ADMIT_FILE", "ADMIT_FILE B CONTENTS" + ); + + "any" + usebundle => file_make( + "$(G.testdir)/127.0.0.1_DIR2/DENY_FILE", "DENY_FILE B CONTENTS" + ); + + "any" usebundle => dcs_fini("$(G.testdir)/destination_file1"); + "any" usebundle => dcs_fini("$(G.testdir)/destination_file2"); + "any" usebundle => generate_key; + + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_inexistent_file_connection_closed-classic_protocol.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_inexistent_file_connection_closed-classic_protocol.cf index 6f581f999b..53bdc0308b 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_inexistent_file_connection_closed-classic_protocol.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_inexistent_file_connection_closed-classic_protocol.cf @@ -1,31 +1,36 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10401" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10401" }; methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "This is the source file to copy $(sys.date) - always fresh"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "This is the source file to copy $(sys.date) - always fresh" + ); - # ensure destination files are not there - "any" usebundle => dcs_fini("$(G.testdir)/destfile1"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile2"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile3"); + # ensure destination files are not there + "any" usebundle => dcs_fini("$(G.testdir)/destfile1"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile2"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile3"); + "any" usebundle => generate_key; - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); + "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_inexistent_file_connection_closed.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_inexistent_file_connection_closed.cf index 6f581f999b..53bdc0308b 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_inexistent_file_connection_closed.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_inexistent_file_connection_closed.cf @@ -1,31 +1,36 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10401" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10401" }; methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "This is the source file to copy $(sys.date) - always fresh"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "This is the source file to copy $(sys.date) - always fresh" + ); - # ensure destination files are not there - "any" usebundle => dcs_fini("$(G.testdir)/destfile1"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile2"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile3"); + # ensure destination files are not there + "any" usebundle => dcs_fini("$(G.testdir)/destfile1"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile2"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile3"); + "any" usebundle => generate_key; - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); + "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_md5_zero_length_file.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_md5_zero_length_file.cf index c5fd0ae45b..d7eee9925e 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_md5_zero_length_file.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_md5_zero_length_file.cf @@ -1,28 +1,31 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10401" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10401" }; methods: - # source file - "any" usebundle => file_empty("$(G.testdir)/source_file"); - # destination files - "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + # source file + "any" usebundle => file_empty("$(G.testdir)/source_file"); - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + # destination files + "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + "any" usebundle => generate_key; - "any" usebundle => run_test("$(this.promise_filename).sub"); + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_reordered_ciphers_success.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_reordered_ciphers_success.cf index 3fba4cb3d5..117ffc2a22 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_reordered_ciphers_success.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_reordered_ciphers_success.cf @@ -1,23 +1,33 @@ body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "Source file to copy, always fresh, $(sys.date)"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "Source file to copy, always fresh, $(sys.date)" + ); - # ensure destination files are not there - "any" usebundle => dcs_fini("$(G.testdir)/destfile1"); + # ensure destination files are not there + "any" usebundle => dcs_fini("$(G.testdir)/destfile1"); + "any" usebundle => generate_key; - "any" usebundle => generate_key; + "any" + usebundle => start_server( + "$(this.promise_dirname)/reordered_default_ciphers_tlsversion.srv" + ); - "any" usebundle => start_server("$(this.promise_dirname)/reordered_default_ciphers_tlsversion.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/reordered_default_ciphers_tlsversion.srv"); + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/reordered_default_ciphers_tlsversion.srv" + ); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_tls_1_3_fail.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_tls_1_3_fail.cf index 11c4bb9204..2ba68f036e 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_tls_1_3_fail.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_tls_1_3_fail.cf @@ -1,35 +1,46 @@ body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_skip_unsupported" string => "!feature_tls_1_3"; + "test_skip_unsupported" string => "!feature_tls_1_3"; - "description" -> {"ENT-4617"} - string => "Test that requiring TLS 1.3 works fine"; + "description" -> { "ENT-4617" } + string => "Test that requiring TLS 1.3 works fine"; - "test_soft_fail" string => "windows", - meta => { "ENT-10401" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10401" }; methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "Source file to copy, always fresh, $(sys.date)"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "Source file to copy, always fresh, $(sys.date)" + ); - # ensure destination files are not there - "any" usebundle => dcs_fini("$(G.testdir)/destfile1"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile2"); + # ensure destination files are not there + "any" usebundle => dcs_fini("$(G.testdir)/destfile1"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile2"); + "any" usebundle => generate_key; + "any" usebundle => start_server("$(this.promise_dirname)/no_tls_1_3.srv"); - "any" usebundle => generate_key; + "any" + usebundle => start_server( + "$(this.promise_dirname)/default_ciphers_tlsversion.srv" + ); - "any" usebundle => start_server("$(this.promise_dirname)/no_tls_1_3.srv"); - "any" usebundle => start_server("$(this.promise_dirname)/default_ciphers_tlsversion.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/no_tls_1_3.srv"); - "any" usebundle => stop_server("$(this.promise_dirname)/default_ciphers_tlsversion.srv"); + "any" usebundle => run_test("$(this.promise_filename).sub"); + "any" usebundle => stop_server("$(this.promise_dirname)/no_tls_1_3.srv"); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/default_ciphers_tlsversion.srv" + ); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_from_tls_1_3_success.cf b/tests/acceptance/16_cf-serverd/serial/copy_from_tls_1_3_success.cf index 5f3b455f78..a03ab272b7 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_from_tls_1_3_success.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_from_tls_1_3_success.cf @@ -1,34 +1,46 @@ body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_skip_unsupported" string => "!feature_tls_1_3"; + "test_skip_unsupported" string => "!feature_tls_1_3"; - "description" -> {"ENT-4617"} - string => "Test that CFEngine connections over TLS 1.3 work fine"; + "description" -> { "ENT-4617" } + string => "Test that CFEngine connections over TLS 1.3 work fine"; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10401" }; - "test_soft_fail" string => "windows", - meta => { "ENT-10401" }; methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "Source file to copy, always fresh, $(sys.date)"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "Source file to copy, always fresh, $(sys.date)" + ); + + # ensure destination files are not there + "any" usebundle => dcs_fini("$(G.testdir)/destfile1"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile2"); + "any" usebundle => generate_key; + "any" usebundle => start_server("$(this.promise_dirname)/tls_1_3_only.srv"); - # ensure destination files are not there - "any" usebundle => dcs_fini("$(G.testdir)/destfile1"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile2"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/default_ciphers_tlsversion.srv" + ); - "any" usebundle => generate_key; + "any" usebundle => run_test("$(this.promise_filename).sub"); + "any" usebundle => stop_server("$(this.promise_dirname)/tls_1_3_only.srv"); - "any" usebundle => start_server("$(this.promise_dirname)/tls_1_3_only.srv"); - "any" usebundle => start_server("$(this.promise_dirname)/default_ciphers_tlsversion.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/tls_1_3_only.srv"); - "any" usebundle => stop_server("$(this.promise_dirname)/default_ciphers_tlsversion.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/default_ciphers_tlsversion.srv" + ); } diff --git a/tests/acceptance/16_cf-serverd/serial/copy_missing_ok.cf b/tests/acceptance/16_cf-serverd/serial/copy_missing_ok.cf index ca4f8f0f9f..13c5c5cab6 100644 --- a/tests/acceptance/16_cf-serverd/serial/copy_missing_ok.cf +++ b/tests/acceptance/16_cf-serverd/serial/copy_missing_ok.cf @@ -1,32 +1,42 @@ body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10401" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10401" }; methods: - # ensure destination files are not there - "any" usebundle => dcs_fini("$(G.testdir)/dir"); - "any" usebundle => dcs_fini("$(G.testdir)/out"); - "any" usebundle => dcs_fini("$(G.testdir)/nodir/does_not_exist"); + # ensure destination files are not there + "any" usebundle => dcs_fini("$(G.testdir)/dir"); + "any" usebundle => dcs_fini("$(G.testdir)/out"); + "any" usebundle => dcs_fini("$(G.testdir)/nodir/does_not_exist"); - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "Source file to copy, always fresh, $(sys.date)"); - "any" usebundle => file_make("$(G.testdir)/out/dummy", - "dummy file to create output dir"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "Source file to copy, always fresh, $(sys.date)" + ); - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => file_make( + "$(G.testdir)/out/dummy", "dummy file to create output dir" + ); - "any" usebundle => run_test("$(this.promise_filename).sub"); + "any" usebundle => generate_key; - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); + "any" + usebundle => start_server("$(this.promise_dirname)/localhost_open.srv"); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server("$(this.promise_dirname)/localhost_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/network/004.cf b/tests/acceptance/16_cf-serverd/serial/network/004.cf index c68256ceb1..adfd2e6c8f 100644 --- a/tests/acceptance/16_cf-serverd/serial/network/004.cf +++ b/tests/acceptance/16_cf-serverd/serial/network/004.cf @@ -1,23 +1,25 @@ -# body common control { - inputs => { "../../../default.sub.cf", "../../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../../default.sub.cf", "../../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "This is the source file to copy $(sys.date) - always fresh"); - # destination files - "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "This is the source file to copy $(sys.date) - always fresh" + ); - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/lan_open.srv"); - "any" usebundle => run_test("$(this.promise_filename).sub"); - "any" usebundle => stop_server("$(this.promise_dirname)/lan_open.srv"); + # destination files + "any" usebundle => dcs_fini("$(G.testdir)/destfile_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/destfile_latest"); + "any" usebundle => generate_key; + "any" usebundle => start_server("$(this.promise_dirname)/lan_open.srv"); + "any" usebundle => run_test("$(this.promise_filename).sub"); + "any" usebundle => stop_server("$(this.promise_dirname)/lan_open.srv"); } diff --git a/tests/acceptance/16_cf-serverd/serial/simple_copy_from_admit_localhost.cf b/tests/acceptance/16_cf-serverd/serial/simple_copy_from_admit_localhost.cf index 71d23c31f1..219e19841f 100644 --- a/tests/acceptance/16_cf-serverd/serial/simple_copy_from_admit_localhost.cf +++ b/tests/acceptance/16_cf-serverd/serial/simple_copy_from_admit_localhost.cf @@ -1,41 +1,60 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_suppress_fail" string => "windows", - meta => { "redmine6405", "ENT-2480"}; + "test_suppress_fail" + string => "windows", + meta => { "redmine6405", "ENT-2480" }; - # Ubuntu 20 (at least our build machines) doesn't know how to resolve - # 127.0.0.1/::1 to localhost, the reverse lookup fails and so - # 'admit => { "localhost" };' and 'admit_hostnames => { "localhost" };' - # are not enough to allow access for this test. - # Test fails on SLES / OpenSUSE 15, pending investigation. - "test_skip_unsupported" string => "(ubuntu_20|ubuntu_22|debian_12|sles_15|opensuse_leap_15)", - meta => { "ENT-2480", "ENT-7362", "ENT-9055" }; + # Ubuntu 20 (at least our build machines) doesn't know how to resolve + # 127.0.0.1/::1 to localhost, the reverse lookup fails and so + # 'admit => { "localhost" };' and 'admit_hostnames => { "localhost" };' + # are not enough to allow access for this test. + # Test fails on SLES / OpenSUSE 15, pending investigation. + "test_skip_unsupported" + string => "(ubuntu_20|ubuntu_22|debian_12|sles_15|opensuse_leap_15)", + meta => { "ENT-2480", "ENT-7362", "ENT-9055" }; methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "This is the source file to copy $(sys.date) - always fresh"); - # destination files - "any" usebundle => dcs_fini("$(G.testdir)/server1_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/server1_latest"); - "any" usebundle => dcs_fini("$(G.testdir)/server2_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/server2_latest"); - - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open_hostname.srv"); - "any" usebundle => start_server("$(this.promise_dirname)/localhost_open_admit_hostnames.srv"); - - "any" usebundle => run_test("$(this.promise_filename).sub"); - - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open_hostname.srv"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_open_admit_hostnames.srv"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "This is the source file to copy $(sys.date) - always fresh" + ); + + # destination files + "any" usebundle => dcs_fini("$(G.testdir)/server1_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/server1_latest"); + "any" usebundle => dcs_fini("$(G.testdir)/server2_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/server2_latest"); + "any" usebundle => generate_key; + + "any" + usebundle => start_server( + "$(this.promise_dirname)/localhost_open_hostname.srv" + ); + + "any" + usebundle => start_server( + "$(this.promise_dirname)/localhost_open_admit_hostnames.srv" + ); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/localhost_open_hostname.srv" + ); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/localhost_open_admit_hostnames.srv" + ); } diff --git a/tests/acceptance/16_cf-serverd/serial/simple_copy_from_deny_localhost.cf b/tests/acceptance/16_cf-serverd/serial/simple_copy_from_deny_localhost.cf index 5cce7403f1..3a381fe705 100644 --- a/tests/acceptance/16_cf-serverd/serial/simple_copy_from_deny_localhost.cf +++ b/tests/acceptance/16_cf-serverd/serial/simple_copy_from_deny_localhost.cf @@ -1,41 +1,60 @@ -# body common control { - inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { meta: - "test_suppress_fail" string => "windows", - meta => { "redmine6405", "ENT-2480"}; + "test_suppress_fail" + string => "windows", + meta => { "redmine6405", "ENT-2480" }; - # Ubuntu 20 (at least our build machines) doesn't know how to resolve - # 127.0.0.1/::1 to localhost, the reverse lookup fails and so - # 'deny => { "localhost" };' and 'deny_hostnames => { "localhost" };' - # are not enough to deny access for this test. - # Test fails on SLES / OpenSUSE 15, pending investigation. - "test_skip_unsupported" string => "(ubuntu_20|ubuntu_22|debian_12|sles_15|opensuse_leap_15)", - meta => { "ENT-2480", "ENT-7362", "ENT-9055" }; + # Ubuntu 20 (at least our build machines) doesn't know how to resolve + # 127.0.0.1/::1 to localhost, the reverse lookup fails and so + # 'deny => { "localhost" };' and 'deny_hostnames => { "localhost" };' + # are not enough to deny access for this test. + # Test fails on SLES / OpenSUSE 15, pending investigation. + "test_skip_unsupported" + string => "(ubuntu_20|ubuntu_22|debian_12|sles_15|opensuse_leap_15)", + meta => { "ENT-2480", "ENT-7362", "ENT-9055" }; methods: - # source file - "any" usebundle => file_make("$(G.testdir)/source_file", - "This is the source file to copy $(sys.date) - always fresh"); - # destination files - "any" usebundle => dcs_fini("$(G.testdir)/server1_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/server1_latest"); - "any" usebundle => dcs_fini("$(G.testdir)/server2_classic"); - "any" usebundle => dcs_fini("$(G.testdir)/server2_latest"); - - "any" usebundle => generate_key; - "any" usebundle => start_server("$(this.promise_dirname)/localhost_closed_hostname.srv"); - "any" usebundle => start_server("$(this.promise_dirname)/localhost_closed_deny_hostnames.srv"); - - "any" usebundle => run_test("$(this.promise_filename).sub"); - - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_closed_hostname.srv"); - "any" usebundle => stop_server("$(this.promise_dirname)/localhost_closed_deny_hostnames.srv"); + # source file + "any" + usebundle => file_make( + "$(G.testdir)/source_file", + "This is the source file to copy $(sys.date) - always fresh" + ); + + # destination files + "any" usebundle => dcs_fini("$(G.testdir)/server1_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/server1_latest"); + "any" usebundle => dcs_fini("$(G.testdir)/server2_classic"); + "any" usebundle => dcs_fini("$(G.testdir)/server2_latest"); + "any" usebundle => generate_key; + + "any" + usebundle => start_server( + "$(this.promise_dirname)/localhost_closed_hostname.srv" + ); + + "any" + usebundle => start_server( + "$(this.promise_dirname)/localhost_closed_deny_hostnames.srv" + ); + + "any" usebundle => run_test("$(this.promise_filename).sub"); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/localhost_closed_hostname.srv" + ); + + "any" + usebundle => stop_server( + "$(this.promise_dirname)/localhost_closed_deny_hostnames.srv" + ); } diff --git a/tests/acceptance/16_cf-serverd/serial/tcp_port_copy_from_within_range.cf b/tests/acceptance/16_cf-serverd/serial/tcp_port_copy_from_within_range.cf index 4bb8079dcf..9d248d270a 100644 --- a/tests/acceptance/16_cf-serverd/serial/tcp_port_copy_from_within_range.cf +++ b/tests/acceptance/16_cf-serverd/serial/tcp_port_copy_from_within_range.cf @@ -1,22 +1,19 @@ -# # Check the parser enforces standard TCP port ( 1 <= port <= 65535) for: # -copy_from bodies "portnumber" -# - body common control { - bundlesequence => { default("$(this.promise_filename)") }; - inputs => { "../../default.sub.cf" }; - version => "1.0"; + bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + version => "1.0"; } bundle agent test { reports: - "$(this.promise_filename) Pass"; + "$(this.promise_filename) Pass"; } body copy_from dummy_copy_from { - portnumber => "5308"; + portnumber => "5308"; } diff --git a/tests/acceptance/16_cf-serverd/serial/tcp_port_listen_within_range.cf b/tests/acceptance/16_cf-serverd/serial/tcp_port_listen_within_range.cf index 18548af4ed..357fbdd9ef 100644 --- a/tests/acceptance/16_cf-serverd/serial/tcp_port_listen_within_range.cf +++ b/tests/acceptance/16_cf-serverd/serial/tcp_port_listen_within_range.cf @@ -1,8 +1,5 @@ -# # Check the parser enforces standard TCP port ( 1 <= port <= 65535) for: # -cf-serverd listening port -# - body common control { bundlesequence => { default("$(this.promise_filename)") }; diff --git a/tests/acceptance/17_users/unsafe/05_hpux_set_non_trusted_mode.cf b/tests/acceptance/17_users/unsafe/05_hpux_set_non_trusted_mode.cf index 9681da00dd..6141117605 100644 --- a/tests/acceptance/17_users/unsafe/05_hpux_set_non_trusted_mode.cf +++ b/tests/acceptance/17_users/unsafe/05_hpux_set_non_trusted_mode.cf @@ -1,20 +1,19 @@ # Not a test, but just setting up non-trusted mode on HPUX. - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { meta: - "test_skip_unsupported" string => "!hpux"; + "test_skip_unsupported" string => "!hpux"; classes: - "non_trusted_mode" - not => fileexists("/etc/shadow"), - scope => "namespace"; + "non_trusted_mode" + not => fileexists("/etc/shadow"), + scope => "namespace"; commands: !not_trusted_mode:: @@ -26,6 +25,7 @@ bundle agent check reports: non_trusted_mode:: "$(this.promise_filename) Pass"; + !non_trusted_mode:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_add_user.cf b/tests/acceptance/17_users/unsafe/10_add_user.cf index f5eb7b996f..29c0de1c90 100644 --- a/tests/acceptance/17_users/unsafe/10_add_user.cf +++ b/tests/acceptance/17_users/unsafe/10_add_user.cf @@ -1,53 +1,49 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user not present gets added"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; } ####################################################### - bundle agent test { users: - "johndoe" - policy => "present"; + "johndoe" policy => "present"; } ####################################################### - bundle agent check { methods: - "any" usebundle => user_exists("johndoe", "success", "failure"), + "any" + usebundle => user_exists("johndoe", "success", "failure"), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_add_user_locked.cf b/tests/acceptance/17_users/unsafe/10_add_user_locked.cf index d25048c7f2..99db1b179f 100644 --- a/tests/acceptance/17_users/unsafe/10_add_user_locked.cf +++ b/tests/acceptance/17_users/unsafe/10_add_user_locked.cf @@ -1,63 +1,59 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added locked"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user not present gets added locked"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; } ####################################################### - bundle agent test { users: - "johndoe" - policy => "locked"; + "johndoe" policy => "locked"; } ####################################################### - bundle agent check { methods: - "any" usebundle => user_is_locked("johndoe", "success", "failure"), + "any" + usebundle => user_is_locked("johndoe", "success", "failure"), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_add_user_locked_with_password.cf b/tests/acceptance/17_users/unsafe/10_add_user_locked_with_password.cf index c00b3633ba..b9b03d313a 100644 --- a/tests/acceptance/17_users/unsafe/10_add_user_locked_with_password.cf +++ b/tests/acceptance/17_users/unsafe/10_add_user_locked_with_password.cf @@ -1,40 +1,38 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added locked with password"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" + string => "A user not present gets added locked with password"; + + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; } ####################################################### - bundle agent test { vars: @@ -53,20 +51,21 @@ body password test_password } ####################################################### - bundle agent check { methods: - "any" usebundle => user_is_locked("johndoe", "success", "failure"), + "any" + usebundle => user_is_locked("johndoe", "success", "failure"), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_add_user_warn.cf b/tests/acceptance/17_users/unsafe/10_add_user_warn.cf index 47dbf431be..4d463132ad 100644 --- a/tests/acceptance/17_users/unsafe/10_add_user_warn.cf +++ b/tests/acceptance/17_users/unsafe/10_add_user_warn.cf @@ -1,31 +1,27 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added (dry run only)"; - "story_id" string => "5525"; - "covers" string => "dryrun_repaired"; + "description" string => "A user not present gets added (dry run only)"; + "story_id" string => "5525"; + "covers" string => "dryrun_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; } ####################################################### - bundle agent test { users: @@ -40,20 +36,21 @@ body action test_action } ####################################################### - bundle agent check { methods: - "any" usebundle => user_exists("johndoe", "failure", "success"), + "any" + usebundle => user_exists("johndoe", "failure", "success"), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_add_user_with_description.cf b/tests/acceptance/17_users/unsafe/10_add_user_with_description.cf index f0900b97ad..7e7e380970 100644 --- a/tests/acceptance/17_users/unsafe/10_add_user_with_description.cf +++ b/tests/acceptance/17_users/unsafe/10_add_user_with_description.cf @@ -1,35 +1,32 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added with description"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user not present gets added with description"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; } ####################################################### - bundle agent test { vars: - "desc_string" string => "This description should make the CFEngine test pass"; + "desc_string" + string => "This description should make the CFEngine test pass"; users: "johndoe" @@ -38,20 +35,23 @@ bundle agent test } ####################################################### - bundle agent check { methods: - "any" usebundle => user_has_description("johndoe", "$(test.desc_string)", "success", "failure"), + "any" + usebundle => user_has_description( + "johndoe", "$(test.desc_string)", "success", "failure" + ), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_add_user_with_hashed_password.cf b/tests/acceptance/17_users/unsafe/10_add_user_with_hashed_password.cf index b09b7c7bc7..dca067d2f6 100644 --- a/tests/acceptance/17_users/unsafe/10_add_user_with_hashed_password.cf +++ b/tests/acceptance/17_users/unsafe/10_add_user_with_hashed_password.cf @@ -1,41 +1,37 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added with password"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user not present gets added with password"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; } ####################################################### - bundle agent test { vars: @@ -54,21 +50,24 @@ body password test_password } ####################################################### - bundle agent check { methods: - "any" usebundle => user_has_password_hash("johndoe", "$(test.hash)", "success", "failure"), + "any" + usebundle => user_has_password_hash( + "johndoe", "$(test.hash)", "success", "failure" + ), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: # Password hash unsupported on Windows. (ok.ready)|windows:: "$(this.promise_filename) Pass"; + (!ok.ready).!windows:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_add_user_with_many_attributes.cf b/tests/acceptance/17_users/unsafe/10_add_user_with_many_attributes.cf index 345d951963..d7f001b9c3 100644 --- a/tests/acceptance/17_users/unsafe/10_add_user_with_many_attributes.cf +++ b/tests/acceptance/17_users/unsafe/10_add_user_with_many_attributes.cf @@ -1,48 +1,49 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added with several attributes"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" + string => "A user not present gets added with several attributes"; + + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; } ####################################################### - bundle agent test { vars: - "desc_string" string => "This description should make the CFEngine test pass"; + "desc_string" + string => "This description should make the CFEngine test pass"; + aix:: # AIX only allows certain shells. "shell" string => "/bin/csh"; + !aix:: "shell" string => "$(G.echo)"; @@ -58,46 +59,86 @@ bundle agent test } ####################################################### - bundle agent check { methods: - "any" usebundle => remove_stale_groups; + "any" usebundle => remove_stale_groups; methods: - "any" usebundle => user_has_uid("johndoe", "9876", "uid_success", "uid_failure"), + "any" + usebundle => user_has_uid( + "johndoe", "9876", "uid_success", "uid_failure" + ), classes => always("uid_methods_run"); - "any" usebundle => user_is_in_primary_group("johndoe", "$(user_tests.group1)", "pgroup_success", "pgroup_failure"), + "any" + usebundle => user_is_in_primary_group( + "johndoe", "$(user_tests.group1)", "pgroup_success", "pgroup_failure" + ), classes => always("pgroup_methods_run"); - "any" usebundle => user_is_in_secondary_group("johndoe", "$(user_tests.group2)", "sgroup_success", "sgroup_failure"), + "any" + usebundle => user_is_in_secondary_group( + "johndoe", "$(user_tests.group2)", "sgroup_success", "sgroup_failure" + ), classes => always("sgroup_methods_run"); - "any" usebundle => user_has_home_dir("johndoe", "/home/user-johndoe", "home_success", "home_failure"), + "any" + usebundle => user_has_home_dir( + "johndoe", "/home/user-johndoe", "home_success", "home_failure" + ), classes => always("home_methods_run"); - "any" usebundle => user_has_shell("johndoe", "$(test.shell)", "shell_success", "shell_failure"), + "any" + usebundle => user_has_shell( + "johndoe", "$(test.shell)", "shell_success", "shell_failure" + ), classes => always("shell_methods_run"); - "any" usebundle => user_has_description("johndoe", "$(test.desc_string)", "desc_success", "desc_failure"), + "any" + usebundle => user_has_description( + "johndoe", "$(test.desc_string)", "desc_success", "desc_failure" + ), classes => always("desc_methods_run"); classes: - "ready" and => { "uid_methods_run", "pgroup_methods_run", "sgroup_methods_run", - "home_methods_run", "shell_methods_run", "desc_methods_run" }; + "ready" + and => { + "uid_methods_run", + "pgroup_methods_run", + "sgroup_methods_run", + "home_methods_run", + "shell_methods_run", + "desc_methods_run", + }; + !windows:: - "unix_ok" and => { "uid_success", "!uid_failure", "shell_success", "!shell_failure", }; + "unix_ok" + and => { + "uid_success", "!uid_failure", "shell_success", "!shell_failure", + }; + windows:: "unix_ok" expression => "any"; + any:: - "ok" and => { "pgroup_success", "!pgroup_failure", "sgroup_success", "!sgroup_failure", - "home_success", "!home_failure", "desc_success", "!desc_failure", - "unix_ok" }; + "ok" + and => { + "pgroup_success", + "!pgroup_failure", + "sgroup_success", + "!sgroup_failure", + "home_success", + "!home_failure", + "desc_success", + "!desc_failure", + "unix_ok", + }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_add_user_with_many_attributes_warn.cf b/tests/acceptance/17_users/unsafe/10_add_user_with_many_attributes_warn.cf index 9968697813..1162d7ba7b 100644 --- a/tests/acceptance/17_users/unsafe/10_add_user_with_many_attributes_warn.cf +++ b/tests/acceptance/17_users/unsafe/10_add_user_with_many_attributes_warn.cf @@ -1,45 +1,44 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added with multiple attributes (dry run only)"; - "story_id" string => "5525"; - "covers" string => "dryrun_repaired"; + "description" + string => "A user not present gets added with multiple attributes (dry run only)"; + + "story_id" string => "5525"; + "covers" string => "dryrun_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; } ####################################################### - bundle agent test { vars: - "desc_string" string => "This description should make the CFEngine test pass"; + "desc_string" + string => "This description should make the CFEngine test pass"; users: "johndoe" @@ -65,20 +64,21 @@ body password test_password } ####################################################### - bundle agent check { methods: - "any" usebundle => user_exists("johndoe", "failure", "success"), + "any" + usebundle => user_exists("johndoe", "failure", "success"), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_add_user_with_many_empty_attributes.cf b/tests/acceptance/17_users/unsafe/10_add_user_with_many_empty_attributes.cf index 7d2ecc0ccd..95cf0785bd 100644 --- a/tests/acceptance/17_users/unsafe/10_add_user_with_many_empty_attributes.cf +++ b/tests/acceptance/17_users/unsafe/10_add_user_with_many_empty_attributes.cf @@ -1,68 +1,82 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added with several empty attributes"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" + string => "A user not present gets added with several empty attributes"; + + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; } ####################################################### - bundle agent test { users: "johndoe" policy => "present", group_primary => "", - groups_secondary => { }, + groups_secondary => {}, description => "", classes => if_ok("promise_ok"); } ####################################################### - bundle agent check { methods: aix:: # AIX forcibly puts a user in the staff group, even if no group is specified. - "any" usebundle => user_is_in_secondary_group("johndoe", "staff", "sgroup_success", "sgroup_failure"), + "any" + usebundle => user_is_in_secondary_group( + "johndoe", "staff", "sgroup_success", "sgroup_failure" + ), classes => always("sgroup_methods_run"); !aix:: - "any" usebundle => user_is_in_any_secondary_group("johndoe", "sgroup_failure", "sgroup_success"), + "any" + usebundle => user_is_in_any_secondary_group( + "johndoe", "sgroup_failure", "sgroup_success" + ), classes => always("sgroup_methods_run"); any:: - "any" usebundle => user_has_description("johndoe", "", "desc_success", "desc_failure"), + "any" + usebundle => user_has_description( + "johndoe", "", "desc_success", "desc_failure" + ), classes => always("desc_methods_run"); classes: - "ready" and => { "sgroup_methods_run", "desc_methods_run" }; - "ok" and => { "sgroup_success", "!sgroup_failure", - "desc_success", "!desc_failure", "promise_ok" }; + "ready" and => { "sgroup_methods_run", "desc_methods_run" }; + + "ok" + and => { + "sgroup_success", + "!sgroup_failure", + "desc_success", + "!desc_failure", + "promise_ok", + }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_add_user_with_password.cf b/tests/acceptance/17_users/unsafe/10_add_user_with_password.cf index 37239464bc..ddd640d750 100644 --- a/tests/acceptance/17_users/unsafe/10_add_user_with_password.cf +++ b/tests/acceptance/17_users/unsafe/10_add_user_with_password.cf @@ -1,41 +1,37 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added with password"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user not present gets added with password"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; } ####################################################### - bundle agent test { users: @@ -51,32 +47,46 @@ body password test_password } ####################################################### - bundle agent check { methods: !windows:: - "any" usebundle => user_get_password_hash("johndoe"), + "any" + usebundle => user_get_password_hash("johndoe"), classes => always("methods_run"); + windows:: - "any" usebundle => user_has_password("johndoe", "J0hnd0eX", "pw_ok", "pw_fail"), + "any" + usebundle => user_has_password( + "johndoe", "J0hnd0eX", "pw_ok", "pw_fail" + ), classes => always("methods_run"); any:: - "any" usebundle => user_does_not_need_password_update("johndoe", "no_pw_update_ok", "no_pw_update_fail"); + "any" + usebundle => user_does_not_need_password_update( + "johndoe", "no_pw_update_ok", "no_pw_update_fail" + ); classes: - "ready" expression => "methods_run"; + "ready" expression => "methods_run"; + !windows:: # Make sure the password field has grown to more than a few characters. - "pw_ok" expression => regcmp("^[^:][^:][^:][^:][^:][^:][^:][^:][^:][^:].*", "$(user_get_password_hash.hash)"); + "pw_ok" + expression => regcmp( + "^[^:][^:][^:][^:][^:][^:][^:][^:][^:][^:].*", + "$(user_get_password_hash.hash)" + ); any:: - "ok" and => { "pw_ok", "!pw_fail", "no_pw_update_ok", "!no_pw_update_fail" }; + "ok" + and => { "pw_ok", "!pw_fail", "no_pw_update_ok", "!no_pw_update_fail" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_add_user_with_primary_gid.cf b/tests/acceptance/17_users/unsafe/10_add_user_with_primary_gid.cf index 8f7e214345..8d9a0199ca 100644 --- a/tests/acceptance/17_users/unsafe/10_add_user_with_primary_gid.cf +++ b/tests/acceptance/17_users/unsafe/10_add_user_with_primary_gid.cf @@ -1,41 +1,40 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added with primary group id"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" + string => "A user not present gets added with primary group id"; + + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", - "user_queries.cf.sub", - "disable_sudo_tty_requirement.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { + "../../default.sub.cf", + "user_queries.cf.sub", + "disable_sudo_tty_requirement.cf.sub", + }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { meta: - # No GIDs on Windows. - "test_skip_unsupported" string => "windows"; + # No GIDs on Windows. + "test_skip_unsupported" string => "windows"; # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; methods: - "any" usebundle => disable_sudo_tty_requirement; + "any" usebundle => disable_sudo_tty_requirement; } body delete init_delete @@ -44,7 +43,6 @@ body delete init_delete } ####################################################### - body contain test_contain_body { useshell => "useshell"; @@ -59,12 +57,10 @@ bundle agent test commands: sudo_works:: - "sudo -u johndoe $(G.touch) $(G.testfile)" - contain => test_contain_body; + "sudo -u johndoe $(G.touch) $(G.testfile)" contain => test_contain_body; } ####################################################### - body perms check_perms_body { groups => { "$(user_tests.gid1)" }; @@ -79,10 +75,13 @@ body classes check_classes_body bundle agent check { methods: - "any" usebundle => remove_stale_groups; + "any" usebundle => remove_stale_groups; methods: - "any" usebundle => user_is_in_primary_group("johndoe", "$(user_tests.group1)", "success", "failure"), + "any" + usebundle => user_is_in_primary_group( + "johndoe", "$(user_tests.group1)", "success", "failure" + ), classes => always("methods_run"); files: @@ -91,15 +90,18 @@ bundle agent check classes => check_classes_body; classes: - "ready" expression => "methods_run"; + "ready" expression => "methods_run"; + sudo_works:: "ok" and => { "success", "!failure", "perms_ok", "!perms_not_ok" }; + !sudo_works:: "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_add_user_with_primary_group.cf b/tests/acceptance/17_users/unsafe/10_add_user_with_primary_group.cf index 3259a22f19..8f65556cfe 100644 --- a/tests/acceptance/17_users/unsafe/10_add_user_with_primary_group.cf +++ b/tests/acceptance/17_users/unsafe/10_add_user_with_primary_group.cf @@ -1,37 +1,34 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added with primary group"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user not present gets added with primary group"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", - "user_queries.cf.sub", - "disable_sudo_tty_requirement.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { + "../../default.sub.cf", + "user_queries.cf.sub", + "disable_sudo_tty_requirement.cf.sub", + }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; methods: - "any" usebundle => disable_sudo_tty_requirement; + "any" usebundle => disable_sudo_tty_requirement; } body delete init_delete @@ -40,7 +37,6 @@ body delete init_delete } ####################################################### - body contain test_contain_body { useshell => "useshell"; @@ -55,12 +51,10 @@ bundle agent test commands: sudo_works:: - "sudo -u johndoe $(G.touch) $(G.testfile)" - contain => test_contain_body; + "sudo -u johndoe $(G.touch) $(G.testfile)" contain => test_contain_body; } ####################################################### - body perms check_perms_body { groups => { "$(user_tests.group1)" }; @@ -75,10 +69,13 @@ body classes check_classes_body bundle agent check { methods: - "any" usebundle => remove_stale_groups; + "any" usebundle => remove_stale_groups; methods: - "any" usebundle => user_is_in_primary_group("johndoe", "$(user_tests.group1)", "success", "failure"), + "any" + usebundle => user_is_in_primary_group( + "johndoe", "$(user_tests.group1)", "success", "failure" + ), classes => always("methods_run"); files: @@ -88,15 +85,18 @@ bundle agent check classes => check_classes_body; classes: - "ready" expression => "methods_run"; + "ready" expression => "methods_run"; + sudo_works:: "ok" and => { "success", "!failure", "perms_ok", "!perms_not_ok" }; + !sudo_works:: "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_add_user_with_secondary_gid.cf b/tests/acceptance/17_users/unsafe/10_add_user_with_secondary_gid.cf index 4249ab3379..9728370441 100644 --- a/tests/acceptance/17_users/unsafe/10_add_user_with_secondary_gid.cf +++ b/tests/acceptance/17_users/unsafe/10_add_user_with_secondary_gid.cf @@ -1,24 +1,25 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added with secondary group id"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" + string => "A user not present gets added with secondary group id"; + + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", - "user_queries.cf.sub", - "disable_sudo_tty_requirement.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { + "../../default.sub.cf", + "user_queries.cf.sub", + "disable_sudo_tty_requirement.cf.sub", + }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - body perms init_perms_body { groups => { "$(user_tests.gid1)" }; @@ -29,16 +30,16 @@ bundle agent init { # AIX useradd/usermod commands do not support numerical group arguments. meta: - "test_soft_fail" string => "aix", - meta => { "redmine6285" }; + "test_soft_fail" + string => "aix", + meta => { "redmine6285" }; - # No GIDs on Windows. - "test_skip_unsupported" string => "windows"; + # No GIDs on Windows. + "test_skip_unsupported" string => "windows"; # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; files: "$(G.testfile)" @@ -46,11 +47,10 @@ bundle agent init perms => init_perms_body; methods: - "any" usebundle => disable_sudo_tty_requirement; + "any" usebundle => disable_sudo_tty_requirement; } ####################################################### - body contain test_contain_body { useshell => "useshell"; @@ -70,26 +70,32 @@ bundle agent test } ####################################################### - bundle agent check { methods: - "any" usebundle => user_is_in_secondary_group("johndoe", "$(user_tests.group1)", "success", "failure"), + "any" + usebundle => user_is_in_secondary_group( + "johndoe", "$(user_tests.group1)", "success", "failure" + ), classes => always("methods_run"); classes: - "content_ok" not => strcmp("0", countlinesmatching("Succeeded", "$(G.testfile)")); + "content_ok" + not => strcmp("0", countlinesmatching("Succeeded", "$(G.testfile)")); classes: - "ready" expression => "methods_run"; + "ready" expression => "methods_run"; + sudo_works:: "ok" and => { "success", "!failure", "content_ok" }; + !sudo_works:: "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_add_user_with_secondary_group.cf b/tests/acceptance/17_users/unsafe/10_add_user_with_secondary_group.cf index 18ab9df565..31f6a240f5 100644 --- a/tests/acceptance/17_users/unsafe/10_add_user_with_secondary_group.cf +++ b/tests/acceptance/17_users/unsafe/10_add_user_with_secondary_group.cf @@ -1,24 +1,25 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added with secondary group"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" + string => "A user not present gets added with secondary group"; + + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", - "user_queries.cf.sub", - "disable_sudo_tty_requirement.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { + "../../default.sub.cf", + "user_queries.cf.sub", + "disable_sudo_tty_requirement.cf.sub", + }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - body perms init_perms_body { groups => { "$(user_tests.group1)" }; @@ -29,8 +30,7 @@ bundle agent init { # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; files: "$(G.testfile)" @@ -38,11 +38,10 @@ bundle agent init perms => init_perms_body; methods: - "any" usebundle => disable_sudo_tty_requirement; + "any" usebundle => disable_sudo_tty_requirement; } ####################################################### - body contain test_contain_body { useshell => "useshell"; @@ -62,27 +61,33 @@ bundle agent test } ####################################################### - bundle agent check { methods: - "any" usebundle => user_is_in_secondary_group("johndoe", "$(user_tests.group1)", "success", "failure"), + "any" + usebundle => user_is_in_secondary_group( + "johndoe", "$(user_tests.group1)", "success", "failure" + ), classes => always("methods_run"); classes: sudo_works:: - "content_ok" not => strcmp("0", countlinesmatching("Succeeded", "$(G.testfile)")); + "content_ok" + not => strcmp("0", countlinesmatching("Succeeded", "$(G.testfile)")); classes: - "ready" expression => "methods_run"; + "ready" expression => "methods_run"; + sudo_works:: "ok" and => { "success", "!failure", "content_ok" }; + !sudo_works:: "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_add_user_with_several_secondary_groups.cf b/tests/acceptance/17_users/unsafe/10_add_user_with_several_secondary_groups.cf index 770a9ad5b1..66670de9a2 100644 --- a/tests/acceptance/17_users/unsafe/10_add_user_with_several_secondary_groups.cf +++ b/tests/acceptance/17_users/unsafe/10_add_user_with_several_secondary_groups.cf @@ -1,24 +1,25 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added with several secondary groups"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" + string => "A user not present gets added with several secondary groups"; + + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", - "user_queries.cf.sub", - "disable_sudo_tty_requirement.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { + "../../default.sub.cf", + "user_queries.cf.sub", + "disable_sudo_tty_requirement.cf.sub", + }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - body perms init_perms_body_bin { groups => { "$(user_tests.group1)" }; @@ -35,23 +36,22 @@ bundle agent init { # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; files: "$(G.testfile)" create => "true", perms => init_perms_body_bin; + "$(G.testfile).2" create => "true", perms => init_perms_body_sys; methods: - "any" usebundle => disable_sudo_tty_requirement; + "any" usebundle => disable_sudo_tty_requirement; } ####################################################### - body contain test_contain_body { useshell => "useshell"; @@ -68,35 +68,57 @@ bundle agent test sudo_works:: "sudo -u johndoe /bin/sh -c '$(G.echo) Succeeded > $(G.testfile)'" contain => test_contain_body; + "sudo -u johndoe /bin/sh -c '$(G.echo) Succeeded > $(G.testfile).2'" contain => test_contain_body; } ####################################################### - bundle agent check { methods: - "any" usebundle => user_is_in_secondary_group("johndoe", "$(user_tests.group1)", "bin_success", "bin_failure"), + "any" + usebundle => user_is_in_secondary_group( + "johndoe", "$(user_tests.group1)", "bin_success", "bin_failure" + ), classes => always("bin_methods_run"); - "any" usebundle => user_is_in_secondary_group("johndoe", "$(user_tests.group2)", "sys_success", "sys_failure"), + + "any" + usebundle => user_is_in_secondary_group( + "johndoe", "$(user_tests.group2)", "sys_success", "sys_failure" + ), classes => always("sys_methods_run"); classes: !windows:: - "1_ok" not => strcmp("0", countlinesmatching("Succeeded", "$(G.testfile)")); - "2_ok" not => strcmp("0", countlinesmatching("Succeeded", "$(G.testfile).2")); + "1_ok" + not => strcmp("0", countlinesmatching("Succeeded", "$(G.testfile)")); + + "2_ok" + not => strcmp("0", countlinesmatching("Succeeded", "$(G.testfile).2")); classes: - "ready" and => { "bin_methods_run", "sys_methods_run" }; + "ready" and => { "bin_methods_run", "sys_methods_run" }; + sudo_works:: - "ok" and => { "bin_success", "!bin_failure", "sys_success", "!sys_failure", "1_ok", "2_ok" }; + "ok" + and => { + "bin_success", + "!bin_failure", + "sys_success", + "!sys_failure", + "1_ok", + "2_ok", + }; + !sudo_works:: - "ok" and => { "bin_success", "!bin_failure", "sys_success", "!sys_failure" }; + "ok" + and => { "bin_success", "!bin_failure", "sys_success", "!sys_failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_add_user_with_shell.cf b/tests/acceptance/17_users/unsafe/10_add_user_with_shell.cf index 8b4c14f0d2..bcb6271d0e 100644 --- a/tests/acceptance/17_users/unsafe/10_add_user_with_shell.cf +++ b/tests/acceptance/17_users/unsafe/10_add_user_with_shell.cf @@ -1,44 +1,42 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added with a shell"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user not present gets added with a shell"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", - "user_queries.cf.sub", - "disable_sudo_tty_requirement.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; - cache_system_functions => "no"; + inputs => { + "../../default.sub.cf", + "user_queries.cf.sub", + "disable_sudo_tty_requirement.cf.sub", + }; + bundlesequence => { default("$(this.promise_filename)") }; + cache_system_functions => "no"; } ####################################################### - bundle agent init { # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; methods: - "any" usebundle => disable_sudo_tty_requirement; + "any" usebundle => disable_sudo_tty_requirement; } ####################################################### - bundle agent test { vars: aix:: # AIX only allows certain shells. "shell" string => "/bin/csh"; + !aix:: "shell" string => "$(G.cat)"; @@ -49,7 +47,6 @@ bundle agent test } ####################################################### - bundle agent check { vars: @@ -57,11 +54,21 @@ bundle agent check classes: !windows.!aix:: - "ok" expression => regcmp(".*Succeeded.*", execresult("sudo su johndoe $(currentdir)$(const.dirsep)add_user_with_shell.txt", "useshell")); + "ok" + expression => regcmp( + ".*Succeeded.*", + execresult( + "sudo su johndoe $(currentdir)$(const.dirsep)add_user_with_shell.txt", + "useshell" + ) + ); methods: aix:: - "any" usebundle => user_has_shell("johndoe", "$(test.shell)", "shell_success", "shell_failure"), + "any" + usebundle => user_has_shell( + "johndoe", "$(test.shell)", "shell_success", "shell_failure" + ), classes => always("shell_methods_run"); classes: @@ -71,6 +78,7 @@ bundle agent check reports: ok|windows:: "$(this.promise_filename) Pass"; + !ok.!windows:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_add_user_with_uid.cf b/tests/acceptance/17_users/unsafe/10_add_user_with_uid.cf index b6ea926299..adf4e7411e 100644 --- a/tests/acceptance/17_users/unsafe/10_add_user_with_uid.cf +++ b/tests/acceptance/17_users/unsafe/10_add_user_with_uid.cf @@ -1,31 +1,27 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added with uid"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user not present gets added with uid"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete @@ -34,7 +30,6 @@ body delete init_delete } ####################################################### - body perms test_perms_body { owners => { "johndoe" }; @@ -54,7 +49,6 @@ bundle agent test } ####################################################### - body perms check_perms_body { owners => { "9999" }; @@ -76,6 +70,7 @@ bundle agent check reports: (ok.!not_ok)|windows:: "$(this.promise_filename) Pass"; + (!ok|not_ok).!windows:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_home_bundle_when_removing_user.cf b/tests/acceptance/17_users/unsafe/10_home_bundle_when_removing_user.cf index 6216dac38d..2641cc9567 100644 --- a/tests/acceptance/17_users/unsafe/10_home_bundle_when_removing_user.cf +++ b/tests/acceptance/17_users/unsafe/10_home_bundle_when_removing_user.cf @@ -1,30 +1,26 @@ bundle common test_meta { vars: - "description" string => "A user removed does not get the home bundle run"; - "story_id" string => "5526"; - "covers" string => "operational_repaired"; + "description" string => "A user removed does not get the home bundle run"; + "story_id" string => "5526"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { users: - "johndoe" - policy => "present"; + "johndoe" policy => "present"; } ####################################################### - bundle agent test { users: @@ -48,15 +44,18 @@ bundle edit_line home_edit(x) } ####################################################### - bundle agent check { classes: - "ok" expression => strcmp("0", countlinesmatching("/home/johndoe", "$(G.testfile)")); + "ok" + expression => strcmp( + "0", countlinesmatching("/home/johndoe", "$(G.testfile)") + ); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_home_bundle_with_existing_user.cf b/tests/acceptance/17_users/unsafe/10_home_bundle_with_existing_user.cf index bb3af82deb..7245c9b409 100644 --- a/tests/acceptance/17_users/unsafe/10_home_bundle_with_existing_user.cf +++ b/tests/acceptance/17_users/unsafe/10_home_bundle_with_existing_user.cf @@ -1,30 +1,26 @@ bundle common test_meta { vars: - "description" string => "A user present does not get the home bundle run"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user present does not get the home bundle run"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { users: - "johndoe" - policy => "present"; + "johndoe" policy => "present"; } ####################################################### - bundle agent test { users: @@ -48,15 +44,18 @@ bundle edit_line home_edit(x) } ####################################################### - bundle agent check { classes: - "ok" expression => strcmp("0", countlinesmatching("/home/johndoe", "$(G.testfile)")); + "ok" + expression => strcmp( + "0", countlinesmatching("/home/johndoe", "$(G.testfile)") + ); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_home_bundle_with_new_user_and_default_inherit.cf b/tests/acceptance/17_users/unsafe/10_home_bundle_with_new_user_and_default_inherit.cf index 1d0a5c136b..0204597dc7 100644 --- a/tests/acceptance/17_users/unsafe/10_home_bundle_with_new_user_and_default_inherit.cf +++ b/tests/acceptance/17_users/unsafe/10_home_bundle_with_new_user_and_default_inherit.cf @@ -1,31 +1,27 @@ bundle common test_meta { vars: - "description" string => "A user added gets the home bundle run"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user added gets the home bundle run"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; } ####################################################### - bundle agent test { classes: @@ -54,15 +50,16 @@ bundle edit_line home_edit(x) } ####################################################### - bundle agent check { classes: - "ok" not => strcmp("0", countlinesmatching("/home/johndoe", "$(G.testfile)")); + "ok" + not => strcmp("0", countlinesmatching("/home/johndoe", "$(G.testfile)")); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_home_bundle_with_new_user_and_inherit.cf b/tests/acceptance/17_users/unsafe/10_home_bundle_with_new_user_and_inherit.cf index 47b2d7828b..fa829d8d4d 100644 --- a/tests/acceptance/17_users/unsafe/10_home_bundle_with_new_user_and_inherit.cf +++ b/tests/acceptance/17_users/unsafe/10_home_bundle_with_new_user_and_inherit.cf @@ -1,31 +1,27 @@ bundle common test_meta { vars: - "description" string => "A user added gets the home bundle run (2)"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user added gets the home bundle run (2)"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; } ####################################################### - bundle agent test { classes: @@ -55,15 +51,18 @@ bundle edit_line home_edit(x) } ####################################################### - bundle agent check { classes: - "ok" expression => strcmp("0", countlinesmatching("/home/johndoe", "$(G.testfile)")); + "ok" + expression => strcmp( + "0", countlinesmatching("/home/johndoe", "$(G.testfile)") + ); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_home_bundle_with_new_user_and_no_inherit.cf b/tests/acceptance/17_users/unsafe/10_home_bundle_with_new_user_and_no_inherit.cf index b2724a5c1b..10895785aa 100644 --- a/tests/acceptance/17_users/unsafe/10_home_bundle_with_new_user_and_no_inherit.cf +++ b/tests/acceptance/17_users/unsafe/10_home_bundle_with_new_user_and_no_inherit.cf @@ -1,31 +1,27 @@ bundle common test_meta { vars: - "description" string => "A user added gets the home bundle run (3)"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user added gets the home bundle run (3)"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { # Remove him first, should he already be present. users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; } ####################################################### - bundle agent test { classes: @@ -55,15 +51,16 @@ bundle edit_line home_edit(x) } ####################################################### - bundle agent check { classes: - "ok" not => strcmp("0", countlinesmatching("/home/johndoe", "$(G.testfile)")); + "ok" + not => strcmp("0", countlinesmatching("/home/johndoe", "$(G.testfile)")); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_missing_policy.cf b/tests/acceptance/17_users/unsafe/10_missing_policy.cf index 38f5a4f794..d123781053 100644 --- a/tests/acceptance/17_users/unsafe/10_missing_policy.cf +++ b/tests/acceptance/17_users/unsafe/10_missing_policy.cf @@ -1,30 +1,28 @@ bundle common test_meta { vars: - "description" string => "A user not present gets added when there is no policy attribute"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" + string => "A user not present gets added when there is no policy attribute"; + + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; } ####################################################### - bundle agent test { users: @@ -32,20 +30,21 @@ bundle agent test } ####################################################### - bundle agent check { methods: - "any" usebundle => user_exists("johndoe", "failure", "success"), + "any" + usebundle => user_exists("johndoe", "failure", "success"), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_modify_user_lock.cf b/tests/acceptance/17_users/unsafe/10_modify_user_lock.cf index a692f2898f..1a2de1850c 100644 --- a/tests/acceptance/17_users/unsafe/10_modify_user_lock.cf +++ b/tests/acceptance/17_users/unsafe/10_modify_user_lock.cf @@ -1,62 +1,58 @@ bundle common test_meta { vars: - "description" string => "A user present gets set to locked"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user present gets set to locked"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; users: - "johndoe" - policy => "present"; + "johndoe" policy => "present"; } ####################################################### - bundle agent test { users: - "johndoe" - policy => "locked"; + "johndoe" policy => "locked"; } ####################################################### - bundle agent check { methods: - "any" usebundle => user_is_locked("johndoe", "success", "failure"), + "any" + usebundle => user_is_locked("johndoe", "success", "failure"), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_modify_user_lock_warn.cf b/tests/acceptance/17_users/unsafe/10_modify_user_lock_warn.cf index 7041243c96..30cc3f64b6 100644 --- a/tests/acceptance/17_users/unsafe/10_modify_user_lock_warn.cf +++ b/tests/acceptance/17_users/unsafe/10_modify_user_lock_warn.cf @@ -1,40 +1,36 @@ bundle common test_meta { vars: - "description" string => "A user present gets locked (dry run)"; - "story_id" string => "5525"; - "covers" string => "dryrun_repaired"; + "description" string => "A user present gets locked (dry run)"; + "story_id" string => "5525"; + "covers" string => "dryrun_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; users: - "johndoe" - policy => "present"; + "johndoe" policy => "present"; } ####################################################### - bundle agent test { users: @@ -49,20 +45,21 @@ body action test_action } ####################################################### - bundle agent check { methods: - "any" usebundle => user_is_unlocked("johndoe", "success", "failure"), + "any" + usebundle => user_is_unlocked("johndoe", "success", "failure"), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_modify_user_lock_with_password.cf b/tests/acceptance/17_users/unsafe/10_modify_user_lock_with_password.cf index f416344160..a9e32f0124 100644 --- a/tests/acceptance/17_users/unsafe/10_modify_user_lock_with_password.cf +++ b/tests/acceptance/17_users/unsafe/10_modify_user_lock_with_password.cf @@ -1,40 +1,38 @@ bundle common test_meta { vars: - "description" string => "A user present gets locked and the password changed"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" + string => "A user present gets locked and the password changed"; + + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; users: - "johndoe" - policy => "present"; + "johndoe" policy => "present"; } ####################################################### - bundle agent test { vars: @@ -53,20 +51,21 @@ body password test_password } ####################################################### - bundle agent check { methods: - "any" usebundle => user_is_locked("johndoe", "success", "failure"), + "any" + usebundle => user_is_locked("johndoe", "success", "failure"), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_modify_user_unlock.cf b/tests/acceptance/17_users/unsafe/10_modify_user_unlock.cf index 8dfa84e55a..8747b96904 100644 --- a/tests/acceptance/17_users/unsafe/10_modify_user_unlock.cf +++ b/tests/acceptance/17_users/unsafe/10_modify_user_unlock.cf @@ -1,62 +1,58 @@ bundle common test_meta { vars: - "description" string => "A user present gets enabled"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user present gets enabled"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; users: - "johndoe" - policy => "locked"; + "johndoe" policy => "locked"; } ####################################################### - bundle agent test { users: - "johndoe" - policy => "present"; + "johndoe" policy => "present"; } ####################################################### - bundle agent check { methods: - "any" usebundle => user_is_unlocked("johndoe", "success", "failure"), + "any" + usebundle => user_is_unlocked("johndoe", "success", "failure"), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_modify_user_unlock_warn.cf b/tests/acceptance/17_users/unsafe/10_modify_user_unlock_warn.cf index c58a28d7ed..085ea7bf25 100644 --- a/tests/acceptance/17_users/unsafe/10_modify_user_unlock_warn.cf +++ b/tests/acceptance/17_users/unsafe/10_modify_user_unlock_warn.cf @@ -1,40 +1,38 @@ bundle common test_meta { vars: - "description" string => "A user present gets enabled and the password changed (dry run)"; - "story_id" string => "5525"; - "covers" string => "dryrun_repaired"; + "description" + string => "A user present gets enabled and the password changed (dry run)"; + + "story_id" string => "5525"; + "covers" string => "dryrun_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; users: - "johndoe" - policy => "locked"; + "johndoe" policy => "locked"; } ####################################################### - bundle agent test { users: @@ -49,20 +47,21 @@ body action test_action } ####################################################### - bundle agent check { methods: - "any" usebundle => user_is_locked("johndoe", "success", "failure"), + "any" + usebundle => user_is_locked("johndoe", "success", "failure"), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_modify_user_unlock_with_password.cf b/tests/acceptance/17_users/unsafe/10_modify_user_unlock_with_password.cf index b7d08c572c..544dc3fdb3 100644 --- a/tests/acceptance/17_users/unsafe/10_modify_user_unlock_with_password.cf +++ b/tests/acceptance/17_users/unsafe/10_modify_user_unlock_with_password.cf @@ -1,40 +1,38 @@ bundle common test_meta { vars: - "description" string => "A user present gets enabled and the password changed"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" + string => "A user present gets enabled and the password changed"; + + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; users: - "johndoe" - policy => "locked"; + "johndoe" policy => "locked"; } ####################################################### - bundle agent test { vars: @@ -51,32 +49,48 @@ body password test_password !windows:: format => "hash"; data => "$(test.hash)"; + windows:: format => "plaintext"; data => "Unlocked0P4SSW0RD"; } ####################################################### - bundle agent check { methods: - "any" usebundle => user_is_unlocked("johndoe", "unlock_success", "unlock_failure"), + "any" + usebundle => user_is_unlocked( + "johndoe", "unlock_success", "unlock_failure" + ), classes => always("unlock_methods_run"); + !windows:: - "any" usebundle => user_has_password_hash("johndoe", "$(test.hash)", "hash_success", "hash_failure"), + "any" + usebundle => user_has_password_hash( + "johndoe", "$(test.hash)", "hash_success", "hash_failure" + ), classes => always("hash_methods_run"); + windows:: - "any" usebundle => user_has_password("johndoe", "Unlocked0P4SSW0RD", "hash_success", "hash_failure"), + "any" + usebundle => user_has_password( + "johndoe", "Unlocked0P4SSW0RD", "hash_success", "hash_failure" + ), classes => always("hash_methods_run"); classes: - "ready" and => { "unlock_methods_run", "hash_methods_run" }; - "ok" and => { "unlock_success", "!unlock_failure", "hash_success", "!hash_failure" }; + "ready" and => { "unlock_methods_run", "hash_methods_run" }; + + "ok" + and => { + "unlock_success", "!unlock_failure", "hash_success", "!hash_failure" + }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_modify_user_with_hashed_password.cf b/tests/acceptance/17_users/unsafe/10_modify_user_with_hashed_password.cf index 366c34080b..f66c91409f 100644 --- a/tests/acceptance/17_users/unsafe/10_modify_user_with_hashed_password.cf +++ b/tests/acceptance/17_users/unsafe/10_modify_user_with_hashed_password.cf @@ -1,32 +1,30 @@ bundle common test_meta { vars: - "description" string => "A user present gets the hashed password changed"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user present gets the hashed password changed"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; users: "johndoe" @@ -41,7 +39,6 @@ body password init_password } ####################################################### - bundle agent test { vars: @@ -60,25 +57,32 @@ body password test_password } ####################################################### - bundle agent check { methods: !windows:: - "any" usebundle => user_has_password_hash("johndoe", "$(test.hash)", "success", "failure"), + "any" + usebundle => user_has_password_hash( + "johndoe", "$(test.hash)", "success", "failure" + ), classes => always("methods_run"); + windows:: # Hash not supported on Windows. Make sure it is the same as before. - "any" usebundle => user_has_password("johndoe", "Bad0P4SSW0RD", "success", "failure"), + "any" + usebundle => user_has_password( + "johndoe", "Bad0P4SSW0RD", "success", "failure" + ), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_modify_user_with_many_attributes.cf b/tests/acceptance/17_users/unsafe/10_modify_user_with_many_attributes.cf index bd130f6229..56bac68876 100644 --- a/tests/acceptance/17_users/unsafe/10_modify_user_with_many_attributes.cf +++ b/tests/acceptance/17_users/unsafe/10_modify_user_with_many_attributes.cf @@ -1,32 +1,30 @@ bundle common test_meta { vars: - "description" string => "A user present gets several attributes changed"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user present gets several attributes changed"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; # Start out with other attributes. users: @@ -48,12 +46,13 @@ body password init_password } ####################################################### - bundle agent test { vars: "hash" string => "dTloMVpjYt1w2"; - "desc_string" string => "This description should make the CFEngine test pass"; + + "desc_string" + string => "This description should make the CFEngine test pass"; users: "johndoe" @@ -72,72 +71,143 @@ body password test_password !windows:: format => "hash"; data => "$(test.hash)"; + windows:: format => "plaintext"; data => "New0P4SSW0RD"; } ####################################################### - bundle agent check { methods: - "any" usebundle => remove_stale_groups; + "any" usebundle => remove_stale_groups; methods: - "any" usebundle => user_has_uid("johndoe", "9876", "uid_success", "uid_failure"), + "any" + usebundle => user_has_uid( + "johndoe", "9876", "uid_success", "uid_failure" + ), classes => always("uid_methods_run"); - "any" usebundle => user_is_in_primary_group("johndoe", "$(user_tests.group1)", "pgroup_success", "pgroup_failure"), + "any" + usebundle => user_is_in_primary_group( + "johndoe", "$(user_tests.group1)", "pgroup_success", "pgroup_failure" + ), classes => always("pgroup_methods_run"); - "any" usebundle => user_is_in_secondary_group("johndoe", "$(user_tests.group2)", "sgroup_success", "sgroup_failure"), + "any" + usebundle => user_is_in_secondary_group( + "johndoe", "$(user_tests.group2)", "sgroup_success", "sgroup_failure" + ), classes => always("sgroup_methods_run"); - "any" usebundle => user_is_in_secondary_group("johndoe", "$(user_tests.group1)", "not_sgroup_failure", "not_sgroup_success"), + "any" + usebundle => user_is_in_secondary_group( + "johndoe", + "$(user_tests.group1)", + "not_sgroup_failure", + "not_sgroup_success" + ), classes => always("not_sgroup_methods_run"); - "any" usebundle => user_has_home_dir("johndoe", "/home/user-johndoe", "home_success", "home_failure"), + "any" + usebundle => user_has_home_dir( + "johndoe", "/home/user-johndoe", "home_success", "home_failure" + ), classes => always("home_methods_run"); - "any" usebundle => user_has_shell("johndoe", "/bin/csh", "shell_success", "shell_failure"), + "any" + usebundle => user_has_shell( + "johndoe", "/bin/csh", "shell_success", "shell_failure" + ), classes => always("shell_methods_run"); - "any" usebundle => user_has_description("johndoe", "$(test.desc_string)", "desc_success", "desc_failure"), + "any" + usebundle => user_has_description( + "johndoe", "$(test.desc_string)", "desc_success", "desc_failure" + ), classes => always("desc_methods_run"); !windows:: - "any" usebundle => user_has_password_hash("johndoe", "$(test.hash)", "hash_success", "hash_failure"), + "any" + usebundle => user_has_password_hash( + "johndoe", "$(test.hash)", "hash_success", "hash_failure" + ), classes => always("hash_methods_run"); + windows:: - "any" usebundle => user_has_password("johndoe", "New0P4SSW0RD", "hash_success", "hash_failure"), + "any" + usebundle => user_has_password( + "johndoe", "New0P4SSW0RD", "hash_success", "hash_failure" + ), classes => always("hash_methods_run"); classes: - "ready" and => { "uid_methods_run", "pgroup_methods_run", "sgroup_methods_run", "not_sgroup_methods_run", - "home_methods_run", "shell_methods_run", "desc_methods_run", "hash_methods_run" }; + "ready" + and => { + "uid_methods_run", + "pgroup_methods_run", + "sgroup_methods_run", + "not_sgroup_methods_run", + "home_methods_run", + "shell_methods_run", + "desc_methods_run", + "hash_methods_run", + }; + !windows:: # Note the secondary group classes here. Windows treats primary and secondary groups the same, # and hence that test is invalid there. - "unix_ok" and => { "uid_success", "!uid_failure", "shell_success", "!shell_failure", - "not_sgroup_success", "!not_sgroup_failure", }; + "unix_ok" + and => { + "uid_success", + "!uid_failure", + "shell_success", + "!shell_failure", + "not_sgroup_success", + "!not_sgroup_failure", + }; + windows:: "unix_ok" expression => "any"; + sles_11:: "ok" -> "CFE-3386" - and => { "pgroup_success", "!pgroup_failure", "!sgroup_success", "sgroup_failure", - "hash_success", "!hash_failure", - "home_success", "!home_failure", "desc_success", "!desc_failure", - "unix_ok" }; + and => { + "pgroup_success", + "!pgroup_failure", + "!sgroup_success", + "sgroup_failure", + "hash_success", + "!hash_failure", + "home_success", + "!home_failure", + "desc_success", + "!desc_failure", + "unix_ok", + }; + !sles_11:: - "ok" and => { "pgroup_success", "!pgroup_failure", "sgroup_success", "!sgroup_failure", - "hash_success", "!hash_failure", - "home_success", "!home_failure", "desc_success", "!desc_failure", - "unix_ok" }; + "ok" + and => { + "pgroup_success", + "!pgroup_failure", + "sgroup_success", + "!sgroup_failure", + "hash_success", + "!hash_failure", + "home_success", + "!home_failure", + "desc_success", + "!desc_failure", + "unix_ok", + }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_modify_user_with_many_attributes_warn.cf b/tests/acceptance/17_users/unsafe/10_modify_user_with_many_attributes_warn.cf index 7afbcec231..ddcd6a89b7 100644 --- a/tests/acceptance/17_users/unsafe/10_modify_user_with_many_attributes_warn.cf +++ b/tests/acceptance/17_users/unsafe/10_modify_user_with_many_attributes_warn.cf @@ -1,32 +1,32 @@ bundle common test_meta { vars: - "description" string => "A user present gets many attributes changed (dry run)"; - "story_id" string => "5525"; - "covers" string => "dryrun_repaired"; + "description" + string => "A user present gets many attributes changed (dry run)"; + + "story_id" string => "5525"; + "covers" string => "dryrun_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; vars: "hash" string => "dTloMVpjYt1w2"; @@ -49,17 +49,18 @@ body password init_password !windows:: format => "hash"; data => "$(init.hash)"; + windows:: format => "plaintext"; data => "Old0P4SSW0RD"; } ####################################################### - bundle agent test { vars: - "desc_string" string => "This description should make the CFEngine test fail"; + "desc_string" + string => "This description should make the CFEngine test fail"; users: "johndoe" @@ -86,66 +87,136 @@ body password test_password } ####################################################### - bundle agent check { methods: - "any" usebundle => remove_stale_groups; + "any" usebundle => remove_stale_groups; methods: - "any" usebundle => user_has_uid("johndoe", "8765", "uid_success", "uid_failure"), + "any" + usebundle => user_has_uid( + "johndoe", "8765", "uid_success", "uid_failure" + ), classes => always("uid_methods_run"); - "any" usebundle => user_is_in_primary_group("johndoe", "$(user_tests.group2)", "pgroup_success", "pgroup_failure"), + "any" + usebundle => user_is_in_primary_group( + "johndoe", "$(user_tests.group2)", "pgroup_success", "pgroup_failure" + ), classes => always("pgroup_methods_run"); - "any" usebundle => user_is_in_secondary_group("johndoe", "$(user_tests.group1)", "sgroup_success", "sgroup_failure"), + "any" + usebundle => user_is_in_secondary_group( + "johndoe", "$(user_tests.group1)", "sgroup_success", "sgroup_failure" + ), classes => always("sgroup_methods_run"); - "any" usebundle => user_is_in_secondary_group("johndoe", "$(user_tests.group2)", "not_sgroup_failure", "not_sgroup_success"), + "any" + usebundle => user_is_in_secondary_group( + "johndoe", + "$(user_tests.group2)", + "not_sgroup_failure", + "not_sgroup_success" + ), classes => always("not_sgroup_methods_run"); - "any" usebundle => user_has_home_dir("johndoe", "/johns_old_home_dir", "home_success", "home_failure"), + "any" + usebundle => user_has_home_dir( + "johndoe", "/johns_old_home_dir", "home_success", "home_failure" + ), classes => always("home_methods_run"); - "any" usebundle => user_has_shell("johndoe", "/bin/csh", "shell_success", "shell_failure"), + "any" + usebundle => user_has_shell( + "johndoe", "/bin/csh", "shell_success", "shell_failure" + ), classes => always("shell_methods_run"); - "any" usebundle => user_has_description("johndoe", "Good user", "desc_success", "desc_failure"), + "any" + usebundle => user_has_description( + "johndoe", "Good user", "desc_success", "desc_failure" + ), classes => always("desc_methods_run"); !windows:: - "any" usebundle => user_has_password_hash("johndoe", "$(init.hash)", "hash_success", "hash_failure"), + "any" + usebundle => user_has_password_hash( + "johndoe", "$(init.hash)", "hash_success", "hash_failure" + ), classes => always("hash_methods_run"); + windows:: - "any" usebundle => user_has_password("johndoe", "Wrong0P4SSW0RD", "hash_failure", "hash_success"), + "any" + usebundle => user_has_password( + "johndoe", "Wrong0P4SSW0RD", "hash_failure", "hash_success" + ), classes => always("hash_methods_run"); classes: - "ready" and => { "uid_methods_run", "pgroup_methods_run", "sgroup_methods_run", "not_sgroup_methods_run", - "home_methods_run", "shell_methods_run", "desc_methods_run", "hash_methods_run" }; + "ready" + and => { + "uid_methods_run", + "pgroup_methods_run", + "sgroup_methods_run", + "not_sgroup_methods_run", + "home_methods_run", + "shell_methods_run", + "desc_methods_run", + "hash_methods_run", + }; + !windows:: # Note the secondary group classes here. Windows treats primary and secondary groups the same, # and hence that test is invalid there. - "unix_ok" and => { "uid_success", "!uid_failure", "shell_success", "!shell_failure", - "not_sgroup_success", "!not_sgroup_failure", }; + "unix_ok" + and => { + "uid_success", + "!uid_failure", + "shell_success", + "!shell_failure", + "not_sgroup_success", + "!not_sgroup_failure", + }; + windows:: "unix_ok" expression => "any"; + sles_11:: "ok" -> "CFE-3386" - and => { "pgroup_success", "!pgroup_failure", "!sgroup_success", "sgroup_failure", - "hash_success", "!hash_failure", - "home_success", "!home_failure", "desc_success", "!desc_failure", - "unix_ok" }; + and => { + "pgroup_success", + "!pgroup_failure", + "!sgroup_success", + "sgroup_failure", + "hash_success", + "!hash_failure", + "home_success", + "!home_failure", + "desc_success", + "!desc_failure", + "unix_ok", + }; + !sles_11:: - "ok" and => { "pgroup_success", "!pgroup_failure", "sgroup_success", "!sgroup_failure", - "hash_success", "!hash_failure", - "home_success", "!home_failure", "desc_success", "!desc_failure", - "unix_ok" }; + "ok" + and => { + "pgroup_success", + "!pgroup_failure", + "sgroup_success", + "!sgroup_failure", + "hash_success", + "!hash_failure", + "home_success", + "!home_failure", + "desc_success", + "!desc_failure", + "unix_ok", + }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_modify_user_with_many_empty_attributes.cf b/tests/acceptance/17_users/unsafe/10_modify_user_with_many_empty_attributes.cf index be69210d4f..45b586443d 100644 --- a/tests/acceptance/17_users/unsafe/10_modify_user_with_many_empty_attributes.cf +++ b/tests/acceptance/17_users/unsafe/10_modify_user_with_many_empty_attributes.cf @@ -1,21 +1,21 @@ bundle common test_meta { vars: - "description" string => "A user present gets multiple empty attributes changed"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" + string => "A user present gets multiple empty attributes changed"; + + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { # Create him first with some unwanted attributes @@ -28,54 +28,78 @@ bundle agent init } ####################################################### - bundle agent test { users: "johndoe" policy => "present", group_primary => "", - groups_secondary => { }, + groups_secondary => {}, description => ""; } ####################################################### - bundle agent check { methods: - "any" usebundle => remove_stale_groups; + "any" usebundle => remove_stale_groups; methods: windows:: - "any" usebundle => user_is_in_primary_group("johndoe", "$(user_tests.group1)", "pgroup_failure", "pgroup_success"), + "any" + usebundle => user_is_in_primary_group( + "johndoe", "$(user_tests.group1)", "pgroup_failure", "pgroup_success" + ), classes => always("pgroup_methods_run"); + # Unix hosts cannot remove the primary group. !windows:: - "any" usebundle => user_is_in_primary_group("johndoe", "$(user_tests.group1)", "pgroup_success", "pgroup_failure"), + "any" + usebundle => user_is_in_primary_group( + "johndoe", "$(user_tests.group1)", "pgroup_success", "pgroup_failure" + ), classes => always("pgroup_methods_run"); aix:: # AIX forcibly puts a user in the primary group, even if no group is specified. - "any" usebundle => user_is_in_secondary_group("johndoe", "$(user_tests.group1)", "sgroup_success", "sgroup_failure"), + "any" + usebundle => user_is_in_secondary_group( + "johndoe", "$(user_tests.group1)", "sgroup_success", "sgroup_failure" + ), classes => always("sgroup_methods_run"); !aix:: - "any" usebundle => user_is_in_any_secondary_group("johndoe", "sgroup_failure", "sgroup_success"), + "any" + usebundle => user_is_in_any_secondary_group( + "johndoe", "sgroup_failure", "sgroup_success" + ), classes => always("sgroup_methods_run"); any:: - "any" usebundle => user_has_description("johndoe", "", "desc_success", "desc_failure"), + "any" + usebundle => user_has_description( + "johndoe", "", "desc_success", "desc_failure" + ), classes => always("desc_methods_run"); classes: - "ready" and => { "pgroup_methods_run", "sgroup_methods_run", "desc_methods_run" }; - "ok" and => { "pgroup_success", "!pgroup_failure", "sgroup_success", "!sgroup_failure", - "desc_success", "!desc_failure", }; + "ready" + and => { "pgroup_methods_run", "sgroup_methods_run", "desc_methods_run" }; + + "ok" + and => { + "pgroup_success", + "!pgroup_failure", + "sgroup_success", + "!sgroup_failure", + "desc_success", + "!desc_failure", + }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_modify_user_with_password.cf b/tests/acceptance/17_users/unsafe/10_modify_user_with_password.cf index fadbe5463c..2d362c3e45 100644 --- a/tests/acceptance/17_users/unsafe/10_modify_user_with_password.cf +++ b/tests/acceptance/17_users/unsafe/10_modify_user_with_password.cf @@ -1,32 +1,30 @@ bundle common test_meta { vars: - "description" string => "A user present gets the password changed"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user present gets the password changed"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; vars: "hash" string => "dTloMVpjYt1w2"; @@ -40,14 +38,15 @@ bundle agent init body password init_password { data => "$(init.hash)"; + !windows:: format => "hash"; + windows:: format => "plaintext"; } ####################################################### - bundle agent test { users: @@ -63,28 +62,40 @@ body password test_password } ####################################################### - bundle agent check { methods: !windows:: # Make sure it is *not* the same as before. - "any" usebundle => user_has_password_hash("johndoe", "$(init.hash)", "failure", "success"), + "any" + usebundle => user_has_password_hash( + "johndoe", "$(init.hash)", "failure", "success" + ), classes => always("methods_run"); + windows:: - "any" usebundle => user_has_password("johndoe", "New0P4SSW0RD", "success", "failure"), + "any" + usebundle => user_has_password( + "johndoe", "New0P4SSW0RD", "success", "failure" + ), classes => always("methods_run"); any:: - "any" usebundle => user_does_not_need_password_update("johndoe", "no_pw_update_ok", "no_pw_update_fail"); + "any" + usebundle => user_does_not_need_password_update( + "johndoe", "no_pw_update_ok", "no_pw_update_fail" + ); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure", "no_pw_update_ok", "!no_pw_update_fail" }; + "ready" expression => "methods_run"; + + "ok" + and => { "success", "!failure", "no_pw_update_ok", "!no_pw_update_fail" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_modify_user_with_same_password.cf b/tests/acceptance/17_users/unsafe/10_modify_user_with_same_password.cf index c7d790b554..d1f289e1a6 100644 --- a/tests/acceptance/17_users/unsafe/10_modify_user_with_same_password.cf +++ b/tests/acceptance/17_users/unsafe/10_modify_user_with_same_password.cf @@ -1,43 +1,46 @@ bundle common test_meta { vars: - "description" string => "A user present gets the password set to the same as before"; - "story_id" string => "5525"; - "covers" string => "operational_kept"; + "description" + string => "A user present gets the password set to the same as before"; + + "story_id" string => "5525"; + "covers" string => "operational_kept"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; - - # Something in the Solaris chroot test environment makes it impossible - # to test matching passwords, the pam module always returns error. - # This should not happen in a production system though. - # Since the error is not on our part, and likely unsolvable, we set - # Redmine to zero. However, it would be nice to know if the problem ever - # goes away, so using soft_fail. - "test_soft_fail" string => "!hpux_trusted_mode_test.(solaris.!sunos_5_9)", - meta => { "redmine0" }; - # On Solaris 9 PAM just crashes inside chroot. - "test_skip_needs_work" string => "!hpux_trusted_mode_test.sunos_5_9"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + + # Something in the Solaris chroot test environment makes it impossible + # to test matching passwords, the pam module always returns error. + # This should not happen in a production system though. + # Since the error is not on our part, and likely unsolvable, we set + # Redmine to zero. However, it would be nice to know if the problem ever + # goes away, so using soft_fail. + "test_soft_fail" + string => "!hpux_trusted_mode_test.(solaris.!sunos_5_9)", + meta => { "redmine0" }; + + # On Solaris 9 PAM just crashes inside chroot. + "test_skip_needs_work" string => "!hpux_trusted_mode_test.sunos_5_9"; + vars: # This is the same password as the plaintext one further down. "hash" string => "dTloMVpjYt1w2"; @@ -53,13 +56,13 @@ body password init_password !windows:: format => "hash"; data => "$(init.hash)"; + windows:: format => "plaintext"; data => "J0hnd0eX"; } ####################################################### - bundle agent test { users: @@ -76,25 +79,32 @@ body password test_password } ####################################################### - bundle agent check { methods: # Make sure it is the same as before. !windows:: - "any" usebundle => user_has_password_hash("johndoe", "$(init.hash)", "success", "failure"), + "any" + usebundle => user_has_password_hash( + "johndoe", "$(init.hash)", "success", "failure" + ), classes => always("methods_run"); + windows:: - "any" usebundle => user_has_password("johndoe", "J0hnd0eX", "success", "failure"), + "any" + usebundle => user_has_password( + "johndoe", "J0hnd0eX", "success", "failure" + ), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure", "!kept_failed" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure", "!kept_failed" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_newly_created_account_should_not_count_as_locked.cf b/tests/acceptance/17_users/unsafe/10_newly_created_account_should_not_count_as_locked.cf index 4a88c17913..504063779d 100644 --- a/tests/acceptance/17_users/unsafe/10_newly_created_account_should_not_count_as_locked.cf +++ b/tests/acceptance/17_users/unsafe/10_newly_created_account_should_not_count_as_locked.cf @@ -1,9 +1,9 @@ bundle common test_meta { vars: - "description" string => "A user present gets locked"; - "story_id" string => "5525"; - "covers" string => "operational_repaired"; + "description" string => "A user present gets locked"; + "story_id" string => "5525"; + "covers" string => "operational_repaired"; } ####################################################### @@ -13,26 +13,24 @@ bundle common test_meta # "useradd" initially sets the password to '!'. # ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; # Delete user, then create. vars: @@ -40,16 +38,13 @@ bundle agent init "users[n2]" string => "johndoe"; "policies[n1]" string => "absent"; "policies[n2]" string => "present"; - "iter" slist => { "n1", "n2" }; users: - "$(users[$(iter)])" - policy => "$(policies[$(iter)])"; + "$(users[$(iter)])" policy => "$(policies[$(iter)])"; } ####################################################### - bundle agent test { vars: @@ -68,20 +63,21 @@ body password test_password } ####################################################### - bundle agent check { methods: - "any" usebundle => user_is_locked("johndoe", "success", "failure"), + "any" + usebundle => user_is_locked("johndoe", "success", "failure"), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_password_hash_is_not_cached.cf b/tests/acceptance/17_users/unsafe/10_password_hash_is_not_cached.cf index 183963ae90..0ebc20b4d7 100644 --- a/tests/acceptance/17_users/unsafe/10_password_hash_is_not_cached.cf +++ b/tests/acceptance/17_users/unsafe/10_password_hash_is_not_cached.cf @@ -1,108 +1,103 @@ bundle common test_meta { vars: - "description" string => "Test that cached password hashes do not cause problems"; - "story_id" string => "5525"; - "covers" string => "operational_kept"; + "description" + string => "Test that cached password hashes do not cause problems"; + + "story_id" string => "5525"; + "covers" string => "operational_kept"; } ####################################################### - # If the platform is using /etc/passwd to store hashes, then the hash will be # cached in the passwd_info structure in the C code. This may cause problems # if one part of the code (password update) tries to modify the hash, and # another one (locking) also does it. The latter may use the cached value from # before it was modified, but should use the updated value. - ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - # Password hashes are not supported on Windows. - "test_skip_unsupported" string => "(hpux_trusted_mode_test.!hpux)|windows"; + # Password hashes are not supported on Windows. + "test_skip_unsupported" string => "(hpux_trusted_mode_test.!hpux)|windows"; vars: - # "j0hnd0e" - "hash" string => "dTloMVpjYt1w2"; + # "j0hnd0e" + "hash" string => "dTloMVpjYt1w2"; methods: - "any" usebundle => init_firstpass; - "any" usebundle => init_secondpass; + "any" usebundle => init_firstpass; + "any" usebundle => init_secondpass; } bundle agent init_firstpass { users: - "user1" - policy => "absent"; - "user2" - policy => "absent"; + "user1" policy => "absent"; + "user2" policy => "absent"; } bundle agent init_secondpass { users: - "user1" - policy => "present", - password => init_password; - "user2" - policy => "present", - password => init_password; + "user1" + policy => "present", + password => init_password; + + "user2" + policy => "present", + password => init_password; } body password init_password { - format => "hash"; - data => "$(init.hash)"; + format => "hash"; + data => "$(init.hash)"; } ####################################################### - bundle agent test { vars: - # "N4wP4ssw" - "hash" string => "aapgPBZAGeZf6"; + # "N4wP4ssw" + "hash" string => "aapgPBZAGeZf6"; methods: - "any" usebundle => test_firstpass; - "any" usebundle => test_secondpass; + "any" usebundle => test_firstpass; + "any" usebundle => test_secondpass; } bundle agent test_firstpass { users: - "user1" - policy => "locked"; - "user2" - policy => "locked"; + "user1" policy => "locked"; + "user2" policy => "locked"; } bundle agent test_secondpass { users: - "user1" - policy => "present", - password => test_hash; - "user2" - policy => "present", - password => test_passwd; + "user1" + policy => "present", + password => test_hash; + + "user2" + policy => "present", + password => test_passwd; } body password test_hash @@ -118,24 +113,33 @@ body password test_passwd } ####################################################### - bundle agent check { methods: - "any" usebundle => user_has_password_hash("user1", "$(test.hash)", "user1_success", "user1_failure"), - classes => always("user1_methods_run"); - "any" usebundle => user_has_password_hash("user2", "$(init.hash)", "user2_failure", "user2_success"), - classes => always("user2_methods_run"); + "any" + usebundle => user_has_password_hash( + "user1", "$(test.hash)", "user1_success", "user1_failure" + ), + classes => always("user1_methods_run"); + + "any" + usebundle => user_has_password_hash( + "user2", "$(init.hash)", "user2_failure", "user2_success" + ), + classes => always("user2_methods_run"); classes: - "ready" and => { "user1_methods_run", "user2_methods_run" }; - "ok" and => { "user1_success", "!user1_failure", - "user2_success", "!user2_failure" - }; + "ready" and => { "user1_methods_run", "user2_methods_run" }; + + "ok" + and => { + "user1_success", "!user1_failure", "user2_success", "!user2_failure" + }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_password_with_no_data.cf b/tests/acceptance/17_users/unsafe/10_password_with_no_data.cf index d63dd2623c..3cb9faed99 100644 --- a/tests/acceptance/17_users/unsafe/10_password_with_no_data.cf +++ b/tests/acceptance/17_users/unsafe/10_password_with_no_data.cf @@ -1,32 +1,32 @@ bundle common test_meta { vars: - "description" string => "A user present gets the password unchanged when it is unspecified"; - "story_id" string => "5525"; - "covers" string => "operational_kept"; + "description" + string => "A user present gets the password unchanged when it is unspecified"; + + "story_id" string => "5525"; + "covers" string => "operational_kept"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; vars: # "j0hnd0e" @@ -43,13 +43,13 @@ body password init_password !windows:: format => "hash"; data => "$(init.hash)"; + windows:: format => "plaintext"; data => "Old0P4SSW0RD"; } ####################################################### - bundle agent test { users: @@ -64,25 +64,32 @@ body password test_password } ####################################################### - bundle agent check { methods: # Make sure it is the same as before. !windows:: - "any" usebundle => user_has_password_hash("johndoe", "$(init.hash)", "success", "failure"), + "any" + usebundle => user_has_password_hash( + "johndoe", "$(init.hash)", "success", "failure" + ), classes => always("methods_run"); + windows:: - "any" usebundle => user_has_password("johndoe", "Old0P4SSW0RD", "success", "failure"), + "any" + usebundle => user_has_password( + "johndoe", "Old0P4SSW0RD", "success", "failure" + ), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_password_with_no_format.cf b/tests/acceptance/17_users/unsafe/10_password_with_no_format.cf index 44246864fd..9aeaa7adbc 100644 --- a/tests/acceptance/17_users/unsafe/10_password_with_no_format.cf +++ b/tests/acceptance/17_users/unsafe/10_password_with_no_format.cf @@ -1,32 +1,32 @@ bundle common test_meta { vars: - "description" string => "A user present has the password unchanged when password format is unspecified"; - "story_id" string => "5525"; - "covers" string => "operational_kept"; + "description" + string => "A user present has the password unchanged when password format is unspecified"; + + "story_id" string => "5525"; + "covers" string => "operational_kept"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; vars: # "j0hnd0e" @@ -43,13 +43,13 @@ body password init_password !windows:: format => "hash"; data => "$(init.hash)"; + windows:: format => "plaintext"; data => "Old0P4SSW0RD"; } ####################################################### - bundle agent test { users: @@ -64,25 +64,32 @@ body password test_password } ####################################################### - bundle agent check { methods: # Make sure it is the same as before. !windows:: - "any" usebundle => user_has_password_hash("johndoe", "$(init.hash)", "success", "failure"), + "any" + usebundle => user_has_password_hash( + "johndoe", "$(init.hash)", "success", "failure" + ), classes => always("methods_run"); + windows:: - "any" usebundle => user_has_password("johndoe", "Old0P4SSW0RD", "success", "failure"), + "any" + usebundle => user_has_password( + "johndoe", "Old0P4SSW0RD", "success", "failure" + ), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_promise_outcomes.cf b/tests/acceptance/17_users/unsafe/10_promise_outcomes.cf index 90820e7f98..7612dc2331 100644 --- a/tests/acceptance/17_users/unsafe/10_promise_outcomes.cf +++ b/tests/acceptance/17_users/unsafe/10_promise_outcomes.cf @@ -3,37 +3,37 @@ # Test that promise outcomes are set correctly. # ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle common hpux_trusted { classes: - "hpux_trusted_mode_test" - expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); + "hpux_trusted_mode_test" + expression => regcmp(".*hpux_trusted.*", $(this.promise_filename)); } bundle agent init { meta: - "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; - - # Something in the Solaris chroot test environment makes it impossible - # to test matching passwords, the pam module always returns error. - # This should not happen in a production system though. - # Since the error is not on our part, and likely unsolvable, we set - # Redmine to zero. However, it would be nice to know if the problem ever - # goes away, so using soft_fail. - "test_soft_fail" string => "!hpux_trusted_mode_test.(solaris.!sunos_5_9)", - meta => { "redmine0" }; - # On Solaris 9 PAM just crashes inside chroot. - "test_skip_needs_work" string => "!hpux_trusted_mode_test.sunos_5_9"; + "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux"; + + # Something in the Solaris chroot test environment makes it impossible + # to test matching passwords, the pam module always returns error. + # This should not happen in a production system though. + # Since the error is not on our part, and likely unsolvable, we set + # Redmine to zero. However, it would be nice to know if the problem ever + # goes away, so using soft_fail. + "test_soft_fail" + string => "!hpux_trusted_mode_test.(solaris.!sunos_5_9)", + meta => { "redmine0" }; + + # On Solaris 9 PAM just crashes inside chroot. + "test_skip_needs_work" string => "!hpux_trusted_mode_test.sunos_5_9"; # AIX doesn't like long names (> 8 chars), so keep them short. # a = absent @@ -43,14 +43,11 @@ bundle agent init # l = locked # r = repair users: - "akeep" - policy => "absent"; - "arepair" - policy => "present"; - "pkeep" - policy => "present"; - "prepair" - policy => "absent"; + "akeep" policy => "absent"; + "arepair" policy => "present"; + "pkeep" policy => "present"; + "prepair" policy => "absent"; + "tkeep" policy => "present", uid => "9878", @@ -58,6 +55,7 @@ bundle agent init groups_secondary => { "$(user_tests.group2)" }, shell => "/bin/csh", description => "Description"; + "trepair" policy => "present", uid => "9877", @@ -65,18 +63,18 @@ bundle agent init groups_secondary => { "$(user_tests.group2)" }, shell => "/bin/csh", description => "Description"; + "wkeep" policy => "present", password => init_password; + "wrepair" policy => "present", password => init_password; - "lkeep" - policy => "locked"; - "lr_byadd" - policy => "absent"; - "lr_bymod" - policy => "present"; + + "lkeep" policy => "locked"; + "lr_byadd" policy => "absent"; + "lr_bymod" policy => "present"; } body password init_password @@ -86,65 +84,114 @@ body password init_password } ####################################################### - bundle agent test { users: - !ok:: - "akeep" - classes => set_classes_kept_repaired("absent_keep", "not_absent_keep"), - policy => "absent"; - "arepair" - classes => set_classes_kept_repaired("not_absent_repair", "absent_repair"), - policy => "absent"; - "pkeep" - classes => set_classes_kept_repaired("present_keep", "not_present_keep"), - policy => "present"; - "prepair" - classes => set_classes_kept_repaired("not_present_repair", "present_repair"), - policy => "present"; - "tkeep" - classes => set_classes_kept_repaired("attributes_keep", "not_attributes_keep"), - policy => "present", - uid => "9878", - group_primary => "$(user_tests.group1)", - groups_secondary => { "$(user_tests.group2)" }, - shell => "/bin/csh", - description => "Description"; - "trepair" - classes => set_classes_kept_repaired("not_attributes_repair", "attributes_repair"), - policy => "present", - uid => "9877", - group_primary => "$(user_tests.group1)", - groups_secondary => { }, - shell => "/bin/ksh", - description => "Description"; - "wkeep" - classes => set_classes_kept_repaired("password_keep", "not_password_keep"), - policy => "present", - password => init_password; - "wrepair" - classes => set_classes_kept_repaired("not_password_repair", "password_repair"), - policy => "present", - password => test_password; - "lkeep" - classes => set_classes_kept_repaired("locked_keep", "not_locked_keep"), - policy => "locked"; - "lr_byadd" - classes => set_classes_kept_repaired("not_locked_repair_by_add", "locked_repair_by_add"), - policy => "locked"; - "lr_bymod" - classes => set_classes_kept_repaired("not_locked_repair_by_mod", "locked_repair_by_mod"), - policy => "locked"; + !ok:: + "akeep" + classes => set_classes_kept_repaired("absent_keep", "not_absent_keep"), + policy => "absent"; + + "arepair" + classes => set_classes_kept_repaired( + "not_absent_repair", "absent_repair" + ), + policy => "absent"; + + "pkeep" + classes => set_classes_kept_repaired( + "present_keep", "not_present_keep" + ), + policy => "present"; + + "prepair" + classes => set_classes_kept_repaired( + "not_present_repair", "present_repair" + ), + policy => "present"; + "tkeep" + classes => set_classes_kept_repaired( + "attributes_keep", "not_attributes_keep" + ), + policy => "present", + uid => "9878", + group_primary => "$(user_tests.group1)", + groups_secondary => { "$(user_tests.group2)" }, + shell => "/bin/csh", + description => "Description"; + + "trepair" + classes => set_classes_kept_repaired( + "not_attributes_repair", "attributes_repair" + ), + policy => "present", + uid => "9877", + group_primary => "$(user_tests.group1)", + groups_secondary => {}, + shell => "/bin/ksh", + description => "Description"; + + "wkeep" + classes => set_classes_kept_repaired( + "password_keep", "not_password_keep" + ), + policy => "present", + password => init_password; + + "wrepair" + classes => set_classes_kept_repaired( + "not_password_repair", "password_repair" + ), + policy => "present", + password => test_password; + + "lkeep" + classes => set_classes_kept_repaired("locked_keep", "not_locked_keep"), + policy => "locked"; + + "lr_byadd" + classes => set_classes_kept_repaired( + "not_locked_repair_by_add", "locked_repair_by_add" + ), + policy => "locked"; + + "lr_bymod" + classes => set_classes_kept_repaired( + "not_locked_repair_by_mod", "locked_repair_by_mod" + ), + policy => "locked"; classes: - "and_ok" and => { "absent_keep", "absent_repair", "present_keep", "present_repair", - "attributes_keep", "attributes_repair", "password_keep", "password_repair", - "locked_keep", "locked_repair_by_add", "locked_repair_by_mod" }; - "not_ok" or => { "not_absent_keep", "not_absent_repair", "not_present_keep", "not_present_repair", - "not_attributes_keep", "not_attributes_repair", "not_password_keep", "not_password_repair", - "not_locked_keep", "not_locked_repair_by_add", "not_locked_repair_by_mod" }; + "and_ok" + and => { + "absent_keep", + "absent_repair", + "present_keep", + "present_repair", + "attributes_keep", + "attributes_repair", + "password_keep", + "password_repair", + "locked_keep", + "locked_repair_by_add", + "locked_repair_by_mod", + }; + + "not_ok" + or => { + "not_absent_keep", + "not_absent_repair", + "not_present_keep", + "not_present_repair", + "not_attributes_keep", + "not_attributes_repair", + "not_password_keep", + "not_password_repair", + "not_locked_keep", + "not_locked_repair_by_add", + "not_locked_repair_by_mod", + }; "ok" and => { "and_ok", "!not_ok" }; "fail" or => { "!and_ok", "not_ok" }; @@ -152,52 +199,73 @@ bundle agent test reports: !absent_keep.DEBUG:: "absent_keep is NOT set, but should be"; + !absent_repair.DEBUG:: "absent_repair is NOT set, but should be"; + !present_keep.DEBUG:: "present_keep is NOT set, but should be"; + !present_repair.DEBUG:: "present_repair is NOT set, but should be"; + !attributes_keep.DEBUG:: "attributes_keep is NOT set, but should be"; + !attributes_repair.DEBUG:: "attributes_repair is NOT set, but should be"; + !password_keep.DEBUG:: "password_keep is NOT set, but should be"; + !password_repair.DEBUG:: "password_repair is NOT set, but should be"; + !locked_keep.DEBUG:: "locked_keep is NOT set, but should be"; + !locked_repair_by_add.DEBUG:: "locked_repair_by_add is NOT set, but should be"; + !locked_repair_by_mod.DEBUG:: "locked_repair_by_mod is NOT set, but should be"; not_absent_keep.DEBUG:: "not_absent_keep is SET, but shouldn't be"; + not_absent_repair.DEBUG:: "not_absent_repair is SET, but shouldn't be"; + not_present_keep.DEBUG:: "not_present_keep is SET, but shouldn't be"; + not_present_repair.DEBUG:: "not_present_repair is SET, but shouldn't be"; + not_attributes_keep.DEBUG:: "not_attributes_keep is SET, but shouldn't be"; + not_attributes_repair.DEBUG:: "not_attributes_repair is SET, but shouldn't be"; + not_password_keep.DEBUG:: "not_password_keep is SET, but shouldn't be"; + not_password_repair.DEBUG:: "not_password_repair is SET, but shouldn't be"; + not_locked_keep.DEBUG:: "not_locked_keep is SET, but shouldn't be"; + not_locked_repair_by_add.DEBUG:: "not_locked_repair_by_add is SET, but shouldn't be"; + not_locked_repair_by_mod.DEBUG:: "not_locked_repair_by_mod is SET, but shouldn't be"; ok:: "$(this.promise_filename) Pass"; + fail|!ok:: "$(this.promise_filename) FAIL"; } @@ -215,7 +283,6 @@ body classes set_classes_kept_repaired(x, y) } ####################################################### - bundle agent check { } diff --git a/tests/acceptance/17_users/unsafe/10_remove_user.cf b/tests/acceptance/17_users/unsafe/10_remove_user.cf index f7da93e393..d689dfbcf1 100644 --- a/tests/acceptance/17_users/unsafe/10_remove_user.cf +++ b/tests/acceptance/17_users/unsafe/10_remove_user.cf @@ -1,52 +1,48 @@ bundle common test_meta { vars: - "description" string => "A user present gets removed"; - "story_id" string => "5526"; - "covers" string => "operational_repaired"; + "description" string => "A user present gets removed"; + "story_id" string => "5526"; + "covers" string => "operational_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { users: - "johndoe" - policy => "present"; + "johndoe" policy => "present"; } ####################################################### - bundle agent test { users: - "johndoe" - policy => "absent"; + "johndoe" policy => "absent"; } ####################################################### - bundle agent check { methods: - "any" usebundle => user_exists("johndoe", "failure", "success"), + "any" + usebundle => user_exists("johndoe", "failure", "success"), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/10_remove_user_warn.cf b/tests/acceptance/17_users/unsafe/10_remove_user_warn.cf index 6349e4601b..e895cde7a1 100644 --- a/tests/acceptance/17_users/unsafe/10_remove_user_warn.cf +++ b/tests/acceptance/17_users/unsafe/10_remove_user_warn.cf @@ -1,30 +1,26 @@ bundle common test_meta { vars: - "description" string => "A user present gets removed (dry run)"; - "story_id" string => "5526"; - "covers" string => "dryrun_repaired"; + "description" string => "A user present gets removed (dry run)"; + "story_id" string => "5526"; + "covers" string => "dryrun_repaired"; } ####################################################### - body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } ####################################################### - bundle agent init { users: - "johndoe" - policy => "present"; + "johndoe" policy => "present"; } ####################################################### - bundle agent test { users: @@ -39,20 +35,21 @@ body action test_action } ####################################################### - bundle agent check { methods: - "any" usebundle => user_exists("johndoe", "success", "failure"), + "any" + usebundle => user_exists("johndoe", "success", "failure"), classes => always("methods_run"); classes: - "ready" expression => "methods_run"; - "ok" and => { "success", "!failure" }; + "ready" expression => "methods_run"; + "ok" and => { "success", "!failure" }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/15_hpux_set_trusted_mode.cf b/tests/acceptance/17_users/unsafe/15_hpux_set_trusted_mode.cf index 64b31d6ae5..223a7966d5 100644 --- a/tests/acceptance/17_users/unsafe/15_hpux_set_trusted_mode.cf +++ b/tests/acceptance/17_users/unsafe/15_hpux_set_trusted_mode.cf @@ -1,25 +1,23 @@ # Not a test, but just setting up trusted mode on HPUX. - body common control { - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { meta: - "test_skip_unsupported" string => "!hpux"; + "test_skip_unsupported" string => "!hpux"; classes: - "trusted_mode" - expression => fileexists("/etc/shadow"), - scope => "namespace"; + "trusted_mode" + expression => fileexists("/etc/shadow"), + scope => "namespace"; commands: !trusted_mode:: - "$(G.echo) yes | /usr/sbin/pwconv" - contain => in_shell; + "$(G.echo) yes | /usr/sbin/pwconv" contain => in_shell; } bundle agent check @@ -27,6 +25,7 @@ bundle agent check reports: trusted_mode:: "$(this.promise_filename) Pass"; + !trusted_mode:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/20_modify_user_missing_secondary_group.cf b/tests/acceptance/17_users/unsafe/20_modify_user_missing_secondary_group.cf index 9389e17eed..40313f47cf 100644 --- a/tests/acceptance/17_users/unsafe/20_modify_user_missing_secondary_group.cf +++ b/tests/acceptance/17_users/unsafe/20_modify_user_missing_secondary_group.cf @@ -1,7 +1,7 @@ body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init @@ -13,8 +13,10 @@ bundle agent init "$(G.sudo) $(user_tests.pw_path) $(G.groupdel) testg2"; "$(G.sudo) $(user_tests.pw_path) $(G.groupadd) testg1"; "$(G.sudo) $(user_tests.pw_path) $(G.useradd) testu"; + freebsd:: "$(G.sudo) $(user_tests.pw_path) $(G.usermod) testu -G testg1"; + !freebsd:: "$(G.sudo) $(user_tests.pw_path) $(G.usermod) -G testg1 testu"; } @@ -27,31 +29,46 @@ bundle agent test should result in no changes to existing secondary groups."; users: - "testu" - policy => "present"; + "testu" policy => "present"; } bundle agent check { methods: - "any" usebundle => user_is_in_secondary_group("testu", "testg1", "testg1_success", "testg1_failure"), + "any" + usebundle => user_is_in_secondary_group( + "testu", "testg1", "testg1_success", "testg1_failure" + ), classes => always("testg1_method_run"); - "any" usebundle => user_is_in_secondary_group("testu", "testg2", "testg2_success", "testg2_failure"), + "any" + usebundle => user_is_in_secondary_group( + "testu", "testg2", "testg2_success", "testg2_failure" + ), classes => always("testg2_method_run"); - "any" usebundle => user_exists("testu", "testu_success", "testu_failure"), + "any" + usebundle => user_exists("testu", "testu_success", "testu_failure"), classes => always("testu_method_run"); classes: - "ready" and => { "testg1_method_run", "testg2_method_run", "testu_method_run" }; - "ok" and => { "testg1_success", "!testg1_failure", - "!testg2_success", "testg2_failure", - "testu_success", "!testu_failure" }; + "ready" + and => { "testg1_method_run", "testg2_method_run", "testu_method_run" }; + + "ok" + and => { + "testg1_success", + "!testg1_failure", + "!testg2_success", + "testg2_failure", + "testu_success", + "!testu_failure", + }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/20_modify_user_secondary_groups.cf b/tests/acceptance/17_users/unsafe/20_modify_user_secondary_groups.cf index 99d891d772..269fdfa7ae 100644 --- a/tests/acceptance/17_users/unsafe/20_modify_user_secondary_groups.cf +++ b/tests/acceptance/17_users/unsafe/20_modify_user_secondary_groups.cf @@ -1,7 +1,7 @@ body common control { - inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "user_queries.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init @@ -13,8 +13,10 @@ bundle agent init "$(G.sudo) $(user_tests.pw_path) $(G.groupdel) testg2"; "$(G.sudo) $(user_tests.pw_path) $(G.groupadd) testg1"; "$(G.sudo) $(user_tests.pw_path) $(G.useradd) testu"; + freebsd:: "$(G.sudo) $(user_tests.pw_path) $(G.usermod) testu -G testg1"; + !freebsd:: "$(G.sudo) $(user_tests.pw_path) $(G.usermod) -G testg1 testu"; } @@ -34,24 +36,40 @@ bundle agent test bundle agent check { methods: - "any" usebundle => user_is_in_secondary_group("testu", "testg1", "testg1_success", "testg1_failure"), + "any" + usebundle => user_is_in_secondary_group( + "testu", "testg1", "testg1_success", "testg1_failure" + ), classes => always("testg1_method_run"); - "any" usebundle => user_is_in_secondary_group("testu", "testg2", "testg2_success", "testg2_failure"), + "any" + usebundle => user_is_in_secondary_group( + "testu", "testg2", "testg2_success", "testg2_failure" + ), classes => always("testg2_method_run"); - "any" usebundle => user_exists("testu", "testu_success", "testu_failure"), + "any" + usebundle => user_exists("testu", "testu_success", "testu_failure"), classes => always("testu_method_run"); classes: - "ready" and => { "testg1_method_run", "testg2_method_run", "testu_method_run" }; - "ok" and => { "testg1_success", "!testg1_failure", - "!testg2_success", "testg2_failure", - "testu_success", "!testu_failure" }; + "ready" + and => { "testg1_method_run", "testg2_method_run", "testu_method_run" }; + + "ok" + and => { + "testg1_success", + "!testg1_failure", + "!testg2_success", + "testg2_failure", + "testu_success", + "!testu_failure", + }; reports: ok.ready:: "$(this.promise_filename) Pass"; + !ok.ready:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/17_users/unsafe/user_command.cf b/tests/acceptance/17_users/unsafe/user_command.cf index 946f20ce35..0a32e98a88 100644 --- a/tests/acceptance/17_users/unsafe/user_command.cf +++ b/tests/acceptance/17_users/unsafe/user_command.cf @@ -3,41 +3,37 @@ # See ticket ENT-13535 for info. # ############################################################################## - body common control { - bundlesequence => { "init", "test", "check", "clean" }; + bundlesequence => { "init", "test", "check", "clean" }; } body delete tidy { dirlinks => "delete"; - rmdirs => "true"; + rmdirs => "true"; } ############################################################################## - bundle agent init { users: - "test_user" - policy => "absent"; + "test_user" policy => "absent"; files: - "/tmp/some-random-file.txt" - delete => tidy; + "/tmp/some-random-file.txt" delete => tidy; } ############################################################################## - bundle agent test { meta: - "description" -> { "ENT-13535" } - string => "See ticket ENT-13535 for info"; - "test_skip_unsupported" - string => "windows", - comment => "Not applicable for Windows since it uses a C API"; + "description" -> { "ENT-13535" } + string => "See ticket ENT-13535 for info"; + + "test_skip_unsupported" + string => "windows", + comment => "Not applicable for Windows since it uses a C API"; users: linux:: @@ -46,16 +42,15 @@ bundle agent test } ############################################################################## - bundle agent check { reports: - "$(this.promise_filename) $(with)" - with => ifelse(fileexists("/tmp/some-random-file.txt"), "FAIL", "Pass"); + "$(this.promise_filename) $(with)" + with => ifelse(fileexists("/tmp/some-random-file.txt"), "FAIL", "Pass"); } bundle agent clean { methods: - "init"; + "init"; } diff --git a/tests/acceptance/20_meta/basic.cf b/tests/acceptance/20_meta/basic.cf index 2e666cbd1a..b4b99a1055 100644 --- a/tests/acceptance/20_meta/basic.cf +++ b/tests/acceptance/20_meta/basic.cf @@ -3,65 +3,69 @@ # Test basics of meta promises # ####################################################### - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent init { } ####################################################### - bundle agent test { meta: - "s" string => "Wally Walleye"; - "l" slist => { "Be", "Hg", "Pb" }; - "c" data => parsejson(' + "s" string => "Wally Walleye"; + "l" slist => { "Be", "Hg", "Pb" }; + + "c" + data => parsejson( + ' { "first": 1, "seconds": 2, "third": [ "a", "b", "c" ], "fourth": null } -'); +' + ); } bundle agent check { vars: - "actual[s]" string => $(test_meta.s); - "actual[l]" string => format("%S", "test_meta.l"); - "actual[c]" string => format("%S", "test_meta.c"); + "actual[s]" string => $(test_meta.s); + "actual[l]" string => format("%S", "test_meta.l"); + "actual[c]" string => format("%S", "test_meta.c"); + "expected[s]" string => "Wally Walleye"; + "expected[l]" string => '{ "Be", "Hg", "Pb" }'; + + "expected[c]" + string => '{ "first": 1, "seconds": 2, "third": [ "a", "b", "c" ], "fourth": null }'; - "expected[s]" string => "Wally Walleye"; - "expected[l]" string => '{ "Be", "Hg", "Pb" }'; - "expected[c]" string => '{ "first": 1, "seconds": 2, "third": [ "a", "b", "c" ], "fourth": null }'; - "tests" slist => getindices(expected); + "tests" slist => getindices(expected); classes: - "ok_$(tests)" expression => strcmp("$(actual[$(tests)])", "$(expected[$(tests)])"); - "ok_$(tests)" not => strcmp("$(actual[$(tests)])", "$(expected[$(tests)])"); + "ok_$(tests)" + expression => strcmp("$(actual[$(tests)])", "$(expected[$(tests)])"); - "ok" and => { "ok_s", "ok_l", "ok_c" }; + "ok_$(tests)" not => strcmp("$(actual[$(tests)])", "$(expected[$(tests)])"); + "ok" and => { "ok_s", "ok_l", "ok_c" }; reports: DEBUG:: - "OK: $(tests) got $(actual[$(tests)])" - if => "ok_$(tests)"; + "OK: $(tests) got $(actual[$(tests)])" if => "ok_$(tests)"; "FAIL: $(tests) got $(actual[$(tests)]) != $(expected[$(tests)])" - if => "not_ok_$(tests)"; + if => "not_ok_$(tests)"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/20_meta/this_bundle_meta_expands.cf b/tests/acceptance/20_meta/this_bundle_meta_expands.cf index a10d8db7dd..b6b51b5892 100644 --- a/tests/acceptance/20_meta/this_bundle_meta_expands.cf +++ b/tests/acceptance/20_meta/this_bundle_meta_expands.cf @@ -6,18 +6,17 @@ bundle common test_meta { vars: - "description" string => "Can dereference meta vars."; + "description" string => "Can dereference meta vars."; } body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } ####################################################### - bundle agent check { meta: @@ -29,30 +28,31 @@ bundle agent check "list" slist => { "element1", "element2" }; classes: - "can_deref_this_bundle_meta_string" - expression => strcmp("$($(this.bundle)_meta.string)", "value"); + "can_deref_this_bundle_meta_string" + expression => strcmp("$($(this.bundle)_meta.string)", "value"); - "can_deref_direct_meta_list_element1" - #expression => strcmp("$($(this.bundle)_meta.list)", "element1"); - expression => strcmp("$(check_meta.list)", "element1"); + "can_deref_direct_meta_list_element1" + #expression => strcmp("$($(this.bundle)_meta.list)", "element1"); + expression => strcmp("$(check_meta.list)", "element1"); - "can_deref_direct_meta_list_element2" - #expression => strcmp("$($(this.bundle)_meta.list)", "element2"); - expression => strcmp("$(check_meta.list)", "element2"); + "can_deref_direct_meta_list_element2" + #expression => strcmp("$($(this.bundle)_meta.list)", "element2"); + expression => strcmp("$(check_meta.list)", "element2"); - "can_deref_this_bundle_meta_list_element1" - expression => strcmp("$($(this.bundle)_meta.list)", "element1"); + "can_deref_this_bundle_meta_list_element1" + expression => strcmp("$($(this.bundle)_meta.list)", "element1"); - "can_deref_this_bundle_meta_list_element2" - expression => strcmp("$($(this.bundle)_meta.list)", "element2"); + "can_deref_this_bundle_meta_list_element2" + expression => strcmp("$($(this.bundle)_meta.list)", "element2"); - "ok" and => { - "can_deref_this_bundle_meta_string", - "can_deref_direct_meta_list_element1", - "can_deref_direct_meta_list_element2", - "can_deref_this_bundle_meta_list_element1", - "can_deref_this_bundle_meta_list_element2", - }; + "ok" + and => { + "can_deref_this_bundle_meta_string", + "can_deref_direct_meta_list_element1", + "can_deref_direct_meta_list_element2", + "can_deref_this_bundle_meta_list_element1", + "can_deref_this_bundle_meta_list_element2", + }; reports: DEBUG:: @@ -62,12 +62,13 @@ bundle agent check "DEBUG $(this.bundle): Can't dereference meta string var with this.bundle" unless => "can_deref_this_bundle_meta_string"; + "DEBUG $(this.bundle): Can't dereference meta list directly" unless => "can_deref_direct_meta_list_element1.can_deref_direct_meta_list_element2"; + "DEBUG $(this.bundle): Can't dereference meta list with this.bundle" unless => "can_deref_this_bundle_meta_list_element1.can_deref_this_bundle_meta_list_element2"; - ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/21_methods/reachable/bundle_usebundle_call_by_arg_defined.cf b/tests/acceptance/21_methods/reachable/bundle_usebundle_call_by_arg_defined.cf index 51c54b81f8..b6f9aa4855 100644 --- a/tests/acceptance/21_methods/reachable/bundle_usebundle_call_by_arg_defined.cf +++ b/tests/acceptance/21_methods/reachable/bundle_usebundle_call_by_arg_defined.cf @@ -16,7 +16,6 @@ bundle agent bar(x) methods: # Will call baz, which exists, should work "foo" usebundle => "$(x)"; - } bundle agent main diff --git a/tests/acceptance/22_cf-runagent/serial/bundles_all_allowed_regex_disallowed_admitted.cf b/tests/acceptance/22_cf-runagent/serial/bundles_all_allowed_regex_disallowed_admitted.cf index 46e0a5e6bc..957b87f84b 100644 --- a/tests/acceptance/22_cf-runagent/serial/bundles_all_allowed_regex_disallowed_admitted.cf +++ b/tests/acceptance/22_cf-runagent/serial/bundles_all_allowed_regex_disallowed_admitted.cf @@ -1,51 +1,64 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Expected output in the exec_args.txt file - "any" usebundle => file_make("$(G.testdir)/expected_args.txt", - "--bundlesequence bundle"); - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Expected output in the exec_args.txt file + "any" + usebundle => file_make( + "$(G.testdir)/expected_args.txt", "--bundlesequence bundle" + ); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/bundles_all_allowed_regex_disallowed.22013.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/bundles_all_allowed_regex_disallowed.22013.srv" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10404" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10404" }; + vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22013 is bundles_all_allowed_regex_disallowed.22013.srv - run_runagent("-H 127.0.0.1:22013 --remote-bundles bundle $(runagent_cf)"); + "any" + # Port 22013 is bundles_all_allowed_regex_disallowed.22013.srv + usebundle => run_runagent( + "-H 127.0.0.1:22013 --remote-bundles bundle $(runagent_cf)" + ); } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt", - "$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testdir)/expected_args.txt", + "$(G.testdir)/exec_args.txt", + "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/bundles_all_allowed_regex_disallowed.22013.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/bundles_all_allowed_regex_disallowed.22013.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/bundles_all_allowed_regex_disallowed_denied.cf b/tests/acceptance/22_cf-runagent/serial/bundles_all_allowed_regex_disallowed_denied.cf index 963256eafe..b1a6ffb906 100644 --- a/tests/acceptance/22_cf-runagent/serial/bundles_all_allowed_regex_disallowed_denied.cf +++ b/tests/acceptance/22_cf-runagent/serial/bundles_all_allowed_regex_disallowed_denied.cf @@ -1,45 +1,52 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/bundles_all_allowed_regex_disallowed.22013.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/bundles_all_allowed_regex_disallowed.22013.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22013 is bundles_all_allowed_regex_disallowed.22013.srv - run_runagent("-H 127.0.0.1:22013 --remote-bundles bundle1 $(runagent_cf)"); + "any" + # Port 22013 is bundles_all_allowed_regex_disallowed.22013.srv + usebundle => run_runagent( + "-H 127.0.0.1:22013 --remote-bundles bundle1 $(runagent_cf)" + ); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/bundles_all_allowed_regex_disallowed.22013.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/bundles_all_allowed_regex_disallowed.22013.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/bundles_all_allowed_roles_disallowed_denied.cf b/tests/acceptance/22_cf-runagent/serial/bundles_all_allowed_roles_disallowed_denied.cf index 7f549e2f73..44fcd88ed7 100644 --- a/tests/acceptance/22_cf-runagent/serial/bundles_all_allowed_roles_disallowed_denied.cf +++ b/tests/acceptance/22_cf-runagent/serial/bundles_all_allowed_roles_disallowed_denied.cf @@ -1,45 +1,52 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/bundles_all_allowed.22010.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/bundles_all_allowed.22010.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22010 is bundles_all_allowed.22010.srv - run_runagent("-H 127.0.0.1:22010 --remote-bundles bundle1 -D role $(runagent_cf)"); + "any" + # Port 22010 is bundles_all_allowed.22010.srv + usebundle => run_runagent( + "-H 127.0.0.1:22010 --remote-bundles bundle1 -D role $(runagent_cf)" + ); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/bundles_all_allowed.22010.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/bundles_all_allowed.22010.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/cfruncommand_argv0_quoted.cf b/tests/acceptance/22_cf-runagent/serial/cfruncommand_argv0_quoted.cf index 8bc55b830d..b310180175 100644 --- a/tests/acceptance/22_cf-runagent/serial/cfruncommand_argv0_quoted.cf +++ b/tests/acceptance/22_cf-runagent/serial/cfruncommand_argv0_quoted.cf @@ -1,51 +1,59 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Expected output in the exec_args.txt file - "any" usebundle => file_make("$(G.testdir)/expected_args.txt", - ""); - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Expected output in the exec_args.txt file + "any" usebundle => file_make("$(G.testdir)/expected_args.txt", ""); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/cfruncommand_argv0_quoted.22014.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/cfruncommand_argv0_quoted.22014.srv" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10404" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10404" }; + vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22014 is cfruncommand_argv0_quoted.22014.srv - run_runagent("-H 127.0.0.1:22014 $(runagent_cf)"); + "any" + # Port 22014 is cfruncommand_argv0_quoted.22014.srv + usebundle => run_runagent("-H 127.0.0.1:22014 $(runagent_cf)"); } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt", - "$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testdir)/expected_args.txt", + "$(G.testdir)/exec_args.txt", + "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/cfruncommand_argv0_quoted.22014.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/cfruncommand_argv0_quoted.22014.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/cfruncommand_deny_root.cf b/tests/acceptance/22_cf-runagent/serial/cfruncommand_deny_root.cf index c8fd9d0fe7..0f193363c7 100644 --- a/tests/acceptance/22_cf-runagent/serial/cfruncommand_deny_root.cf +++ b/tests/acceptance/22_cf-runagent/serial/cfruncommand_deny_root.cf @@ -1,44 +1,48 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/cfruncommand_deny_root.22001.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/cfruncommand_deny_root.22001.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - run_runagent("-H 127.0.0.1:22001 $(runagent_cf)"); + "any" usebundle => run_runagent("-H 127.0.0.1:22001 $(runagent_cf)"); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/cfruncommand_deny_root.22001.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/cfruncommand_deny_root.22001.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/cfruncommand_no_access_1.cf b/tests/acceptance/22_cf-runagent/serial/cfruncommand_no_access_1.cf index 56655451c1..cfcb3cd4b5 100644 --- a/tests/acceptance/22_cf-runagent/serial/cfruncommand_no_access_1.cf +++ b/tests/acceptance/22_cf-runagent/serial/cfruncommand_no_access_1.cf @@ -1,33 +1,33 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/cfruncommand_no_access.22002.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/cfruncommand_no_access.22002.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22002 is cfruncommand_no_access.22002.srv - run_runagent("-H 127.0.0.1:22002 $(runagent_cf)"); + "any" + # Port 22002 is cfruncommand_no_access.22002.srv + usebundle => run_runagent("-H 127.0.0.1:22002 $(runagent_cf)"); } bundle agent check @@ -35,12 +35,17 @@ bundle agent check # Execution output file should still not be there, since cfruncommand # invocation from cf-serverd should have been denied. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/cfruncommand_no_access.22002.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/cfruncommand_no_access.22002.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/cfruncommand_no_access_2.cf b/tests/acceptance/22_cf-runagent/serial/cfruncommand_no_access_2.cf index 7e033ca54b..f48cdc2145 100644 --- a/tests/acceptance/22_cf-runagent/serial/cfruncommand_no_access_2.cf +++ b/tests/acceptance/22_cf-runagent/serial/cfruncommand_no_access_2.cf @@ -1,33 +1,33 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/cfruncommand_no_access.22003.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/cfruncommand_no_access.22003.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22003 is cfruncommand_no_access.22003.srv - run_runagent("-H 127.0.0.1:22003 $(runagent_cf)"); + "any" + # Port 22003 is cfruncommand_no_access.22003.srv + usebundle => run_runagent("-H 127.0.0.1:22003 $(runagent_cf)"); } bundle agent check @@ -35,12 +35,17 @@ bundle agent check # Execution output file should still not be there, since cfruncommand # invocation from cf-serverd should have been denied. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/cfruncommand_no_access.22003.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/cfruncommand_no_access.22003.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/cfruncommand_no_access_3.cf b/tests/acceptance/22_cf-runagent/serial/cfruncommand_no_access_3.cf index aedf501d3b..373f3c0e2d 100644 --- a/tests/acceptance/22_cf-runagent/serial/cfruncommand_no_access_3.cf +++ b/tests/acceptance/22_cf-runagent/serial/cfruncommand_no_access_3.cf @@ -1,33 +1,33 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/cfruncommand_no_access.22004.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/cfruncommand_no_access.22004.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22004 is cfruncommand_no_access.22004.srv - run_runagent("-H 127.0.0.1:22004 $(runagent_cf)"); + "any" + # Port 22004 is cfruncommand_no_access.22004.srv + usebundle => run_runagent("-H 127.0.0.1:22004 $(runagent_cf)"); } bundle agent check @@ -35,12 +35,17 @@ bundle agent check # Execution output file should still not be there, since cfruncommand # invocation from cf-serverd should have been denied. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/cfruncommand_no_access.22004.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/cfruncommand_no_access.22004.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/cfruncommand_open.cf b/tests/acceptance/22_cf-runagent/serial/cfruncommand_open.cf index bdf065ff3a..525fb5143b 100644 --- a/tests/acceptance/22_cf-runagent/serial/cfruncommand_open.cf +++ b/tests/acceptance/22_cf-runagent/serial/cfruncommand_open.cf @@ -1,51 +1,59 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Expected output in the exec_args.txt file - "any" usebundle => file_make("$(G.testdir)/expected_args.txt", - ""); - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Expected output in the exec_args.txt file + "any" usebundle => file_make("$(G.testdir)/expected_args.txt", ""); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/cfruncommand_open.22000.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/cfruncommand_open.22000.srv" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10404" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10404" }; + vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22000 is cfruncommand_open.22000.srv - run_runagent("-H 127.0.0.1:22000 $(runagent_cf)"); + "any" + # Port 22000 is cfruncommand_open.22000.srv + usebundle => run_runagent("-H 127.0.0.1:22000 $(runagent_cf)"); } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt", - "$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testdir)/expected_args.txt", + "$(G.testdir)/exec_args.txt", + "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/cfruncommand_open.22000.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/cfruncommand_open.22000.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle1_admitted_1.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle1_admitted_1.cf index 5a7c77a5c3..0bca6cd43f 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle1_admitted_1.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle1_admitted_1.cf @@ -1,51 +1,64 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Expected output in the exec_args.txt file - "any" usebundle => file_make("$(G.testdir)/expected_args.txt", - "--bundlesequence bundle1"); - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Expected output in the exec_args.txt file + "any" + usebundle => file_make( + "$(G.testdir)/expected_args.txt", "--bundlesequence bundle1" + ); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/bundles_all_allowed.22010.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/bundles_all_allowed.22010.srv" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10404" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10404" }; + vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22010 is bundles_all_allowed.22010.srv - run_runagent("-H 127.0.0.1:22010 --remote-bundles bundle1 $(runagent_cf)"); + "any" + # Port 22010 is bundles_all_allowed.22010.srv + usebundle => run_runagent( + "-H 127.0.0.1:22010 --remote-bundles bundle1 $(runagent_cf)" + ); } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt", - "$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testdir)/expected_args.txt", + "$(G.testdir)/exec_args.txt", + "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/bundles_all_allowed.22010.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/bundles_all_allowed.22010.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle1_bundle2_admitted_1.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle1_bundle2_admitted_1.cf index 07872af5b9..422e3da493 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle1_bundle2_admitted_1.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle1_bundle2_admitted_1.cf @@ -1,51 +1,64 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Expected output in the exec_args.txt file - "any" usebundle => file_make("$(G.testdir)/expected_args.txt", - "--bundlesequence bundle1,bundle2"); - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Expected output in the exec_args.txt file + "any" + usebundle => file_make( + "$(G.testdir)/expected_args.txt", "--bundlesequence bundle1,bundle2" + ); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/bundles_all_allowed.22010.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/bundles_all_allowed.22010.srv" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10404" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10404" }; + vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22010 is bundles_all_allowed.22010.srv - run_runagent("-H 127.0.0.1:22010 --remote-bundles bundle1,bundle2 $(runagent_cf)"); + "any" + # Port 22010 is bundles_all_allowed.22010.srv + usebundle => run_runagent( + "-H 127.0.0.1:22010 --remote-bundles bundle1,bundle2 $(runagent_cf)" + ); } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt", - "$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testdir)/expected_args.txt", + "$(G.testdir)/exec_args.txt", + "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/bundles_all_allowed.22010.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/bundles_all_allowed.22010.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle1_bundle2_denied.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle1_bundle2_denied.cf index 781126803a..96e9d80afc 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle1_bundle2_denied.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle1_bundle2_denied.cf @@ -1,45 +1,52 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22012 is bundle2_role2_only_allowed.22012.srv - run_runagent("-H 127.0.0.1:22012 --remote-bundles bundle1,bundle2 $(runagent_cf)"); + "any" + # Port 22012 is bundle2_role2_only_allowed.22012.srv + usebundle => run_runagent( + "-H 127.0.0.1:22012 --remote-bundles bundle1,bundle2 $(runagent_cf)" + ); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle1_denied_1.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle1_denied_1.cf index bade35c183..fab0ae65c5 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle1_denied_1.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle1_denied_1.cf @@ -1,45 +1,52 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/cfruncommand_open.22000.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/cfruncommand_open.22000.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22000 is cfruncommand_open.22000.srv - run_runagent("-H 127.0.0.1:22000 --remote-bundles bundle1 $(runagent_cf)"); + "any" + # Port 22000 is cfruncommand_open.22000.srv + usebundle => run_runagent( + "-H 127.0.0.1:22000 --remote-bundles bundle1 $(runagent_cf)" + ); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/cfruncommand_open.22000.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/cfruncommand_open.22000.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle2_admitted.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle2_admitted.cf index 21d3e2b78e..6a628d80df 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle2_admitted.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle2_admitted.cf @@ -1,51 +1,64 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Expected output in the exec_args.txt file - "any" usebundle => file_make("$(G.testdir)/expected_args.txt", - "--bundlesequence bundle2"); - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Expected output in the exec_args.txt file + "any" + usebundle => file_make( + "$(G.testdir)/expected_args.txt", "--bundlesequence bundle2" + ); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10404" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10404" }; + vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22012 is bundle2_role2_only_allowed.22012.srv - run_runagent("-H 127.0.0.1:22012 --remote-bundles bundle2 $(runagent_cf)"); + "any" + # Port 22012 is bundle2_role2_only_allowed.22012.srv + usebundle => run_runagent( + "-H 127.0.0.1:22012 --remote-bundles bundle2 $(runagent_cf)" + ); } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt", - "$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testdir)/expected_args.txt", + "$(G.testdir)/exec_args.txt", + "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle2_bundle1_denied.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle2_bundle1_denied.cf index b0b71ba0cd..fc33ee95d0 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle2_bundle1_denied.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle2_bundle1_denied.cf @@ -1,45 +1,52 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22012 is bundle2_role2_only_allowed.22012.srv - run_runagent("-H 127.0.0.1:22012 --remote-bundles bundle2,bundle1 $(runagent_cf)"); + "any" + # Port 22012 is bundle2_role2_only_allowed.22012.srv + usebundle => run_runagent( + "-H 127.0.0.1:22012 --remote-bundles bundle2,bundle1 $(runagent_cf)" + ); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle_denied.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle_denied.cf index af79d87d76..874ad6677c 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle_denied.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-B_bundle_denied.cf @@ -1,45 +1,52 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22012 is bundle2_role2_only_allowed.22012.srv - run_runagent("-H 127.0.0.1:22012 --remote-bundles bundle $(runagent_cf)"); + "any" + # Port 22012 is bundle2_role2_only_allowed.22012.srv + usebundle => run_runagent( + "-H 127.0.0.1:22012 --remote-bundles bundle $(runagent_cf)" + ); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-B_specialchars_denied.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-B_specialchars_denied.cf index ba6b2490d1..a80d578292 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-B_specialchars_denied.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-B_specialchars_denied.cf @@ -1,45 +1,52 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/bundles_roles_all_allowed.22011.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/bundles_roles_all_allowed.22011.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22011 is bundles_roles_all_allowed.22011.srv - run_runagent("-H 127.0.0.1:22011 --remote-bundles bundle@ $(runagent_cf)"); + "any" + # Port 22011 is bundles_roles_all_allowed.22011.srv + usebundle => run_runagent( + "-H 127.0.0.1:22011 --remote-bundles bundle@ $(runagent_cf)" + ); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/bundles_roles_all_allowed.22011.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/bundles_roles_all_allowed.22011.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_ns1_role2_-B_bundle2_denied.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_ns1_role2_-B_bundle2_denied.cf index 56dfa30a66..26f2a0c788 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_ns1_role2_-B_bundle2_denied.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_ns1_role2_-B_bundle2_denied.cf @@ -1,45 +1,52 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/ns2_bundle2_ns1_role2_only_allowed.22015.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/ns2_bundle2_ns1_role2_only_allowed.22015.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22015 is ns2_bundle2_ns1_role2_only_allowed.22015.srv - run_runagent("-H 127.0.0.1:22015 -D ns1:role2 --remote-bundles bundle2 $(runagent_cf)"); + "any" + # Port 22015 is ns2_bundle2_ns1_role2_only_allowed.22015.srv + usebundle => run_runagent( + "-H 127.0.0.1:22015 -D ns1:role2 --remote-bundles bundle2 $(runagent_cf)" + ); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/ns2_bundle2_ns1_role2_only_allowed.22015.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/ns2_bundle2_ns1_role2_only_allowed.22015.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_ns1_role2_-B_ns2_bundle2_admitted.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_ns1_role2_-B_ns2_bundle2_admitted.cf index 23b2778ccb..f1533f871a 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_ns1_role2_-B_ns2_bundle2_admitted.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_ns1_role2_-B_ns2_bundle2_admitted.cf @@ -1,51 +1,65 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Expected output in the exec_args.txt file - "any" usebundle => file_make("$(G.testdir)/expected_args.txt", - "-D ns1:role2 --bundlesequence ns2:bundle2"); - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Expected output in the exec_args.txt file + "any" + usebundle => file_make( + "$(G.testdir)/expected_args.txt", + "-D ns1:role2 --bundlesequence ns2:bundle2" + ); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/ns2_bundle2_ns1_role2_only_allowed.22015.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/ns2_bundle2_ns1_role2_only_allowed.22015.srv" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10404" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10404" }; + vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22015 is ns2:bundle2_ns1:role2_only_allowed.22012.srv - run_runagent("-H 127.0.0.1:22015 -D ns1:role2 --remote-bundles ns2:bundle2 $(runagent_cf)"); + "any" + # Port 22015 is ns2:bundle2_ns1:role2_only_allowed.22012.srv + usebundle => run_runagent( + "-H 127.0.0.1:22015 -D ns1:role2 --remote-bundles ns2:bundle2 $(runagent_cf)" + ); } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt", - "$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testdir)/expected_args.txt", + "$(G.testdir)/exec_args.txt", + "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/ns2_bundle2_ns1_role2_only_allowed.22015.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/ns2_bundle2_ns1_role2_only_allowed.22015.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_ns1_role2_-B_ns2_bundle2_denied.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_ns1_role2_-B_ns2_bundle2_denied.cf index f1e987c2ad..5f299c30a8 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_ns1_role2_-B_ns2_bundle2_denied.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_ns1_role2_-B_ns2_bundle2_denied.cf @@ -1,45 +1,52 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22012 is bundle2_role2_only_allowed.22012.srv - run_runagent("-H 127.0.0.1:22012 -D ns1:role2 --remote-bundles ns2:bundle2 $(runagent_cf)"); + "any" + # Port 22012 is bundle2_role2_only_allowed.22012.srv + usebundle => run_runagent( + "-H 127.0.0.1:22012 -D ns1:role2 --remote-bundles ns2:bundle2 $(runagent_cf)" + ); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_ns2_role2_-B_ns2_bundle2_denied.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_ns2_role2_-B_ns2_bundle2_denied.cf index 27376ad93b..973da4bf04 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_ns2_role2_-B_ns2_bundle2_denied.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_ns2_role2_-B_ns2_bundle2_denied.cf @@ -1,45 +1,52 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/ns2_bundle2_ns1_role2_only_allowed.22015.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/ns2_bundle2_ns1_role2_only_allowed.22015.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22015 is ns2_bundle2_ns1_role2_only_allowed.22015.srv - run_runagent("-H 127.0.0.1:22015 -D ns2:role2 --remote-bundles ns2:bundle2 $(runagent_cf)"); + "any" + # Port 22015 is ns2_bundle2_ns1_role2_only_allowed.22015.srv + usebundle => run_runagent( + "-H 127.0.0.1:22015 -D ns2:role2 --remote-bundles ns2:bundle2 $(runagent_cf)" + ); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/ns2_bundle2_ns1_role2_only_allowed.22015.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/ns2_bundle2_ns1_role2_only_allowed.22015.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1-B_bundle1_admitted_1.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1-B_bundle1_admitted_1.cf index 30c5cd4c5f..1aa7a38693 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1-B_bundle1_admitted_1.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1-B_bundle1_admitted_1.cf @@ -1,51 +1,64 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Expected output in the exec_args.txt file - "any" usebundle => file_make("$(G.testdir)/expected_args.txt", - "-D role1 --bundlesequence bundle1"); - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Expected output in the exec_args.txt file + "any" + usebundle => file_make( + "$(G.testdir)/expected_args.txt", "-D role1 --bundlesequence bundle1" + ); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/bundles_roles_all_allowed.22011.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/bundles_roles_all_allowed.22011.srv" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10404" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10404" }; + vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22010 is bundles_roles_all_allowed.22011.srv - run_runagent("-H 127.0.0.1:22011 -D role1 --remote-bundles bundle1 $(runagent_cf)"); + "any" + # Port 22010 is bundles_roles_all_allowed.22011.srv + usebundle => run_runagent( + "-H 127.0.0.1:22011 -D role1 --remote-bundles bundle1 $(runagent_cf)" + ); } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt", - "$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testdir)/expected_args.txt", + "$(G.testdir)/exec_args.txt", + "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/bundles_roles_all_allowed.22011.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/bundles_roles_all_allowed.22011.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role12_denied_1.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role12_denied_1.cf index 95bb0ee48e..3791ad9530 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role12_denied_1.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role12_denied_1.cf @@ -1,46 +1,51 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/role1_root_allowed.22005.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/role1_root_allowed.22005.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22005 is role1_root_allowed.22005.srv - # It allows "role1" but should disallow "role12" - run_runagent("-H 127.0.0.1:22005 -D role12 $(runagent_cf)"); + "any" + # Port 22005 is role1_root_allowed.22005.srv + # It allows "role1" but should disallow "role12" + usebundle => run_runagent("-H 127.0.0.1:22005 -D role12 $(runagent_cf)"); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/role1_root_allowed.22005.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/role1_root_allowed.22005.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_-B_bundle2_denied.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_-B_bundle2_denied.cf index 5bc17fe037..695aee6f59 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_-B_bundle2_denied.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_-B_bundle2_denied.cf @@ -1,45 +1,52 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22012 is bundle2_role2_only_allowed.22012.srv - run_runagent("-H 127.0.0.1:22012 -D role1 --remote-bundles bundle2 $(runagent_cf)"); + "any" + # Port 22012 is bundle2_role2_only_allowed.22012.srv + usebundle => run_runagent( + "-H 127.0.0.1:22012 -D role1 --remote-bundles bundle2 $(runagent_cf)" + ); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_-D_role2_admitted.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_-D_role2_admitted.cf index bb4ef21d5e..7229329746 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_-D_role2_admitted.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_-D_role2_admitted.cf @@ -1,51 +1,64 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Expected output in the exec_args.txt file - "any" usebundle => file_make("$(G.testdir)/expected_args.txt", - "-D role1,role2"); - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Expected output in the exec_args.txt file + "any" + usebundle => file_make( + "$(G.testdir)/expected_args.txt", "-D role1,role2" + ); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/role1_role2_root_allowed.22008.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/role1_role2_root_allowed.22008.srv" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10404" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10404" }; + vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22008 is role1_role2_root_allowed.22008.srv - run_runagent("-H 127.0.0.1:22008 -D role1 -D role2 $(runagent_cf)"); + "any" + # Port 22008 is role1_role2_root_allowed.22008.srv + usebundle => run_runagent( + "-H 127.0.0.1:22008 -D role1 -D role2 $(runagent_cf)" + ); } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt", - "$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testdir)/expected_args.txt", + "$(G.testdir)/exec_args.txt", + "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/role1_role2_root_allowed.22008.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/role1_role2_root_allowed.22008.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_admitted_1.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_admitted_1.cf index 90e922c06b..1ba8bc5fc0 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_admitted_1.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_admitted_1.cf @@ -1,51 +1,59 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Expected output in the exec_args.txt file - "any" usebundle => file_make("$(G.testdir)/expected_args.txt", - "-D role1"); - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Expected output in the exec_args.txt file + "any" usebundle => file_make("$(G.testdir)/expected_args.txt", "-D role1"); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/role1_root_allowed.22005.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/role1_root_allowed.22005.srv" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10404" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10404" }; + vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22005 is role1_root_allowed.22005.srv - run_runagent("-H 127.0.0.1:22005 -D role1 $(runagent_cf)"); + "any" + # Port 22005 is role1_root_allowed.22005.srv + usebundle => run_runagent("-H 127.0.0.1:22005 -D role1 $(runagent_cf)"); } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt", - "$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testdir)/expected_args.txt", + "$(G.testdir)/exec_args.txt", + "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/role1_root_allowed.22005.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/role1_root_allowed.22005.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_admitted_2.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_admitted_2.cf index d4d7ba574a..5b80db2106 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_admitted_2.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_admitted_2.cf @@ -1,51 +1,59 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Expected output in the exec_args.txt file - "any" usebundle => file_make("$(G.testdir)/expected_args.txt", - "-D role1"); - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Expected output in the exec_args.txt file + "any" usebundle => file_make("$(G.testdir)/expected_args.txt", "-D role1"); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/allroles_root_allowed.22006.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/allroles_root_allowed.22006.srv" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10404" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10404" }; + vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22006 is allroles_root_allowed.22006.srv - run_runagent("-H 127.0.0.1:22006 -D role1 $(runagent_cf)"); + "any" + # Port 22006 is allroles_root_allowed.22006.srv + usebundle => run_runagent("-H 127.0.0.1:22006 -D role1 $(runagent_cf)"); } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt", - "$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testdir)/expected_args.txt", + "$(G.testdir)/exec_args.txt", + "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/allroles_root_allowed.22006.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/allroles_root_allowed.22006.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_admitted_3.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_admitted_3.cf index ed9b4005d4..3aa7d98787 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_admitted_3.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_admitted_3.cf @@ -1,51 +1,59 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Expected output in the exec_args.txt file - "any" usebundle => file_make("$(G.testdir)/expected_args.txt", - "-D role1"); - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Expected output in the exec_args.txt file + "any" usebundle => file_make("$(G.testdir)/expected_args.txt", "-D role1"); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/role1_role2_root_allowed.22008.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/role1_role2_root_allowed.22008.srv" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10404" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10404" }; + vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22008 is role1_role2_root_allowed.22008.srv - run_runagent("-H 127.0.0.1:22008 -D role1 $(runagent_cf)"); + "any" + # Port 22008 is role1_role2_root_allowed.22008.srv + usebundle => run_runagent("-H 127.0.0.1:22008 -D role1 $(runagent_cf)"); } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt", - "$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testdir)/expected_args.txt", + "$(G.testdir)/exec_args.txt", + "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/role1_role2_root_allowed.22008.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/role1_role2_root_allowed.22008.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_denied_1.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_denied_1.cf index be8744669f..1a448f7c10 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_denied_1.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_denied_1.cf @@ -1,45 +1,50 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/cfruncommand_open.22000.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/cfruncommand_open.22000.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22000 is cfruncommand_open.22000.srv - run_runagent("-H 127.0.0.1:22000 -D role1 $(runagent_cf)"); + "any" + # Port 22000 is cfruncommand_open.22000.srv + usebundle => run_runagent("-H 127.0.0.1:22000 -D role1 $(runagent_cf)"); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/cfruncommand_open.22000.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/cfruncommand_open.22000.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_denied_2.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_denied_2.cf index f373c42d6c..700c8563a7 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_denied_2.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_denied_2.cf @@ -1,46 +1,51 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/role12_root_allowed.22007.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/role12_root_allowed.22007.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22007 is role12_root_allowed.22007.srv - # It allows "role12" but should disallow "role1" - run_runagent("-H 127.0.0.1:22007 -D role1 $(runagent_cf)"); + "any" + # Port 22007 is role12_root_allowed.22007.srv + # It allows "role12" but should disallow "role1" + usebundle => run_runagent("-H 127.0.0.1:22007 -D role1 $(runagent_cf)"); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/role12_root_allowed.22007.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/role12_root_allowed.22007.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_denied_3.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_denied_3.cf index 2e81f55efc..e6b8c67bfd 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_denied_3.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_denied_3.cf @@ -1,46 +1,51 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/allroles_nonroot_role2_root_allowed.22009.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/allroles_nonroot_role2_root_allowed.22009.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22009 is allroles_nonroot_role2_root_allowed.22009.srv - # It allows "role1" but only to user "nonroot" so it should fail - run_runagent("-H 127.0.0.1:22009 -D role1 $(runagent_cf)"); + "any" + # Port 22009 is allroles_nonroot_role2_root_allowed.22009.srv + # It allows "role1" but only to user "nonroot" so it should fail + usebundle => run_runagent("-H 127.0.0.1:22009 -D role1 $(runagent_cf)"); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/allroles_nonroot_role2_root_allowed.22009.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/allroles_nonroot_role2_root_allowed.22009.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_admitted_1.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_admitted_1.cf index 0a6aa9cf6b..7af75415d0 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_admitted_1.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_admitted_1.cf @@ -1,51 +1,64 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Expected output in the exec_args.txt file - "any" usebundle => file_make("$(G.testdir)/expected_args.txt", - "-D role1,role2"); - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Expected output in the exec_args.txt file + "any" + usebundle => file_make( + "$(G.testdir)/expected_args.txt", "-D role1,role2" + ); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/allroles_root_allowed.22006.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/allroles_root_allowed.22006.srv" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10404" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10404" }; + vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22006 is allroles_root_allowed.22006.srv - run_runagent("-H 127.0.0.1:22006 -D role1,role2 $(runagent_cf)"); + "any" + # Port 22006 is allroles_root_allowed.22006.srv + usebundle => run_runagent( + "-H 127.0.0.1:22006 -D role1,role2 $(runagent_cf)" + ); } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt", - "$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testdir)/expected_args.txt", + "$(G.testdir)/exec_args.txt", + "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/allroles_root_allowed.22006.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/allroles_root_allowed.22006.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_admitted_2.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_admitted_2.cf index 142a11d10f..c746d5a5f7 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_admitted_2.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_admitted_2.cf @@ -1,51 +1,64 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Expected output in the exec_args.txt file - "any" usebundle => file_make("$(G.testdir)/expected_args.txt", - "-D role1,role2"); - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Expected output in the exec_args.txt file + "any" + usebundle => file_make( + "$(G.testdir)/expected_args.txt", "-D role1,role2" + ); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/role1_role2_root_allowed.22008.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/role1_role2_root_allowed.22008.srv" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10404" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10404" }; + vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22008 is role1_role2_root_allowed.22008.srv - run_runagent("-H 127.0.0.1:22008 -D role1,role2 $(runagent_cf)"); + "any" + # Port 22008 is role1_role2_root_allowed.22008.srv + usebundle => run_runagent( + "-H 127.0.0.1:22008 -D role1,role2 $(runagent_cf)" + ); } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt", - "$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testdir)/expected_args.txt", + "$(G.testdir)/exec_args.txt", + "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/role1_role2_root_allowed.22008.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/role1_role2_root_allowed.22008.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_denied_1.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_denied_1.cf index 054c30d48e..1d624741ca 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_denied_1.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_denied_1.cf @@ -1,46 +1,53 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/role1_root_allowed.22005.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/role1_root_allowed.22005.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22005 is role1_root_allowed.22005.srv - # It allows "role1" but should disallow "role2" - run_runagent("-H 127.0.0.1:22005 -D role1,role2 $(runagent_cf)"); + "any" + # Port 22005 is role1_root_allowed.22005.srv + # It allows "role1" but should disallow "role2" + usebundle => run_runagent( + "-H 127.0.0.1:22005 -D role1,role2 $(runagent_cf)" + ); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/role1_root_allowed.22005.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/role1_root_allowed.22005.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_denied_2.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_denied_2.cf index 03c4843b90..225b4b5698 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_denied_2.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_denied_2.cf @@ -1,46 +1,53 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/role12_root_allowed.22007.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/role12_root_allowed.22007.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22007 is role12_root_allowed.22007.srv - # It allows "role12" but should disallow both "role1" and "role2" - run_runagent("-H 127.0.0.1:22007 -D role1,role2 $(runagent_cf)"); + "any" + # Port 22007 is role12_root_allowed.22007.srv + # It allows "role12" but should disallow both "role1" and "role2" + usebundle => run_runagent( + "-H 127.0.0.1:22007 -D role1,role2 $(runagent_cf)" + ); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/role12_root_allowed.22007.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/role12_root_allowed.22007.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_denied_3.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_denied_3.cf index 99615b9cde..d06ef32b12 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_denied_3.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role1_role2_denied_3.cf @@ -1,45 +1,52 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/allroles_nonroot_role2_root_allowed.22009.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/allroles_nonroot_role2_root_allowed.22009.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22009 is allroles_nonroot_role2_root_allowed.22009.srv - run_runagent("-H 127.0.0.1:22009 -D role1,role2 $(runagent_cf)"); + "any" + # Port 22009 is allroles_nonroot_role2_root_allowed.22009.srv + usebundle => run_runagent( + "-H 127.0.0.1:22009 -D role1,role2 $(runagent_cf)" + ); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/allroles_nonroot_role2_root_allowed.22009.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/allroles_nonroot_role2_root_allowed.22009.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_-B_bundle1_denied.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_-B_bundle1_denied.cf index 09714f4313..31ca6435e9 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_-B_bundle1_denied.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_-B_bundle1_denied.cf @@ -1,45 +1,52 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22012 is bundle2_role2_only_allowed.22012.srv - run_runagent("-H 127.0.0.1:22012 -D role2 --remote-bundles bundle1 $(runagent_cf)"); + "any" + # Port 22012 is bundle2_role2_only_allowed.22012.srv + usebundle => run_runagent( + "-H 127.0.0.1:22012 -D role2 --remote-bundles bundle1 $(runagent_cf)" + ); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_-B_bundle2_admitted.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_-B_bundle2_admitted.cf index 7ca3ccd8c0..8a99a54589 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_-B_bundle2_admitted.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_-B_bundle2_admitted.cf @@ -1,51 +1,64 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Expected output in the exec_args.txt file - "any" usebundle => file_make("$(G.testdir)/expected_args.txt", - "-D role2 --bundlesequence bundle2"); - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Expected output in the exec_args.txt file + "any" + usebundle => file_make( + "$(G.testdir)/expected_args.txt", "-D role2 --bundlesequence bundle2" + ); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10404" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10404" }; + vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22012 is bundle2_role2_only_allowed.22012.srv - run_runagent("-H 127.0.0.1:22012 -D role2 --remote-bundles bundle2 $(runagent_cf)"); + "any" + # Port 22012 is bundle2_role2_only_allowed.22012.srv + usebundle => run_runagent( + "-H 127.0.0.1:22012 -D role2 --remote-bundles bundle2 $(runagent_cf)" + ); } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt", - "$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testdir)/expected_args.txt", + "$(G.testdir)/exec_args.txt", + "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/bundle2_role2_only_allowed.22012.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_admitted_1.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_admitted_1.cf index 8bd3931f3d..e4f8d11fee 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_admitted_1.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_admitted_1.cf @@ -1,51 +1,59 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Expected output in the exec_args.txt file - "any" usebundle => file_make("$(G.testdir)/expected_args.txt", - "-D role2"); - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Expected output in the exec_args.txt file + "any" usebundle => file_make("$(G.testdir)/expected_args.txt", "-D role2"); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/role1_role2_root_allowed.22008.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/role1_role2_root_allowed.22008.srv" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10404" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10404" }; + vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22008 is role1_role2_root_allowed.22008.srv - run_runagent("-H 127.0.0.1:22008 -D role2 $(runagent_cf)"); + "any" + # Port 22008 is role1_role2_root_allowed.22008.srv + usebundle => run_runagent("-H 127.0.0.1:22008 -D role2 $(runagent_cf)"); } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt", - "$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testdir)/expected_args.txt", + "$(G.testdir)/exec_args.txt", + "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/role1_role2_root_allowed.22008.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/role1_role2_root_allowed.22008.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_admitted_2.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_admitted_2.cf index e909f057c7..ffee6cfe00 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_admitted_2.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_admitted_2.cf @@ -1,51 +1,59 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # Expected output in the exec_args.txt file - "any" usebundle => file_make("$(G.testdir)/expected_args.txt", - "-D role2"); - # Ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # Expected output in the exec_args.txt file + "any" usebundle => file_make("$(G.testdir)/expected_args.txt", "-D role2"); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + # Ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/allroles_nonroot_role2_root_allowed.22009.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/allroles_nonroot_role2_root_allowed.22009.srv" + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10404" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10404" }; + vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22009 is allroles_nonroot_role2_root_allowed.22009.srv - run_runagent("-H 127.0.0.1:22009 -D role2 $(runagent_cf)"); + "any" + # Port 22009 is allroles_nonroot_role2_root_allowed.22009.srv + usebundle => run_runagent("-H 127.0.0.1:22009 -D role2 $(runagent_cf)"); } bundle agent check { methods: - "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt", - "$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testdir)/expected_args.txt", + "$(G.testdir)/exec_args.txt", + "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/allroles_nonroot_role2_root_allowed.22009.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/allroles_nonroot_role2_root_allowed.22009.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_denied_1.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_denied_1.cf index dc2f2366af..4204c2eee3 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_denied_1.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_denied_1.cf @@ -1,46 +1,51 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/role1_root_allowed.22005.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/role1_root_allowed.22005.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22005 is role1_root_allowed.22005.srv - # It allows "role1" but should disallow "role2" - run_runagent("-H 127.0.0.1:22005 -D role2 $(runagent_cf)"); + "any" + # Port 22005 is role1_root_allowed.22005.srv + # It allows "role1" but should disallow "role2" + usebundle => run_runagent("-H 127.0.0.1:22005 -D role2 $(runagent_cf)"); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/role1_root_allowed.22005.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/role1_root_allowed.22005.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_role1_denied_1.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_role1_denied_1.cf index 0e95dc5707..6cba6221b5 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_role1_denied_1.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_role2_role1_denied_1.cf @@ -1,45 +1,52 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/allroles_nonroot_role2_root_allowed.22009.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/allroles_nonroot_role2_root_allowed.22009.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22009 is allroles_nonroot_role2_root_allowed.22009.srv - run_runagent("-H 127.0.0.1:22009 -D role2,role1 $(runagent_cf)"); + "any" + # Port 22009 is allroles_nonroot_role2_root_allowed.22009.srv + usebundle => run_runagent( + "-H 127.0.0.1:22009 -D role2,role1 $(runagent_cf)" + ); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/allroles_nonroot_role2_root_allowed.22009.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/allroles_nonroot_role2_root_allowed.22009.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-D_specialchars_denied.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-D_specialchars_denied.cf index efd560e81e..589bed8d1c 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-D_specialchars_denied.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-D_specialchars_denied.cf @@ -1,45 +1,50 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/bundles_roles_all_allowed.22011.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/bundles_roles_all_allowed.22011.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22011 is bundles_roles_all_allowed.22011.srv - run_runagent("-H 127.0.0.1:22011 -D role@ $(runagent_cf)"); + "any" + # Port 22011 is bundles_roles_all_allowed.22011.srv + usebundle => run_runagent("-H 127.0.0.1:22011 -D role@ $(runagent_cf)"); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/bundles_roles_all_allowed.22011.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/bundles_roles_all_allowed.22011.srv" + ); } diff --git a/tests/acceptance/22_cf-runagent/serial/runagent_-o_deprecated.cf b/tests/acceptance/22_cf-runagent/serial/runagent_-o_deprecated.cf index eba78e71db..9807e4f8b5 100644 --- a/tests/acceptance/22_cf-runagent/serial/runagent_-o_deprecated.cf +++ b/tests/acceptance/22_cf-runagent/serial/runagent_-o_deprecated.cf @@ -1,45 +1,52 @@ body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { methods: - # ensure execution output file is not there - "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + # ensure execution output file is not there + "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; - - "any" usebundle => start_server("$(this.promise_dirname)/cfruncommand_open.22000.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/cfruncommand_open.22000.srv" + ); } bundle agent test { vars: - "runagent_cf" string => - "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + "runagent_cf" + string => "$(this.promise_dirname)/empty_config.runagent.cf.sub"; + methods: - "any" usebundle => - # Port 22000 is cfruncommand_open.22000.srv - run_runagent("-H 127.0.0.1:22000 -o custom_option $(runagent_cf)"); + "any" + # Port 22000 is cfruncommand_open.22000.srv + usebundle => run_runagent( + "-H 127.0.0.1:22000 -o custom_option $(runagent_cf)" + ); } bundle agent check { # Execution output file should still not be there. methods: - "any" usebundle => dcs_passif_file_absent("$(G.testdir)/exec_args.txt", - "$(this.promise_filename)"); + "any" + usebundle => dcs_passif_file_absent( + "$(G.testdir)/exec_args.txt", "$(this.promise_filename)" + ); } bundle agent destroy { methods: - "any" usebundle => stop_server("$(this.promise_dirname)/cfruncommand_open.22000.srv"); + "any" + usebundle => stop_server( + "$(this.promise_dirname)/cfruncommand_open.22000.srv" + ); } diff --git a/tests/acceptance/23_failsafe/failsafe_created_on_parse_error.cf b/tests/acceptance/23_failsafe/failsafe_created_on_parse_error.cf index ed5793ab00..9d5fb2549a 100644 --- a/tests/acceptance/23_failsafe/failsafe_created_on_parse_error.cf +++ b/tests/acceptance/23_failsafe/failsafe_created_on_parse_error.cf @@ -1,5 +1,4 @@ # Test that failsafe.cf is created when dosn't exist - body common control { inputs => { "../default.sub.cf" }; @@ -9,33 +8,38 @@ body common control bundle agent init { methods: - # Remove any failsafe.cf - "any" usebundle => dcs_fini("$(sys.inputdir)/failsafe.cf"); + # Remove any failsafe.cf + "any" usebundle => dcs_fini("$(sys.inputdir)/failsafe.cf"); + classes: - "failsafe_before_test_not_exists" not => - fileexists("$(sys.inputdir)/failsafe.cf"), - scope => "namespace"; + "failsafe_before_test_not_exists" + not => fileexists("$(sys.inputdir)/failsafe.cf"), + scope => "namespace"; } bundle agent test { commands: - "$(sys.cf_agent) -f $(this.promise_dirname)/invalid_syntax.sub.x.cf"; + "$(sys.cf_agent) -f $(this.promise_dirname)/invalid_syntax.sub.x.cf"; - # TODO this sub-agent fails to run invalid_syntax.cf and writes - # failsafe.cf, which then executes. The execute bit is - # redundant, can we avoid it? + # TODO this sub-agent fails to run invalid_syntax.cf and writes + # failsafe.cf, which then executes. The execute bit is + # redundant, can we avoid it? } bundle agent check { classes: - "failsafe_after_test_exists" expression => fileexists("$(sys.inputdir)/failsafe.cf"); - "ok" expression => "failsafe_after_test_exists.failsafe_before_test_not_exists"; + "failsafe_after_test_exists" + expression => fileexists("$(sys.inputdir)/failsafe.cf"); + + "ok" + expression => "failsafe_after_test_exists.failsafe_before_test_not_exists"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/23_failsafe/preexisting_failsafe_preserved.cf b/tests/acceptance/23_failsafe/preexisting_failsafe_preserved.cf index d2b623f9c3..7c359d7893 100644 --- a/tests/acceptance/23_failsafe/preexisting_failsafe_preserved.cf +++ b/tests/acceptance/23_failsafe/preexisting_failsafe_preserved.cf @@ -1,6 +1,4 @@ # Test that failsafe.cf is not created when it exists - - body common control { inputs => { "../default.sub.cf", "../plucked.sub.cf" }; @@ -10,13 +8,16 @@ body common control bundle agent init { methods: - # Remove the custom failsafe output file - "any" usebundle => dcs_fini("$(sys.inputdir)/failsafe_output.txt"); + # Remove the custom failsafe output file + "any" usebundle => dcs_fini("$(sys.inputdir)/failsafe_output.txt"); + files: - "$(sys.inputdir)/failsafe.cf" - create => "true", - perms => m("600"), - copy_from => dcs_sync("$(this.promise_dirname)/preexisting_failsafe_preserved.failsafe.cf.sub"); + "$(sys.inputdir)/failsafe.cf" + create => "true", + perms => m("600"), + copy_from => dcs_sync( + "$(this.promise_dirname)/preexisting_failsafe_preserved.failsafe.cf.sub" + ); } bundle agent test @@ -28,9 +29,10 @@ bundle agent test bundle agent check { methods: - "any" usebundle => - # Verify that the custom failsafe.cf did run and created the - # file that we removed earlier. - dcs_passif_fileexists("$(sys.inputdir)/failsafe_output.txt", - "$(this.promise_filename)"); + "any" + # Verify that the custom failsafe.cf did run and created the + # file that we removed earlier. + usebundle => dcs_passif_fileexists( + "$(sys.inputdir)/failsafe_output.txt", "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/26_cf-net/serial/cf-net_connect.cf b/tests/acceptance/26_cf-net/serial/cf-net_connect.cf index a89f9ba698..0dd1667fce 100644 --- a/tests/acceptance/26_cf-net/serial/cf-net_connect.cf +++ b/tests/acceptance/26_cf-net/serial/cf-net_connect.cf @@ -1,62 +1,72 @@ body contain myshell { - !windows:: - useshell => "useshell"; - windows:: - useshell => "powershell"; + !windows:: + useshell => "useshell"; + + windows:: + useshell => "powershell"; } body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { - methods: - "any" usebundle => dcs_fini("$(G.testfile)"); - - "any" usebundle => generate_key; - "any" usebundle => trust_key; + methods: + "any" usebundle => dcs_fini("$(G.testfile)"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv" + ); } bundle agent test { - commands: - "$(sys.cf_net)" - args => " -H 127.0.0.1:15000 connect > $(G.testfile) 2>&1", - contain => myshell; - meta: - "description" string => "Connect and authenticate with cf-serverd"; - "test_soft_fail" string => "windows", - meta => { "ENT-10254" }; + commands: + "$(sys.cf_net)" + args => " -H 127.0.0.1:15000 connect > $(G.testfile) 2>&1", + contain => myshell; + + meta: + "description" string => "Connect and authenticate with cf-serverd"; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10254" }; } bundle agent check { - methods: - "check" usebundle => dcs_check_diff("$(G.testfile)", - "$(this.promise_filename).expected", - "$(this.promise_filename)"); - vars: - DEBUG|EXTRA:: - "actual_output" string => readfile("$(G.testfile)"); - "expected_output" string => readfile("$(this.promise_filename).expected"); - reports: - DEBUG|EXTRA:: - "expected_output: $(expected_output)"; - "actual_output: $(actual_output)"; + methods: + "check" + usebundle => dcs_check_diff( + "$(G.testfile)", + "$(this.promise_filename).expected", + "$(this.promise_filename)" + ); + + vars: + DEBUG|EXTRA:: + "actual_output" string => readfile("$(G.testfile)"); + "expected_output" string => readfile("$(this.promise_filename).expected"); + + reports: + DEBUG|EXTRA:: + "expected_output: $(expected_output)"; + "actual_output: $(actual_output)"; } bundle agent destroy { - methods: - "any" - usebundle => stop_server("$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv"); + methods: + "any" + usebundle => stop_server( + "$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv" + ); } diff --git a/tests/acceptance/26_cf-net/serial/cf-net_get.cf b/tests/acceptance/26_cf-net/serial/cf-net_get.cf index 5c161ef82d..bb1d3af5fc 100644 --- a/tests/acceptance/26_cf-net/serial/cf-net_get.cf +++ b/tests/acceptance/26_cf-net/serial/cf-net_get.cf @@ -1,54 +1,61 @@ body contain myshell { - !windows:: - useshell => "useshell"; - windows:: - useshell => "powershell"; + !windows:: + useshell => "useshell"; + + windows:: + useshell => "powershell"; } body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { - methods: - "any" usebundle => dcs_fini("$(G.testfile)"); - - "any" usebundle => generate_key; - "any" usebundle => trust_key; + methods: + "any" usebundle => dcs_fini("$(G.testfile)"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => start_server("$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv"); + "any" + usebundle => start_server( + "$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv" + ); } bundle agent test { - commands: - "$(sys.cf_net)" - args => " -H 127.0.0.1:15000 get -o $(G.testfile) $(this.promise_filename)", - contain => myshell; - meta: - "description" string => "STAT+GET policy file from cf-serverd"; - "test_skip_needs_work" string => "windows", - comment => "for some reason, softfailing this test is not enough", - meta => { "ENT-10254" }; + commands: + "$(sys.cf_net)" + args => " -H 127.0.0.1:15000 get -o $(G.testfile) $(this.promise_filename)", + contain => myshell; + + meta: + "description" string => "STAT+GET policy file from cf-serverd"; + + "test_skip_needs_work" + string => "windows", + comment => "for some reason, softfailing this test is not enough", + meta => { "ENT-10254" }; } bundle agent check { - methods: - "check" usebundle => dcs_check_diff("$(G.testfile)", - "$(this.promise_filename)", - "$(this.promise_filename)"); + methods: + "check" + usebundle => dcs_check_diff( + "$(G.testfile)", "$(this.promise_filename)", "$(this.promise_filename)" + ); } bundle agent destroy { - methods: - "any" usebundle => stop_server("$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv"); + methods: + "any" + usebundle => stop_server( + "$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv" + ); } diff --git a/tests/acceptance/26_cf-net/serial/cf-net_help.cf b/tests/acceptance/26_cf-net/serial/cf-net_help.cf index 5bb2ecb07b..add0ef82f5 100644 --- a/tests/acceptance/26_cf-net/serial/cf-net_help.cf +++ b/tests/acceptance/26_cf-net/serial/cf-net_help.cf @@ -1,42 +1,47 @@ body contain myshell { - !windows:: - useshell => "useshell"; - windows:: - useshell => "powershell"; + !windows:: + useshell => "useshell"; + + windows:: + useshell => "powershell"; } body common control { - inputs => { - "../../default.sub.cf", - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { - methods: - "any" usebundle => dcs_fini("$(G.testfile)"); + methods: + "any" usebundle => dcs_fini("$(G.testfile)"); } bundle agent test { - commands: - # Run "cf-net help help" - "$(sys.cf_net)" - args => " help help > $(G.testfile) 2>&1", - contain => myshell; - meta: - "description" string => "Argument parsing and help output"; - "test_soft_fail" string => "windows", - meta => { "ENT-10254" }; + commands: + # Run "cf-net help help" + "$(sys.cf_net)" + args => " help help > $(G.testfile) 2>&1", + contain => myshell; + + meta: + "description" string => "Argument parsing and help output"; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10254" }; } bundle agent check { - methods: - "check" usebundle => dcs_check_diff("$(G.testfile)", - "$(this.promise_filename).expected", - $(this.promise_filename)); + methods: + "check" + usebundle => dcs_check_diff( + "$(G.testfile)", + "$(this.promise_filename).expected", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/26_cf-net/serial/cf-net_stat.cf b/tests/acceptance/26_cf-net/serial/cf-net_stat.cf index a9deded550..9d4cc27b3f 100644 --- a/tests/acceptance/26_cf-net/serial/cf-net_stat.cf +++ b/tests/acceptance/26_cf-net/serial/cf-net_stat.cf @@ -1,65 +1,75 @@ body contain myshell { - !windows:: - useshell => "useshell"; - windows:: - useshell => "powershell"; + !windows:: + useshell => "useshell"; + + windows:: + useshell => "powershell"; } body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { - methods: - "any" usebundle => dcs_fini("$(G.testfile)"); + methods: + "any" usebundle => dcs_fini("$(G.testfile)"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; + "any" + usebundle => start_server( + "$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv" + ); - "any" usebundle => start_server("$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv"); - commands: - "echo" - args => " \"127.0.0.1:15000:'$(this.promise_dirname)/cf-net_stat.cf' is a regular file\" > $(G.testfile).expected", - contain => myshell; + commands: + "echo" + args => " \"127.0.0.1:15000:'$(this.promise_dirname)/cf-net_stat.cf' is a regular file\" > $(G.testfile).expected", + contain => myshell; } bundle agent test { - commands: - "$(sys.cf_net)" - args => " -H 127.0.0.1:15000 stat $(this.promise_dirname)/cf-net_stat.cf > $(G.testfile) 2>&1", - contain => myshell; - meta: - "description" string => "Stat a regular file (this policy file)"; - "test_soft_fail" string => "windows", - meta => { "ENT-10254" }; + commands: + "$(sys.cf_net)" + args => " -H 127.0.0.1:15000 stat $(this.promise_dirname)/cf-net_stat.cf > $(G.testfile) 2>&1", + contain => myshell; + + meta: + "description" string => "Stat a regular file (this policy file)"; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10254" }; } bundle agent check { - methods: - "check" usebundle => dcs_check_diff("$(G.testfile)", - "$(G.testfile).expected", - "$(this.promise_filename)"); - vars: - DEBUG|EXTRA:: - "actual_output" string => readfile("$(G.testfile)"); - "expected_output" string => readfile("$(G.testfile).expected"); - reports: - DEBUG|EXTRA:: - "expected_output: $(expected_output)"; - "actual_output: $(actual_output)"; + methods: + "check" + usebundle => dcs_check_diff( + "$(G.testfile)", "$(G.testfile).expected", "$(this.promise_filename)" + ); + + vars: + DEBUG|EXTRA:: + "actual_output" string => readfile("$(G.testfile)"); + "expected_output" string => readfile("$(G.testfile).expected"); + + reports: + DEBUG|EXTRA:: + "expected_output: $(expected_output)"; + "actual_output: $(actual_output)"; } bundle agent destroy { - methods: - "any" usebundle => stop_server("$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv"); + methods: + "any" + usebundle => stop_server( + "$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv" + ); } diff --git a/tests/acceptance/26_cf-net/serial/cf-net_stat_deny.cf b/tests/acceptance/26_cf-net/serial/cf-net_stat_deny.cf index 13b597724d..e8c78346a3 100644 --- a/tests/acceptance/26_cf-net/serial/cf-net_stat_deny.cf +++ b/tests/acceptance/26_cf-net/serial/cf-net_stat_deny.cf @@ -1,65 +1,75 @@ body contain myshell { - !windows:: - useshell => "useshell"; - windows:: - useshell => "powershell"; + !windows:: + useshell => "useshell"; + + windows:: + useshell => "powershell"; } body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { - methods: - "any" usebundle => dcs_fini("$(G.testfile)"); + methods: + "any" usebundle => dcs_fini("$(G.testfile)"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; + "any" + usebundle => start_server( + "$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv" + ); - "any" usebundle => start_server("$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv"); - commands: - "echo" - args => "\"Could not stat: '$(this.promise_dirname)/cf-net_connect.cf'\" > $(G.testfile).expected", - contain => myshell; + commands: + "echo" + args => "\"Could not stat: '$(this.promise_dirname)/cf-net_connect.cf'\" > $(G.testfile).expected", + contain => myshell; } bundle agent test { - commands: - "$(sys.cf_net)" - args => "--log-level ERROR -H 127.0.0.1:15000 stat $(this.promise_dirname)/cf-net_connect.cf > $(G.testfile) 2>&1", - contain => myshell; - meta: - "description" string => "Attempt to stat file without permission"; - "test_soft_fail" string => "windows", - meta => { "ENT-10254" }; + commands: + "$(sys.cf_net)" + args => "--log-level ERROR -H 127.0.0.1:15000 stat $(this.promise_dirname)/cf-net_connect.cf > $(G.testfile) 2>&1", + contain => myshell; + + meta: + "description" string => "Attempt to stat file without permission"; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10254" }; } bundle agent check { - methods: - "check" usebundle => dcs_check_diff("$(G.testfile)", - "$(G.testfile).expected", - "$(this.promise_filename)"); - vars: - DEBUG|EXTRA:: - "actual_output" string => readfile("$(G.testfile)"); - "expected_output" string => readfile("$(G.testfile).expected"); - reports: - DEBUG|EXTRA:: - "expected_output: $(expected_output)"; - "actual_output: $(actual_output)"; + methods: + "check" + usebundle => dcs_check_diff( + "$(G.testfile)", "$(G.testfile).expected", "$(this.promise_filename)" + ); + + vars: + DEBUG|EXTRA:: + "actual_output" string => readfile("$(G.testfile)"); + "expected_output" string => readfile("$(G.testfile).expected"); + + reports: + DEBUG|EXTRA:: + "expected_output: $(expected_output)"; + "actual_output: $(actual_output)"; } bundle agent destroy { - methods: - "any" usebundle => stop_server("$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv"); + methods: + "any" + usebundle => stop_server( + "$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv" + ); } diff --git a/tests/acceptance/26_cf-net/serial/cf-net_stat_dir.cf b/tests/acceptance/26_cf-net/serial/cf-net_stat_dir.cf index 900c5a764d..ecfb916f30 100644 --- a/tests/acceptance/26_cf-net/serial/cf-net_stat_dir.cf +++ b/tests/acceptance/26_cf-net/serial/cf-net_stat_dir.cf @@ -1,65 +1,75 @@ body contain myshell { - !windows:: - useshell => "useshell"; - windows:: - useshell => "powershell"; + !windows:: + useshell => "useshell"; + + windows:: + useshell => "powershell"; } body common control { - inputs => { - "../../default.sub.cf", - "../../run_with_server.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; + inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" }; + bundlesequence => { default("$(this.promise_filename)") }; } bundle agent init { - methods: - "any" usebundle => dcs_fini("$(G.testfile)"); + methods: + "any" usebundle => dcs_fini("$(G.testfile)"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; - "any" usebundle => generate_key; - "any" usebundle => trust_key; + "any" + usebundle => start_server( + "$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv" + ); - "any" usebundle => start_server("$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv"); - commands: - "echo" - args => " \"127.0.0.1:15000:'$(G.testdir)' is a directory\" > $(G.testfile).expected", - contain => myshell; + commands: + "echo" + args => " \"127.0.0.1:15000:'$(G.testdir)' is a directory\" > $(G.testfile).expected", + contain => myshell; } bundle agent test { - commands: - "$(sys.cf_net)" - args => " -H 127.0.0.1:15000 stat $(G.testdir) > $(G.testfile) 2>&1", - contain => myshell; - meta: - "description" string => "Stat a directory"; - "test_soft_fail" string => "windows", - meta => { "ENT-10254" }; + commands: + "$(sys.cf_net)" + args => " -H 127.0.0.1:15000 stat $(G.testdir) > $(G.testfile) 2>&1", + contain => myshell; + + meta: + "description" string => "Stat a directory"; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10254" }; } bundle agent check { - methods: - "check" usebundle => dcs_check_diff("$(G.testfile)", - "$(G.testfile).expected", - "$(this.promise_filename)"); - vars: - DEBUG|EXTRA:: - "actual_output" string => readfile("$(G.testfile)"); - "expected_output" string => readfile("$(G.testfile).expected"); - reports: - DEBUG|EXTRA:: - "expected_output: $(expected_output)"; - "actual_output: $(actual_output)"; + methods: + "check" + usebundle => dcs_check_diff( + "$(G.testfile)", "$(G.testfile).expected", "$(this.promise_filename)" + ); + + vars: + DEBUG|EXTRA:: + "actual_output" string => readfile("$(G.testfile)"); + "expected_output" string => readfile("$(G.testfile).expected"); + + reports: + DEBUG|EXTRA:: + "expected_output: $(expected_output)"; + "actual_output: $(actual_output)"; } bundle agent destroy { - methods: - "any" usebundle => stop_server("$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv"); + methods: + "any" + usebundle => stop_server( + "$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv" + ); } diff --git a/tests/acceptance/27_cf-secret/decrypt.cf b/tests/acceptance/27_cf-secret/decrypt.cf index f50359f89a..d9adaf9f61 100644 --- a/tests/acceptance/27_cf-secret/decrypt.cf +++ b/tests/acceptance/27_cf-secret/decrypt.cf @@ -1,28 +1,32 @@ body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent test { - meta: - "description" - string => "Test that cf-secret can still decrypt content encrypted at the time of initial implementation"; - "test_soft_fail" string => "windows", - meta => { "ENT-10405" }; + meta: + "description" + string => "Test that cf-secret can still decrypt content encrypted at the time of initial implementation"; - commands: - "$(sys.cf_secret)" - args => "decrypt -k $(this.promise_dirname)/testkey.priv -o $(G.testfile) $(this.promise_dirname)/encrypted"; + "test_soft_fail" + string => "windows", + meta => { "ENT-10405" }; + + commands: + "$(sys.cf_secret)" + args => "decrypt -k $(this.promise_dirname)/testkey.priv -o $(G.testfile) $(this.promise_dirname)/encrypted"; } bundle agent check { - methods: - "any" - usebundle => dcs_check_diff("$(this.promise_dirname)/plaintext", - "$(G.testfile)", - "$(this.promise_filename)"); + methods: + "any" + usebundle => dcs_check_diff( + "$(this.promise_dirname)/plaintext", + "$(G.testfile)", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/27_cf-secret/encrypt-decrypt-args.cf b/tests/acceptance/27_cf-secret/encrypt-decrypt-args.cf index 3700ba6c1f..771a007ffc 100644 --- a/tests/acceptance/27_cf-secret/encrypt-decrypt-args.cf +++ b/tests/acceptance/27_cf-secret/encrypt-decrypt-args.cf @@ -1,52 +1,55 @@ body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { - methods: - "any" usebundle => dcs_fini("$(G.testfile).plain"); - "any" usebundle => dcs_fini("$(G.testfile).encrypted"); - "any" usebundle => dcs_fini("$(G.testfile).decrypted"); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + methods: + "any" usebundle => dcs_fini("$(G.testfile).plain"); + "any" usebundle => dcs_fini("$(G.testfile).encrypted"); + "any" usebundle => dcs_fini("$(G.testfile).decrypted"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; } bundle agent test { - meta: - "description" - string => "Test cf-secret with different arguments/order"; - - vars: - "text" string => "This secret sauce should be encrypted and decrypted."; - - files: - "$(G.testfile).plain" - create => "true", - edit_defaults => empty, - edit_line => insert_lines( "$(text)" ); - - commands: - "$(sys.cf_secret)" - args => "encrypt --key $(sys.workdir)/ppkeys/localhost.pub --output $(G.testfile).encrypted $(G.testfile).plain"; - "$(sys.cf_secret)" - args => "decrypt --key $(sys.workdir)/ppkeys/localhost.priv -o $(G.testfile).decrypted $(G.testfile).encrypted"; - reports: - "Binaries/folders:"; - "$(sys.cf_secret)"; - "$(sys.cf_agent)"; - "$(sys.workdir)"; + meta: + "description" string => "Test cf-secret with different arguments/order"; + + vars: + "text" string => "This secret sauce should be encrypted and decrypted."; + + files: + "$(G.testfile).plain" + create => "true", + edit_defaults => empty, + edit_line => insert_lines("$(text)"); + + commands: + "$(sys.cf_secret)" + args => "encrypt --key $(sys.workdir)/ppkeys/localhost.pub --output $(G.testfile).encrypted $(G.testfile).plain"; + + "$(sys.cf_secret)" + args => "decrypt --key $(sys.workdir)/ppkeys/localhost.priv -o $(G.testfile).decrypted $(G.testfile).encrypted"; + + reports: + "Binaries/folders:"; + "$(sys.cf_secret)"; + "$(sys.cf_agent)"; + "$(sys.workdir)"; } bundle agent check { - methods: - "any" - usebundle => dcs_check_diff("$(G.testfile).plain", - "$(G.testfile).decrypted", - "$(this.promise_filename)"); + methods: + "any" + usebundle => dcs_check_diff( + "$(G.testfile).plain", + "$(G.testfile).decrypted", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/27_cf-secret/encrypt-decrypt.cf b/tests/acceptance/27_cf-secret/encrypt-decrypt.cf index ddb9425356..f189aa56ff 100644 --- a/tests/acceptance/27_cf-secret/encrypt-decrypt.cf +++ b/tests/acceptance/27_cf-secret/encrypt-decrypt.cf @@ -1,57 +1,60 @@ body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { - methods: - "any" usebundle => dcs_fini("$(G.testfile).plain"); - "any" usebundle => dcs_fini("$(G.testfile).encrypted"); - "any" usebundle => dcs_fini("$(G.testfile).decrypted"); - "any" usebundle => generate_key; - "any" usebundle => trust_key; + methods: + "any" usebundle => dcs_fini("$(G.testfile).plain"); + "any" usebundle => dcs_fini("$(G.testfile).encrypted"); + "any" usebundle => dcs_fini("$(G.testfile).decrypted"); + "any" usebundle => generate_key; + "any" usebundle => trust_key; } bundle agent test { - meta: - "description" - string => "Test that cf-secret basic key based encryption and decryption work"; - - "test_soft_fail" string => "windows", - meta => { "ENT-10405" }; - - vars: - "text" - string => "This secret sauce should be encrypted and decrypted."; - - files: - "$(G.testfile).plain" - create => "true", - edit_defaults => empty, - edit_line => insert_lines( "$(text)" ); - - commands: - "$(sys.cf_secret)" - args => "encrypt -k $(sys.workdir)/ppkeys/localhost.pub -o $(G.testfile).encrypted $(G.testfile).plain"; - "$(sys.cf_secret)" - args => "decrypt -k $(sys.workdir)/ppkeys/localhost.priv -o $(G.testfile).decrypted $(G.testfile).encrypted"; - - reports: - "Binaries/folders:"; - "$(sys.cf_secret)"; - "$(sys.cf_agent)"; - "$(sys.workdir)"; + meta: + "description" + string => "Test that cf-secret basic key based encryption and decryption work"; + + "test_soft_fail" + string => "windows", + meta => { "ENT-10405" }; + + vars: + "text" string => "This secret sauce should be encrypted and decrypted."; + + files: + "$(G.testfile).plain" + create => "true", + edit_defaults => empty, + edit_line => insert_lines("$(text)"); + + commands: + "$(sys.cf_secret)" + args => "encrypt -k $(sys.workdir)/ppkeys/localhost.pub -o $(G.testfile).encrypted $(G.testfile).plain"; + + "$(sys.cf_secret)" + args => "decrypt -k $(sys.workdir)/ppkeys/localhost.priv -o $(G.testfile).decrypted $(G.testfile).encrypted"; + + reports: + "Binaries/folders:"; + "$(sys.cf_secret)"; + "$(sys.cf_agent)"; + "$(sys.workdir)"; } bundle agent check { methods: - "any" - usebundle => dcs_check_diff("$(G.testfile).plain", - "$(G.testfile).decrypted", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).plain", + "$(G.testfile).decrypted", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/27_cf-secret/encrypt-no-key.cf b/tests/acceptance/27_cf-secret/encrypt-no-key.cf index 361fdfc49f..6f88395db8 100644 --- a/tests/acceptance/27_cf-secret/encrypt-no-key.cf +++ b/tests/acceptance/27_cf-secret/encrypt-no-key.cf @@ -4,69 +4,67 @@ # localhost. # ############################################################################## - body common control { - inputs => { "../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } body delete init_delete { dirlinks => "delete"; - rmdirs => "true"; + rmdirs => "true"; } bundle agent init { methods: - "any" - usebundle => generate_key; - "any" - usebundle => trust_key; + "any" usebundle => generate_key; + "any" usebundle => trust_key; files: # Create plain text file - "$(G.testfile).plaintext" - create => "true", - content => "Hello World!"; + "$(G.testfile).plaintext" + create => "true", + content => "Hello World!"; # Delete encrypted file - "$(G.testfile).encrypted" - delete => init_delete; + "$(G.testfile).encrypted" delete => init_delete; # Delete decrypted file - "$(G.testfile).decrypted" - delete => init_delete; + "$(G.testfile).decrypted" delete => init_delete; } bundle agent test { meta: - "description" -> { "CFE-3874" } - string => "Test that encrypting with no host- / key argument defaults to encrypting for localhost."; + "description" -> { "CFE-3874" } + string => "Test that encrypting with no host- / key argument defaults to encrypting for localhost."; - "test_soft_fail" string => "windows", - meta => { "ENT-10405" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10405" }; commands: # Encrypt test file - "$(sys.cf_secret)" - args => "encrypt -o $(G.testfile).encrypted $(G.testfile).plaintext", - handle => "file-is-encrypted"; + "$(sys.cf_secret)" + args => "encrypt -o $(G.testfile).encrypted $(G.testfile).plaintext", + handle => "file-is-encrypted"; # Decrypt test file - "$(sys.cf_secret)" - args => "decrypt -o $(G.testfile).decrypted $(G.testfile).encrypted", - depends_on => { "file-is-encrypted" }; + "$(sys.cf_secret)" + args => "decrypt -o $(G.testfile).decrypted $(G.testfile).encrypted", + depends_on => { "file-is-encrypted" }; } bundle agent check { methods: - "any" - usebundle => dcs_check_diff("$(G.testfile).plaintext", - "$(G.testfile).decrypted", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "$(G.testfile).plaintext", + "$(G.testfile).decrypted", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/28_inform_testing/01_files/changes01.cf b/tests/acceptance/28_inform_testing/01_files/changes01.cf index b82b88f30c..66be203752 100644 --- a/tests/acceptance/28_inform_testing/01_files/changes01.cf +++ b/tests/acceptance/28_inform_testing/01_files/changes01.cf @@ -12,15 +12,13 @@ bundle common testcase bundle agent setup { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } bundle agent main { files: - "$(G.testfile)" - changes => example; + "$(G.testfile)" changes => example; } body changes example diff --git a/tests/acceptance/28_inform_testing/01_files/changes02.cf b/tests/acceptance/28_inform_testing/01_files/changes02.cf index 79598d03f0..e536fd469c 100644 --- a/tests/acceptance/28_inform_testing/01_files/changes02.cf +++ b/tests/acceptance/28_inform_testing/01_files/changes02.cf @@ -12,13 +12,11 @@ bundle common testcase bundle agent setup { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } bundle agent main { files: - "$(G.testfile)" - edit_line => insert_lines("foobar"); + "$(G.testfile)" edit_line => insert_lines("foobar"); } diff --git a/tests/acceptance/28_inform_testing/01_files/copy_from01.cf b/tests/acceptance/28_inform_testing/01_files/copy_from01.cf index 32ee890b36..66e77c2561 100644 --- a/tests/acceptance/28_inform_testing/01_files/copy_from01.cf +++ b/tests/acceptance/28_inform_testing/01_files/copy_from01.cf @@ -2,6 +2,7 @@ body file control { hpux.ia64:: inputs => { "$(sys.policy_entry_dirname)/../common_soft_fail.cf.sub" }; + !(hpux.ia64):: inputs => { "$(sys.policy_entry_dirname)/../common.cf.sub" }; } @@ -19,16 +20,16 @@ bundle agent setup depth_search => recurse("inf"), perms => system_owned("0644"), copy_from => example("$(this.promise_dirname)/test_files"); - } bundle agent main { files: - "$(G.testroot)/TEST.destination/subdir/." - create => "true"; + "$(G.testroot)/TEST.destination/subdir/." create => "true"; + "$(G.testroot)/TEST.destination/file-perms-644" copy_from => example("$(G.testroot)/TEST.source/file-perms-644"); + "$(G.testroot)/TEST.destination/subdir/subfile" copy_from => example("$(G.testroot)/TEST.source/subdir/subdir-file"); } @@ -39,4 +40,3 @@ body copy_from example(from) compare => "digest"; preserve => "true"; } - diff --git a/tests/acceptance/28_inform_testing/01_files/copy_from02.cf b/tests/acceptance/28_inform_testing/01_files/copy_from02.cf index d0b487be03..35188904aa 100644 --- a/tests/acceptance/28_inform_testing/01_files/copy_from02.cf +++ b/tests/acceptance/28_inform_testing/01_files/copy_from02.cf @@ -20,10 +20,11 @@ bundle agent setup bundle agent main { files: - "$(G.testroot)/TEST.destination/subdir/." - create => "true"; + "$(G.testroot)/TEST.destination/subdir/." create => "true"; + "$(G.testroot)/TEST.destination/file-perms-644" copy_from => example2("$(G.testroot)/TEST.source/file-perms-644"); + "$(G.testroot)/TEST.destination/subdir/subfile" copy_from => example2("$(G.testroot)/TEST.source/subdir/subdir-file"); } diff --git a/tests/acceptance/28_inform_testing/01_files/copy_from03.cf b/tests/acceptance/28_inform_testing/01_files/copy_from03.cf index 7e7f43035c..af2dde450e 100644 --- a/tests/acceptance/28_inform_testing/01_files/copy_from03.cf +++ b/tests/acceptance/28_inform_testing/01_files/copy_from03.cf @@ -2,6 +2,7 @@ body file control { hpux.ia64:: inputs => { "$(sys.policy_entry_dirname)/../common_soft_fail.cf.sub" }; + !(hpux.ia64):: inputs => { "$(sys.policy_entry_dirname)/../common.cf.sub" }; } @@ -19,7 +20,6 @@ bundle agent setup depth_search => recurse("inf"), perms => system_owned("0644"), copy_from => example("$(this.promise_dirname)/test_files"); - } bundle agent main @@ -28,8 +28,10 @@ bundle agent main "$(G.testroot)/TEST.destination/subdir/purgeme" create => "true", handle => "step_one"; + "$(G.testroot)/TEST.destination/file-perms-644" copy_from => example("$(G.testroot)/TEST.source/file-perms-644"); + "$(G.testroot)/TEST.destination/subdir/." depends_on => { "step_one" }, depth_search => recurse("inf"), diff --git a/tests/acceptance/28_inform_testing/01_files/create.cf b/tests/acceptance/28_inform_testing/01_files/create.cf index f4a08afea6..0c46e04248 100644 --- a/tests/acceptance/28_inform_testing/01_files/create.cf +++ b/tests/acceptance/28_inform_testing/01_files/create.cf @@ -12,6 +12,5 @@ bundle common testcase bundle agent main { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } diff --git a/tests/acceptance/28_inform_testing/01_files/delete-dir.cf b/tests/acceptance/28_inform_testing/01_files/delete-dir.cf index 42e56638df..ea84bbac96 100644 --- a/tests/acceptance/28_inform_testing/01_files/delete-dir.cf +++ b/tests/acceptance/28_inform_testing/01_files/delete-dir.cf @@ -12,13 +12,11 @@ bundle common testcase bundle agent setup { files: - "$(G.testdir)/sub-directory/." - create => "true"; + "$(G.testdir)/sub-directory/." create => "true"; } bundle agent main { files: - "$(G.testdir)/sub-directory/." - delete => init_delete; + "$(G.testdir)/sub-directory/." delete => init_delete; } diff --git a/tests/acceptance/28_inform_testing/01_files/delete.cf b/tests/acceptance/28_inform_testing/01_files/delete.cf index 6b8dea0542..4dff471351 100644 --- a/tests/acceptance/28_inform_testing/01_files/delete.cf +++ b/tests/acceptance/28_inform_testing/01_files/delete.cf @@ -12,13 +12,11 @@ bundle common testcase bundle agent setup { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } bundle agent main { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } diff --git a/tests/acceptance/28_inform_testing/01_files/edit_line01.cf b/tests/acceptance/28_inform_testing/01_files/edit_line01.cf index 0501c8ff78..b823e28101 100644 --- a/tests/acceptance/28_inform_testing/01_files/edit_line01.cf +++ b/tests/acceptance/28_inform_testing/01_files/edit_line01.cf @@ -9,39 +9,37 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { files: "$(G.testfile)" - edit_line => insert_lines(" + edit_line => insert_lines( + " foo 1 bar 2 baz 3 me:x:1001:1001::/home/me:/bin/sh -"), +" + ), create => "true"; } bundle agent main { files: - "$(G.testfile)" - edit_line => set_colon_field("me","6","/my/new/shell"); + "$(G.testfile)" edit_line => set_colon_field("me", "6", "/my/new/shell"); } bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } - diff --git a/tests/acceptance/28_inform_testing/01_files/edit_line02.cf b/tests/acceptance/28_inform_testing/01_files/edit_line02.cf index a2c72b99fb..c072826b24 100644 --- a/tests/acceptance/28_inform_testing/01_files/edit_line02.cf +++ b/tests/acceptance/28_inform_testing/01_files/edit_line02.cf @@ -9,39 +9,37 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { files: "$(G.testfile)" - edit_line => insert_lines(" + edit_line => insert_lines( + " foo 1 bar 2 baz 3 me:x:1001:1001::/home/me:/bin/sh -"), +" + ), create => "true"; } bundle agent main { files: - "$(G.testfile)" - edit_line => delete_lines_matching("foo 1"); + "$(G.testfile)" edit_line => delete_lines_matching("foo 1"); } bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } - diff --git a/tests/acceptance/28_inform_testing/01_files/edit_line03.cf b/tests/acceptance/28_inform_testing/01_files/edit_line03.cf index 3f7c46de3a..03d4702d69 100644 --- a/tests/acceptance/28_inform_testing/01_files/edit_line03.cf +++ b/tests/acceptance/28_inform_testing/01_files/edit_line03.cf @@ -9,39 +9,37 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { files: "$(G.testfile)" - edit_line => insert_lines(" + edit_line => insert_lines( + " foo 1 bar 2 baz 3 me:x:1001:1001::/home/me:/bin/sh -"), +" + ), create => "true"; } bundle agent main { files: - "$(G.testfile)" - edit_line => insert_lines("amazing!"); + "$(G.testfile)" edit_line => insert_lines("amazing!"); } bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } - diff --git a/tests/acceptance/28_inform_testing/01_files/edit_line04.cf b/tests/acceptance/28_inform_testing/01_files/edit_line04.cf index d88a526e61..f1a92bf6ed 100644 --- a/tests/acceptance/28_inform_testing/01_files/edit_line04.cf +++ b/tests/acceptance/28_inform_testing/01_files/edit_line04.cf @@ -9,39 +9,37 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { files: "$(G.testfile)" - edit_line => insert_lines(" + edit_line => insert_lines( + " foo 1 bar 2 baz 3 me:x:1001:1001::/home/me:/bin/sh -"), +" + ), create => "true"; } bundle agent main { files: - "$(G.testfile)" - edit_line => regex_replace("bar","BAR"); + "$(G.testfile)" edit_line => regex_replace("bar", "BAR"); } bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } - diff --git a/tests/acceptance/28_inform_testing/01_files/edit_line05.cf b/tests/acceptance/28_inform_testing/01_files/edit_line05.cf index 6e9ab0fec0..daa57daf2b 100644 --- a/tests/acceptance/28_inform_testing/01_files/edit_line05.cf +++ b/tests/acceptance/28_inform_testing/01_files/edit_line05.cf @@ -9,17 +9,18 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { files: "$(G.testfile)" - edit_line => insert_lines(" + edit_line => insert_lines( + " foo 1 bar 2 baz 3 me:x:1001:1001::/home/me:/bin/sh -"), +" + ), create => "true"; } @@ -35,15 +36,13 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } - diff --git a/tests/acceptance/28_inform_testing/01_files/edit_xml01.cf b/tests/acceptance/28_inform_testing/01_files/edit_xml01.cf index 39417b7a97..a309748feb 100644 --- a/tests/acceptance/28_inform_testing/01_files/edit_xml01.cf +++ b/tests/acceptance/28_inform_testing/01_files/edit_xml01.cf @@ -9,12 +9,10 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } bundle agent main @@ -26,16 +24,15 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml build_xpath(xpath) diff --git a/tests/acceptance/28_inform_testing/01_files/edit_xml02.cf b/tests/acceptance/28_inform_testing/01_files/edit_xml02.cf index 9d885775cc..721ae3d130 100644 --- a/tests/acceptance/28_inform_testing/01_files/edit_xml02.cf +++ b/tests/acceptance/28_inform_testing/01_files/edit_xml02.cf @@ -9,12 +9,11 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { - files: - "$(G.testfile)" edit_xml => xml_insert_tree_nopath(""), + "$(G.testfile)" + edit_xml => xml_insert_tree_nopath(""), create => "true"; } @@ -31,27 +30,25 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml xml_insert_tree_nopath(treestring) { insert_tree: - '$(treestring)'; + '$(treestring)'; } bundle edit_xml xml_insert_tree(treestring, xpath) { insert_tree: - '$(treestring)' select_xpath => "$(xpath)"; + '$(treestring)' select_xpath => "$(xpath)"; } - diff --git a/tests/acceptance/28_inform_testing/01_files/edit_xml03.cf b/tests/acceptance/28_inform_testing/01_files/edit_xml03.cf index aef1bbb9dc..9efd2e0969 100644 --- a/tests/acceptance/28_inform_testing/01_files/edit_xml03.cf +++ b/tests/acceptance/28_inform_testing/01_files/edit_xml03.cf @@ -9,14 +9,14 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { vars: "xml" string => "y"; files: - "$(G.testfile)" edit_xml => xml_insert_tree_nopath("$(xml)"), + "$(G.testfile)" + edit_xml => xml_insert_tree_nopath("$(xml)"), create => "true"; } @@ -32,26 +32,25 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml xml_insert_tree_nopath(treestring) { insert_tree: - '$(treestring)'; + '$(treestring)'; } bundle edit_xml xml_insert_tree(treestring, xpath) { insert_tree: - '$(treestring)' select_xpath => "$(xpath)"; + '$(treestring)' select_xpath => "$(xpath)"; } diff --git a/tests/acceptance/28_inform_testing/01_files/edit_xml04.cf b/tests/acceptance/28_inform_testing/01_files/edit_xml04.cf index b44c02c8e9..c5e5a63c50 100644 --- a/tests/acceptance/28_inform_testing/01_files/edit_xml04.cf +++ b/tests/acceptance/28_inform_testing/01_files/edit_xml04.cf @@ -9,12 +9,11 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { - files: - "$(G.testfile)" edit_xml => xml_insert_tree_nopath(""), + "$(G.testfile)" + edit_xml => xml_insert_tree_nopath(""), create => "true"; } @@ -27,27 +26,25 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml xml_insert_tree_nopath(treestring) { insert_tree: - '$(treestring)'; + '$(treestring)'; } bundle edit_xml xml_set_value(value, xpath) { set_text: - "$(value)" - select_xpath => "$(xpath)"; + "$(value)" select_xpath => "$(xpath)"; } diff --git a/tests/acceptance/28_inform_testing/01_files/edit_xml05.cf b/tests/acceptance/28_inform_testing/01_files/edit_xml05.cf index 0c47a920ea..b027c1502f 100644 --- a/tests/acceptance/28_inform_testing/01_files/edit_xml05.cf +++ b/tests/acceptance/28_inform_testing/01_files/edit_xml05.cf @@ -9,48 +9,45 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { - files: - "$(G.testfile)" edit_xml => xml_insert_tree_nopath(""), + "$(G.testfile)" + edit_xml => xml_insert_tree_nopath(""), create => "true"; } bundle agent main { files: - "$(G.testfile)" edit_xml => xml_set_attribute("my_attr", "my_value", "//Root"); + "$(G.testfile)" + edit_xml => xml_set_attribute("my_attr", "my_value", "//Root"); } bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml xml_insert_tree_nopath(treestring) { insert_tree: - '$(treestring)'; + '$(treestring)'; } bundle edit_xml xml_set_attribute(attr, value, xpath) { set_attribute: - "$(attr)" + "$(attr)" attribute_value => "$(value)", select_xpath => "$(xpath)"; - } - diff --git a/tests/acceptance/28_inform_testing/01_files/edit_xml06.cf b/tests/acceptance/28_inform_testing/01_files/edit_xml06.cf index 3fa1da2630..62813b373e 100644 --- a/tests/acceptance/28_inform_testing/01_files/edit_xml06.cf +++ b/tests/acceptance/28_inform_testing/01_files/edit_xml06.cf @@ -9,12 +9,11 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { - files: - "$(G.testfile)" edit_xml => xml_insert_tree_nopath(""), + "$(G.testfile)" + edit_xml => xml_insert_tree_nopath(""), create => "true"; } @@ -27,27 +26,25 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml xml_insert_tree_nopath(treestring) { insert_tree: - '$(treestring)'; + '$(treestring)'; } bundle edit_xml xml_delete_attribute(attr, xpath) { delete_attribute: - "$(attr)" - select_xpath => "$(xpath)"; + "$(attr)" select_xpath => "$(xpath)"; } diff --git a/tests/acceptance/28_inform_testing/01_files/edit_xml07.cf b/tests/acceptance/28_inform_testing/01_files/edit_xml07.cf index 7474433e40..d347120c81 100644 --- a/tests/acceptance/28_inform_testing/01_files/edit_xml07.cf +++ b/tests/acceptance/28_inform_testing/01_files/edit_xml07.cf @@ -9,20 +9,19 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { vars: "xml" string => "text content"; files: - "$(G.testfile)" edit_xml => xml_insert_tree_nopath($(xml)), + "$(G.testfile)" + edit_xml => xml_insert_tree_nopath($(xml)), create => "true"; } bundle agent main { - files: "$(G.testfile)" edit_xml => xml_delete_text("text content", "//c"); } @@ -30,27 +29,25 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml xml_insert_tree_nopath(treestring) { insert_tree: - '$(treestring)'; + '$(treestring)'; } bundle edit_xml xml_delete_text(match, xpath) { delete_text: - "$(match)" - select_xpath => "$(xpath)"; + "$(match)" select_xpath => "$(xpath)"; } diff --git a/tests/acceptance/28_inform_testing/01_files/edit_xml08.cf b/tests/acceptance/28_inform_testing/01_files/edit_xml08.cf index 87eda8e2e2..4ed1cef4dc 100644 --- a/tests/acceptance/28_inform_testing/01_files/edit_xml08.cf +++ b/tests/acceptance/28_inform_testing/01_files/edit_xml08.cf @@ -9,12 +9,11 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { - files: - "$(G.testfile)" edit_xml => xml_insert_tree_nopath(""), + "$(G.testfile)" + edit_xml => xml_insert_tree_nopath(""), create => "true"; } @@ -27,27 +26,25 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml xml_insert_tree_nopath(treestring) { insert_tree: - '$(treestring)'; + '$(treestring)'; } bundle edit_xml xml_insert_text(text, xpath) { insert_text: - "$(text)" - select_xpath => "$(xpath)"; + "$(text)" select_xpath => "$(xpath)"; } diff --git a/tests/acceptance/28_inform_testing/01_files/edit_xml09.cf b/tests/acceptance/28_inform_testing/01_files/edit_xml09.cf index a4a8f9d4a3..0ea7442eb5 100644 --- a/tests/acceptance/28_inform_testing/01_files/edit_xml09.cf +++ b/tests/acceptance/28_inform_testing/01_files/edit_xml09.cf @@ -9,12 +9,11 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { - files: - "$(G.testfile)" edit_xml => xml_insert_tree_nopath("text content"), + "$(G.testfile)" + edit_xml => xml_insert_tree_nopath("text content"), create => "true"; } @@ -27,27 +26,25 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml xml_insert_tree_nopath(treestring) { insert_tree: - '$(treestring)'; + '$(treestring)'; } bundle edit_xml xml_delete_tree(subtree, xpath) { delete_tree: - "$(subtree)" - select_xpath => "$(xpath)"; + "$(subtree)" select_xpath => "$(xpath)"; } diff --git a/tests/acceptance/28_inform_testing/01_files/insert_lines_noop.cf b/tests/acceptance/28_inform_testing/01_files/insert_lines_noop.cf index c6fedbc36d..aa80083482 100644 --- a/tests/acceptance/28_inform_testing/01_files/insert_lines_noop.cf +++ b/tests/acceptance/28_inform_testing/01_files/insert_lines_noop.cf @@ -13,7 +13,6 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { files: @@ -34,15 +33,13 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } - diff --git a/tests/acceptance/28_inform_testing/01_files/perms.cf b/tests/acceptance/28_inform_testing/01_files/perms.cf index f2978c5226..f0e135292d 100644 --- a/tests/acceptance/28_inform_testing/01_files/perms.cf +++ b/tests/acceptance/28_inform_testing/01_files/perms.cf @@ -38,12 +38,7 @@ bundle agent setup bundle agent main { files: - "$(G.testdir)/foo" - perms => m(777); - - "$(G.testdir)/baz" - perms => m(777); - - "$(G.testdir)/foobar" - perms => m(777); + "$(G.testdir)/foo" perms => m(777); + "$(G.testdir)/baz" perms => m(777); + "$(G.testdir)/foobar" perms => m(777); } diff --git a/tests/acceptance/28_inform_testing/01_files/rename_newname.cf b/tests/acceptance/28_inform_testing/01_files/rename_newname.cf index ff61a41c0a..7ee41e6295 100644 --- a/tests/acceptance/28_inform_testing/01_files/rename_newname.cf +++ b/tests/acceptance/28_inform_testing/01_files/rename_newname.cf @@ -12,17 +12,14 @@ bundle common testcase bundle agent setup { files: - "$(G.testfile)" - create => "true"; - "$(G.testroot)/TEST.foobar" - delete => init_delete; + "$(G.testfile)" create => "true"; + "$(G.testroot)/TEST.foobar" delete => init_delete; } bundle agent main { files: - "$(G.testfile)" - rename => newname; + "$(G.testfile)" rename => newname; } body rename newname diff --git a/tests/acceptance/28_inform_testing/01_files/rename_rotate.cf b/tests/acceptance/28_inform_testing/01_files/rename_rotate.cf index c03cc5d838..c54ee580f1 100644 --- a/tests/acceptance/28_inform_testing/01_files/rename_rotate.cf +++ b/tests/acceptance/28_inform_testing/01_files/rename_rotate.cf @@ -12,15 +12,13 @@ bundle common testcase bundle agent setup { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } bundle agent main { files: - "$(G.testfile)" - rename => rotate; + "$(G.testfile)" rename => rotate; } body rename rotate diff --git a/tests/acceptance/28_inform_testing/01_files/touch.cf b/tests/acceptance/28_inform_testing/01_files/touch.cf index 3bacb09d78..57a3588ac3 100644 --- a/tests/acceptance/28_inform_testing/01_files/touch.cf +++ b/tests/acceptance/28_inform_testing/01_files/touch.cf @@ -12,6 +12,5 @@ bundle common testcase bundle agent main { files: - "$(G.testfile)" - touch => "true"; + "$(G.testfile)" touch => "true"; } diff --git a/tests/acceptance/28_inform_testing/01_files/transformer.cf b/tests/acceptance/28_inform_testing/01_files/transformer.cf index d6435a4529..05df36125b 100644 --- a/tests/acceptance/28_inform_testing/01_files/transformer.cf +++ b/tests/acceptance/28_inform_testing/01_files/transformer.cf @@ -26,6 +26,5 @@ banana bundle agent main { files: - "$(G.testfile)" - transformer => "$(G.gzip) $(G.testfile)"; + "$(G.testfile)" transformer => "$(G.gzip) $(G.testfile)"; } diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/changes01.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/changes01.cf index 2445ea3ccd..051104918b 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/changes01.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/changes01.cf @@ -12,15 +12,13 @@ bundle common testcase bundle agent setup { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } bundle agent main { files: - "$(G.testfile)" - changes => example; + "$(G.testfile)" changes => example; } body changes example diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/changes02.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/changes02.cf index 4babb946a5..2ffc53af50 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/changes02.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/changes02.cf @@ -12,13 +12,11 @@ bundle common testcase bundle agent setup { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } bundle agent main { files: - "$(G.testfile)" - edit_line => insert_lines("foobar"); + "$(G.testfile)" edit_line => insert_lines("foobar"); } diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/copy_from01.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/copy_from01.cf index ef726d3917..96a9be6819 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/copy_from01.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/copy_from01.cf @@ -31,4 +31,3 @@ body copy_from example(from) compare => "digest"; preserve => "true"; } - diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/copy_from03.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/copy_from03.cf index 992bb63000..308883ddb1 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/copy_from03.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/copy_from03.cf @@ -23,6 +23,7 @@ bundle agent main "$(G.testroot)/TEST.destination/purgeme" create => "true", handle => "step_one"; + "$(G.testroot)/TEST.destination" depends_on => { "step_one" }, depth_search => recurse("inf"), diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/create.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/create.cf index b5b335b00b..071f48a786 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/create.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/create.cf @@ -12,6 +12,5 @@ bundle common testcase bundle agent main { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/delete.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/delete.cf index f8111dfafe..9eb90d5591 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/delete.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/delete.cf @@ -12,13 +12,11 @@ bundle common testcase bundle agent setup { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } bundle agent main { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line01.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line01.cf index 3e07d0c1fa..25c2201cb4 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line01.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line01.cf @@ -9,39 +9,37 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { files: "$(G.testfile)" - edit_line => insert_lines(" + edit_line => insert_lines( + " foo 1 bar 2 baz 3 me:x:1001:1001::/home/me:/bin/sh -"), +" + ), create => "true"; } bundle agent main { files: - "$(G.testfile)" - edit_line => set_colon_field("me","6","/my/new/shell"); + "$(G.testfile)" edit_line => set_colon_field("me", "6", "/my/new/shell"); } bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } - diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line02.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line02.cf index 2b0cf5758b..25a5b39cc4 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line02.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line02.cf @@ -9,39 +9,37 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { files: "$(G.testfile)" - edit_line => insert_lines(" + edit_line => insert_lines( + " foo 1 bar 2 baz 3 me:x:1001:1001::/home/me:/bin/sh -"), +" + ), create => "true"; } bundle agent main { files: - "$(G.testfile)" - edit_line => delete_lines_matching("foo 1"); + "$(G.testfile)" edit_line => delete_lines_matching("foo 1"); } bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } - diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line03.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line03.cf index 6754bf98de..8dd1c5a142 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line03.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line03.cf @@ -9,39 +9,37 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { files: "$(G.testfile)" - edit_line => insert_lines(" + edit_line => insert_lines( + " foo 1 bar 2 baz 3 me:x:1001:1001::/home/me:/bin/sh -"), +" + ), create => "true"; } bundle agent main { files: - "$(G.testfile)" - edit_line => insert_lines("amazing!"); + "$(G.testfile)" edit_line => insert_lines("amazing!"); } bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } - diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line04.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line04.cf index 5099e850d7..6f5500c0c5 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line04.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line04.cf @@ -9,39 +9,37 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { files: "$(G.testfile)" - edit_line => insert_lines(" + edit_line => insert_lines( + " foo 1 bar 2 baz 3 me:x:1001:1001::/home/me:/bin/sh -"), +" + ), create => "true"; } bundle agent main { files: - "$(G.testfile)" - edit_line => regex_replace("bar","BAR"); + "$(G.testfile)" edit_line => regex_replace("bar", "BAR"); } bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } - diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line05.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line05.cf index 2152aef491..dc8444c967 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line05.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_line05.cf @@ -9,17 +9,18 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { files: "$(G.testfile)" - edit_line => insert_lines(" + edit_line => insert_lines( + " foo 1 bar 2 baz 3 me:x:1001:1001::/home/me:/bin/sh -"), +" + ), create => "true"; } @@ -35,15 +36,13 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } - diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml01.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml01.cf index 066fb6b159..1f5b3c2210 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml01.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml01.cf @@ -9,12 +9,10 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } bundle agent main @@ -26,16 +24,15 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml build_xpath(xpath) diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml02.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml02.cf index 0196431d46..e29dde28d3 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml02.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml02.cf @@ -9,12 +9,11 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { - files: - "$(G.testfile)" edit_xml => xml_insert_tree_nopath(""), + "$(G.testfile)" + edit_xml => xml_insert_tree_nopath(""), create => "true"; } @@ -31,27 +30,25 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml xml_insert_tree_nopath(treestring) { insert_tree: - '$(treestring)'; + '$(treestring)'; } bundle edit_xml xml_insert_tree(treestring, xpath) { insert_tree: - '$(treestring)' select_xpath => "$(xpath)"; + '$(treestring)' select_xpath => "$(xpath)"; } - diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml03.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml03.cf index 4944bcf0da..2d56821d39 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml03.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml03.cf @@ -9,14 +9,14 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { vars: "xml" string => "y"; files: - "$(G.testfile)" edit_xml => xml_insert_tree_nopath("$(xml)"), + "$(G.testfile)" + edit_xml => xml_insert_tree_nopath("$(xml)"), create => "true"; } @@ -32,26 +32,25 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml xml_insert_tree_nopath(treestring) { insert_tree: - '$(treestring)'; + '$(treestring)'; } bundle edit_xml xml_insert_tree(treestring, xpath) { insert_tree: - '$(treestring)' select_xpath => "$(xpath)"; + '$(treestring)' select_xpath => "$(xpath)"; } diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml04.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml04.cf index c1b807c5c5..fd890a6029 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml04.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml04.cf @@ -9,12 +9,11 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { - files: - "$(G.testfile)" edit_xml => xml_insert_tree_nopath(""), + "$(G.testfile)" + edit_xml => xml_insert_tree_nopath(""), create => "true"; } @@ -27,27 +26,25 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml xml_insert_tree_nopath(treestring) { insert_tree: - '$(treestring)'; + '$(treestring)'; } bundle edit_xml xml_set_value(value, xpath) { set_text: - "$(value)" - select_xpath => "$(xpath)"; + "$(value)" select_xpath => "$(xpath)"; } diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml05.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml05.cf index 76360e5a99..1e71be9a37 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml05.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml05.cf @@ -9,48 +9,45 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { - files: - "$(G.testfile)" edit_xml => xml_insert_tree_nopath(""), + "$(G.testfile)" + edit_xml => xml_insert_tree_nopath(""), create => "true"; } bundle agent main { files: - "$(G.testfile)" edit_xml => xml_set_attribute("my_attr", "my_value", "//Root"); + "$(G.testfile)" + edit_xml => xml_set_attribute("my_attr", "my_value", "//Root"); } bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml xml_insert_tree_nopath(treestring) { insert_tree: - '$(treestring)'; + '$(treestring)'; } bundle edit_xml xml_set_attribute(attr, value, xpath) { set_attribute: - "$(attr)" + "$(attr)" attribute_value => "$(value)", select_xpath => "$(xpath)"; - } - diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml06.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml06.cf index eed4d1b99a..0b5c321035 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml06.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml06.cf @@ -9,12 +9,11 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { - files: - "$(G.testfile)" edit_xml => xml_insert_tree_nopath(""), + "$(G.testfile)" + edit_xml => xml_insert_tree_nopath(""), create => "true"; } @@ -27,27 +26,25 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml xml_insert_tree_nopath(treestring) { insert_tree: - '$(treestring)'; + '$(treestring)'; } bundle edit_xml xml_delete_attribute(attr, xpath) { delete_attribute: - "$(attr)" - select_xpath => "$(xpath)"; + "$(attr)" select_xpath => "$(xpath)"; } diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml07.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml07.cf index 457c27cd46..667fadd014 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml07.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml07.cf @@ -9,20 +9,19 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { vars: "xml" string => "text content"; files: - "$(G.testfile)" edit_xml => xml_insert_tree_nopath($(xml)), + "$(G.testfile)" + edit_xml => xml_insert_tree_nopath($(xml)), create => "true"; } bundle agent main { - files: "$(G.testfile)" edit_xml => xml_delete_text("text content", "//c"); } @@ -30,27 +29,25 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml xml_insert_tree_nopath(treestring) { insert_tree: - '$(treestring)'; + '$(treestring)'; } bundle edit_xml xml_delete_text(match, xpath) { delete_text: - "$(match)" - select_xpath => "$(xpath)"; + "$(match)" select_xpath => "$(xpath)"; } diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml08.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml08.cf index 207bde9790..9235f0e85a 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml08.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml08.cf @@ -9,12 +9,11 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { - files: - "$(G.testfile)" edit_xml => xml_insert_tree_nopath(""), + "$(G.testfile)" + edit_xml => xml_insert_tree_nopath(""), create => "true"; } @@ -27,27 +26,25 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml xml_insert_tree_nopath(treestring) { insert_tree: - '$(treestring)'; + '$(treestring)'; } bundle edit_xml xml_insert_text(text, xpath) { insert_text: - "$(text)" - select_xpath => "$(xpath)"; + "$(text)" select_xpath => "$(xpath)"; } diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml09.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml09.cf index cdec05d839..7fd6e4e549 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml09.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/edit_xml09.cf @@ -9,12 +9,11 @@ bundle common testcase "filename" string => "$(this.promise_filename)"; } - bundle agent setup { - files: - "$(G.testfile)" edit_xml => xml_insert_tree_nopath("text content"), + "$(G.testfile)" + edit_xml => xml_insert_tree_nopath("text content"), create => "true"; } @@ -27,27 +26,25 @@ bundle agent main bundle agent teardown { reports: - "Edited file has contents: " - printfile => my_cat( $(G.testfile) ); + "Edited file has contents: " printfile => my_cat($(G.testfile)); } body printfile my_cat(file) # @brief Report the contents of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } bundle edit_xml xml_insert_tree_nopath(treestring) { insert_tree: - '$(treestring)'; + '$(treestring)'; } bundle edit_xml xml_delete_tree(subtree, xpath) { delete_tree: - "$(subtree)" - select_xpath => "$(xpath)"; + "$(subtree)" select_xpath => "$(xpath)"; } diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/perms.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/perms.cf index 1dda939581..d6b4f7d456 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/perms.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/perms.cf @@ -12,13 +12,11 @@ bundle common testcase bundle agent setup { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } bundle agent main { files: - "$(G.testfile)" - perms => m(000); + "$(G.testfile)" perms => m(000); } diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/rename_newname.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/rename_newname.cf index 33d37d68ca..c71c4c193a 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/rename_newname.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/rename_newname.cf @@ -12,17 +12,14 @@ bundle common testcase bundle agent setup { files: - "$(G.testfile)" - create => "true"; - "$(G.testroot)/TEST.foobar" - delete => init_delete; + "$(G.testfile)" create => "true"; + "$(G.testroot)/TEST.foobar" delete => init_delete; } bundle agent main { files: - "$(G.testfile)" - rename => newname; + "$(G.testfile)" rename => newname; } body rename newname diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/rename_rotate.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/rename_rotate.cf index c4e91b7a9e..38a25bd7f8 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/rename_rotate.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/rename_rotate.cf @@ -12,15 +12,13 @@ bundle common testcase bundle agent setup { files: - "$(G.testfile)" - create => "true"; + "$(G.testfile)" create => "true"; } bundle agent main { files: - "$(G.testfile)" - rename => rotate; + "$(G.testfile)" rename => rotate; } body rename rotate diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/touch.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/touch.cf index beeecc3059..8e80183913 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/touch.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/touch.cf @@ -12,6 +12,5 @@ bundle common testcase bundle agent main { files: - "$(G.testfile)" - touch => "true"; + "$(G.testfile)" touch => "true"; } diff --git a/tests/acceptance/28_inform_testing/02_soft_fail_files/transformer.cf b/tests/acceptance/28_inform_testing/02_soft_fail_files/transformer.cf index 5a5487b8a3..00af52cb97 100644 --- a/tests/acceptance/28_inform_testing/02_soft_fail_files/transformer.cf +++ b/tests/acceptance/28_inform_testing/02_soft_fail_files/transformer.cf @@ -26,6 +26,5 @@ banana bundle agent main { files: - "$(G.testfile)" - transformer => "$(G.gzip) $(G.testfile)"; + "$(G.testfile)" transformer => "$(G.gzip) $(G.testfile)"; }