-
Notifications
You must be signed in to change notification settings - Fork 9
chore: add test to ensure fatal state on forbidden error (#756) #302
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
chore: add test to ensure fatal state on forbidden error (#756) #302
Conversation
Signed-off-by: Alexandra Oberaigner <[email protected]>
Summary of ChangesHello @alexandraoberaigner, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the client's error handling by introducing a mechanism to simulate and test forbidden responses from the flagd provider. It configures the Envoy proxy to serve a 403 Forbidden error and adds an end-to-end Gherkin test to ensure that clients properly detect this state and transition to a fatal error, improving the client's resilience to authorization issues. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request effectively adds a test to ensure the client enters a fatal state on a 'permission denied' (403) error. This is accomplished by introducing a new Envoy proxy listener in docker-compose.yaml to simulate the error, and a new Gherkin scenario in connection.feature to test the client's reaction. The implementation is correct and focused. My only feedback is a suggestion to improve the maintainability of the Envoy configuration by extracting it to a separate file, as the current inline approach is becoming unwieldy.
| Given a forbidden flagd provider | ||
| And a error event handler | ||
| Then the error event handler should have been executed within 5000ms | ||
| And the client is in fatal state |
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.
Looks like this is the only new gherkin clause?
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.
yes it is
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.
Does the client have a state? Or do we throw an fatal 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.
Something like "and the error should be fatal" might be better suited, because we are specifically requesting an error, and the connection is with the error and not specifically with the client. Or am I wrong here? For flagd it is important that we throw a fatal event. What the SDK does is not as important for us. At least in this testbed
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 think either way we are testing something on the client, but I agree that if we can do this with fewer new steps that's better. Do we have a step that we can use to check the error in the error handler and verify it's FATAL?
If so I would support that change for sure!
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'm checking the client.State() in the implementation. (See code line)
The event doesn't have the fatal error code, its just a normal error event thats produced. However, the state of the client is in fatal.
Do you think I need to adapt the event mocking logic to include also the fatal error code? or add a handler for fatal?
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 am not sure if the ErrorHandler should know about if it is an error state or fatal state, maybe also something worth defining. But most importantly we should normalize the naming, currently every then-step uses the phrasing should be and we should stay consistent here.
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 one nit.
Co-authored-by: Todd Baert <[email protected]> Signed-off-by: alexandraoberaigner <[email protected]>
This PR
Related Issues
makes sure flagd providers fix this bug #756
Follow-up Tasks
How to test
run the inprocess e2e tests of any flagd provider that uses the gherkin suite. make sure @forbidden is an enabled tag