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: fractional non-percentage and shorthand #132

Merged
merged 1 commit into from
Jun 28, 2024
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
15 changes: 15 additions & 0 deletions flags/custom-ops.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@
]
}
},
"fractional-flag-shorthand": {
"state": "ENABLED",
"variants": {
"heads": "heads",
"tails": "tails",
"draw": "draw"
},
"defaultVariant": "draw",
"targeting": {
"fractional": [
[ "heads" ],
[ "tails", 1 ]
]
}
},
"fractional-flag-A-shared-seed": {
"state": "ENABLED",
"variants": {
Expand Down
11 changes: 10 additions & 1 deletion gherkin/flagd-json-evaluator.feature
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ Feature: flagd json evaluation
| "nine" | "hearts" |
| 3 | "diamonds" |

Scenario Outline: Fractional operator shorthand
When a string flag with key "fractional-flag-shorthand" is evaluated with default value "fallback"
And a context containing a targeting key with value <targeting key>
Then the returned value should be <value>
Comment on lines +33 to +36
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These bindings already exist, so no new implementation code needs to be written. Consumers can just update the flagd image and the submodule containing the gherkin.

Examples:
| targeting key | value |
| "jane@company.com" | "heads" |
| "joe@company.com" | "tails" |

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>
Expand All @@ -46,7 +55,7 @@ Feature: flagd json evaluation
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 |
| name | value |
| "jack" | "ace-of-hearts" |
| "queen" | "ace-of-spades" |
| "ten" | "ace-of-hearts" |
Expand Down