-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Benchmark] test update_commits (#9689)
* add delete_file * test * wip * wip * test billing project * wip * wip * wip * clean * fix comment * changes * test_benchmark in build.yaml * clean * fix response * forgot await * forgot await again * remove userdata arg * add case for testing * changes * changes * change formatted commits from list to dict * wip * wip * wip * wip * wip * wip * comment * wip * wip * wip * remove unused import * refactor * refactor * add benchmark-tests to tls/config.yaml * add wait to deploy_benchmark * clean * clean * changes * changes * changes * clean * clean * wip * wip * wip * aaaa * wip * wip * fixed main weirdness * missing line for benchmark-gsa-key * hope this doesnt ruin everything * fix * changes * changes * change timeout from 300s to 1200s
- Loading branch information
1 parent
be98c56
commit a940880
Showing
6 changed files
with
201 additions
and
34 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM {{ service_base_image.image }} | ||
|
||
COPY benchmark-service/test/ /test/ | ||
RUN python3 -m pip install --no-cache-dir \ | ||
pytest-instafail==0.4.1 \ | ||
pytest-asyncio==0.10.0 |
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
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,54 @@ | ||
import json | ||
import logging | ||
import asyncio | ||
import pytest | ||
import aiohttp | ||
|
||
from hailtop.config import get_deploy_config | ||
from hailtop.auth import service_auth_headers | ||
from hailtop.tls import in_cluster_ssl_client_session, get_context_specific_ssl_client_session | ||
import hailtop.utils as utils | ||
|
||
pytestmark = pytest.mark.asyncio | ||
|
||
logging.basicConfig(level=logging.INFO) | ||
log = logging.getLogger(__name__) | ||
|
||
sha = 'd626f793ad700c45a878d192652a0378818bbd8b' | ||
|
||
|
||
async def test_update_commits(): | ||
deploy_config = get_deploy_config() | ||
headers = service_auth_headers(deploy_config, 'benchmark') | ||
commit_benchmark_url = deploy_config.url('benchmark', f'/api/v1alpha/benchmark/commit/{sha}') | ||
|
||
async with get_context_specific_ssl_client_session( | ||
raise_for_status=True, | ||
timeout=aiohttp.ClientTimeout(total=60)) as session: | ||
|
||
commit = None | ||
|
||
await utils.request_retry_transient_errors( | ||
session, 'DELETE', f'{commit_benchmark_url}', headers=headers, json={'sha': sha}) | ||
|
||
resp_status = await utils.request_retry_transient_errors( | ||
session, 'GET', f'{commit_benchmark_url}', headers=headers, json={'sha': sha}) | ||
commit = await resp_status.json() | ||
assert commit['status'] is None, commit | ||
|
||
resp_commit = await utils.request_retry_transient_errors( | ||
session, 'POST', f'{commit_benchmark_url}', headers=headers, json={'sha': sha}) | ||
commit = await resp_commit.json() | ||
|
||
async def wait_forever(): | ||
nonlocal commit | ||
while commit is None or not commit['status']['complete']: | ||
resp = await utils.request_retry_transient_errors( | ||
session, 'GET', f'{commit_benchmark_url}', headers=headers, json={'sha': sha}) | ||
commit = await resp.json() | ||
await asyncio.sleep(5) | ||
print(commit['status']) | ||
return commit | ||
|
||
commit = await wait_forever() | ||
assert commit['status']['complete'] == True, commit |
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