Skip to content

Commit

Permalink
feat: Gherkin file for caching evaluation
Browse files Browse the repository at this point in the history
This files add another gherkin file for cache evaluation in RPC mode.

Signed-off-by: Simon Schrottner <[email protected]>
  • Loading branch information
aepfli committed Nov 26, 2024
1 parent 496f116 commit 4368db2
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions gherkin/flagd-rpc-caching.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Feature: Flag evaluation with Caching

# This test suite contains scenarios to test the flag evaluation API with caching (RPC only)

Background:
Given a provider is registered

Scenario: Resolves boolean details with caching
When a boolean flag with key "boolean-flag" is evaluated with details and default value "false"
Then the resolved boolean details value should be "true", the variant should be "on", and the reason should be "STATIC"
Then the resolved boolean details value should be "true", the variant should be "on", and the reason should be "CACHED"

Scenario: Resolves string details with caching
When a string flag with key "string-flag" is evaluated with details and default value "bye"
Then the resolved string details value should be "hi", the variant should be "greeting", and the reason should be "STATIC"
Then the resolved string details value should be "hi", the variant should be "greeting", and the reason should be "CACHED"

Scenario: Resolves integer details with caching
When an integer flag with key "integer-flag" is evaluated with details and default value 1
Then the resolved integer details value should be 10, the variant should be "ten", and the reason should be "STATIC"
Then the resolved integer details value should be 10, the variant should be "ten", and the reason should be "CACHED"

Scenario: Resolves float details with caching
When a float flag with key "float-flag" is evaluated with details and default value 0.1
Then the resolved float details value should be 0.5, the variant should be "half", and the reason should be "STATIC"
Then the resolved float details value should be 0.5, the variant should be "half", and the reason should be "CACHED"

Scenario: Resolves object details with caching
When an object flag with key "object-flag" is evaluated with details and a null default value
Then the resolved object details value should be contain fields "showImages", "title", and "imagesPerPage", with values "true", "Check out these pics!" and 100, respectively
And the variant should be "template", and the reason should be "STATIC"
Then the resolved object details value should be contain fields "showImages", "title", and "imagesPerPage", with values "true", "Check out these pics!" and 100, respectively
And the variant should be "template", and the reason should be "CACHED"

Scenario: Flag change event with caching
When a string flag with key "changing-flag" is evaluated with details
When a PROVIDER_CONFIGURATION_CHANGED handler is added
And a flag with key "changing-flag" is modified
Then the returned reason should be "STATIC"
Then the returned reason should be "CACHED"
Then the PROVIDER_CONFIGURATION_CHANGED handler must run
And the event details must indicate "changing-flag" was altered
Then the returned reason should be "STATIC"
Then the returned reason should be "CACHED"

0 comments on commit 4368db2

Please sign in to comment.