2021-12-07 08:57:12 -08:00
|
|
|
import os
|
2021-11-02 12:42:53 -07:00
|
|
|
|
|
|
|
import pytest
|
|
|
|
import requests
|
2022-06-30 16:00:50 +05:30
|
|
|
|
2022-07-14 22:04:06 +05:30
|
|
|
from tests.utils import get_frontend_url, wait_for_healthcheck_util
|
2022-08-06 05:05:23 +05:30
|
|
|
from tests.test_result_msg import send_message
|
2021-11-02 12:42:53 -07:00
|
|
|
|
2021-12-07 08:57:12 -08:00
|
|
|
# Disable telemetry
|
2022-08-06 05:05:23 +05:30
|
|
|
os.environ["DATAHUB_TELEMETRY_ENABLED"] = "false"
|
2021-12-07 08:57:12 -08:00
|
|
|
|
2022-06-30 16:00:50 +05:30
|
|
|
|
2021-11-02 12:42:53 -07:00
|
|
|
@pytest.fixture(scope="session")
|
|
|
|
def wait_for_healthchecks():
|
2022-07-14 22:04:06 +05:30
|
|
|
wait_for_healthcheck_util()
|
2021-11-02 12:42:53 -07:00
|
|
|
yield
|
|
|
|
|
2022-06-30 16:00:50 +05:30
|
|
|
|
2021-11-02 12:42:53 -07:00
|
|
|
@pytest.fixture(scope="session")
|
|
|
|
def frontend_session(wait_for_healthchecks):
|
|
|
|
session = requests.Session()
|
|
|
|
|
|
|
|
headers = {
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
}
|
|
|
|
data = '{"username":"datahub", "password":"datahub"}'
|
2022-06-30 16:00:50 +05:30
|
|
|
response = session.post(f"{get_frontend_url()}/logIn", headers=headers, data=data)
|
2021-11-02 12:42:53 -07:00
|
|
|
response.raise_for_status()
|
|
|
|
|
|
|
|
yield session
|
|
|
|
|
2022-06-30 16:00:50 +05:30
|
|
|
|
2021-11-02 12:42:53 -07:00
|
|
|
# TODO: Determine whether we need this or not.
|
|
|
|
@pytest.mark.dependency()
|
|
|
|
def test_healthchecks(wait_for_healthchecks):
|
|
|
|
# Call to wait_for_healthchecks fixture will do the actual functionality.
|
2022-06-30 16:00:50 +05:30
|
|
|
pass
|
2022-08-06 05:05:23 +05:30
|
|
|
|
|
|
|
|
|
|
|
def pytest_sessionfinish(session, exitstatus):
|
|
|
|
""" whole test run finishes. """
|
|
|
|
send_message(exitstatus)
|