-
Notifications
You must be signed in to change notification settings - Fork 28
[maintenance] improve stability of deploy tests #1563
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
Changes from all commits
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# pylint:disable=unused-variable | ||
# pylint:disable=unused-argument | ||
# pylint:disable=redefined-outer-name | ||
|
||
from typing import Dict | ||
|
||
import aiohttp | ||
import pytest | ||
import tenacity | ||
from yarl import URL | ||
|
||
from servicelib.minio_utils import MinioRetryPolicyUponInitialization | ||
|
||
from .helpers.utils_docker import get_service_published_port | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def webserver_endpoint(docker_stack: Dict, devel_environ: Dict) -> URL: | ||
assert "simcore_webserver" in docker_stack["services"] | ||
endpoint = f"127.0.0.1:{get_service_published_port('webserver', '8080')}" | ||
|
||
return URL(f"http://{endpoint}") | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
async def webserver_service(webserver_endpoint: URL, docker_stack: Dict) -> URL: | ||
await wait_till_webserver_responsive(webserver_endpoint) | ||
|
||
yield webserver_endpoint | ||
|
||
|
||
# HELPERS -- | ||
|
||
# TODO: this can be used by ANY of the simcore services! | ||
@tenacity.retry(**MinioRetryPolicyUponInitialization().kwargs) | ||
async def wait_till_webserver_responsive(webserver_endpoint: URL): | ||
async with aiohttp.ClientSession() as session: | ||
async with session.get(webserver_endpoint.with_path("/v0/")) as resp: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we are going to have one day troubles with the AIP versions ... I start putting them as separate fixtures as well |
||
assert resp.status == 200 | ||
data = await resp.json() | ||
assert "data" in data | ||
assert "status" in data["data"] | ||
assert data["data"]["status"] == "SERVICE_RUNNING" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,8 @@ | |
"pytest_simcore.rabbit_service", | ||
"pytest_simcore.postgres_service", | ||
"pytest_simcore.minio_service", | ||
"pytest_simcore.traefik_service" | ||
"pytest_simcore.traefik_service", | ||
"pytest_simcore.simcore_webserver_service", | ||
] | ||
log = logging.getLogger(__name__) | ||
|
||
|
@@ -44,8 +45,14 @@ def prepare_all_services( | |
return services | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def create_db_on_start(devel_environ: Dict[str, str]): | ||
devel_environ["WEBSERVER_DB_INITTABLES"] = "1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will change this in another pR by migration routings ... but it is ok for now :-) |
||
|
||
|
||
@pytest.fixture(scope="module") | ||
def make_up_prod( | ||
create_db_on_start, | ||
prepare_all_services: Dict, | ||
simcore_docker_compose: Dict, | ||
ops_docker_compose: Dict, | ||
|
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 this is reusable :-)