-
Notifications
You must be signed in to change notification settings - Fork 12
feat: add disabled flag evaluation test scenarios #376
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e13251e
feat: add disabled flag evaluation test scenarios
jonathannorris 56894d2
fix: add object example and correct cross-flagset selector
jonathannorris 834ed06
fix: add @disabled tag, drop bulk eval scenario
jonathannorris 5af9e82
fix: move @in-process to feature level
jonathannorris 53697b2
fixup: move rpc annotation, add flag set
toddbaert 0bb4ca4
fixup: use default in evaluator tests
toddbaert b9929ee
fixup: formatting
toddbaert 87928ac
fixup: bump flagd base image to v0.16.0
toddbaert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| @disabled | ||
| Feature: Evaluator disabled flag evaluation | ||
|
|
||
| # Validates that disabled flags resolve with reason=DISABLED. The evaluator | ||
| # substitutes the caller-provided default value and omits the variant. | ||
| # Flags are configured in evaluator/flags/testkit-flags.json. | ||
| # Relates to: https://github.com/open-feature/flagd/issues/1965 | ||
|
|
||
| Scenario Outline: Resolve disabled flag returns reason DISABLED with the default value | ||
| Given an evaluator | ||
| And a <type>-flag with key "<key>" and a fallback value "<default>" | ||
| When the flag was evaluated with details | ||
| Then the resolved details value should be "<default>" | ||
| And the reason should be "DISABLED" | ||
|
|
||
| Examples: | ||
| | key | type | default | | ||
| | disabled-boolean-flag | Boolean | false | | ||
| | disabled-string-flag | String | bye | | ||
| | disabled-integer-flag | Integer | 1 | | ||
| | disabled-float-flag | Float | 0.1 | | ||
| | disabled-object-flag | Object | {} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| { | ||
| "flags": { | ||
| "disabled-boolean-flag": { | ||
| "state": "DISABLED", | ||
| "variants": { | ||
| "on": true, | ||
| "off": false | ||
| }, | ||
| "defaultVariant": "on" | ||
| }, | ||
| "disabled-string-flag": { | ||
| "state": "DISABLED", | ||
| "variants": { | ||
| "greeting": "hi", | ||
| "parting": "bye" | ||
| }, | ||
| "defaultVariant": "greeting" | ||
| }, | ||
| "disabled-integer-flag": { | ||
| "state": "DISABLED", | ||
| "variants": { | ||
| "one": 1, | ||
| "ten": 10 | ||
| }, | ||
| "defaultVariant": "ten" | ||
| }, | ||
| "disabled-float-flag": { | ||
| "state": "DISABLED", | ||
| "variants": { | ||
| "tenth": 0.1, | ||
| "half": 0.5 | ||
| }, | ||
| "defaultVariant": "half" | ||
| }, | ||
| "disabled-object-flag": { | ||
| "state": "DISABLED", | ||
| "variants": { | ||
| "empty": {}, | ||
| "template": { | ||
| "showImages": true, | ||
| "title": "Check out these pics!", | ||
| "imagesPerPage": 100 | ||
| } | ||
| }, | ||
| "defaultVariant": "template" | ||
| }, | ||
| "cross-flagset-flag": { | ||
| "state": "DISABLED", | ||
| "variants": { | ||
| "on": true, | ||
| "off": false | ||
| }, | ||
| "defaultVariant": "on" | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| @disabled @in-process @rpc | ||
| Feature: Disabled flag evaluation | ||
|
jonathannorris marked this conversation as resolved.
|
||
|
|
||
| # Test coverage for disabled flag behavior. A flag with state=DISABLED resolves | ||
| # successfully with reason=DISABLED; the evaluator substitutes the caller-provided | ||
| # default value and omits the variant. | ||
| # Relates to: https://github.com/open-feature/flagd/issues/1965 | ||
|
|
||
| Scenario Outline: Evaluating a disabled flag returns reason DISABLED and code default | ||
| Given an option "cache" of type "CacheType" with value "disabled" | ||
| And a stable flagd provider | ||
|
jonathannorris marked this conversation as resolved.
|
||
| And a <type>-flag with key "<key>" and a default value "<default>" | ||
| When the flag was evaluated with details | ||
| Then the resolved details value should be "<default>" | ||
| And the reason should be "DISABLED" | ||
|
|
||
| Examples: | ||
| | key | type | default | | ||
| | disabled-boolean-flag | Boolean | false | | ||
| | disabled-string-flag | String | bye | | ||
| | disabled-integer-flag | Integer | 1 | | ||
| | disabled-float-flag | Float | 0.1 | | ||
|
jonathannorris marked this conversation as resolved.
jonathannorris marked this conversation as resolved.
|
||
| | disabled-object-flag | Object | {} | | ||
|
|
||
| Scenario Outline: Flag disabled in one flag set, enabled in another | ||
| Given an option "cache" of type "CacheType" with value "disabled" | ||
| And an option "selector" of type "String" with value "<selector>" | ||
| And a stable flagd provider | ||
| And a Boolean-flag with key "cross-flagset-flag" and a default value "false" | ||
| When the flag was evaluated with details | ||
| Then the resolved details value should be "<resolved_value>" | ||
| And the reason should be "<reason>" | ||
|
|
||
| Examples: | ||
| | selector | resolved_value | reason | | ||
| | flags/allFlags.json | false | DISABLED | | ||
| | rawflags/selector-flags.json | true | STATIC | | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.