Skip to content

Commit

Permalink
fixed tests for localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
aradmaleki02 committed Feb 15, 2024
1 parent b20dfac commit 7c40d63
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
7 changes: 7 additions & 0 deletions client/python/kafka_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@

logger.info(f"Gateway URL: {GATEWAY_URL}")


def init_test_mode():
global GATEWAY_URL
GATEWAY_URL = f'http://localhost:{os.getenv("GATEWAY_PORT")}'
logger.info(f"Gateway URL: {GATEWAY_URL}")


def blocking_request(method: str, url: str, data: bytes, headers: dict) -> bytes:
response = None
while response is None:
Expand Down
20 changes: 15 additions & 5 deletions test/unit_test.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
import unittest
from pathlib import Path
import pytest
from client.python import kafka_client as python_client

import logging

from client.python import kafka_client as python_client
LOGGER = logging.getLogger(__name__)


@pytest.fixture(scope="session", autouse=True)
def setup():
python_client.init_test_mode()
if python_client.GATEWAY_URL != 'http://localhost:8082':
LOGGER.error(f"Gateway URL is set to {python_client.GATEWAY_URL}")
exit(1)


# simple test which gets passed for all clients
def test_answer():
assert True
if python_client.GATEWAY_URL == 'http://localhost:8082':
assert True


# def test_order():
Expand Down Expand Up @@ -51,7 +61,7 @@ def test_answer():
# key, value = python_client.pull()
# if key != f"key_{i}" or value != f"value_{i}".encode("utf-8"):
# num_failed += 1
# assert num_failed < 10
# assert num_failed == 0



Expand Down

0 comments on commit 7c40d63

Please sign in to comment.