From 6357554ed9feab8f62776922f1ce6fc0a8b1c59a Mon Sep 17 00:00:00 2001 From: Vladimir Domnich Date: Tue, 26 Jul 2022 10:28:13 +0300 Subject: [PATCH] Fix logic that collects versions of binaries Signed-off-by: Vladimir Domnich --- pytest_tests/testsuites/conftest.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pytest_tests/testsuites/conftest.py b/pytest_tests/testsuites/conftest.py index 625c8a6..9a7b410 100644 --- a/pytest_tests/testsuites/conftest.py +++ b/pytest_tests/testsuites/conftest.py @@ -1,7 +1,7 @@ import logging import os +import re import shutil -from re import search import allure import pytest @@ -27,13 +27,19 @@ logger = logging.getLogger('NeoLogger') @allure.title('Check binary versions') def check_binary_versions(request): environment_dir = request.config.getoption('--alluredir') - binaries = ['neo-go', 'neofs-cli', 'neofs-authmate', 'aws'] + + # Collect versions of neo binaries + binaries = ['neo-go', 'neofs-cli', 'neofs-authmate'] env_out = {} for binary in binaries: out = _cmd_run(f'{binary} --version') - version = search(r'(v?\d.*)\s+', out) - version = version.group(1) if version else 'Unknown' - env_out[binary.upper()] = version + version = re.search(r'version[:\s]*(.+)', out, re.IGNORECASE) + env_out[binary.upper()] = version.group(1) if version else 'Unknown' + + # Get version of aws binary + out = _cmd_run('aws --version') + out_lines = out.split("\n") + env_out["AWS"] = out_lines[0] if out_lines else 'Unknown' if environment_dir: with open(f'{environment_dir}/environment.properties', 'w') as out_file: