From 470336e82c9ad06bdc65b736e6d6cea26378a7bd Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Sun, 1 Jan 2023 11:07:18 +0300 Subject: [PATCH] Fix docker command (#5541) Follow up for #5538 The previous fix fixed the situation for local environments, but broke the CI. This PR tries to use another way. --- tests/python/rest_api/test_tasks.py | 6 ++++-- tests/python/shared/fixtures/init.py | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/python/rest_api/test_tasks.py b/tests/python/rest_api/test_tasks.py index f102aa90..10e80719 100644 --- a/tests/python/rest_api/test_tasks.py +++ b/tests/python/rest_api/test_tasks.py @@ -20,6 +20,7 @@ from deepdiff import DeepDiff from PIL import Image import shared.utils.s3 as s3 +from shared.fixtures.init import get_server_image_tag from shared.utils.config import get_method, make_api_client, patch_method from shared.utils.helpers import generate_image_files @@ -745,13 +746,14 @@ class TestPostTaskData: f"{tmp_dir}:/local", "--entrypoint", "python3", - "cvat/server:dev", + get_server_image_tag(), "utils/dataset_manifest/create.py", "--output-dir", "/local", "/local", ] - subprocess.run(command, check=True) + subprocess.check_output(command) + with open(osp.join(tmp_dir, "manifest.jsonl"), mode="rb") as m_file: s3_client.create_file( data=m_file.read(), diff --git a/tests/python/shared/fixtures/init.py b/tests/python/shared/fixtures/init.py index 41bbc037..d0a68b94 100644 --- a/tests/python/shared/fixtures/init.py +++ b/tests/python/shared/fixtures/init.py @@ -3,6 +3,7 @@ # SPDX-License-Identifier: MIT import logging +import os import re from http import HTTPStatus from pathlib import Path @@ -225,6 +226,10 @@ def kube_restore_data_volumes(): kube_exec_cvat("tar --strip 3 -xjf /tmp/cvat_data.tar.bz2 -C /home/django/data/") +def get_server_image_tag(): + return f"cvat/server:{os.environ.get('CVAT_VERSION', 'dev')}" + + def start_services(rebuild=False): if any([cn in ["cvat_server", "cvat_db"] for cn in running_containers()]): pytest.exit(