-
Notifications
You must be signed in to change notification settings - Fork 110
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?
Changes from 2 commits
ce929d9
0cef455
aadbbec
12d3367
ecb6f72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,8 @@ | |
| from absl import flags | ||
| import requests | ||
|
|
||
| from shared.lib.constants import CRON_TEST_SURFACE, SURFACE_HEADER_NAME | ||
|
|
||
| FLAGS = flags.FLAGS | ||
|
|
||
| INPUT_DIR = "input" | ||
|
|
@@ -327,6 +329,9 @@ def run_query(self, query: str) -> Result: | |
| 'contextHistory': {}, | ||
| 'dc': f'{post_dc_param}', | ||
| }, | ||
| headers={ | ||
| SURFACE_HEADER_NAME: CRON_TEST_SURFACE | ||
| }, | ||
|
||
| timeout=30) | ||
| except requests.exceptions.ReadTimeout: | ||
| result.status = ResultStatus.TIMED_OUT | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -21,6 +21,8 @@ | |||||
| from absl import flags | ||||||
| import requests | ||||||
|
|
||||||
| from shared.lib.constants import CRON_TEST_SURFACE, SURFACE_HEADER_NAME | ||||||
|
||||||
| from shared.lib.constants import CRON_TEST_SURFACE, SURFACE_HEADER_NAME | |
| from shared.lib.constants import CRON_TEST_SURFACE_HEADER |
Outdated
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
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -459,6 +459,7 @@ | |||||||
| SURFACE_HEADER_NAME = "x-surface" | ||||||||
| WEBSITE_SURFACE = "website" | ||||||||
| TEST_SURFACE = "integration-test" | ||||||||
| CRON_TEST_SURFACE = "cron-tests" | ||||||||
|
||||||||
| CRON_TEST_SURFACE = "cron-tests" | |
| CRON_TEST_SURFACE = "cron-tests" | |
| CRON_TEST_SURFACE_HEADER = {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.
To improve maintainability and centralize header definitions, it's better to define a
CRON_TEST_SURFACE_HEADERconstant inshared/lib/constants.pyand import it here. This avoids importingCRON_TEST_SURFACEandSURFACE_HEADER_NAMEjust to construct the header.