-
Notifications
You must be signed in to change notification settings - Fork 53
feat: flagd json eval suite #328
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
Conversation
9766ff2
to
e51604c
Compare
@@ -614,6 +612,81 @@ func aStringFlagWithKeyIsEvaluatedAsAnIntegerWithDetailsAndADefaultValue( | |||
}), nil | |||
} | |||
|
|||
func booleanEvaluationDetails(ctx context.Context) (openfeature.BooleanEvaluationDetails, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These functions were previously used by 2 suties (caching
and evaluation
). Now they are just used by one so I've moved/renamed them accordingly.
@@ -655,35 +728,6 @@ func theReasonShouldIndicateAnErrorAndTheErrorCodeShouldIndicateATypeMismatchWit | |||
return nil | |||
} | |||
|
|||
func aProviderIsRegisteredWithCacheDisabled(ctx context.Context) (context.Context, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've commonized this initialization method.
func initializeFlagdJsonScenario(ctx *godog.ScenarioContext) { | ||
ctx.Step(`^a flagd provider is set$`, aFlagdProviderIsSet) | ||
ctx.Step(`^a string flag with key "([^"]*)" is evaluated with default value "([^"]*)"$`, aFlagdStringFlagWithKeyIsEvaluatedWithDefaultValue) | ||
ctx.Step(`^a context containing a key "([^"]*)", with value "([^"]*)"$`, aContextContainingAKeyWithValue) | ||
ctx.Step(`^a context containing a nested property with outer key "([^"]*)" and inner key "([^"]*)", with value "([^"]*)"$`, aContextContainingANestedPropertyWithOuterKeyAndInnerKeyWithValue) | ||
ctx.Step(`^the returned value should be "([^"]*)"$`, theReturnedValueShouldBe) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entire gherkin test suite here is captured by these 4 tests, which are run "matrix style" with the table values.
|
||
return got, nil | ||
} | ||
func aFlagdProviderIsSet(ctx context.Context) (context.Context, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
common init method, used by both suites.
e51604c
to
fd58f0b
Compare
Signed-off-by: Todd Baert <[email protected]>
fd58f0b
to
0f78059
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved with an optional suggestion
Signed-off-by: Todd Baert <[email protected]>
Co-authored-by: Florian Bacher <[email protected]> Signed-off-by: Todd Baert <[email protected]>
Co-authored-by: Florian Bacher <[email protected]> Signed-off-by: Todd Baert <[email protected]>
Uses test suite defined [here](https://github.com/open-feature/flagd-testbed/blob/main/gherkin/flagd-json-evaluator.feature) to validate json evaluator behavior end-to-end, by using the test suite added [here](open-feature/go-sdk-contrib#328). --------- Signed-off-by: Todd Baert <[email protected]>
Signed-off-by: Todd Baert <[email protected]> Co-authored-by: Florian Bacher <[email protected]> Signed-off-by: liran2000 <[email protected]>
This PR:
caching
test. I will add a simplified version laterHere is a PR in flagd using this suite: open-feature/flagd#898