Skip to content

Commit 717751d

Browse files
committed
[Tests] Update sleep time to read logs content
1 parent 39cbf84 commit 717751d

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ jobs:
112112
- name: Test OctoBot Binary on Windows
113113
if: matrix.os == 'windows-latest'
114114
run: |
115-
pytest tests
115+
dir
116+
# pytest tests
116117

117118
- name: Download Linux x64 artifact
118119
if: matrix.os == 'ubuntu-latest'

tests/test_binary.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,17 @@
1919
import subprocess
2020
from tempfile import TemporaryFile
2121

22-
import platform
22+
import pytest
2323
import requests
2424
import time
2525

26-
import pytest
27-
2826
from tests import get_binary_file_path, clear_octobot_previous_folders, get_log_file_content, is_on_windows
2927

3028
logger = logging.getLogger()
3129
logger.setLevel(logging.DEBUG)
3230

3331
BINARY_DISABLE_WEB_OPTION = "-nw"
32+
LOG_CONTENT_TEST_WAITING_TIME = 60
3433

3534

3635
@pytest.fixture
@@ -47,6 +46,7 @@ def start_binary_without_web_app():
4746
clear_octobot_previous_folders()
4847
with TemporaryFile() as output, TemporaryFile() as err:
4948
binary_process = create_binary(BINARY_DISABLE_WEB_OPTION, output, err)
49+
logger.debug(err.read())
5050
yield
5151
terminate_binary(binary_process, output, err)
5252

@@ -68,7 +68,7 @@ def terminate_binary(binary_process, output_file, err_file):
6868
raise ValueError(f"Error happened during process execution : {errors}")
6969
logger.debug("Killing binary process...")
7070
if is_on_windows():
71-
binary_process.kill()
71+
os.kill(binary_process.pid, signal.CTRL_C_EVENT)
7272
else:
7373
try:
7474
os.killpg(os.getpgid(binary_process.pid), signal.SIGTERM) # Send the signal to all the process groups
@@ -87,25 +87,27 @@ def test_version_endpoint(start_binary):
8787
logger.warning(f"Failed to get http://localhost/version, retrying ({attempt}/{max_attempts})...")
8888
attempt += 1
8989
time.sleep(1)
90+
log_content = get_log_file_content()
91+
logger.debug(log_content)
9092
assert attempt <= max_attempts
9193

9294

9395
def test_evaluation_state_created(start_binary_without_web_app):
94-
time.sleep(10)
96+
time.sleep(LOG_CONTENT_TEST_WAITING_TIME)
9597
log_content = get_log_file_content()
9698
logger.debug(log_content)
9799
assert "new state:" in log_content
98100

99101

100102
def test_logs_content_has_no_errors(start_binary_without_web_app):
101-
time.sleep(10)
103+
time.sleep(LOG_CONTENT_TEST_WAITING_TIME)
102104
log_content = get_log_file_content()
103105
logger.debug(log_content)
104106
assert "ERROR" not in log_content
105107

106108

107109
def test_balance_profitability_updated(start_binary_without_web_app):
108-
time.sleep(10)
110+
time.sleep(LOG_CONTENT_TEST_WAITING_TIME)
109111
log_content = get_log_file_content()
110112
logger.debug(log_content)
111113
assert "BALANCE PROFITABILITY :" in log_content

0 commit comments

Comments
 (0)