Skip to content

Commit

Permalink
The third time is the charm
Browse files Browse the repository at this point in the history
Ticket: CFE-4244
Changelog: None
Signed-off-by: Lars Erik Wik <[email protected]>
  • Loading branch information
larsewi committed Sep 13, 2023
1 parent 6a6d7c1 commit 690a0c5
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions tests/acceptance/01_vars/02_functions/cache_name.cf
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,31 @@ body common control

bundle agent init
{
vars:
"agent_regex" string => ".*cf-agent.*";
}

#######################################################

bundle agent test
{
vars:
"res1" data => findprocesses("${init.agent_regex}");
meta:
"description" -> { "CFE-4244" }
string => "Test that the function result cache checks function name";

classes:
# must not reuse result from previous line
# is reused, produces a type error
"_pass" expression => processexists("${init.agent_regex}");
vars:
"res1" string => format("cfengine.com");
# must not reuse result from previous line
"res2" string => canonify("cfengine.com");
}


#######################################################

bundle agent check
{
methods:
_pass::
"pass" usebundle => dcs_pass("$(this.promise_filename)");
reports:
DEBUG::
"res1!=res2 -> '$(test.res1)'!='$(test.res2)'";

!_pass::
"pass" usebundle => dcs_fail("$(this.promise_filename)");
methods:
"any" usebundle => dcs_check_strcmp("${test.res1}", "${test.res2}", "$(this.promise_filename)", "yes");
}

0 comments on commit 690a0c5

Please sign in to comment.