-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add gherkin tests to verify evaluation details in finally hooks #290
Open
chrfwow
wants to merge
5
commits into
open-feature:main
Choose a base branch
from
chrfwow:Add-evaluation-details-to-finally-hook-stage-#403
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3aa2264
feat: Add evaluation details to finally hook stage #403
chrfwow a31ed83
fixup! feat: Add evaluation details to finally hook stage #403
chrfwow 3a47b13
fixup! feat: Add evaluation details to finally hook stage #403
chrfwow 2dff5ea
fixup! feat: Add evaluation details to finally hook stage #403
chrfwow 89dfff1
fixup! feat: Add evaluation details to finally hook stage #403
chrfwow 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 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 @@ | ||
@hooks | ||
Feature: Evaluation details through hooks | ||
|
||
# This test suite contains scenarios to test the functionality of hooks. | ||
|
||
Background: | ||
Given a stable provider | ||
|
||
Scenario: Passes evaluation details to after and finally hooks | ||
Given a client with added hook | ||
And a boolean-flag with key "boolean-flag" and a default value "false" | ||
When the flag was evaluated with details | ||
Then the "before" hook should have been executed | ||
And the "after, finally after" hooks should be called with evaluation details | ||
| data_type | key | value | | ||
| string | flag_key | boolean-flag | | ||
| boolean | value | true | | ||
| string | variant | on | | ||
| string | reason | STATIC | | ||
| string | error_code | None | | ||
| string | error_message | None | | ||
|
||
# errors | ||
Scenario: Flag not found | ||
Given a client with added hook | ||
And a string-flag with key "missing-flag" and a default value "uh-oh" | ||
When the flag was evaluated with details | ||
Then the "before" hook should have been executed | ||
And the "error" hook should have been executed | ||
And the "finally after" hooks should be called with evaluation details | ||
| data_type | key | value | | ||
| string | flag_key | missing-flag | | ||
| string | value | uh-oh | | ||
| string | variant | None | | ||
| string | reason | ERROR | | ||
| string | error_code | ErrorCode.FLAG_NOT_FOUND | | ||
| string | error_message | Flag 'missing-flag' not found | | ||
|
||
Scenario: Type error | ||
Given a client with added hook | ||
And a string-flag with key "wrong-flag" and a default value "13" | ||
When the flag was evaluated with details | ||
Then the "before" hook should have been executed | ||
And the "error" hook should have been executed | ||
And the "finally after" hooks should be called with evaluation details | ||
| data_type | key | value | | ||
| string | flag_key | wrong-flag | | ||
| integer | value | 13 | | ||
| string | variant | None | | ||
| string | reason | ERROR | | ||
| string | error_code | ErrorCode.TYPE_MISMATCH | | ||
| string | error_message | Expected type <class 'int'> but got <class 'str'> | | ||
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.
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.
Do we want to define the error message?
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.
Hmm, the error message might be very implementation specific, so I agree with you. @aepfli @toddbaert what do you think?
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.
open for both approaches, i do think that normalized error message could be handy, but we should remove any language specific synatx. eg "Expected type Integer but got String" so we can easier map this in other languages to a desired message. But i like the idea of standardized messages throughout the sdks.
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 agree with the standardized error messages. However, I do think this would be a nontrivial change. Should we do this in a follow up issue? Then I would remove the error message from this PR