-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Todd Baert <[email protected]>
- Loading branch information
Showing
5 changed files
with
121 additions
and
49 deletions.
There are no files selected for viewing
This file contains 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 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,52 @@ | ||
{ | ||
"flags": { | ||
"some-email-targeted-flag": { | ||
"state": "ENABLED", | ||
"variants": { | ||
"hi": "hi", | ||
"bye": "bye", | ||
"none": "none" | ||
}, | ||
"defaultVariant": "none", | ||
"targeting": { | ||
"if": [ | ||
{ | ||
"$ref": "is_ballmer" | ||
}, | ||
"hi", | ||
"bye" | ||
] | ||
} | ||
}, | ||
"some-other-email-targeted-flag": { | ||
"state": "ENABLED", | ||
"variants": { | ||
"yes": "yes", | ||
"no": "no", | ||
"none": "none" | ||
}, | ||
"defaultVariant": "none", | ||
"targeting": { | ||
"if": [ | ||
{ | ||
"$ref": "is_ballmer" | ||
}, | ||
"yes", | ||
"no" | ||
] | ||
} | ||
} | ||
}, | ||
"$evaluators": { | ||
"is_ballmer": { | ||
"==": [ | ||
"[email protected]", | ||
{ | ||
"var": [ | ||
"email" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains 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,63 @@ | ||
Feature: flagd json evaluation | ||
|
||
# This test suite contains scenarios to test the json-evaluation of flagd and flag-in-process providers. | ||
# It's associated with the flags configured in flags/changing-flag.json, flags/zero-flags.json, flags/custom-ops.json and evaluator-refs.json. | ||
# It should be used in conjunection with the suites supplied by the OpenFeature specification. | ||
|
||
Background: | ||
Given a flagd provider is set | ||
|
||
# evaluator refs | ||
Scenario Outline: Evaluator reuse | ||
When a string flag with key <key> is evaluated with default value "fallback" | ||
And a context containing a key "email", with value "[email protected]" | ||
Then the returned value should be <value> | ||
Examples: | ||
| key | value | | ||
| some-email-targeted-flag | hi | | ||
| some-other-email-targeted-flag | yes | | ||
|
||
# custom operators | ||
Scenario Outline: Fractional operator | ||
When a string flag with key "fractional-flag" is evaluated with default value "fallback" | ||
And a context containing a nested property with outer key "user" and inner key "name", with value <name> | ||
Then the returned value should be <value> | ||
Examples: | ||
| name | value | | ||
| jack | clubs | | ||
| queen | diamonds | | ||
| ace | hearts | | ||
| joker | spades | | ||
|
||
Scenario Outline: Substring operators | ||
When a string flag with key "starts-ends-flag" is evaluated with default value "fallback" | ||
And a context containing a key "id", with value <id> | ||
Then the returned value should be <value> | ||
Examples: | ||
| id | value | | ||
| abcdef | prefix | | ||
| uvwxyz | postfix | | ||
| abcxyz | prefix | | ||
| lmnopq | nomatch | | ||
|
||
Scenario Outline: Semantic version operator numeric comparision | ||
When a string flag with key "equal-greater-lesser-version-flag" is evaluated with default value "fallback" | ||
And a context containing a key "version", with value <version> | ||
Then the returned value should be <value> | ||
Examples: | ||
| version | value | | ||
| 2.0.0 | equal | | ||
| 2.1.0 | greater | | ||
| 1.9.0 | lesser | | ||
| 2.0.0-alpha | lesser | | ||
| 2.0.0.0 | invalid | | ||
|
||
Scenario Outline: Semantic version operator semantic comparision | ||
When a string flag with key "major-minor-version-flag" is evaluated with default value "fallback" | ||
And a context containing a key "version", with value <version> | ||
Then the returned value should be <value> | ||
Examples: | ||
| version | value | | ||
| 3.0.1 | minor | | ||
| 3.1.0 | major | | ||
| 4.0.0 | none | |
This file contains 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 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