def blocks(self): try: bug = self.data if bug is None: return False result = False if bug.is_deferred: result = True if bug.is_opened: result = True if bug.upstream_bug: if (not version.appliance_is_downstream() and self.can_test_on_current_upstream_appliance): result = False if not result and version.appliance_is_downstream(): if bug.fixed_in is not None: return version.current_version() < bug.fixed_in return result except RPCFault as e: code = e.faultCode s = e.faultString.strip().split("\n")[0] logger.error("Bugzilla thrown a fault: %s/%s", code, s) logger.warning("Ignoring and taking the bug as non-blocking") store.terminalreporter.write( f"Bugzila made a booboo: {code}/{s}\n", bold=True) return False
def is_opened(self): states = self._bugzilla.open_states if appliance_is_downstream(): # for downstream appliances, "POST" and "MODIFIED" are considered open states states.add('POST') states.add('MODIFIED') return self.status in states
def resolve_blockers(item, blockers): if not isinstance(blockers, (list, tuple, set)): raise ValueError("Type of the 'blockers' parameter must be one of: list, tuple, set") # Prepare the global env for the kwarg insertion global_env = dict( appliance_version=version.current_version(), appliance_downstream=version.appliance_is_downstream(), item=item, blockers=blockers, ) # We will now extend the env with fixtures, so they can be used in the guard functions # We will however add only those that are not in the global_env otherwise we could overwrite # our own stuff. params = extract_fixtures_values(item) for funcarg, value in params.iteritems(): if funcarg not in global_env: global_env[funcarg] = value # Check blockers use_blockers = [] # Bugzilla shortcut blockers = map(lambda b: "BZ#{}".format(b) if isinstance(b, int) else b, blockers) for blocker in map(Blocker.parse, blockers): if blocker.blocks: use_blockers.append(blocker) # Unblocking discard_blockers = set([]) for blocker in use_blockers: unblock_func = kwargify(blocker.kwargs.get("unblock")) local_env = {"blocker": blocker} local_env.update(global_env) if unblock_func(**local_env): discard_blockers.add(blocker) for blocker in discard_blockers: use_blockers.remove(blocker) # We now have those that block testing, so we have to skip # Let's go in the order that they were added # Custom actions first for blocker in use_blockers: if "custom_action" in blocker.kwargs: action = kwargify(blocker.kwargs["custom_action"]) local_env = {"blocker": blocker} local_env.update(global_env) action(**local_env) # And then skip if use_blockers: bugs = [bug.bug_id for bug in use_blockers if hasattr(bug, "bug_id")] skip_data = {'type': 'blocker', 'reason': bugs} fire_art_test_hook(item, 'skip_test', skip_data=skip_data) pytest.skip("Skipping due to these blockers:\n{}".format( "\n".join( "- {}".format(str(blocker)) for blocker in use_blockers ) ))
def resolve_blockers(item, blockers): if not isinstance(blockers, (list, tuple, set)): raise ValueError( "Type of the 'blockers' parameter must be one of: list, tuple, set" ) # Prepare the global env for the kwarg insertion global_env = dict( appliance_version=version.current_version(), appliance_downstream=version.appliance_is_downstream(), item=item, blockers=blockers, ) # We will now extend the env with fixtures, so they can be used in the guard functions # We will however add only those that are not in the global_env otherwise we could overwrite # our own stuff. params = extract_fixtures_values(item) for funcarg, value in params.iteritems(): if funcarg not in global_env: global_env[funcarg] = value # Check blockers use_blockers = [] # Bugzilla shortcut blockers = map(lambda b: "BZ#{}".format(b) if isinstance(b, int) else b, blockers) for blocker in map(Blocker.parse, blockers): if blocker.blocks: use_blockers.append(blocker) # Unblocking discard_blockers = set([]) for blocker in use_blockers: unblock_func = kwargify(blocker.kwargs.get("unblock")) local_env = {"blocker": blocker} local_env.update(global_env) if unblock_func(**local_env): discard_blockers.add(blocker) for blocker in discard_blockers: use_blockers.remove(blocker) # We now have those that block testing, so we have to skip # Let's go in the order that they were added # Custom actions first for blocker in use_blockers: if "custom_action" in blocker.kwargs: action = kwargify(blocker.kwargs["custom_action"]) local_env = {"blocker": blocker} local_env.update(global_env) action(**local_env) # And then skip if use_blockers: bugs = [bug.bug_id for bug in use_blockers if hasattr(bug, "bug_id")] skip_data = {'type': 'blocker', 'reason': bugs} fire_art_test_hook(item, 'skip_test', skip_data=skip_data) pytest.skip("Skipping due to these blockers:\n{}".format("\n".join( "- {}".format(str(blocker)) for blocker in use_blockers)))
def blocks(self): try: bug = self.data if bug is None: return False result = False if bug.is_opened: result = True if bug.upstream_bug: if not version.appliance_is_downstream() and bug.can_test_on_upstream: result = False if not result and version.appliance_is_downstream(): if bug.fixed_in is not None: return version.current_version() < bug.fixed_in return result except six.moves.xmlrpc_client.Fault as e: code = e.faultCode s = e.faultString.strip().split("\n")[0] logger.error("Bugzilla thrown a fault: %s/%s", code, s) logger.warning("Ignoring and taking the bug as non-blocking") store.terminalreporter.write( "Bugzila made a booboo: {}/{}\n".format(code, s), bold=True) return False
def blocks(self): if self.upstream_only and version.appliance_is_downstream(): return False if self.data.state == "closed": return False # Now let's check versions if self.since is None and self.until is None: # No version specifics return True elif self.since is not None and self.until is not None: # since inclusive, until exclusive return self.since <= version.current_version() < self.until elif self.since is not None: # Only since return version.current_version() >= self.since elif self.until is not None: # Only until return version.current_version() < self.until
service_name, vm_name = myservice with appliance.context.use(context): myservice = MyService(appliance, name=service_name, vm_name=vm_name) myservice.set_ownership("Administrator", "EvmGroup-administrator") myservice.add_tag() with update(myservice): myservice.description = "my edited description" myservice.delete() @pytest.mark.parametrize('context', [ViaUI]) @pytest.mark.parametrize("filetype", ["Text", "CSV", "PDF"]) # PDF not present on upstream @pytest.mark.uncollectif( lambda filetype: filetype == 'PDF' and not appliance_is_downstream()) def test_download_file(appliance, context, needs_firefox, myservice, filetype): """Tests my service download files Metadata: test_flag: provision Polarion: assignee: nansari casecomponent: Services initialEstimate: 1/16h tags: service """ service_name, vm_name = myservice with appliance.context.use(context): myservice = MyService(appliance, name=service_name, vm_name=vm_name)
vm_name = catalog_item.provisioning_data["vm_name"] catalog_item.create() service_catalogs = ServiceCatalogs(appliance, catalog_item.name) service_catalogs.order() logger.info('Waiting for cfme provision request for service %s', catalog_item.name) request_description = catalog_item.name request_row = appliance.collections.requests.instantiate( request_description, partial_check=True) request_row.wait_for_request() assert request_row.is_succeeded() return vm_name @pytest.mark.usefixtures("setup_provider") @pytest.mark.uncollectif(lambda: version.appliance_is_downstream()) @pytest.mark.long_running def test_vm_clone(appliance, provider, clone_vm_name, request, create_vm): vm_name = create_vm + "_0001" request.addfinalizer(lambda: cleanup_vm(vm_name, provider)) request.addfinalizer(lambda: cleanup_vm(clone_vm_name, provider)) vm = VM.factory(vm_name, provider) if provider.one_of(RHEVMProvider): provision_type = 'Native Clone' elif provider.one_of(VMwareProvider): provision_type = 'VMware' vm.clone_vm("*****@*****.**", "first", "last", clone_vm_name, provision_type) request_description = clone_vm_name request_row = appliance.collections.requests.instantiate( request_description, partial_check=True)
""" service_name, vm_name = myservice with appliance.context.use(context): myservice = MyService(appliance, name=service_name, vm_name=vm_name) myservice.set_ownership("Administrator", "EvmGroup-administrator") myservice.add_tag() with update(myservice): myservice.description = "my edited description" myservice.delete() @pytest.mark.parametrize('context', [ViaUI]) @pytest.mark.parametrize("filetype", ["Text", "CSV", "PDF"]) # PDF not present on upstream @pytest.mark.uncollectif(lambda filetype: filetype == 'PDF' and not appliance_is_downstream()) def test_download_file(appliance, context, needs_firefox, myservice, filetype): """Tests my service download files Metadata: test_flag: provision Polarion: assignee: nansari initialEstimate: 1/16h """ service_name, vm_name = myservice with appliance.context.use(context): myservice = MyService(appliance, name=service_name, vm_name=vm_name) myservice.download_file(filetype)
def is_opened(self): states = self._bugzilla.open_states if not self.upstream_bug and appliance_is_downstream(): states.add('POST') states.add('MODIFIED') return self.status in states
""" service_name, vm_name = myservice with appliance.context.use(context): myservice = MyService(appliance, name=service_name, vm_name=vm_name) myservice.set_ownership("Administrator", "EvmGroup-administrator") myservice.add_tag() with update(myservice): myservice.description = "my edited description" myservice.delete() @pytest.mark.parametrize('context', [ViaUI]) @pytest.mark.parametrize("filetype", ["Text", "CSV", "PDF"]) # PDF not present on upstream @pytest.mark.uncollectif(lambda filetype: filetype == 'PDF' and not appliance_is_downstream()) def test_download_file(appliance, context, needs_firefox, myservice, filetype): """Tests my service download files Metadata: test_flag: provision """ service_name, vm_name = myservice with appliance.context.use(context): myservice = MyService(appliance, name=service_name, vm_name=vm_name) myservice.download_file(filetype) @pytest.mark.parametrize('context', [ViaUI]) def test_service_link(appliance, context, myservice): """Tests service link from VM details page(BZ1443772)"""
def is_opened(self): states = self._bugzilla.open_states if not self.upstream_bug and appliance_is_downstream(): states = self._bugzilla.open_states + ["POST", "MODIFIED"] return self.status in states
def get_streams_id(): from cfme.utils.version import appliance_is_downstream, current_version if appliance_is_downstream(): return {current_version().series(2), "downstream"} else: return {"upstream"}