-
Notifications
You must be signed in to change notification settings - Fork 109
Adding a test surface header to cron tests #5633
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
base: master
Are you sure you want to change the base?
Adding a test surface header to cron tests #5633
Conversation
Summary of ChangesHello @lucyking140, 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 aims to enhance the clarity and effectiveness of cron-based integration tests by implementing a dedicated surface header. This change allows the system to accurately identify and categorize cron test queries as distinct test results, rather than generic 'unknown' queries. The primary benefit is improved visibility into test outcomes within autopush, which will facilitate quicker recognition and resolution of regressions, ultimately bolstering the reliability of deployments. 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
|
…to lucysking/cron-header
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 adds a x-surface header to cron test queries, which is a good improvement for identifying and tracking these requests. The implementation is correct. I've suggested a small refactoring to improve maintainability by creating a shared constant for the header dictionary. This will reduce code duplication and make future changes easier.
shared/lib/constants.py
Outdated
| SURFACE_HEADER_NAME = "x-surface" | ||
| WEBSITE_SURFACE = "website" | ||
| TEST_SURFACE = "integration-test" | ||
| CRON_TEST_SURFACE = "cron-tests" |
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.
To improve maintainability and avoid duplicating the header dictionary construction, consider defining a constant for the cron test surface header, similar to TEST_SURFACE_HEADER. You can then use this constant in adversarial.py and nodejs_query.py.
| CRON_TEST_SURFACE = "cron-tests" | |
| CRON_TEST_SURFACE = "cron-tests" | |
| CRON_TEST_SURFACE_HEADER = {SURFACE_HEADER_NAME: CRON_TEST_SURFACE} |
| from absl import flags | ||
| import requests | ||
|
|
||
| from shared.lib.constants import CRON_TEST_SURFACE, SURFACE_HEADER_NAME |
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.
To improve maintainability and centralize header definitions, it's better to define a CRON_TEST_SURFACE_HEADER constant in shared/lib/constants.py and import it here. This avoids importing CRON_TEST_SURFACE and SURFACE_HEADER_NAME just to construct the header.
| from shared.lib.constants import CRON_TEST_SURFACE, SURFACE_HEADER_NAME | |
| from shared.lib.constants import CRON_TEST_SURFACE_HEADER |
| headers={ | ||
| SURFACE_HEADER_NAME: CRON_TEST_SURFACE | ||
| }, |
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.
| from absl import flags | ||
| import requests | ||
|
|
||
| from shared.lib.constants import CRON_TEST_SURFACE, SURFACE_HEADER_NAME |
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.
To improve maintainability and centralize header definitions, it's better to define a CRON_TEST_SURFACE_HEADER constant in shared/lib/constants.py and import it here. This avoids importing CRON_TEST_SURFACE and SURFACE_HEADER_NAME just to construct the header.
| from shared.lib.constants import CRON_TEST_SURFACE, SURFACE_HEADER_NAME | |
| from shared.lib.constants import CRON_TEST_SURFACE_HEADER |
| headers={ | ||
| SURFACE_HEADER_NAME: CRON_TEST_SURFACE | ||
| } |
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.
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.
Response to all of these comments: I just used the test surface header instead -- figured I don't actually need a separate cron test header
This identifies cron test queries as test results instead of queries with an "unknown" surface in autopush, which helps to differentiate between actual queries that cannot be identified and these test cases. The tests are run in autopush, so changing them could make it easier to recognize regressions before the are deployed.