From 7f0e10b41f38bb7e77f42cff47dc69b0add9ae52 Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Jan 11 2017 13:15:04 +0000 Subject: Merge branch 'develop' into 'master' for 0.4.18 release --- diff --git a/.arcconfig b/.arcconfig index d36463d..e44f980 100644 --- a/.arcconfig +++ b/.arcconfig @@ -1,6 +1,6 @@ { "project_id" : "libtaskotron", - "conduit_uri" : "https://phab.qadevel.cloud.fedoraproject.org", + "conduit_uri" : "https://phab.qa.fedoraproject.org", "arc.land.onto.default" : "develop", "arc.feature.start.default" : "develop", "unit.engine" : "PytestTestEngine" diff --git a/conf/taskotron.yaml.example b/conf/taskotron.yaml.example index 6c75600..973f33a 100644 --- a/conf/taskotron.yaml.example +++ b/conf/taskotron.yaml.example @@ -2,7 +2,7 @@ ## The file is in YAML syntax, read more about it at: ## http://en.wikipedia.org/wiki/Yaml ## libtaskotron docs live at: -## https://docs.qadevel.cloud.fedoraproject.org/libtaskotron/latest/ +## https://docs.qa.fedoraproject.org/libtaskotron/latest/ ## ==== GENERAL section ==== @@ -67,10 +67,10 @@ ## server werkzeug). ## URL of Koji instance used for querying about new builds -#koji_url: http://koji.fedoraproject.org/kojihub +#koji_url: https://koji.fedoraproject.org/kojihub ## URL of repository of all the RPM packages built in Koji -#pkg_url: http://kojipkgs.fedoraproject.org/packages +#pkg_url: https://kojipkgs.fedoraproject.org/packages ## Whether to use staging Bodhi instance instead of production (the ## default one). diff --git a/conf/yumrepoinfo.conf.example b/conf/yumrepoinfo.conf.example index fd1ad9c..4346b68 100644 --- a/conf/yumrepoinfo.conf.example +++ b/conf/yumrepoinfo.conf.example @@ -38,9 +38,9 @@ release_status = rawhide # Fedora 25 [f25] -url = %(rawhideurl)s -path = development/25 -release_status = branched +url = %(goldurl)s +path = 25 +release_status = stable [f25-updates] url = %(updatesurl)s @@ -68,19 +68,3 @@ url = %(updatesurl)s path = testing/24 parent = f24-updates -# Fedora 23 -[f23] -url = %(goldurl)s -path = 23 -release_status = stable - -[f23-updates] -url = %(updatesurl)s -path = 23 -parent = f23 - -[f23-updates-testing] -url = %(updatesurl)s -path = testing/23 -parent = f23-updates - diff --git a/docs/source/conf.py b/docs/source/conf.py index f007b31..314d56a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -44,7 +44,7 @@ master_doc = 'index' # General information about the project. project = u'libtaskotron' -copyright = u'2016, Fedora QA Devel' +copyright = u'2017, Fedora QA Devel' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -53,7 +53,7 @@ copyright = u'2016, Fedora QA Devel' # The short X.Y version. version = '0.4' # The full version, including alpha/beta/rc tags. -release = '0.4.17' +release = '0.4.18' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/source/devguide.rst b/docs/source/devguide.rst index 2252a56..bbf4d78 100644 --- a/docs/source/devguide.rst +++ b/docs/source/devguide.rst @@ -27,7 +27,7 @@ Bugs, Issues and Tasks We use `Phabricator `_ to track issues and facilitate code reviews for several projects related to libtaskotron and Fedora QA. -Our phabricator instance can be found at https://phab.qadevel.cloud.fedoraproject.org/ +Our phabricator instance can be found at https://phab.qa.fedoraproject.org/ .. _running-tests: @@ -62,7 +62,7 @@ Continuous Integration Ideally, one **should** run unit/functional tests before sending code for review. However, it might happen that code that breaks tests gets pushed, for that we have a basic support for running tests after each commit at -http://qadevel.fedoraproject.org/buildmaster/waterfall. +https://qa.fedoraproject.org/buildmaster/waterfall. Configuration ------------- @@ -251,7 +251,7 @@ revision in differential. Once the feature is ready, push to origin:: Reviewing Code -------------- -To review code, use `Phabricator's web interface `_ +To review code, use `Phabricator's web interface `_ to submit comments, request changes or accept reviews. If you want to look at the code under review locally to run tests or test diff --git a/docs/source/taskyaml.rst b/docs/source/taskyaml.rst index f2d6adb..0813187 100644 --- a/docs/source/taskyaml.rst +++ b/docs/source/taskyaml.rst @@ -241,7 +241,7 @@ should provide a good starting point for understanding what they do. .. note:: This directive documentation is incomplete and is meant to be temporary until - we resolve `some issues `_ + we resolve `some issues `_ around generating documenation for the directives. For now, please see the source or ask questions about directives directly. diff --git a/libtaskotron.spec b/libtaskotron.spec index 554ab33..cfbc5be 100644 --- a/libtaskotron.spec +++ b/libtaskotron.spec @@ -1,11 +1,11 @@ Name: libtaskotron -Version: 0.4.17 +Version: 0.4.18 Release: 1%{?dist} Summary: Taskotron Support Library License: GPLv3 URL: https://bitbucket.org/fedoraqa/libtaskotron -Source0: https://qadevel.cloud.fedoraproject.org/releases/%{name}/%{name}-%{version}.tar.gz +Source0: https://qa.fedoraproject.org/releases/%{name}/%{name}-%{version}.tar.gz BuildArch: noarch @@ -167,6 +167,11 @@ install -d %{buildroot}/%{_sharedstatedir}/taskotron/images %{python2_sitelib}/libtaskotron/ext/disposable/* %changelog +* Wed Jan 11 2017 Martin Krizek - 0.4.18-1 +- distgit directive improvements (D1055, D1069) +- yumrepoinfo.conf updates (D1057, D1074) +- koji_utils: use supported arches when downloading build logs (D1076) + * Thu Nov 3 2016 Tim Flink - 0.4.17-1 - add support for resultsdb 2.0 (D1019) - add armhfp as a primary arch (D1040) diff --git a/libtaskotron/__init__.py b/libtaskotron/__init__.py index 7e04717..6bc061d 100644 --- a/libtaskotron/__init__.py +++ b/libtaskotron/__init__.py @@ -4,4 +4,4 @@ # See the LICENSE file for more details on Licensing from __future__ import absolute_import -__version__ = '0.4.17' +__version__ = '0.4.18' diff --git a/libtaskotron/config_defaults.py b/libtaskotron/config_defaults.py index 9219117..c27f066 100644 --- a/libtaskotron/config_defaults.py +++ b/libtaskotron/config_defaults.py @@ -61,8 +61,8 @@ class Config(object): buildbot_task_step = 'runtask' #: - koji_url = 'http://koji.fedoraproject.org/kojihub' #: - pkg_url = 'http://kojipkgs.fedoraproject.org/packages' #: + koji_url = 'https://koji.fedoraproject.org/kojihub' #: + pkg_url = 'https://kojipkgs.fedoraproject.org/packages' #: bodhi_staging = False #: execdb_server = 'http://localhost:5003' #: resultsdb_server = 'http://localhost:5001/api/v1.0' #: diff --git a/libtaskotron/directives/distgit_directive.py b/libtaskotron/directives/distgit_directive.py index 35c1ec9..ce0a880 100644 --- a/libtaskotron/directives/distgit_directive.py +++ b/libtaskotron/directives/distgit_directive.py @@ -16,9 +16,23 @@ parameters: package: required: true description: | - N(E)VR of a package. Package dist tag determines the git branch used for file download. - Example: ``xchat-2.8.8-21.fc20`` + Name of a package. + Example: ``xchat`` type: str + gitref: + required: false + description: | + A git ref to check out. May be a branch, tag, or commit hash. + Example: ``f24`` or ``04164165a840405e6bb5acc54a51e22346d84e0d`` + type: str + default: master + namespace: + required: false + description: | + dist-git namespace to use when constructing the url to clone. + Example: ``modules``, ``rpms`` or ``docker`` + type: str + default: rpms path: required: true description: | @@ -36,6 +50,13 @@ parameters: description: directory into which to download files type: str default: ${workdir} + baseurl: + required: false + description: | + The baseurl to use for dist-git. Defaults to Fedora's production instance. + Example: ``http://pkgs.stg.fedoraproject.org`` + type: str + default: http://pkgs.fedoraproject.org returns: | A dictionary containing following items: @@ -55,7 +76,8 @@ on those files:: - name: download spec file and httpd conf distgit: - package: yourls-1.7-3.20150410gitabc7d6c.fc22 + package: yourls + gitref: f22 path: - yourls.spec - yourls-httpd.conf @@ -68,7 +90,6 @@ import os.path from libtaskotron.directives import BaseDirective from libtaskotron import file_utils, python_utils -from libtaskotron.ext.fedora import rpm_utils import libtaskotron.exceptions as exc @@ -76,22 +97,13 @@ import libtaskotron.exceptions as exc directive_class = 'DistGitDirective' -URL_FMT = 'http://pkgs.fedoraproject.org/cgit/%s.git/plain/%s?h=%s' +URL_FMT = '{baseurl}/cgit/{namespace}/{package}.git/plain/{path}?h={gitref}' class DistGitDirective(BaseDirective): def __init__(self): super(DistGitDirective, self).__init__() - def _download_file(self, package, path, localpath): - pkgname = rpm_utils.rpmformat(package, fmt='n') - dist_tag = rpm_utils.get_dist_tag(package) - # fc22 -> f22 conversion, since that's how branches are called - branch = dist_tag.replace('c', '') - url = URL_FMT % (pkgname, path, branch) - - return file_utils.download(url, '.', localpath) - def process(self, params, arg_data): if 'package' not in params or 'path' not in params: detected_args = ', '.join(params.keys()) @@ -99,10 +111,12 @@ class DistGitDirective(BaseDirective): "The distgit directive requires 'package' and 'path' arguments." "Detected arguments: %s" % detected_args) - if 'target_dir' not in params: - target_dir = arg_data['workdir'] - else: - target_dir = params['target_dir'] + # Assign defaults + gitref = params.get('gitref', 'master') + namespace = params.get('namespace', 'rpms') + baseurl = params.get('baseurl', 'http://pkgs.fedoraproject.org') + target_dir = params.get('target_dir', arg_data['workdir']) + if not python_utils.iterable(params['path']): raise exc.TaskotronValueError("Incorrect value type of the 'path' argument: " @@ -122,13 +136,19 @@ class DistGitDirective(BaseDirective): target_path = params['localpath'] - + format_fields = { + 'package': params['package'], + 'gitref': gitref, + 'namespace': namespace, + 'baseurl': baseurl, + } output_data['downloaded_files'] = [] for path, localpath in zip(params['path'], target_path): localpath = os.path.join(target_dir, localpath) file_utils.makedirs(os.path.dirname(localpath)) + url = URL_FMT.format(path=path, **format_fields) output_data['downloaded_files'].append( - self._download_file(params['package'], path, localpath) + file_utils.download(url, '.', localpath) ) return output_data diff --git a/libtaskotron/directives/koji_directive.py b/libtaskotron/directives/koji_directive.py index 3a0bdbe..2064e09 100644 --- a/libtaskotron/directives/koji_directive.py +++ b/libtaskotron/directives/koji_directive.py @@ -16,8 +16,13 @@ description: | parameters: action: required: true - description: choose whether to download a single build (``download`` value) - or all builds belonging to a Koji tag (``download_tag`` value) + description: | + Set the main mode of operation: + + * ``download``: download a single build + * ``download_tag``: download all builds belonging to a Koji tag + * ``download_latest_stable``: download the latest build (of the same package you provide in + ``koji_build``) that is currently in stable Fedora repositories (main or updates repo) type: str choices: [download, download_tag, download_latest_stable] arch: @@ -82,9 +87,9 @@ parameters: returns: | A dictionary containing following items: - * `downloaded_rpms`: (list of str) a list of absolute paths of the downloaded RPMs - * `downloaded_logs`: (list of str) a list of absolute paths of the downloaded build logs - * `log_errors`: (list of str) a list of architectures for which the ``build.log`` could not be + * ``downloaded_rpms``: (list of str) a list of absolute paths of the downloaded RPMs + * ``downloaded_logs``: (list of str) a list of absolute paths of the downloaded build logs + * ``log_errors``: (list of str) a list of architectures for which the ``build.log`` could not be downloaded raises: | * :class:`.TaskotronDirectiveError`: if mandatory parameters are missing or incorrect parameter diff --git a/libtaskotron/ext/fedora/koji_utils.py b/libtaskotron/ext/fedora/koji_utils.py index c01013a..6ddee56 100644 --- a/libtaskotron/ext/fedora/koji_utils.py +++ b/libtaskotron/ext/fedora/koji_utils.py @@ -145,6 +145,37 @@ class KojiClient(object): return result + @staticmethod + def _compute_arches(arches, arch_exclude, src): + ''' + From requested arches compute a final list of arches to be used by Koji calls. + The input parameters have the same meaning as documented in :meth:`nvr_to_urls`. + + :return: a set of arches to be used + :rtype: set of str + ''' + arches = set(arches) + arch_exclude = set(arch_exclude) + # populate arches if 'all' requested + if 'all' in arches: + arches.discard('all') + arches.update(config.get_config().supported_arches + ['noarch']) + + # add binary arches if base arches are specified + for arch in arches.copy(): + if arch in arch_utils.Arches.base: + arches.update(arch_utils.Arches.binary[arch]) + + if src: + arches.add('src') + else: + arch_exclude.add('src') + + # exclude unwanted arches + arches.difference_update(arch_exclude) + + return arches + def nvr_to_urls(self, nvr, arches=['all'], arch_exclude=[], debuginfo=False, src=True): '''Get list of URLs for RPMs corresponding to a build. @@ -168,24 +199,8 @@ class KojiClient(object): ''' log.info('Querying Koji for a list of RPMS for: %s', nvr) - arches = set(arches) - # populate arches if 'all' requested - if 'all' in arches: - arches.discard('all') - arches.update(config.get_config().supported_arches + ['noarch']) + arches = list(self._compute_arches(arches, arch_exclude, src)) - # add binary arches if base arches are specified - for arch in arches.copy(): - if arch in arch_utils.Arches.base: - arches.update(arch_utils.Arches.binary[arch]) - - if src: - arches.add('src') - - # exclude unwanted arches - arches.difference_update(set(arch_exclude)) - - arches = list(arches) if not arches: log.debug('Nothing to query for, the combination of `arches`, `arch_exclude` and ' '`src` ended up an empty list.') @@ -300,16 +315,13 @@ class KojiClient(object): retrieved ''' log.info('Getting build logs for: %s', nvr) - arch_exclude = list(arch_exclude) - # add binary arches if base arches are specified - archlist = list(arches) - for arch in arches: - if arch in arch_utils.Arches.base: - archlist.extend(arch_utils.Arches.binary[arch]) - arches = list(set(archlist)) # there seem to be no logs in Koji for 'src' - arch_exclude.append('src') + arches = self._compute_arches(arches, arch_exclude, src=False) + if not arches: + log.debug('Nothing to query for, the combination of `arches` and `arch_exclude` ended ' + 'up an empty list.') + return {'ok': [], 'error': []} # list the RPMs for the koji build, so that we know which arches to download logs for try: @@ -320,13 +332,10 @@ class KojiClient(object): # download for each arch build_arches = set([rpm['arch'] for rpm in build_rpms]) + build_arches.intersection_update(arches) ok = [] error = [] for build_arch in build_arches: - if build_arch not in arches and 'all' not in arches: - continue - if build_arch in arch_exclude: - continue nevra = hawkey.split_nevra(nvr + '.' + build_arch) url = self.build_log_url.format(pkg_url=config.get_config().pkg_url, nevra=nevra) diff --git a/libtaskotron/main.py b/libtaskotron/main.py index fa7eaa5..5b2a29c 100644 --- a/libtaskotron/main.py +++ b/libtaskotron/main.py @@ -19,7 +19,14 @@ from libtaskotron.overlord import Overlord # The list of accepted item types on the command line (--type option) -_ITEM_TYPES = ["bodhi_id", "koji_build", "koji_tag", "compose", "docker_image"] +_ITEM_TYPES = [ + "bodhi_id", + "koji_build", + "koji_tag", + "compose", + "docker_image", + "dist_git_commit", +] def get_argparser(): diff --git a/libtaskotron/minion.py b/libtaskotron/minion.py index 64937ef..057b1b2 100644 --- a/libtaskotron/minion.py +++ b/libtaskotron/minion.py @@ -167,7 +167,7 @@ class PersistentMinion(BaseMinion): self._run() except exc.TaskotronRemoteTimeoutError: # do not try to get logs - the minion is likely dead and we would hang on - # getting the logs, see https://phab.qadevel.cloud.fedoraproject.org/T665 + # getting the logs, see https://phab.qa.fedoraproject.org/T665 log.error('Connection to the minion timed out') raise except exc.TaskotronRemoteError: @@ -219,7 +219,7 @@ class DisposableMinion(BaseMinion): self._run() except exc.TaskotronRemoteTimeoutError: # do not try to get logs - the minion is likely dead and we would hang on - # getting the logs, see https://phab.qadevel.cloud.fedoraproject.org/T665 + # getting the logs, see https://phab.qa.fedoraproject.org/T665 log.error('Connection to the minion timed out') raise except exc.TaskotronRemoteError: diff --git a/libtaskotron/remote_exec.py b/libtaskotron/remote_exec.py index 0ffdfe3..a14bac8 100644 --- a/libtaskotron/remote_exec.py +++ b/libtaskotron/remote_exec.py @@ -133,7 +133,7 @@ class ParamikoWrapper(object): # there seems to be no way to tell whether the remote is alive, # so just use the counter - # https://phab.qadevel.cloud.fedoraproject.org/T593 + # https://phab.qa.fedoraproject.org/T593 alive_counter = 0 while not channel.exit_status_ready(): if channel.recv_ready(): diff --git a/readme.rst b/readme.rst index fcd6dd7..704ffdf 100644 --- a/readme.rst +++ b/readme.rst @@ -26,7 +26,7 @@ Installing a Development Environment Please consider whether you really need a libtaskotron development environment. Maybe you simply want to develop tests *using* libtaskotron? In that case, please follow `libtaskotron install instructions -`_ +`_ instead. If you really want to develop libtaskotron itself, please continue. For the moment, libtaskotron can't be fully installed by either pip or rpm and diff --git a/testing/test_distgit_directive.py b/testing/test_distgit_directive.py index 3d6c520..5ab760a 100644 --- a/testing/test_distgit_directive.py +++ b/testing/test_distgit_directive.py @@ -14,7 +14,7 @@ import libtaskotron.exceptions as exc class TestDistGitDirective(): def setup_method(self, method): - self.ref_nvr = 'foo-1.2-3.fc99' + self.ref_name = 'foo' self.ref_path = ['foo.spec'] self.ref_localpath = ['local.foo.spec'] self.ref_branch = 'f99' @@ -22,11 +22,17 @@ class TestDistGitDirective(): self.helper = distgit_directive.DistGitDirective() def _get_url(self, path): - return distgit_directive.URL_FMT % ('foo', path, self.ref_branch) + return distgit_directive.URL_FMT.format( + baseurl='http://pkgs.fedoraproject.org', + namespace='rpms', + package='foo', + path=path, + gitref=self.ref_branch) def test_parse_download_command(self, monkeypatch): ref_input = {'action': 'download', - 'package': self.ref_nvr, + 'package': self.ref_name, + 'gitref': self.ref_branch, 'path': self.ref_path} monkeypatch.setattr(file_utils, 'download', Dingus()) @@ -42,7 +48,8 @@ class TestDistGitDirective(): def test_parse_download_command_localpath(self, monkeypatch): ref_input = {'action': 'download', - 'package': self.ref_nvr, + 'package': self.ref_name, + 'gitref': self.ref_branch, 'path': self.ref_path, 'localpath': self.ref_localpath} @@ -61,7 +68,8 @@ class TestDistGitDirective(): ref_path = ['file1', 'file2'] ref_localpath = ['file3', 'file4'] ref_input = {'action': 'download', - 'package': self.ref_nvr, + 'package': self.ref_name, + 'gitref': self.ref_branch, 'path': ref_path, 'localpath': ref_localpath} @@ -83,7 +91,8 @@ class TestDistGitDirective(): ref_path = ['file1', 'file2'] ref_localpath = ['file3'] ref_input = {'action': 'download', - 'package': self.ref_nvr, + 'package': self.ref_name, + 'gitref': self.ref_branch, 'path': ref_path, 'localpath': ref_localpath} @@ -93,7 +102,8 @@ class TestDistGitDirective(): def test_parse_download_command_incorrect_path_str(self): ref_path = 'file1' ref_input = {'action': 'download', - 'package': self.ref_nvr, + 'package': self.ref_name, + 'gitref': self.ref_branch, 'path': ref_path} with pytest.raises(exc.TaskotronValueError): @@ -102,7 +112,8 @@ class TestDistGitDirective(): def test_parse_download_command_incorrect_localpath_str(self): ref_localpath = 'file2' ref_input = {'action': 'download', - 'package': self.ref_nvr, + 'package': self.ref_name, + 'gitref': self.ref_branch, 'path': self.ref_path, 'localpath': ref_localpath} @@ -118,7 +129,8 @@ class TestDistGitDirective(): def test_parse_download_command_missing_path(self): ref_input = {'action': 'download', - 'package': self.ref_nvr} + 'package': self.ref_name, + 'gitref': self.ref_branch} with pytest.raises(exc.TaskotronDirectiveError): self.helper.process(ref_input, self.ref_arg_data) diff --git a/testing/test_koji_utils.py b/testing/test_koji_utils.py index 0881cc4..40be06e 100644 --- a/testing/test_koji_utils.py +++ b/testing/test_koji_utils.py @@ -16,6 +16,7 @@ from libtaskotron.ext.fedora import koji_utils from libtaskotron import exceptions as exc from libtaskotron import config from libtaskotron import file_utils +from libtaskotron import arch_utils from test_file_utils import mock_download @@ -158,6 +159,70 @@ class TestKojiClient(object): with pytest.raises(exc.TaskotronRemoteError): test_koji.rpms_to_build([self.ref_filename]) + # ===================== + # _compute_arches() + # ===================== + + def test_add_binary_arches(self): + '''specifying basearch should add all binary arches''' + ref_arch = 'i386' + bin_arches = arch_utils.Arches.binary[ref_arch] + arches = koji_utils.KojiClient._compute_arches(arches=[ref_arch], arch_exclude=[], + src=False) + assert arches == set(bin_arches) + + def test_keep_extra_arch_with_all(self): + '''Arches should not be thrown away even if 'all' is specified (there might be some extra + obscure arches specified in addition)''' + ref_arch = ['all', 'obscure_arch'] + arches = koji_utils.KojiClient._compute_arches(arches=ref_arch, arch_exclude=[], src=False) + assert 'all' not in arches + assert 'obscure_arch' in arches + + def test_src(self): + # src enabled + ref_arch = ['all'] + arches = koji_utils.KojiClient._compute_arches(arches=ref_arch, arch_exclude=[], src=True) + assert 'src' in arches + + # src disabled + ref_arch = ['all', 'src'] + arches = koji_utils.KojiClient._compute_arches(arches=ref_arch, arch_exclude=[], src=False) + assert 'src' not in arches + + def test_only_src(self): + ref_arch = [] + arches = koji_utils.KojiClient._compute_arches(arches=ref_arch, arch_exclude=[], src=True) + assert arches == set(['src']) + + def test_arch_exclude(self): + ref_arch = ['all'] + + # arch_exclude disabled + ref_exclude = [] + arches = koji_utils.KojiClient._compute_arches(arches=ref_arch, arch_exclude=ref_exclude, + src=False) + for arch in ref_exclude: + if arch in config.get_config().supported_arches: + assert arch in arches + + # arch_exclude enabled + ref_exclude = ['x86_64'] + arches = koji_utils.KojiClient._compute_arches(arches=ref_arch, arch_exclude=ref_exclude, + src=False) + for arch in ref_exclude: + assert arch not in arches + + def test_arch_exclude_override_explicit(self): + '''arch_exclude should work even when the same arch is explicitly stated in arches''' + ref_exclude = ['x86_64'] + ref_arch = ref_exclude + ['i386'] + + arches = koji_utils.KojiClient._compute_arches(arches=ref_arch, arch_exclude=ref_exclude, + src=False) + for arch in ref_exclude: + assert arch not in arches + # =================== # nvr_to_urls() # =================== @@ -173,33 +238,6 @@ class TestKojiClient(object): assert url.startswith(koji_baseurl) assert url.endswith('.rpm') - def should_i386_rpmurls_query_i686(self): - self.ref_arch = 'i386' - stub_koji = Dingus(getBuild__returns=self.ref_build, - listRPMs__returns=self.ref_rpms) - test_koji = koji_utils.KojiClient(stub_koji) - - test_koji.nvr_to_urls(self.ref_nvr, arches=[self.ref_arch]) - - listrpm_calls = stub_koji.calls('listRPMs') - requested_arches = listrpm_calls[0][2]['arches'] - assert 'i686' in requested_arches - assert 'i386' in requested_arches - - def test_keep_extra_arch_with_all(self): - '''Arches should not be thrown away even if 'all' is specified (there might be some extra - obscure arches specified in addition)''' - self.ref_arch = ['all', 'obscure_arch'] - stub_koji = Dingus(getBuild__returns=self.ref_build) - test_koji = koji_utils.KojiClient(stub_koji) - - test_koji.nvr_to_urls(self.ref_nvr, arches=self.ref_arch) - - listrpm_calls = stub_koji.calls('listRPMs') - requested_arches = listrpm_calls[0][2]['arches'] - assert 'all' not in requested_arches - assert 'obscure_arch' in requested_arches - def should_not_throw_exception_norpms(self): '''It's possible to have no RPMs (for the given arch) in a build''' stub_koji = Dingus(getBuild__returns = self.ref_build) @@ -207,24 +245,6 @@ class TestKojiClient(object): test_koji.nvr_to_urls(self.ref_nvr, arches = [self.ref_arch]) - def test_nvr_to_urls_src_filtering(self): - stub_koji = Dingus(getBuild__returns=self.ref_build) - test_koji = koji_utils.KojiClient(stub_koji) - - # src enabled - test_koji.nvr_to_urls(self.ref_nvr, src=True, debuginfo=True) - listrpm_calls = stub_koji.calls('listRPMs') - assert len(listrpm_calls) == 1 - requested_arches = listrpm_calls[0][2]['arches'] - assert 'src' in requested_arches - - # src disabled - test_koji.nvr_to_urls(self.ref_nvr, src=False, debuginfo=True) - listrpm_calls = stub_koji.calls('listRPMs') - assert len(listrpm_calls) == 2 - requested_arches = listrpm_calls[1][2]['arches'] - assert 'src' not in requested_arches - def test_nvr_to_urls_debuginfo(self): stub_koji = Dingus(getBuild__returns=self.ref_build, listRPMs__returns=self.ref_rpms) @@ -241,17 +261,6 @@ class TestKojiClient(object): if 'debuginfo' not in rpm['name']]) assert all(['debuginfo' not in url for url in urls]) - def test_nvr_to_urls_only_src(self): - stub_koji = Dingus(getBuild__returns=self.ref_build) - test_koji = koji_utils.KojiClient(stub_koji) - - # arch disabled, src enabled - test_koji.nvr_to_urls(self.ref_nvr, arches=[], src=True) - listrpm_calls = stub_koji.calls('listRPMs') - requested_arches = listrpm_calls[0][2]['arches'] - assert len(requested_arches) == 1 - assert 'src' in requested_arches - def should_not_query_no_arch_no_src(self): '''If there's no arch to query for, should not perform the query''' stub_koji = mock.Mock() @@ -260,44 +269,6 @@ class TestKojiClient(object): test_koji.nvr_to_urls(self.ref_nvr, arches=[], src=False) assert not stub_koji.called - def test_arch_exclude(self): - stub_koji = Dingus(getBuild__returns=self.ref_build) - test_koji = koji_utils.KojiClient(stub_koji) - ref_exclude = ['x86_64'] - - # arch_exclude disabled - test_koji.nvr_to_urls(self.ref_nvr, src=True, debuginfo=True) - listrpm_calls = stub_koji.calls('listRPMs') - assert len(listrpm_calls) == 1 - requested_arches = listrpm_calls[0][2]['arches'] - for arch in ref_exclude: - if arch in config.get_config().supported_arches: - assert arch in requested_arches - - # arch_exclude enabled - test_koji.nvr_to_urls(self.ref_nvr, arch_exclude=ref_exclude, src=True, debuginfo=True) - listrpm_calls = stub_koji.calls('listRPMs') - assert len(listrpm_calls) == 2 - requested_arches = listrpm_calls[1][2]['arches'] - for arch in ref_exclude: - assert arch not in requested_arches - - def test_arch_exclude_override_explicit(self): - '''arch_exclude should work even when the same arch is explicitly stated in arches''' - stub_koji = Dingus(getBuild__returns=self.ref_build) - test_koji = koji_utils.KojiClient(stub_koji) - ref_exclude = ['x86_64'] - ref_arch = ref_exclude + ['i386'] - - # arch_exclude enabled - test_koji.nvr_to_urls(self.ref_nvr, arches=ref_arch, arch_exclude=ref_exclude, - src=True, debuginfo=True) - listrpm_calls = stub_koji.calls('listRPMs') - assert len(listrpm_calls) == 1 - requested_arches = listrpm_calls[0][2]['arches'] - for arch in ref_exclude: - assert arch not in requested_arches - # ==================== # get_nvr_rpms() # ==================== @@ -434,21 +405,6 @@ class TestKojiClient(object): with pytest.raises(exc.TaskotronRemoteError): test_koji.get_build_log(self.ref_nvr, dest=None) - def test_build_log_add_binary_archs(self, monkeypatch): - '''specifying basearch should query for concrete binary arches''' - self.ref_arch = 'i686' - ref_base_arch = 'i386' - stub_koji = mock.Mock() - stub_koji.listBuildRPMs.return_value = self.ref_rpms - test_koji = koji_utils.KojiClient(stub_koji) - stub_download = mock.Mock() - monkeypatch.setattr(file_utils, 'download', stub_download) - - test_koji.get_build_log(self.ref_nvr, dest=None, arches=[ref_base_arch]) - - assert stub_download.call_count == 1 - assert '/%s/' % self.ref_arch in stub_download.call_args[1]['url'] - def test_build_log_do_nothing_different_arch(self, monkeypatch): '''if only unavailable arches are requested, do nothing and don't crash''' ref_arch = 'armv7hl' # not available in self.rpms