Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve contextEnrichment to handle special cases. #229

Merged
merged 2 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions gherkin/contextEnrichment.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@contextEnrichment
Feature: Context Enrichment

Background:
Given a stable flagd provider

@in-process @rpc
Scenario: Use enriched context
Given a String-flag with key "flagd-context-aware" and a default value "not"
When the flag was evaluated with details
Then the resolved details value should be "INTERNAL"

@grace @in-process
Scenario: Use enriched context on connection error for IN-PROCESS
Given a String-flag with key "flagd-context-aware" and a default value "not"
And a stale event handler
And a ready event handler
When the flag was evaluated with details
Then the resolved details value should be "INTERNAL"
When the connection is lost for 6s
And a stale event was fired
When the flag was evaluated with details
Then the resolved details value should be "INTERNAL"
When a ready event was fired

@grace @rpc
Scenario: Use enriched context on connection error for RPC
Given a String-flag with key "flagd-context-aware" and a default value "not"
And a stale event handler
And a ready event handler
When the flag was evaluated with details
Then the resolved details value should be "INTERNAL"
When the connection is lost for 6s
And a stale event was fired
When the flag was evaluated with details
Then the resolved details value should be "not"
When a ready event was fired

@rpc @caching
Scenario: Use enriched context on RPC connection will not cache the value
Given a String-flag with key "flagd-context-aware" and a default value "not"
And a change event handler
And a ready event handler
When the flag was modified
And a change event was fired
And the flag was evaluated with details
Then the reason should be "TARGETING_MATCH"
# ensure that we do not cache a "TARGETING_MATCH", we should only cache evaluation with a "STATIC" reason
When the flag was evaluated with details
Then the reason should be "TARGETING_MATCH"
17 changes: 0 additions & 17 deletions gherkin/targeting.feature
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,3 @@ Feature: Targeting rules
| missing-variant-targeting-flag | 3 |
| non-string-variant-targeting-flag | 2 |
| empty-targeting-flag | 1 |

@contextEnrichment
Scenario: Use enriched context
Given a String-flag with key "flagd-context-aware" and a default value "not"
When the flag was evaluated with details
Then the resolved details value should be "INTERNAL"

@contextEnrichment @grace
Scenario: Use enriched context on connection error
Given a String-flag with key "flagd-context-aware" and a default value "not"
And a stale event handler
When the flag was evaluated with details
Then the resolved details value should be "INTERNAL"
When the connection is lost for 6s
And a stale event was fired
When the flag was evaluated with details
Then the resolved details value should be "INTERNAL"