Skip to content
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

feat: test multiple fractional flags with shared seed #115

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 50 additions & 1 deletion flags/custom-ops.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,56 @@
"defaultVariant": "wild",
"targeting": {
"fractional": [
{ "var": "user.name" },
{"cat": [
{ "var": "$flagd.flagKey" },
{ "var": "user.name" }
]},
[ "clubs", 25 ],
[ "diamonds", 25 ],
[ "hearts", 25 ],
[ "spades", 25 ]
]
}
},
"fractional-flag-A-shared-seed": {
"state": "ENABLED",
"variants": {
"clubs": "clubs",
"diamonds": "diamonds",
"hearts": "hearts",
"spades": "spades",
"wild": "wild"
},
"defaultVariant": "wild",
"targeting": {
"fractional": [
{ "cat": [
"shared-seed",
{ "var": "user.name" }
]},
[ "clubs", 25 ],
[ "diamonds", 25 ],
[ "hearts", 25 ],
[ "spades", 25 ]
]
}
},
"fractional-flag-B-shared-seed": {
"state": "ENABLED",
"variants": {
"clubs": "ace-of-clubs",
"diamonds": "ace-of-diamonds",
"hearts": "ace-of-hearts",
"spades": "ace-of-spades",
"wild": "wild"
},
"defaultVariant": "wild",
"targeting": {
"fractional": [
{ "cat": [
"shared-seed",
{ "var": "user.name" }
]},
[ "clubs", 25 ],
[ "diamonds", 25 ],
[ "hearts", 25 ],
Expand Down
24 changes: 23 additions & 1 deletion gherkin/flagd-json-evaluator.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,29 @@ Feature: flagd json evaluation
| "queen" | "clubs" |
| "ten" | "diamonds" |
| "nine" | "hearts" |
| 3 | "wild" |
| 3 | "diamonds" |

Scenario Outline: Fractional operator with shared seed
When a string flag with key "fractional-flag-A-shared-seed" 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" | "hearts" |
| "queen" | "spades" |
| "ten" | "hearts" |
| "nine" | "diamonds" |

Scenario Outline: Second fractional operator with shared seed
When a string flag with key "fractional-flag-B-shared-seed" 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" | "ace-of-hearts" |
| "queen" | "ace-of-spades" |
| "ten" | "ace-of-hearts" |
| "nine" | "ace-of-diamonds" |

Scenario Outline: Substring operators
When a string flag with key "starts-ends-flag" is evaluated with default value "fallback"
Expand Down
Loading