diff --git a/.github/workflows/cfengine_cli.yml b/.github/workflows/cfengine_cli.yml new file mode 100644 index 0000000000..1dab88dfb3 --- /dev/null +++ b/.github/workflows/cfengine_cli.yml @@ -0,0 +1,23 @@ +name: Lint policy and check formatting with CFEngine CLI +on: + workflow_call: +permissions: + contents: read +jobs: + lint: + runs-on: ubuntu-24.04 + steps: + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.14" + - name: Checkout masterfiles + uses: actions/checkout@v7 + - name: Install CFEngine CLI + run: pipx install cfengine + - name: Run cfengine lint + run: | + cfengine lint --strict no ./ + - name: Run cfengine format --check + run: | + cfengine format --check diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3510615faf..36bcf11f06 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,10 @@ on: branches: [ master, 3.27.x, 3.24.x ] jobs: + cfengine_cli: + uses: ./.github/workflows/cfengine_cli.yml unit_tests: + needs: cfengine_cli uses: ./.github/workflows/unit_tests.yml shellcheck_tests: uses: ./.github/workflows/shellcheck.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index e8b113a2f4..326b2e5fd6 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -4,23 +4,21 @@ name: Label and close stale pull requests on: schedule: - - cron: '31 19 * * *' + - cron: "31 19 * * *" workflow_dispatch: jobs: stale: - runs-on: ubuntu-latest permissions: pull-requests: write steps: - - uses: actions/stale@v5 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-pr-message: 'Marking this PR as stale due to inactivity; it will be closed in 7 days.' - stale-pr-label: 'stale' - days-before-stale: 30 - days-before-close: 7 - close-pr-message: "Closing PR due to inactivity. Feel free to open a new PR if necessary." - + - uses: actions/stale@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-pr-message: "Marking this PR as stale due to inactivity; it will be closed in 7 days." + stale-pr-label: "stale" + days-before-stale: 30 + days-before-close: 7 + close-pr-message: "Closing PR due to inactivity. Feel free to open a new PR if necessary." diff --git a/contrib/cf-doc/example_cf-doc.cf b/contrib/cf-doc/example_cf-doc.cf index 8930365b44..ec33512045 100755 --- a/contrib/cf-doc/example_cf-doc.cf +++ b/contrib/cf-doc/example_cf-doc.cf @@ -1,17 +1,19 @@ #!/var/cfengine/bin/cf-agent -f- bundle agent example_cf_doc { - meta: - "inventory" string => "Example: This bundle does Inventory"; - "config" string => "Example: This bundle configures /tmp/example.txt"; + meta: + "inventory" string => "Example: This bundle does Inventory"; + "config" string => "Example: This bundle configures /tmp/example.txt"; - vars: - "h" - string => "$(sys.fqhost)", - meta => { "docinv=Fully Qualified Hostname according to CFEngine" }; + vars: + "h" + string => "$(sys.fqhost)", + meta => { "docinv=Fully Qualified Hostname according to CFEngine" }; - files: - "/tmp/example.txt" - create => 'true', - meta => { "docconfig=Make sure the important file /tmp/example.txt exists" }; + files: + "/tmp/example.txt" + create => 'true', + meta => { + "docconfig=Make sure the important file /tmp/example.txt exists" + }; } diff --git a/contrib/cf-profile/tests/lib/namespace/ns1.cf b/contrib/cf-profile/tests/lib/namespace/ns1.cf index df33116ab5..7c5fb0a5ef 100644 --- a/contrib/cf-profile/tests/lib/namespace/ns1.cf +++ b/contrib/cf-profile/tests/lib/namespace/ns1.cf @@ -1,14 +1,17 @@ -body file control { - namespace => "ns1"; - inputs => { "$(ns1:d.dir)/ns2.cf" }; +body file control +{ + namespace => "ns1"; + inputs => { "$(ns1:d.dir)/ns2.cf" }; } -bundle common d { - vars: - "dir" string => "$(this.promise_dirname)"; +bundle common d +{ + vars: + "dir" string => "$(this.promise_dirname)"; } -bundle agent ns1 { - methods: - "c" usebundle => ns2:ns2; +bundle agent ns1 +{ + methods: + "c" usebundle => ns2:ns2; } diff --git a/contrib/cf-profile/tests/lib/namespace/ns2.cf b/contrib/cf-profile/tests/lib/namespace/ns2.cf index 8a24a92697..120eb42e6e 100644 --- a/contrib/cf-profile/tests/lib/namespace/ns2.cf +++ b/contrib/cf-profile/tests/lib/namespace/ns2.cf @@ -1,7 +1,10 @@ -body file control { - namespace => "ns2"; +body file control +{ + namespace => "ns2"; } -bundle agent ns2 { - commands: - "/bin/sleep 2"; + +bundle agent ns2 +{ + commands: + "/bin/sleep 2"; } diff --git a/contrib/cf-profile/tests/namespace.cf b/contrib/cf-profile/tests/namespace.cf index 7bc45323c0..97e3c6ebea 100644 --- a/contrib/cf-profile/tests/namespace.cf +++ b/contrib/cf-profile/tests/namespace.cf @@ -1,20 +1,24 @@ -body common control { - bundlesequence => { "main" }; - inputs => { "$(d.dir)/lib/namespace/ns1.cf" }; +body common control +{ + bundlesequence => { "main" }; + inputs => { "$(d.dir)/lib/namespace/ns1.cf" }; } -bundle common d { - vars: - "dir" string => "$(this.promise_dirname)"; +bundle common d +{ + vars: + "dir" string => "$(this.promise_dirname)"; } -bundle agent main { - methods: - "a" usebundle => ns1:ns1; - "b" usebundle => ns1; +bundle agent main +{ + methods: + "a" usebundle => ns1:ns1; + "b" usebundle => ns1; } -bundle agent ns1 { - commands: - "/bin/sleep 3"; +bundle agent ns1 +{ + commands: + "/bin/sleep 3"; } diff --git a/contrib/cf-profile/tests/promises.cf b/contrib/cf-profile/tests/promises.cf index eb8b424807..f9d7588402 100644 --- a/contrib/cf-profile/tests/promises.cf +++ b/contrib/cf-profile/tests/promises.cf @@ -1,33 +1,41 @@ -body common control { - bundlesequence => { "main1", "main2" }; +body common control +{ + bundlesequence => { "main1", "main2" }; } -bundle agent main1 { +bundle agent main1 +{ + commands: + "/bin/sleep 1"; - commands: - "/bin/sleep 1"; - - methods: - "a" usebundle => a("arg1 somevalue", "arg2 somevalue", "arg3 somevalue"); - "b" usebundle => b("arg4 somevalue", "arg5 somevalue", "arg6 somevalue"); + methods: + "a" usebundle => a("arg1 somevalue", "arg2 somevalue", "arg3 somevalue"); + "b" usebundle => b("arg4 somevalue", "arg5 somevalue", "arg6 somevalue"); } -bundle agent a (a1, a2, a3) { - commands: - "/bin/echo $(this.bundle):$(a1),$(a2),$(a3)"; +bundle agent a(a1, a2, a3) +{ + commands: + "/bin/echo $(this.bundle):$(a1),$(a2),$(a3)"; } -bundle agent b (a1, a2, a3) { - methods: - "c" usebundle => c("arg7 somevalue", "arg8 somevalue", "arg9 somevalue"); - commands: - "/bin/echo $(this.bundle):$(a1),$(a2),$(a3)"; + +bundle agent b(a1, a2, a3) +{ + methods: + "c" usebundle => c("arg7 somevalue", "arg8 somevalue", "arg9 somevalue"); + + commands: + "/bin/echo $(this.bundle):$(a1),$(a2),$(a3)"; } -bundle agent c (a1, a2, a3) { - commands: - "/bin/echo $(this.bundle):$(a1),$(a2),$(a3)"; + +bundle agent c(a1, a2, a3) +{ + commands: + "/bin/echo $(this.bundle):$(a1),$(a2),$(a3)"; } -bundle agent main2 { - commands: - "/bin/sleep 2"; +bundle agent main2 +{ + commands: + "/bin/sleep 2"; } diff --git a/contrib/masterfiles/git-failsafe.cf b/contrib/masterfiles/git-failsafe.cf index a03600493f..5eb48a5459 100644 --- a/contrib/masterfiles/git-failsafe.cf +++ b/contrib/masterfiles/git-failsafe.cf @@ -3,79 +3,88 @@ # failsafe.cf - Basic Failsafe Policy for Community # ############################################################################### - body common control { - bundlesequence => { "git_update" }; - version => "git-failsafe.cf 1.0.0"; + bundlesequence => { "git_update" }; + version => "git-failsafe.cf 1.0.0"; } ############################################################################# - body agent control { - ifelapsed => "1"; - skipidentify => "true"; + ifelapsed => "1"; + skipidentify => "true"; } ############################################################################# - bundle agent git_update { - vars: - - "inputs_dir" string => translatepath("$(sys.workdir)/inputs"), - comment => "Directory containing Cfengine policies", - handle => "update_vars_inputs_dir"; - - "ppkeys_file" string => translatepath("$(sys.workdir)/ppkeys/localhost.pub"), - comment => "Path to public key file", - handle => "update_vars_ppkeys_file"; - - "file_check" string => translatepath("$(inputs_dir)/promises.cf"), - comment => "Path to a policy file", - handle => "update_vars_file_check"; - - "master_location" string => "/var/cfengine/masterfiles", - comment => "The master cfengine policy directory on the policy host", - handle => "update_vars_master_location"; - - "git_origin" string => "http://myserver.com/myrepo.git", + vars: + "inputs_dir" + string => translatepath("$(sys.workdir)/inputs"), + comment => "Directory containing Cfengine policies", + handle => "update_vars_inputs_dir"; + + "ppkeys_file" + string => translatepath("$(sys.workdir)/ppkeys/localhost.pub"), + comment => "Path to public key file", + handle => "update_vars_ppkeys_file"; + + "file_check" + string => translatepath("$(inputs_dir)/promises.cf"), + comment => "Path to a policy file", + handle => "update_vars_file_check"; + + "master_location" + string => "/var/cfengine/masterfiles", + comment => "The master cfengine policy directory on the policy host", + handle => "update_vars_master_location"; + + "git_origin" + string => "http://myserver.com/myrepo.git", comment => "The URL to the Git repository.", handle => "update_vars_git_origin"; - "git_checkout_location" string => "$(master_location)/myrepo", + "git_checkout_location" + string => "$(master_location)/myrepo", comment => "The desired checkout location of the Git repository", handle => "update_vars_git_checkout_location"; - "git_checkout_umask" string => "077", + "git_checkout_umask" + string => "077", comment => "The desired umask while checking out the Git repository", handle => "update_vars_git_checkout_umask"; - "git_configfile" string => "$(git_checkout_location)/.git/config", + "git_configfile" + string => "$(git_checkout_location)/.git/config", comment => "The .git/config file location", handle => "update_vars_git_configfile"; - "git_branch" string => "master", + "git_branch" + string => "master", comment => "The desired branch of the Git repository", handle => "update_vars_git_branch"; - "git_binary" string => "/usr/bin/git", + "git_binary" + string => "/usr/bin/git", comment => "The location of the Git executable. Leave blank if you don't want to use Git.", handle => "update_vars_git_binary"; - # 1. Remove untracked files, 2. Discard changes to index and working tree since HEAD - # 3. Check out the proper branch; 4. Pull the latest changes from origin; - # 5. Reset the working tree to the latest updates - "git_update_command" string => "$(git_binary) clean -f -f -x -q -d .; $(git_binary) reset -q --hard HEAD; $(git_binary) checkout -q $(git_branch); $(git_binary) pull -q -s recursive -Xtheirs origin $(git_branch); $(git_binary) reset -q --hard HEAD", + # 1. Remove untracked files, 2. Discard changes to index and working tree since HEAD + # 3. Check out the proper branch; 4. Pull the latest changes from origin; + # 5. Reset the working tree to the latest updates + "git_update_command" + string => "$(git_binary) clean -f -f -x -q -d .; $(git_binary) reset -q --hard HEAD; $(git_binary) checkout -q $(git_branch); $(git_binary) pull -q -s recursive -Xtheirs origin $(git_branch); $(git_binary) reset -q --hard HEAD", comment => "The commands to do a Git update. They should DTRT for your environment (checkout/reset/clean/etc).", handle => "update_vars_git_update_command"; - "git_clone_command" string => "$(git_binary) clone -b $(git_branch) $(git_origin) $(git_checkout_location)", + "git_clone_command" + string => "$(git_binary) clone -b $(git_branch) $(git_origin) $(git_checkout_location)", comment => "The commands to do a Git update. They should DTRT for your environment (checkout/reset/clean/etc).", handle => "update_vars_git_clone_command"; - "git_config_template" string => " + "git_config_template" + string => " [core] repositoryformatversion = 0 filemode = true @@ -94,184 +103,176 @@ bundle agent git_update comment => "The $(git_configfile) template.", handle => "update_vars_git_config_template"; -# - - classes: - - # Set this to "any" or a machine class to have those machines do - # the Git checkouts locally, effectively replacing the policy - # hub model for a "just checkout from Git everywhere" model. + classes: + # Set this to "any" or a machine class to have those machines do + # the Git checkouts locally, effectively replacing the policy + # hub model for a "just checkout from Git everywhere" model. + # This is not recommended unless you are testing in isolation or + # have other very specific requirements. + "idempotent_git" expression => "!any"; - # This is not recommended unless you are testing in isolation or - # have other very specific requirements. - "idempotent_git" expression => "!any"; - - "use_git" expression => fileexists("$(git_binary)"), + "use_git" + expression => fileexists("$(git_binary)"), comment => "True if we found the Git binary and should use Git.", handle => "update_classes_use_git"; - "git_checkout_location_exists" expression => fileexists("$(git_checkout_location)"), + "git_checkout_location_exists" + expression => fileexists("$(git_checkout_location)"), comment => "True if the Git checkout location exists.", handle => "update_classes_git_checkout_location_exists"; - "git_checkout_exists" expression => fileexists("$(git_checkout_location)/.git"), + "git_checkout_exists" + expression => fileexists("$(git_checkout_location)/.git"), comment => "True if the Git checkout has already happened.", handle => "update_classes_git_checkout_exists"; - - "have_ppkeys" expression => fileexists("$(ppkeys_file)"), - comment => "Check for /var/cfengine/ppkeys/localhost.pub", - handle => "update_classes_have_ppkeys"; - - "files_ok" expression => fileexists("$(file_check)"), - comment => "Check for /var/cfengine/masterfiles/promises.cf", - handle => "update_classes_files_ok"; - -# - - processes: - - files_ok:: - - "cf-serverd" restart_class => "start_server", - comment => "Monitor cf-serverd process", - handle => "update_processes_cf_serverd"; - - "cf-monitord" restart_class => "start_monitor", - comment => "Monitor cf-monitord process", - handle => "update_processes_cf_monitord"; - - files_ok.!windows:: - - "cf-execd" restart_class => "start_exec", - comment => "Monitor cf-execd process", - handle => "update_processes_cf_execd"; - -# - - commands: - - start_server:: - - "$(sys.cf_serverd)" - comment => "Start cf-serverd process", - handle => "update_commands_start_cf_serverd"; - - start_monitor:: - - "$(sys.cf_monitord)" - comment => "Start cf-monitord process", - handle => "update_commands_start_cf_monitord"; - - !windows.start_exec:: - - "$(sys.cf_execd)" - comment => "Start cf-execd process", - handle => "update_commands_start_cf_execd_not_windows"; - - !have_ppkeys:: - - "$(sys.cf_key)", - comment => "Generate cfengine encryption keys if necessary", - handle => "update_commands_generate_keys"; + "have_ppkeys" + expression => fileexists("$(ppkeys_file)"), + comment => "Check for /var/cfengine/ppkeys/localhost.pub", + handle => "update_classes_have_ppkeys"; + + "files_ok" + expression => fileexists("$(file_check)"), + comment => "Check for /var/cfengine/masterfiles/promises.cf", + handle => "update_classes_files_ok"; + + processes: + files_ok:: + "cf-serverd" + restart_class => "start_server", + comment => "Monitor cf-serverd process", + handle => "update_processes_cf_serverd"; + + "cf-monitord" + restart_class => "start_monitor", + comment => "Monitor cf-monitord process", + handle => "update_processes_cf_monitord"; + + files_ok.!windows:: + "cf-execd" + restart_class => "start_exec", + comment => "Monitor cf-execd process", + handle => "update_processes_cf_execd"; + + commands: + start_server:: + "$(sys.cf_serverd)" + comment => "Start cf-serverd process", + handle => "update_commands_start_cf_serverd"; + + start_monitor:: + "$(sys.cf_monitord)" + comment => "Start cf-monitord process", + handle => "update_commands_start_cf_monitord"; + + !windows.start_exec:: + "$(sys.cf_execd)" + comment => "Start cf-execd process", + handle => "update_commands_start_cf_execd_not_windows"; + + !have_ppkeys:: + "$(sys.cf_key)", + comment => "Generate cfengine encryption keys if necessary", + handle => "update_commands_generate_keys"; (idempotent_git||am_policy_hub).use_git.git_config_ok:: "$(git_update_command)" - contain => u_in_dir_umask_shell("$(git_checkout_location)", "$(git_checkout_umask)"), - comment => "Update the Git repository.", - handle => "update_commands_git_update", - classes => u_if_repaired("git_resolve_updated"); + contain => u_in_dir_umask_shell( + "$(git_checkout_location)", "$(git_checkout_umask)" + ), + comment => "Update the Git repository.", + handle => "update_commands_git_update", + classes => u_if_repaired("git_resolve_updated"); (idempotent_git||am_policy_hub).use_git.!git_checkout_location_exists.!git_checkout_exists:: "$(git_clone_command)" - contain => u_in_dir_umask_shell("/", "$(git_checkout_umask)"), - comment => "Clone the Git repository.", - handle => "update_commands_git_clone", - classes => u_if_repaired("git_resolve_cloned"); - -# - - files: - - !(idempotent_git||am_policy_hub):: # policy hub should not alter inputs/ uneccessary - - "$(inputs_dir)/cf_promises_validated" + contain => u_in_dir_umask_shell("/", "$(git_checkout_umask)"), + comment => "Clone the Git repository.", + handle => "update_commands_git_clone", + classes => u_if_repaired("git_resolve_cloned"); + + files: + !(idempotent_git||am_policy_hub):: + # policy hub should not alter inputs/ uneccessary + "$(inputs_dir)/cf_promises_validated" comment => "Check whether a validation stamp is available for a new policy update to reduce the distributed load", - handle => "check_valid_update", - copy_from => u_rcp("$(master_location)/cf_promises_validated","$(sys.policy_hub)"), - action => u_immediate, + handle => "check_valid_update", + copy_from => u_rcp( + "$(master_location)/cf_promises_validated", "$(sys.policy_hub)" + ), + action => u_immediate, classes => u_if_repaired("validated_updates_ready"); - # on the policy hub, converge the .git/config file iff the checkout has been made already + # on the policy hub, converge the .git/config file iff the checkout has been made already (idempotent_git||am_policy_hub).use_git.git_checkout_location_exists.git_checkout_exists:: "$(git_configfile)" - handle => "converge_git_configfile", - classes => u_if_ok("git_config_ok"), - perms => u_m("600"), - edit_defaults => u_empty, - edit_line => u_insert_lines("$(git_config_template)"); - - # on the policy hub, do the following if a) we don't use Git - # or b) the Git update succeeded - !idempotent_git.(am_policy_hub.((git_resolve_cloned||git_resolve_updated)|!use_git))|validated_updates_ready:: # policy hub should always put masterfiles in inputs in order to check new policy - - "$(inputs_dir)" - comment => "Copy policy updates from master source on policy server if a new validation was acquired", - handle => "update_files_inputs_dir", - copy_from => u_rcp("$(master_location)","$(sys.policy_hub)"), - depth_search => u_recurse("inf"), - file_select => u_input_files, + handle => "converge_git_configfile", + classes => u_if_ok("git_config_ok"), + perms => u_m("600"), + edit_defaults => u_empty, + edit_line => u_insert_lines("$(git_config_template)"); + + # on the policy hub, do the following if a) we don't use Git + # or b) the Git update succeeded + !idempotent_git.(am_policy_hub.((git_resolve_cloned||git_resolve_updated)|!use_git))|validated_updates_ready:: + # policy hub should always put masterfiles in inputs in order to check new policy + "$(inputs_dir)" + comment => "Copy policy updates from master source on policy server if a new validation was acquired", + handle => "update_files_inputs_dir", + copy_from => u_rcp("$(master_location)", "$(sys.policy_hub)"), + depth_search => u_recurse("inf"), + file_select => u_input_files, depends_on => { "check_valid_update" }, - action => u_immediate, - classes => u_if_repaired("update_report"); - - !windows:: - - "$(sys.workdir)/bin" - comment => "Make sure cfengine binaries have right file permissions", - handle => "update_files_sys_workdir_bin", - perms => u_m("755"), - depth_search => u_recurse_basedir("inf"), - action => u_immediate; - - "$(sys.workdir)/lib" - comment => "Make sure cfengine libraries have right file permissions", - handle => "update_files_sys_workdir_lib", - perms => u_m("644"), - depth_search => u_recurse_basedir("inf"), - action => u_immediate; - - "$(sys.workdir)/lib" - comment => "Make sure cfengine libraries have right file permissions for only HP-UX", - handle => "update_files_sys_workdir_lib_hpux", - perms => u_m("755"), - depth_search => u_recurse_basedir("inf"), - action => u_immediate, - if => "hpux"; - - "/usr/local/bin" - comment => "Ensure cfengine binaries were copied to /usr/local/bin", - handle => "update_files_usr_local_bin", - perms => u_m("755"), - copy_from => u_cp_nobck("$(sys.workdir)/bin"), - file_select => u_cf3_files, - depth_search => u_recurse("1"), - action => u_immediate; - - am_policy_hub:: - - "$(master_location)/." - comment => "Make sure masterfiles folder has right file permissions", - handle => "update_files_sys_workdir_masterfiles", - perms => u_m("644"), - depth_search => u_recurse_basedir("inf"), - action => u_immediate; + action => u_immediate, + classes => u_if_repaired("update_report"); + + !windows:: + "$(sys.workdir)/bin" + comment => "Make sure cfengine binaries have right file permissions", + handle => "update_files_sys_workdir_bin", + perms => u_m("755"), + depth_search => u_recurse_basedir("inf"), + action => u_immediate; + + "$(sys.workdir)/lib" + comment => "Make sure cfengine libraries have right file permissions", + handle => "update_files_sys_workdir_lib", + perms => u_m("644"), + depth_search => u_recurse_basedir("inf"), + action => u_immediate; + + "$(sys.workdir)/lib" + comment => "Make sure cfengine libraries have right file permissions for only HP-UX", + handle => "update_files_sys_workdir_lib_hpux", + perms => u_m("755"), + depth_search => u_recurse_basedir("inf"), + action => u_immediate, + if => "hpux"; + + "/usr/local/bin" + comment => "Ensure cfengine binaries were copied to /usr/local/bin", + handle => "update_files_usr_local_bin", + perms => u_m("755"), + copy_from => u_cp_nobck("$(sys.workdir)/bin"), + file_select => u_cf3_files, + depth_search => u_recurse("1"), + action => u_immediate; + + am_policy_hub:: + "$(master_location)/." + comment => "Make sure masterfiles folder has right file permissions", + handle => "update_files_sys_workdir_masterfiles", + perms => u_m("644"), + depth_search => u_recurse_basedir("inf"), + action => u_immediate; reports: git_checkout_location_exists.!git_checkout_exists:: "$(git_checkout_location) already exists but it's not a Git checkout location. Aborting."; + git_resolve_updated:: "Updated $(git_origin) (branch $(git_branch), umask $(git_checkout_umask)) into $(git_checkout_location)"; + git_resolve_cloned:: "Cloned $(git_origin) (branch $(git_branch), umask $(git_checkout_umask)) into $(git_checkout_location)"; } @@ -279,112 +280,97 @@ bundle agent git_update ######################################################### # Self-contained bodies from the lib to avoid dependencies ######################################################### - body perms u_m(p) { - mode => "$(p)"; + mode => "$(p)"; } ######################################################### - body file_select u_cf3_files { - leaf_name => { "cf-.*" }; - file_result => "leaf_name"; + leaf_name => { "cf-.*" }; + file_result => "leaf_name"; } ######################################################### - body file_select u_input_files { - leaf_name => { ".*.cf",".*.dat",".*.txt" }; - file_result => "leaf_name"; + leaf_name => { ".*.cf", ".*.dat", ".*.txt" }; + file_result => "leaf_name"; } ######################################################### - -body copy_from u_rcp(from,server) +body copy_from u_rcp(from, server) { - source => "$(from)"; - compare => "digest"; - trustkey => "false"; - -!am_policy_hub:: + source => "$(from)"; + compare => "digest"; + trustkey => "false"; - servers => { "$(server)" }; + !am_policy_hub:: + servers => { "$(server)" }; } ######################################################### - body copy_from u_cp_nobck(from) { - source => "$(from)"; - compare => "digest"; - copy_backup => "false"; + source => "$(from)"; + compare => "digest"; + copy_backup => "false"; } ######################################################### - body action u_immediate { - ifelapsed => "0"; + ifelapsed => "0"; } ######################################################### - body depth_search u_recurse(d) { - depth => "$(d)"; - exclude_dirs => { "\.svn", "\.git", "\.hg", "\.bzr" }; + depth => "$(d)"; + exclude_dirs => { "\.svn", "\.git", "\.hg", "\.bzr" }; } ######################################################### - body depth_search u_recurse_basedir(d) { - include_basedir => "true"; - depth => "$(d)"; - exclude_dirs => { "\.svn", "\.git", "\.hg", "\.bzr" }; + include_basedir => "true"; + depth => "$(d)"; + exclude_dirs => { "\.svn", "\.git", "\.hg", "\.bzr" }; } ######################################################### - body classes u_if_repaired(x) { - promise_repaired => { "$(x)" }; + promise_repaired => { "$(x)" }; } body classes u_if_ok(x) { - promise_repaired => { "$(x)" }; - promise_kept => { "$(x)" }; + promise_repaired => { "$(x)" }; + promise_kept => { "$(x)" }; } ######################################################### - body contain u_in_dir_umask_shell(dir, umask) { - chdir => "$(dir)"; - useshell => "true"; - umask => "$(umask)"; + chdir => "$(dir)"; + useshell => "true"; + umask => "$(umask)"; } ######################################################### - bundle edit_line u_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 u_empty { - empty_file_before_editing => "true"; - edit_backup => "false"; + empty_file_before_editing => "true"; + edit_backup => "false"; } ######################################################### diff --git a/examples/abort.cf b/examples/abort.cf index 2c5063af32..2d82f73ab4 100644 --- a/examples/abort.cf +++ b/examples/abort.cf @@ -1,59 +1,43 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #[%+%] body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } body agent control - { - abortbundleclasses => { "invalid" }; + abortbundleclasses => { "invalid" }; } -#[%-%] +#[%-%] ########################################### #[%+%] - bundle agent example - { vars: - - #"userlist" slist => { "mark", "john" }; # contains all valid entries - "userlist" slist => { "mark", "john", "thomas" }; # contains one invalid entry - + #"userlist" slist => { "mark", "john" }; # contains all valid entries + "userlist" slist => { "mark", "john", "thomas" }; # contains one invalid entry classes: - - "invalid" not => regcmp("[a-z][a-z][a-z][a-z]","$(userlist)"); # The class 'invalid' is set if the user name does not - # contain exactly four un-capitalized letters (bundle - # execution will be aborted if set) - + "invalid" not => regcmp("[a-z][a-z][a-z][a-z]", "$(userlist)"); # The class 'invalid' is set if the user name does not + # contain exactly four un-capitalized letters (bundle + # execution will be aborted if set) reports: - !invalid:: - "User name $(userlist) is valid at 4 letters"; } diff --git a/examples/accessed_before.cf b/examples/accessed_before.cf index 87487282f4..01e92fbcf2 100644 --- a/examples/accessed_before.cf +++ b/examples/accessed_before.cf @@ -1,51 +1,33 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # Show the definition of classes by comparing timestamps -# - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################################### - bundle agent example - -{ +{ classes: - - "do_it" and => { - accessedbefore("/tmp/earlier","/tmp/later") - }; + "do_it" and => { accessedbefore("/tmp/earlier", "/tmp/later") }; reports: - do_it:: - "The earlier file has been accessed before the later"; - } - diff --git a/examples/accessedbefore.cf b/examples/accessedbefore.cf index c2569581e7..3840d9b6b0 100644 --- a/examples/accessedbefore.cf +++ b/examples/accessedbefore.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ touch -a -t '200102031234.56' /tmp/earlier @@ -30,18 +24,19 @@ #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { classes: - "do_it" expression => accessedbefore("/tmp/earlier","/tmp/later"); + "do_it" expression => accessedbefore("/tmp/earlier", "/tmp/later"); reports: do_it:: "The secret changes have been accessed after the reference time"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/accumulated_time.cf b/examples/accumulated_time.cf index 49bc874475..d3749a57c8 100644 --- a/examples/accumulated_time.cf +++ b/examples/accumulated_time.cf @@ -1,71 +1,54 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test processes # ######################################################## - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { processes: - - ".*" - - process_count => anyprocs, - process_select => proc_finder; + ".*" + process_count => anyprocs, + process_select => proc_finder; reports: - any_procs:: - "Found processes in range"; } ######################################################## - body process_select proc_finder - { - ttime_range => irange(accumulated(0,0,0,0,2,0),accumulated(0,0,0,0,20,0)); - process_result => "ttime"; + ttime_range => irange( + accumulated(0, 0, 0, 0, 2, 0), accumulated(0, 0, 0, 0, 20, 0) + ); + process_result => "ttime"; } ######################################################## - body process_count anyprocs - { - match_range => "0,0"; - out_of_range_define => { "any_procs" }; + match_range => "0,0"; + out_of_range_define => { "any_procs" }; } - diff --git a/examples/acl.cf b/examples/acl.cf index 271b73d25f..7d7bf6a6f7 100644 --- a/examples/acl.cf +++ b/examples/acl.cf @@ -1,70 +1,55 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "acls" }; + bundlesequence => { "acls" }; } ######################################### - bundle agent acls - { files: - - "/media/flash/acl/test_dir" - + "/media/flash/acl/test_dir" depth_search => include_base, acl => template; } ######################################### - body acl template - { - acl_method => "overwrite"; - acl_type => "posix"; - acl_default => "access"; - aces => { "user:*:r(wwx),-r:allow", "group:*:+rw:allow", "mask:x:allow", "all:r"}; + acl_method => "overwrite"; + acl_type => "posix"; + acl_default => "access"; + aces => { + "user:*:r(wwx),-r:allow", "group:*:+rw:allow", "mask:x:allow", "all:r" + }; } ######################################### - body acl win - { - acl_method => "overwrite"; - acl_type => "ntfs"; - acl_default => "nochange"; - aces => { "user:Administrator:rw", "group:Bad:rwx(Dpo):deny" }; + acl_method => "overwrite"; + acl_type => "ntfs"; + acl_default => "nochange"; + aces => { "user:Administrator:rw", "group:Bad:rwx(Dpo):deny" }; } ######################################### - body depth_search include_base - { - include_basedir => "true"; + include_basedir => "true"; } diff --git a/examples/acl_generic.cf b/examples/acl_generic.cf index 68b030d7a8..4e8d8b2800 100644 --- a/examples/acl_generic.cf +++ b/examples/acl_generic.cf @@ -1,57 +1,42 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "acls" }; + bundlesequence => { "acls" }; } ######################################### - bundle agent acls - { files: - - "/media/flash/acl/test_dir" - + "/media/flash/acl/test_dir" depth_search => include_base, acl => test; } ######################################### - body acl test - { - acl_type => "generic"; - aces => {"user:bob:rwx", "group:staff:rx", "all:r"}; + acl_type => "generic"; + aces => { "user:bob:rwx", "group:staff:rx", "all:r" }; } ######################################### - body depth_search include_base - { - include_basedir => "true"; + include_basedir => "true"; } diff --git a/examples/acl_ntfs.cf b/examples/acl_ntfs.cf index a9649a9622..f79b7ce37f 100644 --- a/examples/acl_ntfs.cf +++ b/examples/acl_ntfs.cf @@ -1,26 +1,28 @@ -body common control -{ - inputs => { "$(sys.libdir)/stdlib.cf" }; - bundlesequence => { "example" }; -} - +body common control +{ + inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "example" }; +} + ### - -bundle agent example -{ - vars: - "acl_secret_dir" slist => { "user:Administrator:rwx:allow", "group:Administrators:rx:allow" }; - "acl_secret_file" slist => { "user:Administrator:rw:allow" }; - - files: - - windows:: - "C:\Secret" - acl => ntfs( "@(acl_secret_dir)" ), - depth_search => include_base, - perms => owner( "Administrator" ); - - "C:\Secret\file.txt" - acl => ntfs( "@(acl_secret_file)" ), - perms => owner( "Administrator" ); -} +bundle agent example +{ + vars: + "acl_secret_dir" + slist => { + "user:Administrator:rwx:allow", "group:Administrators:rx:allow" + }; + + "acl_secret_file" slist => { "user:Administrator:rw:allow" }; + + files: + windows:: + "C:\Secret" + acl => ntfs("@(acl_secret_dir)"), + depth_search => include_base, + perms => owner("Administrator"); + + "C:\Secret\file.txt" + acl => ntfs("@(acl_secret_file)"), + perms => owner("Administrator"); +} diff --git a/examples/acl_secret.cf b/examples/acl_secret.cf index 0bab7c4c97..2a72cae758 100644 --- a/examples/acl_secret.cf +++ b/examples/acl_secret.cf @@ -1,56 +1,43 @@ # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - body common control { - bundlesequence => { "acls" }; + bundlesequence => { "acls" }; } ######################################### - bundle agent acls - { files: - windows:: - "c:\Secret" - acl => win, - depth_search => include_base, - comment => "Secure the secret directory from unauthorized access"; + acl => win, + depth_search => include_base, + comment => "Secure the secret directory from unauthorized access"; } ######################################### - body acl win - { - acl_method => "overwrite"; - aces => { "user:Administrator:rwx" }; + acl_method => "overwrite"; + aces => { "user:Administrator:rwx" }; } ######################################### - body depth_search include_base - { - include_basedir => "true"; + include_basedir => "true"; } diff --git a/examples/action_policy.cf b/examples/action_policy.cf index 422063b190..768833f9bb 100755 --- a/examples/action_policy.cf +++ b/examples/action_policy.cf @@ -1,98 +1,91 @@ #!/var/cfengine/bin/cf-agent -f- # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body file control { - # Include the stdlib for local_dcp, policy, delete_lines - inputs => { "$(sys.libdir)/stdlib.cf" }; + # Include the stdlib for local_dcp, policy, delete_lines + inputs => { "$(sys.libdir)/stdlib.cf" }; } + bundle agent example_action_policy # @brief Example illustrating how action_policy in action bodies control promise actuation and outcomes { files: - - # We make sure there is some files to operate on, so we simply make a copy - # of ourselves - - "$(this.promise_filename).nop" - copy_from => local_dcp( $(this.promise_filename) ); - - "$(this.promise_filename).warn" - copy_from => local_dcp( $(this.promise_filename) ); - - "$(this.promise_filename).fix" - copy_from => local_dcp( $(this.promise_filename) ); - - # We exercise each valid value of action_policy (nop, fix, warn) defining - # classes named for the action_policy - - "$(this.promise_filename).nop" - handle => "delete_lines_action_nop", - edit_line => delete_lines_matching ( ".*" ), - action => policy( "nop" ), - classes => results( "namespace", "MY_files_promise_nop" ); - - "$(this.promise_filename).warn" - handle => "delete_lines_action_warn", - edit_line => delete_lines_matching ( ".*" ), - action => policy( "warn" ), - classes => results( "namespace", "MY_files_promise_warn" ); - - "$(this.promise_filename).fix" - handle => "delete_lines_action_fix", - edit_line => delete_lines_matching ( ".*" ), - action => policy( "fix" ), - classes => results( "namespace", "MY_files_promise_fix" ); + # We make sure there is some files to operate on, so we simply make a copy + # of ourselves + "$(this.promise_filename).nop" + copy_from => local_dcp($(this.promise_filename)); + + "$(this.promise_filename).warn" + copy_from => local_dcp($(this.promise_filename)); + + "$(this.promise_filename).fix" + copy_from => local_dcp($(this.promise_filename)); + + # We exercise each valid value of action_policy (nop, fix, warn) defining + # classes named for the action_policy + "$(this.promise_filename).nop" + handle => "delete_lines_action_nop", + edit_line => delete_lines_matching(".*"), + action => policy("nop"), + classes => results("namespace", "MY_files_promise_nop"); + + "$(this.promise_filename).warn" + handle => "delete_lines_action_warn", + edit_line => delete_lines_matching(".*"), + action => policy("warn"), + classes => results("namespace", "MY_files_promise_warn"); + + "$(this.promise_filename).fix" + handle => "delete_lines_action_fix", + edit_line => delete_lines_matching(".*"), + action => policy("fix"), + classes => results("namespace", "MY_files_promise_fix"); commands: + "/bin/echo Running Command nop" + handle => "command_nop", + action => policy("nop"), + classes => results("namespace", "MY_commands_promise_nop"); - "/bin/echo Running Command nop" - handle => "command_nop", - action => policy( "nop" ), - classes => results( "namespace", "MY_commands_promise_nop" ); + "/bin/echo Running Command warn" + handle => "command_warn", + action => policy("warn"), + classes => results("namespace", "MY_commands_promise_warn"); - "/bin/echo Running Command warn" - handle => "command_warn", - action => policy( "warn" ), - classes => results( "namespace", "MY_commands_promise_warn" ); - - "/bin/echo Running Command fix" - handle => "command_fix", - action => policy( "fix" ), - classes => results( "namespace", "MY_commands_promise_fix" ); + "/bin/echo Running Command fix" + handle => "command_fix", + action => policy("fix"), + classes => results("namespace", "MY_commands_promise_fix"); reports: - - "MY classes:$(const.n)$(const.t)$(with)" - with => join( "$(const.n)$(const.t)", sort( classesmatching( "MY_.*" ), "lex" )); - + "MY classes:$(const.n)$(const.t)$(with)" + with => join( + "$(const.n)$(const.t)", sort(classesmatching("MY_.*"), "lex") + ); } + bundle agent __main__ { methods: - "example_action_policy"; + "example_action_policy"; } + #+end_src ############################################################################### #+begin_src mock_example_output diff --git a/examples/active_directory.cf b/examples/active_directory.cf index f0d1491bdb..d9d9c7e82e 100644 --- a/examples/active_directory.cf +++ b/examples/active_directory.cf @@ -1,23 +1,18 @@ # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################################### # active_directory.cf - Extract Data From Windows Domain Controllers # @@ -27,47 +22,43 @@ # to the resources we want to read. # ######################################################################### - -bundle agent active_directory -{ - vars: - # NOTE: Edit this to your domain, e.g. "corp", may also need more DC's after it - "domain_name" string => "cftesting"; - "user_name" string => "Guest"; - - - # NOTE: We can also extract data from remote Domain Controllers - - dummy.DomainController:: - "domain_controller" string => "localhost"; - - "userlist" slist => ldaplist( - "ldap://$(domain_controller)", - "CN=Users,DC=$(domain_name),DC=com", - "(objectClass=user)", - "sAMAccountName", - "subtree", - "none"); - - classes: - - dummy.DomainController:: - - "gotuser" expression => ldaparray( - "userinfo", - "ldap://$(domain_controller)", - "CN=$(user_name),CN=Users,DC=$(domain_name),DC=com", - "(name=*)", - "subtree", - "none"); - - - reports: - dummy.DomainController:: - "Username is \"$(userlist)\""; - - dummy.gotuser:: - "Got user data; $(userinfo[name]) has logged on $(userinfo[logonCount]) times"; - -} - +bundle agent active_directory +{ + vars: + # NOTE: Edit this to your domain, e.g. "corp", may also need more DC's after it + "domain_name" string => "cftesting"; + "user_name" string => "Guest"; + + # NOTE: We can also extract data from remote Domain Controllers + dummy.DomainController:: + "domain_controller" string => "localhost"; + + "userlist" + slist => ldaplist( + "ldap://$(domain_controller)", + "CN=Users,DC=$(domain_name),DC=com", + "(objectClass=user)", + "sAMAccountName", + "subtree", + "none" + ); + + classes: + dummy.DomainController:: + "gotuser" + expression => ldaparray( + "userinfo", + "ldap://$(domain_controller)", + "CN=$(user_name),CN=Users,DC=$(domain_name),DC=com", + "(name=*)", + "subtree", + "none" + ); + + reports: + dummy.DomainController:: + "Username is \"$(userlist)\""; + + dummy.gotuser:: + "Got user data; $(userinfo[name]) has logged on $(userinfo[logonCount]) times"; +} diff --git a/examples/activedirectory_listusers.cf b/examples/activedirectory_listusers.cf index dc86612f3e..0d7693f692 100644 --- a/examples/activedirectory_listusers.cf +++ b/examples/activedirectory_listusers.cf @@ -1,38 +1,34 @@ # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # List users from Active Directory through LDAP # Note: Anonymous LDAP binding must be allowed, and the Anonymous user # must have read access to CN=Users - bundle agent ldap { vars: - "userlist" slist => ldaplist( - "ldap://cf-win2003", - "CN=Users,DC=domain,DC=cf-win2003", - "(objectClass=user)", - "sAMAccountName", - "subtree", - "none"); + "userlist" + slist => ldaplist( + "ldap://cf-win2003", + "CN=Users,DC=domain,DC=cf-win2003", + "(objectClass=user)", + "sAMAccountName", + "subtree", + "none" + ); + reports: - "Username: \"$(userlist)\""; + "Username: \"$(userlist)\""; } - diff --git a/examples/activedirectory_showuser.cf b/examples/activedirectory_showuser.cf index 77959ddcd6..6fa8c90ac8 100644 --- a/examples/activedirectory_showuser.cf +++ b/examples/activedirectory_showuser.cf @@ -1,41 +1,39 @@ # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # List users from Active Directory through LDAP # Note: Anonymous LDAP binding must be allowed, and the Anonymous user # must have read access to CN=Users and CN=theusername # Run the agent in verbose mode to see the data - bundle agent ldap { classes: - "gotdata" expression => ldaparray( - "myarray", - "ldap://cf-win2003", - "CN=Test Pilot,CN=Users,DC=domain,DC=cf-win2003", - "(name=*)", - "subtree", - "none"); + "gotdata" + expression => ldaparray( + "myarray", + "ldap://cf-win2003", + "CN=Test Pilot,CN=Users,DC=domain,DC=cf-win2003", + "(name=*)", + "subtree", + "none" + ); + reports: gotdata:: "Got user data"; + !gotdata:: "Did not get user data"; } diff --git a/examples/ago.cf b/examples/ago.cf index 07710f9a9f..b37107a6f6 100644 --- a/examples/ago.cf +++ b/examples/ago.cf @@ -1,62 +1,50 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "testbundle" }; + bundlesequence => { "testbundle" }; } bundle agent testbundle { processes: - - ".*" - - process_count => anyprocs, - process_select => proc_finder; + ".*" + process_count => anyprocs, + process_select => proc_finder; reports: - any_procs:: - "Found processes out of range"; } - body process_select proc_finder - { - # Processes started between 100 years + 5.5 hours and 1 minute ago - stime_range => irange(ago(100,0,0,5,30,0),ago(0,0,0,0,1,0)); - process_result => "stime"; + # Processes started between 100 years + 5.5 hours and 1 minute ago + stime_range => irange(ago(100, 0, 0, 5, 30, 0), ago(0, 0, 0, 0, 1, 0)); + process_result => "stime"; } body process_count anyprocs - { - match_range => "0,0"; - out_of_range_define => { "any_procs" }; + match_range => "0,0"; + out_of_range_define => { "any_procs" }; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/app_baseline.cf b/examples/app_baseline.cf index 0afcda60d7..715b79e1ac 100644 --- a/examples/app_baseline.cf +++ b/examples/app_baseline.cf @@ -1,23 +1,18 @@ # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################################### # # app_baseline.cf - Verify Existence of Applications @@ -28,39 +23,46 @@ # and act upon or report any anomalies. # ######################################################################### - - -bundle agent app_baseline -{ - - methods: - windows:: - "any" usebundle => detect_adobereader; - -} - +bundle agent app_baseline +{ + methods: + windows:: + "any" usebundle => detect_adobereader; +} + ### - -bundle agent detect_adobereader -{ - vars: - - windows:: - "value1" string => registryvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\9.0\Installer", "ENU_GUID"); - "value2" string => registryvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\9.0\Installer", "VersionMax"); - "value3" string => registryvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\9.0\Installer", "VersionMin"); - - classes: - - windows:: - "is_correct" and => { - strcmp("$(value1)", "{AC76BA86-7AD7-1033-7B44-A93000000001}"), - strcmp("$(value2)", "90003"), - islessthan("$(value3)", "10001" ) - }; - - reports: - - windows.!is_correct:: - "Adobe Reader is not correctly deployed - got \"$(value1)\", \"$(value2)\", \"$(value3)\""; -} +bundle agent detect_adobereader +{ + vars: + windows:: + "value1" + string => registryvalue( + "HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\9.0\Installer", + "ENU_GUID" + ); + + "value2" + string => registryvalue( + "HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\9.0\Installer", + "VersionMax" + ); + + "value3" + string => registryvalue( + "HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\9.0\Installer", + "VersionMin" + ); + + classes: + windows:: + "is_correct" + and => { + strcmp("$(value1)", "{AC76BA86-7AD7-1033-7B44-A93000000001}"), + strcmp("$(value2)", "90003"), + islessthan("$(value3)", "10001"), + }; + + reports: + windows.!is_correct:: + "Adobe Reader is not correctly deployed - got \"$(value1)\", \"$(value2)\", \"$(value3)\""; +} diff --git a/examples/appgroups.cf b/examples/appgroups.cf index d2b38f9bf2..b6ee02627f 100644 --- a/examples/appgroups.cf +++ b/examples/appgroups.cf @@ -1,36 +1,32 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { run }; + bundlesequence => { run }; } bundle agent run { vars: - # you can also readjson() from a file - "groups" data => parsejson('{ + # you can also readjson() from a file + "groups" + data => parsejson( + '{ "ByGroup": { "App1": @@ -61,73 +57,76 @@ bundle agent run "Host3" ] } -}'); +}' + ); methods: - # use the first one on the client - #"go" usebundle => appgroups($(sys.uqhost), @(groups)); - "go" usebundle => appgroups("Host1", @(groups)); - "go" usebundle => appgroups("Host2", @(groups)); + # use the first one on the client + #"go" usebundle => appgroups($(sys.uqhost), @(groups)); + "go" usebundle => appgroups("Host1", @(groups)); + "go" usebundle => appgroups("Host2", @(groups)); } bundle agent appgroups(name, g) { classes: - # stage (3) now for each APP, define have_app_APP if the host is in APP's host list - "have_app_$(apps)" expression => strcmp($(name), "$(hosts_$(apps))"); + # stage (3) now for each APP, define have_app_APP if the host is in APP's host list + "have_app_$(apps)" expression => strcmp($(name), "$(hosts_$(apps))"); - # stage (4) define the class have_group_GROUP for every GROUP belonging to APP - "have_group_$(groups_$(apps))" expression => "have_app_$(apps)"; + # stage (4) define the class have_group_GROUP for every GROUP belonging to APP + "have_group_$(groups_$(apps))" expression => "have_app_$(apps)"; - # stage (5) define the class have_group if we found any groups - "have_group" not => strcmp("0", length("$(cname)_list")); + # stage (5) define the class have_group if we found any groups + "have_group" not => strcmp("0", length("$(cname)_list")); vars: - # stage (1) start here: we get the apps from the list of "by app" keys - "apps" slist => getindices("g[ByApp]"); - "apps_str" string => format("%S", "apps"); - # stage (2) now for each app, we collect the hosts assigned to it - "hosts_$(apps)" slist => getvalues("g[ByApp][$(apps)]"); - "hosts_$(apps)_str" string => format("%S", "hosts_$(apps)"); + # stage (1) start here: we get the apps from the list of "by app" keys + "apps" slist => getindices("g[ByApp]"); + "apps_str" string => format("%S", "apps"); + + # stage (2) now for each app, we collect the hosts assigned to it + "hosts_$(apps)" slist => getvalues("g[ByApp][$(apps)]"); + "hosts_$(apps)_str" string => format("%S", "hosts_$(apps)"); - # stage (2) now for each app, we collect the groups assigned to it - "groups_$(apps)" slist => getvalues("g[ByGroup][$(apps)]"); - "groups_$(apps)_str" string => format("%S", "groups_$(apps)"); + # stage (2) now for each app, we collect the groups assigned to it + "groups_$(apps)" slist => getvalues("g[ByGroup][$(apps)]"); + "groups_$(apps)_str" string => format("%S", "groups_$(apps)"); - # stage (5) collect the space-separated group names from an intermediate array - "cname" string => canonify($(name)); + # stage (5) collect the space-separated group names from an intermediate array + "cname" string => canonify($(name)); - "$(cname)_grouplist[$(groups_$(apps))]" string => "1", + "$(cname)_grouplist[$(groups_$(apps))]" + string => "1", if => "have_app_$(apps)"; - "$(cname)_grouplist_slist" slist => getvalues("$(cname)_grouplist"); + "$(cname)_grouplist_slist" slist => getvalues("$(cname)_grouplist"); - # get the keys of the array and sort them, then join with spaces - "$(cname)_list" slist => getindices("$(cname)_grouplist"); - "$(cname)_list_sorted" slist => sort("$(cname)_list", "lex"); - "$(cname)_list_spaces" string => join(" ", "$(cname)_list_sorted"); + # get the keys of the array and sort them, then join with spaces + "$(cname)_list" slist => getindices("$(cname)_grouplist"); + "$(cname)_list_sorted" slist => sort("$(cname)_list", "lex"); + "$(cname)_list_spaces" string => join(" ", "$(cname)_list_sorted"); reports: - # stage (1) - "$(this.bundle): looking for $(name)"; + # stage (1) + "$(this.bundle): looking for $(name)"; + "$(this.bundle): apps: $(apps_str)"; - "$(this.bundle): apps: $(apps_str)"; - # stage (2) - "$(this.bundle): hosts for $(apps): $(hosts_$(apps)_str)"; - "$(this.bundle): groups for $(apps): $(groups_$(apps)_str)"; + # stage (2) + "$(this.bundle): hosts for $(apps): $(hosts_$(apps)_str)"; + "$(this.bundle): groups for $(apps): $(groups_$(apps)_str)"; - # stage (3) - "$(this.bundle): $(name) is assigned $(apps)" - if => "have_app_$(apps)"; + # stage (3) + "$(this.bundle): $(name) is assigned $(apps)" if => "have_app_$(apps)"; - # stage (4) - "$(this.bundle): all groups for $(name) = $(groups_$(apps))" - if => "have_group_$(groups_$(apps))"; + # stage (4) + "$(this.bundle): all groups for $(name) = $(groups_$(apps))" + if => "have_group_$(groups_$(apps))"; - # stage (5) + # stage (5) have_group:: "$(this.bundle): space-separated groups for $(name) = $($(cname)_list_spaces)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/arrays.cf b/examples/arrays.cf index 09ce51d9c1..4e9879d3ac 100644 --- a/examples/arrays.cf +++ b/examples/arrays.cf @@ -2,32 +2,29 @@ bundle common g { vars: - - "array[key1]" string => "one"; - "array[key2]" string => "two"; + "array[key1]" string => "one"; + "array[key2]" string => "two"; } bundle agent __main__ { vars: - "thing[1][color]" string => "red"; - "thing[1][name]" string => "one"; - "thing[2][color]" string => "blue"; - "thing[2][name]" string => "two"; - - "_thing_idx" - slist => sort( getindices( thing ), lex ); + "thing[1][color]" string => "red"; + "thing[1][name]" string => "one"; + "thing[2][color]" string => "blue"; + "thing[2][name]" string => "two"; + "_thing_idx" slist => sort(getindices(thing), lex); reports: + "Keys in default:g.array = $(with)" + with => join(", ", sort(getindices("default:g.array"), lex)); - "Keys in default:g.array = $(with)" - with => join( ", ", sort( getindices( "default:g.array" ), lex)); + "Keys of default:main.thing[1] = $(with)" + with => join(", ", sort(getindices("default:main.thing[1]"), lex)); - "Keys of default:main.thing[1] = $(with)" - with => join( ", ", sort( getindices( "default:main.thing[1]" ), lex)); - - "Thing $(thing[$(_thing_idx)][name]) is $(thing[$(_thing_idx)][color])"; + "Thing $(thing[$(_thing_idx)][name]) is $(thing[$(_thing_idx)][color])"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/augment.cf b/examples/augment.cf index 3bedd7fba7..5d00c69353 100644 --- a/examples/augment.cf +++ b/examples/augment.cf @@ -10,19 +10,19 @@ bundle common def "example_augment_list_override" slist => { "defined", "in", "bundle", "common", "def" }; } + bundle agent main { vars: - "def_vars" - slist => variablesmatching("default\:def\..*"); + "def_vars" slist => variablesmatching("default\:def\..*"); reports: "Def var: '$(def_vars)'"; - "def.example_augment_string = '$(def.example_augment_string)'"; "def.example_augment_list_override = '$(def.example_augment_list_override)'"; "def.example_augment_structured_override[key1] = '$(def.example_augment_structured_override[key1])'"; } + #+begin_src example_output #@ ``` #@ R: Def var: 'default:def.example_augment_structured_override' diff --git a/examples/backreferences_files.cf b/examples/backreferences_files.cf index f73b12f020..691a459d8b 100644 --- a/examples/backreferences_files.cf +++ b/examples/backreferences_files.cf @@ -1,74 +1,50 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ###################################################################### # # File editing - back reference # ###################################################################### - - body common control - { - version => "1.2.3"; - bundlesequence => { "example" }; + version => "1.2.3"; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { files: - - # The back reference in a path only applies to the last link - # of the pathname, so the (tmp) gets ignored - - "/tmp/(cf3)_(.*)" - - edit_line => myedit("second $(match.2)"); - + # The back reference in a path only applies to the last link + # of the pathname, so the (tmp) gets ignored + "/tmp/(cf3)_(.*)" edit_line => myedit("second $(match.2)"); # but ... - # "/tmp/cf3_test" # create => "true", # edit_line => myedit("second $(match.1)"); - - } ######################################################## - bundle edit_line myedit(parameter) { vars: - - "edit_variable" string => "private edit variable is $(parameter)"; + "edit_variable" string => "private edit variable is $(parameter)"; insert_lines: - - "$(edit_variable)"; - + "$(edit_variable)"; } - diff --git a/examples/basename.cf b/examples/basename.cf index 23ab6504f9..a31cbc6215 100644 --- a/examples/basename.cf +++ b/examples/basename.cf @@ -4,16 +4,17 @@ bundle agent main # @brief Example illustrating the behavior of basename() { vars: - "basename" -> { "CFE-3196" } - string => basename( $(this.promise_filename) ); + "basename" -> { "CFE-3196" } + string => basename($(this.promise_filename)); - "basename_wo_extension" -> { "CFE-3196" } - string => basename( $(this.promise_filename), ".cf" ); - reports: + "basename_wo_extension" -> { "CFE-3196" } + string => basename($(this.promise_filename), ".cf"); - "basename = '$(basename)'"; - "basename without '.cf' extension = '$(basename_wo_extension)'"; + reports: + "basename = '$(basename)'"; + "basename without '.cf' extension = '$(basename_wo_extension)'"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/bsdflags.cf b/examples/bsdflags.cf index 1119407e17..78a54f3647 100644 --- a/examples/bsdflags.cf +++ b/examples/bsdflags.cf @@ -1,47 +1,34 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { files: - freebsd:: - "/tmp/newfile" - - create => "true", - perms => setbsd; - + create => "true", + perms => setbsd; } - body perms setbsd { - bsdflags => { "+uappnd","+uchg", "+uunlnk", "-nodump" }; + bsdflags => { "+uappnd", "+uchg", "+uunlnk", "-nodump" }; } - diff --git a/examples/buggy/namespaces.cf b/examples/buggy/namespaces.cf index 692b2b0170..d59ff99130 100644 --- a/examples/buggy/namespaces.cf +++ b/examples/buggy/namespaces.cf @@ -1,60 +1,46 @@ - body common control { - bundlesequence => { "main" }; - inputs => { "namespaces/1.cf", "namespaces/2.cf", "namespaces/3.cf" }; + bundlesequence => { "main" }; + inputs => { "namespaces/1.cf", "namespaces/2.cf", "namespaces/3.cf" }; } - bundle agent main { vars: - - "alien_list" slist => { getindices("name1:mymethod.array")}; - - "local_list" slist => { getindices("example.array") }; + "alien_list" slist => { getindices("name1:mymethod.array") }; + "local_list" slist => { getindices("example.array") }; files: - - "/tmp/bla" - + "/tmp/bla" create => "true", perms => zub("700"); - # or perms => default:zub("700"); + # or perms => default:zub("700"); methods: + "namespace demo" usebundle => name1:mymethod("arg1"); + "namespace demo" usebundle => name2:mymethod("arg1", "arg2"); + "namespace demo" usebundle => example; - "namespace demo" usebundle => name1:mymethod("arg1"); - - "namespace demo" usebundle => name2:mymethod("arg1","arg2"); - - "namespace demo" usebundle => example; - # Or "namespace demo" usebundle => default:example; - - "namespace demo" usebundle => test_in_last_file; + # Or "namespace demo" usebundle => default:example; + "namespace demo" usebundle => test_in_last_file; reports: - - "Foreign namespace index list: $(alien_list)"; - "Local index list: $(local_list)"; + "Foreign namespace index list: $(alien_list)"; + "Local index list: $(local_list)"; } - body perms zub(x) { - mode => "$(x)"; + mode => "$(x)"; } - bundle agent example { vars: - - "array[one]" string => "text one"; - "array[two]" string => "text two"; - "array[three]" string => "text three"; + "array[one]" string => "text one"; + "array[two]" string => "text two"; + "array[three]" string => "text three"; reports: - - "TEST OK in no namespace"; + "TEST OK in no namespace"; } diff --git a/examples/buggy/namespaces/1.cf b/examples/buggy/namespaces/1.cf index 33c7b534e4..9113689d36 100644 --- a/examples/buggy/namespaces/1.cf +++ b/examples/buggy/namespaces/1.cf @@ -1,42 +1,35 @@ body file control { - namespace => "name1"; + namespace => "name1"; } - bundle agent mymethod(one) { vars: - - "array[one]" string => "text one"; - "array[two]" string => "text two"; - "array[three]" string => "text three"; + "array[one]" string => "text one"; + "array[two]" string => "text two"; + "array[three]" string => "text three"; files: - - "/tmp/$(one)" - + "/tmp/$(one)" create => "true", edit_line => makefile, perms => name2:settings; reports: - - "test $(one) in $(this.namespace)_$(this.bundle)"; + "test $(one) in $(this.namespace)_$(this.bundle)"; } - bundle edit_line makefile { insert_lines: - - "THIS IS NAME1"; + "THIS IS NAME1"; reports: - "makefile in name 1"; + "makefile in name 1"; } body perms settings { - mode => "600"; + mode => "600"; } diff --git a/examples/buggy/namespaces/2.cf b/examples/buggy/namespaces/2.cf index facaf8aa63..bb4a7b954d 100644 --- a/examples/buggy/namespaces/2.cf +++ b/examples/buggy/namespaces/2.cf @@ -1,38 +1,30 @@ - body file control { - namespace => "name2"; + namespace => "name2"; } - -bundle agent mymethod(one,two) +bundle agent mymethod(one, two) { files: - - "/tmp/$(one)$(two)" - + "/tmp/$(one)$(two)" create => "true", edit_line => makefile, perms => name1:settings; reports: - "test $(one) $(two) in $(this.namespace)_$(this.bundle)"; - + "test $(one) $(two) in $(this.namespace)_$(this.bundle)"; } bundle edit_line makefile { insert_lines: - - "THIS IS NAME2"; + "THIS IS NAME2"; reports: - - "makefile in name 2"; + "makefile in name 2"; } - body perms settings { - mode => "666"; + mode => "666"; } diff --git a/examples/buggy/namespaces/3.cf b/examples/buggy/namespaces/3.cf index 077a92237a..6e662cffb4 100644 --- a/examples/buggy/namespaces/3.cf +++ b/examples/buggy/namespaces/3.cf @@ -1,9 +1,5 @@ - - bundle agent test_in_last_file { reports: - - "Final namespace is the default"; - + "Final namespace is the default"; } diff --git a/examples/bundle_return_values.cf b/examples/bundle_return_values.cf index 4c53048301..72cb84e26d 100644 --- a/examples/bundle_return_values.cf +++ b/examples/bundle_return_values.cf @@ -1,34 +1,23 @@ - body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } - bundle agent example { methods: - - "any" usebundle => child, + "any" + usebundle => child, useresult => "my_return_var"; - reports: - - "My return was: \"$(my_return_var[1])\" and \"$(my_return_var[2])\""; - + "My return was: \"$(my_return_var[1])\" and \"$(my_return_var[2])\""; } bundle agent child { reports: - - # Map these indices into the useresult namespace - - "this is a return value" - bundle_return_value_index => "1"; - - "this is another return value" - bundle_return_value_index => "2"; - + # Map these indices into the useresult namespace + "this is a return value" bundle_return_value_index => "1"; + "this is another return value" bundle_return_value_index => "2"; } diff --git a/examples/bundlesequence.cf b/examples/bundlesequence.cf index ca28033932..76e003baf2 100644 --- a/examples/bundlesequence.cf +++ b/examples/bundlesequence.cf @@ -1,18 +1,17 @@ # Example showing how to override the default bundlesequence body common control { - bundlesequence => { "hello" }; + bundlesequence => { "hello" }; } bundle agent hello # @brief say hello and report my bundle name { reports: - "Hello, $(this.bundle) bundle."; + "Hello, $(this.bundle) bundle."; } #@ The policy promises to report the name of the current bundle, and produces this output: - #+begin_src example_output #@ ``` #@ R: Hello, hello bundle. diff --git a/examples/bundlesmatching.cf b/examples/bundlesmatching.cf index 910f13af5e..5419b2b568 100644 --- a/examples/bundlesmatching.cf +++ b/examples/bundlesmatching.cf @@ -1,76 +1,67 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { mefirst }; + bundlesequence => { mefirst }; } bundle common g { vars: - - # Here we find all bundles in the default namespace whos name starts with - # run. - - "todo" slist => bundlesmatching("default:run.*"); + # Here we find all bundles in the default namespace whos name starts with + # run. + "todo" slist => bundlesmatching("default:run.*"); } bundle agent mefirst { methods: - - # Here, we actuate each of the bundles that were found using - # bundlesmatching in bundle common g. - - "" usebundle => $(g.todo); + # Here, we actuate each of the bundles that were found using + # bundlesmatching in bundle common g. + "" usebundle => $(g.todo); } bundle agent run_deprecated { meta: - # This bundle is tagged with deprecated - "tags" slist => { "deprecated" }; + # This bundle is tagged with deprecated + "tags" slist => { "deprecated" }; } bundle agent run_123_456 { vars: - # Here we find all bundles in our policy. - "bundles" slist => bundlesmatching(".*"); + # Here we find all bundles in our policy. + "bundles" slist => bundlesmatching(".*"); - # Here we find all the bundles that are tagged as deprecated. - "deprecated_bundles" slist => bundlesmatching(".*", "deprecated"); + # Here we find all the bundles that are tagged as deprecated. + "deprecated_bundles" slist => bundlesmatching(".*", "deprecated"); - # Here we find all bundles that match 891 (none will). - "no_bundles" slist => bundlesmatching("891"); + # Here we find all bundles that match 891 (none will). + "no_bundles" slist => bundlesmatching("891"); reports: - # Here we report on our findings: - "bundles = $(bundles)"; - "deprecated bundles = $(deprecated_bundles)"; - "no bundles = $(no_bundles)"; + # Here we report on our findings: + "bundles = $(bundles)"; + "deprecated bundles = $(deprecated_bundles)"; + "no bundles = $(no_bundles)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/bundlestate.cf b/examples/bundlestate.cf index 9efde97e23..ae2871d7f3 100644 --- a/examples/bundlestate.cf +++ b/examples/bundlestate.cf @@ -1,53 +1,47 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { holder, test }; + bundlesequence => { holder, test }; } bundle common holder { classes: - "holderclass" expression => "any"; # will be global - + "holderclass" expression => "any"; # will be global vars: - "s" string => "Hello!"; - "d" data => parsejson('[4,5,6]'); - "list" slist => { "element1", "element2" }; + "s" string => "Hello!"; + "d" data => parsejson('[4,5,6]'); + "list" slist => { "element1", "element2" }; } bundle agent test { vars: - "bundle_state" data => bundlestate("holder"); + "bundle_state" data => bundlestate("holder"); - # all the variables in bundle "holder" defined as of the execution of bundlestate() will be here - "holderstate" string => format("%S", "bundle_state"); + # all the variables in bundle "holder" defined as of the execution of bundlestate() will be here + "holderstate" string => format("%S", "bundle_state"); reports: - "holder vars = $(holderstate)"; + "holder vars = $(holderstate)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/canonify.cf b/examples/canonify.cf index 22166e35d7..166513495e 100644 --- a/examples/canonify.cf +++ b/examples/canonify.cf @@ -1,39 +1,33 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - "component" string => "/var/cfengine/bin/cf-serverd"; - "canon" string => canonify("$(component)"); + "component" string => "/var/cfengine/bin/cf-serverd"; + "canon" string => canonify("$(component)"); reports: - "canonified component == $(canon)"; + "canonified component == $(canon)"; } #+end_src diff --git a/examples/cf-secret.cf b/examples/cf-secret.cf index 0f610c57ce..b7d603ae54 100644 --- a/examples/cf-secret.cf +++ b/examples/cf-secret.cf @@ -1,57 +1,50 @@ # Copyright (C) Cfengine AS - # This file is part of CFEngine 3 - written and maintained by Cfengine AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ############################################################################### #+begin_src cfengine3 bundle agent main { vars: + "private_key" + comment => "The decryption key", + string => "$(this.promise_filename).priv"; - "private_key" - comment => "The decryption key", - string => "$(this.promise_filename).priv"; - - "encrypted_file" string => "$(this.promise_filename).cfcrypt"; + "encrypted_file" string => "$(this.promise_filename).cfcrypt"; - "secret" - comment => "We decrypt the encrypted file directly into a variable.", - string => execresult("$(sys.cf_secret) -d $(private_key) -i $(encrypted_file) -o -", noshell); + "secret" + comment => "We decrypt the encrypted file directly into a variable.", + string => execresult( + "$(sys.cf_secret) -d $(private_key) -i $(encrypted_file) -o -", noshell + ); reports: - "Encrypted file content:" - printfile => cat( $(encrypted_file) ); - - "Decrypted content:$(const.n)$(secret)"; + "Encrypted file content:" printfile => cat($(encrypted_file)); + "Decrypted content:$(const.n)$(secret)"; } 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"; } -#+end_src +#+end_src ############################################################################### #+begin_src static_example_output #@ ``` diff --git a/examples/cf2_integration.cf b/examples/cf2_integration.cf index 2a71a55474..e5ab92a20e 100644 --- a/examples/cf2_integration.cf +++ b/examples/cf2_integration.cf @@ -1,62 +1,44 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # Cfagent 2 can be run as a command within cfengine 3 # so that cfagent 2 AND cfagent 3 can coexist # # It does not matter which versions of the daemons are run # but you must choose version 2 XOR version 3 -# - body common control - { - - # Reads default - # /var/cfengine/inputs/promises.cf - # /var/cfengine/inputs/failsafe.cf - bundlesequence => { "cfengine3", "cfengine2" }; + # Reads default + # /var/cfengine/inputs/promises.cf + # /var/cfengine/inputs/failsafe.cf + bundlesequence => { "cfengine3", "cfengine2" }; } ########################################### - bundle agent cfengine2 - { commands: - - "/var/cfengine/bin/cfagent"; - + "/var/cfengine/bin/cfagent"; } ########################################### - bundle agent cfengine3 - { - - # Stuff + # Stuff commands: - - "/var/cfengine/bin/cf-agent"; + "/var/cfengine/bin/cf-agent"; } diff --git a/examples/cf_version_after.cf b/examples/cf_version_after.cf index 8e007a2100..32c6b78792 100644 --- a/examples/cf_version_after.cf +++ b/examples/cf_version_after.cf @@ -4,9 +4,10 @@ bundle agent __main__ reports: "This will be skipped on older or equal versions" if => cf_version_after("3.15"); - "This will be skipped on newer versions" - unless => cf_version_after("3.15"); + + "This will be skipped on newer versions" unless => cf_version_after("3.15"); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/cf_version_at.cf b/examples/cf_version_at.cf index 74ce09d047..844a9e166a 100644 --- a/examples/cf_version_at.cf +++ b/examples/cf_version_at.cf @@ -2,11 +2,10 @@ bundle agent __main__ { reports: - "This will be skipped if version is not the same" - if => cf_version_at("3"); - "This will be skipped if version is the same" - unless => cf_version_at("3"); + "This will be skipped if version is not the same" if => cf_version_at("3"); + "This will be skipped if version is the same" unless => cf_version_at("3"); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/cf_version_before.cf b/examples/cf_version_before.cf index eb5691a65f..26e37c1fd1 100644 --- a/examples/cf_version_before.cf +++ b/examples/cf_version_before.cf @@ -4,9 +4,11 @@ bundle agent __main__ reports: "This will be skipped on newer or equal versions" if => cf_version_before("3.15"); + "This will be skipped on older versions" unless => cf_version_before("3.15"); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/cf_version_between.cf b/examples/cf_version_between.cf index 5e06afeb14..97a8bc938b 100644 --- a/examples/cf_version_between.cf +++ b/examples/cf_version_between.cf @@ -4,9 +4,11 @@ bundle agent __main__ reports: "This will be skipped on versions outside this inclusive range" if => cf_version_between("3.15", "4"); + "This will be skipped if version is within this inclusive range" unless => cf_version_between("3.15", "4"); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/cf_version_maximum.cf b/examples/cf_version_maximum.cf index 5daf1ec059..6527c788d8 100644 --- a/examples/cf_version_maximum.cf +++ b/examples/cf_version_maximum.cf @@ -2,11 +2,12 @@ bundle agent __main__ { reports: - "This will be skipped on newer versions" - if => cf_version_maximum("3.15"); + "This will be skipped on newer versions" if => cf_version_maximum("3.15"); + "This will be skipped on older or equal versions" unless => cf_version_maximum("3.15"); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/cf_version_minimum.cf b/examples/cf_version_minimum.cf index 429f183c71..46f9a2bff2 100644 --- a/examples/cf_version_minimum.cf +++ b/examples/cf_version_minimum.cf @@ -2,11 +2,12 @@ bundle agent __main__ { reports: - "This will be skipped on older versions" - if => cf_version_minimum("3.15"); + "This will be skipped on older versions" if => cf_version_minimum("3.15"); + "This will be skipped on newer or equal versions" unless => cf_version_minimum("3.15"); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/change_detect.cf b/examples/change_detect.cf index fb1de041c2..ce3d69709e 100644 --- a/examples/change_detect.cf +++ b/examples/change_detect.cf @@ -1,65 +1,48 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Change detect # ######################################################## - #[%+%] - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { files: - - "/home/mark/tmp/web" # Directory to monitor for changes. - - changes => detect_all_change, + "/home/mark/tmp/web" # Directory to monitor for changes. + changes => detect_all_change, depth_search => recurse("inf"); } ######################################################### - body changes detect_all_change - { - report_changes => "all"; - update_hashes => "true"; + report_changes => "all"; + update_hashes => "true"; } ######################################################### - body depth_search recurse(d) - { - depth => "$(d)"; + depth => "$(d)"; } diff --git a/examples/changedbefore.cf b/examples/changedbefore.cf index 11dadc2640..c8be0b5906 100644 --- a/examples/changedbefore.cf +++ b/examples/changedbefore.cf @@ -1,46 +1,31 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################################### - bundle agent example - -{ +{ classes: - - "do_it" and => { changedbefore("/tmp/earlier","/tmp/later") }; + "do_it" and => { changedbefore("/tmp/earlier", "/tmp/later") }; reports: - do_it:: - "Earlier than later!"; - } - diff --git a/examples/chdir.cf b/examples/chdir.cf index 3a31b14335..d836524500 100644 --- a/examples/chdir.cf +++ b/examples/chdir.cf @@ -1,46 +1,33 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################################### - -body contain cd(dir) +body contain cd(dir) { - chdir => "${dir}"; - useshell => "useshell"; + chdir => "${dir}"; + useshell => "useshell"; } -bundle agent example +bundle agent example { commands: - - "/bin/pwd" - contain => cd("/tmp"); + "/bin/pwd" contain => cd("/tmp"); } - diff --git a/examples/class-automatic-canonificiation.cf b/examples/class-automatic-canonificiation.cf index f4cde2cc8c..efcde70c61 100644 --- a/examples/class-automatic-canonificiation.cf +++ b/examples/class-automatic-canonificiation.cf @@ -1,38 +1,32 @@ # This example shows how classes are automatically canonified when they are # defined and that you must explicitly canonify when verifying classes. - #+begin_src cfengine3 bundle agent main { classes: - - "my-illegal-class"; + "my-illegal-class"; reports: - - # We search to see what class was defined: - "$(with)" with => join( " ", classesmatching( "my.illegal.class" ) ); - - # We see that the illegal class is explicitly not defined. - "my-illegal-class is NOT defined (as expected, its invalid)" - unless => "my-illegal-class"; - - # We see the canonified form of the illegal class is defined. - "my_illegal_class is defined" - if => canonify("my-illegal-class"); - - # Note, if takes expressisons, you couldn't do that if it were - # automatically canonified. Here I canonify the string using with, and use - # it as part of the expression which contains an invalid classcharacter, but - # its desireable for constructing expressions. - - "Slice and dice using `with`" - with => canonify( "my-illegal-class" ), - if => "linux|$(with)"; - + # We search to see what class was defined: + "$(with)" with => join(" ", classesmatching("my.illegal.class")); + + # We see that the illegal class is explicitly not defined. + "my-illegal-class is NOT defined (as expected, its invalid)" + unless => "my-illegal-class"; + + # We see the canonified form of the illegal class is defined. + "my_illegal_class is defined" if => canonify("my-illegal-class"); + + # Note, if takes expressisons, you couldn't do that if it were + # automatically canonified. Here I canonify the string using with, and use + # it as part of the expression which contains an invalid classcharacter, but + # its desireable for constructing expressions. + "Slice and dice using `with`" + with => canonify("my-illegal-class"), + if => "linux|$(with)"; } -#+end_src +#+end_src #+begin_src policy_description #@ First we promise to define `my-illegal-class`. When the promise is actuated #@ it is automatically canonified and defined. This automatic canonification is @@ -41,7 +35,6 @@ bundle agent main #@ report shows how `if` takes a class expression, and if you are checking a class #@ that contains invalid characters you must canonify it. #+end_src - #+begin_src example_output #@ ``` #@ R: my_illegal_class diff --git a/examples/classes_context_applies_multiple_promises.cf b/examples/classes_context_applies_multiple_promises.cf index 6f1cbdcad6..cec69d58f3 100644 --- a/examples/classes_context_applies_multiple_promises.cf +++ b/examples/classes_context_applies_multiple_promises.cf @@ -2,14 +2,13 @@ bundle agent __main__ { reports: - "This promise is not restricted."; + "This promise is not restricted."; any:: "Neither is this promise restricted, 'any' is always defined."; linux:: "This promise is restricted to hosts that have the class 'linux' defined."; - "This promise is also restricted to hosts that have the class 'linux' defined."; linux.cfengine_4:: @@ -19,11 +18,12 @@ bundle agent __main__ "This promise will never be actuated."; vars: - "Message" string => "Hello World!"; + "Message" string => "Hello World!"; reports: - "And this promise is again unrestricted"; + "And this promise is again unrestricted"; } + #+end_src #+begin_src example_output #@ ``` diff --git a/examples/classes_global.cf b/examples/classes_global.cf index a1395d4233..b0987f82ed 100644 --- a/examples/classes_global.cf +++ b/examples/classes_global.cf @@ -1,66 +1,48 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "g","tryclasses_1", "tryclasses_2" }; - + bundlesequence => { "g", "tryclasses_1", "tryclasses_2" }; } ################################# - bundle common g { classes: - - "one" expression => "any"; - - "client_network" expression => iprange("128.39.89.0/24"); + "one" expression => "any"; + "client_network" expression => iprange("128.39.89.0/24"); } ################################# - bundle agent tryclasses_1 { classes: - - "two" expression => "any"; + "two" expression => "any"; } ################################# - bundle agent tryclasses_2 { classes: - - "three" expression => "any"; + "three" expression => "any"; reports: - one.three.!two:: - "Success"; } - ################################# diff --git a/examples/classesmatching.cf b/examples/classesmatching.cf index 4f9564f345..2b5b2bc28a 100644 --- a/examples/classesmatching.cf +++ b/examples/classesmatching.cf @@ -1,51 +1,41 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 bundle agent main { classes: - "example_one"; - "example_two" - meta => { "plus", "defined_from=$(this.bundle)" }; - "example_three" - meta => { "plus", "defined_from=$(this.bundle)" }; + "example_one"; + "example_two" meta => { "plus", "defined_from=$(this.bundle)" }; + "example_three" meta => { "plus", "defined_from=$(this.bundle)" }; vars: - "cfengine_classes" - slist => sort( classesmatching("cfengine"), lex); + "cfengine_classes" slist => sort(classesmatching("cfengine"), lex); - "example_with_plus" - slist => sort( classesmatching("example.*", "plus"), lex); + "example_with_plus" + slist => sort(classesmatching("example.*", "plus"), lex); reports: - # you may find this list of all classes interesting but it - # produces different output every time, so it's commented out here - # "All classes = '$(all)'"; - - "Classes matching 'cfengine' = '$(cfengine_classes)'"; + # you may find this list of all classes interesting but it + # produces different output every time, so it's commented out here + # "All classes = '$(all)'"; + "Classes matching 'cfengine' = '$(cfengine_classes)'"; - # this should produce no output - "Classes matching 'example.*' with the 'plus' tag = $(example_with_plus)"; + # this should produce no output + "Classes matching 'example.*' with the 'plus' tag = $(example_with_plus)"; } #+end_src diff --git a/examples/classfiltercsv.cf b/examples/classfiltercsv.cf index 8fc0a90e81..1d1dea832c 100644 --- a/examples/classfiltercsv.cf +++ b/examples/classfiltercsv.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ echo 'ClassExpr,Sort,Token,Value' > /tmp/classfiltercsv.csv @@ -33,29 +27,29 @@ #@ sed -i 's/$/\r/' /tmp/classfiltercsv.csv #@ ``` #+end_src - ############################################################################### - #+begin_src cfengine3 bundle agent example_classfiltercsv { classes: - "example_class1"; - "example_class2"; - "example_class3"; + "example_class1"; + "example_class2"; + "example_class3"; vars: - "data_file" string => "/tmp/classfiltercsv.csv"; - "d" data => classfiltercsv($(data_file), "true", 0, 1); + "data_file" string => "/tmp/classfiltercsv.csv"; + "d" data => classfiltercsv($(data_file), "true", 0, 1); reports: - "Filtered data: $(with)" with => string_mustache("{{%-top-}}", d); + "Filtered data: $(with)" with => string_mustache("{{%-top-}}", d); } + bundle agent __main__ { methods: - "example_classfiltercsv"; + "example_classfiltercsv"; } + #+end_src #+begin_src example_output #@ ``` diff --git a/examples/classfilterdata_array_of_arrays.cf b/examples/classfilterdata_array_of_arrays.cf index 5c0786c313..3a713a8f43 100644 --- a/examples/classfilterdata_array_of_arrays.cf +++ b/examples/classfilterdata_array_of_arrays.cf @@ -2,25 +2,23 @@ bundle agent __main__ { classes: - "role_2"; + "role_2"; vars: - "original" - data => '[ + "original" + data => '[ [ "role_1", "alice", 32 ], [ "!role_1", "bob", 24 ], [ "role_2", "malcom", 27 ] ]'; - "filtered" - data => classfilterdata("original", "array_of_arrays", "0"); + "filtered" data => classfilterdata("original", "array_of_arrays", "0"); reports: - "Filtered data: $(with)" - with => storejson("filtered"); + "Filtered data: $(with)" with => storejson("filtered"); } -#+end_src +#+end_src #+begin_src example_output #@ ``` #@ R: Filtered data: [ diff --git a/examples/classfilterdata_array_of_objects.cf b/examples/classfilterdata_array_of_objects.cf index 6dbd9caebc..35a30b1f1d 100644 --- a/examples/classfilterdata_array_of_objects.cf +++ b/examples/classfilterdata_array_of_objects.cf @@ -2,25 +2,23 @@ bundle agent __main__ { classes: - "role_2"; + "role_2"; vars: - "original" - data => '[ + "original" + data => '[ { "file": "/tmp/foo", "if": "role_1" }, { "file": "/tmp/bar", "if": "role_2" }, { "file": "/tmp/baz", "if": "(role_1|role_2)" } ]'; - "filtered" - data => classfilterdata("original", "array_of_objects", "if"); + "filtered" data => classfilterdata("original", "array_of_objects", "if"); reports: - "Filtered data: $(with)" - with => storejson("filtered"); + "Filtered data: $(with)" with => storejson("filtered"); } -#+end_src +#+end_src #+begin_src example_output #@ ``` #@ R: Filtered data: [ diff --git a/examples/classfilterdata_object_of_arrays.cf b/examples/classfilterdata_object_of_arrays.cf index 725b289cc5..a32fa4a7e6 100644 --- a/examples/classfilterdata_object_of_arrays.cf +++ b/examples/classfilterdata_object_of_arrays.cf @@ -2,25 +2,23 @@ bundle agent __main__ { classes: - "role_2"; + "role_2"; vars: - "original" - data => '{ + "original" + data => '{ "alice": [ "role_1", 32 ], "bob": [ "!role_1", 24 ], "malcom": [ "role_2", 27 ] }'; - "filtered" - data => classfilterdata("original", "object_of_arrays", "0"); + "filtered" data => classfilterdata("original", "object_of_arrays", "0"); reports: - "Filtered data: $(with)" - with => storejson("filtered"); + "Filtered data: $(with)" with => storejson("filtered"); } -#+end_src +#+end_src #+begin_src example_output #@ ``` #@ R: Filtered data: { diff --git a/examples/classfilterdata_object_of_arrays_key_to_obj.cf b/examples/classfilterdata_object_of_arrays_key_to_obj.cf index 23b3f7ac2e..ed476019e6 100644 --- a/examples/classfilterdata_object_of_arrays_key_to_obj.cf +++ b/examples/classfilterdata_object_of_arrays_key_to_obj.cf @@ -2,26 +2,24 @@ bundle agent __main__ { classes: - "role_2"; + "role_2"; vars: - "original" - data => '{ + "original" + data => '{ "role_1" : [ "alice", 32 ], "!role_1" : [ "bob", 24 ], "role_2" : [ "malcom", 27 ] }'; - # Using exogenous key (i.e., the key of the child array within the parent object) - "filtered" - data => classfilterdata("original", "object_of_arrays"); + # Using exogenous key (i.e., the key of the child array within the parent object) + "filtered" data => classfilterdata("original", "object_of_arrays"); reports: - "Filtered data: $(with)" - with => storejson("filtered"); + "Filtered data: $(with)" with => storejson("filtered"); } -#+end_src +#+end_src #+begin_src example_output #@ ``` #@ R: Filtered data: { diff --git a/examples/classfilterdata_object_of_objects.cf b/examples/classfilterdata_object_of_objects.cf index d0ae0db6ea..da963a551f 100644 --- a/examples/classfilterdata_object_of_objects.cf +++ b/examples/classfilterdata_object_of_objects.cf @@ -2,25 +2,23 @@ bundle agent __main__ { classes: - "role_2"; + "role_2"; vars: - "original" - data => '{ + "original" + data => '{ "/tmp/foo": { "if": "role_1" }, "/tmp/bar": { "if": "role_2" }, "/tmp/baz": { "if": "(role_1|role_2)" } }'; - "filtered" - data => classfilterdata("original", "object_of_objects", "if"); + "filtered" data => classfilterdata("original", "object_of_objects", "if"); reports: - "Filtered data: $(with)" - with => storejson("filtered"); + "Filtered data: $(with)" with => storejson("filtered"); } -#+end_src +#+end_src #+begin_src example_output #@ ``` #@ R: Filtered data: { diff --git a/examples/classfilterdata_object_of_objects_key_to_obj.cf b/examples/classfilterdata_object_of_objects_key_to_obj.cf index 3d4b96b2c3..f6a699e091 100644 --- a/examples/classfilterdata_object_of_objects_key_to_obj.cf +++ b/examples/classfilterdata_object_of_objects_key_to_obj.cf @@ -2,26 +2,24 @@ bundle agent __main__ { classes: - "role_2"; + "role_2"; vars: - "original" - data => '{ + "original" + data => '{ "role_1": { "file": "/tmp/foo" }, "role_2": { "file": "/tmp/bar" }, "(role_1|role_2)": { "file": "/tmp/baz" } }'; - # Using exogenous key (i.e., the key of the child object within the parent object) - "filtered" - data => classfilterdata("original", "object_of_objects"); + # Using exogenous key (i.e., the key of the child object within the parent object) + "filtered" data => classfilterdata("original", "object_of_objects"); reports: - "Filtered data: $(with)" - with => storejson("filtered"); + "Filtered data: $(with)" with => storejson("filtered"); } -#+end_src +#+end_src #+begin_src example_output #@ ``` #@ R: Filtered data: { diff --git a/examples/classmatch.cf b/examples/classmatch.cf index 98286e6d64..3296df1c2a 100644 --- a/examples/classmatch.cf +++ b/examples/classmatch.cf @@ -1,47 +1,41 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { classes: + "do_it" and => { classmatch("cfengine_3.*"), "any" }; - "do_it" and => { classmatch("cfengine_3.*"), "any" }; - "have_hardclass_nonesuch" expression => classmatch("nonesuchclass_sodonttryit", hardclass); - reports: + "have_hardclass_nonesuch" + expression => classmatch("nonesuchclass_sodonttryit", hardclass); + reports: do_it:: - "Host matches pattern"; have_hardclass_nonesuch:: - "Host has that really weird hardclass"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/classvar_convergence.cf b/examples/classvar_convergence.cf index a63d3a88b6..b064f8a025 100644 --- a/examples/classvar_convergence.cf +++ b/examples/classvar_convergence.cf @@ -1,61 +1,43 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "tryclasses_1" }; + bundlesequence => { "tryclasses_1" }; } ################################# - bundle agent tryclasses_1 { vars: - - "x" string => "one"; - - "y" slist => { "linux", "Friday" }; + "x" string => "one"; + "y" slist => { "linux", "Friday" }; classes: - - "three" and => { "$(x)", "two" }; - - "four" or => { @(y) }; - - "one" expression => "any"; - "two" expression => "any"; + "three" and => { "$(x)", "two" }; + "four" or => { @(y) }; + "one" expression => "any"; + "two" expression => "any"; reports: - three:: - "Evaluated true"; four:: - "List substitution works"; - } - ################################# diff --git a/examples/commands.cf b/examples/commands.cf index d5671945de..c681a6c269 100644 --- a/examples/commands.cf +++ b/examples/commands.cf @@ -1,47 +1,31 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "my_commands" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "my_commands" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } - bundle agent my_commands { commands: - Sunday.Hr04.Min05_10.myhost:: - "/usr/bin/update_db"; any:: - - "/etc/mysql/start" - - contain => setuid("mysql"); - + "/etc/mysql/start" contain => setuid("mysql"); } - - diff --git a/examples/compare.cf b/examples/compare.cf index a6f624d1c5..dbf8d4d541 100644 --- a/examples/compare.cf +++ b/examples/compare.cf @@ -1,56 +1,40 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # Testing some variable/class definitions - note scope # # Use browser -f promise_output_agent.html to view -# - body common control - { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } ########################################################### - bundle agent test - { classes: - - "ok" expression => isgreaterthan("1","0"); + "ok" expression => isgreaterthan("1", "0"); reports: - ok:: - "Assertion is true"; !ok:: - "Assertion is false"; - } #+begin_src example_output diff --git a/examples/complicated_cpu_bound_benchmark.cf b/examples/complicated_cpu_bound_benchmark.cf index 222f2dc103..a4b7995f27 100644 --- a/examples/complicated_cpu_bound_benchmark.cf +++ b/examples/complicated_cpu_bound_benchmark.cf @@ -1,1293 +1,1201 @@ body common control { - bundlesequence => { "benchmark" }; + bundlesequence => { "benchmark" }; } bundle agent benchmark { vars: # Determines how many times each example is run - "n" int => "10"; + "n" int => "10"; # Range: 1, 2, 3, ..., n - "i" slist => { expandrange("[1-$(n)]", "1") }; + "i" slist => { expandrange("[1-$(n)]", "1") }; methods: - "accumulated" - usebundle => accumulated_bench("$(i)"); - "ago" - usebundle => ago_bench("$(i)"); - "and" - usebundle => and_bench("$(i)"); - "basename" - usebundle => basename_bench("$(i)"); - "bundlesmatching" - usebundle => bundlesmatching_bench("$(i)"); - "bundlestate" - usebundle => bundlestate_bench("$(i)"); - "callstack_callers" - usebundle => callstack_callers_bench("$(i)"); - "callstack_promisers" - usebundle => callstack_promisers_bench("$(i)"); - "canonify" - usebundle => canonify_bench("$(i)"); - "canonifyuniquely" - usebundle => canonifyuniquely_bench("$(i)"); - "cf_version_after" - usebundle => cf_version_after_bench("$(i)"); - "cf_version_at" - usebundle => cf_version_at_bench("$(i)"); - "cf_version_before" - usebundle => cf_version_before_bench("$(i)"); - "cf_version_between" - usebundle => cf_version_between_bench("$(i)"); - "cf_version_maximum" - usebundle => cf_version_maximum_bench("$(i)"); - "cf_version_minimum" - usebundle => cf_version_minimum_bench("$(i)"); - "classesmatching" - usebundle => classesmatching_bench("$(i)"); - "classify" - usebundle => classify_bench("$(i)"); - "classmatch" - usebundle => classmatch_bench("$(i)"); - "concat" - usebundle => concat_bench("$(i)"); - "countclassesmatching" - usebundle => countclassesmatching_bench("$(i)"); - "data_expand" - usebundle => data_expand_bench("$(i)"); - "data_regextract" - usebundle => data_regextract_bench("$(i)"); - "difference" - usebundle => difference_bench("$(i)"); - "dirname" - usebundle => dirname_bench("$(i)"); - "escape" - usebundle => escape_bench("$(i)"); - "eval" - usebundle => eval_bench("$(i)"); - "every" - usebundle => every_bench("$(i)"); - "expandrange" - usebundle => expandrange_bench("$(i)"); - "filter" - usebundle => filter_bench("$(i)"); - "format" - usebundle => format_bench("$(i)"); - "getclassmetatags" - usebundle => getclassmetatags_bench("$(i)"); - "getindices" - usebundle => getindices_bench("$(i)"); - "getvalues" - usebundle => getvalues_bench("$(i)"); - "getvariablemetatags" - usebundle => getvariablemetatags_bench("$(i)"); - "grep" - usebundle => grep_bench("$(i)"); - "hash" - usebundle => hash_bench("$(i)"); - "hash_to_int" - usebundle => hash_to_int_bench("$(i)"); - "ifelse" - usebundle => ifelse_bench("$(i)"); - "intersection" - usebundle => intersection_bench("$(i)"); - "isgreaterthan" - usebundle => isgreaterthan_bench("$(i)"); - "islessthan" - usebundle => islessthan_bench("$(i)"); - "isvariable" - usebundle => isvariable_bench("$(i)"); - "join" - usebundle => join_bench("$(i)"); - "laterthan" - usebundle => laterthan_bench("$(i)"); - "length" - usebundle => length_bench("$(i)"); - "maparray" - usebundle => maparray_bench("$(i)"); - "mapdata" - usebundle => mapdata_bench("$(i)"); - "maplist" - usebundle => maplist_bench("$(i)"); - "max" - usebundle => max_bench("$(i)"); - "mean" - usebundle => mean_bench("$(i)"); - "mergedata" - usebundle => mergedata_bench("$(i)"); - "min" - usebundle => min_bench("$(i)"); - "none" - usebundle => none_bench("$(i)"); - "not" - usebundle => not_bench("$(i)"); - "now" - usebundle => now_bench("$(i)"); - "nth" - usebundle => nth_bench("$(i)"); - "on" - usebundle => on_bench("$(i)"); - "or" - usebundle => or_bench("$(i)"); - "parseintarray" - usebundle => parseintarray_bench("$(i)"); - "parsejson" - usebundle => parsejson_bench("$(i)"); - "parserealarray" - usebundle => parserealarray_bench("$(i)"); - "parsestringarray" - usebundle => parsestringarray_bench("$(i)"); - "parsestringarrayidx" - usebundle => parsestringarrayidx_bench("$(i)"); - "product" - usebundle => product_bench("$(i)"); - "random" - usebundle => randomint_bench("$(i)"); - "regarray" - usebundle => regarray_bench("$(i)"); - "regcmp" - usebundle => regcmp_bench("$(i)"); - "regex_replace" - usebundle => regex_replace_bench("$(i)"); - "regextract" - usebundle => regextract_bench("$(i)"); - "reglist" - usebundle => reglist_bench("$(i)"); - "reverse" - usebundle => reverse_bench("$(i)"); - "shuffle" - usebundle => shuffle_bench("$(i)"); - "some" - usebundle => some_bench("$(i)"); - "sort" - usebundle => sort_bench("$(i)"); - "splitstring" - usebundle => splitstring_bench("$(i)"); - "storejson" - usebundle => storejson_bench("$(i)"); - "strcmp" - usebundle => strcmp_bench("$(i)"); - "strftime" - usebundle => strftime_bench("$(i)"); - "string_downcase" - usebundle => string_downcase_bench("$(i)"); - "string_head" - usebundle => string_head_bench("$(i)"); - "string_length" - usebundle => string_length_bench("$(i)"); - "string_mustache" - usebundle => string_mustache_bench("$(i)"); - "string_replace" - usebundle => string_replace_bench("$(i)"); - "string_reverse" - usebundle => string_reverse_bench("$(i)"); - "string_split" - usebundle => string_split_bench("$(i)"); - "string_tail" - usebundle => string_tail_bench("$(i)"); - "string_upcase" - usebundle => string_upcase_bench("$(i)"); - "sublist" - usebundle => sublist_bench("$(i)"); - "sum" - usebundle => sum_bench("$(i)"); - "translatepath" - usebundle => translatepath_bench("$(i)"); - "unique" - usebundle => unique_bench("$(i)"); - "validdata" - usebundle => validdata_bench("$(i)"); - "validjson" - usebundle => validjson_bench("$(i)"); - "variablesmatching" - usebundle => variablesmatching_bench("$(i)"); - "variablesmatching_as_data" - usebundle => variablesmatching_as_data_bench("$(i)"); - "variance" - usebundle => variance_bench("$(i)"); - "done" - usebundle => print_benchmark_done_msg(); + "accumulated" usebundle => accumulated_bench("$(i)"); + "ago" usebundle => ago_bench("$(i)"); + "and" usebundle => and_bench("$(i)"); + "basename" usebundle => basename_bench("$(i)"); + "bundlesmatching" usebundle => bundlesmatching_bench("$(i)"); + "bundlestate" usebundle => bundlestate_bench("$(i)"); + "callstack_callers" usebundle => callstack_callers_bench("$(i)"); + "callstack_promisers" usebundle => callstack_promisers_bench("$(i)"); + "canonify" usebundle => canonify_bench("$(i)"); + "canonifyuniquely" usebundle => canonifyuniquely_bench("$(i)"); + "cf_version_after" usebundle => cf_version_after_bench("$(i)"); + "cf_version_at" usebundle => cf_version_at_bench("$(i)"); + "cf_version_before" usebundle => cf_version_before_bench("$(i)"); + "cf_version_between" usebundle => cf_version_between_bench("$(i)"); + "cf_version_maximum" usebundle => cf_version_maximum_bench("$(i)"); + "cf_version_minimum" usebundle => cf_version_minimum_bench("$(i)"); + "classesmatching" usebundle => classesmatching_bench("$(i)"); + "classify" usebundle => classify_bench("$(i)"); + "classmatch" usebundle => classmatch_bench("$(i)"); + "concat" usebundle => concat_bench("$(i)"); + "countclassesmatching" usebundle => countclassesmatching_bench("$(i)"); + "data_expand" usebundle => data_expand_bench("$(i)"); + "data_regextract" usebundle => data_regextract_bench("$(i)"); + "difference" usebundle => difference_bench("$(i)"); + "dirname" usebundle => dirname_bench("$(i)"); + "escape" usebundle => escape_bench("$(i)"); + "eval" usebundle => eval_bench("$(i)"); + "every" usebundle => every_bench("$(i)"); + "expandrange" usebundle => expandrange_bench("$(i)"); + "filter" usebundle => filter_bench("$(i)"); + "format" usebundle => format_bench("$(i)"); + "getclassmetatags" usebundle => getclassmetatags_bench("$(i)"); + "getindices" usebundle => getindices_bench("$(i)"); + "getvalues" usebundle => getvalues_bench("$(i)"); + "getvariablemetatags" usebundle => getvariablemetatags_bench("$(i)"); + "grep" usebundle => grep_bench("$(i)"); + "hash" usebundle => hash_bench("$(i)"); + "hash_to_int" usebundle => hash_to_int_bench("$(i)"); + "ifelse" usebundle => ifelse_bench("$(i)"); + "intersection" usebundle => intersection_bench("$(i)"); + "isgreaterthan" usebundle => isgreaterthan_bench("$(i)"); + "islessthan" usebundle => islessthan_bench("$(i)"); + "isvariable" usebundle => isvariable_bench("$(i)"); + "join" usebundle => join_bench("$(i)"); + "laterthan" usebundle => laterthan_bench("$(i)"); + "length" usebundle => length_bench("$(i)"); + "maparray" usebundle => maparray_bench("$(i)"); + "mapdata" usebundle => mapdata_bench("$(i)"); + "maplist" usebundle => maplist_bench("$(i)"); + "max" usebundle => max_bench("$(i)"); + "mean" usebundle => mean_bench("$(i)"); + "mergedata" usebundle => mergedata_bench("$(i)"); + "min" usebundle => min_bench("$(i)"); + "none" usebundle => none_bench("$(i)"); + "not" usebundle => not_bench("$(i)"); + "now" usebundle => now_bench("$(i)"); + "nth" usebundle => nth_bench("$(i)"); + "on" usebundle => on_bench("$(i)"); + "or" usebundle => or_bench("$(i)"); + "parseintarray" usebundle => parseintarray_bench("$(i)"); + "parsejson" usebundle => parsejson_bench("$(i)"); + "parserealarray" usebundle => parserealarray_bench("$(i)"); + "parsestringarray" usebundle => parsestringarray_bench("$(i)"); + "parsestringarrayidx" usebundle => parsestringarrayidx_bench("$(i)"); + "product" usebundle => product_bench("$(i)"); + "random" usebundle => randomint_bench("$(i)"); + "regarray" usebundle => regarray_bench("$(i)"); + "regcmp" usebundle => regcmp_bench("$(i)"); + "regex_replace" usebundle => regex_replace_bench("$(i)"); + "regextract" usebundle => regextract_bench("$(i)"); + "reglist" usebundle => reglist_bench("$(i)"); + "reverse" usebundle => reverse_bench("$(i)"); + "shuffle" usebundle => shuffle_bench("$(i)"); + "some" usebundle => some_bench("$(i)"); + "sort" usebundle => sort_bench("$(i)"); + "splitstring" usebundle => splitstring_bench("$(i)"); + "storejson" usebundle => storejson_bench("$(i)"); + "strcmp" usebundle => strcmp_bench("$(i)"); + "strftime" usebundle => strftime_bench("$(i)"); + "string_downcase" usebundle => string_downcase_bench("$(i)"); + "string_head" usebundle => string_head_bench("$(i)"); + "string_length" usebundle => string_length_bench("$(i)"); + "string_mustache" usebundle => string_mustache_bench("$(i)"); + "string_replace" usebundle => string_replace_bench("$(i)"); + "string_reverse" usebundle => string_reverse_bench("$(i)"); + "string_split" usebundle => string_split_bench("$(i)"); + "string_tail" usebundle => string_tail_bench("$(i)"); + "string_upcase" usebundle => string_upcase_bench("$(i)"); + "sublist" usebundle => sublist_bench("$(i)"); + "sum" usebundle => sum_bench("$(i)"); + "translatepath" usebundle => translatepath_bench("$(i)"); + "unique" usebundle => unique_bench("$(i)"); + "validdata" usebundle => validdata_bench("$(i)"); + "validjson" usebundle => validjson_bench("$(i)"); + "variablesmatching" usebundle => variablesmatching_bench("$(i)"); + + "variablesmatching_as_data" + usebundle => variablesmatching_as_data_bench("$(i)"); + + "variance" usebundle => variance_bench("$(i)"); + "done" usebundle => print_benchmark_done_msg(); } bundle agent accumulated_bench(i) { vars: - "test" - int => accumulated("$(i)", "$(i)", "$(i)", "$(i)", "$(i)", "$(i)"); + "test" int => accumulated("$(i)", "$(i)", "$(i)", "$(i)", "$(i)", "$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent ago_bench(i) { vars: - "test" - int => ago("$(i)", "$(i)", "$(i)", "$(i)", "$(i)", "$(i)"); + "test" int => ago("$(i)", "$(i)", "$(i)", "$(i)", "$(i)", "$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent and_bench(i) { classes: - "test_1" - expression => and("any_$(i)", "any_$(i)"); - "test_2" - expression => and("any_$(i)", "!any_$(i)"); - "test_3" - expression => and("!any_$(i)", "any_$(i)"); - "test_4" - expression => and("!any_$(i)", "!any_$(i)"); + "test_1" expression => and("any_$(i)", "any_$(i)"); + "test_2" expression => and("any_$(i)", "!any_$(i)"); + "test_3" expression => and("!any_$(i)", "any_$(i)"); + "test_4" expression => and("!any_$(i)", "!any_$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent basename_bench(i) { vars: - "test_1" - string => basename("/tmp/test_$(i).txt"); - "test_2" - string => basename("/tmp/test_$(i).txt", ".txt"); + "test_1" string => basename("/tmp/test_$(i).txt"); + "test_2" string => basename("/tmp/test_$(i).txt", ".txt"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent bundlesmatching_bench(i) { vars: - "test" - slist => bundlesmatching(".*"); + "test" slist => bundlesmatching(".*"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent bundlestate_bench(i) { vars: - "test" - data => bundlestate("benchmark"); + "test" data => bundlestate("benchmark"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent callstack_callers_bench(i) { vars: - "test" - data => callstack_callers(); + "test" data => callstack_callers(); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent callstack_promisers_bench(i) { vars: - "test" - slist => callstack_promisers(); + "test" slist => callstack_promisers(); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent canonify_bench(i) { vars: - "test" - string => canonify("/home/root/test-$(i).txt"); + "test" string => canonify("/home/root/test-$(i).txt"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent canonifyuniquely_bench(i) { vars: - "test" - string => canonifyuniquely("/home/root/test-$(i).txt"); + "test" string => canonifyuniquely("/home/root/test-$(i).txt"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent cf_version_after_bench(i) { classes: - "test" - expression => cf_version_after("3.$(i)"); + "test" expression => cf_version_after("3.$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent cf_version_at_bench(i) { classes: - "test" - expression => cf_version_at("3.$(i)"); + "test" expression => cf_version_at("3.$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent cf_version_before_bench(i) { classes: - "test" - expression => cf_version_before("3.$(i)"); + "test" expression => cf_version_before("3.$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent cf_version_between_bench(i) { classes: - "test" - expression => cf_version_between("3.$(i)", "4"); + "test" expression => cf_version_between("3.$(i)", "4"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent cf_version_maximum_bench(i) { classes: - "test" - expression => cf_version_maximum("3.$(i)"); + "test" expression => cf_version_maximum("3.$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent cf_version_minimum_bench(i) { classes: - "test" - expression => cf_version_minimum("3.$(i)"); + "test" expression => cf_version_minimum("3.$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent classesmatching_bench(i) { vars: - "test" - slist => classesmatching(".*$(i).*"); + "test" slist => classesmatching(".*$(i).*"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent classify_bench(i) { classes: - "test" - expression => classify("/home/root/test-$(i).txt"); + "test" expression => classify("/home/root/test-$(i).txt"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent classmatch_bench(i) { classes: - "test" - expression => classmatch(".*$(i).*", "hardclass"); + "test" expression => classmatch(".*$(i).*", "hardclass"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent concat_bench(i) { vars: - "test" - string => concat("file", "_$(i)", ".txt"); + "test" string => concat("file", "_$(i)", ".txt"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent countclassesmatching_bench(i) { vars: - "test" - int => countclassesmatching(".*$(i).*"); + "test" int => countclassesmatching(".*$(i).*"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent data_expand_bench(i) { vars: - "json" - data => '{ "i": $(i) }'; - "expanded" - data => data_expand("json"); + "json" data => '{ "i": $(i) }'; + "expanded" data => data_expand("json"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent data_regextract_bench(i) { vars: - "parsed" - data => data_regextract("^(?...)(...)(..)-(?...)-(..).*", - "abcdef12-345-$(i)andsoon"); + "parsed" + data => data_regextract( + "^(?...)(...)(..)-(?...)-(..).*", + "abcdef12-345-$(i)andsoon" + ); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent difference_bench(i) { vars: - "a" - slist => { "a", "b", "c", "d", "e", "f", "$(i)" }; - "b" - slist => { "a", "c", "e", "g", "i", "k" }; - "diff" - slist => difference(a, b); + "a" slist => { "a", "b", "c", "d", "e", "f", "$(i)" }; + "b" slist => { "a", "c", "e", "g", "i", "k" }; + "diff" slist => difference(a, b); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent dirname_bench(i) { vars: - "dir" - string => dirname("/dir/dir_$(i)/file"); + "dir" string => dirname("/dir/dir_$(i)/file"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent escape_bench(i) { vars: - "node" - string => format("%d", eval("($(i) - 1) % 256")); - "ip" - string => "192.168.1.$(node)"; - "escaped" - string => escape("$(ip)"); + "node" string => format("%d", eval("($(i) - 1) % 256")); + "ip" string => "192.168.1.$(node)"; + "escaped" string => escape("$(ip)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent eval_bench(i) { vars: - "hyp" - string => eval("sqrt( ( ($(i) * $(i)) + ($(i) * $(i)) ) )", "math", "infix"); - "same" - string => eval("$(i) == sqrt($(i) * $(i))", "class", "infix"); + "hyp" + string => eval( + "sqrt( ( ($(i) * $(i)) + ($(i) * $(i)) ) )", "math", "infix" + ); + + "same" string => eval("$(i) == sqrt($(i) * $(i))", "class", "infix"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent every_bench(i) { vars: - "test" - slist => { "/var/cfengine/bin/cf-agent", "/var/cfengine/bin/cf-execd", "/var/cfengine/bin/rpmvercmp", "/var/cfengine/bin/cf-$(i)" }; + "test" + slist => { + "/var/cfengine/bin/cf-agent", + "/var/cfengine/bin/cf-execd", + "/var/cfengine/bin/rpmvercmp", + "/var/cfengine/bin/cf-$(i)", + }; + classes: - "yes" - expression => every("/var/cfengine/bin/.*", test); - "no" - expression => every("/var/cfengine/bin/cf-.*", test); + "yes" expression => every("/var/cfengine/bin/.*", test); + "no" expression => every("/var/cfengine/bin/cf-.*", test); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent expandrange_bench(i) { vars: - "range" - slist=> { expandrange("[0-$(i)]", "1") }; + "range" slist => { expandrange("[0-$(i)]", "1") }; + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent filter_bench(i) { vars: - "natural" - slist => { expandrange("[0-$(i)]", "1") }; - "odd" - slist => filter("[0-9]*[02468]", natural, "true", "false", "inf"); + "natural" slist => { expandrange("[0-$(i)]", "1") }; + "odd" slist => filter("[0-9]*[02468]", natural, "true", "false", "inf"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent format_bench(i) { vars: - "formatted" - string => format("num: %s", "$(i)"); + "formatted" string => format("num: %s", "$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent getclassmetatags_bench(i) { classes: - "myclass" - expression => "any", - meta => { "tag_$(i)" }; + "myclass" + expression => "any", + meta => { "tag_$(i)" }; + vars: - "metatags" - slist => getclassmetatags("myclass"); + "metatags" slist => getclassmetatags("myclass"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent getindices_bench(i) { vars: - "test[i$(i)]" - string => "v$(i)"; - "indices" - slist => getindices(test); + "test[i$(i)]" string => "v$(i)"; + "indices" slist => getindices(test); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent getvalues_bench(i) { vars: - "test[i$(i)]" - string => "v$(i)"; - "values" - slist => getvalues(test); + "test[i$(i)]" string => "v$(i)"; + "values" slist => getvalues(test); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent getvariablemetatags_bench(i) { vars: - "myvar" - string => "hello", - meta => { "tag_$(i)" }; - "metatags" - slist => getvariablemetatags(myvar); + "myvar" + string => "hello", + meta => { "tag_$(i)" }; + + "metatags" slist => getvariablemetatags(myvar); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent grep_bench(i) { vars: - "mylist" - slist => { "One", "Two", "Three", "Four", "Five", "T$(i)" }; - "tlist" - slist => grep("T.*", mylist); + "mylist" slist => { "One", "Two", "Three", "Four", "Five", "T$(i)" }; + "tlist" slist => grep("T.*", mylist); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent hash_bench(i) { vars: - "md5" string => hash("Cfengine $(i) is not cryptic","md5"); - "sha256" string => hash("Cfengine $(i) is not cryptic","sha256"); - "sha384" string => hash("Cfengine $(i) is not cryptic","sha384"); - "sha512" string => hash("Cfengine $(i) is not cryptic","sha512"); + "md5" string => hash("Cfengine $(i) is not cryptic", "md5"); + "sha256" string => hash("Cfengine $(i) is not cryptic", "sha256"); + "sha384" string => hash("Cfengine $(i) is not cryptic", "sha384"); + "sha512" string => hash("Cfengine $(i) is not cryptic", "sha512"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent hash_to_int_bench(i) { vars: - "a" int => hash_to_int(0, "$(i)", "hello"); - "b" int => hash_to_int(0, "$(i)", "world"); - "c" int => hash_to_int(0, "$(i)", "$(sys.key_digest)"); - "d" int => hash_to_int(0, "$(i)", "$(sys.policy_hub)"); + "a" int => hash_to_int(0, "$(i)", "hello"); + "b" int => hash_to_int(0, "$(i)", "world"); + "c" int => hash_to_int(0, "$(i)", "$(sys.key_digest)"); + "d" int => hash_to_int(0, "$(i)", "$(sys.policy_hub)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent ifelse_bench(i) { vars: - "outcome" - string => ifelse(regcmp("[0-9]*[02468]", "$(i)"), "is odd", - regcmp("[0-9]", "$(i)"), "is less than 10", - "is even"); + "outcome" + string => ifelse( + regcmp("[0-9]*[02468]", "$(i)"), + "is odd", + regcmp("[0-9]", "$(i)"), + "is less than 10", + "is even" + ); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent intersection_bench(i) { vars: - "a" - slist => { "a", "b", "c", "d", "e", "f", "$(i)" }; - "b" - slist => { "a", "c", "e", "g", "i", "k", "$(i)" }; - "inter" - slist => intersection(a, b); + "a" slist => { "a", "b", "c", "d", "e", "f", "$(i)" }; + "b" slist => { "a", "c", "e", "g", "i", "k", "$(i)" }; + "inter" slist => intersection(a, b); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent isgreaterthan_bench(i) { classes: - "indeed" - expression => isgreaterthan("5", "$(i)"); + "indeed" expression => isgreaterthan("5", "$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent islessthan_bench(i) { classes: - "indeed" - expression => islessthan("5", "$(i)"); + "indeed" expression => islessthan("5", "$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent isvariable_bench(i) { vars: - "defined_$(i)" - string => "this var is defined"; + "defined_$(i)" string => "this var is defined"; + classes: - "test_1" - expression => isvariable("defined_$(i)"); - "test_2" - expression => isvariable("undefined_$(i)"); + "test_1" expression => isvariable("defined_$(i)"); + "test_2" expression => isvariable("undefined_$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent join_bench(i) { vars: - "list" - slist => { "a", "b", "c", "d", "e", "$(i)" }; - "joined_list" - string => join(", ", list); - "dat" - data => '[ "a", "b", "c", "d", "e", "$(i)" ]'; - "joined_data" - string => join("->", dat); + "list" slist => { "a", "b", "c", "d", "e", "$(i)" }; + "joined_list" string => join(", ", list); + "dat" data => '[ "a", "b", "c", "d", "e", "$(i)" ]'; + "joined_data" string => join("->", dat); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent laterthan_bench(i) { classes: - "test" - expression => laterthan("$(i)", "$(i)", "$(i)", "$(i)", "$(i)", "$(i)"); + "test" + expression => laterthan("$(i)", "$(i)", "$(i)", "$(i)", "$(i)", "$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent length_bench(i) { vars: - "list" - slist => { expandrange("[0-$(i)]", "1") }; - "len" - int => length(list); + "list" slist => { expandrange("[0-$(i)]", "1") }; + "len" int => length(list); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent maparray_bench(i) { vars: - "arr[0]" - string => "a"; - "arr[1]" - string => "b"; - "arr[2]" - string => "c"; - "arr[3]" - string => "d"; - "arr[4]" - string => "e"; - "arr[5]" - string => "$(i)"; - "mapped" - slist => maparray("key=$(this.k), val=$(this.v)", arr); + "arr[0]" string => "a"; + "arr[1]" string => "b"; + "arr[2]" string => "c"; + "arr[3]" string => "d"; + "arr[4]" string => "e"; + "arr[5]" string => "$(i)"; + "mapped" slist => maparray("key=$(this.k), val=$(this.v)", arr); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent mapdata_bench(i) { vars: - "dat" - data => '{ "name": "alice", "age": $(i) }'; - "map_json" - data => mapdata("json", '{ "key": "$(this.k)", "value": "$(this.v)" }', dat); + "dat" data => '{ "name": "alice", "age": $(i) }'; + + "map_json" + data => mapdata( + "json", '{ "key": "$(this.k)", "value": "$(this.v)" }', dat + ); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent maplist_bench(i) { vars: - "list" - slist => { "a", "b", "c", "d", "e", "$(i)" }; - "mapped" - slist => maplist("Element: $(this)", list); + "list" slist => { "a", "b", "c", "d", "e", "$(i)" }; + "mapped" slist => maplist("Element: $(this)", list); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent max_bench(i) { vars: - "alpha" - slist => { "a", "c", "b", "d", "f", "$(i)" }; - "numer" - ilist => { 1, 3, 2, 4, 6, "$(i)" }; - "alpha_max" - string => max(alpha, "lex"); - "numer_max" - string => max(numer, "int"); + "alpha" slist => { "a", "c", "b", "d", "f", "$(i)" }; + "numer" ilist => { 1, 3, 2, 4, 6, "$(i)" }; + "alpha_max" string => max(alpha, "lex"); + "numer_max" string => max(numer, "int"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent mean_bench(i) { vars: - "list" - slist => { "a", "1", "b", "2", "f", "$(i)" }; - "mean" - real => mean(list); + "list" slist => { "a", "1", "b", "2", "f", "$(i)" }; + "mean" real => mean(list); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent mergedata_bench(i) { vars: - "d1" - data => '{ "name": "alice" }'; - "d2" - data => '{ "age": $(i) }'; - "data" - data => mergedata(d1, d2); + "d1" data => '{ "name": "alice" }'; + "d2" data => '{ "age": $(i) }'; + "data" data => mergedata(d1, d2); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent min_bench(i) { vars: - "alpha" - slist => { "a", "c", "b", "d", "f", "$(i)" }; - "numer" - ilist => { 1, 3, 2, 4, 6, "$(i)" }; - "alpha_min" - string => min(alpha, "lex"); - "numer_min" - string => min(numer, "int"); + "alpha" slist => { "a", "c", "b", "d", "f", "$(i)" }; + "numer" ilist => { 1, 3, 2, 4, 6, "$(i)" }; + "alpha_min" string => min(alpha, "lex"); + "numer_min" string => min(numer, "int"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent none_bench(i) { vars: - "list" - slist => { "a", "b", "c", "$(i)" }; + "list" slist => { "a", "b", "c", "$(i)" }; + classes: - "test_2" - expression => none("[0-9]", list); + "test_2" expression => none("[0-9]", list); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent not_bench(i) { classes: - "myclass_$(i)" - expression => "any"; - "yes" - expression => not("!myclass_$(i)"); - "no" - expression => not("myclass_$(i)"); + "myclass_$(i)" expression => "any"; + "yes" expression => not("!myclass_$(i)"); + "no" expression => not("myclass_$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent now_bench(i) { vars: - "epoch" - int => now(); + "epoch" int => now(); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent nth_bench(i) { vars: - "list" - slist => { "a", "b", "c", "d", "e", "$(i)" }; - "first" - string => nth(list, "0"); - "second" - string => nth(list, "1"); - "third" - string => nth(list, "2"); - "forth" - string => nth(list, "3"); - "fifth" - string => nth(list, "4"); - "sixth" - string => nth(list, "5"); + "list" slist => { "a", "b", "c", "d", "e", "$(i)" }; + "first" string => nth(list, "0"); + "second" string => nth(list, "1"); + "third" string => nth(list, "2"); + "forth" string => nth(list, "3"); + "fifth" string => nth(list, "4"); + "sixth" string => nth(list, "5"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent on_bench(i) { vars: - "epoch" - int => on("$(i)", "$(i)", "$(i)", "$(i)", "$(i)", "$(i)"); + "epoch" int => on("$(i)", "$(i)", "$(i)", "$(i)", "$(i)", "$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent or_bench(i) { classes: - "myclass_$(i)" - expression => "any"; - "test_1" - expression => or("myclass_$(i)", "myclass_$(i)"); - "test_2" - expression => or("myclass_$(i)", "!myclass_$(i)"); - "test_3" - expression => or("!myclass_$(i)", "myclass_$(i)"); - "test_3" - expression => or("!myclass_$(i)", "!myclass_$(i)"); + "myclass_$(i)" expression => "any"; + "test_1" expression => or("myclass_$(i)", "myclass_$(i)"); + "test_2" expression => or("myclass_$(i)", "!myclass_$(i)"); + "test_3" expression => or("!myclass_$(i)", "myclass_$(i)"); + "test_3" expression => or("!myclass_$(i)", "!myclass_$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent parseintarray_bench(i) { vars: - # Define data inline for convenience - "table" - string => - "1:2 + # Define data inline for convenience + "table" string => "1:2 3:4 $(i):6"; - "dim" - int => parseintarray("items", "$(table)", "\s*#[^\n]*", ":", "1000", "200000"); + + "dim" + int => parseintarray( + "items", "$(table)", "\s*#[^\n]*", ":", "1000", "200000" + ); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent parsejson_bench(i) { vars: - "json" - string => '{ "name": "alice", "age": $(i) }'; - "data" - data => parsejson("$(json)"); + "json" string => '{ "name": "alice", "age": $(i) }'; + "data" data => parsejson("$(json)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent parserealarray_bench(i) { vars: - "table" - string => - "1.1:2.2 + "table" string => "1.1:2.2 3.3:4.4 $(i).5:6.6"; - "dim" - int => parserealarray("items", "$(table)", "\s*#[^\n]*", ":", "1000", "200000"); + + "dim" + int => parserealarray( + "items", "$(table)", "\s*#[^\n]*", ":", "1000", "200000" + ); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent parsestringarray_bench(i) { - vars: - "table" - string => - "a:b + vars: + "table" string => "a:b c:d $(i):f"; - "dim" - int => parsestringarray("items", "$(table)", "\s*#[^\n]*", ":", "1000", "200000"); + + "dim" + int => parsestringarray( + "items", "$(table)", "\s*#[^\n]*", ":", "1000", "200000" + ); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent parsestringarrayidx_bench(i) { - vars: - "table" - string => - "one: a + vars: + "table" string => "one: a two: b $(i): c"; - "dim" - int => parsestringarrayidx("items", "$(table)", "\s*#[^\n]*", ":", "1000", "200000"); + + "dim" + int => parsestringarrayidx( + "items", "$(table)", "\s*#[^\n]*", ":", "1000", "200000" + ); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent product_bench(i) { vars: - "series" - rlist => { "1.1", "1.2", "2.3", "3.$(i)" }; - "prod" - real => product(series); + "series" rlist => { "1.1", "1.2", "2.3", "3.$(i)" }; + "prod" real => product(series); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent randomint_bench(i) { vars: - "rand" - int => randomint("0", "$(i)"); + "rand" int => randomint("0", "$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent regarray_bench(i) { vars: - "array[0]" - string => "a1"; - "array[1]" - string => "a2"; - "array[2]" - string => "b$(i)"; + "array[0]" string => "a1"; + "array[1]" string => "a2"; + "array[2]" string => "b$(i)"; + classes: - "yes" - expression => regarray(array, "[ab][123]"); - "no" - expression => regarray(array, "[cd][456]"); + "yes" expression => regarray(array, "[ab][123]"); + "no" expression => regarray(array, "[cd][456]"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent regcmp_bench(i) { classes: - "odd" - expression => regcmp("[0-9]*[02468]", "$(i)"); - "par" - expression => regcmp("[0-9]*[13579]", "$(i)"); + "odd" expression => regcmp("[0-9]*[02468]", "$(i)"); + "par" expression => regcmp("[0-9]*[13579]", "$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent regex_replace_bench(i) { vars: - "str" - string => regex_replace("$(i)", "[0-9]*[02468]", "odd", "i"); + "str" string => regex_replace("$(i)", "[0-9]*[02468]", "odd", "i"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent regextract_bench(i) { classes: - "ok" - expression => regextract("abc([0-9]+)def", "abc$(i)def", "arr"); + "ok" expression => regextract("abc([0-9]+)def", "abc$(i)def", "arr"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent reglist_bench(i) { vars: - "test" - slist => { "a", "$(i)", "c" }; + "test" slist => { "a", "$(i)", "c" }; + classes: - "yes" - expression => reglist("@(test)", "[0-9]*[02468]"); + "yes" expression => reglist("@(test)", "[0-9]*[02468]"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent reverse_bench(i) { vars: - "test" - slist => { "a", "b", "c", "1", "2", "$(i)" }; - "reversed" - slist => reverse(test); + "test" slist => { "a", "b", "c", "1", "2", "$(i)" }; + "reversed" slist => reverse(test); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent shuffle_bench(i) { vars: - "test" - slist => { "a", "b", "c", "1", "2", "3" }; - "shuffled" - slist => shuffle(test, "seed_$(i)"); + "test" slist => { "a", "b", "c", "1", "2", "3" }; + "shuffled" slist => shuffle(test, "seed_$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent some_bench(i) { vars: - "test" - slist => { "a", "b", "c", "1", "$(i)", "3" }; + "test" slist => { "a", "b", "c", "1", "$(i)", "3" }; + classes: - "yes" - expression => some("[0-9]*[02468]", test); + "yes" expression => some("[0-9]*[02468]", test); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent sort_bench(i) { vars: - "test" - slist => { "1", "2", "3", "4", "5", "$(i)" }; - "shuffled" - slist => shuffle(test, "seed_$(i)"); - "lex" - slist => sort(shuffled, "lex"); - "int" - slist => sort(shuffled, "int"); + "test" slist => { "1", "2", "3", "4", "5", "$(i)" }; + "shuffled" slist => shuffle(test, "seed_$(i)"); + "lex" slist => sort(shuffled, "lex"); + "int" slist => sort(shuffled, "int"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent splitstring_bench(i) { vars: - "test" - string => "1.5;2.3;$(i).0"; - "split" - slist => splitstring("$(test)", ";", "inf"); + "test" string => "1.5;2.3;$(i).0"; + "split" slist => splitstring("$(test)", ";", "inf"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent storejson_bench(i) { vars: - "dat" - data => '{ "name": "alice", "age": $(i) }'; - "json" - string => storejson(dat); + "dat" data => '{ "name": "alice", "age": $(i) }'; + "json" string => storejson(dat); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent strcmp_bench(i) { classes: - "same" - expression => strcmp("test$(i)", "test$(i)"); - "diff" - expression => strcmp("$(i)test", "test$(i)"); + "same" expression => strcmp("test$(i)", "test$(i)"); + "diff" expression => strcmp("$(i)test", "test$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent strftime_bench(i) { vars: - "at_time" - string => strftime("localtime", "%Y-%m-%d %T", "$(i)"); - "gmt_at_time" - string => strftime("gmtime", "%Y-%m-%d %T", "$(i)"); + "at_time" string => strftime("localtime", "%Y-%m-%d %T", "$(i)"); + "gmt_at_time" string => strftime("gmtime", "%Y-%m-%d %T", "$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent string_downcase_bench(i) { vars: - "downcase" - string => string_downcase("AbC dEf_$(i)"); + "downcase" string => string_downcase("AbC dEf_$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent string_head_bench(i) { vars: - "str" - string => "a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, 1, 2, 3, 4, 5, 6, 7, 8, 9"; - "head" - string => string_head("$(str)", "$(i)"); + "str" + string => "a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, 1, 2, 3, 4, 5, 6, 7, 8, 9"; + + "head" string => string_head("$(str)", "$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent string_length_bench(i) { vars: - "len" - int => string_length("Hello world $(i)!"); + "len" int => string_length("Hello world $(i)!"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent string_mustache_bench(i) { vars: - "deserts" - data => parsejson('{"deserts":{"Africa":"Sahara","Asia":"Gobi"}}'); - "data" - string => string_mustache("from container $(i): deserts = {{%deserts}}from container: {{#deserts}}The desert {{.}} is in {{@}}. {{/deserts}}", deserts); + "deserts" + data => parsejson('{"deserts":{"Africa":"Sahara","Asia":"Gobi"}}'); + + "data" + string => string_mustache( + "from container $(i): deserts = {{%deserts}}from container: {{#deserts}}The desert {{.}} is in {{@}}. {{/deserts}}", + deserts + ); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent string_replace_bench(i) { vars: - "str" - string => string_replace("This is a string $(i)", "string", "thing"); + "str" string => string_replace("This is a string $(i)", "string", "thing"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent string_reverse_bench(i) { vars: - "str" - string => string_reverse("abcdefghijklmnopqrstuvwxyz$(i)"); + "str" string => string_reverse("abcdefghijklmnopqrstuvwxyz$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent string_split_bench(i) { vars: - "split" - slist => string_split("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z", ",", "$(i)"); + "split" + slist => string_split( + "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z", ",", "$(i)" + ); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent string_tail_bench(i) { vars: - "tail" - string => string_tail("a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z", "$(i)"); + "tail" + string => string_tail( + "a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z", + "$(i)" + ); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent string_upcase_bench(i) { vars: - "upcase" - string => string_upcase("AbC dEf_$(i)"); + "upcase" string => string_upcase("AbC dEf_$(i)"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent sublist_bench(i) { vars: - "list" - slist => { "a", "b", "c", "d", "e", "f", "g", - "h", "i", "j", "k", "l", "m", "n", - "o", "p", "q", "r", "s", "t", "u", - "v", "x", "y", "z" }; - "sub_head" - slist => sublist(list, "head", "$(i)"); - "sub_tail" - slist => sublist(list, "tail", "$(i)"); - reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "list" + slist => { + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + "u", + "v", + "x", + "y", + "z", + }; + + "sub_head" slist => sublist(list, "head", "$(i)"); + "sub_tail" slist => sublist(list, "tail", "$(i)"); + + reports: + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent sum_bench(i) { vars: - "nums" - ilist => { "1", "2", "3", "4", "5", "$(i)" }; - "num_sum" - real => sum(nums); + "nums" ilist => { "1", "2", "3", "4", "5", "$(i)" }; + "num_sum" real => sum(nums); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent translatepath_bench(i) { vars: - "path" - string => translatepath("/a/b/c/file_$(i).txt"); + "path" string => translatepath("/a/b/c/file_$(i).txt"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent unique_bench(i) { vars: - "uni" - slist => { "one", "two", "three", - "1", "2", "3", - "one", "$(i)", "two" }; + "uni" + slist => { "one", "two", "three", "1", "2", "3", "one", "$(i)", "two" }; + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent validdata_bench(i) { classes: - "is_valid" - expression => validdata('{ "name": "alice", "age": $(i) }', "JSON"); - "not_valid" - expression => validdata('{ "name": "alice", "age": $(i) ]', "JSON"); + "is_valid" + expression => validdata('{ "name": "alice", "age": $(i) }', "JSON"); + + "not_valid" + expression => validdata('{ "name": "alice", "age": $(i) ]', "JSON"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent validjson_bench(i) { classes: - "is_valid" - expression => validjson('{ "name": "alice", "age": $(i) }'); - "not_valid" - expression => validjson('{ "name": "alice", "age": $(i) ]'); + "is_valid" expression => validjson('{ "name": "alice", "age": $(i) }'); + "not_valid" expression => validjson('{ "name": "alice", "age": $(i) ]'); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent variablesmatching_bench(i) { vars: - "matches" - slist => variablesmatching(".*$(i).*", "source=agent"); + "matches" slist => variablesmatching(".*$(i).*", "source=agent"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent variablesmatching_as_data_bench(i) { vars: - "matches" - data => variablesmatching_as_data(".*$(i).*", "source=agent"); + "matches" data => variablesmatching_as_data(".*$(i).*", "source=agent"); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent variance_bench(i) { vars: - "nums" - ilist => { "1", "2", "3", "$(i) " }; - "vari" - real => variance(nums); + "nums" ilist => { "1", "2", "3", "$(i) " }; + "vari" real => variance(nums); + reports: - "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; + "Benching '$(this.bundle)' ($(i)/$(benchmark.n)) ..."; } bundle agent print_benchmark_done_msg() diff --git a/examples/const.cf b/examples/const.cf index 1403c7ec17..79d9e3f064 100644 --- a/examples/const.cf +++ b/examples/const.cf @@ -3,36 +3,38 @@ bundle agent __main__ # @brief Example illustrating cosnt vars { vars: - "example_file" - string => "/tmp/const-vars.txt"; + "example_file" string => "/tmp/const-vars.txt"; files: - "$(example_file)" - create => "true", - content => concat("CFEngine const vars$(const.n)", - "before const.at $(const.at) after const.at$(const.n)", - "before const.dollar $(const.dollar) after const.dollar$(const.n)", - "before const.dirsep $(const.dirsep) after const.dirsep$(const.n)", - "before const.linesep $(const.linesep) after const.linesep$(const.n)", - "before const.endl$(const.endl) after const.endl$(const.n)", - "before const.n$(const.n) after const.n$(const.n)", - "before const.r $(const.r) after const.r$(const.n)", - "before const.t $(const.t) after const.t$(const.n)"); + "$(example_file)" + create => "true", + content => concat( + "CFEngine const vars$(const.n)", + "before const.at $(const.at) after const.at$(const.n)", + "before const.dollar $(const.dollar) after const.dollar$(const.n)", + "before const.dirsep $(const.dirsep) after const.dirsep$(const.n)", + "before const.linesep $(const.linesep) after const.linesep$(const.n)", + "before const.endl$(const.endl) after const.endl$(const.n)", + "before const.n$(const.n) after const.n$(const.n)", + "before const.r $(const.r) after const.r$(const.n)", + "before const.t $(const.t) after const.t$(const.n)" + ); reports: - "const vars available: $(with)" - with => storejson( variablesmatching_as_data( "default:const\..*" ) ); + "const vars available: $(with)" + with => storejson(variablesmatching_as_data("default:const\..*")); - "$(example_file):" - printfile => cat( "$(example_file)" ); + "$(example_file):" printfile => cat("$(example_file)"); } + 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"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/container_iteration.cf b/examples/container_iteration.cf index 2d674129b9..d6312b005c 100644 --- a/examples/container_iteration.cf +++ b/examples/container_iteration.cf @@ -1,51 +1,49 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { run }; + bundlesequence => { run }; } bundle agent run { vars: - "x" data => parsejson('[ + "x" + data => parsejson( + '[ { "one": "a" }, { "two": "b" }, { "three": "c" } -]'); +]' + ); - # get the numeric indices of x: 0, 1, 2 - "xi" slist => getindices(x); + # get the numeric indices of x: 0, 1, 2 + "xi" slist => getindices(x); - # for each xi, make a variable xpiece_$(xi) so we'll have - # xpiece_0, xpiece_1, xpiece_2. Each xpiece will have that - # particular element of the list x. - "xpiece_$(xi)" string => format("%S", "x[$(xi)]"); + # for each xi, make a variable xpiece_$(xi) so we'll have + # xpiece_0, xpiece_1, xpiece_2. Each xpiece will have that + # particular element of the list x. + "xpiece_$(xi)" string => format("%S", "x[$(xi)]"); reports: - "$(xi): $(xpiece_$(xi))"; + "$(xi): $(xpiece_$(xi))"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/container_key_iteration.cf b/examples/container_key_iteration.cf index a01da5c7dc..60957b881f 100644 --- a/examples/container_key_iteration.cf +++ b/examples/container_key_iteration.cf @@ -1,62 +1,59 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { run }; + bundlesequence => { run }; } bundle agent run { vars: - "animals" data => parsejson(' + "animals" + data => parsejson( + ' { "dog": { "legs": 4, "tail": true, "names": [ "Fido", "Cooper", "Sandy" ] }, "cat": { "legs": 4, "tail": true, "names": [ "Fluffy", "Snowball", "Tabby" ] }, "dolphin": { "legs": 0, "tail": true, "names": [ "Flipper", "Duffy" ] }, "hamster": { "legs": 4, "tail": true, "names": [ "Skullcrusher", "Kimmy", "Fluffadoo" ] }, - }'); + }' + ); - "keys_unsorted" slist => getindices("animals"); - "keys" slist => sort(keys_unsorted, "lex"); - - "animals_$(keys)" data => mergedata("animals[$(keys)]"); + "keys_unsorted" slist => getindices("animals"); + "keys" slist => sort(keys_unsorted, "lex"); + "animals_$(keys)" data => mergedata("animals[$(keys)]"); methods: - # pass the container and a key inside it - "any" usebundle => analyze(@(animals), $(keys)); + # pass the container and a key inside it + "any" usebundle => analyze(@(animals), $(keys)); } bundle agent analyze(animals, a) { vars: - "names" slist => getvalues("animals[$(a)][names]"); - "names_str" string => format("%S", names); + "names" slist => getvalues("animals[$(a)][names]"); + "names_str" string => format("%S", names); reports: - "$(this.bundle): possible names for animal '$(a)': $(names_str)"; - "$(this.bundle): describe animal '$(a)' => name = $(a), legs = $(animals[$(a)][legs]), tail = $(animals[$(a)][tail])"; + "$(this.bundle): possible names for animal '$(a)': $(names_str)"; + "$(this.bundle): describe animal '$(a)' => name = $(a), legs = $(animals[$(a)][legs]), tail = $(animals[$(a)][tail])"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/control_expand.cf b/examples/control_expand.cf index 0168ce0d41..48be4b6269 100644 --- a/examples/control_expand.cf +++ b/examples/control_expand.cf @@ -1,91 +1,74 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - bundle common g { classes: - - "softclass" expression => "any"; + "softclass" expression => "any"; vars: - - "bundle" slist => { "bundle1", "bundle2", @(g.extra) }; + "bundle" slist => { "bundle1", "bundle2", @(g.extra) }; any:: - # default extra - - "extra" slist => { "bundle3" }, - policy => "overridable"; + "extra" + slist => { "bundle3" }, + policy => "overridable"; softclass:: - - "extra" slist => { "bundle3", "bundle4" }, - policy => "overridable"; - + "extra" + slist => { "bundle3", "bundle4" }, + policy => "overridable"; } ############################################################## - body common control { - bundlesequence => { @(g.bundle) }; + bundlesequence => { @(g.bundle) }; } ############################################################## - bundle agent bundle1 { vars: - - "var1" string => "anything"; - "bundle" slist => { @(g.bundle) }; + "var1" string => "anything"; + "bundle" slist => { @(g.bundle) }; reports: - "$(bundle)"; + "$(bundle)"; } bundle agent bundle2 { classes: - - "ok" expression => isvariable("bundle1.var1"); + "ok" expression => isvariable("bundle1.var1"); reports: - ok:: - "Success"; } bundle agent bundle3 { reports: - "Success extra..."; + "Success extra..."; } bundle agent bundle4 { reports: - "Success extra more..."; + "Success extra more..."; } diff --git a/examples/copy.cf b/examples/copy.cf index 375b4d6611..25723a6559 100644 --- a/examples/copy.cf +++ b/examples/copy.cf @@ -1,40 +1,34 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - body common control { - bundlesequence => { "copy" }; + bundlesequence => { "copy" }; } bundle agent copy { files: - "/tmp/testfile1-cop" copy_from => mycopy("/tmp/testfile1", "gudea"); - "/tmp/testfile2-cop" copy_from => mycopy("/tmp/testfile2", "gudea"); + "/tmp/testfile1-cop" copy_from => mycopy("/tmp/testfile1", "gudea"); + "/tmp/testfile2-cop" copy_from => mycopy("/tmp/testfile2", "gudea"); } -body copy_from mycopy(from,server) +body copy_from mycopy(from, server) { - source => "$(from)"; - #servers => { "$(server)" }; -} + source => "$(from)"; + #servers => { "$(server)" }; +} diff --git a/examples/copy_classes.cf b/examples/copy_classes.cf index 688024a27b..f86bde1029 100644 --- a/examples/copy_classes.cf +++ b/examples/copy_classes.cf @@ -1,43 +1,38 @@ -body common control +body common control { - bundlesequence => { "copy_file"}; - - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "copy_file" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } ###################################################### - -bundle agent copy_file() +bundle agent copy_file() { files: - - "/tmp/non_existent" + "/tmp/non_existent" copy_from => local_cp_compare("/non_existent"), # perms => m("777"), action => warn_only, classes => check_promises("NE_NE"); - - "/tmp/non_existent" + "/tmp/non_existent" copy_from => local_cp_compare("/tmp/existent_file"), # perms => m("777"), action => warn_only, classes => check_promises("NE_E"); - - "/tmp/existent_file" + "/tmp/existent_file" copy_from => local_cp_compare("/tmp/existent_file"), # perms => m("777"), action => warn_only, classes => check_promises("E_E"); - "/tmp/existent_file" + "/tmp/existent_file" copy_from => local_cp_compare("/tmp/different_file"), # perms => m("777"), action => warn_only, classes => check_promises("D_E"); - "/tmp/existent_file" + "/tmp/existent_file" copy_from => local_cp_compare("/non_existent"), # perms => m("777"), action => warn_only, @@ -46,81 +41,94 @@ bundle agent copy_file() reports: NE_NE_kept:: "NE_NE_kept"; + NE_NE_repaired:: "NE_NE_repaired"; + NE_NE_failed:: "NE_NE_failed"; + NE_NE_denied:: "NE_NE_denied"; + NE_NE_timeout:: "NE_NE_timeout"; NE_E_kept:: "NE_E_kept"; + NE_E_repaired:: "NE_E_repaired"; + NE_E_failed:: "NE_E_failed"; + NE_E_denied:: "NE_E_denied"; + NE_E_timeout:: "NE_E_timeout"; - E_E_kept:: "E_E_kept"; + E_E_repaired:: "E_E_repaired"; + E_E_failed:: "E_E_failed"; + E_E_denied:: "E_E_denied"; + E_E_timeout:: "E_E_timeout"; - D_E_kept:: "D_E_kept"; + D_E_repaired:: "D_E_repaired"; + D_E_failed:: "D_E_failed"; + D_E_denied:: "D_E_denied"; + D_E_timeout:: "D_E_timeout"; E_NE_kept:: "E_NE_kept"; + E_NE_repaired:: "E_NE_repaired"; + E_NE_failed:: "E_NE_failed"; + E_NE_denied:: "E_NE_denied"; + E_NE_timeout:: "E_NE_timeout"; } ###################################################### - body classes check_promises(prom) { - promise_kept => { "$(prom)_kept" }; - promise_repaired => { "$(prom)_repaired" }; - - repair_failed => { "$(prom)_failed" }; - repair_denied => { "$(prom)_denied" }; - repair_timeout => { "$(prom)_timeout" }; + promise_kept => { "$(prom)_kept" }; + promise_repaired => { "$(prom)_repaired" }; + repair_failed => { "$(prom)_failed" }; + repair_denied => { "$(prom)_denied" }; + repair_timeout => { "$(prom)_timeout" }; } ###################################################### - body copy_from local_cp_compare(from) { - source => "$(from)"; - verify => "true"; - compare => "hash"; + source => "$(from)"; + verify => "true"; + compare => "hash"; } - - diff --git a/examples/copy_copbl.cf b/examples/copy_copbl.cf index d2269f4950..f96e9ef02b 100644 --- a/examples/copy_copbl.cf +++ b/examples/copy_copbl.cf @@ -1,45 +1,37 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - body common control { - bundlesequence => { "mycopy" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "mycopy" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } bundle agent mycopy { files: - "/tmp/test_plain" - -#@ Path and name of the file we wish to copy to - + "/tmp/test_plain" + # Path and name of the file we wish to copy to comment => "/tmp/test_plain promises to be an up-to-date copy of /bin/echo to demonstrate copying a local file", copy_from => local_cp("$(sys.workdir)/bin/file"); -#@ Copy locally from path/filename - - "/tmp/test_remote_plain" + # Copy locally from path/filename + "/tmp/test_remote_plain" comment => "/tmp/test_plain_remote promises to be a copy of cfengine://serverhost.example.org/repo/config-files/motd", - copy_from => secure_cp("/repo/config-files/motd", "serverhost.example.org"); + copy_from => secure_cp( + "/repo/config-files/motd", "serverhost.example.org" + ); } -#@ Copy remotely from path/filename and specified host diff --git a/examples/copy_edit.cf b/examples/copy_edit.cf index 5f89d55b69..183f25fa5c 100644 --- a/examples/copy_edit.cf +++ b/examples/copy_edit.cf @@ -1,118 +1,88 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Copy and edit convergently # ######################################################## - body common control - { - bundlesequence => { "example" }; - version => "1.2.3"; + bundlesequence => { "example" }; + version => "1.2.3"; } ######################################################## - bundle agent example - { vars: - - "source" string => "/tmp"; - "dest" string => "/tmp"; + "source" string => "/tmp"; + "dest" string => "/tmp"; files: - - "/$(dest)/staging-file" - - comment => "Copy from source to buffer", - copy_from => cp("$(source)/source-template"), - classes => satisfied("copy_ok"); + "/$(dest)/staging-file" + comment => "Copy from source to buffer", + copy_from => cp("$(source)/source-template"), + classes => satisfied("copy_ok"); copy_ok:: - - "/$(dest)/final-file" - - comment => "Build a file template and expand keys", - edit_line => myedits("/$(dest)/staging-file"), - edit_defaults => empty; - + "/$(dest)/final-file" + comment => "Build a file template and expand keys", + edit_line => myedits("/$(dest)/staging-file"), + edit_defaults => empty; } ######################################################### - body copy_from cp(from) - { - source => "$(from)"; - compare => "mtime"; - type_check => "true"; + source => "$(from)"; + compare => "mtime"; + type_check => "true"; } ######################################################## - bundle edit_line myedits(f) - { insert_lines: - - "$(f)" - - comment => "Populate empty file", + "$(f)" + comment => "Populate empty file", insert_type => "file"; replace_patterns: - - "TEMPLATE_HOST_KEY" - + "TEMPLATE_HOST_KEY" comment => "Replace a place-marker with the name of this host", replace_with => rp("$(sys.host)"); - } ######################################################## - body replace_with rp(x) - { - replace_value => "$(x)"; - occurrences => "all"; + replace_value => "$(x)"; + occurrences => "all"; } ######################################################### - body classes satisfied(x) { - promise_repaired => { "$(x)" }; - persist_time => "0"; + promise_repaired => { "$(x)" }; + persist_time => "0"; } ####################################################### - body edit_defaults empty - { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } diff --git a/examples/copydir_copbl.cf b/examples/copydir_copbl.cf index 0709cbe054..f225d62c56 100644 --- a/examples/copydir_copbl.cf +++ b/examples/copydir_copbl.cf @@ -1,45 +1,33 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - body common control { - bundlesequence => { "my_recursive_copy" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "my_recursive_copy" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } bundle agent my_recursive_copy { files: - - "/home/mark/tmp/test_dir" - + "/home/mark/tmp/test_dir" copy_from => local_cp("$(sys.workdir)/bin/."), depth_search => recurse("inf"); - "/home/mark/tmp/test_dir" - - copy_from => secure_cp("$(sys.workdir)/bin","serverhost"), + "/home/mark/tmp/test_dir" + copy_from => secure_cp("$(sys.workdir)/bin", "serverhost"), depth_search => recurse("inf"); - } - - diff --git a/examples/copylinks.cf b/examples/copylinks.cf index b3f3a53d79..4a8f85a36a 100644 --- a/examples/copylinks.cf +++ b/examples/copylinks.cf @@ -1,81 +1,60 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test copy with link/copy exceptions # ######################################################## - ######################################################## - body common control - { - bundlesequence => { "example" }; - - version => "1.2.3"; + bundlesequence => { "example" }; + version => "1.2.3"; } ######################################################## - bundle agent example - { files: - - "/home/mark/tmp/test_to" - - copy_from => mycopy("/home/mark/tmp/test_from"), - perms => system, + "/home/mark/tmp/test_to" + copy_from => mycopy("/home/mark/tmp/test_from"), + perms => system, move_obstructions => "true", depth_search => recurse("inf"); - } ######################################################### - body perms system - { - mode => "0644"; + mode => "0644"; } ######################################################### - body depth_search recurse(d) - { - depth => "$(d)"; + depth => "$(d)"; } ######################################################### - body copy_from mycopy(from) - { - source => "$(from)"; - #copylink_patterns => { ".*" }; # copy all links - linkcopy_patterns => { ".*" }; # copy all links - #copy_backup => "timestamp"; -} + source => "$(from)"; + #copylink_patterns => { ".*" }; # copy all links + linkcopy_patterns => { ".*" }; # copy all links + #copy_backup => "timestamp"; +} diff --git a/examples/countclassesmatching.cf b/examples/countclassesmatching.cf index 37a7b6886c..223b24ebe1 100644 --- a/examples/countclassesmatching.cf +++ b/examples/countclassesmatching.cf @@ -1,40 +1,36 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - # this is anchored, so you need .* to match multiple things - "num" int => countclassesmatching("cfengine"); - "hardcount" int => countclassesmatching(".*", "hardclass"); + # this is anchored, so you need .* to match multiple things + "num" int => countclassesmatching("cfengine"); + "hardcount" int => countclassesmatching(".*", "hardclass"); + reports: - "Found $(num) classes matching"; + "Found $(num) classes matching"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/countlinesmatching.cf b/examples/countlinesmatching.cf index c00e1ca74b..f1eb452624 100644 --- a/examples/countlinesmatching.cf +++ b/examples/countlinesmatching.cf @@ -1,40 +1,35 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - # typically there is only one root user - "no" int => countlinesmatching("root:.*","/etc/passwd"); + # typically there is only one root user + "no" int => countlinesmatching("root:.*", "/etc/passwd"); reports: - "Found $(no) lines matching"; + "Found $(no) lines matching"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/create_filedir.cf b/examples/create_filedir.cf index c06b03bce2..5bd6fba9fb 100644 --- a/examples/create_filedir.cf +++ b/examples/create_filedir.cf @@ -1,70 +1,50 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of CFEngine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test create files # ######################################################## - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } -######################################################## - bundle agent example - { files: - - "/home/mark/tmp/test_plain" -#@ The promiser specifies the path and name of the file. + # The promiser specifies the path and name of the file: + "/home/mark/tmp/test_plain" + # The `perms` attribute sets the file permissions as defined in the `system` + # body below: perms => system, + # The `create` attribute makes sure that the files exists. If it + # doesn't, CFEngine will create it. create => "true"; -#@ The `perms` attribute sets the file permissions as defined in the `system` -#@ body below. The `create` attribute makes sure that the files exists. If it -#@ doesn't, CFEngine will create it. - - "/home/mark/tmp/test_dir/." - + # The trailing `/.` in the filename tells CFEngine that the promiser is a + # directory: + "/home/mark/tmp/test_dir/." perms => system, create => "true"; -#@ The trailing `/.` in the filename tells CFEngine that the promiser is a -#@ directory. } -######################################################### - body perms system - +# This body sets permissions to "0640" { - mode => "0640"; + mode => "0640"; } -#@ This body sets permissions to "0640" - - -######################################################### - diff --git a/examples/createdb.cf b/examples/createdb.cf index ab81d8b844..66a2963451 100644 --- a/examples/createdb.cf +++ b/examples/createdb.cf @@ -1,67 +1,54 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "databases" }; + bundlesequence => { "databases" }; } bundle agent databases - { databases: - - "knowledge_bank/topics" - + "knowledge_bank/topics" database_operation => "create", database_type => "sql", - database_columns => { - "demo_name,varchar,256", - "demo_comment,varchar,1024", - "demo_id,varchar,256", - "demo_type,varchar,256", - "demo_extra,varchar,26" + database_columns => { + "demo_name,varchar,256", + "demo_comment,varchar,1024", + "demo_id,varchar,256", + "demo_type,varchar,256", + "demo_extra,varchar,26", }, - database_server => myserver; } ################################################ - - body database_server myserver { - none:: - db_server_owner => "postgres"; - db_server_password => ""; - db_server_host => "localhost"; - db_server_type => "postgres"; - db_server_connection_db => "postgres"; - any:: - db_server_owner => "root"; - db_server_password => ""; - db_server_host => "localhost"; - db_server_type => "mysql"; - db_server_connection_db => "mysql"; + none:: + db_server_owner => "postgres"; + db_server_password => ""; + db_server_host => "localhost"; + db_server_type => "postgres"; + db_server_connection_db => "postgres"; + + any:: + db_server_owner => "root"; + db_server_password => ""; + db_server_host => "localhost"; + db_server_type => "mysql"; + db_server_connection_db => "mysql"; } - diff --git a/examples/customize_by_named_list.cf b/examples/customize_by_named_list.cf index a7cf9dcacf..e33b238eaf 100644 --- a/examples/customize_by_named_list.cf +++ b/examples/customize_by_named_list.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test - copy from a single directory of spec files @@ -27,71 +21,50 @@ # edits. # ######################################################## - body common control - { - bundlesequence => { "virtualhosts" }; - version => "1.2.3"; + bundlesequence => { "virtualhosts" }; + version => "1.2.3"; } ######################################################## - bundle agent virtualhosts - { vars: - - - "vmbase" string => "/home/mark/tmp/vm"; - "source_files" string => "/home/mark/tmp/src"; - - # list of hosts to create - - "hostlist" slist => { - "host1", - "host2", - "host3", - "host4", - "host5", - "host6", - "host7", - "host8", - "host9" + "vmbase" string => "/home/mark/tmp/vm"; + "source_files" string => "/home/mark/tmp/src"; + + # list of hosts to create + "hostlist" + slist => { + "host1", + "host2", + "host3", + "host4", + "host5", + "host6", + "host7", + "host8", + "host9", }; - - - - - ################### or just a new file to the dir ################ - # - # "hostlist" slist => { SelectFilesIn("$(source_files)",".*") } - # - ################################################################## - + ################### or just a new file to the dir ################ + # + # "hostlist" slist => { SelectFilesIn("$(source_files)",".*") } + # + ################################################################## files: - - "$(vmbase)/$(hostlist)/config_for_$(hostlist).vm" - + "$(vmbase)/$(hostlist)/config_for_$(hostlist).vm" copy_from => buildvm("$(source_files)/template_$(hostlist)"); - - - # # Now edit config .e.g. edit in $(ipadr[$(hostlist)]) for each - # - } ######################################################### # library template ######################################################### - body copy_from buildvm(from) - { - source => "$(from)"; - copy_backup => "true"; #/false/timestamp + source => "$(from)"; + copy_backup => "true"; #/false/timestamp } - diff --git a/examples/data_expand.cf b/examples/data_expand.cf index d0542e39cf..faab7f7606 100644 --- a/examples/data_expand.cf +++ b/examples/data_expand.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ echo '{ "$(main.x)": "$(main.y)" }' > /tmp/expand.json @@ -30,17 +24,16 @@ bundle agent main { vars: - "x" string => "the expanded x"; - "y" string => "the expanded y"; - - "read" data => readjson("/tmp/expand.json", inf); - "expanded" data => data_expand(read); - - "expanded_str" string => format("%S", expanded); + "x" string => "the expanded x"; + "y" string => "the expanded y"; + "read" data => readjson("/tmp/expand.json", inf); + "expanded" data => data_expand(read); + "expanded_str" string => format("%S", expanded); reports: - "$(this.bundle): the x and y references expanded to $(expanded_str)"; + "$(this.bundle): the x and y references expanded to $(expanded_str)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/data_readstringarray.cf b/examples/data_readstringarray.cf index 286c9d7e5e..2bc1499cbf 100644 --- a/examples/data_readstringarray.cf +++ b/examples/data_readstringarray.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ echo a,b,c > /tmp/cfe_array @@ -34,28 +28,34 @@ #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - # The comment regex warrents an explination: - # # matches the character # literally - # [^\n]* match a single character not including the newline character - # between zero and unlimited times, as many times as possible - "bykey" data => data_readstringarray("/tmp/cfe_array","#[^\n]*",",",10,400); - "byint" data => data_readstringarrayidx("/tmp/cfe_array","#[^\n]*",",",10,400); + # The comment regex warrents an explination: + # # matches the character # literally + # [^\n]* match a single character not including the newline character + # between zero and unlimited times, as many times as possible + "bykey" + data => data_readstringarray("/tmp/cfe_array", "#[^\n]*", ",", 10, 400); - "bykey_str" string => format("%S", bykey); - "byint_str" string => format("%S", byint); - reports: - "By key: $(bykey_str)"; - "specific element by key a, offset 0: '$(bykey[a][0])'"; - "By int offset: $(byint_str)"; - "specific element by int offset 2, 0: '$(byint[2][0])'"; + "byint" + data => data_readstringarrayidx( + "/tmp/cfe_array", "#[^\n]*", ",", 10, 400 + ); + + "bykey_str" string => format("%S", bykey); + "byint_str" string => format("%S", byint); + reports: + "By key: $(bykey_str)"; + "specific element by key a, offset 0: '$(bykey[a][0])'"; + "By int offset: $(byint_str)"; + "specific element by int offset 2, 0: '$(byint[2][0])'"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/data_regextract.cf b/examples/data_regextract.cf index 31b0e293ff..f00b0c8f03 100644 --- a/examples/data_regextract.cf +++ b/examples/data_regextract.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ##+begin_src prep #@ ``` #@ printf "[general]\n" > /tmp/instance.cfg @@ -32,41 +26,47 @@ bundle agent main { vars: - # the returned data container is a key-value map: - - # the whole matched string is put in key "0" - # the first three characters are put in key "name1" - # the next three characters go into key "2" (the capture has no name) - # the next two characters go into key "3" (the capture has no name) - # then the dash is ignored - # then three characters are put in key "name2" - # then another dash is ignored - # the next three characters go into key "5" (the capture has no name) - # anything else is ignored + # the returned data container is a key-value map: + # the whole matched string is put in key "0" + # the first three characters are put in key "name1" + # the next three characters go into key "2" (the capture has no name) + # the next two characters go into key "3" (the capture has no name) + # then the dash is ignored + # then three characters are put in key "name2" + # then another dash is ignored + # the next three characters go into key "5" (the capture has no name) + # anything else is ignored + "parsed" + data => data_regextract( + "^(?...)(...)(..)-(?...)-(..).*", + "abcdef12-345-67andsoon" + ); - "parsed" data => data_regextract("^(?...)(...)(..)-(?...)-(..).*", "abcdef12-345-67andsoon"); - "parsed_str" string => format("%S", parsed); + "parsed_str" string => format("%S", parsed); - # Illustrating multiline regular expression + # Illustrating multiline regular expression + "instance_guid_until_end_of_string" + data => data_regextract( + "^guid\s?+=\s?+(?.*)$", readfile("/tmp/instance.cfg", 200) + ); - "instance_guid_until_end_of_string" - data => data_regextract( "^guid\s?+=\s?+(?.*)$", - readfile( "/tmp/instance.cfg", 200)); + "instance_guid" + data => data_regextract( + "^guid\s+=\s+(?[^\n]*)", readfile("/tmp/instance.cfg", 200) + ); - "instance_guid" - data => data_regextract( "^guid\s+=\s+(?[^\n]*)", - readfile( "/tmp/instance.cfg", 200)); - - "instance_port" - data => data_regextract( "^port\s?+=\s?+(?[^\n]*)", - readfile( "/tmp/instance.cfg", 200)); + "instance_port" + data => data_regextract( + "^port\s?+=\s?+(?[^\n]*)", readfile("/tmp/instance.cfg", 200) + ); reports: - "$(this.bundle): parsed[0] '$(parsed[0])' parses into: $(parsed_str)"; - "$(this.bundle): instance_guid_until_end_of_string[value] '$(instance_guid_until_end_of_string[value])'"; - "$(this.bundle): instance_guid[value] '$(instance_guid[value])'"; - "$(this.bundle): instance_port[value] '$(instance_port[value])'"; + "$(this.bundle): parsed[0] '$(parsed[0])' parses into: $(parsed_str)"; + "$(this.bundle): instance_guid_until_end_of_string[value] '$(instance_guid_until_end_of_string[value])'"; + "$(this.bundle): instance_guid[value] '$(instance_guid[value])'"; + "$(this.bundle): instance_port[value] '$(instance_port[value])'"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/data_sysctlvalues.cf b/examples/data_sysctlvalues.cf index d2c56a8e71..f69b26915b 100644 --- a/examples/data_sysctlvalues.cf +++ b/examples/data_sysctlvalues.cf @@ -3,31 +3,30 @@ bundle agent inventory_sysctl # @brief Inventory each sysctl variable { vars: - # Get the complete set of sysctl variables and values as a data structure - "_sysctl_d" - data => data_sysctlvalues(), - unless => isvariable( _sysctl_d ); + # Get the complete set of sysctl variables and values as a data structure + "_sysctl_d" + data => data_sysctlvalues(), + unless => isvariable(_sysctl_d); - # Get the sysctl variable names - "_sysctl_i" - slist => getindices( "_sysctl_d" ); + # Get the sysctl variable names + "_sysctl_i" slist => getindices("_sysctl_d"); - # Define a variable tagged for inventory for each sysctl variable - "sysctl[$(_sysctl_i)]" - string => "$(_sysctl_d[$(_sysctl_i)])", - meta => { "inventory", "attribute_name=Kernel Tunable $(_sysctl_i)" }; + # Define a variable tagged for inventory for each sysctl variable + "sysctl[$(_sysctl_i)]" + string => "$(_sysctl_d[$(_sysctl_i)])", + meta => { "inventory", "attribute_name=Kernel Tunable $(_sysctl_i)" }; reports: - # Show what data_sysctlvalues() returned. - "data_sysctlvalues() returned:$(with)" - with => storejson( @(_sysctl_d) ); - + # Show what data_sysctlvalues() returned. + "data_sysctlvalues() returned:$(with)" with => storejson(@(_sysctl_d)); } + bundle agent __main__ { - methods: "inventory_sysctl"; - + methods: + "inventory_sysctl"; } + #+end_src ############################################################################### #+begin_src mock_example_output diff --git a/examples/datastate.cf b/examples/datastate.cf index 8caa8d542c..db4fce5e10 100644 --- a/examples/datastate.cf +++ b/examples/datastate.cf @@ -1,60 +1,56 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { holder, test }; + bundlesequence => { holder, test }; } bundle common holder { classes: - "holderclass" expression => "any"; # will be global - + "holderclass" expression => "any"; # will be global vars: - "s" string => "Hello!"; - "d" data => parsejson('[4,5,6]'); - "list" slist => { "element1", "element2" }; + "s" string => "Hello!"; + "d" data => parsejson('[4,5,6]'); + "list" slist => { "element1", "element2" }; } bundle agent test { vars: - "state" data => datastate(); + "state" data => datastate(); + + # all the variables in bundle "holder" defined as of the execution of datastate() will be here + "holderstate" string => format("%S", "state[vars][holder]"); - # all the variables in bundle "holder" defined as of the execution of datastate() will be here - "holderstate" string => format("%S", "state[vars][holder]"); - # all the classes defined as of the execution of datastate() will be here - "allclasses" slist => getindices("state[classes]"); + # all the classes defined as of the execution of datastate() will be here + "allclasses" slist => getindices("state[classes]"); classes: - "have_holderclass" expression => some("holderclass", allclasses); + "have_holderclass" expression => some("holderclass", allclasses); reports: - "holder vars = $(holderstate)"; + "holder vars = $(holderstate)"; + have_holderclass:: "I have the holder class"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/def.json b/examples/def.json index 5b8b32e45e..6b85c7c532 100644 --- a/examples/def.json +++ b/examples/def.json @@ -1,9 +1,7 @@ { "vars": { "example_augment_string_override": "defined in def.json", - "example_augment_list_override": [ "defined", "in", "def.json"], - "example_augment_structured_override": { - "key1": "defined in def.json" - } + "example_augment_list_override": ["defined", "in", "def.json"], + "example_augment_structured_override": { "key1": "defined in def.json" } } } diff --git a/examples/defaults.cf b/examples/defaults.cf index 97c2ba5491..67c5aaebc5 100644 --- a/examples/defaults.cf +++ b/examples/defaults.cf @@ -1,79 +1,60 @@ - # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # Default values for variables and parameters, introduced 3.4.0 # - ########################################################### - bundle agent main - -{ +{ defaults: - - # We can have default values even if variables are not defined at all. - # This is equivalent to a variable definition, so not particularly useful. - - "X" string => "I am a default value"; - "Y" slist => { "I am a default list item 1", "I am a default list item 2" }; + # We can have default values even if variables are not defined at all. + # This is equivalent to a variable definition, so not particularly useful. + "X" string => "I am a default value"; + "Y" slist => { "I am a default list item 1", "I am a default list item 2" }; methods: - - # More useful, defaults if parameters are passed to a param bundle - - "example" usebundle => mymethod("","bbb"); + # More useful, defaults if parameters are passed to a param bundle + "example" usebundle => mymethod("", "bbb"); reports: - - "The default value of X is $(X)"; - "The default value of Y is $(Y)"; + "The default value of X is $(X)"; + "The default value of Y is $(Y)"; } ########################################################### - -bundle agent mymethod(a,b) - +bundle agent mymethod(a, b) { vars: - - "no_return" string => "ok"; # readfile("/dont/exist","123"); - + "no_return" string => "ok"; # readfile("/dont/exist","123"); defaults: + "a" + string => "AAAAAAAAA", + if_match_regex => ""; - "a" string => "AAAAAAAAA", if_match_regex => ""; - - "b" string => "BBBBBBBBB", if_match_regex => ""; + "b" + string => "BBBBBBBBB", + if_match_regex => ""; - "no_return" string => "no such file"; + "no_return" string => "no such file"; reports: - - "The value of a is $(a)"; - "The value of b is $(b)"; - - "The value of no_return is $(no_return)"; - + "The value of a is $(a)"; + "The value of b is $(b)"; + "The value of no_return is $(no_return)"; } ############################################################################### @@ -87,4 +68,3 @@ bundle agent mymethod(a,b) #@ R: The default value of Y is I am a default list item 2 #@ ``` #+end_src - diff --git a/examples/defaults2.cf b/examples/defaults2.cf index 72f2c4fba6..cc3cf68255 100644 --- a/examples/defaults2.cf +++ b/examples/defaults2.cf @@ -1,68 +1,46 @@ - # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # Default values for variables and parameters, introduced 3.4.0 -# - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################################### - bundle agent example - -{ +{ vars: - - "Y" slist => { "I am list item 1", "I am list item 2" }; + "Y" slist => { "I am list item 1", "I am list item 2" }; methods: - - # More useful, defaults if parameters are passed to a param bundle - - "example" usebundle => mymethod(@(example.Y)); - + # More useful, defaults if parameters are passed to a param bundle + "example" usebundle => mymethod(@(example.Y)); } ########################################################### - bundle agent mymethod(list) - { defaults: + "list" + slist => { "1", "2", "3" }, + if_match_regex => ".*list item.*"; - "list" slist => { "1", "2", "3"}, if_match_regex => ".*list item.*"; - # "list" string => "1" , if_match_regex => ".*list item.*"; - - + # "list" string => "1" , if_match_regex => ".*list item.*"; reports: - - "The value of list is $(list)"; - + "The value of list is $(list)"; } - - diff --git a/examples/defaults3.cf b/examples/defaults3.cf index dee49f5489..81afc4d7ee 100644 --- a/examples/defaults3.cf +++ b/examples/defaults3.cf @@ -1,28 +1,33 @@ - - body common control { - bundlesequence => { "main" }; + bundlesequence => { "main" }; } bundle agent main { methods: - - "example" usebundle => test("one","x","","$(four)"); - + "example" usebundle => test("one", "x", "", "$(four)"); } - -bundle agent test(a,b,c,d) +bundle agent test(a, b, c, d) { defaults: + "a" + string => "default a", + if_match_regex => ""; + + "b" + string => "default b", + if_match_regex => "x"; + + "c" + string => "default c", + if_match_regex => ""; - "a" string => "default a", if_match_regex => ""; - "b" string => "default b", if_match_regex => "x"; - "c" string => "default c", if_match_regex => ""; - "d" string => "default d", if_match_regex => "\$\([a-zA-Z0-9_.]+\)"; + "d" + string => "default d", + if_match_regex => "\$\([a-zA-Z0-9_.]+\)"; reports: - "a = '$(a)', b = '$(b)', c = '$(c)' d = '$(d)'"; + "a = '$(a)', b = '$(b)', c = '$(c)' d = '$(d)'"; } diff --git a/examples/definitions.cf b/examples/definitions.cf index ca5e892b32..f82e639441 100644 --- a/examples/definitions.cf +++ b/examples/definitions.cf @@ -1,105 +1,75 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # Testing some variable/class definitions - note scope # # Use browser -f promise_output_agent.html to view -# - body common control - { - bundlesequence => { "mycommon", "assign" }; + bundlesequence => { "mycommon", "assign" }; } ########################################################### - bundle common mycommon - { classes: - - "global_class" expression => "any"; - - "another_global" xor => { "any", "linux", "solaris"}; + "global_class" expression => "any"; + "another_global" xor => { "any", "linux", "solaris" }; } ########################################################### - bundle agent assign - -{ +{ vars: - - "scalar" int => "16k"; - - # "xxx" string => readfile( "/home/mark/tmp/testfile" , "33" ); - - "ran" int => randomint(4,88); + "scalar" int => "16k"; - # "yyy" slist => { readstringlist("/home/mark/tmp/testlist","#[a-zA-Z0-9 ]*","[^a-zA-Z0-9]",15,4000) }; - # "zzz" slist => { readstringlist("/home/mark/tmp/testlist2","#[^\n]*",",",5,4000) }; - # "aaa" ilist => { readintlist("/home/mark/tmp/testilist","#[a-zA-Z0-9 ]*",",",10,4000) }; - - "dim_array" int => readstringarray("array_name","/etc/passwd","#[^\n]*",":",10,4000); + # "xxx" string => readfile( "/home/mark/tmp/testfile" , "33" ); + "ran" int => randomint(4, 88); + # "yyy" slist => { readstringlist("/home/mark/tmp/testlist","#[a-zA-Z0-9 ]*","[^a-zA-Z0-9]",15,4000) }; + # "zzz" slist => { readstringlist("/home/mark/tmp/testlist2","#[^\n]*",",",5,4000) }; + # "aaa" ilist => { readintlist("/home/mark/tmp/testilist","#[a-zA-Z0-9 ]*",",",10,4000) }; + "dim_array" + int => readstringarray( + "array_name", "/etc/passwd", "#[^\n]*", ":", 10, 4000 + ); classes: + # Standard aliasing + "myclass" or => { "solaris", "linux" }; - # Standard aliasing - - "myclass" or => { "solaris", "linux" }; - - # got_array is a class that says whether the read was successful - # array_name[] is the lval - - # Create a distribution - - "my_dist" dist => { "10", "20", "30", "40" }; - - # - # Now like "alerts" in cf2 - # + # got_array is a class that says whether the read was successful + # array_name[] is the lval + # Create a distribution + "my_dist" dist => { "10", "20", "30", "40" }; + # Now like "alerts" in cf2 reports: + "Dimension of passwd array $(dim_array)"; + "Read item from list: $(yyy)"; - "Dimension of passwd array $(dim_array)"; - - "Read item from list: $(yyy)"; - - # Any kind of rule can define classes on exit - - "Read this file: [$(xxx)] ..." - classes => persist("alertclass","20"); - + # Any kind of rule can define classes on exit + "Read this file: [$(xxx)] ..." classes => persist("alertclass", "20"); } ###################################################################### - -body classes persist(class,time) - +body classes persist(class, time) { - promise_repaired => { "$(class)" }; - persist_time => "$(time)"; - timer_policy => "absolute"; + promise_repaired => { "$(class)" }; + persist_time => "$(time)"; + timer_policy => "absolute"; } diff --git a/examples/deletelines.cf b/examples/deletelines.cf index 2d9245a42e..a86c5e741d 100644 --- a/examples/deletelines.cf +++ b/examples/deletelines.cf @@ -1,90 +1,67 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - - body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } - - bundle agent example { files: - - "/tmp/resolv.conf" # test on "/tmp/resolv.conf" # - - create => "true", - edit_line => resolver, + "/tmp/resolv.conf" # test on "/tmp/resolv.conf" # + create => "true", + edit_line => resolver, edit_defaults => def; - } - ####################################################### # For the library ####################################################### - bundle edit_line resolver - { vars: - - "search" slist => { "search iu.hio.no cfengine.com", "nameserver 128.39.89.10" }; + "search" + slist => { "search iu.hio.no cfengine.com", "nameserver 128.39.89.10" }; delete_lines: - - "search.*"; + "search.*"; insert_lines: - - "$(search)" location => end; + "$(search)" location => end; } ####################################################### - body edit_defaults def { - empty_file_before_editing => "false"; - edit_backup => "false"; - max_file_size => "100000"; + empty_file_before_editing => "false"; + edit_backup => "false"; + max_file_size => "100000"; } ######################################################## - body location start - { - # If not line to match, applies to whole text body - before_after => "before"; + # If not line to match, applies to whole text body + before_after => "before"; } ######################################################## - body location end - { - # If not line to match, applies to whole text body - before_after => "after"; + # If not line to match, applies to whole text body + before_after => "after"; } diff --git a/examples/depends_on.cf b/examples/depends_on.cf index aaaec1f03a..6ed05d5639 100644 --- a/examples/depends_on.cf +++ b/examples/depends_on.cf @@ -1,18 +1,11 @@ - - body common control { - bundlesequence => { "one" }; + bundlesequence => { "one" }; } bundle agent one { reports: - - "two" - depends_on => { "handle_one" }; - - "one" - handle => "handle_one"; - + "two" depends_on => { "handle_one" }; + "one" handle => "handle_one"; } diff --git a/examples/depends_on2.cf b/examples/depends_on2.cf index d276e530b3..70ddbb8cb6 100644 --- a/examples/depends_on2.cf +++ b/examples/depends_on2.cf @@ -1,50 +1,36 @@ - - body common control { - bundlesequence => { "main" }; + bundlesequence => { "main" }; } bundle agent main { methods: - - "any" usebundle => one; - - "any" usebundle => mars:two; - + "any" usebundle => one; + "any" usebundle => mars:two; } bundle agent one { reports: - - "two" - depends_on => { "handle_one" }; - - "one" - handle => "handle_one"; - + "two" depends_on => { "handle_one" }; + "one" handle => "handle_one"; } body file control { - namespace => "mars"; + namespace => "mars"; } - bundle agent two { reports: - - "marstwo" + "marstwo" handle => "mars_two", depends_on => { "handle_one" }; - # Currently bugged -> CFE-3206 - # "marsone" - # handle => "handle_one"; - - "marsthree" - depends_on => { "default.handle_one", "mars_two" }; + # Currently bugged -> CFE-3206 + # "marsone" + # handle => "handle_one"; + "marsthree" depends_on => { "default.handle_one", "mars_two" }; } diff --git a/examples/difference.cf b/examples/difference.cf index 792ab3a9ea..bfd6420f04 100644 --- a/examples/difference.cf +++ b/examples/difference.cf @@ -1,58 +1,55 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test { vars: - "a" slist => { 1,2,3,"x" }; - "b" slist => { "x" }; + "a" slist => { 1, 2, 3, "x" }; + "b" slist => { "x" }; - # normal usage - "diff_between_a_and_b" slist => difference(a, b); - "diff_between_a_and_b_str" string => join(",", diff_between_a_and_b); + # normal usage + "diff_between_a_and_b" slist => difference(a, b); + "diff_between_a_and_b_str" string => join(",", diff_between_a_and_b); - # NOTE: advanced usage! - "mylist1" slist => { "a", "b" }; - "mylist2" slist => { "a", "b" }; - "$(mylist1)_str" string => join(",", $(mylist1)); + # NOTE: advanced usage! + "mylist1" slist => { "a", "b" }; + "mylist2" slist => { "a", "b" }; + "$(mylist1)_str" string => join(",", $(mylist1)); - # Here we're going to really call difference(a,a) then difference(a,b) then difference(b,a) then difference(b,b) - # We create a new variable for each difference!!! - "diff_$(mylist1)_$(mylist2)" slist => difference($(mylist1), $(mylist2)); - "diff_$(mylist1)_$(mylist2)_str" string => join(",", "diff_$(mylist1)_$(mylist2)"); + # Here we're going to really call difference(a,a) then difference(a,b) then difference(b,a) then difference(b,b) + # We create a new variable for each difference!!! + "diff_$(mylist1)_$(mylist2)" slist => difference($(mylist1), $(mylist2)); + + "diff_$(mylist1)_$(mylist2)_str" + string => join(",", "diff_$(mylist1)_$(mylist2)"); reports: - # normal usage - "The difference between lists a and b is '$(diff_between_a_and_b_str)'"; + # normal usage + "The difference between lists a and b is '$(diff_between_a_and_b_str)'"; - # NOTE: advanced usage results! - "The difference of list '$($(mylist1)_str)' with '$($(mylist2)_str)' is '$(diff_$(mylist1)_$(mylist2)_str)'"; + # NOTE: advanced usage results! + "The difference of list '$($(mylist1)_str)' with '$($(mylist2)_str)' is '$(diff_$(mylist1)_$(mylist2)_str)'"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/dirname.cf b/examples/dirname.cf index 2c7f3a29e1..9418033f8e 100644 --- a/examples/dirname.cf +++ b/examples/dirname.cf @@ -1,38 +1,34 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - "apache_dir" string => dirname("/etc/apache2/httpd.conf"); + "apache_dir" string => dirname("/etc/apache2/httpd.conf"); + reports: - "apache conf dir = $(apache_dir)"; + "apache conf dir = $(apache_dir)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/disable.cf b/examples/disable.cf index ed54193ad5..a91c0e220e 100644 --- a/examples/disable.cf +++ b/examples/disable.cf @@ -1,42 +1,28 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - body common control { - bundlesequence => { "my_disable" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "my_disable" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } bundle agent my_disable { - files: - - "/home/mark/tmp/test_create" - rename => disable; - - "/home/mark/tmp/rotate_my_log" - rename => rotate("4"); - + "/home/mark/tmp/test_create" rename => disable; + "/home/mark/tmp/rotate_my_log" rename => rotate("4"); } - - diff --git a/examples/disable_and_rotate_files.cf b/examples/disable_and_rotate_files.cf index 1220fe4745..8999a59bb9 100644 --- a/examples/disable_and_rotate_files.cf +++ b/examples/disable_and_rotate_files.cf @@ -1,68 +1,49 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ####################################################### # # Disabling / rotating files # ####################################################### - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } - ############################################ - bundle agent example - { files: - - "/home/mark/tmp/test_create" - + "/home/mark/tmp/test_create" comment => "this rule does something", rename => disable; - "/home/mark/tmp/rotateme" - - rename => rotate("4"); + "/home/mark/tmp/rotateme" rename => rotate("4"); } ############################################ - body rename disable - { - disable => "true"; - disable_suffix => "_blownaway"; + disable => "true"; + disable_suffix => "_blownaway"; } ############################################ - body rename rotate(level) - { - rotate => "$(level)"; + rotate => "$(level)"; } diff --git a/examples/diskfree.cf b/examples/diskfree.cf index 7660d3b878..515a277f80 100644 --- a/examples/diskfree.cf +++ b/examples/diskfree.cf @@ -1,45 +1,41 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { classes: - "has_space" expression => isgreaterthan($(free), 0); + "has_space" expression => isgreaterthan($(free), 0); vars: - "free" int => diskfree("/tmp"); + "free" int => diskfree("/tmp"); reports: has_space:: "The filesystem has free space"; + !has_space:: "The filesystem has NO free space"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/dollar.cf b/examples/dollar.cf index 328edeabe9..5ce873958b 100644 --- a/examples/dollar.cf +++ b/examples/dollar.cf @@ -1,49 +1,32 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################################### - bundle agent example - -{ +{ classes: - - "some" expression => "any"; + "some" expression => "any"; reports: - some:: - "The value of $(const.dollar)(const.dollar) is $(const.dollar)"; - "But the value of \$(dollar) is \$(dollar)"; - } - diff --git a/examples/edit.empty_before_use.cf b/examples/edit.empty_before_use.cf index fa74032b2f..68493991b9 100644 --- a/examples/edit.empty_before_use.cf +++ b/examples/edit.empty_before_use.cf @@ -2,48 +2,52 @@ bundle agent __main__ { files: + "/tmp/example-edit.empty_before_use.one" create => "true"; + "/tmp/example-edit.empty_before_use.two" create => "true"; - "/tmp/example-edit.empty_before_use.one" create => "true"; - "/tmp/example-edit.empty_before_use.two" create => "true"; - - "/tmp/example-edit.empty_before_use.one" - edit_line => show_edit_empty_before_use, - edit_defaults => my_empty_file_before_editing; - - "/tmp/example-edit.empty_before_use.two" - edit_line => show_edit_empty_before_use; + "/tmp/example-edit.empty_before_use.one" + edit_line => show_edit_empty_before_use, + edit_defaults => my_empty_file_before_editing; + "/tmp/example-edit.empty_before_use.two" + edit_line => show_edit_empty_before_use; } bundle edit_line show_edit_empty_before_use { reports: - "$(with)" - with => concat( "The promise to edit '$(edit.filename)' was ", - "instructed to ignore any pre-existing content." ), - if => strcmp( "true", "$(edit.empty_before_use)"); - - "$(with)" - with => concat( "The promise to edit '$(edit.filename)' was ", - "not instructed to ignore any pre-existing content."), - if => strcmp( "false", "$(edit.empty_before_use)"); - - "$(with)" - with => concat ( "This version of CFEngine does not know if the", - "edit operation is expected to ignore pre-existing ", - "content the variable 'edit.empty_before_use' does ", - "not exist"), - unless => isvariable ( "edit.empty_before_use" ); - + "$(with)" + with => concat( + "The promise to edit '$(edit.filename)' was ", + "instructed to ignore any pre-existing content." + ), + if => strcmp("true", "$(edit.empty_before_use)"); + + "$(with)" + with => concat( + "The promise to edit '$(edit.filename)' was ", + "not instructed to ignore any pre-existing content." + ), + if => strcmp("false", "$(edit.empty_before_use)"); + + "$(with)" + with => concat( + "This version of CFEngine does not know if the", + "edit operation is expected to ignore pre-existing ", + "content the variable 'edit.empty_before_use' does ", + "not exist" + ), + unless => isvariable("edit.empty_before_use"); } body edit_defaults my_empty_file_before_editing { - empty_file_before_editing => "true"; # The variable - # edit.empty_before_use allows this - # to be known from within an - # edit_line bundle. + empty_file_before_editing => "true"; # The variable + # edit.empty_before_use allows this + # to be known from within an + # edit_line bundle. } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/edit.filename.cf b/examples/edit.filename.cf index d98eec5e18..05fb3509b8 100644 --- a/examples/edit.filename.cf +++ b/examples/edit.filename.cf @@ -2,49 +2,50 @@ bundle agent __main__ { files: - - "/tmp/example-edit.filename.txt" content => "Hello World!"; - - "/tmp/example-edit.filename.txt" - edit_line => show_edit_filename; - + "/tmp/example-edit.filename.txt" content => "Hello World!"; + "/tmp/example-edit.filename.txt" edit_line => show_edit_filename; } bundle edit_line show_edit_filename { reports: - "$(with)" - with => concat( "I found the string 'World' in the file being ", - "edited ('$(edit.filename)')"), - if => strcmp( "false", "$(edit.empty_before_use)"); # It's probably - # useless to probe - # the content of the - # file if you are - # ignoring - # pre-existing - # content. - - "$(with)" - with => concat( "It's probably not very useful to inspect content", - "that is being thrown away." ), - if => strcmp( "true", "$(edit.empty_before_use)"); - - "$(with)" - with => concat ( "This version of CFEngine does not know if the", - "edit operation is expected to ignore pre-existing ", - "content the variable 'edit.empty_before_use' does ", - "not exist"), - unless => isvariable ( "edit.empty_before_use" ); - + "$(with)" + with => concat( + "I found the string 'World' in the file being ", + "edited ('$(edit.filename)')" + ), + if => strcmp("false", "$(edit.empty_before_use)"); # It's probably + # useless to probe + # the content of the + # file if you are + # ignoring + # pre-existing + # content. + "$(with)" + with => concat( + "It's probably not very useful to inspect content", + "that is being thrown away." + ), + if => strcmp("true", "$(edit.empty_before_use)"); + + "$(with)" + with => concat( + "This version of CFEngine does not know if the", + "edit operation is expected to ignore pre-existing ", + "content the variable 'edit.empty_before_use' does ", + "not exist" + ), + unless => isvariable("edit.empty_before_use"); } body edit_defaults my_empty_file_before_editing { - empty_file_before_editing => "true"; # The variable - # edit.empty_before_use allows this - # to be known from within an - # edit_line bundle. + empty_file_before_editing => "true"; # The variable + # edit.empty_before_use allows this + # to be known from within an + # edit_line bundle. } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/edit_column_files.cf b/examples/edit_column_files.cf index 7fc167bd8c..814498d970 100644 --- a/examples/edit_column_files.cf +++ b/examples/edit_column_files.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ###################################################################### # # File editing @@ -30,84 +24,60 @@ # - insert # ###################################################################### - - body common control - { - version => "1.2.3"; - bundlesequence => { "bun" }; + version => "1.2.3"; + bundlesequence => { "bun" }; } ######################################################## - bundle agent bun - { vars: - - "userset" slist => { "one", "two", "three" }; + "userset" slist => { "one", "two", "three" }; files: - - # Make a copy of the password file - - "/home/mark/tmp/passwd" - - create => "true", - edit_line => set_user_field("mark","6","/home/dir"); - - "/home/mark/tmp/group" - - create => "true", - edit_line => append_user_field("wheel","4","@(bun.userset)"); - + # Make a copy of the password file + "/home/mark/tmp/passwd" + create => "true", + edit_line => set_user_field("mark", "6", "/home/dir"); + + "/home/mark/tmp/group" + create => "true", + edit_line => append_user_field("wheel", "4", "@(bun.userset)"); } ######################################################## - -bundle edit_line set_user_field(user,field,val) +bundle edit_line set_user_field(user, field, val) { field_edits: - - "$(user).*" - + "$(user).*" # Set field of the file to parameter - - edit_field => col(":","$(field)","$(val)","set"); + edit_field => col(":", "$(field)", "$(val)", "set"); } ######################################################## - -bundle edit_line append_user_field(user,field,allusers) +bundle edit_line append_user_field(user, field, allusers) { vars: - - "val" slist => { @(allusers) }; + "val" slist => { @(allusers) }; field_edits: - - "$(user).*" - + "$(user).*" # Set field of the file to parameter - - edit_field => col(":","$(field)","$(val)","alphanum"); - + edit_field => col(":", "$(field)", "$(val)", "alphanum"); } ######################################## # Bodies ######################################## - -body edit_field col(split,col,newval,method) - +body edit_field 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"; } - diff --git a/examples/edit_comment_lines.cf b/examples/edit_comment_lines.cf index 7d441e4a6c..f608b97a7c 100644 --- a/examples/edit_comment_lines.cf +++ b/examples/edit_comment_lines.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ###################################################################### # # File editing @@ -30,65 +24,46 @@ # - insert # ###################################################################### - - body common control - { - version => "1.2.3"; - bundlesequence => { "example" }; + version => "1.2.3"; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { - files: - - "/home/mark/tmp/cf3_test" - - create => "true", + "/home/mark/tmp/cf3_test" + create => "true", edit_line => myedit("second"); } ######################################################## - bundle edit_line myedit(parameter) { vars: + "edit_variable" string => "private edit variable is $(parameter)"; - "edit_variable" string => "private edit variable is $(parameter)"; - - replace_patterns: - - # replace shell comments with C comments - - "#(.*)" - + # replace shell comments with C comments + "#(.*)" replace_with => C_comment, select_region => MySection("New section"); - } ######################################## # Bodies ######################################## - body replace_with C_comment - { - replace_value => "/* $(match.1) */"; # backreference 0 - occurrences => "all"; # first, last all + replace_value => "/* $(match.1) */"; # backreference 0 + occurrences => "all"; # first, last all } ######################################################## - body select_region MySection(x) - { - select_start => "\[$(x)\]"; - select_end => "\[.*\]"; + select_start => "\[$(x)\]"; + select_end => "\[.*\]"; } diff --git a/examples/edit_deletenotmatch.cf b/examples/edit_deletenotmatch.cf index a9af940657..a21390f2e8 100644 --- a/examples/edit_deletenotmatch.cf +++ b/examples/edit_deletenotmatch.cf @@ -1,31 +1,24 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test editfile # ######################################################## - # # This assumes a file format like: # @@ -36,34 +29,23 @@ # [section 2] # # lines... etc - - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { files: - - "/tmp/passwd_excerpt" - - create => "true", + "/tmp/passwd_excerpt" + create => "true", edit_line => MarkNRoot; } ######################################################## - bundle edit_line MarkNRoot { delete_lines: - - "mark.*|root.*" not_matching => "true"; - + "mark.*|root.*" not_matching => "true"; } - diff --git a/examples/edit_insert_fuzzylines.cf b/examples/edit_insert_fuzzylines.cf index 4fb55e2058..374a3a7315 100644 --- a/examples/edit_insert_fuzzylines.cf +++ b/examples/edit_insert_fuzzylines.cf @@ -1,78 +1,53 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - ####################################################### # # Insert a number of lines with vague whitespace # ####################################################### - body common control - { - any:: - - bundlesequence => { "insert" }; + any:: + bundlesequence => { "insert" }; } - ####################################################### - bundle agent insert - { vars: + "v" string => " One potato"; - "v" string => " One potato"; - files: - - "/tmp/test_insert" - + "/tmp/test_insert" create => "true", edit_line => Insert("$(insert.v)"); - } ####################################################### # For the library ####################################################### - bundle edit_line Insert(name) - { insert_lines: - - " $(name)" - - whitespace_policy => { "ignore_leading", "ignore_embedded" }; - + " $(name)" whitespace_policy => { "ignore_leading", "ignore_embedded" }; } ####################################################### - body edit_defaults empty - { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } diff --git a/examples/edit_insert_lines.cf b/examples/edit_insert_lines.cf index e0bf3b9bd0..385b297b5e 100644 --- a/examples/edit_insert_lines.cf +++ b/examples/edit_insert_lines.cf @@ -1,82 +1,60 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - ####################################################### # # Insert a number of lines # ####################################################### - body common control - { - any:: - - bundlesequence => { "insert" }; + any:: + bundlesequence => { "insert" }; } - ####################################################### - bundle agent insert - { vars: - - "v" string => " + "v" + string => " One potato Two potato Three potatoe Four "; - - files: - - "/tmp/test_insert" + files: + "/tmp/test_insert" create => "true", edit_line => Insert("$(insert.v)"), edit_defaults => empty; - } ####################################################### # For the library ####################################################### - bundle edit_line Insert(name) - { insert_lines: - - "Begin$(const.n)$(name)$(const.n)End"; - + "Begin$(const.n)$(name)$(const.n)End"; } ####################################################### - body edit_defaults empty - { - empty_file_before_editing => "false"; + empty_file_before_editing => "false"; } diff --git a/examples/edit_insert_lines_silly.cf b/examples/edit_insert_lines_silly.cf index d86ef4a795..a2188686e5 100644 --- a/examples/edit_insert_lines_silly.cf +++ b/examples/edit_insert_lines_silly.cf @@ -1,82 +1,55 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - ####################################################### # # Insert a number of lines # ####################################################### - body common control - { - any:: - - bundlesequence => { "insert" }; + any:: + bundlesequence => { "insert" }; } - ####################################################### - bundle agent insert - { vars: + "v" slist => { "One potato", "Two potato", "Three potatoe", "Four" }; - "v" slist => { - "One potato", - "Two potato", - "Three potatoe", - "Four" - }; - files: - - "/tmp/test_insert" - + "/tmp/test_insert" create => "true", edit_line => Insert("@(insert.v)"); - # edit_defaults => empty; + # edit_defaults => empty; } ####################################################### # For the library ####################################################### - bundle edit_line Insert(name) - { insert_lines: - - "$(name)"; - + "$(name)"; } ####################################################### - body edit_defaults empty - { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } diff --git a/examples/edit_passwd_file.cf b/examples/edit_passwd_file.cf index bc25760727..11245dfaba 100644 --- a/examples/edit_passwd_file.cf +++ b/examples/edit_passwd_file.cf @@ -1,91 +1,62 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "addpasswd" }; + bundlesequence => { "addpasswd" }; } bundle agent addpasswd { vars: - - # want to set these values by the names of their array keys - - "pwd[mark]" string => "mark:x:1000:100:Mark Burgess:/home/mark:/bin/bash"; - "pwd[fred]" string => "fred:x:1001:100:Right Said:/home/fred:/bin/bash"; - "pwd[jane]" string => "jane:x:1002:100:Jane Doe:/home/jane:/bin/bash"; + # want to set these values by the names of their array keys + "pwd[mark]" string => "mark:x:1000:100:Mark Burgess:/home/mark:/bin/bash"; + "pwd[fred]" string => "fred:x:1001:100:Right Said:/home/fred:/bin/bash"; + "pwd[jane]" string => "jane:x:1002:100:Jane Doe:/home/jane:/bin/bash"; files: - - - "/tmp/passwd" - + "/tmp/passwd" create => "true", edit_line => append_users_starting("addpasswd.pwd"); - } ############################################################ # Library stuff ############################################################ - bundle edit_line append_users_starting(v) - { vars: - - "index" slist => getindices("$(v)"); + "index" slist => getindices("$(v)"); classes: - - "add_$(index)" not => userexists("$(index)"); + "add_$(index)" not => userexists("$(index)"); insert_lines: - - "$($(v)[$(index)])" - - if => "add_$(index)"; - + "$($(v)[$(index)])" if => "add_$(index)"; } ############################################################ - bundle edit_line append_groups_starting(v) - { vars: - - "index" slist => getindices("$(v)"); + "index" slist => getindices("$(v)"); classes: - - "add_$(index)" not => groupexists("$(index)"); + "add_$(index)" not => groupexists("$(index)"); insert_lines: - - "$($(v)[$(index)])" - - if => "add_$(index)"; - + "$($(v)[$(index)])" if => "add_$(index)"; } diff --git a/examples/edit_passwd_file_basic.cf b/examples/edit_passwd_file_basic.cf index d6c105efe3..3c482c3aa3 100644 --- a/examples/edit_passwd_file_basic.cf +++ b/examples/edit_passwd_file_basic.cf @@ -1,49 +1,31 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "edit_passwd" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "edit_passwd" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } bundle agent edit_passwd { - vars: - - "userset" slist => { "user1", "user2", "user3" }; + "userset" slist => { "user1", "user2", "user3" }; files: - - "/etc/passwd" - edit_line => - set_user_field("mark","7","/set/this/shell"); - - - "/etc/group" - edit_line => - append_user_field("root","4","@(main.userset)"); - + "/etc/passwd" edit_line => set_user_field("mark", "7", "/set/this/shell"); + "/etc/group" edit_line => append_user_field("root", "4", "@(main.userset)"); } - diff --git a/examples/edit_replace_string.cf b/examples/edit_replace_string.cf index 17e5c93152..a15b65e072 100644 --- a/examples/edit_replace_string.cf +++ b/examples/edit_replace_string.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ###################################################################### # # File editing @@ -30,65 +24,44 @@ # - insert # ###################################################################### - - body common control - { - version => "1.2.3"; - bundlesequence => { "example" }; + version => "1.2.3"; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { - files: - - "/tmp/replacestring" - - create => "true", + "/tmp/replacestring" + create => "true", edit_line => myedit("second"); } ######################################################## - bundle edit_line myedit(parameter) { vars: + "edit_variable" string => "private edit variable is $(parameter)"; - "edit_variable" string => "private edit variable is $(parameter)"; - - replace_patterns: - - # replace shell comments with C comments - - "puppet" - - replace_with => With("cfengine 3"); - + # replace shell comments with C comments + "puppet" replace_with => With("cfengine 3"); } ######################################## # Bodies ######################################## - body replace_with With(x) - { - replace_value => "$(x)"; - occurrences => "first"; + replace_value => "$(x)"; + occurrences => "first"; } ######################################## - body select_region MySection(x) - { - select_start => "\[$(x)\]"; - select_end => "\[.*\]"; + select_start => "\[$(x)\]"; + select_end => "\[.*\]"; } - diff --git a/examples/edit_sectioned_file.cf b/examples/edit_sectioned_file.cf index ec38265a0e..176a1ae6a5 100644 --- a/examples/edit_sectioned_file.cf +++ b/examples/edit_sectioned_file.cf @@ -1,31 +1,24 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test editfile # ######################################################## - # # This assumes a file format like: # @@ -36,86 +29,64 @@ # [section 2] # # lines... etc - - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { vars: - - "v1" string => "numerical backreference"; + "v1" string => "numerical backreference"; files: - - "/home/mark/tmp/cf3_test" - - create => "true", - edit_line => AppendIfNoLine("cfengine tcp 5308","second"); - - + "/home/mark/tmp/cf3_test" + create => "true", + edit_line => AppendIfNoLine("cfengine tcp 5308", "second"); } ######################################################## - -bundle edit_line AppendIfNoLine(parameter,two) +bundle edit_line AppendIfNoLine(parameter, two) { vars: - - "list" slist => { "1", "2", "3" }; + "list" slist => { "1", "2", "3" }; insert_lines: + "$(parameter) and $(two)-$(list)" location => append; + "NEW Special-insert!!!" select_region => MySection("New section"); + "set variable = value" select_region => MySection("New section"); - "$(parameter) and $(two)-$(list)" location => append; - - "NEW Special-insert!!!" select_region => MySection("New section"); - "set variable = value" select_region => MySection("New section"); - - - "/home/mark/tmp/insert" insert_type => "file", + "/home/mark/tmp/insert" + insert_type => "file", expand_scalars => "true", select_region => MySection("New section"); delete_lines: - # "l.*"; - # "NEW.*" select_region => MySection("New section"); - - # Delete LinesStarting in file - + # "l.*"; + # "NEW.*" select_region => MySection("New section"); + # Delete LinesStarting in file } ######################################################## - body location append - { - # If not line to match, applies to whole text body - before_after => "after"; + # If not line to match, applies to whole text body + before_after => "after"; } ######################################################## - body location after(x) - { - # If not line to match, applies to whole text body - #select_line_matching => "$(x)"; - before_after => "after"; + # If not line to match, applies to whole text body + #select_line_matching => "$(x)"; + before_after => "after"; } ######################################################## - body select_region MySection(x) - { - select_start => "\[$(x)\]"; - select_end => "\[.*\]"; + select_start => "\[$(x)\]"; + select_end => "\[.*\]"; } diff --git a/examples/edit_setvar.cf b/examples/edit_setvar.cf index c7e21da9fd..650f1574de 100644 --- a/examples/edit_setvar.cf +++ b/examples/edit_setvar.cf @@ -1,74 +1,51 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ####################################################### # # Edit variable = value in a text file # ####################################################### - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } - ####################################################### - bundle agent example - { vars: - - "v[variable_1]" string => "value_1"; - "v[variable_2]" string => "value_2"; + "v[variable_1]" string => "value_1"; + "v[variable_2]" string => "value_2"; files: - - "/tmp/test_setvar" - - edit_line => setvars_v1("testsetvar.v"); - + "/tmp/test_setvar" edit_line => setvars_v1("testsetvar.v"); } ####################################################### # For the library ####################################################### - bundle edit_line setvars_v1(contexted_array_name) - { vars: + "parameter_name" slist => getindices("$(contexted_array_name)"); - "parameter_name" slist => getindices("$(contexted_array_name)"); - - delete_lines: - - "$(parameter_name).*"; + delete_lines: + "$(parameter_name).*"; insert_lines: - - "$(parameter_name) = $($(contexted_array_name)[$(parameter_name)])"; - + "$(parameter_name) = $($(contexted_array_name)[$(parameter_name)])"; } - diff --git a/examples/edit_template.cf b/examples/edit_template.cf index e08bca448b..4251e97f00 100644 --- a/examples/edit_template.cf +++ b/examples/edit_template.cf @@ -1,21 +1,16 @@ - body common control { - bundlesequence => { "main" }; + bundlesequence => { "main" }; } bundle agent main { vars: - - "here" string => "/home/a10004/LapTop/cfengine/core/examples"; - - "list" slist => { "one", "two", "three" }; + "here" string => "/home/a10004/LapTop/cfengine/core/examples"; + "list" slist => { "one", "two", "three" }; files: - - "/tmp/output" - + "/tmp/output" create => "true", edit_template => "$(here)/input.edittemplate"; } diff --git a/examples/edit_triggerclass.cf b/examples/edit_triggerclass.cf index d53486db39..5bbc0d184c 100644 --- a/examples/edit_triggerclass.cf +++ b/examples/edit_triggerclass.cf @@ -1,102 +1,74 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - ####################################################### # # Insert a number of lines and trigger a followup if edited # ####################################################### - body common control - { - any:: - - bundlesequence => { "insert" }; + any:: + bundlesequence => { "insert" }; } - ####################################################### - bundle agent insert - { vars: - - "v" string => " + "v" + string => " One potato Two potato Three potahto Four "; - - files: - - "/tmp/test_insert" + files: + "/tmp/test_insert" edit_line => Insert("$(insert.v)"), edit_defaults => empty, classes => trigger("edited"); commands: - edited:: - "/bin/echo make bananas"; reports: - edited:: - "The potatoes are bananas"; - } ####################################################### # For the library ####################################################### - bundle edit_line Insert(name) - { insert_lines: - - "Begin$(const.n) $(name)$(const.n)End"; - + "Begin$(const.n) $(name)$(const.n)End"; } ####################################################### - body edit_defaults empty - { - empty_file_before_editing => "true"; + empty_file_before_editing => "true"; } ####################################################### - body classes trigger(x) - { - promise_repaired => { "$(x)" }; + promise_repaired => { "$(x)" }; } diff --git a/examples/edit_xml.cf b/examples/edit_xml.cf index 611a736595..cf2209a0cb 100644 --- a/examples/edit_xml.cf +++ b/examples/edit_xml.cf @@ -1,89 +1,87 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ############################################################################### #+begin_src cfengine3 # for more info: http://cfengine.com/docs/master/reference-promise-types-edit_xml.html - body common control { - bundlesequence => { run }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { run }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } bundle agent run { vars: - "file" string => "$(this.promise_filename).txt"; + "file" string => "$(this.promise_filename).txt"; + methods: - "rm" usebundle => rmxml; - "make" usebundle => makexml; - "use" usebundle => maintainxml; - "report" usebundle => reportxml; + "rm" usebundle => rmxml; + "make" usebundle => makexml; + "use" usebundle => maintainxml; + "report" usebundle => reportxml; } bundle agent rmxml { files: - "$(run.file)" delete => tidy; + "$(run.file)" delete => tidy; } bundle agent makexml { files: - "$(run.file)" + "$(run.file)" comment => "Create xml file", create => "true", edit_defaults => empty, - edit_xml => xml_insert_tree_nopath('cfe_alias'); + edit_xml => xml_insert_tree_nopath( + 'cfe_alias' + ); } bundle agent reportxml { vars: - "data" string => readfile($(run.file), 4k); + "data" string => readfile($(run.file), 4k); + reports: - "Final XML is $(data)"; -# R: Final XML is -# newhosttextnewalias + "Final XML is $(data)"; + # R: Final XML is + # newhosttextnewalias } bundle agent maintainxml { files: - "$(run.file)" + "$(run.file)" comment => "Maintain xml file: set the Alias node", create => "false", - edit_xml => xml_set_value("newalias","/Host/Alias"); + edit_xml => xml_set_value("newalias", "/Host/Alias"); - "$(run.file)" + "$(run.file)" comment => "Maintain xml file: replace a Host node with a name attribute = cfe_host", create => "false", - edit_xml => xml_set_value("newhosttext","/Host[@name='cfe_host']"); + edit_xml => xml_set_value("newhosttext", "/Host[@name='cfe_host']"); - "$(run.file)" + "$(run.file)" comment => "Maintain xml file: replace a Host node's name attribute", create => "false", edit_xml => xml_set_attribute("name", "newhostname", "/Host"); } + #+end_src diff --git a/examples/ensure_line_present_prepend_append.cf b/examples/ensure_line_present_prepend_append.cf index 75005cee03..2d260ffb7a 100644 --- a/examples/ensure_line_present_prepend_append.cf +++ b/examples/ensure_line_present_prepend_append.cf @@ -1,41 +1,39 @@ # Note that this example assumes that the masterfiles policy framework is installed # in inputs in your user's working directory (e.g. /var/cfengine/inputs for root). - #+begin_src cfengine3 body common control { - bundlesequence => { "line_prepend", "line_append" , "output" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "line_prepend", "line_append", "output" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } - bundle agent line_prepend { files: - "/tmp/test_line_prepend" - edit_line => prepend_if_no_line("I am the first line"), - create => "true"; + "/tmp/test_line_prepend" + edit_line => prepend_if_no_line("I am the first line"), + create => "true"; } - bundle agent line_append { files: - "/tmp/test_line_append" - edit_line => append_if_no_line("I am the last line"), - create => "true"; + "/tmp/test_line_append" + edit_line => append_if_no_line("I am the last line"), + create => "true"; } bundle agent output { vars: - "prepend_file" string => readfile("/tmp/test_line_prepend", 1000); - "append_file" string => readfile("/tmp/test_line_append", 1000); + "prepend_file" string => readfile("/tmp/test_line_prepend", 1000); + "append_file" string => readfile("/tmp/test_line_append", 1000); reports: - "Contents of /tmp/test_line_prepend:"; - "$(prepend_file)"; - "Contents of /tmp/test_line_append:"; - "$(append_file)"; + "Contents of /tmp/test_line_prepend:"; + "$(prepend_file)"; + "Contents of /tmp/test_line_append:"; + "$(append_file)"; } + #+end_src diff --git a/examples/env.cf b/examples/env.cf index 111bafc5a9..dfe933c063 100644 --- a/examples/env.cf +++ b/examples/env.cf @@ -1,17 +1,15 @@ - body common control { - bundlesequence => { "one" }; + bundlesequence => { "one" }; } body agent control { - environment => { "A=123", "B=456", "PGK_PATH=/tmp"}; + environment => { "A=123", "B=456", "PGK_PATH=/tmp" }; } bundle agent one { commands: - - "/usr/bin/env"; + "/usr/bin/env"; } diff --git a/examples/epimenides.cf b/examples/epimenides.cf index 7503e871d1..c4042f0ff7 100644 --- a/examples/epimenides.cf +++ b/examples/epimenides.cf @@ -1,39 +1,30 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "g" }; + bundlesequence => { "g" }; } bundle common g { vars: - - "head" string => "Swallow my ${tail}"; - "tail" string => "behind my "; + "head" string => "Swallow my ${tail}"; + "tail" string => "behind my "; reports: - - "Go $(head)"; + "Go $(head)"; } diff --git a/examples/escape.cf b/examples/escape.cf index 2ff234e723..8a15b0bc42 100644 --- a/examples/escape.cf +++ b/examples/escape.cf @@ -1,39 +1,33 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - "ip" string => "10.123.321.250"; - "escaped" string => escape($(ip)); + "ip" string => "10.123.321.250"; + "escaped" string => escape($(ip)); reports: - "escaped $(ip) = $(escaped)"; + "escaped $(ip) = $(escaped)"; } #+end_src diff --git a/examples/eval.cf b/examples/eval.cf index b537d1fdf9..ae0b8e7b1e 100644 --- a/examples/eval.cf +++ b/examples/eval.cf @@ -1,46 +1,48 @@ #+begin_src cfengine3 body common control { - bundlesequence => { run }; + bundlesequence => { run }; } + body agent control { - inform => "true"; + inform => "true"; } + bundle agent run { vars: - "values[0]" string => "x"; # bad - "values[1]" string => "+ 200"; # bad - "values[2]" string => "200 + 100"; - "values[3]" string => "200 - 100"; - "values[4]" string => "- - -"; # bad - "values[5]" string => "2 + 3 - 1"; - "values[6]" string => ""; # 0 - "values[7]" string => "3 / 0"; # inf but not an error - "values[8]" string => "3^3"; - # "values[9]" string => "-1^2.1"; # 'nan' or '-nan' (on some platforms) - "values[10]" string => "sin(20)"; - "values[11]" string => "cos(20)"; - "values[19]" string => "20 % 3"; # remainder - "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 => "e"; - "values[27]" string => "pi"; - "values[28]" string => "100m"; # 100 million - "values[29]" string => "100k"; # 100 thousand + "values[0]" string => "x"; # bad + "values[1]" string => "+ 200"; # bad + "values[2]" string => "200 + 100"; + "values[3]" string => "200 - 100"; + "values[4]" string => "- - -"; # bad + "values[5]" string => "2 + 3 - 1"; + "values[6]" string => ""; # 0 + "values[7]" string => "3 / 0"; # inf but not an error + "values[8]" string => "3^3"; - "indices" slist => sort( getindices("values"), int); - - "eval[$(indices)]" string => eval("$(values[$(indices)])", "math", "infix"); + # "values[9]" string => "-1^2.1"; # 'nan' or '-nan' (on some platforms) + "values[10]" string => "sin(20)"; + "values[11]" string => "cos(20)"; + "values[19]" string => "20 % 3"; # remainder + "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 => "e"; + "values[27]" string => "pi"; + "values[28]" string => "100m"; # 100 million + "values[29]" string => "100k"; # 100 thousand + "indices" slist => sort(getindices("values"), int); + "eval[$(indices)]" string => eval("$(values[$(indices)])", "math", "infix"); reports: - "math/infix eval('$(values[$(indices)])') = '$(eval[$(indices)])'"; + "math/infix eval('$(values[$(indices)])') = '$(eval[$(indices)])'"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/every.cf b/examples/every.cf index 58e9c50cf6..56a6db3bb4 100644 --- a/examples/every.cf +++ b/examples/every.cf @@ -1,88 +1,103 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test - { classes: - "every_dot_star" expression => every(".*", test); - "every_dot" expression => every(".", test); - "every_number" expression => every("[0-9]", test); - - "every2_dot_star" expression => every(".*", test2); - "every2_dot" expression => every(".", test2); - "every2_number" expression => every("[0-9]", test2); + "every_dot_star" expression => every(".*", test); + "every_dot" expression => every(".", test); + "every_number" expression => every("[0-9]", test); + "every2_dot_star" expression => every(".*", test2); + "every2_dot" expression => every(".", test2); + "every2_number" expression => every("[0-9]", test2); 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", }; - "test2" data => parsejson('[1,2,3, + "test2" + data => parsejson( + '[1,2,3, "one", "two", "three", "long string", "four", "fix", "six", - "one", "two", "three",]'); + "one", "two", "three",]' + ); reports: - "The test list is $(test)"; + "The test list is $(test)"; every_dot_star:: "every() test passed: every element matches '.*'"; + !every_dot_star:: "every() test failed: not every element matches '.*'"; + every_number:: "every() test failed: every element matches '[0-9]'"; + !every_number:: "every() test passed: not every element matches '[0-9]'"; + every_dot:: "every() test failed: every element matches '.'"; + !every_dot:: "every() test passed: not every element matches '.'"; - "The test2 list is $(test2)"; + every2_dot_star:: "every() test2 passed: every element matches '.*'"; + !every2_dot_star:: "every() test2 failed: not every element matches '.*'"; + every2_number:: "every() test2 failed: every element matches '[0-9]'"; + !every2_number:: "every() test2 passed: not every element matches '[0-9]'"; + every2_dot:: "every() test2 failed: every element matches '.'"; + !every2_dot:: "every() test2 passed: not every element matches '.'"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/exec_args.cf b/examples/exec_args.cf index 152ba55eea..ec1b198b36 100644 --- a/examples/exec_args.cf +++ b/examples/exec_args.cf @@ -1,48 +1,33 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # Test the symmetry between using / not using args => # Locks should prevent these from being run twice, all else being equal. -# - body common control { - bundlesequence => { "main" }; + bundlesequence => { "main" }; } bundle agent main { - vars: - - "testlist" slist => { "apple", "banana", "carrot" }; + "testlist" slist => { "apple", "banana", "carrot" }; commands: - - "/bin/echo test1 $(testlist)"; - - "/bin/echo test1" - - args => "$(testlist)"; - + "/bin/echo test1 $(testlist)"; + "/bin/echo test1" args => "$(testlist)"; } diff --git a/examples/exec_in_sequence.cf b/examples/exec_in_sequence.cf index 6c302c1d3f..1c2d3d354b 100644 --- a/examples/exec_in_sequence.cf +++ b/examples/exec_in_sequence.cf @@ -1,81 +1,60 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test execution # ######################################################## - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { vars: - - "size" int => "46k"; - "rand" int => randomint("33","$(size)"); + "size" int => "46k"; + "rand" int => randomint("33", "$(size)"); commands: - - "/bin/echo" + "/bin/echo" args => "Hello world - $(size)/$(rand)", contain => standard, - classes => cdefine("followup","alert"); + classes => cdefine("followup", "alert"); followup:: - - "/bin/ls" - contain => standard; + "/bin/ls" contain => standard; reports: - alert:: - "What happened?"; - } ###################################################################### - body contain standard - { - exec_owner => "mark"; - useshell => "useshell"; + exec_owner => "mark"; + useshell => "useshell"; } ###################################################################### - -body classes cdefine(class,alert) - +body classes cdefine(class, alert) { - promise_repaired => { "$(class)" }; - repair_failed => { "$(alert)" }; + promise_repaired => { "$(class)" }; + repair_failed => { "$(alert)" }; } diff --git a/examples/execd.cf b/examples/execd.cf index e638ee875a..c8f8b96853 100644 --- a/examples/execd.cf +++ b/examples/execd.cf @@ -1,38 +1,30 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - body common control { - bundlesequence => { }; + bundlesequence => {}; } body executor control - { - mailto => "MARK@iu.hio.no"; - mailfrom => "cfengine@domain.tld"; - smtpserver => "MAIL-out.hio.no"; - mailmaxlines => "50"; - schedule => { "Min00_05", "Min30_35" }; - - exec_command => "/var/cfengine/bin/cf-agent"; + mailto => "MARK@iu.hio.no"; + mailfrom => "cfengine@domain.tld"; + smtpserver => "MAIL-out.hio.no"; + mailmaxlines => "50"; + schedule => { "Min00_05", "Min30_35" }; + exec_command => "/var/cfengine/bin/cf-agent"; } diff --git a/examples/execresult.cf b/examples/execresult.cf index b78b7eb01c..5790552102 100644 --- a/examples/execresult.cf +++ b/examples/execresult.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ rm -rf /tmp/testhere @@ -39,31 +33,34 @@ #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - "my_result" - string => execresult("/bin/ls /tmp/testhere", noshell); + "my_result" string => execresult("/bin/ls /tmp/testhere", noshell); - "my_result_with_stdout_and_stderr" - string => execresult("/tmp/testhere/echo-stdout-and-stderr", noshell); + "my_result_with_stdout_and_stderr" + string => execresult("/tmp/testhere/echo-stdout-and-stderr", noshell); - "my_result_with_stdout" - string => execresult("/tmp/testhere/echo-stdout-and-stderr 2>/dev/null", useshell); + "my_result_with_stdout" + string => execresult( + "/tmp/testhere/echo-stdout-and-stderr 2>/dev/null", useshell + ); - "my_result_with_stderr" - string => execresult("/tmp/testhere/echo-stdout-and-stderr 1>/dev/null", useshell); + "my_result_with_stderr" + string => execresult( + "/tmp/testhere/echo-stdout-and-stderr 1>/dev/null", useshell + ); reports: - "/bin/ls /tmp/testhere returned '$(my_result)'"; - "my_result_with_stdout_and_stderr == '$(my_result_with_stdout_and_stderr)'"; - "my_result_with_stdout == '$(my_result_with_stdout)'"; - "my_result_with_stderr == '$(my_result_with_stderr)'"; - + "/bin/ls /tmp/testhere returned '$(my_result)'"; + "my_result_with_stdout_and_stderr == '$(my_result_with_stdout_and_stderr)'"; + "my_result_with_stdout == '$(my_result_with_stdout)'"; + "my_result_with_stderr == '$(my_result_with_stderr)'"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/execresult_as_data.cf b/examples/execresult_as_data.cf index f9b3fc2f41..e03c3d5650 100644 --- a/examples/execresult_as_data.cf +++ b/examples/execresult_as_data.cf @@ -2,21 +2,19 @@ #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - "my_data" - data => execresult_as_data("echo 'hello'", "useshell", "both"); - "my_json_string" - string => storejson(my_data); + "my_data" data => execresult_as_data("echo 'hello'", "useshell", "both"); + "my_json_string" string => storejson(my_data); reports: - "echo 'hello' returned '$(my_json_string)'"; - + "echo 'hello' returned '$(my_json_string)'"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/expand.cf b/examples/expand.cf index df926e12bf..87998e7b5d 100644 --- a/examples/expand.cf +++ b/examples/expand.cf @@ -1,52 +1,34 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################################### - bundle agent example - -{ +{ vars: - - "component" slist => { "cf-monitord", "cf-serverd", "cf-execd" }; + "component" slist => { "cf-monitord", "cf-serverd", "cf-execd" }; processes: - - "$(component)" restart_class => canonify("start_$(component)"); + "$(component)" restart_class => canonify("start_$(component)"); commands: - - "/bin/echo /var/cfengine/bin/$(component)" - + "/bin/echo /var/cfengine/bin/$(component)" if => canonify("start_$(component)"); - - } - diff --git a/examples/failedcommand.cf b/examples/failedcommand.cf index ca03c36b05..971a275aef 100644 --- a/examples/failedcommand.cf +++ b/examples/failedcommand.cf @@ -1,31 +1,29 @@ -body common control -{ - bundlesequence => { "cmdtest" }; -} - -bundle agent cmdtest -{ - files: - "/tmp/test" - copy_from => copy("/etc/passwd"); - - - "/tmp/test" - classes => example, - transformer => "/bin/grep -q lkajfo999999 $(this.promiser)"; - - reports: - hasfailed:: - "The files-promise failed!"; -} - -body classes example -{ - failed_returncodes => { "1" }; - repair_failed => { "hasfailed" }; -} - -body copy_from copy(file) -{ - source => "$(file)"; -} +body common control +{ + bundlesequence => { "cmdtest" }; +} + +bundle agent cmdtest +{ + files: + "/tmp/test" copy_from => copy("/etc/passwd"); + + "/tmp/test" + classes => example, + transformer => "/bin/grep -q lkajfo999999 $(this.promiser)"; + + reports: + hasfailed:: + "The files-promise failed!"; +} + +body classes example +{ + failed_returncodes => { "1" }; + repair_failed => { "hasfailed" }; +} + +body copy_from copy(file) +{ + source => "$(file)"; +} diff --git a/examples/file_change_detection.cf b/examples/file_change_detection.cf index 5af7ba9d04..c6a9c65ac0 100644 --- a/examples/file_change_detection.cf +++ b/examples/file_change_detection.cf @@ -1,88 +1,65 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple backgrounding # ######################################################## - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - body agent control - { - agentaccess => { "mark", "root" }; + agentaccess => { "mark", "root" }; } ######################################################## - bundle agent example - { files: - - "/home/mark/tmp" -> "me" - - changes => tripwire, + "/home/mark/tmp" -> "me" + changes => tripwire, depth_search => recurse("inf"), - action => background; - - "/home/mark/LapTop/words" -> "you" + action => background; - changes => tripwire, + "/home/mark/LapTop/words" -> "you" + changes => tripwire, depth_search => recurse("inf"); - } - ######################################################### - body changes tripwire - { - hash => "md5"; - report_changes => "content"; - update_hashes => "true"; + hash => "md5"; + report_changes => "content"; + update_hashes => "true"; } ######################################################### - body action background - { - background => "true"; + background => "true"; } ######################################################### - body depth_search recurse(d) - { - depth => "$(d)"; + depth => "$(d)"; } diff --git a/examples/file_hash.cf b/examples/file_hash.cf index 3fc1ce94c6..a5dd407c79 100644 --- a/examples/file_hash.cf +++ b/examples/file_hash.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ echo 1 > /tmp/1 @@ -31,27 +25,24 @@ #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example - { vars: - - "md5" string => file_hash("/tmp/1","md5"); - "sha256" string => file_hash("/tmp/2","sha256"); - "sha384" string => hash("/tmp/3","sha384"); - "sha512" string => hash("/tmp/3","sha512"); + "md5" string => file_hash("/tmp/1", "md5"); + "sha256" string => file_hash("/tmp/2", "sha256"); + "sha384" string => hash("/tmp/3", "sha384"); + "sha512" string => hash("/tmp/3", "sha512"); reports: - - "'1\n' hashed to: md5 $(md5)"; - "'2\n' hashed to: sha256 $(sha256)"; - "'3\n' hashed to: sha384 $(sha384)"; - "'3\n' hashed to: sha512 $(sha512)"; - + "'1\n' hashed to: md5 $(md5)"; + "'2\n' hashed to: sha256 $(sha256)"; + "'3\n' hashed to: sha384 $(sha384)"; + "'3\n' hashed to: sha512 $(sha512)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/file_owner_list_template.cf b/examples/file_owner_list_template.cf index 19378897a1..1611601eef 100644 --- a/examples/file_owner_list_template.cf +++ b/examples/file_owner_list_template.cf @@ -1,60 +1,44 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # List substitution in bodies # ######################################################## - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { vars: - - "usernames" slist => { "one", "two", "three" }; + "usernames" slist => { "one", "two", "three" }; files: - - "/home/mark/tmp/test_plain" - + "/home/mark/tmp/test_plain" perms => users("@(usernames)"), create => "true"; - } ######################################################### - body perms users(x) - { - mode => "0640"; - owners => { @(x) }; + mode => "0640"; + owners => { @(x) }; } diff --git a/examples/fileexists.cf b/examples/fileexists.cf index 008cee6c9e..8e31c025ba 100644 --- a/examples/fileexists.cf +++ b/examples/fileexists.cf @@ -1,45 +1,38 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { classes: - # this.promise_filename has the currently-executed file, so it - # better exist! - "exists" expression => fileexists($(this.promise_filename)); - "exists_etc_passwd" expression => fileexists("/etc/passwd"); + # this.promise_filename has the currently-executed file, so it + # better exist! + "exists" expression => fileexists($(this.promise_filename)); + "exists_etc_passwd" expression => fileexists("/etc/passwd"); reports: - exists:: - "I exist! I mean, file exists!"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/filenames.cf b/examples/filenames.cf index 0ed8372349..657fcfb97f 100644 --- a/examples/filenames.cf +++ b/examples/filenames.cf @@ -1,47 +1,30 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # filenames -# - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { files: - - - "/etc/passwd" - - create => "true"; - - "C:\etc\passwd" - create => "true"; - - "etc/passwd" - create => "true"; + "/etc/passwd" create => "true"; + "C:\etc\passwd" create => "true"; + "etc/passwd" create => "true"; } diff --git a/examples/fileperms.cf b/examples/fileperms.cf index 585dfaf519..8b1aba5b5c 100644 --- a/examples/fileperms.cf +++ b/examples/fileperms.cf @@ -1,52 +1,34 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - body common control - { - - bundlesequence => { - "main" - }; - + bundlesequence => { "main" }; } ######################################################### - bundle agent main - { - files: - - "/tmp/foo" perms => p("at","0750"); - + "/tmp/foo" perms => p("at", "0750"); } ######################################################### - -body perms p(user,mode) - +body perms p(user, mode) { - owners => { "$(user)" }; - mode => "$(mode)"; + owners => { "$(user)" }; + mode => "$(mode)"; } diff --git a/examples/files-content-if-fileexists.cf b/examples/files-content-if-fileexists.cf index cde6527bae..21adbda3fa 100644 --- a/examples/files-content-if-fileexists.cf +++ b/examples/files-content-if-fileexists.cf @@ -6,8 +6,9 @@ #+begin_src cfengine3 body agent control { - inform => "true"; + inform => "true"; } + bundle agent __main__ { files: @@ -15,6 +16,7 @@ bundle agent __main__ content => "Hello, CFEngine", if => fileexists("/tmp/hello"); } + #+end_src #+begin_src example_output #@ ``` diff --git a/examples/files-content-with.cf b/examples/files-content-with.cf index 6034773507..eb8bbb940b 100644 --- a/examples/files-content-with.cf +++ b/examples/files-content-with.cf @@ -6,15 +6,17 @@ #+begin_src cfengine3 body agent control { - inform => "true"; + inform => "true"; } + bundle agent __main__ { files: - "/tmp/hello" - content => "Output from stat: $(with)", - with => execresult( 'stat -c "%U" /', "useshell" ); + "/tmp/hello" + content => "Output from stat: $(with)", + with => execresult('stat -c "%U" /', "useshell"); } + #+end_src #+begin_src example_output #@ ``` diff --git a/examples/files-content.cf b/examples/files-content.cf index 0adfd9b06d..6d9bbc1f73 100644 --- a/examples/files-content.cf +++ b/examples/files-content.cf @@ -6,14 +6,15 @@ #+begin_src cfengine3 body agent control { - inform => "true"; + inform => "true"; } + bundle agent __main__ { files: - "/tmp/hello" - content => "Hello, CFEngine"; + "/tmp/hello" content => "Hello, CFEngine"; } + #+end_src #+begin_src example_output #@ ``` diff --git a/examples/files-create-class-expression.cf b/examples/files-create-class-expression.cf index 70f43bada9..dd3a362d1c 100644 --- a/examples/files-create-class-expression.cf +++ b/examples/files-create-class-expression.cf @@ -6,15 +6,16 @@ #+begin_src cfengine3 body agent control { - inform => "true"; + inform => "true"; } + bundle agent __main__ { files: linux:: - "/tmp/linux" - create => "true"; + "/tmp/linux" create => "true"; } + #+end_src #+begin_src example_output #@ ``` diff --git a/examples/files_auto_define.cf b/examples/files_auto_define.cf index 679d0bf5ec..ffce98db7a 100644 --- a/examples/files_auto_define.cf +++ b/examples/files_auto_define.cf @@ -10,30 +10,31 @@ #+begin_src cfengine3 body agent control { - inform => "true"; # So that we can easily see class definition - files_auto_define => { ".*" }; # Trigger for any copied file + inform => "true"; # So that we can easily see class definition + files_auto_define => { ".*" }; # Trigger for any copied file } + bundle agent main { - files: - "/tmp/source_file.txt" - content => "Hello World!"; + "/tmp/source_file.txt" content => "Hello World!"; - "/tmp/example_files_auto_define.txt" - copy_from => local_dcp( "/tmp/source_file.txt" ); + "/tmp/example_files_auto_define.txt" + copy_from => local_dcp("/tmp/source_file.txt"); reports: - "Defined '$(with)', the canonified form of 'auto_/tmp/example_files_auto_define.txt'" - with => canonify( "auto_/tmp/example_files_auto_define.txt"), - if => canonify( "auto_/tmp/example_files_auto_define.txt"); + "Defined '$(with)', the canonified form of 'auto_/tmp/example_files_auto_define.txt'" + with => canonify("auto_/tmp/example_files_auto_define.txt"), + if => canonify("auto_/tmp/example_files_auto_define.txt"); } + # Copied from the standard library to make self-contained. body copy_from local_dcp(from) { - source => "$(from)"; - compare => "digest"; + source => "$(from)"; + compare => "digest"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/files_content.cf b/examples/files_content.cf index 285ce4a4a5..41654685c7 100644 --- a/examples/files_content.cf +++ b/examples/files_content.cf @@ -3,37 +3,36 @@ bundle agent example_file_content # @brief Example showing files content { vars: - "my_content" - string => "Hello from var!"; + "my_content" string => "Hello from var!"; files: - "/tmp/hello_string" - create => "true", - content => "Hello from string!"; + "/tmp/hello_string" + create => "true", + content => "Hello from string!"; - "/tmp/hello_var" - create => "true", - content => "$(my_content)"; + "/tmp/hello_var" + create => "true", + content => "$(my_content)"; reports: - "/tmp/hello_string" - printfile => cat( $(this.promiser) ); - "/tmp/hello_var" - printfile => cat( $(this.promiser) ); + "/tmp/hello_string" printfile => cat($(this.promiser)); + "/tmp/hello_var" printfile => cat($(this.promiser)); } 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"; } bundle agent __main__ { - methods: "example_file_content"; + methods: + "example_file_content"; } + ############################################################################### #+end_src #+begin_src example_output diff --git a/examples/files_depth_search_include_basedir.cf b/examples/files_depth_search_include_basedir.cf index 52e35dafa9..3b6ea38946 100644 --- a/examples/files_depth_search_include_basedir.cf +++ b/examples/files_depth_search_include_basedir.cf @@ -21,91 +21,97 @@ bundle agent main # @brief Example showing how to promise permissions recursively and promise a directory tree is empty. It illustrates the behavior of `include_basedir` in `depth_search` bodies and that the delete ignores `include_basedir`. { files: - "/tmp/CFE-3217/test-delete/." -> { "CFE-3217", "CFE-3218" } - depth_search => aggressive("true"), - file_select => all, - delete => tidy, - comment => "include_basedir => 'true' will not result in thd promised directory being removed."; - - "/tmp/CFE-3217/test-delete-nobasedir/." - depth_search => aggressive("false"), - file_select => all, - delete => tidy, - comment => "include_basedir => 'false' will not result in thd promised directory being removed."; - - "/tmp/CFE-3217/test-perms/." - perms => m(555), - depth_search => aggressive("true"), - file_select => all, - comment => "include_basedir => 'true' results in thd promised directory having permissions managed as well."; - - "/tmp/CFE-3217/test-perms-nobasedir/." -> { "CFE-3217" } - perms => m(555), - depth_search => aggressive("false"), - file_select => all, - comment => "include_basedir => 'false' results in thd promised directory not having permissions managed."; + "/tmp/CFE-3217/test-delete/." -> { "CFE-3217", "CFE-3218" } + depth_search => aggressive("true"), + file_select => all, + delete => tidy, + comment => "include_basedir => 'true' will not result in thd promised directory being removed."; + + "/tmp/CFE-3217/test-delete-nobasedir/." + depth_search => aggressive("false"), + file_select => all, + delete => tidy, + comment => "include_basedir => 'false' will not result in thd promised directory being removed."; + + "/tmp/CFE-3217/test-perms/." + perms => m(555), + depth_search => aggressive("true"), + file_select => all, + comment => "include_basedir => 'true' results in thd promised directory having permissions managed as well."; + + "/tmp/CFE-3217/test-perms-nobasedir/." -> { "CFE-3217" } + perms => m(555), + depth_search => aggressive("false"), + file_select => all, + comment => "include_basedir => 'false' results in thd promised directory not having permissions managed."; reports: + "delete => tidy"; + + "/tmp/CFE-3217/test-delete present despite include_basedir => 'true'" + if => isdir("/tmp/CFE-3217/test-delete"); + + "/tmp/CFE-3217/test-delete-nobasedir present as expected with include_basedir => 'false'" + if => isdir("/tmp/CFE-3217/test-delete-nobasedir"); + + "/tmp/CFE-3217/test-delete absent, unexpectedly" + unless => isdir("/tmp/CFE-3217/test-delete"); - "delete => tidy"; - "/tmp/CFE-3217/test-delete present despite include_basedir => 'true'" - if => isdir("/tmp/CFE-3217/test-delete"); - "/tmp/CFE-3217/test-delete-nobasedir present as expected with include_basedir => 'false'" - if => isdir("/tmp/CFE-3217/test-delete-nobasedir"); - "/tmp/CFE-3217/test-delete absent, unexpectedly" - unless => isdir("/tmp/CFE-3217/test-delete"); - "/tmp/CFE-3217/test-delete-nobasedir absent, unexpectedly" - unless => isdir("/tmp/CFE-3217/test-delete-nobasedir"); - - - "perms => m(555)"; - "/tmp/CFE-3217/test-perms $(with), as expected with include_basedir => 'true'" - with => filestat( "/tmp/CFE-3217/test-perms", modeoct ), - if => strcmp( filestat( "/tmp/CFE-3217/test-perms", modeoct ), "40555" ); - - "/tmp/CFE-3217/test-perms-nobasedir $(with), not 555, as expected with include_basedir => 'false'" - with => filestat( "/tmp/CFE-3217/test-perms-nobasedir", modeoct ), - unless => strcmp( filestat( "/tmp/CFE-3217/test-perms-nobasedir", modeoct ), "40555" ); + "/tmp/CFE-3217/test-delete-nobasedir absent, unexpectedly" + unless => isdir("/tmp/CFE-3217/test-delete-nobasedir"); + + "perms => m(555)"; + + "/tmp/CFE-3217/test-perms $(with), as expected with include_basedir => 'true'" + with => filestat("/tmp/CFE-3217/test-perms", modeoct), + if => strcmp(filestat("/tmp/CFE-3217/test-perms", modeoct), "40555"); + + "/tmp/CFE-3217/test-perms-nobasedir $(with), not 555, as expected with include_basedir => 'false'" + with => filestat("/tmp/CFE-3217/test-perms-nobasedir", modeoct), + unless => strcmp( + filestat("/tmp/CFE-3217/test-perms-nobasedir", modeoct), "40555" + ); } body depth_search aggressive(include_basedir) # @brief Search for files recursively from promiser traversing synmlinks and filesystem boundaries. { - depth => "inf"; - # exclude_dirs => { @(exclude_dirs) }; - include_basedir => "$(include_basedir)"; - # include_dirs => { @(include_dirs) }; - # inherit_from => "$(inherit_from)"; - # meta => "$(meta)"; meta attribute inside the depth_search body? It's not documented. TODO!? - rmdeadlinks => "false"; # Depth search removes dead links, this seems like something that should be in delete body. TODO!? - traverse_links => "true"; - xdev => "true"; + depth => "inf"; + # exclude_dirs => { @(exclude_dirs) }; + include_basedir => "$(include_basedir)"; + + # include_dirs => { @(include_dirs) }; + # inherit_from => "$(inherit_from)"; + # meta => "$(meta)"; meta attribute inside the depth_search body? It's not documented. TODO!? + rmdeadlinks => "false"; # Depth search removes dead links, this seems like something that should be in delete body. TODO!? + traverse_links => "true"; + xdev => "true"; } #@ Inlined bodies from the stdlib in the Masterfiles Policy Framework - body file_select all # @brief Select all file system entries { - leaf_name => { ".*" }; - file_result => "leaf_name"; + leaf_name => { ".*" }; + file_result => "leaf_name"; } body delete tidy # @brief Delete the file and remove empty directories # and links to directories { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } body perms m(mode) # @brief Set the file mode # @param mode The new mode { - mode => "$(mode)"; + mode => "$(mode)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/files_transformer.cf b/examples/files_transformer.cf index 11a8e56a26..28967c2669 100644 --- a/examples/files_transformer.cf +++ b/examples/files_transformer.cf @@ -12,12 +12,12 @@ bundle agent main { vars: - "gzip_path" string => ifelse( isexecutable("/bin/gzip"), "/bin/gzip", - "/usr/bin/gzip" ); + "gzip_path" + string => ifelse(isexecutable("/bin/gzip"), "/bin/gzip", "/usr/bin/gzip"); + files: linux:: - "/tmp/example-files-transformer.txt" - content => "Hello World"; + "/tmp/example-files-transformer.txt" content => "Hello World"; "/tmp/example-files-transformer.txt" transformer => "$(gzip_path) $(this.promiser)"; @@ -26,7 +26,6 @@ bundle agent main # being absent on completion. Note: It is the expectation and # responsibility of the transformer itself that the transformation results # in the promised file no longer existing. - "/tmp/example-files-transformer.txt" transformer => "$(gzip_path) $(this.promiser)"; @@ -36,22 +35,35 @@ bundle agent main transformer => "$(gzip_path) $(this.promiser)"; reports: - "/tmp/example-files-transformer.txt $(with)" - with => ifelse( fileexists( "/tmp/example-files-transformer.txt"), "exists", - "does not exist"); + "/tmp/example-files-transformer.txt $(with)" + with => ifelse( + fileexists("/tmp/example-files-transformer.txt"), + "exists", + "does not exist" + ); - "/tmp/example-files-transformer.txt.gz $(with)" - with => ifelse( fileexists( "/tmp/example-files-transformer.txt.gz"), "exists", - "does not exist"); + "/tmp/example-files-transformer.txt.gz $(with)" + with => ifelse( + fileexists("/tmp/example-files-transformer.txt.gz"), + "exists", + "does not exist" + ); - "/tmp/this-file-does-not-exist-to-be-transformed.txt $(with)" - with => ifelse( fileexists( "/tmp/this-file-does-not-exist-to-be-transformed.txt"), "exists", - "does not exist"); + "/tmp/this-file-does-not-exist-to-be-transformed.txt $(with)" + with => ifelse( + fileexists("/tmp/this-file-does-not-exist-to-be-transformed.txt"), + "exists", + "does not exist" + ); - "/tmp/this-file-does-not-exist-to-be-transformed.txt.gz $(with)" - with => ifelse( fileexists( "/tmp/this-file-does-not-exist-to-be-transformed.txt.gz"), "exists", - "does not exist"); + "/tmp/this-file-does-not-exist-to-be-transformed.txt.gz $(with)" + with => ifelse( + fileexists("/tmp/this-file-does-not-exist-to-be-transformed.txt.gz"), + "exists", + "does not exist" + ); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/filesexist.cf b/examples/filesexist.cf index a1c5f3f241..0a31660e2e 100644 --- a/examples/filesexist.cf +++ b/examples/filesexist.cf @@ -1,53 +1,41 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example - { vars: - - "mylist" slist => { "/tmp/a", "/tmp/b", "/tmp/c" }; + "mylist" slist => { "/tmp/a", "/tmp/b", "/tmp/c" }; classes: - - "exists" expression => filesexist("@(mylist)"); + "exists" expression => filesexist("@(mylist)"); reports: - exists:: - "All files exist"; !exists:: - "Not all files exist"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/filesexist2.cf b/examples/filesexist2.cf index a08d3b7e05..d0e9718980 100644 --- a/examples/filesexist2.cf +++ b/examples/filesexist2.cf @@ -1,64 +1,43 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################################### - bundle agent example - -{ +{ vars: - - "mylist" slist => { "/tmp/a", "/tmp/b", "/tmp/c" }; - + "mylist" slist => { "/tmp/a", "/tmp/b", "/tmp/c" }; methods: - - "any" usebundle => crystal_meth(@(example.mylist)); - + "any" usebundle => crystal_meth(@(example.mylist)); } bundle agent crystal_meth(x) - { classes: - - "exists" expression => filesexist("@(x)"); + "exists" expression => filesexist("@(x)"); reports: - exists:: - "File does exist"; !exists:: - "Does not yet exist"; - } - diff --git a/examples/filesize.cf b/examples/filesize.cf index 4e8cb9428c..3a069d5c22 100644 --- a/examples/filesize.cf +++ b/examples/filesize.cf @@ -1,48 +1,43 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ############################################################################### #+begin_src cfengine3 body common control { - bundlesequence => { example }; + bundlesequence => { example }; } bundle agent example { vars: - # my own size! - "exists" int => filesize("$(this.promise_filename)"); - "nexists" int => filesize("/etc/passwdx"); + # my own size! + "exists" int => filesize("$(this.promise_filename)"); + "nexists" int => filesize("/etc/passwdx"); reports: - "File size $(exists)"; - "Does not exist: $(nexists)"; + "File size $(exists)"; + "Does not exist: $(nexists)"; } + #+end_src ############################################################################### #+begin_src example_output #@ ``` -#@ R: File size 301 +#@ R: File size 288 #@ R: Does not exist: $(nexists) #@ ``` #+end_src diff --git a/examples/filestat.cf b/examples/filestat.cf index c9c917ecc0..3492b093f3 100644 --- a/examples/filestat.cf +++ b/examples/filestat.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ echo 1234567890 > FILE.txt @@ -32,33 +26,39 @@ #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - "file" string => "$(this.promise_filename).txt"; + "file" string => "$(this.promise_filename).txt"; + methods: - "fileinfo" usebundle => fileinfo("$(file)"); + "fileinfo" usebundle => fileinfo("$(file)"); } + bundle agent fileinfo(f) { vars: - # use the full list if you want to see all the attributes! - # "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); - - # ino (inode number), ctime (creation time), - # devno/dev_minor/dev_major (device numbers) were omitted but - # they are all integers + # use the full list if you want to see all the attributes! + # "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); + # ino (inode number), ctime (creation time), + # devno/dev_minor/dev_major (device numbers) were omitted but + # they are all integers + "fields" + slist => splitstring( + "size,gid,uid,nlink,mode,modeoct,permstr,permoct,type,basename", + ",", + 999 + ); - "fields" slist => splitstring("size,gid,uid,nlink,mode,modeoct,permstr,permoct,type,basename", ",", 999); - - "stat[$(f)][$(fields)]" string => filestat($(f), $(fields)); + "stat[$(f)][$(fields)]" string => filestat($(f), $(fields)); reports: - "$(this.bundle): file $(stat[$(f)][basename]) has $(fields) = $(stat[$(f)][$(fields)])"; + "$(this.bundle): file $(stat[$(f)][basename]) has $(fields) = $(stat[$(f)][$(fields)])"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/filter.cf b/examples/filter.cf index 29d23a1a10..53515120a2 100644 --- a/examples/filter.cf +++ b/examples/filter.cf @@ -1,79 +1,83 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } 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", }; - "test2" data => parsejson('[1,2,3, "ab", "c"]'); - - "test_filtergrep" slist => filter("[0-9]", test, "true", "false", 999); - "test_exact1" slist => filter("one", test, "false", "false", 999); - "test_exact2" slist => filter(".", test, "false", "false", 999); - "test_invert" slist => filter("[0-9]", test, "true", "true", 999); - "test_max2" slist => filter(".*", test, "true", "false", 2); - "test_max0" slist => filter(".*", test, "true", "false", 0); - "test_grep" slist => grep("[0-9]", test); - - "test2_filtergrep" slist => filter("[0-9]", test2, "true", "false", 999); - "test2_exact1" slist => filter("one", test2, "false", "false", 999); - "test2_exact2" slist => filter(".", test2, "false", "false", 999); - "test2_invert" slist => filter("[0-9]", test2, "true", "true", 999); - "test2_max2" slist => filter(".*", test2, "true", "false", 2); - "test2_max0" slist => filter(".*", test2, "true", "false", 0); - "test2_grep" slist => grep("[0-9]", test2); + "test2" data => parsejson('[1,2,3, "ab", "c"]'); + "test_filtergrep" slist => filter("[0-9]", test, "true", "false", 999); + "test_exact1" slist => filter("one", test, "false", "false", 999); + "test_exact2" slist => filter(".", test, "false", "false", 999); + "test_invert" slist => filter("[0-9]", test, "true", "true", 999); + "test_max2" slist => filter(".*", test, "true", "false", 2); + "test_max0" slist => filter(".*", test, "true", "false", 0); + "test_grep" slist => grep("[0-9]", test); + "test2_filtergrep" slist => filter("[0-9]", test2, "true", "false", 999); + "test2_exact1" slist => filter("one", test2, "false", "false", 999); + "test2_exact2" slist => filter(".", test2, "false", "false", 999); + "test2_invert" slist => filter("[0-9]", test2, "true", "true", 999); + "test2_max2" slist => filter(".*", test2, "true", "false", 2); + "test2_max0" slist => filter(".*", test2, "true", "false", 0); + "test2_grep" slist => grep("[0-9]", test2); - "todo" slist => { "test", "test2", "test_filtergrep", "test_exact1", - "test_exact2", "test_invert", "test_max2", - "test_max0", "test_grep", "test2_filtergrep", - "test2_exact1", "test2_exact2", - "test2_invert", "test2_max2", "test2_max0", - "test2_grep"}; + "todo" + slist => { + "test", + "test2", + "test_filtergrep", + "test_exact1", + "test_exact2", + "test_invert", + "test_max2", + "test_max0", + "test_grep", + "test2_filtergrep", + "test2_exact1", + "test2_exact2", + "test2_invert", + "test2_max2", + "test2_max0", + "test2_grep", + }; - "$(todo)_str" string => format("%S", $(todo)); - "tests" slist => { "test", "test2" }; + "$(todo)_str" string => format("%S", $(todo)); + "tests" slist => { "test", "test2" }; reports: - "The $(tests) list is $($(tests)_str)"; - "The grepped list (only single digits from $(tests)) is $($(tests)_grep_str)"; - "The filter-grepped list (only single digits from $(tests)) is $($(tests)_grep_str)"; - "The filter-exact list, looking for only 'one' in $(tests), is $($(tests)_exact1_str)"; - "This list should be empty, the '.' is not literally in the list $(tests): $($(tests)_exact2_str)"; - "The filter-invert list, looking for non-digits in $(tests), is $($(tests)_invert_str)"; - "The filter-bound list, matching at most 2 items from the whole list $(tests), is $($(tests)_max2_str)"; - "This list should be empty because 0 elements of $(tests) were requested: $($(tests)_max0_str)"; + "The $(tests) list is $($(tests)_str)"; + "The grepped list (only single digits from $(tests)) is $($(tests)_grep_str)"; + "The filter-grepped list (only single digits from $(tests)) is $($(tests)_grep_str)"; + "The filter-exact list, looking for only 'one' in $(tests), is $($(tests)_exact1_str)"; + "This list should be empty, the '.' is not literally in the list $(tests): $($(tests)_exact2_str)"; + "The filter-invert list, looking for non-digits in $(tests), is $($(tests)_invert_str)"; + "The filter-bound list, matching at most 2 items from the whole list $(tests), is $($(tests)_max2_str)"; + "This list should be empty because 0 elements of $(tests) were requested: $($(tests)_max0_str)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/findfiles.cf b/examples/findfiles.cf index 1ef73683de..5e2f073834 100644 --- a/examples/findfiles.cf +++ b/examples/findfiles.cf @@ -1,39 +1,34 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { run }; + bundlesequence => { run }; } bundle agent run { vars: - "findtmp" slist => findfiles("/[tT][mM][pP]"); - # or find all .txt files under /tmp, up to 6 levels deep... - # "findtmp" slist => findfiles("/tmp/**/*.txt"); + "findtmp" slist => findfiles("/[tT][mM][pP]"); + + # or find all .txt files under /tmp, up to 6 levels deep... + # "findtmp" slist => findfiles("/tmp/**/*.txt"); reports: - "All files that match '/[tT][mM][pP]' = $(findtmp)"; + "All files that match '/[tT][mM][pP]' = $(findtmp)"; } #+end_src diff --git a/examples/findfiles_up.cf b/examples/findfiles_up.cf index f667c8d218..57d13792d7 100644 --- a/examples/findfiles_up.cf +++ b/examples/findfiles_up.cf @@ -12,18 +12,22 @@ bundle agent __main__ { vars: - "path" # path to search up from - string => "/tmp/repo/submodule/some/place/deep/within/my/repo/"; - "glob" # glob pattern matching filename - string => ".git/config"; - "level" # how far to search - int => "inf"; - "configs" - data => findfiles_up("$(path)", "$(glob)", "$(level)"); + "path" # path to search up from + string => "/tmp/repo/submodule/some/place/deep/within/my/repo/"; + + "glob" # glob pattern matching filename + string => ".git/config"; + + "level" # how far to search + int => "inf"; + + "configs" data => findfiles_up("$(path)", "$(glob)", "$(level)"); + reports: - "Submodules '$(glob)' is located in '$(configs[0])'"; - "Parents '$(glob)' is located in '$(configs[1])'"; + "Submodules '$(glob)' is located in '$(configs[0])'"; + "Parents '$(glob)' is located in '$(configs[1])'"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/findlocalusers.cf b/examples/findlocalusers.cf index 0aaf4558fd..5e0de4a45e 100644 --- a/examples/findlocalusers.cf +++ b/examples/findlocalusers.cf @@ -7,18 +7,12 @@ body common control bundle agent example { vars: - "root_filter" - slist => {"gid=0", "name=root"}; - "root_container" - data => findlocalusers("@(root_filter)"); - "root_list" - slist => getindices("root_container"); - "bin_filter" - data => '["name=bin"]'; - "bin_container" - data => findlocalusers("@(bin_filter)"); - "bin_list" - slist => getindices("bin_container"); + "root_filter" slist => { "gid=0", "name=root" }; + "root_container" data => findlocalusers("@(root_filter)"); + "root_list" slist => getindices("root_container"); + "bin_filter" data => '["name=bin"]'; + "bin_container" data => findlocalusers("@(bin_filter)"); + "bin_list" slist => getindices("bin_container"); reports: "List: $(root_list)"; diff --git a/examples/fix_names.cf b/examples/fix_names.cf index 5b97823cc8..27074689dc 100644 --- a/examples/fix_names.cf +++ b/examples/fix_names.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ###################################################################### # # File editing @@ -30,48 +24,31 @@ # - insert # ###################################################################### - - body common control - { - version => "1.2.3"; - bundlesequence => { "example" }; + version => "1.2.3"; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { - files: - - "/home/mark/LapTop/Cfengine3/trunk/src/.*\.[ch]" - - edit_line => change_name; + "/home/mark/LapTop/Cfengine3/trunk/src/.*\.[ch]" edit_line => change_name; } ######################################################## - bundle edit_line change_name { replace_patterns: - - "Verbose\(" - - replace_with => With("CfOut(cf_verbose,\"\","); - + "Verbose\(" replace_with => With("CfOut(cf_verbose,\"\","); } ######################################## # Bodies ######################################## - body replace_with With(x) - { - replace_value => "$(x)"; - occurrences => "all"; + replace_value => "$(x)"; + occurrences => "all"; } - diff --git a/examples/format.cf b/examples/format.cf index de0eee95cd..b8b4247f75 100644 --- a/examples/format.cf +++ b/examples/format.cf @@ -1,56 +1,54 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "run" }; + bundlesequence => { "run" }; } bundle agent run { vars: - "v" string => "2.5.6"; - "vlist" slist => splitstring($(v), "\.", 3); - "padded" string => format("%04d%04d%04d", nth("vlist", 0), nth("vlist", 1), nth("vlist", 2)); - "a" string => format("%10.10s", "x"); - "b" string => format("%-10.10s", "x"); - "c" string => format("%04d", 1); - "d" string => format("%07.2f", 1); - "e" string => format("hello my name is %s %s", "Inigo", "Montoya"); + "v" string => "2.5.6"; + "vlist" slist => splitstring($(v), "\.", 3); - "container" data => parsejson('{ "x": "y", "z": true }'); + "padded" + string => format( + "%04d%04d%04d", nth("vlist", 0), nth("vlist", 1), nth("vlist", 2) + ); - "packed" string => format("slist = %S, container = %S", vlist, container); + "a" string => format("%10.10s", "x"); + "b" string => format("%-10.10s", "x"); + "c" string => format("%04d", 1); + "d" string => format("%07.2f", 1); + "e" string => format("hello my name is %s %s", "Inigo", "Montoya"); + "container" data => parsejson('{ "x": "y", "z": true }'); + "packed" string => format("slist = %S, container = %S", vlist, container); reports: - "version $(v) => padded $(padded)"; - "%10.10s on 'x' => '$(a)'"; - "%-10.10s on 'x' => '$(b)'"; - "%04d on '1' => '$(c)'"; - "%07.2f on '1' => '$(d)'"; - "you killed my father... => '$(e)'"; - "$(packed)"; + "version $(v) => padded $(padded)"; + "%10.10s on 'x' => '$(a)'"; + "%-10.10s on 'x' => '$(b)'"; + "%04d on '1' => '$(c)'"; + "%07.2f on '1' => '$(d)'"; + "you killed my father... => '$(e)'"; + "$(packed)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/function-return-types.cf b/examples/function-return-types.cf index ebdbeef8fa..9514d58f39 100644 --- a/examples/function-return-types.cf +++ b/examples/function-return-types.cf @@ -10,59 +10,60 @@ bundle agent example_function_return_types # @brief Example showing function return types { - classes: - "this_file_exists" expression => fileexists( $(this.promise_filename) ); + "this_file_exists" expression => fileexists($(this.promise_filename)); vars: - "my_string" string => concat( "Promises you cannot keep", - " are no better than lies"); - - "my_list_of_strings" - slist => readstringlist( "/tmp/list.txt", # File to read - "", # Don't ignore any lines - "\n", # Split on newlines - inf, # Extract as many entries as possible - inf); # Read in as much data as possible - - "my_list_of_integers" - ilist => readintlist( "/tmp/list.txt", # File to read - "^(\D+)|(\d+[^\n]+)", # Ignore any lines that are not integers - "\n", # Split on newlines - inf, # Maximum number of entries - inf); # Maximum number of bytes to read - - "my_list_of_reals" - rlist => readreallist( "/tmp/list.txt", # File to read - "^(\D+)", # Ignore any lines that are not digits - "\n", # Split on newlines - inf, # Maximum number of entries - inf); # Maximum number of bytes to read - - "my_integer" int => string_length( $(my_string) ); + "my_string" + string => concat("Promises you cannot keep", " are no better than lies"); - "my_real" real => sum( my_list_of_integers ); - - "my_data" data => mergedata( '{ "Hello": "world!" }' ); + "my_list_of_strings" + slist => readstringlist( + "/tmp/list.txt", # File to read + "", # Don't ignore any lines + "\n", # Split on newlines + inf, # Extract as many entries as possible + inf + ); # Read in as much data as possible + "my_list_of_integers" + ilist => readintlist( + "/tmp/list.txt", # File to read + "^(\D+)|(\d+[^\n]+)", # Ignore any lines that are not integers + "\n", # Split on newlines + inf, # Maximum number of entries + inf + ); # Maximum number of bytes to read + "my_list_of_reals" + rlist => readreallist( + "/tmp/list.txt", # File to read + "^(\D+)", # Ignore any lines that are not digits + "\n", # Split on newlines + inf, # Maximum number of entries + inf + ); # Maximum number of bytes to read + "my_integer" int => string_length($(my_string)); + "my_real" real => sum(my_list_of_integers); + "my_data" data => mergedata('{ "Hello": "world!" }'); reports: - "my_string: '$(my_string)'"; - "my_list_of_strings includes '$(my_list_of_strings)'"; - "my_list_of_integers includes '$(my_list_of_integers)'"; - "my_list_of_reals includes '$(my_list_of_reals)'"; - "my_integer: '$(my_integer)'"; - "my_real: '$(my_real)'"; - "my_data: '$(with)'" - with => string_mustache( "{{%-top-}}", my_data ); + "my_string: '$(my_string)'"; + "my_list_of_strings includes '$(my_list_of_strings)'"; + "my_list_of_integers includes '$(my_list_of_integers)'"; + "my_list_of_reals includes '$(my_list_of_reals)'"; + "my_integer: '$(my_integer)'"; + "my_real: '$(my_real)'"; + "my_data: '$(with)'" with => string_mustache("{{%-top-}}", my_data); this_file_exists:: "This file exists."; - } + bundle agent __main__ { - methods: "example_function_return_types"; + methods: + "example_function_return_types"; } + #+end_src #+begin_src example_output #@ ``` diff --git a/examples/getacls.cf b/examples/getacls.cf index 637e2bb253..ab4baa6f7a 100644 --- a/examples/getacls.cf +++ b/examples/getacls.cf @@ -1,8 +1,6 @@ bundle agent __main__ { vars: - "default_acls" - slist => getacls("/tmp/foo/", "default"); - "access_acls" - slist => getacls("/tmp/bar", "access"); + "default_acls" slist => getacls("/tmp/foo/", "default"); + "access_acls" slist => getacls("/tmp/bar", "access"); } diff --git a/examples/getbundlemetatags.cf b/examples/getbundlemetatags.cf index 46f57d64b9..18c71d962d 100644 --- a/examples/getbundlemetatags.cf +++ b/examples/getbundlemetatags.cf @@ -15,15 +15,14 @@ bundle agent example }; vars: - "bundle_tags" - slist => getbundlemetatags("default:example"); - "contact_tag" - slist => getbundlemetatags("default:example", "contact"); + "bundle_tags" slist => getbundlemetatags("default:example"); + "contact_tag" slist => getbundlemetatags("default:example", "contact"); reports: "Found tags: $(bundle_tags)"; "Contact tag: $(contact_tag)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/getclassmetatags.cf b/examples/getclassmetatags.cf index c816205047..438165ecfa 100644 --- a/examples/getclassmetatags.cf +++ b/examples/getclassmetatags.cf @@ -1,45 +1,41 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { classes: - "c" expression => "any", meta => { "mytag", "other=once", "other=twice" }; + "c" + expression => "any", + meta => { "mytag", "other=once", "other=twice" }; vars: - "ctags" slist => getclassmetatags("c"); - "othertag_values" slist => getclassmetatags("c", "other"); + "ctags" slist => getclassmetatags("c"); + "othertag_values" slist => getclassmetatags("c", "other"); reports: - "Found tags: $(ctags)"; - "Found tags for key 'other': $(othertag_values)"; - + "Found tags: $(ctags)"; + "Found tags for key 'other': $(othertag_values)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/getenv.cf b/examples/getenv.cf index 56d73977fa..4a9b2c9369 100644 --- a/examples/getenv.cf +++ b/examples/getenv.cf @@ -1,52 +1,41 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - - "myvar" string => getenv("EXAMPLE","2048"); + "myvar" string => getenv("EXAMPLE", "2048"); classes: - - "isdefined" not => strcmp("$(myvar)",""); + "isdefined" not => strcmp("$(myvar)", ""); reports: - isdefined:: - "The EXAMPLE environment variable is $(myvar)"; !isdefined:: - "The environment variable EXAMPLE does not exist"; - } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/getfields.cf b/examples/getfields.cf index 7e1a6666f9..ef7bf7e89a 100644 --- a/examples/getfields.cf +++ b/examples/getfields.cf @@ -1,50 +1,44 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - - "no" int => getfields("root:.*","/etc/passwd",":","userdata"); + "no" int => getfields("root:.*", "/etc/passwd", ":", "userdata"); reports: - "Found $(no) lines matching"; - "root's handle = $(userdata[1])"; - "root's passwd = ... forget it!"; - "root's uid = $(userdata[3])"; - # uncomment this if you want to see the HOMEDIR field - #"root's homedir = $(userdata[6])"; - # uncomment this if you want to see the GID field - #"root's gid = $(userdata[4])"; - # uncomment this if you want to see the GECOS field - #"root's name = $(userdata[5])"; - + "Found $(no) lines matching"; + "root's handle = $(userdata[1])"; + "root's passwd = ... forget it!"; + "root's uid = $(userdata[3])"; + + # uncomment this if you want to see the HOMEDIR field + #"root's homedir = $(userdata[6])"; + # uncomment this if you want to see the GID field + #"root's gid = $(userdata[4])"; + # uncomment this if you want to see the GECOS field + #"root's name = $(userdata[5])"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/getgid.cf b/examples/getgid.cf index 3d9978e9c3..cc9edad984 100644 --- a/examples/getgid.cf +++ b/examples/getgid.cf @@ -1,29 +1,23 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example @@ -31,14 +25,17 @@ bundle agent example vars: linux|solaris|hpux:: "gid" int => getgid("root"); + freebsd|darwin|openbsd:: "gid" int => getgid("wheel"); + aix:: "gid" int => getgid("system"); reports: - "root's gid is $(gid)"; + "root's gid is $(gid)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/getindices.cf b/examples/getindices.cf index c6f97522ed..4433ef89eb 100644 --- a/examples/getindices.cf +++ b/examples/getindices.cf @@ -1,52 +1,44 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - - "ps[relayhost]" string => "[mymailrelay]:587"; - "ps[mydomain]" string => "iu.hio.no"; - "ps[smtp_sasl_auth_enable]" string => "yes"; - "ps[smtp_sasl_password_maps]" string => "hash:/etc/postfix/sasl-passwd"; - "ps[smtp_sasl_security_options]" string => ""; - "ps[smtp_use_tls]" string => "yes"; - "ps[default_privs]" string => "mailman"; - "ps[inet_protocols]" string => "all"; - "ps[inet_interfaces]" string => "127.0.0.1"; - - "parameter_name" slist => getindices("ps"); - "parameter_name_sorted" slist => sort(parameter_name, lex); + "ps[relayhost]" string => "[mymailrelay]:587"; + "ps[mydomain]" string => "iu.hio.no"; + "ps[smtp_sasl_auth_enable]" string => "yes"; + "ps[smtp_sasl_password_maps]" string => "hash:/etc/postfix/sasl-passwd"; + "ps[smtp_sasl_security_options]" string => ""; + "ps[smtp_use_tls]" string => "yes"; + "ps[default_privs]" string => "mailman"; + "ps[inet_protocols]" string => "all"; + "ps[inet_interfaces]" string => "127.0.0.1"; + "parameter_name" slist => getindices("ps"); + "parameter_name_sorted" slist => sort(parameter_name, lex); reports: - - "Found key $(parameter_name_sorted)"; + "Found key $(parameter_name_sorted)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/getindices_and_values.cf b/examples/getindices_and_values.cf index e5934b68c7..5446ee34c4 100644 --- a/examples/getindices_and_values.cf +++ b/examples/getindices_and_values.cf @@ -1,50 +1,36 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } - ####################################################### - bundle agent example - { vars: - - "v[index_1]" string => "value_1"; - "v[index_2]" string => "value_2"; - - "x" slist => getindices("v"); - "y" slist => getvalues("v"); + "v[index_1]" string => "value_1"; + "v[index_2]" string => "value_2"; + "x" slist => getindices("v"); + "y" slist => getvalues("v"); reports: - - "All indices:"; - " Found index: $(x) with value \"$(v[$(x)])\""; - "All values:"; - " Found value: $(y)"; + "All indices:"; + " Found index: $(x) with value \"$(v[$(x)])\""; + "All values:"; + " Found value: $(y)"; } diff --git a/examples/getmacaddress.cf b/examples/getmacaddress.cf index b9d2fc08d1..7e23990511 100644 --- a/examples/getmacaddress.cf +++ b/examples/getmacaddress.cf @@ -1,65 +1,50 @@ - body common control { - bundlesequence => { "get_mac_adr" }; + bundlesequence => { "get_mac_adr" }; } ############################################################## - bundle agent get_mac_adr { vars: - linux:: - "interface" string => execresult("/sbin/ifconfig eth0","noshell"); + "interface" string => execresult("/sbin/ifconfig eth0", "noshell"); solaris:: - "interface" string => execresult("/usr/sbin/ifconfig bge0","noshell"); + "interface" string => execresult("/usr/sbin/ifconfig bge0", "noshell"); freebsd:: - "interface" string => execresult("/sbin/ifconfig le0","noshell"); + "interface" string => execresult("/sbin/ifconfig le0", "noshell"); darwin:: - "interface" string => execresult("/sbin/ifconfig en0","noshell"); + "interface" string => execresult("/sbin/ifconfig en0", "noshell"); classes: - linux:: - - "ok" expression => regextract( - ".*HWaddr ([^\s]+).*(\n.*)*", - "$(interface)", - "mac" - ); + "ok" + expression => regextract( + ".*HWaddr ([^\s]+).*(\n.*)*", "$(interface)", "mac" + ); solaris:: - - "ok" expression => regextract( - ".*ether ([^\s]+).*(\n.*)*", - "$(interface)", - "mac" - ); + "ok" + expression => regextract( + ".*ether ([^\s]+).*(\n.*)*", "$(interface)", "mac" + ); freebsd:: - - "ok" expression => regextract( - ".*ether ([^\s]+).*(\n.*)*", - "$(interface)", - "mac" - ); + "ok" + expression => regextract( + ".*ether ([^\s]+).*(\n.*)*", "$(interface)", "mac" + ); darwin:: - - "ok" expression => regextract( - "(?s).*ether ([^\s]+).*(\n.*)*", - "$(interface)", - "mac" - ); + "ok" + expression => regextract( + "(?s).*ether ([^\s]+).*(\n.*)*", "$(interface)", "mac" + ); reports: - ok:: - "MAC address is $(mac[1])"; - } diff --git a/examples/getregistry.cf b/examples/getregistry.cf index d3eb3c13bd..4bab0f5730 100644 --- a/examples/getregistry.cf +++ b/examples/getregistry.cf @@ -1,41 +1,33 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "reg" }; + bundlesequence => { "reg" }; } bundle agent reg { vars: - windows:: - - "value" string => registryvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Northern.tech AS\Cfengine","value3"); + "value" + string => registryvalue( + "HKEY_LOCAL_MACHINE\SOFTWARE\Northern.tech AS\Cfengine", "value3" + ); reports: - - "Value extracted: $(value)"; - + "Value extracted: $(value)"; } diff --git a/examples/getuid.cf b/examples/getuid.cf index a5076eeeff..66efb4bc4d 100644 --- a/examples/getuid.cf +++ b/examples/getuid.cf @@ -1,40 +1,34 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - - "uid" int => getuid("root"); + "uid" int => getuid("root"); reports: - "root's uid is $(uid)"; + "root's uid is $(uid)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/getuserinfo.cf b/examples/getuserinfo.cf index 9a516f042e..2b40da905b 100644 --- a/examples/getuserinfo.cf +++ b/examples/getuserinfo.cf @@ -1,43 +1,43 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { - vars: - # note the results here will vary depending on your platform - "me" data => getuserinfo(); # the current user's info - "root" data => getuserinfo("root"); # the "root" user's info (usually UID 0) - "uid0" data => getuserinfo(0); # lookup user info for UID 0 (usually "root") - - # sys.user_data has the information for the user that started the agent - "out" string => format("I am '%s', root shell is '%s', and the agent was started by %S", "$(me[description])", "$(root[shell])", "sys.user_data"); + vars: + # note the results here will vary depending on your platform + "me" data => getuserinfo(); # the current user's info + "root" data => getuserinfo("root"); # the "root" user's info (usually UID 0) + "uid0" data => getuserinfo(0); # lookup user info for UID 0 (usually "root") + # sys.user_data has the information for the user that started the agent + "out" + string => format( + "I am '%s', root shell is '%s', and the agent was started by %S", + "$(me[description])", + "$(root[shell])", + "sys.user_data" + ); reports: - "$(out)"; + "$(out)"; } + #+end_src diff --git a/examples/getusers.cf b/examples/getusers.cf index faa37a0450..4f62509869 100644 --- a/examples/getusers.cf +++ b/examples/getusers.cf @@ -1,61 +1,53 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - - # The getusers function takes two filtering arguments: exclude_names and - # exclude_ids, both a comma separated list of usernames and user IDs - # respectively. - - # To get users with a uid 1000 and greater we generate a list of uids from - # 0 to 999 and convert it into a comma separated string used to filter the - # list of users. - - "users_with_uid_gt_999" - slist => getusers( "", join( ",", expandrange( "[0-999]", 1 ) ) ); - - # Here we get a list of users except usernames nfsnobody and vagrant as - # well as any users with uid 8 or 9 - - "users_except_nfsnobody_and_vagrant_and_uid_8_and_9" - slist => getusers( "nfsnobody,vagrant", "8,9" ); - - # Here we get a list of all users by not filtering any - "allusers" slist => getusers("",""); - "root_list" slist => { "root" }; - # this will get just the root users out of the full user list - "justroot" slist => intersection(allusers, root_list); + # The getusers function takes two filtering arguments: exclude_names and + # exclude_ids, both a comma separated list of usernames and user IDs + # respectively. + # To get users with a uid 1000 and greater we generate a list of uids from + # 0 to 999 and convert it into a comma separated string used to filter the + # list of users. + "users_with_uid_gt_999" + slist => getusers("", join(",", expandrange("[0-999]", 1))); + + # Here we get a list of users except usernames nfsnobody and vagrant as + # well as any users with uid 8 or 9 + "users_except_nfsnobody_and_vagrant_and_uid_8_and_9" + slist => getusers("nfsnobody,vagrant", "8,9"); + + # Here we get a list of all users by not filtering any + "allusers" slist => getusers("", ""); + "root_list" slist => { "root" }; + + # this will get just the root users out of the full user list + "justroot" slist => intersection(allusers, root_list); reports: - "Found just the root user: $(justroot)"; + "Found just the root user: $(justroot)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/getvalues.cf b/examples/getvalues.cf index 298b540738..443c863239 100644 --- a/examples/getvalues.cf +++ b/examples/getvalues.cf @@ -1,52 +1,43 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: + "v[index_1]" string => "value_1"; + "v[index_2]" string => "value_2"; + "values" slist => getvalues("v"); + "values_sorted" slist => sort(values, lex); - "v[index_1]" string => "value_1"; - "v[index_2]" string => "value_2"; - - "values" slist => getvalues("v"); - "values_sorted" slist => sort(values, lex); - - # works with data containers too - "d" data => parsejson('{ "k": [ 1, 2, 3, "a", "b", "c" ] }'); - - "cvalues" slist => getvalues("d[k]"); - "cvalues_sorted" slist => sort(cvalues, lex); + # works with data containers too + "d" data => parsejson('{ "k": [ 1, 2, 3, "a", "b", "c" ] }'); + "cvalues" slist => getvalues("d[k]"); + "cvalues_sorted" slist => sort(cvalues, lex); reports: - "Found values: $(values_sorted)"; - "Found container values: $(cvalues_sorted)"; - + "Found values: $(values_sorted)"; + "Found container values: $(cvalues_sorted)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/getvariablemetatags.cf b/examples/getvariablemetatags.cf index a251d7e164..805901dbe1 100644 --- a/examples/getvariablemetatags.cf +++ b/examples/getvariablemetatags.cf @@ -1,43 +1,40 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - "v" string => "myvalue", meta => { "mytag", "other=once", "other=twice" }; - "vtags" slist => getvariablemetatags("example.v"); - "othertag_values" slist => getvariablemetatags("example.v", "other"); + "v" + string => "myvalue", + meta => { "mytag", "other=once", "other=twice" }; - reports: - "Found tags: $(vtags)"; - "Found tags for key 'other': $(othertag_values)"; + "vtags" slist => getvariablemetatags("example.v"); + "othertag_values" slist => getvariablemetatags("example.v", "other"); + reports: + "Found tags: $(vtags)"; + "Found tags for key 'other': $(othertag_values)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/global_list_expansion.cf b/examples/global_list_expansion.cf index c295421588..9a6bfce3d6 100644 --- a/examples/global_list_expansion.cf +++ b/examples/global_list_expansion.cf @@ -1,62 +1,46 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # Show access of external lists. # # - to pass lists globally, use a parameter to dereference them -# - body common control { - bundlesequence => { hardening(@(va.tmpdirs)) }; + bundlesequence => { hardening(@(va.tmpdirs)) }; } ######################################################### - -bundle common va +bundle common va { vars: - - "tmpdirs" slist => { "/tmp", "/var/tmp", "/usr/tmp" }; - -} + "tmpdirs" slist => { "/tmp", "/var/tmp", "/usr/tmp" }; +} ########################################################## - bundle agent hardening(x) { classes: - - "ok" expression => "any"; + "ok" expression => "any"; vars: - - "other" slist => { "/tmp", "/var/tmp" }; + "other" slist => { "/tmp", "/var/tmp" }; reports: - ok:: - "Do $(x)"; "Other: $(other)"; -} +} diff --git a/examples/global_list_expansion_2.cf b/examples/global_list_expansion_2.cf index be31985219..707229aa03 100644 --- a/examples/global_list_expansion_2.cf +++ b/examples/global_list_expansion_2.cf @@ -1,61 +1,45 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # Show access of external lists. -# - body common control { - bundlesequence => { hardening }; + bundlesequence => { hardening }; } ######################################################### - -bundle common va +bundle common va { vars: - - "tmpdirs" slist => { "/tmp", "/var/tmp", "/usr/tmp" }; - -} + "tmpdirs" slist => { "/tmp", "/var/tmp", "/usr/tmp" }; +} ########################################################## - bundle agent hardening { classes: - - "ok" expression => "any"; + "ok" expression => "any"; vars: - - "other" slist => { "/tmp", "/var/tmp" }; - "x" slist => { @(va.tmpdirs) }; + "other" slist => { "/tmp", "/var/tmp" }; + "x" slist => { @(va.tmpdirs) }; reports: - ok:: - "Do $(x)"; "Other: $(other)"; -} +} diff --git a/examples/grep.cf b/examples/grep.cf index 5d9421a8ef..4fecbfc17c 100644 --- a/examples/grep.cf +++ b/examples/grep.cf @@ -1,49 +1,51 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test { vars: - - "mylist" slist => { "One", "Two", "Three", "Four", "Five" }; - "Tlist" slist => grep("T.*","mylist"); - "empty_list" slist => grep("ive","mylist"); - - "datalist" data => parsejson('[1,2,3, "Tab", "chive"]'); - "data_Tlist" slist => grep("T.*","datalist"); - "data_empty_list" slist => grep("ive","datalist"); - - "todo" slist => { "mylist", "Tlist", "empty_list", "datalist", "data_Tlist", "data_empty_list" }; - "$(todo)_str" string => format("%S", $(todo)); + "mylist" slist => { "One", "Two", "Three", "Four", "Five" }; + "Tlist" slist => grep("T.*", "mylist"); + "empty_list" slist => grep("ive", "mylist"); + "datalist" data => parsejson('[1,2,3, "Tab", "chive"]'); + "data_Tlist" slist => grep("T.*", "datalist"); + "data_empty_list" slist => grep("ive", "datalist"); + + "todo" + slist => { + "mylist", + "Tlist", + "empty_list", + "datalist", + "data_Tlist", + "data_empty_list", + }; + + "$(todo)_str" string => format("%S", $(todo)); reports: - "$(todo): $($(todo)_str)"; + "$(todo): $($(todo)_str)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/groupexists.cf b/examples/groupexists.cf index c6c5eddaa7..dba8ab6e08 100644 --- a/examples/groupexists.cf +++ b/examples/groupexists.cf @@ -1,45 +1,40 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################################### - bundle agent example { classes: - "gname" expression => groupexists("sys"); - "gid" expression => groupexists("0"); + "gname" expression => groupexists("sys"); + "gid" expression => groupexists("0"); reports: gname:: "Group exists by name"; + gid:: "Group exists by id"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/guest_environment_kvm.cf b/examples/guest_environment_kvm.cf index 27ee8322be..980f7d7d1b 100644 --- a/examples/guest_environment_kvm.cf +++ b/examples/guest_environment_kvm.cf @@ -1,61 +1,56 @@ -# # Management of KVM/QEMU virtual machines # Assumes you already have a disk image (with an OS installed) for the machine on creation -# - - body common control { - bundlesequence => { "kvm_create" }; + bundlesequence => { "kvm_create" }; } - -bundle agent kvm_create +bundle agent kvm_create { - guest_environments: - "my_host_machine" - environment_resources => mykvm("my_host_machine", "x86_64", "1", "1048576", "/var/lib/libvirt/images/ubuntu104-64-clone.img"), - environment_type => "kvm", - environment_state => "create", - environment_host => "ubuntu"; + "my_host_machine" + environment_resources => mykvm( + "my_host_machine", + "x86_64", + "1", + "1048576", + "/var/lib/libvirt/images/ubuntu104-64-clone.img" + ), + environment_type => "kvm", + environment_state => "create", + environment_host => "ubuntu"; } - bundle agent kvm_suspend { guest_environments: - "my_host_machine" - environment_type => "kvm", - environment_state => "suspended", - environment_host => "ubuntu"; + "my_host_machine" + environment_type => "kvm", + environment_state => "suspended", + environment_host => "ubuntu"; } - bundle agent kvm_run { guest_environments: - "my_host_machine" - environment_type => "kvm", - environment_state => "running", - environment_host => "ubuntu"; + "my_host_machine" + environment_type => "kvm", + environment_state => "running", + environment_host => "ubuntu"; } - bundle agent kvm_delete { guest_environments: - "my_host_machine" - environment_type => "kvm", - environment_state => "delete", - environment_host => "ubuntu"; + "my_host_machine" + environment_type => "kvm", + environment_state => "delete", + environment_host => "ubuntu"; } - body environment_resources mykvm(name, arch, cpu_count, mem_kb, disk_file) { - env_spec => - " + env_spec => " $(name) $(mem_kb) $(mem_kb) @@ -85,4 +80,3 @@ body environment_resources mykvm(name, arch, cpu_count, mem_kb, disk_file) "; } - diff --git a/examples/hash.cf b/examples/hash.cf index ebbda900e3..034d7c1d3c 100644 --- a/examples/hash.cf +++ b/examples/hash.cf @@ -1,49 +1,40 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example - { vars: - - "md5" string => hash("Cfengine is not cryptic","md5"); - "sha256" string => hash("Cfengine is not cryptic","sha256"); - "sha384" string => hash("Cfengine is not cryptic","sha384"); - "sha512" string => hash("Cfengine is not cryptic","sha512"); + "md5" string => hash("Cfengine is not cryptic", "md5"); + "sha256" string => hash("Cfengine is not cryptic", "sha256"); + "sha384" string => hash("Cfengine is not cryptic", "sha384"); + "sha512" string => hash("Cfengine is not cryptic", "sha512"); reports: - - "Hashed to: md5 $(md5)"; - "Hashed to: sha256 $(sha256)"; - "Hashed to: sha384 $(sha384)"; - "Hashed to: sha512 $(sha512)"; - + "Hashed to: md5 $(md5)"; + "Hashed to: sha256 $(sha256)"; + "Hashed to: sha384 $(sha384)"; + "Hashed to: sha512 $(sha512)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/hash_to_int.cf b/examples/hash_to_int.cf index 03d31b9a0d..ce0d8f9e94 100644 --- a/examples/hash_to_int.cf +++ b/examples/hash_to_int.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ############################################################################### #+begin_src cfengine3 body common control @@ -30,18 +24,18 @@ body common control bundle agent example { vars: - "hello" int => hash_to_int(0, 1000, "hello"); - "world" int => hash_to_int(0, 1000, "world"); + "hello" int => hash_to_int(0, 1000, "hello"); + "world" int => hash_to_int(0, 1000, "world"); # Hash can vary on hostkey or policy hub: - "hour" int => hash_to_int(0, 24, "$(sys.key_digest)"); + "hour" int => hash_to_int(0, 24, "$(sys.key_digest)"); "minute" int => hash_to_int(0, 60, "$(sys.policy_hub)"); reports: - "'hello' hashed to: $(hello)"; - "'world' hashed to: $(world)"; - + "'hello' hashed to: $(hello)"; + "'world' hashed to: $(world)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/hashcomment.cf b/examples/hashcomment.cf index e48687d877..d4dcd8ab87 100644 --- a/examples/hashcomment.cf +++ b/examples/hashcomment.cf @@ -1,73 +1,54 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ###################################################################### # # Comment lines # ###################################################################### - body common control - { - version => "1.2.3"; - bundlesequence => { "example" }; + version => "1.2.3"; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { files: - - "/home/mark/tmp/comment_test" - - create => "true", + "/home/mark/tmp/comment_test" + create => "true", edit_line => comment_lines_matching; } ######################################################## - bundle edit_line comment_lines_matching { vars: - - "regexes" slist => { "one.*", "two.*", "four.*" }; + "regexes" slist => { "one.*", "two.*", "four.*" }; replace_patterns: - - "^($(regexes))$" - replace_with => comment("# "); + "^($(regexes))$" replace_with => comment("# "); } ######################################## # Bodies ######################################## - body replace_with comment(c) - { - replace_value => "$(c) $(match.1)"; - occurrences => "all"; + replace_value => "$(c) $(match.1)"; + occurrences => "all"; } - diff --git a/examples/hashmatch.cf b/examples/hashmatch.cf index 2e3f8a2e4d..67811e6c0e 100644 --- a/examples/hashmatch.cf +++ b/examples/hashmatch.cf @@ -1,46 +1,34 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################################### - bundle agent example - -{ +{ classes: - - "matches" expression => hashmatch("/etc/passwd","md5","c5068b7c2b1707f8939b283a2758a691"); + "matches" + expression => hashmatch( + "/etc/passwd", "md5", "c5068b7c2b1707f8939b283a2758a691" + ); reports: - matches:: - "File has correct version"; - } - diff --git a/examples/hashuncomment.cf b/examples/hashuncomment.cf index 1b289b4e59..b5cee84635 100644 --- a/examples/hashuncomment.cf +++ b/examples/hashuncomment.cf @@ -1,72 +1,54 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ###################################################################### # # Uncomment lines # ###################################################################### - body common control - { - version => "1.2.3"; - bundlesequence => { "example" }; + version => "1.2.3"; + bundlesequence => { "example" }; } # try this on some test data like - # one # two # mark one #mark two - ######################################################## - bundle agent example - { files: - - "/home/mark/tmp/comment_test" - - create => "true", - edit_line => uncomment_lines_matching("\s*mark.*","#"); + "/home/mark/tmp/comment_test" + create => "true", + edit_line => uncomment_lines_matching("\s*mark.*", "#"); } ######################################################## - -bundle edit_line uncomment_lines_matching(regex,comment) +bundle edit_line uncomment_lines_matching(regex, comment) { replace_patterns: - - "#($(regex))$" replace_with => uncomment; + "#($(regex))$" replace_with => uncomment; } ######################################################## - body replace_with uncomment { - replace_value => "$(match.1)"; - occurrences => "all"; + replace_value => "$(match.1)"; + occurrences => "all"; } - diff --git a/examples/helloworld.cf b/examples/helloworld.cf index f6a802b06f..4fd19f9829 100644 --- a/examples/helloworld.cf +++ b/examples/helloworld.cf @@ -1,29 +1,23 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - bundle agent main { files: - "/tmp/hello_world" - create => "true", - content => "Hello, CFEngine!$(const.n)"; + "/tmp/hello_world" + create => "true", + content => "Hello, CFEngine!$(const.n)"; } diff --git a/examples/host2ip.cf b/examples/host2ip.cf index 02d23d273b..e2982ce649 100644 --- a/examples/host2ip.cf +++ b/examples/host2ip.cf @@ -1,49 +1,35 @@ - # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ####################################################### # # host2ip function # ####################################################### - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ####################################################### - bundle agent example - { vars: - - "ip" string => host2ip("www.google.com"); + "ip" string => host2ip("www.google.com"); reports: - - "IP address $(ip)"; - + "IP address $(ip)"; } diff --git a/examples/hostrange.cf b/examples/hostrange.cf index 79301a5166..2f1612665b 100644 --- a/examples/hostrange.cf +++ b/examples/hostrange.cf @@ -1,50 +1,46 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 bundle agent main { vars: - - "range" string => "1-32"; - "hostname_f" string => execresult( "hostname -f", useshell); - "hostname_s" string => execresult( "hostname -s", useshell); - "hostname" string => execresult( "hostname", useshell); + "range" string => "1-32"; + "hostname_f" string => execresult("hostname -f", useshell); + "hostname_s" string => execresult("hostname -s", useshell); + "hostname" string => execresult("hostname", useshell); classes: + "hostgroup_alpha_no_leading_zeros" + expression => hostrange("host", $(range)); + + "hostgroup_alpha_leading_zeros" + expression => hostrange("host", "00$(range)"); - "hostgroup_alpha_no_leading_zeros" expression => hostrange("host", $(range) ); - "hostgroup_alpha_leading_zeros" expression => hostrange("host", "00$(range)" ); - "hostgroup_alpha_UPPERCASE_prefix" expression => hostrange("HOST", "0$(range)" ); + "hostgroup_alpha_UPPERCASE_prefix" + expression => hostrange("HOST", "0$(range)"); reports: - "sys.fqhost = '$(sys.fqhost)'"; - "sys.uqhost = '$(sys.uqhost)'"; - "hostname -f = '$(hostname_f)'"; - "hostname -s = '$(hostname_s)'"; - "hostname = '$(hostname)'"; + "sys.fqhost = '$(sys.fqhost)'"; + "sys.uqhost = '$(sys.uqhost)'"; + "hostname -f = '$(hostname_f)'"; + "hostname -s = '$(hostname_s)'"; + "hostname = '$(hostname)'"; hostgroup_alpha_no_leading_zeros:: - "This host is within the alpha host group range (host$(range))"; hostgroup_alpha_leading_zeros:: @@ -53,6 +49,7 @@ bundle agent main hostgroup_alpha_UPPERCASE_prefix:: "This host is within the alpha host group range (HOST0$(range)) (NOTE: Leading zeros and prefix capitalization is insignificant)"; } + #+end_src ############################################################################### #+begin_src static_example_output diff --git a/examples/hostsseen.cf b/examples/hostsseen.cf index f764a77c56..ed7d0e001a 100644 --- a/examples/hostsseen.cf +++ b/examples/hostsseen.cf @@ -1,39 +1,29 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example - { vars: - - "myhosts" slist => { hostsseen("inf","lastseen","address") }; + "myhosts" slist => { hostsseen("inf", "lastseen", "address") }; reports: - "Found client/peer: $(myhosts)"; - + "Found client/peer: $(myhosts)"; } diff --git a/examples/hostswithclass.cf b/examples/hostswithclass.cf index cd230e3d9a..72e17c3c7b 100644 --- a/examples/hostswithclass.cf +++ b/examples/hostswithclass.cf @@ -1,20 +1,18 @@ body common control { - bundlesequence => { "example" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "example" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } - bundle agent example { vars: - am_policy_hub:: - "host_list" slist => hostswithclass( "debian", "name" ); + "host_list" slist => hostswithclass("debian", "name"); files: am_policy_hub:: "/tmp/master_config.cfg" - edit_line => insert_lines("host=$(host_list)"), - create => "true"; + edit_line => insert_lines("host=$(host_list)"), + create => "true"; } diff --git a/examples/hostswithgroup.cf b/examples/hostswithgroup.cf index 2ae2a1aa1e..3b49cf2bb7 100644 --- a/examples/hostswithgroup.cf +++ b/examples/hostswithgroup.cf @@ -8,8 +8,7 @@ bundle agent example { vars: am_policy_hub:: - "host_list" - slist => hostswithgroup("Linux", "name"); + "host_list" slist => hostswithgroup("Linux", "name"); files: am_policy_hub:: diff --git a/examples/hub.cf b/examples/hub.cf index 6a82c42d28..04aa50c71e 100644 --- a/examples/hub.cf +++ b/examples/hub.cf @@ -1,31 +1,24 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Remote value from hub # ######################################################## - # # run this as follows: # @@ -33,55 +26,40 @@ # cf-agent -f runtest_2.cf # # Notice that the same file configures all parts of cfengine - ######################################################## - body common control - { - bundlesequence => { "example" }; - - version => "1.2.3"; + bundlesequence => { "example" }; + version => "1.2.3"; } ######################################################## - bundle agent example - { vars: - - "remote_value" string => hubknowledge("monitoring"); + "remote_value" string => hubknowledge("monitoring"); reports: - - "Global knowledge: $(remote_value)"; + "Global knowledge: $(remote_value)"; } ######################################################### # Server config ######################################################### - -body server control - +body server control { - allowconnects => { "127.0.0.1" , "::1" }; - allowallconnects => { "127.0.0.1" , "::1" }; - trustkeysfrom => { "127.0.0.1" , "::1" }; - allowusers => { "mark" }; + allowconnects => { "127.0.0.1", "::1" }; + allowallconnects => { "127.0.0.1", "::1" }; + trustkeysfrom => { "127.0.0.1", "::1" }; + allowusers => { "mark" }; } ######################################################### - bundle server access_rules() - { access: - - "discovered value" - - handle => "monitoring", + "discovered value" + handle => "monitoring", resource_type => "literal", - admit => { "127.0.0.1" }; - + admit => { "127.0.0.1" }; } diff --git a/examples/id.cf b/examples/id.cf index 6779ef204b..48faccf8ac 100644 --- a/examples/id.cf +++ b/examples/id.cf @@ -1,110 +1,82 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test of promise references # ######################################################## - body common control - { - bundlesequence => { "example" }; - - version => "1.2.3"; + bundlesequence => { "example" }; + version => "1.2.3"; } ######################################################## - bundle agent example - { vars: - classes: - files: - - "/home/mark/tmp/testcopy" - - copy_from => mycopy("/home/mark/LapTop/words","127.0.0.1"), - perms => system, + "/home/mark/tmp/testcopy" + copy_from => mycopy("/home/mark/LapTop/words", "127.0.0.1"), + perms => system, depth_search => recurse("inf"); - } ######################################################### - body perms system - { - mode => "0644"; + mode => "0644"; } ######################################################### - body depth_search recurse(d) - { - depth => "$(d)"; + depth => "$(d)"; } ######################################################### - -body copy_from mycopy(from,server) - +body copy_from mycopy(from, server) { - source => "$(from)"; - servers => { "$(server)" }; - copy_backup => "true"; #/false/timestamp - purge => "false"; - type_check => "true"; - force_ipv4 => "true"; + source => "$(from)"; + servers => { "$(server)" }; + copy_backup => "true"; #/false/timestamp + purge => "false"; + type_check => "true"; + force_ipv4 => "true"; } ######################################################### # Server config ######################################################### - -body server control - +body server control { - allowconnects => { "127.0.0.1" , "::1" }; - allowallconnects => { "127.0.0.1" , "::1" }; - trustkeysfrom => { "127.0.0.1" , "::1" }; + allowconnects => { "127.0.0.1", "::1" }; + allowallconnects => { "127.0.0.1", "::1" }; + trustkeysfrom => { "127.0.0.1", "::1" }; } ######################################################### - bundle server access_rules() - { access: - - "/home/mark/LapTop" - - handle => "update_rule", - admit => { "127.0.0.1" }; + "/home/mark/LapTop" + handle => "update_rule", + admit => { "127.0.0.1" }; } diff --git a/examples/inform.cf b/examples/inform.cf index f47d69830a..830deeaca2 100644 --- a/examples/inform.cf +++ b/examples/inform.cf @@ -4,12 +4,10 @@ # etc. Since commands promises CAN modify the system, they create INFO # messages by default. However, not all commands promises do change the # system, so we let the policy writer customize this. - bundle agent main { commands: - "/bin/touch /tmp/module_cache" - inform => "true"; # Default + "/bin/touch /tmp/module_cache" inform => "true"; # Default "/bin/cat /tmp/module_cache" inform => "false", # Read-only promise, no INFO logging wanted module => "true"; diff --git a/examples/inherit.cf b/examples/inherit.cf index a2127d583f..505e946f9c 100644 --- a/examples/inherit.cf +++ b/examples/inherit.cf @@ -1,98 +1,70 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ###################################################################### # # Inheritance of classes # ###################################################################### - body common control - { - version => "1.2.3"; - bundlesequence => { "parent" }; + version => "1.2.3"; + bundlesequence => { "parent" }; } ######################################################## - bundle agent parent - { classes: - - "parent_private" expression => "any"; + "parent_private" expression => "any"; methods: - - "any" usebundle => child, + "any" + usebundle => child, inherit => "true"; files: - - "/tmp/bla" - + "/tmp/bla" create => "true", edit_line => edit_child, edit_defaults => inherit_all; - } ######################################################## - bundle agent child - { reports: - parent_private:: - "Parent class is inherited"; !parent_private:: - "Parent class is not inherited"; - } -# - bundle edit_line edit_child { reports: - parent_private:: - "Parent editclass is inherited"; !parent_private:: - "Parent editclass is not inherited"; - } -# - body edit_defaults inherit_all { - inherit => "true"; + inherit => "true"; } diff --git a/examples/inherit_from.cf b/examples/inherit_from.cf index 2882b7189a..dd9d810641 100644 --- a/examples/inherit_from.cf +++ b/examples/inherit_from.cf @@ -5,32 +5,33 @@ bundle agent __main__ { files: - "$(this.promise_filename).txt" - content => "Hello World$(const.n)2$(const.n)3$(const.n)4$(const.n)half-way + "$(this.promise_filename).txt" + content => "Hello World$(const.n)2$(const.n)3$(const.n)4$(const.n)half-way 6$(const.n)7$(const.n)8$(const.n)9$(const.n)Byeeeeeee", - create => "true"; + create => "true"; reports: - "The first 3 lines of this file are:" - printfile => head_n( "$(this.promise_filename).txt", "3" ); + "The first 3 lines of this file are:" + printfile => head_n("$(this.promise_filename).txt", "3"); - "The whole file contains:" - printfile => cat( "$(this.promise_filename).txt" ); + "The whole file contains:" printfile => cat("$(this.promise_filename).txt"); } body printfile head_n(file, lines) { - # Sets file_to_print the same as cat - inherit_from => cat( $(file) ); + # Sets file_to_print the same as cat + inherit_from => cat($(file)); - # Overrides number_of_lines from cat - number_of_lines => "$(lines)"; + # Overrides number_of_lines from cat + number_of_lines => "$(lines)"; } + body printfile cat(file) { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } + ############################################################################### #+begin_src example_output #@ ``` @@ -51,5 +52,3 @@ body printfile cat(file) #@ R: Byeeeeeee #@ ``` #+end_src - - diff --git a/examples/inherit_from_classes.cf b/examples/inherit_from_classes.cf index 5e1debb83c..a4ee6401e7 100644 --- a/examples/inherit_from_classes.cf +++ b/examples/inherit_from_classes.cf @@ -5,40 +5,45 @@ bundle agent __main__ { commands: - "/bin/true" - handle => "some meaningful string", - classes => my_set_some_extra_fancy_classes( "$(this.promiser)", - "$(this.handle)", - "some_class_to_handle_dependencies" ); + "/bin/true" + handle => "some meaningful string", + classes => my_set_some_extra_fancy_classes( + "$(this.promiser)", + "$(this.handle)", + "some_class_to_handle_dependencies" + ); - "/bin/false" - handle => "some meaningless string", - classes => my_set_some_extra_fancy_classes( "$(this.promiser)", - "$(this.handle)", - "some_class_to_handle_dependencies" ); + "/bin/false" + handle => "some meaningless string", + classes => my_set_some_extra_fancy_classes( + "$(this.promiser)", + "$(this.handle)", + "some_class_to_handle_dependencies" + ); reports: - "Defined classes:$(const.n)$(with)" - with => join( "$(const.n)", sort( classesmatching( "some_.*"), "lex" )); + "Defined classes:$(const.n)$(with)" + with => join("$(const.n)", sort(classesmatching("some_.*"), "lex")); } body classes my_set_some_extra_fancy_classes(x, y, z) # @brief In addition to the classes set by `set_some_fancy_classes` define `z` when the promise is repaired { - inherit_from => set_some_fancy_classes( $(x), $(y) ); - promise_repaired => { "some_fancy_class_${x}_${y}_repaired", $(z) }; + inherit_from => set_some_fancy_classes($(x), $(y)); + promise_repaired => { "some_fancy_class_${x}_${y}_repaired", $(z) }; } body classes set_some_fancy_classes(x, y) # @brief Define a class prefixed with `some_fancy_class_` followed by expansion # of `x`_`y` and suffixed with the promise outcome for each promise outcome. { - promise_kept => { "some_fancy_class_${x}_${y}_kept" }; - promise_repaired => { "some_fancy_class_${x}_${y}_repaired" }; - repair_failed => { "some_fancy_class_${x}_${y}_notkept" }; - repair_denied => { "some_fancy_class_${x}_${y}_notkept" }; - repair_timeout => { "some_fancy_class_${x}_${y}_notkept" }; + promise_kept => { "some_fancy_class_${x}_${y}_kept" }; + promise_repaired => { "some_fancy_class_${x}_${y}_repaired" }; + repair_failed => { "some_fancy_class_${x}_${y}_notkept" }; + repair_denied => { "some_fancy_class_${x}_${y}_notkept" }; + repair_timeout => { "some_fancy_class_${x}_${y}_notkept" }; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/inline-json.cf b/examples/inline-json.cf index 0d633592be..03098c7ec7 100644 --- a/examples/inline-json.cf +++ b/examples/inline-json.cf @@ -3,7 +3,8 @@ bundle agent example_inline_json # @brief Example illustrating inline json { vars: - "json_multi_line" data => '{ + "json_multi_line" + data => '{ "CFEngine Champions": [ { "Name": "Aleksey Tsalolikhin", @@ -16,21 +17,22 @@ bundle agent example_inline_json ] }'; - - "json_single_line" data => '[{"key1":"value1"},{"key2":"value2"}]'; + "json_single_line" data => '[{"key1":"value1"},{"key2":"value2"}]'; reports: - "Data container defined from json_multi_line: $(with)" - with => storejson( @(json_multi_line) ); + "Data container defined from json_multi_line: $(with)" + with => storejson(@(json_multi_line)); - "Data container defined from json_single_line: $(with)" - with => storejson( @(json_single_line) ); + "Data container defined from json_single_line: $(with)" + with => storejson(@(json_single_line)); } + bundle agent __main__ { methods: - "example_inline_json"; + "example_inline_json"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/inline-yaml.cf b/examples/inline-yaml.cf index 231b3fe890..8240c59345 100644 --- a/examples/inline-yaml.cf +++ b/examples/inline-yaml.cf @@ -3,31 +3,33 @@ bundle agent example_inline_yaml # @brief Example illustrating inline yaml { vars: - # YAML requires "---" header (followed by newline) - # NOTE \n is not interpreted as a newline, instead use $(const.n) - - "yaml_multi_line" data => '--- + # YAML requires "---" header (followed by newline) + # NOTE \n is not interpreted as a newline, instead use $(const.n) + "yaml_multi_line" + data => '--- - "CFEngine Champions": - Name: "Aleksey Tsalolikhin" Year: 2011 - Name: "Ted Zlatanov" Year : 2013'; - - "yaml_single_line" data => '---$(const.n)- key1: value1$(const.n)- key2: value2'; + "yaml_single_line" + data => '---$(const.n)- key1: value1$(const.n)- key2: value2'; reports: - "Data container defined from yaml_multi_line: $(with)" - with => storejson( @(yaml_multi_line) ); + "Data container defined from yaml_multi_line: $(with)" + with => storejson(@(yaml_multi_line)); - "Data container defined from yaml_single_line: $(with)" - with => storejson( @(yaml_single_line) ); + "Data container defined from yaml_single_line: $(with)" + with => storejson(@(yaml_single_line)); } + bundle agent __main__ { methods: - "example_inline_yaml"; + "example_inline_yaml"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/insert_users.cf b/examples/insert_users.cf index 99433fc759..6b707ec02e 100644 --- a/examples/insert_users.cf +++ b/examples/insert_users.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Insert users into the passwd file of a system by @@ -27,108 +21,74 @@ # for /etc/shadow # ######################################################## - body common control - { - bundlesequence => { "updateusers" }; + bundlesequence => { "updateusers" }; } ######################################################## - bundle agent updateusers - { vars: - - # Set $(testing) to "" for production - - "testing" string => "/home/mark/tmp"; - "tmp" string => "$(testing)/etc/passwd_tmp"; - - "extract_users" slist => { "mark", "root", "at", "www-run" }; + # Set $(testing) to "" for production + "testing" string => "/home/mark/tmp"; + "tmp" string => "$(testing)/etc/passwd_tmp"; + "extract_users" slist => { "mark", "root", "at", "www-run" }; files: + # Take the passwed entries from source and add them to real_passwd + "$(tmp)" + create => "true", + edit_line => SelectUsers( + "$(testing)/masterfiles/passwd", "@(this.extract_users)" + ); - # - # Take the passwed entries from source and add them to real_passwd - # - - "$(tmp)" - - create => "true", - edit_line => SelectUsers("$(testing)/masterfiles/passwd","@(this.extract_users)"); - - # - # Intermediate file - should be secure - not in /tmp - # - - "$(testing)/etc/passwd" - - edit_line => ReplaceUsers("$(tmp)","@(this.extract_users)"); - - # - - "$(testing)/home/$(extract_users)/." + # Intermediate file - should be secure - not in /tmp + "$(testing)/etc/passwd" + edit_line => ReplaceUsers("$(tmp)", "@(this.extract_users)"); + "$(testing)/home/$(extract_users)/." create => "true", perms => userdir("$(extract_users)"); } - - - - - ######################################################## # Library stuff ######################################################## - body perms userdir(u) { - mode => "755"; - owners => { "$(u)" }; - groups => { "users" }; + mode => "755"; + owners => { "$(u)" }; + groups => { "users" }; } ######################################################## - -bundle edit_line SelectUsers(f,l) +bundle edit_line SelectUsers(f, l) { insert_lines: - - "$(f)" - + "$(f)" insert_type => "file", insert_select => keep("@(l)"); } ######################################################## - -bundle edit_line ReplaceUsers(f,l) +bundle edit_line ReplaceUsers(f, l) { delete_lines: - - "$(f)" - delete_select => discard("@(l)"); + "$(f)" delete_select => discard("@(l)"); insert_lines: - - "$(f)" - - insert_type => "file"; + "$(f)" insert_type => "file"; } ######################################################## - body insert_select keep(s) { - insert_if_startwith_from_list => { @(s) }; + insert_if_startwith_from_list => { @(s) }; } ######################################################## - body delete_select discard(s) { - delete_if_not_startwith_from_list => { @(s) }; + delete_if_not_startwith_from_list => { @(s) }; } diff --git a/examples/int.cf b/examples/int.cf index ef372dc62b..820a2c8eed 100644 --- a/examples/int.cf +++ b/examples/int.cf @@ -2,18 +2,19 @@ bundle agent main { vars: - "data" data => '{"acft_name": "A320neo", + "data" + data => '{"acft_name": "A320neo", "engine_num": "2", "price_in_USD": "123.456789k"}'; - "engines" int => int("$(data[engine_num])"); - "ballpark_price" int => int("$(data[price_in_USD])"); + "engines" int => int("$(data[engine_num])"); + "ballpark_price" int => int("$(data[price_in_USD])"); reports: - "A320neo has $(engines) engines and costs about $(ballpark_price) USD."; + "A320neo has $(engines) engines and costs about $(ballpark_price) USD."; } -#+end_src +#+end_src #+begin_src example_output #@ ``` #@ R: A320neo has 2 engines and costs about 123456 USD. diff --git a/examples/intarray.cf b/examples/intarray.cf index 7dd0dc25e6..67dc36b7b4 100644 --- a/examples/intarray.cf +++ b/examples/intarray.cf @@ -1,43 +1,30 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################################### - bundle agent example - -{ +{ vars: - - "dim_array" - - int => readstringarray("array_name","/tmp/array","#[^\n]*",":",10,4000); - - + "dim_array" + int => readstringarray( + "array_name", "/tmp/array", "#[^\n]*", ":", 10, 4000 + ); } - diff --git a/examples/intersection.cf b/examples/intersection.cf index ece7c2e99b..98e3661875 100644 --- a/examples/intersection.cf +++ b/examples/intersection.cf @@ -1,47 +1,42 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test { vars: - "a" slist => { 1,2,3,"x" }; - "b" slist => { "x" }; + "a" slist => { 1, 2, 3, "x" }; + "b" slist => { "x" }; + "mylist1" slist => { "a", "b" }; + "mylist2" slist => { "a", "b" }; + "$(mylist1)_str" string => join(",", $(mylist1)); + "int_$(mylist1)_$(mylist2)" slist => intersection($(mylist1), $(mylist2)); - "mylist1" slist => { "a", "b" }; - "mylist2" slist => { "a", "b" }; - "$(mylist1)_str" string => join(",", $(mylist1)); - - "int_$(mylist1)_$(mylist2)" slist => intersection($(mylist1), $(mylist2)); - "int_$(mylist1)_$(mylist2)_str" string => join(",", "int_$(mylist1)_$(mylist2)"); + "int_$(mylist1)_$(mylist2)_str" + string => join(",", "int_$(mylist1)_$(mylist2)"); reports: - "The intersection of list '$($(mylist1)_str)' with '$($(mylist2)_str)' is '$(int_$(mylist1)_$(mylist2)_str)'"; + "The intersection of list '$($(mylist1)_str)' with '$($(mylist2)_str)' is '$(int_$(mylist1)_$(mylist2)_str)'"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/inventory_cpu.cf b/examples/inventory_cpu.cf index 8734152f56..aacf0535c7 100644 --- a/examples/inventory_cpu.cf +++ b/examples/inventory_cpu.cf @@ -1,28 +1,25 @@ # Demo on how to extract the first "model name" field from /proc/cpuinfo # into a variable. # Can be used for inventory information in CFEngine Nova and above. - body common control { - bundlesequence => { "inventory" }; + bundlesequence => { "inventory" }; } ### - bundle common inventory { vars: - "cpuinfo" string => execresult("/bin/grep \"model name\" /proc/cpuinfo", "noshell"); - + "cpuinfo" + string => execresult("/bin/grep \"model name\" /proc/cpuinfo", "noshell"); + got_model_name:: - "cpu" string => "$(myarray[1])"; + "cpu" string => "$(myarray[1])"; classes: - - "got_model_name" expression => regextract( - "model\s+name\s+:\s+([^\n]*)\n?.*", - "$(cpuinfo)", - "myarray" + "got_model_name" + expression => regextract( + "model\s+name\s+:\s+([^\n]*)\n?.*", "$(cpuinfo)", "myarray" ); reports: @@ -32,4 +29,3 @@ bundle common inventory !got_model_name:: "Did not match CPU model name"; } - diff --git a/examples/ip2host.cf b/examples/ip2host.cf index 414b7528eb..62780685b5 100644 --- a/examples/ip2host.cf +++ b/examples/ip2host.cf @@ -1,38 +1,32 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "reverse_lookup" }; + bundlesequence => { "reverse_lookup" }; } bundle agent reverse_lookup { vars: - "local4" string => ip2host("127.0.0.1"); + "local4" string => ip2host("127.0.0.1"); - # this will be localhost on some systems, ip6-localhost on others... - "local6" string => ip2host("::1"); + # this will be localhost on some systems, ip6-localhost on others... + "local6" string => ip2host("::1"); reports: _cfe_output_testing:: @@ -42,6 +36,7 @@ bundle agent reverse_lookup "local4 is $(local4)"; "local6 is $(local6)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/iprange.cf b/examples/iprange.cf index d08f697ec2..cbb806b232 100644 --- a/examples/iprange.cf +++ b/examples/iprange.cf @@ -1,50 +1,35 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################################### - bundle agent example - -{ +{ classes: - - "adhoc_group_1" expression => iprange("192.168.1.50-140"); - "adhoc_group_2" expression => iprange("192.168.1.0/24"); + "adhoc_group_1" expression => iprange("192.168.1.50-140"); + "adhoc_group_2" expression => iprange("192.168.1.0/24"); reports: - adhoc_group_1:: - "Some numerology"; adhoc_group_2:: - "The masked warriors"; } - diff --git a/examples/irange.cf b/examples/irange.cf index ec8c32b904..5312a950cc 100644 --- a/examples/irange.cf +++ b/examples/irange.cf @@ -1,59 +1,50 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - body common control { - bundlesequence => { "cleanup" }; + bundlesequence => { "cleanup" }; } bundle agent cleanup { files: - # This will not delete the parent - - "/home/mark/tmp/testcopy" + # This will not delete the parent + "/home/mark/tmp/testcopy" delete => tidyfiles, file_select => changed_within_1_year, depth_search => recurse; - #Now delete the parent. - - "/home/mark/tmp/testcopy" - delete => tidyfiles; + #Now delete the parent. + "/home/mark/tmp/testcopy" delete => tidyfiles; } body delete tidyfiles { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } body file_select changed_within_1_year { - mtime => irange(ago(1,0,0,0,0,0),now); - file_result => "mtime"; + mtime => irange(ago(1, 0, 0, 0, 0, 0), now); + file_result => "mtime"; } body depth_search recurse { - depth => "inf"; + depth => "inf"; } diff --git a/examples/is_type.cf b/examples/is_type.cf index 8e6d39830d..5d2d6faf40 100644 --- a/examples/is_type.cf +++ b/examples/is_type.cf @@ -7,30 +7,27 @@ body common control bundle agent example { vars: - "foo" - data => '{ "bar": true }'; - "a" - string => "hello"; + "foo" data => '{ "bar": true }'; + "a" string => "hello"; classes: - "isdata" - expression => is_type("foo", "data"); - "isdata_boolean" - expression => is_type("foo[bar]", "data boolean"); - "isstring" - expression => is_type("a", "string"); - "isint" - expression => is_type("a", "int"); + "isdata" expression => is_type("foo", "data"); + "isdata_boolean" expression => is_type("foo[bar]", "data boolean"); + "isstring" expression => is_type("a", "string"); + "isint" expression => is_type("a", "int"); reports: isdata:: - "'foo' is of type 'data'"; + "'foo' is of type 'data'"; + isdata_boolean:: - "'foo[bar]' is of type 'data boolean'"; + "'foo[bar]' is of type 'data boolean'"; + isstring:: - "'a' is of type 'string'"; + "'a' is of type 'string'"; + isint:: - "'a' is of type 'int'"; + "'a' is of type 'int'"; } #+end_src diff --git a/examples/isconnectable.cf b/examples/isconnectable.cf index c6a04eb0c0..8c9be63df2 100644 --- a/examples/isconnectable.cf +++ b/examples/isconnectable.cf @@ -6,12 +6,12 @@ body common control bundle agent example { classes: - "isconnectable" - expression => isconnectable("localhost", 22, "30"); + "isconnectable" expression => isconnectable("localhost", 22, "30"); reports: isconnectable:: "Port is connectable"; + !isconnectable:: "Port is not connectable"; } diff --git a/examples/isdir.cf b/examples/isdir.cf index db3ec14bf4..941c5f3abb 100644 --- a/examples/isdir.cf +++ b/examples/isdir.cf @@ -1,44 +1,35 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { classes: - - "isdir" expression => isdir("/"); + "isdir" expression => isdir("/"); reports: - isdir:: - "Directory exists.."; - } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/isexecutable.cf b/examples/isexecutable.cf index ff06e24368..2bd1d0695e 100644 --- a/examples/isexecutable.cf +++ b/examples/isexecutable.cf @@ -1,40 +1,35 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { classes: + "yes" expression => isexecutable("/bin/ls"); - "yes" expression => isexecutable("/bin/ls"); reports: yes:: "/bin/ls is an executable file"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/isgreaterthan.cf b/examples/isgreaterthan.cf index c34c3df627..aeebeff2d6 100644 --- a/examples/isgreaterthan.cf +++ b/examples/isgreaterthan.cf @@ -1,48 +1,38 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { classes: - - "ok" expression => isgreaterthan("1","0"); + "ok" expression => isgreaterthan("1", "0"); reports: - ok:: - "Assertion is true"; !ok:: - "Assertion is false"; - } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/isipinsubnet.cf b/examples/isipinsubnet.cf index e3cbd34208..622061a021 100644 --- a/examples/isipinsubnet.cf +++ b/examples/isipinsubnet.cf @@ -1,38 +1,31 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ############################################################################### #+begin_src cfengine3 bundle agent main { classes: - - "in_192" expression => isipinsubnet("192.0.0.0/8", "192.1.2.3"); - "in_192_2_2_2" expression => isipinsubnet("192.2.2.0/24", "192.1.2.3"); + "in_192" expression => isipinsubnet("192.0.0.0/8", "192.1.2.3"); + "in_192_2_2_2" expression => isipinsubnet("192.2.2.0/24", "192.1.2.3"); reports: - in_192:: "The address 192.1.2.3 is in the 192/8 subnet"; + !in_192_2_2_2:: "The address 192.1.2.3 is not in the 192.2.2/24 subnet"; } diff --git a/examples/islessthan.cf b/examples/islessthan.cf index aaddd9892e..7c3568c29b 100644 --- a/examples/islessthan.cf +++ b/examples/islessthan.cf @@ -1,48 +1,38 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test { classes: - - "ok" expression => islessthan("0","1"); + "ok" expression => islessthan("0", "1"); reports: - ok:: - "Assertion is true"; !ok:: - "Assertion is false"; - } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/islink.cf b/examples/islink.cf index 52a12dba40..a493859b12 100644 --- a/examples/islink.cf +++ b/examples/islink.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ ln -fs /tmp/cfe_testhere.txt /tmp/link @@ -29,22 +23,19 @@ #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { classes: - - "islink" expression => islink("/tmp/link"); + "islink" expression => islink("/tmp/link"); reports: - islink:: - "It's a link."; - } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/isnewerthan.cf b/examples/isnewerthan.cf index bb928c9d2c..c502b302f7 100644 --- a/examples/isnewerthan.cf +++ b/examples/isnewerthan.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ touch -t '200102031234.56' /tmp/earlier @@ -30,21 +24,19 @@ #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { classes: - - "do_it" expression => isnewerthan("/tmp/later","/tmp/earlier"); + "do_it" expression => isnewerthan("/tmp/later", "/tmp/earlier"); reports: - do_it:: - "/tmp/later is older than /tmp/earlier"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/isnewerthantime.cf b/examples/isnewerthantime.cf index 514159c762..117da703f4 100644 --- a/examples/isnewerthantime.cf +++ b/examples/isnewerthantime.cf @@ -20,9 +20,11 @@ bundle agent example reports: !is_file_a_new:: "/tmp/file_a is not newer than 2001-09-09 01:46:40"; + is_file_b_new:: "/tmp/file_b is newer than 2001-09-09 01:46:40"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/isplain.cf b/examples/isplain.cf index a97f92742d..681eea7916 100644 --- a/examples/isplain.cf +++ b/examples/isplain.cf @@ -1,47 +1,39 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { classes: - - "fileisplain" expression => isplain("/etc/passwd"); - "dirisnotplain" not => isplain("/"); + "fileisplain" expression => isplain("/etc/passwd"); + "dirisnotplain" not => isplain("/"); reports: - fileisplain:: "/etc/passwd is plain.."; dirisnotplain:: "/ is not plain.."; - } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/isreadable.cf b/examples/isreadable.cf index 25fc7d7832..70ff107038 100644 --- a/examples/isreadable.cf +++ b/examples/isreadable.cf @@ -8,14 +8,14 @@ bundle agent __main__ { vars: - "filename" - string => "/tmp/foo.txt"; - "timeout" - int => "3"; + "filename" string => "/tmp/foo.txt"; + "timeout" int => "3"; + reports: - "File '$(filename)' is readable" - if => isreadable("$(filename)", "$(timeout)"); + "File '$(filename)' is readable" + if => isreadable("$(filename)", "$(timeout)"); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/isvariable.cf b/examples/isvariable.cf index af7acc36b8..30a6e3ef97 100644 --- a/examples/isvariable.cf +++ b/examples/isvariable.cf @@ -1,48 +1,38 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - - "bla" string => "xyz.."; + "bla" string => "xyz.."; classes: - - "exists" expression => isvariable("bla"); + "exists" expression => isvariable("bla"); reports: - exists:: - "Variable exists: \"$(bla)\".."; - } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/iteration.cf b/examples/iteration.cf index ecc1e11b6a..0e5aa8808e 100644 --- a/examples/iteration.cf +++ b/examples/iteration.cf @@ -1,45 +1,33 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # Nested iteration -# - body common control { - bundlesequence => {"x"}; + bundlesequence => { "x" }; } bundle agent x { vars: - - "list1" slist => { "a", "b", "c" }; - - "list2" slist => { "1", "2", "3", "4" }; - - "list3" slist => { "x", "y", "z" }; + "list1" slist => { "a", "b", "c" }; + "list2" slist => { "1", "2", "3", "4" }; + "list3" slist => { "x", "y", "z" }; reports: - "Hello $(list1) $(list2) $(list3)"; + "Hello $(list1) $(list2) $(list3)"; } - diff --git a/examples/join.cf b/examples/join.cf index 310c081041..29832bf91e 100644 --- a/examples/join.cf +++ b/examples/join.cf @@ -1,51 +1,49 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test { vars: + "mylist" slist => { "one", "two", "three", "four", "five" }; - "mylist" slist => { "one", "two", "three", "four", "five" }; - "datalist" data => parsejson('[1,2,3, + "datalist" + data => parsejson( + '[1,2,3, "one", "two", "three", "long string", "four", "fix", "six", - "one", "two", "three",]'); + "one", "two", "three",]' + ); - "mylist_str" string => format("%S", mylist); - "datalist_str" string => format("%S", datalist); - "myscalar" string => join("->", mylist); - "datascalar" string => join("->", datalist); + "mylist_str" string => format("%S", mylist); + "datalist_str" string => format("%S", datalist); + "myscalar" string => join("->", mylist); + "datascalar" string => join("->", datalist); reports: - "Concatenated $(mylist_str): $(myscalar)"; - "Concatenated $(datalist_str): $(datascalar)"; + "Concatenated $(mylist_str): $(myscalar)"; + "Concatenated $(datalist_str): $(datascalar)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/kill_process_running_wrong_user.cf b/examples/kill_process_running_wrong_user.cf index 2e2d3c1e13..7f23a21dd3 100644 --- a/examples/kill_process_running_wrong_user.cf +++ b/examples/kill_process_running_wrong_user.cf @@ -1,37 +1,29 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 bundle agent main { - processes: - - # Any /usr/local/web/tomcat-logviewer processes not - # running as buildsrv should be killed on sight. - - "/usr/local/web/tomcat-logviewer" -> { "security" } - process_select => not_running_as("buildsrv"), - signals => { "kill" }, - comment => "It is against the security policy for this + processes: + # Any /usr/local/web/tomcat-logviewer processes not + # running as buildsrv should be killed on sight. + "/usr/local/web/tomcat-logviewer" -> { "security" } + process_select => not_running_as("buildsrv"), + signals => { "kill" }, + comment => "It is against the security policy for this service to run under the wrong user id."; } @@ -42,6 +34,7 @@ body process_select not_running_as(owner) process_owner => { $(owner) }; process_result => "!process_owner"; } + #+end_src ############################################################################### #+begin_src static_example_output diff --git a/examples/lastnode.cf b/examples/lastnode.cf index ab2567f598..0c112eceea 100644 --- a/examples/lastnode.cf +++ b/examples/lastnode.cf @@ -1,52 +1,43 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "yes" }; + bundlesequence => { "yes" }; } bundle agent yes { vars: - - "path1" string => "/one/two/last1"; - "path2" string => "one:two:last2"; - "path4" string => "/one/two/"; - - "last1" string => lastnode("$(path1)","/"); - "last2" string => lastnode("$(path2)",":"); - - "last3" string => lastnode("$(path2)","/"); - "last4" string => lastnode("$(path4)","/"); + "path1" string => "/one/two/last1"; + "path2" string => "one:two:last2"; + "path4" string => "/one/two/"; + "last1" string => lastnode("$(path1)", "/"); + "last2" string => lastnode("$(path2)", ":"); + "last3" string => lastnode("$(path2)", "/"); + "last4" string => lastnode("$(path4)", "/"); reports: - "Last / node in / path '$(path1)' = '$(last1)'"; - "Last : node in : path '$(path2)' = '$(last2)'"; - "Last / node in : path '$(path2)' = '$(last3)'"; - "Last / node in /-terminated path '$(path4)' = '$(last4)'"; - + "Last / node in / path '$(path1)' = '$(last1)'"; + "Last : node in : path '$(path2)' = '$(last2)'"; + "Last / node in : path '$(path2)' = '$(last3)'"; + "Last / node in /-terminated path '$(path4)' = '$(last4)'"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/ldap.cf b/examples/ldap.cf index 06df601cd6..ce9e0bf69e 100644 --- a/examples/ldap.cf +++ b/examples/ldap.cf @@ -1,31 +1,22 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - -# - body common control { - bundlesequence => { "ldap" , "followup"}; + bundlesequence => { "ldap", "followup" }; } ################################################################################################### @@ -33,45 +24,66 @@ body common control # You could destroy a system by assuming that the service will respond with a # sensible result. Cfengine does not recommend reliance on network services in configuration. ################################################################################################### - bundle agent ldap { vars: - - # Get the first matching value for "uid" - - "value" string => ldapvalue("ldap://eternity.iu.hio.no","dc=cfengine,dc=com","(sn=User)","uid","subtree","none"); - - # Geta all matching values for "uid" - should be a single record match - - "list" slist => ldaplist("ldap://eternity.iu.hio.no","dc=cfengine,dc=com","(sn=User)","uid","subtree","none"); + # Get the first matching value for "uid" + "value" + string => ldapvalue( + "ldap://eternity.iu.hio.no", + "dc=cfengine,dc=com", + "(sn=User)", + "uid", + "subtree", + "none" + ); + + # Geta all matching values for "uid" - should be a single record match + "list" + slist => ldaplist( + "ldap://eternity.iu.hio.no", + "dc=cfengine,dc=com", + "(sn=User)", + "uid", + "subtree", + "none" + ); classes: - - "gotdata" expression => ldaparray("myarray","ldap://eternity.iu.hio.no","dc=cfengine,dc=com","(uid=mark)","subtree","none"); - - "found" expression => regldap("ldap://eternity.iu.hio.no","dc=cfengine,dc=com","(sn=User)","uid","subtree","jon.*","none"); + "gotdata" + expression => ldaparray( + "myarray", + "ldap://eternity.iu.hio.no", + "dc=cfengine,dc=com", + "(uid=mark)", + "subtree", + "none" + ); + + "found" + expression => regldap( + "ldap://eternity.iu.hio.no", + "dc=cfengine,dc=com", + "(sn=User)", + "uid", + "subtree", + "jon.*", + "none" + ); reports: - - "LDAP VALUE $(value) found"; - "LDAP LIST VALUE $(list)"; + "LDAP VALUE $(value) found"; + "LDAP LIST VALUE $(list)"; gotdata:: - "Found specific entry data ...$(ldap.myarray[uid]),$(ldap.myarray[gecos]), etc"; found:: - "Matched regex"; - } bundle agent followup - { reports: - - "Different bundle ...$(ldap.myarray[uid]),$(ldap.myarray[gecos]), etc"; - + "Different bundle ...$(ldap.myarray[uid]),$(ldap.myarray[gecos]), etc"; } diff --git a/examples/length.cf b/examples/length.cf index 61f0a6ef30..fa406dc634 100644 --- a/examples/length.cf +++ b/examples/length.cf @@ -1,50 +1,53 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } 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", }; - "length" int => length("test"); - "test_str" string => join(",", "test"); + "length" int => length("test"); + "test_str" string => join(",", "test"); reports: - "The test list is $(test_str)"; - "The test list has $(length) elements"; + "The test list is $(test_str)"; + "The test list has $(length) elements"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/linking.cf b/examples/linking.cf index addcd7e1b1..2beca5739d 100644 --- a/examples/linking.cf +++ b/examples/linking.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ###################################################################### # # File editing @@ -30,57 +24,40 @@ # - insert # ###################################################################### - - body common control - { - version => "1.2.3"; - bundlesequence => { "example" }; + version => "1.2.3"; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { files: - - # Make a copy of the password file - - "/home/mark/tmp/passwd" - - link_from => linkdetails("/etc/passwd"), + # Make a copy of the password file + "/home/mark/tmp/passwd" + link_from => linkdetails("/etc/passwd"), move_obstructions => "true"; - - "/home/mark/tmp/linktest" - - link_from => linkchildren("/usr/local/sbin"); - + "/home/mark/tmp/linktest" link_from => linkchildren("/usr/local/sbin"); #child links } ######################################################### - body link_from linkdetails(tofile) - { - source => "$(tofile)"; - link_type => "symlink"; - when_no_source => "force"; # kill + source => "$(tofile)"; + link_type => "symlink"; + when_no_source => "force"; # kill } ######################################################### - body link_from linkchildren(tofile) - { - source => "$(tofile)"; - link_type => "symlink"; - when_no_source => "force"; # kill - link_children => "true"; - when_linking_children => "if_no_such_file"; # "override_file"; + source => "$(tofile)"; + link_type => "symlink"; + when_no_source => "force"; # kill + link_children => "true"; + when_linking_children => "if_no_such_file"; # "override_file"; } - diff --git a/examples/literal_server.cf b/examples/literal_server.cf index e991f2df5e..525d2cd62f 100644 --- a/examples/literal_server.cf +++ b/examples/literal_server.cf @@ -1,31 +1,24 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Remote value from server connection to cfServer # ######################################################## - # # run this as follows: # @@ -33,77 +26,60 @@ # cf-agent -f runtest_2.cf # # Notice that the same file configures all parts of cfengine - ######################################################## - body common control - { - bundlesequence => { "example" }; - - version => "1.2.3"; + bundlesequence => { "example" }; + version => "1.2.3"; } ######################################################## - bundle agent example - { vars: + "encrypt" string => "yes"; + "x" string => "scalar2"; + "remote1" string => remotescalar("test_scalar1", "127.0.0.1", "$(encrypt)"); + "remote2" string => remotescalar("test_scalar2", "127.0.0.1", "$(encrypt)"); + "remote3" string => remotescalar("test_scalar3", "127.0.0.1", "$(encrypt)"); - "encrypt" string => "yes"; - - "x" string => "scalar2"; - "remote1" string => remotescalar("test_scalar1","127.0.0.1","$(encrypt)"); - "remote2" string => remotescalar("test_scalar2","127.0.0.1","$(encrypt)"); - "remote3" string => remotescalar("test_scalar3","127.0.0.1","$(encrypt)"); - "remote_error" string => remotescalar("test_$(x)","127.0.0.2","$(encrypt)"); + "remote_error" + string => remotescalar("test_$(x)", "127.0.0.2", "$(encrypt)"); reports: - - "Receive value $(remote1), $(remote2), $(remote3)"; - - "And an error gives: $(remote_error)"; + "Receive value $(remote1), $(remote2), $(remote3)"; + "And an error gives: $(remote_error)"; } ######################################################### # Server config ######################################################### - -body server control - +body server control { - allowconnects => { "127.0.0.1" , "::1" }; - allowallconnects => { "127.0.0.1" , "::1" }; - trustkeysfrom => { "127.0.0.1" , "::1" }; - allowusers => { "mark" }; + allowconnects => { "127.0.0.1", "::1" }; + allowallconnects => { "127.0.0.1", "::1" }; + trustkeysfrom => { "127.0.0.1", "::1" }; + allowusers => { "mark" }; } ######################################################### - bundle server access_rules() - { vars: - - "localvar" string => "literal string"; + "localvar" string => "literal string"; access: - - "Embed a $(localvar) for remote access" - - handle => "test_scalar1", + "Embed a $(localvar) for remote access" + handle => "test_scalar1", resource_type => "literal", - admit => { "127.0.0.1" }; - + admit => { "127.0.0.1" }; - "Mary had a little lamb whose fleece was white as snow and everywhere that Mary went she wore it lovingly" - - handle => "test_scalar2", + "Mary had a little lamb whose fleece was white as snow and everywhere that Mary went she wore it lovingly" + handle => "test_scalar2", resource_type => "literal", - admit => { "127.0.0.1" }; + admit => { "127.0.0.1" }; - "/etc/passwd" - handle => "test_scalar3", - admit => { "127.0.0.1" }; + "/etc/passwd" + handle => "test_scalar3", + admit => { "127.0.0.1" }; } diff --git a/examples/local_group_present.cf b/examples/local_group_present.cf index 4716797231..12b89cdd31 100644 --- a/examples/local_group_present.cf +++ b/examples/local_group_present.cf @@ -7,11 +7,9 @@ body file control bundle agent main { classes: - "group_cfengineers_absent" - not => groupexists("cfengineers"); + "group_cfengineers_absent" not => groupexists("cfengineers"); commands: linux.group_cfengineers_absent:: - "$(paths.groupadd)" - args => "cfengineers"; + "$(paths.groupadd)" args => "cfengineers"; } diff --git a/examples/local_user_password.cf b/examples/local_user_password.cf index 535c7cf915..c7b8494739 100644 --- a/examples/local_user_password.cf +++ b/examples/local_user_password.cf @@ -7,7 +7,7 @@ body file control bundle agent main { vars: - # This is the hashed password for 'vagrant' + # This is the hashed password for 'vagrant' debian_8:: "root_hash" string => "$6$1nRTeNoE$DpBSe.eDsuZaME0EydXBEf.DAwuzpSoIJhkhiIAPgRqVKlmI55EONfvjZorkxNQvK2VFfMm9txx93r2bma/4h/"; @@ -16,6 +16,6 @@ bundle agent main linux:: "root" policy => "present", - password => hashed_password( $(root_hash) ), + password => hashed_password($(root_hash)), if => isvariable("root_hash"); } diff --git a/examples/local_users_absent.cf b/examples/local_users_absent.cf index f6c8dc3c99..70e58ba709 100644 --- a/examples/local_users_absent.cf +++ b/examples/local_users_absent.cf @@ -5,6 +5,5 @@ bundle agent main users: linux:: - "$(users)" - policy => "absent"; + "$(users)" policy => "absent"; } diff --git a/examples/local_users_locked.cf b/examples/local_users_locked.cf index b3a6f30f1c..de22908b92 100644 --- a/examples/local_users_locked.cf +++ b/examples/local_users_locked.cf @@ -5,6 +5,5 @@ bundle agent main users: linux:: - "$(users)" - policy => "locked"; + "$(users)" policy => "locked"; } diff --git a/examples/local_users_present.cf b/examples/local_users_present.cf index 80ac180561..225a549e8b 100644 --- a/examples/local_users_present.cf +++ b/examples/local_users_present.cf @@ -15,7 +15,7 @@ bundle agent main "$(users)" home_dir => "/home/$(users)", policy => "present", - home_bundle => home_skel( $(users), $(skel) ); + home_bundle => home_skel($(users), $(skel)); } bundle agent home_skel(user, skel) @@ -26,6 +26,6 @@ bundle agent home_skel(user, skel) files: "/home/$(user)/." create => "true", - copy_from => seed_cp( $(skel) ), - depth_search => recurse( "inf" ); + copy_from => seed_cp($(skel)), + depth_search => recurse("inf"); } diff --git a/examples/locate_files_and_compress.cf b/examples/locate_files_and_compress.cf index 9d7935135d..e02081b03d 100644 --- a/examples/locate_files_and_compress.cf +++ b/examples/locate_files_and_compress.cf @@ -1,66 +1,48 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ####################################################### # # Compressing files # ####################################################### - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ############################################ - bundle agent example - { files: - - "/home/mark/tmp/testcopy" - + "/home/mark/tmp/testcopy" file_select => pdf_files, transformer => "/usr/bin/gzip $(this.promiser)", depth_search => recurse("inf"); - } ############################################ - body file_select pdf_files - { - leaf_name => { ".*.pdf" , ".*.fdf" }; - file_result => "leaf_name"; + leaf_name => { ".*.pdf", ".*.fdf" }; + file_result => "leaf_name"; } ############################################ - body depth_search recurse(d) - { - depth => "$(d)"; + depth => "$(d)"; } - diff --git a/examples/log_private.cf b/examples/log_private.cf index a71937b67c..209defd244 100644 --- a/examples/log_private.cf +++ b/examples/log_private.cf @@ -1,52 +1,39 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - - "software" slist => { "/root/xyz", "/tmp/xyz" }; + "software" slist => { "/root/xyz", "/tmp/xyz" }; files: - - "$(software)" - + "$(software)" create => "true", action => logme("$(software)"); - } -# - body action logme(x) { - log_kept => "/tmp/private_keptlog.log"; - log_failed => "/tmp/private_faillog.log"; - log_repaired => "/tmp/private_replog.log"; - log_string => "$(sys.date) $(x) promise status"; + log_kept => "/tmp/private_keptlog.log"; + log_failed => "/tmp/private_faillog.log"; + log_repaired => "/tmp/private_replog.log"; + log_string => "$(sys.date) $(x) promise status"; } diff --git a/examples/loops.cf b/examples/loops.cf index e73cce22d1..84d7eee788 100644 --- a/examples/loops.cf +++ b/examples/loops.cf @@ -1,48 +1,33 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################################### - bundle agent example - -{ +{ vars: - - "component" slist => { "cf-monitord", "cf-serverd", "cf-execd" }; - - "array[cf-monitord]" string => "The monitor"; - "array[cf-serverd]" string => "The server"; - "array[cf-execd]" string => "The executor, not executioner"; + "component" slist => { "cf-monitord", "cf-serverd", "cf-execd" }; + "array[cf-monitord]" string => "The monitor"; + "array[cf-serverd]" string => "The server"; + "array[cf-execd]" string => "The executor, not executioner"; reports: - "/bin/echo $(component) is $(array[$(component)])"; - + "/bin/echo $(component) is $(array[$(component)])"; } - diff --git a/examples/lsdir.cf b/examples/lsdir.cf index 81f6a73941..21457c7a8b 100644 --- a/examples/lsdir.cf +++ b/examples/lsdir.cf @@ -1,40 +1,35 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - "listfiles" slist => lsdir("/etc", "(p.sswd|gr[ou]+p)", "true"); - "sorted_listfiles" slist => sort(listfiles, "lex"); + "listfiles" slist => lsdir("/etc", "(p.sswd|gr[ou]+p)", "true"); + "sorted_listfiles" slist => sort(listfiles, "lex"); reports: - "files in list: $(sorted_listfiles)"; + "files in list: $(sorted_listfiles)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/main.cf b/examples/main.cf index d803c10c69..b2991d706a 100644 --- a/examples/main.cf +++ b/examples/main.cf @@ -1,14 +1,12 @@ # Example showing how the default bundlesequence runs bundle agent main - bundle agent main # @brief main is the default bundlesequence { reports: - "Hello, $(this.bundle) bundle."; + "Hello, $(this.bundle) bundle."; } #@ The policy promises to report the name of the current bundle, and produces this output: - #+begin_src example_output #@ ``` #@ R: Hello, main bundle. diff --git a/examples/main_entry_point.cf b/examples/main_entry_point.cf index 3fc2181165..c1cdead3ec 100644 --- a/examples/main_entry_point.cf +++ b/examples/main_entry_point.cf @@ -2,17 +2,15 @@ # Example showing how bundle __main__ works # This file can be used as the main entry (`cf-agent -KIf ./main_entry_point.cf`) # This file can also be included from another policy file containing __main__ - body file control { - inputs => { "$(sys.policy_entry_dirname)/main_library.cf" }; + inputs => { "$(sys.policy_entry_dirname)/main_library.cf" }; } bundle agent __main__ { methods: - - "a" usebundle => libprint("Hello from $(sys.policy_entry_basename)"); + "a" usebundle => libprint("Hello from $(sys.policy_entry_basename)"); } #+begin_src example_output diff --git a/examples/main_library.cf b/examples/main_library.cf index 9f6460639f..bee696c555 100644 --- a/examples/main_library.cf +++ b/examples/main_library.cf @@ -2,12 +2,11 @@ # Example showing how bundle __main__ works # This file can be used as the main entry (`cf-agent -KIf ./main_library.cf`) # This file can also be included from another policy file containing __main__ - bundle agent libprint(message) # @brief report `message` { reports: - "Library: $(message)."; + "Library: $(message)."; } bundle agent __main__ @@ -15,11 +14,10 @@ bundle agent __main__ # This bundle is special. It is ignored unless it is the policy entry file { methods: - "test" usebundle => libprint( "ok 1 - libprint works" ); + "test" usebundle => libprint("ok 1 - libprint works"); } #@ The policy promises to call libprint to report that it works when the policy file is the main entry. - #+begin_src example_output #@ ``` #@ R: Library: ok 1 - libprint works diff --git a/examples/maparray.cf b/examples/maparray.cf index fceb0227d0..4f3790b756 100644 --- a/examples/maparray.cf +++ b/examples/maparray.cf @@ -1,48 +1,46 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "run" }; + bundlesequence => { "run" }; } bundle agent run { vars: - "static[2]" string => "lookup 2"; - "static[two]" string => "lookup two"; - "static[big]" string => "lookup big"; - "static[small]" string => "lookup small"; + "static[2]" string => "lookup 2"; + "static[two]" string => "lookup two"; + "static[big]" string => "lookup big"; + "static[small]" string => "lookup small"; + "todo[1]" string => "2"; + "todo[one]" string => "two"; + "todo[3999]" slist => { "big", "small" }; + + "map" + slist => maparray( + "key='$(this.k)', static lookup = '$(static[$(this.v)])', value='$(this.v)'", + todo + ); - "todo[1]" string => "2"; - "todo[one]" string => "two"; - "todo[3999]" slist => { "big", "small" }; - "map" slist => - maparray("key='$(this.k)', static lookup = '$(static[$(this.v)])', value='$(this.v)'", - todo); - "map_sorted" slist => sort(map, lex); + "map_sorted" slist => sort(map, lex); - "mycontainer" data => parsejson(' + "mycontainer" + data => parsejson(' { "top": { @@ -50,14 +48,18 @@ bundle agent run "y": "big" } }'); - "mapc" slist => - maparray("key='$(this.k)', key2='$(this.k[1])', static lookup = '$(static[$(this.v)])', value='$(this.v)'", - mycontainer); - "mapc_str" string => format("%S", mapc); + + "mapc" + slist => maparray( + "key='$(this.k)', key2='$(this.k[1])', static lookup = '$(static[$(this.v)])', value='$(this.v)'", + mycontainer + ); + + "mapc_str" string => format("%S", mapc); reports: - "mapped array: $(map_sorted)"; - "mapped container: $(mapc_str)"; + "mapped array: $(map_sorted)"; + "mapped container: $(mapc_str)"; } #+end_src diff --git a/examples/mapdata.cf b/examples/mapdata.cf index 19fe2c16e9..78b8147296 100644 --- a/examples/mapdata.cf +++ b/examples/mapdata.cf @@ -1,46 +1,53 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "run" }; + bundlesequence => { "run" }; } bundle agent run { vars: - "myarray[lookup][big]" string => "lookup big"; - "myarray[lookup][small]" string => "lookup small"; + "myarray[lookup][big]" string => "lookup big"; + "myarray[lookup][small]" string => "lookup small"; + + # every item must parse as valid JSON when the interpretation is `json` + "mapa_json" + data => mapdata( + "json", + '{ "key": "$(this.k)", "key2": "$(this.k[1])", "value": "$(this.v)" }', + myarray + ); + + "mapa_json_str" string => format("%S", mapa_json); - # every item must parse as valid JSON when the interpretation is `json` - "mapa_json" data => mapdata("json", '{ "key": "$(this.k)", "key2": "$(this.k[1])", "value": "$(this.v)" }', myarray); - "mapa_json_str" string => format("%S", mapa_json); + # every item is just a string when the interpretation is `none` + "mapa_none" + data => mapdata( + "none", + 'key=$(this.k), level 2 key = $(this.k[1]), value=$(this.v)', + myarray + ); - # every item is just a string when the interpretation is `none` - "mapa_none" data => mapdata("none", 'key=$(this.k), level 2 key = $(this.k[1]), value=$(this.v)', myarray); - "mapa_none_str" string => format("%S", mapa_none); + "mapa_none_str" string => format("%S", mapa_none); - "mycontainer" data => parsejson(' + "mycontainer" + data => parsejson(' { "top": { @@ -49,13 +56,25 @@ bundle agent run } }'); - # every item must parse as valid JSON when the interpretation is `json` - "mapc_json" data => mapdata("json", '{ "key": "$(this.k)", "key2": "$(this.k[1])", "value": "$(this.v)" }', mycontainer); - "mapc_json_str" string => format("%S", mapc_json); + # every item must parse as valid JSON when the interpretation is `json` + "mapc_json" + data => mapdata( + "json", + '{ "key": "$(this.k)", "key2": "$(this.k[1])", "value": "$(this.v)" }', + mycontainer + ); + + "mapc_json_str" string => format("%S", mapc_json); + + # every item is just a string when the interpretation is `none` + "mapc_none" + data => mapdata( + "none", + 'key=$(this.k), level 2 key = $(this.k[1]), value=$(this.v)', + mycontainer + ); - # every item is just a string when the interpretation is `none` - "mapc_none" data => mapdata("none", 'key=$(this.k), level 2 key = $(this.k[1]), value=$(this.v)', mycontainer); - "mapc_none_str" string => format("%S", mapc_none); + "mapc_none_str" string => format("%S", mapc_none); reports: show_example:: diff --git a/examples/mapdata_jsonpipe.cf b/examples/mapdata_jsonpipe.cf index c50ea18f30..a66708d16c 100644 --- a/examples/mapdata_jsonpipe.cf +++ b/examples/mapdata_jsonpipe.cf @@ -1,67 +1,61 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "run" }; + bundlesequence => { "run" }; } bundle agent run { vars: - "tester" data => '{ "x": 100, "y": [ true, "a", "b" ] }'; + "tester" data => '{ "x": 100, "y": [ true, "a", "b" ] }'; - # "jq ." returns the same thing that was passed in - "pipe_passthrough" data => mapdata("json_pipe", '$(def.jq) .', tester); - "pipe_passthrough_str" string => format("%S", pipe_passthrough); + # "jq ." returns the same thing that was passed in + "pipe_passthrough" data => mapdata("json_pipe", '$(def.jq) .', tester); + "pipe_passthrough_str" string => format("%S", pipe_passthrough); - # "jq .x" returns what was under x wrapped in an array: [100] - "pipe_justx" data => mapdata("json_pipe", '$(def.jq) .x', tester); - "pipe_justx_str" string => format("%S", pipe_justx); + # "jq .x" returns what was under x wrapped in an array: [100] + "pipe_justx" data => mapdata("json_pipe", '$(def.jq) .x', tester); + "pipe_justx_str" string => format("%S", pipe_justx); - # "jq .y" returns what was under y wrapped in an array: [[true,"a","b"]] - "pipe_justy" data => mapdata("json_pipe", '$(def.jq) .y', tester); - "pipe_justy_str" string => format("%S", pipe_justy); + # "jq .y" returns what was under y wrapped in an array: [[true,"a","b"]] + "pipe_justy" data => mapdata("json_pipe", '$(def.jq) .y', tester); + "pipe_justy_str" string => format("%S", pipe_justy); - # "jq .y[]" returns each entry under y *separately*: [true,"a","b"] - "pipe_yarray" data => mapdata("json_pipe", '$(def.jq) .y[]', tester); - "pipe_yarray_str" string => format("%S", pipe_yarray); + # "jq .y[]" returns each entry under y *separately*: [true,"a","b"] + "pipe_yarray" data => mapdata("json_pipe", '$(def.jq) .y[]', tester); + "pipe_yarray_str" string => format("%S", pipe_yarray); - # "jq .z" returns null because the key "z" is missing: [null] - "pipe_justz" data => mapdata("json_pipe", '$(def.jq) .z', tester); - "pipe_justz_str" string => format("%S", pipe_justz); + # "jq .z" returns null because the key "z" is missing: [null] + "pipe_justz" data => mapdata("json_pipe", '$(def.jq) .z', tester); + "pipe_justz_str" string => format("%S", pipe_justz); - # "jq" can do math too! and much more! - "pipe_jqmath" data => mapdata("json_pipe", '$(def.jq) 1+2+3', tester); - "pipe_jqmath_str" string => format("%S", pipe_jqmath); + # "jq" can do math too! and much more! + "pipe_jqmath" data => mapdata("json_pipe", '$(def.jq) 1+2+3', tester); + "pipe_jqmath_str" string => format("%S", pipe_jqmath); reports: - "mapdata/json_pipe passthrough result: $(pipe_passthrough_str)"; - "mapdata/json_pipe just x result: $(pipe_justx_str)"; - "mapdata/json_pipe just y result: $(pipe_justy_str)"; - "mapdata/json_pipe array under y result: $(pipe_yarray_str)"; - "mapdata/json_pipe just z result: $(pipe_justz_str)"; - "mapdata/json_pipe math expression result: $(pipe_jqmath_str)"; + "mapdata/json_pipe passthrough result: $(pipe_passthrough_str)"; + "mapdata/json_pipe just x result: $(pipe_justx_str)"; + "mapdata/json_pipe just y result: $(pipe_justy_str)"; + "mapdata/json_pipe array under y result: $(pipe_yarray_str)"; + "mapdata/json_pipe just z result: $(pipe_justz_str)"; + "mapdata/json_pipe math expression result: $(pipe_jqmath_str)"; } #+end_src diff --git a/examples/maplist.cf b/examples/maplist.cf index 11c20354c2..a82957f435 100644 --- a/examples/maplist.cf +++ b/examples/maplist.cf @@ -1,54 +1,44 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle common g { vars: - - "otherlist" slist => { "x", "y", "z" }; + "otherlist" slist => { "x", "y", "z" }; } ####################################################### - bundle agent example - { vars: - - "oldlist" slist => { "a", "b", "c" }; - - "newlist1" slist => maplist("Element ($(this))","@(g.otherlist)"); - "newlist2" slist => maplist("Element ($(this))",@(oldlist)); + "oldlist" slist => { "a", "b", "c" }; + "newlist1" slist => maplist("Element ($(this))", "@(g.otherlist)"); + "newlist2" slist => maplist("Element ($(this))", @(oldlist)); reports: - "Transform: $(newlist1)"; - "Transform: $(newlist2)"; + "Transform: $(newlist1)"; + "Transform: $(newlist2)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/max-min-mean-variance.cf b/examples/max-min-mean-variance.cf index 838779beb2..91743b5495 100644 --- a/examples/max-min-mean-variance.cf +++ b/examples/max-min-mean-variance.cf @@ -1,64 +1,55 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test { vars: - # the behavior will be the same whether you use a data container or a list - # "mylist" slist => { "foo", "1", "2", "3000", "bar", "10.20.30.40" }; - "mylist" data => parsejson('["foo", "1", "2", "3000", "bar", "10.20.30.40"]'); - "mylist_str" string => format("%S", mylist); + # the behavior will be the same whether you use a data container or a list + # "mylist" slist => { "foo", "1", "2", "3000", "bar", "10.20.30.40" }; + "mylist" + data => parsejson('["foo", "1", "2", "3000", "bar", "10.20.30.40"]'); - "max_int" string => max(mylist, "int"); - "max_lex" string => max(mylist, "lex"); - "max_ip" string => max(mylist, "ip"); - - "min_int" string => min(mylist, "int"); - "min_lex" string => min(mylist, "lex"); - "min_ip" string => min(mylist, "ip"); - - "mean" real => mean(mylist); - "variance" real => variance(mylist); + "mylist_str" string => format("%S", mylist); + "max_int" string => max(mylist, "int"); + "max_lex" string => max(mylist, "lex"); + "max_ip" string => max(mylist, "ip"); + "min_int" string => min(mylist, "int"); + "min_lex" string => min(mylist, "lex"); + "min_ip" string => min(mylist, "ip"); + "mean" real => mean(mylist); + "variance" real => variance(mylist); reports: - "my list is $(mylist_str)"; - - "mean is $(mean)"; - "variance is $(variance) (use eval() to get the standard deviation)"; - - "max int is $(max_int)"; - "max IP is $(max_ip)"; - "max lexicographically is $(max_lex)"; - - "min int is $(min_int)"; - "min IP is $(min_ip)"; - "min lexicographically is $(min_lex)"; + "my list is $(mylist_str)"; + "mean is $(mean)"; + "variance is $(variance) (use eval() to get the standard deviation)"; + "max int is $(max_int)"; + "max IP is $(max_ip)"; + "max lexicographically is $(max_lex)"; + "min int is $(min_int)"; + "min IP is $(min_ip)"; + "min lexicographically is $(min_lex)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/measure_log.cf b/examples/measure_log.cf index 5bba071d79..90d996b184 100644 --- a/examples/measure_log.cf +++ b/examples/measure_log.cf @@ -1,42 +1,34 @@ #cop measurements,example - ####################################################### # # Test file: log scanner # ####################################################### - # # Look for a file in $STATEDIR/line_counter_measure.log # # $STATEDIR = $WORKDIR/state unless overridden at compile time. -# - bundle monitor watch { measurements: - - "/home/mark/tmp/file" - + "/home/mark/tmp/file" handle => "line_counter", stream_type => "file", data_type => "counter", match_value => scan_log("MYLINE.*"), history_type => "log", action => sample_rate("0"); - } ########################################################## - body match_value scan_log(x) { - select_line_matching => "^$(x)$"; - track_growing_file => "true"; + select_line_matching => "^$(x)$"; + track_growing_file => "true"; } body action sample_rate(x) { - ifelapsed => "$(x)"; - expireafter => "10"; + ifelapsed => "$(x)"; + expireafter => "10"; } diff --git a/examples/measurements.cf b/examples/measurements.cf index 911c0b068a..9e122392c0 100644 --- a/examples/measurements.cf +++ b/examples/measurements.cf @@ -1,27 +1,20 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #cop measurements,example - ####################################################### # # Test file: @@ -30,41 +23,34 @@ # Blonk blonk bnklkygsuilnm # ####################################################### - body common control { - bundlesequence => { "report" }; + bundlesequence => { "report" }; } ####################################################### - body monitor control { - forgetrate => "0.7"; - histograms => "true"; + forgetrate => "0.7"; + histograms => "true"; } ####################################################### - bundle agent report { reports: - " + " Free memory read at $(mon.av_free_memory_watch) cf_monitord read $(mon.value_monitor_self_watch) "; } ####################################################### - bundle monitor watch { measurements: - - # Test 1 - extract string matching - - "/home/mark/tmp/testmeasure" - + # Test 1 - extract string matching + "/home/mark/tmp/testmeasure" handle => "blonk_watch", stream_type => "file", data_type => "string", @@ -73,87 +59,75 @@ bundle monitor watch match_value => find_blonks, action => sample_min("10"); - # Test 2 - follow a special process over time - # using cfengine's process cache to avoid resampling - - "/var/cfengine/state/cf_rootprocs" - + # Test 2 - follow a special process over time + # using cfengine's process cache to avoid resampling + "/var/cfengine/state/cf_rootprocs" handle => "monitor_self_watch", stream_type => "file", data_type => "int", history_type => "static", units => "kB", - match_value => proc_value(".*cf-monitord.*", - "root\s+[0-9.]+\s+[0-9.]+\s+[0-9.]+\s+[0-9.]+\s+([0-9]+).*"); - - # Test 3, discover disk device information - - "/bin/df" + match_value => proc_value( + ".*cf-monitord.*", + "root\s+[0-9.]+\s+[0-9.]+\s+[0-9.]+\s+[0-9.]+\s+([0-9]+).*" + ); + # Test 3, discover disk device information + "/bin/df" handle => "free_disk_watch", stream_type => "pipe", data_type => "slist", history_type => "static", units => "device", match_value => file_system; - # Update this as often as possible - - # Test 4 - - "/tmp/file" + # Update this as often as possible + # Test 4 + "/tmp/file" handle => "line_counter", stream_type => "file", data_type => "counter", match_value => scanlines("MYLINE.*"), history_type => "log"; - } ########################################################## - body match_value scanlines(x) { - select_line_matching => "^$(x)$"; + select_line_matching => "^$(x)$"; } ########################################################## - body action sample_min(x) { - ifelapsed => "$(x)"; - expireafter => "$(x)"; + ifelapsed => "$(x)"; + expireafter => "$(x)"; } ########################################################## - body match_value find_blonks { - select_line_number => "2"; - extraction_regex => "Blonk blonk ([blonk]+).*"; + select_line_number => "2"; + extraction_regex => "Blonk blonk ([blonk]+).*"; } ########################################################## - body match_value free_memory # not willy! { - select_line_matching => "MemFree:.*"; - extraction_regex => "MemFree:\s+([0-9]+).*"; + select_line_matching => "MemFree:.*"; + extraction_regex => "MemFree:\s+([0-9]+).*"; } ########################################################## - -body match_value proc_value(x,y) +body match_value proc_value(x, y) { - select_line_matching => "$(x)"; - extraction_regex => "$(y)"; + select_line_matching => "$(x)"; + extraction_regex => "$(y)"; } ########################################################## - body match_value file_system { - select_line_matching => "/.*"; - extraction_regex => "(.*)"; + select_line_matching => "/.*"; + extraction_regex => "(.*)"; } - diff --git a/examples/menu.cf b/examples/menu.cf index eb17774e56..46ff6c695c 100644 --- a/examples/menu.cf +++ b/examples/menu.cf @@ -1,31 +1,24 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test copy from server connection to cfServer # ######################################################## - # # run this as follows: # @@ -33,17 +26,14 @@ # cf-agent -f runtest_2.cf # # Notice that the same file configures all parts of cfengine - ######################################################## - body common control { - bundlesequence => { "example" }; - version => "1.2.3"; + bundlesequence => { "example" }; + version => "1.2.3"; } # cf-runagent -q - bundle agent example { files: @@ -52,27 +42,23 @@ bundle agent example ######################################################### # Server config ######################################################### - -body server control - +body server control { - allowconnects => { "127.0.0.1" , "::1" }; - allowallconnects => { "127.0.0.1" , "::1" }; - trustkeysfrom => { "127.0.0.1" , "::1" }; - allowusers => { "mark", "root" }; + allowconnects => { "127.0.0.1", "::1" }; + allowallconnects => { "127.0.0.1", "::1" }; + trustkeysfrom => { "127.0.0.1", "::1" }; + allowusers => { "mark", "root" }; } ######################################################### - bundle server access_rules() - { access: - - "delta" + "delta" resource_type => "query", - admit => { "127.0.0.1" }; - "full" + admit => { "127.0.0.1" }; + + "full" resource_type => "query", - admit => { "127.0.0.1" }; + admit => { "127.0.0.1" }; } diff --git a/examples/mergedata-last-key-wins.cf b/examples/mergedata-last-key-wins.cf index fc75d4702c..b81ee2d12b 100644 --- a/examples/mergedata-last-key-wins.cf +++ b/examples/mergedata-last-key-wins.cf @@ -3,18 +3,21 @@ bundle agent mergedata_last_key_wins # @brief Example illustrating how the last key wins when merging data containers with conflicting keys { vars: + "one" + data => '{ "color": "red", "stuff": [ "one", "two" ], "thing": "one" }'; - "one" data => '{ "color": "red", "stuff": [ "one", "two" ], "thing": "one" }'; - "two" data => '{ "color": "blue", "stuff": [ "three" ] }'; + "two" data => '{ "color": "blue", "stuff": [ "three" ] }'; reports: - "$(with)" with => storejson( mergedata( one, two ) ); - + "$(with)" with => storejson(mergedata(one, two)); } + bundle agent __main__ { - methods: "mergedata_last_key_wins"; + methods: + "mergedata_last_key_wins"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/mergedata.cf b/examples/mergedata.cf index bfaa830912..cd5ab8cca7 100644 --- a/examples/mergedata.cf +++ b/examples/mergedata.cf @@ -1,106 +1,147 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test", "test2", "test3" }; + bundlesequence => { "test", "test2", "test3" }; } bundle agent test { vars: - "d1" data => parsejson('{ "a": [1,2,3], "b": [] }'); - "d2" data => parsejson('{ "b": [4,5,6] }'); - "d3" data => parsejson('[4,5,6]'); - "list1" slist => { "element1", "element2" }; - "array1[mykey]" slist => { "array_element1", "array_element2" }; - "array2[otherkey]" string => "hello"; - - "merged_d1_d2" data => mergedata("d1", "d2"); - "merged_d1_d3" data => mergedata("d1", "d3"); - "merged_d3_list1" data => mergedata("d3", "list1"); - - "merged_d1_array1" data => mergedata("d1", "array1"); - "merged_d2_array2" data => mergedata("d2", "array2"); - - "merged_d1_wrap_array_d2" data => mergedata("d1", "[ d2 ]"); - "merged_d1_wrap_map_d2" data => mergedata("d1", '{ "newkey": d2 }'); - - "merged_d1_d2_str" string => format("merging %S with %S produced %S", d1, d2, merged_d1_d2); - "merged_d1_wrap_array_d2_str" string => format("merging %S with wrapped [ %S ] produced %S", d1, d2, merged_d1_wrap_array_d2); - "merged_d1_wrap_map_d2_str" string => format('merging %S with wrapped { "newkey": %S produced %S', d1, d2, merged_d1_wrap_map_d2); - "merged_d1_d3_str" string => format("merging %S with %S produced %S", d1, d3, merged_d1_d3); - "merged_d3_list1_str" string => format("merging %S with %S produced %S", d3, list1, merged_d3_list1); - - "merged_d1_array1_str" string => format("merging %S with %s produced %S", d1, array1, merged_d1_array1); - "merged_d2_array2_str" string => format("merging %S with %s produced %S", d2, array2, merged_d2_array2); + "d1" data => parsejson('{ "a": [1,2,3], "b": [] }'); + "d2" data => parsejson('{ "b": [4,5,6] }'); + "d3" data => parsejson('[4,5,6]'); + "list1" slist => { "element1", "element2" }; + "array1[mykey]" slist => { "array_element1", "array_element2" }; + "array2[otherkey]" string => "hello"; + "merged_d1_d2" data => mergedata("d1", "d2"); + "merged_d1_d3" data => mergedata("d1", "d3"); + "merged_d3_list1" data => mergedata("d3", "list1"); + "merged_d1_array1" data => mergedata("d1", "array1"); + "merged_d2_array2" data => mergedata("d2", "array2"); + "merged_d1_wrap_array_d2" data => mergedata("d1", "[ d2 ]"); + "merged_d1_wrap_map_d2" data => mergedata("d1", '{ "newkey": d2 }'); + + "merged_d1_d2_str" + string => format("merging %S with %S produced %S", d1, d2, merged_d1_d2); + + "merged_d1_wrap_array_d2_str" + string => format( + "merging %S with wrapped [ %S ] produced %S", + d1, + d2, + merged_d1_wrap_array_d2 + ); + + "merged_d1_wrap_map_d2_str" + string => format( + 'merging %S with wrapped { "newkey": %S produced %S', + d1, + d2, + merged_d1_wrap_map_d2 + ); + + "merged_d1_d3_str" + string => format("merging %S with %S produced %S", d1, d3, merged_d1_d3); + + "merged_d3_list1_str" + string => format( + "merging %S with %S produced %S", d3, list1, merged_d3_list1 + ); + + "merged_d1_array1_str" + string => format( + "merging %S with %s produced %S", d1, array1, merged_d1_array1 + ); + + "merged_d2_array2_str" + string => format( + "merging %S with %s produced %S", d2, array2, merged_d2_array2 + ); + reports: - "$(merged_d1_d2_str)"; - "$(merged_d1_wrap_array_d2_str)"; - "$(merged_d1_wrap_map_d2_str)"; - "$(merged_d1_d3_str)"; - "$(merged_d3_list1_str)"; - "$(merged_d1_array1_str)"; - "$(merged_d2_array2_str)"; + "$(merged_d1_d2_str)"; + "$(merged_d1_wrap_array_d2_str)"; + "$(merged_d1_wrap_map_d2_str)"; + "$(merged_d1_d3_str)"; + "$(merged_d3_list1_str)"; + "$(merged_d1_array1_str)"; + "$(merged_d2_array2_str)"; } bundle agent test2 { vars: - "a" data => parsejson('{ "a": "1" }'), meta => { "mymerge" }; - "b" data => parsejson('{ "b": "2" }'), meta => { "mymerge" }; - "c" data => parsejson('{ "c": "3" }'), meta => { "mymerge" }; - "d" data => parsejson('{ "d": "4" }'), meta => { "mymerge" }; - "todo" slist => variablesmatching(".*", "mymerge"); + "a" + data => parsejson('{ "a": "1" }'), + meta => { "mymerge" }; - methods: - "go" usebundle => cmerge(@(todo)); # a, b, c, d + "b" + data => parsejson('{ "b": "2" }'), + meta => { "mymerge" }; + + "c" + data => parsejson('{ "c": "3" }'), + meta => { "mymerge" }; + "d" + data => parsejson('{ "d": "4" }'), + meta => { "mymerge" }; + + "todo" slist => variablesmatching(".*", "mymerge"); + + methods: + "go" usebundle => cmerge(@(todo)); # a, b, c, d reports: - "$(this.bundle): merged containers with cmerge = $(cmerge.all_str)"; + "$(this.bundle): merged containers with cmerge = $(cmerge.all_str)"; } # note this bundle is in the standard library, in lib/3.6/bundles.cf bundle agent cmerge(varlist) { vars: - "all" data => parsejson('[]'), policy => "free"; - "all" data => mergedata(all, $(varlist)), policy => "free"; - "all_str" string => format("%S", all), policy => "free"; + "all" + data => parsejson('[]'), + policy => "free"; + + "all" + data => mergedata(all, $(varlist)), + policy => "free"; + + "all_str" + string => format("%S", all), + policy => "free"; } bundle agent test3 { - vars: - "dest_files" slist => { "/tmp/default.json", "/tmp/epel.json" }; - "template_file" string => "repository.mustache"; + vars: + "dest_files" slist => { "/tmp/default.json", "/tmp/epel.json" }; + "template_file" string => "repository.mustache"; - "process_templates" data => mergedata('{ "$(template_file)" : dest_files }'); - "process__templates_str" string => format("%S", "process_templates"); + "process_templates" + data => mergedata('{ "$(template_file)" : dest_files }'); - reports: - "$(this.bundle) $(process__templates_str)"; - "$(this.bundle) $(process_templates[$(template_file)])"; + "process__templates_str" string => format("%S", "process_templates"); + + reports: + "$(this.bundle) $(process__templates_str)"; + "$(this.bundle) $(process_templates[$(template_file)])"; } #+end_src diff --git a/examples/meta.cf b/examples/meta.cf index 9e76e9d1de..d3cd42dd44 100644 --- a/examples/meta.cf +++ b/examples/meta.cf @@ -1,62 +1,44 @@ - # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # Default values for variables and parameters, introduced 3.4.0 -# - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################################### - bundle agent example - -{ +{ meta: - - "bundle_version" string => "1.2.3"; - "works_with_cfengine" string => "3.4.0"; + "bundle_version" string => "1.2.3"; + "works_with_cfengine" string => "3.4.0"; vars: - - "testvar" string => "x"; + "testvar" string => "x"; reports: - "Not a local variable: $(bundle_version)"; - "Not a local variable: $(other_bundle.something)"; - "Meta data (variable): $(example_meta.bundle_version)"; - + "Not a local variable: $(bundle_version)"; + "Not a local variable: $(other_bundle.something)"; + "Meta data (variable): $(example_meta.bundle_version)"; } - bundle agent other_bundle - { vars: - - "something" string => "I am defined in another bundle"; + "something" string => "I am defined in another bundle"; } diff --git a/examples/method.cf b/examples/method.cf index bef2705955..78e8c6fc59 100644 --- a/examples/method.cf +++ b/examples/method.cf @@ -1,59 +1,41 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control - { - bundlesequence => { "example" }; - - version => "1.2.3"; + bundlesequence => { "example" }; + version => "1.2.3"; } ########################################### - bundle agent example { vars: - - "userlist" slist => { "mark", "jeang", "jonhenrik", "thomas", "eben" }; + "userlist" slist => { "mark", "jeang", "jonhenrik", "thomas", "eben" }; methods: - - "any" usebundle => subtest("$(userlist)"); - + "any" usebundle => subtest("$(userlist)"); } ########################################### - bundle agent subtest(user) - { commands: - - "/bin/echo Fix $(user)"; + "/bin/echo Fix $(user)"; reports: - - "Finished doing stuff for $(user)"; + "Finished doing stuff for $(user)"; } - diff --git a/examples/method_polymorph.cf b/examples/method_polymorph.cf index d3f437b4ff..8c7c8219e1 100644 --- a/examples/method_polymorph.cf +++ b/examples/method_polymorph.cf @@ -1,38 +1,28 @@ -# # Demonstrates the use of polymorphism to call bundles. -# - body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################### - bundle agent example { methods: - - "Patch Group" - + "Patch Group" comment => "Apply OS specific patches and modifications", usebundle => "$(sys.class)_fix"; - } ########################################### - bundle agent linux_fix { reports: - "Fixes for linux"; + "Fixes for linux"; } ########################################### - bundle agent solaris_android { reports: - "Fixes for android"; + "Fixes for android"; } - diff --git a/examples/method_validate.cf b/examples/method_validate.cf index 03bcbb7508..0ce8cf55c6 100644 --- a/examples/method_validate.cf +++ b/examples/method_validate.cf @@ -1,72 +1,52 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control - { - bundlesequence => { "example" }; - - version => "1.2.3"; + bundlesequence => { "example" }; + version => "1.2.3"; } ########################################### - body agent control - { - abortbundleclasses => { "invalid" }; + abortbundleclasses => { "invalid" }; } ########################################### - bundle agent example { vars: - - "userlist" slist => { "xyz", "mark", "jeang", "jonhenrik", "thomas", "eben" }; + "userlist" + slist => { "xyz", "mark", "jeang", "jonhenrik", "thomas", "eben" }; methods: - - "any" usebundle => subtest("$(userlist)"); - + "any" usebundle => subtest("$(userlist)"); } ########################################### - bundle agent subtest(user) - { classes: - - "invalid" not => regcmp("[a-z][a-z][a-z][a-z]","$(user)"); + "invalid" not => regcmp("[a-z][a-z][a-z][a-z]", "$(user)"); reports: - !invalid:: - "User name $(user) is valid at 4 letters"; invalid:: - "User name $(user) is invalid"; } diff --git a/examples/method_var.cf b/examples/method_var.cf index 9d48783f7e..2f98eb9756 100644 --- a/examples/method_var.cf +++ b/examples/method_var.cf @@ -1,47 +1,39 @@ -# # Demonstrates the use of variables to call bundles. # We can then filter variables on classes, for example. -# - body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################### - bundle agent test { vars: - "run_bundles" slist => { "test_one", "test_two" }; - "run_a_bundle" string => "test_three"; + "run_bundles" slist => { "test_one", "test_two" }; + "run_a_bundle" string => "test_three"; methods: - "any" usebundle => "$(run_bundles)"; - "any" usebundle => "$(run_a_bundle)"; + "any" usebundle => "$(run_bundles)"; + "any" usebundle => "$(run_a_bundle)"; } ########################################### - bundle agent test_one { reports: - "in test_one"; + "in test_one"; } ########################################### - bundle agent test_two { reports: - "in test_two"; + "in test_two"; } ########################################### - bundle agent test_three { reports: - "in test_three"; + "in test_three"; } - diff --git a/examples/method_var2.cf b/examples/method_var2.cf index b4a452b8ad..487cb6da49 100644 --- a/examples/method_var2.cf +++ b/examples/method_var2.cf @@ -1,47 +1,37 @@ -# # Demonstrates the use of polymorphism to call bundles. -# - body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################### - bundle agent example { vars: - "m" slist => { "login", "ssh_keys", "environment" }; - "user" slist => { "diego", "mark", "neil" }; + "m" slist => { "login", "ssh_keys", "environment" }; + "user" slist => { "diego", "mark", "neil" }; methods: - "set of $(m)" usebundle => $(m)("$(user)"); - - + "set of $(m)" usebundle => $(m)("$(user)"); } ########################################### - bundle agent login(x) { reports: - "Setup login for $(x)"; + "Setup login for $(x)"; } ########################################### - bundle agent ssh_keys(x) { reports: - "Setup ssh keys for $(x)"; + "Setup ssh keys for $(x)"; } ########################################### - bundle agent environment(x) { reports: - "Setup login environment for $(x)"; + "Setup login environment for $(x)"; } - diff --git a/examples/missing_ok.cf b/examples/missing_ok.cf index 63a10595d2..c927bb90aa 100644 --- a/examples/missing_ok.cf +++ b/examples/missing_ok.cf @@ -1,79 +1,76 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # This example shows how to use the missing_ok attribute in copy from bodies. If # the source file is missing, the promise will be seen to be a promise kept # instead of a failure. The exception is that a remote copy that fails to make a # connection to the remote server will still be seen as a promise failure. - #+begin_src cfengine3 bundle agent main { files: "/tmp/copied_from_missing_ok" - copy_from => missing_ok( "/var/cfengine/masterfiles/missing" ), + copy_from => missing_ok("/var/cfengine/masterfiles/missing"), classes => results("bundle", "copy_from_missing_ok"); reports: "$(with)" - with => string_mustache( "{{%-top-}}", sort( classesmatching( "copy_from_.*" ), lex)); + with => string_mustache( + "{{%-top-}}", sort(classesmatching("copy_from_.*"), lex) + ); } -body copy_from missing_ok( file_path ) + +body copy_from missing_ok(file_path) { source => "$(file_path)"; missing_ok => "true"; - # Run with these classes to try remote copies - remote_copy_self:: - servers => { "127.0.0.1" }; + # Run with these classes to try remote copies + remote_copy_self:: + servers => { "127.0.0.1" }; - remote_copy_policy_hub:: - servers => { $(sys.policy_hub) }; + remote_copy_policy_hub:: + servers => { $(sys.policy_hub) }; } + body classes results(scope, class_prefix) { scope => "$(scope)"; - - promise_kept => { "$(class_prefix)_reached", - "$(class_prefix)_kept" }; - - promise_repaired => { "$(class_prefix)_reached", - "$(class_prefix)_repaired" }; - - repair_failed => { "$(class_prefix)_reached", - "$(class_prefix)_error", - "$(class_prefix)_not_kept", - "$(class_prefix)_failed" }; - - repair_denied => { "$(class_prefix)_reached", - "$(class_prefix)_error", - "$(class_prefix)_not_kept", - "$(class_prefix)_denied" }; - - repair_timeout => { "$(class_prefix)_reached", - "$(class_prefix)_error", - "$(class_prefix)_not_kept", - "$(class_prefix)_timeout" }; + promise_kept => { "$(class_prefix)_reached", "$(class_prefix)_kept" }; + promise_repaired => { "$(class_prefix)_reached", "$(class_prefix)_repaired" }; + repair_failed => { + "$(class_prefix)_reached", + "$(class_prefix)_error", + "$(class_prefix)_not_kept", + "$(class_prefix)_failed", + }; + repair_denied => { + "$(class_prefix)_reached", + "$(class_prefix)_error", + "$(class_prefix)_not_kept", + "$(class_prefix)_denied", + }; + repair_timeout => { + "$(class_prefix)_reached", + "$(class_prefix)_error", + "$(class_prefix)_not_kept", + "$(class_prefix)_timeout", + }; } + #+end_src #@ In the above example `/tmp/copied_from_missing_ok` promises to be a copy of the local file #@ `/var/cfengine/masterfiles/missing`. In the `missing_ok` `copy_from` body diff --git a/examples/module_exec.cf b/examples/module_exec.cf index 07a40ef809..359dc7b23e 100644 --- a/examples/module_exec.cf +++ b/examples/module_exec.cf @@ -1,45 +1,32 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # Test module execution as class function -# - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ################################################################### - bundle agent example - { classes: - - "done" or => { usemodule("module:getusers","") }; + "done" or => { usemodule("module:getusers", "") }; commands: - - "/bin/echo promiser text" args => "test $(user)"; + "/bin/echo promiser text" args => "test $(user)"; } diff --git a/examples/module_exec_2.cf b/examples/module_exec_2.cf index 1258f6ecca..d9a10979bd 100644 --- a/examples/module_exec_2.cf +++ b/examples/module_exec_2.cf @@ -1,73 +1,46 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # Test module execution as class function -# - body common control - { - bundlesequence => { "def", "example" }; + bundlesequence => { "def", "example" }; } ################################################################### - bundle agent def - { commands: - - "$(sys.workdir)/modules/module_name" module => "true"; + "$(sys.workdir)/modules/module_name" module => "true"; reports: - - # - # Each module forms a private context with its name as id - # - + # Each module forms a private context with its name as id module_class:: - "Module set variable $(module_name.myscalar)"; - } ################################################################### - bundle agent example - { vars: - - "mylist" slist => { @(module_name.mylist) }; + "mylist" slist => { @(module_name.mylist) }; reports: - - # - # Each module forms a private context with its name as id - # - + # Each module forms a private context with its name as id module_class:: - "Module set variable $(mylist)"; - } diff --git a/examples/monitord.cf b/examples/monitord.cf index 4e1e88941a..7dd6fd7423 100644 --- a/examples/monitord.cf +++ b/examples/monitord.cf @@ -1,43 +1,30 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################### - body monitor control { - #version => "1.2.3.4"; + #version => "1.2.3.4"; + forgetrate => "0.7"; + histograms => "true"; + tcpdump => "false"; + tcpdumpcommand => "/usr/sbin/tcpdump -i eth1 -n -t -v"; - forgetrate => "0.7"; + # on linux + linux:: - histograms => "true"; - - tcpdump => "false"; - - tcpdumpcommand => "/usr/sbin/tcpdump -i eth1 -n -t -v"; - - # on linux - - linux:: - - # sensor => readfile("/proc/cpu/temperature"); + # sensor => readfile("/proc/cpu/temperature"); } - diff --git a/examples/mount_fs.cf b/examples/mount_fs.cf index bd2d69c241..6982e27aa3 100644 --- a/examples/mount_fs.cf +++ b/examples/mount_fs.cf @@ -1,58 +1,42 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - # # cfengine 3 # # cf-agent -f ./cftest.cf -K -# - body common control - { - bundlesequence => { "mounts" }; + bundlesequence => { "mounts" }; } -# - bundle agent mounts - { storage: - - "/mnt" mount => nfs("slogans.iu.hio.no","/home"); - + "/mnt" mount => nfs("slogans.iu.hio.no", "/home"); } ###################################################################### - -body mount nfs(server,source) - +body mount nfs(server, source) { - mount_type => "nfs"; - mount_source => "$(source)"; - mount_server => "$(server)"; - #mount_options => { "rw" }; - edit_fstab => "true"; - unmount => "true"; + mount_type => "nfs"; + mount_source => "$(source)"; + mount_server => "$(server)"; + + #mount_options => { "rw" }; + edit_fstab => "true"; + unmount => "true"; } diff --git a/examples/multipassvars.cf b/examples/multipassvars.cf index d962fcf32c..88b9026ee6 100644 --- a/examples/multipassvars.cf +++ b/examples/multipassvars.cf @@ -1,35 +1,30 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - -body common control +body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } -bundle agent example +bundle agent example { vars: any:: "tempdir" string => execresult("/bin/mktemp -d", "noshell"); + reports: - "tempdir: ${tempdir}"; + "tempdir: ${tempdir}"; } diff --git a/examples/multiple_outcomes.cf b/examples/multiple_outcomes.cf index 604d023dba..92c0f54601 100644 --- a/examples/multiple_outcomes.cf +++ b/examples/multiple_outcomes.cf @@ -1,39 +1,35 @@ # Note: This is NOT an automatically tested example. The difference between # dry-run and normal run output makes it problematic to do so. - #+begin_src cfengine3 bundle agent main { meta: - "description" string => " + "description" + string => " Illustrate how a promise can have multiple outcomes"; vars: !windows:: - "repaired_and_kept" - string => "/tmp/repaired_and_not_kept.txt"; + "repaired_and_kept" string => "/tmp/repaired_and_not_kept.txt"; files: # We make sure our test file is absent so that we # can show consistent outcomes. - "$(repaired_and_kept)" - handle => "testfile_absent", - delete => tidy; - - "$(repaired_and_kept)" - handle => "test_outcomes", - depends_on => { "testfile_absent" }, - create => "true", - edit_template => "$(this.promsie_filename).broken_mustache", - template_method => "mustache", - classes => results("bundle", "outcome"); + "$(repaired_and_kept)" + handle => "testfile_absent", + delete => tidy; + + "$(repaired_and_kept)" + handle => "test_outcomes", + depends_on => { "testfile_absent" }, + create => "true", + edit_template => "$(this.promsie_filename).broken_mustache", + template_method => "mustache", + classes => results("bundle", "outcome"); vars: - "result_classes" - slist => classesmatching("outcome_.*"); - - "s_result_classes" - slist => sort( result_classes, "lex"); + "result_classes" slist => classesmatching("outcome_.*"); + "s_result_classes" slist => sort(result_classes, "lex"); reports: outcome_repaired:: @@ -55,8 +51,8 @@ body delete tidy # repository at commit # 6244c16e6934546d069052f953e597c4b95747df { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } body classes results(scope, class_prefix) @@ -66,30 +62,29 @@ body classes results(scope, class_prefix) # 206a8b2e6bf277c3df9b57bf5c535b0b6dba963a { scope => "$(scope)"; - - promise_kept => { "$(class_prefix)_reached", - "$(class_prefix)_kept" }; - - promise_repaired => { "$(class_prefix)_reached", - "$(class_prefix)_repaired" }; - - repair_failed => { "$(class_prefix)_reached", - "$(class_prefix)_error", - "$(class_prefix)_not_kept", - "$(class_prefix)_failed" }; - - repair_denied => { "$(class_prefix)_reached", - "$(class_prefix)_error", - "$(class_prefix)_not_kept", - "$(class_prefix)_denied" }; - - repair_timeout => { "$(class_prefix)_reached", - "$(class_prefix)_error", - "$(class_prefix)_not_kept", - "$(class_prefix)_timeout" }; + promise_kept => { "$(class_prefix)_reached", "$(class_prefix)_kept" }; + promise_repaired => { "$(class_prefix)_reached", "$(class_prefix)_repaired" }; + repair_failed => { + "$(class_prefix)_reached", + "$(class_prefix)_error", + "$(class_prefix)_not_kept", + "$(class_prefix)_failed", + }; + repair_denied => { + "$(class_prefix)_reached", + "$(class_prefix)_error", + "$(class_prefix)_not_kept", + "$(class_prefix)_denied", + }; + repair_timeout => { + "$(class_prefix)_reached", + "$(class_prefix)_error", + "$(class_prefix)_not_kept", + "$(class_prefix)_timeout", + }; } -#+end_src +#+end_src ######################### #+begin_src do_not_test_example_output #@ ``` diff --git a/examples/mustache_classes.cf b/examples/mustache_classes.cf index c4fe623307..1aefd9e826 100644 --- a/examples/mustache_classes.cf +++ b/examples/mustache_classes.cf @@ -1,34 +1,31 @@ # Example showing how sections are rendered using cfengine classes - # Being a logicless templating system, mustache is not able to leverage # CFEngine's powerful class expression logic. Only singular classes can be used # to conditionally render a block in mustache. This example shows how you can # define a singular cfengine class based on a complex expression, and then use # that singular class for conditional rendering in a template. - #+begin_src cfengine3 bundle agent main { classes: - - "known_day_of_week" - expression => "(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday)"; + "known_day_of_week" + expression => "(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday)"; vars: - - "rendered" - string => string_mustache( -"{{#classes.known_day_of_week}}I recognize the day of the week.{{/classes.known_day_of_week}} + "rendered" + string => string_mustache( + "{{#classes.known_day_of_week}}I recognize the day of the week.{{/classes.known_day_of_week}} {{^classes.class_you_are_looking_for}} The class you are looking for is not defined. {{/classes.class_you_are_looking_for}}", - datastate()); - reports: - "$(rendered)"; + datastate() + ); + reports: + "$(rendered)"; } -#+end_src +#+end_src #+begin_src policy_description #@ Here we define the class `known_day_of_week` as long as there is a class #@ representing a known day. Then we render the value of the string variable diff --git a/examples/mustache_comments.cf b/examples/mustache_comments.cf index 1c6b9b92b0..06a2a9bf43 100644 --- a/examples/mustache_comments.cf +++ b/examples/mustache_comments.cf @@ -1,19 +1,16 @@ # Example showing how comments are not rendered - #+begin_src cfengine3 bundle agent main { reports: "$(with)" with => string_mustache("Render this.{{! But not -this}}", - datastate()); +this}}", datastate()); } -#+end_src +#+end_src #+begin_src example_output #@ ``` #@ R: Render this. #@ ``` #+end_src - diff --git a/examples/mustache_extension_compact_json.cf b/examples/mustache_extension_compact_json.cf index 87a4d8dc99..3d04840953 100644 --- a/examples/mustache_extension_compact_json.cf +++ b/examples/mustache_extension_compact_json.cf @@ -2,19 +2,18 @@ bundle agent main { vars: - "msg" string => "Hello World"; - - "report" - string => string_mustache("{{$-top-}}", bundlestate( $(this.bundle) ) ), - unless => isvariable( $(this.promiser) ); # Careful to not include - # ourselves so we only grab the - # state of the first pass. + "msg" string => "Hello World"; + "report" + string => string_mustache("{{$-top-}}", bundlestate($(this.bundle))), + unless => isvariable($(this.promiser)); # Careful to not include + # ourselves so we only grab the + # state of the first pass. reports: - "$(report)"; + "$(report)"; } -#+end_src +#+end_src #+begin_src example_output #@ ``` #@ R: {"msg":"Hello World"} diff --git a/examples/mustache_extension_expand_key.cf b/examples/mustache_extension_expand_key.cf index 8a2202d10a..5ff20641bd 100644 --- a/examples/mustache_extension_expand_key.cf +++ b/examples/mustache_extension_expand_key.cf @@ -2,9 +2,12 @@ bundle agent main { reports: - "$(with)" - with => string_mustache("datastate() provides {{#-top-}} {{{@}}}{{/-top-}}", datastate() ); + "$(with)" + with => string_mustache( + "datastate() provides {{#-top-}} {{{@}}}{{/-top-}}", datastate() + ); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/mustache_extension_multiline_json.cf b/examples/mustache_extension_multiline_json.cf index 2b15b643e7..902b7327e8 100644 --- a/examples/mustache_extension_multiline_json.cf +++ b/examples/mustache_extension_multiline_json.cf @@ -2,10 +2,12 @@ bundle agent main { reports: - "$(with)" - with => string_mustache( "{{%mykey}}", - '{ "mykey": { "msg": "Hello World" } }' ); + "$(with)" + with => string_mustache( + "{{%mykey}}", '{ "mykey": { "msg": "Hello World" } }' + ); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/mustache_extension_top.cf b/examples/mustache_extension_top.cf index a669cbab4b..47e9cafc1e 100644 --- a/examples/mustache_extension_top.cf +++ b/examples/mustache_extension_top.cf @@ -1,19 +1,17 @@ # Example showing how -top- gives access to the entire data provided to a mustache template. - #+begin_src cfengine3 bundle agent main { vars: - "data" data => '{ "key": "value", "list": [ "1", "2" ] }'; + "data" data => '{ "key": "value", "list": [ "1", "2" ] }'; reports: - "-top- contains$(const.n)$(with)" - with => string_mustache("{{%-top-}}", data ); + "-top- contains$(const.n)$(with)" + with => string_mustache("{{%-top-}}", data); } -#+end_src +#+end_src ############################################################################### - #+begin_src example_output #@ ``` #@ R: -top- contains diff --git a/examples/mustache_sections_empty_list.cf b/examples/mustache_sections_empty_list.cf index 4171459912..7331015a25 100644 --- a/examples/mustache_sections_empty_list.cf +++ b/examples/mustache_sections_empty_list.cf @@ -1,5 +1,4 @@ # Example showing how variables are rendered for empty lists. - #+begin_src cfengine3 bundle agent main { @@ -8,14 +7,12 @@ bundle agent main reports: "The list contains $(with)." - with => string_mustache("{{#list}} {{{.}}}{{/list}}", - data); + with => string_mustache("{{#list}} {{{.}}}{{/list}}", data); } -#+end_src +#+end_src #+begin_src example_output #@ ``` #@ R: The list contains . #@ ``` #+end_src - diff --git a/examples/mustache_sections_inverted.cf b/examples/mustache_sections_inverted.cf index 9151f5216f..3061e9f43e 100644 --- a/examples/mustache_sections_inverted.cf +++ b/examples/mustache_sections_inverted.cf @@ -1,18 +1,18 @@ # Example showing how inverted sections are rendered - #+begin_src cfengine3 bundle agent main { reports: "CFEngine $(with)" - with => string_mustache("{{^classes.enterprise_edition}}Community{{/classes.enterprise_edition}}{{#classes.enterprise_edition}}Enterprise{{/classes.example}}", - datastate()); + with => string_mustache( + "{{^classes.enterprise_edition}}Community{{/classes.enterprise_edition}}{{#classes.enterprise_edition}}Enterprise{{/classes.example}}", + datastate() + ); } -#+end_src +#+end_src #+begin_src example_output #@ ``` #@ R: CFEngine Community #@ ``` #+end_src - diff --git a/examples/mustache_sections_non_empty_list.cf b/examples/mustache_sections_non_empty_list.cf index 8b7477315f..8113510a42 100644 --- a/examples/mustache_sections_non_empty_list.cf +++ b/examples/mustache_sections_non_empty_list.cf @@ -1,5 +1,4 @@ # Example showing how variables are rendered for non empty lists. - #+begin_src cfengine3 bundle agent main { @@ -7,15 +6,12 @@ bundle agent main "data" data => '{ "list": [ "1", "2", "3" ] }'; reports: - "$(with)" - with => string_mustache("{{#list}} {{{.}}}{{/list}}", - data); + "$(with)" with => string_mustache("{{#list}} {{{.}}}{{/list}}", data); } -#+end_src +#+end_src #+begin_src example_output #@ ``` #@ R: 1 2 3 #@ ``` #+end_src - diff --git a/examples/mustache_sections_non_false_value.cf b/examples/mustache_sections_non_false_value.cf index 6ebfa28294..351b6f9b6d 100644 --- a/examples/mustache_sections_non_false_value.cf +++ b/examples/mustache_sections_non_false_value.cf @@ -1,21 +1,20 @@ # Example showing how sections are rendered for non-false - #+begin_src cfengine3 bundle agent main { vars: - "data" data => parsejson('{ "classes": { "example": true } }'); + "data" data => parsejson('{ "classes": { "example": true } }'); reports: - "$(with)" - with => string_mustache("{{#classes.example}}This is an example.{{/classes.example}}", - data); + "$(with)" + with => string_mustache( + "{{#classes.example}}This is an example.{{/classes.example}}", data + ); } -#+end_src +#+end_src #+begin_src example_output #@ ``` #@ R: This is an example. #@ ``` #+end_src - diff --git a/examples/mustache_set_delimiters.cf b/examples/mustache_set_delimiters.cf index f56441d826..9bcaeb08db 100644 --- a/examples/mustache_set_delimiters.cf +++ b/examples/mustache_set_delimiters.cf @@ -1,5 +1,4 @@ # Example showing how delimeters can be customized - #+begin_src cfengine3 bundle agent main { @@ -7,15 +6,12 @@ bundle agent main "data" data => '{ "key": "value of key in data" }'; reports: - "$(with)" - with => string_mustache("{{=<% %>=}}key has <% key %>", - data); + "$(with)" with => string_mustache("{{=<% %>=}}key has <% key %>", data); } -#+end_src +#+end_src #+begin_src example_output #@ ``` #@ R: key has value of key in data #@ ``` #+end_src - diff --git a/examples/mustache_template_motd.cf b/examples/mustache_template_motd.cf index bd3816d4db..773e82f6f9 100644 --- a/examples/mustache_template_motd.cf +++ b/examples/mustache_template_motd.cf @@ -2,86 +2,89 @@ bundle agent env_classification # @brief Classify environment { vars: - # We use presence of key files to know the hosts environment - "environment_semaphores" slist => { "/etc/prod", "/etc/staging" }; - "environment" - string => ifelse( filesexist( @(environment_semaphores) ), "incoherent", - fileexists("/etc/prod"), "production", - fileexists("/etc/staging"), "staging", - "unknown" ); - "env_issue_msg" - string => ifelse( strcmp( "incoherent", $(environment) ), - "WARNING: Environment incoherent (multiple environment semaphores)", - strcmp( "unknown", $(environment) ), - "WARNING: Environment unknown (missing environment semaphores)", - "Host environment classified as $(environment)"); - - # This is to extract the cfengine role ( hub or client ) - "cf_role" - string => ifelse( "policy_server", "Policy Server", "Policy Client"); + # We use presence of key files to know the hosts environment + "environment_semaphores" slist => { "/etc/prod", "/etc/staging" }; + + "environment" + string => ifelse( + filesexist(@(environment_semaphores)), + "incoherent", + fileexists("/etc/prod"), + "production", + fileexists("/etc/staging"), + "staging", + "unknown" + ); + + "env_issue_msg" + string => ifelse( + strcmp("incoherent", $(environment)), + "WARNING: Environment incoherent (multiple environment semaphores)", + strcmp("unknown", $(environment)), + "WARNING: Environment unknown (missing environment semaphores)", + "Host environment classified as $(environment)" + ); + + # This is to extract the cfengine role ( hub or client ) + "cf_role" + string => ifelse("policy_server", "Policy Server", "Policy Client"); classes: - - # We define a class for the selected environment. It's useful for making - # decisions in other policies - - "env_$(environment)" - expression => "any", - scope => "namespace"; - + # We define a class for the selected environment. It's useful for making + # decisions in other policies + "env_$(environment)" + expression => "any", + scope => "namespace"; } + bundle agent env_info # @brief Relevant environment information { vars: - ## Based on the environment we define different contacts. - "admin_contact" - slist => { "admin@acme.com", "oncall@acme.com" }, - if => strcmp( $(env_classification.environment), "production" ); + ## Based on the environment we define different contacts. + "admin_contact" + slist => { "admin@acme.com", "oncall@acme.com" }, + if => strcmp($(env_classification.environment), "production"); - "admin_contact" - slist => { "dev@acme.com" }, - if => strcmp( $(env_classification.environment), "staging" ); + "admin_contact" + slist => { "dev@acme.com" }, + if => strcmp($(env_classification.environment), "staging"); - "admin_contact" - slist => { "root@localhost" }, - if => strcmp( $(env_classification.environment), "unknown" ); + "admin_contact" + slist => { "root@localhost" }, + if => strcmp($(env_classification.environment), "unknown"); - ## This is to extract the available package updates status - "updates_available" - data => packageupdatesmatching(".*", ".*", ".*", ".*"); - "count_updates" int => length("updates_available"); + ## This is to extract the available package updates status + "updates_available" data => packageupdatesmatching(".*", ".*", ".*", ".*"); + "count_updates" int => length("updates_available"); classes: - - # We define a class indicating there are updates available, it might be - # useful for various different policies. - - "have_updates_available" - expression => isgreaterthan( $(count_updates), 0), - scope => "namespace"; - + # We define a class indicating there are updates available, it might be + # useful for various different policies. + "have_updates_available" + expression => isgreaterthan($(count_updates), 0), + scope => "namespace"; } -bundle agent motd { +bundle agent motd +{ vars: - "motd_path" string => "/etc/motd"; - - # It's considered best practice to prepare a data container holding the - # information you need to render the template instead of relying on - # current datastate() - - # First we extract currently defined classes from datastate(), then we - # construct the template data. - - "_state" data => datastate(), - if => not( isvariable ( $(this.promiser) ) ); # Limit recursive growth - # and multiple calls to - # datastate() over - # multiple passes. - - "template_data" - data => mergedata('{ "fqhost": "$(sys.fqhost)", + "motd_path" string => "/etc/motd"; + + # It's considered best practice to prepare a data container holding the + # information you need to render the template instead of relying on + # current datastate() + # First we extract currently defined classes from datastate(), then we + # construct the template data. + "_state" + data => datastate(), + if => not(isvariable($(this.promiser))); # Limit recursive growth + # and multiple calls to + # datastate() over + # multiple passes. + "template_data" + data => mergedata( + '{ "fqhost": "$(sys.fqhost)", "primary_ip": "$(sys.ipv4)", "cf_version": "$(sys.cf_version)", "issue_msg": "$(env_classification.env_issue_msg)", @@ -89,14 +92,15 @@ bundle agent motd { "count_updates": "$(env_info.count_updates)", "contacts": env_info.admin_contact, "classes": _state[classes] - }'); + }' + ); files: - "$(motd_path)" - create => "true", - template_method => "inline_mustache", - template_data => @(template_data), - edit_template_string => '# Managed by CFEngine + "$(motd_path)" + create => "true", + template_method => "inline_mustache", + template_data => @(template_data), + edit_template_string => '# Managed by CFEngine {{{issue_msg}}} *** *** Welcome to {{{fqhost}}} @@ -112,12 +116,12 @@ bundle agent motd { * * For support contact:{{#contacts}} - {{{.}}}{{/contacts}}$(const.n)'; - } + bundle agent __main__ { methods: - "env_classification"; - "env_info"; - "motd"; + "env_classification"; + "env_info"; + "motd"; } diff --git a/examples/mustache_variables.cf b/examples/mustache_variables.cf index 72e083fc99..4200d303a4 100644 --- a/examples/mustache_variables.cf +++ b/examples/mustache_variables.cf @@ -1,5 +1,4 @@ # Example showing how sections are rendered. - #+begin_src cfengine3 bundle agent main { @@ -9,14 +8,15 @@ bundle agent main reports: "$(with)" with => string_mustache( -"{{key}} + "{{key}} {{{key}}} {{&key}} Missing '{{missing}}' varibles render empty strings.", - data); + data + ); } -#+end_src +#+end_src #+begin_src example_output #@ ``` #@ R: Hello World & 3>2! @@ -25,4 +25,3 @@ Missing '{{missing}}' varibles render empty strings.", #@ Missing '' varibles render empty strings. #@ ``` #+end_src - diff --git a/examples/namespace_bodies.cf b/examples/namespace_bodies.cf index dc2f18b16b..bc7b24f810 100644 --- a/examples/namespace_bodies.cf +++ b/examples/namespace_bodies.cf @@ -1,45 +1,47 @@ bundle agent __main__ { methods: - "example_space:main"; + "example_space:main"; } + body file control { - namespace => "example_space"; + namespace => "example_space"; } bundle agent main { - reports: - # Use the 'first_line' printfile body from the current namespace - "Specifying a body without explict namespace assumes the same namespace.$(const.n)Show me the first 1 line of this file" - printfile => first_line( $(this.promise_filename) ); - - # Use the 'first_two_lines' printfile body from the 'default' namespace - "Forgetting to prefix bodies with 'default:' is a common mistake when using the standard library.$(const.n)Show me the first 2 line of this file" - printfile => default:first_two_lines( $(this.promise_filename) ); + # Use the 'first_line' printfile body from the current namespace + "Specifying a body without explict namespace assumes the same namespace.$(const.n)Show me the first 1 line of this file" + printfile => first_line($(this.promise_filename)); + # Use the 'first_two_lines' printfile body from the 'default' namespace + "Forgetting to prefix bodies with 'default:' is a common mistake when using the standard library.$(const.n)Show me the first 2 line of this file" + printfile => default:first_two_lines($(this.promise_filename)); } body printfile first_line(file) # @brief Report the first 1 lines of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "1"; + file_to_print => "$(file)"; + number_of_lines => "1"; } + body file control { - namespace => "default"; + namespace => "default"; } + body printfile first_two_lines(file) # @brief Report the first 2 lines of a file # @param file The full path of the file to report { - file_to_print => "$(file)"; - number_of_lines => "2"; + file_to_print => "$(file)"; + number_of_lines => "2"; } + ############################################################################### #+begin_src example_output #@ ``` diff --git a/examples/namespace_classes.cf b/examples/namespace_classes.cf index 38681afd55..17313ee907 100644 --- a/examples/namespace_classes.cf +++ b/examples/namespace_classes.cf @@ -1,10 +1,9 @@ bundle agent __main__ { methods: - "mynamespace:my_bundle"; + "mynamespace:my_bundle"; reports: - a_bundle_scoped_class_in_my_namespaced_bundle:: "In $(this.namespace):$(this.bundle) I see 'a_bundle_scoped_class_in_my_namespaced_bundle::'"; @@ -29,19 +28,16 @@ bundle agent __main__ body file control { - namespace => "mynamespace"; + namespace => "mynamespace"; } bundle agent my_bundle { classes: - "a_bundle_scoped_class_in_my_namespaced_bundle"; - - "a_namespace_scoped_class_in_my_namespaced_bundle" - scope => "namespace"; + "a_bundle_scoped_class_in_my_namespaced_bundle"; + "a_namespace_scoped_class_in_my_namespaced_bundle" scope => "namespace"; reports: - a_bundle_scoped_class_in_my_namespaced_bundle:: "In $(this.namespace):$(this.bundle) I see 'a_bundle_scoped_class_in_my_namespaced_bundle::'"; @@ -63,6 +59,7 @@ bundle agent my_bundle mynamespace:a_namespace_scoped_class_in_my_namespaced_bundle:: "In $(this.namespace):$(this.bundle) I see 'mynamespace:a_namespace_scoped_class_in_my_namespaced_bundle::'"; } + ############################################################################### #+begin_src example_output #@ ``` @@ -76,4 +73,3 @@ bundle agent my_bundle #@ R: In default:main I see 'mynamespace:a_namespace_scoped_class_in_my_namespaced_bundle::' #@ ``` #+end_src - diff --git a/examples/namespace_declaration.cf b/examples/namespace_declaration.cf index 1a85e5e5d8..6759c09959 100644 --- a/examples/namespace_declaration.cf +++ b/examples/namespace_declaration.cf @@ -1,58 +1,53 @@ # By default we are in the default namespace - bundle agent __main__ { methods: - "Main in my_namespace namespace" - usebundle => my_namespace:main; - - "Main in your_namespace namespace" - usebundle => your_namespace:main; - - "my_bundle in default namespace" - usebundle => my_bundle; + "Main in my_namespace namespace" usebundle => my_namespace:main; + "Main in your_namespace namespace" usebundle => your_namespace:main; + "my_bundle in default namespace" usebundle => my_bundle; reports: - "Inside $(this.namespace):$(this.bundle)"; + "Inside $(this.namespace):$(this.bundle)"; } body file control # From here until the next namespace declaration all bundles and bodies are # defined in my_namespace. { - namespace => "my_namespace"; + namespace => "my_namespace"; } bundle agent main { reports: - "Inside $(this.namespace):$(this.bundle)"; + "Inside $(this.namespace):$(this.bundle)"; } body file control # From here until the next namespace declaration all bundles and bodies are # defined in your_namespace. { - namespace => "your_namespace"; + namespace => "your_namespace"; } bundle agent main { reports: - "Inside $(this.namespace):$(this.bundle)"; + "Inside $(this.namespace):$(this.bundle)"; } body file control # From here until the next namespace declaration we return to the default namespace. { - namespace => "default"; + namespace => "default"; } bundle agent my_bundle { reports: - "Inside $(this.namespace):$(this.bundle)"; + "Inside $(this.namespace):$(this.bundle)"; } + ############################################################################### #+begin_src example_output #@ ``` diff --git a/examples/namespace_hard_classes.cf b/examples/namespace_hard_classes.cf index 4a8bd578fd..ea2a57b10a 100644 --- a/examples/namespace_hard_classes.cf +++ b/examples/namespace_hard_classes.cf @@ -1,7 +1,7 @@ bundle agent __main__ { methods: - "example:my_bundle"; + "example:my_bundle"; reports: cfengine:: @@ -11,12 +11,12 @@ bundle agent __main__ "From the '$(this.namespace)' namespace the class expression 'default:cfengine::' evaluates true"; "The class 'cfengine' has tags: $(with)" - with => join( ", ", getclassmetatags( "cfengine" ) ); + with => join(", ", getclassmetatags("cfengine")); } body file control { - namespace => "example"; + namespace => "example"; } bundle agent my_bundle @@ -28,6 +28,7 @@ bundle agent my_bundle default:cfengine:: "From the '$(this.namespace)' namespace the class expression 'default:cfengine::' evaluates true"; } + ############################################################################### #+begin_src example_output #@ ``` diff --git a/examples/namespace_methods-usebundle.cf b/examples/namespace_methods-usebundle.cf index fe1d8f7d7d..09112dfb39 100644 --- a/examples/namespace_methods-usebundle.cf +++ b/examples/namespace_methods-usebundle.cf @@ -1,33 +1,38 @@ bundle agent __main__ { methods: - # Call the bundle named main within the example_space namespace. - "example_space:main"; + # Call the bundle named main within the example_space namespace. + "example_space:main"; } + body file control { - namespace => "example_space"; + namespace => "example_space"; } bundle agent main { methods: - # Call the bundle 'my_bundle' within the current namespace - "When not specified, we assume you are refering to a bundle or body within the same namespace" - usebundle => my_bundle( "Called 'my_bundle' from $(this.namespace):$(this.bundle) (the same namespace)."); + # Call the bundle 'my_bundle' within the current namespace + "When not specified, we assume you are refering to a bundle or body within the same namespace" + usebundle => my_bundle( + "Called 'my_bundle' from $(this.namespace):$(this.bundle) (the same namespace)." + ); - # Call the bundle 'my_bundle' from the 'example_space' namespace - "When explicitly specified, the policy reader has less congnitive burden" - usebundle => example_space:my_bundle( "Called 'example_space:my_bundle' $(this.namespace):$(this.bundle) (the same namespace)."); + # Call the bundle 'my_bundle' from the 'example_space' namespace + "When explicitly specified, the policy reader has less congnitive burden" + usebundle => example_space:my_bundle( + "Called 'example_space:my_bundle' $(this.namespace):$(this.bundle) (the same namespace)." + ); } bundle agent my_bundle(string) { reports: - "In $(this.namespace):$(this.bundle)" - handle => "$(string)"; - "$(string)"; + "In $(this.namespace):$(this.bundle)" handle => "$(string)"; + "$(string)"; } + ############################################################################### #+begin_src example_output #@ ``` diff --git a/examples/namespace_special_var_exception.cf b/examples/namespace_special_var_exception.cf index c4ba9cc83b..d25ee9125b 100644 --- a/examples/namespace_special_var_exception.cf +++ b/examples/namespace_special_var_exception.cf @@ -1,18 +1,22 @@ bundle agent __main__ { - methods: "special_variables_example:demo"; + methods: + "special_variables_example:demo"; } + body file control { - namespace => "special_variables_example"; + namespace => "special_variables_example"; } + bundle agent demo { reports: - "Special Variables live in the default namespace but don't have to be fully qualified when referenced ..."; - "In $(this.namespace):$(this.bundle) $(const.dollar)(sys.cf_version_major) == $(sys.cf_version_major)"; - "In $(this.namespace):$(this.bundle) $(default:const.dollar)(default:sys.cf_version_major) == $(default:sys.cf_version_major)"; + "Special Variables live in the default namespace but don't have to be fully qualified when referenced ..."; + "In $(this.namespace):$(this.bundle) $(const.dollar)(sys.cf_version_major) == $(sys.cf_version_major)"; + "In $(this.namespace):$(this.bundle) $(default:const.dollar)(default:sys.cf_version_major) == $(default:sys.cf_version_major)"; } + ############################################################################### #+begin_src example_output #@ ``` diff --git a/examples/namespace_var_meta.cf b/examples/namespace_var_meta.cf index 09d6a95979..f2b8925557 100644 --- a/examples/namespace_var_meta.cf +++ b/examples/namespace_var_meta.cf @@ -1,24 +1,18 @@ - body common control { - bundlesequence => { "main" }; - version => "0.1"; - inputs => { "namespace_var_meta2.cf"}; + bundlesequence => { "main" }; + version => "0.1"; + inputs => { "namespace_var_meta2.cf" }; } bundle agent main { - classes: - - "abc" expression => "any"; - + "abc" expression => "any"; methods: - - "bla" usebundle => fred:example; + "bla" usebundle => fred:example; reports: - "remote var: $(fred:example.bundle_version)"; - + "remote var: $(fred:example.bundle_version)"; } diff --git a/examples/namespace_var_meta2.cf b/examples/namespace_var_meta2.cf index 63c723372c..0333181088 100644 --- a/examples/namespace_var_meta2.cf +++ b/examples/namespace_var_meta2.cf @@ -1,25 +1,18 @@ - body file control { - namespace => "fred"; + namespace => "fred"; } - bundle agent example - -{ +{ vars: - - "bundle_version" string => "4.5.6"; + "bundle_version" string => "4.5.6"; meta: - - "bundle_version" string => "1.2.3"; - "works_with_cfengine" string => "3.4.0"; + "bundle_version" string => "1.2.3"; + "works_with_cfengine" string => "3.4.0"; reports: - "Not a local variable: $(bundle_version)"; - "Meta data (variable): $(example_meta.bundle_version)"; - + "Not a local variable: $(bundle_version)"; + "Meta data (variable): $(example_meta.bundle_version)"; } - diff --git a/examples/namespace_variable_references.cf b/examples/namespace_variable_references.cf index b556f0afbb..f2015cdaf6 100644 --- a/examples/namespace_variable_references.cf +++ b/examples/namespace_variable_references.cf @@ -1,21 +1,26 @@ bundle agent __main__ { - methods: "example:demo"; + methods: + "example:demo"; } + body file control { - namespace => "example"; + namespace => "example"; } + bundle agent demo { vars: - "color" string => "#f5821f"; + "color" string => "#f5821f"; reports: - "Unqualified: The color is $(color)"; - # ENT-8817 "Bundle-qualified: The color is $(demo.color)"; - "Fully-qualified: The color is $(example:demo.color)"; + "Unqualified: The color is $(color)"; + + # ENT-8817 "Bundle-qualified: The color is $(demo.color)"; + "Fully-qualified: The color is $(example:demo.color)"; } + ############################################################################### #+begin_src example_output #@ ``` diff --git a/examples/neighbourhood_watch.cf b/examples/neighbourhood_watch.cf index cc5282345a..9bcbb625c2 100644 --- a/examples/neighbourhood_watch.cf +++ b/examples/neighbourhood_watch.cf @@ -1,96 +1,74 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Change detect # ######################################################## - body common control - { - bundlesequence => { "neighbourhood_watch" }; + bundlesequence => { "neighbourhood_watch" }; } ######################################################## - bundle agent neighbourhood_watch - { vars: - - "neighbours" slist => peers("/var/cfengine/inputs/hostlist","#.*",4); + "neighbours" slist => peers("/var/cfengine/inputs/hostlist", "#.*", 4); files: - - # Redundant cross monitoring ....................................... - - "$(sys.workdir)/nw/$(neighbours)_checksum_digests.db" - + # Redundant cross monitoring ....................................... + "$(sys.workdir)/nw/$(neighbours)_checksum_digests.db" comment => "Watch our peers remote hash tables and keep a local copy", - copy_from => rcp("$(sys.workdir)/checksum_digests.db",$(neighbours)), + copy_from => rcp("$(sys.workdir)/checksum_digests.db", $(neighbours)), depends_on => { "grant_hash_tables" }; - # Define the actual children to watch over ......................... - - "/usr/bin" - - comment => "Watch over the system binaries - changes are mostly updates", - changes => lay_trip_wire, + # Define the actual children to watch over ......................... + "/usr/bin" + comment => "Watch over the system binaries - changes are mostly updates", + changes => lay_trip_wire, depth_search => recurse("inf"), - action => measure; - + action => measure; } ######################################################### - body changes lay_trip_wire { - hash => "best"; - report_changes => "content"; - update_hashes => "yes"; + hash => "best"; + report_changes => "content"; + update_hashes => "yes"; } ######################################################### - -body copy_from rcp(from,server) - +body copy_from rcp(from, server) { - servers => { "$(server)" }; - source => "$(from)"; - compare => "digest"; - encrypt => "false"; + servers => { "$(server)" }; + source => "$(from)"; + compare => "digest"; + encrypt => "false"; } ########################################################## - body depth_search recurse(d) - { - depth => "$(d)"; + depth => "$(d)"; } body action measure { - measurement_class => "$(this.promiser) long job scan of /usr"; + measurement_class => "$(this.promiser) long job scan of /usr"; } diff --git a/examples/none.cf b/examples/none.cf index faceb576a5..191323861c 100644 --- a/examples/none.cf +++ b/examples/none.cf @@ -1,76 +1,89 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { classes: - "none11" expression => none("jebadiah", test1); - "none12" expression => none("2", test1); - "none21" expression => none("jebadiah", test2); - "none22" expression => none("2", test2); + "none11" expression => none("jebadiah", test1); + "none12" expression => none("2", test1); + "none21" expression => none("jebadiah", test2); + "none22" expression => none("2", test2); vars: - "test1" slist => { - 1,2,3, - "one", "two", "three", - "long string", - "four", "fix", "six", - "one", "two", "three", + "test1" + slist => { + 1, + 2, + 3, + "one", + "two", + "three", + "long string", + "four", + "fix", + "six", + "one", + "two", + "three", }; - - "test2" data => parsejson('[1,2,3, + "test2" + data => parsejson( + '[1,2,3, "one", "two", "three", "long string", "four", "fix", "six", - "one", "two", "three",]'); + "one", "two", "three",]' + ); reports: - "The test1 list is $(test1)"; + "The test1 list is $(test1)"; + none11:: "none() test1 1 passed"; + !none11:: "none() test1 1 failed"; + none12:: "none() test1 2 failed"; + !none12:: "none() test1 2 passed"; - "The test2 list is $(test2)"; + none21:: "none() test2 1 passed"; + !none21:: "none() test2 1 failed"; + none22:: "none() test2 2 failed"; + !none22:: "none() test2 2 passed"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/nth-key.cf b/examples/nth-key.cf index e9363c9e17..87896c413a 100644 --- a/examples/nth-key.cf +++ b/examples/nth-key.cf @@ -2,14 +2,15 @@ bundle agent main { vars: - "d" data => '{ "key1": "dvalue1", "key2": "dvalue2" }'; - "a[key1]" string => "value1"; - "a[key2]" string => "value2"; + "d" data => '{ "key1": "dvalue1", "key2": "dvalue2" }'; + "a[key1]" string => "value1"; + "a[key2]" string => "value2"; reports: - "$(with)" with => nth( a, "key1" ); - "$(with)" with => nth( d, "key1" ); + "$(with)" with => nth(a, "key1"); + "$(with)" with => nth(d, "key1"); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/nth.cf b/examples/nth.cf index 2e36739cb4..ed3805f009 100644 --- a/examples/nth.cf +++ b/examples/nth.cf @@ -1,77 +1,73 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } 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", }; - "test_str" string => format("%S", test); - - "test2" data => parsejson("[1, 2, 3, null]"); - "test2_str" string => format("%S", test2); - - "test3" data => parsejson('{ "x": true, "y": "z" }'); - "test3_str" string => format("%S", test3); - - "nth" slist => { 1, 2, 6, 10, 11, 1000 }; - "nth2" slist => getindices(test2); - "nth3" slist => getindices(test3); - - "access[$(nth)]" string => nth(test, $(nth)); - "access[0]" string => nth(test, 0); - - "access2[$(nth2)]" string => nth(test2, $(nth2)); - "access3[$(nth3)]" string => nth(test3, $(nth3)); - - "nth_neg1" string => nth(test, "-1"); - "nth_neg100" string => nth(test, "-100"); # invalid index position requested + "test_str" string => format("%S", test); + "test2" data => parsejson("[1, 2, 3, null]"); + "test2_str" string => format("%S", test2); + "test3" data => parsejson('{ "x": true, "y": "z" }'); + "test3_str" string => format("%S", test3); + "nth" slist => { 1, 2, 6, 10, 11, 1000 }; + "nth2" slist => getindices(test2); + "nth3" slist => getindices(test3); + "access[$(nth)]" string => nth(test, $(nth)); + "access[0]" string => nth(test, 0); + "access2[$(nth2)]" string => nth(test2, $(nth2)); + "access3[$(nth3)]" string => nth(test3, $(nth3)); + "nth_neg1" string => nth(test, "-1"); + "nth_neg100" string => nth(test, "-100"); # invalid index position requested reports: - "The test list is $(test_str)"; - "element #$(nth) of the test list: $(access[$(nth)])"; - "element #0 of the test list: $(access[0])"; - - "The test2 data container is $(test2_str)"; - "element #$(nth2) of the test2 data container: $(access2[$(nth2)])"; - - "The test3 data container is $(test3_str)"; - "element #$(nth3) of the test3 data container: $(access3[$(nth3)])"; - - "The last element of test is $(nth_neg1)"; - "nth_neg100 is not defined, because an invalid index was requested" - if => not( isvariable( nth_neg100 )); + "The test list is $(test_str)"; + "element #$(nth) of the test list: $(access[$(nth)])"; + "element #0 of the test list: $(access[0])"; + "The test2 data container is $(test2_str)"; + "element #$(nth2) of the test2 data container: $(access2[$(nth2)])"; + "The test3 data container is $(test3_str)"; + "element #$(nth3) of the test3 data container: $(access3[$(nth3)])"; + "The last element of test is $(nth_neg1)"; + + "nth_neg100 is not defined, because an invalid index was requested" + if => not(isvariable(nth_neg100)); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/null_config.cf b/examples/null_config.cf index 7a8ac3d705..448c8d5ab7 100644 --- a/examples/null_config.cf +++ b/examples/null_config.cf @@ -1,42 +1,32 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ####################################################### # # The starting point for every configuration # ####################################################### - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ####################################################### - bundle agent example - { reports: - "This is a test bundle"; + "This is a test bundle"; } diff --git a/examples/orchestrate_chain1.cf b/examples/orchestrate_chain1.cf index 474f9f2bc0..debb9c68e7 100644 --- a/examples/orchestrate_chain1.cf +++ b/examples/orchestrate_chain1.cf @@ -8,61 +8,60 @@ # to add host1 host2 host3 host4 as aliases to localhost # ############################################################ - body common control { - bundlesequence => { "weak_dependency_symphony" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "weak_dependency_symphony" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } body server control { - allowconnects => { "127.0.0.1" , "::1", @(def.acl) }; - allowallconnects => { "127.0.0.1" , "::1", @(def.acl) }; + allowconnects => { "127.0.0.1", "::1", @(def.acl) }; + allowallconnects => { "127.0.0.1", "::1", @(def.acl) }; } - ############################################################ - bundle agent weak_dependency_symphony { methods: - - # We have to seed the beginning by creating the tower - # /tmp/tower_localhost - + # We have to seed the beginning by creating the tower + # /tmp/tower_localhost host1:: - "tower" usebundle => tier1, - classes => publish_ok("ok_O"); + "tower" + usebundle => tier1, + classes => publish_ok("ok_O"); host2:: - "tower" usebundle => tier2, - classes => publish_ok("ok_1"); + "tower" + usebundle => tier2, + classes => publish_ok("ok_1"); host3:: - "tower" usebundle => tier3, - classes => publish_ok("ok_2"); + "tower" + usebundle => tier3, + classes => publish_ok("ok_2"); host4:: - "tower" usebundle => tier4, - classes => publish_ok("ok_f"); + "tower" + usebundle => tier4, + classes => publish_ok("ok_f"); classes: - ok_O:: # Wait for the methods, report on host1 only - - "check1" expression => remoteclassesmatching("ok.*","host2","yes","a"); - "check2" expression => remoteclassesmatching("ok.*","host3","yes","a"); - "check3" expression => remoteclassesmatching("ok.*","host4","yes","a"); + "check1" expression => remoteclassesmatching("ok.*", "host2", "yes", "a"); + "check2" expression => remoteclassesmatching("ok.*", "host3", "yes", "a"); + "check3" expression => remoteclassesmatching("ok.*", "host4", "yes", "a"); reports: - ok_O:: "tier 1 is ok"; + a_ok_1:: "tier 2 is ok"; + a_ok_2:: "tier 3 is ok"; + a_ok_f:: "tier 4 is ok"; @@ -74,60 +73,44 @@ bundle agent weak_dependency_symphony } ############################################################ - bundle agent tier1 { files: - - "/tmp/something_to_do_1" - create => "true"; + "/tmp/something_to_do_1" create => "true"; } bundle agent tier2 { files: - - "/tmp/something_to_do_2" - create => "true"; + "/tmp/something_to_do_2" create => "true"; } bundle agent tier3 { files: - - "/tmp/something_to_do_3" - create => "true"; - + "/tmp/something_to_do_3" create => "true"; } bundle agent tier4 { files: - - "/tmp/something_to_do_4" - create => "true"; + "/tmp/something_to_do_4" create => "true"; } ############################################################ - - bundle server access_rules() { access: - - "ok.*" + "ok.*" resource_type => "context", admit => { "127.0.0.1" }; - } ############################################################ - body classes publish_ok(x) { - promise_repaired => { "$(x)" }; - promise_kept => { "$(x)" }; - cancel_notkept => { "$(x)" }; - persist_time => "2"; + promise_repaired => { "$(x)" }; + promise_kept => { "$(x)" }; + cancel_notkept => { "$(x)" }; + persist_time => "2"; } - diff --git a/examples/orchestrate_chain2.cf b/examples/orchestrate_chain2.cf index 8a6ad85bd1..6866834045 100644 --- a/examples/orchestrate_chain2.cf +++ b/examples/orchestrate_chain2.cf @@ -8,119 +8,97 @@ # to add host1 host2 host3 host4 as aliases to localhost # ############################################################ - body common control { - bundlesequence => { "weak_dependency_symphony" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "weak_dependency_symphony" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } body server control { - allowconnects => { "127.0.0.1" , "::1", @(def.acl) }; - allowallconnects => { "127.0.0.1" , "::1", @(def.acl) }; + allowconnects => { "127.0.0.1", "::1", @(def.acl) }; + allowallconnects => { "127.0.0.1", "::1", @(def.acl) }; } - ############################################################ - bundle agent weak_dependency_symphony { methods: - - # We have to seed the beginning by creating the tower - # /tmp/tower_localhost - + # We have to seed the beginning by creating the tower + # /tmp/tower_localhost host1:: - "tower" usebundle => tier1, - classes => publish_ok("ok_O"); + "tower" + usebundle => tier1, + classes => publish_ok("ok_O"); host2:: - "tower" usebundle => tier2, - classes => publish_ok("ok_1"); + "tower" + usebundle => tier2, + classes => publish_ok("ok_1"); host3:: - "tower" usebundle => tier3, - classes => publish_ok("ok_2"); + "tower" + usebundle => tier3, + classes => publish_ok("ok_2"); host4:: - "tower" usebundle => tier4, - classes => publish_ok("ok_f"); + "tower" + usebundle => tier4, + classes => publish_ok("ok_f"); classes: - ok_O:: # Wait for the methods, report on host1 only - - "check1" expression => remoteclassesmatching("ok.*","host2","yes","a"); - "check2" expression => remoteclassesmatching("ok.*","host3","yes","a"); - "check3" expression => remoteclassesmatching("ok.*","host4","yes","a"); + "check1" expression => remoteclassesmatching("ok.*", "host2", "yes", "a"); + "check2" expression => remoteclassesmatching("ok.*", "host3", "yes", "a"); + "check3" expression => remoteclassesmatching("ok.*", "host4", "yes", "a"); reports: - ok_O&a_ok_1&a_ok_2&a_ok_f:: - "The Tower is standing"; !(ok_O&a_ok_1&a_ok_2&a_ok_f):: - "The Tower is down"; } ############################################################ - bundle agent tier1 { files: - - "/tmp/something_to_do_1" - create => "true"; + "/tmp/something_to_do_1" create => "true"; } bundle agent tier2 { files: - - "/tmp/something_to_do_2" - create => "true"; + "/tmp/something_to_do_2" create => "true"; } bundle agent tier3 { files: - - "/tmp/something_to_do_3" - create => "true"; - + "/tmp/something_to_do_3" create => "true"; } bundle agent tier4 { files: - - "/tmp/something_to_do_4" - create => "true"; + "/tmp/something_to_do_4" create => "true"; } ############################################################ - - bundle server access_rules() { access: - - "ok.*" + "ok.*" resource_type => "context", admit => { "127.0.0.1" }; - } ############################################################ - body classes publish_ok(x) { - promise_repaired => { "$(x)" }; - promise_kept => { "$(x)" }; - cancel_notkept => { "$(x)" }; - persist_time => "5"; + promise_repaired => { "$(x)" }; + promise_kept => { "$(x)" }; + cancel_notkept => { "$(x)" }; + persist_time => "5"; } - diff --git a/examples/orchestrate_delay_trigger.cf b/examples/orchestrate_delay_trigger.cf index d4c1a202dc..eeb46d456a 100644 --- a/examples/orchestrate_delay_trigger.cf +++ b/examples/orchestrate_delay_trigger.cf @@ -1,81 +1,71 @@ -# # Time based orchestration -# - body common control { - bundlesequence => { "example" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "example" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } ########################################### - bundle common orchestrate { vars: - - # Must have delay < reset_time - - "reset_time" int => "2"; - "delay" int => "1"; + # Must have delay < reset_time + "reset_time" int => "2"; + "delay" int => "1"; } ########################################### - bundle agent example { methods: - - "immediate" usebundle => one, + "immediate" + usebundle => one, classes => if_repaired_persist("countdown", "$(orchestrate.delay)"), if => "!one"; - "delayed" usebundle => two, + "delayed" + usebundle => two, if => "one.!countdown"; reports: - countdown:: "Counting down ... $(sys.date)"; } ########################################### - bundle agent one { reports: - - "One = $(this.bundle) at $(sys.date)" - classes => if_repaired_persist("$(this.bundle)", "$(orchestrate.reset_time)"), + "One = $(this.bundle) at $(sys.date)" + classes => if_repaired_persist( + "$(this.bundle)", "$(orchestrate.reset_time)" + ), action => if_elapsed("0"); - "Set class $(this.bundle)" - if => "$(this.bundle)"; + "Set class $(this.bundle)" if => "$(this.bundle)"; } ########################################## - bundle agent two { reports: - - "Two = $(this.bundle) at $(sys.date)" - classes => if_repaired_persist("$(this.bundle)", "$(orchestrate.reset_time)"), + "Two = $(this.bundle) at $(sys.date)" + classes => if_repaired_persist( + "$(this.bundle)", "$(orchestrate.reset_time)" + ), action => if_elapsed("0"); - "Set class $(this.bundle)" - if => "$(this.bundle)"; + "Set class $(this.bundle)" if => "$(this.bundle)"; } ########################################### - -body classes if_repaired_persist(x,t) +body classes if_repaired_persist(x, t) { - promise_repaired => { "$(x)" }; - persist_time => "$(t)"; + promise_repaired => { "$(x)" }; + persist_time => "$(t)"; } body classes cancel_persist(x) { - cancel_repaired => { "$(x)" }; + cancel_repaired => { "$(x)" }; } diff --git a/examples/orchestrate_dominoes1.cf b/examples/orchestrate_dominoes1.cf index 2eba58658b..14a5ef5edd 100644 --- a/examples/orchestrate_dominoes1.cf +++ b/examples/orchestrate_dominoes1.cf @@ -8,101 +8,82 @@ # to add host1 host2 host3 host4 as aliases to localhost # ############################################################ - body common control { - bundlesequence => { "dominoes_symphony" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "dominoes_symphony" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } ############################################################ - bundle agent dominoes_symphony { methods: - - # We have to seed the beginning by creating the dominoes - # /tmp/dominoes_localhost - + # We have to seed the beginning by creating the dominoes + # /tmp/dominoes_localhost host1:: - "dominoes" usebundle => hand_over("localhost","host1","overture"); + "dominoes" usebundle => hand_over("localhost", "host1", "overture"); host2:: - "dominoes" usebundle => hand_over("host1","host2","first movement"); + "dominoes" usebundle => hand_over("host1", "host2", "first movement"); host3:: - "dominoes" usebundle => hand_over("host2","host3","second movement"); + "dominoes" usebundle => hand_over("host2", "host3", "second movement"); host4:: - "dominoes" usebundle => hand_over("host3","host4","final movement"), - classes => if_ok("finale"); + "dominoes" + usebundle => hand_over("host3", "host4", "final movement"), + classes => if_ok("finale"); reports: - finale:: - "The visitors book of the Dominoes method" - printfile => visitors_book("/tmp/dominoes_host4"); - + printfile => visitors_book("/tmp/dominoes_host4"); } ############################################################ - -bundle agent hand_over(predecessor,myalias,method) +bundle agent hand_over(predecessor, myalias, method) { - - # This is a wrapper for the orchestration - + # This is a wrapper for the orchestration files: - - "/tmp/tip_the_dominoes" - + "/tmp/tip_the_dominoes" comment => "Wait for our cue or relay/conductor baton", - copy_from => secure_cp("/tmp/dominoes_$(predecessor)","$(predecessor)"), + copy_from => secure_cp("/tmp/dominoes_$(predecessor)", "$(predecessor)"), classes => if_repaired("cue_action"); cue_action:: - "/tmp/outcome_of_part" - - comment => "One off activity", - create => "true", - edit_line => append_if_no_line("Do something meaningful by calling $(method)"), - classes => if_ok("pass_the_stick"); + comment => "One off activity", + create => "true", + edit_line => append_if_no_line( + "Do something meaningful by calling $(method)" + ), + classes => if_ok("pass_the_stick"); pass_the_stick:: - "/tmp/tip_the_dominoes" - comment => "Add our signature to the dominoes's tail", - edit_line => append_if_no_line("Knocked over $(myalias) and did: $(method)"); + comment => "Add our signature to the dominoes's tail", + edit_line => append_if_no_line( + "Knocked over $(myalias) and did: $(method)" + ); "/tmp/dominoes_$(myalias)" - - comment => "Dominoes in position to be beamed up by next agent", - copy_from => local_cp("/tmp/tip_the_dominoes"); - + comment => "Dominoes in position to be beamed up by next agent", + copy_from => local_cp("/tmp/tip_the_dominoes"); } ############################################################ - bundle server access_rules() { access: + "/tmp" admit => { "127.0.0.1" }; - "/tmp" - - admit => { "127.0.0.1" }; - - "did.*" + "did.*" resource_type => "context", admit => { "127.0.0.1" }; - } - body printfile visitors_book(file) { - file_to_print => "$(file)"; - number_of_lines => "10"; + file_to_print => "$(file)"; + number_of_lines => "10"; } - diff --git a/examples/orchestrate_dominoes2.cf b/examples/orchestrate_dominoes2.cf index 612cf8165a..d32bd4d6f6 100644 --- a/examples/orchestrate_dominoes2.cf +++ b/examples/orchestrate_dominoes2.cf @@ -8,133 +8,106 @@ # to add host1 host2 host3 host4 as aliases to localhost # ############################################################ - body common control { - bundlesequence => { "dominoes_symphony" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "dominoes_symphony" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } ############################################################ - bundle agent dominoes_symphony { methods: - - # We have to seed the beginning by creating the dominoes - # /tmp/dominoes_localhost - + # We have to seed the beginning by creating the dominoes + # /tmp/dominoes_localhost host1:: - "dominoes" usebundle => hand_over("localhost","host1","overture"); + "dominoes" usebundle => hand_over("localhost", "host1", "overture"); host2:: - "dominoes" usebundle => hand_over("host1","host2","first_movement"); + "dominoes" usebundle => hand_over("host1", "host2", "first_movement"); host3:: - "dominoes" usebundle => hand_over("host2","host3","second_movement"); + "dominoes" usebundle => hand_over("host2", "host3", "second_movement"); host4:: - "dominoes" usebundle => hand_over("host3","host4","final_movement"), - classes => if_ok("finale"); + "dominoes" + usebundle => hand_over("host3", "host4", "final_movement"), + classes => if_ok("finale"); reports: - finale:: - "The visitors book of the Dominoes method" - printfile => visitors_book("/tmp/dominoes_host4"); - + printfile => visitors_book("/tmp/dominoes_host4"); } ############################################################ - -bundle agent hand_over(predecessor,myalias,method) +bundle agent hand_over(predecessor, myalias, method) { - - # This is a wrapper for the orchestration - + # This is a wrapper for the orchestration files: - - "/tmp/tip_the_dominoes" - + "/tmp/tip_the_dominoes" comment => "Wait for our cue or relay/conductor baton", - copy_from => secure_cp("/tmp/dominoes_$(predecessor)","$(predecessor)"), + copy_from => secure_cp("/tmp/dominoes_$(predecessor)", "$(predecessor)"), classes => if_repaired("cue_action"); methods: - cue_action:: - "the music happens" - - comment => "One off activity", - usebundle => $(method), - classes => if_ok("pass_the_stick"); + comment => "One off activity", + usebundle => $(method), + classes => if_ok("pass_the_stick"); files: - pass_the_stick:: - "/tmp/tip_the_dominoes" - comment => "Add our signature to the dominoes's tail", - edit_line => append_if_no_line("Knocked over $(myalias) and did: $(method)"); + comment => "Add our signature to the dominoes's tail", + edit_line => append_if_no_line( + "Knocked over $(myalias) and did: $(method)" + ); "/tmp/dominoes_$(myalias)" - - comment => "Dominoes in position to be beamed up by next agent", - copy_from => local_cp("/tmp/tip_the_dominoes"); - + comment => "Dominoes in position to be beamed up by next agent", + copy_from => local_cp("/tmp/tip_the_dominoes"); } ############################################################ - bundle agent overture { reports: - "Singing the overture..."; + "Singing the overture..."; } bundle agent first_movement { reports: - "Singing the first adagio..."; + "Singing the first adagio..."; } bundle agent second_movement { reports: - "Singing second allegro..."; - + "Singing second allegro..."; } bundle agent final_movement { reports: - "Trumpets for the finale"; - + "Trumpets for the finale"; } ############################################################ - - bundle server access_rules() { access: + "/tmp" admit => { "127.0.0.1" }; - "/tmp" - - admit => { "127.0.0.1" }; - - "did.*" + "did.*" resource_type => "context", admit => { "127.0.0.1" }; - } - body printfile visitors_book(file) { - file_to_print => "$(file)"; - number_of_lines => "10"; + file_to_print => "$(file)"; + number_of_lines => "10"; } - diff --git a/examples/orchestrate_dragon.cf b/examples/orchestrate_dragon.cf index 714e84037d..3fd47b28ca 100644 --- a/examples/orchestrate_dragon.cf +++ b/examples/orchestrate_dragon.cf @@ -9,223 +9,175 @@ # to add host1 host2 host3 host4 as aliases to localhost # ############################################################ - body common control { - bundlesequence => { "dragon_symphony" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "dragon_symphony" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } ############################################################ - bundle agent dragon_symphony { methods: - - # We have to seed the beginning by creating the dragon - # /tmp/dragon_localhost - - "dragon" usebundle => visit("localhost","host1","chapter1"); - - "dragon" usebundle => visit("host1","host2","chapter2"); - - "dragon" usebundle => visit("host2","host3","chapter3"); - - "dragon" usebundle => visit("host3","host4","chapter4"), + # We have to seed the beginning by creating the dragon + # /tmp/dragon_localhost + "dragon" usebundle => visit("localhost", "host1", "chapter1"); + "dragon" usebundle => visit("host1", "host2", "chapter2"); + "dragon" usebundle => visit("host2", "host3", "chapter3"); + + "dragon" + usebundle => visit("host3", "host4", "chapter4"), classes => if_ok("finale"); reports: - finale:: - "The dragon is slain:" - printfile => visitors_book("/tmp/shoo_dragon_host4"); + printfile => visitors_book("/tmp/shoo_dragon_host4"); } ############################################################ # Define the ############################################################ - bundle agent chapter1(x) { - # Do something significant here - + # Do something significant here reports: - host1:: " ----> Breathing fire on $(x)"; } ################################ - bundle agent chapter2(x) { - # Do something significant here - + # Do something significant here reports: - host2:: " ----> Breathing fire on $(x)"; - } ################################ - bundle agent chapter3(x) { - # Do something significant here - + # Do something significant here reports: - host3:: " ----> Breathing fire on $(x)"; - } ################################ - bundle agent chapter4(x) { - # Do something significant here - + # Do something significant here reports: - host4:: " ----> Breathing fire on $(x)"; - } ############################################################ # Orchestration wrappers ############################################################ - -bundle agent visit(predecessor,satellite,method) +bundle agent visit(predecessor, satellite, method) { - - # This is a wrapper for the orchestration will be acted on - # first by the dragon's lair and then by the satellite - + # This is a wrapper for the orchestration will be acted on + # first by the dragon's lair and then by the satellite vars: - - "dragons_lair" string => "host0"; + "dragons_lair" string => "host0"; files: - - # We start in the dragon's lair .. - - "/tmp/unleash_dragon" - + # We start in the dragon's lair .. + "/tmp/unleash_dragon" comment => "Unleash the dragon", rename => to("/tmp/enter_the_dragon"), classes => if_repaired("dispatch_dragon_$(satellite)"), if => "$(dragons_lair)"; - # if we are the dragon's lair, welcome the dragon back, shooed from the satellite - - "/tmp/enter_the_dragon" - + # if we are the dragon's lair, welcome the dragon back, shooed from the satellite + "/tmp/enter_the_dragon" comment => "Returning from a visit to a satellite", - copy_from => secure_cp("/tmp/shoo_dragon_$(predecessor)","$(predecessor)"), + copy_from => secure_cp( + "/tmp/shoo_dragon_$(predecessor)", "$(predecessor)" + ), classes => if_repaired("dispatch_dragon_$(satellite)"), if => "$(dragons_lair)"; - # If we are a satellite, receive the dragon from its lair - - "/tmp/enter_the_dragon" + # If we are a satellite, receive the dragon from its lair + "/tmp/enter_the_dragon" comment => "Wait for our cue or relay/conductor baton", - copy_from => secure_cp("/tmp/dragon_$(satellite)","$(dragons_lair)"), + copy_from => secure_cp("/tmp/dragon_$(satellite)", "$(dragons_lair)"), classes => if_repaired("cue_action_on_$(satellite)"), if => "$(satellite)"; methods: - - "check in at home" + "check in at home" comment => "Edit the load balancer?", usebundle => switch_satellite(" -> Send dragon to $(satellite)"), classes => if_repaired("send_the_dragon_to_$(satellite)"), if => "dispatch_dragon_$(satellite)"; - "dragon visits" + "dragon visits" comment => "One off activity that the nodes carry out while the dragon visits", usebundle => $(method)("$(satellite)"), classes => if_repaired("send_the_dragon_back_from_$(satellite)"), if => "cue_action_on_$(satellite)"; - files: - - # hub/lair hub signs the book too and schedules the dragon for next satellite - - "/tmp/dragon_$(satellite)" + # hub/lair hub signs the book too and schedules the dragon for next satellite + "/tmp/dragon_$(satellite)" create => "true", comment => "Add our signature to the dragon's tail", edit_line => sign_visitor_book("Dragon returned from $(predecessor)"), if => "send_the_dragon_to_$(satellite)"; - # Satellite signs the book and shoos dragon for hub to collect - - "/tmp/shoo_dragon_$(satellite)" + # Satellite signs the book and shoos dragon for hub to collect + "/tmp/shoo_dragon_$(satellite)" create => "true", comment => "Add our signature to the dragon's tail", - edit_line => sign_visitor_book("Dragon visited $(satellite) and did: $(method)"), + edit_line => sign_visitor_book( + "Dragon visited $(satellite) and did: $(method)" + ), if => "send_the_dragon_back_from_$(satellite)"; reports: - "Done $(satellite)"; - + "Done $(satellite)"; } ############################################################ - bundle agent switch_satellite(name) { files: - - "/tmp/enter_the_dragon" + "/tmp/enter_the_dragon" comment => "Add our signature to the dragon's tail", edit_line => append_if_no_line("Switch new dragon's target $(name)"); reports: - " X Switching new dragon's target $(name)"; + " X Switching new dragon's target $(name)"; } - ############################################################ - bundle edit_line sign_visitor_book(s) { insert_lines: - - "/tmp/enter_the_dragon" + "/tmp/enter_the_dragon" comment => "Import the current visitor's book", insert_type => "file"; - "$(s)" comment => "Append this string to the visitor's book"; + "$(s)" comment => "Append this string to the visitor's book"; } ############################################################ - - bundle server access_rules() { access: + "/tmp" admit => { "127.0.0.1" }; - "/tmp" - - admit => { "127.0.0.1" }; - - "did.*" + "did.*" resource_type => "context", admit => { "127.0.0.1" }; - } ############################################################ - body printfile visitors_book(file) { - file_to_print => "$(file)"; - number_of_lines => "100"; + file_to_print => "$(file)"; + number_of_lines => "100"; } - - diff --git a/examples/orchestrate_dragon_load_balancer.cf b/examples/orchestrate_dragon_load_balancer.cf index be8f07d44f..a00d53dc40 100644 --- a/examples/orchestrate_dragon_load_balancer.cf +++ b/examples/orchestrate_dragon_load_balancer.cf @@ -12,296 +12,228 @@ # host1 ON # host2 ON # host3 ON etc - - ############################################################ - body common control { - bundlesequence => { "dragon_symphony" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "dragon_symphony" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } ############################################################ - bundle agent dragon_symphony { methods: - - # We have to seed the beginning by creating the dragon - # /tmp/dragon_localhost - - "dragon" usebundle => upgrade_host("localhost","host1","chapter1"); - - "dragon" usebundle => upgrade_host("host1","host2","chapter2"); - - "dragon" usebundle => upgrade_host("host2","host3","chapter3"); - - "dragon" usebundle => upgrade_host("host3","host4","chapter4"), + # We have to seed the beginning by creating the dragon + # /tmp/dragon_localhost + "dragon" usebundle => upgrade_host("localhost", "host1", "chapter1"); + "dragon" usebundle => upgrade_host("host1", "host2", "chapter2"); + "dragon" usebundle => upgrade_host("host2", "host3", "chapter3"); + + "dragon" + usebundle => upgrade_host("host3", "host4", "chapter4"), classes => if_ok("finale"); finale:: - - "dragon" usebundle => restore_final("host4"), - comment => "Restore all the deactivated satellites"; - + "dragon" + usebundle => restore_final("host4"), + comment => "Restore all the deactivated satellites"; reports: - finale:: - "The dragon is slain!!!" - printfile => visitors_book("/tmp/shoo_dragon_host4"); + printfile => visitors_book("/tmp/shoo_dragon_host4"); "And the switch state is..." - printfile => visitors_book("/tmp/switch_file"); + printfile => visitors_book("/tmp/switch_file"); } ############################################################ # Define the ############################################################ - bundle agent chapter1(x) { - # Do something significant here - + # Do something significant here reports: - host1:: " ----> Breathing fire on $(x)"; } ################################ - bundle agent chapter2(x) { - # Do something significant here - + # Do something significant here reports: - host2:: " ----> Breathing fire on $(x)"; - } ################################ - bundle agent chapter3(x) { - # Do something significant here - + # Do something significant here reports: - host3:: " ----> Breathing fire on $(x)"; - } ################################ - bundle agent chapter4(x) { - # Do something significant here - + # Do something significant here reports: - host4:: " ----> Breathing fire on $(x)"; - } ############################################################ # Orchestration wrappers ############################################################ - -bundle agent upgrade_host(predecessor,satellite,method) +bundle agent upgrade_host(predecessor, satellite, method) { - - # This is a wrapper for the orchestration will be acted on - # first by the dragon's lair and then by the satellite - + # This is a wrapper for the orchestration will be acted on + # first by the dragon's lair and then by the satellite vars: - - "dragons_lair" string => "host0"; + "dragons_lair" string => "host0"; files: - - # We start in the dragon's lair .. - - "/tmp/unleash_dragon" - + # We start in the dragon's lair .. + "/tmp/unleash_dragon" comment => "Unleash the dragon", rename => to("/tmp/enter_the_dragon"), classes => if_repaired("dispatch_dragon_$(satellite)"), if => "$(dragons_lair)"; - # if we are the dragon's lair, welcome the dragon back, shooed from the satellite - - "/tmp/enter_the_dragon" - + # if we are the dragon's lair, welcome the dragon back, shooed from the satellite + "/tmp/enter_the_dragon" comment => "Returning from a visit to a satellite", - copy_from => secure_cp("/tmp/shoo_dragon_$(predecessor)","$(predecessor)"), + copy_from => secure_cp( + "/tmp/shoo_dragon_$(predecessor)", "$(predecessor)" + ), classes => if_repaired("dispatch_dragon_$(satellite)"), if => "$(dragons_lair)"; - # If we are a satellite, receive the dragon from its lair - - "/tmp/enter_the_dragon" + # If we are a satellite, receive the dragon from its lair + "/tmp/enter_the_dragon" comment => "Wait for our cue or relay/conductor baton", - copy_from => secure_cp("/tmp/dragon_$(satellite)","$(dragons_lair)"), + copy_from => secure_cp("/tmp/dragon_$(satellite)", "$(dragons_lair)"), classes => if_repaired("cue_action_on_$(satellite)"), if => "$(satellite)"; methods: - - "check in at home" + "check in at home" comment => "Edit the load balancer?", - usebundle => next_host("$(satellite)","$(predecessor)"), + usebundle => next_host("$(satellite)", "$(predecessor)"), classes => if_repaired("send_the_dragon_to_$(satellite)"), if => "dispatch_dragon_$(satellite)"; - "dragon visits" + "dragon visits" comment => "One off activity that the nodes carry out while the dragon visits", usebundle => $(method)("$(satellite)"), classes => if_repaired("send_the_dragon_back_from_$(satellite)"), if => "cue_action_on_$(satellite)"; - files: - - # hub/lair hub signs the book too and schedules the dragon for next satellite - - "/tmp/dragon_$(satellite)" + # hub/lair hub signs the book too and schedules the dragon for next satellite + "/tmp/dragon_$(satellite)" create => "true", comment => "Add our signature to the dragon's tail", edit_line => sign_visitor_book("Dragon returned from $(predecessor)"), if => "send_the_dragon_to_$(satellite)"; - # Satellite signs the book and shoos dragon for hub to collect - - "/tmp/shoo_dragon_$(satellite)" + # Satellite signs the book and shoos dragon for hub to collect + "/tmp/shoo_dragon_$(satellite)" create => "true", comment => "Add our signature to the dragon's tail", - edit_line => sign_visitor_book("Dragon visited $(satellite) and did: $(method)"), + edit_line => sign_visitor_book( + "Dragon visited $(satellite) and did: $(method)" + ), if => "send_the_dragon_back_from_$(satellite)"; reports: - - "Done $(satellite)" - if => "$(satellite)"; + "Done $(satellite)" if => "$(satellite)"; } ############################################################ - -bundle agent next_host(name,pred) +bundle agent next_host(name, pred) { files: - - "/tmp/enter_the_dragon" + "/tmp/enter_the_dragon" comment => "Add our signature to the dragon's tail", edit_line => append_if_no_line("Switch new dragon's target $(name)"); - # Edit the switch file - - "/tmp/switch_file" + # Edit the switch file + "/tmp/switch_file" comment => "Restore whatever is missing and comment out", - edit_line => restore_and_comment("$(name)","$(pred)"), + edit_line => restore_and_comment("$(name)", "$(pred)"), classes => if_repaired("reload_switch_$(name)"); reports: - !problem:: - "Returned from $(pred), heading out to $(name)"; " X Restoring $(pred) and switching new dragon's target $(name)" - if => "reload_switch_$(name)"; + if => "reload_switch_$(name)"; } ############################################################ - bundle agent restore_final(name) { files: - host0:: - "/tmp/switch_file" - comment => "Restore whatever is missing and comment out", - edit_line => restore_and_comment("NONE","$(name)"), - classes => if_repaired("reload_switch"); + comment => "Restore whatever is missing and comment out", + edit_line => restore_and_comment("NONE", "$(name)"), + classes => if_repaired("reload_switch"); reports: - reload_switch:: " X Restoring $(name) to tidy up loose ends"; - } ############################################################ - bundle edit_line sign_visitor_book(s) { insert_lines: - - "/tmp/enter_the_dragon" + "/tmp/enter_the_dragon" comment => "Import the current visitor's book", insert_type => "file"; - "$(s)" comment => "Append this string to the visitor's book"; + "$(s)" comment => "Append this string to the visitor's book"; } -# - -bundle edit_line restore_and_comment(name,pred) +bundle edit_line restore_and_comment(name, pred) { replace_patterns: - - "$(name) ON" - + "$(name) ON" replace_with => value("$(name) OFF"), comment => "Uncomment the predecessor to reactivate"; - "$(pred) OFF" - + "$(pred) OFF" replace_with => value("$(pred) ON"), comment => "Comment out the new host", classes => if_repaired("show_switch_$(name)"); reports: - !problem:: - "The state of the switch was:" - printfile => visitors_book("/tmp/switch_file"), - if => "show_switch_$(name)"; - - + printfile => visitors_book("/tmp/switch_file"), + if => "show_switch_$(name)"; } ############################################################ - - bundle server access_rules() { access: + "/tmp" admit => { "127.0.0.1" }; - "/tmp" - - admit => { "127.0.0.1" }; - - "did.*" + "did.*" resource_type => "context", admit => { "127.0.0.1" }; - } ############################################################ - body printfile visitors_book(file) { - file_to_print => "$(file)"; - number_of_lines => "100"; + file_to_print => "$(file)"; + number_of_lines => "100"; } - - diff --git a/examples/orchestrate_n_of_m.cf b/examples/orchestrate_n_of_m.cf index 39ac0a1d41..9f5b30c2d3 100644 --- a/examples/orchestrate_n_of_m.cf +++ b/examples/orchestrate_n_of_m.cf @@ -9,54 +9,42 @@ # to add host1 host2 host3 host4 as aliases to localhost # ############################################################ - body common control { - bundlesequence => { "n_of_m_symphony" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "n_of_m_symphony" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } ############################################################ - bundle agent n_of_m_symphony { vars: - - "count_compliant_hosts" string => hubknowledge("running_myprocess"); + "count_compliant_hosts" string => hubknowledge("running_myprocess"); classes: - - "reboot" expression => isgreaterthan("$(count_compliant_hosts)","20"); + "reboot" expression => isgreaterthan("$(count_compliant_hosts)", "20"); processes: - - "myprocess" - + "myprocess" comment => "Count this host if a job is matched", classes => enumerate("running_myprocess"); commands: - reboot:: - "/bin/shutdown now"; } - ####################################################### - bundle server access_rules() { access: - - "value of my test_scalar, can expand variables here - $(sys.host)" + "value of my test_scalar, can expand variables here - $(sys.host)" handle => "test_scalar", comment => "Grant access to contents of test_scalar VAR", resource_type => "literal", admit => { "127.0.0.1" }; - "running_myprocess" + "running_myprocess" resource_type => "variable", admit => { "127.0.0.1" }; - } diff --git a/examples/orchestration_hostlist.cf b/examples/orchestration_hostlist.cf index a3381a394b..4b283e8dc3 100644 --- a/examples/orchestration_hostlist.cf +++ b/examples/orchestration_hostlist.cf @@ -1,4 +1,3 @@ -# # Make list of hosts available to all clients, and use it on clients # in order to configure a sample monitoring application that checks # health of all clients. @@ -14,16 +13,14 @@ # # Note that your copy_from statement in failsafe.cf or update.cf must # copy this file also (e.g. not only copy *.cf files in any file_select) - - - body common control { - inputs => { "$(sys.libdir)/stdlib.cf" }; - bundlesequence => { "orchestration_hostlist_update", "orchestration_hostlist_use"}; + inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { + "orchestration_hostlist_update", "orchestration_hostlist_use" + }; } - bundle agent orchestration_hostlist_update { vars: @@ -31,28 +28,30 @@ bundle agent orchestration_hostlist_update "host_list" slist => hostsseen("inf", "lastseen", "address"); files: - am_policy_hub:: "$(sys.workdir)/masterfiles/host_list" - comment => "Write the addresses of all hosts to a file", - handle => "orchestration_hostlit_update_files_host_list_write", - edit_line => insert_lines( "@(orchestration_hostlist_update.host_list)" ), - create => "true", - edit_defaults => empty; + comment => "Write the addresses of all hosts to a file", + handle => "orchestration_hostlit_update_files_host_list_write", + edit_line => insert_lines("@(orchestration_hostlist_update.host_list)"), + create => "true", + edit_defaults => empty; } - bundle agent orchestration_hostlist_use { vars: - "host_list" slist => readstringlist("$(sys.workdir)/inputs/host_list", "#.*", "\n", 1000, 40000); - "host_string" string => join(", ", "host_list"); + "host_list" + slist => readstringlist( + "$(sys.workdir)/inputs/host_list", "#.*", "\n", 1000, 40000 + ); + + "host_string" string => join(", ", "host_list"); files: - "/tmp/monitoring" - comment => "Update application configuration to reflect all hosts on this hub", - handle => "orchestration_read_files_host_list_configuration", - edit_line => expand_template("$(sys.workdir)/inputs/template_monitoring"), - create => "true", + "/tmp/monitoring" + comment => "Update application configuration to reflect all hosts on this hub", + handle => "orchestration_read_files_host_list_configuration", + edit_line => expand_template("$(sys.workdir)/inputs/template_monitoring"), + create => "true", edit_defaults => empty; } diff --git a/examples/ordering.cf b/examples/ordering.cf index 30206fab45..3ef80ece9d 100644 --- a/examples/ordering.cf +++ b/examples/ordering.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ################################################################## # # cfengine 3 - ordering promises into dependent chains @@ -29,51 +23,37 @@ # cf-agent -f ./cftest.cf -K # ################################################################## - body common control - { - bundlesequence => { "order" }; + bundlesequence => { "order" }; } ################################################################## - bundle agent order - { vars: - - "list" slist => { "three", "four" }; + "list" slist => { "three", "four" }; commands: - ok_later:: - "/bin/echo five"; otherthing:: - "/bin/echo six"; any:: - - - "/bin/echo one" classes => d("ok_later","otherthing"); + "/bin/echo one" classes => d("ok_later", "otherthing"); "/bin/echo two"; "/bin/echo $(list)"; preserved_class:: - "/bin/echo seven"; - } ############################################ - -body classes d(if,else) - +body classes d(if, else) { - promise_repaired => { "$(if)" }; - repair_failed => { "$(else)" }; - persist_time => "0"; + promise_repaired => { "$(if)" }; + repair_failed => { "$(else)" }; + persist_time => "0"; } diff --git a/examples/package_apt.cf b/examples/package_apt.cf index e377756334..3f3c409058 100644 --- a/examples/package_apt.cf +++ b/examples/package_apt.cf @@ -1,94 +1,74 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # to see list of packages type "apt-cache pkgnames" # to see list of installed packages type "dpkg --get-selections" # # Package management -# - body common control { - bundlesequence => { "packages" }; + bundlesequence => { "packages" }; } body agent control { - environment => { "DEBIAN_FRONTEND=noninteractive" }; + environment => { "DEBIAN_FRONTEND=noninteractive" }; } ############################################# - bundle agent packages { vars: - - # Test the simplest case -- leave everything to the yum smart manager - - "match_package" slist => { - "apache2" - # "apache2-mod_php5", - # "apache2-prefork", - # "php5" + # Test the simplest case -- leave everything to the yum smart manager + "match_package" + slist => { + "apache2", + # "apache2-mod_php5", + # "apache2-prefork", + # "php5" }; - packages: - - "$(match_package)" + packages: + "$(match_package)" package_policy => "add", package_method => apt; - } ############################################# - body package_method apt - { - any:: - - # ii acpi 0.09-3ubuntu1 - - package_changes => "bulk"; - package_list_command => "/usr/bin/dpkg -l"; - - package_list_name_regex => "ii\s+([^\s]+).*"; - package_list_version_regex => "ii\s+[^\s]+\s+([^\s]+).*"; - - # package_list_arch_regex => "none"; - - package_installed_regex => ".*"; # all reported are installed - - #package_name_convention => "$(name)_$(version)_$(arch)"; - package_name_convention => "$(name)"; - - # Use these only if not using a separate version/arch string - # package_version_regex => ""; - # package_name_regex => ""; - # package_arch_regex => ""; - - package_add_command => "/usr/bin/apt-get --yes install"; - package_delete_command => "/usr/bin/apt-get --yes remove"; - package_update_command => "/usr/bin/apt-get --yes dist-upgrade"; - #package_verify_command => "/bin/rpm -V"; + any:: + # ii acpi 0.09-3ubuntu1 + package_changes => "bulk"; + package_list_command => "/usr/bin/dpkg -l"; + package_list_name_regex => "ii\s+([^\s]+).*"; + package_list_version_regex => "ii\s+[^\s]+\s+([^\s]+).*"; + + # package_list_arch_regex => "none"; + package_installed_regex => ".*"; # all reported are installed + #package_name_convention => "$(name)_$(version)_$(arch)"; + package_name_convention => "$(name)"; + + # Use these only if not using a separate version/arch string + # package_version_regex => ""; + # package_name_regex => ""; + # package_arch_regex => ""; + package_add_command => "/usr/bin/apt-get --yes install"; + package_delete_command => "/usr/bin/apt-get --yes remove"; + package_update_command => "/usr/bin/apt-get --yes dist-upgrade"; + + #package_verify_command => "/bin/rpm -V"; } - diff --git a/examples/package_bundles.cf b/examples/package_bundles.cf index 18a3525247..a91eb21de4 100644 --- a/examples/package_bundles.cf +++ b/examples/package_bundles.cf @@ -1,72 +1,62 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. # - #+begin_src cfengine3 body common control { - inputs => { "$(sys.libdir)/packages.cf" }; - bundlesequence => { "runme" }; + inputs => { "$(sys.libdir)/packages.cf" }; + bundlesequence => { "runme" }; } - bundle agent runme { methods: - "nozip" usebundle => package_absent("zip"); # delete - "pleasezip" usebundle => package_present("zip"); # add - "latestzip" usebundle => package_latest("zip"); # add/update - - # add a package from a file with a specific selection method, - # version, and architecture - "addfilezip" - usebundle => package_specific_present("/mydir/zip.deb-or-rpm", - "3.0-7", - ifelse("debian", "amd64", - "x86_64")); - - # add a package with a specific selection method, version, and - # architecture - "addzip" - usebundle => package_specific_present("zip", - ifelse("redhat", "3.0-7", - "2.99"), - ifelse("debian", "amd64", - "x86_64")); - - # add or update a package from a file with a specific selection - # method, version, and architecture - "upgradefilezip" - usebundle => package_specific_latest("/mydir/zip.deb-or-rpm", - "3.0-7", - ifelse("debian", "amd64", - "x86_64")); - - # add or update a package with a specific selection method, - # version, and architecture - "upgradezip" - usebundle => package_specific_latest("zip", - "3.0-7", - ifelse("debian", "amd64", - "x86_64")); + "nozip" usebundle => package_absent("zip"); # delete + "pleasezip" usebundle => package_present("zip"); # add + "latestzip" usebundle => package_latest("zip"); # add/update + # add a package from a file with a specific selection method, + # version, and architecture + "addfilezip" + usebundle => package_specific_present( + "/mydir/zip.deb-or-rpm", "3.0-7", ifelse("debian", "amd64", "x86_64") + ); + + # add a package with a specific selection method, version, and + # architecture + "addzip" + usebundle => package_specific_present( + "zip", + ifelse("redhat", "3.0-7", "2.99"), + ifelse("debian", "amd64", "x86_64") + ); + + # add or update a package from a file with a specific selection + # method, version, and architecture + "upgradefilezip" + usebundle => package_specific_latest( + "/mydir/zip.deb-or-rpm", "3.0-7", ifelse("debian", "amd64", "x86_64") + ); + + # add or update a package with a specific selection method, + # version, and architecture + "upgradezip" + usebundle => package_specific_latest( + "zip", "3.0-7", ifelse("debian", "amd64", "x86_64") + ); } + #+end_src diff --git a/examples/package_freebsd.cf b/examples/package_freebsd.cf index ad006bd781..901781f08d 100644 --- a/examples/package_freebsd.cf +++ b/examples/package_freebsd.cf @@ -1,86 +1,63 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - # # Package management -# - body common control { - bundlesequence => { "packages" }; + bundlesequence => { "packages" }; } ############################################# - body agent control { - environment => { "PACKAGESITE=ftp://freebsd-src.es.net/pub/FreeBSD/ports/i386/packages-7.2-release/All/" }; + environment => { + "PACKAGESITE=ftp://freebsd-src.es.net/pub/FreeBSD/ports/i386/packages-7.2-release/All/", + }; } ############################################# - bundle agent packages { vars: + # Test the simplest case -- leave everything to the yum smart manager + "match_package" slist => { "wget-1.11.4" }; - # Test the simplest case -- leave everything to the yum smart manager - - "match_package" slist => { - "wget-1.11.4" - }; packages: - - "$(match_package)" - + "$(match_package)" package_policy => "add", package_method => freebsd; - } -############################################# +############################################# body package_method freebsd - { - any:: - - package_changes => "individual"; - - # Could use rpm for this - package_list_command => "/usr/sbin/pkg_info"; - - # Remember to escape special characters like | - - package_list_name_regex => "([^-]+).*"; - package_list_version_regex => "[^-]+-([^\s]+).*"; - - package_name_regex => "([^-]+).*"; - package_version_regex => "[^-]+-([^\s]+).*"; - - package_installed_regex => ".*"; - - package_name_convention => "$(name)-$(version)"; - - - package_add_command => "/usr/sbin/pkg_add -r"; - package_delete_command => "/usr/sbin/pkg_delete"; + any:: + package_changes => "individual"; + + # Could use rpm for this + package_list_command => "/usr/sbin/pkg_info"; + + # Remember to escape special characters like | + package_list_name_regex => "([^-]+).*"; + package_list_version_regex => "[^-]+-([^\s]+).*"; + package_name_regex => "([^-]+).*"; + package_version_regex => "[^-]+-([^\s]+).*"; + package_installed_regex => ".*"; + package_name_convention => "$(name)-$(version)"; + package_add_command => "/usr/sbin/pkg_add -r"; + package_delete_command => "/usr/sbin/pkg_delete"; } diff --git a/examples/package_latest.cf b/examples/package_latest.cf index 42c5ba9cba..0cb158b339 100644 --- a/examples/package_latest.cf +++ b/examples/package_latest.cf @@ -1,24 +1,18 @@ -# # Makes sure a package is installed at latest version. # Does not take any action if the package has already # reached the version given in package_version. -# - body common control { - inputs => { "$(sys.libdir)/stdlib.cf" }; - bundlesequence => { "example" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "example" }; } - bundle agent example { packages: - - "apache2" + "apache2" package_method => generic, package_version => "2.2.00", package_select => ">=", package_policy => "addupdate"; } - diff --git a/examples/package_msi_file.cf b/examples/package_msi_file.cf index 47d238378d..1cb3172e3c 100644 --- a/examples/package_msi_file.cf +++ b/examples/package_msi_file.cf @@ -1,67 +1,50 @@ # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # MSI package management using file name -# - -body common control -{ - bundlesequence => { "packages" }; -} - +body common control +{ + bundlesequence => { "packages" }; +} + ############################################# - -bundle agent packages -{ - vars: - - "match_package" slist => { - "7zip-4.65-x86_64.msi" - }; - packages: - - "$(match_package)" - - package_policy => "add", - package_method => msi_fmatch; - -} - +bundle agent packages +{ + vars: + "match_package" slist => { "7zip-4.65-x86_64.msi" }; + + packages: + "$(match_package)" + package_policy => "add", + package_method => msi_fmatch; +} + ############################################# - -body package_method msi_fmatch - -{ - package_changes => "individual"; - package_file_repositories => { "$(sys.workdir)\software_updates\windows", "s:\su" }; - - package_installed_regex => ".*"; - - package_name_regex => "^(\S+)-(\d+\.?)+"; - package_version_regex => "^\S+-((\d+\.?)+)"; - package_arch_regex => "^\S+-(\d+\.?)+(^.+)"; - - package_name_convention => "$(name)-$(version)-$(arch).msi"; - - package_add_command => "\"$(sys.winsysdir)\msiexec.exe\" /qn /i"; - package_update_command => "\"$(sys.winsysdir)\msiexec.exe\" /qn /i"; - package_delete_command => "\"$(sys.winsysdir)\msiexec.exe\" /qn /x"; -} +body package_method msi_fmatch +{ + package_changes => "individual"; + package_file_repositories => { + "$(sys.workdir)\software_updates\windows", "s:\su" + }; + package_installed_regex => ".*"; + package_name_regex => "^(\S+)-(\d+\.?)+"; + package_version_regex => "^\S+-((\d+\.?)+)"; + package_arch_regex => "^\S+-(\d+\.?)+(^.+)"; + package_name_convention => "$(name)-$(version)-$(arch).msi"; + package_add_command => "\"$(sys.winsysdir)\msiexec.exe\" /qn /i"; + package_update_command => "\"$(sys.winsysdir)\msiexec.exe\" /qn /i"; + package_delete_command => "\"$(sys.winsysdir)\msiexec.exe\" /qn /x"; +} diff --git a/examples/package_msi_version.cf b/examples/package_msi_version.cf index 38c4d74f95..10bf80e64f 100644 --- a/examples/package_msi_version.cf +++ b/examples/package_msi_version.cf @@ -1,67 +1,50 @@ # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # MSI package management using version criteria -# - body common control { - bundlesequence => { "packages" }; + bundlesequence => { "packages" }; } ############################################# - bundle agent packages { vars: + "match_package" slist => { "7zip" }; - "match_package" slist => { - "7zip" - }; packages: - - "$(match_package)" - + "$(match_package)" package_policy => "update", package_select => ">=", package_architectures => { "x86_64" }, package_version => "3.00", package_method => msi_vmatch; - } ############################################# - body package_method msi_vmatch - { - package_changes => "individual"; - package_file_repositories => { "$(sys.workdir)\software_updates\windows", "s:\su" }; - - package_installed_regex => ".*"; - - package_name_convention => "$(name)-$(version)-$(arch).msi"; - - package_add_command => "\"$(sys.winsysdir)\msiexec.exe\" /qn /i"; - package_update_command => "\"$(sys.winsysdir)\msiexec.exe\" /qn /i"; - package_delete_command => "\"$(sys.winsysdir)\msiexec.exe\" /qn /x"; + package_changes => "individual"; + package_file_repositories => { + "$(sys.workdir)\software_updates\windows", "s:\su" + }; + package_installed_regex => ".*"; + package_name_convention => "$(name)-$(version)-$(arch).msi"; + package_add_command => "\"$(sys.winsysdir)\msiexec.exe\" /qn /i"; + package_update_command => "\"$(sys.winsysdir)\msiexec.exe\" /qn /i"; + package_delete_command => "\"$(sys.winsysdir)\msiexec.exe\" /qn /x"; } - diff --git a/examples/package_rpm.cf b/examples/package_rpm.cf index 5c4d7daa94..9cda292286 100644 --- a/examples/package_rpm.cf +++ b/examples/package_rpm.cf @@ -1,85 +1,60 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # Package management -# - body common control { - bundlesequence => { "packages" }; + bundlesequence => { "packages" }; } ############################################# - bundle agent packages { vars: - - "exact_package" slist => { - "apache2", - "kernel-default" - }; - - "version[OpenOffice_org-hyphen]" string => "1.2.3"; - "version[kernel-default]" string => "2.6.27.7-9.1"; + "exact_package" slist => { "apache2", "kernel-default" }; + "version[OpenOffice_org-hyphen]" string => "1.2.3"; + "version[kernel-default]" string => "2.6.27.7-9.1"; packages: - - "$(exact_package)" - + "$(exact_package)" package_policy => "verify", package_method => rpm, package_select => ">=", package_architectures => { "x86_64" }, package_version => "$(version[$(exact_package)])"; - } ############################################# - body package_method rpm - { - any:: - - package_changes => "individual"; - - package_list_command => "/bin/rpm -qa --queryformat \"i | repos | %{name} | %{version}-%{release} | %{arch}\n\""; - - # Remember to escape special characters like | - - package_list_name_regex => "[^|]+\|[^|]+\|\s+([^\s|]+).*"; - package_list_version_regex => "[^|]+\|[^|]+\|[^|]+\|\s+([^\s|]+).*"; - package_list_arch_regex => "[^|]+\|[^|]+\|[^|]+\|[^|]+\|\s+([^\s]+).*"; - - package_installed_regex => "i.*"; - - package_name_convention => "$(name).$(arch)"; - - package_add_command => "/bin echo /bin/rpm -i "; - package_delete_command => "/bin/rpm -e --nodeps"; - package_verify_command => "/bin/rpm -V"; - package_noverify_regex => ".*[^\s].*"; - #package_noverify_returncode => "-1"; - + any:: + package_changes => "individual"; + package_list_command => "/bin/rpm -qa --queryformat \"i | repos | %{name} | %{version}-%{release} | %{arch}\n\""; + + # Remember to escape special characters like | + package_list_name_regex => "[^|]+\|[^|]+\|\s+([^\s|]+).*"; + package_list_version_regex => "[^|]+\|[^|]+\|[^|]+\|\s+([^\s|]+).*"; + package_list_arch_regex => "[^|]+\|[^|]+\|[^|]+\|[^|]+\|\s+([^\s]+).*"; + package_installed_regex => "i.*"; + package_name_convention => "$(name).$(arch)"; + package_add_command => "/bin echo /bin/rpm -i "; + package_delete_command => "/bin/rpm -e --nodeps"; + package_verify_command => "/bin/rpm -V"; + package_noverify_regex => ".*[^\s].*"; + + #package_noverify_returncode => "-1"; } diff --git a/examples/package_solaris.cf b/examples/package_solaris.cf index 82aad7f52c..8be79d931c 100644 --- a/examples/package_solaris.cf +++ b/examples/package_solaris.cf @@ -1,60 +1,47 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - # # Package management -# - body common control { - bundlesequence => { "packages" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "packages" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } ############################################# - bundle agent packages { vars: - - "solaris_packages[SMCzlib]" string => "zlib-1.2.3-sol10-sparc-local"; - "admin_file" string => "cfengine_admin_file"; - - "package_names" slist => getindices("solaris_packages"); + "solaris_packages[SMCzlib]" string => "zlib-1.2.3-sol10-sparc-local"; + "admin_file" string => "cfengine_admin_file"; + "package_names" slist => getindices("solaris_packages"); files: - - "/tmp/$(admin_file)" + "/tmp/$(admin_file)" create => "true", edit_defaults => empty, edit_line => create_solaris_admin_file; packages: - - "$(package_names)" - + "$(package_names)" package_policy => "add", - package_method => solaris("$(package_names)", "$(solaris_packages[$(package_names)])", "$(admin_file)"); - + package_method => solaris( + "$(package_names)", + "$(solaris_packages[$(package_names)])", + "$(admin_file)" + ); } - diff --git a/examples/package_windows_feature.cf b/examples/package_windows_feature.cf index 20997f4bfa..7a717ba315 100644 --- a/examples/package_windows_feature.cf +++ b/examples/package_windows_feature.cf @@ -1,34 +1,28 @@ body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { packages: - Windows_Server_2008_R2:: "Telnet-Client" - comment => "Install the telnet client", - package_policy => "add", - package_method => windows_feature; - + comment => "Install the telnet client", + package_policy => "add", + package_method => windows_feature; } - body package_method windows_feature # NOTE: Windows feature names are case-sensitive { - package_changes => "individual"; - - package_name_convention => "$(name)"; - package_delete_convention => "$(name)"; - - package_installed_regex => ".*"; - package_list_name_regex => "(.*)"; - package_list_version_regex => "(.*)"; # FIXME: the listing does not give version, so takes name for version too now - - package_add_command => "$(sys.winsysdir)\\WindowsPowerShell\\v1.0\\powershell.exe -Command \"Import-Module ServerManager; Add-WindowsFeature -Name\""; - package_delete_command => "$(sys.winsysdir)\\WindowsPowerShell\\v1.0\\powershell.exe -Command \"Import-Module ServerManager; Remove-WindowsFeature -confirm:$false -Name\""; - package_list_command => "$(sys.winsysdir)\\WindowsPowerShell\\v1.0\\powershell.exe -Command \"Import-Module ServerManager; Get-WindowsFeature | where {$_.installed -eq $True} |foreach {$_.Name}\""; + package_changes => "individual"; + package_name_convention => "$(name)"; + package_delete_convention => "$(name)"; + package_installed_regex => ".*"; + package_list_name_regex => "(.*)"; + package_list_version_regex => "(.*)"; # FIXME: the listing does not give version, so takes name for version too now + package_add_command => "$(sys.winsysdir)\\WindowsPowerShell\\v1.0\\powershell.exe -Command \"Import-Module ServerManager; Add-WindowsFeature -Name\""; + package_delete_command => "$(sys.winsysdir)\\WindowsPowerShell\\v1.0\\powershell.exe -Command \"Import-Module ServerManager; Remove-WindowsFeature -confirm:$false -Name\""; + package_list_command => "$(sys.winsysdir)\\WindowsPowerShell\\v1.0\\powershell.exe -Command \"Import-Module ServerManager; Get-WindowsFeature | where {$_.installed -eq $True} |foreach {$_.Name}\""; } diff --git a/examples/package_yum.cf b/examples/package_yum.cf index 56f61b8185..490973945b 100644 --- a/examples/package_yum.cf +++ b/examples/package_yum.cf @@ -1,56 +1,37 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - # # Package management -# - body common control { - bundlesequence => { "packages" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "packages" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } ############################################# - bundle agent packages { vars: + # Test the simplest case -- leave everything to the yum smart manager + "match_package" + slist => { "apache2", "apache2-mod_php5", "apache2-prefork", "php5" }; - # Test the simplest case -- leave everything to the yum smart manager - - "match_package" slist => { - "apache2", - "apache2-mod_php5", - "apache2-prefork", - "php5" - }; packages: - - "$(match_package)" - + "$(match_package)" package_policy => "add", package_method => yum; - } - diff --git a/examples/package_zypper.cf b/examples/package_zypper.cf index 9c74441331..5b7b453596 100644 --- a/examples/package_zypper.cf +++ b/examples/package_zypper.cf @@ -1,56 +1,37 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - # # Package management -# - body common control { - bundlesequence => { "packages" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "packages" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } ############################################# - bundle agent packages { vars: + # Test the simplest case -- leave everything to the zypper smart manager + "match_package" + slist => { "apache2", "apache2-mod_php5", "apache2-prefork", "php5" }; - # Test the simplest case -- leave everything to the zypper smart manager - - "match_package" slist => { - "apache2", - "apache2-mod_php5", - "apache2-prefork", - "php5" - }; packages: - - "$(match_package)" - + "$(match_package)" package_policy => "add", package_method => zypper; - } - diff --git a/examples/packagesmatching.cf b/examples/packagesmatching.cf index b07eb7403b..1f68a42f2c 100644 --- a/examples/packagesmatching.cf +++ b/examples/packagesmatching.cf @@ -1,35 +1,27 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #[%-%] body common control - { - bundlesequence => { "missing_packages" }; + bundlesequence => { "missing_packages" }; } -#[%-%] +#[%-%] ########################################### - #[%+%] bundle agent missing_packages { @@ -38,9 +30,9 @@ bundle agent missing_packages "desired" slist => { "mypackage1", "mypackage2" }; # Get info on all installed packages - "installed" data => packagesmatching(".*",".*",".*",".*"); + "installed" data => packagesmatching(".*", ".*", ".*", ".*"); "installed_indices" slist => getindices(installed); - + # Build a simple array of the package names so that we can use # getvalues to pull a unified list of package names that are installed. "installed_name[$(installed_indices)]" @@ -51,7 +43,7 @@ bundle agent missing_packages # Determine packages that are missing my differencing the list of # desired packages, against the list of installed packages - "missing_list" slist => difference(desired,installed_names); + "missing_list" slist => difference(desired, installed_names); reports: # Report on packages that are missing, installed @@ -60,4 +52,5 @@ bundle agent missing_packages "Installed packages = $(installed_names)"; "Desired packages = $(desired)"; } + #[%+%] diff --git a/examples/parallel_exec.cf b/examples/parallel_exec.cf index 4bf6102ef4..5d0aedc6a1 100644 --- a/examples/parallel_exec.cf +++ b/examples/parallel_exec.cf @@ -1,65 +1,48 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple backgrounding - try this with background = true and false # ######################################################## - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - body agent control - { - agentaccess => { "mark", "root" }; + agentaccess => { "mark", "root" }; } ######################################################## - bundle agent example - { commands: + "/bin/sleep 10" action => background; - "/bin/sleep 10" - action => background; - - "/bin/sleep" + "/bin/sleep" args => "20", - action => background; - + action => background; } ######################################################### - body action background - { - background => "true"; + background => "true"; } diff --git a/examples/parseintarray.cf b/examples/parseintarray.cf index e3737426e9..36b00c81d7 100644 --- a/examples/parseintarray.cf +++ b/examples/parseintarray.cf @@ -1,54 +1,44 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test(f) { vars: - # Define data inline for convenience - "table" string => - "1:2 + # Define data inline for convenience + "table" string => "1:2 3:4 5:6"; - "dim" int => parseintarray( - "items", - "$(table)", - "\s*#[^\n]*", - ":", - "1000", - "200000" + "dim" + int => parseintarray( + "items", "$(table)", "\s*#[^\n]*", ":", "1000", "200000" ); - "keys" slist => sort(getindices("items")); + "keys" slist => sort(getindices("items")); reports: - "$(keys)"; + "$(keys)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/parserealarray.cf b/examples/parserealarray.cf index a6096393df..c04690bbbf 100644 --- a/examples/parserealarray.cf +++ b/examples/parserealarray.cf @@ -1,51 +1,39 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 bundle agent __main__ { vars: - # Define data inline for convenience - "table" - string => "1.0:2.718 + # Define data inline for convenience + "table" string => "1.0:2.718 3:4.6692 5.0:6.82"; - - "dim" - int => parserealarray( - "items", - "$(table)", - "\s*#[^\n]*", - ":", - "1000", - "200000" + "dim" + int => parserealarray( + "items", "$(table)", "\s*#[^\n]*", ":", "1000", "200000" ); - "keys" slist => sort(getindices("items")); + "keys" slist => sort(getindices("items")); reports: - "$(keys) - $(items[$(keys)][1])"; + "$(keys) - $(items[$(keys)][1])"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/parsestringarray.cf b/examples/parsestringarray.cf index c5abf3fe56..bafd01e510 100644 --- a/examples/parsestringarray.cf +++ b/examples/parsestringarray.cf @@ -2,32 +2,26 @@ bundle agent __main__ { vars: - - ####################################### - # Define data inline for convenience - ####################################### - - "table" - string => "Eulers Number:2.718 + ####################################### + # Define data inline for convenience + ####################################### + "table" + string => "Eulers Number:2.718 A Feigenbaum constant:4.6692 Tau (2pi):6.28"; - ####################################### - - "dim" int => parsestringarray( - "items", - "$(table)", - "\s*#[^\n]*", - ":", - "1000", - "200000" + ####################################### + "dim" + int => parsestringarray( + "items", "$(table)", "\s*#[^\n]*", ":", "1000", "200000" ); - "keys" slist => sort(getindices("items")); + "keys" slist => sort(getindices("items")); reports: - "$(keys) - $(items[$(keys)][1])"; + "$(keys) - $(items[$(keys)][1])"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/parsestringarrayidx.cf b/examples/parsestringarrayidx.cf index 019afab4ce..5c2f966edb 100644 --- a/examples/parsestringarrayidx.cf +++ b/examples/parsestringarrayidx.cf @@ -1,56 +1,47 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test(f) { vars: - # Define data inline for convenience - "table" string => "one: a + # Define data inline for convenience + "table" + string => "one: a two: b three: c"; - ####################################### - - "dim" int => parsestringarrayidx( - "items", - "$(table)", - "\s*#[^\n]*", - ":", - "1000", - "200000" + ####################################### + "dim" + int => parsestringarrayidx( + "items", "$(table)", "\s*#[^\n]*", ":", "1000", "200000" ); - "keys" slist => getindices("items"); - "sorted_keys" slist => sort(keys, "int"); + "keys" slist => getindices("items"); + "sorted_keys" slist => sort(keys, "int"); reports: - "item $(sorted_keys) has column 0 = $(items[$(sorted_keys)][0]) and column 1 = $(items[$(sorted_keys)][1])"; + "item $(sorted_keys) has column 0 = $(items[$(sorted_keys)][0]) and column 1 = $(items[$(sorted_keys)][1])"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/pathtype.cf b/examples/pathtype.cf index b3c2fcf7df..a3e94bd2cf 100644 --- a/examples/pathtype.cf +++ b/examples/pathtype.cf @@ -1,76 +1,55 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - ######################################################## # # Simple backgrounding # ######################################################## - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { files: - - "/home/mark/tmp" -> "me" - - changes => tripwire, - pathtype => "literal", + "/home/mark/tmp" -> "me" + changes => tripwire, + pathtype => "literal", depth_search => recurse("inf"); - } - ######################################################### - body changes tripwire - { - hash => "md5"; - report_changes => "all"; - update_hashes => "true"; + hash => "md5"; + report_changes => "all"; + update_hashes => "true"; } ######################################################### - body action background - { - background => "true"; + background => "true"; } ######################################################### - body depth_search recurse(d) - { - depth => "$(d)"; + depth => "$(d)"; } diff --git a/examples/pattern_and_edit.cf b/examples/pattern_and_edit.cf index 457a60a258..37cb27b795 100644 --- a/examples/pattern_and_edit.cf +++ b/examples/pattern_and_edit.cf @@ -1,60 +1,42 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control - { - bundlesequence => {"test"}; + bundlesequence => { "test" }; } ######################################################## - bundle agent example - { - files: - - "/home/(.*)/testfile" - - create => "true", + "/home/(.*)/testfile" + create => "true", edit_line => AppendIfNoLine("key_$(match.1)"); - } ######################################################## - bundle edit_line AppendIfNoLine(x) { insert_lines: - - "Line $(x)" location => append; + "Line $(x)" location => append; } ######################################################## - body location append - { - before_after => "before"; + before_after => "before"; } diff --git a/examples/peerleader.cf b/examples/peerleader.cf index e2f5a4e184..fc5a9a0419 100644 --- a/examples/peerleader.cf +++ b/examples/peerleader.cf @@ -1,20 +1,15 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See @@ -40,31 +35,30 @@ #+begin_src cfengine3 body common control { - bundlesequence => { "peers" }; + bundlesequence => { "peers" }; } bundle agent peers { vars: - - "mygroup" slist => peers("/tmp/cfe_hostlist","#.*",4); - - "myleader" string => peerleader("/tmp/cfe_hostlist","#.*",4); - - "all_leaders" slist => peerleaders("/tmp/cfe_hostlist","#.*",4); + "mygroup" slist => peers("/tmp/cfe_hostlist", "#.*", 4); + "myleader" string => peerleader("/tmp/cfe_hostlist", "#.*", 4); + "all_leaders" slist => peerleaders("/tmp/cfe_hostlist", "#.*", 4); reports: + # note that the current host name is fourth in the host list, so + # its peer group is the first 4-host group, minus the host itself. + "/tmp/cfe_hostlist mypeer $(mygroup)"; - # note that the current host name is fourth in the host list, so - # its peer group is the first 4-host group, minus the host itself. - "/tmp/cfe_hostlist mypeer $(mygroup)"; - # note that the current host name is fourth in the host list, so - # the peer leader is "alpha" - "/tmp/cfe_hostlist myleader $(myleader)"; - "/tmp/cfe_hostlist another leader $(all_leaders)"; - "Unable to find my fully qualified hostname $(sys.fqhost) in /tmp/cfe_hostlist. Can't determine peers." - if => not( regline( $(sys.fqhost), "/tmp/cfe_hostlist" ) ); + # note that the current host name is fourth in the host list, so + # the peer leader is "alpha" + "/tmp/cfe_hostlist myleader $(myleader)"; + "/tmp/cfe_hostlist another leader $(all_leaders)"; + + "Unable to find my fully qualified hostname $(sys.fqhost) in /tmp/cfe_hostlist. Can't determine peers." + if => not(regline($(sys.fqhost), "/tmp/cfe_hostlist")); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/peerleaders.cf b/examples/peerleaders.cf index e2f5a4e184..fc5a9a0419 100644 --- a/examples/peerleaders.cf +++ b/examples/peerleaders.cf @@ -1,20 +1,15 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See @@ -40,31 +35,30 @@ #+begin_src cfengine3 body common control { - bundlesequence => { "peers" }; + bundlesequence => { "peers" }; } bundle agent peers { vars: - - "mygroup" slist => peers("/tmp/cfe_hostlist","#.*",4); - - "myleader" string => peerleader("/tmp/cfe_hostlist","#.*",4); - - "all_leaders" slist => peerleaders("/tmp/cfe_hostlist","#.*",4); + "mygroup" slist => peers("/tmp/cfe_hostlist", "#.*", 4); + "myleader" string => peerleader("/tmp/cfe_hostlist", "#.*", 4); + "all_leaders" slist => peerleaders("/tmp/cfe_hostlist", "#.*", 4); reports: + # note that the current host name is fourth in the host list, so + # its peer group is the first 4-host group, minus the host itself. + "/tmp/cfe_hostlist mypeer $(mygroup)"; - # note that the current host name is fourth in the host list, so - # its peer group is the first 4-host group, minus the host itself. - "/tmp/cfe_hostlist mypeer $(mygroup)"; - # note that the current host name is fourth in the host list, so - # the peer leader is "alpha" - "/tmp/cfe_hostlist myleader $(myleader)"; - "/tmp/cfe_hostlist another leader $(all_leaders)"; - "Unable to find my fully qualified hostname $(sys.fqhost) in /tmp/cfe_hostlist. Can't determine peers." - if => not( regline( $(sys.fqhost), "/tmp/cfe_hostlist" ) ); + # note that the current host name is fourth in the host list, so + # the peer leader is "alpha" + "/tmp/cfe_hostlist myleader $(myleader)"; + "/tmp/cfe_hostlist another leader $(all_leaders)"; + + "Unable to find my fully qualified hostname $(sys.fqhost) in /tmp/cfe_hostlist. Can't determine peers." + if => not(regline($(sys.fqhost), "/tmp/cfe_hostlist")); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/peers.cf b/examples/peers.cf index e2f5a4e184..fc5a9a0419 100644 --- a/examples/peers.cf +++ b/examples/peers.cf @@ -1,20 +1,15 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See @@ -40,31 +35,30 @@ #+begin_src cfengine3 body common control { - bundlesequence => { "peers" }; + bundlesequence => { "peers" }; } bundle agent peers { vars: - - "mygroup" slist => peers("/tmp/cfe_hostlist","#.*",4); - - "myleader" string => peerleader("/tmp/cfe_hostlist","#.*",4); - - "all_leaders" slist => peerleaders("/tmp/cfe_hostlist","#.*",4); + "mygroup" slist => peers("/tmp/cfe_hostlist", "#.*", 4); + "myleader" string => peerleader("/tmp/cfe_hostlist", "#.*", 4); + "all_leaders" slist => peerleaders("/tmp/cfe_hostlist", "#.*", 4); reports: + # note that the current host name is fourth in the host list, so + # its peer group is the first 4-host group, minus the host itself. + "/tmp/cfe_hostlist mypeer $(mygroup)"; - # note that the current host name is fourth in the host list, so - # its peer group is the first 4-host group, minus the host itself. - "/tmp/cfe_hostlist mypeer $(mygroup)"; - # note that the current host name is fourth in the host list, so - # the peer leader is "alpha" - "/tmp/cfe_hostlist myleader $(myleader)"; - "/tmp/cfe_hostlist another leader $(all_leaders)"; - "Unable to find my fully qualified hostname $(sys.fqhost) in /tmp/cfe_hostlist. Can't determine peers." - if => not( regline( $(sys.fqhost), "/tmp/cfe_hostlist" ) ); + # note that the current host name is fourth in the host list, so + # the peer leader is "alpha" + "/tmp/cfe_hostlist myleader $(myleader)"; + "/tmp/cfe_hostlist another leader $(all_leaders)"; + + "Unable to find my fully qualified hostname $(sys.fqhost) in /tmp/cfe_hostlist. Can't determine peers." + if => not(regline($(sys.fqhost), "/tmp/cfe_hostlist")); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/postfix.cf b/examples/postfix.cf index da5406e397..21b010d3fe 100644 --- a/examples/postfix.cf +++ b/examples/postfix.cf @@ -1,124 +1,93 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ####################################################### # # Postfix # ####################################################### - body common control - { - any:: - - bundlesequence => { - postfix - }; + any:: + bundlesequence => { postfix }; } ####################################################### - bundle agent postfix - { vars: - - "prefix" string => "/home/mark/tmp"; - "smtpserver" string => "mailx.domain.tld"; - "mailrelay" string => "mailx.domain.tld"; + "prefix" string => "/home/mark/tmp"; + "smtpserver" string => "mailx.domain.tld"; + "mailrelay" string => "mailx.domain.tld"; files: - - "$(prefix)/main.cf" - edit_line => prefix_postfix; - - "$(prefix)/sasl-passwd" - create => "true", - perms => system("0600","root"), - edit_line => AppendIfNSL("$(smtpserver) _$(fqhost):chmsxrcynz4etzefabj9frejizhs22"); - - + "$(prefix)/main.cf" edit_line => prefix_postfix; + + "$(prefix)/sasl-passwd" + create => "true", + perms => system("0600", "root"), + edit_line => AppendIfNSL( + "$(smtpserver) _$(fqhost):chmsxrcynz4etzefabj9frejizhs22" + ); } ####################################################### # For the library ####################################################### - bundle edit_line prefix_postfix - { - # - # Value have the form NAME = "quoted space separated list" - # + # Value have the form NAME = "quoted space separated list" vars: - - "ps[relayhost]" string => "[$(postfix.mailrelay)]:587"; - "ps[mydomain]" string => "iu.hio.no"; - "ps[smtp_sasl_auth_enable]" string => "yes"; - "ps[smtp_sasl_password_maps]" string => "hash:/etc/postfix/sasl-passwd"; - "ps[smtp_sasl_security_options]" string => ""; - "ps[smtp_use_tls]" string => "yes"; - "ps[default_privs]" string => "mailman"; - "ps[inet_protocols]" string => "all"; - "ps[inet_interfaces]" string => "127.0.0.1"; - - "parameter_name" slist => getindices("ps"); - - delete_lines: - - "$(parameter_name).*"; + "ps[relayhost]" string => "[$(postfix.mailrelay)]:587"; + "ps[mydomain]" string => "iu.hio.no"; + "ps[smtp_sasl_auth_enable]" string => "yes"; + "ps[smtp_sasl_password_maps]" string => "hash:/etc/postfix/sasl-passwd"; + "ps[smtp_sasl_security_options]" string => ""; + "ps[smtp_use_tls]" string => "yes"; + "ps[default_privs]" string => "mailman"; + "ps[inet_protocols]" string => "all"; + "ps[inet_interfaces]" string => "127.0.0.1"; + "parameter_name" slist => getindices("ps"); + + delete_lines: + "$(parameter_name).*"; insert_lines: - - "$(parameter_name) = $(ps[$(parameter_name)])"; - + "$(parameter_name) = $(ps[$(parameter_name)])"; } ######################################################## - bundle edit_line AppendIfNSL(parameter) { insert_lines: - - "$(parameter)"; # This is default + "$(parameter)"; # This is default } ######################################## # Library Bodies ######################################## - body replace_with All(x) - { - replace_value => "$(x)"; - occurrences => "all"; + replace_value => "$(x)"; + occurrences => "all"; } ######################################################### - -body perms system(x,owner) - +body perms system(x, owner) { - mode => "0640"; - owners => { "$(owner)", "root" }; + mode => "0640"; + owners => { "$(owner)", "root" }; } diff --git a/examples/printfile.cf b/examples/printfile.cf index bdc7b2846c..fc4e88b78d 100644 --- a/examples/printfile.cf +++ b/examples/printfile.cf @@ -15,18 +15,17 @@ #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - "example_file" string => "/tmp/example_file.txt"; + "example_file" string => "/tmp/example_file.txt"; + reports: - "First three:" - printfile => first_three("$(example_file)"); - "Last three:" - printfile => last_three("$(example_file)"); + "First three:" printfile => first_three("$(example_file)"); + "Last three:" printfile => last_three("$(example_file)"); } body printfile first_three(file) @@ -40,6 +39,7 @@ body printfile last_three(file) file_to_print => "$(file)"; number_of_lines => "-3"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/process_kill.cf b/examples/process_kill.cf index dc47e9cc4c..ba8b3088d1 100644 --- a/examples/process_kill.cf +++ b/examples/process_kill.cf @@ -1,38 +1,26 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - body common control { - bundlesequence => { "kill_process" }; + bundlesequence => { "kill_process" }; } - - bundle agent kill_process { processes: - - "sleep" - - signals => { "term", "kill" }; - + "sleep" signals => { "term", "kill" }; } diff --git a/examples/process_matching.cf b/examples/process_matching.cf index de43e0fa32..03b9ff7a9d 100644 --- a/examples/process_matching.cf +++ b/examples/process_matching.cf @@ -1,69 +1,51 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test processes # ######################################################## - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { processes: - - ".*" - - process_select => proc_finder("a.*"), - process_count => up("cfservd"); + ".*" + process_select => proc_finder("a.*"), + process_count => up("cfservd"); } ######################################################## - body process_count up(s) - { - match_range => "1,10"; # or irange("1","10"); - out_of_range_define => { "$(s)_out_of_control" }; + match_range => "1,10"; # or irange("1","10"); + out_of_range_define => { "$(s)_out_of_control" }; } ######################################################## - body process_select proc_finder(p) - { - process_owner => { "avahi", "bin" }; - command => "$(p)"; - pid => "100,199"; - vsize => "0,1000"; - process_result => "command.(process_owner|vsize)"; + process_owner => { "avahi", "bin" }; + command => "$(p)"; + pid => "100,199"; + vsize => "0,1000"; + process_result => "command.(process_owner|vsize)"; } - - diff --git a/examples/process_matching2.cf b/examples/process_matching2.cf index 854b28e9d6..39878a0d30 100644 --- a/examples/process_matching2.cf +++ b/examples/process_matching2.cf @@ -1,61 +1,43 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test processes # ######################################################## - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { processes: - - "sleep" - - process_count => up("sleep"); + "sleep" process_count => up("sleep"); reports: - sleep_out_of_control:: - "Out of control"; } ######################################################## - body process_count up(s) - { - match_range => "5,10"; # or irange("1","10"); - out_of_range_define => { "$(s)_out_of_control" }; + match_range => "5,10"; # or irange("1","10"); + out_of_range_define => { "$(s)_out_of_control" }; } - diff --git a/examples/process_matching3.cf b/examples/process_matching3.cf index da4d2b686b..1a8327cd51 100644 --- a/examples/process_matching3.cf +++ b/examples/process_matching3.cf @@ -1,66 +1,48 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test processes # ######################################################## - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { processes: - - ".*" - - process_select => proc_finder("a.*"), - process_count => up("cfservd"); + ".*" + process_select => proc_finder("a.*"), + process_count => up("cfservd"); } ######################################################## - body process_count up(s) - { - match_range => "1,10"; # or irange("1","10"); - out_of_range_define => { "$(s)_out_of_control" }; + match_range => "1,10"; # or irange("1","10"); + out_of_range_define => { "$(s)_out_of_control" }; } ######################################################## - body process_select proc_finder(p) - { - stime_range => irange(ago("0","0","0","2","0","0"),now); - process_result => "stime"; + stime_range => irange(ago("0", "0", "0", "2", "0", "0"), now); + process_result => "stime"; } - - diff --git a/examples/process_restart.cf b/examples/process_restart.cf index 15f9248995..2199c06d8d 100644 --- a/examples/process_restart.cf +++ b/examples/process_restart.cf @@ -1,49 +1,33 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - body common control { - bundlesequence => { "process_restart" }; + bundlesequence => { "process_restart" }; } ######################################################### - bundle agent process_restart { vars: + "component" slist => { "cf-monitord", "cf-serverd", "cf-execd" }; - "component" slist => { - "cf-monitord", - "cf-serverd", - "cf-execd" - }; processes: - - "$(component)" - restart_class => canonify("start_$(component)"); + "$(component)" restart_class => canonify("start_$(component)"); commands: - - "/var/cfengine/bin/$(component)" - if => canonify("start_$(component)"); - + "/var/cfengine/bin/$(component)" if => canonify("start_$(component)"); } diff --git a/examples/process_restart_basic.cf b/examples/process_restart_basic.cf index 7afc21c693..b6b446ba99 100644 --- a/examples/process_restart_basic.cf +++ b/examples/process_restart_basic.cf @@ -1,43 +1,31 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - body common control { - bundlesequence => { "process_restart" }; + bundlesequence => { "process_restart" }; } ######################################################### - bundle agent process_restart { processes: - - "/usr/bin/daemon" - restart_class => "launch"; + "/usr/bin/daemon" restart_class => "launch"; commands: - launch:: - "/usr/bin/daemon"; - } diff --git a/examples/process_signalling.cf b/examples/process_signalling.cf index 7e02662254..9ce60ea6eb 100644 --- a/examples/process_signalling.cf +++ b/examples/process_signalling.cf @@ -1,69 +1,48 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test process restart # ######################################################## - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { processes: - - "cfservd" - - process_count => up("cfservd"); + "cfservd" process_count => up("cfservd"); cfservd_out_of_control:: - "cfservd" - - signals => { "stop" , "term" }, - restart_class => "start_cfserv"; - + signals => { "stop", "term" }, + restart_class => "start_cfserv"; commands: - start_cfserv:: - "/usr/local/bin/cfservd"; - } ######################################################## - body process_count up(s) - { - match_range => "1,10"; # or irange("1","10"); - out_of_range_define => { "$(s)_out_of_control" }; + match_range => "1,10"; # or irange("1","10"); + out_of_range_define => { "$(s)_out_of_control" }; } diff --git a/examples/processes_define_class_based_on_process_runtime.cf b/examples/processes_define_class_based_on_process_runtime.cf index 8fac6ece08..4560fe16de 100644 --- a/examples/processes_define_class_based_on_process_runtime.cf +++ b/examples/processes_define_class_based_on_process_runtime.cf @@ -10,22 +10,17 @@ # - main is the default bundle executed if no bundlesequence is defined in # 3.7+ ######################################################## - bundle agent main - { processes: - - "init" - process_count => any_count("booted_over_1_day_ago"), - process_select => days_older_than(1), - comment => "Define a class indicating we found an init process running + "init" + process_count => any_count("booted_over_1_day_ago"), + process_select => days_older_than(1), + comment => "Define a class indicating we found an init process running for more than 1 day."; reports: - booted_over_1_day_ago:: - "This system was booted over 1 days ago since there is an init process that is older than 1 day."; @@ -35,29 +30,25 @@ bundle agent main } ######################################################## - ######################################################## # NOTE: These bundles were copied from the stdlib in # order to make this a standalone policy that requires # no external files. Because the standard library is # constantly evolving their definition may change ######################################################## - body process_count any_count(cl) # @brief Define class `cl` if one or more process is running # @param cl Name of the class to be defined { - match_range => "0,0"; - out_of_range_define => { "$(cl)" }; + match_range => "0,0"; + out_of_range_define => { "$(cl)" }; } ######################################################## - body process_select days_older_than(d) # @brief Select all processes that are older than `d` days # @param d Days that processes need to be old to be selected { - stime_range => irange(ago(0,0,"$(d)",0,0,0),now); - process_result => "!stime"; + stime_range => irange(ago(0, 0, "$(d)", 0, 0, 0), now); + process_result => "!stime"; } - diff --git a/examples/product.cf b/examples/product.cf index d8ce18d8fc..23a22bb039 100644 --- a/examples/product.cf +++ b/examples/product.cf @@ -1,43 +1,36 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test { vars: - - "series" rlist => { "1.1", "2.2", "3.3", "5.5", "7.7" }; - - "prod" real => product("series"); - "sum" real => sum("series"); + "series" rlist => { "1.1", "2.2", "3.3", "5.5", "7.7" }; + "prod" real => product("series"); + "sum" real => sum("series"); reports: - "Product result: $(prod) > $(sum)"; + "Product result: $(prod) > $(sum)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/promises.cf b/examples/promises.cf index bfa7b1bae7..65988953b8 100644 --- a/examples/promises.cf +++ b/examples/promises.cf @@ -1,69 +1,59 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ####################################################### # # The starting point for every configuration # ####################################################### - body common control - { - inputs => { "$(sys.libdir)/stdlib.cf" }; - bundlesequence => { "main", "cfengine2" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "main", "cfengine2" }; } ####################################################### - bundle agent main - { - # do something + # do something vars: - "sys_files" slist => { - "/etc/passwd", - "/etc/services" - }; + "sys_files" slist => { "/etc/passwd", "/etc/services" }; + files: - "$(sys_files)" perms => mo("0644", "root"), - changes => detect_content; - "/etc/shadow" perms => mo("0600", "root"), - changes => detect_content; - "/usr" changes => detect_content, + "$(sys_files)" + perms => mo("0644", "root"), + changes => detect_content; + + "/etc/shadow" + perms => mo("0600", "root"), + changes => detect_content; + + "/usr" + changes => detect_content, depth_search => recurse("inf"); - "/tmp" delete => tidy, - file_select => days_old("2"), + + "/tmp" + delete => tidy, + file_select => days_old("2"), depth_search => recurse("inf"); } ####################################################### - bundle agent cfengine2 - { commands: - - "/var/cfengine/bin/cfagent"; - - + "/var/cfengine/bin/cfagent"; } diff --git a/examples/quoting.cf b/examples/quoting.cf index e28dff0f4a..941b0d22e8 100644 --- a/examples/quoting.cf +++ b/examples/quoting.cf @@ -29,6 +29,3 @@ bundle agent main #@ R: Note: You can't escape backtick quotes #@ ``` #+end_src - - - diff --git a/examples/randomint.cf b/examples/randomint.cf index c33cf4c064..18ef7ef918 100644 --- a/examples/randomint.cf +++ b/examples/randomint.cf @@ -1,35 +1,29 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 bundle agent main { vars: - "low" string => "4"; - "high" string => "60"; + "low" string => "4"; + "high" string => "60"; + "random" int => randomint($(low), $(high)); - "random" int => randomint($(low), $(high)); classes: - "isabove" expression => isgreaterthan($(random), 3); + "isabove" expression => isgreaterthan($(random), 3); reports: isabove:: @@ -38,6 +32,7 @@ bundle agent main show_random:: "Randomly generated '$(random)'"; } + #+end_src ############################################################################### #+begin_src show_random_example_output diff --git a/examples/read_module_protocol.cf b/examples/read_module_protocol.cf index bffd155757..ed37cd9f98 100644 --- a/examples/read_module_protocol.cf +++ b/examples/read_module_protocol.cf @@ -1,13 +1,12 @@ bundle agent cache_maintenance # Creates a module protocol cache, refreshes it if minute is 30-35 { - vars: - "file" - string => "$(this.promise_dirname)/cached_module"; + vars: + "file" string => "$(this.promise_dirname)/cached_module"; classes: - "cache_refresh" - if => not(fileexists("$(file)")); + "cache_refresh" if => not(fileexists("$(file)")); + Min30_35:: "cache_refresh"; @@ -23,22 +22,18 @@ bundle agent cache_maintenance bundle agent demo # Demonstrates read_module_protocol function, prints a variable from it { - classes: - "cache_was_read" - if => read_module_protocol("$(cache_maintenance.file)"); + classes: + "cache_was_read" if => read_module_protocol("$(cache_maintenance.file)"); - reports: - cache_was_read:: - "Module cache was read!"; - "cached_module.my_variable = $(cached_module.my_variable)"; + reports: + cache_was_read:: + "Module cache was read!"; + "cached_module.my_variable = $(cached_module.my_variable)"; } - bundle agent __main__ { methods: - "cache_maintenance" - handle => "cache_maintenance_done"; - "demo" - depends_on => { "cache_maintenance_done" }; + "cache_maintenance" handle => "cache_maintenance_done"; + "demo" depends_on => { "cache_maintenance_done" }; } diff --git a/examples/readcsv.cf b/examples/readcsv.cf index e0fa7199ab..928b009fa9 100644 --- a/examples/readcsv.cf +++ b/examples/readcsv.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ echo -n 1,2,3 > /tmp/csv @@ -30,17 +24,15 @@ bundle agent main { vars: - - # note that the CSV file has to have ^M (DOS) EOL terminators - # thus the prep step uses `echo -n` and just one line, so it will work on Unix - "csv" data => readcsv("/tmp/csv"); - "csv_str" string => format("%S", csv); + # note that the CSV file has to have ^M (DOS) EOL terminators + # thus the prep step uses `echo -n` and just one line, so it will work on Unix + "csv" data => readcsv("/tmp/csv"); + "csv_str" string => format("%S", csv); reports: - - "From /tmp/csv, got data $(csv_str)"; - + "From /tmp/csv, got data $(csv_str)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/readdata.cf b/examples/readdata.cf index 38bc103820..ebd4be17f2 100644 --- a/examples/readdata.cf +++ b/examples/readdata.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ echo -n 1,2,3 > /tmp/file.csv @@ -33,26 +27,26 @@ bundle agent main { vars: - - "csv" data => readdata("/tmp/file.csv", "auto"); # or file type "CSV" - "json" data => readdata("/tmp/file.json", "auto"); # or file type "JSON" - - "csv_str" string => format("%S", csv); - "json_str" string => format("%S", json); + "csv" data => readdata("/tmp/file.csv", "auto"); # or file type "CSV" + "json" data => readdata("/tmp/file.json", "auto"); # or file type "JSON" + "csv_str" string => format("%S", csv); + "json_str" string => format("%S", json); feature_yaml:: # we can only test YAML data if libyaml is compiled in "yaml" data => readdata("/tmp/file.yaml", "auto"); # or file type "YAML" "yaml_str" string => format("%S", yaml); + reports: + "From /tmp/file.csv, got data $(csv_str)"; + "From /tmp/file.json, got data $(json_str)"; - "From /tmp/file.csv, got data $(csv_str)"; - "From /tmp/file.json, got data $(json_str)"; feature_yaml:: "From /tmp/file.yaml, we would get data $(yaml_str)"; + !feature_yaml:: # show the output anyway 'From /tmp/file.yaml, we would get data ["a","b"]'; - } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/readenvfile.cf b/examples/readenvfile.cf index efaf2f4651..8475aca264 100644 --- a/examples/readenvfile.cf +++ b/examples/readenvfile.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ echo 'PRETTY_NAME="Ubuntu 14.04.5 LTS"' > /tmp/os-release @@ -30,50 +24,49 @@ # Definitions (from standard library): body edit_defaults empty { - empty_file_before_editing => "true"; - edit_backup => "false"; + empty_file_before_editing => "true"; + edit_backup => "false"; } bundle edit_line insert_lines(lines) { - insert_lines: - "$(lines)"; + insert_lines: + "$(lines)"; } body printfile cat(file) { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } + # empty, insert_lines() and cat() are part of the standard library # To import the standard library, remove them and uncomment this line: # body file control { inputs => { "$(sys.libdir)/stdlib.cf" }; } - bundle agent main { - classes: - "file_found" expression => fileexists("/tmp/os-release"); + classes: + "file_found" expression => fileexists("/tmp/os-release"); - # Use readenvfile() to load /tmp/os-release, then convert to json: - vars: - file_found:: - "envdata" - data => readenvfile("/tmp/os-release"); - "jsonstring" - string => storejson(envdata); + # Use readenvfile() to load /tmp/os-release, then convert to json: + vars: + file_found:: + "envdata" data => readenvfile("/tmp/os-release"); + "jsonstring" string => storejson(envdata); - # Print input(os-release) and output(json) files: - reports: - file_found:: - "/tmp/os-release :" - printfile => cat("/tmp/os-release"); - "/tmp/os-release converted to json:"; - "$(jsonstring)"; - "(The data for this system is available in sys.os_release)"; - !file_found:: - "/tmp/os-release doesn't exist, run this command:"; - "echo 'PRETTY_NAME=\"Ubuntu 14.04.5 LTS\"' > /tmp/os-release"; + # Print input(os-release) and output(json) files: + reports: + file_found:: + "/tmp/os-release :" printfile => cat("/tmp/os-release"); + "/tmp/os-release converted to json:"; + "$(jsonstring)"; + "(The data for this system is available in sys.os_release)"; + + !file_found:: + "/tmp/os-release doesn't exist, run this command:"; + "echo 'PRETTY_NAME=\"Ubuntu 14.04.5 LTS\"' > /tmp/os-release"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/readfile.cf b/examples/readfile.cf index ca3a040e28..8f2e621686 100644 --- a/examples/readfile.cf +++ b/examples/readfile.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ echo alpha > /tmp/cfe_hostlist @@ -31,18 +25,18 @@ #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: + "xxx" string => readfile("/tmp/cfe_hostlist", "5"); - "xxx" - string => readfile( "/tmp/cfe_hostlist" , "5" ); reports: - "first 5 characters of /tmp/cfe_hostlist: $(xxx)"; + "first 5 characters of /tmp/cfe_hostlist: $(xxx)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/readintarray.cf b/examples/readintarray.cf index 857063bda3..bd62b29c3e 100644 --- a/examples/readintarray.cf +++ b/examples/readintarray.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ echo 1: 5:7:21:13 > /tmp/readintarray.txt @@ -31,22 +25,18 @@ ############################################################################### #+begin_src cfengine3 bundle agent main - { vars: - - "lines" int => readintarray("array_name", - "/tmp/readintarray.txt", - "#[^\n]*", - ":", - 10, - 4000); + "lines" + int => readintarray( + "array_name", "/tmp/readintarray.txt", "#[^\n]*", ":", 10, 4000 + ); reports: - "array_name contains $(lines) keys$(const.n)$(with)" - with => string_mustache("{{%-top-}}", "array_name"); - + "array_name contains $(lines) keys$(const.n)$(with)" + with => string_mustache("{{%-top-}}", "array_name"); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/readintlist.cf b/examples/readintlist.cf index 5e38cc9eba..4fd9f08888 100644 --- a/examples/readintlist.cf +++ b/examples/readintlist.cf @@ -10,20 +10,24 @@ bundle agent example_readintlist # @brief Example showing function return types { vars: - "my_list_of_integers" - ilist => readintlist( "/tmp/list.txt", # File to read - "^(\D+)|(\d+[^\n]+)", # Ignore any lines that are not integers - "\n", # Split on newlines - inf, # Maximum number of entries - inf); # Maximum number of bytes to read - + "my_list_of_integers" + ilist => readintlist( + "/tmp/list.txt", # File to read + "^(\D+)|(\d+[^\n]+)", # Ignore any lines that are not integers + "\n", # Split on newlines + inf, # Maximum number of entries + inf + ); # Maximum number of bytes to read reports: - "my_list_of_integers includes '$(my_list_of_integers)'"; + "my_list_of_integers includes '$(my_list_of_integers)'"; } + bundle agent __main__ { - methods: "example_readintlist"; + methods: + "example_readintlist"; } + #+end_src #+begin_src example_output #@ ``` diff --git a/examples/readintrealstringlist.cf b/examples/readintrealstringlist.cf index d3456be414..3de9962e74 100644 --- a/examples/readintrealstringlist.cf +++ b/examples/readintrealstringlist.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ echo 1 > /tmp/cfe_list_ints @@ -43,24 +37,29 @@ #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: + "integers" + ilist => readintlist("/tmp/cfe_list_ints", "#[^\n]*", "[\n]", 10, 400); - "integers" ilist => readintlist("/tmp/cfe_list_ints","#[^\n]*","[\n]",10,400); - "strings" slist => readstringlist("/tmp/cfe_list_strings", "#[^\n]*", "\s", 10, 400); - "reals" rlist => readreallist("/tmp/cfe_list_reals","#[^\n]*","[\n]",10,400); - - reports: + "strings" + slist => readstringlist( + "/tmp/cfe_list_strings", "#[^\n]*", "\s", 10, 400 + ); - "integers in /tmp/cfe_list_ints: $(integers)"; - "strings in /tmp/cfe_list_strings: $(strings)"; - "reals in /tmp/cfe_list_reals: $(reals)"; + "reals" + rlist => readreallist("/tmp/cfe_list_reals", "#[^\n]*", "[\n]", 10, 400); + reports: + "integers in /tmp/cfe_list_ints: $(integers)"; + "strings in /tmp/cfe_list_strings: $(strings)"; + "reals in /tmp/cfe_list_reals: $(reals)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/readlist.cf b/examples/readlist.cf index 6cb581bd1c..e6218bccdc 100644 --- a/examples/readlist.cf +++ b/examples/readlist.cf @@ -1,45 +1,30 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################################### - bundle agent example - -{ +{ vars: - - "mylist" ilist => { readintlist("/tmp/listofint","#.*","[\n]",10,400) }; + "mylist" ilist => { readintlist("/tmp/listofint", "#.*", "[\n]", 10, 400) }; reports: - - "List entry: $(mylist)"; - + "List entry: $(mylist)"; } - diff --git a/examples/readrealarray.cf b/examples/readrealarray.cf index 0191f294b6..7c6872c554 100644 --- a/examples/readrealarray.cf +++ b/examples/readrealarray.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ echo "1: 5.0:7:21:13" > /tmp/readrealarray.txt @@ -33,19 +27,16 @@ bundle agent main { vars: - - "lines" int => readrealarray("array_name", - "/tmp/readrealarray.txt", - "#[^\n]*", - ":", - 10, - 4000); + "lines" + int => readrealarray( + "array_name", "/tmp/readrealarray.txt", "#[^\n]*", ":", 10, 4000 + ); reports: - "array_name contains $(lines) keys$(const.n)$(with)" - with => string_mustache("{{%-top-}}", "array_name"); - + "array_name contains $(lines) keys$(const.n)$(with)" + with => string_mustache("{{%-top-}}", "array_name"); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/readreallist.cf b/examples/readreallist.cf index 1171026c02..3c1754b9e1 100644 --- a/examples/readreallist.cf +++ b/examples/readreallist.cf @@ -10,20 +10,24 @@ bundle agent example_readreallist # @brief Example showing function return types { vars: - "my_list_of_reals" - rlist => readreallist( "/tmp/list.txt", # File to read - "^(\D+)", # Ignore any non-digits - "\n", # Split on newlines - inf, # Maximum number of entries - inf ); # Maximum number of bytes to read - + "my_list_of_reals" + rlist => readreallist( + "/tmp/list.txt", # File to read + "^(\D+)", # Ignore any non-digits + "\n", # Split on newlines + inf, # Maximum number of entries + inf + ); # Maximum number of bytes to read reports: - "my_list_of_reals includes '$(my_list_of_reals)'"; + "my_list_of_reals includes '$(my_list_of_reals)'"; } + bundle agent __main__ { - methods: "example_readreallist"; + methods: + "example_readreallist"; } + #+end_src #+begin_src example_output #@ ``` diff --git a/examples/readstringarray.cf b/examples/readstringarray.cf index 36ab7745c8..1632bf60f6 100644 --- a/examples/readstringarray.cf +++ b/examples/readstringarray.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ echo "at:x:25:25:Batch jobs daemon:/var/spool/atjobs:/bin/bash" > /tmp/readstringarray.txt @@ -35,19 +29,16 @@ bundle agent main { vars: - - "lines" int => readstringarray("array_name", - "/tmp/readstringarray.txt", - "#[^\n]*", - ":", - 10, - 4000); + "lines" + int => readstringarray( + "array_name", "/tmp/readstringarray.txt", "#[^\n]*", ":", 10, 4000 + ); reports: - "array_name contains $(lines) keys$(const.n)$(with)" - with => string_mustache("{{%-top-}}", "array_name"); - + "array_name contains $(lines) keys$(const.n)$(with)" + with => string_mustache("{{%-top-}}", "array_name"); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/readstringlist.cf b/examples/readstringlist.cf index 8a4c2fefb9..a5179db6c7 100644 --- a/examples/readstringlist.cf +++ b/examples/readstringlist.cf @@ -13,20 +13,24 @@ bundle agent example_readstringlist # @brief Example showing readstringlist() { vars: - "my_list_of_strings" - slist => readstringlist( "/tmp/list.txt", # File to read - "^\s*#[^\n]*", # Exclude hash comment lines lines - "\n", # Split on newlines - inf, # Maximum number of entries - inf); # Maximum number of bytes to read - + "my_list_of_strings" + slist => readstringlist( + "/tmp/list.txt", # File to read + "^\s*#[^\n]*", # Exclude hash comment lines lines + "\n", # Split on newlines + inf, # Maximum number of entries + inf + ); # Maximum number of bytes to read reports: - "my_list_of_strings includes '$(my_list_of_strings)'"; + "my_list_of_strings includes '$(my_list_of_strings)'"; } + bundle agent __main__ { - methods: "example_readstringlist"; + methods: + "example_readstringlist"; } + #+end_src #+begin_src example_output #@ ``` diff --git a/examples/readtcp.cf b/examples/readtcp.cf index c0da53d756..eec99a933b 100644 --- a/examples/readtcp.cf +++ b/examples/readtcp.cf @@ -1,49 +1,45 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - - "my80" string => readtcp("myserver.com","80","GET /index.html HTTP/1.1$(const.r)$(const.n)Host: myserver.com$(const.r)$(const.n)$(const.r)$(const.n)",20); + "my80" + string => readtcp( + "myserver.com", + "80", + "GET /index.html HTTP/1.1$(const.r)$(const.n)Host: myserver.com$(const.r)$(const.n)$(const.r)$(const.n)", + 20 + ); classes: - - "server_ok" expression => regcmp("[^\n]*200 OK.*\n.*","$(my80)"); + "server_ok" expression => regcmp("[^\n]*200 OK.*\n.*", "$(my80)"); reports: - server_ok:: - "Server is alive"; !server_ok:: - "Server is not responding - got $(my80)"; } + #+end_src diff --git a/examples/reference_values_inside_data.cf b/examples/reference_values_inside_data.cf index 9ea7507b55..6623611ddb 100755 --- a/examples/reference_values_inside_data.cf +++ b/examples/reference_values_inside_data.cf @@ -3,8 +3,8 @@ bundle agent example_reference_values_inside_data { vars: - - "data" data => '{ + "data" + data => '{ "Key1": "Value1", "Key2": "Value2", "Key3": [ @@ -18,10 +18,13 @@ bundle agent example_reference_values_inside_data "Key2 contains '$(data[Key2])'"; "Key3 iterates and contains '$(data[Key3])'"; } + bundle agent __main__ { - methods: "example_reference_values_inside_data"; + methods: + "example_reference_values_inside_data"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/reg_multiline.cf b/examples/reg_multiline.cf index 3a3bd571f3..64eec68a84 100644 --- a/examples/reg_multiline.cf +++ b/examples/reg_multiline.cf @@ -1,30 +1,29 @@ ############################################# # Matching multiple lines in regexp (PCRE) ############################################## - body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - "data" string => "Something boring is + "data" + string => "Something boring is written up here. This is the interesting part: KWYDK (know what you don't know)"; classes: - - # note the (?s) at the beginning of the pattern - this ensures newlines are matched by . - - "matched" expression => regextract("(?s).*: (.*)", "$(data)", "interesting"); + # note the (?s) at the beginning of the pattern - this ensures newlines are matched by . + "matched" + expression => regextract("(?s).*: (.*)", "$(data)", "interesting"); reports: matched:: "This is interesting: \"$(interesting[1])\""; - + !matched:: "Nothing was interesting!"; } diff --git a/examples/regarray.cf b/examples/regarray.cf index d1e4953b06..b2cfbe321d 100644 --- a/examples/regarray.cf +++ b/examples/regarray.cf @@ -1,54 +1,43 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - - "myarray[0]" string => "bla1"; - "myarray[1]" string => "bla2"; - "myarray[3]" string => "bla"; + "myarray[0]" string => "bla1"; + "myarray[1]" string => "bla2"; + "myarray[3]" string => "bla"; classes: - - "ok" expression => regarray("myarray","b.*2"); + "ok" expression => regarray("myarray", "b.*2"); reports: - ok:: - "Found in list"; !ok:: - "Not found in list"; - } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/regcmp.cf b/examples/regcmp.cf index 87988028ba..a5e8525feb 100644 --- a/examples/regcmp.cf +++ b/examples/regcmp.cf @@ -1,47 +1,38 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { subtest("mark") }; + bundlesequence => { subtest("mark") }; } bundle agent subtest(user) { classes: - - "invalid" not => regcmp("[a-z]{4}","$(user)"); + "invalid" not => regcmp("[a-z]{4}", "$(user)"); reports: - !invalid:: - "User name $(user) is valid at exactly 4 letters"; invalid:: - "User name $(user) is invalid"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/regex_replace.cf b/examples/regex_replace.cf index 48fb79b6fc..662d13425e 100644 --- a/examples/regex_replace.cf +++ b/examples/regex_replace.cf @@ -1,45 +1,50 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 bundle agent main { vars: - # global regex replace A with B - "AB" string => regex_replace("This has AAA rating", "A", "B", "g"); - # global regex replace [Aa] with B (case insensitive) - "AaB" string => regex_replace("This has AAA rating", "A", "B", "gi"); - # global replace every three characters with [cap=thecharacters] using $1 - "cap123" string => regex_replace("abcdefghijklmn", "(...)", "[cap=$1]", "g"); - # multiple captures using \1 \2 (just like $1 $2 but can only go up to \9) - "path_breakdown" string => regex_replace("/a/b/c/example.txt", "(.+)/(.+)", "dirname = \1 file basename = \2", ""); + # global regex replace A with B + "AB" string => regex_replace("This has AAA rating", "A", "B", "g"); + + # global regex replace [Aa] with B (case insensitive) + "AaB" string => regex_replace("This has AAA rating", "A", "B", "gi"); + + # global replace every three characters with [cap=thecharacters] using $1 + "cap123" + string => regex_replace("abcdefghijklmn", "(...)", "[cap=$1]", "g"); + + # multiple captures using \1 \2 (just like $1 $2 but can only go up to \9) + "path_breakdown" + string => regex_replace( + "/a/b/c/example.txt", + "(.+)/(.+)", + "dirname = \1 file basename = \2", + "" + ); reports: - # in order, the above... - "AB replacement = '$(AB)'"; - "AaB replacement = '$(AaB)'"; - "cap123 replacement = '$(cap123)'"; - "path_breakdown replacement = '$(path_breakdown)'"; + # in order, the above... + "AB replacement = '$(AB)'"; + "AaB replacement = '$(AaB)'"; + "cap123 replacement = '$(cap123)'"; + "path_breakdown replacement = '$(path_breakdown)'"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/regex_win.cf b/examples/regex_win.cf index e68f8c79f8..e1f07e9676 100644 --- a/examples/regex_win.cf +++ b/examples/regex_win.cf @@ -1,26 +1,21 @@ ###################################################################### # Using path regular expressions on Windows (always forward slash) ###################################################################### - body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - bundle agent example { files: - "c:/test/.*.xml" - edit_line => add_information(); + "c:/test/.*.xml" edit_line => add_information(); } ######################################################## - bundle edit_line add_information() { insert_lines: - "a line" - comment => "adding line"; + "a line" comment => "adding line"; } diff --git a/examples/regextract.cf b/examples/regextract.cf index ada8232f5a..69a43d79c9 100644 --- a/examples/regextract.cf +++ b/examples/regextract.cf @@ -1,48 +1,39 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { classes: - - # Extract regex backreferences and put them in an array - - "ok" expression => regextract( - "xx ([^\s]+) ([^\s]+).* xx", - "xx one two three four xx", - "myarray" + # Extract regex backreferences and put them in an array + "ok" + expression => regextract( + "xx ([^\s]+) ([^\s]+).* xx", "xx one two three four xx", "myarray" ); - reports: + reports: ok:: - "ok - \"$(myarray[0])\" = xx + \"$(myarray[1])\" + \"$(myarray[2])\" + .. + xx"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/registry.cf b/examples/registry.cf index ebda7ba8a3..58f134061e 100644 --- a/examples/registry.cf +++ b/examples/registry.cf @@ -1,74 +1,46 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - - - body common control { - - bundlesequence => { "databases" }; + bundlesequence => { "databases" }; } - bundle agent databases - { databases: - windows:: - # Regsitry has (value,data) pairs in "keys" which are directories - # "HKEY_LOCAL_MACHINE\SOFTWARE\Northern.tech AS" - # database_operation => "create", # database_type => "ms_registry"; - # "HKEY_LOCAL_MACHINE\SOFTWARE\Northern.tech AS\Cfengine" - # database_operation => "create", # database_rows => { "value1,REG_SZ,new value 1", "value2,REG_SZ,new val 2"} , # database_type => "ms_registry"; - - "HKEY_LOCAL_MACHINE\SOFTWARE\Northern.tech AS\Cfengine" - - database_operation => "delete", - database_columns => { "value1", "value2" } , - database_type => "ms_registry"; - + database_operation => "delete", + database_columns => { "value1", "value2" }, + database_type => "ms_registry"; # "HKEY_LOCAL_MACHINE\SOFTWARE\Northern.tech AS\Cfengine" - # database_operation => "cache", # cache,restore - # registry_exclude => { ".*Windows.*CurrentVersion.*", ".*Touchpad.*", ".*Capabilities.FileAssociations.*", ".*Rfc1766.*" , ".*Synaptics.SynTP.*", ".*SupportedDevices.*8086", ".*Microsoft.*ErrorThresholds" }, - # database_type => "ms_registry"; - "HKEY_LOCAL_MACHINE\SOFTWARE\Northern.tech AS" - - database_operation => "restore", - database_type => "ms_registry"; - + database_operation => "restore", + database_type => "ms_registry"; } diff --git a/examples/registry_cache.cf b/examples/registry_cache.cf index 729341d0cc..d5ae109423 100644 --- a/examples/registry_cache.cf +++ b/examples/registry_cache.cf @@ -1,53 +1,44 @@ # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - body common control { - bundlesequence => { - # "registry_cache" - # "registry_restore" - }; + bundlesequence => { + # "registry_cache" + # "registry_restore" + }; } ######################################### - bundle agent registry_cache { databases: windows:: - "HKEY_LOCAL_MACHINE\SOFTWARE\Adobe" - database_operation => "cache", - database_type => "ms_registry", - comment => "Save correct registry settings for Adobe products"; + database_operation => "cache", + database_type => "ms_registry", + comment => "Save correct registry settings for Adobe products"; } ######################################### - bundle agent registry_restore { databases: windows:: - "HKEY_LOCAL_MACHINE\SOFTWARE\Adobe" - database_operation => "restore", - database_type => "ms_registry", - comment => "Make sure Adobe products have correct registry settings"; + database_operation => "restore", + database_type => "ms_registry", + comment => "Make sure Adobe products have correct registry settings"; } diff --git a/examples/registryvalue.cf b/examples/registryvalue.cf index 685600459b..572ce8a144 100644 --- a/examples/registryvalue.cf +++ b/examples/registryvalue.cf @@ -1,43 +1,41 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "reg" }; + bundlesequence => { "reg" }; } bundle agent reg { vars: windows:: - "value" string => registryvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Northern.tech AS\CFEngine","value3"); + "value" + string => registryvalue( + "HKEY_LOCAL_MACHINE\SOFTWARE\Northern.tech AS\CFEngine", "value3" + ); + !windows:: "value" string => "Sorry, no registry data is available"; reports: - "Value extracted: $(value)"; - + "Value extracted: $(value)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/regline.cf b/examples/regline.cf index 2c91c067f8..72b1dc8a08 100644 --- a/examples/regline.cf +++ b/examples/regline.cf @@ -1,64 +1,52 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ###################################################################### # Function regline(regex,file) ###################################################################### - #+begin_src cfengine3 bundle agent main # @brief An example showing how to use regline to see if a pattern exists within # a file. { vars: - linux:: - "file" string => "/proc/sys/net/ipv4/ip_forward"; "reg_enabled" string => "^1$"; "reg_disabled" string => "^0$"; classes: - linux:: - "ipv4_forwarding_enabled" -> { "SecOps" } - expression => regline( $(reg_enabled) , $(file) ), + expression => regline($(reg_enabled), $(file)), comment => "We want to know if ip forwarding is enabled because it is a potential security issue."; "ipv4_forwarding_disabled" -> { "SecOps" } - expression => regline( $(reg_disabled) , $(file) ); + expression => regline($(reg_disabled), $(file)); reports: - ipv4_forwarding_enabled:: "I found that IPv4 forwarding is enabled!"; ipv4_forwarding_disabled:: "I found that IPv4 forwarding is disabled."; } -#+end_src +#+end_src #+begin_src random_example_output #@ ``` #@ R: I found that IPv4 forwarding is disabled. diff --git a/examples/reglist.cf b/examples/reglist.cf index 5090c6dcf7..e48a59dfe0 100644 --- a/examples/reglist.cf +++ b/examples/reglist.cf @@ -1,50 +1,44 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - - "nameservers" slist => { - "128.39.89.10", - "128.39.74.16", - "192.168.1.103", - "10.132.51.66" + "nameservers" + slist => { + "128.39.89.10", "128.39.74.16", "192.168.1.103", "10.132.51.66" }; + classes: + "am_name_server" expression => reglist(@(nameservers), "127\.0\.0\.1"); - "am_name_server" expression => reglist(@(nameservers), "127\.0\.0\.1"); reports: am_name_server:: "127.0.0.1 is currently set as a nameserver"; + !am_name_server:: "127.0.0.1 is NOT currently set as a nameserver"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/remoteclasses.cf b/examples/remoteclasses.cf index 7e2b2f9280..9eeb2ac276 100644 --- a/examples/remoteclasses.cf +++ b/examples/remoteclasses.cf @@ -1,32 +1,24 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - ######################################################## # # Remote classes from server connection to cfServer # ######################################################## - # # run this as follows: # @@ -34,142 +26,106 @@ # cf-agent -f runtest_2.cf # # Notice that the same file configures all parts of cfengine - ######################################################## - body common control - { - bundlesequence => { job_chain("Hr16|Hr17") }; - - version => "1.2.3"; + bundlesequence => { job_chain("Hr16|Hr17") }; + version => "1.2.3"; } ######################################################## - bundle common g { vars: - - # Signals are in scope of promiser and promisee - - "signal" string => "pack_a_name"; - + # Signals are in scope of promiser and promisee + "signal" string => "pack_a_name"; } ######################################################## - bundle agent job_chain(time) - { vars: - - "client" string => "localhost"; - "server" string => "localhost"; - "margin" string => "5"; # mins deadtime - + "client" string => "localhost"; + "server" string => "localhost"; + "margin" string => "5"; # mins deadtime classes: - - "client_primed" expression => classmatch(canonify("$(client)")), + "client_primed" + expression => classmatch(canonify("$(client)")), if => "$(time)"; - "server_primed" expression => classmatch(canonify("$(server)")), + "server_primed" + expression => classmatch(canonify("$(server)")), if => "$(time)"; client_primed:: + "succeeded" + expression => remoteclassesmatching( + "$(g.signal)", "$(server)", "yes", "myprefix" + ); - "succeeded" expression => remoteclassesmatching("$(g.signal)","$(server)","yes","myprefix"); - - # - # Now the job itself - # - + # Now the job itself methods: - client_primed:: - - "downstream" usebundle => do_job("Starting local follow-up job"), - action => if_elapsed("$(margin)"), - if => "myprefix_$(g.signal)"; + "downstream" + usebundle => do_job("Starting local follow-up job"), + action => if_elapsed("$(margin)"), + if => "myprefix_$(g.signal)"; server_primed:: - - "upstream" usebundle => do_job("Starting remote job"), - action => if_elapsed("$(margin)"), - classes => signal_repaired("$(g.signal)"); + "upstream" + usebundle => do_job("Starting remote job"), + action => if_elapsed("$(margin)"), + classes => signal_repaired("$(g.signal)"); reports: - !succeeded:: - - "Server communication failed" - - if => "$(time)"; - - - "Job completed on the server..." - - if => "$(g.signal)"; - + "Server communication failed" if => "$(time)"; + "Job completed on the server..." if => "$(g.signal)"; } ######################################################### - bundle agent do_job(job) { commands: - - # do whatever... - - "/bin/echo $(job)"; + # do whatever... + "/bin/echo $(job)"; } - ######################################################### # Server config ######################################################### - -body server control - +body server control { - allowconnects => { "127.0.0.1" , "::1" }; - allowallconnects => { "127.0.0.1" , "::1" }; - trustkeysfrom => { "127.0.0.1" , "::1" }; - allowusers => { "mark" }; + allowconnects => { "127.0.0.1", "::1" }; + allowallconnects => { "127.0.0.1", "::1" }; + trustkeysfrom => { "127.0.0.1", "::1" }; + allowusers => { "mark" }; } ######################################################### - bundle server access_rules() - { vars: - - "localvar" string => "literal string"; + "localvar" string => "literal string"; access: - - "$(g.signal)" - - handle => "test_class_signal", + "$(g.signal)" + handle => "test_class_signal", resource_type => "context", - admit => { "127.0.0.1" }; + admit => { "127.0.0.1" }; } - ######################################################### # Standard library ######################################################### - body action if_elapsed(x) { - ifelapsed => "$(x)"; + ifelapsed => "$(x)"; } ######################################################### - body classes signal_repaired(x) { - promise_repaired => { "$(x)" }; - persist_time => "10"; + promise_repaired => { "$(x)" }; + persist_time => "10"; } diff --git a/examples/remoteclasses2.cf b/examples/remoteclasses2.cf index 65b51bfa37..7d994bd902 100644 --- a/examples/remoteclasses2.cf +++ b/examples/remoteclasses2.cf @@ -1,28 +1,22 @@ -# - body common control { - bundlesequence => { "overture" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "overture" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } ####################################################### - bundle agent overture { classes: - "extended_context" - expression => remoteclassesmatching(".*did.*","127.0.0.1","yes","got"); + "extended_context" + expression => remoteclassesmatching(".*did.*", "127.0.0.1", "yes", "got"); files: - - "/etc/passwd" + "/etc/passwd" create => "true", classes => set_outcome_classes; - reports: - got_did_task_one:: "task 1 complete"; @@ -31,34 +25,28 @@ bundle agent overture extended_context.got_did_task_three:: "task 3 complete"; - } - body classes set_outcome_classes { - promise_kept => { "did_task_one","did_task_two", "did_task_three" }; - promise_repaired => { "did_task_one","did_task_two", "did_task_three" }; - #cancel_kept => { "did_task_one" }; - persist_time => "10"; -} + promise_kept => { "did_task_one", "did_task_two", "did_task_three" }; + promise_repaired => { "did_task_one", "did_task_two", "did_task_three" }; -body server control + #cancel_kept => { "did_task_one" }; + persist_time => "10"; +} +body server control { - allowconnects => { "127.0.0.1" , "::1",}; - allowallconnects => { "127.0.0.1" , "::1", }; - trustkeysfrom => { "127.0.0.1" , "::1",}; + allowconnects => { "127.0.0.1", "::1" }; + allowallconnects => { "127.0.0.1", "::1" }; + trustkeysfrom => { "127.0.0.1", "::1" }; } - - bundle server access_rules() { access: - - "did.*" + "did.*" resource_type => "context", admit => { "127.0.0.1" }; - } diff --git a/examples/remotescalar.cf b/examples/remotescalar.cf index 3acdf1ac51..05584ab8ef 100644 --- a/examples/remotescalar.cf +++ b/examples/remotescalar.cf @@ -1,89 +1,69 @@ - # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################################## # # Testing comms for remote orchestration # ######################################################################## - body common control { - bundlesequence => { "overture" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "overture" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } -body server control - +body server control { - allowconnects => { "127.0.0.1" , "::1",}; - allowallconnects => { "127.0.0.1" , "::1", }; - trustkeysfrom => { "127.0.0.1" , "::1",}; + allowconnects => { "127.0.0.1", "::1" }; + allowallconnects => { "127.0.0.1", "::1" }; + trustkeysfrom => { "127.0.0.1", "::1" }; } ####################################################### - bundle agent overture { vars: - - "remote" string => remotescalar("test_scalar","127.0.0.1","yes"); - - "know" string => hubknowledge("test_scalar"); - - "count_getty" string => hubknowledge("count_getty"); + "remote" string => remotescalar("test_scalar", "127.0.0.1", "yes"); + "know" string => hubknowledge("test_scalar"); + "count_getty" string => hubknowledge("count_getty"); processes: - - # Use the enumerated library body to count hosts running getty - - "getty" - + # Use the enumerated library body to count hosts running getty + "getty" comment => "Count this host if a job is matched", classes => enumerate("count_getty"); reports: - "GOT remote scalar $(remote)"; - "GOT knowedge scalar $(know)"; - "GOT persistent scalar $(xyz)"; - + "GOT remote scalar $(remote)"; + "GOT knowedge scalar $(know)"; + "GOT persistent scalar $(xyz)"; } ####################################################### - bundle server access_rules() { access: - - "value of my test_scalar, can expand variables here - $(sys.host)" + "value of my test_scalar, can expand variables here - $(sys.host)" handle => "test_scalar", comment => "Grant access to contents of test_scalar VAR", resource_type => "literal", admit => { "127.0.0.1" }; - "XYZ" + "XYZ" resource_type => "variable", handle => "XYZ", admit => { "127.0.0.1" }; - } diff --git a/examples/remove_deadlinks.cf b/examples/remove_deadlinks.cf index abc1d8aac6..0c4e2fb8f9 100644 --- a/examples/remove_deadlinks.cf +++ b/examples/remove_deadlinks.cf @@ -1,74 +1,54 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ####################################################### # # Test dead link removal # ####################################################### - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } - ############################################ - bundle agent example - { files: - - "/home/mark/tmp/test_to" -> "someone" - + "/home/mark/tmp/test_to" -> "someone" depth_search => recurse("inf"), perms => modestuff, action => tell_me; - } ############################################ - body depth_search recurse(d) - { - rmdeadlinks => "true"; - depth => "$(d)"; + rmdeadlinks => "true"; + depth => "$(d)"; } ############################################ - body perms modestuff - { - mode => "o-w"; + mode => "o-w"; } ############################################ - body action tell_me - { - report_level => "inform"; + report_level => "inform"; } diff --git a/examples/rename.cf b/examples/rename.cf index 2d0e4ad644..0ce162e710 100644 --- a/examples/rename.cf +++ b/examples/rename.cf @@ -1,42 +1,31 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => {"test"}; + bundlesequence => { "test" }; } bundle agent example { files: - - "/tmp/foo" - - rename => moveit; - + "/tmp/foo" rename => moveit; } -body rename moveit +body rename moveit { - newname => "/tmp/foo_moved"; + newname => "/tmp/foo_moved"; } diff --git a/examples/repairedcommand.cf b/examples/repairedcommand.cf index cdaedd009f..911177df80 100644 --- a/examples/repairedcommand.cf +++ b/examples/repairedcommand.cf @@ -1,24 +1,20 @@ -body common control -{ - bundlesequence => { "cmdtest" }; -} - - -bundle agent cmdtest -{ - commands: - "/bin/false" - classes => example; - - reports: - wasrepaired:: - "The command-promise got repaired!"; -} - - - -body classes example -{ - repaired_returncodes => { "0", "1" }; - promise_repaired => { "wasrepaired" }; -} +body common control +{ + bundlesequence => { "cmdtest" }; +} + +bundle agent cmdtest +{ + commands: + "/bin/false" classes => example; + + reports: + wasrepaired:: + "The command-promise got repaired!"; +} + +body classes example +{ + repaired_returncodes => { "0", "1" }; + promise_repaired => { "wasrepaired" }; +} diff --git a/examples/report_custom.cf b/examples/report_custom.cf index 0dfd335476..c1936b9a65 100644 --- a/examples/report_custom.cf +++ b/examples/report_custom.cf @@ -1,70 +1,49 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - - - body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - - "software" slist => { "gpg", "zip", "rsync" }; + "software" slist => { "gpg", "zip", "rsync" }; classes: - - "noreport" expression => fileexists("/tmp/report.html"); - "have_$(software)" expression => fileexists("/usr/bin/$(software)"); + "noreport" expression => fileexists("/tmp/report.html"); + "have_$(software)" expression => fileexists("/usr/bin/$(software)"); reports: - no_report:: - " Name of this host is: $(sys.host)
Type of this host is: $(sys.os)
" - - report_to_file => "/tmp/report.html"; - - # + report_to_file => "/tmp/report.html"; " Host has software $(software)
" - - if => "have_$(software)", - report_to_file => "/tmp/report.html"; - - # + if => "have_$(software)", + report_to_file => "/tmp/report.html"; " - " - report_to_file => "/tmp/report.html"; - + " report_to_file => "/tmp/report.html"; } diff --git a/examples/report_state.cf b/examples/report_state.cf index c0afd959ce..75a9d0bb91 100644 --- a/examples/report_state.cf +++ b/examples/report_state.cf @@ -1,51 +1,36 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control - { - bundlesequence => { "report" }; + bundlesequence => { "report" }; } ########################################################### - bundle agent report - -{ +{ reports: - "/etc/passwd except $(const.n)" - - printfile => pr("/etc/passwd","5"), - + "/etc/passwd except $(const.n)" + printfile => pr("/etc/passwd", "5"), showstate => { "otherprocs", "rootprocs" }; - } ###################################################################### - -body printfile pr(file,lines) - +body printfile pr(file, lines) { - file_to_print => "$(file)"; - number_of_lines => "$(lines)"; + file_to_print => "$(file)"; + number_of_lines => "$(lines)"; } diff --git a/examples/reports.cf b/examples/reports.cf index b2f7590c50..1a2085d734 100644 --- a/examples/reports.cf +++ b/examples/reports.cf @@ -2,50 +2,49 @@ bundle agent main { reports: - "It's recommended that you always guard reports" - comment => "Remember by default output from cf-agent when run + "It's recommended that you always guard reports" + comment => "Remember by default output from cf-agent when run from cf-execd will be emailed"; DEBUG|DEBUG_main:: "Run with --define DEBUG or --define DEBUG_main to display this report"; methods: - "Actuate bundle that reports with a return value" - usebundle => bundle_with_return_value, - useresult => "return_array", - comment => "Reports can be used to return data into a parent bundle. + "Actuate bundle that reports with a return value" + usebundle => bundle_with_return_value, + useresult => "return_array", + comment => "Reports can be used to return data into a parent bundle. This is useful in some re-usable bundle patterns."; reports: - "I got '$(return_array[key])' returned from bundle_with_return_value"; + "I got '$(return_array[key])' returned from bundle_with_return_value"; - "Reports can be redirected and appended to files" - report_to_file => "$(sys.workdir)/report_output.txt", - comment => "It's important to note that this will suppress the report + "Reports can be redirected and appended to files" + report_to_file => "$(sys.workdir)/report_output.txt", + comment => "It's important to note that this will suppress the report from stdout."; - "Report content of a file:$(const.n)$(const.n)------------------------" - printfile => cat( $(this.promise_filename) ); + "Report content of a file:$(const.n)$(const.n)------------------------" + printfile => cat($(this.promise_filename)); } bundle agent bundle_with_return_value { reports: - "value from bundle_with_return_value" - bundle_return_value_index => "key"; + "value from bundle_with_return_value" bundle_return_value_index => "key"; } body printfile cat(file) { - file_to_print => "$(file)"; - number_of_lines => "inf"; + file_to_print => "$(file)"; + number_of_lines => "inf"; } - @if minimum_version(3.8) body printfile head(file) { - inherit_from => "cat"; - # GNU head defaults to 10 - number_of_lines => "10"; + inherit_from => "cat"; + + # GNU head defaults to 10 + number_of_lines => "10"; } @endif diff --git a/examples/reporttofile.cf b/examples/reporttofile.cf index 5c617ab3a4..68e563c787 100644 --- a/examples/reporttofile.cf +++ b/examples/reporttofile.cf @@ -1,36 +1,26 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } -# - bundle agent example { reports: - "$(sys.date),This is a report" - report_to_file => "/tmp/test_log"; + "$(sys.date),This is a report" report_to_file => "/tmp/test_log"; } diff --git a/examples/resolveconf.cf b/examples/resolveconf.cf index 11368c5065..72f1b454cf 100644 --- a/examples/resolveconf.cf +++ b/examples/resolveconf.cf @@ -1,116 +1,81 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ####################################################### # # Resolve conf # ####################################################### - bundle common g # globals { vars: + "searchlist" slist => { "search iu.hio.no", "search cfengine.com" }; + "nameservers" slist => { "128.39.89.10", "128.39.74.16", "192.168.1.103" }; - "searchlist" slist => { - "search iu.hio.no", - "search cfengine.com" - }; - - "nameservers" slist => { - "128.39.89.10", - "128.39.74.16", - "192.168.1.103" - }; classes: - - "am_name_server" expression => reglist("@(nameservers)","$(sys.ipv4[eth1])"); + "am_name_server" + expression => reglist("@(nameservers)", "$(sys.ipv4[eth1])"); } ####################################################### - body common control - { - any:: - - bundlesequence => { - "g", - resolver(@(g.searchlist),@(g.nameservers)) - }; - - domain => "iu.hio.no"; + any:: + bundlesequence => { "g", resolver(@(g.searchlist), @(g.nameservers)) }; + domain => "iu.hio.no"; } ####################################################### - -bundle agent resolver(s,n) - +bundle agent resolver(s, n) { files: - - # When passing parameters down, we have to refer to - # a source context - - "$(sys.resolv)" # test on "/tmp/resolv.conf" # - - create => "true", - edit_line => doresolv("@(this.s)","@(this.n)"), + # When passing parameters down, we have to refer to + # a source context + "$(sys.resolv)" # test on "/tmp/resolv.conf" # + create => "true", + edit_line => doresolv("@(this.s)", "@(this.n)"), edit_defaults => reconstruct; + # or edit_defaults => modify } ####################################################### # For the library ####################################################### - -bundle edit_line doresolv(s,n) - +bundle edit_line doresolv(s, n) { vars: - - "line" slist => { @(s), @(n) }; + "line" slist => { @(s), @(n) }; insert_lines: - - "$(line)"; - + "$(line)"; } ####################################################### - body edit_defaults reconstruct { - empty_file_before_editing => "true"; - edit_backup => "false"; - max_file_size => "100000"; + empty_file_before_editing => "true"; + edit_backup => "false"; + max_file_size => "100000"; } ####################################################### - body edit_defaults modify { - empty_file_before_editing => "false"; - edit_backup => "false"; - max_file_size => "100000"; + empty_file_before_editing => "false"; + edit_backup => "false"; + max_file_size => "100000"; } - - diff --git a/examples/returnszero.cf b/examples/returnszero.cf index 2fc409c66b..5a6a03338f 100644 --- a/examples/returnszero.cf +++ b/examples/returnszero.cf @@ -1,44 +1,36 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { classes: - - "my_result" expression => returnszero("/usr/local/bin/mycommand","noshell"); + "my_result" + expression => returnszero("/usr/local/bin/mycommand", "noshell"); reports: - !my_result:: - "Command failed"; - } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/reverse.cf b/examples/reverse.cf index 019c9bd09f..5053cb3c2d 100644 --- a/examples/reverse.cf +++ b/examples/reverse.cf @@ -1,47 +1,40 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } 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", }; - "reversed" slist => reverse("test"); + "reversed" slist => reverse("test"); reports: - "Original list is $(test)"; - "The reversed list is $(reversed)"; + "Original list is $(test)"; + "The reversed list is $(reversed)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/root_passwd.cf b/examples/root_passwd.cf index 5c963a05cb..b4a4632dc9 100644 --- a/examples/root_passwd.cf +++ b/examples/root_passwd.cf @@ -1,136 +1,111 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ###################################################################### # # Root password distribution # ###################################################################### - body common control - { - version => "1.2.3"; - bundlesequence => { "SetRootPassword" }; + version => "1.2.3"; + bundlesequence => { "SetRootPassword" }; } ######################################################## - bundle common g { vars: - - "secret_keys_dir" string => "/tmp"; - + "secret_keys_dir" string => "/tmp"; } ######################################################## - bundle agent SetRootPassword - { files: + "/var/cfengine/ppkeys/rootpw.txt" + copy_from => scp("$(fqhost)-root.txt", "master_host.example.org"); - "/var/cfengine/ppkeys/rootpw.txt" - - copy_from => scp("$(fqhost)-root.txt","master_host.example.org"); - - # or $(pw_class)-root.txt - - # Test this on a copy - - "/tmp/shadow" - - edit_line => SetPasswd("root"); - + # or $(pw_class)-root.txt + # Test this on a copy + "/tmp/shadow" edit_line => SetPasswd("root"); } ######################################################## - bundle edit_line SetPasswd(user) { vars: - - # Assume this file contains a single string of the form :passwdhash: - # with : delimiters to avoid end of line/file problems - - "gotpw" int => readstringarray("pw","$(sys.workdir)/ppkeys/root-pw.txt","#[^\n]*",":","3","200"); + # Assume this file contains a single string of the form :passwdhash: + # with : delimiters to avoid end of line/file problems + "gotpw" + int => readstringarray( + "pw", "$(sys.workdir)/ppkeys/root-pw.txt", "#[^\n]*", ":", "3", "200" + ); field_edits: - - "$(user).*" - + "$(user).*" # Set field of the file to parameter # File has format root:HASH: or user:HASH: - - edit_field => col(":","2","$(pw[root][1])","set"); + edit_field => col(":", "2", "$(pw[root][1])", "set"); } ######################################################## - bundle server passwords { vars: + # Read a file of format + # + # classname: host1,host2,host4,IP-address,regex.*,etc + "pw_classes" + int => readstringarray( + "acl", + "$(g.secret_keys_dir)/classes.txt", + "#[^\n]*", + ":", + "100", + "4000" + ); + + "each_pw_class" slist => getindices("acl"); - # Read a file of format - # - # classname: host1,host2,host4,IP-address,regex.*,etc - # - - "pw_classes" int => readstringarray("acl","$(g.secret_keys_dir)/classes.txt","#[^\n]*",":","100","4000"); - "each_pw_class" slist => getindices("acl"); - access: - - "/secret/keys/$(each_pw_class)-root.txt" - - admit => splitstring("$(acl[$(each_pw_class)][1])" , ":" , "100"), + "/secret/keys/$(each_pw_class)-root.txt" + admit => splitstring("$(acl[$(each_pw_class)][1])", ":", "100"), ifencrypted => "true"; - } ######################################## # Bodies ######################################## - -body edit_field col(split,col,newval,method) - +body edit_field 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 copy_from scp(from,server) - +body copy_from scp(from, server) { - source => "$(from)"; - compare => "digest"; - encrypt => "true"; - verify => "true"; + source => "$(from)"; + compare => "digest"; + encrypt => "true"; + verify => "true"; } diff --git a/examples/rxdirs.cf b/examples/rxdirs.cf index 81eeb9acdc..51d044b39e 100644 --- a/examples/rxdirs.cf +++ b/examples/rxdirs.cf @@ -4,49 +4,46 @@ bundle agent __main__ # @brief Illustrating the behavior of rxdirs in perms bodies. { vars: - "example_dirs" slist => { - "/tmp/rxdirs_example/rxdirs=default(false)-r", - "/tmp/rxdirs_example/rxdirs=default(false)-rx", - "/tmp/rxdirs_example/rxdirs=true-r", - "/tmp/rxdirs_example/rxdirs=true-rx", + "example_dirs" + slist => { + "/tmp/rxdirs_example/rxdirs=default(false)-r", + "/tmp/rxdirs_example/rxdirs=default(false)-rx", + "/tmp/rxdirs_example/rxdirs=true-r", + "/tmp/rxdirs_example/rxdirs=true-rx", }; files: - "$(example_dirs)/." - create => "true"; - - "/tmp/rxdirs_example/rxdirs=default(false)-r" - perms => example:m( 600 ); - - "/tmp/rxdirs_example/rxdirs=default(false)-rx" - perms => example:m( 700 ); - - "/tmp/rxdirs_example/rxdirs=true-r" - perms => example:m_rxdirs_on( 600 ); - - "/tmp/rxdirs_example/rxdirs=true-rx" - perms => example:m_rxdirs_on( 700 ); + "$(example_dirs)/." create => "true"; + "/tmp/rxdirs_example/rxdirs=default(false)-r" perms => example:m(600); + "/tmp/rxdirs_example/rxdirs=default(false)-rx" perms => example:m(700); + "/tmp/rxdirs_example/rxdirs=true-r" perms => example:m_rxdirs_on(600); + "/tmp/rxdirs_example/rxdirs=true-rx" perms => example:m_rxdirs_on(700); reports: - "$(example_dirs) modeoct='$(with)'" - with => filestat( $(example_dirs), modeoct ); + "$(example_dirs) modeoct='$(with)'" + with => filestat($(example_dirs), modeoct); } -body file control{ namespace => "example"; } +body file control +{ + namespace => "example"; +} body perms m(mode) # @brief Set the file mode # @param mode The new mode { - mode => "$(mode)"; + mode => "$(mode)"; } + body perms m_rxdirs_on(mode) # @brief Set the file mode and set +x on directory when +r is desired # @param mode The new mode { - inherit_from => m( $(mode) ); - rxdirs => "true"; + inherit_from => m($(mode)); + rxdirs => "true"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/select_class.cf b/examples/select_class.cf index 9eb150637c..fc5530ce2c 100644 --- a/examples/select_class.cf +++ b/examples/select_class.cf @@ -1,53 +1,37 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "g" }; - + bundlesequence => { "g" }; } ################################# - bundle common g { classes: - - "selection" select_class => { "one", "two" }; + "selection" select_class => { "one", "two" }; reports: - one:: - "One was selected"; two:: - "Two was selected"; selection:: - "A selection was made"; - } - diff --git a/examples/select_mode.cf b/examples/select_mode.cf index d7e0313b46..681d6fe19c 100644 --- a/examples/select_mode.cf +++ b/examples/select_mode.cf @@ -1,66 +1,48 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ####################################################### # # Searching for permissions # ####################################################### - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ############################################ - bundle agent example - { files: - - "/home/mark/tmp/test_from" - + "/home/mark/tmp/test_from" file_select => by_modes, transformer => "/bin/echo DETECTED $(this.promiser)", depth_search => recurse("inf"); - } ############################################ - body file_select by_modes - { - search_mode => { "711" , "666" }; - file_result => "mode"; + search_mode => { "711", "666" }; + file_result => "mode"; } ############################################ - body depth_search recurse(d) - { - depth => "$(d)"; + depth => "$(d)"; } - diff --git a/examples/select_region.cf b/examples/select_region.cf index 217c0be843..8b71cb372a 100644 --- a/examples/select_region.cf +++ b/examples/select_region.cf @@ -1,25 +1,19 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src prep #@ ``` #@ echo "MATCHING before region" > /tmp/example_select_region.txt @@ -29,48 +23,40 @@ #@ echo "MATCHING after region" >> /tmp/example_select_region.txt #@ ``` #+end_src - #+begin_src cfengine3 bundle agent main # @brief Demonstrate how edit_line can operate within a region of a file { - vars: - "file" string => "/tmp/example_select_region.txt"; - files: + "file" string => "/tmp/example_select_region.txt"; - "$(file)" - comment => "We want to delete any lines that begin with the string + files: + "$(file)" + comment => "We want to delete any lines that begin with the string MATCHING inside the region described by regular expressions matching the beginning and end of the region.", - create => "true", - edit_line => delete_inside_region("^MATCHING.*", - "^BEGIN.*", - "^END.*"); + create => "true", + edit_line => delete_inside_region("^MATCHING.*", "^BEGIN.*", "^END.*"); reports: - "$(file)" printfile => cat( $(this.promiser) ); + "$(file)" printfile => cat($(this.promiser)); } ######################################################## - bundle edit_line delete_inside_region(line_reg, begin_reg, end_reg) # @brief Delete lines matching `line_reg` when found within the expected region starting with `begin_reg` and `end_reg` { delete_lines: - - "$(line_reg)" - select_region => between( $(begin_reg), $(end_reg) ); - + "$(line_reg)" select_region => between($(begin_reg), $(end_reg)); } body select_region between(start, end) # @brief Select a region exclusively between regular expressions `start` and `end`. { - select_start => "$(start)"; - select_end => "$(end)"; + select_start => "$(start)"; + select_end => "$(end)"; @if minimum_version(3.10) - select_end_match_eof => "false"; + select_end_match_eof => "false"; @endif } @@ -78,11 +64,11 @@ 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"; } -#+end_src +#+end_src #+begin_src example_output #@ ``` #@ R: /tmp/example_select_region.txt diff --git a/examples/select_size.cf b/examples/select_size.cf index 19da8064b2..8e691fc7ea 100644 --- a/examples/select_size.cf +++ b/examples/select_size.cf @@ -1,57 +1,42 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } -# - bundle agent example { files: - - # Show files in range - - "/home/mark/tmp" - - file_select => name_and_sizes(".*cf","100","300"), + # Show files in range + "/home/mark/tmp" + file_select => name_and_sizes(".*cf", "100", "300"), depth_search => recurse("1"), transformer => "/bin/ls -l $(this.promiser)"; - } -# - -body file_select name_and_sizes(n,x,y) +body file_select name_and_sizes(n, x, y) { - leaf_name => { "$(n)" }; - search_size => irange("$(x)", "$(y)"); - file_result => "leaf_name&size"; + leaf_name => { "$(n)" }; + search_size => irange("$(x)", "$(y)"); + file_result => "leaf_name&size"; } body depth_search recurse(x) { - depth => "$(x)"; + depth => "$(x)"; } diff --git a/examples/selectservers.cf b/examples/selectservers.cf index 0afd360160..7f0fe58bac 100644 --- a/examples/selectservers.cf +++ b/examples/selectservers.cf @@ -1,70 +1,51 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - # # Testing some variable/class definitions - note scope # # Use browser -f promise_output_agent.html to view -# - body common control - { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } ########################################################### - bundle agent example - -{ +{ vars: + "hosts" + slist => { "slogans.iu.hio.no", "eternity.iu.hio.no", "nexus.iu.hio.no" }; - "hosts" slist => { "slogans.iu.hio.no", "eternity.iu.hio.no", "nexus.iu.hio.no" }; - - # selectservers(hostlist,port,sendstr,regex_on_reply,maxbytesread_reply,array_name - - "up_servers" int => selectservers("@(hosts)","80","","","100","alive_servers"); + # selectservers(hostlist,port,sendstr,regex_on_reply,maxbytesread_reply,array_name + "up_servers" + int => selectservers("@(hosts)", "80", "", "", "100", "alive_servers"); classes: - - "someone_alive" expression => isgreaterthan("$(up_servers)","0"); - - "i_am_a_server" expression => regarray("up_servers","$(host)|$(fqhost)"); + "someone_alive" expression => isgreaterthan("$(up_servers)", "0"); + "i_am_a_server" expression => regarray("up_servers", "$(host)|$(fqhost)"); reports: - someone_alive:: - "Number of active servers $(up_servers)" action => always; - "First server $(alive_servers[0]) fails over to $(alive_servers[1])"; - - } ############################################################# - body action always { - ifelapsed => "0"; + ifelapsed => "0"; } diff --git a/examples/server_callback.cf b/examples/server_callback.cf index 3383fce61e..acfdb0a3e6 100644 --- a/examples/server_callback.cf +++ b/examples/server_callback.cf @@ -1,30 +1,24 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test copy from server connection to cfServer # ######################################################## - # # run this as follows: # @@ -32,18 +26,14 @@ # cf-agent -f runtest_2.cf # # Notice that the same file configures all parts of cfengine - - ######################################################## - body common control { - bundlesequence => { "example" }; - version => "1.2.3"; + bundlesequence => { "example" }; + version => "1.2.3"; } ######################################################## - bundle agent example { vars: @@ -52,41 +42,34 @@ bundle agent example ######################################################### # Server config ######################################################### - body server control - { - allowconnects => { "127.0.0.1" , "::1" }; - allowallconnects => { "127.0.0.1" , "::1" }; - trustkeysfrom => { "127.0.0.1" , "::1" }; - call_collect_interval => "5"; + allowconnects => { "127.0.0.1", "::1" }; + allowallconnects => { "127.0.0.1", "::1" }; + trustkeysfrom => { "127.0.0.1", "::1" }; + call_collect_interval => "5"; } ######################################################### - bundle server access_rules() - { - access: - # On the policy hub am_policy_hub:: - "collect_calls" - comment => "Enable call-collect report collection for the specific client", - resource_type => "query", - admit => { "1.2.3.4" }; + comment => "Enable call-collect report collection for the specific client", + resource_type => "query", + admit => { "1.2.3.4" }; # On the isolated clients in the field any:: - "delta" - comment => "Grant access to cfengine hub to collect report deltas", - resource_type => "query", - admit => { "$(sys.policy_hub)" }; + comment => "Grant access to cfengine hub to collect report deltas", + resource_type => "query", + admit => { "$(sys.policy_hub)" }; + "full" - comment => "Grant access to cfengine hub to collect full report dump", - resource_type => "query", - admit => { "$(sys.policy_hub)" }; + comment => "Grant access to cfengine hub to collect full report dump", + resource_type => "query", + admit => { "$(sys.policy_hub)" }; } diff --git a/examples/server_copy_localhost.cf b/examples/server_copy_localhost.cf index 8c78bf92c5..3ac82881ed 100644 --- a/examples/server_copy_localhost.cf +++ b/examples/server_copy_localhost.cf @@ -1,30 +1,24 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test copy from server connection to cfServer # ######################################################## - # # run this as follows: # @@ -32,108 +26,85 @@ # cf-agent -f runtest_2.cf # # Notice that the same file configures all parts of cfengine - - ######################################################## - body common control { - bundlesequence => { "example" }; - version => "1.2.3"; - #fips_mode => "true"; + bundlesequence => { "example" }; + version => "1.2.3"; + + #fips_mode => "true"; } ######################################################## - bundle agent example { - files: - - "/tmp/testcopy" - comment => "test copy promise", - copy_from => mycopy("/tmp/test-src","127.0.0.1"), - perms => system, + files: + "/tmp/testcopy" + comment => "test copy promise", + copy_from => mycopy("/tmp/test-src", "127.0.0.1"), + perms => system, depth_search => recurse("inf"), - classes => satisfied("copy_ok"); + classes => satisfied("copy_ok"); - "/tmp/testcopy/single_file" - - comment => "test copy promise", - copy_from => mycopy("/tmp/test-src/README","127.0.0.1"), - perms => system; + "/tmp/testcopy/single_file" + comment => "test copy promise", + copy_from => mycopy("/tmp/test-src/README", "127.0.0.1"), + perms => system; reports: - copy_ok:: - "Files were copied.."; } ######################################################### - body perms system - { - mode => "0644"; + mode => "0644"; } ######################################################### - body depth_search recurse(d) - { - depth => "$(d)"; + depth => "$(d)"; } ######################################################### - -body copy_from mycopy(from,server) - +body copy_from mycopy(from, server) { - source => "$(from)"; - servers => { "$(server)" }; - compare => "digest"; - encrypt => "true"; - verify => "true"; - copy_backup => "true"; #/false/timestamp - purge => "false"; - type_check => "true"; - force_ipv4 => "true"; - trustkey => "true"; + source => "$(from)"; + servers => { "$(server)" }; + compare => "digest"; + encrypt => "true"; + verify => "true"; + copy_backup => "true"; #/false/timestamp + purge => "false"; + type_check => "true"; + force_ipv4 => "true"; + trustkey => "true"; } ######################################################### - body classes satisfied(x) { - promise_repaired => { "$(x)" }; - persist_time => "0"; + promise_repaired => { "$(x)" }; + persist_time => "0"; } ######################################################### # Server config ######################################################### - -body server control - +body server control { - allowconnects => { "127.0.0.1" , "::1" }; - allowallconnects => { "127.0.0.1" , "::1" }; - trustkeysfrom => { "127.0.0.1" , "::1" }; - # allowusers + allowconnects => { "127.0.0.1", "::1" }; + allowallconnects => { "127.0.0.1", "::1" }; + trustkeysfrom => { "127.0.0.1", "::1" }; + + # allowusers } ######################################################### - bundle server access_rules() - { - access: - - "/tmp/test-src" - - admit => { "127.0.0.1" }; + "/tmp/test-src" admit => { "127.0.0.1" }; } - - diff --git a/examples/server_copy_purge.cf b/examples/server_copy_purge.cf index 09a0056784..ba01ae98b1 100644 --- a/examples/server_copy_purge.cf +++ b/examples/server_copy_purge.cf @@ -1,31 +1,24 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test copy from server connection to cfServer # ######################################################## - # # run this as follows: # @@ -33,98 +26,75 @@ # cf-agent -f runtest_2.cf # # Notice that the same file configures all parts of cfengine - ######################################################## - body common control - { - bundlesequence => { "example" }; - version => "1.2.3"; + bundlesequence => { "example" }; + version => "1.2.3"; } ######################################################## - bundle agent example - { files: - - "/home/mark/tmp/test_to" - - comment => "test copy promise", - copy_from => mycopy("/home/mark/tmp/test_from","127.0.0.1"), - perms => system, + "/home/mark/tmp/test_to" + comment => "test copy promise", + copy_from => mycopy("/home/mark/tmp/test_from", "127.0.0.1"), + perms => system, depth_search => recurse("inf"), - classes => satisfied("copy_ok"); + classes => satisfied("copy_ok"); reports: - copy_ok:: - "Files were copied.."; } ######################################################### - body perms system - { - mode => "0644"; + mode => "0644"; } ######################################################### - body depth_search recurse(d) - { - depth => "$(d)"; + depth => "$(d)"; } ######################################################### - -body copy_from mycopy(from,server) - +body copy_from mycopy(from, server) { - source => "$(from)"; - servers => { "$(server)" }; - compare => "digest"; - verify => "true"; - copy_backup => "true"; #/false/timestamp - purge => "true"; - type_check => "true"; - force_ipv4 => "true"; - trustkey => "true"; + source => "$(from)"; + servers => { "$(server)" }; + compare => "digest"; + verify => "true"; + copy_backup => "true"; #/false/timestamp + purge => "true"; + type_check => "true"; + force_ipv4 => "true"; + trustkey => "true"; } ######################################################### - body classes satisfied(x) { - promise_repaired => { "$(x)" }; - persist_time => "0"; + promise_repaired => { "$(x)" }; + persist_time => "0"; } ######################################################### # Server config ######################################################### - -body server control - +body server control { - allowconnects => { "127.0.0.1" , "::1" }; - allowallconnects => { "127.0.0.1" , "::1" }; - trustkeysfrom => { "127.0.0.1" , "::1" }; + allowconnects => { "127.0.0.1", "::1" }; + allowallconnects => { "127.0.0.1", "::1" }; + trustkeysfrom => { "127.0.0.1", "::1" }; } ######################################################### - bundle server access_rules() - { access: - - "/home/mark/tmp" - - admit => { "127.0.0.1" }; + "/home/mark/tmp" admit => { "127.0.0.1" }; } diff --git a/examples/server_copy_remote.cf b/examples/server_copy_remote.cf index fad85208a2..99c7af9d19 100644 --- a/examples/server_copy_remote.cf +++ b/examples/server_copy_remote.cf @@ -1,32 +1,24 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - ######################################################## # # Simple test copy from server connection to cfServer # ######################################################## - # # run this as follows: # @@ -35,97 +27,75 @@ # # Notice that the same file configures all parts of cfengine # even though different parts are read by different hosts and agents - ######################################################## - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { files: - - "/tmp/testcopy" - + "/tmp/testcopy" perms => system, - copy_from => mycopy("/src/document","remote-host.example.org"), + copy_from => mycopy("/src/document", "remote-host.example.org"), depth_search => recurse("inf"); - } ######################################################## - body perms system - { - mode => "0444"; + mode => "0444"; } ######################################################### - body depth_search recurse(d) - { - depth => "$(d)"; + depth => "$(d)"; } ######################################################### - -body copy_from mycopy(from,server) - +body copy_from mycopy(from, server) { - source => "$(from)"; - #portnumber => "6789"; - servers => { "$(server)" , "failover1" }; - copy_backup => "true"; #/false/timestamp - stealth => "true"; #/on/false/off - preserve => "true"; - linkcopy_patterns => { ".*fish.*" }; - copylink_patterns => { "non-local.*"}; - compare => "mtime"; # ctime/mtime/checksum/sum/byte/binary/any - link_type => "absolute"; # /symbolic/relative/hard etc - type_check => "true"; - force_update => "false"; - force_ipv4 => "false"; - copy_size => irange("0","50000"); - trustkey => "true"; - encrypt => "true"; - verify => "true"; - purge => "false"; - findertype => "MacOSX"; + source => "$(from)"; + + #portnumber => "6789"; + servers => { "$(server)", "failover1" }; + copy_backup => "true"; #/false/timestamp + stealth => "true"; #/on/false/off + preserve => "true"; + linkcopy_patterns => { ".*fish.*" }; + copylink_patterns => { "non-local.*" }; + compare => "mtime"; # ctime/mtime/checksum/sum/byte/binary/any + link_type => "absolute"; # /symbolic/relative/hard etc + type_check => "true"; + force_update => "false"; + force_ipv4 => "false"; + copy_size => irange("0", "50000"); + trustkey => "true"; + encrypt => "true"; + verify => "true"; + purge => "false"; + findertype => "MacOSX"; } ######################################################### # Server config ######################################################### - -body server control - +body server control { - allowconnects => { "1.2.3.4" , "::1" }; - allowallconnects => { "1.2.3.4" , "::1" }; - trustkeysfrom => { "1.2.3.4" , "::1" }; - # allowusers + allowconnects => { "1.2.3.4", "::1" }; + allowallconnects => { "1.2.3.4", "::1" }; + trustkeysfrom => { "1.2.3.4", "::1" }; + + # allowusers } ######################################################### - bundle server access_rules() - { - access: - - # Grant access to the remote client to access the source docs - - "/src" admit => { "1.2.3.4" }; + # Grant access to the remote client to access the source docs + "/src" admit => { "1.2.3.4" }; } - - - diff --git a/examples/server_flatcopy_localhost.cf b/examples/server_flatcopy_localhost.cf index 5abd95241a..8701f2e5a4 100644 --- a/examples/server_flatcopy_localhost.cf +++ b/examples/server_flatcopy_localhost.cf @@ -1,31 +1,24 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test copy from server connection to cfServer # ######################################################## - # # run this as follows: # @@ -33,106 +26,83 @@ # cf-agent -f runtest_2.cf # # Notice that the same file configures all parts of cfengine - ######################################################## - body common control - { - bundlesequence => { "example" }; - version => "1.2.3"; + bundlesequence => { "example" }; + version => "1.2.3"; } ######################################################## - bundle agent example - { files: - - "/home/mark/tmp/testflatcopy" - - comment => "test copy promise", - copy_from => mycopy("/home/mark/LapTop/words","127.0.0.1"), - perms => system, + "/home/mark/tmp/testflatcopy" + comment => "test copy promise", + copy_from => mycopy("/home/mark/LapTop/words", "127.0.0.1"), + perms => system, depth_search => recurse("inf"), - classes => satisfied("copy_ok"); - - - "/home/mark/tmp/testcopy/single_file" + classes => satisfied("copy_ok"); - comment => "test copy promise", - copy_from => mycopy("/home/mark/LapTop/Cfengine3/trunk/README","127.0.0.1"), - perms => system; + "/home/mark/tmp/testcopy/single_file" + comment => "test copy promise", + copy_from => mycopy( + "/home/mark/LapTop/Cfengine3/trunk/README", "127.0.0.1" + ), + perms => system; reports: - copy_ok:: - "Files were copied.."; } ######################################################### - body perms system - { - mode => "0644"; + mode => "0644"; } ######################################################### - body depth_search recurse(d) - { - depth => "$(d)"; + depth => "$(d)"; } ######################################################### - -body copy_from mycopy(from,server) - +body copy_from mycopy(from, server) { - source => "$(from)"; - servers => { "$(server)" }; - compare => "digest"; - verify => "true"; - copy_backup => "true"; #/false/timestamp - purge => "false"; - type_check => "true"; - force_ipv4 => "true"; - trustkey => "true"; - collapse_destination_dir => "true"; + source => "$(from)"; + servers => { "$(server)" }; + compare => "digest"; + verify => "true"; + copy_backup => "true"; #/false/timestamp + purge => "false"; + type_check => "true"; + force_ipv4 => "true"; + trustkey => "true"; + collapse_destination_dir => "true"; } ######################################################### - body classes satisfied(x) { - promise_repaired => { "$(x)" }; - persist_time => "0"; + promise_repaired => { "$(x)" }; + persist_time => "0"; } ######################################################### # Server config ######################################################### - -body server control - +body server control { - allowconnects => { "127.0.0.1" , "::1" }; - allowallconnects => { "127.0.0.1" , "::1" }; - trustkeysfrom => { "127.0.0.1" , "::1" }; + allowconnects => { "127.0.0.1", "::1" }; + allowallconnects => { "127.0.0.1", "::1" }; + trustkeysfrom => { "127.0.0.1", "::1" }; } ######################################################### - bundle server access_rules() - { access: - - "/home/mark/LapTop" - - admit => { "127.0.0.1" }; + "/home/mark/LapTop" admit => { "127.0.0.1" }; } diff --git a/examples/service_catalogue.cf b/examples/service_catalogue.cf index b60e12eb8c..47e163647d 100644 --- a/examples/service_catalogue.cf +++ b/examples/service_catalogue.cf @@ -1,59 +1,44 @@ body common control { - bundlesequence => { "service_catalogue" }; + bundlesequence => { "service_catalogue" }; } - bundle agent service_catalogue { services: - "syslog" service_policy => "start"; - "www" service_policy => "stop"; + "syslog" service_policy => "start"; + "www" service_policy => "stop"; } - - bundle agent standard_services(service, state) { vars: - debian:: - - "startcommand[www]" string => "/etc/init.d/apache2 start"; - "stopcommand[www]" string => "/etc/init.d/apache2 stop"; - "processname[www]" string => "apache2"; - - "startcommand[syslog]" string => "/etc/init.d/rsyslog start"; - "stopcommand[syslog]" string => "/etc/init.d/rsyslog stop"; - "processname[syslog]" string => "rsyslogd"; - + "startcommand[www]" string => "/etc/init.d/apache2 start"; + "stopcommand[www]" string => "/etc/init.d/apache2 stop"; + "processname[www]" string => "apache2"; + "startcommand[syslog]" string => "/etc/init.d/rsyslog start"; + "stopcommand[syslog]" string => "/etc/init.d/rsyslog stop"; + "processname[syslog]" string => "rsyslogd"; classes: - - "start" expression => strcmp("start","$(state)"); - "stop" expression => strcmp("stop","$(state)"); + "start" expression => strcmp("start", "$(state)"); + "stop" expression => strcmp("stop", "$(state)"); processes: - start:: - ".*$(processname[$(service)]).*" - - comment => "Verify that the service appears in the process table", - restart_class => "restart_$(service)"; + comment => "Verify that the service appears in the process table", + restart_class => "restart_$(service)"; stop:: - ".*$(processname[$(service)]).*" - - comment => "Verify that the service does not appear in the process table", - process_stop => "$(stopcommand[$(service)])", - signals => { "term", "kill"}; + comment => "Verify that the service does not appear in the process table", + process_stop => "$(stopcommand[$(service)])", + signals => { "term", "kill" }; commands: - - "$(startcommand[$(service)])" - + "$(startcommand[$(service)])" comment => "Execute command to restart the $(service) service", if => "restart_$(service)"; } diff --git a/examples/service_catalogue_separate.cf b/examples/service_catalogue_separate.cf index 258c378447..983938c0af 100644 --- a/examples/service_catalogue_separate.cf +++ b/examples/service_catalogue_separate.cf @@ -1,33 +1,33 @@ body common control { - bundlesequence => { "service_catalogue_separate" }; + bundlesequence => { "service_catalogue_separate" }; } - bundle agent service_catalogue_separate { services: - "foo" service_policy => "start", + "foo" + service_policy => "start", service_method => service_bundle_separate; - "bar" service_policy => "stop", + "bar" + service_policy => "stop", service_method => service_bundle_separate; } body service_method service_bundle_separate { - service_bundle => $(this.promiser)("$(this.service_policy)"); + service_bundle => $(this.promiser)("$(this.service_policy)"); } - bundle agent foo(service_policy) { reports: - "we need to ensure $(service_policy) of foo"; + "we need to ensure $(service_policy) of foo"; } bundle agent bar(service_policy) { reports: - "we need to ensure $(service_policy) of bar"; + "we need to ensure $(service_policy) of bar"; } diff --git a/examples/service_disable.cf b/examples/service_disable.cf index 629fdae511..ef40e61eb0 100644 --- a/examples/service_disable.cf +++ b/examples/service_disable.cf @@ -1,44 +1,32 @@ # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - body common control - { - bundlesequence => { "winservice" }; + bundlesequence => { "winservice" }; } ########################################################### - bundle agent winservice - { vars: - - "bad_services" slist => { "Alerter", "ClipSrv" }; + "bad_services" slist => { "Alerter", "ClipSrv" }; services: - windows:: - "$(bad_services)" - - service_policy => "disable", - comment => "Disable services that create security issues"; + service_policy => "disable", + comment => "Disable services that create security issues"; } diff --git a/examples/service_start.cf b/examples/service_start.cf index a7544832ff..d0c3aa398a 100644 --- a/examples/service_start.cf +++ b/examples/service_start.cf @@ -1,26 +1,23 @@ -body common control -{ - bundlesequence => { "example" }; -} - +body common control +{ + bundlesequence => { "example" }; +} + ############################################# - -bundle agent example -{ - services: - - "Themes" - service_policy => "start", - service_dependencies => { "Alerter" }, - service_method => exmethod; -} - +bundle agent example +{ + services: + "Themes" + service_policy => "start", + service_dependencies => { "Alerter" }, + service_method => exmethod; +} + ############################################# - -body service_method exmethod -{ - service_type => "windows"; - service_args => "-f \"the file with spaces.cf\" --some-args"; - service_autostart_policy => "boot_time"; - service_dependence_chain => "start_parent_services"; -} +body service_method exmethod +{ + service_type => "windows"; + service_args => "-f \"the file with spaces.cf\" --some-args"; + service_autostart_policy => "boot_time"; + service_dependence_chain => "start_parent_services"; +} diff --git a/examples/services.cf b/examples/services.cf index edf58503f6..5ca211e861 100644 --- a/examples/services.cf +++ b/examples/services.cf @@ -8,22 +8,21 @@ bundle agent main # services { vars: - linux:: "enable[ssh]" - string => ifelse( "debian|ubuntu", "ssh", "sshd"), + string => ifelse("debian|ubuntu", "ssh", "sshd"), comment => "The name of the ssh service varies on different platforms. Here we set the name of the service based on existing classes and defaulting to `sshd`"; "disable[apache]" - string => ifelse( "debian|ubuntu", "apache2", "httpd" ), + string => ifelse("debian|ubuntu", "apache2", "httpd"), comment => "The name of the apache web service varies on different platforms. Here we set the name of the service based on existing classes and defaulting to `httpd`"; "enable[cron]" - string => ifelse( "debian|ubuntu", "cron", "crond" ), + string => ifelse("debian|ubuntu", "cron", "crond"), comment => "The name of the cron service varies on different platforms. Here we set the name of the service based on existing classes and defaulting to `crond`"; @@ -32,13 +31,11 @@ bundle agent main string => "cups", comment => "Printing services are not needed on most hosts."; - "enabled" slist => getvalues( enable ); - "disabled" slist => getvalues( disable ); + "enabled" slist => getvalues(enable); + "disabled" slist => getvalues(disable); services: - linux:: - "$(enabled)" -> { "SysOps" } service_policy => "start", comment => "These services should be running because x, y or z."; @@ -48,7 +45,6 @@ bundle agent main comment => "These services should not be running because x, y or z."; systemd:: - "sysstat" service_policy => "stop", comment => "Standard service handling for sysstat only works with diff --git a/examples/services_concept.cf b/examples/services_concept.cf index 9955b4fe06..bcfeefaa25 100644 --- a/examples/services_concept.cf +++ b/examples/services_concept.cf @@ -1,126 +1,96 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ##################################################################### # # Concept of standard services promises # ##################################################################### - body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } -# - bundle agent example { vars: - - "mail" slist => { "milter", "spamassassin", "postfix" }; - + "mail" slist => { "milter", "spamassassin", "postfix" }; services: - - "www" service_policy => "start", + "www" + service_policy => "start", service_method => service_test; - "$(mail)" service_policy => "stop", + "$(mail)" + service_policy => "stop", service_method => service_test; - } #################################################################### - body service_method service_test { - service_bundle => non_standard_services("$(this.promiser)","$(this.service_policy)"); + service_bundle => non_standard_services( + "$(this.promiser)", "$(this.service_policy)" + ); } #################################################################### - -bundle agent standard_services(service,state) +bundle agent standard_services(service, state) { - # DATA, - + # DATA, vars: - suse|redhat:: - - "startcommand[www]" string => "/etc/init.d/apache2 start"; - "stopcommand[www]" string => "/etc/init.d/apache2 stop"; + "startcommand[www]" string => "/etc/init.d/apache2 start"; + "stopcommand[www]" string => "/etc/init.d/apache2 stop"; debian|ubuntu:: - - "startcommand[www]" string => "/etc/init.d/httpd start"; - "stopcommand[www]" string => "/etc/init.d/httpd stop"; + "startcommand[www]" string => "/etc/init.d/httpd start"; + "stopcommand[www]" string => "/etc/init.d/httpd stop"; linux:: - "startcommand[postfix]" string => "/etc/init.d/postfix start"; - "stopcommand[postfix]" string => "/etc/init.d/postfix stop"; - - - # METHODS + "stopcommand[postfix]" string => "/etc/init.d/postfix stop"; + # METHODS classes: - - "start" expression => strcmp("start","$(state)"); - "stop" expression => strcmp("stop","$(state)"); + "start" expression => strcmp("start", "$(state)"); + "stop" expression => strcmp("stop", "$(state)"); processes: - start:: - ".*$(service).*" - - comment => "Verify that the service appears in the process table", - restart_class => "restart_$(service)"; + comment => "Verify that the service appears in the process table", + restart_class => "restart_$(service)"; stop:: - ".*$(service).*" - - comment => "Verify that the service does not appear in the process", - process_stop => "$(stopcommand[$(service)])", - signals => { "term", "kill"}; + comment => "Verify that the service does not appear in the process", + process_stop => "$(stopcommand[$(service)])", + signals => { "term", "kill" }; commands: - - "$(startcommand[$(service)])" - + "$(startcommand[$(service)])" comment => "Execute command to restart the $(service) service", if => "restart_$(service)"; - } ###################################################################### - -bundle agent non_standard_services(service,state) +bundle agent non_standard_services(service, state) { reports: - !done:: - "Test service promise for \"$(service)\" -> $(state)"; } diff --git a/examples/services_default_service_bundle.cf b/examples/services_default_service_bundle.cf index 2adeafc400..d798b88f6f 100644 --- a/examples/services_default_service_bundle.cf +++ b/examples/services_default_service_bundle.cf @@ -2,20 +2,22 @@ bundle agent main # @brief Example showing how service_bundle is defaulted. { services: - "my-custom-service" + "my-custom-service" service_method => my_custom_service, service_policy => "stop"; } body service_method my_custom_service { - service_bundle => service_my_custom_service($(this.promiser), $(this.service_policy)); + service_bundle => service_my_custom_service( + $(this.promiser), $(this.service_policy) + ); } bundle agent service_my_custom_service(service, state) { reports: - "$(service) should have state $(state)"; + "$(service) should have state $(state)"; } ############################################################################### @@ -24,4 +26,3 @@ bundle agent service_my_custom_service(service, state) #@ R: my-custom-service should have state stop #@ ``` #+end_src - diff --git a/examples/services_win.cf b/examples/services_win.cf index 561e676979..9c897eb9e6 100644 --- a/examples/services_win.cf +++ b/examples/services_win.cf @@ -3,53 +3,41 @@ # win_services.cf - Windows Service Management # ######################################################################### - -body file control -{ - inputs => { "$(sys.libdir)/stdlib.cf" }; -} - -bundle agent win_services -{ - vars: - - # NOTE: Use "Service Name" (not "Display Name"); - # Administrative Tools -> Services -> Double Click on one to see its name - - "bad_services" slist => { - "RemoteRegistry" - }; - - - Windows_Server_2003_R2:: - - "autostart_services" slist => { - "Alerter", - "W32Time" # Windows Time - }; - - Windows_Server_2008:: - - "autostart_services" slist => { - "MpsSvc", # Windows Firewall - "W32Time" # Windows Time - }; - - - services: - - "$(bad_services)" - service_policy => "disable", - service_method => force_deps, - comment => "Disable services that create security issues"; - - - Windows_Server_2003_R2|Windows_Server_2008:: - - "$(autostart_services)" - service_policy => "start", - service_method => bootstart, - comment => "Make sure important services are running and set to start at boot time"; - -} - +body file control +{ + inputs => { "$(sys.libdir)/stdlib.cf" }; +} + +bundle agent win_services +{ + vars: + # NOTE: Use "Service Name" (not "Display Name"); + # Administrative Tools -> Services -> Double Click on one to see its name + "bad_services" slist => { "RemoteRegistry" }; + + Windows_Server_2003_R2:: + "autostart_services" + slist => { + "Alerter", + "W32Time", # Windows Time + }; + + Windows_Server_2008:: + "autostart_services" + slist => { + "MpsSvc", # Windows Firewall + "W32Time", # Windows Time + }; + + services: + "$(bad_services)" + service_policy => "disable", + service_method => force_deps, + comment => "Disable services that create security issues"; + + Windows_Server_2003_R2|Windows_Server_2008:: + "$(autostart_services)" + service_policy => "start", + service_method => bootstart, + comment => "Make sure important services are running and set to start at boot time"; +} diff --git a/examples/setuidlog.cf b/examples/setuidlog.cf index 5f8c06873a..f3ae0e3575 100644 --- a/examples/setuidlog.cf +++ b/examples/setuidlog.cf @@ -1,61 +1,43 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { files: - - "/home/mark/tmp" -> "me" - - changes => tripwire, + "/home/mark/tmp" -> "me" + changes => tripwire, depth_search => recurse("1"); - } - ######################################################### - body changes tripwire - { - hash => "md5"; - report_changes => "content"; - update_hashes => "true"; + hash => "md5"; + report_changes => "content"; + update_hashes => "true"; } ######################################################### - body depth_search recurse(d) - { - depth => "$(d)"; + depth => "$(d)"; } diff --git a/examples/setvar.cf b/examples/setvar.cf index 84554960a1..3bacefbb3b 100644 --- a/examples/setvar.cf +++ b/examples/setvar.cf @@ -1,56 +1,40 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "setvars" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "setvars" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } bundle agent setvars { vars: - - # want to set these values by the names of their array keys - - "rhs[lhs1]" string => " Mary had a little pig"; - "rhs[lhs2]" string => "Whose Fleece was white as snow"; - "rhs[lhs3]" string => "And everywhere that Mary went"; - - "rhs[net/ipv4/tcp_syncookies]" string => "1"; - "rhs[net/ipv4/icmp_echo_ignore_broadcasts]" string => "1"; - "rhs[net/ipv4/ip_forward]" string => "0"; - - # oops, now change pig -> lamb - + # want to set these values by the names of their array keys + "rhs[lhs1]" string => " Mary had a little pig"; + "rhs[lhs2]" string => "Whose Fleece was white as snow"; + "rhs[lhs3]" string => "And everywhere that Mary went"; + "rhs[net/ipv4/tcp_syncookies]" string => "1"; + "rhs[net/ipv4/icmp_echo_ignore_broadcasts]" string => "1"; + "rhs[net/ipv4/ip_forward]" string => "0"; + + # oops, now change pig -> lamb files: - - - "/tmp/system" - + "/tmp/system" comment => "Create a file of variable assignments and manage this file", create => "true", edit_line => set_variable_values("setvars.rhs"); - } - diff --git a/examples/shuffle.cf b/examples/shuffle.cf index d8a96f91d7..6b625f2b97 100644 --- a/examples/shuffle.cf +++ b/examples/shuffle.cf @@ -1,44 +1,37 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test { vars: - "mylist" slist => { "b", "c", "a" }; - "seeds" slist => { "xx", "yy", "zz" }; - - "shuffled_$(seeds)" slist => shuffle(mylist, $(seeds)); - - "joined_$(seeds)" string => join(",", "shuffled_$(seeds)"); + "mylist" slist => { "b", "c", "a" }; + "seeds" slist => { "xx", "yy", "zz" }; + "shuffled_$(seeds)" slist => shuffle(mylist, $(seeds)); + "joined_$(seeds)" string => join(",", "shuffled_$(seeds)"); reports: - "shuffled RANDOMLY by $(seeds) = '$(joined_$(seeds))'"; + "shuffled RANDOMLY by $(seeds) = '$(joined_$(seeds))'"; } + #+end_src ############################################################################### # Not checked because shuffle is random. diff --git a/examples/simple_ssh_key_distribution.cf b/examples/simple_ssh_key_distribution.cf index 0ee199c906..bf928c949c 100644 --- a/examples/simple_ssh_key_distribution.cf +++ b/examples/simple_ssh_key_distribution.cf @@ -1,7 +1,7 @@ body common control { - bundlesequence => { "autorun_ssh_key_distribution" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "autorun_ssh_key_distribution" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } bundle common ssh_key_info @@ -33,8 +33,8 @@ bundle agent autorun_ssh_key_distribution methods: "Distribute SSH Keys" - usebundle => ssh_key_distribution( $(users) ), - if => userexists( $(users) ), + usebundle => ssh_key_distribution($(users)), + if => userexists($(users)), comment => "It's important that we make sure each of these users ssh_authorized_keys file has the correct content and permissions so that they can successfully log in, if @@ -47,27 +47,28 @@ bundle agent ssh_key_distribution(users) "description" string => "Ensure that specified users are able to log in using their ssh keys"; + vars: # We get the users UID so that we can set permission appropriately - "uid[$(users)]" int => getuid( $(users) ); + "uid[$(users)]" int => getuid($(users)); files: "/home/$(users)/.ssh/." create => "true", - perms => mo( 700, "$(uid[$(users)])"), + perms => mo(700, "$(uid[$(users)])"), comment => "It is important to set the proper restrictive permissions and ownership so that the ssh authorized_keys feature works correctly."; "/home/$(users)/.ssh/authorized_keys" - perms => mo( 600, "$(uid[$(users)])" ), - copy_from => remote_dcp( "$(ssh_key_info.repo_path)/$(users)", - $(ssh_key_info.key_server) ), + perms => mo(600, "$(uid[$(users)])"), + copy_from => remote_dcp( + "$(ssh_key_info.repo_path)/$(users)", $(ssh_key_info.key_server) + ), comment => "We centrally manage and users authorized keys. We source each users complete authorized_keys file from the central server."; } - bundle server ssh_key_access_rules { meta: diff --git a/examples/software_dist.cf b/examples/software_dist.cf index 3c059ffde3..06963b99a4 100644 --- a/examples/software_dist.cf +++ b/examples/software_dist.cf @@ -1,23 +1,18 @@ # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################################### # # software_local.cf - Application Deployment From Directory Repository @@ -45,131 +40,122 @@ # "cfengine-nova-1.1.2-i686.msi". # ######################################################################### - -body common control -{ - inputs => { "$(sys.libdir)/stdlib.cf" }; - bundlesequence => { "check_software" }; -} - -bundle agent check_software -{ - vars: - - # software to install if not installed - "include_software" slist => { - "7-zip-4.50-$(sys.arch).msi" - }; - - # this software gets updated if it is installed - "autoupdate_software" slist => { - "7-zip" - }; - - # software to uninstall if it is installed - "exclude_software" slist => { - "7-zip-4.65-$(sys.arch).msi" - }; - - methods: +body common control +{ + inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "check_software" }; +} + +bundle agent check_software +{ + vars: + # software to install if not installed + "include_software" slist => { "7-zip-4.50-$(sys.arch).msi" }; + + # this software gets updated if it is installed + "autoupdate_software" slist => { "7-zip" }; + + # software to uninstall if it is installed + "exclude_software" slist => { "7-zip-4.65-$(sys.arch).msi" }; + + methods: + # TODO: Fix the following bundles, msi_implicit is giving errors: - # "any" usebundle => add_software( "@(check_software.include_software)", "$(sys.policy_hub)" ); - # "any" usebundle => update_software( "@(check_software.autoupdate_software)", "$(sys.policy_hub)" ); - # "any" usebundle => remove_software( "@(check_software.exclude_software)", "$(sys.policy_hub)" ); -} - + # "any" usebundle => add_software( "@(check_software.include_software)", "$(sys.policy_hub)" ); + # "any" usebundle => update_software( "@(check_software.autoupdate_software)", "$(sys.policy_hub)" ); + # "any" usebundle => remove_software( "@(check_software.exclude_software)", "$(sys.policy_hub)" ); +} + ######################################################################### - -bundle agent add_software(pkg_name, srv) -{ - vars: - # dir to install from locally - can also check multiple directories - "local_software_dir" string => "C:\Program Files\Cfengine\software\add"; - - files: - - "$(local_software_dir)" - copy_from => remote_cp("/var/cfengine/master_software_updates/$(sys.flavour)_$(sys.arch)/add", "$(srv)"), - depth_search => recurse("1"), - classes => if_repaired("got_newpkg"), - comment => "Copy software from remote repository"; - - - packages: - - # When to check if the package is installed ? - got_newpkg|any:: - "$(pkg_name)" - package_policy => "add", - package_method => msi_implicit( "$(local_software_dir)" ), - classes => if_else("add_success", "add_fail" ), - comment => "Install new software, if not already present"; - - reports: - add_fail:: - "Failed to install one or more packages"; -} - +bundle agent add_software(pkg_name, srv) +{ + vars: + # dir to install from locally - can also check multiple directories + "local_software_dir" string => "C:\Program Files\Cfengine\software\add"; + + files: + "$(local_software_dir)" + copy_from => remote_cp( + "/var/cfengine/master_software_updates/$(sys.flavour)_$(sys.arch)/add", + "$(srv)" + ), + depth_search => recurse("1"), + classes => if_repaired("got_newpkg"), + comment => "Copy software from remote repository"; + + packages: + # When to check if the package is installed ? + got_newpkg|any:: + "$(pkg_name)" + package_policy => "add", + package_method => msi_implicit("$(local_software_dir)"), + classes => if_else("add_success", "add_fail"), + comment => "Install new software, if not already present"; + + reports: + add_fail:: + "Failed to install one or more packages"; +} + ######################################################################### - -bundle agent update_software(sw_names, srv) -{ - vars: - # dir to install from locally - can also check multiple directories - "local_software_dir" string => "C:\Program Files\Cfengine\software\update"; - - files: - - "$(local_software_dir)" - copy_from => remote_cp("/var/cfengine/master_software_updates/$(sys.flavour)_$(sys.arch)/update", "$(srv)"), - depth_search => recurse("1"), - classes => if_repaired("got_newpkg"), - comment => "Copy software updates from remote repository"; - - - packages: - - # When to check if the package is updated ? - got_newpkg|any:: - "$(sw_names)" - package_policy => "update", - package_select => ">=", # picks the newest update available - package_architectures => { "$(sys.arch)" }, # install 32 or 64 bit package ? - package_version => "1.0", # at least version 1.0 - package_method => msi_explicit( "$(local_software_dir)" ), - classes => if_else("update_success", "update_fail"); - - - reports: - update_fail:: - "Failed to update one or more packages"; -} - +bundle agent update_software(sw_names, srv) +{ + vars: + # dir to install from locally - can also check multiple directories + "local_software_dir" string => "C:\Program Files\Cfengine\software\update"; + + files: + "$(local_software_dir)" + copy_from => remote_cp( + "/var/cfengine/master_software_updates/$(sys.flavour)_$(sys.arch)/update", + "$(srv)" + ), + depth_search => recurse("1"), + classes => if_repaired("got_newpkg"), + comment => "Copy software updates from remote repository"; + + packages: + # When to check if the package is updated ? + got_newpkg|any:: + "$(sw_names)" + package_policy => "update", + package_select => ">=", # picks the newest update available + package_architectures => { "$(sys.arch)" }, # install 32 or 64 bit package ? + package_version => "1.0", # at least version 1.0 + package_method => msi_explicit("$(local_software_dir)"), + classes => if_else("update_success", "update_fail"); + + reports: + update_fail:: + "Failed to update one or more packages"; +} + ######################################################################### - -bundle agent remove_software(pkg_name, srv) -{ - vars: - # dir to install from locally - can also check multiple directories - "local_software_dir" string => "C:\Program Files\Cfengine\software\remove"; - - files: - - "$(local_software_dir)" - copy_from => remote_cp("/var/cfengine/master_software_updates/$(sys.flavour)_$(sys.arch)/remove", "$(srv)"), - depth_search => recurse("1"), - classes => if_repaired("got_newpkg"), - comment => "Copy removable software from remote repository"; - - packages: - got_newpkg:: - "$(pkg_name)" - package_policy => "delete", - package_method => msi_implicit( "$(local_software_dir)" ), - classes => if_else("remove_success", "remove_fail" ), - comment => "Remove software, if present"; - - reports: - remove_fail:: - "Failed to remove one or more packages"; -} +bundle agent remove_software(pkg_name, srv) +{ + vars: + # dir to install from locally - can also check multiple directories + "local_software_dir" string => "C:\Program Files\Cfengine\software\remove"; + + files: + "$(local_software_dir)" + copy_from => remote_cp( + "/var/cfengine/master_software_updates/$(sys.flavour)_$(sys.arch)/remove", + "$(srv)" + ), + depth_search => recurse("1"), + classes => if_repaired("got_newpkg"), + comment => "Copy removable software from remote repository"; + + packages: + got_newpkg:: + "$(pkg_name)" + package_policy => "delete", + package_method => msi_implicit("$(local_software_dir)"), + classes => if_else("remove_success", "remove_fail"), + comment => "Remove software, if present"; + + reports: + remove_fail:: + "Failed to remove one or more packages"; +} diff --git a/examples/software_update_version_yum.cf b/examples/software_update_version_yum.cf index 3df34b742e..710ef62946 100644 --- a/examples/software_update_version_yum.cf +++ b/examples/software_update_version_yum.cf @@ -1,55 +1,45 @@ -# # Schedule software update for yum-based distributions (e.g. RedHat, CentOS) # Will only update to the given package_version assumed to be found in the yum repository. # If installed version is the same as package_version or newer, no action is taken. -# - body common control { - bundlesequence => { "system_software" }; + bundlesequence => { "system_software" }; } - bundle agent system_software { classes: - "update_hosts" expression => "host1|host2"; - "update_schedule" expression => "Day27.Hr02.Min00_05"; + "update_hosts" expression => "host1|host2"; + "update_schedule" expression => "Day27.Hr02.Min00_05"; packages: update_hosts.update_schedule:: "bash" - comment => "Make sure bash package is updated to right version", - handle => "package_bash_update", - package_version => "3.2-32.el5", - package_architectures => { "x86_64" }, - package_policy => "addupdate", - package_select => ">=", - package_method => yum_version; - + comment => "Make sure bash package is updated to right version", + handle => "package_bash_update", + package_version => "3.2-32.el5", + package_architectures => { "x86_64" }, + package_policy => "addupdate", + package_select => ">=", + package_method => yum_version; } - body package_method yum_version { - package_changes => "bulk"; - package_list_command => "/bin/rpm -qa --qf '%{name} %{version}-%{release} %{arch}\n'"; - package_patch_list_command => "/usr/bin/yum check-update"; - - 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_name_convention => "$(name)-$(version).$(arch)"; - - package_patch_installed_regex => "^\s.*"; - package_patch_name_regex => "([^.]+).*"; - package_patch_version_regex => "[^\s]\s+([^\s]+).*"; - package_patch_arch_regex => "[^.]+\.([^\s]+).*"; - - package_add_command => "/usr/bin/yum -y install"; - package_update_command => "/usr/bin/yum -y update"; - package_delete_command => "/bin/rpm -e --nodeps --allmatches"; - package_verify_command => "/bin/rpm -V"; + package_changes => "bulk"; + package_list_command => "/bin/rpm -qa --qf '%{name} %{version}-%{release} %{arch}\n'"; + package_patch_list_command => "/usr/bin/yum check-update"; + 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_name_convention => "$(name)-$(version).$(arch)"; + package_patch_installed_regex => "^\s.*"; + package_patch_name_regex => "([^.]+).*"; + package_patch_version_regex => "[^\s]\s+([^\s]+).*"; + package_patch_arch_regex => "[^.]+\.([^\s]+).*"; + package_add_command => "/usr/bin/yum -y install"; + package_update_command => "/usr/bin/yum -y update"; + package_delete_command => "/bin/rpm -e --nodeps --allmatches"; + package_verify_command => "/bin/rpm -V"; } diff --git a/examples/some.cf b/examples/some.cf index bbcfa210d6..27289cb6a1 100644 --- a/examples/some.cf +++ b/examples/some.cf @@ -1,96 +1,106 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test { classes: - - # This is an easy way to check if a list is empty, better than - # expression => strcmp(length(x), "0") - - # Note that if you use length() or none() or every() they will - # go through all the elements!!! some() returns as soon as any - # element matches. - "empty_x" not => some(".*", x); - "empty_y" not => some(".*", y); - - "some11" expression => some("long string", test1); - "some12" expression => some("none", test1); - "some21" expression => some("long string", test2); - "some22" expression => some("none", test2); + # This is an easy way to check if a list is empty, better than + # expression => strcmp(length(x), "0") + # Note that if you use length() or none() or every() they will + # go through all the elements!!! some() returns as soon as any + # element matches. + "empty_x" not => some(".*", x); + "empty_y" not => some(".*", y); + "some11" expression => some("long string", test1); + "some12" expression => some("none", test1); + "some21" expression => some("long string", test2); + "some22" expression => some("none", test2); vars: - "x" slist => { "a", "b" }; - "y" slist => { }; - - "test1" slist => { - 1,2,3, - "one", "two", "three", - "long string", - "four", "fix", "six", - "one", "two", "three", + "x" slist => { "a", "b" }; + "y" slist => {}; + + "test1" + slist => { + 1, + 2, + 3, + "one", + "two", + "three", + "long string", + "four", + "fix", + "six", + "one", + "two", + "three", }; - - "test2" data => parsejson('[1,2,3, + "test2" + data => parsejson( + '[1,2,3, "one", "two", "three", "long string", "four", "fix", "six", - "one", "two", "three",]'); + "one", "two", "three",]' + ); reports: empty_x:: "x has no elements"; + empty_y:: "y has no elements"; any:: "The test1 list is $(test1)"; + some11:: "some() test1 1 passed"; + !some11:: "some() test1 1 failed"; + some12:: "some() test1 2 failed"; + !some12:: "some() test1 2 passed"; - "The test2 list is $(test2)"; + some21:: "some() test2 1 passed"; + !some21:: "some() test2 1 failed"; + some22:: "some() test2 2 failed"; + !some22:: "some() test2 2 passed"; - } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/sort.cf b/examples/sort.cf index 4ed79f00f9..0750e09b0d 100644 --- a/examples/sort.cf +++ b/examples/sort.cf @@ -1,100 +1,119 @@ #+begin_src cfengine3 body common control { - bundlesequence => { test }; + bundlesequence => { test }; } bundle agent test { vars: - "a" slist => { "b", "c", "a" }; - "b" slist => { "100", "9", "10", "8.23" }; - "c" slist => { }; - "d" slist => { "", "a", "", "b" }; - "e" slist => { "a", "1", "b" }; + "a" slist => { "b", "c", "a" }; + "b" slist => { "100", "9", "10", "8.23" }; + "c" slist => {}; + "d" slist => { "", "a", "", "b" }; + "e" slist => { "a", "1", "b" }; - "ips" 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?" }; + "ips" + 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?", + }; - "macs" 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?" }; + "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?", + }; - "ja" string => join(",", "a"); - "jb" string => join(",", "b"); - "jc" string => join(",", "c"); - "jd" string => join(",", "d"); - "je" string => join(",", "e"); + "macs" + 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?", + }; - "jips" string => join(",", "ips"); - "jipv6" string => join(",", "ipv6"); - "jmacs" string => join(",", "macs"); - - "sa" slist => sort("a", "lex"); - "sb" slist => sort("b", "lex"); - "sc" slist => sort("c", "lex"); - "sd" slist => sort("d", "lex"); - "se" slist => sort("e", "lex"); - - "sb_int" slist => sort("b", "int"); - "sb_real" slist => sort("b", "real"); - - "sips" slist => sort("ips", "ip"); - "sipv6" slist => sort("ipv6", "ip"); - "smacs" slist => sort("macs", "mac"); - - - "jsa" string => join(",", "sa"); - "jsb" string => join(",", "sb"); - "jsc" string => join(",", "sc"); - "jsd" string => join(",", "sd"); - "jse" string => join(",", "se"); - - "jsb_int" string => join(",", "sb_int"); - "jsb_real" string => join(",", "sb_real"); - - "jsips" string => join(",", "sips"); - "jsipv6" string => join(",", "sipv6"); - "jsmacs" string => join(",", "smacs"); + "ja" string => join(",", "a"); + "jb" string => join(",", "b"); + "jc" string => join(",", "c"); + "jd" string => join(",", "d"); + "je" string => join(",", "e"); + "jips" string => join(",", "ips"); + "jipv6" string => join(",", "ipv6"); + "jmacs" string => join(",", "macs"); + "sa" slist => sort("a", "lex"); + "sb" slist => sort("b", "lex"); + "sc" slist => sort("c", "lex"); + "sd" slist => sort("d", "lex"); + "se" slist => sort("e", "lex"); + "sb_int" slist => sort("b", "int"); + "sb_real" slist => sort("b", "real"); + "sips" slist => sort("ips", "ip"); + "sipv6" slist => sort("ipv6", "ip"); + "smacs" slist => sort("macs", "mac"); + "jsa" string => join(",", "sa"); + "jsb" string => join(",", "sb"); + "jsc" string => join(",", "sc"); + "jsd" string => join(",", "sd"); + "jse" string => join(",", "se"); + "jsb_int" string => join(",", "sb_int"); + "jsb_real" string => join(",", "sb_real"); + "jsips" string => join(",", "sips"); + "jsipv6" string => join(",", "sipv6"); + "jsmacs" string => join(",", "smacs"); reports: - "sorted lexicographically '$(ja)' => '$(jsa)'"; - "sorted lexicographically '$(jb)' => '$(jsb)'"; - "sorted lexicographically '$(jc)' => '$(jsc)'"; - "sorted lexicographically '$(jd)' => '$(jsd)'"; - "sorted lexicographically '$(je)' => '$(jse)'"; - - "sorted integers '$(jb)' => '$(jsb_int)'"; - "sorted reals '$(jb)' => '$(jsb_real)'"; - - "sorted IPs '$(jips)' => '$(jsips)'"; - "sorted IPv6s '$(jipv6)' => '$(jsipv6)'"; - "sorted MACs '$(jmacs)' => '$(jsmacs)'"; + "sorted lexicographically '$(ja)' => '$(jsa)'"; + "sorted lexicographically '$(jb)' => '$(jsb)'"; + "sorted lexicographically '$(jc)' => '$(jsc)'"; + "sorted lexicographically '$(jd)' => '$(jsd)'"; + "sorted lexicographically '$(je)' => '$(jse)'"; + "sorted integers '$(jb)' => '$(jsb_int)'"; + "sorted reals '$(jb)' => '$(jsb_real)'"; + "sorted IPs '$(jips)' => '$(jsips)'"; + "sorted IPv6s '$(jipv6)' => '$(jsipv6)'"; + "sorted MACs '$(jmacs)' => '$(jsmacs)'"; } + #+end_src diff --git a/examples/splitstring.cf b/examples/splitstring.cf index c32f4ea088..228ab349ec 100644 --- a/examples/splitstring.cf +++ b/examples/splitstring.cf @@ -1,46 +1,38 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test { vars: - - "split1" slist => splitstring("one:two:three",":","10"); - "split2" slist => splitstring("one:two:three",":","1"); - "split3" slist => splitstring("alpha:xyz:beta","xyz","10"); + "split1" slist => splitstring("one:two:three", ":", "10"); + "split2" slist => splitstring("one:two:three", ":", "1"); + "split3" slist => splitstring("alpha:xyz:beta", "xyz", "10"); reports: - - "split1: $(split1)"; # will list "one", "two", and "three" - "split2: $(split2)"; # will list "one", "two:three" will be thrown away. - "split3: $(split3)"; # will list "alpha:" and ":beta" - + "split1: $(split1)"; # will list "one", "two", and "three" + "split2: $(split2)"; # will list "one", "two:three" will be thrown away. + "split3: $(split3)"; # will list "alpha:" and ":beta" } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/sql_table_structure.cf b/examples/sql_table_structure.cf index d1c3816daf..287ec196ee 100644 --- a/examples/sql_table_structure.cf +++ b/examples/sql_table_structure.cf @@ -1,47 +1,35 @@ -# # Database promises are introduced in CFEngine Community edition 3.3.0 -# - body common control { - bundlesequence => { "databases" }; + bundlesequence => { "databases" }; } - bundle agent databases - { databases: - - "cfengine_db/users" - + "cfengine_db/users" database_operation => "create", database_type => "sql", - database_columns => { - "username,varchar,50", - "password,varchar,80", - "email,varchar,20", + database_columns => { + "username,varchar,50", "password,varchar,80", "email,varchar,20", }, database_server => local_mysql("root", ""); } - -body database_server local_mysql(username, password) +body database_server local_mysql(username, password) { - db_server_owner => "$(username)"; - db_server_password => "$(password)"; - db_server_host => "localhost"; - db_server_type => "mysql"; - db_server_connection_db => "mysql"; + db_server_owner => "$(username)"; + db_server_password => "$(password)"; + db_server_host => "localhost"; + db_server_type => "mysql"; + db_server_connection_db => "mysql"; } - body database_server local_postgresql(username, password) { - db_server_owner => "$(username)"; - db_server_password => "$(password)"; - db_server_host => "localhost"; - db_server_type => "postgres"; - db_server_connection_db => "postgres"; + db_server_owner => "$(username)"; + db_server_password => "$(password)"; + db_server_host => "localhost"; + db_server_type => "postgres"; + db_server_connection_db => "postgres"; } - diff --git a/examples/storage-cifs.cf b/examples/storage-cifs.cf index 3568f69c15..57013406a5 100644 --- a/examples/storage-cifs.cf +++ b/examples/storage-cifs.cf @@ -7,7 +7,7 @@ bundle agent main packages: redhat|centos:: - "cifs-utils" policy => "present"; + "cifs-utils" policy => "present"; "samba-client" policy => "present"; files: @@ -16,15 +16,14 @@ bundle agent main storage: redhat|centos:: - "/mnt/CIFS" - mount => cifs_guest( $(cifs[server]) , $(cifs[path]) ); + "/mnt/CIFS" mount => cifs_guest($(cifs[server]), $(cifs[path])); } -body mount cifs_guest(server,source) +body mount cifs_guest(server, source) { - mount_type => "cifs"; - mount_source => "$(source)"; - mount_server => "$(server)"; - mount_options => { "guest" }; - edit_fstab => "false"; + mount_type => "cifs"; + mount_source => "$(source)"; + mount_server => "$(server)"; + mount_options => { "guest" }; + edit_fstab => "false"; } diff --git a/examples/storage.cf b/examples/storage.cf index 7cecbe531d..f97dc18208 100644 --- a/examples/storage.cf +++ b/examples/storage.cf @@ -1,57 +1,40 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - # # cfengine 3 # # cf-agent -f ./cftest.cf -K -# - body common control - { - bundlesequence => { "storage" }; + bundlesequence => { "storage" }; } -# - bundle agent storage - { storage: - - "/usr" volume => mycheck("11G"); - "/" volume => mycheck("60%"); - + "/usr" volume => mycheck("11G"); + "/" volume => mycheck("60%"); } ###################################################################### - -body volume mycheck(free) # reusable template - +body volume mycheck(free) # reusable template { - check_foreign => "false"; - freespace => "$(free)"; - sensible_size => "10000"; - sensible_count => "2"; + check_foreign => "false"; + freespace => "$(free)"; + sensible_size => "10000"; + sensible_count => "2"; } diff --git a/examples/storejson.cf b/examples/storejson.cf index 851f47d6d0..6c1d67d030 100644 --- a/examples/storejson.cf +++ b/examples/storejson.cf @@ -2,47 +2,48 @@ bundle common globals { vars: - "example_data" data => '{ "msg": "Hello from $(this.bundle)" }'; + "example_data" data => '{ "msg": "Hello from $(this.bundle)" }'; } + bundle agent example_storejson # @brief Example showing storejson { vars: - "example_data" data => '{ "msg": "Hello from $(this.bundle)" }'; - - # Using storejson with data from remote bundle + "example_data" data => '{ "msg": "Hello from $(this.bundle)" }'; - # "json_string_zero" -> { "CFEngine 3.16.0"} - # string => storejson( globals.example_data ) - # comment => "Unquoted with . (dot) present will cause the parser to error"; + # Using storejson with data from remote bundle + # "json_string_zero" -> { "CFEngine 3.16.0"} + # string => storejson( globals.example_data ) + # comment => "Unquoted with . (dot) present will cause the parser to error"; + "json_string_one" string => storejson(@(globals.example_data)); + "json_string_two" string => storejson("globals.example_data"); - "json_string_one" string => storejson( @(globals.example_data) ); - "json_string_two" string => storejson( "globals.example_data" ); - - # Using storejson with data from this bundle - "json_string_three" string => storejson( @(example_storejson.example_data) ); - "json_string_four" string => storejson( "example_storejson.example_data"); - "json_string_five" string => storejson( example_data ); - "json_string_six" string => storejson( "$(this.bundle).example_data"); - "json_string_seven" string => storejson( @(example_data) ); + # Using storejson with data from this bundle + "json_string_three" string => storejson(@(example_storejson.example_data)); + "json_string_four" string => storejson("example_storejson.example_data"); + "json_string_five" string => storejson(example_data); + "json_string_six" string => storejson("$(this.bundle).example_data"); + "json_string_seven" string => storejson(@(example_data)); reports: - "json_string_one and json_string_two are identical:$(const.n)$(json_string_one)" - if => strcmp( $(json_string_one), $(json_string_two) ); + "json_string_one and json_string_two are identical:$(const.n)$(json_string_one)" + if => strcmp($(json_string_one), $(json_string_two)); - "json_string_{one,two,three,four,five,six,seven} are identical:$(const.n)$(json_string_three)" - if => and( - strcmp( $(json_string_three), $(json_string_four) ), - strcmp( $(json_string_four), $(json_string_five) ), - strcmp( $(json_string_five), $(json_string_six) ), - strcmp( $(json_string_six), $(json_string_seven) ) - ); + "json_string_{one,two,three,four,five,six,seven} are identical:$(const.n)$(json_string_three)" + if => and( + strcmp($(json_string_three), $(json_string_four)), + strcmp($(json_string_four), $(json_string_five)), + strcmp($(json_string_five), $(json_string_six)), + strcmp($(json_string_six), $(json_string_seven)) + ); } bundle agent __main__ { - methods: "example_storejson"; + methods: + "example_storejson"; } + ############################################################################### #+end_src #+begin_src example_output diff --git a/examples/strcmp.cf b/examples/strcmp.cf index 016dafed4c..768cac3e5b 100644 --- a/examples/strcmp.cf +++ b/examples/strcmp.cf @@ -1,47 +1,38 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { classes: - - "same" expression => strcmp("test","test"); + "same" expression => strcmp("test", "test"); reports: - same:: - "Strings are equal"; !same:: - "Strings are not equal"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/strftime.cf b/examples/strftime.cf index ead82f8d45..ca1e91b0c3 100644 --- a/examples/strftime.cf +++ b/examples/strftime.cf @@ -1,88 +1,161 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 #@ The templates used here are from the documentation of the standard strftime #@ implementation in the [glibc manual](http://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html#Formatting-Calendar-Time). body agent control { - environment => { "LC_ALL=en_US.UTF-8", "TZ=GMT" }; + environment => { "LC_ALL=en_US.UTF-8", "TZ=GMT" }; } + bundle agent main { vars: - "time" int => "1234567890"; - - "template[%a]" string => "The abbreviated weekday name according to the current locale."; - "template[%A]" string => "The full weekday name according to the current locale."; - "template[%b]" string => "The abbreviated month name according to the current locale."; - "template[%B]" string => "The full month name according to the current locale."; - "template[%c]" string => "The preferred calendar time representation for the current locale."; - "template[%C]" string => "The century of the year. This is equivalent to the greatest integer not greater than the year divided by 100."; - "template[%d]" string => "The day of the month as a decimal number (range 01 through 31)."; - "template[%D]" string => "The date using the format %m/$d/%y."; - "template[%e]" string => "The day of the month like with %d, but padded with blank (range 1 through 31)."; - "template[%F]" string => "The date using the format %Y-%m-%d. This is the form specified in the ISO 8601 standard and is the preferred form for all uses."; - "template[%g]" string => "The year corresponding to the ISO week number, but without the century (range 00 through 99). This has the same format and value as %y, except that if the ISO week number (see %V) belongs to the previous or next year, that year is used instead."; - "template[%G]" string => "The year corresponding to the ISO week number. This has the same format and value as %Y, except that if the ISO week number (see %V) belongs to the previous or next year, that year is used instead."; - "template[%h]" string => "The abbreviated month name according to the current locale. The action is the same as for %b."; - "template[%H]" string => "The hour as a decimal number, using a 24-hour clock (range 00 through 23)."; - "template[%I]" string => "The hour as a decimal number, using a 12-hour clock (range 01 through 12)."; - "template[%j]" string => "The day of the year as a decimal number (range 001 through 366)."; - "template[%k]" string => "The hour as a decimal number, using a 24-hour clock like %H, but padded with blank (range 0 through 23)."; - "template[%l]" string => "The hour as a decimal number, using a 12-hour clock like %I, but padded with blank (range 1 through 12)."; - "template[%m]" string => "The month as a decimal number (range 01 through 12)."; - "template[%M]" string => "The minute as a decimal number (range 00 through 59)."; - "template[%n]" string => "A single \n (newline) character."; - "template[%p]" string => "Either AM or PM, according to the given time value; or the corresponding strings for the current locale. Noon is treated as PM and midnight as AM. In most locales AM/PM format is not supported, in such cases %p yields an empty string."; - "template[%P]" string => "Either am or pm, according to the given time value; or the corresponding strings for the current locale, printed in lowercase characters. Noon is treated as pm and midnight as am. In most locales AM/PM format is not supported, in such cases %P yields an empty string."; - "template[%r]" string => "The complete calendar time using the AM/PM format of the current locale."; - "template[%R]" string => "The hour and minute in decimal numbers using the format %H:%M."; - "template[%S]" string => "The seconds as a decimal number (range 00 through 60)."; - "template[%t]" string => "A single \t (tabulator) character."; - "template[%T]" string => "The time of day using decimal numbers using the format %H:%M:%S."; - "template[%u]" string => "The day of the week as a decimal number (range 1 through 7), Monday being 1."; - "template[%U]" string => "The week number of the current year as a decimal number (range 00 through 53), starting with the first Sunday as the first day of the first week. Days preceding the first Sunday in the year are considered to be in week 00."; - "template[%V]" string => "The *ISO 8601:1988* week number as a decimal number (range 01 through 53). ISO weeks start with Monday and end with Sunday. Week 01 of a year is the first week which has the majority of its days in that year; this is equivalent to the week containing the year's first Thursday, and it is also equivalent to the week containing January 4. Week 01 of a year can contain days from the previous year. The week before week 01 of a year is the last week (52 or 53) of the previous year even if it contains days from the new year."; - "template[%w]" string => "The day of the week as a decimal number (range 0 through 6), Sunday being 0."; - "template[%w]" string => "The day of the week as a decimal number (range 0 through 6), Sunday being 0."; - "template[%x]" string => "The preferred date representation for the current locale."; - "template[%X]" string => "The preferred time of day representation for the current locale."; - "template[%y]" string => "The year without a century as a decimal number (range 00 through 99). This is equivalent to the year modulo 100."; - "template[%Y]" string => "The year as a decimal number, using the Gregorian calendar. Years before the year 1 are numbered 0, -1, and so on."; - "template[%z]" string => "*RFC 822*/*ISO 8601:1988* style numeric time zone (e.g., -0600 or +0100), or nothing if no time zone is determinable."; - "template[%Z]" string => "The time zone abbreviation (empty if the time zone can't be determined)."; - "template[%%]" string => "A literal % character."; - - # Since %s is ever changing resulting in unstable output, causing a test failure in CI - # it's not used unless show_seconds_since_epoch is defined - "template[%s]" string => "The number of seconds since the epoch, i.e., since 1970-01-01 00:00:00 UTC. Leap seconds are not counted unless leap second support is available.", if => "show_seconds_since_epoch"; - - "_i" slist => sort(getindices(template), lex); + "time" int => "1234567890"; + + "template[%a]" + string => "The abbreviated weekday name according to the current locale."; + + "template[%A]" + string => "The full weekday name according to the current locale."; + + "template[%b]" + string => "The abbreviated month name according to the current locale."; + + "template[%B]" + string => "The full month name according to the current locale."; + + "template[%c]" + string => "The preferred calendar time representation for the current locale."; + + "template[%C]" + string => "The century of the year. This is equivalent to the greatest integer not greater than the year divided by 100."; + + "template[%d]" + string => "The day of the month as a decimal number (range 01 through 31)."; + + "template[%D]" string => "The date using the format %m/$d/%y."; + + "template[%e]" + string => "The day of the month like with %d, but padded with blank (range 1 through 31)."; + + "template[%F]" + string => "The date using the format %Y-%m-%d. This is the form specified in the ISO 8601 standard and is the preferred form for all uses."; + + "template[%g]" + string => "The year corresponding to the ISO week number, but without the century (range 00 through 99). This has the same format and value as %y, except that if the ISO week number (see %V) belongs to the previous or next year, that year is used instead."; + + "template[%G]" + string => "The year corresponding to the ISO week number. This has the same format and value as %Y, except that if the ISO week number (see %V) belongs to the previous or next year, that year is used instead."; + + "template[%h]" + string => "The abbreviated month name according to the current locale. The action is the same as for %b."; + + "template[%H]" + string => "The hour as a decimal number, using a 24-hour clock (range 00 through 23)."; + + "template[%I]" + string => "The hour as a decimal number, using a 12-hour clock (range 01 through 12)."; + + "template[%j]" + string => "The day of the year as a decimal number (range 001 through 366)."; + + "template[%k]" + string => "The hour as a decimal number, using a 24-hour clock like %H, but padded with blank (range 0 through 23)."; + + "template[%l]" + string => "The hour as a decimal number, using a 12-hour clock like %I, but padded with blank (range 1 through 12)."; + + "template[%m]" + string => "The month as a decimal number (range 01 through 12)."; + + "template[%M]" + string => "The minute as a decimal number (range 00 through 59)."; + + "template[%n]" string => "A single \n (newline) character."; + + "template[%p]" + string => "Either AM or PM, according to the given time value; or the corresponding strings for the current locale. Noon is treated as PM and midnight as AM. In most locales AM/PM format is not supported, in such cases %p yields an empty string."; + + "template[%P]" + string => "Either am or pm, according to the given time value; or the corresponding strings for the current locale, printed in lowercase characters. Noon is treated as pm and midnight as am. In most locales AM/PM format is not supported, in such cases %P yields an empty string."; + + "template[%r]" + string => "The complete calendar time using the AM/PM format of the current locale."; + + "template[%R]" + string => "The hour and minute in decimal numbers using the format %H:%M."; + + "template[%S]" + string => "The seconds as a decimal number (range 00 through 60)."; + + "template[%t]" string => "A single \t (tabulator) character."; + + "template[%T]" + string => "The time of day using decimal numbers using the format %H:%M:%S."; + + "template[%u]" + string => "The day of the week as a decimal number (range 1 through 7), Monday being 1."; + + "template[%U]" + string => "The week number of the current year as a decimal number (range 00 through 53), starting with the first Sunday as the first day of the first week. Days preceding the first Sunday in the year are considered to be in week 00."; + + "template[%V]" + string => "The *ISO 8601:1988* week number as a decimal number (range 01 through 53). ISO weeks start with Monday and end with Sunday. Week 01 of a year is the first week which has the majority of its days in that year; this is equivalent to the week containing the year's first Thursday, and it is also equivalent to the week containing January 4. Week 01 of a year can contain days from the previous year. The week before week 01 of a year is the last week (52 or 53) of the previous year even if it contains days from the new year."; + + "template[%w]" + string => "The day of the week as a decimal number (range 0 through 6), Sunday being 0."; + + "template[%w]" + string => "The day of the week as a decimal number (range 0 through 6), Sunday being 0."; + + "template[%x]" + string => "The preferred date representation for the current locale."; + + "template[%X]" + string => "The preferred time of day representation for the current locale."; + + "template[%y]" + string => "The year without a century as a decimal number (range 00 through 99). This is equivalent to the year modulo 100."; + + "template[%Y]" + string => "The year as a decimal number, using the Gregorian calendar. Years before the year 1 are numbered 0, -1, and so on."; + + "template[%z]" + string => "*RFC 822*/*ISO 8601:1988* style numeric time zone (e.g., -0600 or +0100), or nothing if no time zone is determinable."; + + "template[%Z]" + string => "The time zone abbreviation (empty if the time zone can't be determined)."; + + "template[%%]" string => "A literal % character."; + + # Since %s is ever changing resulting in unstable output, causing a test failure in CI + # it's not used unless show_seconds_since_epoch is defined + "template[%s]" + string => "The number of seconds since the epoch, i.e., since 1970-01-01 00:00:00 UTC. Leap seconds are not counted unless leap second support is available.", + if => "show_seconds_since_epoch"; + + "_i" slist => sort(getindices(template), lex); reports: - "$(_i) :: $(template[$(_i)])$(const.n)$(const.t)For example: '$(with)'" - with => strftime(gmtime, $(_i), $(time)); + "$(_i) :: $(template[$(_i)])$(const.n)$(const.t)For example: '$(with)'" + with => strftime(gmtime, $(_i), $(time)); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/string.cf b/examples/string.cf index 9953b0d2f9..e4722e91d5 100644 --- a/examples/string.cf +++ b/examples/string.cf @@ -2,20 +2,22 @@ bundle agent main { classes: - "classA"; - "classB"; + "classA"; + "classB"; vars: - "some_string" string => "cba"; - "class_expressions" slist => {"classA.classB", - string(and("classA", strcmp("$(some_string)", "abc"))) + "some_string" string => "cba"; + + "class_expressions" + slist => { + "classA.classB", string(and("classA", strcmp("$(some_string)", "abc"))) }; reports: - "$(class_expressions)"; + "$(class_expressions)"; } -#+end_src +#+end_src #+begin_src example_output #@ ``` #@ R: classA.classB diff --git a/examples/string_downcase.cf b/examples/string_downcase.cf index d9d0eb2a7d..04c4950800 100644 --- a/examples/string_downcase.cf +++ b/examples/string_downcase.cf @@ -1,38 +1,33 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - "downcase" string => string_downcase("ABC"); # will contain "abc" + "downcase" string => string_downcase("ABC"); # will contain "abc" reports: - "downcased ABC = $(downcase)"; + "downcased ABC = $(downcase)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/string_head.cf b/examples/string_head.cf index da7d51febe..c30f803346 100644 --- a/examples/string_head.cf +++ b/examples/string_head.cf @@ -1,39 +1,33 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - "start" string => string_head("abc", "1"); # will contain "a" + "start" string => string_head("abc", "1"); # will contain "a" reports: - "start of abc = $(start)"; - + "start of abc = $(start)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/string_length.cf b/examples/string_length.cf index daebc9bc8a..76790f4c55 100644 --- a/examples/string_length.cf +++ b/examples/string_length.cf @@ -1,38 +1,33 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - "length" int => string_length("abc"); # will contain "3" + "length" int => string_length("abc"); # will contain "3" reports: - "length of string abc = $(length)"; + "length of string abc = $(length)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/string_mustache.cf b/examples/string_mustache.cf index 4e646df464..8cdfeca17d 100644 --- a/examples/string_mustache.cf +++ b/examples/string_mustache.cf @@ -1,57 +1,59 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "config", "example" }; + bundlesequence => { "config", "example" }; } bundle agent config { vars: - "deserts" data => parsejson('{ "deserts": { + "deserts" + data => parsejson( + '{ "deserts": { "Africa": "Sahara", "Asia": "Gobi" -} }'); +} }' + ); } - bundle agent example { vars: - # {{@}} is the current key during an iteration in 3.7 with Mustache - "with_data_container" string => string_mustache("from container: deserts = {{%deserts}} -from container: {{#deserts}}The desert {{.}} is in {{@}}. {{/deserts}}", "config.deserts"); - - # you can dump an entire data structure with {{%myvar}} in 3.7 with Mustache - "with_system_state" string => string_mustache("from datastate(): deserts = {{%vars.config.deserts.deserts}} -from datastate(): {{#vars.config.deserts.deserts}}The desert {{.}} is in {{@}}. {{/vars.config.deserts.deserts}}"); # will use datastate() + # {{@}} is the current key during an iteration in 3.7 with Mustache + "with_data_container" + string => string_mustache( + "from container: deserts = {{%deserts}} +from container: {{#deserts}}The desert {{.}} is in {{@}}. {{/deserts}}", + "config.deserts" + ); + # you can dump an entire data structure with {{%myvar}} in 3.7 with Mustache + "with_system_state" + string => string_mustache( + "from datastate(): deserts = {{%vars.config.deserts.deserts}} +from datastate(): {{#vars.config.deserts.deserts}}The desert {{.}} is in {{@}}. {{/vars.config.deserts.deserts}}" + ); # will use datastate() reports: - "With an explicit data container: $(with_data_container)"; - - "With the system datastate(): $(with_system_state)"; + "With an explicit data container: $(with_data_container)"; + "With the system datastate(): $(with_system_state)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/string_replace.cf b/examples/string_replace.cf index 1e4e84940b..dc31afd938 100644 --- a/examples/string_replace.cf +++ b/examples/string_replace.cf @@ -1,45 +1,44 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 bundle agent main { vars: - # replace one occurence - "replace_once" string => string_replace("This is a string", "string", "thing"); - # replace several occurences - "replace_several" string => string_replace("This is a string", "i", "o"); - # replace nothing - "replace_none" string => string_replace("This is a string", "boat", "no"); - # replace ambiguous order - "replace_ambiguous" string => string_replace("aaaaa", "aaa", "b"); + # replace one occurence + "replace_once" + string => string_replace("This is a string", "string", "thing"); + + # replace several occurences + "replace_several" string => string_replace("This is a string", "i", "o"); + + # replace nothing + "replace_none" string => string_replace("This is a string", "boat", "no"); + + # replace ambiguous order + "replace_ambiguous" string => string_replace("aaaaa", "aaa", "b"); reports: - # in order, the above... - "replace_once = '$(replace_once)'"; - "replace_several = '$(replace_several)'"; - "replace_none = '$(replace_none)'"; - "replace_ambiguous = '$(replace_ambiguous)'"; + # in order, the above... + "replace_once = '$(replace_once)'"; + "replace_several = '$(replace_several)'"; + "replace_none = '$(replace_none)'"; + "replace_ambiguous = '$(replace_ambiguous)'"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/string_reverse.cf b/examples/string_reverse.cf index 402030d2ca..0925677666 100644 --- a/examples/string_reverse.cf +++ b/examples/string_reverse.cf @@ -1,39 +1,33 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - "reversed" - string => string_reverse("abc"); # will contain "cba" + "reversed" string => string_reverse("abc"); # will contain "cba" reports: - "reversed abs = $(reversed)"; + "reversed abs = $(reversed)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/string_split.cf b/examples/string_split.cf index 7e1cf4a4bc..288446305f 100644 --- a/examples/string_split.cf +++ b/examples/string_split.cf @@ -1,46 +1,38 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test { vars: - - "split1" slist => string_split("one:two:three", ":", "10"); - "split2" slist => string_split("one:two:three", ":", "1"); - "split3" slist => string_split("alpha:xyz:beta", "xyz", "10"); + "split1" slist => string_split("one:two:three", ":", "10"); + "split2" slist => string_split("one:two:three", ":", "1"); + "split3" slist => string_split("alpha:xyz:beta", "xyz", "10"); reports: - - "split1: $(split1)"; # will list "one", "two", and "three" - "split2: $(split2)"; # will list "one:two:three" - "split3: $(split3)"; # will list "alpha:" and ":beta" - + "split1: $(split1)"; # will list "one", "two", and "three" + "split2: $(split2)"; # will list "one:two:three" + "split3: $(split3)"; # will list "alpha:" and ":beta" } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/string_tail.cf b/examples/string_tail.cf index 441af12280..d976690c64 100644 --- a/examples/string_tail.cf +++ b/examples/string_tail.cf @@ -1,39 +1,33 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - "end" string => string_tail("abc", "1"); # will contain "c" + "end" string => string_tail("abc", "1"); # will contain "c" reports: - "end of abc = $(end)"; - + "end of abc = $(end)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/string_trim.cf b/examples/string_trim.cf index 466c3a0125..e479b50740 100644 --- a/examples/string_trim.cf +++ b/examples/string_trim.cf @@ -3,21 +3,25 @@ bundle agent example_trim # @brief Example showing string_trim { vars: - "my_string_one" string => string_trim( " Trim spaces please "); - "my_string_two" string => string_trim( " + "my_string_one" string => string_trim(" Trim spaces please "); + + "my_string_two" + string => string_trim(" Trim newlines also please "); reports: - "my_string_one: '$(my_string_one)'"; - "my_string_two: '$(my_string_two)'"; + "my_string_one: '$(my_string_one)'"; + "my_string_two: '$(my_string_two)'"; } bundle agent __main__ { - methods: "example_trim"; + methods: + "example_trim"; } + ############################################################################### #+end_src #+begin_src example_output diff --git a/examples/string_upcase.cf b/examples/string_upcase.cf index 85edc87a88..d41c2a3dac 100644 --- a/examples/string_upcase.cf +++ b/examples/string_upcase.cf @@ -1,38 +1,33 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - "upcase" string => string_upcase("abc"); # will contain "ABC" + "upcase" string => string_upcase("abc"); # will contain "ABC" reports: - "upcased abc: $(upcase)"; + "upcased abc: $(upcase)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/stringarray.cf b/examples/stringarray.cf index 147d9b22be..a1ee2062aa 100644 --- a/examples/stringarray.cf +++ b/examples/stringarray.cf @@ -1,47 +1,35 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################################### - bundle agent example - -{ +{ vars: + "dim_array" + int => readstringarray( + "array_name", "/etc/passwd", "#[^\n]*", ":", 10, 4000 + ); - "dim_array" - - int => readstringarray("array_name","/etc/passwd","#[^\n]*",":",10,4000); - - "idx" slist => getindices("array_name"); + "idx" slist => getindices("array_name"); reports: - - "Index $(idx): [1]=$(array_name[$(idx)][1]),[2]=$(array_name[$(idx)][2])...[7]=$(array_name[$(idx)][6])"; + "Index $(idx): [1]=$(array_name[$(idx)][1]),[2]=$(array_name[$(idx)][2])...[7]=$(array_name[$(idx)][6])"; } - diff --git a/examples/style_PascaleCase.cf b/examples/style_PascaleCase.cf index 739bc5ca1f..a04c2a785f 100644 --- a/examples/style_PascaleCase.cf +++ b/examples/style_PascaleCase.cf @@ -1,29 +1,28 @@ bundle agent __main__ { methods: - "Ssh"; + "Ssh"; } + bundle agent Ssh { vars: - "ServiceName" string => "ssh"; - "ConfigFile" string => "/etc/ssh/sshd_config"; - "Conf[Port]" string => "22"; + "ServiceName" string => "ssh"; + "ConfigFile" string => "/etc/ssh/sshd_config"; + "Conf[Port]" string => "22"; files: - "$(ConfigFile)" - edit_line => default:set_line_based("$(this.bundle).Conf", - " ", - "\s+", - ".*", - "\s*#\s*"), - classes => default:results( "bundle", "$(ConfigFile)"); + "$(ConfigFile)" + edit_line => default:set_line_based( + "$(this.bundle).Conf", " ", "\s+", ".*", "\s*#\s*" + ), + classes => default:results("bundle", "$(ConfigFile)"); services: _etc_ssh_sshd_config_repaired:: "$(ServiceName)" service_policy => "restart", - classes => default:results( "bundle", "$(ServiceName)_restart"); + classes => default:results("bundle", "$(ServiceName)_restart"); reports: ssh_restart_repaired._etc_ssh_sshd_config_repaired:: diff --git a/examples/style_camelCase.cf b/examples/style_camelCase.cf index 87fb29d4d7..221ec571c0 100644 --- a/examples/style_camelCase.cf +++ b/examples/style_camelCase.cf @@ -1,29 +1,28 @@ bundle agent __main__ { methods: - "Ssh"; + "Ssh"; } + bundle agent ssh { vars: - "serviceName" string => "ssh"; - "configFile" string => "/etc/ssh/sshd_config"; - "conf[Port]" string => "22"; + "serviceName" string => "ssh"; + "configFile" string => "/etc/ssh/sshd_config"; + "conf[Port]" string => "22"; files: - "$(configFile)" - edit_line => default:set_line_based("$(this.bundle).conf", - " ", - "\s+", - ".*", - "\s*#\s*"), - classes => default:results( "bundle", "$(configFile)"); + "$(configFile)" + edit_line => default:set_line_based( + "$(this.bundle).conf", " ", "\s+", ".*", "\s*#\s*" + ), + classes => default:results("bundle", "$(configFile)"); services: _etc_ssh_sshd_config_repaired:: "$(serviceName)" service_policy => "restart", - classes => default:results( "bundle", "$(serviceName)_restart"); + classes => default:results("bundle", "$(serviceName)_restart"); reports: ssh_restart_repaired._etc_ssh_sshd_config_repaired:: diff --git a/examples/style_hungarian.cf b/examples/style_hungarian.cf index 49d1ddf76d..adc5e5a201 100644 --- a/examples/style_hungarian.cf +++ b/examples/style_hungarian.cf @@ -2,43 +2,41 @@ bundle agent __main__ { vars: - "s_one" string => "one"; - "ITwo" int => "2"; - "rThree" real => "3.0"; - - "lMyList" slist => { "$(s_one)", "$(ITwo)", "$(rThree)" }; + "s_one" string => "one"; + "ITwo" int => "2"; + "rThree" real => "3.0"; + "lMyList" slist => { "$(s_one)", "$(ITwo)", "$(rThree)" }; methods: - "Iteration inside (bundle called once)" - usebundle => dollar_vs_at( @(lMyList) ); + "Iteration inside (bundle called once)" + usebundle => dollar_vs_at(@(lMyList)); - "Iteration outside (bundle called length(lMyList) times)" - usebundle => dollar_vs_at( $(lMyList) ); + "Iteration outside (bundle called length(lMyList) times)" + usebundle => dollar_vs_at($(lMyList)); } -bundle agent dollar_vs_at( myParam ) +bundle agent dollar_vs_at(myParam) { vars: - "myParamType" string => type( myParam ); + "myParamType" string => type(myParam); - classes: - "myParamType_slist" expression => strcmp( $(myParamType), "slist" ); - "myParamType_string" expression => strcmp( $(myParamType), "string" ); + classes: + "myParamType_slist" expression => strcmp($(myParamType), "slist"); + "myParamType_string" expression => strcmp($(myParamType), "string"); reports: - "Bundle promised by '$(with)'" - with => nth( reverse( callstack_promisers() ), 0 ); + "Bundle promised by '$(with)'" + with => nth(reverse(callstack_promisers()), 0); myParamType_slist:: "myParam is of type '$(myParamType)' with value $(with)" - with => join( ", ", @(myParam) ); + with => join(", ", @(myParam)); myParamType_string:: "myParam is of type '$(myParamType)' with value $(myParam)"; - } -#+end_src cfengine3 +#+end_src cfengine3 #+begin_src example_output #@ ``` #@ R: Bundle promised by 'Iteration inside (bundle called once)' @@ -49,4 +47,3 @@ bundle agent dollar_vs_at( myParam ) #@ R: myParam is of type 'string' with value 3.000000 #@ ``` #+end_src - diff --git a/examples/style_snake_case.cf b/examples/style_snake_case.cf index 3d83833bdd..05efc120ed 100644 --- a/examples/style_snake_case.cf +++ b/examples/style_snake_case.cf @@ -1,29 +1,28 @@ bundle agent __main__ { methods: - "ssh"; + "ssh"; } + bundle agent ssh { vars: - "service_name" string => "ssh"; - "config_file" string => "/etc/ssh/sshd_config"; - "conf[Port]" string => "22"; + "service_name" string => "ssh"; + "config_file" string => "/etc/ssh/sshd_config"; + "conf[Port]" string => "22"; files: - "$(config_file)" - edit_line => default:set_line_based("$(this.bundle).conf", - " ", - "\s+", - ".*", - "\s*#\s*"), - classes => default:results( "bundle", "$(config_file)"); + "$(config_file)" + edit_line => default:set_line_based( + "$(this.bundle).conf", " ", "\s+", ".*", "\s*#\s*" + ), + classes => default:results("bundle", "$(config_file)"); services: _etc_ssh_sshd_config_repaired:: "$(service_name)" service_policy => "restart", - classes => default:results( "bundle", "$(service_name)_restart"); + classes => default:results("bundle", "$(service_name)_restart"); reports: ssh_restart_repaired._etc_ssh_sshd_config_repaired:: diff --git a/examples/sublist.cf b/examples/sublist.cf index d2104f8309..ecf8098c44 100644 --- a/examples/sublist.cf +++ b/examples/sublist.cf @@ -1,62 +1,54 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test { vars: - "test" slist => { - 1,2,3, - "one", "two", "three", - "long string", - "four", "fix", "six", + "test" + slist => { + 1, 2, 3, "one", "two", "three", "long string", "four", "fix", "six", }; - "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_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); reports: - "The test list is $(test)"; - "This line should not appear: $(test_head0)"; - "The head(1) of the test list is $(test_head1)"; - "The head(9999) of the test list is $(test_head9999)"; - "This line should not appear: $(test_tail0)"; - "The tail(1) of the test list is $(test_tail1)"; - "The tail(10) of the test list is $(test_tail10)"; - "The tail(2) of the test list is $(test_tail2)"; - "The tail(9999) of the test list is $(test_tail9999)"; + "The test list is $(test)"; + "This line should not appear: $(test_head0)"; + "The head(1) of the test list is $(test_head1)"; + "The head(9999) of the test list is $(test_head9999)"; + "This line should not appear: $(test_tail0)"; + "The tail(1) of the test list is $(test_tail1)"; + "The tail(10) of the test list is $(test_tail10)"; + "The tail(2) of the test list is $(test_tail2)"; + "The tail(9999) of the test list is $(test_tail9999)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/sum.cf b/examples/sum.cf index 5aa0fe157a..3f2c60b280 100644 --- a/examples/sum.cf +++ b/examples/sum.cf @@ -1,42 +1,37 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test { vars: - "adds_to_six" ilist => { "1", "2", "3" }; - "six" real => sum("adds_to_six"); - "adds_to_zero" rlist => { "1.0", "2", "-3e0" }; - "zero" real => sum("adds_to_zero"); + "adds_to_six" ilist => { "1", "2", "3" }; + "six" real => sum("adds_to_six"); + "adds_to_zero" rlist => { "1.0", "2", "-3e0" }; + "zero" real => sum("adds_to_zero"); reports: - "six is $(six), zero is $(zero)"; + "six is $(six), zero is $(zero)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/switchcase.cf b/examples/switchcase.cf index 7865a8448c..7e42c08535 100644 --- a/examples/switchcase.cf +++ b/examples/switchcase.cf @@ -1,73 +1,53 @@ - body common control { - bundlesequence => { "test1", "test2" }; + bundlesequence => { "test1", "test2" }; } ################################################## - bundle agent test1 { classes: - - "default" expression => "any"; + "default" expression => "any"; reports: - linux:: - - "This is a linux box" - classes => exclusive; + "This is a linux box" classes => exclusive; solaris:: - - - "This is a solaris box" - classes => exclusive; + "This is a solaris box" classes => exclusive; default:: - "This is something not worth mentioning specifically" - classes => reset_default; + classes => reset_default; } ################################################## - bundle agent test2 { classes: - - "default" expression => "any"; + "default" expression => "any"; reports: - linux:: - - "This is another linux box" - classes => exclusive; + "This is another linux box" classes => exclusive; solaris:: - - "This is another solaris box" - classes => exclusive; + "This is another solaris box" classes => exclusive; default:: - "This is something else not worth mentioning specifically" - classes => reset_default; - + classes => reset_default; } ########################################################## - body classes exclusive { - cancel_kept => { "default" }; - cancel_notkept => { "default" }; - cancel_repaired => { "default" }; + cancel_kept => { "default" }; + cancel_notkept => { "default" }; + cancel_repaired => { "default" }; } body classes reset_default { - promise_kept => { "default" }; + promise_kept => { "default" }; } diff --git a/examples/symlink.cf b/examples/symlink.cf index f89e51f1ca..2cce654c38 100644 --- a/examples/symlink.cf +++ b/examples/symlink.cf @@ -1,41 +1,36 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. ######################################################## - body file control { - inputs => { "$(sys.libdir)/stdlib.cf" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } bundle agent main { files: - - # We use move_obstructions because we want the symlink to replace a - # regular file if necessary. - "/etc/apache2/sites-enabled/www.cfengine.com" -> { "webmaster@cfengine.com" } - link_from => ln_s( "/etc/apache2/sites-available/www.cfengine.com" ), - move_obstructions => "true", - comment => "We always want our website to be enabled."; + # We use move_obstructions because we want the symlink to replace a + # regular file if necessary. + "/etc/apache2/sites-enabled/www.cfengine.com" -> { + "webmaster@cfengine.com" + } + link_from => ln_s("/etc/apache2/sites-available/www.cfengine.com"), + move_obstructions => "true", + comment => "We always want our website to be enabled."; } ######################################################### diff --git a/examples/symlink_children.cf b/examples/symlink_children.cf index 338fa1e4fd..0c7c14ce3e 100644 --- a/examples/symlink_children.cf +++ b/examples/symlink_children.cf @@ -1,26 +1,20 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. ######################################################## - #+begin_src cfengine3 body file control { @@ -30,15 +24,15 @@ body file control bundle agent main { files: - - # This will make symlinks to each file in /var/cfengine/bin - # for example: - # '/usr/local/bin/cf-agent' -> '/var/cfengine/bin/cf-agent' - # '/usr/local/bin/cf-serverd' -> '/var/cfengine/bin/cf-serverd' - "/usr/local/bin" - link_from => linkchildren("/var/cfengine/bin"), - comment => "We like for cfengine binaries to be available inside of the + # This will make symlinks to each file in /var/cfengine/bin + # for example: + # '/usr/local/bin/cf-agent' -> '/var/cfengine/bin/cf-agent' + # '/usr/local/bin/cf-serverd' -> '/var/cfengine/bin/cf-serverd' + "/usr/local/bin" + link_from => linkchildren("/var/cfengine/bin"), + comment => "We like for cfengine binaries to be available inside of the common $PATH"; } + #+end_src ######################################################## diff --git a/examples/sys_interfaces_ip_addresses_ipv4.cf b/examples/sys_interfaces_ip_addresses_ipv4.cf index 39c93e1c91..702b30f9d3 100644 --- a/examples/sys_interfaces_ip_addresses_ipv4.cf +++ b/examples/sys_interfaces_ip_addresses_ipv4.cf @@ -1,39 +1,35 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 bundle agent example_sys_interfaces # @brief Illustrate iterating over interfaces and addresses { reports: - "Address: $(sys.ip_addresses)"; - "Interface: $(sys.interfaces)"; - "Address of '$(sys.interfaces)' is '$(sys.ipv4[$(sys.interfaces)])'"; + "Address: $(sys.ip_addresses)"; + "Interface: $(sys.interfaces)"; + "Address of '$(sys.interfaces)' is '$(sys.ipv4[$(sys.interfaces)])'"; } + bundle agent __main__ { methods: - "example_sys_interfaces"; + "example_sys_interfaces"; } + #+end_src ############################################################################### #+begin_src static_example_output @@ -59,4 +55,3 @@ bundle agent __main__ #@ R: Address of 'vboxnet13' is '192.168.69.1' #@ ``` #+end_src - diff --git a/examples/syslog.cf b/examples/syslog.cf index 574cf6c91f..b163cb779e 100644 --- a/examples/syslog.cf +++ b/examples/syslog.cf @@ -1,47 +1,33 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - body common control { - bundlesequence => { "one" }; + bundlesequence => { "one" }; } - - bundle agent one { files: - - "/tmp/xyz" - + "/tmp/xyz" create => "true", action => log; - } body action log { - log_level => "inform"; + log_level => "inform"; } - - diff --git a/examples/syslog2.cf b/examples/syslog2.cf index 0cf62746fd..837a44d8e4 100644 --- a/examples/syslog2.cf +++ b/examples/syslog2.cf @@ -1,34 +1,23 @@ -# # With Nova, log directly to a central server -- careful of scalability (UDP) -# - body common control { - bundlesequence => { "example" }; - syslog_host => "loghost.example.org"; + bundlesequence => { "example" }; + syslog_host => "loghost.example.org"; } -# - bundle agent example { vars: - - "software" slist => { "/root/xyz", "/tmp/xyz" }; + "software" slist => { "/root/xyz", "/tmp/xyz" }; files: - - "$(software)" - + "$(software)" create => "true", action => logme("$(software)"); - } -# - body action logme(x) { - log_repaired => "udp_syslog"; - log_string => "cfengine repaired promise $(this.handle) - $(x)"; + log_repaired => "udp_syslog"; + log_string => "cfengine repaired promise $(this.handle) - $(x)"; } diff --git a/examples/template.cf b/examples/template.cf index bf7b45e775..1e84893c05 100644 --- a/examples/template.cf +++ b/examples/template.cf @@ -1,65 +1,46 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Simple test editfile - template expansion # ######################################################## - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { files: - - "/home/mark/tmp/file_based_on_template" - - create => "true", + "/home/mark/tmp/file_based_on_template" + create => "true", edit_line => ExpandMeFrom("/tmp/source_template"); - - } ######################################################## - bundle edit_line ExpandMeFrom(template) { vars: - - "myvar" string => "[sub string]"; + "myvar" string => "[sub string]"; insert_lines: - - "$(template)" - + "$(template)" insert_type => "file", expand_scalars => "true"; } - diff --git a/examples/template2.cf b/examples/template2.cf index 8e506caeb3..30a3845d3f 100644 --- a/examples/template2.cf +++ b/examples/template2.cf @@ -1,47 +1,38 @@ - body common control { - bundlesequence => { "example" }; - - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "example" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; } bundle agent example { methods: - - "any" usebundle => get_template("/tmp/sudoers","400"); - "any" usebundle => get_template("/tmp/hosts","644"); - + "any" usebundle => get_template("/tmp/sudoers", "400"); + "any" usebundle => get_template("/tmp/hosts", "644"); } ############################################################# - -bundle agent get_template(final_destination,mode) +bundle agent get_template(final_destination, mode) { vars: - - # This needs to ne preconfigured to your site - - "masterfiles" string => "/home/mark/tmp"; - "this_template" string => lastnode("$(final_destination)","/"); + # This needs to ne preconfigured to your site + "masterfiles" string => "/home/mark/tmp"; + "this_template" string => lastnode("$(final_destination)", "/"); files: - - "$(final_destination).staging" - + "$(final_destination).staging" comment => "Get template and expand variables for this host", - perms => mo("400","root"), - copy_from => remote_cp("$(masterfiles)/templates/$(this_template)","$(policy_server)"), + perms => mo("400", "root"), + copy_from => remote_cp( + "$(masterfiles)/templates/$(this_template)", "$(policy_server)" + ), action => if_elapsed("60"); - "$(final_destination)" - + "$(final_destination)" comment => "Expand the template", create => "true", edit_line => expand_template("$(final_destination).staging"), edit_defaults => empty, - perms => mo("$(mode)","root"), + perms => mo("$(mode)", "root"), action => if_elapsed("60"); - } diff --git a/examples/template_method-inline_mustache.cf b/examples/template_method-inline_mustache.cf index b78550f6c1..de6cbefede 100644 --- a/examples/template_method-inline_mustache.cf +++ b/examples/template_method-inline_mustache.cf @@ -1,53 +1,41 @@ # Copyright 2021 Northern.tech AS - # This file is part of Cfengine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ############################################################################### #+begin_src cfengine3 bundle agent example_using_template_method_inline_mustache { vars: + # Here we construct a data container that will be passed to the mustache + # templating engine + "d" data => '{ "host": "docs.cfengine.com" }'; - # Here we construct a data container that will be passed to the mustache - # templating engine - - "d" - data => '{ "host": "docs.cfengine.com" }'; - - # Here we specify a string that will be used as an inline mustache template - "mustache_template_string" - string => "Welcome to host '{{{host}}}'"; + # Here we specify a string that will be used as an inline mustache template + "mustache_template_string" string => "Welcome to host '{{{host}}}'"; files: - # Here we render the file using the data container and inline template specification - - "/tmp/example.txt" - create => "true", - template_method => "inline_mustache", - edit_template_string => "$(mustache_template_string)", - template_data => @(d); + # Here we render the file using the data container and inline template specification + "/tmp/example.txt" + create => "true", + template_method => "inline_mustache", + edit_template_string => "$(mustache_template_string)", + template_data => @(d); reports: - "/tmp/example.txt" - printfile => cat( $(this.promiser) ); + "/tmp/example.txt" printfile => cat($(this.promiser)); } # Copied from stdlib, lib/reports.cf @@ -55,13 +43,16 @@ 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"; } + bundle agent __main__ { - methods: "example_using_template_method_inline_mustache"; + methods: + "example_using_template_method_inline_mustache"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/test_environment.cf b/examples/test_environment.cf index 54f2be9e9a..14dd39f8d2 100644 --- a/examples/test_environment.cf +++ b/examples/test_environment.cf @@ -1,103 +1,80 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ####################################################### # # Guest environments # ####################################################### - body common control - { - bundlesequence => { "my_vm_cloud" }; + bundlesequence => { "my_vm_cloud" }; } ####################################################### - bundle agent my_vm_cloud - { guest_environments: - - scope||any:: # These should probably be in class "any" to ensure uniqueness - + scope||any:: # These should probably be in class "any" to ensure uniqueness "test2" - - environment_resources => my_environment, - environment_interface => vnet("eth0,192.168.1.100/24"), - environment_type => "test", - environment_state => "create", - environment_host => "atlas"; - + environment_resources => my_environment, + environment_interface => vnet("eth0,192.168.1.100/24"), + environment_type => "test", + environment_state => "create", + environment_host => "atlas"; "test2" - - environment_resources => my_environment, - environment_interface => vnet("eth0,192.168.1.101/24"), - environment_type => "test", - environment_state => "delete", - environment_host => "atlas"; - + environment_resources => my_environment, + environment_interface => vnet("eth0,192.168.1.101/24"), + environment_type => "test", + environment_state => "delete", + environment_host => "atlas"; "test4" - - environment_resources => my_environment, - environment_interface => vnet("eth0,192.168.1.102/24"), - environment_type => "test", - environment_state => "create", - environment_host => "atlas"; + environment_resources => my_environment, + environment_interface => vnet("eth0,192.168.1.102/24"), + environment_type => "test", + environment_state => "create", + environment_host => "atlas"; "network1" - environment_type => "test_net", - environment_state => "create", - environment_host => "atlas"; - + environment_type => "test_net", + environment_state => "create", + environment_host => "atlas"; - # default environment_state => "create" on host, and "suspended elsewhere" + # default environment_state => "create" on host, and "suspended elsewhere" } ####################################################### - body environment_resources my_environment { - env_cpus => "2"; - env_memory => "512"; # in KB - env_disk => "1024"; # in MB + env_cpus => "2"; + env_memory => "512"; # in KB + env_disk => "1024"; # in MB } ####################################################### - body environment_interface vnet(primary) { - env_name => "$(this.promiser)"; - env_addresses => { "$(primary)" }; - - host1:: - - env_network => "default_vnet1"; - - host2:: + env_name => "$(this.promiser)"; + env_addresses => { "$(primary)" }; - env_network => "default_vnet2"; + host1:: + env_network => "default_vnet1"; + host2:: + env_network => "default_vnet2"; } diff --git a/examples/tidy_all_files.cf b/examples/tidy_all_files.cf index 413b8e38d7..b7d8c539d4 100644 --- a/examples/tidy_all_files.cf +++ b/examples/tidy_all_files.cf @@ -1,87 +1,63 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ####################################################### # # Deleting files, like cf2 tidy age=0 r=inf # ####################################################### - body common control - { - any:: - - bundlesequence => { "example" }; + any:: + bundlesequence => { "example" }; } ############################################ - bundle agent example - { files: - - "/home/mark/tmp/test_to" - + "/home/mark/tmp/test_to" delete => tidyfiles, file_select => zero_age, depth_search => recurse("inf"); - # Now delete the parent. - - "/home/mark/tmp/testcopy" - delete => tidyfiles; + # Now delete the parent. + "/home/mark/tmp/testcopy" delete => tidyfiles; } ######################################################### - body depth_search recurse(d) - { - #include_basedir => "true"; - depth => "$(d)"; + #include_basedir => "true"; + depth => "$(d)"; } ######################################################### - body delete tidyfiles - { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ######################################################### - body file_select zero_age - -# # we can build old "include", "exclude", and "ignore" # from these as standard patterns - these bodies can # form a library of standard patterns -# - { - mtime => irange(ago(1,0,0,0,0,0),now); - file_result => "mtime"; + mtime => irange(ago(1, 0, 0, 0, 0, 0), now); + file_result => "mtime"; } diff --git a/examples/translatepath.cf b/examples/translatepath.cf index 8271a24f93..e7033a7c80 100644 --- a/examples/translatepath.cf +++ b/examples/translatepath.cf @@ -1,44 +1,38 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } bundle agent test { vars: - "inputs_dir" string => translatepath("/a/b/c/inputs"); + "inputs_dir" string => translatepath("/a/b/c/inputs"); reports: - windows:: "The path has backslashes: $(inputs_dir)"; !windows:: "The path has slashes: $(inputs_dir)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/type.cf b/examples/type.cf index 07ab7a2032..b8ea1b4dfe 100644 --- a/examples/type.cf +++ b/examples/type.cf @@ -1,36 +1,32 @@ #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { vars: - "foo" - data => '{ "bar": true, "baz": [1, 2, 3] }'; - - "_foo" string => type("foo", "true"); - "_foobar" string => type("foo[bar]", "false"); - "_foobaz" string => type("foo[baz]", "true"); - - "a" string => "hello"; - "b" int => "123"; - "c" rlist => { "1.1", "2.2", "3.3" }; - - "_a" string => type("a"); - "_b" string => type("b", "true"); - "_c" string => type("c", "false"); + "foo" data => '{ "bar": true, "baz": [1, 2, 3] }'; + "_foo" string => type("foo", "true"); + "_foobar" string => type("foo[bar]", "false"); + "_foobaz" string => type("foo[baz]", "true"); + "a" string => "hello"; + "b" int => "123"; + "c" rlist => { "1.1", "2.2", "3.3" }; + "_a" string => type("a"); + "_b" string => type("b", "true"); + "_c" string => type("c", "false"); reports: - "'foo' is of type '$(_foo)' (detail)"; - "'foo[bar]' is of type '$(_foobar)' (no detail)"; - "'foo[baz]' is of type '$(_foobaz)' (detail)"; - - "'a' is of type '$(_a)' (no detail)"; - "'b' is of type '$(_b)' (detail)"; - "'c' is of type '$(_c)' (no detail)"; + "'foo' is of type '$(_foo)' (detail)"; + "'foo[bar]' is of type '$(_foobar)' (no detail)"; + "'foo[baz]' is of type '$(_foobaz)' (detail)"; + "'a' is of type '$(_a)' (no detail)"; + "'b' is of type '$(_b)' (detail)"; + "'c' is of type '$(_c)' (no detail)"; } + #+end_src ############################################################################# #+begin_src example_output diff --git a/examples/unique.cf b/examples/unique.cf index 028f4b7673..86e2cf0124 100644 --- a/examples/unique.cf +++ b/examples/unique.cf @@ -1,50 +1,54 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "test" }; + bundlesequence => { "test" }; } 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", }; - "test_str" string => join(",", "test"); - "test_unique" slist => unique("test"); - "unique_str" string => join(",", "test_unique"); + "test_str" string => join(",", "test"); + "test_unique" slist => unique("test"); + "unique_str" string => join(",", "test_unique"); reports: - "The test list is $(test_str)"; - "The unique elements of the test list: $(unique_str)"; + "The test list is $(test_str)"; + "The unique elements of the test list: $(unique_str)"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/unpack_method_calls.cf b/examples/unpack_method_calls.cf index 7f0a8dae58..9a6b846fbe 100644 --- a/examples/unpack_method_calls.cf +++ b/examples/unpack_method_calls.cf @@ -1,39 +1,40 @@ #+begin_src cfengine3 body common control { - bundlesequence => { run }; + bundlesequence => { run }; } bundle agent run { vars: - "todo" slist => { "call_1,a,b", "call_2,x,y", "call_2,p,q" }; + "todo" slist => { "call_1,a,b", "call_2,x,y", "call_2,p,q" }; methods: - "call" usebundle => unpack($(todo)); + "call" usebundle => unpack($(todo)); } bundle agent unpack(list) { vars: - "split" slist => splitstring($(list), ",", "100"); - "method" string => nth("split", "0"); - "param1" string => nth("split", "1"); - "param2" string => nth("split", "2"); + "split" slist => splitstring($(list), ",", "100"); + "method" string => nth("split", "0"); + "param1" string => nth("split", "1"); + "param2" string => nth("split", "2"); methods: - "relay" usebundle => $(method)($(param1), $(param2)); + "relay" usebundle => $(method)($(param1), $(param2)); } bundle agent call_1(p1, p2) { reports: - "$(this.bundle): called with parameters $(p1) and $(p2)"; + "$(this.bundle): called with parameters $(p1) and $(p2)"; } bundle agent call_2(p1, p2) { reports: - "$(this.bundle): called with parameters $(p1) and $(p2)"; + "$(this.bundle): called with parameters $(p1) and $(p2)"; } + #+end_src diff --git a/examples/update.cf b/examples/update.cf index 0c1a93656d..862d9cdf67 100644 --- a/examples/update.cf +++ b/examples/update.cf @@ -1,67 +1,55 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #cop update,example #cop What should a failsafe and update file contain?,example - # Minimum failsafe - body common control { - bundlesequence => { "update" }; + bundlesequence => { "update" }; } bundle agent update { vars: + "master_location" string => "$(sys.workdir)/masterfiles"; - "master_location" string => "$(sys.workdir)/masterfiles"; - - "policy_server" string => readfile("$(sys.workdir)/policy_server.dat",40), + "policy_server" + string => readfile("$(sys.workdir)/policy_server.dat", 40), comment => "IP address to locate your policy host."; classes: - - "policy_host" or => { - classmatch(canonify("ipv4_$(policy_server)")), - classmatch(canonify("$(policy_server)")) + "policy_host" + or => { + classmatch(canonify("ipv4_$(policy_server)")), + classmatch(canonify("$(policy_server)")), }, - comment => "Define the ip identity of the policy source host"; - "have_ppkeys" expression => fileexists("$(sys.workdir)/ppkeys/localhost.pub"); + "have_ppkeys" + expression => fileexists("$(sys.workdir)/ppkeys/localhost.pub"); - "nofile" expression => fileexists("$(sys.workdir)/policy_server.dat"); + "nofile" expression => fileexists("$(sys.workdir)/policy_server.dat"); commands: - !have_ppkeys:: - "/var/cfengine/bin/cf-key"; files: - - "/var/cfengine/inputs" - + "/var/cfengine/inputs" handle => "update_policy", perms => u_p("600"), copy_from => u_scp("$(master_location)"), @@ -69,74 +57,56 @@ bundle agent update action => immediate; processes: - any:: - "cf-execd" restart_class => "start_exec"; policy_host:: - "cf-serverd" restart_class => "start_server"; commands: - start_exec:: - "$(sys.workdir)/bin/cf-execd" - action => logme("executor"); + "$(sys.workdir)/bin/cf-execd" action => logme("executor"); start_server:: - "$(sys.workdir)/bin/cf-serverd" - action => logme("server"); + "$(sys.workdir)/bin/cf-serverd" action => logme("server"); reports: - bootstrap_mode.policy_host:: - "I am the policy host - i.e. with ipv4 address $(policy_server)"; - } ############################################ - body action logme(x) { - log_repaired => "stdout"; - log_string => " -> Started the $(x) (success)"; + log_repaired => "stdout"; + log_string => " -> Started the $(x) (success)"; } ############################################ - body perms u_p(p) - { - mode => "$(p)"; + mode => "$(p)"; } ############################################# - body copy_from u_scp(from) - { - source => "$(from)"; - compare => "digest"; - trustkey => "true"; - - !policy_host:: + source => "$(from)"; + compare => "digest"; + trustkey => "true"; - servers => { "$(policy_server)" }; + !policy_host:: + servers => { "$(policy_server)" }; } ######################################################### - body action immediate { - ifelapsed => "1"; + ifelapsed => "1"; } ############################################ - body depth_search u_recurse(d) - { - depth => "$(d)"; + depth => "$(d)"; } diff --git a/examples/user_edit.cf b/examples/user_edit.cf index 1a19d20ee9..066b1e8b2c 100644 --- a/examples/user_edit.cf +++ b/examples/user_edit.cf @@ -1,69 +1,59 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - -# - body common control { - bundlesequence => { "users" }; + bundlesequence => { "users" }; } body agent control { - abortbundleclasses => { "ldap_fail" }; + abortbundleclasses => { "ldap_fail" }; } ################################################################################ - bundle agent users { vars: - - "users" slist => { "mark", "nakarin", "jonhenrik" }; + "users" slist => { "mark", "nakarin", "jonhenrik" }; files: - - "/tmp/passwd2" - + "/tmp/passwd2" create => "true", edit_line => fix_passwd("$(users)"); reports: - !ldap_fail:: - "Editing user $(users)"; } ################################################################################################### - bundle edit_line fix_passwd(x) { classes: - - "ldap_fail" not => ldaparray("dat","ldap://eternity.iu.hio.no","dc=cfengine,dc=com","(uid=$(x))","subtree","none"); + "ldap_fail" + not => ldaparray( + "dat", + "ldap://eternity.iu.hio.no", + "dc=cfengine,dc=com", + "(uid=$(x))", + "subtree", + "none" + ); insert_lines: - - "Hello $(x),$(dat[uid]),$(dat[gecos])"; + "Hello $(x),$(dat[uid]),$(dat[gecos])"; } diff --git a/examples/user_edit_method.cf b/examples/user_edit_method.cf index fc1a354925..a1878c0f45 100644 --- a/examples/user_edit_method.cf +++ b/examples/user_edit_method.cf @@ -1,81 +1,66 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - -# - body common control { - bundlesequence => { "users" }; + bundlesequence => { "users" }; } body agent control { - abortbundleclasses => { "ldap_fail" }; + abortbundleclasses => { "ldap_fail" }; } #################################################################################### - bundle agent users { vars: - - "users" slist => { "mark", "nakarin", "three" }; + "users" slist => { "mark", "nakarin", "three" }; methods: - - "all" usebundle => fix_user("$(users)"); - + "all" usebundle => fix_user("$(users)"); } ################################################################################### - bundle agent fix_user(x) - { classes: - - "ldap_fail" not => ldaparray("dat","ldap://eternity.iu.hio.no","dc=cfengine,dc=com","(uid=$(x))","subtree","none"); + "ldap_fail" + not => ldaparray( + "dat", + "ldap://eternity.iu.hio.no", + "dc=cfengine,dc=com", + "(uid=$(x))", + "subtree", + "none" + ); files: - - "/tmp/passwd" - + "/tmp/passwd" create => "true", edit_line => fix_passwd("$(x)"); reports: - !ldap_fail:: - "Editing user $(x)"; } #################################################################################### - bundle edit_line fix_passwd(x) - { insert_lines: - - "Hello $(x),$(fix_user.dat[uid]),$(fix_user.dat[gecos])"; + "Hello $(x),$(fix_user.dat[uid]),$(fix_user.dat[gecos])"; } diff --git a/examples/userexists.cf b/examples/userexists.cf index 979a8f4f97..938c50105f 100644 --- a/examples/userexists.cf +++ b/examples/userexists.cf @@ -1,47 +1,38 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } bundle agent example { classes: - - "ok" expression => userexists("root"); + "ok" expression => userexists("root"); reports: - ok:: - "Root exists"; !ok:: - "Root does not exist"; } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/useringroup.cf b/examples/useringroup.cf index 0c594ed0bf..abc11b9ee4 100644 --- a/examples/useringroup.cf +++ b/examples/useringroup.cf @@ -1,5 +1,5 @@ #+begin_src cfengine3 -body common control +body common control { bundlesequence => { "example" }; } @@ -7,15 +7,16 @@ body common control bundle agent example { classes: - "root_in_root" - expression => useringroup("root", "root"); + "root_in_root" expression => useringroup("root", "root"); reports: root_in_root:: "root is indeed in the root group"; + !root_in_root:: "something went wrong"; } + #+end_src ############################################################################# #+begin_src example_output diff --git a/examples/users_type.cf b/examples/users_type.cf index aebf87cfa2..1c3c3b55da 100644 --- a/examples/users_type.cf +++ b/examples/users_type.cf @@ -7,8 +7,8 @@ body file control bundle agent main { vars: - "users" slist => { "jack", "john" }; - "skel" string => "/etc/skel"; + "users" slist => { "jack", "john" }; + "skel" string => "/etc/skel"; users: !windows:: @@ -17,8 +17,8 @@ bundle agent main home_dir => "/home/$(users)", home_bundle => home_skel($(users), $(skel)); } -### Users main END ### +### Users main END ### ### Home Bundle BEGIN ### bundle agent home_skel(user, skel) # @brief Initialize a user's home directory with the contents of skel @@ -31,17 +31,17 @@ bundle agent home_skel(user, skel) copy_from => seed_cp($(skel)), depth_search => recurse("inf"); } -### Home Bundle END ### +### Home Bundle END ### ### Locked User BEGIN ### bundle agent service_accounts { vars: - "users" slist => { "apache", "libuuid" }; + "users" slist => { "apache", "libuuid" }; users: !windows:: - "$(users)" - policy => "locked"; + "$(users)" policy => "locked"; } + ### Locked User END ### diff --git a/examples/validdata.cf b/examples/validdata.cf index f9bb636964..5c2f4ea6e5 100644 --- a/examples/validdata.cf +++ b/examples/validdata.cf @@ -4,18 +4,20 @@ bundle agent main vars: "json_string" string => '{"test": [1, 2, 3]}'; "primitive" string => "\"hello\""; - + reports: - "This JSON string is valid!" - if => validdata("$(json_string)", "JSON"); + "This JSON string is valid!" if => validdata("$(json_string)", "JSON"); + "This JSON string is not valid." unless => validdata("$(json_string)", "JSON"); "This JSON string is valid! (strict)" if => validdata("$(primitive)", "JSON", "true"); + "This JSON string is not valid. (strict)" unless => validdata("$(primitive)", "JSON", "true"); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/validjson.cf b/examples/validjson.cf index c11eca8b3b..38ac3aeeb8 100644 --- a/examples/validjson.cf +++ b/examples/validjson.cf @@ -6,13 +6,12 @@ bundle agent main "primitive" string => "\"hello\""; reports: - "This JSON string is valid!" - if => validjson("$(json_string)"); - "This JSON string is not valid." - unless => validjson("$(json_string)"); + "This JSON string is valid!" if => validjson("$(json_string)"); + "This JSON string is not valid." unless => validjson("$(json_string)"); "This JSON string is valid! (strict)" if => validjson("$(primitive)", "true"); + "This JSON string is not valid. (strict)" unless => validjson("$(primitive)", "true"); } diff --git a/examples/varclass.cf b/examples/varclass.cf index 8eacead6ad..07a49b281d 100644 --- a/examples/varclass.cf +++ b/examples/varclass.cf @@ -1,48 +1,28 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################################### - bundle agent example - -{ +{ commands: - - "/bin/echo This is linux" - - if => "linux"; - - - "/bin/echo This is solaris" - - if => "solaris"; - + "/bin/echo This is linux" if => "linux"; + "/bin/echo This is solaris" if => "solaris"; } - diff --git a/examples/varexpansion.cf b/examples/varexpansion.cf index 6f30ee2818..f64525725e 100644 --- a/examples/varexpansion.cf +++ b/examples/varexpansion.cf @@ -1,54 +1,36 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - - - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ########################################################### - bundle agent example - -{ +{ vars: - - "scalar1" string => "SCALAR 1"; - "list1" slist => { "LIST1_1", "LIST1_2" } ; - - "array[1]" string => "ARRAY 1"; - "array[2]" string => "ARRAY 2"; - - "i" slist => getindices("array"); + "scalar1" string => "SCALAR 1"; + "list1" slist => { "LIST1_1", "LIST1_2" }; + "array[1]" string => "ARRAY 1"; + "array[2]" string => "ARRAY 2"; + "i" slist => getindices("array"); reports: - "Scalar $(scalar1)"; - - "LIst $(list1)"; - - "Array $(array[$(i)])"; - + "Scalar $(scalar1)"; + "LIst $(list1)"; + "Array $(array[$(i)])"; } - diff --git a/examples/variablesmatching.cf b/examples/variablesmatching.cf index 647b598a9e..95273b3d8c 100644 --- a/examples/variablesmatching.cf +++ b/examples/variablesmatching.cf @@ -1,39 +1,34 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { run }; + bundlesequence => { run }; } bundle agent run { vars: - "all" slist => variablesmatching(".*"); - "v" slist => variablesmatching("default:sys.cf_version.*"); - "v_sorted" slist => sort(v, lex); + "all" slist => variablesmatching(".*"); + "v" slist => variablesmatching("default:sys.cf_version.*"); + "v_sorted" slist => sort(v, lex); + reports: - "Variables matching 'default:sys.cf_version.*' = $(v_sorted)"; + "Variables matching 'default:sys.cf_version.*' = $(v_sorted)"; } #+end_src diff --git a/examples/variablesmatching_as_data.cf b/examples/variablesmatching_as_data.cf index 19bc026792..97c1882feb 100644 --- a/examples/variablesmatching_as_data.cf +++ b/examples/variablesmatching_as_data.cf @@ -1,39 +1,34 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 body common control { - bundlesequence => { run }; + bundlesequence => { run }; } bundle agent run { vars: - "all" data => variablesmatching_as_data(".*"); # this is huge - "v" data => variablesmatching_as_data("default:sys.cf_version_major.*"); - "v_dump" string => format("%S", v); + "all" data => variablesmatching_as_data(".*"); # this is huge + "v" data => variablesmatching_as_data("default:sys.cf_version_major.*"); + "v_dump" string => format("%S", v); + reports: - "Variables matching 'default:sys.cf_version.*' = $(v_dump)"; + "Variables matching 'default:sys.cf_version.*' = $(v_dump)"; } #+end_src diff --git a/examples/varnet.cf b/examples/varnet.cf index d104643ff1..8e80bcd60e 100644 --- a/examples/varnet.cf +++ b/examples/varnet.cf @@ -1,14 +1,11 @@ - -body common control -{ - bundlesequence => { "example" }; -} - - - -bundle agent example -{ - reports: - "My default interface and ip4 address is $(sys.interface) and $(sys.ipv4)"; - "Can also extract $(sys.ipv4[Local_Area_Connection_3]), $(sys.ipv4_2[Wireless_Network_Connection])"; -} +body common control +{ + bundlesequence => { "example" }; +} + +bundle agent example +{ + reports: + "My default interface and ip4 address is $(sys.interface) and $(sys.ipv4)"; + "Can also extract $(sys.ipv4[Local_Area_Connection_3]), $(sys.ipv4_2[Wireless_Network_Connection])"; +} diff --git a/examples/vars.cf b/examples/vars.cf index 92b0b6c719..d9237bf2a7 100644 --- a/examples/vars.cf +++ b/examples/vars.cf @@ -1,39 +1,31 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - body common control { - bundlesequence => {"yes"}; + bundlesequence => { "yes" }; } - bundle agent yes { vars: - - "var" string => "/one/two/last1", + "var" + string => "/one/two/last1", comment => "This is a comment"; - - reports: - "Test = $(var)"; + reports: + "Test = $(var)"; } diff --git a/examples/version_compare.cf b/examples/version_compare.cf index e9859f67e1..5bf88c179f 100644 --- a/examples/version_compare.cf +++ b/examples/version_compare.cf @@ -4,9 +4,11 @@ bundle agent __main__ reports: "This will be skipped because the version comparison is false" if => version_compare("3.21.0", "<", "3.20.99"); + "This will be printed because the version comparison is true" if => version_compare("3.24.1", ">=", "3.24.1"); } + #+end_src ############################################################################### #+begin_src example_output diff --git a/examples/warnifline.cf b/examples/warnifline.cf index f86e560ce3..17a96ebeec 100644 --- a/examples/warnifline.cf +++ b/examples/warnifline.cf @@ -1,63 +1,47 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ######################################################## # # Warn if line matched # ######################################################## - body common control - { - bundlesequence => { "example" }; + bundlesequence => { "example" }; } ######################################################## - bundle agent example - { files: - - "/var/cfengine/inputs/.*" - + "/var/cfengine/inputs/.*" edit_line => DeleteLinesMatching(".*cfenvd.*"), action => WarnOnly; } ######################################################## - bundle edit_line DeleteLinesMatching(regex) { delete_lines: - - "$(regex)" action => WarnOnly; - + "$(regex)" action => WarnOnly; } ######################################################## - body action WarnOnly { - action_policy => "warn"; + action_policy => "warn"; } diff --git a/examples/webserver.cf b/examples/webserver.cf index d6458a5bc6..7b4b7a38bd 100644 --- a/examples/webserver.cf +++ b/examples/webserver.cf @@ -1,104 +1,67 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ####################################################### # # Apache 2 reconfig - modelled on SuSE # ####################################################### - body common control - { - any:: - - bundlesequence => { - apache - }; + any:: + bundlesequence => { apache }; } ####################################################### - bundle agent apache - { files: - - "/home/mark/tmp/apache2" # "/etc/sysconfig/apache2" - + "/home/mark/tmp/apache2" # "/etc/sysconfig/apache2" edit_line => fixapache; } ####################################################### # For the library ####################################################### - bundle edit_line fixapache - { # Values have the form NAME = "quoted space separated list" - vars: - - "add_modules" slist => { - "dav", - "dav_fs", - "ssl", - "php5", - "dav_svn", - "xyz", - "superduper" + "add_modules" + slist => { + "dav", "dav_fs", "ssl", "php5", "dav_svn", "xyz", "superduper" }; - "del_modules" slist => { - "php3", - "jk", - "userdir", - "imagemap", - "alias" - }; + "del_modules" slist => { "php3", "jk", "userdir", "imagemap", "alias" }; insert_lines: - - "APACHE_CONF_INCLUDE_FILES=\"/site/masterfiles/local-http.conf\""; + "APACHE_CONF_INCLUDE_FILES=\"/site/masterfiles/local-http.conf\""; field_edits: - - ##################################################################### - # APACHE_MODULES="authz_host actions alias auth_basic dav dav_fs imagemap ssl php5 dav_svn authz_default jk" - ##################################################################### - - "APACHE_MODULES=.*" - + ##################################################################### + # APACHE_MODULES="authz_host actions alias auth_basic dav dav_fs imagemap ssl php5 dav_svn authz_default jk" + ##################################################################### + "APACHE_MODULES=.*" # Insert module "columns" between the quoted RHS # using space separators + edit_field => quotedvar("$(add_modules)", "append"); - edit_field => quotedvar("$(add_modules)","append"); - - "APACHE_MODULES=.*" - + "APACHE_MODULES=.*" # Delte module "columns" between the quoted RHS # using space separators - - edit_field => quotedvar("$(del_modules)","delete"); + edit_field => quotedvar("$(del_modules)", "delete"); # if this line already exists, edit it } @@ -106,16 +69,13 @@ bundle edit_line fixapache ######################################## # Bodies ######################################## - -body edit_field quotedvar(newval,method) - +body edit_field quotedvar(newval, method) { - field_separator => "\""; - select_field => "2"; - value_separator => " "; - field_value => "$(newval)"; - field_operation => "$(method)"; - extend_fields => "false"; - allow_blank_fields => "true"; + field_separator => "\""; + select_field => "2"; + value_separator => " "; + field_value => "$(newval)"; + field_operation => "$(method)"; + extend_fields => "false"; + allow_blank_fields => "true"; } - diff --git a/examples/win_dns_client.cf b/examples/win_dns_client.cf index eb4d066952..c48d968076 100644 --- a/examples/win_dns_client.cf +++ b/examples/win_dns_client.cf @@ -1,27 +1,29 @@ # Ensures correct DNS settings for Windows DNS clients # Tested on: Windows Server 2003 32-bit, Windows Server 2008 R2 64-bit - - -body common control -{ - bundlesequence => { "windows_dns" }; -} - -bundle agent windows_dns -{ - vars: - "dns_servers" string => "192.168.1.3 192.168.1.4"; - - "keys" string => execresult("$(sys.winsysdir)\reg.exe query HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces", "noshell"); - "key_list" slist => splitstring("$(keys)", "\r\n", 50); - - - databases: - "$(key_list)" - comment => "Ensure DNS client configuration is correct", - handle => canonify("windows_dns_$(dns_servers)"), - database_operation => "create", - database_rows => { "NameServer,REG_SZ,$(dns_servers)" }, - database_type => "ms_registry", - if => not( strcmp("$(key_list)", "" )); -} +body common control +{ + bundlesequence => { "windows_dns" }; +} + +bundle agent windows_dns +{ + vars: + "dns_servers" string => "192.168.1.3 192.168.1.4"; + + "keys" + string => execresult( + "$(sys.winsysdir)\reg.exe query HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces", + "noshell" + ); + + "key_list" slist => splitstring("$(keys)", "\r\n", 50); + + databases: + "$(key_list)" + comment => "Ensure DNS client configuration is correct", + handle => canonify("windows_dns_$(dns_servers)"), + database_operation => "create", + database_rows => { "NameServer,REG_SZ,$(dns_servers)" }, + database_type => "ms_registry", + if => not(strcmp("$(key_list)", "")); +} diff --git a/examples/win_emergency.cf b/examples/win_emergency.cf index e4279ef885..6c8410c736 100644 --- a/examples/win_emergency.cf +++ b/examples/win_emergency.cf @@ -8,66 +8,46 @@ # by the server control policy). # ######################################################################### - -body common control -{ - bundlesequence => { "win_emergency" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; -} - -bundle agent win_emergency -{ - vars: - "disable_services" slist => { - "RemoteRegistry" # Windows Remote Management - }; - - "secure_files" slist => { - "C:\Secret", - "$(sys.workdir)\secret.txt" - }; - - "close_ports" slist => { - "6510", - "9300" - }; - - - commands: - - emergency:: - - "\"$(sys.winsysdir)\netsh.exe\"" - args => "firewall add portopening ALL $(close_ports) \"Port $(close_ports)\" DISABLE", - comment => "Close firewall ports on emergency"; - - - databases: - - emergency:: - - "HKEY_LOCAL_MACHINE\SOFTWARE\Northern.tech AS\Cfengine" - database_operation => "create", - database_rows => { "emergency,REG_SZ,This is an emergency!" } , - database_type => "ms_registry", - comment => "Create emergency policy registry settings"; - - - files: - - emergency:: - - "$(secure_files)" - acl => strict, - comment => "Secure important file access on emergency"; - - - services: - - emergency:: - - "$(disable_services)" - service_policy => "disable", - comment => "Disable security-relevant services on emergency"; - -} +body common control +{ + bundlesequence => { "win_emergency" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; +} + +bundle agent win_emergency +{ + vars: + "disable_services" + slist => { + "RemoteRegistry", # Windows Remote Management + }; + + "secure_files" slist => { "C:\Secret", "$(sys.workdir)\secret.txt" }; + "close_ports" slist => { "6510", "9300" }; + + commands: + emergency:: + "\"$(sys.winsysdir)\netsh.exe\"" + args => "firewall add portopening ALL $(close_ports) \"Port $(close_ports)\" DISABLE", + comment => "Close firewall ports on emergency"; + + databases: + emergency:: + "HKEY_LOCAL_MACHINE\SOFTWARE\Northern.tech AS\Cfengine" + database_operation => "create", + database_rows => { "emergency,REG_SZ,This is an emergency!" }, + database_type => "ms_registry", + comment => "Create emergency policy registry settings"; + + files: + emergency:: + "$(secure_files)" + acl => strict, + comment => "Secure important file access on emergency"; + + services: + emergency:: + "$(disable_services)" + service_policy => "disable", + comment => "Disable security-relevant services on emergency"; +} diff --git a/examples/win_registry.cf b/examples/win_registry.cf index 0b66b91e9e..6a37215eee 100644 --- a/examples/win_registry.cf +++ b/examples/win_registry.cf @@ -3,92 +3,71 @@ # win_registry.cf - Windows Registry Management # ######################################################################### - -bundle agent win_registry -{ - vars: - - "cache_keys" slist => { - "HKEY_LOCAL_MACHINE\SOFTWARE\Northern.tech AS" - }; - - "reg_create" slist => - { - "value1,REG_SZ,this is the first value...", - "value2,REG_SZ,...and this is the second!" - }; - - "reg_delete" slist => - { - "value1" - }; - - - methods: - - # 1) Cfengine can cache and restore any part of the registry - - # "any" usebundle => registry_cache("@(win_registry.cache_keys)"); - # "any" usebundle => registry_restore("@(win_registry.cache_keys)"); - - # 2) Registry settings may also be explicitly defined/deleted in policy - - # "any" usebundle => registry_define("HKEY_LOCAL_MACHINE\SOFTWARE\Northern.tech AS\Cfengine", "@(win_registry.reg_create)"); - # "any" usebundle => registry_delete("HKEY_LOCAL_MACHINE\SOFTWARE\Northern.tech AS\Cfengine", "@(win_registry.reg_delete)"); -} - +bundle agent win_registry +{ + vars: + "cache_keys" slist => { "HKEY_LOCAL_MACHINE\SOFTWARE\Northern.tech AS" }; + + "reg_create" + slist => { + "value1,REG_SZ,this is the first value...", + "value2,REG_SZ,...and this is the second!", + }; + + "reg_delete" slist => { "value1" }; + + methods: + + # 1) Cfengine can cache and restore any part of the registry + # "any" usebundle => registry_cache("@(win_registry.cache_keys)"); + # "any" usebundle => registry_restore("@(win_registry.cache_keys)"); + # 2) Registry settings may also be explicitly defined/deleted in policy + # "any" usebundle => registry_define("HKEY_LOCAL_MACHINE\SOFTWARE\Northern.tech AS\Cfengine", "@(win_registry.reg_create)"); + # "any" usebundle => registry_delete("HKEY_LOCAL_MACHINE\SOFTWARE\Northern.tech AS\Cfengine", "@(win_registry.reg_delete)"); +} + ######################################################################### - -bundle agent registry_cache(keys) -{ - databases: - windows:: - - "$(keys)" - database_operation => "cache", - database_type => "ms_registry", - comment => "Save correct registry settings"; -} - +bundle agent registry_cache(keys) +{ + databases: + windows:: + "$(keys)" + database_operation => "cache", + database_type => "ms_registry", + comment => "Save correct registry settings"; +} + ######################################################################### - -bundle agent registry_restore(keys) -{ - databases: - windows:: - - "$(keys)" - database_operation => "restore", - database_type => "ms_registry", - comment => "Make sure correct registry settings are set, according to cached version"; -} - +bundle agent registry_restore(keys) +{ + databases: + windows:: + "$(keys)" + database_operation => "restore", + database_type => "ms_registry", + comment => "Make sure correct registry settings are set, according to cached version"; +} + ######################################################################### - -bundle agent registry_define(key, contents) -{ - databases: - windows:: - - "$(key)" - - database_operation => "create", - database_rows => { "$(contents)" } , - database_type => "ms_registry", - comment => "Explicitly define important registry settings"; -} - +bundle agent registry_define(key, contents) +{ + databases: + windows:: + "$(key)" + database_operation => "create", + database_rows => { "$(contents)" }, + database_type => "ms_registry", + comment => "Explicitly define important registry settings"; +} + ######################################################################### - -bundle agent registry_delete(key, values) -{ - databases: - windows:: - - "$(key)" - - database_operation => "delete", - database_columns => { "@(values)" } , - database_type => "ms_registry", - comment => "Remove unwanted registry values"; -} +bundle agent registry_delete(key, values) +{ + databases: + windows:: + "$(key)" + database_operation => "delete", + database_columns => { "@(values)" }, + database_type => "ms_registry", + comment => "Remove unwanted registry values"; +} diff --git a/examples/win_schedule.cf b/examples/win_schedule.cf index 29d46b340f..af294113d2 100644 --- a/examples/win_schedule.cf +++ b/examples/win_schedule.cf @@ -9,57 +9,52 @@ # security and performance. # ######################################################################### - -body common control -{ - bundlesequence => { "system_scheduling" }; - inputs => { "$(sys.libdir)/stdlib.cf" }; -} - -bundle agent system_scheduling -{ - vars: - - # Command definitions are given in cmd[index]. - # The dependencies of the commands are dep_cmd[index], as boolean class expressions. - # Comments are given as comment_cmd[index] - - "cmd[1]" string => "$(sys.cf_key)"; - "dep_cmd[1]" string => "cmd2_success"; - "comment_cmd[1]" string => "Check that a Cfengine key is generated if command 2 has run (dummy)"; - - - windows:: - "cmd[2]" string => "\"$(sys.winsysdir)\shutdown.exe\" /r /c \"Cfengine automatic restart\" /t 120"; - "dep_cmd[2]" string => "Monday.Hr05.Min00_05"; - "comment_cmd[2]" string => "Restart windows every week"; - - "cmd[3]" string => "$(sys.winsysdir)\cscript.exe \"$(sys.workdir)\script1.vbs\" //Nologo > \"$(sys.workdir)\script1_out.txt\""; - "dep_cmd[3]" string => "Hr05.Min05_10"; - "comment_cmd[3]" string => "Run a script and save its output for later reference (needs to be run in shell)"; - - - !windows:: - - "cmd[2]" string => "/bin/echo Hello World!"; - "dep_cmd[2]" string => "Hr12.Min00_05"; - "comment_cmd[2]" string => "Print a message (dummy)"; - - - any:: - - "cmd_index" slist => getindices("cmd"); - - - commands: - - # Runs a command if its dependencies are satisfied - - "$(cmd[$(cmd_index)])" - classes => if_repaired("cmd$(cmd_index)_success"), - if => "$(dep_cmd[$(cmd_index)])", - contain => in_shell, - comment => "$(comment_cmd[$(cmd_index)])"; - -} - +body common control +{ + bundlesequence => { "system_scheduling" }; + inputs => { "$(sys.libdir)/stdlib.cf" }; +} + +bundle agent system_scheduling +{ + vars: + # Command definitions are given in cmd[index]. + # The dependencies of the commands are dep_cmd[index], as boolean class expressions. + # Comments are given as comment_cmd[index] + "cmd[1]" string => "$(sys.cf_key)"; + "dep_cmd[1]" string => "cmd2_success"; + + "comment_cmd[1]" + string => "Check that a Cfengine key is generated if command 2 has run (dummy)"; + + windows:: + "cmd[2]" + string => "\"$(sys.winsysdir)\shutdown.exe\" /r /c \"Cfengine automatic restart\" /t 120"; + + "dep_cmd[2]" string => "Monday.Hr05.Min00_05"; + "comment_cmd[2]" string => "Restart windows every week"; + + "cmd[3]" + string => "$(sys.winsysdir)\cscript.exe \"$(sys.workdir)\script1.vbs\" //Nologo > \"$(sys.workdir)\script1_out.txt\""; + + "dep_cmd[3]" string => "Hr05.Min05_10"; + + "comment_cmd[3]" + string => "Run a script and save its output for later reference (needs to be run in shell)"; + + !windows:: + "cmd[2]" string => "/bin/echo Hello World!"; + "dep_cmd[2]" string => "Hr12.Min00_05"; + "comment_cmd[2]" string => "Print a message (dummy)"; + + any:: + "cmd_index" slist => getindices("cmd"); + + commands: + # Runs a command if its dependencies are satisfied + "$(cmd[$(cmd_index)])" + classes => if_repaired("cmd$(cmd_index)_success"), + if => "$(dep_cmd[$(cmd_index)])", + contain => in_shell, + comment => "$(comment_cmd[$(cmd_index)])"; +} diff --git a/examples/with.cf b/examples/with.cf index 9a9ce649d9..9e10e36697 100644 --- a/examples/with.cf +++ b/examples/with.cf @@ -1,35 +1,32 @@ # Copyright 2021 Northern.tech AS - # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. - # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; version 3. - # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - # To the extent this program is licensed as part of the Enterprise # versions of Cfengine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - #+begin_src cfengine3 bundle agent main { vars: - "todo" slist => { "a 1", "b 2", "c 3" }; - # Here, `with` is the canonified version of $(todo), letting us avoid an - # intermediate canonification array. - "$(with)" string => "$(todo)", with => canonify($(todo)); + "todo" slist => { "a 1", "b 2", "c 3" }; + + # Here, `with` is the canonified version of $(todo), letting us avoid an + # intermediate canonification array. + "$(with)" + string => "$(todo)", + with => canonify($(todo)); - "complex" data => ' + "complex" data => ' { "x": 200, "y": [ 1, 2, null, true, false ] @@ -37,14 +34,14 @@ bundle agent main '; reports: - "For iterable '$(todo)' we created variable '$(with)' and its value is '$(todo)'" - with => canonify($(todo)); + "For iterable '$(todo)' we created variable '$(with)' and its value is '$(todo)'" + with => canonify($(todo)); - "We can print a data container compactly without creating a temporary variable: $(with)" - with => format("%S", complex); + "We can print a data container compactly without creating a temporary variable: $(with)" + with => format("%S", complex); - "We can print a data container fully without creating a temporary variable: $(with)" - with => storejson(complex); + "We can print a data container fully without creating a temporary variable: $(with)" + with => storejson(complex); } #+end_src diff --git a/examples/zenoss.cf b/examples/zenoss.cf index 45736fc610..9e9289eeb1 100644 --- a/examples/zenoss.cf +++ b/examples/zenoss.cf @@ -1,88 +1,71 @@ - ###################################################################### # # Zenoss integration template example # ###################################################################### - body common control { - bundlesequence => { "zenoss_host", "zenoss_client" }; - syslog_host => "zenoss_syslog.example.org"; - syslog_port => "514"; - inputs => { "$(sys.libdir)/stdlib.cf" }; + bundlesequence => { "zenoss_host", "zenoss_client" }; + syslog_host => "zenoss_syslog.example.org"; + syslog_port => "514"; + inputs => { "$(sys.libdir)/stdlib.cf" }; } ######################################################## - bundle agent zenoss_host { vars: + "cf_server_hosts" string => "cfengine_policy.example.org"; + "cf_doc_root" string => "/srv/www/html"; + "zCfengineComplianceFile" string => "/home/zenoss/compliance.zen"; - "cf_server_hosts" string => "cfengine_policy.example.org"; - "cf_doc_root" string => "/srv/www/html"; - "zCfengineComplianceFile" string => "/home/zenoss/compliance.zen"; - - files: - - # Assume Cfengine is running on the zenoss server to collect data - + files: + # Assume Cfengine is running on the zenoss server to collect data zenoss_syslog_example_org:: - "$(zCfengineComplianceFile)" - - comment => "Collect data from the Cfengine policy server", - perms => mo("644","zenoss"), - copy_from => secure_cp("$(cf_doc_root)/reports/summary.z","$(cf_server_host)"); - + comment => "Collect data from the Cfengine policy server", + perms => mo("644", "zenoss"), + copy_from => secure_cp( + "$(cf_doc_root)/reports/summary.z", "$(cf_server_host)" + ); } ######################################################## - bundle agent zenoss_client { processes: - - # On clients, we just pass any messages to the zenoss server - # for logging... - - "bad_process" - + # On clients, we just pass any messages to the zenoss server + # for logging... + "bad_process" comment => "Make sure that process X is not running, tell zenoss if it was", signals => { "term", "kill" }, action => tell_zenoss_repaired("bad_process was killed"); files: - - "/etc/passwd" - + "/etc/passwd" comment => "Check passwd security, tell zenoss if permissions were wrong", - perms => mog("644","root","root"), + perms => mog("644", "root", "root"), action => tell_zenoss_repaired("passwd file had incorrect permissions"); commands: - - "/my/important/script -xyz" - + "/my/important/script -xyz" comment => "Run my mission critical batch process", - action => tell_zenoss_failed("myscript failed to execute or returned error"); - + action => tell_zenoss_failed( + "myscript failed to execute or returned error" + ); } -# # Library stuff -# - body action tell_zenoss_repaired(x) { - log_repaired => "udp_syslog"; - log_string => "zenoss_cfengine_integration $(x) promise repaired"; - ifelapsed => "10"; # Every 10 mins + log_repaired => "udp_syslog"; + log_string => "zenoss_cfengine_integration $(x) promise repaired"; + ifelapsed => "10"; # Every 10 mins } body action tell_zenoss_failed(x) { - log_failed => "udp_syslog"; - log_string => "zenoss_cfengine_integration $(x) persistent problem"; - ifelapsed => "10"; # Every 10 mins + log_failed => "udp_syslog"; + log_string => "zenoss_cfengine_integration $(x) persistent problem"; + ifelapsed => "10"; # Every 10 mins } diff --git a/libpromises/failsafe.cf b/libpromises/failsafe.cf index 946e53a049..4a982176ce 100644 --- a/libpromises/failsafe.cf +++ b/libpromises/failsafe.cf @@ -1,4 +1,3 @@ -# # Copyright 2021 Northern.tech AS # # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. @@ -20,7 +19,6 @@ # versions of CFEngine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. - ########## CFEngine Bootstrap / Failsafe Policy ############################## # This file (failsafe.cf) is re-generated inside "inputs" directory every time # you bootstrap. This means that custom changes will be overwritten. @@ -29,74 +27,74 @@ # the policy hub for the first time when bootstrapping, and to recover the # system by fetching policies in case the standard agent run fails. ############################################################################## - body agent control { - # Bootstrapping can't continue without keys - abortclasses => { "no_ppkeys_ABORT_kept" }; - # Make sure that running failsafe many times in a row does not - # change functionality - ifelapsed => "0"; + # Bootstrapping can't continue without keys + abortclasses => { "no_ppkeys_ABORT_kept" }; + + # Make sure that running failsafe many times in a row does not + # change functionality + ifelapsed => "0"; } ################################################################################ - bundle agent main { meta: - - "description" - string => "Perform bootstrap or failsafe recovery operations."; + "description" + string => "Perform bootstrap or failsafe recovery operations."; vars: - # In order to preserve the log level used during bootstrap we build the - # string to set log level on any direct sub-agent calls based on classes - # that are defined when the options are set. - - # --log-level, -g value - Specify how detailed logs should be. - # Possible values: 'error', 'warning', 'notice', 'info', 'verbose', 'debug' - - "log_level" - string => ifelse("debug_mode", "--log-level=debug", - "verbose_mode", "--log-level=verbose", - "info_mode", "--log-level=info", - # CFE-4121 - Not yet implemented - # "notice_mode", "--log-level=notice", - # "warning_mode", "--log-level=warning", - # "error_mode", "--log-level=error", - ""); + # In order to preserve the log level used during bootstrap we build the + # string to set log level on any direct sub-agent calls based on classes + # that are defined when the options are set. + # --log-level, -g value - Specify how detailed logs should be. + # Possible values: 'error', 'warning', 'notice', 'info', 'verbose', 'debug' + "log_level" + string => ifelse( + "debug_mode", + "--log-level=debug", + "verbose_mode", + "--log-level=verbose", + "info_mode", + "--log-level=info", + # CFE-4121 - Not yet implemented + # "notice_mode", "--log-level=notice", + # "warning_mode", "--log-level=warning", + # "error_mode", "--log-level=error", + "" + ); methods: - - "Check Keys" - usebundle => failsafe_cfe_internal_checkkeys, - comment => "Without a valid keypair we aren't going to be able + "Check Keys" + usebundle => failsafe_cfe_internal_checkkeys, + comment => "Without a valid keypair we aren't going to be able to establish trust"; - "Fetch Inputs" - usebundle => failsafe_cfe_internal_update, - comment => "We need to fetch policy from upstream if we are + "Fetch Inputs" + usebundle => failsafe_cfe_internal_update, + comment => "We need to fetch policy from upstream if we are bootstrapping or if we are performing failsafe recovery."; - "Actuate Update Policy" - usebundle => failsafe_cfe_internal_call_update, - comment => "In order to speed up convergence and reporting we + "Actuate Update Policy" + usebundle => failsafe_cfe_internal_call_update, + comment => "In order to speed up convergence and reporting we trigger the update policy right after initial bootstrap. This allows the first scheduled run to happen with the most up to date and complete information."; - "Trigger Policy" - usebundle => failsafe_cfe_internal_trigger_policy, - comment => "In order to speed up convergence and reporting we + "Trigger Policy" + usebundle => failsafe_cfe_internal_trigger_policy, + comment => "In order to speed up convergence and reporting we trigger the whole policy right after initial bootstrap. This allows the first report to provide more complete data."; - "Report" - usebundle => failsafe_cfe_internal_report, - comment => "It's important to let the user know what happened + "Report" + usebundle => failsafe_cfe_internal_report, + comment => "It's important to let the user know what happened as the result of the bootstrap or failsafe operation."; } @@ -104,9 +102,9 @@ bundle agent main bundle agent failsafe_cfe_internal_checkkeys { classes: - "have_ppkeys" - expression => fileexists("$(sys.workdir)/ppkeys/localhost.pub"), - handle => "failsafe_cfe_internal_bootstrap_checkkeys_classes_have_ppkeys"; + "have_ppkeys" + expression => fileexists("$(sys.workdir)/ppkeys/localhost.pub"), + handle => "failsafe_cfe_internal_bootstrap_checkkeys_classes_have_ppkeys"; reports: !have_ppkeys:: @@ -115,36 +113,29 @@ bundle agent failsafe_cfe_internal_checkkeys } ################################################################################ - bundle agent failsafe_cfe_internal_update { vars: - - # A policy server cannot use the shortcut feature to resolve - # masterfiles since cf-serverd is potentially not yet up and - # running. - - # The unqualified path is used for non policy servers so that - # the policy server can use a shortcut to decide on behalf of - # the client which policy to serve by default. This is useful - # when running binaires from mixed sources (for example CFEngine - # produced binaries vs packages from the debian repository). - - "masterfiles_dir_remote" - string => ifelse( "policy_server", $(sys.masterdir), - "masterfiles" ); + # A policy server cannot use the shortcut feature to resolve + # masterfiles since cf-serverd is potentially not yet up and + # running. + # The unqualified path is used for non policy servers so that + # the policy server can use a shortcut to decide on behalf of + # the client which policy to serve by default. This is useful + # when running binaires from mixed sources (for example CFEngine + # produced binaries vs packages from the debian repository). + "masterfiles_dir_remote" + string => ifelse("policy_server", $(sys.masterdir), "masterfiles"); files: - - "$(sys.inputdir)" - handle => "failsafe_cfe_internal_bootstrap_update_files_sys_workdir_inputs_shortcut", - copy_from => failsafe_scp("$(masterfiles_dir_remote)"), - depth_search => failsafe_u_infinite_client_policy, - file_select => failsafe_exclude_vcs_files, - classes => failsafe_results("namespace", "inputdir_update"); + "$(sys.inputdir)" + handle => "failsafe_cfe_internal_bootstrap_update_files_sys_workdir_inputs_shortcut", + copy_from => failsafe_scp("$(masterfiles_dir_remote)"), + depth_search => failsafe_u_infinite_client_policy, + file_select => failsafe_exclude_vcs_files, + classes => failsafe_results("namespace", "inputdir_update"); !policy_server:: - "$(sys.workdir)/modules" handle => "failsafe_cfe_internal_bootstrap_update_files_sys_workdir_modules_shortcut", copy_from => failsafe_scp("modules"), @@ -153,7 +144,6 @@ bundle agent failsafe_cfe_internal_update classes => failsafe_results("namespace", "modulesdir_update"); !windows.inputdir_update_error:: - # When running on a *nix platform with homogeneous packages # $(sys.masterdir) is a good guess. This is never the case for # windows, and might be a poor guess if mixing packages from @@ -171,7 +161,6 @@ bundle agent failsafe_cfe_internal_update shortcut."; windows.inputdir_update_error:: - # Note: Windows can't use $(sys.masterdir) because no one runs a # hub on windows and the copy_from needs the remote path. "$(sys.inputdir)" @@ -186,7 +175,6 @@ bundle agent failsafe_cfe_internal_update shortcut."; windows:: - # TODO: Remove the use of bin-twin ref: Redmine #7364 "$(sys.workdir)\\bin-twin\\." handle => "failsafe_cfe_internal_bootstrap_update_files_sys_workdir_bin_twin_windows", @@ -196,45 +184,36 @@ bundle agent failsafe_cfe_internal_update comment => "Make sure we maintain a clone of the binaries and libraries for updating"; - processes: - - # TODO: Decide if this class guard is appropriate. Should we - # guard checking of cf-execd process running to when inputs are - # repaired + # TODO: Decide if this class guard is appropriate. Should we + # guard checking of cf-execd process running to when inputs are + # repaired !windows.inputdir_update_repaired:: - # We need to know when cf-execd is not running so that we can # start it when necessary. Windows and systemd hosts uses the service # manager instead of keying on individual processes. - - "cf-execd" restart_class => "cf_execd_not_running", + "cf-execd" + restart_class => "cf_execd_not_running", handle => "failsafe_cfe_internal_bootstrap_update_processes_start_cf_execd"; any:: - # We need to know if cf-serverd isn't running so that we can # start it when necessary. - - "cf-serverd" restart_class => "cf_serverd_not_running", + "cf-serverd" + restart_class => "cf_serverd_not_running", handle => "failsafe_cfe_internal_bootstrap_update_processes_start_cf_serverd"; commands: - cf_execd_not_running.!(windows|systemd|bootstrap_skip_services):: - # Windows and systemd do not launch cf-execd directly and are # handeled separately. - "$(sys.cf_execd)" handle => "failsafe_cfe_internal_bootstrap_update_commands_check_sys_cf_execd_start", classes => failsafe_results("namespace", "cf_execd_running"); cf_serverd_not_running.!(windows|systemd|bootstrap_skip_services):: - # cf-serverd is not launched directly on Windows and systemd and is # handled separately. - "$(sys.cf_serverd)" handle => "failsafe_cfe_internal_bootstrap_update_commands_check_sys_cf_serverd_start", action => failsafe_ifwin_bg, @@ -246,23 +225,19 @@ bundle agent failsafe_cfe_internal_update started by a separate policy."; cf_execd_not_running.systemd.!bootstrap_skip_services:: - # We explicitly use "restart", because it is possible that cf-serverd # is running, even if cf-execd isn't, for example. Here we want to be # sure we relaunch everything. - "/bin/systemctl restart cfengine3" -> { "CFE-1459" } handle => "failsafe_cfe_internal_bootstrap_update_commands_systemd_cfe_start", contain => bootstrap_command_silent, classes => failsafe_results("namespace", "systemctl_restart_cfengine3"); services: - - # TODO: Is this restriction to only promise the service running - # when inputs are repaired appropriate? Perhaps it should always - # be checked. + # TODO: Is this restriction to only promise the service running + # when inputs are repaired appropriate? Perhaps it should always + # be checked. windows.inputdir_update_repaired.!bootstrap_skip_services:: - "CfengineNovaExec" handle => "failsafe_cfe_internal_bootstrap_update_services_windows_executor", service_policy => "start", @@ -271,35 +246,29 @@ bundle agent failsafe_cfe_internal_update } ################################################################################ - bundle agent failsafe_cfe_internal_report { meta: - - "description" - string => "Report the outcome of the embedded + "description" + string => "Report the outcome of the embedded bootstrap/failsafe operation."; classes: - - # TODO: Determine if this is necessary and/or useful. Pre-eval - # might resolve this before policy update occurs, and this is - # probably most useful after policy update has been attempted. - - "have_promises_cf" - scope => "bundle", - expression => fileexists("$(sys.inputdir)/promises.cf"), - handle => "failsafe_cfe_internal_bootstrap_update_classes_have_promises_cf", - comment => "We expect to find promises.cf after policy has + # TODO: Determine if this is necessary and/or useful. Pre-eval + # might resolve this before policy update occurs, and this is + # probably most useful after policy update has been attempted. + "have_promises_cf" + scope => "bundle", + expression => fileexists("$(sys.inputdir)/promises.cf"), + handle => "failsafe_cfe_internal_bootstrap_update_classes_have_promises_cf", + comment => "We expect to find promises.cf after policy has been successfully copied from the policy server. If promises.cf is missing, then the bootstrap or failsafe recovery has likely failed."; reports: - !bootstrap_mode:: - "Built-in failsafe policy triggered" handle => "failsafe_cfe_internal_bootstrap_update_reports_failsafe_notification", comment => "Be sure to inform the user that the failsafe policy has @@ -308,29 +277,23 @@ bundle agent failsafe_cfe_internal_report configuration in body executor control."; bootstrap_mode:: - "Bootstrapping from host '$(sys.policy_hub)' via built-in policy '$(this.promise_filename)'" handle => "failsafe_cfe_internal_bootstrap_update_reports_bootstrap_notification", comment => "Be sure to inform the user that they have triggerd a bootstrap."; bootstrap_mode.policy_server:: - "This host assumes the role of policy server" - handle => "failsafe_cfe_internal_bootstrap_update_reports_assume_policy_hub"; + handle => "failsafe_cfe_internal_bootstrap_update_reports_assume_policy_hub"; bootstrap_mode.!policy_server:: - "This autonomous node assumes the role of voluntary client" - handle => "failsafe_cfe_internal_bootstrap_update_reports_assume_voluntary_client"; + handle => "failsafe_cfe_internal_bootstrap_update_reports_assume_voluntary_client"; inputdir_update_repaired:: - "Updated local policy from policy server" - handle => "failsafe_cfe_internal_bootstrap_update_reports_inputdir_update_repaired"; - + handle => "failsafe_cfe_internal_bootstrap_update_reports_inputdir_update_repaired"; inputdir_update_repaired.!have_promises_cf:: - # We used to display this report when we have fetched new # policy, but still can not find promises.cf in # sys.inputdir. However if the hub being bootstrapped to is down @@ -338,7 +301,6 @@ bundle agent failsafe_cfe_internal_report # # TODO: Come up with better conditions. These seem weak. # - Potentially use returnszero() with cf-promises? - "Failed to copy policy from policy server at $(sys.policy_hub):$(sys.masterdir) Please check * cf-serverd is running on $(sys.policy_hub) @@ -348,7 +310,7 @@ bundle agent failsafe_cfe_internal_report * masterfiles 'bundle server' -> access: -> masterfiles -> admit/deny It is often useful to restart cf-serverd in verbose mode (cf-serverd -v) on $(sys.policy_hub) to diagnose connection issues. When updating masterfiles, wait (usually 5 minutes) for files to propagate to inputs on $(sys.policy_hub) before retrying." - handle => "failsafe_cfe_internal_bootstrap_update_reports_did_not_get_policy"; + handle => "failsafe_cfe_internal_bootstrap_update_reports_did_not_get_policy"; trigger_policy_repaired:: "Triggered an initial run of the policy" @@ -359,66 +321,56 @@ bundle agent failsafe_cfe_internal_report handle => "failsafe_cfe_internal_bootstrap_trigger_policy_failed"; systemctl_restart_cfengine3_repaired:: - "Restarted systemd unit cfengine3" handle => "failsafe_cfe_intrnal_bootstrap_update_reports_systemd_unit_restarted"; systemctl_restart_cfengine3_error:: - "Error restarting systemd unit cfengine3" handle => "failsafe_cfe_intrnal_bootstrap_update_reports_systemd_unit_restarted"; cf_serverd_running_repaired:: - "Started the server" - handle => "failsafe_cfe_internal_bootstrap_update_reports_started_serverd"; + handle => "failsafe_cfe_internal_bootstrap_update_reports_started_serverd"; cf_serverd_running_failed:: - "Failed to start the server" - handle => "failsafe_cfe_internal_bootstrap_update_reports_failed_to_start_serverd"; + handle => "failsafe_cfe_internal_bootstrap_update_reports_failed_to_start_serverd"; cf_execd_running_repaired:: - "Started the scheduler" - handle => "failsafe_cfe_internal_bootstrap_update_reports_started_execd"; + handle => "failsafe_cfe_internal_bootstrap_update_reports_started_execd"; cf_execd_running_failed:: - "Failed to start the scheduler" - handle => "failsafe_cfe_internal_bootstrap_update_reports_failed_to_start_execd"; + handle => "failsafe_cfe_internal_bootstrap_update_reports_failed_to_start_execd"; } ################################################################################ - bundle agent failsafe_cfe_internal_call_update { vars: - - "mode" string => ifelse("bootstrap_mode", "bootstrap_mode", "failsafe_mode"); + "mode" + string => ifelse("bootstrap_mode", "bootstrap_mode", "failsafe_mode"); commands: - # On Windows we need cf-execd to call update.cf, otherwise the daemons will # not run under the SYSTEM account. !windows.!skip_policy_on_bootstrap:: "$(sys.cf_agent) -f $(sys.update_policy_path) --define $(mode) $(main.log_level)" handle => "failsafe_cfe_internal_call_update_commands_call_update_cf", - if => fileexists( $(sys.update_policy_path) ), + if => fileexists($(sys.update_policy_path)), comment => "We run update.cf in order to prepare system information for collection into CFEngine Enterprise more quickly."; } ################################################################################ - bundle agent failsafe_cfe_internal_trigger_policy { commands: - bootstrap_mode.!skip_policy_on_bootstrap:: "$(sys.cf_agent) --define bootstrap_mode $(main.log_level)" handle => "failsafe_cfe_internal_trigger_policy_commands_call_promises_cf", - if => fileexists( $(sys.default_policy_path) ), + if => fileexists($(sys.default_policy_path)), classes => failsafe_results("namespace", "trigger_policy"), comment => "We run promises.cf in order to prepare system information for collection into CFEngine Enterprise more quickly."; @@ -427,54 +379,62 @@ bundle agent failsafe_cfe_internal_trigger_policy ############################################ body copy_from failsafe_scp(from) { - source => "$(from)"; - compare => "digest"; - # This class is always set when bootstrapping. You can deactivate - # this class with --trust-server=no when bootstrapping - trust_server:: - trustkey => "true"; - !policy_server:: - servers => { "$(sys.policy_hub)" }; - portnumber => "$(sys.policy_hub_port)"; + source => "$(from)"; + compare => "digest"; + + # This class is always set when bootstrapping. You can deactivate + # this class with --trust-server=no when bootstrapping + trust_server:: + trustkey => "true"; + + !policy_server:: + servers => { "$(sys.policy_hub)" }; + portnumber => "$(sys.policy_hub_port)"; } + ############################################ body depth_search failsafe_u_infinite_client_policy # @brief Search recursively for files excluding vcs related files and .no-distrib directories # @param d Maximum depth to search recursively # Duplicated in update policy { - depth => "inf"; - exclude_dirs => { "\.svn", "\.git", "git-core", "\.no-distrib" }; + depth => "inf"; + exclude_dirs => { "\.svn", "\.git", "git-core", "\.no-distrib" }; } + ############################################ body depth_search failsafe_recurse(d) { - depth => "$(d)"; - exclude_dirs => { "\.svn", "\.git" }; + depth => "$(d)"; + exclude_dirs => { "\.svn", "\.git" }; } + ############################################ body file_select failsafe_exclude_vcs_files { - leaf_name => { "\.git.*", "\.mailmap" }; - file_result => "!leaf_name"; + leaf_name => { "\.git.*", "\.mailmap" }; + file_result => "!leaf_name"; } + ############################################ body service_method failsafe_bootstart { - service_autostart_policy => "boot_time"; + service_autostart_policy => "boot_time"; } + ############################################ body action failsafe_ifwin_bg { - windows:: - background => "true"; + windows:: + background => "true"; } + ############################################ body copy_from failsafe_cp(from) { - source => "$(from)"; - compare => "digest"; - copy_backup => "false"; + source => "$(from)"; + compare => "digest"; + copy_backup => "false"; } ############################################ @@ -487,31 +447,30 @@ body classes failsafe_results(scope, class_prefix) # @param class_prefix The prefix for the classes defined { scope => "$(scope)"; - - promise_kept => { "$(class_prefix)_reached", - "$(class_prefix)_kept" }; - - promise_repaired => { "$(class_prefix)_reached", - "$(class_prefix)_repaired" }; - - repair_failed => { "$(class_prefix)_reached", - "$(class_prefix)_error", - "$(class_prefix)_not_kept", - "$(class_prefix)_failed" }; - - repair_denied => { "$(class_prefix)_reached", - "$(class_prefix)_error", - "$(class_prefix)_not_kept", - "$(class_prefix)_denied" }; - - repair_timeout => { "$(class_prefix)_reached", - "$(class_prefix)_error", - "$(class_prefix)_not_kept", - "$(class_prefix)_timeout" }; + promise_kept => { "$(class_prefix)_reached", "$(class_prefix)_kept" }; + promise_repaired => { "$(class_prefix)_reached", "$(class_prefix)_repaired" }; + repair_failed => { + "$(class_prefix)_reached", + "$(class_prefix)_error", + "$(class_prefix)_not_kept", + "$(class_prefix)_failed", + }; + repair_denied => { + "$(class_prefix)_reached", + "$(class_prefix)_error", + "$(class_prefix)_not_kept", + "$(class_prefix)_denied", + }; + repair_timeout => { + "$(class_prefix)_reached", + "$(class_prefix)_error", + "$(class_prefix)_not_kept", + "$(class_prefix)_timeout", + }; } body contain bootstrap_command_silent # @brief Suppress command output { - no_output => "true"; + no_output => "true"; } 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..b6a38c8a40 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,59 @@ # 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_arglist.cf b/tests/acceptance/00_basics/01_compiler/trailing_comma_arglist.cf index ee419aac13..6ab05e8dcf 100644 --- a/tests/acceptance/00_basics/01_compiler/trailing_comma_arglist.cf +++ b/tests/acceptance/00_basics/01_compiler/trailing_comma_arglist.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..2a36fe4762 100644 --- a/tests/acceptance/00_basics/03_bodies/114.cf +++ b/tests/acceptance/00_basics/03_bodies/114.cf @@ -6,140 +6,141 @@ # 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)" }; + + "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/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/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..e95657486d 100644 --- a/tests/acceptance/00_basics/03_bodies/staging/214.cf +++ b/tests/acceptance/00_basics/03_bodies/staging/214.cf @@ -6,122 +6,122 @@ # 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"; } 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..3f5e9f57a3 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,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 => { "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..a75479a582 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,12 +1,16 @@ #!/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: @@ -14,11 +18,16 @@ bundle agent example expression => "any", 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 +39,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..eb176aab93 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,12 +1,16 @@ #!/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: @@ -14,51 +18,54 @@ bundle agent example expression => "any", 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 +73,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..35fe78363d 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,22 @@ #!/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 - reports: TRIGGERED:: "TRIGGERED is defined within $(this.namespace).$(this.bundle)"; @@ -24,11 +27,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 +48,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..c31e34b23b 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,12 +1,16 @@ #!/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: @@ -14,51 +18,54 @@ bundle agent example expression => "any", 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 +73,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..74056bea33 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,39 @@ 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..fb26f43890 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,17 +49,16 @@ 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" @@ -90,7 +85,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 +95,7 @@ bundle agent test if => not("!any"); classes: - any:: - # Simple expressions - unless is equivalent to if not: "defined_class_unless" expression => "any", @@ -150,19 +142,18 @@ 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" @@ -194,7 +185,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 +195,70 @@ bundle agent test expression => "any", scope => "namespace", if => not("!any"); - } bundle agent check { classes: - any:: - "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: 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..87e7f2d8f1 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,61 @@ # 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..d709268761 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,60 @@ # 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..0883de35ab 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,61 @@ # 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..bd80f9d047 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,66 @@ # 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 08df96c6b9..02f455de25 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: @@ -38,25 +38,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 cdbb1484eb..9153f7483a 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,11 +1,13 @@ { - "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::" ] - } + "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::" + ] + } } 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..c028df8525 100644 --- a/tests/acceptance/01_vars/01_basic/009.cf +++ b/tests/acceptance/01_vars/01_basic/009.cf @@ -3,48 +3,48 @@ # 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..1018133cf6 100644 --- a/tests/acceptance/01_vars/01_basic/CFE-628.cf +++ b/tests/acceptance/01_vars/01_basic/CFE-628.cf @@ -3,42 +3,37 @@ # 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..f120a59d5a 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,63 @@ # 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/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..4991e022f9 100644 --- a/tests/acceptance/01_vars/01_basic/parse_number.cf +++ b/tests/acceptance/01_vars/01_basic/parse_number.cf @@ -3,96 +3,114 @@ # 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) + "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"; - "whole" slist => { "digits", "zero", "negate", "spacey", - "kilo", "kibi", "mega", "mibi", "giga", "gibi" }; - "float" slist => { "pi", "nowt", "nogiga", "me2pi" }; + "pi" + string => "3.141592653589793238462643383279502884197169399375105820974"; - # 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"; + "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..cb2e788f18 100644 --- a/tests/acceptance/01_vars/02_functions/010.cf +++ b/tests/acceptance/01_vars/02_functions/010.cf @@ -3,44 +3,42 @@ # 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} }; - classes: - "ok" expression => "any"; # XXX # I don't know how to test hostsseen! + "hosts" slist => { @{test.hosts} }; + classes: + "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..cc59c32670 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,53 @@ 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..8032a987cc 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,53 @@ 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..e90f323f89 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,50 @@ 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..e9d1dbfafc 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,50 @@ 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..41a076f560 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,50 @@ 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..c8c73e774e 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,50 @@ 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..b0d9b0b64d 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,50 @@ 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..29f27ea27f 100644 --- a/tests/acceptance/01_vars/02_functions/054.cf +++ b/tests/acceptance/01_vars/02_functions/054.cf @@ -3,46 +3,43 @@ # 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..e296f8c358 100644 --- a/tests/acceptance/01_vars/02_functions/055.cf +++ b/tests/acceptance/01_vars/02_functions/055.cf @@ -3,46 +3,43 @@ # 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..890326546a 100644 --- a/tests/acceptance/01_vars/02_functions/065.cf +++ b/tests/acceptance/01_vars/02_functions/065.cf @@ -3,46 +3,43 @@ # 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..91a6a15b3a 100644 --- a/tests/acceptance/01_vars/02_functions/201.cf +++ b/tests/acceptance/01_vars/02_functions/201.cf @@ -3,37 +3,32 @@ # 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 - - "keys" slist => getindices("array"); + "array" string => "zero"; # Intentionally not an array + "keys" slist => getindices("array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -45,18 +40,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..eb163f6871 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,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 { vars: - "array" string => "blah"; # Intentionally not an array - - "vals" slist => getvalues("array"); + "array" string => "blah"; # Intentionally not an array + "vals" slist => getvalues("array"); files: - "$(G.testfile).actual" + "$(G.testfile).actual" create => "true", edit_line => test_insert; @@ -59,18 +55,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..77de9a99d8 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,36 @@ 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 +59,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..dcb02747ee 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: @@ -21,16 +20,15 @@ bundle agent test vars: "f" # false string => "(cfengine.(!cfengine))"; + "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 +37,8 @@ bundle agent test "(any.cfengine)", concat(and()), concat(and(and())), - }; + }; + "many_false" slist => { "(!any)", @@ -49,11 +48,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 +59,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 +76,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 +85,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 +94,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 +101,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 +110,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 +141,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 +148,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 +192,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..a1808eeb61 100644 --- a/tests/acceptance/01_vars/02_functions/classfiltercsv_1.cf +++ b/tests/acceptance/01_vars/02_functions/classfiltercsv_1.cf @@ -1,51 +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 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"; + + "d" + data => classfiltercsv( + $(data_file), + "true", # Data file contains column headings + 0 + ); # 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 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..bb9b429423 100644 --- a/tests/acceptance/01_vars/02_functions/classfiltercsv_2.cf +++ b/tests/acceptance/01_vars/02_functions/classfiltercsv_2.cf @@ -1,51 +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 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"; + + "d" + data => classfiltercsv( + $(data_file), + "false", # Data file contains column headings + 0 + ); # 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 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..ee9a3068da 100644 --- a/tests/acceptance/01_vars/02_functions/classfiltercsv_3.cf +++ b/tests/acceptance/01_vars/02_functions/classfiltercsv_3.cf @@ -1,52 +1,56 @@ body common control { - inputs => { "../../default.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..be863dcc57 100644 --- a/tests/acceptance/01_vars/02_functions/classfiltercsv_4.cf +++ b/tests/acceptance/01_vars/02_functions/classfiltercsv_4.cf @@ -1,51 +1,56 @@ body common control { - inputs => { "../../default.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"; + + "d" + data => classfiltercsv( + $(data_file), + "true", # Data file contains column headings + 0 + ); # 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 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..f81d81995f 100644 --- a/tests/acceptance/01_vars/02_functions/classfiltercsv_5.cf +++ b/tests/acceptance/01_vars/02_functions/classfiltercsv_5.cf @@ -1,51 +1,56 @@ body common control { - inputs => { "../../default.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"; + + "d" + data => classfiltercsv( + $(data_file), + "true", # Data file contains column headings + 0 + ); # 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 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..35658cd812 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,42 @@ 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..e8ec44e891 100644 --- a/tests/acceptance/01_vars/02_functions/data_regextract.cf +++ b/tests/acceptance/01_vars/02_functions/data_regextract.cf @@ -1,25 +1,31 @@ # 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); # this is one more than the valid indices + "parsed_$(pi)_$(si)" + data => data_regextract(nth(patterns, $(pi)), nth(strings, $(si))); - "parsed_$(pi)_$(si)" data => data_regextract(nth(patterns, $(pi)), - nth(strings, $(si))); - "parsed_$(pi)_$(si)_str" string => format("%S", "parsed_$(pi)_$(si)"); + "parsed_$(pi)_$(si)_str" string => format("%S", "parsed_$(pi)_$(si)"); reports: EXTRA:: @@ -29,7 +35,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 +54,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 +74,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/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..0f8a5471b2 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,54 +27,58 @@ 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"; @@ -84,6 +86,7 @@ bundle agent check "expected[permoct]" string => "666"; "expected[modeoct]" string => "100666"; "expected[permstr]" string => "-rw-rw-rw-"; + !windows:: "expected[size]" string => "42"; "expected[mode]" string => "33152"; # 100600 @@ -93,26 +96,30 @@ bundle agent check 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 181da562e0..6567110848 100644 --- a/tests/acceptance/01_vars/02_functions/findlocalusers.cf +++ b/tests/acceptance/01_vars/02_functions/findlocalusers.cf @@ -1,36 +1,39 @@ -body common control +body common control { inputs => { "../../default.sub.cf" }; bundlesequence => { default("$(this.promise_filename)") }; version => "1.0"; } + bundle agent init { vars: - # simple filters - "simple_filter" slist => { "name=root" }; - "number_filter" slist => { "uid=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 => { "uid=0.*" }; - "longer_regex" slist => { "name=ro.*", "uid=0.*" }; - - # non-existent user - "unknown" slist => { "name=thisuserdoesntexist" }; + # simple filters + "simple_filter" slist => { "name=root" }; + "number_filter" slist => { "uid=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 => { "uid=0.*" }; + "longer_regex" slist => { "name=ro.*", "uid=0.*" }; + + # non-existent user + "unknown" slist => { "name=thisuserdoesntexist" }; } -bundle agent test + +bundle agent test { meta: - "test_soft_fail" string => "windows|aix|solaris|hpux|redhat_10", - comment => "redhat_10 user name is 'Super User' not 'root'", - meta => { "CFE-2318" }; + "test_soft_fail" + string => "windows|aix|solaris|hpux|redhat_10", + comment => "redhat_10 user name is 'Super User' not 'root'", + meta => { "CFE-2318" }; vars: "ulist1" data => findlocalusers("@(init.simple_filter)"); @@ -41,12 +44,15 @@ bundle agent test "ulist6" data => findlocalusers("@(init.number_regex)"); "ulist7" data => 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/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/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 9e38de2018..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,43 +4,48 @@ # 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" ], - "bar": { "one": "1" "two": "2" } -}'); + "bar": { + "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/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..6504e30d9e 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,37 @@ # 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..8c7dc71b06 100644 --- a/tests/acceptance/01_vars/02_functions/isreadable.cf +++ b/tests/acceptance/01_vars/02_functions/isreadable.cf @@ -3,115 +3,141 @@ # 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..2a7d56459f 100644 --- a/tests/acceptance/01_vars/02_functions/length.cf +++ b/tests/acceptance/01_vars/02_functions/length.cf @@ -3,48 +3,43 @@ # 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..50c103319b 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,78 @@ 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..51cb28a4b4 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: @@ -21,16 +20,15 @@ bundle agent test vars: "f" # false string => "(cfengine.(!cfengine))"; + "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 +37,8 @@ bundle agent test "(any.cfengine)", concat(not(or())), concat(not(or(or()))), - }; + }; + "many_false" slist => { "(!any)", @@ -49,11 +48,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 +59,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 +76,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 +85,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 +94,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 +104,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 +133,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 +164,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 +171,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 +208,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..5976784933 100644 --- a/tests/acceptance/01_vars/02_functions/readdata.cf +++ b/tests/acceptance/01_vars/02_functions/readdata.cf @@ -3,47 +3,49 @@ # 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"); - - "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"); # 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_env" data => readdata("$(this.promise_filename).csv", "ENV"); - "failed_explicit_json" data => readdata($(this.promise_filename), "JSON"); - - "failed_guess" data => readdata($(this.promise_filename), "auto"); + "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"); # 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_env" + data => readdata("$(this.promise_filename).csv", "ENV"); + + "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..7e3fc3edd9 100644 --- a/tests/acceptance/01_vars/02_functions/readdata_yaml.cf +++ b/tests/acceptance/01_vars/02_functions/readdata_yaml.cf @@ -3,41 +3,42 @@ # 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..5c70611357 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,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: - "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..4e0ae6f68b 100644 --- a/tests/acceptance/01_vars/02_functions/regex_replace.cf +++ b/tests/acceptance/01_vars/02_functions/regex_replace.cf @@ -3,59 +3,79 @@ # 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..a6514ab45b 100644 --- a/tests/acceptance/01_vars/02_functions/sort.cf +++ b/tests/acceptance/01_vars/02_functions/sort.cf @@ -3,85 +3,117 @@ # 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..68a5159928 100644 --- a/tests/acceptance/01_vars/02_functions/staging/accumulated.cf +++ b/tests/acceptance/01_vars/02_functions/staging/accumulated.cf @@ -3,46 +3,43 @@ # 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..0281177c09 100644 --- a/tests/acceptance/01_vars/02_functions/staging/accumulated2.cf +++ b/tests/acceptance/01_vars/02_functions/staging/accumulated2.cf @@ -3,46 +3,43 @@ # 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 deleted file mode 100644 index e2a663eda6..0000000000 --- a/tests/acceptance/01_vars/02_functions/staging/datatype.cf +++ /dev/null @@ -1,269 +0,0 @@ -####################################################### -# -# Test datatype() -# -####################################################### - -body common control -{ - inputs => { "../../default.sub.cf" }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; -} - -####################################################### - -bundle agent init -{ - vars: - "results" string => 'jsonstring = { - "person": { - "first": "miyamoto", - "last": "musashi" - }, - "birth": null, - "death": 16450613, - "go rin no sho": { - "1": "ground", - "2": "water", - "3": "fire", - "4": "wind", - "5": "void" - }, - "dokkōdō": [ - "accept everything just the way it is.", - "do not seek pleasure for its own sake.", - "do not, under any circumstances, depend on a partial feeling.", - "think lightly of yourself and deeply of the world.", - "be detached from desire your whole life.", - "do not regret what you have done.", - "never be jealous.", - "never let yourself be saddened by a separation.", - "resentment and complaint are appropriate neither for oneself nor others.", - "do not let yourself be guided by the feeling of lust or love.", - "In all things, have no preferences.", - "be indifferent to where you live.", - "do not pursue the taste of good food.", - "do not hold on to possessions you no longer need.", - "do not act following customary beliefs.", - "do not collect weapons or practice with weapons beyond what is useful.", - "do not fear death.", - "do not seek to possess either goods or fiefs for your old age.", - "respect buddha and the gods without counting on their help.", - "you may abandon your own body but you must preserve your honor.", - "never stray from the way." - ], - "styles": [ - "two heavens as one", - "two swords as one" - ], - "decidable": false, - "dituri was here": 3.1416 -}'; - - "results2" string => '--------------------- -toplevel:key = person -toplevel:key = birth -toplevel:key = death -toplevel:key = go rin no sho -toplevel:key = dokkōdō -toplevel:key = styles -toplevel:key = decidable -toplevel:key = dituri was here -toplevel[person]:type = json_object -toplevel[birth]:type = json_null -toplevel[death]:type = json_integer -toplevel[go rin no sho]:type = json_object -toplevel[dokkōdō]:type = json_array -toplevel[styles]:type = json_array -toplevel[decidable]:type = json_bool -toplevel[dituri was here]:type = json_real ------------------------------------------- -toplevel[person]:key= first -toplevel[go rin no sho]:key= 1 -toplevel[dokkōdō]:key= 0 -toplevel[styles]:key= 0 -toplevel[person]:key= last -toplevel[go rin no sho]:key= 2 -toplevel[go rin no sho]:key= 3 -toplevel[go rin no sho]:key= 4 -toplevel[go rin no sho]:key= 5 -toplevel[dokkōdō]:key= 1 -toplevel[dokkōdō]:key= 2 -toplevel[dokkōdō]:key= 3 -toplevel[dokkōdō]:key= 4 -toplevel[dokkōdō]:key= 5 -toplevel[dokkōdō]:key= 6 -toplevel[dokkōdō]:key= 7 -toplevel[dokkōdō]:key= 8 -toplevel[dokkōdō]:key= 9 -toplevel[dokkōdō]:key= 10 -toplevel[dokkōdō]:key= 11 -toplevel[dokkōdō]:key= 12 -toplevel[dokkōdō]:key= 13 -toplevel[dokkōdō]:key= 14 -toplevel[dokkōdō]:key= 15 -toplevel[dokkōdō]:key= 16 -toplevel[dokkōdō]:key= 17 -toplevel[dokkōdō]:key= 18 -toplevel[dokkōdō]:key= 19 -toplevel[dokkōdō]:key= 20 -toplevel[styles]:key= 1'; - - "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 -toplevel[person][last]:type = json_string -toplevel[go rin no sho][2]:type = json_string -toplevel[go rin no sho][3]:type = json_string -toplevel[go rin no sho][4]:type = json_string -toplevel[go rin no sho][5]:type = json_string -toplevel[dokkōdō][1]:type = json_string -toplevel[dokkōdō][2]:type = json_string -toplevel[dokkōdō][3]:type = json_string -toplevel[dokkōdō][4]:type = json_string -toplevel[dokkōdō][5]:type = json_string -toplevel[dokkōdō][6]:type = json_string -toplevel[dokkōdō][7]:type = json_string -toplevel[dokkōdō][8]:type = json_string -toplevel[dokkōdō][9]:type = json_string -toplevel[dokkōdō][10]:type = json_string -toplevel[dokkōdō][11]:type = json_string -toplevel[dokkōdō][12]:type = json_string -toplevel[dokkōdō][13]:type = json_string -toplevel[dokkōdō][14]:type = json_string -toplevel[dokkōdō][15]:type = json_string -toplevel[dokkōdō][16]:type = json_string -toplevel[dokkōdō][17]:type = json_string -toplevel[dokkōdō][18]:type = json_string -toplevel[dokkōdō][19]:type = json_string -toplevel[dokkōdō][20]:type = json_string -toplevel[styles][1]:type = json_string -ok: datatype(datastr) failed properly'; - - files: - "$(G.testfile).expected" - create => "true", - edit_defaults => init_empty, - edit_line => init_insert; -} - -body edit_defaults init_empty -{ - empty_file_before_editing => "true"; - edit_backup => "false"; -} - -bundle edit_line init_insert -{ - insert_lines: - "$(init.results)"; - "$(init.results2)"; - "$(init.results3)"; -} - -####################################################### - -bundle common test_common -{ - vars: - "datastr" string => storejson("data"); - "data" data => parsejson(' -{ - "person": { "first": "miyamoto", "last": "musashi" }, - "birth": null, - "death": 16450613, - "go rin no sho": { "1": "ground", "2": "water", "3": "fire", "4": "wind", "5": "void" }, - "dokkōdō": [ - "accept everything just the way it is.", - "do not seek pleasure for its own sake.", - "do not, under any circumstances, depend on a partial feeling.", - "think lightly of yourself and deeply of the world.", - "be detached from desire your whole life.", - "do not regret what you have done.", - "never be jealous.", - "never let yourself be saddened by a separation.", - "resentment and complaint are appropriate neither for oneself nor others.", - "do not let yourself be guided by the feeling of lust or love.", - "In all things, have no preferences.", - "be indifferent to where you live.", - "do not pursue the taste of good food.", - "do not hold on to possessions you no longer need.", - "do not act following customary beliefs.", - "do not collect weapons or practice with weapons beyond what is useful.", - "do not fear death.", - "do not seek to possess either goods or fiefs for your old age.", - "respect buddha and the gods without counting on their help.", - "you may abandon your own body but you must preserve your honor.", - "never stray from the way." - ], - "styles": ["two heavens as one","two swords as one"], - "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)]"); - - "types[$(typenames)][$(keys[$(typenames)])]" - string => datatype("data[$(typenames)][$(keys[$(typenames)])]"); - - "bad_type_test" - string => datatype("datastr"); - - classes: - "ok_invalid_test_failed" not => isvariable("bad_type_test"); -} - - -bundle agent test -{ - files: - "$(G.testfile).actual" - create => "true", - edit_line => test_insert; -} - -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: datatype(datastr) failed properly"; - - !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)"); -} 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..55b68ae051 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 => string_length("$(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..a1a09bca43 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,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: - "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..0e0e7b896b 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" string => 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..e26ed5044b 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,70 @@ 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..c5f38e2bba 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" string => readfile("$(G.testfile)"); + "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..950f1c702c 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,105 @@ 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..b0eaa9b9d3 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" string => 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..23112a5ac0 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" string => readfile("$(G.testfile)"); + + "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..62baef2e4d 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" string => readfile("$(G.testfile)"); + + "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..01f1c9a8cf 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" string => readfile("$(G.testfile)"); + + "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..6aa8390f74 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" string => 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..0d2efd4db7 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" string => 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..64d4d3b3ab 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" string => 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..d664a44bc8 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" string => readfile("$(G.testfile)"); + "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..8713cbd6a9 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" string => 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..f558022b86 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" string => 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..9d3e0c8f78 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,68 @@ 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..717847a8be 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,67 @@ 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..5b8158e2c3 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,50 @@ 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..97c2000363 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,50 @@ 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..022cfe3391 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,68 @@ 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..39c2f01d7e 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,50 @@ 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..a332e383eb 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,50 @@ 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..8a0900e206 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,70 @@ 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..928e28154a 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,50 @@ 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..c48c6aefdc 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,50 @@ 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..21382e4567 100644 --- a/tests/acceptance/01_vars/02_functions/string.cf +++ b/tests/acceptance/01_vars/02_functions/string.cf @@ -1,30 +1,32 @@ 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 +34,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..264092c381 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,12 @@ -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..736092d749 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,49 @@ # 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..b492d686e9 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,104 @@ -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..f189c866ff 100644 --- a/tests/acceptance/01_vars/03_lists/007.cf +++ b/tests/acceptance/01_vars/03_lists/007.cf @@ -1,43 +1,41 @@ # 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..d16f8bc0e1 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,87 @@ 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..557ef96fcb 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,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).$(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..b1de26067b 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,31 @@ 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_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..017fd783de 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,45 @@ # 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_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..983dc4ca39 100644 --- a/tests/acceptance/02_classes/01_basic/staging/028.cf +++ b/tests/acceptance/02_classes/01_basic/staging/028.cf @@ -4,337 +4,335 @@ # 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..22a132b81c 100644 --- a/tests/acceptance/02_classes/02_functions/014.cf +++ b/tests/acceptance/02_classes/02_functions/014.cf @@ -3,40 +3,36 @@ # 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..8e20017d9e 100644 --- a/tests/acceptance/02_classes/02_functions/classesmatching.cf +++ b/tests/acceptance/02_classes/02_functions/classesmatching.cf @@ -3,69 +3,79 @@ # 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 bdb265f8e9..1ef22d44ab 100644 --- a/tests/acceptance/02_classes/02_functions/isipinsubnet-valid-ip.cf +++ b/tests/acceptance/02_classes/02_functions/isipinsubnet-valid-ip.cf @@ -3,49 +3,46 @@ # 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"; - - "test_soft_fail" - string => "any", - meta => { "CFE-3081"}; - vars: + "description" -> { "CFE-3081" } + string => "Test that isipinsubnet() validates IP addresses as valid especially within the 0.0.0.0/0 range"; - "variable_value_from_varible" string => "$(nosuch.variable)"; + "test_soft_fail" + string => "any", + meta => { "CFE-3081" }; - "candidates" slist => { "10.68.71.5", "10.168.171.5", "not-an-ip-address" }; + vars: + "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..9284d90eab 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,51 @@ # 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..c19281059c 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,64 @@ # 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:: - # 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:: + 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..5a29b95955 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,149 @@ 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 # 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 +210,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..1112602998 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,52 @@ # 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..15599635e5 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,52 @@ # 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..c591e6fb21 100644 --- a/tests/acceptance/07_packages/default_package_module.cf +++ b/tests/acceptance/07_packages/default_package_module.cf @@ -1,48 +1,52 @@ # 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..2863655089 100644 --- a/tests/acceptance/07_packages/package_module_interpreter.cf +++ b/tests/acceptance/07_packages/package_module_interpreter.cf @@ -1,50 +1,55 @@ # 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 8fb5e46ee9..724e340523 100644 --- a/tests/acceptance/10_files/01_create/013.cf +++ b/tests/acceptance/10_files/01_create/013.cf @@ -4,69 +4,66 @@ # 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: "test_skip_needs_work" string => "hpux"; 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..dc54190765 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,100 @@ # "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 - 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..47fad6c088 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,44 @@ # 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 +48,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..1d72cc7dfe 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,40 @@ 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 +87,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..9caf600719 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,39 @@ 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 +86,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..929e369649 100644 --- a/tests/acceptance/10_files/02_maintain/RM5411.cf +++ b/tests/acceptance/10_files/02_maintain/RM5411.cf @@ -1,31 +1,31 @@ # 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"; + "$(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..26dfed586e 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,306 @@ # 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..94c4576c7a 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,88 @@ # 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..6bf1155ed0 100644 --- a/tests/acceptance/10_files/03_transform/003.cf +++ b/tests/acceptance/10_files/03_transform/003.cf @@ -3,92 +3,90 @@ # 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..f7cd385444 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,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)"; # 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..bb1416d5d1 100644 --- a/tests/acceptance/10_files/05_classes/staging/007.cf +++ b/tests/acceptance/10_files/05_classes/staging/007.cf @@ -3,95 +3,96 @@ # 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..f44e3c3a16 100644 --- a/tests/acceptance/10_files/05_classes/staging/114.cf +++ b/tests/acceptance/10_files/05_classes/staging/114.cf @@ -6,121 +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)" }; + + "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/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..47701e3f92 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,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 { 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..05961adcd0 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,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.*$"; # 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..f56304f448 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,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)" - 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..d31891c702 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,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"; - 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..24d6166bd6 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,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: - # 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..1551d78fdc 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,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: - # 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..929cba4d54 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,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"; - 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..ce8b671b4e 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,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 "; # 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..7dedda9c7a 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,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"; - 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..9c2df88658 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,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"; - 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..7cf1b4cb46 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,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 "; # 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..d1b61c70c3 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,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 "; # 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..c4a4a263f0 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,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; - "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..cd6245be88 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,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"; - 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..43f67511ff 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,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 "; # 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..5f1e8952d8 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,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 { 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..09c19d46fb 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,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: - "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..3d1565fecb 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,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 { 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..08cba95d52 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,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)" + "$(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..199f92da28 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,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 { 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..40eb99d6dd 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,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: - "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..2b61f7bff4 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,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 { 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..f2c9c0d408 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,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)" + "$(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..64793bf392 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,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 { 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..a8cbdd5a37 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,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 ### 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..eafcf30e7e 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,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 ### 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..c0d857a310 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,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)" + "$(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..94307ccc95 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,44 @@ trailer"; bundle edit_line init_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..df9e1ab4a5 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,46 @@ 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..4a30c6681f 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,50 @@ 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..57615bc94c 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,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 => "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..7d162ab3c7 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,51 @@ # 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 +61,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..ba7f2efc47 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,16 +3,15 @@ # 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 @@ -20,7 +19,6 @@ body agent control { } ############################################################################## - bundle agent init { methods: @@ -28,7 +26,6 @@ bundle agent init } ############################################################################## - bundle agent test { meta: @@ -42,27 +39,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..703e3490b9 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,58 @@ 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 +124,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 +154,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 +194,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 +203,22 @@ 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..594eb3c910 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,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 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/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..b2e39a3958 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,17 @@ 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..085b6b1c6d 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,28 @@ 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..0725484f44 100644 --- a/tests/acceptance/10_files/templating/mustache_datastate_demo.cf +++ b/tests/acceptance/10_files/templating/mustache_datastate_demo.cf @@ -3,52 +3,46 @@ # 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 +53,11 @@ bundle agent test } ####################################################### - bundle agent check { vars: - "expect" string => '

Colors

+ "expect" + string => '

Colors

red green @@ -107,10 +101,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 +112,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..42338650ff 100644 --- a/tests/acceptance/15_control/01_common/004.cf +++ b/tests/acceptance/15_control/01_common/004.cf @@ -3,44 +3,41 @@ # 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..9415aa903a 100644 --- a/tests/acceptance/15_control/01_common/014.cf +++ b/tests/acceptance/15_control/01_common/014.cf @@ -3,44 +3,41 @@ # 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..04a0d56d89 100644 --- a/tests/acceptance/15_control/02_agent/002.cf +++ b/tests/acceptance/15_control/02_agent/002.cf @@ -3,56 +3,54 @@ # 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..8f00ccace4 100644 --- a/tests/acceptance/15_control/02_agent/003.cf +++ b/tests/acceptance/15_control/02_agent/003.cf @@ -3,56 +3,54 @@ # 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..b430891995 100644 --- a/tests/acceptance/15_control/02_agent/022.cf +++ b/tests/acceptance/15_control/02_agent/022.cf @@ -3,48 +3,45 @@ # 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..aa55a24925 100644 --- a/tests/acceptance/15_control/02_agent/023.cf +++ b/tests/acceptance/15_control/02_agent/023.cf @@ -3,56 +3,54 @@ # 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..16090ba3eb 100644 --- a/tests/acceptance/15_control/02_agent/031.cf +++ b/tests/acceptance/15_control/02_agent/031.cf @@ -3,47 +3,44 @@ # 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 26fc02a564..1b781c4fa2 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|redhat_10", - meta => { "ENT-10401", "ENT-13494" }; + "test_soft_fail" + string => "windows|redhat_10", + 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/19_security/other_writeable/group_write.cf b/tests/acceptance/19_security/other_writeable/group_write.cf index 73786f129c..95fbc2b014 100644 --- a/tests/acceptance/19_security/other_writeable/group_write.cf +++ b/tests/acceptance/19_security/other_writeable/group_write.cf @@ -3,19 +3,19 @@ # 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 common g { vars: - # This extracts the octal mode, and decimal nlink, uid, gid, size - "policy_file" string => ' + # This extracts the octal mode, and decimal nlink, uid, gid, size + "policy_file" + string => ' body common control { @@ -29,11 +29,9 @@ bundle agent test "Scarecrow: Well, some people without brains do an awful lot of talking don\'t they?"; }'; - } ####################################################### - bundle agent init { files: @@ -45,30 +43,31 @@ bundle agent init } ####################################################### - bundle agent test { - vars: - "agent_output" string => execresult("$(sys.cf_agent) -f $(G.testfile)", "noshell"), + "agent_output" + string => execresult("$(sys.cf_agent) -f $(G.testfile)", "noshell"), if => fileexists("$(G.testfile)"); classes: "security_exception" - expression => regcmp(".*is writable by others (security exception).*", "$(agent_output)"), + expression => regcmp( + ".*is writable by others (security exception).*", "$(agent_output)" + ), comment => "It's a security risk to evaluate policy that is writeable by users other than the owner"; } ####################################################### - bundle agent check { classes: - "ok" expression => "!security_exception"; + "ok" expression => "!security_exception"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/19_security/other_writeable/other_write.cf b/tests/acceptance/19_security/other_writeable/other_write.cf index 48ec961be3..24804a3a0f 100644 --- a/tests/acceptance/19_security/other_writeable/other_write.cf +++ b/tests/acceptance/19_security/other_writeable/other_write.cf @@ -3,19 +3,19 @@ # 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 common g { vars: - # This extracts the octal mode, and decimal nlink, uid, gid, size - "policy_file" string => ' + # This extracts the octal mode, and decimal nlink, uid, gid, size + "policy_file" + string => ' body common control { @@ -28,11 +28,9 @@ bundle agent test "We\'re not in KS anymore toto."; }'; - } ####################################################### - bundle agent init { files: @@ -44,31 +42,31 @@ bundle agent init } ####################################################### - bundle agent test { - vars: - "agent_output" string => execresult("$(sys.cf_agent) -f $(G.testfile)", "noshell"), + "agent_output" + string => execresult("$(sys.cf_agent) -f $(G.testfile)", "noshell"), if => fileexists("$(G.testfile)"); - classes: "security_exception" - expression => regcmp(".*is writable by others (security exception).*", "$(agent_output)"), + expression => regcmp( + ".*is writable by others (security exception).*", "$(agent_output)" + ), comment => "It's a security risk to evaluate policy that is writeable by users other than the owner"; } ####################################################### - bundle agent check { classes: - "ok" expression => "!security_exception"; + "ok" expression => "!security_exception"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } 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/array_reset.cf b/tests/acceptance/21_methods/array_reset.cf index c74f88a3c7..955173c0ca 100644 --- a/tests/acceptance/21_methods/array_reset.cf +++ b/tests/acceptance/21_methods/array_reset.cf @@ -3,41 +3,41 @@ # Redmine 6369 - make sure that arrays don't accumulate # ####################################################### - body common control { - inputs => { "../default.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: - "key_value" slist => { 1, 2, 3 }; + "key_value" slist => { 1, 2, 3 }; methods: - "in" usebundle => test_method($(key_value), $(key_value)); + "in" usebundle => test_method($(key_value), $(key_value)); } bundle agent test_method(key, value) { vars: - "array[$(key)]" string => "$(value)"; + "array[$(key)]" string => "$(value)"; } bundle agent check { vars: - "indices" slist => getindices("test_method.array"); - "dim" int => length("indices"); + "indices" slist => getindices("test_method.array"); + "dim" int => length("indices"); classes: - "ok" expression => strcmp("$(dim)", "1"); + "ok" expression => strcmp("$(dim)", "1"); reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; diff --git a/tests/acceptance/21_methods/call_methods_using_array_expansion.cf b/tests/acceptance/21_methods/call_methods_using_array_expansion.cf index 6b6ce245e1..d0aaa6476a 100644 --- a/tests/acceptance/21_methods/call_methods_using_array_expansion.cf +++ b/tests/acceptance/21_methods/call_methods_using_array_expansion.cf @@ -3,12 +3,11 @@ # Redmine 6369 - make sure that arrays don't accumulate # ####################################################### - body common control { - inputs => { "../default.sub.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,53 +17,47 @@ bundle agent init "$(G.dos2unix) $(this.promise_filename).expected.txt" -> { "ENT-10433" }; files: - "$(G.testdir)/reports.txt" - delete => tidy; + "$(G.testdir)/reports.txt" delete => tidy; } + bundle agent test { meta: - - "description" -> { "CFE-636" } - string => "Check that methods can be called by expanding classic - arrays"; + "description" -> { "CFE-636" } + string => "Check that methods can be called by expanding classic arrays"; vars: - - "b1" string => "b1"; - "b2" string => "b2"; - "b[b2]" string => "b2"; + "b1" string => "b1"; + "b2" string => "b2"; + "b[b2]" string => "b2"; methods: - - "${b1}" - usebundle => ${b1}; - "${b[b2]}" - usebundle => ${b[b2]}("param"); - "${b[b2]}" - usebundle => ${b[${b2}]}("param2"); + "${b1}" usebundle => ${b1}; + "${b[b2]}" usebundle => ${b[b2]}("param"); + "${b[b2]}" usebundle => ${b[${b2}]}("param2"); } bundle agent check { methods: - - "Pass/Fail" - usebundle => dcs_check_diff( "$(G.testdir)/reports.txt", - "$(this.promise_filename).expected.txt", - $(this.promise_filename)); + "Pass/Fail" + usebundle => dcs_check_diff( + "$(G.testdir)/reports.txt", + "$(this.promise_filename).expected.txt", + $(this.promise_filename) + ); } -bundle agent b1{ +bundle agent b1 +{ reports: cfengine:: - "Bundle b1" - report_to_file => "$(G.testdir)/reports.txt"; + "Bundle b1" report_to_file => "$(G.testdir)/reports.txt"; } -bundle agent b2(ref){ +bundle agent b2(ref) +{ reports: cfengine:: - "Bundle b2 ${ref}" - report_to_file => "$(G.testdir)/reports.txt"; + "Bundle b2 ${ref}" report_to_file => "$(G.testdir)/reports.txt"; } diff --git a/tests/acceptance/21_methods/callers/callers_directly.cf b/tests/acceptance/21_methods/callers/callers_directly.cf index 624ba06765..3700ff4599 100644 --- a/tests/acceptance/21_methods/callers/callers_directly.cf +++ b/tests/acceptance/21_methods/callers/callers_directly.cf @@ -3,44 +3,48 @@ # Test the variable this.callers_promisers with one 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 { +bundle agent init +{ } -bundle agent test { +bundle agent test +{ methods: "test" usebundle => "caller"; } -bundle agent check { +bundle agent check +{ vars: - "callers_expect" string => "agent"; - # Due to the 4K variable limit we cannot test the whole structure, so - # just test one element within it. At least it's not completely broken - # if we find it. - "callers_actual" string => "$(dummy.callers[0][bundle][bundleType])"; + "callers_expect" string => "agent"; + + # Due to the 4K variable limit we cannot test the whole structure, so + # just test one element within it. At least it's not completely broken + # if we find it. + "callers_actual" string => "$(dummy.callers[0][bundle][bundleType])"; classes: - "success" expression => strcmp("${callers_expect}", "${callers_actual}"), - scope => "namespace"; + "success" + expression => strcmp("${callers_expect}", "${callers_actual}"), + scope => "namespace"; reports: success:: "$(this.promise_filename) Pass"; + !success:: "$(this.promise_filename) FAIL"; methods: - "any" usebundle => file_make($(G.testfile), $(callers_actual)); + "any" usebundle => file_make($(G.testfile), $(callers_actual)); reports: DEBUG:: @@ -48,12 +52,14 @@ bundle agent check { "ACTUAL: callers_string = $(callers_actual)"; } -bundle agent caller { +bundle agent caller +{ methods: "first call" usebundle => dummy; } -bundle agent dummy { +bundle agent dummy +{ vars: "callers" data => callstack_callers(); } diff --git a/tests/acceptance/21_methods/callers/promisers_directly.cf b/tests/acceptance/21_methods/callers/promisers_directly.cf index 54a62cba0c..fe7b27ee2e 100644 --- a/tests/acceptance/21_methods/callers/promisers_directly.cf +++ b/tests/acceptance/21_methods/callers/promisers_directly.cf @@ -3,46 +3,52 @@ # Test the variable this.callers_promisers with one 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 { +bundle agent init +{ } -bundle agent test { +bundle agent test +{ methods: "test" usebundle => "caller"; } -bundle agent check { +bundle agent check +{ reports: success:: "$(this.promise_filename) Pass"; + !success:: "$(this.promise_filename) FAIL"; } -bundle agent caller { +bundle agent caller +{ methods: "first call" usebundle => dummy; } -bundle agent dummy { +bundle agent dummy +{ vars: "callers_promisers" slist => callstack_promisers(); - "callers_promisers_expect" string => "any, any, test, first call"; "callers_promisers_actual" string => join(", ", "callers_promisers"); classes: - "success" expression => strcmp("${callers_promisers_expect}", "${callers_promisers_actual}"), + "success" + expression => strcmp( + "${callers_promisers_expect}", "${callers_promisers_actual}" + ), scope => "namespace"; reports: diff --git a/tests/acceptance/21_methods/callers/promisers_indirectly.cf b/tests/acceptance/21_methods/callers/promisers_indirectly.cf index 136efee86f..680ccf60b2 100644 --- a/tests/acceptance/21_methods/callers/promisers_indirectly.cf +++ b/tests/acceptance/21_methods/callers/promisers_indirectly.cf @@ -3,68 +3,76 @@ # Test the variable this.callers_promisers with one bundle called twice # ####################################################### - body common control { - inputs => { "../../default.sub.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 +{ } -bundle agent test { +bundle agent test +{ methods: "test" usebundle => "caller"; } -bundle agent check { +bundle agent check +{ reports: success_first.success_second:: "$(this.promise_filename) Pass"; + !(success_first.success_second):: "$(this.promise_filename) FAIL"; } -bundle agent caller { - +bundle agent caller +{ methods: "first call" usebundle => dummy; "second call" usebundle => dummy_inter; - } -bundle agent dummy_inter { - +bundle agent dummy_inter +{ methods: "inter" usebundle => dummy; - } -bundle agent dummy { - +bundle agent dummy +{ vars: # This bundle gets called twice, once directly, and once via dummy_inter "callers_promisers" slist => callstack_promisers(); - "callers_promisers_expect_first" string => "any, any, test, first call"; - "callers_promisers_expect_second" string => "any, any, test, second call, inter"; + + "callers_promisers_expect_second" + string => "any, any, test, second call, inter"; + "callers_promisers_actual" string => join(", ", "callers_promisers"); classes: - "success_first" expression => strcmp("${callers_promisers_expect_first}", "${callers_promisers_actual}"), + "success_first" + expression => strcmp( + "${callers_promisers_expect_first}", "${callers_promisers_actual}" + ), scope => "namespace"; - "success_second" expression => strcmp("${callers_promisers_expect_second}", "${callers_promisers_actual}"), + + "success_second" + expression => strcmp( + "${callers_promisers_expect_second}", "${callers_promisers_actual}" + ), scope => "namespace"; reports: DEBUG:: "EXPECT (first in ${this.bundle}): callers_promisers_string = ${callers_promisers_expect_first}"; "ACTUAL (first in ${this.bundle}): callers_promisers_string = ${callers_promisers_actual}"; - "EXPECT (second in ${this.bundle}): callers_promisers_string = ${callers_promisers_expect_second}"; "ACTUAL (second in ${this.bundle}): callers_promisers_string = ${callers_promisers_actual}"; } diff --git a/tests/acceptance/21_methods/method_outcomes.cf b/tests/acceptance/21_methods/method_outcomes.cf index 9d0a5e2ca9..44a1ca6a1a 100644 --- a/tests/acceptance/21_methods/method_outcomes.cf +++ b/tests/acceptance/21_methods/method_outcomes.cf @@ -3,29 +3,23 @@ # bundle. body file control { - inputs => { "../default.sub.cf" }; + inputs => { "../default.sub.cf" }; } bundle agent main { methods: - "init" - usebundle => init; - "check" - usebundle => check; + "init" usebundle => init; + "check" usebundle => check; } bundle agent init { - classes: + # classes: # "method_FORCE_UNEXPECTED_FAIL" expression => "any"; - vars: - "method_outcome_classes" - slist => classesmatching("method_.*"); - - "sorted_method_outcome_classes" - slist => sort(method_outcome_classes, lex); + "method_outcome_classes" slist => classesmatching("method_.*"); + "sorted_method_outcome_classes" slist => sort(method_outcome_classes, lex); methods: "test kept bundle" @@ -44,7 +38,6 @@ bundle agent init usebundle => method_worst, classes => scoped_classes_generic("namespace", "method_worst_outcome"); - reports: "$(sorted_method_outcome_classes)"; } @@ -54,91 +47,80 @@ bundle agent check vars: "expected_classes" slist => { - "method_kept_outcome_kept", - "method_kept_outcome_ok", - "method_kept_outcome_reached", - "method_not_kept_outcome_error", - "method_not_kept_outcome_failed", - "method_not_kept_outcome_not_kept", - "method_not_kept_outcome_not_ok", - "method_not_kept_outcome_reached", - "method_repaired_outcome_ok", - "method_repaired_outcome_reached", - "method_repaired_outcome_repaired", - "method_worst_outcome_error", - "method_worst_outcome_failed", - "method_worst_outcome_not_kept", - "method_worst_outcome_not_ok", - "method_worst_outcome_reached", - #"method_FORCE_UNEXPECTED_FAILURE", - }; - - # Find classes that we expect to find but do not - "missing_expected_classes" - slist => difference( "expected_classes", "init.method_outcome_classes"); - - # Find classes that we did not expect to find - "unexpected_classes" - slist => difference( "init.method_outcome_classes", "expected_classes" ); - - # Count up the number of missing and extra classes - "num_missing" - int => length("missing_expected_classes"); - "num_unexpected" - int => length("unexpected_classes"); + "method_kept_outcome_kept", + "method_kept_outcome_ok", + "method_kept_outcome_reached", + "method_not_kept_outcome_error", + "method_not_kept_outcome_failed", + "method_not_kept_outcome_not_kept", + "method_not_kept_outcome_not_ok", + "method_not_kept_outcome_reached", + "method_repaired_outcome_ok", + "method_repaired_outcome_reached", + "method_repaired_outcome_repaired", + "method_worst_outcome_error", + "method_worst_outcome_failed", + "method_worst_outcome_not_kept", + "method_worst_outcome_not_ok", + "method_worst_outcome_reached", + #"method_FORCE_UNEXPECTED_FAILURE", + }; + + # Find classes that we expect to find but do not + "missing_expected_classes" + slist => difference("expected_classes", "init.method_outcome_classes"); + + # Find classes that we did not expect to find + "unexpected_classes" + slist => difference("init.method_outcome_classes", "expected_classes"); + + # Count up the number of missing and extra classes + "num_missing" int => length("missing_expected_classes"); + "num_unexpected" int => length("unexpected_classes"); classes: - # Fail if the counts are not as expected - "fail" - expression => isgreaterthan( "$(num_missing)", "0"); - "fail" - expression => isgreaterthan( "$(num_unexpected)", "0"); + # Fail if the counts are not as expected + "fail" expression => isgreaterthan("$(num_missing)", "0"); + "fail" expression => isgreaterthan("$(num_unexpected)", "0"); - # Pass if we found all expected classes and did not fail - "ok" and => { @(expected_classes), "!fail" }; + # Pass if we found all expected classes and did not fail + "ok" and => { @(expected_classes), "!fail" }; reports: ok:: "$(this.promise_filename) Pass"; + fail:: "$(this.promise_filename) FAIL"; - } bundle agent method_kept { reports: - "$(this.bundle)" - comment => "This promsie should have a kept outcome"; + "$(this.bundle)" comment => "This promsie should have a kept outcome"; } bundle agent method_repaired { -# This bundle runs a command that returns 0 and is by default considered -# repaired, so the bundle will be considered repaired + # This bundle runs a command that returns 0 and is by default considered + # repaired, so the bundle will be considered repaired commands: - "$(G.true)" - comment => "This promsie should have a repaired outcome"; + "$(G.true)" comment => "This promsie should have a repaired outcome"; } bundle agent method_not_kept { commands: - "$(G.false)" - comment => "This promise should have a not_kept outcome"; + "$(G.false)" comment => "This promise should have a not_kept outcome"; } bundle agent method_worst # @brief This bundle activates a promise that is repaired (/bin/true), a promise that is not kept (/bin/false), and a promise that is kept (report) { commands: - "$(G.true)" - comment => "This promsie should have a repaired outcome"; - - "$(G.false)" - comment => "This promise should have a not_kept outcome"; + "$(G.true)" comment => "This promsie should have a repaired outcome"; + "$(G.false)" comment => "This promise should have a not_kept outcome"; reports: - "$(this.bundle)" - comment => "This promsie should have a kept outcome"; + "$(this.bundle)" comment => "This promsie should have a kept outcome"; } diff --git a/tests/acceptance/21_methods/reachable/bundle_promiser_call_by_arg_defined.cf b/tests/acceptance/21_methods/reachable/bundle_promiser_call_by_arg_defined.cf index 037ccf689e..2e28ab9dc0 100644 --- a/tests/acceptance/21_methods/reachable/bundle_promiser_call_by_arg_defined.cf +++ b/tests/acceptance/21_methods/reachable/bundle_promiser_call_by_arg_defined.cf @@ -1,12 +1,10 @@ # Reachable bundle tests verify that you are allowed have references # to undefined bundles, as long as they are not actually called. - # These tests are left very simple on purpose, # they are not using the test framework. # They should be seen together, note that defined vs undefined variants are # almost identical, just replacing one detail to show what should work # and what should error. - bundle agent baz { reports: @@ -16,12 +14,13 @@ bundle agent baz bundle agent bar(x) { methods: - "$(x)"; # Tries to call baz, exists, works + "$(x)"; + + # Tries to call baz, exists, works } bundle agent main { methods: - "foo" - usebundle => bar("baz"); + "foo" usebundle => bar("baz"); } diff --git a/tests/acceptance/21_methods/reachable/bundle_promiser_defined.cf b/tests/acceptance/21_methods/reachable/bundle_promiser_defined.cf index e01cf79995..4f670d095d 100644 --- a/tests/acceptance/21_methods/reachable/bundle_promiser_defined.cf +++ b/tests/acceptance/21_methods/reachable/bundle_promiser_defined.cf @@ -1,12 +1,10 @@ # Reachable bundle tests verify that you are allowed have references # to undefined bundles, as long as they are not actually called. - # These tests are left very simple on purpose, # they are not using the test framework. # They should be seen together, note that defined vs undefined variants are # almost identical, just replacing one detail to show what should work # and what should error. - bundle agent foo { reports: diff --git a/tests/acceptance/21_methods/reachable/bundle_promiser_unreachable.cf b/tests/acceptance/21_methods/reachable/bundle_promiser_unreachable.cf index b0847e75f4..06d7477b80 100644 --- a/tests/acceptance/21_methods/reachable/bundle_promiser_unreachable.cf +++ b/tests/acceptance/21_methods/reachable/bundle_promiser_unreachable.cf @@ -1,12 +1,10 @@ # Reachable bundle tests verify that you are allowed have references # to undefined bundles, as long as they are not actually called. - # These tests are left very simple on purpose, # they are not using the test framework. # They should be seen together, note that defined vs undefined variants are # almost identical, just replacing one detail to show what should work # and what should error. - bundle agent bar { reports: @@ -17,7 +15,9 @@ bundle agent main { methods: out_of_context:: - "foo"; # Should not error because it's unreachable + "foo"; + + # Should not error because it's unreachable any:: "bar"; } diff --git a/tests/acceptance/21_methods/reachable/bundle_reversed_usebundle_parameters_defined.cf b/tests/acceptance/21_methods/reachable/bundle_reversed_usebundle_parameters_defined.cf index e0373ba2be..644a76f88c 100644 --- a/tests/acceptance/21_methods/reachable/bundle_reversed_usebundle_parameters_defined.cf +++ b/tests/acceptance/21_methods/reachable/bundle_reversed_usebundle_parameters_defined.cf @@ -1,20 +1,16 @@ # Reachable bundle tests verify that you are allowed have references # to undefined bundles, as long as they are not actually called. - # These tests are left very simple on purpose, # they are not using the test framework. # They should be seen together, note that defined vs undefined variants are # almost identical, just replacing one detail to show what should work # and what should error. - # reversed tests are just to show it should behave the same # if the called bundle comes after instead of before - bundle agent main { methods: - "foo" - usebundle => bar("baz"); + "foo" usebundle => bar("baz"); } bundle agent bar(x) 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 f586391d0f..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 @@ -1,12 +1,10 @@ # Reachable bundle tests verify that you are allowed have references # to undefined bundles, as long as they are not actually called. - # These tests are left very simple on purpose, # they are not using the test framework. # They should be seen together, note that defined vs undefined variants are # almost identical, just replacing one detail to show what should work # and what should error. - bundle agent baz { reports: @@ -16,13 +14,12 @@ bundle agent baz bundle agent bar(x) { methods: - "foo" - usebundle => "$(x)"; # Will call baz, which exists, should work + # Will call baz, which exists, should work + "foo" usebundle => "$(x)"; } bundle agent main { methods: - "foo" - usebundle => bar("baz"); + "foo" usebundle => bar("baz"); } diff --git a/tests/acceptance/21_methods/reachable/bundle_usebundle_defined.cf b/tests/acceptance/21_methods/reachable/bundle_usebundle_defined.cf index e4d1136a92..5a00d039a5 100644 --- a/tests/acceptance/21_methods/reachable/bundle_usebundle_defined.cf +++ b/tests/acceptance/21_methods/reachable/bundle_usebundle_defined.cf @@ -1,12 +1,10 @@ # Reachable bundle tests verify that you are allowed have references # to undefined bundles, as long as they are not actually called. - # These tests are left very simple on purpose, # they are not using the test framework. # They should be seen together, note that defined vs undefined variants are # almost identical, just replacing one detail to show what should work # and what should error. - bundle agent bar { reports: @@ -16,6 +14,5 @@ bundle agent bar bundle agent main { methods: - "foo" - usebundle => bar; + "foo" usebundle => bar; } diff --git a/tests/acceptance/21_methods/reachable/bundle_usebundle_parameters_defined.cf b/tests/acceptance/21_methods/reachable/bundle_usebundle_parameters_defined.cf index 8eee0f8e1c..ca66bd2a73 100644 --- a/tests/acceptance/21_methods/reachable/bundle_usebundle_parameters_defined.cf +++ b/tests/acceptance/21_methods/reachable/bundle_usebundle_parameters_defined.cf @@ -1,12 +1,10 @@ # Reachable bundle tests verify that you are allowed have references # to undefined bundles, as long as they are not actually called. - # These tests are left very simple on purpose, # they are not using the test framework. # They should be seen together, note that defined vs undefined variants are # almost identical, just replacing one detail to show what should work # and what should error. - bundle agent bar(x) { # bar exists and it's the bundle we want, so this will pass: @@ -18,6 +16,5 @@ bundle agent bar(x) bundle agent main { methods: - "foo" - usebundle => bar("baz"); + "foo" usebundle => bar("baz"); } diff --git a/tests/acceptance/21_methods/reachable/bundle_usebundle_unreachable.cf b/tests/acceptance/21_methods/reachable/bundle_usebundle_unreachable.cf index 3fd33f4a97..51c97ee9d3 100644 --- a/tests/acceptance/21_methods/reachable/bundle_usebundle_unreachable.cf +++ b/tests/acceptance/21_methods/reachable/bundle_usebundle_unreachable.cf @@ -1,12 +1,10 @@ # Reachable bundle tests verify that you are allowed have references # to undefined bundles, as long as they are not actually called. - # These tests are left very simple on purpose, # they are not using the test framework. # They should be seen together, note that defined vs undefined variants are # almost identical, just replacing one detail to show what should work # and what should error. - bundle agent baz { reports: @@ -18,6 +16,8 @@ bundle agent main methods: "foo" if => "out_of_context", - usebundle => "bar"; # Should not error because it's unreachable + # Should not error because it's unreachable + usebundle => "bar"; + "baz"; } diff --git a/tests/acceptance/21_methods/reporting/kept.cf b/tests/acceptance/21_methods/reporting/kept.cf index 72339839ea..bb1f0a19fe 100644 --- a/tests/acceptance/21_methods/reporting/kept.cf +++ b/tests/acceptance/21_methods/reporting/kept.cf @@ -3,34 +3,32 @@ # Redmine#4852: test kept methods reporting # ####################################################### - body common control { - inputs => { "../../default.sub.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: - "create" usebundle => test_create_hello; + "create" usebundle => test_create_hello; } ####################################################### - bundle agent test { methods: - - "verify" usebundle => test_create_hello, + "verify" + usebundle => test_create_hello, classes => test_verify_method; reports: OK:: "OK"; + FAIL:: "FAIL"; } @@ -38,7 +36,7 @@ bundle agent test bundle agent test_create_hello { files: - "$(G.testfile)" + "$(G.testfile)" create => "true", perms => test_m("000"), action => test_immediate; @@ -46,17 +44,17 @@ bundle agent test_create_hello body perms test_m(mode) { - mode => $(mode); + mode => $(mode); } body action test_immediate { - ifelapsed => 0; + ifelapsed => 0; } body classes test_verify_method { - promise_kept => {"ok"}; + promise_kept => { "ok" }; } bundle agent check @@ -64,6 +62,7 @@ bundle agent check reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/21_methods/usebundle_with_or_without.cf b/tests/acceptance/21_methods/usebundle_with_or_without.cf index f1c0e60633..7c43b7d91f 100644 --- a/tests/acceptance/21_methods/usebundle_with_or_without.cf +++ b/tests/acceptance/21_methods/usebundle_with_or_without.cf @@ -1,92 +1,106 @@ # Test that methods promises work correctly both with and without usebundle. - 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: - "test_var7" string => "7"; - "test_var8" string => "8"; + "test_var7" string => "7"; + "test_var8" string => "8"; methods: - "check1"; - "check2" usebundle => check2; - "bad_check3" usebundle => check3; - #"checkN(4)"; # Not currently working. - "checkN(5)" usebundle => checkN(5); - "bad_checkN(6)" usebundle => checkN(6); - "checkN(bad)" usebundle => checkN(good); - "check$(test_var7)"; - #"checkN($(test_var8))"; # Not currently working. + "check1"; + "check2" usebundle => check2; + "bad_check3" usebundle => check3; + + #"checkN(4)"; # Not currently working. + "checkN(5)" usebundle => checkN(5); + "bad_checkN(6)" usebundle => checkN(6); + "checkN(bad)" usebundle => checkN(good); + "check$(test_var7)"; + + #"checkN($(test_var8))"; # Not currently working. } bundle agent check1 { classes: - "ok_1" expression => "any", - scope => "namespace"; + "ok_1" + expression => "any", + scope => "namespace"; } + bundle agent check2 { classes: - "ok_2" expression => "any", - scope => "namespace"; + "ok_2" + expression => "any", + scope => "namespace"; } + bundle agent check3 { classes: - "ok_3" expression => "any", - scope => "namespace"; + "ok_3" + expression => "any", + scope => "namespace"; } + bundle agent bad_check3 { classes: - "bad_3" expression => "any", - scope => "namespace"; + "bad_3" + expression => "any", + scope => "namespace"; } + bundle agent checkN(X) { classes: - "ok_$(X)" expression => "any", - scope => "namespace"; + "ok_$(X)" + expression => "any", + scope => "namespace"; } + bundle agent bad_checkN(X) { classes: - "bad_$(X)" expression => "any", - scope => "namespace"; + "bad_$(X)" + expression => "any", + scope => "namespace"; } + bundle agent check7 { classes: - "ok_7" expression => "any", - scope => "namespace"; + "ok_7" + expression => "any", + scope => "namespace"; } bundle agent check { vars: - "cases" slist => { 1, 2, 3, 5, 6, 7, "good" }; - "positive" slist => maplist("ok_$(this)", "cases"); - "negative" slist => { maplist("bad_$(this)", "cases"), "ok_bad" }; + "cases" slist => { 1, 2, 3, 5, 6, 7, "good" }; + "positive" slist => maplist("ok_$(this)", "cases"); + "negative" slist => { maplist("bad_$(this)", "cases"), "ok_bad" }; classes: - "positive_match" and => { @(positive) }; - "negative_match" or => { @(negative) }; - "ok" expression => "positive_match.!negative_match"; + "positive_match" and => { @(positive) }; + "negative_match" or => { @(negative) }; + "ok" expression => "positive_match.!negative_match"; reports: DEBUG:: - "Classes not set that should be: $(positive)" - if => "!$(positive)"; - "Classes set that should not be: $(negative)" - if => "$(negative)"; + "Classes not set that should be: $(positive)" if => "!$(positive)"; + "Classes set that should not be: $(negative)" if => "$(negative)"; + ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/21_methods/warn_only.cf b/tests/acceptance/21_methods/warn_only.cf index 8292b6409d..8fd31289f8 100644 --- a/tests/acceptance/21_methods/warn_only.cf +++ b/tests/acceptance/21_methods/warn_only.cf @@ -3,36 +3,33 @@ # Redmine#4852: test kept methods reporting # ####################################################### - body common control { - 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 action warnonly { - action_policy => "warn"; + action_policy => "warn"; } ####################################################### - bundle agent test { methods: - "verify" - usebundle => test_method, - action => warnonly, - classes => if_else("method_kept", "method_notkept"); + "verify" + usebundle => test_method, + action => warnonly, + classes => if_else("method_kept", "method_notkept"); } bundle agent test_method { reports: - "unwanted sideeffect!" classes => if_else("report_kept", "report_notkept"); + "unwanted sideeffect!" classes => if_else("report_kept", "report_notkept"); } bundle agent check @@ -43,6 +40,7 @@ bundle agent check reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } 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/24_cmd_line_arguments/parsed_policy.cf b/tests/acceptance/24_cmd_line_arguments/parsed_policy.cf index 7835fb6591..48a46fea2e 100644 --- a/tests/acceptance/24_cmd_line_arguments/parsed_policy.cf +++ b/tests/acceptance/24_cmd_line_arguments/parsed_policy.cf @@ -1,41 +1,45 @@ # Tests that the '-p' option works properly in all its modes. - 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: - "testdir" data => '{ testdir: "$(this.promise_dirname)" }'; + "testdir" data => '{ testdir: "$(this.promise_dirname)" }'; files: - "$(G.testdir)/output.expected" - create => "true", - edit_template => "$(this.promise_filename).template", - template_method => "mustache", - template_data => @(testdir); + "$(G.testdir)/output.expected" + create => "true", + edit_template => "$(this.promise_filename).template", + template_method => "mustache", + template_data => @(testdir); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10254" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10254" }; + vars: - "arg_list" slist => { "none", "cf", "json", "cf-full", "json-full" }; + "arg_list" slist => { "none", "cf", "json", "cf-full", "json-full" }; commands: - "$(sys.cf_promises) -f $(this.promise_filename).sub -p $(arg_list) >> $(G.testdir)/output.actual" - contain => in_shell; + "$(sys.cf_promises) -f $(this.promise_filename).sub -p $(arg_list) >> $(G.testdir)/output.actual" + contain => in_shell; } bundle agent check { methods: - "check" usebundle => dcs_check_diff("$(G.testdir)/output.actual", - "$(G.testdir)/output.expected", - $(this.promise_filename)); + "check" + usebundle => dcs_check_diff( + "$(G.testdir)/output.actual", + "$(G.testdir)/output.expected", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/25_cf-execd/mail_1st_run_empty_new_log.cf b/tests/acceptance/25_cf-execd/mail_1st_run_empty_new_log.cf index 3e3aecfa65..b7a6a7ac0a 100644 --- a/tests/acceptance/25_cf-execd/mail_1st_run_empty_new_log.cf +++ b/tests/acceptance/25_cf-execd/mail_1st_run_empty_new_log.cf @@ -1,44 +1,42 @@ # Tests that no mail is sent by cf-execd on the first run (hence the old log # doesn't exist) and if the new log is empty. - body common control { - inputs => { "../default.sub.cf", "mailfilter_common.cf.sub" }; - bundlesequence => { default($(this.promiser_filename)) }; + inputs => { "../default.sub.cf", "mailfilter_common.cf.sub" }; + bundlesequence => { default($(this.promiser_filename)) }; } bundle agent init { vars: - "reports" slist => { - }; - - # No mail is expected at all, since everything is filtered. - "expected" slist => { }; - "unexpected" slist => { ".+" }; + "reports" slist => {}; - "includes" slist => { - }; - "excludes" slist => { - }; + # No mail is expected at all, since everything is filtered. + "expected" slist => {}; + "unexpected" slist => { ".+" }; + "includes" slist => {}; + "excludes" slist => {}; methods: - "any" usebundle => prepare_mailfilter_test(@(reports), - @(includes), - @(excludes)); + "any" + usebundle => prepare_mailfilter_test( + @(reports), @(includes), @(excludes) + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; } bundle agent check { methods: - "any" usebundle => check_cf_execd_mail(@(init.expected), - @(init.unexpected), - $(this.promise_filename)); + "any" + usebundle => check_cf_execd_mail( + @(init.expected), @(init.unexpected), $(this.promise_filename) + ); } diff --git a/tests/acceptance/25_cf-execd/mail_empty_old_and_new_log.cf b/tests/acceptance/25_cf-execd/mail_empty_old_and_new_log.cf index dbe497c931..317ab54dea 100644 --- a/tests/acceptance/25_cf-execd/mail_empty_old_and_new_log.cf +++ b/tests/acceptance/25_cf-execd/mail_empty_old_and_new_log.cf @@ -1,49 +1,47 @@ # Tests that no mail is sent by cf-execd if the old and new logs are empty. - body common control { - inputs => { "../default.sub.cf", "mailfilter_common.cf.sub" }; - bundlesequence => { default($(this.promiser_filename)) }; + inputs => { "../default.sub.cf", "mailfilter_common.cf.sub" }; + bundlesequence => { default($(this.promiser_filename)) }; } bundle agent init { vars: - "reports" slist => { - }; - - # No mail is expected at all, since everything is filtered. - "expected" slist => { }; - "unexpected" slist => { ".+" }; + "reports" slist => {}; - "includes" slist => { - }; - "excludes" slist => { - }; + # No mail is expected at all, since everything is filtered. + "expected" slist => {}; + "unexpected" slist => { ".+" }; + "includes" slist => {}; + "excludes" slist => {}; methods: - "any" usebundle => prepare_mailfilter_test(@(reports), - @(includes), - @(excludes)); + "any" + usebundle => prepare_mailfilter_test( + @(reports), @(includes), @(excludes) + ); files: - "$(sys.workdir)/outputs/old.log" - create => "true"; - "$(sys.workdir)/outputs/previous" - link_from => linkfrom("$(sys.workdir)/outputs/old.log", "symlink"); + "$(sys.workdir)/outputs/old.log" create => "true"; + + "$(sys.workdir)/outputs/previous" + link_from => linkfrom("$(sys.workdir)/outputs/old.log", "symlink"); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; } bundle agent check { methods: - "any" usebundle => check_cf_execd_mail(@(init.expected), - @(init.unexpected), - $(this.promise_filename)); + "any" + usebundle => check_cf_execd_mail( + @(init.expected), @(init.unexpected), $(this.promise_filename) + ); } diff --git a/tests/acceptance/25_cf-execd/mail_exclude_filter.cf b/tests/acceptance/25_cf-execd/mail_exclude_filter.cf index 3269074618..521db06207 100644 --- a/tests/acceptance/25_cf-execd/mail_exclude_filter.cf +++ b/tests/acceptance/25_cf-execd/mail_exclude_filter.cf @@ -1,45 +1,46 @@ # Tests that exclude mail filter causes excluded lines not to be mailed by # cf-execd. - body common control { - inputs => { "../default.sub.cf", "mailfilter_common.cf.sub" }; - bundlesequence => { default($(this.promise_filename)) }; + inputs => { "../default.sub.cf", "mailfilter_common.cf.sub" }; + bundlesequence => { default($(this.promise_filename)) }; } bundle agent init { vars: - "reports" slist => { - "CorrectString1", - "CorrectString2", - "WrongString1", - "WrongString2", - }; - "includes" slist => { }; - "excludes" slist => { "R: WrongString1", ".*WrongString[2]" }; + "reports" + slist => { + "CorrectString1", "CorrectString2", "WrongString1", "WrongString2", + }; + + "includes" slist => {}; + "excludes" slist => { "R: WrongString1", ".*WrongString[2]" }; methods: - "any" usebundle => prepare_mailfilter_test(@(reports), - @(includes), - @(excludes)); + "any" + usebundle => prepare_mailfilter_test( + @(reports), @(includes), @(excludes) + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; } bundle agent check { vars: - "expected" slist => { "CorrectString1", "CorrectString2" }; - "not_expected" slist => { "WrongString1", "WrongString2" }; + "expected" slist => { "CorrectString1", "CorrectString2" }; + "not_expected" slist => { "WrongString1", "WrongString2" }; methods: - "any" usebundle => check_cf_execd_mail(@(expected), - @(not_expected), - $(this.promise_filename)); + "any" + usebundle => check_cf_execd_mail( + @(expected), @(not_expected), $(this.promise_filename) + ); } diff --git a/tests/acceptance/25_cf-execd/mail_include_and_exclude_filters.cf b/tests/acceptance/25_cf-execd/mail_include_and_exclude_filters.cf index a944a0756f..744562d0cb 100644 --- a/tests/acceptance/25_cf-execd/mail_include_and_exclude_filters.cf +++ b/tests/acceptance/25_cf-execd/mail_include_and_exclude_filters.cf @@ -1,54 +1,65 @@ # Tests that combining include and exclude mail filters works, IOW only lines # matching the include filter should be printed, unless they also match the # exclude filter. - body common control { - inputs => { "../default.sub.cf", "mailfilter_common.cf.sub" }; - bundlesequence => { default($(this.promise_filename)) }; + inputs => { "../default.sub.cf", "mailfilter_common.cf.sub" }; + bundlesequence => { default($(this.promise_filename)) }; } bundle agent init { vars: - "reports" slist => { - "CorrectString1", - "CorrectString2", - "WrongString1", - "WrongString2", - "WrongString3", - }; - "includes" slist => { - "R: CorrectString1", ".*CorrectString[2]", - "R: WrongString1", ".*WrongString[2]" - }; - "excludes" slist => { - "R: WrongString1", ".*WrongString[2]", - # Tests anchoring. This is only a part of the string - # and should not match. - "orrectString1" - }; + "reports" + slist => { + "CorrectString1", + "CorrectString2", + "WrongString1", + "WrongString2", + "WrongString3", + }; + + "includes" + slist => { + "R: CorrectString1", + ".*CorrectString[2]", + "R: WrongString1", + ".*WrongString[2]", + }; + + "excludes" + slist => { + "R: WrongString1", + ".*WrongString[2]", + # Tests anchoring. This is only a part of the string + # and should not match. + "orrectString1", + }; + methods: - "any" usebundle => prepare_mailfilter_test(@(reports), - @(includes), - @(excludes)); + "any" + usebundle => prepare_mailfilter_test( + @(reports), @(includes), @(excludes) + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; } bundle agent check { vars: - "expected" slist => { "CorrectString1", "CorrectString2" }; - "not_expected" slist => { "WrongString1", "WrongString2", "WrongString3" }; + "expected" slist => { "CorrectString1", "CorrectString2" }; + "not_expected" slist => { "WrongString1", "WrongString2", "WrongString3" }; methods: - "any" usebundle => check_cf_execd_mail(@(expected), - @(not_expected), - $(this.promise_filename)); + "any" + usebundle => check_cf_execd_mail( + @(expected), @(not_expected), $(this.promise_filename) + ); } diff --git a/tests/acceptance/25_cf-execd/mail_include_filter.cf b/tests/acceptance/25_cf-execd/mail_include_filter.cf index 5d68ad05e3..9091eae0b1 100644 --- a/tests/acceptance/25_cf-execd/mail_include_filter.cf +++ b/tests/acceptance/25_cf-execd/mail_include_filter.cf @@ -1,45 +1,46 @@ # Tests that include mail filter causes only matched lines to be mailed by # cf-execd. - body common control { - inputs => { "../default.sub.cf", "mailfilter_common.cf.sub" }; - bundlesequence => { default($(this.promise_filename)) }; + inputs => { "../default.sub.cf", "mailfilter_common.cf.sub" }; + bundlesequence => { default($(this.promise_filename)) }; } bundle agent init { vars: - "reports" slist => { - "CorrectString1", - "CorrectString2", - "WrongString1", - "WrongString2", - }; - "includes" slist => { "R: CorrectString1", ".*CorrectString[2]" }; - "excludes" slist => { }; + "reports" + slist => { + "CorrectString1", "CorrectString2", "WrongString1", "WrongString2", + }; + + "includes" slist => { "R: CorrectString1", ".*CorrectString[2]" }; + "excludes" slist => {}; methods: - "any" usebundle => prepare_mailfilter_test(@(reports), - @(includes), - @(excludes)); + "any" + usebundle => prepare_mailfilter_test( + @(reports), @(includes), @(excludes) + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; } bundle agent check { vars: - "expected" slist => { "CorrectString1", "CorrectString2" }; - "not_expected" slist => { "WrongString1", "WrongString2" }; + "expected" slist => { "CorrectString1", "CorrectString2" }; + "not_expected" slist => { "WrongString1", "WrongString2" }; methods: - "any" usebundle => check_cf_execd_mail(@(expected), - @(not_expected), - $(this.promise_filename)); + "any" + usebundle => check_cf_execd_mail( + @(expected), @(not_expected), $(this.promise_filename) + ); } diff --git a/tests/acceptance/25_cf-execd/mail_no_filter.cf b/tests/acceptance/25_cf-execd/mail_no_filter.cf index 370be75ece..e1b1aced3e 100644 --- a/tests/acceptance/25_cf-execd/mail_no_filter.cf +++ b/tests/acceptance/25_cf-execd/mail_no_filter.cf @@ -1,40 +1,40 @@ # Tests that without mail filters, everything is mailed by cf-execd. - body common control { - inputs => { "../default.sub.cf", "mailfilter_common.cf.sub" }; - bundlesequence => { default($(this.promise_filename)) }; + inputs => { "../default.sub.cf", "mailfilter_common.cf.sub" }; + bundlesequence => { default($(this.promise_filename)) }; } bundle agent init { vars: - "reports" slist => { - "CorrectString1", - "CorrectString2", - }; - "includes" slist => { }; - "excludes" slist => { }; + "reports" slist => { "CorrectString1", "CorrectString2" }; + "includes" slist => {}; + "excludes" slist => {}; methods: - "any" usebundle => prepare_mailfilter_test(@(reports), - @(includes), - @(excludes)); + "any" + usebundle => prepare_mailfilter_test( + @(reports), @(includes), @(excludes) + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; } bundle agent check { vars: - "empty_list" slist => { }; + "empty_list" slist => {}; + methods: - "any" usebundle => check_cf_execd_mail(@(init.reports), - @(empty_list), - $(this.promise_filename)); + "any" + usebundle => check_cf_execd_mail( + @(init.reports), @(empty_list), $(this.promise_filename) + ); } diff --git a/tests/acceptance/25_cf-execd/mailfilter_1st_run_everything_filtered.cf b/tests/acceptance/25_cf-execd/mailfilter_1st_run_everything_filtered.cf index 4ad8779f81..38ec25bdd3 100644 --- a/tests/acceptance/25_cf-execd/mailfilter_1st_run_everything_filtered.cf +++ b/tests/acceptance/25_cf-execd/mailfilter_1st_run_everything_filtered.cf @@ -1,48 +1,42 @@ # Tests that no mail is sent by cf-execd if everything is filtered on the first # run (hence the old log doesn't exist). - body common control { - inputs => { "../default.sub.cf", "mailfilter_common.cf.sub" }; - bundlesequence => { default($(this.promiser_filename)) }; + inputs => { "../default.sub.cf", "mailfilter_common.cf.sub" }; + bundlesequence => { default($(this.promiser_filename)) }; } bundle agent init { vars: - "reports" slist => { - "WrongString1", - "WrongString2", - "WrongString3", - }; - - # No mail is expected at all, since everything is filtered. - "expected" slist => { }; - "unexpected" slist => { ".+" }; + "reports" slist => { "WrongString1", "WrongString2", "WrongString3" }; - "includes" slist => { - }; - "excludes" slist => { - ".*WrongString.*" - }; + # No mail is expected at all, since everything is filtered. + "expected" slist => {}; + "unexpected" slist => { ".+" }; + "includes" slist => {}; + "excludes" slist => { ".*WrongString.*" }; methods: - "any" usebundle => prepare_mailfilter_test(@(reports), - @(includes), - @(excludes)); + "any" + usebundle => prepare_mailfilter_test( + @(reports), @(includes), @(excludes) + ); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; } bundle agent check { methods: - "any" usebundle => check_cf_execd_mail(@(init.expected), - @(init.unexpected), - $(this.promise_filename)); + "any" + usebundle => check_cf_execd_mail( + @(init.expected), @(init.unexpected), $(this.promise_filename) + ); } diff --git a/tests/acceptance/25_cf-execd/mailfilter_empty_old_log_everything_filtered.cf b/tests/acceptance/25_cf-execd/mailfilter_empty_old_log_everything_filtered.cf index 3121d7bbac..1c20b55bf7 100644 --- a/tests/acceptance/25_cf-execd/mailfilter_empty_old_log_everything_filtered.cf +++ b/tests/acceptance/25_cf-execd/mailfilter_empty_old_log_everything_filtered.cf @@ -1,54 +1,48 @@ # Tests that no mail is sent by cf-execd if everything is filtered and the old # log is empty. - body common control { - inputs => { "../default.sub.cf", "mailfilter_common.cf.sub" }; - bundlesequence => { default($(this.promiser_filename)) }; + inputs => { "../default.sub.cf", "mailfilter_common.cf.sub" }; + bundlesequence => { default($(this.promiser_filename)) }; } bundle agent init { vars: - "reports" slist => { - "WrongString1", - "WrongString2", - "WrongString3", - }; - - # No mail is expected at all, since everything is filtered. - "expected" slist => { }; - "unexpected" slist => { ".+" }; + "reports" slist => { "WrongString1", "WrongString2", "WrongString3" }; - "includes" slist => { - }; - "excludes" slist => { - ".*WrongString.*" - }; + # No mail is expected at all, since everything is filtered. + "expected" slist => {}; + "unexpected" slist => { ".+" }; + "includes" slist => {}; + "excludes" slist => { ".*WrongString.*" }; methods: - "any" usebundle => prepare_mailfilter_test(@(reports), - @(includes), - @(excludes)); + "any" + usebundle => prepare_mailfilter_test( + @(reports), @(includes), @(excludes) + ); files: - "$(sys.workdir)/outputs/old.log" - create => "true"; - "$(sys.workdir)/outputs/previous" - link_from => linkfrom("$(sys.workdir)/outputs/old.log", "symlink"); + "$(sys.workdir)/outputs/old.log" create => "true"; + + "$(sys.workdir)/outputs/previous" + link_from => linkfrom("$(sys.workdir)/outputs/old.log", "symlink"); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; } bundle agent check { methods: - "any" usebundle => check_cf_execd_mail(@(init.expected), - @(init.unexpected), - $(this.promise_filename)); + "any" + usebundle => check_cf_execd_mail( + @(init.expected), @(init.unexpected), $(this.promise_filename) + ); } diff --git a/tests/acceptance/25_cf-execd/slow/dies_in_time.cf b/tests/acceptance/25_cf-execd/slow/dies_in_time.cf index 90faa20938..3bfbaa30ec 100644 --- a/tests/acceptance/25_cf-execd/slow/dies_in_time.cf +++ b/tests/acceptance/25_cf-execd/slow/dies_in_time.cf @@ -1,23 +1,16 @@ # ENT-3147, zd#3157 - # Ensure that cf-execd dies within 3 seconds after being signalled. - - 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 { vars: - - "exec_command_script" string => -"#!/bin/sh -x + "exec_command_script" + string => "#!/bin/sh -x sleep 10 @@ -60,36 +53,34 @@ echo DONE > $(G.testdir)/exec_command.status "; files: - "$(G.testdir)/exec_command.sh" - create => "true", - perms => m(777), - edit_line => insert_lines("$(exec_command_script)"); + "$(G.testdir)/exec_command.sh" + create => "true", + perms => m(777), + edit_line => insert_lines("$(exec_command_script)"); methods: - "any" usebundle => dcs_fini("$(sys.piddir)/cf-execd.pid"); - "any" usebundle => dcs_fini("$(G.testdir)/EXECUTOR_WAS_SIGNALLED"); - "any" usebundle => dcs_fini("$(G.testdir)/cf_execd.status"); - "any" usebundle => dcs_fini("$(G.testdir)/exec_command.status"); + "any" usebundle => dcs_fini("$(sys.piddir)/cf-execd.pid"); + "any" usebundle => dcs_fini("$(G.testdir)/EXECUTOR_WAS_SIGNALLED"); + "any" usebundle => dcs_fini("$(G.testdir)/cf_execd.status"); + "any" usebundle => dcs_fini("$(G.testdir)/exec_command.status"); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; commands: - - "$(sys.cf_execd) -f $(this.promise_dirname)/kill_myself.execd.srv" - classes => if_repaired("executor_started"); + "$(sys.cf_execd) -f $(this.promise_dirname)/kill_myself.execd.srv" + classes => if_repaired("executor_started"); executor_started:: # Make sure it started fully - "$(G.sleep) 5" - classes => if_repaired("waited"); + "$(G.sleep) 5" classes => if_repaired("waited"); executor_started.waited:: - # Ensure executor PID is up "kill -0 `cat $(sys.piddir)/cf-execd.pid`" contain => in_shell, @@ -117,20 +108,18 @@ exit 1 # Executor was never signalled! executor_was_signalled:: # Wait again until executor runs the signal handler and exits gracefully - "$(G.sleep) 3" - classes => if_repaired("waited_for_cleanup"); + "$(G.sleep) 3" classes => if_repaired("waited_for_cleanup"); waited_for_cleanup:: # and another 10s for exec_command.sh script to exit - "$(G.sleep) 10" - classes => if_repaired("script_should_have_exited"); + "$(G.sleep) 10" classes => if_repaired("script_should_have_exited"); classes: - "test_bundle_done" expression => "script_should_have_exited", - scope => "namespace"; + "test_bundle_done" + expression => "script_should_have_exited", + scope => "namespace"; reports: - !executor_was_signalled:: "$(this.promise_filename) FAIL"; } @@ -140,20 +129,26 @@ bundle agent check { classes: test_bundle_done:: - "executor_is_dead" expression => - returnszero("$(G.grep) DEAD $(G.testdir)/cf_execd.status", - "useshell"); - "exec_command_finished" expression => - returnszero("$(G.grep) DONE $(G.testdir)/exec_command.status", - "useshell"); + "executor_is_dead" + expression => returnszero( + "$(G.grep) DEAD $(G.testdir)/cf_execd.status", "useshell" + ); + + "exec_command_finished" + expression => returnszero( + "$(G.grep) DONE $(G.testdir)/exec_command.status", "useshell" + ); methods: - "" usebundle => - dcs_passif_expected("executor_is_dead,exec_command_finished","", - "$(this.promise_filename)"), - inherit => "true"; + "" + usebundle => dcs_passif_expected( + "executor_is_dead,exec_command_finished", + "", + "$(this.promise_filename)" + ), + inherit => "true"; reports: !executor_is_dead.DEBUG:: - "FAIL: cf-execd did not die within 3s after TERM signal!"; + "FAIL: cf-execd did not die within 3s after TERM signal!"; } diff --git a/tests/acceptance/25_cf-execd/timed/mailfilter_repeated_runs.cf b/tests/acceptance/25_cf-execd/timed/mailfilter_repeated_runs.cf index bed447743d..5d6b5ce448 100644 --- a/tests/acceptance/25_cf-execd/timed/mailfilter_repeated_runs.cf +++ b/tests/acceptance/25_cf-execd/timed/mailfilter_repeated_runs.cf @@ -1,117 +1,132 @@ # Tests that the correct content is sent by cf-execd after several consecutive # cf-agent runs. - body common control { - inputs => { "../../default.sub.cf", "../mailfilter_common.cf.sub" }; - bundlesequence => { default($(this.promiser_filename)) }; + inputs => { "../../default.sub.cf", "../mailfilter_common.cf.sub" }; + bundlesequence => { default($(this.promiser_filename)) }; } bundle agent init { vars: - # Positions of WrongString inside the report should not matter, since it - # is filtered out. - "reports1" slist => { - "CorrectString1", - "CorrectString2", - "WrongString1", - "WrongString2", - "WrongString3", - }; - "expected1" slist => { - "CorrectString1", - "CorrectString2", - }; - - "reports2" slist => { - "WrongString1", - "CorrectString1", - "WrongString2", - "CorrectString2", - "WrongString3", - }; - "expected2" slist => { - # Nothing expected, since it is identical to - # previous run. - }; - - "reports3" slist => { - }; - "expected3" slist => { - # Nothing expected, because the log is empty. - }; - - "reports4" slist => { - "WrongString1", - "WrongString2", - "WrongString3", - }; - "expected4" slist => { - # Nothing expected, because everything is filtered. - }; - - "reports5" slist => { - "WrongString2", - "WrongString1", - "CorrectString2", - "CorrectString1", - "WrongString3", - }; - "expected5" slist => { - "CorrectString2", - "CorrectString1", - }; - - "unexpected" slist => { ".*WrongString.*" }; - - "includes" slist => { - "R: CorrectString1", ".*CorrectString[2]", - "R: WrongString1", ".*WrongString[2]" - }; - "excludes" slist => { - "R: WrongString1", ".*WrongString[2]", - # Tests anchoring. - "orrectString1" - }; + # Positions of WrongString inside the report should not matter, since it + # is filtered out. + "reports1" + slist => { + "CorrectString1", + "CorrectString2", + "WrongString1", + "WrongString2", + "WrongString3", + }; + + "expected1" slist => { "CorrectString1", "CorrectString2" }; + + "reports2" + slist => { + "WrongString1", + "CorrectString1", + "WrongString2", + "CorrectString2", + "WrongString3", + }; + + "expected2" + slist => { + # Nothing expected, since it is identical to + # previous run. + }; + + "reports3" slist => {}; + + "expected3" + slist => { + # Nothing expected, because the log is empty. + }; + + "reports4" slist => { "WrongString1", "WrongString2", "WrongString3" }; + + "expected4" + slist => { + # Nothing expected, because everything is filtered. + }; + + "reports5" + slist => { + "WrongString2", + "WrongString1", + "CorrectString2", + "CorrectString1", + "WrongString3", + }; + + "expected5" slist => { "CorrectString2", "CorrectString1" }; + "unexpected" slist => { ".*WrongString.*" }; + + "includes" + slist => { + "R: CorrectString1", + ".*CorrectString[2]", + "R: WrongString1", + ".*WrongString[2]", + }; + + "excludes" + slist => { + "R: WrongString1", + ".*WrongString[2]", + # Tests anchoring. + "orrectString1", + }; methods: test_pass_1:: - "any" usebundle => prepare_mailfilter_test(@(reports1), - @(includes), - @(excludes)); + "any" + usebundle => prepare_mailfilter_test( + @(reports1), @(includes), @(excludes) + ); + "any" usebundle => run_cf_execd(@(expected1), @(unexpected)); test_pass_2:: - "any" usebundle => prepare_mailfilter_test(@(reports2), - @(includes), - @(excludes)); + "any" + usebundle => prepare_mailfilter_test( + @(reports2), @(includes), @(excludes) + ); + "any" usebundle => run_cf_execd(@(expected2), @(unexpected)); test_pass_3:: - "any" usebundle => prepare_mailfilter_test(@(reports3), - @(includes), - @(excludes)); + "any" + usebundle => prepare_mailfilter_test( + @(reports3), @(includes), @(excludes) + ); + "any" usebundle => run_cf_execd(@(expected3), @(unexpected)); test_pass_4:: - "any" usebundle => prepare_mailfilter_test(@(reports4), - @(includes), - @(excludes)); + "any" + usebundle => prepare_mailfilter_test( + @(reports4), @(includes), @(excludes) + ); + "any" usebundle => run_cf_execd(@(expected4), @(unexpected)); test_pass_5:: - "any" usebundle => prepare_mailfilter_test(@(reports5), - @(includes), - @(excludes)); + "any" + usebundle => prepare_mailfilter_test( + @(reports5), @(includes), @(excludes) + ); + "any" usebundle => run_cf_execd(@(expected5), @(unexpected)); } bundle agent test { meta: - "test_soft_fail" string => "windows", - meta => { "ENT-10215" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10215" }; } bundle agent check @@ -119,6 +134,7 @@ bundle agent check methods: test_pass_1|test_pass_2|test_pass_3|test_pass_4:: "any" usebundle => dcs_wait($(this.promise_filename), 1); + test_pass_5:: "any" usebundle => compare_cf_execd_mail($(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)"; } diff --git a/tests/acceptance/29_simulate_mode/diff_mode.cf b/tests/acceptance/29_simulate_mode/diff_mode.cf index 971c6da897..26c47f9efd 100644 --- a/tests/acceptance/29_simulate_mode/diff_mode.cf +++ b/tests/acceptance/29_simulate_mode/diff_mode.cf @@ -1,15 +1,14 @@ body common control { - inputs => { - "../default.sub.cf", - "./prepare_files_for_simulate_tests.cf.sub", - "./normalize_agent_output.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { + "../default.sub.cf", + "./prepare_files_for_simulate_tests.cf.sub", + "./normalize_agent_output.cf.sub", + }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - bundle agent init { methods: @@ -19,10 +18,11 @@ bundle agent init bundle agent test { meta: - "test_soft_fail" string => "(solaris|aix|hpux|windows)", - meta => { "ENT-6540,ENT-10254" }; + "test_soft_fail" + string => "(solaris|aix|hpux|windows)", # ENT-6540 exotics fail to delete chroot # ENT-10254 tests fail on Windows due to CRLF + meta => { "ENT-6540", "ENT-10254" }; "description" -> { "ENT-5302" } string => "Test that files promises in --simulate=diff mode produce proper output and only make changes in chroot"; @@ -37,9 +37,15 @@ bundle agent test bundle agent check { methods: - "normalize_agent_results" usebundle => normalize_agent_results("$(this.promise_filename).temp", - "$(this.promise_filename).actual"); - "check" usebundle => dcs_check_diff("$(this.promise_filename).actual", - "$(this.promise_filename).expected", - "$(this.promise_filename)"); + "normalize_agent_results" + usebundle => normalize_agent_results( + "$(this.promise_filename).temp", "$(this.promise_filename).actual" + ); + + "check" + usebundle => dcs_check_diff( + "$(this.promise_filename).actual", + "$(this.promise_filename).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/29_simulate_mode/manifest_full_mode.cf b/tests/acceptance/29_simulate_mode/manifest_full_mode.cf index db7a6a1f22..fe027cf486 100644 --- a/tests/acceptance/29_simulate_mode/manifest_full_mode.cf +++ b/tests/acceptance/29_simulate_mode/manifest_full_mode.cf @@ -1,15 +1,14 @@ body common control { - inputs => { - "../default.sub.cf", - "./prepare_files_for_simulate_tests.cf.sub", - "./normalize_agent_output.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { + "../default.sub.cf", + "./prepare_files_for_simulate_tests.cf.sub", + "./normalize_agent_output.cf.sub", + }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - bundle agent init { methods: @@ -19,10 +18,11 @@ bundle agent init bundle agent test { meta: - "test_soft_fail" string => "(solaris|aix|hpux|windows)", - meta => { "ENT-6540,ENT-10254" }; + "test_soft_fail" + string => "(solaris|aix|hpux|windows)", # ENT-6540 exotics fail to delete chroot # ENT-10254 tests fail on Windows due to CRLF + meta => { "ENT-6540", "ENT-10254" }; "description" -> { "ENT-5301" } string => "Test that files promises in --simulate=manifest-full mode produce proper output and only make changes in chroot"; @@ -37,9 +37,15 @@ bundle agent test bundle agent check { methods: - "normalize_agent_results" usebundle => normalize_agent_results("$(this.promise_filename).temp", - "$(this.promise_filename).actual"); - "check" usebundle => dcs_check_diff("$(this.promise_filename).actual", - "$(this.promise_filename).expected", - "$(this.promise_filename)"); + "normalize_agent_results" + usebundle => normalize_agent_results( + "$(this.promise_filename).temp", "$(this.promise_filename).actual" + ); + + "check" + usebundle => dcs_check_diff( + "$(this.promise_filename).actual", + "$(this.promise_filename).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/29_simulate_mode/manifest_mode.cf b/tests/acceptance/29_simulate_mode/manifest_mode.cf index 711c356d23..9fb130ca71 100644 --- a/tests/acceptance/29_simulate_mode/manifest_mode.cf +++ b/tests/acceptance/29_simulate_mode/manifest_mode.cf @@ -1,15 +1,14 @@ body common control { - inputs => { - "../default.sub.cf", - "./prepare_files_for_simulate_tests.cf.sub", - "./normalize_agent_output.cf.sub" - }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { + "../default.sub.cf", + "./prepare_files_for_simulate_tests.cf.sub", + "./normalize_agent_output.cf.sub", + }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - bundle agent init { methods: @@ -19,10 +18,11 @@ bundle agent init bundle agent test { meta: - "test_soft_fail" string => "(solaris|aix|hpux|windows)", - meta => { "ENT-6540,ENT-10254" }; + "test_soft_fail" + string => "(solaris|aix|hpux|windows)", # ENT-6540 exotics fail to delete chroot # ENT-10254 tests fail on Windows due to CRLF + meta => { "ENT-6540,ENT-10254" }; "description" -> { "ENT-5301" } string => "Test that files promises in --simulate=manifest mode produce proper output and only make changes in chroot"; @@ -37,9 +37,15 @@ bundle agent test bundle agent check { methods: - "normalize_agent_results" usebundle => normalize_agent_results("$(this.promise_filename).temp", - "$(this.promise_filename).actual"); - "check" usebundle => dcs_check_diff("$(this.promise_filename).actual", - "$(this.promise_filename).expected", - "$(this.promise_filename)"); + "normalize_agent_results" + usebundle => normalize_agent_results( + "$(this.promise_filename).temp", "$(this.promise_filename).actual" + ); + + "check" + usebundle => dcs_check_diff( + "$(this.promise_filename).actual", + "$(this.promise_filename).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/29_simulate_mode/simulate_safe_functions.cf b/tests/acceptance/29_simulate_mode/simulate_safe_functions.cf index 0de654013e..289f5811d5 100644 --- a/tests/acceptance/29_simulate_mode/simulate_safe_functions.cf +++ b/tests/acceptance/29_simulate_mode/simulate_safe_functions.cf @@ -7,18 +7,22 @@ body common control bundle agent init { vars: - "usemodule_unsafe_module_path" string => "$(sys.workdir)$(const.dirsep)modules$(const.dirsep)usemodule_unsafe.sh"; - "usemodule_safe_module_path" string => "$(sys.workdir)$(const.dirsep)modules$(const.dirsep)usemodule_safe.sh"; + "usemodule_unsafe_module_path" + string => "$(sys.workdir)$(const.dirsep)modules$(const.dirsep)usemodule_unsafe.sh"; + + "usemodule_safe_module_path" + string => "$(sys.workdir)$(const.dirsep)modules$(const.dirsep)usemodule_safe.sh"; files: - "$(sys.statedir)/*safe" - delete => tidy; + "$(sys.statedir)/*safe" delete => tidy; + "$(usemodule_unsafe_module_path)" create => "true", perms => m(700), content => "#!/bin/bash touch $(sys.statedir)/usemodule_unsafe "; + "$(usemodule_safe_module_path)" create => "true", perms => m(700), @@ -34,7 +38,12 @@ bundle agent test string => "Test that unsafe functions are only evaluated in --simulate mode when tagged as simulate_safe"; vars: - "cf_agent" string => ifelse(isvariable("sys.cf_agent"), "$(sys.cf_agent)", "/var/cfengine/bin/cf-agent"); + "cf_agent" + string => ifelse( + isvariable("sys.cf_agent"), + "$(sys.cf_agent)", + "/var/cfengine/bin/cf-agent" + ); commands: "$(cf_agent) --timestamp --debug --simulate=manifest -Kf $(this.promise_filename).sub >$(sys.workdir)$(const.dirsep)state$(const.dirsep)agent.log" @@ -44,8 +53,14 @@ bundle agent test bundle agent check { vars: - "result" string => readfile("$(sys.workdir)$(const.dirsep)state$(const.dirsep)agent.log"); + "result" + string => readfile( + "$(sys.workdir)$(const.dirsep)state$(const.dirsep)agent.log" + ); methods: - "Pass/FAIL" usebundle => dcs_check_strcmp( "$(result)", "FAIL", $(this.promise_filename), "yes"); + "Pass/FAIL" + usebundle => dcs_check_strcmp( + "$(result)", "FAIL", $(this.promise_filename), "yes" + ); } diff --git a/tests/acceptance/30_custom_promise_types/01_basic_module.cf b/tests/acceptance/30_custom_promise_types/01_basic_module.cf index 6eb89eb392..5aa507fef8 100644 --- a/tests/acceptance/30_custom_promise_types/01_basic_module.cf +++ b/tests/acceptance/30_custom_promise_types/01_basic_module.cf @@ -5,37 +5,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 { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - promise agent example { - interpreter => "/bin/bash"; - path => "$(this.promise_dirname)/example_module.sh"; + interpreter => "/bin/bash"; + path => "$(this.promise_dirname)/example_module.sh"; } body classes example { - promise_repaired => { "example_promise_repaired" }; + promise_repaired => { "example_promise_repaired" }; } bundle agent test @@ -43,13 +40,13 @@ bundle agent test meta: "description" -> { "CFE-3443" } string => "Test that you can add a promise module and evaluate a custom promise"; - "test_soft_fail" string => "windows", - meta => { "ENT-10217" }; + "test_soft_fail" + string => "windows", + meta => { "ENT-10217" }; vars: - "test_string" - string => "hello, modules"; + "test_string" string => "hello, modules"; example: cfengine:: @@ -58,42 +55,49 @@ bundle agent test classes => example; classes: - "file_created" - expression => canonify("$(G.testfile)_created"), - scope => "namespace"; - "file_updated" - expression => canonify("$(G.testfile)_content_updated"), - scope => "namespace"; - "file_update_failed" - expression => canonify("$(G.testfile)_content_update_failed"), - scope => "namespace"; + "file_created" + expression => canonify("$(G.testfile)_created"), + scope => "namespace"; + + "file_updated" + expression => canonify("$(G.testfile)_content_updated"), + scope => "namespace"; + + "file_update_failed" + expression => canonify("$(G.testfile)_content_update_failed"), + scope => "namespace"; } ####################################################### - bundle agent check { classes: - "file_ok" - expression => strcmp("$(test.test_string)", readfile("$(G.testfile)")), - if => fileexists("$(G.testfile)"); + "file_ok" + expression => strcmp("$(test.test_string)", readfile("$(G.testfile)")), + if => fileexists("$(G.testfile)"); - "ok" expression => "file_ok.file_created.file_updated.(!file_update_failed).example_promise_repaired"; + "ok" + expression => "file_ok.file_created.file_updated.(!file_update_failed).example_promise_repaired"; reports: DEBUG.file_ok:: "file_ok"; + DEBUG.file_created:: "file_created"; + DEBUG.file_updated:: "file_updated"; + DEBUG.file_update_failed:: "file_update_failed"; + DEBUG.example_promise_repaired:: "example_promise_repaired"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/30_custom_promise_types/02_if.cf b/tests/acceptance/30_custom_promise_types/02_if.cf index 39ca005a66..c060a1aa20 100644 --- a/tests/acceptance/30_custom_promise_types/02_if.cf +++ b/tests/acceptance/30_custom_promise_types/02_if.cf @@ -5,52 +5,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 init { files: - "$(G.testfile)-0" - delete => init_delete; - "$(G.testfile)-1" - delete => init_delete; - "$(G.testfile)-2" - delete => init_delete; - "$(G.testfile)-3" - delete => init_delete; - "$(G.testfile)-4" - delete => init_delete; - "$(G.testfile)-5" - delete => init_delete; - "$(G.testfile)-6" - delete => init_delete; - "$(G.testfile)-7" - delete => init_delete; - "$(G.testfile)-8" - delete => init_delete; - "$(G.testfile)-9" - delete => init_delete; - "$(G.testfile)-10" - delete => init_delete; + "$(G.testfile)-0" delete => init_delete; + "$(G.testfile)-1" delete => init_delete; + "$(G.testfile)-2" delete => init_delete; + "$(G.testfile)-3" delete => init_delete; + "$(G.testfile)-4" delete => init_delete; + "$(G.testfile)-5" delete => init_delete; + "$(G.testfile)-6" delete => init_delete; + "$(G.testfile)-7" delete => init_delete; + "$(G.testfile)-8" delete => init_delete; + "$(G.testfile)-9" delete => init_delete; + "$(G.testfile)-10" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - promise agent example { - interpreter => "/bin/bash"; - path => "$(this.promise_dirname)/example_module.sh"; + interpreter => "/bin/bash"; + path => "$(this.promise_dirname)/example_module.sh"; } bundle agent test @@ -58,53 +45,73 @@ bundle agent test meta: "description" -> { "CFE-3391" } string => "Test that custom promises work with if attribute"; - "test_soft_fail" string => "windows", + + "test_soft_fail" + string => "windows", meta => { "ENT-10217" }; vars: - "false_variable" - string => "cfengine.(!cfengine)"; - "true_variable" - string => "cfengine|(!cfengine)"; + "false_variable" string => "cfengine.(!cfengine)"; + "true_variable" string => "cfengine|(!cfengine)"; example: cfengine:: - "$(G.testfile)-0" # Created - no condition + "$(G.testfile)-0" + # Created - no condition message => "x"; - "$(G.testfile)-1" # Created - true condition + + "$(G.testfile)-1" + # Created - true condition message => "x", if => "cfengine"; - "$(G.testfile)-2" # Created - true condition from variable + + "$(G.testfile)-2" + # Created - true condition from variable message => "x", if => "$(true_variable)"; - "$(G.testfile)-3" # Created - true condition (inverted false variable) + + "$(G.testfile)-3" + # Created - true condition (inverted false variable) message => "x", if => "!($(false_variable))"; - "$(G.testfile)-4" # Created - not function call of something false + + "$(G.testfile)-4" + # Created - not function call of something false message => "x", if => not("$(false_variable)"); - "$(G.testfile)-5" # Not created - false condition + + "$(G.testfile)-5" + # Not created - false condition message => "x", if => "!cfengine"; - "$(G.testfile)-6" # Not created - false condition from variable + + "$(G.testfile)-6" + # Not created - false condition from variable message => "x", if => "$(false_variable)"; - "$(G.testfile)-7" # Not created - false condition (inverted true variable) + + "$(G.testfile)-7" + # Not created - false condition (inverted true variable) message => "x", if => "!($(true_variable))"; - "$(G.testfile)-8" # Not created - not function call of something true + + "$(G.testfile)-8" + # Not created - not function call of something true message => "x", if => not("$(true_variable)"); - "$(G.testfile)-9" # Not created - undefined variable in if + + "$(G.testfile)-9" + # Not created - undefined variable in if message => "x", if => "$(undefined_variable)"; - "$(G.testfile)-10" # Not created - unresolved function call in if + + "$(G.testfile)-10" + # Not created - unresolved function call in if message => "x", if => not("$(undefined_variable)"); } ####################################################### - bundle agent check { classes: @@ -126,6 +133,7 @@ bundle agent check reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/30_custom_promise_types/05_meta_attr.cf b/tests/acceptance/30_custom_promise_types/05_meta_attr.cf index 35f09e5618..c816891fcb 100644 --- a/tests/acceptance/30_custom_promise_types/05_meta_attr.cf +++ b/tests/acceptance/30_custom_promise_types/05_meta_attr.cf @@ -7,37 +7,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 { files: - "$(G.testfile)" - delete => init_delete; + "$(G.testfile)" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - promise agent example { - interpreter => "/bin/bash"; - path => "$(this.promise_dirname)/example_module.sh"; + interpreter => "/bin/bash"; + path => "$(this.promise_dirname)/example_module.sh"; } body classes example { - promise_repaired => { "example_promise_repaired" }; + promise_repaired => { "example_promise_repaired" }; } bundle agent test @@ -45,12 +42,13 @@ bundle agent test meta: "description" -> { "CFE-3440" } string => "Test that you can use a meta attribute with a custom promise"; - "test_soft_fail" string => "windows", + + "test_soft_fail" + string => "windows", meta => { "ENT-10217" }; vars: - "test_string" - string => "hello, modules"; + "test_string" string => "hello, modules"; example: cfengine:: @@ -60,42 +58,49 @@ bundle agent test meta => { "tag1", "tag2" }; classes: - "file_created" - expression => canonify("$(G.testfile)_created"), - scope => "namespace"; - "file_updated" - expression => canonify("$(G.testfile)_content_updated"), - scope => "namespace"; - "file_update_failed" - expression => canonify("$(G.testfile)_content_update_failed"), - scope => "namespace"; + "file_created" + expression => canonify("$(G.testfile)_created"), + scope => "namespace"; + + "file_updated" + expression => canonify("$(G.testfile)_content_updated"), + scope => "namespace"; + + "file_update_failed" + expression => canonify("$(G.testfile)_content_update_failed"), + scope => "namespace"; } ####################################################### - bundle agent check { classes: - "file_ok" - expression => strcmp("$(test.test_string)", readfile("$(G.testfile)")), - if => fileexists("$(G.testfile)"); + "file_ok" + expression => strcmp("$(test.test_string)", readfile("$(G.testfile)")), + if => fileexists("$(G.testfile)"); - "ok" expression => "file_ok.file_created.file_updated.(!file_update_failed).example_promise_repaired"; + "ok" + expression => "file_ok.file_created.file_updated.(!file_update_failed).example_promise_repaired"; reports: DEBUG.file_ok:: "file_ok"; + DEBUG.file_created:: "file_created"; + DEBUG.file_updated:: "file_updated"; + DEBUG.file_update_failed:: "file_update_failed"; + DEBUG.example_promise_repaired:: "example_promise_repaired"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/30_custom_promise_types/11_unless.cf b/tests/acceptance/30_custom_promise_types/11_unless.cf index a1c56638bc..ceba1ae673 100644 --- a/tests/acceptance/30_custom_promise_types/11_unless.cf +++ b/tests/acceptance/30_custom_promise_types/11_unless.cf @@ -5,52 +5,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 init { files: - "$(G.testfile)-0" - delete => init_delete; - "$(G.testfile)-1" - delete => init_delete; - "$(G.testfile)-2" - delete => init_delete; - "$(G.testfile)-3" - delete => init_delete; - "$(G.testfile)-4" - delete => init_delete; - "$(G.testfile)-5" - delete => init_delete; - "$(G.testfile)-6" - delete => init_delete; - "$(G.testfile)-7" - delete => init_delete; - "$(G.testfile)-8" - delete => init_delete; - "$(G.testfile)-9" - delete => init_delete; - "$(G.testfile)-10" - delete => init_delete; + "$(G.testfile)-0" delete => init_delete; + "$(G.testfile)-1" delete => init_delete; + "$(G.testfile)-2" delete => init_delete; + "$(G.testfile)-3" delete => init_delete; + "$(G.testfile)-4" delete => init_delete; + "$(G.testfile)-5" delete => init_delete; + "$(G.testfile)-6" delete => init_delete; + "$(G.testfile)-7" delete => init_delete; + "$(G.testfile)-8" delete => init_delete; + "$(G.testfile)-9" delete => init_delete; + "$(G.testfile)-10" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - promise agent example { - interpreter => "/bin/bash"; - path => "$(this.promise_dirname)/example_module.sh"; + interpreter => "/bin/bash"; + path => "$(this.promise_dirname)/example_module.sh"; } bundle agent test @@ -58,53 +45,73 @@ bundle agent test meta: "description" -> { "CFE-3431" } string => "Test that custom promises work with unless attribute"; - "test_soft_fail" string => "windows", + + "test_soft_fail" + string => "windows", meta => { "ENT-10217" }; vars: - "false_variable" - string => "cfengine.(!cfengine)"; - "true_variable" - string => "cfengine|(!cfengine)"; + "false_variable" string => "cfengine.(!cfengine)"; + "true_variable" string => "cfengine|(!cfengine)"; example: cfengine:: - "$(G.testfile)-0" # Created - no condition + "$(G.testfile)-0" + # Created - no condition message => "x"; - "$(G.testfile)-1" # Not created - true condition + + "$(G.testfile)-1" + # Not created - true condition message => "x", unless => "cfengine"; - "$(G.testfile)-2" # Not created - true condition from variable + + "$(G.testfile)-2" + # Not created - true condition from variable message => "x", unless => "$(true_variable)"; - "$(G.testfile)-3" # Not created - true condition (inverted false variable) + + "$(G.testfile)-3" + # Not created - true condition (inverted false variable) message => "x", unless => "!($(false_variable))"; - "$(G.testfile)-4" # NOT - not function call of something false + + "$(G.testfile)-4" + # NOT - not function call of something false message => "x", unless => not("$(false_variable)"); - "$(G.testfile)-5" # Created - false condition + + "$(G.testfile)-5" + # Created - false condition message => "x", unless => "!cfengine"; - "$(G.testfile)-6" # Created - false condition from variable + + "$(G.testfile)-6" + # Created - false condition from variable message => "x", unless => "$(false_variable)"; - "$(G.testfile)-7" # Created - false condition (inverted true variable) + + "$(G.testfile)-7" + # Created - false condition (inverted true variable) message => "x", unless => "!($(true_variable))"; - "$(G.testfile)-8" # Created - not function call of something true + + "$(G.testfile)-8" + # Created - not function call of something true message => "x", unless => not("$(true_variable)"); - "$(G.testfile)-9" # Created - undefined variable in unless + + "$(G.testfile)-9" + # Created - undefined variable in unless message => "x", unless => "$(undefined_variable)"; - "$(G.testfile)-10" # Created - unresolved function call in unless + + "$(G.testfile)-10" + # Created - unresolved function call in unless message => "x", unless => not("$(undefined_variable)"); } ####################################################### - bundle agent check { classes: @@ -126,6 +133,7 @@ bundle agent check reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/30_custom_promise_types/12_multiple_promises.cf b/tests/acceptance/30_custom_promise_types/12_multiple_promises.cf index bcb3f5a6c1..024d0fcfa9 100644 --- a/tests/acceptance/30_custom_promise_types/12_multiple_promises.cf +++ b/tests/acceptance/30_custom_promise_types/12_multiple_promises.cf @@ -6,44 +6,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 agent init { files: - "$(G.testfile)" - delete => init_delete; - "$(G.testfile)2" - delete => init_delete; + "$(G.testfile)" delete => init_delete; + "$(G.testfile)2" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - promise agent example { - interpreter => "/bin/bash"; - path => "$(this.promise_dirname)/example_module.sh"; + interpreter => "/bin/bash"; + path => "$(this.promise_dirname)/example_module.sh"; } body classes example { - promise_repaired => { "example_promise_repaired" }; + promise_repaired => { "example_promise_repaired" }; } body classes example2 { - promise_repaired => { "example2_promise_repaired" }; + promise_repaired => { "example2_promise_repaired" }; } bundle agent test @@ -51,85 +47,104 @@ bundle agent test meta: "description" -> { "CFE-3443" } string => "Test that you can evaluate multiple custom promises of the same type"; - "test_soft_fail" string => "windows", + + "test_soft_fail" + string => "windows", meta => { "ENT-10217" }; vars: - "test_string" - string => "hello, modules"; + "test_string" string => "hello, modules"; example: cfengine:: "$(G.testfile)" message => "$(test_string)", classes => example; + "$(G.testfile)2" message => "$(test_string)", classes => example2; classes: - "file_created" - expression => canonify("$(G.testfile)_created"), - scope => "namespace"; - "file_updated" - expression => canonify("$(G.testfile)_content_updated"), - scope => "namespace"; - "file_update_failed" - expression => canonify("$(G.testfile)_content_update_failed"), - scope => "namespace"; - "file2_created" - expression => canonify("$(G.testfile)2_created"), - scope => "namespace"; - "file2_updated" - expression => canonify("$(G.testfile)2_content_updated"), - scope => "namespace"; - "file2_update_failed" - expression => canonify("$(G.testfile)2_content_update_failed"), - scope => "namespace"; + "file_created" + expression => canonify("$(G.testfile)_created"), + scope => "namespace"; + + "file_updated" + expression => canonify("$(G.testfile)_content_updated"), + scope => "namespace"; + + "file_update_failed" + expression => canonify("$(G.testfile)_content_update_failed"), + scope => "namespace"; + + "file2_created" + expression => canonify("$(G.testfile)2_created"), + scope => "namespace"; + + "file2_updated" + expression => canonify("$(G.testfile)2_content_updated"), + scope => "namespace"; + + "file2_update_failed" + expression => canonify("$(G.testfile)2_content_update_failed"), + scope => "namespace"; } ####################################################### - bundle agent check { classes: - "file_ok" - expression => strcmp("$(test.test_string)", readfile("$(G.testfile)")), - if => fileexists("$(G.testfile)"); - "file2_ok" - expression => strcmp("$(test.test_string)", readfile("$(G.testfile)2")), - if => fileexists("$(G.testfile)2"); + "file_ok" + expression => strcmp("$(test.test_string)", readfile("$(G.testfile)")), + if => fileexists("$(G.testfile)"); + + "file2_ok" + expression => strcmp("$(test.test_string)", readfile("$(G.testfile)2")), + if => fileexists("$(G.testfile)2"); - "example_ok" expression => "file_ok.file_created.file_updated.(!file_update_failed).example_promise_repaired"; - "example2_ok" expression => "file2_ok.file2_created.file2_updated.(!file2_update_failed).example2_promise_repaired"; + "example_ok" + expression => "file_ok.file_created.file_updated.(!file_update_failed).example_promise_repaired"; - "ok" expression => "example_ok.example2_ok"; + "example2_ok" + expression => "file2_ok.file2_created.file2_updated.(!file2_update_failed).example2_promise_repaired"; + + "ok" expression => "example_ok.example2_ok"; reports: DEBUG.file_ok:: "file_ok"; + DEBUG.file_created:: "file_created"; + DEBUG.file_updated:: "file_updated"; + DEBUG.file_update_failed:: "file_update_failed"; + DEBUG.example_promise_repaired:: "example_promise_repaired"; DEBUG.file2_ok:: "file2_ok"; + DEBUG.file2_created:: "file2_created"; + DEBUG.file2_updated:: "file2_updated"; + DEBUG.file2_update_failed:: "file2_update_failed"; + DEBUG.example2_promise_repaired:: "example_promise_repaired"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/30_custom_promise_types/13_binary_path.cf b/tests/acceptance/30_custom_promise_types/13_binary_path.cf index f6cd98acb4..13eec0ad49 100644 --- a/tests/acceptance/30_custom_promise_types/13_binary_path.cf +++ b/tests/acceptance/30_custom_promise_types/13_binary_path.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"; } promise agent binary @@ -13,11 +13,12 @@ promise agent binary bundle agent test { meta: - "test_soft_fail" string => "windows", + "test_soft_fail" + string => "windows", meta => { "ENT-10217" }; + binary: - "foobar" - classes => if_ok("binary_ok"); + "foobar" classes => if_ok("binary_ok"); } bundle agent check @@ -25,6 +26,7 @@ bundle agent check reports: binary_ok:: "$(this.promise_filename) Pass"; + !binary_ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/30_custom_promise_types/14_multiple_promise_types_same_module.cf b/tests/acceptance/30_custom_promise_types/14_multiple_promise_types_same_module.cf index 352660a244..c6650c8441 100644 --- a/tests/acceptance/30_custom_promise_types/14_multiple_promise_types_same_module.cf +++ b/tests/acceptance/30_custom_promise_types/14_multiple_promise_types_same_module.cf @@ -6,50 +6,46 @@ ##################################################### body common control { - inputs => { "../default.sub.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)2" - delete => init_delete; + "$(G.testfile)" delete => init_delete; + "$(G.testfile)2" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - promise agent example { - interpreter => "/bin/bash"; - path => "$(this.promise_dirname)/example_module.sh"; + interpreter => "/bin/bash"; + path => "$(this.promise_dirname)/example_module.sh"; } promise agent example_two { - interpreter => "/bin/bash"; - path => "$(this.promise_dirname)/example_module.sh"; + interpreter => "/bin/bash"; + path => "$(this.promise_dirname)/example_module.sh"; } body classes example { - promise_repaired => { "example_promise_repaired" }; + promise_repaired => { "example_promise_repaired" }; } body classes example2 { - promise_repaired => { "example2_promise_repaired" }; + promise_repaired => { "example2_promise_repaired" }; } bundle agent test @@ -57,12 +53,13 @@ bundle agent test meta: "description" -> { "CFE-3443" } string => "Test that you can use the same custom module for two promise types"; - "test_soft_fail" string => "windows", + + "test_soft_fail" + string => "windows", meta => { "ENT-10217" }; vars: - "test_string" - string => "hello, modules"; + "test_string" string => "hello, modules"; example: cfengine:: @@ -77,68 +74,85 @@ bundle agent test classes => example2; classes: - "file_created" - expression => canonify("$(G.testfile)_created"), - scope => "namespace"; - "file_updated" - expression => canonify("$(G.testfile)_content_updated"), - scope => "namespace"; - "file_update_failed" - expression => canonify("$(G.testfile)_content_update_failed"), - scope => "namespace"; - "file2_created" - expression => canonify("$(G.testfile)2_created"), - scope => "namespace"; - "file2_updated" - expression => canonify("$(G.testfile)2_content_updated"), - scope => "namespace"; - "file2_update_failed" - expression => canonify("$(G.testfile)2_content_update_failed"), - scope => "namespace"; + "file_created" + expression => canonify("$(G.testfile)_created"), + scope => "namespace"; + + "file_updated" + expression => canonify("$(G.testfile)_content_updated"), + scope => "namespace"; + + "file_update_failed" + expression => canonify("$(G.testfile)_content_update_failed"), + scope => "namespace"; + + "file2_created" + expression => canonify("$(G.testfile)2_created"), + scope => "namespace"; + + "file2_updated" + expression => canonify("$(G.testfile)2_content_updated"), + scope => "namespace"; + + "file2_update_failed" + expression => canonify("$(G.testfile)2_content_update_failed"), + scope => "namespace"; } ####################################################### - bundle agent check { classes: - "file_ok" - expression => strcmp("$(test.test_string)", readfile("$(G.testfile)")), - if => fileexists("$(G.testfile)"); - "file2_ok" - expression => strcmp("$(test.test_string)", readfile("$(G.testfile)2")), - if => fileexists("$(G.testfile)2"); + "file_ok" + expression => strcmp("$(test.test_string)", readfile("$(G.testfile)")), + if => fileexists("$(G.testfile)"); + + "file2_ok" + expression => strcmp("$(test.test_string)", readfile("$(G.testfile)2")), + if => fileexists("$(G.testfile)2"); - "example_ok" expression => "file_ok.file_created.file_updated.(!file_update_failed).example_promise_repaired"; - "example2_ok" expression => "file2_ok.file2_created.file2_updated.(!file2_update_failed).example2_promise_repaired"; + "example_ok" + expression => "file_ok.file_created.file_updated.(!file_update_failed).example_promise_repaired"; - "ok" expression => "example_ok.example2_ok"; + "example2_ok" + expression => "file2_ok.file2_created.file2_updated.(!file2_update_failed).example2_promise_repaired"; + + "ok" expression => "example_ok.example2_ok"; reports: DEBUG.file_ok:: "file_ok"; + DEBUG.file_created:: "file_created"; + DEBUG.file_updated:: "file_updated"; + DEBUG.file_update_failed:: "file_update_failed"; + DEBUG.example_promise_repaired:: "example_promise_repaired"; DEBUG.file2_ok:: "file2_ok"; + DEBUG.file2_created:: "file2_created"; + DEBUG.file2_updated:: "file2_updated"; + DEBUG.file2_update_failed:: "file2_update_failed"; + DEBUG.example2_promise_repaired:: "example_promise_repaired"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/30_custom_promise_types/15_conflicting_interpreters.cf b/tests/acceptance/30_custom_promise_types/15_conflicting_interpreters.cf index eb108acda6..78a93342eb 100644 --- a/tests/acceptance/30_custom_promise_types/15_conflicting_interpreters.cf +++ b/tests/acceptance/30_custom_promise_types/15_conflicting_interpreters.cf @@ -7,50 +7,46 @@ ##################################################### body common control { - inputs => { "../default.sub.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)2" - delete => init_delete; + "$(G.testfile)" delete => init_delete; + "$(G.testfile)2" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - promise agent example { - interpreter => "/bin/bash"; - path => "$(this.promise_dirname)/example_module.sh"; + interpreter => "/bin/bash"; + path => "$(this.promise_dirname)/example_module.sh"; } promise agent example_two { - interpreter => "/bin/bash_noexist"; - path => "$(this.promise_dirname)/example_module.sh"; + interpreter => "/bin/bash_noexist"; + path => "$(this.promise_dirname)/example_module.sh"; } body classes example { - promise_repaired => { "example_promise_repaired" }; + promise_repaired => { "example_promise_repaired" }; } body classes example2 { - promise_repaired => { "example2_promise_repaired" }; + promise_repaired => { "example2_promise_repaired" }; } bundle agent test @@ -58,12 +54,13 @@ bundle agent test meta: "description" -> { "CFE-3443" } string => "Test that you cannot use a promise module with two different interpreters"; - "test_soft_fail" string => "windows", + + "test_soft_fail" + string => "windows", meta => { "ENT-10217" }; vars: - "test_string" - string => "hello, modules"; + "test_string" string => "hello, modules"; example: cfengine:: @@ -78,68 +75,85 @@ bundle agent test classes => example2; classes: - "file_created" - expression => canonify("$(G.testfile)_created"), - scope => "namespace"; - "file_updated" - expression => canonify("$(G.testfile)_content_updated"), - scope => "namespace"; - "file_update_failed" - expression => canonify("$(G.testfile)_content_update_failed"), - scope => "namespace"; - "file2_created" - expression => canonify("$(G.testfile)2_created"), - scope => "namespace"; - "file2_updated" - expression => canonify("$(G.testfile)2_content_updated"), - scope => "namespace"; - "file2_update_failed" - expression => canonify("$(G.testfile)2_content_update_failed"), - scope => "namespace"; + "file_created" + expression => canonify("$(G.testfile)_created"), + scope => "namespace"; + + "file_updated" + expression => canonify("$(G.testfile)_content_updated"), + scope => "namespace"; + + "file_update_failed" + expression => canonify("$(G.testfile)_content_update_failed"), + scope => "namespace"; + + "file2_created" + expression => canonify("$(G.testfile)2_created"), + scope => "namespace"; + + "file2_updated" + expression => canonify("$(G.testfile)2_content_updated"), + scope => "namespace"; + + "file2_update_failed" + expression => canonify("$(G.testfile)2_content_update_failed"), + scope => "namespace"; } ####################################################### - bundle agent check { classes: - "file_ok" - expression => strcmp("$(test.test_string)", readfile("$(G.testfile)")), - if => fileexists("$(G.testfile)"); - "file2_ok" - expression => strcmp("$(test.test_string)", readfile("$(G.testfile)2")), - if => fileexists("$(G.testfile)2"); + "file_ok" + expression => strcmp("$(test.test_string)", readfile("$(G.testfile)")), + if => fileexists("$(G.testfile)"); + + "file2_ok" + expression => strcmp("$(test.test_string)", readfile("$(G.testfile)2")), + if => fileexists("$(G.testfile)2"); - "example_ok" expression => "file_ok.file_created.file_updated.(!file_update_failed).example_promise_repaired"; - "example2_ok" expression => "!file2_ok.!file2_created.!file2_updated.!file2_update_failed.!example2_promise_repaired"; + "example_ok" + expression => "file_ok.file_created.file_updated.(!file_update_failed).example_promise_repaired"; - "ok" expression => "example_ok.example2_ok"; + "example2_ok" + expression => "!file2_ok.!file2_created.!file2_updated.!file2_update_failed.!example2_promise_repaired"; + + "ok" expression => "example_ok.example2_ok"; reports: DEBUG.file_ok:: "file_ok"; + DEBUG.file_created:: "file_created"; + DEBUG.file_updated:: "file_updated"; + DEBUG.file_update_failed:: "file_update_failed"; + DEBUG.example_promise_repaired:: "example_promise_repaired"; DEBUG.file2_ok:: "file2_ok"; + DEBUG.file2_created:: "file2_created"; + DEBUG.file2_updated:: "file2_updated"; + DEBUG.file2_update_failed:: "file2_update_failed"; + DEBUG.example2_promise_repaired:: "example_promise_repaired"; ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/30_custom_promise_types/17_early_module_failure.cf b/tests/acceptance/30_custom_promise_types/17_early_module_failure.cf index 2210b316dc..631b4d8317 100644 --- a/tests/acceptance/30_custom_promise_types/17_early_module_failure.cf +++ b/tests/acceptance/30_custom_promise_types/17_early_module_failure.cf @@ -5,20 +5,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 check { vars: - "command" string => "$(sys.cf_agent) -D AUTO -KIf $(this.promise_filename).sub"; + "command" + string => "$(sys.cf_agent) -D AUTO -KIf $(this.promise_filename).sub"; methods: - "check" - usebundle => dcs_passif_output(".*error:.*", ".*(Assertion.*failed|fault).*", - $(command), $(this.promise_filename)); + "check" + usebundle => dcs_passif_output( + ".*error:.*", + ".*(Assertion.*failed|fault).*", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/30_custom_promise_types/18_early_module_failure_classes.cf b/tests/acceptance/30_custom_promise_types/18_early_module_failure_classes.cf index 86e6c67995..f47d17b546 100644 --- a/tests/acceptance/30_custom_promise_types/18_early_module_failure_classes.cf +++ b/tests/acceptance/30_custom_promise_types/18_early_module_failure_classes.cf @@ -5,17 +5,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"; } ####################################################### - promise agent bad { - interpreter => "/usr/bin/python3"; - path => "$(this.promise_dirname)/bad_import.py"; + interpreter => "/usr/bin/python3"; + path => "$(this.promise_dirname)/bad_import.py"; } bundle agent test @@ -25,24 +24,24 @@ bundle agent test string => "Test that a promise using an early-failing custom module still sets result classes"; bad: - "doesn't matter what I put here" - classes => test; + "doesn't matter what I put here" classes => test; } body classes test { - promise_repaired => { "test_promise_repaired" }; - repair_failed => { "test_promise_failed" }; + promise_repaired => { "test_promise_repaired" }; + repair_failed => { "test_promise_failed" }; } bundle agent check { classes: - "ok" expression => "test_promise_failed"; + "ok" expression => "test_promise_failed"; reports: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/30_custom_promise_types/22_what_module_gets.cf b/tests/acceptance/30_custom_promise_types/22_what_module_gets.cf index 63181be6af..80953def2f 100644 --- a/tests/acceptance/30_custom_promise_types/22_what_module_gets.cf +++ b/tests/acceptance/30_custom_promise_types/22_what_module_gets.cf @@ -5,32 +5,29 @@ ##################################################### body common control { - inputs => { "../default.sub.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/module.log" - delete => init_delete; + "/tmp/module.log" delete => init_delete; } body delete init_delete { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } ####################################################### - promise agent example { - interpreter => "/bin/bash"; - path => "$(this.promise_dirname)/cat_module.sh"; + interpreter => "/bin/bash"; + path => "$(this.promise_dirname)/cat_module.sh"; } bundle agent test @@ -38,21 +35,24 @@ bundle agent test meta: "description" -> { "CFE-3723" } string => "Test that input from cf-agent to promise module matches expected data"; - "test_soft_fail" string => "windows", + + "test_soft_fail" + string => "windows", meta => { "ENT-10217" }; example: cfengine:: - "Promiser" - attributeName => "attributeValue"; + "Promiser" attributeName => "attributeValue"; } ####################################################### - bundle agent check { methods: - "any" usebundle => dcs_check_diff("/tmp/module.log", - "$(this.promise_filename).expected", - "$(this.promise_filename)"); + "any" + usebundle => dcs_check_diff( + "/tmp/module.log", + "$(this.promise_filename).expected", + "$(this.promise_filename)" + ); } diff --git a/tests/acceptance/30_custom_promise_types/22_what_module_gets.cf.expected b/tests/acceptance/30_custom_promise_types/22_what_module_gets.cf.expected index d06f1bc7c9..5536b5ea33 100644 --- a/tests/acceptance/30_custom_promise_types/22_what_module_gets.cf.expected +++ b/tests/acceptance/30_custom_promise_types/22_what_module_gets.cf.expected @@ -4,7 +4,7 @@ operation=validate_promise log_level=info promise_type=example promiser=Promiser -line_number=46 +line_number=45 filename=./30_custom_promise_types/22_what_module_gets.cf attribute_attributeName=attributeValue @@ -12,7 +12,7 @@ operation=evaluate_promise log_level=info promise_type=example promiser=Promiser -line_number=46 +line_number=45 filename=./30_custom_promise_types/22_what_module_gets.cf attribute_attributeName=attributeValue diff --git a/tests/acceptance/30_custom_promise_types/23_action_policy/dryrun_supported.cf b/tests/acceptance/30_custom_promise_types/23_action_policy/dryrun_supported.cf index 7b009e09ec..2c50cf5a26 100644 --- a/tests/acceptance/30_custom_promise_types/23_action_policy/dryrun_supported.cf +++ b/tests/acceptance/30_custom_promise_types/23_action_policy/dryrun_supported.cf @@ -6,29 +6,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 test { meta: "description" -> { "CFE-3433" } string => "Test that dry-run can be used with custom promise modules supporting it"; - "test_soft_fail" string => "windows", + + "test_soft_fail" + string => "windows", meta => { "ENT-10217" }; } bundle agent check { vars: - "command" string => "$(sys.cf_agent) --dry-run -D AUTO -KIf $(this.promise_filename).sub"; + "command" + string => "$(sys.cf_agent) --dry-run -D AUTO -KIf $(this.promise_filename).sub"; methods: - "check" - usebundle => dcs_passif_output(".*warning: Should.*", ".*CRITICAL:.*", - $(command), $(this.promise_filename)); + "check" + usebundle => dcs_passif_output( + ".*warning: Should.*", + ".*CRITICAL:.*", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/30_custom_promise_types/23_action_policy/dryrun_unsupported.cf b/tests/acceptance/30_custom_promise_types/23_action_policy/dryrun_unsupported.cf index 77e213b673..1e61d2029a 100644 --- a/tests/acceptance/30_custom_promise_types/23_action_policy/dryrun_unsupported.cf +++ b/tests/acceptance/30_custom_promise_types/23_action_policy/dryrun_unsupported.cf @@ -6,29 +6,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 test { meta: "description" -> { "CFE-3433" } string => "Test that --dry-run produces errors when used with custom promise modules not supporting it"; - "test_soft_fail" string => "windows", + + "test_soft_fail" + string => "windows", meta => { "ENT-10217" }; } bundle agent check { vars: - "command" string => "$(sys.cf_agent) --dry-run -D AUTO -KIf $(this.promise_filename).sub"; + "command" + string => "$(sys.cf_agent) --dry-run -D AUTO -KIf $(this.promise_filename).sub"; methods: - "check" - usebundle => dcs_passif_output(".*error: Not making changes.*", ".*CRITICAL:.*", - $(command), $(this.promise_filename)); + "check" + usebundle => dcs_passif_output( + ".*error: Not making changes.*", + ".*CRITICAL:.*", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/30_custom_promise_types/23_action_policy/explicit_warn_fake_supported.cf b/tests/acceptance/30_custom_promise_types/23_action_policy/explicit_warn_fake_supported.cf index 81ed9896aa..42da613e6f 100644 --- a/tests/acceptance/30_custom_promise_types/23_action_policy/explicit_warn_fake_supported.cf +++ b/tests/acceptance/30_custom_promise_types/23_action_policy/explicit_warn_fake_supported.cf @@ -6,29 +6,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 test { meta: "description" -> { "CFE-3433" } string => "Test that a bug in a module is reported if it advertises action_policy feature, but doesn't properly implement it"; - "test_soft_fail" string => "windows", + + "test_soft_fail" + string => "windows", meta => { "ENT-10217" }; } bundle agent check { vars: - "command" string => "$(sys.cf_agent) -D AUTO -KIf $(this.promise_filename).sub"; + "command" + string => "$(sys.cf_agent) -D AUTO -KIf $(this.promise_filename).sub"; methods: - "check" - usebundle => dcs_passif_output(".*CRITICAL: Bug in promise module.*", "", - $(command), $(this.promise_filename)); + "check" + usebundle => dcs_passif_output( + ".*CRITICAL: Bug in promise module.*", + "", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/30_custom_promise_types/23_action_policy/explicit_warn_supported.cf b/tests/acceptance/30_custom_promise_types/23_action_policy/explicit_warn_supported.cf index 37e68f5518..9364265248 100644 --- a/tests/acceptance/30_custom_promise_types/23_action_policy/explicit_warn_supported.cf +++ b/tests/acceptance/30_custom_promise_types/23_action_policy/explicit_warn_supported.cf @@ -6,29 +6,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 test { meta: "description" -> { "CFE-3433" } string => "Test that action_policy can be used with custom promise modules supporting it"; - "test_soft_fail" string => "windows", + + "test_soft_fail" + string => "windows", meta => { "ENT-10217" }; } bundle agent check { vars: - "command" string => "$(sys.cf_agent) -D AUTO -KIf $(this.promise_filename).sub"; + "command" + string => "$(sys.cf_agent) -D AUTO -KIf $(this.promise_filename).sub"; methods: - "check" - usebundle => dcs_passif_output(".*warning: Should.*", ".*CRITICAL:.*", - $(command), $(this.promise_filename)); + "check" + usebundle => dcs_passif_output( + ".*warning: Should.*", + ".*CRITICAL:.*", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/30_custom_promise_types/23_action_policy/explicit_warn_unsupported.cf b/tests/acceptance/30_custom_promise_types/23_action_policy/explicit_warn_unsupported.cf index 27df2493b3..a1e928ae91 100644 --- a/tests/acceptance/30_custom_promise_types/23_action_policy/explicit_warn_unsupported.cf +++ b/tests/acceptance/30_custom_promise_types/23_action_policy/explicit_warn_unsupported.cf @@ -6,29 +6,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 test { meta: "description" -> { "CFE-3433" } string => "Test that action_policy produces errors when used with custom promise modules not supporting it"; - "test_soft_fail" string => "windows", + + "test_soft_fail" + string => "windows", meta => { "ENT-10217" }; } bundle agent check { vars: - "command" string => "$(sys.cf_agent) -D AUTO -KIf $(this.promise_filename).sub"; + "command" + string => "$(sys.cf_agent) -D AUTO -KIf $(this.promise_filename).sub"; methods: - "check" - usebundle => dcs_passif_output(".*error: Not making changes.*", ".*CRITICAL:.*", - $(command), $(this.promise_filename)); + "check" + usebundle => dcs_passif_output( + ".*error: Not making changes.*", + ".*CRITICAL:.*", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/30_custom_promise_types/23_action_policy/simulate_supported.cf b/tests/acceptance/30_custom_promise_types/23_action_policy/simulate_supported.cf index 2094f3759a..05f9329e1d 100644 --- a/tests/acceptance/30_custom_promise_types/23_action_policy/simulate_supported.cf +++ b/tests/acceptance/30_custom_promise_types/23_action_policy/simulate_supported.cf @@ -6,29 +6,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 test { meta: "description" -> { "CFE-3433" } string => "Test that --simulate can be used with custom promise modules supporting it"; - "test_soft_fail" string => "windows", + + "test_soft_fail" + string => "windows", meta => { "ENT-10217" }; } bundle agent check { vars: - "command" string => "$(sys.cf_agent) --simulate manifest -D AUTO -KIf $(this.promise_filename).sub"; + "command" + string => "$(sys.cf_agent) --simulate manifest -D AUTO -KIf $(this.promise_filename).sub"; methods: - "check" - usebundle => dcs_passif_output(".*warning: Should.*", ".*CRITICAL:.*", - $(command), $(this.promise_filename)); + "check" + usebundle => dcs_passif_output( + ".*warning: Should.*", + ".*CRITICAL:.*", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/30_custom_promise_types/23_action_policy/simulate_unsupported.cf b/tests/acceptance/30_custom_promise_types/23_action_policy/simulate_unsupported.cf index 3b6408b13f..fece267512 100644 --- a/tests/acceptance/30_custom_promise_types/23_action_policy/simulate_unsupported.cf +++ b/tests/acceptance/30_custom_promise_types/23_action_policy/simulate_unsupported.cf @@ -6,29 +6,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 test { meta: "description" -> { "CFE-3433" } string => "Test that --simulate produces errors when used with custom promise modules not supporting it"; - "test_soft_fail" string => "windows", + + "test_soft_fail" + string => "windows", meta => { "ENT-10217" }; } bundle agent check { vars: - "command" string => "$(sys.cf_agent) --simulate manifest -D AUTO -KIf $(this.promise_filename).sub"; + "command" + string => "$(sys.cf_agent) --simulate manifest -D AUTO -KIf $(this.promise_filename).sub"; methods: - "check" - usebundle => dcs_passif_output(".*error: Not making changes.*", ".*CRITICAL:.*", - $(command), $(this.promise_filename)); + "check" + usebundle => dcs_passif_output( + ".*error: Not making changes.*", + ".*CRITICAL:.*", + $(command), + $(this.promise_filename) + ); } diff --git a/tests/acceptance/31_tickets/CFE-2367/1/test.cf b/tests/acceptance/31_tickets/CFE-2367/1/test.cf index f6f6d17441..57f246e04d 100644 --- a/tests/acceptance/31_tickets/CFE-2367/1/test.cf +++ b/tests/acceptance/31_tickets/CFE-2367/1/test.cf @@ -1,34 +1,34 @@ 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 test { meta: - "description" -> { "CFE-2367" } - string => "cf-agent should not fatally error when fileexists() is given an undefined variable as a parameter"; + "description" -> { "CFE-2367" } + string => "cf-agent should not fatally error when fileexists() is given an undefined variable as a parameter"; files: "$(G.testfile)" - content => "CFE-2367", - unless => fileexists( $(testfile) ); # testfile is not defined, in the - # original ticket filed this caused - # a fatal error + content => "CFE-2367", + # testfile is not defined, in the + # original ticket filed this caused + # a fatal error + unless => fileexists($(testfile)); } bundle agent check { methods: - # Since this was testing for the absence of a fatal error, if we get to - # this point, we pass. - "Pass" - usebundle => dcs_pass("$(this.promise_filename)" ); + # Since this was testing for the absence of a fatal error, if we get to + # this point, we pass. + "Pass" usebundle => dcs_pass("$(this.promise_filename)"); } diff --git a/tests/acceptance/31_tickets/CFE-2367/2/test.cf b/tests/acceptance/31_tickets/CFE-2367/2/test.cf index 03ff5e5752..2000b198f6 100644 --- a/tests/acceptance/31_tickets/CFE-2367/2/test.cf +++ b/tests/acceptance/31_tickets/CFE-2367/2/test.cf @@ -1,40 +1,40 @@ 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 test { meta: - "description" -> { "CFE-2367" } - string => "cf-agent should not fatally error when fileexists() is given an undefined variable as a parameter"; + "description" -> { "CFE-2367" } + string => "cf-agent should not fatally error when fileexists() is given an undefined variable as a parameter"; files: "$(G.testfile)" - content => "CFE-2367", - unless => and( fileexists( $(testfile) ) ); # testfile is not defined, - # in the original ticket - # filed this caused a fatal - # error and the workaround - # was to wrap the function - # call with and(), so we - # simply test that as in the - # original case, there is no - # fatal error. + content => "CFE-2367", + # testfile is not defined, + # in the original ticket + # filed this caused a fatal + # error and the workaround + # was to wrap the function + # call with and(), so we + # simply test that as in the + # original case, there is no + # fatal error. + unless => and(fileexists($(testfile))); } bundle agent check { methods: - # Since this was testing for the absence of a fatal error, if we get to - # this point, we pass. - "Pass" - usebundle => dcs_pass("$(this.promise_filename)" ); + # Since this was testing for the absence of a fatal error, if we get to + # this point, we pass. + "Pass" usebundle => dcs_pass("$(this.promise_filename)"); } diff --git a/tests/acceptance/31_tickets/CFE-3866/test.cf b/tests/acceptance/31_tickets/CFE-3866/test.cf index 643ae0e0d3..5a8dd62645 100644 --- a/tests/acceptance/31_tickets/CFE-3866/test.cf +++ b/tests/acceptance/31_tickets/CFE-3866/test.cf @@ -1,85 +1,77 @@ body file control { - inputs => { - "../../default.sub.cf", - }; + inputs => { "../../default.sub.cf" }; } bundle agent __main__ { methods: - "bundlesequence" usebundle => default("$(this.promise_filename)"); + "bundlesequence" usebundle => default("$(this.promise_filename)"); } 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: - "description" - string => "Test that select_region converges across multiple edit_line passes when the region is created in an earlier pass", - meta => { "CFE-3866" }; + "description" + string => "Test that select_region converges across multiple edit_line passes when the region is created in an earlier pass", + meta => { "CFE-3866" }; files: - "$(G.testfile)" - create => "true", - edit_line => insert_section_then_add_content; + "$(G.testfile)" + create => "true", + edit_line => insert_section_then_add_content; } bundle edit_line insert_section_then_add_content { # First promise: Create the section header insert_lines: - "[section]" - location => start; + "[section]" location => start; # Second promise: Add content within the section using select_region # This should converge even though the section didn't exist when # select_region was first evaluated (pass 1) - insert_lines: - "key=value" - location => append, - select_region => section_region; + "key=value" + location => append, + select_region => section_region; } body location append { - before_after => "after"; + before_after => "after"; } body select_region section_region { - select_start => "^\[section\]"; - include_start_delimiter => "true"; - select_end => "^\[.*\]"; - select_end_match_eof => "true"; + select_start => "^\[section\]"; + include_start_delimiter => "true"; + select_end => "^\[.*\]"; + select_end_match_eof => "true"; } bundle agent check { vars: - "expected" - string => "[section] + "expected" string => "[section] key=value "; - - "actual" - string => readfile("$(G.testfile)", "1000"); + "actual" string => readfile("$(G.testfile)", "1000"); classes: - "ok" expression => strcmp("$(expected)", "$(actual)"); + "ok" expression => strcmp("$(expected)", "$(actual)"); reports: DEBUG:: @@ -88,6 +80,7 @@ key=value ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; } diff --git a/tests/acceptance/31_tickets/CFE-3987/1/test.cf b/tests/acceptance/31_tickets/CFE-3987/1/test.cf index e8e56725cc..60b973e816 100644 --- a/tests/acceptance/31_tickets/CFE-3987/1/test.cf +++ b/tests/acceptance/31_tickets/CFE-3987/1/test.cf @@ -1,72 +1,72 @@ 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 { files: - # Seed the file we will exercise the test on - "$(G.testfile)" - copy_from => local_dcp( "$(this.promise_dirname)/before_test.xml.txt" ); + # Seed the file we will exercise the test on + "$(G.testfile)" + copy_from => local_dcp("$(this.promise_dirname)/before_test.xml.txt"); } + bundle agent test { meta: - "description" - string => "edit_line doesn't insert text immediately before a selected region if a location body only explicitly sets before_after => 'before'", - meta => { "CFE-3987" }; + "description" + string => "edit_line doesn't insert text immediately before a selected region if a location body only explicitly sets before_after => 'before'", + meta => { "CFE-3987" }; - "test_soft_fail" - string => "any", - meta => { "CFE-3987" }; + "test_soft_fail" + string => "any", + meta => { "CFE-3987" }; vars: - "seed_file" string => "$(this.promise_dirname)/before_test.xml.txt"; - "test_file" string => "$(G.testfile)"; + "seed_file" string => "$(this.promise_dirname)/before_test.xml.txt"; + "test_file" string => "$(G.testfile)"; files: - "$(test_file)" - edit_line => CFE_3987; + "$(test_file)" edit_line => CFE_3987; } bundle agent check { methods: - "Pass/FAIL" - usebundle => dcs_check_regcmp( - ".*INSERT\sME\R\s+ - #INSERT ME - - "Pass/FAIL" - usebundle => dcs_check_regcmp( - ".*\s+THIS MUST BE THE LAST FILTER IN THE DEFINED CHAIN\R\s+=+\s+-->\RINSERT\sME.*", - readfile( "$(test.test_file)" ), - $(this.promise_filename), - "no" - ); + # We expect to find lines that look something like this: + # THIS MUST BE THE LAST FILTER IN THE DEFINED CHAIN + # ===================================================== --> + #INSERT ME + "Pass/FAIL" + usebundle => dcs_check_regcmp( + ".*\s+THIS MUST BE THE LAST FILTER IN THE DEFINED CHAIN\R\s+=+\s+-->\RINSERT\sME.*", + readfile("$(test.test_file)"), + $(this.promise_filename), + "no" + ); } bundle edit_line CFE_3988 { insert_lines: - "INSERT ME" - select_region => my_comment_last_filter, - location => my_location_after_comment_last_filter; + "INSERT ME" + select_region => my_comment_last_filter, + location => my_location_after_comment_last_filter; } + body location my_location_after_comment_last_filter # @brief Editing occurs after the last line in the selected region { - before_after => "after"; - first_last => "last"; - select_line_matching => ".*"; + before_after => "after"; + first_last => "last"; + select_line_matching => ".*"; } body select_region my_comment_last_filter { - select_start => "\s+THIS MUST BE THE LAST FILTER IN THE DEFINED CHAIN"; - select_end => "\s+=+\s+-->"; - include_start_delimiter => "true"; - include_end_delimiter => "true"; - select_end_match_eof => "false"; + select_start => "\s+THIS MUST BE THE LAST FILTER IN THE DEFINED CHAIN"; + select_end => "\s+=+\s+-->"; + include_start_delimiter => "true"; + include_end_delimiter => "true"; + select_end_match_eof => "false"; } diff --git a/tests/acceptance/31_tickets/ENT-8788/1/main.cf b/tests/acceptance/31_tickets/ENT-8788/1/main.cf index 8e32746879..3fa1522794 100644 --- a/tests/acceptance/31_tickets/ENT-8788/1/main.cf +++ b/tests/acceptance/31_tickets/ENT-8788/1/main.cf @@ -1,74 +1,81 @@ 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 { vars: - "original_file" string => "$(this.promise_dirname)/start.xml.txt"; - "test_file" string => "$(sys.workdir)/start.xml.test"; + "original_file" string => "$(this.promise_dirname)/start.xml.txt"; + "test_file" string => "$(sys.workdir)/start.xml.test"; + files: - "$(test_file)" - copy_from => local_cp("${original_file}"); + "$(test_file)" copy_from => local_cp("${original_file}"); } bundle agent test { meta: - "description" - string => "Inserting content that contains blank lines with file_preserve_block before select_line_matching does not split inserted content before and after select_line_matching", - meta => { "ENT-8788" }; + "description" + string => "Inserting content that contains blank lines with file_preserve_block before select_line_matching does not split inserted content before and after select_line_matching", + meta => { "ENT-8788" }; vars: - "new_content_file" string => "$(this.promise_dirname)/newcontent.xml.txt"; + "new_content_file" string => "$(this.promise_dirname)/newcontent.xml.txt"; files: "$(init.test_file)" - create => "false", - edit_defaults => size("500k"), - edit_line => insert_file_as_block_relative_to_first_or_last_line( - "$(new_content_file)", # File with content to insert if not found - "before", # Relative position to insert content (before|after) - "last", # which line match will we insert based on? - "\s+" # Regex to match the line we want to insert relative to - ); + create => "false", + edit_defaults => size("500k"), + edit_line => insert_file_as_block_relative_to_first_or_last_line( + # File with content to insert if not found: + "$(new_content_file)", + # Relative position to insert content (before|after): + "before", + # which line match will we insert based on? + "last", + # Regex to match the line we want to insert relative to: + "\s+" + ); } bundle agent check { methods: - - "Pass/Fail" usebundle => dcs_check_diff($(init.test_file), - "$(this.promise_dirname)/desired-result.xml.txt", - $(this.promise_filename)); + "Pass/Fail" + usebundle => dcs_check_diff( + $(init.test_file), + "$(this.promise_dirname)/desired-result.xml.txt", + $(this.promise_filename) + ); } bundle edit_line insert_file_as_block_relative_to_first_or_last_line(templatefile, relative_location, first_or_last, location_line_regex) { insert_lines: - - "$(templatefile)" - comment => "Insert the template file into the file being edited", - insert_type => "file_preserve_block", - location => location_before_after_first_or_last_line( $(relative_location), $(first_or_last), $(location_line_regex) ); + "$(templatefile)" + comment => "Insert the template file into the file being edited", + insert_type => "file_preserve_block", + location => location_before_after_first_or_last_line( + $(relative_location), $(first_or_last), $(location_line_regex) + ); } + body location location_before_after_first_or_last_line(relative_position, first_or_last, regex_matching_line) { - before_after => "$(relative_position)"; - first_last => "$(first_or_last)"; - select_line_matching => "$(regex_matching_line)"; + before_after => "$(relative_position)"; + first_last => "$(first_or_last)"; + select_line_matching => "$(regex_matching_line)"; } body edit_defaults size(bigenough) { - max_file_size => "$(bigenough)"; + max_file_size => "$(bigenough)"; } diff --git a/tests/acceptance/31_tickets/ENT-8788/2/main.cf b/tests/acceptance/31_tickets/ENT-8788/2/main.cf index e7af7a38ce..0f0a8d70ec 100644 --- a/tests/acceptance/31_tickets/ENT-8788/2/main.cf +++ b/tests/acceptance/31_tickets/ENT-8788/2/main.cf @@ -1,74 +1,81 @@ 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 { vars: - "original_file" string => "$(this.promise_dirname)/start.xml.txt"; - "test_file" string => "$(sys.workdir)/start.xml.test"; + "original_file" string => "$(this.promise_dirname)/start.xml.txt"; + "test_file" string => "$(sys.workdir)/start.xml.test"; + files: - "$(test_file)" - copy_from => local_cp("${original_file}"); + "$(test_file)" copy_from => local_cp("${original_file}"); } bundle agent test { meta: - "description" - string => "Inserting content that does not contain blank lines with file_preserve_block before select_line_matching works as expected", - meta => { "ENT-8788" }; + "description" + string => "Inserting content that does not contain blank lines with file_preserve_block before select_line_matching works as expected", + meta => { "ENT-8788" }; vars: - "new_content_file" string => "$(this.promise_dirname)/newcontent.xml.txt"; + "new_content_file" string => "$(this.promise_dirname)/newcontent.xml.txt"; files: "$(init.test_file)" - create => "false", - edit_defaults => size("500k"), - edit_line => insert_file_as_block_relative_to_first_or_last_line( - "$(new_content_file)", # File with content to insert if not found - "before", # Relative position to insert content (before|after) - "last", # which line match will we insert based on? - "\s+" # Regex to match the line we want to insert relative to - ); + create => "false", + edit_defaults => size("500k"), + edit_line => insert_file_as_block_relative_to_first_or_last_line( + # File with content to insert if not found: + "$(new_content_file)", + # Relative position to insert content (before|after): + "before", + # which line match will we insert based on? + "last", + # Regex to match the line we want to insert relative to: + "\s+" + ); } bundle agent check { methods: - - "Pass/Fail" usebundle => dcs_check_diff($(init.test_file), - "$(this.promise_dirname)/desired-result.xml.txt", - $(this.promise_filename)); + "Pass/Fail" + usebundle => dcs_check_diff( + $(init.test_file), + "$(this.promise_dirname)/desired-result.xml.txt", + $(this.promise_filename) + ); } bundle edit_line insert_file_as_block_relative_to_first_or_last_line(templatefile, relative_location, first_or_last, location_line_regex) { insert_lines: - - "$(templatefile)" - comment => "Insert the template file into the file being edited", - insert_type => "file_preserve_block", - location => location_before_after_first_or_last_line( $(relative_location), $(first_or_last), $(location_line_regex) ); + "$(templatefile)" + comment => "Insert the template file into the file being edited", + insert_type => "file_preserve_block", + location => location_before_after_first_or_last_line( + $(relative_location), $(first_or_last), $(location_line_regex) + ); } + body location location_before_after_first_or_last_line(relative_position, first_or_last, regex_matching_line) { - before_after => "$(relative_position)"; - first_last => "$(first_or_last)"; - select_line_matching => "$(regex_matching_line)"; + before_after => "$(relative_position)"; + first_last => "$(first_or_last)"; + select_line_matching => "$(regex_matching_line)"; } body edit_defaults size(bigenough) { - max_file_size => "$(bigenough)"; + max_file_size => "$(bigenough)"; } diff --git a/tests/acceptance/31_tickets/ENT-8818/1/staging/main.cf b/tests/acceptance/31_tickets/ENT-8818/1/staging/main.cf index 0705e06ebc..81067d535b 100644 --- a/tests/acceptance/31_tickets/ENT-8818/1/staging/main.cf +++ b/tests/acceptance/31_tickets/ENT-8818/1/staging/main.cf @@ -1,33 +1,30 @@ # NOTE: This test file must have it's be renamed from .x.cf to .cf when the bug is fixed. 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 test { meta: - "description" -> { "ENT-8818" } - string => "Referencing variables in a namespace that does not exist should not cause the agent to crash"; + "description" -> { "ENT-8818" } + string => "Referencing variables in a namespace that does not exist should not cause the agent to crash"; reports: - # NOTE: Here in the last variable I misspelled default as defult which is how I originally found this bug. - - "In $(this.namespace):$(this.bundle) $(const.dollar)(default:sys.cf_version_major) == $(defult:sys.cf_version_major)"; + # NOTE: Here in the last variable I misspelled default as defult which is how I originally found this bug. + "In $(this.namespace):$(this.bundle) $(const.dollar)(default:sys.cf_version_major) == $(defult:sys.cf_version_major)"; } bundle agent check { methods: - - # If we make ti this far we pass. - "Pass" usebundle => dcs_pass( $(this.promise_filename) ); + # If we make ti this far we pass. + "Pass" usebundle => dcs_pass($(this.promise_filename)); } diff --git a/tests/acceptance/dcs.sub.cf b/tests/acceptance/dcs.sub.cf index 757943343b..a2c0c3a61d 100644 --- a/tests/acceptance/dcs.sub.cf +++ b/tests/acceptance/dcs.sub.cf @@ -3,128 +3,170 @@ # # See README for details about writing test cases. ######################################################################## - bundle common G { vars: windows:: - "cwd" string => execresult("C:\windows\system32\cmd.exe /C cd", "noshell"), + "cwd" + string => execresult("C:\windows\system32\cmd.exe /C cd", "noshell"), meta => { "simulate_safe" }; + # Use for redirection, not as a real file. "dev_null" string => "nul"; "exeext" slist => { ".exe", ".bat" }; + !windows:: - "cwd" string => execresult("/bin/pwd 2>/dev/null || /usr/bin/pwd", "useshell"), + "cwd" + string => execresult( + "/bin/pwd 2>/dev/null || /usr/bin/pwd", "useshell" + ), meta => { "simulate_safe" }; + # Use for redirection, not as a real file. "dev_null" string => "/dev/null"; "exeext" string => ""; any:: # General commands. - "cmds" slist => { "date", - "dd", - "dos2unix", - "diff", - "cat", - "colordiff", - "cp", - "echo", - "egrep", - "env", - "false", - "grep", - "gsed", # will override sed on solaris hosts - "gzip", - "hexdump", - "ln", - "ls", - "mkdir", - "mkfifo", - "mkgroup", # AIX equivalent of groupadd - "mock_package_manager", - "mv", - "no_fds", - "od", - "perl", - "printf", - "ps", - "psexec", - "pwd", - "rm", - "sed", - "seq", - "sh", - "sleep", - "sort", - "stat", - "sudo", - "tee", - "touch", - "true", - "yes", - "wc", - }; + "cmds" + slist => { + "date", + "dd", + "dos2unix", + "diff", + "cat", + "colordiff", + "cp", + "echo", + "egrep", + "env", + "false", + "grep", + # will override sed on solaris hosts: + "gsed", + "gzip", + "hexdump", + "ln", + "ls", + "mkdir", + "mkfifo", + # AIX equivalent of groupadd: + "mkgroup", + "mock_package_manager", + "mv", + "no_fds", + "od", + "perl", + "printf", + "ps", + "psexec", + "pwd", + "rm", + "sed", + "seq", + "sh", + "sleep", + "sort", + "stat", + "sudo", + "tee", + "touch", + "true", + "yes", + "wc", + }; + # Special cases. "make_cmds" slist => { "gmake", "make" }; + # rmgroup is AIX equivalent of groupdel - "sbin_cmds" slist => { "rmgroup", "groupadd", "groupdel", "useradd", "userdel", "usermod" }; + "sbin_cmds" + slist => { + "rmgroup", "groupadd", "groupdel", "useradd", "userdel", "usermod" + }; any:: - "paths[tests]" string => "$(this.promise_dirname)"; + "paths[tests]" string => "$(this.promise_dirname)"; + solaris:: - "paths[usr_xpg4_bin]" string => "/usr/xpg4/bin"; - "paths[usr_ucb_sparcv7]" string => "/usr/ucb/sparcv7"; - "paths[opt_csw_bin]" string => "/opt/csw/bin"; - "paths[usr_sfw_bin]" string => "/usr/sfw/bin"; + "paths[usr_xpg4_bin]" string => "/usr/xpg4/bin"; + "paths[usr_ucb_sparcv7]" string => "/usr/ucb/sparcv7"; + "paths[opt_csw_bin]" string => "/opt/csw/bin"; + "paths[usr_sfw_bin]" string => "/usr/sfw/bin"; + !windows:: - "paths[bin]" string => "/bin"; - "paths[usr_bin]" string => "/usr/bin"; - "paths[usr_sbin]" string => "/usr/sbin"; - "paths[usr_local_bin]" string => "/usr/local/bin"; - "paths[usr_contrib_bin]" string => "/usr/contrib/bin"; + "paths[bin]" string => "/bin"; + "paths[usr_bin]" string => "/usr/bin"; + "paths[usr_sbin]" string => "/usr/sbin"; + "paths[usr_local_bin]" string => "/usr/local/bin"; + "paths[usr_contrib_bin]" string => "/usr/contrib/bin"; + windows:: - "paths[msys64_usr_bin]" string => "c:\\msys64\\usr\\bin"; - "paths[temp_msys64_usr_bin]" string => "d:\\a\\_temp\\msys64\\usr\\bin"; - "paths[tool_wrappers]" string => "$(this.promise_dirname)\\tool_wrappers"; + "paths[msys64_usr_bin]" string => "c:\\msys64\\usr\\bin"; + "paths[temp_msys64_usr_bin]" string => "d:\\a\\_temp\\msys64\\usr\\bin"; + "paths[tool_wrappers]" string => "$(this.promise_dirname)\\tool_wrappers"; any:: "paths_indices" slist => getindices("paths"); # dereferenced path of the executable - "deref_paths[$(paths[$(paths_indices)])][$(cmds)$(exeext)]" string => - filestat("$(paths[$(paths_indices)])$(const.dirsep)$(cmds)$(exeext)", - "linktarget"); + "deref_paths[$(paths[$(paths_indices)])][$(cmds)$(exeext)]" + string => filestat( + "$(paths[$(paths_indices)])$(const.dirsep)$(cmds)$(exeext)", + "linktarget" + ); classes: - # General commands. - "$(paths_indices)_$(cmds)$(exeext)" expression => - fileexists("$(deref_paths[$(paths[$(paths_indices)])][$(cmds)$(exeext)])"); - "has_$(cmds)" expression => - fileexists("$(deref_paths[$(paths[$(paths_indices)])][$(cmds)$(exeext)])"), - scope => "namespace"; + # General commands. + "$(paths_indices)_$(cmds)$(exeext)" + expression => fileexists( + "$(deref_paths[$(paths[$(paths_indices)])][$(cmds)$(exeext)])" + ); + + "has_$(cmds)" + expression => fileexists( + "$(deref_paths[$(paths[$(paths_indices)])][$(cmds)$(exeext)])" + ), + scope => "namespace"; - # Special cases. - "$(paths_indices)_$(sbin_cmds)$(exeext)" expression => fileexists("$(paths[$(paths_indices)])$(const.dirsep)$(sbin_cmds)$(exeext)"); - "$(paths_indices)_$(make_cmds)$(exeext)" expression => fileexists("$(paths[$(paths_indices)])$(const.dirsep)$(make_cmds)$(exeext)"); - "has_make" expression => fileexists("$(paths[$(paths_indices)])$(const.dirsep)$(make_cmds)$(exeext)"), + # Special cases. + "$(paths_indices)_$(sbin_cmds)$(exeext)" + expression => fileexists( + "$(paths[$(paths_indices)])$(const.dirsep)$(sbin_cmds)$(exeext)" + ); + + "$(paths_indices)_$(make_cmds)$(exeext)" + expression => fileexists( + "$(paths[$(paths_indices)])$(const.dirsep)$(make_cmds)$(exeext)" + ); + + "has_make" + expression => fileexists( + "$(paths[$(paths_indices)])$(const.dirsep)$(make_cmds)$(exeext)" + ), scope => "namespace"; - "want_color" expression => strcmp(getenv("CFENGINE_COLOR", 4k), "1"); - "have_colordiff" expression => fileexists($(colordiff)); + "want_color" expression => strcmp(getenv("CFENGINE_COLOR", 4k), "1"); + "have_colordiff" expression => fileexists($(colordiff)); vars: - # General commands. - "$(cmds)" string => "$(paths[$(paths_indices)])$(const.dirsep)$(cmds)$(exeext)", + # General commands. + "$(cmds)" + string => "$(paths[$(paths_indices)])$(const.dirsep)$(cmds)$(exeext)", if => canonify("$(paths_indices)_$(cmds)$(exeext)"); - # Special cases. - "$(sbin_cmds)" string => "$(paths[$(paths_indices)])$(const.dirsep)$(sbin_cmds)$(exeext)", + # Special cases. + "$(sbin_cmds)" + string => "$(paths[$(paths_indices)])$(const.dirsep)$(sbin_cmds)$(exeext)", if => canonify("$(paths_indices)_$(sbin_cmds)$(exeext)"); - # gmake has higher priority, so should come last. - "make" string => "$(paths[$(paths_indices)])$(const.dirsep)make$(exeext)", + + # gmake has higher priority, so should come last. + "make" + string => "$(paths[$(paths_indices)])$(const.dirsep)make$(exeext)", if => canonify("$(paths_indices)_make$(exeext)"); - "make" string => "$(paths[$(paths_indices)])$(const.dirsep)gmake$(exeext)", + + "make" + string => "$(paths[$(paths_indices)])$(const.dirsep)gmake$(exeext)", if => canonify("$(paths_indices)_gmake$(exeext)"); # on solaris, gsed works more like GNU sed, such as having `-i` option @@ -138,26 +180,46 @@ bundle common G want_color.have_colordiff:: "diff_maybecolor" string => $(colordiff); + !want_color|!have_colordiff:: "diff_maybecolor" string => $(diff); classes: - "temp_declared" not => strcmp(getenv("TEMP", "65536"), ""); + "temp_declared" not => strcmp(getenv("TEMP", "65536"), ""); vars: - "etc" string => "$(this.promise_dirname)$(const.dirsep)dummy_etc"; - "etc_motd" string => "$(this.promise_dirname)$(const.dirsep)dummy_etc$(const.dirsep)motd"; - "etc_passwd" string => "$(this.promise_dirname)$(const.dirsep)dummy_etc$(const.dirsep)passwd"; - "etc_shadow" string => "$(this.promise_dirname)$(const.dirsep)dummy_etc$(const.dirsep)shadow"; - "etc_group" string => "$(this.promise_dirname)$(const.dirsep)dummy_etc$(const.dirsep)group"; - # Use instead of /dev/null when you need a real empty file to open. - "etc_null" string => "$(this.promise_dirname)$(const.dirsep)dummy_etc$(const.dirsep)null"; - "write_args_sh" string => "$(this.promise_dirname)/write_args.sh"; + "etc" string => "$(this.promise_dirname)$(const.dirsep)dummy_etc"; + + "etc_motd" + string => "$(this.promise_dirname)$(const.dirsep)dummy_etc$(const.dirsep)motd"; + + "etc_passwd" + string => "$(this.promise_dirname)$(const.dirsep)dummy_etc$(const.dirsep)passwd"; + + "etc_shadow" + string => "$(this.promise_dirname)$(const.dirsep)dummy_etc$(const.dirsep)shadow"; + + "etc_group" + string => "$(this.promise_dirname)$(const.dirsep)dummy_etc$(const.dirsep)group"; + + # Use instead of /dev/null when you need a real empty file to open. + "etc_null" + string => "$(this.promise_dirname)$(const.dirsep)dummy_etc$(const.dirsep)null"; + + "write_args_sh" string => "$(this.promise_dirname)/write_args.sh"; temp_declared:: "testroot" string => getenv("TEMP", "65535"); - "testdir" string => concat(getenv("TEMP", "65535"), "$(const.dirsep)TESTDIR.cfengine"); - "testfile" string => concat(getenv("TEMP", "65535"), "$(const.dirsep)TEST.cfengine"); + + "testdir" + string => concat( + getenv("TEMP", "65535"), "$(const.dirsep)TESTDIR.cfengine" + ); + + "testfile" + string => concat( + getenv("TEMP", "65535"), "$(const.dirsep)TEST.cfengine" + ); !temp_declared:: "testroot" string => "$(const.dirsep)tmp"; @@ -165,23 +227,22 @@ bundle common G "testfile" string => "$(const.dirsep)tmp$(const.dirsep)TEST.cfengine"; classes: - "using_fakeroot" - expression => regcmp(".+", getenv("FAKEROOTKEY", "10")); + "using_fakeroot" expression => regcmp(".+", getenv("FAKEROOTKEY", "10")); } bundle common dcs_strings { vars: - "multiline_potatoes" string => - "BEGIN + "multiline_potatoes" + string => "BEGIN One potato Two potato Three potatoes Four END"; - "multiline_potatoes_lesser" string => - "BEGIN + "multiline_potatoes_lesser" + string => "BEGIN One potato Three potatoes Four @@ -191,44 +252,43 @@ END"; bundle agent paths_init(filename) { classes: - "filename_absolute" expression => regcmp("/.*", "$(filename)"); + "filename_absolute" expression => regcmp("/.*", "$(filename)"); } bundle agent paths_absolute(filename) { vars: filename_absolute:: - "input_file" - string => "$(filename)"; + "input_file" string => "$(filename)"; + !filename_absolute:: - "input_file" - string => "$(G.cwd)/$(filename)"; + "input_file" string => "$(G.cwd)/$(filename)"; } bundle agent default(filename) { classes: - "have_test_run_$(bundles)" expression => "any"; + "have_test_run_$(bundles)" expression => "any"; vars: - - "tests" slist => { "default:init", - "default:test", - "default:check", - "default:destroy" + "tests" + slist => { + "default:init", "default:test", "default:check", "default:destroy" }; - "bundles" slist => bundlesmatching("default:(init|test|check|destroy)"); + "bundles" slist => bundlesmatching("default:(init|test|check|destroy)"); files: - "$(G.testdir)/." create => "true"; + "$(G.testdir)/." create => "true"; methods: - "any" usebundle => collect_stories_metadata; - "any" usebundle => test_precheck; + "any" usebundle => collect_stories_metadata; + "any" usebundle => test_precheck; proceed_with_test:: - "any" usebundle => test_run("$(filename)"), inherit => "true"; + "any" + usebundle => test_run("$(filename)"), + inherit => "true"; reports: EXTRA.verbose_mode:: @@ -240,14 +300,13 @@ bundle agent test_run(filename) vars: methods: - "any" - usebundle => paths_init("$(filename)"); - "any" - usebundle => paths_absolute("$(filename)"); + "any" usebundle => paths_init("$(filename)"); + "any" usebundle => paths_absolute("$(filename)"); AUTO:: - "any" usebundle => "$(default.tests)", - if => canonify("have_test_run_$(default.tests)"); + "any" + usebundle => "$(default.tests)", + if => canonify("have_test_run_$(default.tests)"); reports: !AUTO:: @@ -259,14 +318,18 @@ bundle agent collect_stories_metadata { vars: "test_meta_vars" slist => { "description", "story_id", "covers" }; + classes: - "have_$(test_meta_vars)" expression => isvariable("test_meta.$(test_meta_vars)"); + "have_$(test_meta_vars)" + expression => isvariable("test_meta.$(test_meta_vars)"); reports: have_description:: "test description: $(test_meta.description)"; + have_story_id:: "test story_id: $(test_meta.story_id)"; + have_covers:: "test covers: $(test_meta.covers)"; } @@ -274,76 +337,108 @@ bundle agent collect_stories_metadata bundle agent test_precheck { vars: - "fail_types" slist => { "suppress", "soft", "flakey" }; + "fail_types" slist => { "suppress", "soft", "flakey" }; + + "test_skip_unsupported" + slist => variablesmatching(".*_meta\.test_skip_unsupported"); - "test_skip_unsupported" slist => variablesmatching(".*_meta\.test_skip_unsupported"); - "test_skip_needs_work" slist => variablesmatching(".*_meta\.test_skip_needs_work"); - "test_$(fail_types)_fail" slist => variablesmatching(".*_meta\.test_$(fail_types)_fail"); - "test_$(fail_types)_fail_metatags" slist => getvariablemetatags("$(test_$(fail_types)_fail)"); - "test_$(fail_types)_fail_ticket" slist => filter("(redmine|CFE-|ENT-|ARCHIVE-|QA-).*", "test_$(fail_types)_fail_metatags", "true", "false", 1); + "test_skip_needs_work" + slist => variablesmatching(".*_meta\.test_skip_needs_work"); + + "test_$(fail_types)_fail" + slist => variablesmatching(".*_meta\.test_$(fail_types)_fail"); + + "test_$(fail_types)_fail_metatags" + slist => getvariablemetatags("$(test_$(fail_types)_fail)"); + + "test_$(fail_types)_fail_ticket" + slist => filter( + "(redmine|CFE-|ENT-|ARCHIVE-|QA-).*", + "test_$(fail_types)_fail_metatags", + "true", + "false", + 1 + ); classes: - "test_skip_unsupported_set" expression => some(".*", "test_skip_unsupported"); - "test_skip_needs_work_set" expression => some(".*", "test_skip_needs_work"); - "test_$(fail_types)_fail_set" expression => some(".*", "test_$(fail_types)_fail"); - "test_$(fail_types)_fail_ticket_set" expression => some(".*", "test_$(fail_types)_fail_ticket"); + "test_skip_unsupported_set" + expression => some(".*", "test_skip_unsupported"); + + "test_skip_needs_work_set" expression => some(".*", "test_skip_needs_work"); + + "test_$(fail_types)_fail_set" + expression => some(".*", "test_$(fail_types)_fail"); - "test_skip_unsupported_match" and => { "test_skip_unsupported_set", "$($(test_skip_unsupported))" }; - "test_skip_needs_work_match" and => { "test_skip_needs_work_set", "$($(test_skip_needs_work))" }; - "test_$(fail_types)_fail_match" and => { "test_$(fail_types)_fail_set", "$($(test_$(fail_types)_fail))" }; + "test_$(fail_types)_fail_ticket_set" + expression => some(".*", "test_$(fail_types)_fail_ticket"); - "proceed_with_test" + "test_skip_unsupported_match" + and => { "test_skip_unsupported_set", "$($(test_skip_unsupported))" }; + + "test_skip_needs_work_match" + and => { "test_skip_needs_work_set", "$($(test_skip_needs_work))" }; + + "test_$(fail_types)_fail_match" + and => { "test_$(fail_types)_fail_set", "$($(test_$(fail_types)_fail))" }; + + "proceed_with_test" and => { "!test_skip_unsupported_match", "!test_skip_needs_work_match" }, scope => "namespace"; reports: test_skip_unsupported_match:: "$(this.promise_filename) Skip/unsupported"; + test_skip_needs_work_match:: "$(this.promise_filename) Skip/needs_work"; + test_suppress_fail_match.test_suppress_fail_ticket_set:: "$(this.promise_filename) XFAIL/$(test_suppress_fail_ticket)"; + test_suppress_fail_match.!test_suppress_fail_ticket_set:: "$(this.promise_filename) FAIL/no_ticket_number"; + test_soft_fail_match.test_soft_fail_ticket_set:: "$(this.promise_filename) SFAIL/$(test_soft_fail_ticket)"; + test_soft_fail_match.!test_soft_fail_ticket_set:: "$(this.promise_filename) FAIL/no_ticket_number"; + test_flakey_fail_match.test_flakey_fail_ticket_set:: "$(this.promise_filename) FLAKEY/$(test_flakey_fail_ticket)"; + test_flakey_fail_match.!test_flakey_fail_ticket_set:: "$(this.promise_filename) FAIL/no_ticket_number"; } ####################################################### - bundle agent dcs_sort(infile, outfile) { commands: - # Enforce byte sort order with LC_ALL. - "$(G.env) LC_ALL=C $(G.sort) $(infile) > $(outfile)" - contain => in_shell; + # Enforce byte sort order with LC_ALL. + "$(G.env) LC_ALL=C $(G.sort) $(infile) > $(outfile)" contain => in_shell; } bundle agent dcs_check_state(bundlename, expected_file, test) { vars: - "state" data => bundlestate($(bundlename)); + "state" data => bundlestate($(bundlename)); methods: - "" usebundle => file_make("$(G.testdir)/template", "{{%state}}"); - "" usebundle => file_make("$(G.testdir)/actual", ""); - "any" usebundle => dcs_check_state_prep(@(state)); - "any" usebundle => dcs_check_diff_expected("$(G.testdir)/actual", - $(expected_file), - $(test), - "no"); + "" usebundle => file_make("$(G.testdir)/template", "{{%state}}"); + "" usebundle => file_make("$(G.testdir)/actual", ""); + "any" usebundle => dcs_check_state_prep(@(state)); + + "any" + usebundle => dcs_check_diff_expected( + "$(G.testdir)/actual", $(expected_file), $(test), "no" + ); } bundle agent dcs_check_state_prep(state_container) { files: - "$(G.testdir)/actual" + "$(G.testdir)/actual" create => "true", edit_template => "$(G.testdir)/template", template_data => mergedata('{ "state": state_container }'), @@ -354,89 +449,116 @@ bundle agent dcs_check_diff(file1, file2, test) # @brief Pass if two files do not differ. { methods: - "any" usebundle => dcs_check_diff_expected($(file1), - $(file2), - $(test), - "no"); + "any" + usebundle => dcs_check_diff_expected($(file1), $(file2), $(test), "no"); } bundle agent dcs_if_diff(file1, file2, pass_class, fail_class) { methods: - "any" usebundle => dcs_if_diff_expected($(file1), - $(file2), - "no", - $(pass_class), - $(fail_class)); + "any" + usebundle => dcs_if_diff_expected( + $(file1), $(file2), "no", $(pass_class), $(fail_class) + ); } bundle agent sorted_check_diff(file1, file2, test) { methods: - "any" usebundle => dcs_sort("$(file1)", "$(file1).sort"); - "any" usebundle => dcs_sort("$(file2)", "$(file2).sort"); - "any" usebundle => dcs_check_diff_expected("$(file1).sort", - "$(file2).sort", - $(test), - "no"); + "any" usebundle => dcs_sort("$(file1)", "$(file1).sort"); + "any" usebundle => dcs_sort("$(file2)", "$(file2).sort"); + + "any" + usebundle => dcs_check_diff_expected( + "$(file1).sort", "$(file2).sort", $(test), "no" + ); } bundle agent xml_check_diff(file1, file2, test, expected_difference) { vars: DEBUG.check_ready.!no_difference:: - "file1r" string => execresult("$(G.cwd)/xml-c14nize $(file1)", "noshell"), + "file1r" + string => execresult("$(G.cwd)/xml-c14nize $(file1)", "noshell"), meta => { "simulate_safe" }; - "file2r" string => execresult("$(G.cwd)/xml-c14nize $(file2)", "noshell"), + + "file2r" + string => execresult("$(G.cwd)/xml-c14nize $(file2)", "noshell"), meta => { "simulate_safe" }; DEBUG.check_ready.!no_difference.has_hexdump:: - "file1h" string => execresult("$(G.hexdump) -C $(file1)", "useshell"), + "file1h" + string => execresult("$(G.hexdump) -C $(file1)", "useshell"), meta => { "simulate_safe" }; - "file2h" string => execresult("$(G.hexdump) -C $(file2)", "useshell"), + + "file2h" + string => execresult("$(G.hexdump) -C $(file2)", "useshell"), meta => { "simulate_safe" }; DEBUG.check_ready.!no_difference.!has_hexdump:: - "file1h" string => execresult("$(G.od) -c $(file1)", "useshell"), + "file1h" + string => execresult("$(G.od) -c $(file1)", "useshell"), meta => { "simulate_safe" }; - "file2h" string => execresult("$(G.od) -c $(file2)", "useshell"), + + "file2h" + string => execresult("$(G.od) -c $(file2)", "useshell"), meta => { "simulate_safe" }; DEBUG.check_ready.!no_difference.has_unified_diff:: - "diffu" string => execresult("$(G.diff_maybecolor) -u $(file2) $(file1) 2>$(G.dev_null)", "useshell"), + "diffu" + string => execresult( + "$(G.diff_maybecolor) -u $(file2) $(file1) 2>$(G.dev_null)", + "useshell" + ), meta => { "simulate_safe" }; + DEBUG.check_ready.!no_difference.!has_unified_diff:: - "diffu" string => execresult("$(G.diff_maybecolor) -c $(file2) $(file1) 2>$(G.dev_null)", "useshell"), + "diffu" + string => execresult( + "$(G.diff_maybecolor) -c $(file2) $(file1) 2>$(G.dev_null)", + "useshell" + ), meta => { "simulate_safe" }; classes: - "has_unified_diff" expression => returnszero( - "$(G.diff_maybecolor) -u $(G.etc_null) $(G.etc_null) >$(G.dev_null) 2>&1", "useshell"), - meta => { "simulate_safe" }; + "has_unified_diff" + expression => returnszero( + "$(G.diff_maybecolor) -u $(G.etc_null) $(G.etc_null) >$(G.dev_null) 2>&1", + "useshell" + ), + meta => { "simulate_safe" }; c14n_files_created:: - "no_difference" expression => returnszero( - "$(G.diff_maybecolor) $(G.testfile).default-xml-check-diff-1 $(G.testfile).default-xml-check-diff-2 >$(G.dev_null) 2>&1", - "useshell"), + "no_difference" + expression => returnszero( + "$(G.diff_maybecolor) $(G.testfile).default-xml-check-diff-1 $(G.testfile).default-xml-check-diff-2 >$(G.dev_null) 2>&1", + "useshell" + ), meta => { "simulate_safe" }; - "expected_difference" expression => strcmp("$(expected_difference)", "yes"); + "expected_difference" + expression => strcmp("$(expected_difference)", "yes"); + "check_ready" expression => "any"; commands: - "$(G.cwd)/xml-c14nize $(file1) > $(G.testfile).default-xml-check-diff-1" + "$(G.cwd)/xml-c14nize $(file1) > $(G.testfile).default-xml-check-diff-1" contain => in_shell; - "$(G.cwd)/xml-c14nize $(file2) > $(G.testfile).default-xml-check-diff-2" + + "$(G.cwd)/xml-c14nize $(file2) > $(G.testfile).default-xml-check-diff-2" contain => in_shell, classes => if_ok("c14n_files_created"); reports: check_ready.no_difference.!expected_difference:: "$(test) Pass"; + check_ready.!no_difference.expected_difference:: "$(test) Pass"; + check_ready.!no_difference.!expected_difference:: "$(test) FAIL"; + check_ready.no_difference.expected_difference:: "$(test) FAIL"; @@ -449,6 +571,7 @@ $(file1h)"; "dump $(file2): $(file2h)"; "$(diffu)"; + DEBUG.check_ready.no_difference.expected_difference:: "Contents of $(file1) and $(file) is the same."; } @@ -456,7 +579,7 @@ $(file2h)"; bundle agent dcs_report_generic_classes(x) { vars: - "choices" slist => { "repaired", "failed", "denied", "timeout", "kept" }; + "choices" slist => { "repaired", "failed", "denied", "timeout", "kept" }; reports: DEBUG:: @@ -467,60 +590,82 @@ bundle agent dcs_report_generic_classes(x) bundle agent dcs_generic_classes_to_string(x) { vars: - "choices" slist => { "repaired", "failed", "denied", "timeout", "kept" }; - "s[$(choices)]" string => "$(x)_$(choices)", if => '$(x)_$(choices)'; - "found_unsorted" slist => getvalues(s); - "found" slist => sort(found_unsorted, "lex"); - "found_str" string => format("%S", found); + "choices" slist => { "repaired", "failed", "denied", "timeout", "kept" }; + + "s[$(choices)]" + string => "$(x)_$(choices)", + if => '$(x)_$(choices)'; + + "found_unsorted" slist => getvalues(s); + "found" slist => sort(found_unsorted, "lex"); + "found_str" string => format("%S", found); reports: - "$(found_str)" bundle_return_value_index => "str"; + "$(found_str)" bundle_return_value_index => "str"; } # These set/clear global classes, so they can be tested in another bundle body classes dcs_all_classes(prefix) { - promise_kept => { "$(prefix)_promise_kept" }; - promise_repaired => { "$(prefix)_promise_repaired" }; - repair_failed => { "$(prefix)_repair_failed" }; - repair_denied => { "$(prefix)_repair_denied" }; - repair_timeout => { "$(prefix)_repair_timeout" }; - cancel_kept => { "$(prefix)_cancel_kept" }; - cancel_repaired => { "$(prefix)_cancel_repaired" }; - cancel_notkept => { "$(prefix)_cancel_notkept" }; + promise_kept => { "$(prefix)_promise_kept" }; + promise_repaired => { "$(prefix)_promise_repaired" }; + repair_failed => { "$(prefix)_repair_failed" }; + repair_denied => { "$(prefix)_repair_denied" }; + repair_timeout => { "$(prefix)_repair_timeout" }; + cancel_kept => { "$(prefix)_cancel_kept" }; + cancel_repaired => { "$(prefix)_cancel_repaired" }; + cancel_notkept => { "$(prefix)_cancel_notkept" }; } bundle agent dcs_all_negative_classes(prefix) { - # 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: - "$(prefix)_cancel_kept" expression => "any", scope => "namespace"; - "$(prefix)_cancel_repaired" expression => "any", scope => "namespace"; - "$(prefix)_cancel_notkept" expression => "any", scope => "namespace"; + "$(prefix)_cancel_kept" + expression => "any", + scope => "namespace"; + + "$(prefix)_cancel_repaired" + expression => "any", + scope => "namespace"; + + "$(prefix)_cancel_notkept" + expression => "any", + scope => "namespace"; } bundle agent dcs_all_classes_to_string(prefix) { vars: - "classes_all" slist => classesmatching("$(prefix)_.*(kept|notkept|failed|denied|repaired|timeout)"); - "classes" slist => sort(classes_all, "lex"); - "found_str" string => format("%S", classes); + "classes_all" + slist => classesmatching( + "$(prefix)_.*(kept|notkept|failed|denied|repaired|timeout)" + ); + + "classes" slist => sort(classes_all, "lex"); + "found_str" string => format("%S", classes); reports: - "$(found_str)" bundle_return_value_index => "str"; + "$(found_str)" bundle_return_value_index => "str"; } bundle agent dcs_check_diff_expected(file1, file2, test, expected_difference) { methods: - "any" usebundle => dcs_if_diff_expected($(file1), $(file2), $(expected_difference), - "dcs_check_diff_expected_pass_class", - "dcs_check_diff_expected_fail_class"); + "any" + usebundle => dcs_if_diff_expected( + $(file1), + $(file2), + $(expected_difference), + "dcs_check_diff_expected_pass_class", + "dcs_check_diff_expected_fail_class" + ); reports: dcs_check_diff_expected_pass_class:: "$(test) Pass"; + dcs_check_diff_expected_fail_class:: "$(test) FAIL"; } @@ -533,48 +678,75 @@ bundle agent dcs_if_diff_expected(file1, file2, expected_difference, pass_class, "file2r" string => readfile("$(file2)", "4096"); (EXTRA|DEBUG_HEXDUMP).check_ready.!no_difference.has_hexdump:: - "file1h" string => execresult("$(G.hexdump) -C $(file1)", "useshell"), + "file1h" + string => execresult("$(G.hexdump) -C $(file1)", "useshell"), meta => { "simulate_safe" }; - "file2h" string => execresult("$(G.hexdump) -C $(file2)", "useshell"), + + "file2h" + string => execresult("$(G.hexdump) -C $(file2)", "useshell"), meta => { "simulate_safe" }; (EXTRA|DEBUG_HEXDUMP).check_ready.!no_difference.!has_hexdump:: - "file1h" string => execresult("$(G.od) -c $(file1)", "useshell"), + "file1h" + string => execresult("$(G.od) -c $(file1)", "useshell"), meta => { "simulate_safe" }; - "file2h" string => execresult("$(G.od) -c $(file2)", "useshell"), + + "file2h" + string => execresult("$(G.od) -c $(file2)", "useshell"), meta => { "simulate_safe" }; DEBUG.check_ready.!no_difference.has_unified_diff:: - "diffu" string => execresult("$(G.diff_maybecolor) -u $(file2) $(file1) 2>$(G.dev_null)", "useshell"), + "diffu" + string => execresult( + "$(G.diff_maybecolor) -u $(file2) $(file1) 2>$(G.dev_null)", + "useshell" + ), meta => { "simulate_safe" }; + DEBUG.check_ready.!no_difference.!has_unified_diff:: - "diffu" string => execresult("$(G.diff_maybecolor) -c $(file2) $(file1) 2>$(G.dev_null)", "useshell"), + "diffu" + string => execresult( + "$(G.diff_maybecolor) -c $(file2) $(file1) 2>$(G.dev_null)", + "useshell" + ), meta => { "simulate_safe" }; classes: - "has_unified_diff" expression => returnszero( - "$(G.diff_maybecolor) -u $(G.etc_null) $(G.etc_null) >$(G.dev_null) 2>&1", "useshell"), - meta => { "simulate_safe" }; - - "no_difference" expression => returnszero( - "$(G.diff_maybecolor) $(file1) $(file2) >$(G.dev_null) 2>&1", - "useshell"), - meta => { "simulate_safe" }; - - "expected_difference" expression => strcmp("$(expected_difference)", "yes"); - "check_ready" expression => "any"; + "has_unified_diff" + expression => returnszero( + "$(G.diff_maybecolor) -u $(G.etc_null) $(G.etc_null) >$(G.dev_null) 2>&1", + "useshell" + ), + meta => { "simulate_safe" }; + + "no_difference" + expression => returnszero( + "$(G.diff_maybecolor) $(file1) $(file2) >$(G.dev_null) 2>&1", + "useshell" + ), + meta => { "simulate_safe" }; + + "expected_difference" expression => strcmp("$(expected_difference)", "yes"); + "check_ready" expression => "any"; check_ready.no_difference.!expected_difference:: - "$(pass_class)" expression => "any", + "$(pass_class)" + expression => "any", scope => "namespace"; + check_ready.!no_difference.expected_difference:: - "$(pass_class)" expression => "any", + "$(pass_class)" + expression => "any", scope => "namespace"; + check_ready.!no_difference.!expected_difference:: - "$(fail_class)" expression => "any", + "$(fail_class)" + expression => "any", scope => "namespace"; + check_ready.no_difference.expected_difference:: - "$(fail_class)" expression => "any", + "$(fail_class)" + expression => "any", scope => "namespace"; reports: @@ -585,13 +757,16 @@ $(file1r)"; "CONTENTS OF $(file2): $(file2r)"; "$(diffu)"; + (DEBUG_HEXDUMP|EXTRA).check_ready.!no_difference.!expected_difference:: "hexdump $(file1): $(file1h)"; "hexdump $(file2): $(file2h)"; + DEBUG.check_ready.no_difference.expected_difference:: "Contents of $(file1) and $(file) are the same but should differ."; + EXTRA:: "Diff command: $(G.diff_maybecolor) -u $(file2) $(file1) 2>$(G.dev_null)"; } @@ -599,24 +774,21 @@ $(file2h)"; bundle agent dcs_sleep(t) { commands: - "$(G.perl) -e 'sleep $(t)'"; + "$(G.perl) -e 'sleep $(t)'"; + reports: EXTRA:: "Sleeping $(t) seconds"; } ####################################################### - # Uses rm -rf instead of selecting and deleting files to avoid side-effects in # tests due to problems in file deleletion promises. - bundle agent dcs_fini(file) { commands: - "$(G.rm) -rf $(file)*" - contain => dcs_useshell; - "$(G.rm) -rf $(sys.statedir)/cf_state.*" - contain => dcs_useshell; + "$(G.rm) -rf $(file)*" contain => dcs_useshell; + "$(G.rm) -rf $(sys.statedir)/cf_state.*" contain => dcs_useshell; reports: EXTRA:: @@ -626,7 +798,7 @@ bundle agent dcs_fini(file) bundle agent dcs_copyfile(from, to) { files: - "$(to)" + "$(to)" create => "true", copy_from => dcs_sync($(from)); @@ -637,17 +809,17 @@ bundle agent dcs_copyfile(from, to) body copy_from dcs_sync(f) { - source => "$(f)"; - purge => "true"; - preserve => "false"; - type_check => "false"; - compare => "digest"; + source => "$(f)"; + purge => "true"; + preserve => "false"; + type_check => "false"; + compare => "digest"; } body contain dcs_useshell { - useshell => "true"; - chdir => "/"; + useshell => "true"; + chdir => "/"; } bundle agent dcs_runagent(args) @@ -655,36 +827,45 @@ bundle agent dcs_runagent(args) commands: debug_mode:: "$(sys.cf_agent) -Kdf $(args)"; + verbose_mode:: "$(sys.cf_agent) -Kvf $(args)"; + inform_mode:: "$(sys.cf_agent) -KIf $(args)"; + !debug_mode.!verbose_mode.!inform_mode:: "$(sys.cf_agent) -Kf $(args)"; } ####################################################### # Test based on whether two strings are the same - bundle agent dcs_check_strcmp(strA, strB, test, expected_difference) { classes: - "equal" expression => strcmp($(strA), $(strB)); - "expected_difference" or => { strcmp($(expected_difference), "yes"), - strcmp($(expected_difference), "true") }; + "equal" expression => strcmp($(strA), $(strB)); + + "expected_difference" + or => { + strcmp($(expected_difference), "yes"), + strcmp($(expected_difference), "true"), + }; + + "__passif" xor => { "equal", "expected_difference" }; - "__passif" xor => { "equal", "expected_difference" }; reports: EXTRA|!__passif:: "$(this.bundle): STRING A: '$(strA)'"; "$(this.bundle): STRING B: '$(strB)'"; + __passif:: "$(test) Pass"; + !__passif:: "$(test) FAIL"; } -bundle agent dcs_check_diff_elements( setA, setB, test, expected_difference) +bundle agent dcs_check_diff_elements(setA, setB, test, expected_difference) # @brief Test that there is or is not a difference between two lists or data containers elements (order elements does not matter) # # **Example:** @@ -708,61 +889,69 @@ bundle agent dcs_check_diff_elements( setA, setB, test, expected_difference) # ``` { vars: - "length_A" int => length( setA ); - "length_B" int => length( setB ); - "difference_A_B" slist => difference( setA, setB ); - "difference_B_A" slist => difference( setB, setA ); + "length_A" int => length(setA); + "length_B" int => length(setB); + "difference_A_B" slist => difference(setA, setB); + "difference_B_A" slist => difference(setB, setA); classes: - "_pass_same_length" - expression => eval( "$(length_A) == $(length_B)", class, infix ); - "_pass_no_elements_in_setA_that_are_not_in_setB" - expression => islessthan( length( difference_A_B ), 1 ); - "_pass_no_elements_in_setB_that_are_not_in_setA" - expression => islessthan( length( difference_B_A ), 1 ); + "_pass_same_length" + expression => eval("$(length_A) == $(length_B)", class, infix); - "__passif" and => { "_pass_same_length", - "_pass_no_elements_in_setA_that_are_not_in_setB", - "_pass_no_elements_in_setB_that_are_not_in_setA"}; + "_pass_no_elements_in_setA_that_are_not_in_setB" + expression => islessthan(length(difference_A_B), 1); + + "_pass_no_elements_in_setB_that_are_not_in_setA" + expression => islessthan(length(difference_B_A), 1); + + "__passif" + and => { + "_pass_same_length", + "_pass_no_elements_in_setA_that_are_not_in_setB", + "_pass_no_elements_in_setB_that_are_not_in_setA", + }; reports: DEBUG|EXTRA:: - - # We print each element of the list out individually on versions that didn't - # have the with attribute. No great way to specify a version less than a - # cfengine version. - "setA: $(setA)" if => eval( "$(sys.cf_version_minor) < 11", class, infix ); - "setB: $(setB)" if => eval( "$(sys.cf_version_minor) < 11", class, infix ); + # We print each element of the list out individually on versions that didn't + # have the with attribute. No great way to specify a version less than a + # cfengine version. + "setA: $(setA)" if => eval("$(sys.cf_version_minor) < 11", class, infix); + "setB: $(setB)" if => eval("$(sys.cf_version_minor) < 11", class, infix); @if minimum_version(3.11) - "setA: $(with)" with => join( ", ", setA ); - "setB: $(with)" with => join( ", ", setB ); + "setA: $(with)" with => join(", ", setA); + "setB: $(with)" with => join(", ", setB); @endif "setA and setB have the same number of elements" if => "_pass_same_length"; + "setA and setB do not have the same number of elements" if => not("_pass_same_length"); + "setA has $(length_A) elements and setB has $(length_B) ements" if => not("_pass_same_length"); "There are no elements in setA that are not in setB" if => "_pass_no_elements_in_setA_that_are_not_in_setB"; + "Element in setA that is not in setB: $(difference_A_B)" - if => not( "_pass_no_elements_in_setA_that_are_not_in_setB" ); + if => not("_pass_no_elements_in_setA_that_are_not_in_setB"); "There are no elements in setB that are not in setA" if => "_pass_no_elements_in_setB_that_are_not_in_setA"; + "Element in setB that is not in setA: $(difference_B_A)" - if => not( "_pass_no_elements_in_setB_that_are_not_in_setA" ); + if => not("_pass_no_elements_in_setB_that_are_not_in_setA"); __passif:: "$(test) Pass"; + !__passif:: "$(test) FAIL"; } ####################################################### # Test based on whether a string matches a regular expression - bundle agent dcs_check_regcmp(regex, thestring, test, expected_mismatch) # @brief Check if `regex` matches `thestring` Pass if they match, unless `expected_mismatch` is `true|yes`, in which case, FAIL # @param regex The regular expression to check `thestring` against @@ -771,40 +960,50 @@ bundle agent dcs_check_regcmp(regex, thestring, test, expected_mismatch) # @param expected_mismatch When `yes|true` the test will Pass if `regex` does not match `thestring` { classes: - "matched" expression => regcmp($(regex), $(thestring)); - "expected_mismatch" or => { strcmp($(expected_mismatch), "yes"), - strcmp($(expected_mismatch), "true") }; + "matched" expression => regcmp($(regex), $(thestring)); + + "expected_mismatch" + or => { + strcmp($(expected_mismatch), "yes"), + strcmp($(expected_mismatch), "true"), + }; + + "__passif" xor => { "matched", "expected_mismatch" }; - "__passif" xor => { "matched", "expected_mismatch" }; -reports: + reports: EXTRA|!__passif:: "$(this.bundle): REGEX: '$(regex)'"; "$(this.bundle): STRING TO MATCH: '$(thestring)'"; + __passif:: "$(test) Pass"; + !__passif:: "$(test) FAIL"; } ####################################################### # Pass the test if class - bundle agent dcs_passif(classname, test) { reports: - "$(test) Pass" if => $(classname); - "$(test) FAIL" if => not($(classname)); + "$(test) Pass" if => $(classname); + "$(test) FAIL" if => not($(classname)); EXTRA:: - "$(this.bundle): passing based on class '$(classname)'" if => $(classname); + "$(this.bundle): passing based on class '$(classname)'" + if => $(classname); + DEBUG:: - "$(this.bundle): failing based on class '$(classname)'" if => not($(classname)); + "$(this.bundle): failing based on class '$(classname)'" + if => not($(classname)); } bundle agent dcs_pass(test) { reports: - "$(test) Pass"; + "$(test) Pass"; + EXTRA:: "$(this.bundle): Explicitly passing..."; } @@ -812,7 +1011,8 @@ bundle agent dcs_pass(test) bundle agent dcs_fail(test) { reports: - "$(test) FAIL"; + "$(test) FAIL"; + EXTRA:: "$(this.bundle): Explicitly failing..."; } @@ -820,7 +1020,8 @@ bundle agent dcs_fail(test) bundle agent dcs_wait(test, seconds) { reports: - "$(test) Wait/$(seconds)"; + "$(test) Wait/$(seconds)"; + EXTRA:: "$(this.bundle): Explicitly waiting $(seconds) seconds..."; } @@ -828,14 +1029,17 @@ bundle agent dcs_wait(test, seconds) bundle agent dcs_passif_fileexists(file, test) { classes: - "__passif" expression => fileexists($(file)); + "__passif" expression => fileexists($(file)); methods: - "" usebundle => dcs_passif("__passif", $(test)), inherit => "true"; + "" + usebundle => dcs_passif("__passif", $(test)), + inherit => "true"; reports: DEBUG.!__passif:: "$(this.bundle): $(file) did not exist!"; + EXTRA.__passif:: "$(this.bundle): $(file) exists."; } @@ -843,14 +1047,17 @@ bundle agent dcs_passif_fileexists(file, test) bundle agent dcs_passif_file_absent(file, test) { classes: - "__passif" not => fileexists($(file)); + "__passif" not => fileexists($(file)); methods: - "" usebundle => dcs_passif("__passif", $(test)), inherit => "true"; + "" + usebundle => dcs_passif("__passif", $(test)), + inherit => "true"; reports: DEBUG.__passif:: "$(this.bundle): $(file) did not exist."; + EXTRA.!__passif:: "$(this.bundle): $(file) exists!"; } @@ -858,65 +1065,65 @@ bundle agent dcs_passif_file_absent(file, test) bundle agent dcs_passif_expected(expected, not_expected, test) { vars: - "ex" slist => splitstring($(expected), ",", 1000); - "notex" slist => splitstring($(not_expected), ",", 1000); - "e[$(ex)]" string => $(ex); - "e[$(notex)]" string => "!$(notex)"; - "classes" slist => getvalues(e); + "ex" slist => splitstring($(expected), ",", 1000); + "notex" slist => splitstring($(not_expected), ",", 1000); + "e[$(ex)]" string => $(ex); + "e[$(notex)]" string => "!$(notex)"; + "classes" slist => getvalues(e); classes: - "__passif" and => { @(classes) }; + "__passif" and => { @(classes) }; + methods: - "" usebundle => dcs_passif("__passif", $(test)), inherit => "true"; + "" + usebundle => dcs_passif("__passif", $(test)), + inherit => "true"; reports: DEBUG:: - "$(this.bundle): bad: $(ex) was NOT defined" - if => "!$(ex)"; - - "$(this.bundle): bad: $(notex) WAS defined" - if => "$(notex)"; + "$(this.bundle): bad: $(ex) was NOT defined" if => "!$(ex)"; + "$(this.bundle): bad: $(notex) WAS defined" if => "$(notex)"; EXTRA:: - "$(this.bundle): good: $(ex) WAS defined" - if => "$(ex)"; - - "$(this.bundle): good: $(notex) was NOT defined" - if => "!$(notex)"; + "$(this.bundle): good: $(ex) WAS defined" if => "$(ex)"; + "$(this.bundle): good: $(notex) was NOT defined" if => "!$(notex)"; } ####################################################### - bundle agent dcs_passif_output(wanted, unwanted, command, test) { vars: - "subout" string => execresult($(command), "useshell"), - meta => { "simulate_safe" }; + "subout" + string => execresult($(command), "useshell"), + meta => { "simulate_safe" }; classes: - "__passif_output_unwanted" expression => regcmp($(unwanted), $(subout)); - "__passif_output_wanted" expression => regcmp($(wanted), $(subout)); + "__passif_output_unwanted" expression => regcmp($(unwanted), $(subout)); + "__passif_output_wanted" expression => regcmp($(wanted), $(subout)); methods: - "" usebundle => dcs_passif_expected("__passif_output_wanted", # expected - "__passif_output_unwanted", # not expected - $(test)), + "" + usebundle => dcs_passif_expected( + "__passif_output_wanted", # expected + "__passif_output_unwanted", # not expected + $(test) + ), inherit => "true"; reports: DEBUG:: "$(this.bundle): bad: '$(wanted)' was NOT found in the output of '$(command)'" - if => "!__passif_output_wanted"; + if => "!__passif_output_wanted"; "$(this.bundle): bad: '$(unwanted)' WAS found in the output of '$(command)'" - if => "__passif_output_unwanted"; + if => "__passif_output_unwanted"; EXTRA:: "$(this.bundle): good: '$(wanted)' WAS found in the output of '$(command)'" - if => "__passif_output_wanted"; + if => "__passif_output_wanted"; "$(this.bundle): good: '$(unwanted)' was NOT found in the output of '$(command)'" - if => "!__passif_output_unwanted"; + if => "!__passif_output_unwanted"; DEBUG:: "$(this.bundle): the output of command '$(command)' was: '$(subout)'"; @@ -925,54 +1132,77 @@ bundle agent dcs_passif_output(wanted, unwanted, command, test) bundle agent dcs_passif_output1(wanted, command, test) { methods: - "" usebundle => dcs_passif_output($(wanted), # expected - "^(unlikely data){400}$", # not expected - $(command), - $(test)), + "" + usebundle => dcs_passif_output( + $(wanted), # expected + "^(unlikely data){400}$", # not expected + $(command), + $(test) + ), inherit => "true"; } bundle agent generate_key { classes: - "key_exists" expression => fileexists("$(sys.workdir)/ppkeys/localhost.pub"); + "key_exists" + expression => fileexists("$(sys.workdir)/ppkeys/localhost.pub"); + files: !key_exists:: "$(sys.workdir)/ppkeys/localhost.priv" create => "true", - copy_from => dcs_sync("$(this.promise_dirname)/root-MD5=617eb383deffef843ea856b129d0a423.priv"); + copy_from => dcs_sync( + "$(this.promise_dirname)/root-MD5=617eb383deffef843ea856b129d0a423.priv" + ); + "$(sys.workdir)/ppkeys/localhost.pub" create => "true", - copy_from => dcs_sync("$(this.promise_dirname)/root-MD5=617eb383deffef843ea856b129d0a423.pub"); + copy_from => dcs_sync( + "$(this.promise_dirname)/root-MD5=617eb383deffef843ea856b129d0a423.pub" + ); } bundle agent trust_key { classes: nova:: - "key_exists" expression => fileexists("$(sys.workdir)/ppkeys/root-SHA=ba71659fc294990d4f61ec1734515f89ce24524fbaeebad5b3f76da532da7390.pub"); + "key_exists" + expression => fileexists( + "$(sys.workdir)/ppkeys/root-SHA=ba71659fc294990d4f61ec1734515f89ce24524fbaeebad5b3f76da532da7390.pub" + ); + !nova:: - "key_exists" expression => fileexists("$(sys.workdir)/ppkeys/root-MD5=617eb383deffef843ea856b129d0a423.pub"); + "key_exists" + expression => fileexists( + "$(sys.workdir)/ppkeys/root-MD5=617eb383deffef843ea856b129d0a423.pub" + ); + files: !key_exists.nova:: "$(sys.workdir)/ppkeys/root-SHA=ba71659fc294990d4f61ec1734515f89ce24524fbaeebad5b3f76da532da7390.pub" create => "true", - copy_from => dcs_sync("$(this.promise_dirname)/root-MD5=617eb383deffef843ea856b129d0a423.pub"); + copy_from => dcs_sync( + "$(this.promise_dirname)/root-MD5=617eb383deffef843ea856b129d0a423.pub" + ); + !key_exists.!nova:: "$(sys.workdir)/ppkeys/root-MD5=617eb383deffef843ea856b129d0a423.pub" create => "true", - copy_from => dcs_sync("$(this.promise_dirname)/root-MD5=617eb383deffef843ea856b129d0a423.pub"); + copy_from => dcs_sync( + "$(this.promise_dirname)/root-MD5=617eb383deffef843ea856b129d0a423.pub" + ); } -body copy_from dcs_remote_cp(from,server, port) +body copy_from dcs_remote_cp(from, server, port) # @brief Download a file from a remote server. They server is always trusted. # # @param from The location of the file on the remote server # @param server The hostname or IP of the server from which to download { - servers => { "$(server)" }; - portnumber => "$(port)"; - source => "$(from)"; - compare => "mtime"; - trustkey => "true"; + servers => { "$(server)" }; + portnumber => "$(port)"; + source => "$(from)"; + compare => "mtime"; + trustkey => "true"; } diff --git a/tests/acceptance/default.sub.cf b/tests/acceptance/default.sub.cf index 40f15cc14d..0185e5328a 100644 --- a/tests/acceptance/default.sub.cf +++ b/tests/acceptance/default.sub.cf @@ -7,34 +7,30 @@ bundle common D { vars: any:: - "owndir" string => "$(this.promise_dirname)"; - # If not testing the masterfiles policy framework we want to include the # plucked bodies and bundles so that we have conveniant access to commonly # used bundles and bodies. !testing_masterfiles_policy_framework:: "inputs" slist => { - "$(D.owndir)$(const.dirsep)dcs.sub.cf", - "$(D.owndir)$(const.dirsep)plucked.sub.cf", - }; + "$(D.owndir)$(const.dirsep)dcs.sub.cf", + "$(D.owndir)$(const.dirsep)plucked.sub.cf", + }; # If testing the masterfiles policy framework then load the stdlib by # default so it can be leveraged as expected. testing_masterfiles_policy_framework:: "inputs" slist => { - "$(D.owndir)$(const.dirsep)dcs.sub.cf", - "$(D.owndir)$(const.dirsep)..$(const.dirsep)..$(const.dirsep)lib$(const.dirsep)stdlib.cf" - }; - - + "$(D.owndir)$(const.dirsep)dcs.sub.cf", + "$(D.owndir)$(const.dirsep)..$(const.dirsep)..$(const.dirsep)lib$(const.dirsep)stdlib.cf", + }; } body file control { - # plucked.sub.cf comes from the stdlib with `make pluck` - inputs => { @(D.inputs) }; + # plucked.sub.cf comes from the stdlib with `make pluck` + inputs => { @(D.inputs) }; } diff --git a/tests/acceptance/plucked.sub.cf b/tests/acceptance/plucked.sub.cf index e7fa7eb99e..8e18458540 100644 --- a/tests/acceptance/plucked.sub.cf +++ b/tests/acceptance/plucked.sub.cf @@ -1,5 +1,4 @@ ### This is an auto-generated file, see Makefile.am and `make pluck` ### - bundle agent run_ifdefined(namespace, mybundle) # @brief bundle to maybe run another bundle dynamically # @param namespace the namespace, usually `$(this.namespace)` @@ -19,13 +18,13 @@ bundle agent run_ifdefined(namespace, mybundle) # ``` { vars: - "bundlesfound" slist => bundlesmatching("^$(namespace):$(mybundle)$"); - "count" int => length(bundlesfound); + "bundlesfound" slist => bundlesmatching("^$(namespace):$(mybundle)$"); + "count" int => length(bundlesfound); methods: - "any" + "any" usebundle => $(bundlesfound), - if => strcmp(1, $(count)); + if => strcmp(1, $(count)); reports: verbose_mode:: @@ -48,7 +47,7 @@ body contain powershell # # * Introduced in 3.17.0 { - useshell => "powershell"; + useshell => "powershell"; } body contain in_dir_shell(dir) @@ -63,8 +62,8 @@ body contain in_dir_shell(dir) # contain => in_dir_shell("/tmp"); # ``` { - chdir => "$(dir)"; - useshell => "true"; # canonical "useshell" but this is backwards-compatible + chdir => "$(dir)"; + useshell => "true"; # canonical "useshell" but this is backwards-compatible } body contain in_shell @@ -78,7 +77,7 @@ body contain in_shell # contain => in_shell; # ``` { - useshell => "true"; # canonical "useshell" but this is backwards-compatible + useshell => "true"; # canonical "useshell" but this is backwards-compatible } body contain in_shell_bg @@ -87,7 +86,7 @@ body contain in_shell_bg # parser strictness enhancements. Backgrounding is handeled by the body action # background attribute. { - useshell => "true"; # canonical "useshell" but this is backwards-compatible + useshell => "true"; # canonical "useshell" but this is backwards-compatible } body contain in_shell_and_silent @@ -102,8 +101,8 @@ body contain in_shell_and_silent # comment => "Silently run command in shell"; # ``` { - useshell => "true"; # canonical "useshell" but this is backwards-compatible - no_output => "true"; + useshell => "true"; # canonical "useshell" but this is backwards-compatible + no_output => "true"; } body contain in_dir_shell_and_silent(dir) @@ -118,26 +117,25 @@ body contain in_dir_shell_and_silent(dir) # contain => in_dir_shell_and_silent("/tmp"), # comment => "Silently run command in shell"; # ``` - { - useshell => "true"; # canonical "useshell" but this is backwards-compatible - no_output => "true"; - chdir => "$(dir)"; + useshell => "true"; # canonical "useshell" but this is backwards-compatible + no_output => "true"; + chdir => "$(dir)"; } body action if_elapsed(x) # @brief Evaluate the promise every `x` minutes # @param x The time in minutes between promise evaluations { - ifelapsed => "$(x)"; - expireafter => "$(x)"; + ifelapsed => "$(x)"; + expireafter => "$(x)"; } body action if_elapsed_day # @brief Evaluate the promise once every 24 hours { - ifelapsed => "1440"; # 60 x 24 - expireafter => "1400"; + ifelapsed => "1440"; # 60 x 24 + expireafter => "1400"; } body action warn_only @@ -145,21 +143,21 @@ body action warn_only # # The promise does not get repaired. { - action_policy => "warn"; - ifelapsed => "60"; + action_policy => "warn"; + ifelapsed => "60"; } body action immediate # @brief Evaluate the promise at every `cf-agent` execution. { - ifelapsed => "0"; + ifelapsed => "0"; } body classes if_repaired(x) # @brief Define class `x` if the promise has been repaired # @param x The name of the class { - promise_repaired => { "$(x)" }; + promise_repaired => { "$(x)" }; } body classes if_else(yes, no) @@ -167,47 +165,72 @@ body classes if_else(yes, no) # @param yes The name of the class that should be defined if the promise is kept or repaired # @param no The name of the class that should be defined if the promise could not be repaired { - promise_kept => { "$(yes)" }; - promise_repaired => { "$(yes)" }; - repair_failed => { "$(no)" }; - repair_denied => { "$(no)" }; - repair_timeout => { "$(no)" }; + promise_kept => { "$(yes)" }; + promise_repaired => { "$(yes)" }; + repair_failed => { "$(no)" }; + repair_denied => { "$(no)" }; + repair_timeout => { "$(no)" }; } body classes if_notkept(x) # @brief Define the class `x` if the promise is not kept and cannot be repaired. # @param x The name of the class that should be defined { - repair_failed => { "$(x)" }; - repair_denied => { "$(x)" }; - repair_timeout => { "$(x)" }; + repair_failed => { "$(x)" }; + repair_denied => { "$(x)" }; + repair_timeout => { "$(x)" }; } body classes if_ok(x) # @brief Define the class `x` if the promise is kept or repaired # @param x The name of the class that should be defined { - promise_repaired => { "$(x)" }; - promise_kept => { "$(x)" }; + promise_repaired => { "$(x)" }; + promise_kept => { "$(x)" }; } body classes if_ok_cancel(x) # @brief Cancel the class `x` if the promise is kept or repaired # @param x The name of the class that should be cancelled { - cancel_repaired => { "$(x)" }; - cancel_kept => { "$(x)" }; + cancel_repaired => { "$(x)" }; + cancel_kept => { "$(x)" }; } body classes classes_generic(x) # @brief Define `x` prefixed/suffixed with promise outcome # @param x The unique part of the classes to be defined { - promise_repaired => { "promise_repaired_$(x)", "$(x)_repaired", "$(x)_ok", "$(x)_reached" }; - repair_failed => { "repair_failed_$(x)", "$(x)_failed", "$(x)_not_ok", "$(x)_error", "$(x)_not_kept", "$(x)_reached" }; - repair_denied => { "repair_denied_$(x)", "$(x)_denied", "$(x)_not_ok", "$(x)_error", "$(x)_not_kept", "$(x)_reached" }; - repair_timeout => { "repair_timeout_$(x)", "$(x)_timeout", "$(x)_not_ok", "$(x)_error", "$(x)_not_kept", "$(x)_reached" }; - promise_kept => { "promise_kept_$(x)", "$(x)_kept", "$(x)_ok", "$(x)_reached" }; + promise_repaired => { + "promise_repaired_$(x)", "$(x)_repaired", "$(x)_ok", "$(x)_reached" + }; + repair_failed => { + "repair_failed_$(x)", + "$(x)_failed", + "$(x)_not_ok", + "$(x)_error", + "$(x)_not_kept", + "$(x)_reached", + }; + repair_denied => { + "repair_denied_$(x)", + "$(x)_denied", + "$(x)_not_ok", + "$(x)_error", + "$(x)_not_kept", + "$(x)_reached", + }; + repair_timeout => { + "repair_timeout_$(x)", + "$(x)_timeout", + "$(x)_not_ok", + "$(x)_error", + "$(x)_not_kept", + "$(x)_reached", + }; + promise_kept => { + "promise_kept_$(x)", "$(x)_kept", "$(x)_ok", "$(x)_reached" + }; } body classes results(scope, class_prefix) @@ -283,27 +306,26 @@ body classes results(scope, class_prefix) # **See also:** `scope`, `scoped_classes_generic`, `classes_generic` { scope => "$(scope)"; - - promise_kept => { "$(class_prefix)_reached", - "$(class_prefix)_kept" }; - - promise_repaired => { "$(class_prefix)_reached", - "$(class_prefix)_repaired" }; - - repair_failed => { "$(class_prefix)_reached", - "$(class_prefix)_error", - "$(class_prefix)_not_kept", - "$(class_prefix)_failed" }; - - repair_denied => { "$(class_prefix)_reached", - "$(class_prefix)_error", - "$(class_prefix)_not_kept", - "$(class_prefix)_denied" }; - - repair_timeout => { "$(class_prefix)_reached", - "$(class_prefix)_error", - "$(class_prefix)_not_kept", - "$(class_prefix)_timeout" }; + promise_kept => { "$(class_prefix)_reached", "$(class_prefix)_kept" }; + promise_repaired => { "$(class_prefix)_reached", "$(class_prefix)_repaired" }; + repair_failed => { + "$(class_prefix)_reached", + "$(class_prefix)_error", + "$(class_prefix)_not_kept", + "$(class_prefix)_failed", + }; + repair_denied => { + "$(class_prefix)_reached", + "$(class_prefix)_error", + "$(class_prefix)_not_kept", + "$(class_prefix)_denied", + }; + repair_timeout => { + "$(class_prefix)_reached", + "$(class_prefix)_error", + "$(class_prefix)_not_kept", + "$(class_prefix)_timeout", + }; } body classes diff_results(scope, x) @@ -337,9 +359,9 @@ body classes diff_results(scope, x) # } # ``` { - inherit_from => results( $(scope), $(x) ); - kept_returncodes => { "0" }; - failed_returncodes => { "1", "2" }; + inherit_from => results($(scope), $(x)); + kept_returncodes => { "0" }; + failed_returncodes => { "1", "2" }; } body classes scoped_classes_generic(scope, x) @@ -349,29 +371,54 @@ body classes scoped_classes_generic(scope, x) # @param scope The scope in which the class should be defined # @param x The unique part of the classes to be defined { - scope => "$(scope)"; - promise_repaired => { "promise_repaired_$(x)", "$(x)_repaired", "$(x)_ok", "$(x)_reached" }; - repair_failed => { "repair_failed_$(x)", "$(x)_failed", "$(x)_not_ok", "$(x)_error", "$(x)_not_kept", "$(x)_reached" }; - repair_denied => { "repair_denied_$(x)", "$(x)_denied", "$(x)_not_ok", "$(x)_error", "$(x)_not_kept", "$(x)_reached" }; - repair_timeout => { "repair_timeout_$(x)", "$(x)_timeout", "$(x)_not_ok", "$(x)_error", "$(x)_not_kept", "$(x)_reached" }; - promise_kept => { "promise_kept_$(x)", "$(x)_kept", "$(x)_ok", "$(x)_reached" }; + scope => "$(scope)"; + promise_repaired => { + "promise_repaired_$(x)", "$(x)_repaired", "$(x)_ok", "$(x)_reached" + }; + repair_failed => { + "repair_failed_$(x)", + "$(x)_failed", + "$(x)_not_ok", + "$(x)_error", + "$(x)_not_kept", + "$(x)_reached", + }; + repair_denied => { + "repair_denied_$(x)", + "$(x)_denied", + "$(x)_not_ok", + "$(x)_error", + "$(x)_not_kept", + "$(x)_reached", + }; + repair_timeout => { + "repair_timeout_$(x)", + "$(x)_timeout", + "$(x)_not_ok", + "$(x)_error", + "$(x)_not_kept", + "$(x)_reached", + }; + promise_kept => { + "promise_kept_$(x)", "$(x)_kept", "$(x)_ok", "$(x)_reached" + }; } body classes always(x) # @brief Define class `x` no matter what the outcome of the promise is # @param x The name of the class to be defined { - 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)" }; } body classes kept_successful_command # @brief Set command to "kept" instead of "repaired" if it returns 0 { - kept_returncodes => { "0" }; + kept_returncodes => { "0" }; } bundle edit_line insert_before_if_no_line(before, string) @@ -379,12 +426,11 @@ bundle edit_line insert_before_if_no_line(before, string) # @param before The regular expression matching the line which `string` will be # inserted before # @param string The string to be prepended -# { insert_lines: - "$(string)" - location => before($(before)), - comment => "Prepend a line to the file if it doesn't already exist"; + "$(string)" + location => before($(before)), + comment => "Prepend a line to the file if it doesn't already exist"; } bundle edit_line insert_file(templatefile) @@ -393,8 +439,7 @@ bundle edit_line insert_file(templatefile) # @param templatefile The name of the file from which to import lines. { insert_lines: - - "$(templatefile)" + "$(templatefile)" comment => "Insert the template file into the file being edited", insert_type => "file"; } @@ -418,9 +463,7 @@ bundle edit_line lines_present(lines) # ``` { insert_lines: - - "$(lines)" - comment => "Append lines if they don't exist"; + "$(lines)" comment => "Append lines if they don't exist"; } bundle edit_line insert_lines(lines) @@ -428,9 +471,7 @@ bundle edit_line insert_lines(lines) # @param lines List or string that should be present in the file { insert_lines: - - "$(lines)" - comment => "Append lines if they don't exist"; + "$(lines)" comment => "Append lines if they don't exist"; } bundle edit_line append_if_no_line(lines) @@ -438,9 +479,7 @@ bundle edit_line append_if_no_line(lines) # @param lines List or string that should be present in the file { insert_lines: - - "$(lines)" - comment => "Append lines if they don't exist"; + "$(lines)" comment => "Append lines if they don't exist"; } bundle edit_line append_if_no_lines(lines) @@ -448,20 +487,16 @@ bundle edit_line append_if_no_lines(lines) # @param lines List or string that should be present in the file { insert_lines: - - "$(lines)" - comment => "Append lines if they don't exist"; + "$(lines)" comment => "Append lines if they don't exist"; } -bundle edit_line comment_lines_matching(regex,comment) +bundle edit_line comment_lines_matching(regex, comment) # @brief Comment lines in the file that matching an [anchored] regex # @param regex Anchored regex that the entire line needs to match # @param comment A string that is prepended to matching lines { replace_patterns: - - "^($(regex))$" - + "^($(regex))$" replace_with => comment("$(comment)"), comment => "Search and replace string"; } @@ -473,51 +508,44 @@ bundle edit_line contains_literal_string(string) # @param string The string (potentially multiline) to ensure exists in the # promised file. { - - insert_lines: - "$(string)" - insert_type => "preserve_block", - expand_scalars => "false", - whitespace_policy => { "exact_match" }; + insert_lines: + "$(string)" + insert_type => "preserve_block", + expand_scalars => "false", + whitespace_policy => { "exact_match" }; } -bundle edit_line uncomment_lines_matching(regex,comment) +bundle edit_line uncomment_lines_matching(regex, comment) # @brief Uncomment lines of the file where the regex matches # the entire text after the comment string # @param regex The regex that lines need to match after `comment` # @param comment The prefix of the line that is removed { replace_patterns: - - "^$(comment)\s?($(regex))$" - + "^$(comment)\s?($(regex))$" replace_with => uncomment, comment => "Uncomment lines matching a regular expression"; } -bundle edit_line comment_lines_containing(regex,comment) +bundle edit_line comment_lines_containing(regex, comment) # @brief Comment lines of the file matching a regex # @param regex A regex that a part of the line needs to match # @param comment A string that is prepended to matching lines { replace_patterns: - - "^((?!$(comment)).*$(regex).*)$" - + "^((?!$(comment)).*$(regex).*)$" replace_with => comment("$(comment)"), comment => "Comment out lines in a file"; } -bundle edit_line uncomment_lines_containing(regex,comment) +bundle edit_line uncomment_lines_containing(regex, comment) # @brief Uncomment lines of the file where the regex matches # parts of the text after the comment string # @param regex The regex that lines need to match after `comment` # @param comment The prefix of the line that is removed { replace_patterns: - - "^$(comment)\s?(.*$(regex).*)$" - + "^$(comment)\s?(.*$(regex).*)$" replace_with => uncomment, comment => "Uncomment a line containing a fragment"; } @@ -527,10 +555,7 @@ bundle edit_line delete_lines_matching(regex) # @param regex The regular expression that the lines need to match { delete_lines: - - "$(regex)" - - comment => "Delete lines matching regular expressions"; + "$(regex)" comment => "Delete lines matching regular expressions"; } bundle edit_line warn_lines_matching(regex) @@ -538,9 +563,7 @@ bundle edit_line warn_lines_matching(regex) # @param regex The regular expression that the lines need to match { delete_lines: - - "$(regex)" - + "$(regex)" comment => "Warn about lines in a file", action => warn_only; } @@ -555,12 +578,12 @@ bundle edit_line prepend_if_no_line(string) # * [`edit_line` bundles][edit_line] { insert_lines: - "$(string)" + "$(string)" location => start, comment => "Prepend a line to the file if it doesn't already exist"; } -bundle edit_line replace_line_end(start,end) +bundle edit_line replace_line_end(start, end) # @brief Give lines starting with `start` the ending given in `end` # # Whitespaces will be left unmodified. For example, @@ -576,13 +599,12 @@ bundle edit_line replace_line_end(start,end) # @param end The string lines should end with { field_edits: - - "\s*$(start)\s.*" + "\s*$(start)\s.*" comment => "Replace lines with $(this.start) and $(this.end)", - edit_field => line("(^|\s)$(start)\s*", "2", "$(end)","set"); + edit_field => line("(^|\s)$(start)\s*", "2", "$(end)", "set"); } -bundle edit_line replace_uncommented_substrings( _comment, _find, _replace ) +bundle edit_line replace_uncommented_substrings(_comment, _find, _replace) # @brief Replace all occurrences of `_find` with `_replace` on lines that do not follow a `_comment` # @param _comment Sequence of characters, each indicating the start of a comment. # @param _find String matching substring to replace @@ -609,15 +631,15 @@ bundle edit_line replace_uncommented_substrings( _comment, _find, _replace ) # * Introduced 3.17.0, 3.15.3 { vars: - "_reg_match_uncommented_lines_containing_find" - string => "^([^$(_comment)]*)\Q$(_find)\E(.*$)"; + "_reg_match_uncommented_lines_containing_find" + string => "^([^$(_comment)]*)\Q$(_find)\E(.*$)"; replace_patterns: "$(_reg_match_uncommented_lines_containing_find)" - replace_with => text_between_match1_and_match2( $(_replace) ); + replace_with => text_between_match1_and_match2($(_replace)); } -bundle edit_line append_to_line_end(start,end) +bundle edit_line append_to_line_end(start, end) # @brief Append `end` to any lines beginning with `start` # # `end` will be appended to all lines starting with `start` and not @@ -641,29 +663,26 @@ bundle edit_line append_to_line_end(start,end) # files: # "/tmp/boot-options" edit_line => append_to_line_end("kernel", "vga=791"); # ``` -# { field_edits: - - "\s*$(start)\s.*" + "\s*$(start)\s.*" comment => "Append lines with $(this.start) and $(this.end)", - edit_field => line("(^|\s)$(start)\s*", "2", "$(end)","append"); + edit_field => line("(^|\s)$(start)\s*", "2", "$(end)", "append"); } -bundle edit_line regex_replace(find,replace) +bundle edit_line regex_replace(find, replace) # @brief Find exactly a regular expression and replace exactly the match with a string. # You can think of this like a PCRE powered sed. # @param find The regular expression # @param replace The replacement string { replace_patterns: - - "$(find)" + "$(find)" replace_with => value("$(replace)"), comment => "Search and replace string"; } -bundle edit_line resolvconf(search,list) +bundle edit_line resolvconf(search, list) # @brief Adds search domains and name servers to the system # resolver configuration. # @@ -674,17 +693,15 @@ bundle edit_line resolvconf(search,list) # @param list An slist of nameserver addresses { delete_lines: - - "search.*" comment => "Reset search lines from resolver"; - "nameserver.*" comment => "Reset nameservers in resolver"; + "search.*" comment => "Reset search lines from resolver"; + "nameserver.*" comment => "Reset nameservers in resolver"; insert_lines: - - "search $(search)" comment => "Add search domains to resolver"; - "nameserver $(list)" comment => "Add name servers to resolver"; + "search $(search)" comment => "Add search domains to resolver"; + "nameserver $(list)" comment => "Add name servers to resolver"; } -bundle edit_line resolvconf_o(search,list,options) +bundle edit_line resolvconf_o(search, list, options) # @brief Adds search domains, name servers and options to the system # resolver configuration. # @@ -694,19 +711,16 @@ bundle edit_line resolvconf_o(search,list,options) # @param search The search domains with space # @param list An slist of nameserver addresses # @param options is an slist of variables to modify the resolver - { delete_lines: - - "search.*" comment => "Reset search lines from resolver"; - "nameserver.*" comment => "Reset nameservers in resolver"; - "options.*" comment => "Reset options in resolver"; + "search.*" comment => "Reset search lines from resolver"; + "nameserver.*" comment => "Reset nameservers in resolver"; + "options.*" comment => "Reset options in resolver"; insert_lines: - - "search $(search)" comment => "Add search domains to resolver"; - "nameserver $(list)" comment => "Add name servers to resolver"; - "options $(options)" comment => "Add options to resolver"; + "search $(search)" comment => "Add search domains to resolver"; + "nameserver $(list)" comment => "Add name servers to resolver"; + "options $(options)" comment => "Add options to resolver"; } bundle edit_line manage_variable_values_ini(tab, sectionName) @@ -725,19 +739,19 @@ bundle edit_line manage_variable_values_ini(tab, sectionName) # **See also:** `set_variable_values_ini()` { vars: - "index" slist => getindices("$(tab)[$(sectionName)]"); + "index" slist => getindices("$(tab)[$(sectionName)]"); delete_lines: - ".*" + ".*" select_region => INI_section(escape("$(sectionName)")), - comment => "Remove all entries in the region so there are no extra entries"; + comment => "Remove all entries in the region so there are no extra entries"; insert_lines: - "[$(sectionName)]" + "[$(sectionName)]" location => start, comment => "Insert lines"; - "$(index)=$($(tab)[$(sectionName)][$(index)])" + "$(index)=$($(tab)[$(sectionName)][$(index)])" select_region => INI_section(escape("$(sectionName)")); } @@ -756,56 +770,65 @@ bundle edit_line set_variable_values_ini(tab, sectionName) # **See also:** `manage_variable_values_ini()` { vars: - "index" slist => getindices("$(tab)[$(sectionName)]"); + "index" slist => getindices("$(tab)[$(sectionName)]"); - # Be careful if the index string contains funny chars - "cindex[$(index)]" string => canonify("$(index)"); - "_escaped_section" string => escape("$(sectionName)"); + # Be careful if the index string contains funny chars + "cindex[$(index)]" string => canonify("$(index)"); + "_escaped_section" string => escape("$(sectionName)"); classes: - "edit_$(cindex[$(index)])" not => strcmp("$($(tab)[$(sectionName)][$(index)])","dontchange"), + "edit_$(cindex[$(index)])" + not => strcmp("$($(tab)[$(sectionName)][$(index)])", "dontchange"), comment => "Create conditions to make changes"; - "section_$(sectionName)_exists" - expression => regline("^\[$(_escaped_section)\]", "$(edit.filename)"), - if => fileexists("$(edit.filename)"), - comment => "Check if the section header already exists in the file"; + "section_$(sectionName)_exists" + expression => regline("^\[$(_escaped_section)\]", "$(edit.filename)"), + if => fileexists("$(edit.filename)"), + comment => "Check if the section header already exists in the file"; field_edits: - - # If the line is there, but commented out, first uncomment it - "#+\s*$(index)\s*=.*" + # If the line is there, but commented out, first uncomment it + "#+\s*$(index)\s*=.*" select_region => INI_section(escape("$(sectionName)")), - edit_field => col("\s*=\s*","1","$(index)","set"), - if => and("edit_$(cindex[$(index)])", - canonify("section_$(sectionName)_exists")); - - # match a line starting like the key something - "\s*$(index)\s*=.*" - edit_field => col("\s*=\s*","2","$($(tab)[$(sectionName)][$(index)])","set"), + edit_field => col("\s*=\s*", "1", "$(index)", "set"), + if => and( + "edit_$(cindex[$(index)])", canonify("section_$(sectionName)_exists") + ); + + # match a line starting like the key something + "\s*$(index)\s*=.*" + edit_field => col( + "\s*=\s*", "2", "$($(tab)[$(sectionName)][$(index)])", "set" + ), select_region => INI_section(escape("$(sectionName)")), - classes => results("bundle", "set_variable_values_ini_not_$(cindex[$(index)])"), - if => and("edit_$(cindex[$(index)])", - canonify("section_$(sectionName)_exists")); + classes => results( + "bundle", "set_variable_values_ini_not_$(cindex[$(index)])" + ), + if => and( + "edit_$(cindex[$(index)])", canonify("section_$(sectionName)_exists") + ); insert_lines: - "[$(sectionName)]" + "[$(sectionName)]" location => start, comment => "Insert lines"; - "$(index)=$($(tab)[$(sectionName)][$(index)])" + "$(index)=$($(tab)[$(sectionName)][$(index)])" select_region => INI_section(escape("$(sectionName)")), - if => and("!(set_variable_values_ini_not_$(cindex[$(index)])_kept|set_variable_values_ini_not_$(cindex[$(index)])_repaired)", - "edit_$(cindex[$(index)])", - canonify("section_$(sectionName)_exists")), - handle => "insert_key_in_existing_section_$(sectionName)_$(cindex[$(index)])"; - - "$(index)=$($(tab)[$(sectionName)][$(index)])" - location => after("^\[$(_escaped_section)\]"), - if => and("edit_$(cindex[$(index)])", - not(canonify("section_$(sectionName)_exists"))), - handle => "insert_key_in_new_section_$(sectionName)_$(cindex[$(index)])"; - + if => and( + "!(set_variable_values_ini_not_$(cindex[$(index)])_kept|set_variable_values_ini_not_$(cindex[$(index)])_repaired)", + "edit_$(cindex[$(index)])", + canonify("section_$(sectionName)_exists") + ), + handle => "insert_key_in_existing_section_$(sectionName)_$(cindex[$(index)])"; + + "$(index)=$($(tab)[$(sectionName)][$(index)])" + location => after("^\[$(_escaped_section)\]"), + if => and( + "edit_$(cindex[$(index)])", + not(canonify("section_$(sectionName)_exists")) + ), + handle => "insert_key_in_new_section_$(sectionName)_$(cindex[$(index)])"; } bundle edit_line insert_ini_section(name, config) @@ -824,17 +847,16 @@ bundle edit_line insert_ini_section(name, config) # @param config The fully-qualified name of an associative array containing `v[LHS]="rhs"` { vars: - # TODO: refactor once 3.7.x is EOL - "indices" slist => getindices($(config)); - "k" slist => sort("indices", lex); + # TODO: refactor once 3.7.x is EOL + "indices" slist => getindices($(config)); + "k" slist => sort("indices", lex); insert_lines: - "[$(name)]" + "[$(name)]" location => start, comment => "Insert an ini section with values if not present"; - "$(k)=$($(config)[$(k)])" - location => after("[$(name)]"); + "$(k)=$($(config)[$(k)])" location => after("[$(name)]"); } bundle edit_line set_quoted_values(v) @@ -864,35 +886,33 @@ bundle edit_line set_quoted_values(v) # **See also:** `set_variable_values()` { meta: - "tags" - slist => - { + "tags" + slist => { "deprecated=3.6.0", "deprecation-reason=Generic reimplementation", - "replaced-by=set_line_based" + "replaced-by=set_line_based", }; vars: - "index" slist => getindices("$(v)"); - # Be careful if the index string contains funny chars + "index" slist => getindices("$(v)"); - "cindex[$(index)]" string => canonify("$(index)"); + # Be careful if the index string contains funny chars + "cindex[$(index)]" string => canonify("$(index)"); field_edits: - # If the line is there, but commented out, first uncomment it - "#+\s*$(index)\s*=.*" - edit_field => col("=","1","$(index)","set"); + # If the line is there, but commented out, first uncomment it + "#+\s*$(index)\s*=.*" edit_field => col("=", "1", "$(index)", "set"); - # match a line starting like the key = something - "\s*$(index)\s*=.*" - edit_field => col("=","2",'"$($(v)[$(index)])"',"set"), - classes => results("bundle", "$(cindex[$(index)])_in_file"), - comment => "Match a line starting like key = something"; + # match a line starting like the key = something + "\s*$(index)\s*=.*" + edit_field => col("=", "2", '"$($(v)[$(index)])"', "set"), + classes => results("bundle", "$(cindex[$(index)])_in_file"), + comment => "Match a line starting like key = something"; insert_lines: - '$(index)="$($(v)[$(index)])"' - comment => "Insert a variable definition", - if => "!($(cindex[$(index)])_in_file_kept|$(cindex[$(index)])_in_file_repaired)"; + '$(index)="$($(v)[$(index)])"' + comment => "Insert a variable definition", + if => "!($(cindex[$(index)])_in_file_kept|$(cindex[$(index)])_in_file_repaired)"; } bundle edit_line set_variable_values(v) @@ -922,39 +942,31 @@ bundle edit_line set_variable_values(v) # **See also:** `set_quoted_values()` { meta: - "tags" - slist => - { + "tags" + slist => { "deprecated=3.6.0", "deprecation-reason=Generic reimplementation", - "replaced-by=set_line_based" + "replaced-by=set_line_based", }; vars: + "index" slist => getindices("$(v)"); - "index" slist => getindices("$(v)"); - - # Be careful if the index string contains funny chars - - "cindex[$(index)]" string => canonify("$(index)"); - "cv" string => canonify("$(v)"); + # Be careful if the index string contains funny chars + "cindex[$(index)]" string => canonify("$(index)"); + "cv" string => canonify("$(v)"); field_edits: - - # match a line starting like the key = something - - "\s*$(index)\s*=.*" - - edit_field => col("\s*$(index)\s*=","2","$($(v)[$(index)])","set"), + # match a line starting like the key = something + "\s*$(index)\s*=.*" + edit_field => col("\s*$(index)\s*=", "2", "$($(v)[$(index)])", "set"), classes => results("bundle", "$(cv)_$(cindex[$(index)])_in_file"), comment => "Match a line starting like key = something"; insert_lines: - - "$(index)=$($(v)[$(index)])" - + "$(index)=$($(v)[$(index)])" comment => "Insert a variable definition", - if => "!($(cv)_$(cindex[$(index)])_in_file_kept|$(cv)_$(cindex[$(index)])_in_file_repaired)"; + if => "!($(cv)_$(cindex[$(index)])_in_file_kept|$(cv)_$(cindex[$(index)])_in_file_repaired)"; } bundle edit_line set_config_values(v) @@ -971,75 +983,76 @@ bundle edit_line set_config_values(v) # @param v The fully-qualified name of an associative array containing `v[LHS]="rhs"` { meta: - "tags" - slist => - { + "tags" + slist => { "deprecated=3.6.0", "deprecation-reason=Generic reimplementation", - "replaced-by=set_line_based" + "replaced-by=set_line_based", }; vars: - "index" slist => getindices("$(v)"); - - # Be careful if the index string contains funny chars - "cindex[$(index)]" string => canonify("$(index)"); + "index" slist => getindices("$(v)"); - # Escape the value (had a problem with special characters and regex's) - "ev[$(index)]" string => escape("$($(v)[$(index)])"); + # Be careful if the index string contains funny chars + "cindex[$(index)]" string => canonify("$(index)"); - # Do we have more than one line commented out? - "index_comment_matches_$(cindex[$(index)])" - int => countlinesmatching("^\s*#\s*($(index)\s+.*|$(index))$","$(edit.filename)"); + # Escape the value (had a problem with special characters and regex's) + "ev[$(index)]" string => escape("$($(v)[$(index)])"); + # Do we have more than one line commented out? + "index_comment_matches_$(cindex[$(index)])" + int => countlinesmatching( + "^\s*#\s*($(index)\s+.*|$(index))$", "$(edit.filename)" + ); classes: - # Check to see if this line exists - "line_exists_$(cindex[$(index)])" - expression => regline("^\s*($(index)\s.*|$(index))$","$(edit.filename)"), - scope => "bundle"; - - # if there's more than one comment, just add new (don't know who to use) - "multiple_comments_$(cindex[$(index)])" - expression => isgreaterthan("$(index_comment_matches_$(cindex[$(index)]))","1"), - scope => "bundle"; + # Check to see if this line exists + "line_exists_$(cindex[$(index)])" + expression => regline("^\s*($(index)\s.*|$(index))$", "$(edit.filename)"), + scope => "bundle"; + + # if there's more than one comment, just add new (don't know who to use) + "multiple_comments_$(cindex[$(index)])" + expression => isgreaterthan( + "$(index_comment_matches_$(cindex[$(index)]))", "1" + ), + scope => "bundle"; replace_patterns: - # If the line is commented out, uncomment and replace with - # the correct value - "^\s*#\s*($(index)\s+.*|$(index))$" - comment => "If we find a single commented entry we can uncomment it to + # If the line is commented out, uncomment and replace with + # the correct value + "^\s*#\s*($(index)\s+.*|$(index))$" + comment => "If we find a single commented entry we can uncomment it to keep the settings near any inline documentation. If there are multiple comments, then we don't try to replace them and instead will later append the new value after the first commented occurrence of $(index).", - handle => "set_config_values_replace_commented_line", - replace_with => value("$(index) $($(v)[$(index)])"), - if => "!line_exists_$(cindex[$(index)]).!replace_attempted_$(cindex[$(index)])_reached.!multiple_comments_$(cindex[$(index)])", - classes => results("bundle", "uncommented_$(cindex[$(index)])"); - - # If the line is there with the wrong value, replace with - # the correct value - "^\s*($(index)\s+(?!$(ev[$(index)])$).*|$(index))$" - comment => "Correct the value $(index)", + handle => "set_config_values_replace_commented_line", replace_with => value("$(index) $($(v)[$(index)])"), - classes => results("bundle", "replace_attempted_$(cindex[$(index)])"); + if => "!line_exists_$(cindex[$(index)]).!replace_attempted_$(cindex[$(index)])_reached.!multiple_comments_$(cindex[$(index)])", + classes => results("bundle", "uncommented_$(cindex[$(index)])"); - insert_lines: - # If the line doesn't exist, or there is more than one occurrence - # of the LHS commented out, insert a new line and try to place it - # after the commented LHS (keep new line with old comments) - "$(index) $($(v)[$(index)])" - comment => "Insert the value, marker exists $(index)", - location => after("^\s*#\s*($(index)\s+.*|$(index))$"), - if => "replace_attempted_$(cindex[$(index)])_reached.multiple_comments_$(cindex[$(index)])"; + # If the line is there with the wrong value, replace with + # the correct value + "^\s*($(index)\s+(?!$(ev[$(index)])$).*|$(index))$" + comment => "Correct the value $(index)", + replace_with => value("$(index) $($(v)[$(index)])"), + classes => results("bundle", "replace_attempted_$(cindex[$(index)])"); - # If the line doesn't exist and there are no occurrences - # of the LHS commented out, insert a new line at the eof - "$(index) $($(v)[$(index)])" - comment => "Insert the value, marker doesn't exist $(index)", - if => "replace_attempted_$(cindex[$(index)])_reached.!multiple_comments_$(cindex[$(index)])"; + insert_lines: + # If the line doesn't exist, or there is more than one occurrence + # of the LHS commented out, insert a new line and try to place it + # after the commented LHS (keep new line with old comments) + "$(index) $($(v)[$(index)])" + comment => "Insert the value, marker exists $(index)", + location => after("^\s*#\s*($(index)\s+.*|$(index))$"), + if => "replace_attempted_$(cindex[$(index)])_reached.multiple_comments_$(cindex[$(index)])"; + # If the line doesn't exist and there are no occurrences + # of the LHS commented out, insert a new line at the eof + "$(index) $($(v)[$(index)])" + comment => "Insert the value, marker doesn't exist $(index)", + if => "replace_attempted_$(cindex[$(index)])_reached.!multiple_comments_$(cindex[$(index)])"; } bundle edit_line set_line_based(v, sep, bp, kp, cp) @@ -1067,8 +1080,6 @@ bundle edit_line set_line_based(v, sep, bp, kp, cp) # # Adds a new line if none exists or if more than one commented-out # possible matches exist. -# -# # **Note:** If the data structure being used for the first parameter is in the current bundle, you can use `$(this.bundle).variable`. # # Originally `set_config_values` by Ed King. @@ -1080,9 +1091,8 @@ bundle edit_line set_line_based(v, sep, bp, kp, cp) # @param cp The comment pattern from line-start, e.g. `\s*#\s*` { meta: - "tags" - slist => - { + "tags" + slist => { "replaces=set_config_values", "replaces=set_config_values_matching", "replaces=set_variable_values", @@ -1091,94 +1101,86 @@ bundle edit_line set_line_based(v, sep, bp, kp, cp) }; vars: - "vkeys" slist => getindices("$(v)"); - "i" slist => grep($(kp), vkeys); + "vkeys" slist => getindices("$(v)"); + "i" slist => grep($(kp), vkeys); - # Be careful if the index string contains funny chars - "ci[$(i)]" string => canonify("$(i)"); + # Be careful if the index string contains funny chars + "ci[$(i)]" string => canonify("$(i)"); - # Escape the value (had a problem with special characters and regex's) - "ev[$(i)]" string => escape("$($(v)[$(i)])"); - - # Do we have more than one line commented out? - "comment_matches_$(ci[$(i)])" - int => countlinesmatching("^$(cp)($(i)$(bp).*|$(i))$", - $(edit.filename)); + # Escape the value (had a problem with special characters and regex's) + "ev[$(i)]" string => escape("$($(v)[$(i)])"); + # Do we have more than one line commented out? + "comment_matches_$(ci[$(i)])" + int => countlinesmatching("^$(cp)($(i)$(bp).*|$(i))$", $(edit.filename)); classes: - # 3.21.0 and greater know about a file being emptied before editing and - # skip this check since it does not make sense. + # 3.21.0 and greater know about a file being emptied before editing and + # skip this check since it does not make sense. @if minimum_version(3.21) - # Check to see if this line exists - "exists_$(ci[$(i)])" - expression => regline("^\s*($(i)$(bp).*|$(i))$", - $(edit.filename)), - unless => strcmp( "true", $(edit.empty_before_use) ); + # Check to see if this line exists + "exists_$(ci[$(i)])" + expression => regline("^\s*($(i)$(bp).*|$(i))$", $(edit.filename)), + unless => strcmp("true", $(edit.empty_before_use)); @endif - @if minimum_version(3.18) !(cfengine_3_18_0|cfengine_3_18_1|cfengine_3_18_2):: "exists_$(ci[$(i)])" - expression => regline("^\s*($(i)$(bp).*|$(i))$", - $(edit.filename)), - unless => strcmp( "true", $(edit.empty_before_use) ); + expression => regline("^\s*($(i)$(bp).*|$(i))$", $(edit.filename)), + unless => strcmp("true", $(edit.empty_before_use)); @endif - (cfengine_3_15|cfengine_3_16|cfengine_3_17|cfengine_3_18_0|cfengine_3_18_1|cfengine_3_18_2|cfengine_3_19|cfengine_3_20):: # Version 3.15.0 does not know about the before_version macro, so we keep the same behavior # TODO Remove after 3.21 is no longer supported. (3.15.0 was supported when 3.21 was released) # Check to see if this line exists "exists_$(ci[$(i)])" - expression => regline("^\s*($(i)$(bp).*|$(i))$", - $(edit.filename)); + expression => regline("^\s*($(i)$(bp).*|$(i))$", $(edit.filename)); any:: - # if there's more than one comment, just add new (don't know who to use) "multiple_comments_$(ci[$(i)])" - expression => isgreaterthan("$(comment_matches_$(ci[$(i)]))", - "1"); - + expression => isgreaterthan("$(comment_matches_$(ci[$(i)]))", "1"); replace_patterns: - # If the line is commented out, uncomment and replace with - # the correct value - "^$(cp)($(i)$(bp).*|$(i))$" - comment => "Uncommented the value '$(i)'", - replace_with => value("$(i)$(sep)$($(v)[$(i)])"), - if => "!exists_$(ci[$(i)]).!replace_attempted_$(ci[$(i)])_reached.!multiple_comments_$(ci[$(i)])", - classes => results("bundle", "uncommented_$(ci[$(i)])"); - - # If the line is there with the wrong value, replace with - # the correct value - "^\s*($(i)$(bp)(?!$(ev[$(i)])$).*|$(i))$" - comment => "Correct the value '$(i)'", + # If the line is commented out, uncomment and replace with + # the correct value + "^$(cp)($(i)$(bp).*|$(i))$" + comment => "Uncommented the value '$(i)'", replace_with => value("$(i)$(sep)$($(v)[$(i)])"), - classes => results("bundle", "replace_attempted_$(ci[$(i)])"); + if => "!exists_$(ci[$(i)]).!replace_attempted_$(ci[$(i)])_reached.!multiple_comments_$(ci[$(i)])", + classes => results("bundle", "uncommented_$(ci[$(i)])"); + + # If the line is there with the wrong value, replace with + # the correct value + "^\s*($(i)$(bp)(?!$(ev[$(i)])$).*|$(i))$" + comment => "Correct the value '$(i)'", + replace_with => value("$(i)$(sep)$($(v)[$(i)])"), + classes => results("bundle", "replace_attempted_$(ci[$(i)])"); insert_lines: - # If the line doesn't exist, or there is more than one occurrence - # of the LHS commented out, insert a new line and try to place it - # after the commented LHS (keep new line with old comments) - "$(i)$(sep)$($(v)[$(i)])" - comment => "Insert the value, marker '$(i)' exists", - location => after("^$(cp)($(i)$(bp).*|$(i))$"), - if => "replace_attempted_$(ci[$(i)])_reached.multiple_comments_$(ci[$(i)])"; - - # If the line doesn't exist and there are no occurrences - # of the LHS commented out, insert a new line at the eof - "$(i)$(sep)$($(v)[$(i)])" - comment => "Insert the value, marker '$(i)' doesn't exist", - if => "replace_attempted_$(ci[$(i)])_reached.!multiple_comments_$(ci[$(i)]).!exists_$(ci[$(i)])"; + # If the line doesn't exist, or there is more than one occurrence + # of the LHS commented out, insert a new line and try to place it + # after the commented LHS (keep new line with old comments) + "$(i)$(sep)$($(v)[$(i)])" + comment => "Insert the value, marker '$(i)' exists", + location => after("^$(cp)($(i)$(bp).*|$(i))$"), + if => "replace_attempted_$(ci[$(i)])_reached.multiple_comments_$(ci[$(i)])"; + + # If the line doesn't exist and there are no occurrences + # of the LHS commented out, insert a new line at the eof + "$(i)$(sep)$($(v)[$(i)])" + comment => "Insert the value, marker '$(i)' doesn't exist", + if => "replace_attempted_$(ci[$(i)])_reached.!multiple_comments_$(ci[$(i)]).!exists_$(ci[$(i)])"; reports: verbose_mode|EXTRA:: "$(this.bundle): Line for '$(i)' exists" if => "exists_$(ci[$(i)])"; - "$(this.bundle): Line for '$(i)' does not exist" if => "!exists_$(ci[$(i)])"; + + "$(this.bundle): Line for '$(i)' does not exist" + if => "!exists_$(ci[$(i)])"; } -bundle edit_line set_config_values_matching(v,pat) +bundle edit_line set_config_values_matching(v, pat) # @brief Sets the RHS of configuration items in the file of the form # # ``` @@ -1192,73 +1194,72 @@ bundle edit_line set_config_values_matching(v,pat) # @param pat Only elements of `v` that match the regex `pat` are use { meta: - "tags" - slist => - { + "tags" + slist => { "deprecated=3.6.0", "deprecation-reason=Generic reimplementation", - "replaced-by=set_line_based" + "replaced-by=set_line_based", }; vars: - "allparams" slist => getindices("$(v)"); - "index" slist => grep("$(pat)", "allparams"); + "allparams" slist => getindices("$(v)"); + "index" slist => grep("$(pat)", "allparams"); - # Be careful if the index string contains funny chars - "cindex[$(index)]" string => canonify("$(index)"); + # Be careful if the index string contains funny chars + "cindex[$(index)]" string => canonify("$(index)"); replace_patterns: - # If the line is there, maybe commented out, uncomment and replace with - # the correct value - "^\s*($(index)\s+(?!$($(v)[$(index)])).*|# ?$(index)\s+.*)$" + # If the line is there, maybe commented out, uncomment and replace with + # the correct value + "^\s*($(index)\s+(?!$($(v)[$(index)])).*|# ?$(index)\s+.*)$" comment => "Correct the value", replace_with => value("$(index) $($(v)[$(index)])"), classes => results("bundle", "replace_attempted_$(cindex[$(index)])"); insert_lines: - "$(index) $($(v)[$(index)])" + "$(index) $($(v)[$(index)])" if => "replace_attempted_$(cindex[$(index)])_reached"; - } -bundle edit_line maintain_key_values(v,sep) +bundle edit_line maintain_key_values(v, sep) # @brief Sets the RHS of configuration items with an giving separator # # Contributed by David Lee { meta: - "tags" - slist => - { + "tags" + slist => { "deprecated=3.6.0", "deprecation-reason=Generic reimplementation", - "replaced-by=set_line_based" + "replaced-by=set_line_based", }; vars: - "index" slist => getindices("$(v)"); - # Be careful if the index string contains funny chars - "cindex[$(index)]" string => canonify("$(index)"); - # Matching pattern for line (basically key-and-separator) - "keypat[$(index)]" string => "\s*$(index)\s*$(sep)\s*"; + "index" slist => getindices("$(v)"); + + # Be careful if the index string contains funny chars + "cindex[$(index)]" string => canonify("$(index)"); - # Values may contain regexps. Escape them for replace_pattern matching. - "ve[$(index)]" string => escape("$($(v)[$(index)])"); + # Matching pattern for line (basically key-and-separator) + "keypat[$(index)]" string => "\s*$(index)\s*$(sep)\s*"; + + # Values may contain regexps. Escape them for replace_pattern matching. + "ve[$(index)]" string => escape("$($(v)[$(index)])"); classes: - "$(cindex[$(index)])_key_in_file" + "$(cindex[$(index)])_key_in_file" comment => "Dynamic Class created if patterns matching", expression => regline("^$(keypat[$(index)]).*", "$(edit.filename)"); replace_patterns: - # For convergence need to use negative lookahead on value: - # "key sep (?!value).*" - "^($(keypat[$(index)]))(?!$(ve[$(index)])$).*" + # For convergence need to use negative lookahead on value: + # "key sep (?!value).*" + "^($(keypat[$(index)]))(?!$(ve[$(index)])$).*" comment => "Replace definition of $(index)", replace_with => value("$(match.1)$($(v)[$(index)])"); insert_lines: - "$(index)$(sep)$($(v)[$(index)])" + "$(index)$(sep)$($(v)[$(index)])" comment => "Insert definition of $(index)", if => "!$(cindex[$(index)])_key_in_file"; } @@ -1271,18 +1272,15 @@ bundle edit_line append_users_starting(v) # consider making `users` promises instead of modifying system files. { vars: - - "index" slist => getindices("$(v)"); + "index" slist => getindices("$(v)"); classes: - - "add_$(index)" not => userexists("$(index)"), + "add_$(index)" + not => userexists("$(index)"), comment => "Class created if user does not exist"; insert_lines: - - "$($(v)[$(index)])" - + "$($(v)[$(index)])" comment => "Append users into a password file format", if => "add_$(index)"; } @@ -1295,24 +1293,20 @@ bundle edit_line append_groups_starting(v) # consider making `users` promises instead of modifying system files. { vars: - - "index" slist => getindices("$(v)"); + "index" slist => getindices("$(v)"); classes: - - "add_$(index)" not => groupexists("$(index)"), + "add_$(index)" + not => groupexists("$(index)"), comment => "Class created if group does not exist"; insert_lines: - - "$($(v)[$(index)])" - + "$($(v)[$(index)])" comment => "Append users into a group file format", if => "add_$(index)"; - } -bundle edit_line set_colon_field(key,field,val) +bundle edit_line set_colon_field(key, field, val) # @brief Set the value of field number `field` of the line whose # first field is `key` to the value `val`, in a colon-separated file. # @param key The value the first field has to match @@ -1320,14 +1314,12 @@ bundle edit_line set_colon_field(key,field,val) # @param val The new value of `field` { field_edits: - - "$(key):.*" - + "$(key):.*" comment => "Edit a colon-separated file, using the first field as a key", - edit_field => col(":","$(field)","$(val)","set"); + edit_field => col(":", "$(field)", "$(val)", "set"); } -bundle edit_line set_user_field(user,field,val) +bundle edit_line set_user_field(user, field, val) # @brief Set the value of field number "field" in a `:-field` # formatted file like `/etc/passwd` # @param user A regular expression matching the user(s) to be modified @@ -1343,14 +1335,12 @@ bundle edit_line set_user_field(user,field,val) # * [edit_line field_edits][field_edits] { field_edits: - - "$(user):.*" - - comment => "Edit a user attribute in the password file", - edit_field => col(":","$(field)","$(val)","set"); + "$(user):.*" + comment => "Edit a user attribute in the password file", + edit_field => col(":", "$(field)", "$(val)", "set"); } -bundle edit_line set_escaped_user_field(user,field,val) +bundle edit_line set_escaped_user_field(user, field, val) # @brief Set the value of field number "field" in a `:-field` # formatted file like `/etc/passwd` # @param user The user to be modified @@ -1366,18 +1356,15 @@ bundle edit_line set_escaped_user_field(user,field,val) # * [edit_line field_edits][field_edits] { vars: - "escaped_user" - string => escape( "$(user)" ); + "escaped_user" string => escape("$(user)"); field_edits: - - "$(escaped_user):.*" - - comment => "Edit a user attribute in the password file", - edit_field => col(":","$(field)","$(val)","set"); + "$(escaped_user):.*" + comment => "Edit a user attribute in the password file", + edit_field => col(":", "$(field)", "$(val)", "set"); } -bundle edit_line append_user_field(group,field,allusers) +bundle edit_line append_user_field(group, field, allusers) # @brief For adding users to to a file like `/etc/group` # at field position `field`, comma separated subfields # @param group The group to be modified @@ -1388,11 +1375,9 @@ bundle edit_line append_user_field(group,field,allusers) # consider making `users` promises instead of modifying system files. { field_edits: - - "$(group):.*" - + "$(group):.*" comment => "Append users into a password file format", - edit_field => col(":","$(field)","$(allusers)","alphanum"); + edit_field => col(":", "$(field)", "$(allusers)", "alphanum"); } bundle edit_line expand_template(templatefile) @@ -1400,15 +1385,13 @@ bundle edit_line expand_template(templatefile) # @param templatefile The name of the file { insert_lines: - - "$(templatefile)" - + "$(templatefile)" insert_type => "file", comment => "Expand variables in the template file", expand_scalars => "true"; } -bundle edit_line replace_or_add(pattern,line) +bundle edit_line replace_or_add(pattern, line) # @brief Replace a pattern in a file with a single line. # # If the pattern is not found, add the line to the file. @@ -1420,18 +1403,17 @@ bundle edit_line replace_or_add(pattern,line) # @param line The line with which to replace matches of `pattern` { vars: - "cline" string => canonify("$(line)"); - "eline" string => escape("$(line)"); + "cline" string => canonify("$(line)"); + "eline" string => escape("$(line)"); replace_patterns: - "^(?!$(eline)$)$(pattern)$" + "^(?!$(eline)$)$(pattern)$" comment => "Replace a pattern here", replace_with => value("$(line)"), classes => results("bundle", "replace_$(cline)"); insert_lines: - "$(line)" - if => "replace_$(cline)_reached"; + "$(line)" if => "replace_$(cline)_reached"; } bundle edit_line converge(marker, lines) @@ -1463,12 +1445,13 @@ bundle edit_line converge(marker, lines) # * Introduced in 3.6.0 { vars: - "regex" string => escape($(marker)); + "regex" string => escape($(marker)); delete_lines: - ".*$(regex).*" comment => "Delete lines matching the marker"; + ".*$(regex).*" comment => "Delete lines matching the marker"; + insert_lines: - "$(lines)" comment => "Insert the given lines"; + "$(lines)" comment => "Insert the given lines"; } bundle edit_line converge_prepend(marker, lines) @@ -1500,12 +1483,15 @@ bundle edit_line converge_prepend(marker, lines) # * Introduced in 3.17.0, 3.15.3, 3.12.6 { vars: - "regex" string => escape($(marker)); + "regex" string => escape($(marker)); delete_lines: - ".*$(regex).*" comment => "Delete lines matching the marker"; + ".*$(regex).*" comment => "Delete lines matching the marker"; + insert_lines: - "$(lines)" location => start, comment => "Insert the given lines"; + "$(lines)" + location => start, + comment => "Insert the given lines"; } bundle edit_line fstab_option_editor(method, mount, option) @@ -1527,9 +1513,8 @@ bundle edit_line fstab_option_editor(method, mount, option) # "/etc/fstab" edit_line => fstab_option_editor("append", "/", "acl"); # ``` { - field_edits: - "(?!#)\S+\s+$(mount)\s.+" - edit_field => fstab_options($(option), $(method)); + field_edits: + "(?!#)\S+\s+$(mount)\s.+" edit_field => fstab_options($(option), $(method)); } body edit_field fstab_options(newval, method) @@ -1550,85 +1535,84 @@ body edit_field fstab_options(newval, method) # edit_field => fstab_options($(option), $(method)); # ``` { - field_separator => "\s+"; - select_field => "4"; - value_separator => ","; - field_value => "$(newval)"; - field_operation => "$(method)"; + field_separator => "\s+"; + select_field => "4"; + value_separator => ","; + field_value => "$(newval)"; + field_operation => "$(method)"; } -body edit_field quoted_var(newval,method) +body edit_field quoted_var(newval, method) # @brief Edit the quoted value of the matching line # @param newval The new value # @param method The method by which to edit the field (append|prepend|alphanum|set|delete) # Ref https://docs.cfengine.com/latest/reference-promise-types-files-edit_line-field_edits.html#field_operation { - field_separator => "\""; - select_field => "2"; - value_separator => " "; - field_value => "$(newval)"; - field_operation => "$(method)"; - extend_fields => "false"; - allow_blank_fields => "true"; + field_separator => "\""; + select_field => "2"; + value_separator => " "; + field_value => "$(newval)"; + field_operation => "$(method)"; + extend_fields => "false"; + allow_blank_fields => "true"; } -body edit_field col(split,col,newval,method) +body edit_field col(split, col, newval, method) # @brief Edit tabluar data with comma-separated sub-values # @param split The separator that defines columns # @param col The (1-based) index of the value to change # @param newval The new value # @param method The method by which to edit the field { - 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 edit_field line(split,col,newval,method) +body edit_field line(split, col, newval, method) # @brief Edit tabular data with space-separated sub-values # @param split The separator that defines columns # @param col The (1-based) index of the value to change # @param newval The new value # @param method The method by which to edit the field { - 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 replace_with text_between_match1_and_match2( _text ) +body replace_with text_between_match1_and_match2(_text) # @brief Replace matched line with substituted string # @param _text String to substitute between first and second match { - replace_value => "$(match.1)$(_text)$(match.2)"; - occurrences => "all"; + replace_value => "$(match.1)$(_text)$(match.2)"; + occurrences => "all"; } body replace_with value(x) # @brief Replace matching lines # @param x The replacement string { - replace_value => "$(x)"; - occurrences => "all"; + replace_value => "$(x)"; + occurrences => "all"; } body select_region INI_section(x) # @brief Restrict the `edit_line` promise to the lines in section `[x]` # @param x The name of the section in an INI-like configuration file { - select_start => "\[$(x)\]\s*"; - select_end => "\[.*\]\s*"; - + select_start => "\[$(x)\]\s*"; + select_end => "\[.*\]\s*"; @if minimum_version(3.10) - select_end_match_eof => "true"; + select_end_match_eof => "true"; @endif } @@ -1637,50 +1621,51 @@ body edit_defaults empty # # No backup is made { - empty_file_before_editing => "true"; - edit_backup => "false"; - #max_file_size => "300000"; + empty_file_before_editing => "true"; + edit_backup => "false"; + + #max_file_size => "300000"; } body location start # @brief Editing occurs before the matched line { - before_after => "before"; + before_after => "before"; } body location after(str) # @brief Editing occurs after the line matching `str` # @param str Regular expression matching the file line location { - before_after => "after"; - select_line_matching => "$(str)"; + before_after => "after"; + select_line_matching => "$(str)"; } body location before(str) # @brief Editing occurs before the line matching `str` # @param str Regular expression matching the file line location { - before_after => "before"; - select_line_matching => "$(str)"; + before_after => "before"; + select_line_matching => "$(str)"; } body replace_with comment(c) # @brief Comment all lines matching the pattern by preprending `c` # @param c The prefix that comments out lines { - replace_value => "$(c) $(match.1)"; - occurrences => "all"; + replace_value => "$(c) $(match.1)"; + occurrences => "all"; } body replace_with uncomment # @brief Uncomment all lines matching the pattern by removing # anything outside the matching string { - replace_value => "$(match.1)"; - occurrences => "all"; + replace_value => "$(match.1)"; + occurrences => "all"; } -body copy_from secure_cp(from,server) +body copy_from secure_cp(from, server) # @brief Download a file from a remote server over an encrypted channel # # Only copy the file if it is different from the local copy, and verify @@ -1689,25 +1674,25 @@ body copy_from secure_cp(from,server) # @param from The location of the file on the remote server # @param server The hostname or IP of the server from which to download { - source => "$(from)"; - servers => { "$(server)" }; - compare => "digest"; - encrypt => "true"; - verify => "true"; + source => "$(from)"; + servers => { "$(server)" }; + compare => "digest"; + encrypt => "true"; + verify => "true"; } -body copy_from remote_cp(from,server) +body copy_from remote_cp(from, server) # @brief Download a file from a remote server. # # @param from The location of the file on the remote server # @param server The hostname or IP of the server from which to download { - servers => { "$(server)" }; - source => "$(from)"; - compare => "mtime"; + servers => { "$(server)" }; + source => "$(from)"; + compare => "mtime"; } -body copy_from remote_dcp(from,server) +body copy_from remote_dcp(from, server) # @brief Download a file from a remote server if it is different from the local copy. # # @param from The location of the file on the remote server @@ -1715,9 +1700,9 @@ body copy_from remote_dcp(from,server) # # **See Also:** `local_dcp()` { - servers => { "$(server)" }; - source => "$(from)"; - compare => "digest"; + servers => { "$(server)" }; + source => "$(from)"; + compare => "digest"; } body copy_from local_cp(from) @@ -1738,7 +1723,7 @@ body copy_from local_cp(from) # # **See Also:** `local_dcp()` { - source => "$(from)"; + source => "$(from)"; } body copy_from local_dcp(from) @@ -1758,8 +1743,8 @@ body copy_from local_dcp(from) # # **See Also:** `local_cp()`, `remote_dcp()` { - source => "$(from)"; - compare => "digest"; + source => "$(from)"; + compare => "digest"; } body copy_from perms_cp(from) @@ -1767,8 +1752,8 @@ body copy_from perms_cp(from) # # @param from The path to the source file. { - source => "$(from)"; - preserve => "true"; + source => "$(from)"; + preserve => "true"; } body copy_from perms_dcp(from) @@ -1777,9 +1762,9 @@ body copy_from perms_dcp(from) # # @param from The path to the source file. { - source => "$(from)"; - preserve => "true"; - compare => "digest"; + source => "$(from)"; + preserve => "true"; + compare => "digest"; } body copy_from backup_local_cp(from) @@ -1787,8 +1772,8 @@ body copy_from backup_local_cp(from) # # @param from The path to the source file. { - source => "$(from)"; - copy_backup => "timestamp"; + source => "$(from)"; + copy_backup => "timestamp"; } body copy_from seed_cp(from) @@ -1811,11 +1796,11 @@ body copy_from seed_cp(from) # } # ``` { - source => "$(from)"; - compare => "exists"; + source => "$(from)"; + compare => "exists"; } -body copy_from sync_cp(from,server) +body copy_from sync_cp(from, server) # @brief Synchronize a file with a remote server. # # * If the file does not exist on the remote server then it should be purged. @@ -1839,11 +1824,11 @@ body copy_from sync_cp(from,server) # # **See Also:** `dir_sync()`, `copyfrom_sync()` { - servers => { "$(server)" }; - source => "$(from)"; - purge => "true"; - preserve => "true"; - type_check => "false"; + servers => { "$(server)" }; + source => "$(from)"; + purge => "true"; + preserve => "true"; + type_check => "false"; } body copy_from no_backup_cp(from) @@ -1851,8 +1836,8 @@ body copy_from no_backup_cp(from) # # @param from The path to the source file. { - source => "$(from)"; - copy_backup => "false"; + source => "$(from)"; + copy_backup => "false"; } body copy_from no_backup_cp_compare(from, comparison) @@ -1861,9 +1846,9 @@ body copy_from no_backup_cp_compare(from, comparison) # @param from The path to the source file. # @param comparison The comparison to use. (mtime|ctime|atime|exists|binary|hash|digest) { - source => "$(from)"; - copy_backup => "false"; - compare => "$(comparison)"; + source => "$(from)"; + copy_backup => "false"; + compare => "$(comparison)"; } body copy_from no_backup_dcp(from) @@ -1872,9 +1857,9 @@ body copy_from no_backup_dcp(from) # # @param from The path to the source file. { - source => "$(from)"; - copy_backup => "false"; - compare => "digest"; + source => "$(from)"; + copy_backup => "false"; + compare => "digest"; } body link_from linkfrom(source, type) @@ -1882,75 +1867,75 @@ body link_from linkfrom(source, type) # @param source link to this # @param type the link's type (`symlink` or `hardlink`) { - source => $(source); - link_type => $(type); + source => $(source); + link_type => $(type); } body perms m(mode) # @brief Set the file mode # @param mode The new mode { - mode => "$(mode)"; + mode => "$(mode)"; -#+begin_ENT-951 -# Remove after 3.20 is not supported - rxdirs => "true"; + #+begin_ENT-951 + # Remove after 3.20 is not supported + rxdirs => "true"; @if minimum_version(3.20) - rxdirs => "false"; + rxdirs => "false"; @endif -#+end + #+end } -body perms mo(mode,user) +body perms mo(mode, user) # @brief Set the file's mode and owners # @param mode The new mode # @param user The username of the new owner { - owners => { "$(user)" }; - mode => "$(mode)"; + owners => { "$(user)" }; + mode => "$(mode)"; -#+begin_ENT-951 -# Remove after 3.20 is not supported - rxdirs => "true"; + #+begin_ENT-951 + # Remove after 3.20 is not supported + rxdirs => "true"; @if minimum_version(3.20) - rxdirs => "false"; + rxdirs => "false"; @endif -#+end + #+end } -body perms mog(mode,user,group) +body perms mog(mode, user, group) # @brief Set the file's mode, owner and group # @param mode The new mode # @param user The username of the new owner # @param group The group name { - owners => { "$(user)" }; - groups => { "$(group)" }; - mode => "$(mode)"; + owners => { "$(user)" }; + groups => { "$(group)" }; + mode => "$(mode)"; -#+begin_ENT-951 -# Remove after 3.20 is not supported - rxdirs => "true"; + #+begin_ENT-951 + # Remove after 3.20 is not supported + rxdirs => "true"; @if minimum_version(3.20) - rxdirs => "false"; + rxdirs => "false"; @endif -#+end + #+end } -body perms og(u,g) +body perms og(u, g) # @brief Set the file's owner and group # @param u The username of the new owner # @param g The group name { - owners => { "$(u)" }; - groups => { "$(g)" }; + owners => { "$(u)" }; + groups => { "$(g)" }; } body perms owner(user) # @brief Set the file's owner # @param user The username of the new owner { - owners => { "$(user)" }; + owners => { "$(user)" }; } body perms system_owned(mode) @@ -1964,40 +1949,37 @@ body perms system_owned(mode) # "/etc/passwd" perms => system_owned("0644"); # ``` { - mode => "$(mode)"; + mode => "$(mode)"; -#+begin_ENT-951 -# Remove after 3.20 is not supported - rxdirs => "true"; + #+begin_ENT-951 + # Remove after 3.20 is not supported + rxdirs => "true"; @if minimum_version(3.20) - rxdirs => "false"; + rxdirs => "false"; @endif -#+end + #+end + !windows:: + owners => { "root" }; - !windows:: - owners => { "root" }; + windows:: + # NOTE: Setting owners will generate an error if the policy is not being + # executed as the user who's ownership is being targeted. While it seems + # that should typically be Administrator or SYSTEM, both are reported to + # result in errors by users, thus owners is currently omitted for Windows. + # ENT-9778 + groups => { "Administrators" }; - windows:: + freebsd|openbsd|netbsd|darwin:: + groups => { "wheel" }; - # NOTE: Setting owners will generate an error if the policy is not being - # executed as the user who's ownership is being targeted. While it seems - # that should typically be Administrator or SYSTEM, both are reported to - # result in errors by users, thus owners is currently omitted for Windows. + linux:: + groups => { "root" }; - # ENT-9778 - groups => { "Administrators" }; + solaris:: + groups => { "sys" }; - freebsd|openbsd|netbsd|darwin:: - groups => { "wheel" }; - - linux:: - groups => { "root" }; - - solaris:: - groups => { "sys" }; - - aix:: - groups => { "system" }; + aix:: + groups => { "system" }; } body depth_search recurse(d) @@ -2006,19 +1988,19 @@ body depth_search recurse(d) # # @param d The maximum search depth { - depth => "$(d)"; - xdev => "true"; + depth => "$(d)"; + xdev => "true"; } -body depth_search recurse_ignore(d,list) +body depth_search recurse_ignore(d, list) # @brief Search files and directories recursively, # but don't recurse into the specified directories # # @param d The maximum search depth # @param list The list of directories to be excluded { - depth => "$(d)"; - exclude_dirs => { @(list) }; + depth => "$(d)"; + exclude_dirs => { @(list) }; } body depth_search recurse_with_base(d) @@ -2028,34 +2010,34 @@ body depth_search recurse_with_base(d) # # @param d The maximum search depth { - depth => "$(d)"; - xdev => "true"; - include_basedir => "true"; + depth => "$(d)"; + xdev => "true"; + include_basedir => "true"; } body delete tidy # @brief Delete the file and remove empty directories # and links to directories { - dirlinks => "delete"; - rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } body file_select all # @brief Select all file system entries { - leaf_name => { ".*" }; - file_result => "leaf_name"; + leaf_name => { ".*" }; + file_result => "leaf_name"; } body changes all_changes # @brief Detect all file changes using sha256 # and report the diff to CFEngine Enterprise { - hash => "sha256"; - report_changes => "all"; - report_diffs => "true"; - update_hashes => "yes"; + hash => "sha256"; + report_changes => "all"; + report_diffs => "true"; + update_hashes => "yes"; } bundle agent file_mustache(mustache_file, json_file, target_file) @@ -2072,7 +2054,7 @@ bundle agent file_mustache(mustache_file, json_file, target_file) # ``` { files: - "$(target_file)" + "$(target_file)" create => "true", edit_template => $(mustache_file), template_data => readjson($(json_file), "100k"), @@ -2093,7 +2075,7 @@ bundle agent file_mustache_jsonstring(mustache_file, json_string, target_file) # ``` { files: - "$(target_file)" + "$(target_file)" create => "true", edit_template => $(mustache_file), template_data => parsejson($(json_string)), @@ -2112,7 +2094,7 @@ bundle agent file_tidy(file) # ``` { files: - "$(file)" delete => tidy; + "$(file)" delete => tidy; reports: "DEBUG|DEBUG_$(this.bundle)":: @@ -2132,7 +2114,7 @@ bundle agent dir_sync(from, to) # ``` { files: - "$(to)/." + "$(to)/." create => "true", depth_search => recurse("inf"), copy_from => copyfrom_sync($(from)); @@ -2155,8 +2137,7 @@ bundle agent file_copy(from, to) # ``` { files: - "$(to)" - copy_from => copyfrom_sync($(from)); + "$(to)" copy_from => copyfrom_sync($(from)); reports: "DEBUG|DEBUG_$(this.bundle)":: @@ -2167,11 +2148,11 @@ body copy_from copyfrom_sync(f) # @brief Copy a directory or file with digest checksums, preserving attributes and purging leftovers # @param f the file or directory { - source => "$(f)"; - purge => "true"; - preserve => "true"; - type_check => "false"; - compare => "digest"; + source => "$(f)"; + purge => "true"; + preserve => "true"; + type_check => "false"; + compare => "digest"; } bundle agent file_make(file, str) @@ -2188,16 +2169,19 @@ bundle agent file_make(file, str) # ``` { vars: - "len" int => string_length($(str)); + "len" int => string_length($(str)); + summarize:: - "summary" string => format("%s...%s", - string_head($(str), 18), - string_tail($(str), 18)); + "summary" + string => format( + "%s...%s", string_head($(str), 18), string_tail($(str), 18) + ); + classes: - "summarize" expression => isgreaterthan($(len), 40); + "summarize" expression => isgreaterthan($(len), 40); files: - "$(file)" + "$(file)" create => "true", edit_line => insert_lines($(str)), edit_defaults => empty; @@ -2205,10 +2189,10 @@ bundle agent file_make(file, str) reports: "DEBUG|DEBUG_$(this.bundle)":: "DEBUG $(this.bundle): creating $(file) with contents '$(str)'" - if => "!summarize"; + if => "!summarize"; "DEBUG $(this.bundle): creating $(file) with contents '$(summary)'" - if => "summarize"; + if => "summarize"; } bundle agent file_make_mog(file, str, mode, owner, group) @@ -2228,16 +2212,19 @@ bundle agent file_make_mog(file, str, mode, owner, group) # ``` { vars: - "len" int => string_length($(str)); + "len" int => string_length($(str)); + summarize:: - "summary" string => format("%s...%s", - string_head($(str), 18), - string_tail($(str), 18)); + "summary" + string => format( + "%s...%s", string_head($(str), 18), string_tail($(str), 18) + ); + classes: - "summarize" expression => isgreaterthan($(len), 40); + "summarize" expression => isgreaterthan($(len), 40); files: - "$(file)" + "$(file)" create => "true", edit_line => insert_lines($(str)), perms => mog($(mode), $(owner), $(group)), @@ -2246,10 +2233,10 @@ bundle agent file_make_mog(file, str, mode, owner, group) reports: "DEBUG|DEBUG_$(this.bundle)":: "DEBUG $(this.bundle): creating $(file) with contents '$(str)', mode '$(mode)', owner '$(owner)' and group '$(group)'" - if => "!summarize"; + if => "!summarize"; "DEBUG $(this.bundle): creating $(file) with contents '$(summary)', mode '$(mode)', owner '$(owner)' and group '$(group)'" - if => "summarize"; + if => "summarize"; } bundle agent file_make_mustache(file, template, data) @@ -2269,14 +2256,14 @@ bundle agent file_make_mustache(file, template, data) # ``` { files: - "$(file)" - create => "true", - edit_template => "$(template)", - template_method => "mustache", - template_data => @(data); + "$(file)" + create => "true", + edit_template => "$(template)", + template_method => "mustache", + template_data => @(data); reports: - "DEBUG|DEBUG_$(this.bundle)":: + "DEBUG|DEBUG_$(this.bundle)":: "DEBUG $(this.bundle): rendering $(file) with template '$(template)'"; } @@ -2301,15 +2288,15 @@ bundle agent file_make_mustache_with_perms(file, template, data, mode, owner, gr # ``` { files: - "$(file)" - create => "true", - edit_template => "$(template)", - template_method => "mustache", - perms => mog( $(mode), $(owner), $(group) ), - template_data => @(data); + "$(file)" + create => "true", + edit_template => "$(template)", + template_method => "mustache", + perms => mog($(mode), $(owner), $(group)), + template_data => @(data); reports: - "DEBUG|DEBUG_$(this.bundle)":: + "DEBUG|DEBUG_$(this.bundle)":: "DEBUG $(this.bundle): rendering $(file) with template '$(template)'"; } @@ -2325,7 +2312,7 @@ bundle agent file_empty(file) # ``` { files: - "$(file)" + "$(file)" create => "true", edit_defaults => empty; @@ -2347,7 +2334,7 @@ bundle agent file_hardlink(target, link) # ``` { files: - "$(link)" + "$(link)" move_obstructions => "true", link_from => linkfrom($(target), "hardlink"); @@ -2369,7 +2356,7 @@ bundle agent file_link(target, link) # ``` { files: - "$(link)" + "$(link)" move_obstructions => "true", link_from => linkfrom($(target), "symlink"); @@ -2384,7 +2371,6 @@ bundle edit_line create_solaris_admin_file # See unit examples. { insert_lines: - - "$(solaris_knowledge.admin_nocheck)" + "$(solaris_knowledge.admin_nocheck)" comment => "Insert contents of Solaris admin file (automatically install packages)"; } diff --git a/tests/acceptance/selftest/flakey_meta_fail.cf b/tests/acceptance/selftest/flakey_meta_fail.cf index 9f1d6a4b56..163e123fcb 100644 --- a/tests/acceptance/selftest/flakey_meta_fail.cf +++ b/tests/acceptance/selftest/flakey_meta_fail.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 test { meta: - "test_flakey_fail" string => "any", + "test_flakey_fail" + string => "any", meta => { "ENT-6947" }; } diff --git a/tests/acceptance/selftest/flakey_meta_no_ticket.cf b/tests/acceptance/selftest/flakey_meta_no_ticket.cf index 084c77419b..12583441c3 100644 --- a/tests/acceptance/selftest/flakey_meta_no_ticket.cf +++ b/tests/acceptance/selftest/flakey_meta_no_ticket.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 test diff --git a/tests/acceptance/selftest/skipped.cf b/tests/acceptance/selftest/skipped.cf index a90caa0848..00d9315850 100644 --- a/tests/acceptance/selftest/skipped.cf +++ b/tests/acceptance/selftest/skipped.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 test diff --git a/tests/acceptance/selftest/soft_no_ticket.cf b/tests/acceptance/selftest/soft_no_ticket.cf index 6e5ce0f3ea..4e49dc4feb 100644 --- a/tests/acceptance/selftest/soft_no_ticket.cf +++ b/tests/acceptance/selftest/soft_no_ticket.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 test diff --git a/tests/stress/american_psycho.cf b/tests/stress/american_psycho.cf index 7f83abc518..3493b2a25a 100644 --- a/tests/stress/american_psycho.cf +++ b/tests/stress/american_psycho.cf @@ -1,47 +1,36 @@ # It might be interesting to run some of these with action => background to test parralism # might be good to have a test to create large files (over 100M) and very large files (over 1G) and copy_from on those, especially when using compare digest, encrypt and verify - bundle agent stress { - vars: "large_number" string => "1834", comment => "values larger than this generate a segfault in execresult for seq"; methods: - STRESS_DEFINE_CLASSES:: - "define_classes" - usebundle => define_classes; + "define_classes" usebundle => define_classes; STRESS_COMMANDS_ECHO:: - "commands_echo" - usebundle => commands_echo; + "commands_echo" usebundle => commands_echo; STRESS_DEFINE_VARIABLES:: - "define_variables" - usebundle => define_variables; + "define_variables" usebundle => define_variables; STRESS_EXECRESULT_ECHO_NOSHELL:: - "execresult_echo_noshell" - usebundle => execresult_echo_noshell; + "execresult_echo_noshell" usebundle => execresult_echo_noshell; STRESS_EXECRESULT_ECHO_USESHELL:: - "execresult_echo_useshell" - usebundle => execresult_echo_useshell; + "execresult_echo_useshell" usebundle => execresult_echo_useshell; STRESS_DEFINE_PERSISTENT_CLASSES:: - "define_persistent_classes" - usebundle => define_persistent_classes; + "define_persistent_classes" usebundle => define_persistent_classes; STRESS_NESTED_USEBUNDLE:: - "nested_usebundle" - usebundle => nested_usebundle; + "nested_usebundle" usebundle => nested_usebundle; STRESS_COPY_FROM_INIT:: - "copy_from_init" - usebundle => copy_from_init; + "copy_from_init" usebundle => copy_from_init; STRESS_COPY_MANY_FILES_TO_MANY_FILES:: "copy_many_files_to_many_files" @@ -55,30 +44,33 @@ bundle common knowledge "echo" string => "/bin/echo"; "bc" string => "/usr/bin/bc -l"; - "range" string => execresult("$(knowledge.seq) $(stress.large_number)", "noshell"); - "range_list" slist => splitstring("$(range)", $(const.n), "$(stress.large_number)"); + "range" + string => execresult( + "$(knowledge.seq) $(stress.large_number)", "noshell" + ); + + "range_list" + slist => splitstring("$(range)", $(const.n), "$(stress.large_number)"); } bundle agent define_classes { - classes: + classes: "$(this.bundle)_class_$(knowledge.range_list)" expression => "any"; reports: DEBUG:: - "$(this.bundle): Defined $(this.bundle)_class_$(knowledge.range_list)"; + "$(this.bundle): Defined $(this.bundle)_class_$(knowledge.range_list)"; } bundle agent commands_echo { commands: - "$(knowledge.echo)" - args => "$(this.bundle): $(knowledge.range_list)"; + "$(knowledge.echo)" args => "$(this.bundle): $(knowledge.range_list)"; reports: DEBUG:: - "$(this.bundle) Called $(knowledge.echo) $(this.bundle): $(knowledge.range_list)"; - + "$(this.bundle) Called $(knowledge.echo) $(this.bundle): $(knowledge.range_list)"; } bundle agent define_variables @@ -88,29 +80,33 @@ bundle agent define_variables reports: DEBUG:: - "$(this.bundle) Defined var_$(knowledge.range_list)"; + "$(this.bundle) Defined var_$(knowledge.range_list)"; } bundle agent execresult_echo_noshell { vars: "var_$(knowledge.range_list)" - string => execresult("$(knowledge.echo) $(this.bundle): $(knowledge.range_list)", "noshell"); + string => execresult( + "$(knowledge.echo) $(this.bundle): $(knowledge.range_list)", "noshell" + ); reports: DEBUG:: - "$(this.bundle) Defined var_$(knowledge.echo) with value $(var_$(knowledge.range_list))"; + "$(this.bundle) Defined var_$(knowledge.echo) with value $(var_$(knowledge.range_list))"; } bundle agent execresult_echo_useshell { vars: "var_$(knowledge.range_list)" - string => execresult("$(knowledge.echo) $(this.bundle): $(knowledge.range_list)", "useshell"); + string => execresult( + "$(knowledge.echo) $(this.bundle): $(knowledge.range_list)", "useshell" + ); reports: DEBUG:: - "$(this.bundle) Defined var_$(knowledge.echo) with value $(var_$(knowledge.range_list))"; + "$(this.bundle) Defined var_$(knowledge.echo) with value $(var_$(knowledge.range_list))"; } bundle agent define_persistent_classes @@ -122,8 +118,7 @@ bundle agent define_persistent_classes reports: DEBUG:: - "$(this.bundle): Defined persistent_$(this.bundle)_class_$(knowledge.range_list)"; - + "$(this.bundle): Defined persistent_$(this.bundle)_class_$(knowledge.range_list)"; } bundle agent nested_usebundle @@ -138,14 +133,17 @@ bundle agent nested_usebundle_param(number) # called with this bundle call will generate a segfault relatively quickly { vars: - "half" string => execresult("$(knowledge.echo) $(number)/1.2 | $(knowledge.bc)", "useshell"); + "half" + string => execresult( + "$(knowledge.echo) $(number)/1.2 | $(knowledge.bc)", "useshell" + ); methods: - "call myself inderectly" - usebundle => nested_usebundle_param($(half)); + "call myself inderectly" usebundle => nested_usebundle_param($(half)); reports: "$(knowledge.echo) $(number)/1.2 | $(knowledge.bc)"; + "$(this.bundle): '$(knowledge.echo) $(number)/1.2 | $(knowledge.bc)' = $(half)" action => immediate; } @@ -156,24 +154,24 @@ bundle agent copy_from_init "copy_from_source_path" string => "/var/cfengine/masterfiles/"; "copy_from_single_file" string => "$(copy_from_source_path)/promises.cf"; - files: "$(copy_from_source_path)/$(knowledge.range_list).txt" copy_from => local_cp("$(copy_from_single_file)"); - "/tmp/$(knowledge.range_list)" - delete => tidy; - + "/tmp/$(knowledge.range_list)" delete => tidy; } bundle agent copy_many_files_to_many_files { files: "/tmp/$(knowledge.range_list)" - copy_from => secure_cp("$(copy_from_init.copy_from_source_path)/$(knowledge.range_list).txt", $(sys.uqhost)), + copy_from => secure_cp( + "$(copy_from_init.copy_from_source_path)/$(knowledge.range_list).txt", + $(sys.uqhost) + ), classes => classes_generic("$(this.bundle)_tmp_$(knowledge.range_list)"); - # if you use 'generic' as the classes body here the agent aborts, need acceptance test. + # if you use 'generic' as the classes body here the agent aborts, need acceptance test. reports: DEBUG:: "$(this.bundle): copied $(copy_from_init.copy_from_source_path)/$(knowledge.range_list).txt to /tmp/$(knowledge.range_list)" @@ -183,45 +181,70 @@ bundle agent copy_many_files_to_many_files body classes classes_generic(x) # Define x prefixed/suffixed with promise outcome { - 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" }; + 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", + }; } body copy_from local_cp(from) { -source => "$(from)"; + source => "$(from)"; } body delete tidy { -dirlinks => "delete"; -rmdirs => "true"; + dirlinks => "delete"; + rmdirs => "true"; } -body copy_from secure_cp(from,server) +body copy_from secure_cp(from, server) { -source => "$(from)"; -servers => { "$(server)" }; -compare => "digest"; -encrypt => "true"; -verify => "true"; + source => "$(from)"; + servers => { "$(server)" }; + compare => "digest"; + encrypt => "true"; + verify => "true"; } - - body action immediate { -ifelapsed => "0"; + ifelapsed => "0"; } - body classes persist(class, minutes) { promise_kept => { @(class) }; promise_repaired => { @(class) }; persist_time => "$(minutes)"; } - diff --git a/tests/unit/data/benchmark.cf b/tests/unit/data/benchmark.cf index 52c8d66921..0d455a1e78 100644 --- a/tests/unit/data/benchmark.cf +++ b/tests/unit/data/benchmark.cf @@ -1,38 +1,36 @@ # This file is intended to have as much feature variation as possible, # while still being correct. - body common control { - bundlesequence => { "main" }; + bundlesequence => { "main" }; } bundle agent main { reports: cfengine:: - "Hello, CFEngine" - friend_pattern => hash("abc", "md5"); + "Hello, CFEngine" friend_pattern => hash("abc", "md5"); + any:: - "Hello, world" - friend_pattern => hash("abc", "md5"); + "Hello, world" friend_pattern => hash("abc", "md5"); files: - "/tmp/stuff" -> { "stakeholder" } + "/tmp/stuff" -> { "stakeholder" } create => "true", perms => myperms; processes: - "/bin/stuff" -> { "stakeholder" } + "/bin/stuff" -> { "stakeholder" } process_count => any_count("stuff_running"); } body process_count any_count(cl) { - match_range => "0,0"; - out_of_range_define => { "$(cl)" }; + match_range => "0,0"; + out_of_range_define => { "$(cl)" }; } body perms myperms { - mode => "555"; + mode => "555"; } diff --git a/tests/unit/data/benchmark.json b/tests/unit/data/benchmark.json index 8d0917fb2f..5f6280456a 100644 --- a/tests/unit/data/benchmark.json +++ b/tests/unit/data/benchmark.json @@ -1,186 +1,156 @@ { - "bundles": [ + "bundles": [ + { + "sourcePath": "tests/unit/data/benchmark.cf", + "line": 9, + "namespace": "default", + "name": "main", + "bundleType": "agent", + "arguments": [], + "promiseTypes": [ { - "sourcePath": "tests/unit/data/benchmark.cf", - "line": 9, - "namespace": "default", - "name": "main", - "bundleType": "agent", - "arguments": [], - "promiseTypes": [ + "line": 11, + "name": "reports", + "contexts": [ + { + "name": "cfengine", + "promises": [ { - "line": 11, - "name": "reports", - "contexts": [ - { - "name": "cfengine", - "promises": [ - { - "line": 13, - "promiser": "Hello, CFEngine", - "attributes": [ - { - "line": 14, - "lval": "friend_pattern", - "rval": { - "type": "functionCall", - "name": "hash", - "arguments": [ - { - "type": "string", - "value": "abc" - }, - { - "type": "string", - "value": "md5" - } - ] - } - } - ] - } - ] - }, - { - "name": "any", - "promises": [ - { - "line": 16, - "promiser": "Hello, world", - "attributes": [ - { - "line": 17, - "lval": "friend_pattern", - "rval": { - "type": "functionCall", - "name": "hash", - "arguments": [ - { - "type": "string", - "value": "abc" - }, - { - "type": "string", - "value": "md5" - } - ] - } - } - ] - } - ] - } - ] - }, - { - "line": 19, - "name": "files", - "contexts": [ - { - "name": "any", - "promises": [ - { - "line": 20, - "promiser": "/tmp/stuff", - "promisee": [ - "stakeholder" - ], - "attributes": [ - { - "line": 21, - "lval": "create", - "rval": { - "type": "string", - "value": "true" - } - }, - { - "line": 22, - "lval": "perms", - "rval": { - "type": "symbol", - "value": "myperms" - } - } - ] - } - ] - } - ] - }, + "line": 13, + "promiser": "Hello, CFEngine", + "attributes": [ + { + "line": 14, + "lval": "friend_pattern", + "rval": { + "type": "functionCall", + "name": "hash", + "arguments": [ + { "type": "string", "value": "abc" }, + { "type": "string", "value": "md5" } + ] + } + } + ] + } + ] + }, + { + "name": "any", + "promises": [ { - "line": 24, - "name": "processes", - "contexts": [ - { - "name": "any", - "promises": [ - { - "line": 25, - "promiser": "/bin/stuff", - "promisee": [ - "stakeholder" - ], - "attributes": [] - } - ] - } - ] + "line": 16, + "promiser": "Hello, world", + "attributes": [ + { + "line": 17, + "lval": "friend_pattern", + "rval": { + "type": "functionCall", + "name": "hash", + "arguments": [ + { "type": "string", "value": "abc" }, + { "type": "string", "value": "md5" } + ] + } + } + ] } - ] - } - ], - "bodies": [ + ] + } + ] + }, { - "sourcePath": "tests/unit/data/benchmark.cf", - "line": 4, - "namespace": "default", - "name": "control", - "bodyType": "common", - "arguments": [], - "contexts": [ + "line": 19, + "name": "files", + "contexts": [ + { + "name": "any", + "promises": [ { - "name": "any", - "attributes": [ - { - "line": 6, - "lval": "bundlesequence", - "rval": { - "type": "list", - "value": [ - { - "type": "string", - "value": "main" - } - ] - } - } - ] + "line": 20, + "promiser": "/tmp/stuff", + "promisee": ["stakeholder"], + "attributes": [ + { + "line": 21, + "lval": "create", + "rval": { "type": "string", "value": "true" } + }, + { + "line": 22, + "lval": "perms", + "rval": { "type": "symbol", "value": "myperms" } + } + ] } - ] + ] + } + ] }, { - "sourcePath": "tests/unit/data/benchmark.cf", - "line": 28, - "namespace": "default", - "name": "myperms", - "bodyType": "perms", - "arguments": [], - "contexts": [ + "line": 24, + "name": "processes", + "contexts": [ + { + "name": "any", + "promises": [ { - "name": "any", - "attributes": [ - { - "line": 30, - "lval": "mode", - "rval": { - "type": "string", - "value": "555" - } - } - ] + "line": 25, + "promiser": "/bin/stuff", + "promisee": ["stakeholder"], + "attributes": [] } - ] + ] + } + ] + } + ] + } + ], + "bodies": [ + { + "sourcePath": "tests/unit/data/benchmark.cf", + "line": 4, + "namespace": "default", + "name": "control", + "bodyType": "common", + "arguments": [], + "contexts": [ + { + "name": "any", + "attributes": [ + { + "line": 6, + "lval": "bundlesequence", + "rval": { + "type": "list", + "value": [{ "type": "string", "value": "main" }] + } + } + ] + } + ] + }, + { + "sourcePath": "tests/unit/data/benchmark.cf", + "line": 28, + "namespace": "default", + "name": "myperms", + "bodyType": "perms", + "arguments": [], + "contexts": [ + { + "name": "any", + "attributes": [ + { + "line": 30, + "lval": "mode", + "rval": { "type": "string", "value": "555" } + } + ] } - ] + ] + } + ] } diff --git a/tests/unit/data/body_edit_line_common_constraints.cf b/tests/unit/data/body_edit_line_common_constraints.cf index 398d14645b..23c67e749e 100644 --- a/tests/unit/data/body_edit_line_common_constraints.cf +++ b/tests/unit/data/body_edit_line_common_constraints.cf @@ -1,6 +1,5 @@ bundle edit_line test { delete_lines: - "abc" - select_region => test_select; + "abc" select_region => test_select; } diff --git a/tests/unit/data/body_edit_xml_common_constraints.cf b/tests/unit/data/body_edit_xml_common_constraints.cf index 58bff998c5..fcfbbe6ab1 100644 --- a/tests/unit/data/body_edit_xml_common_constraints.cf +++ b/tests/unit/data/body_edit_xml_common_constraints.cf @@ -1,6 +1,5 @@ bundle edit_xml test { build_xpath: - "foo" - select_xpath => "abc"; + "foo" select_xpath => "abc"; } diff --git a/tests/unit/data/body_executor_control_agent_expireafter_only.cf b/tests/unit/data/body_executor_control_agent_expireafter_only.cf index f77b10500d..cc82641905 100644 --- a/tests/unit/data/body_executor_control_agent_expireafter_only.cf +++ b/tests/unit/data/body_executor_control_agent_expireafter_only.cf @@ -1,4 +1,4 @@ body executor control { - agent_expireafter => "121"; + agent_expireafter => "121"; } diff --git a/tests/unit/data/body_executor_control_full.cf b/tests/unit/data/body_executor_control_full.cf index 66fad8cdb3..74ca1957ed 100644 --- a/tests/unit/data/body_executor_control_full.cf +++ b/tests/unit/data/body_executor_control_full.cf @@ -1,13 +1,13 @@ body executor control { - splaytime => "1"; - mailto => "cfengine_mail@example.org"; - mailfrom => "cfengine@example.org"; - mailsubject => "Test [localhost/127.0.0.1]"; - smtpserver => "localhost"; - mailmaxlines => "50"; - schedule => { "Min00_05", "Min05_10" }; - executorfacility => "LOG_LOCAL6"; - agent_expireafter => "120"; - exec_command => "/bin/echo"; + splaytime => "1"; + mailto => "cfengine_mail@example.org"; + mailfrom => "cfengine@example.org"; + mailsubject => "Test [localhost/127.0.0.1]"; + smtpserver => "localhost"; + mailmaxlines => "50"; + schedule => { "Min00_05", "Min05_10" }; + executorfacility => "LOG_LOCAL6"; + agent_expireafter => "120"; + exec_command => "/bin/echo"; } diff --git a/tests/unit/data/body_redefinition.cf b/tests/unit/data/body_redefinition.cf index bf1fe68734..f06fbe8d30 100644 --- a/tests/unit/data/body_redefinition.cf +++ b/tests/unit/data/body_redefinition.cf @@ -1,9 +1,9 @@ body agent control { - ifelapsed => "60"; + ifelapsed => "60"; } body agent control { - ifelapsed => "120"; + ifelapsed => "120"; } diff --git a/tests/unit/data/bundle_custom_promise_type.cf b/tests/unit/data/bundle_custom_promise_type.cf index 2ab37741d7..ca278c36c2 100644 --- a/tests/unit/data/bundle_custom_promise_type.cf +++ b/tests/unit/data/bundle_custom_promise_type.cf @@ -2,6 +2,6 @@ # defined in another policy file bundle agent foo { -custom_promise_type: - "var" string => "test"; + custom_promise_type: + "var" string => "test"; } diff --git a/tests/unit/data/constraint_comment_nonscalar.cf b/tests/unit/data/constraint_comment_nonscalar.cf index e935dc2e7d..da7243eb4a 100644 --- a/tests/unit/data/constraint_comment_nonscalar.cf +++ b/tests/unit/data/constraint_comment_nonscalar.cf @@ -1,6 +1,5 @@ bundle agent foo { reports: - "hello" - comment => { "a" }; + "hello" comment => { "a" }; } diff --git a/tests/unit/data/methods_invalid_arity.cf b/tests/unit/data/methods_invalid_arity.cf index 2b1188cb0f..aae9ad1791 100644 --- a/tests/unit/data/methods_invalid_arity.cf +++ b/tests/unit/data/methods_invalid_arity.cf @@ -8,6 +8,5 @@ bundle agent foo(one, two) bundle agent bar { methods: - "any" - usebundle => foo("snookie"); + "any" usebundle => foo("snookie"); } diff --git a/tests/unit/data/mustache_comments.json b/tests/unit/data/mustache_comments.json index eb2fc158f9..6cd078f7c1 100644 --- a/tests/unit/data/mustache_comments.json +++ b/tests/unit/data/mustache_comments.json @@ -1,83 +1,83 @@ { - "__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.", - "overview": "Comment tags represent content that should never appear in the resulting\noutput.\n\nThe tag's content may contain any substring (including newlines) EXCEPT the\nclosing delimiter.\n\nComment tags SHOULD be treated as standalone when appropriate.\n", - "tests": [ - { - "name": "Inline", - "data": {}, - "expected": "1234567890", - "template": "12345{{! Comment Block! }}67890", - "desc": "Comment blocks should be removed from the template." - }, - { - "name": "Multiline", - "data": {}, - "expected": "1234567890\n", - "template": "12345{{!\n This is a\n multi-line comment...\n}}67890\n", - "desc": "Multiline comments should be permitted." - }, - { - "name": "Standalone", - "data": {}, - "expected": "Begin.\nEnd.\n", - "template": "Begin.\n{{! Comment Block! }}\nEnd.\n", - "desc": "All standalone comment lines should be removed." - }, - { - "name": "Indented Standalone", - "data": {}, - "expected": "Begin.\nEnd.\n", - "template": "Begin.\n {{! Indented Comment Block! }}\nEnd.\n", - "desc": "All standalone comment lines should be removed." - }, - { - "name": "Standalone Line Endings", - "data": {}, - "expected": "|\r\n|", - "template": "|\r\n{{! Standalone Comment }}\r\n|", - "desc": "\"\\r\\n\" should be considered a newline for standalone tags." - }, - { - "name": "Standalone Without Previous Line", - "data": {}, - "expected": "!", - "template": " {{! I'm Still Standalone }}\n!", - "desc": "Standalone tags should not require a newline to precede them." - }, - { - "name": "Standalone Without Newline", - "data": {}, - "expected": "!\n", - "template": "!\n {{! I'm Still Standalone }}", - "desc": "Standalone tags should not require a newline to follow them." - }, - { - "name": "Multiline Standalone", - "data": {}, - "expected": "Begin.\nEnd.\n", - "template": "Begin.\n{{!\nSomething's going on here...\n}}\nEnd.\n", - "desc": "All standalone comment lines should be removed." - }, - { - "name": "Indented Multiline Standalone", - "data": {}, - "expected": "Begin.\nEnd.\n", - "template": "Begin.\n {{!\n Something's going on here...\n }}\nEnd.\n", - "desc": "All standalone comment lines should be removed." - }, - { - "name": "Indented Inline", - "data": {}, - "expected": " 12 \n", - "template": " 12 {{! 34 }}\n", - "desc": "Inline comments should not strip whitespace" - }, - { - "name": "Surrounding Whitespace", - "data": {}, - "expected": "12345 67890", - "template": "12345 {{! Comment Block! }} 67890", - "desc": "Comment removal should preserve surrounding whitespace." - } - ] + "__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.", + "overview": "Comment tags represent content that should never appear in the resulting\noutput.\n\nThe tag's content may contain any substring (including newlines) EXCEPT the\nclosing delimiter.\n\nComment tags SHOULD be treated as standalone when appropriate.\n", + "tests": [ + { + "name": "Inline", + "data": {}, + "expected": "1234567890", + "template": "12345{{! Comment Block! }}67890", + "desc": "Comment blocks should be removed from the template." + }, + { + "name": "Multiline", + "data": {}, + "expected": "1234567890\n", + "template": "12345{{!\n This is a\n multi-line comment...\n}}67890\n", + "desc": "Multiline comments should be permitted." + }, + { + "name": "Standalone", + "data": {}, + "expected": "Begin.\nEnd.\n", + "template": "Begin.\n{{! Comment Block! }}\nEnd.\n", + "desc": "All standalone comment lines should be removed." + }, + { + "name": "Indented Standalone", + "data": {}, + "expected": "Begin.\nEnd.\n", + "template": "Begin.\n {{! Indented Comment Block! }}\nEnd.\n", + "desc": "All standalone comment lines should be removed." + }, + { + "name": "Standalone Line Endings", + "data": {}, + "expected": "|\r\n|", + "template": "|\r\n{{! Standalone Comment }}\r\n|", + "desc": "\"\\r\\n\" should be considered a newline for standalone tags." + }, + { + "name": "Standalone Without Previous Line", + "data": {}, + "expected": "!", + "template": " {{! I'm Still Standalone }}\n!", + "desc": "Standalone tags should not require a newline to precede them." + }, + { + "name": "Standalone Without Newline", + "data": {}, + "expected": "!\n", + "template": "!\n {{! I'm Still Standalone }}", + "desc": "Standalone tags should not require a newline to follow them." + }, + { + "name": "Multiline Standalone", + "data": {}, + "expected": "Begin.\nEnd.\n", + "template": "Begin.\n{{!\nSomething's going on here...\n}}\nEnd.\n", + "desc": "All standalone comment lines should be removed." + }, + { + "name": "Indented Multiline Standalone", + "data": {}, + "expected": "Begin.\nEnd.\n", + "template": "Begin.\n {{!\n Something's going on here...\n }}\nEnd.\n", + "desc": "All standalone comment lines should be removed." + }, + { + "name": "Indented Inline", + "data": {}, + "expected": " 12 \n", + "template": " 12 {{! 34 }}\n", + "desc": "Inline comments should not strip whitespace" + }, + { + "name": "Surrounding Whitespace", + "data": {}, + "expected": "12345 67890", + "template": "12345 {{! Comment Block! }} 67890", + "desc": "Comment removal should preserve surrounding whitespace." + } + ] } diff --git a/tests/unit/data/mustache_delimiters.json b/tests/unit/data/mustache_delimiters.json index de1c22ba0a..803f1795f6 100644 --- a/tests/unit/data/mustache_delimiters.json +++ b/tests/unit/data/mustache_delimiters.json @@ -1,77 +1,67 @@ { - "tests": [ - { - "name": "Pair Behavior", - "data": { - "text": "Hey!" - }, - "expected": "(Hey!)", - "template": "{{=<% %>=}}(<%text%>)", - "desc": "The equals sign (used on both sides) should permit delimiter changes." - }, - { - "name": "Special Characters", - "data": { - "text": "It worked!" - }, - "expected": "(It worked!)", - "template": "({{=[ ]=}}[text])", - "desc": "Characters with special meaning regexen should be valid delimiters." - }, - { - "name": "Sections", - "data": { - "section": true, - "data": "I got interpolated." - }, - "expected": "[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n", - "template": "[\n{{#section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|#section|\n {{data}}\n |data|\n|/section|\n]\n", - "desc": "Delimiters set outside sections should persist." - }, - { - "name": "Inverted Sections", - "data": { - "section": false, - "data": "I got interpolated." - }, - "expected": "[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n", - "template": "[\n{{^section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|^section|\n {{data}}\n |data|\n|/section|\n]\n", - "desc": "Delimiters set outside inverted sections should persist." - }, - { - "name": "Surrounding Whitespace", - "data": {}, - "expected": "| |", - "template": "| {{=@ @=}} |", - "desc": "Surrounding whitespace should be left untouched." - }, - { - "name": "Outlying Whitespace (Inline)", - "data": {}, - "expected": " | \n", - "template": " | {{=@ @=}}\n", - "desc": "Whitespace should be left untouched." - }, - { - "name": "Standalone Tag", - "data": {}, - "expected": "Begin.\nEnd.\n", - "template": "Begin.\n{{=@ @=}}\nEnd.\n", - "desc": "Standalone lines should be removed from the template." - }, - { - "name": "Indented Standalone Tag", - "data": {}, - "expected": "Begin.\nEnd.\n", - "template": "Begin.\n {{=@ @=}}\nEnd.\n", - "desc": "Indented standalone lines should be removed from the template." - }, - { - "name": "Pair with Padding", - "data": {}, - "expected": "||", - "template": "|{{= @ @ =}}|", - "desc": "Superfluous in-tag whitespace should be ignored." - } - ] + "tests": [ + { + "name": "Pair Behavior", + "data": { "text": "Hey!" }, + "expected": "(Hey!)", + "template": "{{=<% %>=}}(<%text%>)", + "desc": "The equals sign (used on both sides) should permit delimiter changes." + }, + { + "name": "Special Characters", + "data": { "text": "It worked!" }, + "expected": "(It worked!)", + "template": "({{=[ ]=}}[text])", + "desc": "Characters with special meaning regexen should be valid delimiters." + }, + { + "name": "Sections", + "data": { "section": true, "data": "I got interpolated." }, + "expected": "[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n", + "template": "[\n{{#section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|#section|\n {{data}}\n |data|\n|/section|\n]\n", + "desc": "Delimiters set outside sections should persist." + }, + { + "name": "Inverted Sections", + "data": { "section": false, "data": "I got interpolated." }, + "expected": "[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n", + "template": "[\n{{^section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|^section|\n {{data}}\n |data|\n|/section|\n]\n", + "desc": "Delimiters set outside inverted sections should persist." + }, + { + "name": "Surrounding Whitespace", + "data": {}, + "expected": "| |", + "template": "| {{=@ @=}} |", + "desc": "Surrounding whitespace should be left untouched." + }, + { + "name": "Outlying Whitespace (Inline)", + "data": {}, + "expected": " | \n", + "template": " | {{=@ @=}}\n", + "desc": "Whitespace should be left untouched." + }, + { + "name": "Standalone Tag", + "data": {}, + "expected": "Begin.\nEnd.\n", + "template": "Begin.\n{{=@ @=}}\nEnd.\n", + "desc": "Standalone lines should be removed from the template." + }, + { + "name": "Indented Standalone Tag", + "data": {}, + "expected": "Begin.\nEnd.\n", + "template": "Begin.\n {{=@ @=}}\nEnd.\n", + "desc": "Indented standalone lines should be removed from the template." + }, + { + "name": "Pair with Padding", + "data": {}, + "expected": "||", + "template": "|{{= @ @ =}}|", + "desc": "Superfluous in-tag whitespace should be ignored." + } + ] } diff --git a/tests/unit/data/mustache_extra.json b/tests/unit/data/mustache_extra.json index a69973b933..ac77a5a69f 100644 --- a/tests/unit/data/mustache_extra.json +++ b/tests/unit/data/mustache_extra.json @@ -1,66 +1,66 @@ { - "tests": [ - { - "name": "Demo", - "data": { - "header": "Colors", - "items": [ - {"name": "red", "first": true, "url": "#Red"}, - {"name": "green", "link": true, "url": "#Green"}, - {"name": "blue", "link": true, "url": "#Blue"} - ], - "empty": false - }, - "expected": "

Colors

\n\n
  • red
  • \n
  • green
  • \n
  • blue
  • \n\n", - "template": "

    {{header}}

    \n{{#bug}}\n{{/bug}}\n\n{{#items}}\n {{#first}}\n
  • {{name}}
  • \n {{/first}}\n {{#link}}\n
  • {{name}}
  • \n {{/link}}\n{{/items}}\n\n{{#empty}}\n

    The list is empty.

    \n{{/empty}}\n" - }, - { - "name": "Ted's Abusive Test 1", - "data": { "x": 123 }, - "template": "{{x}}", - "expected": "123" - }, - { - "name": "Ted's Abusive Test 2", - "data": { "x": 123, "y": 456 }, - "template": "{{x}} {{y}}", - "expected": "123 456" - }, - { - "name": "Ted's Abusive Test 3", - "data": [ null ], - "template": "{{null}}", - "expected": "" - }, - { - "name": "Ted's Abusive Test 4", - "data": { "x": 123, "y": 456 }, - "template": "{{}}", - "expected": "{{}}" - }, - { - "name": "Ted's Abusive Test 5", - "data": { "boolean": true}, - "template": "{{#boolean}}IT IS TRUE{{/boolean}}", - "expected": "IT IS TRUE" - }, - { - "name": "Ted's Abusive Test 6", - "data": { "boolean": false}, - "template": "{{^boolean}}IT IS FALSE{{/boolean}}", - "expected": "IT IS FALSE" - }, - { - "name": "Ted's Abusive Test 7", - "data": { "list": - [ - { "k": 789, "v": 0 }, - { "k": null, "v": true }, - { "k": -1, "v": -2 } - ] - }, - "template": "{{#list}}{{k}}={{v}}, {{/list}}", - "expected": "789=0, =true, -1=-2, " - } - ] + "tests": [ + { + "name": "Demo", + "data": { + "header": "Colors", + "items": [ + { "name": "red", "first": true, "url": "#Red" }, + { "name": "green", "link": true, "url": "#Green" }, + { "name": "blue", "link": true, "url": "#Blue" } + ], + "empty": false + }, + "expected": "

    Colors

    \n\n
  • red
  • \n
  • green
  • \n
  • blue
  • \n\n", + "template": "

    {{header}}

    \n{{#bug}}\n{{/bug}}\n\n{{#items}}\n {{#first}}\n
  • {{name}}
  • \n {{/first}}\n {{#link}}\n
  • {{name}}
  • \n {{/link}}\n{{/items}}\n\n{{#empty}}\n

    The list is empty.

    \n{{/empty}}\n" + }, + { + "name": "Ted's Abusive Test 1", + "data": { "x": 123 }, + "template": "{{x}}", + "expected": "123" + }, + { + "name": "Ted's Abusive Test 2", + "data": { "x": 123, "y": 456 }, + "template": "{{x}} {{y}}", + "expected": "123 456" + }, + { + "name": "Ted's Abusive Test 3", + "data": [null], + "template": "{{null}}", + "expected": "" + }, + { + "name": "Ted's Abusive Test 4", + "data": { "x": 123, "y": 456 }, + "template": "{{}}", + "expected": "{{}}" + }, + { + "name": "Ted's Abusive Test 5", + "data": { "boolean": true }, + "template": "{{#boolean}}IT IS TRUE{{/boolean}}", + "expected": "IT IS TRUE" + }, + { + "name": "Ted's Abusive Test 6", + "data": { "boolean": false }, + "template": "{{^boolean}}IT IS FALSE{{/boolean}}", + "expected": "IT IS FALSE" + }, + { + "name": "Ted's Abusive Test 7", + "data": { + "list": [ + { "k": 789, "v": 0 }, + { "k": null, "v": true }, + { "k": -1, "v": -2 } + ] + }, + "template": "{{#list}}{{k}}={{v}}, {{/list}}", + "expected": "789=0, =true, -1=-2, " + } + ] } diff --git a/tests/unit/data/mustache_interpolation.json b/tests/unit/data/mustache_interpolation.json index 0b2c03aa4c..a1fd4ec19f 100644 --- a/tests/unit/data/mustache_interpolation.json +++ b/tests/unit/data/mustache_interpolation.json @@ -1,182 +1,144 @@ { - "tests": [ - { - "name": "No Interpolation", - "data": {}, - "expected": "Hello from {Mustache}!\n", - "template": "Hello from {Mustache}!\n", - "desc": "Mustache-free templates should render as-is." - }, - { - "name": "Basic Interpolation", - "data": { - "subject": "world" - }, - "expected": "Hello, world!\n", - "template": "Hello, {{subject}}!\n", - "desc": "Unadorned tags should interpolate content into the template." - }, - { - "name": "HTML Escaping", - "data": { - "forbidden": "& \" < >" - }, - "expected": "These characters should be HTML escaped: & " < >\n", - "template": "These characters should be HTML escaped: {{forbidden}}\n", - "desc": "Basic interpolation should be HTML escaped." - }, - { - "name": "Triple Mustache", - "data": { - "forbidden": "& \" < >" - }, - "expected": "These characters should not be HTML escaped: & \" < >\n", - "template": "These characters should not be HTML escaped: {{{forbidden}}}\n", - "desc": "Triple mustaches should interpolate without HTML escaping." - }, - { - "name": "Ampersand", - "data": { - "forbidden": "& \" < >" - }, - "expected": "These characters should not be HTML escaped: & \" < >\n", - "template": "These characters should not be HTML escaped: {{&forbidden}}\n", - "desc": "Ampersand should interpolate without HTML escaping." - }, - { - "name": "Basic Integer Interpolation", - "data": { - "mph": 85 - }, - "expected": "\"85 miles an hour!\"", - "template": "\"{{mph}} miles an hour!\"", - "desc": "Integers should interpolate seamlessly." - }, - { - "name": "Triple Mustache Integer Interpolation", - "data": { - "mph": 85 - }, - "expected": "\"85 miles an hour!\"", - "template": "\"{{{mph}}} miles an hour!\"", - "desc": "Integers should interpolate seamlessly." - }, - { - "name": "Ampersand Integer Interpolation", - "data": { - "mph": 85 - }, - "expected": "\"85 miles an hour!\"", - "template": "\"{{&mph}} miles an hour!\"", - "desc": "Integers should interpolate seamlessly." - }, - { - "name": "Basic Decimal Interpolation", - "data": { - "power": 1.21 - }, - "expected": "\"1.21 jiggawatts!\"", - "template": "\"{{power}} jiggawatts!\"", - "desc": "Decimals should interpolate seamlessly with proper significance." - }, - { - "name": "Triple Mustache Decimal Interpolation", - "data": { - "power": 1.21 - }, - "expected": "\"1.21 jiggawatts!\"", - "template": "\"{{{power}}} jiggawatts!\"", - "desc": "Decimals should interpolate seamlessly with proper significance." - }, - { - "name": "Ampersand Decimal Interpolation", - "data": { - "power": 1.21 - }, - "expected": "\"1.21 jiggawatts!\"", - "template": "\"{{&power}} jiggawatts!\"", - "desc": "Decimals should interpolate seamlessly with proper significance." - }, - { - "name": "Interpolation - Surrounding Whitespace", - "data": { - "string": "---" - }, - "expected": "| --- |", - "template": "| {{string}} |", - "desc": "Interpolation should not alter surrounding whitespace." - }, - { - "name": "Triple Mustache - Surrounding Whitespace", - "data": { - "string": "---" - }, - "expected": "| --- |", - "template": "| {{{string}}} |", - "desc": "Interpolation should not alter surrounding whitespace." - }, - { - "name": "Ampersand - Surrounding Whitespace", - "data": { - "string": "---" - }, - "expected": "| --- |", - "template": "| {{&string}} |", - "desc": "Interpolation should not alter surrounding whitespace." - }, - { - "name": "Interpolation - Standalone", - "data": { - "string": "---" - }, - "expected": " ---\n", - "template": " {{string}}\n", - "desc": "Standalone interpolation should not alter surrounding whitespace." - }, - { - "name": "Triple Mustache - Standalone", - "data": { - "string": "---" - }, - "expected": " ---\n", - "template": " {{{string}}}\n", - "desc": "Standalone interpolation should not alter surrounding whitespace." - }, - { - "name": "Ampersand - Standalone", - "data": { - "string": "---" - }, - "expected": " ---\n", - "template": " {{&string}}\n", - "desc": "Standalone interpolation should not alter surrounding whitespace." - }, - { - "name": "Interpolation With Padding", - "data": { - "string": "---" - }, - "expected": "|---|", - "template": "|{{ string }}|", - "desc": "Superfluous in-tag whitespace should be ignored." - }, - { - "name": "Triple Mustache With Padding", - "data": { - "string": "---" - }, - "expected": "|---|", - "template": "|{{{ string }}}|", - "desc": "Superfluous in-tag whitespace should be ignored." - }, - { - "name": "Ampersand With Padding", - "data": { - "string": "---" - }, - "expected": "|---|", - "template": "|{{& string }}|", - "desc": "Superfluous in-tag whitespace should be ignored." - } - ] + "tests": [ + { + "name": "No Interpolation", + "data": {}, + "expected": "Hello from {Mustache}!\n", + "template": "Hello from {Mustache}!\n", + "desc": "Mustache-free templates should render as-is." + }, + { + "name": "Basic Interpolation", + "data": { "subject": "world" }, + "expected": "Hello, world!\n", + "template": "Hello, {{subject}}!\n", + "desc": "Unadorned tags should interpolate content into the template." + }, + { + "name": "HTML Escaping", + "data": { "forbidden": "& \" < >" }, + "expected": "These characters should be HTML escaped: & " < >\n", + "template": "These characters should be HTML escaped: {{forbidden}}\n", + "desc": "Basic interpolation should be HTML escaped." + }, + { + "name": "Triple Mustache", + "data": { "forbidden": "& \" < >" }, + "expected": "These characters should not be HTML escaped: & \" < >\n", + "template": "These characters should not be HTML escaped: {{{forbidden}}}\n", + "desc": "Triple mustaches should interpolate without HTML escaping." + }, + { + "name": "Ampersand", + "data": { "forbidden": "& \" < >" }, + "expected": "These characters should not be HTML escaped: & \" < >\n", + "template": "These characters should not be HTML escaped: {{&forbidden}}\n", + "desc": "Ampersand should interpolate without HTML escaping." + }, + { + "name": "Basic Integer Interpolation", + "data": { "mph": 85 }, + "expected": "\"85 miles an hour!\"", + "template": "\"{{mph}} miles an hour!\"", + "desc": "Integers should interpolate seamlessly." + }, + { + "name": "Triple Mustache Integer Interpolation", + "data": { "mph": 85 }, + "expected": "\"85 miles an hour!\"", + "template": "\"{{{mph}}} miles an hour!\"", + "desc": "Integers should interpolate seamlessly." + }, + { + "name": "Ampersand Integer Interpolation", + "data": { "mph": 85 }, + "expected": "\"85 miles an hour!\"", + "template": "\"{{&mph}} miles an hour!\"", + "desc": "Integers should interpolate seamlessly." + }, + { + "name": "Basic Decimal Interpolation", + "data": { "power": 1.21 }, + "expected": "\"1.21 jiggawatts!\"", + "template": "\"{{power}} jiggawatts!\"", + "desc": "Decimals should interpolate seamlessly with proper significance." + }, + { + "name": "Triple Mustache Decimal Interpolation", + "data": { "power": 1.21 }, + "expected": "\"1.21 jiggawatts!\"", + "template": "\"{{{power}}} jiggawatts!\"", + "desc": "Decimals should interpolate seamlessly with proper significance." + }, + { + "name": "Ampersand Decimal Interpolation", + "data": { "power": 1.21 }, + "expected": "\"1.21 jiggawatts!\"", + "template": "\"{{&power}} jiggawatts!\"", + "desc": "Decimals should interpolate seamlessly with proper significance." + }, + { + "name": "Interpolation - Surrounding Whitespace", + "data": { "string": "---" }, + "expected": "| --- |", + "template": "| {{string}} |", + "desc": "Interpolation should not alter surrounding whitespace." + }, + { + "name": "Triple Mustache - Surrounding Whitespace", + "data": { "string": "---" }, + "expected": "| --- |", + "template": "| {{{string}}} |", + "desc": "Interpolation should not alter surrounding whitespace." + }, + { + "name": "Ampersand - Surrounding Whitespace", + "data": { "string": "---" }, + "expected": "| --- |", + "template": "| {{&string}} |", + "desc": "Interpolation should not alter surrounding whitespace." + }, + { + "name": "Interpolation - Standalone", + "data": { "string": "---" }, + "expected": " ---\n", + "template": " {{string}}\n", + "desc": "Standalone interpolation should not alter surrounding whitespace." + }, + { + "name": "Triple Mustache - Standalone", + "data": { "string": "---" }, + "expected": " ---\n", + "template": " {{{string}}}\n", + "desc": "Standalone interpolation should not alter surrounding whitespace." + }, + { + "name": "Ampersand - Standalone", + "data": { "string": "---" }, + "expected": " ---\n", + "template": " {{&string}}\n", + "desc": "Standalone interpolation should not alter surrounding whitespace." + }, + { + "name": "Interpolation With Padding", + "data": { "string": "---" }, + "expected": "|---|", + "template": "|{{ string }}|", + "desc": "Superfluous in-tag whitespace should be ignored." + }, + { + "name": "Triple Mustache With Padding", + "data": { "string": "---" }, + "expected": "|---|", + "template": "|{{{ string }}}|", + "desc": "Superfluous in-tag whitespace should be ignored." + }, + { + "name": "Ampersand With Padding", + "data": { "string": "---" }, + "expected": "|---|", + "template": "|{{& string }}|", + "desc": "Superfluous in-tag whitespace should be ignored." + } + ] } diff --git a/tests/unit/data/mustache_inverted.json b/tests/unit/data/mustache_inverted.json index aae4cc3f8f..9a7ddac3cc 100644 --- a/tests/unit/data/mustache_inverted.json +++ b/tests/unit/data/mustache_inverted.json @@ -1,214 +1,153 @@ { - "__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.", - "overview": "Inverted Section tags and End Section tags are used in combination to wrap a\nsection of the template.\n\nThese tags' content MUST be a non-whitespace character sequence NOT\ncontaining the current closing delimiter; each Inverted Section tag MUST be\nfollowed by an End Section tag with the same content within the same\nsection.\n\nThis tag's content names the data to replace the tag. Name resolution is as\nfollows:\n 1) Split the name on periods; the first part is the name to resolve, any\n remaining parts should be retained.\n 2) Walk the context stack from top to bottom, finding the first context\n that is a) a hash containing the name as a key OR b) an object responding\n to a method with the given name.\n 3) If the context is a hash, the data is the value associated with the\n name.\n 4) If the context is an object and the method with the given name has an\n arity of 1, the method SHOULD be called with a String containing the\n unprocessed contents of the sections; the data is the value returned.\n 5) Otherwise, the data is the value returned by calling the method with\n the given name.\n 6) If any name parts were retained in step 1, each should be resolved\n against a context stack containing only the result from the former\n resolution. If any part fails resolution, the result should be considered\n falsey, and should interpolate as the empty string.\nIf the data is not of a list type, it is coerced into a list as follows: if\nthe data is truthy (e.g. `!!data == true`), use a single-element list\ncontaining the data, otherwise use an empty list.\n\nThis section MUST NOT be rendered unless the data list is empty.\n\nInverted Section and End Section tags SHOULD be treated as standalone when\nappropriate.\n", - "tests": [ - { - "name": "Falsey", - "data": { - "boolean": false - }, - "expected": "\"This should be rendered.\"", - "template": "\"{{^boolean}}This should be rendered.{{/boolean}}\"", - "desc": "Falsey sections should have their contents rendered." - }, - { - "name": "Truthy", - "data": { - "boolean": true - }, - "expected": "\"\"", - "template": "\"{{^boolean}}This should not be rendered.{{/boolean}}\"", - "desc": "Truthy sections should have their contents omitted." - }, - { - "name": "Context", - "data": { - "context": { - "name": "Joe" - } - }, - "expected": "\"\"", - "template": "\"{{^context}}Hi {{name}}.{{/context}}\"", - "desc": "Objects and hashes should behave like truthy values." - }, - { - "name": "List", - "data": { - "list": [ - { - "n": 1 - }, - { - "n": 2 - }, - { - "n": 3 - } - ] - }, - "expected": "\"\"", - "template": "\"{{^list}}{{n}}{{/list}}\"", - "desc": "Lists should behave like truthy values." - }, - { - "name": "Empty List", - "data": { - "list": [] - }, - "expected": "\"Yay lists!\"", - "template": "\"{{^list}}Yay lists!{{/list}}\"", - "desc": "Empty lists should behave like falsey values." - }, - { - "name": "Doubled", - "data": { - "two": "second", - "bool": false - }, - "expected": "* first\n* second\n* third\n", - "template": "{{^bool}}\n* first\n{{/bool}}\n* {{two}}\n{{^bool}}\n* third\n{{/bool}}\n", - "desc": "Multiple inverted sections per template should be permitted." - }, - { - "name": "Nested (Falsey)", - "data": { - "bool": false - }, - "expected": "| A B C D E |", - "template": "| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |", - "desc": "Nested falsey sections should have their contents rendered." - }, - { - "name": "Nested (Truthy)", - "data": { - "bool": true - }, - "expected": "| A E |", - "template": "| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |", - "desc": "Nested truthy sections should be omitted." - }, - { - "name": "Context Misses", - "data": {}, - "expected": "[Cannot find key 'missing'!]", - "template": "[{{^missing}}Cannot find key 'missing'!{{/missing}}]", - "desc": "Failed context lookups should be considered falsey." - }, - { - "name": "Dotted Names - Truthy", - "data": { - "a": { - "b": { - "c": true - } - } - }, - "expected": "\"\" == \"\"", - "template": "\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"\"", - "desc": "Dotted names should be valid for Inverted Section tags." - }, - { - "name": "Dotted Names - Falsey", - "data": { - "a": { - "b": { - "c": false - } - } - }, - "expected": "\"Not Here\" == \"Not Here\"", - "template": "\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"Not Here\"", - "desc": "Dotted names should be valid for Inverted Section tags." - }, - { - "name": "Dotted Names - Broken Chains", - "data": { - "a": {} - }, - "expected": "\"Not Here\" == \"Not Here\"", - "template": "\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"Not Here\"", - "desc": "Dotted names that cannot be resolved should be considered falsey." - }, - { - "name": "Surrounding Whitespace", - "data": { - "boolean": false - }, - "expected": " | \t|\t | \n", - "template": " | {{^boolean}}\t|\t{{/boolean}} | \n", - "desc": "Inverted sections should not alter surrounding whitespace." - }, - { - "name": "Internal Whitespace", - "data": { - "boolean": false - }, - "expected": " | \n | \n", - "template": " | {{^boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n", - "desc": "Inverted should not alter internal whitespace." - }, - { - "name": "Indented Inline Sections", - "data": { - "boolean": false - }, - "expected": " NO\n WAY\n", - "template": " {{^boolean}}NO{{/boolean}}\n {{^boolean}}WAY{{/boolean}}\n", - "desc": "Single-line sections should not alter surrounding whitespace." - }, - { - "name": "Standalone Lines", - "data": { - "boolean": false - }, - "expected": "| This Is\n|\n| A Line\n", - "template": "| This Is\n{{^boolean}}\n|\n{{/boolean}}\n| A Line\n", - "desc": "Standalone lines should be removed from the template." - }, - { - "name": "Standalone Indented Lines", - "data": { - "boolean": false - }, - "expected": "| This Is\n|\n| A Line\n", - "template": "| This Is\n {{^boolean}}\n|\n {{/boolean}}\n| A Line\n", - "desc": "Standalone indented lines should be removed from the template." - }, - { - "name": "Standalone Line Endings", - "data": { - "boolean": false - }, - "expected": "|\r\n|", - "template": "|\r\n{{^boolean}}\r\n{{/boolean}}\r\n|", - "desc": "\"\\r\\n\" should be considered a newline for standalone tags." - }, - { - "name": "Standalone Without Previous Line", - "data": { - "boolean": false - }, - "expected": "^\n/", - "template": " {{^boolean}}\n^{{/boolean}}\n/", - "desc": "Standalone tags should not require a newline to precede them." - }, - { - "name": "Standalone Without Newline", - "data": { - "boolean": false - }, - "expected": "^\n/\n", - "template": "^{{^boolean}}\n/\n {{/boolean}}", - "desc": "Standalone tags should not require a newline to follow them." - }, - { - "name": "Padding", - "data": { - "boolean": false - }, - "expected": "|=|", - "template": "|{{^ boolean }}={{/ boolean }}|", - "desc": "Superfluous in-tag whitespace should be ignored." - } - ] + "__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.", + "overview": "Inverted Section tags and End Section tags are used in combination to wrap a\nsection of the template.\n\nThese tags' content MUST be a non-whitespace character sequence NOT\ncontaining the current closing delimiter; each Inverted Section tag MUST be\nfollowed by an End Section tag with the same content within the same\nsection.\n\nThis tag's content names the data to replace the tag. Name resolution is as\nfollows:\n 1) Split the name on periods; the first part is the name to resolve, any\n remaining parts should be retained.\n 2) Walk the context stack from top to bottom, finding the first context\n that is a) a hash containing the name as a key OR b) an object responding\n to a method with the given name.\n 3) If the context is a hash, the data is the value associated with the\n name.\n 4) If the context is an object and the method with the given name has an\n arity of 1, the method SHOULD be called with a String containing the\n unprocessed contents of the sections; the data is the value returned.\n 5) Otherwise, the data is the value returned by calling the method with\n the given name.\n 6) If any name parts were retained in step 1, each should be resolved\n against a context stack containing only the result from the former\n resolution. If any part fails resolution, the result should be considered\n falsey, and should interpolate as the empty string.\nIf the data is not of a list type, it is coerced into a list as follows: if\nthe data is truthy (e.g. `!!data == true`), use a single-element list\ncontaining the data, otherwise use an empty list.\n\nThis section MUST NOT be rendered unless the data list is empty.\n\nInverted Section and End Section tags SHOULD be treated as standalone when\nappropriate.\n", + "tests": [ + { + "name": "Falsey", + "data": { "boolean": false }, + "expected": "\"This should be rendered.\"", + "template": "\"{{^boolean}}This should be rendered.{{/boolean}}\"", + "desc": "Falsey sections should have their contents rendered." + }, + { + "name": "Truthy", + "data": { "boolean": true }, + "expected": "\"\"", + "template": "\"{{^boolean}}This should not be rendered.{{/boolean}}\"", + "desc": "Truthy sections should have their contents omitted." + }, + { + "name": "Context", + "data": { "context": { "name": "Joe" } }, + "expected": "\"\"", + "template": "\"{{^context}}Hi {{name}}.{{/context}}\"", + "desc": "Objects and hashes should behave like truthy values." + }, + { + "name": "List", + "data": { "list": [{ "n": 1 }, { "n": 2 }, { "n": 3 }] }, + "expected": "\"\"", + "template": "\"{{^list}}{{n}}{{/list}}\"", + "desc": "Lists should behave like truthy values." + }, + { + "name": "Empty List", + "data": { "list": [] }, + "expected": "\"Yay lists!\"", + "template": "\"{{^list}}Yay lists!{{/list}}\"", + "desc": "Empty lists should behave like falsey values." + }, + { + "name": "Doubled", + "data": { "two": "second", "bool": false }, + "expected": "* first\n* second\n* third\n", + "template": "{{^bool}}\n* first\n{{/bool}}\n* {{two}}\n{{^bool}}\n* third\n{{/bool}}\n", + "desc": "Multiple inverted sections per template should be permitted." + }, + { + "name": "Nested (Falsey)", + "data": { "bool": false }, + "expected": "| A B C D E |", + "template": "| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |", + "desc": "Nested falsey sections should have their contents rendered." + }, + { + "name": "Nested (Truthy)", + "data": { "bool": true }, + "expected": "| A E |", + "template": "| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |", + "desc": "Nested truthy sections should be omitted." + }, + { + "name": "Context Misses", + "data": {}, + "expected": "[Cannot find key 'missing'!]", + "template": "[{{^missing}}Cannot find key 'missing'!{{/missing}}]", + "desc": "Failed context lookups should be considered falsey." + }, + { + "name": "Dotted Names - Truthy", + "data": { "a": { "b": { "c": true } } }, + "expected": "\"\" == \"\"", + "template": "\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"\"", + "desc": "Dotted names should be valid for Inverted Section tags." + }, + { + "name": "Dotted Names - Falsey", + "data": { "a": { "b": { "c": false } } }, + "expected": "\"Not Here\" == \"Not Here\"", + "template": "\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"Not Here\"", + "desc": "Dotted names should be valid for Inverted Section tags." + }, + { + "name": "Dotted Names - Broken Chains", + "data": { "a": {} }, + "expected": "\"Not Here\" == \"Not Here\"", + "template": "\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"Not Here\"", + "desc": "Dotted names that cannot be resolved should be considered falsey." + }, + { + "name": "Surrounding Whitespace", + "data": { "boolean": false }, + "expected": " | \t|\t | \n", + "template": " | {{^boolean}}\t|\t{{/boolean}} | \n", + "desc": "Inverted sections should not alter surrounding whitespace." + }, + { + "name": "Internal Whitespace", + "data": { "boolean": false }, + "expected": " | \n | \n", + "template": " | {{^boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n", + "desc": "Inverted should not alter internal whitespace." + }, + { + "name": "Indented Inline Sections", + "data": { "boolean": false }, + "expected": " NO\n WAY\n", + "template": " {{^boolean}}NO{{/boolean}}\n {{^boolean}}WAY{{/boolean}}\n", + "desc": "Single-line sections should not alter surrounding whitespace." + }, + { + "name": "Standalone Lines", + "data": { "boolean": false }, + "expected": "| This Is\n|\n| A Line\n", + "template": "| This Is\n{{^boolean}}\n|\n{{/boolean}}\n| A Line\n", + "desc": "Standalone lines should be removed from the template." + }, + { + "name": "Standalone Indented Lines", + "data": { "boolean": false }, + "expected": "| This Is\n|\n| A Line\n", + "template": "| This Is\n {{^boolean}}\n|\n {{/boolean}}\n| A Line\n", + "desc": "Standalone indented lines should be removed from the template." + }, + { + "name": "Standalone Line Endings", + "data": { "boolean": false }, + "expected": "|\r\n|", + "template": "|\r\n{{^boolean}}\r\n{{/boolean}}\r\n|", + "desc": "\"\\r\\n\" should be considered a newline for standalone tags." + }, + { + "name": "Standalone Without Previous Line", + "data": { "boolean": false }, + "expected": "^\n/", + "template": " {{^boolean}}\n^{{/boolean}}\n/", + "desc": "Standalone tags should not require a newline to precede them." + }, + { + "name": "Standalone Without Newline", + "data": { "boolean": false }, + "expected": "^\n/\n", + "template": "^{{^boolean}}\n/\n {{/boolean}}", + "desc": "Standalone tags should not require a newline to follow them." + }, + { + "name": "Padding", + "data": { "boolean": false }, + "expected": "|=|", + "template": "|{{^ boolean }}={{/ boolean }}|", + "desc": "Superfluous in-tag whitespace should be ignored." + } + ] } diff --git a/tests/unit/data/mustache_sections.json b/tests/unit/data/mustache_sections.json index 56279257f5..53936eda5a 100644 --- a/tests/unit/data/mustache_sections.json +++ b/tests/unit/data/mustache_sections.json @@ -1,282 +1,187 @@ { - "__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.", - "overview": "Section tags and End Section tags are used in combination to wrap a section\nof the template for iteration\n\nThese tags' content MUST be a non-whitespace character sequence NOT\ncontaining the current closing delimiter; each Section tag MUST be followed\nby an End Section tag with the same content within the same section.\n\nThis tag's content names the data to replace the tag. Name resolution is as\nfollows:\n 1) Split the name on periods; the first part is the name to resolve, any\n remaining parts should be retained.\n 2) Walk the context stack from top to bottom, finding the first context\n that is a) a hash containing the name as a key OR b) an object responding\n to a method with the given name.\n 3) If the context is a hash, the data is the value associated with the\n name.\n 4) If the context is an object and the method with the given name has an\n arity of 1, the method SHOULD be called with a String containing the\n unprocessed contents of the sections; the data is the value returned.\n 5) Otherwise, the data is the value returned by calling the method with\n the given name.\n 6) If any name parts were retained in step 1, each should be resolved\n against a context stack containing only the result from the former\n resolution. If any part fails resolution, the result should be considered\n falsey, and should interpolate as the empty string.\nIf the data is not of a list type, it is coerced into a list as follows: if\nthe data is truthy (e.g. `!!data == true`), use a single-element list\ncontaining the data, otherwise use an empty list.\n\nFor each element in the data list, the element MUST be pushed onto the\ncontext stack, the section MUST be rendered, and the element MUST be popped\noff the context stack.\n\nSection and End Section tags SHOULD be treated as standalone when\nappropriate.\n", - "tests": [ - { - "name": "Truthy", - "data": { - "boolean": true - }, - "expected": "\"This should be rendered.\"", - "template": "\"{{#boolean}}This should be rendered.{{/boolean}}\"", - "desc": "Truthy sections should have their contents rendered." - }, - { - "name": "Falsey", - "data": { - "boolean": false - }, - "expected": "\"\"", - "template": "\"{{#boolean}}This should not be rendered.{{/boolean}}\"", - "desc": "Falsey sections should have their contents omitted." - }, - { - "name": "Context", - "data": { - "context": { - "name": "Joe" - } - }, - "expected": "\"Hi Joe.\"", - "template": "\"{{#context}}Hi {{name}}.{{/context}}\"", - "desc": "Objects and hashes should be pushed onto the context stack." - }, - { - "name": "Deeply Nested Contexts", - "data": { - "a": { - "one": 1 - }, - "b": { - "two": 2 - }, - "c": { - "three": 3 - }, - "d": { - "four": 4 - }, - "e": { - "five": 5 - } - }, - "expected": "1\n121\n12321\n1234321\n123454321\n1234321\n12321\n121\n1\n", - "template": "{{#a}}\n{{one}}\n{{#b}}\n{{one}}{{two}}{{one}}\n{{#c}}\n{{one}}{{two}}{{three}}{{two}}{{one}}\n{{#d}}\n{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}\n{{#e}}\n{{one}}{{two}}{{three}}{{four}}{{five}}{{four}}{{three}}{{two}}{{one}}\n{{/e}}\n{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}\n{{/d}}\n{{one}}{{two}}{{three}}{{two}}{{one}}\n{{/c}}\n{{one}}{{two}}{{one}}\n{{/b}}\n{{one}}\n{{/a}}\n", - "desc": "All elements on the context stack should be accessible." - }, - { - "name": "List", - "data": { - "list": [ - { - "item": 1 - }, - { - "item": 2 - }, - { - "item": 3 - } - ] - }, - "expected": "\"123\"", - "template": "\"{{#list}}{{item}}{{/list}}\"", - "desc": "Lists should be iterated; list items should visit the context stack." - }, - { - "name": "Empty List", - "data": { - "list": [] - }, - "expected": "\"\"", - "template": "\"{{#list}}Yay lists!{{/list}}\"", - "desc": "Empty lists should behave like falsey values." - }, - { - "name": "Doubled", - "data": { - "two": "second", - "bool": true - }, - "expected": "* first\n* second\n* third\n", - "template": "{{#bool}}\n* first\n{{/bool}}\n* {{two}}\n{{#bool}}\n* third\n{{/bool}}\n", - "desc": "Multiple sections per template should be permitted." - }, - { - "name": "Nested (Truthy)", - "data": { - "bool": true - }, - "expected": "| A B C D E |", - "template": "| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |", - "desc": "Nested truthy sections should have their contents rendered." - }, - { - "name": "Nested (Falsey)", - "data": { - "bool": false - }, - "expected": "| A E |", - "template": "| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |", - "desc": "Nested falsey sections should be omitted." - }, - { - "name": "Context Misses", - "data": {}, - "expected": "[]", - "template": "[{{#missing}}Found key 'missing'!{{/missing}}]", - "desc": "Failed context lookups should be considered falsey." - }, - { - "name": "Implicit Iterator - String", - "data": { - "list": [ - "a", - "b", - "c", - "d", - "e" - ] - }, - "expected": "\"(a)(b)(c)(d)(e)\"", - "template": "\"{{#list}}({{.}}){{/list}}\"", - "desc": "Implicit iterators should directly interpolate strings." - }, - { - "name": "Implicit Iterator - Integer", - "data": { - "list": [ - 1, - 2, - 3, - 4, - 5 - ] - }, - "expected": "\"(1)(2)(3)(4)(5)\"", - "template": "\"{{#list}}({{.}}){{/list}}\"", - "desc": "Implicit iterators should cast integers to strings and interpolate." - }, - { - "name": "Implicit Iterator - Decimal", - "data": { - "list": [ - 1.1, - 2.2, - 3.3, - 4.4, - 5.5 - ] - }, - "expected": "\"(1.10)(2.20)(3.30)(4.40)(5.50)\"", - "template": "\"{{#list}}({{.}}){{/list}}\"", - "desc": "Implicit iterators should cast decimals to strings and interpolate." - }, - { - "name": "Dotted Names - Truthy", - "data": { - "a": { - "b": { - "c": true - } - } - }, - "expected": "\"Here\" == \"Here\"", - "template": "\"{{#a.b.c}}Here{{/a.b.c}}\" == \"Here\"", - "desc": "Dotted names should be valid for Section tags." - }, - { - "name": "Dotted Names - Falsey", - "data": { - "a": { - "b": { - "c": false - } - } - }, - "expected": "\"\" == \"\"", - "template": "\"{{#a.b.c}}Here{{/a.b.c}}\" == \"\"", - "desc": "Dotted names should be valid for Section tags." - }, - { - "name": "Dotted Names - Broken Chains", - "data": { - "a": {} - }, - "expected": "\"\" == \"\"", - "template": "\"{{#a.b.c}}Here{{/a.b.c}}\" == \"\"", - "desc": "Dotted names that cannot be resolved should be considered falsey." - }, - { - "name": "Surrounding Whitespace", - "data": { - "boolean": true - }, - "expected": " | \t|\t | \n", - "template": " | {{#boolean}}\t|\t{{/boolean}} | \n", - "desc": "Sections should not alter surrounding whitespace." - }, - { - "name": "Internal Whitespace", - "data": { - "boolean": true - }, - "expected": " | \n | \n", - "template": " | {{#boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n", - "desc": "Sections should not alter internal whitespace." - }, - { - "name": "Indented Inline Sections", - "data": { - "boolean": true - }, - "expected": " YES\n GOOD\n", - "template": " {{#boolean}}YES{{/boolean}}\n {{#boolean}}GOOD{{/boolean}}\n", - "desc": "Single-line sections should not alter surrounding whitespace." - }, - { - "name": "Standalone Lines", - "data": { - "boolean": true - }, - "expected": "| This Is\n|\n| A Line\n", - "template": "| This Is\n{{#boolean}}\n|\n{{/boolean}}\n| A Line\n", - "desc": "Standalone lines should be removed from the template." - }, - { - "name": "Indented Standalone Lines", - "data": { - "boolean": true - }, - "expected": "| This Is\n|\n| A Line\n", - "template": "| This Is\n {{#boolean}}\n|\n {{/boolean}}\n| A Line\n", - "desc": "Indented standalone lines should be removed from the template." - }, - { - "name": "Standalone Line Endings", - "data": { - "boolean": true - }, - "expected": "|\r\n|", - "template": "|\r\n{{#boolean}}\r\n{{/boolean}}\r\n|", - "desc": "\"\\r\\n\" should be considered a newline for standalone tags." - }, - { - "name": "Standalone Without Previous Line", - "data": { - "boolean": true - }, - "expected": "#\n/", - "template": " {{#boolean}}\n#{{/boolean}}\n/", - "desc": "Standalone tags should not require a newline to precede them." - }, - { - "name": "Standalone Without Newline", - "data": { - "boolean": true - }, - "expected": "#\n/\n", - "template": "#{{#boolean}}\n/\n {{/boolean}}", - "desc": "Standalone tags should not require a newline to follow them." - }, - { - "name": "Padding", - "data": { - "boolean": true - }, - "expected": "|=|", - "template": "|{{# boolean }}={{/ boolean }}|", - "desc": "Superfluous in-tag whitespace should be ignored." - } - ] + "__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.", + "overview": "Section tags and End Section tags are used in combination to wrap a section\nof the template for iteration\n\nThese tags' content MUST be a non-whitespace character sequence NOT\ncontaining the current closing delimiter; each Section tag MUST be followed\nby an End Section tag with the same content within the same section.\n\nThis tag's content names the data to replace the tag. Name resolution is as\nfollows:\n 1) Split the name on periods; the first part is the name to resolve, any\n remaining parts should be retained.\n 2) Walk the context stack from top to bottom, finding the first context\n that is a) a hash containing the name as a key OR b) an object responding\n to a method with the given name.\n 3) If the context is a hash, the data is the value associated with the\n name.\n 4) If the context is an object and the method with the given name has an\n arity of 1, the method SHOULD be called with a String containing the\n unprocessed contents of the sections; the data is the value returned.\n 5) Otherwise, the data is the value returned by calling the method with\n the given name.\n 6) If any name parts were retained in step 1, each should be resolved\n against a context stack containing only the result from the former\n resolution. If any part fails resolution, the result should be considered\n falsey, and should interpolate as the empty string.\nIf the data is not of a list type, it is coerced into a list as follows: if\nthe data is truthy (e.g. `!!data == true`), use a single-element list\ncontaining the data, otherwise use an empty list.\n\nFor each element in the data list, the element MUST be pushed onto the\ncontext stack, the section MUST be rendered, and the element MUST be popped\noff the context stack.\n\nSection and End Section tags SHOULD be treated as standalone when\nappropriate.\n", + "tests": [ + { + "name": "Truthy", + "data": { "boolean": true }, + "expected": "\"This should be rendered.\"", + "template": "\"{{#boolean}}This should be rendered.{{/boolean}}\"", + "desc": "Truthy sections should have their contents rendered." + }, + { + "name": "Falsey", + "data": { "boolean": false }, + "expected": "\"\"", + "template": "\"{{#boolean}}This should not be rendered.{{/boolean}}\"", + "desc": "Falsey sections should have their contents omitted." + }, + { + "name": "Context", + "data": { "context": { "name": "Joe" } }, + "expected": "\"Hi Joe.\"", + "template": "\"{{#context}}Hi {{name}}.{{/context}}\"", + "desc": "Objects and hashes should be pushed onto the context stack." + }, + { + "name": "Deeply Nested Contexts", + "data": { + "a": { "one": 1 }, + "b": { "two": 2 }, + "c": { "three": 3 }, + "d": { "four": 4 }, + "e": { "five": 5 } + }, + "expected": "1\n121\n12321\n1234321\n123454321\n1234321\n12321\n121\n1\n", + "template": "{{#a}}\n{{one}}\n{{#b}}\n{{one}}{{two}}{{one}}\n{{#c}}\n{{one}}{{two}}{{three}}{{two}}{{one}}\n{{#d}}\n{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}\n{{#e}}\n{{one}}{{two}}{{three}}{{four}}{{five}}{{four}}{{three}}{{two}}{{one}}\n{{/e}}\n{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}\n{{/d}}\n{{one}}{{two}}{{three}}{{two}}{{one}}\n{{/c}}\n{{one}}{{two}}{{one}}\n{{/b}}\n{{one}}\n{{/a}}\n", + "desc": "All elements on the context stack should be accessible." + }, + { + "name": "List", + "data": { "list": [{ "item": 1 }, { "item": 2 }, { "item": 3 }] }, + "expected": "\"123\"", + "template": "\"{{#list}}{{item}}{{/list}}\"", + "desc": "Lists should be iterated; list items should visit the context stack." + }, + { + "name": "Empty List", + "data": { "list": [] }, + "expected": "\"\"", + "template": "\"{{#list}}Yay lists!{{/list}}\"", + "desc": "Empty lists should behave like falsey values." + }, + { + "name": "Doubled", + "data": { "two": "second", "bool": true }, + "expected": "* first\n* second\n* third\n", + "template": "{{#bool}}\n* first\n{{/bool}}\n* {{two}}\n{{#bool}}\n* third\n{{/bool}}\n", + "desc": "Multiple sections per template should be permitted." + }, + { + "name": "Nested (Truthy)", + "data": { "bool": true }, + "expected": "| A B C D E |", + "template": "| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |", + "desc": "Nested truthy sections should have their contents rendered." + }, + { + "name": "Nested (Falsey)", + "data": { "bool": false }, + "expected": "| A E |", + "template": "| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |", + "desc": "Nested falsey sections should be omitted." + }, + { + "name": "Context Misses", + "data": {}, + "expected": "[]", + "template": "[{{#missing}}Found key 'missing'!{{/missing}}]", + "desc": "Failed context lookups should be considered falsey." + }, + { + "name": "Implicit Iterator - String", + "data": { "list": ["a", "b", "c", "d", "e"] }, + "expected": "\"(a)(b)(c)(d)(e)\"", + "template": "\"{{#list}}({{.}}){{/list}}\"", + "desc": "Implicit iterators should directly interpolate strings." + }, + { + "name": "Implicit Iterator - Integer", + "data": { "list": [1, 2, 3, 4, 5] }, + "expected": "\"(1)(2)(3)(4)(5)\"", + "template": "\"{{#list}}({{.}}){{/list}}\"", + "desc": "Implicit iterators should cast integers to strings and interpolate." + }, + { + "name": "Implicit Iterator - Decimal", + "data": { "list": [1.1, 2.2, 3.3, 4.4, 5.5] }, + "expected": "\"(1.10)(2.20)(3.30)(4.40)(5.50)\"", + "template": "\"{{#list}}({{.}}){{/list}}\"", + "desc": "Implicit iterators should cast decimals to strings and interpolate." + }, + { + "name": "Dotted Names - Truthy", + "data": { "a": { "b": { "c": true } } }, + "expected": "\"Here\" == \"Here\"", + "template": "\"{{#a.b.c}}Here{{/a.b.c}}\" == \"Here\"", + "desc": "Dotted names should be valid for Section tags." + }, + { + "name": "Dotted Names - Falsey", + "data": { "a": { "b": { "c": false } } }, + "expected": "\"\" == \"\"", + "template": "\"{{#a.b.c}}Here{{/a.b.c}}\" == \"\"", + "desc": "Dotted names should be valid for Section tags." + }, + { + "name": "Dotted Names - Broken Chains", + "data": { "a": {} }, + "expected": "\"\" == \"\"", + "template": "\"{{#a.b.c}}Here{{/a.b.c}}\" == \"\"", + "desc": "Dotted names that cannot be resolved should be considered falsey." + }, + { + "name": "Surrounding Whitespace", + "data": { "boolean": true }, + "expected": " | \t|\t | \n", + "template": " | {{#boolean}}\t|\t{{/boolean}} | \n", + "desc": "Sections should not alter surrounding whitespace." + }, + { + "name": "Internal Whitespace", + "data": { "boolean": true }, + "expected": " | \n | \n", + "template": " | {{#boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n", + "desc": "Sections should not alter internal whitespace." + }, + { + "name": "Indented Inline Sections", + "data": { "boolean": true }, + "expected": " YES\n GOOD\n", + "template": " {{#boolean}}YES{{/boolean}}\n {{#boolean}}GOOD{{/boolean}}\n", + "desc": "Single-line sections should not alter surrounding whitespace." + }, + { + "name": "Standalone Lines", + "data": { "boolean": true }, + "expected": "| This Is\n|\n| A Line\n", + "template": "| This Is\n{{#boolean}}\n|\n{{/boolean}}\n| A Line\n", + "desc": "Standalone lines should be removed from the template." + }, + { + "name": "Indented Standalone Lines", + "data": { "boolean": true }, + "expected": "| This Is\n|\n| A Line\n", + "template": "| This Is\n {{#boolean}}\n|\n {{/boolean}}\n| A Line\n", + "desc": "Indented standalone lines should be removed from the template." + }, + { + "name": "Standalone Line Endings", + "data": { "boolean": true }, + "expected": "|\r\n|", + "template": "|\r\n{{#boolean}}\r\n{{/boolean}}\r\n|", + "desc": "\"\\r\\n\" should be considered a newline for standalone tags." + }, + { + "name": "Standalone Without Previous Line", + "data": { "boolean": true }, + "expected": "#\n/", + "template": " {{#boolean}}\n#{{/boolean}}\n/", + "desc": "Standalone tags should not require a newline to precede them." + }, + { + "name": "Standalone Without Newline", + "data": { "boolean": true }, + "expected": "#\n/\n", + "template": "#{{#boolean}}\n/\n {{/boolean}}", + "desc": "Standalone tags should not require a newline to follow them." + }, + { + "name": "Padding", + "data": { "boolean": true }, + "expected": "|=|", + "template": "|{{# boolean }}={{/ boolean }}|", + "desc": "Superfluous in-tag whitespace should be ignored." + } + ] } diff --git a/tests/unit/data/promise_duplicate_handle.cf b/tests/unit/data/promise_duplicate_handle.cf index 97363a8be6..4286b06bd6 100644 --- a/tests/unit/data/promise_duplicate_handle.cf +++ b/tests/unit/data/promise_duplicate_handle.cf @@ -2,8 +2,6 @@ bundle agent foo { reports: cfengine3:: - "hello world" - handle => "stuff"; - "quux" - handle => "stuff"; + "hello world" handle => "stuff"; + "quux" handle => "stuff"; } diff --git a/tests/unit/data/promiser_empty_varref.cf b/tests/unit/data/promiser_empty_varref.cf index 63b7053f77..4bb240a5c2 100644 --- a/tests/unit/data/promiser_empty_varref.cf +++ b/tests/unit/data/promiser_empty_varref.cf @@ -1,5 +1,5 @@ bundle agent foo { reports: - "$()"; + "$()"; } diff --git a/tests/unit/policy_test.c b/tests/unit/policy_test.c index 26ffea99ce..6d6db41a17 100644 --- a/tests/unit/policy_test.c +++ b/tests/unit/policy_test.c @@ -287,13 +287,13 @@ static void test_policy_json_offsets(void) { JsonElement *main_bundle = JsonArrayGetAsObject(json_bundles, 0); int line = JsonPrimitiveGetAsInteger(JsonObjectGet(main_bundle, "line")); - assert_int_equal(9, line); + assert_int_equal(8, line); JsonElement *json_promise_types = JsonObjectGetAsArray(main_bundle, "promiseTypes"); { JsonElement *json_reports_type = JsonArrayGetAsObject(json_promise_types, 0); line = JsonPrimitiveGetAsInteger(JsonObjectGet(json_reports_type, "line")); - assert_int_equal(11, line); + assert_int_equal(10, line); JsonElement *json_contexts = JsonObjectGetAsArray(json_reports_type, "contexts"); JsonElement *cf_context = JsonArrayGetAsObject(json_contexts, 0); @@ -301,13 +301,13 @@ static void test_policy_json_offsets(void) JsonElement *hello_cf_promise = JsonArrayGetAsObject(cf_context_promises, 0); line = JsonPrimitiveGetAsInteger(JsonObjectGet(hello_cf_promise, "line")); - assert_int_equal(13, line); + assert_int_equal(12, line); JsonElement *hello_cf_attribs = JsonObjectGetAsArray(hello_cf_promise, "attributes"); { JsonElement *friend_pattern_attrib = JsonArrayGetAsObject(hello_cf_attribs, 0); line = JsonPrimitiveGetAsInteger(JsonObjectGet(friend_pattern_attrib, "line")); - assert_int_equal(14, line); + assert_int_equal(12, line); } } } @@ -316,11 +316,11 @@ static void test_policy_json_offsets(void) { JsonElement *control_body = JsonArrayGetAsObject(json_bodies, 0); int line = JsonPrimitiveGetAsInteger(JsonObjectGet(control_body, "line")); - assert_int_equal(4, line); + assert_int_equal(3, line); JsonElement *myperms_body = JsonArrayGetAsObject(json_bodies, 1); line = JsonPrimitiveGetAsInteger(JsonObjectGet(myperms_body, "line")); - assert_int_equal(29, line); + assert_int_equal(27, line); JsonElement *myperms_contexts = JsonObjectGetAsArray(myperms_body, "contexts"); JsonElement *any_context = JsonArrayGetAsObject(myperms_contexts, 0); @@ -328,7 +328,7 @@ static void test_policy_json_offsets(void) { JsonElement *mode_attrib = JsonArrayGetAsObject(any_attribs, 0); line = JsonPrimitiveGetAsInteger(JsonObjectGet(mode_attrib, "line")); - assert_int_equal(31, line); + assert_int_equal(29, line); } }