mirror of
https://github.com/logos-messaging/logos-messaging-interop-tests.git
synced 2026-05-21 01:39:37 +00:00
small tweaks
This commit is contained in:
parent
49e5f8b407
commit
aab1a6b63f
@ -16,10 +16,11 @@ def get_env_var(var_name, default=None):
|
|||||||
# Configuration constants. Need to be upercase to appear in reports
|
# Configuration constants. Need to be upercase to appear in reports
|
||||||
NODE_1 = get_env_var("NODE_1", "wakuorg/nwaku:latest")
|
NODE_1 = get_env_var("NODE_1", "wakuorg/nwaku:latest")
|
||||||
NODE_2 = get_env_var("NODE_2", "wakuorg/go-waku:latest")
|
NODE_2 = get_env_var("NODE_2", "wakuorg/go-waku:latest")
|
||||||
LOG_DIR = get_env_var("LOG_DIR", "./log")
|
DOCKER_LOG_DIR = get_env_var("DOCKER_LOG_DIR", "./log/docker")
|
||||||
NETWORK_NAME = get_env_var("NETWORK_NAME", "waku")
|
NETWORK_NAME = get_env_var("NETWORK_NAME", "waku")
|
||||||
SUBNET = get_env_var("SUBNET", "172.18.0.0/16")
|
SUBNET = get_env_var("SUBNET", "172.18.0.0/16")
|
||||||
IP_RANGE = get_env_var("IP_RANGE", "172.18.0.0/24")
|
IP_RANGE = get_env_var("IP_RANGE", "172.18.0.0/24")
|
||||||
GATEWAY = get_env_var("GATEWAY", "172.18.0.1")
|
GATEWAY = get_env_var("GATEWAY", "172.18.0.1")
|
||||||
DEFAULT_PUBSUBTOPIC = get_env_var("DEFAULT_PUBSUBTOPIC", "/waku/2/default-waku/proto")
|
DEFAULT_PUBSUBTOPIC = get_env_var("DEFAULT_PUBSUBTOPIC", "/waku/2/default-waku/proto")
|
||||||
PROTOCOL = get_env_var("PROTOCOL", "REST")
|
PROTOCOL = get_env_var("PROTOCOL", "REST")
|
||||||
|
RUNNING_IN_CI = get_env_var("CI")
|
||||||
|
|||||||
@ -5,7 +5,7 @@ from tenacity import retry, stop_after_delay, wait_fixed
|
|||||||
from src.node.api_clients.rpc import RPC
|
from src.node.api_clients.rpc import RPC
|
||||||
from src.node.api_clients.rest import REST
|
from src.node.api_clients.rest import REST
|
||||||
from src.node.docker_mananger import DockerManager
|
from src.node.docker_mananger import DockerManager
|
||||||
from src.env_vars import LOG_DIR, DEFAULT_PUBSUBTOPIC, PROTOCOL
|
from src.env_vars import DOCKER_LOG_DIR, DEFAULT_PUBSUBTOPIC, PROTOCOL
|
||||||
from src.data_storage import DS
|
from src.data_storage import DS
|
||||||
|
|
||||||
logger = get_custom_logger(__name__)
|
logger = get_custom_logger(__name__)
|
||||||
@ -14,7 +14,7 @@ logger = get_custom_logger(__name__)
|
|||||||
class WakuNode:
|
class WakuNode:
|
||||||
def __init__(self, docker_image, docker_log_prefix=""):
|
def __init__(self, docker_image, docker_log_prefix=""):
|
||||||
self._image_name = docker_image
|
self._image_name = docker_image
|
||||||
self._log_path = os.path.join(LOG_DIR, f"{docker_log_prefix}__{self._image_name.replace('/', '_')}.log")
|
self._log_path = os.path.join(DOCKER_LOG_DIR, f"{docker_log_prefix}__{self._image_name.replace('/', '_')}.log")
|
||||||
self._docker_manager = DockerManager(self._image_name)
|
self._docker_manager = DockerManager(self._image_name)
|
||||||
self._container = None
|
self._container = None
|
||||||
logger.debug("WakuNode instance initialized with log path %s", self._log_path)
|
logger.debug("WakuNode instance initialized with log path %s", self._log_path)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ from src.libs.custom_logger import get_custom_logger
|
|||||||
import os
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from time import time
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
from src.libs.common import attach_allure_file
|
from src.libs.common import attach_allure_file
|
||||||
import src.env_vars as env_vars
|
import src.env_vars as env_vars
|
||||||
@ -44,19 +45,21 @@ def test_id(request):
|
|||||||
def test_setup(request, test_id):
|
def test_setup(request, test_id):
|
||||||
logger.debug("Running test: %s with id: %s", request.node.name, request.cls.test_id)
|
logger.debug("Running test: %s with id: %s", request.node.name, request.cls.test_id)
|
||||||
yield
|
yield
|
||||||
for file in glob.glob(os.path.join(env_vars.LOG_DIR, "*" + request.cls.test_id + "*")):
|
for file in glob.glob(os.path.join(env_vars.DOCKER_LOG_DIR, "*")):
|
||||||
try:
|
if os.path.getmtime(file) < time() - 3600:
|
||||||
os.remove(file)
|
logger.debug(f"Deleting old log file: {file}")
|
||||||
except Exception:
|
try:
|
||||||
logger.debug("Could not remove file: %s", file)
|
os.remove(file)
|
||||||
|
except:
|
||||||
|
logger.error("Could not delete file")
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="function", autouse=True)
|
@pytest.fixture(scope="function", autouse=True)
|
||||||
def attach_logs_on_fail(request):
|
def attach_logs_on_fail(request):
|
||||||
yield
|
yield
|
||||||
if hasattr(request.node, "rep_call") and request.node.rep_call.failed:
|
if env_vars.RUNNING_IN_CI and hasattr(request.node, "rep_call") and request.node.rep_call.failed:
|
||||||
logger.debug("Test failed, attempting to attach logs to the allure reports")
|
logger.debug("Test failed, attempting to attach logs to the allure reports")
|
||||||
for file in glob.glob(os.path.join(env_vars.LOG_DIR, "*" + request.cls.test_id + "*")):
|
for file in glob.glob(os.path.join(env_vars.DOCKER_LOG_DIR, "*" + request.cls.test_id + "*")):
|
||||||
attach_allure_file(file)
|
attach_allure_file(file)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user