From a721f58fb0b598569469a3d369deaaf4437ad34c Mon Sep 17 00:00:00 2001 From: Todd Baert Date: Tue, 18 Feb 2025 14:56:23 -0500 Subject: [PATCH 1/3] feat: add context-sensitive test with connection err Adds a test for asserting the injected context still works after connection error/stale events. Signed-off-by: Todd Baert --- gherkin/targeting.feature | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gherkin/targeting.feature b/gherkin/targeting.feature index 90551aa..8a6fb72 100644 --- a/gherkin/targeting.feature +++ b/gherkin/targeting.feature @@ -146,7 +146,19 @@ Feature: Targeting rules | empty-targeting-flag | 1 | @flagdcontext - Scenario: Use Flagd provided context + Scenario: Use injected 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" + + + @flagdcontext + Scenario: Use injected context after 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" From 864554e55743e8caf979607ead0ac469275afeb1 Mon Sep 17 00:00:00 2001 From: Todd Baert Date: Tue, 18 Feb 2025 15:00:51 -0500 Subject: [PATCH 2/3] Update targeting.feature Signed-off-by: Todd Baert --- gherkin/targeting.feature | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gherkin/targeting.feature b/gherkin/targeting.feature index 8a6fb72..6f12b6d 100644 --- a/gherkin/targeting.feature +++ b/gherkin/targeting.feature @@ -145,15 +145,15 @@ Feature: Targeting rules | non-string-variant-targeting-flag | 2 | | empty-targeting-flag | 1 | - @flagdcontext - Scenario: Use injected context + @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" - - @flagdcontext - Scenario: Use injected context after connection error + + @contextEnrichment + 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 From 7cb0e111f74b5d53da67a0e63bcee3bdf71ead0b Mon Sep 17 00:00:00 2001 From: Todd Baert Date: Tue, 18 Feb 2025 15:02:05 -0500 Subject: [PATCH 3/3] Update targeting.feature Signed-off-by: Todd Baert --- gherkin/targeting.feature | 1 - 1 file changed, 1 deletion(-) diff --git a/gherkin/targeting.feature b/gherkin/targeting.feature index 6f12b6d..a033057 100644 --- a/gherkin/targeting.feature +++ b/gherkin/targeting.feature @@ -151,7 +151,6 @@ Feature: Targeting rules When the flag was evaluated with details Then the resolved details value should be "INTERNAL" - @contextEnrichment Scenario: Use enriched context on connection error Given a String-flag with key "flagd-context-aware" and a default value "not"