[#189] parallel get remote binaries versions

This commit is contained in:
Ekaterina Chernitsyna 2024-01-29 19:00:47 +03:00 committed by Andrey Berezin
parent 46e57870d0
commit 566f1a425f
2 changed files with 8 additions and 6 deletions

View file

@ -326,7 +326,7 @@ def two_buckets(s3_client: S3ClientWrapper, request: pytest.FixtureRequest):
@pytest.fixture(scope="session", autouse=True) @pytest.fixture(scope="session", autouse=True)
def check_binary_versions(hosting: Hosting, client_shell: Shell, request: pytest.FixtureRequest): def check_binary_versions(hosting: Hosting, client_shell: Shell, request: pytest.FixtureRequest):
local_versions = version_utils.get_local_binaries_versions(client_shell) local_versions = version_utils.get_local_binaries_versions(client_shell)
remote_versions = version_utils.get_remote_binaries_versions(hosting) remote_versions, exсeptions_remote_binaries_versions = version_utils.get_remote_binaries_versions(hosting)
all_versions = { all_versions = {
**local_versions, **local_versions,

View file

@ -23,21 +23,21 @@ def test_binaries_versions(request: FixtureRequest, hosting: Hosting):
Compare binaries versions from external source (url) and deployed on servers. Compare binaries versions from external source (url) and deployed on servers.
""" """
with reporter.step("Get binaries versions from servers"): with reporter.step("Get binaries versions from servers"):
got_versions = get_remote_binaries_versions(hosting) got_versions, exсeptions_remote_binaries_versions = get_remote_binaries_versions(hosting)
environment_dir = request.config.getoption("--alluredir") or ASSETS_DIR environment_dir = request.config.getoption("--alluredir") or ASSETS_DIR
env_file = os.path.join(environment_dir, "environment.properties") env_file = os.path.join(environment_dir, "environment.properties")
env_properties = read_env_properties(env_file) env_properties = read_env_properties(env_file)
# compare versions from servers and file # compare versions from servers and file
exeptions = [] exсeptions = []
additional_env_properties = {} additional_env_properties = {}
for binary_name, binary in got_versions.items(): for binary_name, binary in got_versions.items():
version = binary["version"] version = binary["version"]
requires_check = binary["check"] requires_check = binary["check"]
if requires_check and not fullmatch(r"^\d+\.\d+\.\d+(-.*)?(?<!dirty)", version): if requires_check and not fullmatch(r"^\d+\.\d+\.\d+(-.*)?(?<!dirty)", version):
exeptions.append(f"{binary_name}: Actual version doesn't conform to format '0.0.0-000-aaaaaaa': {version}") exсeptions.append(f"{binary_name}: Actual version doesn't conform to format '0.0.0-000-aaaaaaa': {version}")
# If some binary was not listed in the env properties file, let's add it # If some binary was not listed in the env properties file, let's add it
# so that we have full information about versions in allure report # so that we have full information about versions in allure report
@ -47,9 +47,11 @@ def test_binaries_versions(request: FixtureRequest, hosting: Hosting):
if env_properties and additional_env_properties: if env_properties and additional_env_properties:
save_env_properties(env_file, additional_env_properties) save_env_properties(env_file, additional_env_properties)
exсeptions.extend(exсeptions_remote_binaries_versions)
# create clear beautiful error with aggregation info # create clear beautiful error with aggregation info
if exeptions: if exсeptions:
msg = "\n".join(exeptions) msg = "\n".join(exсeptions)
raise AssertionError(f"Found binaries with unexpected versions:\n{msg}") raise AssertionError(f"Found binaries with unexpected versions:\n{msg}")