Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
AmirhBrt committed Feb 15, 2024
2 parents a0dc75c + 7c40d63 commit 0fd80b7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest test
pytest test -o log_cli=true
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 0fd80b7

Please sign in to comment.