Skip to content

Commit a04a65e

Browse files
authoredDec 2, 2024··
feat: Gherkin file for caching evaluation (#155)
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
1 parent fe9c3c8 commit a04a65e

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
 

‎gherkin/flagd-rpc-caching.feature

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Feature: Flag evaluation with Caching
2+
3+
# This test suite contains scenarios to test the flag evaluation API with caching (RPC only)
4+
5+
Background:
6+
Given a provider is registered
7+
8+
Scenario: Resolves boolean details with caching
9+
When a boolean flag with key "boolean-flag" is evaluated with details and default value "false"
10+
Then the resolved boolean details value should be "true", the variant should be "on", and the reason should be "STATIC"
11+
Then the resolved boolean details value should be "true", the variant should be "on", and the reason should be "CACHED"
12+
13+
Scenario: Resolves string details with caching
14+
When a string flag with key "string-flag" is evaluated with details and default value "bye"
15+
Then the resolved string details value should be "hi", the variant should be "greeting", and the reason should be "STATIC"
16+
Then the resolved string details value should be "hi", the variant should be "greeting", and the reason should be "CACHED"
17+
18+
Scenario: Resolves integer details with caching
19+
When an integer flag with key "integer-flag" is evaluated with details and default value 1
20+
Then the resolved integer details value should be 10, the variant should be "ten", and the reason should be "STATIC"
21+
Then the resolved integer details value should be 10, the variant should be "ten", and the reason should be "CACHED"
22+
23+
Scenario: Resolves float details with caching
24+
When a float flag with key "float-flag" is evaluated with details and default value 0.1
25+
Then the resolved float details value should be 0.5, the variant should be "half", and the reason should be "STATIC"
26+
Then the resolved float details value should be 0.5, the variant should be "half", and the reason should be "CACHED"
27+
28+
Scenario: Resolves object details with caching
29+
When an object flag with key "object-flag" is evaluated with details and a null default value
30+
Then the resolved object details value should be contain fields "showImages", "title", and "imagesPerPage", with values "true", "Check out these pics!" and 100, respectively
31+
And the variant should be "template", and the reason should be "STATIC"
32+
Then the resolved object details value should be contain fields "showImages", "title", and "imagesPerPage", with values "true", "Check out these pics!" and 100, respectively
33+
And the variant should be "template", and the reason should be "CACHED"
34+
35+
Scenario: Flag change event with caching
36+
When a string flag with key "changing-flag" is evaluated with details
37+
When a PROVIDER_CONFIGURATION_CHANGED handler is added
38+
And a flag with key "changing-flag" is modified
39+
Then the returned reason should be "STATIC"
40+
Then the returned reason should be "CACHED"
41+
Then the PROVIDER_CONFIGURATION_CHANGED handler must run
42+
And the event details must indicate "changing-flag" was altered
43+
Then the returned reason should be "STATIC"
44+
Then the returned reason should be "CACHED"

0 commit comments

Comments
 (0)
Please sign in to comment.