def instance_container_with_unpacked_tgz(docker_client, tmpdir, tgz_archive_with_cartridge, request): project = tgz_archive_with_cartridge.project # build image with installed Tarantool build_path = os.path.join(tmpdir, 'build_image') os.makedirs(build_path) dockerfile_layers = ["FROM centos:7"] if not tarantool_enterprise_is_used(): tarantool_installer = get_tarantool_installer_cmd("yum") dockerfile_layers.append(f"RUN {tarantool_installer}") with open(os.path.join(build_path, 'Dockerfile'), 'w') as f: f.write('\n'.join(dockerfile_layers)) image_name = '%s-test-tgz' % project.name build_image(build_path, image_name) request.addfinalizer(lambda: delete_image(docker_client, image_name)) # create container instance_name = 'instance-1' http_port = '8183' advertise_port = '3302' environment = [ 'TARANTOOL_APP_NAME=%s' % project.name, 'TARANTOOL_INSTANCE_NAME=%s' % instance_name, 'TARANTOOL_ADVERTISE_URI=%s' % advertise_port, 'TARANTOOL_HTTP_PORT=%s' % http_port, ] container_proj_path = os.path.join('/opt', project.name) init_script_path = os.path.join(container_proj_path, 'init.lua') tarantool_executable = \ os.path.join(container_proj_path, 'tarantool') \ if tarantool_enterprise_is_used() \ else 'tarantool' cmd = [tarantool_executable, init_script_path] container = docker_client.containers.create( image_name, cmd, environment=environment, ports={http_port: http_port}, name='{}-{}'.format(project.name, instance_name), detach=True, ) with gzip.open(tgz_archive_with_cartridge.filepath, 'rb') as f: container.put_archive('/opt', f.read()) request.addfinalizer(lambda: container.remove(force=True)) return InstanceContainer(container=container, instance_name=instance_name, http_port=http_port, advertise_port=advertise_port)
def test_rpm(rpm_archive, tmpdir): project = rpm_archive.project # archive files should be extracted to the empty directory # to correctly check archive contents extract_dir = os.path.join(tmpdir, 'extract') os.makedirs(extract_dir) ps = subprocess.Popen( ['rpm2cpio', rpm_archive.filepath], stdout=subprocess.PIPE) subprocess.check_output(['cpio', '-idmv'], stdin=ps.stdout, cwd=extract_dir) ps.wait() assert ps.returncode == 0, "Error during extracting files from rpm archive" if not tarantool_enterprise_is_used(): assert_tarantool_dependency_rpm(rpm_archive.filepath) check_package_files(project, extract_dir) assert_files_mode_and_owner_rpm(project, rpm_archive.filepath) # check rpm signature cmd = [ 'rpm', '--checksig', '-v', rpm_archive.filepath ] process = subprocess.run(cmd) assert process.returncode == 0, "RPM signature isn't correct"
def __init__(self, name, basepath, template='cartridge'): self.name = name self.basepath = basepath self.template = template # create project and save its path self.path = create_project(basepath, name, template) # save tarantool_enterprise_is_used() result to variable tarantool_is_enterprise = tarantool_enterprise_is_used() # files that should be delivered in the result package project_files = recursive_listdir(self.path) self.distribution_files = filter_out_files_removed_on_pack(project_files) self.distribution_files.add('VERSION') if tarantool_is_enterprise: self.distribution_files.update({'tarantool', 'tarantoolctl'}) # project rockspec name and path self.rockspec_name = '{}-scm-1.rockspec'.format(self.name) self.rockspec_path = os.path.join(self.path, self.rockspec_name) # rocks that should be delivered in the result package self.rocks_content = get_base_project_rocks(self.name, self.rockspec_name) # keys that should be mentioned in the package VERSION file self.version_file_keys = { 'TARANTOOL', self.name, # default application dependencies 'cartridge', 'luatest', } if tarantool_is_enterprise: self.version_file_keys.add('TARANTOOL_SDK')
def image_name_for_tests(docker_client, tmpdir, request): if tarantool_enterprise_is_used(): docker_client.images.pull('centos', '8') return 'centos:8' build_path = os.path.join(tmpdir, 'build_image') os.makedirs(build_path) test_image_dockerfile_path = os.path.join(build_path, 'Dockerfile') with open(test_image_dockerfile_path, 'w') as f: f.write(''' FROM centos:8 RUN curl -s \ https://packagecloud.io/install/repositories/tarantool/{}/script.rpm.sh | bash \ && yum -y install tarantool tarantool-devel '''.format(tarantool_repo_version())) IMAGE_NAME = 'test-image' docker_client.images.build( path=build_path, forcerm=True, tag=IMAGE_NAME, ) request.addfinalizer(lambda: delete_image(docker_client, IMAGE_NAME)) return IMAGE_NAME
def test_project(project_path): process = subprocess.run(['tarantoolctl', 'rocks', 'make'], cwd=project_path) assert process.returncode == 0, \ "Error building project" if tarantool_enterprise_is_used(): process = subprocess.run(['tarantoolctl', 'rocks', 'test'], cwd=project_path) assert process.returncode == 0, \ "Error testing project"
def test_deb(deb_archive, tmpdir): project = deb_archive.project # archive files should be extracted to the empty directory # to correctly check archive contents extract_dir = os.path.join(tmpdir, 'extract') os.makedirs(extract_dir) # unpack ar process = subprocess.run(['ar', 'x', deb_archive.filepath], cwd=extract_dir) assert process.returncode == 0, 'Error during unpacking of deb archive' for filename in ['debian-binary', 'control.tar.xz', 'data.tar.xz']: assert os.path.exists(os.path.join(extract_dir, filename)) # check debian-binary with open(os.path.join(extract_dir, 'debian-binary')) as debian_binary_file: assert debian_binary_file.read() == '2.0\n' # check data.tar.xz with tarfile.open( name=os.path.join(extract_dir, 'data.tar.xz')) as data_arch: data_dir = os.path.join(extract_dir, 'data') data_arch.extractall(path=data_dir) check_package_files(project, data_dir) assert_filemodes(project, data_dir) # check control.tar.xz with tarfile.open( name=os.path.join(extract_dir, 'control.tar.xz')) as control_arch: control_dir = os.path.join(extract_dir, 'control') control_arch.extractall(path=control_dir) for filename in ['control', 'preinst', 'postinst']: assert os.path.exists(os.path.join(control_dir, filename)) if not tarantool_enterprise_is_used(): assert_tarantool_dependency_deb( os.path.join(control_dir, 'control')) # check if postinst script set owners correctly with open(os.path.join(control_dir, 'postinst')) as postinst_script_file: postinst_script = postinst_script_file.read() assert 'chown -R root:root /usr/share/tarantool/{}'.format( project.name) in postinst_script assert 'chown root:root /etc/systemd/system/{}.service'.format( project.name) in postinst_script assert 'chown root:root /etc/systemd/system/{}@.service'.format( project.name) in postinst_script assert 'chown root:root /usr/lib/tmpfiles.d/{}.conf'.format( project.name) in postinst_script
def assert_dir_contents(files_list): without_rocks = {x for x in files_list if not x.startswith('.rocks')} file_tree = original_file_tree if not tarantool_enterprise_is_used(): file_tree = { x for x in file_tree if x not in ['tarantool', 'tarantoolctl'] } assert file_tree == without_rocks assert all(x in files_list for x in original_rocks_content)
def test_rpm_pack(project, rpm_archive, tmpdir): ps = subprocess.Popen(['rpm2cpio', rpm_archive['name']], stdout=subprocess.PIPE) subprocess.check_output(['cpio', '-idmv'], stdin=ps.stdout, cwd=tmpdir) ps.wait() assert ps.returncode == 0, "Error during extracting files from rpm archive" if not tarantool_enterprise_is_used(): assert_tarantool_dependency_rpm(rpm_archive['name']) check_package_files(project, tmpdir) assert_files_mode_and_owner_rpm(project, rpm_archive['name'])
def test_pack(docker_image, tmpdir, docker_client): project = docker_image.project image_name = docker_image.name container = docker_client.containers.create(docker_image.name) container_distribution_dir = '/usr/share/tarantool/{}'.format(project.name) # check if distribution dir was created command = '[ -d "{}" ] && echo true || echo false'.format(container_distribution_dir) output = run_command_on_image(docker_client, image_name, command) assert output == 'true' # get distribution dir contents arhive_path = os.path.join(tmpdir, 'distribution_dir.tar') with open(arhive_path, 'wb') as f: bits, _ = container.get_archive(container_distribution_dir) for chunk in bits: f.write(chunk) with tarfile.open(arhive_path) as arch: arch.extractall(path=os.path.join(tmpdir, 'usr/share/tarantool')) os.remove(arhive_path) assert_distribution_dir_contents( dir_contents=recursive_listdir(os.path.join(tmpdir, 'usr/share/tarantool/', project.name)), project=project, ) assert_filemodes(project, tmpdir) container.remove() if not tarantool_enterprise_is_used(): # check if tarantool was installed command = 'yum list installed 2>/dev/null | grep tarantool' output = run_command_on_image(docker_client, image_name, command) packages_list = output.split('\n') assert any(['tarantool' in package for package in packages_list]) # check tarantool version command = 'tarantool --version' output = run_command_on_image(docker_client, image_name, command) m = re.search(r'Tarantool\s+(\d+.\d+)', output) assert m is not None installed_version = m.group(1) m = re.search(r'(\d+.\d+)', tarantool_version()) assert m is not None expected_version = m.group(1) assert installed_version == expected_version
def container_with_installed_deb(docker_client, deb_archive_with_cartridge, request, tmpdir): project = deb_archive_with_cartridge.project # build image with installed DEB build_path = os.path.join(tmpdir, 'build_image') os.makedirs(build_path) shutil.copy(deb_archive_with_cartridge.filepath, build_path) dockerfile_layers = ["FROM jrei/systemd-ubuntu"] if not tarantool_enterprise_is_used(): dockerfile_layers.append( '''RUN apt-get update && apt-get install -y curl \ && DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata \ && curl -s \ https://packagecloud.io/install/repositories/tarantool/{}/script.deb.sh | bash '''.format(tarantool_repo_version())) dockerfile_layers.append(''' COPY {deb_filename} /opt RUN apt-get install -y /opt/{deb_filename} '''.format( deb_filename=os.path.basename(deb_archive_with_cartridge.filepath))) with open(os.path.join(build_path, 'Dockerfile'), 'w') as f: f.write('\n'.join(dockerfile_layers)) image_name = '%s-test-deb' % project.name build_image(build_path, image_name) request.addfinalizer(lambda: delete_image(docker_client, image_name)) # create container http_port = '8183' container = docker_client.containers.create( image_name, command='/lib/systemd/systemd', ports={http_port: http_port}, name='%s-test-deb' % project.name, detach=True, privileged=True, volumes=['/sys/fs/cgroup:/sys/fs/cgroup:ro'], ) request.addfinalizer(lambda: container.remove(force=True)) return ProjectContainer(project=project, container=container, http_port=http_port)
def __init__(self, cartridge_cmd, name, basepath, template='cartridge', create_func=None): self.name = name self.basepath = basepath self.template = template self.deprecated_flow_is_used = False self.vshard_groups_names = None self.custom_roles = None if create_func is None: # create project and save its path self.path = create_project(cartridge_cmd, basepath, name, template) else: self.path = create_func(basepath) # save tarantool_enterprise_is_used() result to variable tarantool_is_enterprise = tarantool_enterprise_is_used() # files that should be delivered in the result package project_files = recursive_listdir(self.path) self.distribution_files = filter_out_files_removed_on_pack( project_files) self.distribution_files.add('VERSION') self.distribution_files.add('VERSION.lua') if tarantool_is_enterprise: self.distribution_files.update({'tarantool', 'tarantoolctl'}) # project rockspec name and path self.rockspec_name = '{}-scm-1.rockspec'.format(self.name) self.rockspec_path = os.path.join(self.path, self.rockspec_name) # rocks that should be delivered in the result package self.rocks_content = get_base_project_rocks(self.name, self.rockspec_name) # keys that should be mentioned in the package VERSION file self.version_file_keys = { 'TARANTOOL', self.name, # default application dependencies 'cartridge', } if tarantool_is_enterprise: self.version_file_keys.add('TARANTOOL_SDK') self.image_runtime_requirements_filepath = None
def instance_container_with_unpacked_tgz(docker_client, image_name_for_tests, tmpdir, tgz_archive_with_cartridge, request): project = tgz_archive_with_cartridge.project instance_name = 'instance-1' http_port = '8183' advertise_port = '3302' environment = [ 'TARANTOOL_INSTANCE_NAME={}'.format(instance_name), 'TARANTOOL_ADVERTISE_URI={}'.format(advertise_port), 'TARANTOOL_CLUSTER_COOKIE=secret', 'TARANTOOL_HTTP_PORT={}'.format(http_port), ] distribution_dir = os.path.join(tmpdir, 'distribution_dir') with tarfile.open(name=tgz_archive_with_cartridge.filepath) as tgz_arch: tgz_arch.extractall(path=distribution_dir) container_proj_path = os.path.join('/opt', project.name) init_script_path = os.path.join(container_proj_path, 'init.lua') tarantool_executable = \ os.path.join(container_proj_path, 'tarantool') \ if tarantool_enterprise_is_used() \ else 'tarantool' cmd = [tarantool_executable, init_script_path] container = docker_client.containers.create( image_name_for_tests, cmd, environment=environment, ports={http_port: http_port}, name='{}-{}'.format(project.name, instance_name), detach=True, ) with gzip.open(tgz_archive_with_cartridge.filepath, 'rb') as f: container.put_archive('/opt', f.read()) request.addfinalizer(lambda: container.remove(force=True)) return InstanceContainer(container=container, instance_name=instance_name, http_port=http_port, advertise_port=advertise_port)
def container_with_installed_rpm(docker_client, rpm_archive_with_cartridge, request, tmpdir): project = rpm_archive_with_cartridge.project # build image with installed RPM build_path = os.path.join(tmpdir, 'build_image') os.makedirs(build_path) shutil.copy(rpm_archive_with_cartridge.filepath, build_path) dockerfile_layers = ["FROM centos:7"] if not tarantool_enterprise_is_used(): installer_cmd = get_tarantool_installer_cmd("yum") dockerfile_layers.append(f"RUN {installer_cmd}") else: dockerfile_layers.append("RUN yum update -y") dockerfile_layers.append(''' COPY {rpm_filename} /opt RUN yum install -y /opt/{rpm_filename} '''.format( rpm_filename=os.path.basename(rpm_archive_with_cartridge.filepath))) with open(os.path.join(build_path, 'Dockerfile'), 'w') as f: f.write('\n'.join(dockerfile_layers)) image_name = '%s-test-rpm' % project.name build_image(build_path, image_name) request.addfinalizer(lambda: delete_image(docker_client, image_name)) # create container http_port = '8183' container = docker_client.containers.create( image_name, command='/sbin/init', ports={http_port: http_port}, name='%s-test-rpm' % project.name, detach=True, privileged=True, volumes=['/sys/fs/cgroup:/sys/fs/cgroup:ro'], ) request.addfinalizer(lambda: container.remove(force=True)) return ProjectContainer(project=project, container=container, http_port=http_port)
def test_build_in_docker_without_download_token_for_ee(project_without_dependencies, pack_format, tmpdir): if not tarantool_enterprise_is_used(): pytest.skip() project = project_without_dependencies env = os.environ.copy() del env['TARANTOOL_DOWNLOAD_TOKEN'] cmd = [ os.path.join(basepath, "cartridge"), "pack", pack_format, "--use-docker", project.path ] rc, output = run_command_and_get_output(cmd, cwd=tmpdir, env=env) assert rc == 1 assert 'download token is required to pack enterprise Tarantool app in docker' in output
def validate_version_file(file_path): original_keys = [ project_name, ] if tarantool_enterprise_is_used(): original_keys.append('TARANTOOL') original_keys.append('TARANTOOL_SDK') default_section_name = 'tnt-version' version_props = '[{}]\n'.format(default_section_name) with open(file_path) as version_file: version_props = version_props + version_file.read() parser = configparser.ConfigParser() parser.read_string(version_props) assert set(parser[default_section_name].keys()) == set( map(lambda x: x.lower(), original_keys))
def project_path(request, module_tmpdir): if request.param == 'cartridge' and not tarantool_enterprise_is_used(): pytest.skip('Skip cartridge template test for Opensource Tarantool') project_path = create_project(module_tmpdir, 'project-' + request.param, request.param) ## HACK: install cartridge rocks if request.param == 'cartridge': cmd = [ 'tarantoolctl', 'rocks', 'install', 'https://raw.githubusercontent.com/rosik/cartridge/master/cartridge-scm-1.rockspec', ] process = subprocess.run(cmd, cwd=project_path) assert process.returncode == 0 return project_path
def test_rpm_pack(project_path, rpm_archive, tmpdir): ps = subprocess.Popen(['rpm2cpio', rpm_archive['name']], stdout=subprocess.PIPE) subprocess.check_output(['cpio', '-idmv'], stdin=ps.stdout, cwd=tmpdir) ps.wait() assert ps.returncode == 0, "Error during extracting files from rpm archive" project_dir = os.path.join(tmpdir, 'usr/share/tarantool', project_name) assert_dir_contents(recursive_listdir(project_dir)) target_version_file = os.path.join(project_path, 'VERSION') with open(os.path.join(project_dir, 'VERSION'), 'r') as version_file: with open(target_version_file, 'w') as xvf: xvf.write(version_file.read()) if not tarantool_enterprise_is_used(): assert_tarantool_dependency(rpm_archive['name']) validate_version_file(target_version_file)
def test_rpm(rpm_archive, tmpdir): project = rpm_archive.project # archive files should be extracted to the empty directory # to correctly check archive contents extract_dir = os.path.join(tmpdir, 'extract') os.makedirs(extract_dir) extract_rpm(rpm_archive.filepath, extract_dir) if not tarantool_enterprise_is_used(): assert_tarantool_dependency_rpm(rpm_archive.filepath) check_package_files(project, extract_dir) assert_files_mode_and_owner_rpm(project, rpm_archive.filepath) # check rpm signature cmd = ['rpm', '--checksig', '-v', rpm_archive.filepath] process = subprocess.run(cmd) assert process.returncode == 0, "RPM signature isn't correct"
def test_pack(docker_image, tmpdir, docker_client): project = docker_image.project image_name = docker_image.name container = docker_client.containers.create(docker_image.name) container_distribution_dir = '/usr/share/tarantool/{}'.format(project.name) # check if distribution dir was created command = '[ -d "{}" ] && echo true || echo false'.format( container_distribution_dir) output = run_command_on_image(docker_client, image_name, command) assert output == 'true' # get distribution dir contents arhive_path = os.path.join(tmpdir, 'distribution_dir.tar') with open(arhive_path, 'wb') as f: bits, _ = container.get_archive(container_distribution_dir) for chunk in bits: f.write(chunk) with tarfile.open(arhive_path) as arch: arch.extractall(path=os.path.join(tmpdir, 'usr/share/tarantool')) os.remove(arhive_path) distribution_dir_contents = recursive_listdir( os.path.join(tmpdir, 'usr/share/tarantool/', project.name)) # The runtime image is built using Dockerfile.<random-string> in the # distribution directory # This dockerfile name should be added to project distribution files set # to correctly check distribution directory contents for f in distribution_dir_contents: if f.startswith('Dockerfile') and f not in [ 'Dockerfile.build.cartridge', 'Dockerfile.cartridge' ]: project.distribution_files.add(f) break assert_distribution_dir_contents( dir_contents=recursive_listdir( os.path.join(tmpdir, 'usr/share/tarantool/', project.name)), project=project, ) assert_filemodes(project, tmpdir) container.remove() if project.image_runtime_requirements_filepath is not None: command = 'ls {}'.format(project.image_runtime_requirements_filepath) output = run_command_on_image(docker_client, image_name, command) assert output == project.image_runtime_requirements_filepath if not tarantool_enterprise_is_used(): # check if tarantool was installed command = 'yum list installed 2>/dev/null | grep tarantool' output = run_command_on_image(docker_client, image_name, command) packages_list = output.split('\n') assert any(['tarantool' in package for package in packages_list]) # check tarantool version command = 'tarantool --version' output = run_command_on_image(docker_client, image_name, command) m = re.search(r'Tarantool\s+(\d+.\d+)', output) assert m is not None installed_version = m.group(1) m = re.search(r'(\d+.\d+)', tarantool_version()) assert m is not None expected_version = m.group(1) assert installed_version == expected_version
def project_path(request, module_tmpdir): if request.param == 'cartridge' and not tarantool_enterprise_is_used(): pytest.skip('Skip cartridge template test for Opensource Tarantool') return create_project(module_tmpdir, 'project-' + request.param, request.param)
def test_build_in_docker_sdk_path_ee(cartridge_cmd, project_without_dependencies, pack_format, tmpdir): if not tarantool_enterprise_is_used(): pytest.skip() project = project_without_dependencies # remove TARANTOOL_SDK_PATH from env env = os.environ.copy() del env['TARANTOOL_SDK_PATH'] def get_pack_cmd(sdk_path): return [ cartridge_cmd, "pack", pack_format, "--use-docker", "--sdk-path", sdk_path, project.path ] def create_binary(path, name, executable=False): binary_filepath = os.path.join(path, name) with open(binary_filepath, 'w') as f: f.write('I am {} binary'.format(name)) if executable: st = os.stat(binary_filepath) os.chmod(binary_filepath, st.st_mode | stat.S_IEXEC) # pass non-exitent path cmd = get_pack_cmd(sdk_path='non-existent-path') rc, output = run_command_and_get_output(cmd, cwd=tmpdir, env=env) assert rc == 1 assert 'Specified SDK path does not exists' in output # pass a file sdk_filepath = os.path.join(tmpdir, 'sdk-file') with open(sdk_filepath, 'w') as f: f.write('I am SDK file') cmd = get_pack_cmd(sdk_path=sdk_filepath) rc, output = run_command_and_get_output(cmd, cwd=tmpdir, env=env) assert rc == 1 assert 'Specified SDK path is not a directory' in output # create empty SDK directory empty_sdk_path = os.path.join(tmpdir, 'SDK-empty') os.mkdir(empty_sdk_path) cmd = get_pack_cmd(sdk_path=empty_sdk_path) rc, output = run_command_and_get_output(cmd, cwd=tmpdir, env=env) assert rc == 1 assert re.search( r'Specified SDK directory \S+ does not contain \S+ binary', output) is not None # check that both binaries should exists for binary in ['tarantool', 'tarantoolctl']: sdk_path = os.path.join(tmpdir, 'SDK-with-only-{}-binary'.format(binary)) os.mkdir(sdk_path) create_binary(sdk_path, binary, executable=True) cmd = get_pack_cmd(sdk_path=sdk_path) rc, output = run_command_and_get_output(cmd, cwd=tmpdir, env=env) assert rc == 1 assert re.search( r'Specified SDK directory \S+ does not contain \S+ binary', output) is not None # check that both binaries should be executable sdk_path = os.path.join(tmpdir, 'SDK-with-one-binary-non-exec') os.mkdir(sdk_path) create_binary(sdk_path, 'tarantool', executable=True) create_binary(sdk_path, 'tarantoolctl', executable=False) cmd = get_pack_cmd(sdk_path=sdk_path) rc, output = run_command_and_get_output(cmd, cwd=tmpdir, env=env) assert rc == 1 assert 'Specified SDK directory contains tarantoolctl binary that is not executable' in output
def test_docker_pack(project, docker_image, tmpdir, docker_client): image_name = docker_image['name'] container = docker_client.containers.create(image_name) container_distribution_dir = '/usr/share/tarantool/{}'.format(project['name']) # check if distribution dir was created command = '[ -d "{}" ] && echo true || echo false'.format(container_distribution_dir) output = run_command_on_image(docker_client, image_name, command) assert output == 'true' # get distribution dir contents arhive_path = os.path.join(tmpdir, 'distribution_dir.tar') with open(arhive_path, 'wb') as f: bits, _ = container.get_archive(container_distribution_dir) for chunk in bits: f.write(chunk) with tarfile.open(arhive_path) as arch: arch.extractall(path=os.path.join(tmpdir, 'usr/share/tarantool')) os.remove(arhive_path) assert_dir_contents( files_list=recursive_listdir(os.path.join(tmpdir, 'usr/share/tarantool/', project['name'])), exp_files_list=project['distribution_files_list'], exp_rocks_content=project['rocks_content'], skip_tarantool_binaries=True ) assert_filemodes(project, tmpdir) container.remove() if tarantool_enterprise_is_used(): # check tarantool and tarantoolctl binaries command = '[ -d "/usr/share/tarantool/tarantool-enterprise/" ] && echo true || echo false' output = run_command_on_image(docker_client, image_name, command) assert output == 'true' command = 'cd /usr/share/tarantool/tarantool-enterprise/ && find .' output = run_command_on_image(docker_client, image_name, command) files_list = output.split('\n') files_list.remove('.') dir_contents = [ os.path.normpath(filename) for filename in files_list ] assert 'tarantool' in dir_contents assert 'tarantoolctl' in dir_contents else: # check if tarantool was installed command = 'yum list installed 2>/dev/null | grep tarantool' output = run_command_on_image(docker_client, image_name, command) packages_list = output.split('\n') assert any(['tarantool' in package for package in packages_list]) # check tarantool version command = 'yum info tarantool' output = run_command_on_image(docker_client, image_name, command) m = re.search(r'Version\s+:\s+(\d+)\.(\d+).', output) assert m is not None installed_version = m.groups() m = re.search(r'(\d+)\.(\d+)\.\d+', tarantool_version()) assert m is not None expected_version = m.groups() assert installed_version == expected_version