diff --git a/e2e_tests/conftest.py b/e2e_tests/conftest.py index 12b975e24..c554433da 100644 --- a/e2e_tests/conftest.py +++ b/e2e_tests/conftest.py @@ -6,12 +6,12 @@ @pytest.fixture(scope="session", autouse=True) def docker_compose_setup(): """Spin up Docker containers for OPAL services using docker-compose.""" - compose_file = os.path.abspath("./docker-compose.yml") + compose_file = os.path.abspath("../app-tests/docker-compose-app-tests.yml") subprocess.run(["docker-compose", "-f", compose_file, "up", "-d"]) # Wait for services to be up and running - time.sleep(60) + time.sleep(10) yield diff --git a/e2e_tests/docker-compose.yml b/e2e_tests/docker-compose.yml deleted file mode 100644 index 5bc5c4b73..000000000 --- a/e2e_tests/docker-compose.yml +++ /dev/null @@ -1,22 +0,0 @@ -services: - opal_server: - image: permitio/opal-server:${OPAL_IMAGE_TAG:-latest} - ports: - - "7002:7002" - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:7002/healthcheck"] - interval: 10s - timeout: 10s - retries: 5 - - opal_client: - image: permitio/opal-client:${OPAL_IMAGE_TAG:-latest} - ports: - - "7000:7000" - depends_on: - - opal_server - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:7000/healthcheck"] - interval: 10s - timeout: 10s - retries: 5 diff --git a/e2e_tests/tests/test_e2e.py b/e2e_tests/tests/test_e2e.py index 0cbd27574..564b440f0 100644 --- a/e2e_tests/tests/test_e2e.py +++ b/e2e_tests/tests/test_e2e.py @@ -1,14 +1,24 @@ import requests import time +import subprocess + +def check_logs(container_name): + result = subprocess.run(["docker", "logs", container_name], capture_output=True, text=True) + assert "ERROR" not in result.stdout and "CRITICAL" not in result.stdout, f"Critical errors found in {container_name}" def test_opal_server_health(): """Test OPAL Server health endpoint.""" - response = requests.get("http://localhost:7002/healthcheck") + response = requests.get("http://opal_server:7002/healthcheck") assert response.status_code == 200 def test_opal_client_health(): """Test OPAL Client endpoint.""" - - response = requests.get("http://localhost:7000/healthcheck") + response = requests.get("http://opal_client:7000/healthcheck") assert response.status_code == 200 - print(response.json()) \ No newline at end of file + print(response.json()) + +def test_opal_server_logs(): + check_logs("app-tests-opal_server-1") + +def test_opal_client_logs(): + check_logs("app-tests-opal_client-1")