-
Notifications
You must be signed in to change notification settings - Fork 5k
Fix/test case/err desc main #33246
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
Fix/test case/err desc main #33246
Conversation
Summary of ChangesHello @facetosea, 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 error handling within a specific stream processing test case. The primary goal is to make the test more resilient to variations in error messages and to provide clearer, more informative logs when stream creation fails due to incorrect usage of window query parameters. By refining the error detection logic and improving logging, the PR contributes to more robust and maintainable test infrastructure. 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 improves exception handling in a test case. The changes are good, especially the use of raise to re-raise exceptions, which is a best practice. However, I've identified a potential bug in the test logic where a successful execution (when a failure is expected) would not fail the test. I've also suggested making the error message check case-insensitive for better robustness.
| try: | ||
| tdSql.execute(stream1,queryTimes=2) | ||
| except Exception as e: | ||
| if "_WSTART, _WEND and _WDURATION can only be used in window query" in str(e): | ||
| tdLog.info(f"create stream error :_WSTART, _WEND and _WDURATION can only be used in window query") | ||
| if "_WSTART, _WEND" in str(e) and "can only be used in window query" in str(e): | ||
| tdLog.info(f"create stream error: {e}") | ||
| else: | ||
| raise Exception(f"error: _WSTART, _WEND and _WDURATION must be used in window query") | ||
| raise |
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.
While the changes are an improvement, the test logic is still incomplete. It doesn't handle the case where tdSql.execute succeeds without raising an exception. In this scenario, the test should fail, but it will currently pass silently. An explicit assertion should be added to ensure an exception is raised.
Additionally, to make the error message check more robust, it's a good practice to make it case-insensitive.
| try: | |
| tdSql.execute(stream1,queryTimes=2) | |
| except Exception as e: | |
| if "_WSTART, _WEND and _WDURATION can only be used in window query" in str(e): | |
| tdLog.info(f"create stream error :_WSTART, _WEND and _WDURATION can only be used in window query") | |
| if "_WSTART, _WEND" in str(e) and "can only be used in window query" in str(e): | |
| tdLog.info(f"create stream error: {e}") | |
| else: | |
| raise Exception(f"error: _WSTART, _WEND and _WDURATION must be used in window query") | |
| raise | |
| try: | |
| tdSql.execute(stream1,queryTimes=2) | |
| raise AssertionError("Exception was expected when creating stream, but it was not raised.") | |
| except Exception as e: | |
| err_msg = str(e).lower() | |
| if "_wstart, _wend" in err_msg and "can only be used in window query" in err_msg: | |
| tdLog.info(f"create stream error: {e}") | |
| else: | |
| raise |
Description
Please briefly describe the code changes in this pull request.
Checklist
Please check the items in the checklist if applicable.