Skip to content

Commit 4763b1c

Browse files
committed
feat: improve contextEnrichment to handle special cases.
relates: open-feature/java-sdk-contrib#1230 Signed-off-by: Simon Schrottner <[email protected]>
1 parent 34a0c31 commit 4763b1c

File tree

2 files changed

+44
-17
lines changed

2 files changed

+44
-17
lines changed

gherkin/contextEnrichment.feature

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
@contextEnrichment
2+
Feature: Context Enrichment
3+
4+
Background:
5+
And a stable flagd provider
6+
7+
@in-process @rpc
8+
Scenario: Use enriched context
9+
Given a String-flag with key "flagd-context-aware" and a default value "not"
10+
When the flag was evaluated with details
11+
Then the resolved details value should be "INTERNAL"
12+
13+
@grace @in-process
14+
Scenario: Use enriched context on connection error for IN-PROCESS
15+
Given a String-flag with key "flagd-context-aware" and a default value "not"
16+
And a stale event handler
17+
When the flag was evaluated with details
18+
Then the resolved details value should be "INTERNAL"
19+
When the connection is lost for 6s
20+
And a stale event was fired
21+
When the flag was evaluated with details
22+
Then the resolved details value should be "INTERNAL"
23+
24+
@grace @rpc
25+
Scenario: Use enriched context on connection error for RPC
26+
Given a String-flag with key "flagd-context-aware" and a default value "not"
27+
And a stale event handler
28+
When the flag was evaluated with details
29+
Then the resolved details value should be "INTERNAL"
30+
When the connection is lost for 6s
31+
And a stale event was fired
32+
When the flag was evaluated with details
33+
Then the resolved details value should be "not"
34+
35+
@rpc @caching
36+
Scenario: Use enriched context on RPC connection will not cache the value
37+
Given a String-flag with key "flagd-context-aware" and a default value "not"
38+
And a change event handler
39+
When the flag was modified
40+
And a change event was fired
41+
And the flag was evaluated with details
42+
Then the reason should be "TARGETING_MATCH"
43+
When the flag was evaluated with details
44+
Then the reason should be "TARGETING_MATCH"

gherkin/targeting.feature

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -144,20 +144,3 @@ Feature: Targeting rules
144144
| missing-variant-targeting-flag | 3 |
145145
| non-string-variant-targeting-flag | 2 |
146146
| empty-targeting-flag | 1 |
147-
148-
@contextEnrichment
149-
Scenario: Use enriched context
150-
Given a String-flag with key "flagd-context-aware" and a default value "not"
151-
When the flag was evaluated with details
152-
Then the resolved details value should be "INTERNAL"
153-
154-
@contextEnrichment @grace
155-
Scenario: Use enriched context on connection error
156-
Given a String-flag with key "flagd-context-aware" and a default value "not"
157-
And a stale event handler
158-
When the flag was evaluated with details
159-
Then the resolved details value should be "INTERNAL"
160-
When the connection is lost for 6s
161-
And a stale event was fired
162-
When the flag was evaluated with details
163-
Then the resolved details value should be "INTERNAL"

0 commit comments

Comments
 (0)