From dda47acab7c8ea1b670aa09c93af9f8591220a40 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Tue, 10 Jan 2017 14:29:54 +0100 Subject: [PATCH 1/5] Fix #276 - Use PDC to resolve buildroot components instead of MBS database --- module_build_service/builder.py | 19 ++++++ module_build_service/pdc.py | 67 +++++++++++++++++++ .../scheduler/handlers/components.py | 14 +--- .../scheduler/handlers/modules.py | 26 ++----- .../scheduler/handlers/repos.py | 13 +--- tests/__init__.py | 24 +++++++ tests/test_build/test_build.py | 13 +++- 7 files changed, 130 insertions(+), 46 deletions(-) diff --git a/module_build_service/builder.py b/module_build_service/builder.py index e1179c0f..2023b220 100644 --- a/module_build_service/builder.py +++ b/module_build_service/builder.py @@ -52,6 +52,7 @@ from OpenSSL.SSL import SysCallError from module_build_service import conf, log, db from module_build_service.models import ModuleBuild +from module_build_service import pdc import module_build_service.scm import module_build_service.utils import module_build_service.scheduler @@ -277,6 +278,24 @@ class GenericBuilder(six.with_metaclass(ABCMeta)): """ raise NotImplementedError() + @classmethod + def default_buildroot_groups(cls, session, module): + try: + pdc_session = pdc.get_pdc_client_session(conf) + pdc_groups = pdc.resolve_profiles(pdc_session, module.mmd(), + ('buildroot', 'srpm-buildroot')) + groups = { + 'build': pdc_groups['buildroot'], + 'srpm-build': pdc_groups['srpm-buildroot'], + } + except ValueError: + reason = "Failed to gather buildroot groups from SCM." + log.exception(reason) + module.transition(conf, state="failed", state_reason=reason) + session.commit() + raise + return groups + class KojiModuleBuilder(GenericBuilder): """ Koji specific builder class """ diff --git a/module_build_service/pdc.py b/module_build_service/pdc.py index a95fb088..6b4f0d5d 100644 --- a/module_build_service/pdc.py +++ b/module_build_service/pdc.py @@ -183,6 +183,73 @@ def get_module_tag(session, module_info, strict=False): """ return get_module(session, module_info, strict=strict)['koji_tag'] +def get_module_modulemd(session, module_info, strict=False): + """ + :param session : PDCClient instance + :param module_info: list of module_info dicts + :param strict: Normally this function returns None if no module can be + found. If strict=True, then a ValueError is raised. + :return: ModuleMetadata instance + """ + yaml = get_module(session, module_info, strict=strict)['modulemd'] + if not yaml: + if strict: + raise ValueError("Failed to find modulemd entry in PDC for " + "%r" % module_info) + else: + return None + + mmd = modulemd.ModuleMetadata() + mmd.loads(yaml) + return mmd + +def resolve_profiles(session, mmd, keys, seen=None): + """ + :param session : PDCClient instance + :param mmd: ModuleMetadata instance of module + :param keys: list of modulemd installation profiles to include in + the result. + :return: Dictionary with keys set according to `keys` param and values + set to union of all components defined in all installation + profiles matching the key recursively using the buildrequires. + + https://pagure.io/fm-orchestrator/issue/181 + """ + + seen = seen or [] # Initialize to an empty list. + results = {} + for key in keys: + results[key] = set() + for name, stream in mmd.buildrequires.items(): + # First, guard against infinite recursion + if name in seen: + continue + + # Find the latest of the dep in our db of built modules. + module_info = {} + module_info['variant_id'] = name + module_info['variant_stream'] = stream + dep_mmd = get_module_modulemd(session, module_info, False) + # XXX - We may want to make this fatal one day, but warn for now. + if not dep_mmd: + log.warn("Could not find built dep " + "%s/%s for %r" % (name, stream, mmd.name)) + continue + + # Take note of what rpms are in this dep's profile. + profiles = dep_mmd.profiles + for key in keys: + if key in profiles: + results[key] |= profiles[key].rpms + + # And recurse to all modules that are deps of our dep. + rec_results = resolve_profiles(session, dep_mmd, keys, seen + [name]) + for rec_key, rec_result in rec_results.items(): + results[rec_key] |= rec_result + + # Return the union of all rpms in all profiles of the given keys. + return results + def module_depsolving_wrapper(session, module_list, strict=True): """ :param session : PDCClient instance diff --git a/module_build_service/scheduler/handlers/components.py b/module_build_service/scheduler/handlers/components.py index 7ebab34b..c039b47b 100644 --- a/module_build_service/scheduler/handlers/components.py +++ b/module_build_service/scheduler/handlers/components.py @@ -77,18 +77,8 @@ def _finalize(config, session, msg, state): builder = module_build_service.builder.GenericBuilder.create( parent.owner, module_name, config.system, config, tag_name=tag) - try: - groups = { - 'build': parent.resolve_profiles(session, 'buildroot'), - 'srpm-build': parent.resolve_profiles(session, 'srpm-buildroot'), - } - except ValueError: - reason = "Failed to gather buildroot groups from SCM." - log.exception(reason) - parent.transition(config, state=models.BUILD_STATES["failed"], - state_reason=reason) - session.commit() - raise + groups = module_build_service.builder.GenericBuilder.default_buildroot_groups( + session, parent) builder.buildroot_connect(groups) diff --git a/module_build_service/scheduler/handlers/modules.py b/module_build_service/scheduler/handlers/modules.py index 240d16c3..d393c8c8 100644 --- a/module_build_service/scheduler/handlers/modules.py +++ b/module_build_service/scheduler/handlers/modules.py @@ -68,17 +68,8 @@ def failed(config, session, msg): and c.state != koji.BUILD_STATES["FAILED"]) ] - try: - groups = { - 'build': build.resolve_profiles(session, 'buildroot'), - 'srpm-build': build.resolve_profiles(session, 'srpm-buildroot'), - } - except ValueError: - reason = "Failed to gather buildroot groups from SCM." - log.exception(reason) - build.transition(config, state="failed", state_reason=reason) - session.commit() - raise + groups = module_build_service.builder.GenericBuilder.default_buildroot_groups( + session, build) if build.koji_tag: builder = module_build_service.builder.GenericBuilder.create( @@ -201,17 +192,8 @@ def wait(config, session, msg): session.commit() raise - try: - groups = { - 'build': build.resolve_profiles(session, 'buildroot'), - 'srpm-build': build.resolve_profiles(session, 'srpm-buildroot'), - } - except ValueError: - reason = "Failed to gather buildroot groups from SCM." - log.exception(reason) - build.transition(config, state="failed", state_reason=reason) - session.commit() - raise + groups = module_build_service.builder.GenericBuilder.default_buildroot_groups( + session, build) log.debug("Found tag=%s for module %r" % (tag, build)) # Hang on to this information for later. We need to know which build is diff --git a/module_build_service/scheduler/handlers/repos.py b/module_build_service/scheduler/handlers/repos.py index 5010d086..cf4aa54e 100644 --- a/module_build_service/scheduler/handlers/repos.py +++ b/module_build_service/scheduler/handlers/repos.py @@ -79,17 +79,8 @@ def done(config, session, msg): log.warn("Odd! All components in batch failed for %r." % module_build) return - try: - groups = { - 'build': module_build.resolve_profiles(session, 'buildroot'), - 'srpm-build': module_build.resolve_profiles(session, 'srpm-buildroot'), - } - except ValueError: - reason = "Failed to gather buildroot groups from SCM." - log.exception(reason) - module_build.transition(config, state="failed", state_reason=reason) - session.commit() - raise + groups = module_build_service.builder.GenericBuilder.default_buildroot_groups( + session, module_build) builder = module_build_service.builder.GenericBuilder.create( module_build.owner, module_build.name, config.system, config, diff --git a/tests/__init__.py b/tests/__init__.py index ecc16a69..12c869b2 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -28,10 +28,34 @@ from module_build_service import db from module_build_service.config import init_config from module_build_service.models import ModuleBuild, ComponentBuild from module_build_service.utils import insert_fake_baseruntime +import module_build_service.pdc app = module_build_service.app conf = init_config(app) +def local_resolve_profiles(pdc_session, mmd, keys): + """ + Returns the default srpm-buildroot and "buildroot" groups as they + would have been return from PDC. + + We are not using real PDC for resolve_profiles in tests, + because it makes tests slower and depending on the remote dev + PDC instance which is not ideal. + """ + default_groups = { + 'srpm-buildroot': + set(['shadow-utils', 'fedora-release', 'redhat-rpm-config', + 'rpm-build', 'fedpkg-minimal', 'gnupg2', 'bash']), + 'buildroot': + set(['unzip', 'fedora-release', 'tar', 'cpio', 'gawk', + 'gcc', 'xz', 'sed', 'findutils', 'util-linux', 'bash', + 'info', 'bzip2', 'grep', 'redhat-rpm-config', + 'diffutils', 'make', 'patch', 'shadow-utils', + 'coreutils', 'which', 'rpm-build', 'gzip', 'gcc-c++'])} + + return default_groups + +module_build_service.pdc.resolve_profiles = local_resolve_profiles def init_data(): db.session.remove() diff --git a/tests/test_build/test_build.py b/tests/test_build/test_build.py index da9ec056..ce3488f9 100644 --- a/tests/test_build/test_build.py +++ b/tests/test_build/test_build.py @@ -96,7 +96,18 @@ class TestModuleBuilder(GenericBuilder): TestModuleBuilder.on_tag_artifacts_cb = None def buildroot_connect(self, groups): - pass + default_groups = { + 'srpm-build': + set(['shadow-utils', 'fedora-release', 'redhat-rpm-config', + 'rpm-build', 'fedpkg-minimal', 'gnupg2', 'bash']), + 'build': + set(['unzip', 'fedora-release', 'tar', 'cpio', 'gawk', + 'gcc', 'xz', 'sed', 'findutils', 'util-linux', 'bash', + 'info', 'bzip2', 'grep', 'redhat-rpm-config', + 'diffutils', 'make', 'patch', 'shadow-utils', + 'coreutils', 'which', 'rpm-build', 'gzip', 'gcc-c++'])} + if groups != default_groups: + raise ValueError("Wrong groups in TestModuleBuilder.buildroot_connect()") def buildroot_prep(self): pass From 0f797c291789f3fbe2a62bb7f96db5ed41f4a612 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Tue, 10 Jan 2017 15:58:26 +0100 Subject: [PATCH 2/5] Remove fake base-runtime module from DB and old resolve_profiles method because they are not used anymore. Fix the tests to work with remove fake base-runtime. --- module_build_service/manage.py | 3 -- module_build_service/models.py | 42 --------------- module_build_service/utils.py | 92 -------------------------------- tests/__init__.py | 7 +-- tests/test_models/test_models.py | 14 +---- tests/test_views/test_views.py | 69 ++++++++++++------------ 6 files changed, 38 insertions(+), 189 deletions(-) diff --git a/module_build_service/manage.py b/module_build_service/manage.py index 26a9627a..06fb7f3e 100644 --- a/module_build_service/manage.py +++ b/module_build_service/manage.py @@ -42,7 +42,6 @@ from module_build_service.pdc import ( get_module_tag, get_module_build_dependencies) from module_build_service.utils import ( submit_module_build, - insert_fake_baseruntime, ) from module_build_service.messaging import RidaModule import module_build_service.messaging @@ -135,7 +134,6 @@ def upgradedb(): 'migrations') with app.app_context(): flask_migrate.upgrade(directory=migrations_dir) - insert_fake_baseruntime() @manager.command @@ -172,7 +170,6 @@ def build_module_locally(url): # In the future, we should use PDC to get what we need from the fake module, # so it's probably not big problem. db.create_all() - insert_fake_baseruntime() username = getpass.getuser() submit_module_build(username, url, allow_local_url=True) diff --git a/module_build_service/models.py b/module_build_service/models.py index 79126d9c..009fa88f 100644 --- a/module_build_service/models.py +++ b/module_build_service/models.py @@ -287,48 +287,6 @@ class ModuleBuild(RidaBase): return tasks - def resolve_profiles(self, session, key, seen=None): - """ Gather dependency profiles named `key` of modules we depend on. - - This is used to find the union of all 'buildroot' profiles of a - module's dependencies. - - https://pagure.io/fm-orchestrator/issue/181 - """ - - seen = seen or [] # Initialize to an empty list. - result = set() - for name, stream in self.mmd().buildrequires.items(): - # First, guard against infinite recursion - if name in seen: - continue - - # Find the latest of the dep in our db of built modules. - dep = session.query(ModuleBuild)\ - .filter(ModuleBuild.name==name)\ - .filter(ModuleBuild.stream==stream)\ - .filter(or_( - ModuleBuild.state==BUILD_STATES["done"], - ModuleBuild.state==BUILD_STATES["ready"], - )).order_by('version').first() - - # XXX - We may want to make this fatal one day, but warn for now. - if not dep: - log.warn("Could not find built dep " - "%s/%s for %r" % (name, stream, self)) - continue - - # Take note of what rpms are in this dep's profile. - profiles = dep.mmd().profiles - if key in profiles: - result |= profiles[key].rpms - - # And recurse to all modules that are deps of our dep. - result |= dep.resolve_profiles(session, key, seen + [name]) - - # Return the union of all rpms in all profiles of the given key. - return result - def __repr__(self): return "" % ( self.name, self.stream, self.version, diff --git a/module_build_service/utils.py b/module_build_service/utils.py index df298518..06fc274b 100644 --- a/module_build_service/utils.py +++ b/module_build_service/utils.py @@ -427,98 +427,6 @@ def submit_module_build(username, url, allow_local_url = False): mmd.name, mmd.stream, mmd.version) return module - -def insert_fake_baseruntime(): - """ Insert a fake base-runtime module into our db. - - This is done so that we can reference the build profiles in its modulemd. - - See: - - https://pagure.io/fm-orchestrator/pull-request/228 - - https://pagure.io/fm-orchestrator/pull-request/225 - """ - - import sqlalchemy as sa - - import modulemd - - yaml = """ - document: modulemd - version: 1 - data: - name: base-runtime - stream: master - version: 3 - summary: A fake base-runtime module, used to bootstrap the infrastructure. - description: ... - profiles: - buildroot: - rpms: - - bash - - bzip2 - - coreutils - - cpio - - diffutils - - fedora-release - - findutils - - gawk - - gcc - - gcc-c++ - - grep - - gzip - - info - - make - - patch - - redhat-rpm-config - - rpm-build - - sed - - shadow-utils - - tar - - unzip - - util-linux - - which - - xz - srpm-buildroot: - rpms: - - bash - - fedora-release - - fedpkg-minimal - - gnupg2 - - redhat-rpm-config - - rpm-build - - shadow-utils - """ - - mmd = modulemd.ModuleMetadata() - mmd.loads(yaml) - - # Check to see if this thing already exists... - query = models.ModuleBuild.query\ - .filter_by(name=mmd.name)\ - .filter_by(stream=mmd.stream)\ - .filter_by(version=mmd.version) - if query.count(): - logging.info('%r exists. Skipping creation.' % query.first()) - return - - # Otherwise, it does not exist. So, create it. - now = datetime.utcnow() - module = models.ModuleBuild() - module.name = mmd.name - module.stream = mmd.stream - module.version = mmd.version - module.modulemd = yaml - module.scmurl = '...' - module.owner = 'modularity' - module.state = models.BUILD_STATES['done'] - module.state_reason = 'Artificially created.' - module.time_submitted = now - module.time_modified = now - module.time_completed = now - db.session.add(module) - db.session.commit() - - def scm_url_schemes(terse=False): """ Definition of URL schemes supported by both frontend and scheduler. diff --git a/tests/__init__.py b/tests/__init__.py index 12c869b2..74481b30 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -27,7 +27,6 @@ from datetime import datetime, timedelta from module_build_service import db from module_build_service.config import init_config from module_build_service.models import ModuleBuild, ComponentBuild -from module_build_service.utils import insert_fake_baseruntime import module_build_service.pdc app = module_build_service.app @@ -61,7 +60,6 @@ def init_data(): db.session.remove() db.drop_all() db.create_all() - insert_fake_baseruntime() for index in range(10): build_one = ModuleBuild() build_one.name = 'nginx' @@ -208,7 +206,6 @@ def scheduler_init_data(): db.session.remove() db.drop_all() db.create_all() - insert_fake_baseruntime() current_dir = os.path.dirname(__file__) star_command_yml_path = os.path.join( @@ -241,7 +238,7 @@ def scheduler_init_data(): component_one_build_one.state = None component_one_build_one.nvr = 'communicator-1.10.1-2.module_starcommand_1_3' component_one_build_one.batch = 2 - component_one_build_one.module_id = 2 + component_one_build_one.module_id = 1 component_two_build_one = module_build_service.models.ComponentBuild() component_two_build_one.package = 'module-build-macros' @@ -254,7 +251,7 @@ def scheduler_init_data(): component_two_build_one.nvr = \ 'module-build-macros-01-1.module_starcommand_1_3' component_two_build_one.batch = 2 - component_two_build_one.module_id = 2 + component_two_build_one.module_id = 1 db.session.add(build_one) db.session.add(component_one_build_one) diff --git a/tests/test_models/test_models.py b/tests/test_models/test_models.py index 466831e9..bafee720 100644 --- a/tests/test_models/test_models.py +++ b/tests/test_models/test_models.py @@ -33,16 +33,4 @@ class TestModels(unittest.TestCase): def setUp(self): init_data() - def test_resolve_refs(self): - expected = set([ - 'shadow-utils', - 'fedora-release', - 'redhat-rpm-config', - 'rpm-build', - 'fedpkg-minimal', - 'gnupg2', - 'bash', - ]) - build = db.session.query(models.ModuleBuild).filter_by(name='testmodule').one() - result = build.resolve_profiles(db.session, 'srpm-buildroot') - eq_(result, expected) + diff --git a/tests/test_views/test_views.py b/tests/test_views/test_views.py index c29708c2..d468eca5 100644 --- a/tests/test_views/test_views.py +++ b/tests/test_views/test_views.py @@ -82,16 +82,17 @@ class TestViews(unittest.TestCase): init_data() def test_query_build(self): - rv = self.client.get('/module-build-service/1/module-builds/2') + rv = self.client.get('/module-build-service/1/module-builds/1') data = json.loads(rv.data) - self.assertEquals(data['id'], 2) + self.assertEquals(data['id'], 1) self.assertEquals(data['name'], 'nginx') self.assertEquals(data['owner'], 'Moe Szyslak') self.assertEquals(data['state'], 3) self.assertEquals(data['state_reason'], None) self.assertEquals(data['tasks'], { - 'rpms/module-build-macros': '47383993/1', - 'rpms/postgresql': '2433433/1'} + 'rpms/module-build-macros': '12312321/1', + 'rpms/nginx': '12312345/1' + } ) self.assertEquals(data['time_completed'], '2016-09-03T11:25:32Z') self.assertEquals(data['time_modified'], '2016-09-03T11:25:32Z') @@ -108,7 +109,7 @@ class TestViews(unittest.TestCase): 'module-build-service/1/module-builds/?per_page=8&page=4' in meta_data['last']) self.assertTrue( 'module-build-service/1/module-builds/?per_page=8&page=1' in meta_data['first']) - self.assertEquals(meta_data['total'], 31) + self.assertEquals(meta_data['total'], 30) self.assertEquals(meta_data['per_page'], 8) self.assertEquals(meta_data['pages'], 4) self.assertEquals(meta_data['page'], 2) @@ -121,14 +122,14 @@ class TestViews(unittest.TestCase): def test_query_builds_verbose(self): rv = self.client.get('/module-build-service/1/module-builds/?per_page=2&verbose=True') - item = json.loads(rv.data)['items'][1] - self.assertEquals(item['id'], 2) + item = json.loads(rv.data)['items'][0] + self.assertEquals(item['id'], 1) self.assertEquals(item['name'], 'nginx') self.assertEquals(item['owner'], 'Moe Szyslak') self.assertEquals(item['state'], 3) self.assertEquals(item['tasks'], { - 'rpms/module-build-macros': '47383993/1', - 'rpms/postgresql': '2433433/1' + 'rpms/module-build-macros': '12312321/1', + 'rpms/nginx': '12312345/1' } ) self.assertEquals(item['time_completed'], '2016-09-03T11:25:32Z') @@ -150,7 +151,7 @@ class TestViews(unittest.TestCase): rv = self.client.get( '/module-build-service/1/module-builds/?completed_after=2016-09-03T12:25:00Z') data = json.loads(rv.data) - self.assertEquals(data['meta']['total'], 9) + self.assertEquals(data['meta']['total'], 8) def test_query_builds_filter_submitted_before(self): rv = self.client.get( @@ -162,7 +163,7 @@ class TestViews(unittest.TestCase): rv = self.client.get( '/module-build-service/1/module-builds/?submitted_after=2016-09-03T12:25:00Z') data = json.loads(rv.data) - self.assertEquals(data['meta']['total'], 24) + self.assertEquals(data['meta']['total'], 23) def test_query_builds_filter_modified_before(self): rv = self.client.get( @@ -174,7 +175,7 @@ class TestViews(unittest.TestCase): rv = self.client.get( '/module-build-service/1/module-builds/?modified_after=2016-09-03T12:25:00Z') data = json.loads(rv.data) - self.assertEquals(data['meta']['total'], 25) + self.assertEquals(data['meta']['total'], 24) def test_query_builds_filter_owner(self): rv = self.client.get( @@ -186,7 +187,7 @@ class TestViews(unittest.TestCase): rv = self.client.get( '/module-build-service/1/module-builds/?state=3') data = json.loads(rv.data) - self.assertEquals(data['meta']['total'], 21) + self.assertEquals(data['meta']['total'], 20) def test_query_builds_two_filters(self): rv = self.client.get('/module-build-service/1/module-builds/?owner=Moe%20Szyslak' @@ -212,14 +213,14 @@ class TestViews(unittest.TestCase): rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( {'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/' - 'testmodule.git?#68932c90de214d9d13feefbd35246a81b6cb8d49'})) + 'testmodule.git?#68931c90de214d9d13feefbd35246a81b6cb8d49'})) data = json.loads(rv.data) self.assertEquals(data['component_builds'], [61]) self.assertEquals(data['name'], 'fakemodule') self.assertEquals(data['scmurl'], ('git://pkgs.stg.fedoraproject.org/modules/testmodule' - '.git?#68932c90de214d9d13feefbd35246a81b6cb8d49')) + '.git?#68931c90de214d9d13feefbd35246a81b6cb8d49')) self.assertEquals(data['version'], '5') self.assertTrue(data['time_submitted'] is not None) self.assertTrue(data['time_modified'] is not None) @@ -227,9 +228,9 @@ class TestViews(unittest.TestCase): self.assertEquals(data['time_completed'], None) self.assertEquals(data['stream'], '4.3.44') self.assertEquals(data['owner'], 'Homer J. Simpson') - self.assertEquals(data['id'], 32) + self.assertEquals(data['id'], 31) self.assertEquals(data['state_name'], 'wait') - self.assertEquals(data['state_url'], '/module-build-service/1/module-builds/32') + self.assertEquals(data['state_url'], '/module-build-service/1/module-builds/31') mmd = _modulemd.ModuleMetadata() mmd.loads(data["modulemd"]) @@ -242,14 +243,14 @@ class TestViews(unittest.TestCase): rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( {'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/' - 'testmodule.git?#68932c90de214d9d13feefbd35246a81b6cb8d49'})) + 'testmodule.git?#68931c90de214d9d13feefbd35246a81b6cb8d49'})) data = json.loads(rv.data) self.assertEquals(data['component_builds'], []) self.assertEquals(data['name'], 'fakemodule2') self.assertEquals(data['scmurl'], ('git://pkgs.stg.fedoraproject.org/modules/testmodule' - '.git?#68932c90de214d9d13feefbd35246a81b6cb8d49')) + '.git?#68931c90de214d9d13feefbd35246a81b6cb8d49')) self.assertEquals(data['version'], '5') self.assertTrue(data['time_submitted'] is not None) self.assertTrue(data['time_modified'] is not None) @@ -257,13 +258,13 @@ class TestViews(unittest.TestCase): self.assertEquals(data['time_completed'], None) self.assertEquals(data['stream'], '4.3.44') self.assertEquals(data['owner'], 'Homer J. Simpson') - self.assertEquals(data['id'], 32) + self.assertEquals(data['id'], 31) self.assertEquals(data['state_name'], 'wait') def test_submit_build_auth_error(self): rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( {'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/' - 'testmodule.git?#48932b90de214d9d13feefbd35246a81b6cb8d49'})) + 'testmodule.git?#48931b90de214d9d13feefbd35246a81b6cb8d49'})) data = json.loads(rv.data) self.assertEquals( data['message'], @@ -309,7 +310,7 @@ class TestViews(unittest.TestCase): rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( {'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/' - 'testmodule.git?#68932c90de214d9d13feefbd35246a81b6cb8d49'})) + 'testmodule.git?#68931c90de214d9d13feefbd35246a81b6cb8d49'})) data = json.loads(rv.data) self.assertTrue(data['message'].startswith('Invalid modulemd:')) self.assertEquals(data['status'], 422) @@ -330,19 +331,19 @@ class TestViews(unittest.TestCase): start = time.time() rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( {'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/' - 'testmodule.git?#68932c90de214d9d13feefbd35246a81b6cb8d49'})) + 'testmodule.git?#68931c90de214d9d13feefbd35246a81b6cb8d49'})) data = json.loads(rv.data) self.assertEquals(len(data['component_builds']), 5) self.assertEquals(data['name'], 'base-runtime') self.assertEquals(data['scmurl'], ('git://pkgs.stg.fedoraproject.org/modules/testmodule' - '.git?#68932c90de214d9d13feefbd35246a81b6cb8d49')) + '.git?#68931c90de214d9d13feefbd35246a81b6cb8d49')) self.assertTrue(data['time_submitted'] is not None) self.assertTrue(data['time_modified'] is not None) self.assertEquals(data['time_completed'], None) self.assertEquals(data['owner'], 'Homer J. Simpson') - self.assertEquals(data['id'], 32) + self.assertEquals(data['id'], 31) self.assertEquals(data['state_name'], 'wait') # SCM availability check is parallelized, so 5 components should not @@ -364,7 +365,7 @@ class TestViews(unittest.TestCase): rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( {'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/' - 'testmodule.git?#68932c90de214d9d13feefbd35246a81b6cb8d49'})) + 'testmodule.git?#68931c90de214d9d13feefbd35246a81b6cb8d49'})) data = json.loads(rv.data) self.assertEquals(data['status'], 422) @@ -381,14 +382,14 @@ class TestViews(unittest.TestCase): rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( {'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/' - 'testmodule.git?#68932c90de214d9d13feefbd35246a81b6cb8d49'})) + 'testmodule.git?#68931c90de214d9d13feefbd35246a81b6cb8d49'})) data = json.loads(rv.data) self.assertEquals(data['component_builds'], [61, 62]) self.assertEquals(data['name'], 'fakemodule') self.assertEquals(data['scmurl'], ('git://pkgs.stg.fedoraproject.org/modules/testmodule' - '.git?#68932c90de214d9d13feefbd35246a81b6cb8d49')) + '.git?#68931c90de214d9d13feefbd35246a81b6cb8d49')) self.assertEquals(data['version'], '5') self.assertTrue(data['time_submitted'] is not None) self.assertTrue(data['time_modified'] is not None) @@ -396,12 +397,12 @@ class TestViews(unittest.TestCase): self.assertEquals(data['time_completed'], None) self.assertEquals(data['stream'], '4.3.44') self.assertEquals(data['owner'], 'Homer J. Simpson') - self.assertEquals(data['id'], 32) + self.assertEquals(data['id'], 31) self.assertEquals(data['state_name'], 'wait') - self.assertEquals(data['state_url'], '/module-build-service/1/module-builds/32') + self.assertEquals(data['state_url'], '/module-build-service/1/module-builds/31') batches = {} - for build in ComponentBuild.query.filter_by(module_id=32).all(): + for build in ComponentBuild.query.filter_by(module_id=31).all(): batches[build.package] = build.batch self.assertEquals(batches["bash"], 2) @@ -411,7 +412,7 @@ class TestViews(unittest.TestCase): @patch('module_build_service.auth.assert_is_packager') def test_cancel_build(self, mocked_assert_is_packager, mocked_get_username): - rv = self.client.patch('/module-build-service/1/module-builds/31', + rv = self.client.patch('/module-build-service/1/module-builds/30', data=json.dumps({'state': 'failed'})) data = json.loads(rv.data) @@ -434,7 +435,7 @@ class TestViews(unittest.TestCase): @patch('module_build_service.auth.assert_is_packager') def test_cancel_build_wrong_param(self, mocked_assert_is_packager, mocked_get_username): - rv = self.client.patch('/module-build-service/1/module-builds/31', + rv = self.client.patch('/module-build-service/1/module-builds/30', data=json.dumps({'some_param': 'value'})) data = json.loads(rv.data) @@ -447,7 +448,7 @@ class TestViews(unittest.TestCase): @patch('module_build_service.auth.assert_is_packager') def test_cancel_build_wrong_state(self, mocked_assert_is_packager, mocked_get_username): - rv = self.client.patch('/module-build-service/1/module-builds/31', + rv = self.client.patch('/module-build-service/1/module-builds/30', data=json.dumps({'state': 'some_state'})) data = json.loads(rv.data) From ca754903ac659d8d32ad3422accb46cc7ff44a18 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Wed, 11 Jan 2017 09:54:45 +0100 Subject: [PATCH 3/5] Fail in resolve_profiles in case dependency cannot be found in PDC --- module_build_service/pdc.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/module_build_service/pdc.py b/module_build_service/pdc.py index 6b4f0d5d..4d7142b9 100644 --- a/module_build_service/pdc.py +++ b/module_build_service/pdc.py @@ -226,21 +226,13 @@ def resolve_profiles(session, mmd, keys, seen=None): continue # Find the latest of the dep in our db of built modules. - module_info = {} - module_info['variant_id'] = name - module_info['variant_stream'] = stream - dep_mmd = get_module_modulemd(session, module_info, False) - # XXX - We may want to make this fatal one day, but warn for now. - if not dep_mmd: - log.warn("Could not find built dep " - "%s/%s for %r" % (name, stream, mmd.name)) - continue + module_info = {'variant_id': name, 'variant_stream': stream} + dep_mmd = get_module_modulemd(session, module_info, True) # Take note of what rpms are in this dep's profile. - profiles = dep_mmd.profiles for key in keys: - if key in profiles: - results[key] |= profiles[key].rpms + if key in dep_mmd.profiles: + results[key] |= dep_mmd.profiles[key].rpms # And recurse to all modules that are deps of our dep. rec_results = resolve_profiles(session, dep_mmd, keys, seen + [name]) From 4acc1d69aaf6d25b0e20a9a0416107450b8c881c Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Thu, 12 Jan 2017 11:52:49 +0100 Subject: [PATCH 4/5] Use vcrpy for tests to simulate PDC responses. --- requirements.txt | 1 + tests/__init__.py | 24 - tests/test_build/test_build.py | 9 + tests/test_scheduler/test_module_wait.py | 5 +- tests/test_scheduler/test_repo_done.py | 11 + ...ild.test_build.TestBuild.test_submit_build | 506 ++++++++++++++++++ ...t_build.TestBuild.test_submit_build_cancel | 226 ++++++++ ...ild.test_submit_build_concurrent_threshold | 506 ++++++++++++++++++ ...stBuild.test_submit_build_instant_complete | 282 ++++++++++ ...repo_done.TestRepoDone.test_a_single_match | 58 ++ ...estRepoDone.test_a_single_match_build_fail | 58 ++ 11 files changed, 1661 insertions(+), 25 deletions(-) create mode 100644 tests/vcr-request-data/tests.test_build.test_build.TestBuild.test_submit_build create mode 100644 tests/vcr-request-data/tests.test_build.test_build.TestBuild.test_submit_build_cancel create mode 100644 tests/vcr-request-data/tests.test_build.test_build.TestBuild.test_submit_build_concurrent_threshold create mode 100644 tests/vcr-request-data/tests.test_build.test_build.TestBuild.test_submit_build_instant_complete create mode 100644 tests/vcr-request-data/tests.test_scheduler.test_repo_done.TestRepoDone.test_a_single_match create mode 100644 tests/vcr-request-data/tests.test_scheduler.test_repo_done.TestRepoDone.test_a_single_match_build_fail diff --git a/requirements.txt b/requirements.txt index 0c5c09d1..65d23a8e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,3 +19,4 @@ python-fedora six sqlalchemy systemd-python +vcrpy diff --git a/tests/__init__.py b/tests/__init__.py index 74481b30..603dcb41 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -32,30 +32,6 @@ import module_build_service.pdc app = module_build_service.app conf = init_config(app) -def local_resolve_profiles(pdc_session, mmd, keys): - """ - Returns the default srpm-buildroot and "buildroot" groups as they - would have been return from PDC. - - We are not using real PDC for resolve_profiles in tests, - because it makes tests slower and depending on the remote dev - PDC instance which is not ideal. - """ - default_groups = { - 'srpm-buildroot': - set(['shadow-utils', 'fedora-release', 'redhat-rpm-config', - 'rpm-build', 'fedpkg-minimal', 'gnupg2', 'bash']), - 'buildroot': - set(['unzip', 'fedora-release', 'tar', 'cpio', 'gawk', - 'gcc', 'xz', 'sed', 'findutils', 'util-linux', 'bash', - 'info', 'bzip2', 'grep', 'redhat-rpm-config', - 'diffutils', 'make', 'patch', 'shadow-utils', - 'coreutils', 'which', 'rpm-build', 'gzip', 'gcc-c++'])} - - return default_groups - -module_build_service.pdc.resolve_profiles = local_resolve_profiles - def init_data(): db.session.remove() db.drop_all() diff --git a/tests/test_build/test_build.py b/tests/test_build/test_build.py index ce3488f9..837bc543 100644 --- a/tests/test_build/test_build.py +++ b/tests/test_build/test_build.py @@ -22,7 +22,9 @@ import unittest import koji +import vcr from os import path, mkdir +from os.path import dirname from shutil import copyfile from nose.tools import timed @@ -40,6 +42,8 @@ import json from module_build_service.builder import KojiModuleBuilder, GenericBuilder import module_build_service.scheduler.consumer +base_dir = dirname(dirname(__file__)) +cassette_dir = base_dir + '/vcr-request-data/' class MockedSCM(object): def __init__(self, mocked_scm, name, mmd_filename): @@ -203,6 +207,10 @@ class TestBuild(unittest.TestCase): models.ModuleBuild.query.delete() models.ComponentBuild.query.delete() + filename = cassette_dir + self.id() + self.vcr = vcr.use_cassette(filename) + self.vcr.__enter__() + def tearDown(self): conf.set_item("system", self._prev_system) conf.set_item("num_consecutive_builds", self._prev_num_consencutive_builds) @@ -214,6 +222,7 @@ class TestBuild(unittest.TestCase): del sys.modules['moksha.hub.reactor'] del sys.modules['moksha.hub'] import moksha.hub.reactor + self.vcr.__exit__() @timed(30) @patch('module_build_service.auth.get_username', return_value='Homer J. Simpson') diff --git a/tests/test_scheduler/test_module_wait.py b/tests/test_scheduler/test_module_wait.py index c07b1f2f..7b506a52 100644 --- a/tests/test_scheduler/test_module_wait.py +++ b/tests/test_scheduler/test_module_wait.py @@ -24,7 +24,7 @@ import unittest import mock import module_build_service.messaging import module_build_service.scheduler.handlers.modules - +import modulemd as _modulemd class TestModuleWait(unittest.TestCase): @@ -50,6 +50,9 @@ class TestModuleWait(unittest.TestCase): 'state': 'some state', } + mmd = _modulemd.ModuleMetadata() + mocked_module_build.mmd.return_value = mmd + from_module_event.return_value = mocked_module_build msg = module_build_service.messaging.RidaModule(msg_id=None, module_build_id=1, diff --git a/tests/test_scheduler/test_repo_done.py b/tests/test_scheduler/test_repo_done.py index 096ef6cf..54401585 100644 --- a/tests/test_scheduler/test_repo_done.py +++ b/tests/test_scheduler/test_repo_done.py @@ -20,8 +20,10 @@ # # Written by Ralph Bean +from os.path import dirname import unittest import mock +import vcr import module_build_service.messaging import module_build_service.scheduler.handlers.repos @@ -29,12 +31,21 @@ import module_build_service.models from tests import scheduler_init_data from tests import conf, db +base_dir = dirname(dirname(__file__)) +cassette_dir = base_dir + '/vcr-request-data/' class TestRepoDone(unittest.TestCase): def setUp(self): scheduler_init_data() + filename = cassette_dir + self.id() + self.vcr = vcr.use_cassette(filename) + self.vcr.__enter__() + + def tearDown(self): + self.vcr.__exit__() + @mock.patch('module_build_service.models.ModuleBuild.from_repo_done_event') def test_no_match(self, from_repo_done_event): """ Test that when a repo msg hits us and we have no match, diff --git a/tests/vcr-request-data/tests.test_build.test_build.TestBuild.test_submit_build b/tests/vcr-request-data/tests.test_build.test_build.TestBuild.test_submit_build new file mode 100644 index 00000000..71cc6246 --- /dev/null +++ b/tests/vcr-request-data/tests.test_build.test_build.TestBuild.test_submit_build @@ -0,0 +1,506 @@ +interactions: +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:29 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:30 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=tyEGNtsUoim3k8pfQqftTuF5JrdCLnGD; expires=Thu, 11-Jan-2018 + 10:37:30 GMT; Max-Age=31449600; Path=/', 'sessionid=bhtu6e5m5cvhb9yxlu2ipywh8c90q4ho; + expires=Thu, 26-Jan-2017 10:37:30 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:31 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:32 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=XTBH53Zf7fxz7rcPAPHAtOlXOyZIgB1F; expires=Thu, 11-Jan-2018 + 10:37:32 GMT; Max-Age=31449600; Path=/', 'sessionid=tol31kaee33hqw5ys19o8qb7k1dfcw4t; + expires=Thu, 26-Jan-2017 10:37:32 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:33 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:34 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=QhBAe06GhIMjY5bSwvrdU5YawNSw1zOt; expires=Thu, 11-Jan-2018 + 10:37:34 GMT; Max-Age=31449600; Path=/', 'sessionid=4m1x25j3ptqj2nucz9q66wrftr8mizfy; + expires=Thu, 26-Jan-2017 10:37:34 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:34 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:35 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=zWTox7nd4KxXJ9lMbsd5X4EvqPzKBwKa; expires=Thu, 11-Jan-2018 + 10:37:35 GMT; Max-Age=31449600; Path=/', 'sessionid=lx9e5mpeg4pjpfv8v4j9jdgbveurtkvq; + expires=Thu, 26-Jan-2017 10:37:35 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:36 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:37 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=Pj759tMTCvN5Gh1aq34njcw3fs2A6BJu; expires=Thu, 11-Jan-2018 + 10:37:37 GMT; Max-Age=31449600; Path=/', 'sessionid=qxwjzhrhzlyn95wg0j9u0n4kfs438mhf; + expires=Thu, 26-Jan-2017 10:37:37 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:37 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:38 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=pGNb5qnVy5D11zoHJYtv1kgMIL4N6QuP; expires=Thu, 11-Jan-2018 + 10:37:38 GMT; Max-Age=31449600; Path=/', 'sessionid=4fzywpb68h51wnw0j6aeabw54alvw2hp; + expires=Thu, 26-Jan-2017 10:37:38 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:39 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:40 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=6gKKa8HlU5Wsv36r1qVPn2XKf9Hwy84h; expires=Thu, 11-Jan-2018 + 10:37:40 GMT; Max-Age=31449600; Path=/', 'sessionid=ousofqe4ig07usjb8ig0tvd0yknytzaq; + expires=Thu, 26-Jan-2017 10:37:40 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:40 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:41 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=UtOkuhqOp9rZJnP8Pfe3z262TRzao70h; expires=Thu, 11-Jan-2018 + 10:37:41 GMT; Max-Age=31449600; Path=/', 'sessionid=mhbyvogoknaga1yxn8sbhr7gvlbq5dv3; + expires=Thu, 26-Jan-2017 10:37:41 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:42 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:42 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=DimuoEvPVtKJENQgqBI4wNyajI4JAJJZ; expires=Thu, 11-Jan-2018 + 10:37:42 GMT; Max-Age=31449600; Path=/', 'sessionid=fbn8nda1n715v3rivev6f86qc65ybsfq; + expires=Thu, 26-Jan-2017 10:37:42 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +version: 1 diff --git a/tests/vcr-request-data/tests.test_build.test_build.TestBuild.test_submit_build_cancel b/tests/vcr-request-data/tests.test_build.test_build.TestBuild.test_submit_build_cancel new file mode 100644 index 00000000..af22a659 --- /dev/null +++ b/tests/vcr-request-data/tests.test_build.test_build.TestBuild.test_submit_build_cancel @@ -0,0 +1,226 @@ +interactions: +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:44 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:45 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=6Qxyo8NXtITCc2YiJf5M2MAXfhBxpaBi; expires=Thu, 11-Jan-2018 + 10:37:45 GMT; Max-Age=31449600; Path=/', 'sessionid=oogbdb99pbsf9yryffdrbnmpuygki5l4; + expires=Thu, 26-Jan-2017 10:37:45 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:45 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:46 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=gagPouNG6feK2Jd86ZCv55PDouwOwY5p; expires=Thu, 11-Jan-2018 + 10:37:46 GMT; Max-Age=31449600; Path=/', 'sessionid=n2usoosxj2c073cotvp3plhjihwc42yl; + expires=Thu, 26-Jan-2017 10:37:46 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:47 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:47 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=I00ULEIWIBBFzCeyHRVts4Dk4gDaYsFq; expires=Thu, 11-Jan-2018 + 10:37:47 GMT; Max-Age=31449600; Path=/', 'sessionid=gsna9poqaofx5islnvwg6wigtulcxgfd; + expires=Thu, 26-Jan-2017 10:37:47 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:48 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:49 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=gHsPmCL7PZ2C4yxVTLmjEOLm5t8bcDGB; expires=Thu, 11-Jan-2018 + 10:37:49 GMT; Max-Age=31449600; Path=/', 'sessionid=yafpxepzcgje930oadei830lx2ct0bva; + expires=Thu, 26-Jan-2017 10:37:49 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +version: 1 diff --git a/tests/vcr-request-data/tests.test_build.test_build.TestBuild.test_submit_build_concurrent_threshold b/tests/vcr-request-data/tests.test_build.test_build.TestBuild.test_submit_build_concurrent_threshold new file mode 100644 index 00000000..70e4b06e --- /dev/null +++ b/tests/vcr-request-data/tests.test_build.test_build.TestBuild.test_submit_build_concurrent_threshold @@ -0,0 +1,506 @@ +interactions: +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:51 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:51 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=dyYqw5OK59DaGvsuSLOckKjFNCZmet2K; expires=Thu, 11-Jan-2018 + 10:37:51 GMT; Max-Age=31449600; Path=/', 'sessionid=gff9blh1dhpeeug6jpakfzkl6z0gxo8g; + expires=Thu, 26-Jan-2017 10:37:51 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:52 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:53 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=waR84663mQUfnNzMhRzat9EWKbnEGESa; expires=Thu, 11-Jan-2018 + 10:37:53 GMT; Max-Age=31449600; Path=/', 'sessionid=qmtf4n7gz50dtlgijfi8eus6zxoxze6t; + expires=Thu, 26-Jan-2017 10:37:53 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:53 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:54 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=NQN5sMarQpFmjxkdxOFHIB79ZRUASPnO; expires=Thu, 11-Jan-2018 + 10:37:54 GMT; Max-Age=31449600; Path=/', 'sessionid=qw7xkyp5zdfzck8gjeejz8nf2dab40m0; + expires=Thu, 26-Jan-2017 10:37:54 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:54 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:55 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=Pwny8ExsUvWXxQuBAfDv2L0B8smNKbA5; expires=Thu, 11-Jan-2018 + 10:37:55 GMT; Max-Age=31449600; Path=/', 'sessionid=htw4f3fxckraiixou0kr3n5sod7dvtmi; + expires=Thu, 26-Jan-2017 10:37:55 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:55 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:56 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=f41CtE0qG1G1cER1z3qA5gDwB5NGGd3I; expires=Thu, 11-Jan-2018 + 10:37:56 GMT; Max-Age=31449600; Path=/', 'sessionid=ng5yn5cza9dcnjrd26etuyvvgt2ebjsu; + expires=Thu, 26-Jan-2017 10:37:56 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:57 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:58 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=FrtMghs7QeLpImrMhGvpwuzZYY4V3jhK; expires=Thu, 11-Jan-2018 + 10:37:58 GMT; Max-Age=31449600; Path=/', 'sessionid=0e0kzmfi310l5cdsyawa6evr12vnjuze; + expires=Thu, 26-Jan-2017 10:37:58 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:37:59 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:37:59 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=b3EYsuvc5qaQCvM7HdEKs7fR2ZPGwN6v; expires=Thu, 11-Jan-2018 + 10:37:59 GMT; Max-Age=31449600; Path=/', 'sessionid=gkovv54svqtaqprgtih61xnf1v3wenyh; + expires=Thu, 26-Jan-2017 10:37:59 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:38:01 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:38:01 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=1i5QzIxstIe4A1vtJdN7Mo3onnBpmbxj; expires=Thu, 11-Jan-2018 + 10:38:01 GMT; Max-Age=31449600; Path=/', 'sessionid=m7gmfzygqzx69fuxl3kwznue536ijdf0; + expires=Thu, 26-Jan-2017 10:38:01 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:38:02 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:38:03 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=WtjAs6G0PqsQAtpzzkQO11KNAYjhcy8l; expires=Thu, 11-Jan-2018 + 10:38:03 GMT; Max-Age=31449600; Path=/', 'sessionid=0fuv0uvmdyadi5ia5ob2xsfe0yx7ntjc; + expires=Thu, 26-Jan-2017 10:38:03 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +version: 1 diff --git a/tests/vcr-request-data/tests.test_build.test_build.TestBuild.test_submit_build_instant_complete b/tests/vcr-request-data/tests.test_build.test_build.TestBuild.test_submit_build_instant_complete new file mode 100644 index 00000000..2ba085ca --- /dev/null +++ b/tests/vcr-request-data/tests.test_build.test_build.TestBuild.test_submit_build_instant_complete @@ -0,0 +1,282 @@ +interactions: +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:38:05 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:38:06 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=bpnemVSKtIj5qBNO3afW8iRgI3GCHXts; expires=Thu, 11-Jan-2018 + 10:38:06 GMT; Max-Age=31449600; Path=/', 'sessionid=s9zhmby4e1sw9jvvefl8nnxk6ogvj0ff; + expires=Thu, 26-Jan-2017 10:38:06 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:38:07 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:38:08 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=5360uB74rel8yBAEgQTPpeNsEY9XGSR0; expires=Thu, 11-Jan-2018 + 10:38:08 GMT; Max-Age=31449600; Path=/', 'sessionid=k1z9fze4f665afdqvysr5xwoggn371w0; + expires=Thu, 26-Jan-2017 10:38:08 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:38:09 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:38:09 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=RVz7eNfx3tyoYfBL1vl1vyWj5uxucqap; expires=Thu, 11-Jan-2018 + 10:38:09 GMT; Max-Age=31449600; Path=/', 'sessionid=hw10cbhbsamt07yjbi89xgg8ecbpvelb; + expires=Thu, 26-Jan-2017 10:38:09 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:38:10 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:38:11 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=kHJgn8H8z0WZu5BNBvTNLIMetvdxieQP; expires=Thu, 11-Jan-2018 + 10:38:11 GMT; Max-Age=31449600; Path=/', 'sessionid=fdanci9im30w6l5syddjqqgd9t8ra10x; + expires=Thu, 26-Jan-2017 10:38:11 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:38:11 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:38:12 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=pDDTFDDiWa9xvKvKBeDF9vNZBbCe6TbP; expires=Thu, 11-Jan-2018 + 10:38:12 GMT; Max-Age=31449600; Path=/', 'sessionid=1e1oo5wxsu1hvlb1is6sf9uziagacwlo; + expires=Thu, 26-Jan-2017 10:38:12 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +version: 1 diff --git a/tests/vcr-request-data/tests.test_scheduler.test_repo_done.TestRepoDone.test_a_single_match b/tests/vcr-request-data/tests.test_scheduler.test_repo_done.TestRepoDone.test_a_single_match new file mode 100644 index 00000000..fa1c25c6 --- /dev/null +++ b/tests/vcr-request-data/tests.test_scheduler.test_repo_done.TestRepoDone.test_a_single_match @@ -0,0 +1,58 @@ +interactions: +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:42:02 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:42:03 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=F8Q1L8iQTVRIwZt9grZ3P3hvqomRUaK2; expires=Thu, 11-Jan-2018 + 10:42:03 GMT; Max-Age=31449600; Path=/', 'sessionid=9tni9905j6c5ihm5o38onicnpks1glji; + expires=Thu, 26-Jan-2017 10:42:03 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +version: 1 diff --git a/tests/vcr-request-data/tests.test_scheduler.test_repo_done.TestRepoDone.test_a_single_match_build_fail b/tests/vcr-request-data/tests.test_scheduler.test_repo_done.TestRepoDone.test_a_single_match_build_fail new file mode 100644 index 00000000..ce71b0f5 --- /dev/null +++ b/tests/vcr-request-data/tests.test_scheduler.test_repo_done.TestRepoDone.test_a_single_match_build_fail @@ -0,0 +1,58 @@ +interactions: +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode ''} + headers: + content-type: [text/html; charset=utf-8] + date: ['Thu, 12 Jan 2017 10:42:04 GMT'] + location: ['http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime'] + server: [WSGIServer/0.1 Python/2.7.12] + x-frame-options: [SAMEORIGIN] + status: {code: 301, message: MOVED PERMANENTLY} +- request: + body: null + headers: + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.10.0] + accept: [application/json] + content-type: [application/json] + method: GET + uri: http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=base-runtime + response: + body: {string: !!python/unicode '[{"variant_id":"base-runtime","variant_uid":"base-runtime-master-3","variant_name":"base-runtime","variant_type":"module","variant_version":"master","variant_release":"3","koji_tag":"module-base-runtime-master-3","modulemd":"document: + modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: + 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: + ...\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - + bash\r\n - bzip2\r\n - coreutils\r\n - + cpio\r\n - diffutils\r\n - fedora-release\r\n - + findutils\r\n - gawk\r\n - gcc\r\n - + gcc-c++\r\n - grep\r\n - gzip\r\n - + info\r\n - make\r\n - patch\r\n - + redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - + shadow-utils\r\n - tar\r\n - unzip\r\n - + util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - + bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - + gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - + shadow-utils","runtime_deps":[],"build_deps":[]}]'} + headers: + allow: ['GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS'] + content-type: [application/json] + date: ['Thu, 12 Jan 2017 10:42:05 GMT'] + server: [WSGIServer/0.1 Python/2.7.12] + set-cookie: ['csrftoken=RHZQGCRNy5WVlgOS8DJQquFgzUz2fMCz; expires=Thu, 11-Jan-2018 + 10:42:05 GMT; Max-Age=31449600; Path=/', 'sessionid=6lb37nfrlhvxdt3i9h9lzuu8b7zyxstd; + expires=Thu, 26-Jan-2017 10:42:05 GMT; httponly; Max-Age=1209600; Path=/'] + vary: ['Accept, Cookie'] + x-frame-options: [SAMEORIGIN] + status: {code: 200, message: OK} +version: 1 From d7b2b3ad52abed8f07a66601a7eac2a6ebfc22f6 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Thu, 12 Jan 2017 13:43:40 +0100 Subject: [PATCH 5/5] Adjust the module ID in build_module_locally, because the fake base-runtime is not in DB anymore. --- module_build_service/manage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module_build_service/manage.py b/module_build_service/manage.py index 06fb7f3e..7311679c 100644 --- a/module_build_service/manage.py +++ b/module_build_service/manage.py @@ -175,7 +175,7 @@ def build_module_locally(url): submit_module_build(username, url, allow_local_url=True) stop = module_build_service.scheduler.make_simple_stop_condition(db.session) - initial_messages = [RidaModule("local module build", 2, 1)] + initial_messages = [RidaModule("local module build", 1, 1)] # Run the consumer until stop_condition returns True module_build_service.scheduler.main(initial_messages, stop)