-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the function name to the result cache key
The function cache only used the args values, which in some cases could lead to mixing results from different functions with the same arguments. Ticket: CFE-4244 Changelog: Cashed policy function results now take into account number of arguments and function name. Signed-off-by: Lars Erik Wik <[email protected]> Co-authored-by: Alexis Mousset <[email protected]>
- Loading branch information
Showing
2 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
####################################################### | ||
# | ||
# Test that the function result cache checks function name | ||
# | ||
####################################################### | ||
|
||
body common control | ||
{ | ||
inputs => { "../../default.cf.sub" }; | ||
bundlesequence => { default("$(this.promise_filename)") }; | ||
version => "1.0"; | ||
} | ||
|
||
####################################################### | ||
|
||
|
||
bundle agent init | ||
{ | ||
vars: | ||
"agent_regex" string => ".*cf-agent.*"; | ||
} | ||
|
||
####################################################### | ||
|
||
bundle common test | ||
{ | ||
meta: | ||
"description" -> { "CFE-4244" } | ||
string => "Test that the function result cache checks function name"; | ||
|
||
vars: | ||
"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}"); | ||
} | ||
|
||
|
||
####################################################### | ||
|
||
bundle agent check | ||
{ | ||
methods: | ||
_pass:: | ||
"pass" usebundle => dcs_pass("$(this.promise_filename)"); | ||
|
||
!_pass:: | ||
"pass" usebundle => dcs_fail("$(this.promise_filename)"); | ||
} |