Skip to content

Commit 30f7c8b

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 30f7c8b

File tree

2 files changed

+49
-17
lines changed

2 files changed

+49
-17
lines changed

gherkin/contextEnrichment.feature

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
And a ready event handler
18+
When the flag was evaluated with details
19+
Then the resolved details value should be "INTERNAL"
20+
When the connection is lost for 6s
21+
And a stale event was fired
22+
When the flag was evaluated with details
23+
Then the resolved details value should be "INTERNAL"
24+
When a ready event was fired
25+
26+
@grace @rpc
27+
Scenario: Use enriched context on connection error for RPC
28+
Given a String-flag with key "flagd-context-aware" and a default value "not"
29+
And a stale event handler
30+
And a ready event handler
31+
When the flag was evaluated with details
32+
Then the resolved details value should be "INTERNAL"
33+
When the connection is lost for 6s
34+
And a stale event was fired
35+
When the flag was evaluated with details
36+
Then the resolved details value should be "not"
37+
When a ready event was fired
38+
39+
@rpc @caching
40+
Scenario: Use enriched context on RPC connection will not cache the value
41+
Given a String-flag with key "flagd-context-aware" and a default value "not"
42+
And a change event handler
43+
And a ready event handler
44+
When the flag was modified
45+
And a change event was fired
46+
And the flag was evaluated with details
47+
Then the reason should be "TARGETING_MATCH"
48+
When the flag was evaluated with details
49+
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)