Пример #1
0
 def revert_restore(self):
     assert_is_not_none(self.snapshot_name,
                        "'snapshot_name' variable is not defined!")
     assert_true(
         self.env.revert_snapshot(self.snapshot_name),
         "The test can not use given environment - snapshot "
         "{!r} does not exists".format(self.snapshot_name))
Пример #2
0
 def test_create_security_group_rule(self):
     if len(self.testSecurityGroup.rules) == 0:
         self.testSecurityGroupRule = \
             dbaas.security_group_rules.create(
                 group_id=self.testSecurityGroup.id,
                 protocol="tcp",
                 from_port=3306,
                 to_port=3306,
                 cidr="0.0.0.0/0")
         assert_is_not_none(self.testSecurityGroupRule)
         with TypeCheck('SecurityGroupRule',
                        self.testSecurityGroupRule) as secGrpRule:
             secGrpRule.has_field('id', basestring)
             secGrpRule.has_field('security_group_id', basestring)
             secGrpRule.has_field('protocol', basestring)
             secGrpRule.has_field('cidr', basestring)
             secGrpRule.has_field('from_port', int)
             secGrpRule.has_field('to_port', int)
             secGrpRule.has_field('created', basestring)
         assert_equal(self.testSecurityGroupRule.security_group_id,
                      self.testSecurityGroup.id)
         assert_equal(self.testSecurityGroupRule.protocol, "tcp")
         assert_equal(int(self.testSecurityGroupRule.from_port), 3306)
         assert_equal(int(self.testSecurityGroupRule.to_port), 3306)
         assert_equal(self.testSecurityGroupRule.cidr, "0.0.0.0/0")
     else:
         assert_not_equal(len(self.testSecurityGroup.rules), 0)
Пример #3
0
 def redfish_discovery_test(self):
     """ Testing Redfish Service Discovery """
     user, passwd = get_cred('redfish')
     assert_is_not_none(user)
     assert_is_not_none(passwd)
     body = {
         'options': {
             'defaults': {
                 'username': user,
                 'password': passwd,
                 'uri': URI
             }
         }
     }
         
     if IS_EMC:
         body['options']['when-catalog-emc'] = { 'autoCatalogEmc': 'true' }
         body['options']['when-pollers-emc'] = { 'autoCreatePollerEmc': 'true' }
         
     self.__post_unbound_workflow('Graph.Redfish.Discovery', body)
     Nodes().nodes_get()
     nodes = self.__get_data()
     
     settings = []
     for node in nodes:
         if node.get('type') == 'enclosure':
             for obm in node.get('obmSettings', []):
                 if obm.get('service') == 'redfish-obm-service':
                     self.__nodes.append(node)
                     config = obm.get('config')
                     assert_equal(URI, config.get('uri'), \
                         message = "Unexpected Redfish URI")
     assert_not_equal(len(self.__nodes), 0, message='Missing Redfish Enclosures')
    def get_plugin_setting(self, plugin, parameter):
        """Return the given parameter's value for the plugin.

        :param plugin: name of the plugin.
        :type plugin: str
        :param parameter: name of the parameter.
        :type parameter: str
        :returns: parameter's value
        """
        asserts.assert_true(
            self.fuel_web.check_plugin_exists(self.cluster_id, plugin),
            "Plugin {0} isn't found.".format(plugin))

        attributes = self.nailgun_client.get_cluster_attributes(
            self.cluster_id)
        attributes = attributes['editable'][plugin]

        value = None
        for item in attributes['metadata']['versions']:
            if (parameter in item and
                item['metadata']['plugin_id'] ==
                    attributes['metadata']['chosen_id']):
                value = item[parameter]['value']
                break
        asserts.assert_is_not_none(
            value, "Could not find parameter {0} for plugin {1}".format(
                parameter, plugin))
        return value
Пример #5
0
    def prepare_patching_environment(self):
        """Prepare environment for patching (OpenStack)

        Scenario:
        1. Take existing environment created by previous deployment test
        and snapshot it
        2. Revert snapshot and check that environment is alive
        3. Check that deployed environment is affected by the bug and
        verification scenario fails without applied patches

        Duration: 10m
        """

        logger.debug('Creating snapshot of environment deployed for patching.')
        self.env.make_snapshot(snapshot_name=self.snapshot_name,
                               is_make=True)
        self.env.revert_snapshot(self.snapshot_name)
        cluster_id = self.fuel_web.get_last_created_cluster()
        assert_is_not_none(cluster_id, 'Environment for patching not found.')
        slaves = self.fuel_web.client.list_cluster_nodes(cluster_id)
        logger.info('Checking that environment is affected '
                    'by bug #{0}...'.format(settings.PATCHING_BUG_ID))
        is_environment_affected = False
        try:
            patching.verify_fix(self.env, target='environment', slaves=slaves)
        except AssertionError:
            is_environment_affected = True
        assert_true(is_environment_affected,
                    'Deployed environment for testing patches is not affected'
                    'by bug #{0} or provided verification scenario is not '
                    'correct! Fix verification passed without applying '
                    'patches!'.format(settings.PATCHING_BUG_ID))
Пример #6
0
 def _get_instance_volume(self):
     """After _create_instance is called, this will return the volume ID."""
     metadata = TroveInstanceMetaData(self.db, context.get_admin_context(),
                                      self.local_id)
     assert_is_not_none(metadata.volume)
     self.volume_id = metadata.volume_id
     return self.volume_id
Пример #7
0
 def test_get_sel_log_services_entries_entryid(self):
     """ Testing GET /Systems/{identifier}/LogServices/sel/Entries/{entryId} """
     # TODO Add more validation when a 'add_sel' task is available
     assert_is_not_none(self.__membersList)
     membersList = self.__logServicesList.get('Members')
     assert_is_not_none(membersList,
                        message='missing log services members field!')
Пример #8
0
 def handle_sdr_result(self,body,message):
     LOG.debug(body,json=True)
     assert_is_not_none(body)
     assert_is_not_none(message)
     message.ack()
     self.__task_worker.stop()
     self.__task_worker = None
Пример #9
0
 def test_create_security_group_rule(self):
     if len(self.testSecurityGroup.rules) == 0:
         self.testSecurityGroupRule = \
             dbaas.security_group_rules.create(
                 group_id=self.testSecurityGroup.id,
                 protocol="tcp",
                 from_port=3306,
                 to_port=3306,
                 cidr="0.0.0.0/0")
         assert_is_not_none(self.testSecurityGroupRule)
         with TypeCheck('SecurityGroupRule',
                        self.testSecurityGroupRule) as secGrpRule:
             secGrpRule.has_field('id', basestring)
             secGrpRule.has_field('security_group_id', basestring)
             secGrpRule.has_field('protocol', basestring)
             secGrpRule.has_field('cidr', basestring)
             secGrpRule.has_field('from_port', int)
             secGrpRule.has_field('to_port', int)
             secGrpRule.has_field('created', basestring)
         assert_equal(self.testSecurityGroupRule.security_group_id,
                      self.testSecurityGroup.id)
         assert_equal(self.testSecurityGroupRule.protocol, "tcp")
         assert_equal(int(self.testSecurityGroupRule.from_port), 3306)
         assert_equal(int(self.testSecurityGroupRule.to_port), 3306)
         assert_equal(self.testSecurityGroupRule.cidr, "0.0.0.0/0")
     else:
         assert_not_equal(len(self.testSecurityGroup.rules), 0)
Пример #10
0
    def test_scheduledtask_create(self):
        now = datetime.now()
        params = {
            "name": "Test Task",
            "instance_id": self.instance.id,
            "description": "Testing",
            "type": self.test_task_type,
            "enabled": True,
            "frequency": "daily",
            "window_start": now,
            "window_end": now + timedelta(hours=1),
            "metadata": {
                "meta": "data",
                "i_am": "so meta!",
            },
        }
        self.test_task = self.client.scheduledtasks.create(**params)
        for key in params:
            assert_equal(getattr(self.test_task, key), params[key])

        assert_is_not_none(self.test_task.id)

        params['frequency'] = 'dodecahourly'
        assert_raises(exceptions.NotFound, self.client.scheduledtasks.create,
                      **params)

        params['type'] = 'nonexistent'
        assert_raises(exceptions.NotFound, self.client.scheduledtasks.create,
                      **params)
Пример #11
0
    def assert_users_list(self, instance_id, expected_user_defs, expected_http_code, limit=2):
        full_list = self.rd_client.users.list(instance_id)
        self.assert_client_code(expected_http_code)
        listed_users = {user.name: user for user in full_list}
        asserts.assert_is_none(full_list.next, "Unexpected pagination in the list.")

        for user_def in expected_user_defs:
            user_name = user_def["name"]
            asserts.assert_true(
                user_name in listed_users, "User not included in the 'user-list' output: %s" % user_name
            )
            self._assert_user_matches(listed_users[user_name], user_def)

        # Check that the system (ignored) users are not included in the output.
        system_users = self.get_system_users()
        asserts.assert_false(
            any(name in listed_users for name in system_users),
            "System users should not be included in the 'user-list' output.",
        )

        # Test list pagination.
        list_page = self.rd_client.users.list(instance_id, limit=limit)
        self.assert_client_code(expected_http_code)

        asserts.assert_true(len(list_page) <= limit)
        asserts.assert_is_not_none(list_page.next, "List page is missing.")
        marker = list_page.next

        self.assert_pagination_match(list_page, full_list, 0, limit)
        self.assert_pagination_match(list_page[-1:], full_list, limit - 1, limit)

        list_page = self.rd_client.users.list(instance_id, marker=marker)
        self.assert_client_code(expected_http_code)
        self.assert_pagination_match(list_page, full_list, limit, len(full_list))
Пример #12
0
        def assert_download(sid):
            filename, audio = self.mm.download_song(sid)

            # TODO could use original filename to verify this
            # but, when manually checking, got modified title occasionally
            assert_true(filename.endswith('.mp3'))
            assert_is_not_none(audio)
 def _get_instance_volume(self):
     """After _create_instance is called, this will return the volume ID."""
     metadata = ReddwarfInstanceMetaData(self.db,
         context.get_admin_context(), self.local_id)
     assert_is_not_none(metadata.volume)
     self.volume_id = metadata.volume_id
     return self.volume_id
Пример #14
0
 def test_list_security_group(self):
     securityGroupList = dbaas.security_groups.list()
     assert_is_not_none(securityGroupList)
     securityGroup = [
         x for x in securityGroupList if x.name in self.secGroupName
     ]
     assert_is_not_none(securityGroup)
    def deploy_toolchain_with_detached_database(self):
        """Deploy a cluster with the LMA Toolchain plugins and the
        detach-database plugin.

        Scenario:
            1. Upload the plugins to the master node
            2. Install the plugins
            3. Create the cluster
            4. Add 1 node with the controller role
            5. Add 1 node with the database role
            6. Add 1 node with the compute and cinder roles
            7. Add 1 node with the plugin roles
            8. Deploy the cluster
            9. Check that LMA Toolchain plugins are running
            10. Run OSTF

        Duration 60m
        Snapshot deploy_toolchain_with_detached_database
        """
        self.check_run("deploy_toolchain_with_detached_database")

        asserts.assert_is_not_none(
            DETACH_DATABASE_PLUGIN_PATH,
            "DETACH_DATABASE_PLUGIN_PATH variable should be set"
        )

        self._deploy_toolchain_with_detached_plugin(
            "deploy_toolchain_with_detached_database",
            DETACH_DATABASE_PLUGIN_PATH,
            "standalone-database"
        )
        def assert_playlist_exists(plid):
            playlists = self.wc.get_all_playlist_ids(auto=False, user=True)

            found = playlists["user"].get(TEST_PLAYLIST_NAME, None)

            assert_is_not_none(found)
            assert_equal(found[-1], self.playlist_id)
 def revert_restore(self):
     assert_is_not_none(self.snapshot_name,
                        "'snapshot_name' variable is not defined!")
     assert_true(
         self.env.revert_snapshot(self.snapshot_name),
         "The test can not use given environment - snapshot "
         "{!r} does not exists".format(self.snapshot_name))
Пример #18
0
def get_package_test_info(package, pkg_type, tests_path, patch_target):
    packages_path = "{0}/{1}/packages.yaml".format(tests_path, pkg_type)
    tests = set()
    tests_file = "test.yaml"
    all_packages = yaml.load(open(packages_path).read())
    assert_is_not_none(
        _get_target_and_project(package, all_packages),
        "Package '{0}' doesn't belong to any installation " "target / project".format(package),
    )
    target, project = _get_target_and_project(package, all_packages)
    if patch_target == "master":
        if target not in ["master", "bootstrap"]:
            return {None}
    if patch_target == "environment":
        if target not in ["deployment", "provisioning"]:
            return {None}
    target_tests_path = "/".join((tests_path, pkg_type, target, tests_file))
    project_tests_path = "/".join((tests_path, pkg_type, target, project, tests_file))
    package_tests_path = "/".join((tests_path, pkg_type, target, project, package, tests_file))
    for path in (target_tests_path, project_tests_path, package_tests_path):
        try:
            test = yaml.load(open(path).read())
            if "system_tests" in test.keys():
                tests.update(test["system_tests"]["tags"])
        except IOError:
            pass
    return tests
Пример #19
0
    def prepare_patching_environment(self):
        """Prepare environment for patching (OpenStack)

        Scenario:
        1. Take existing environment created by previous deployment test
        and snapshot it
        2. Revert snapshot and check that environment is alive
        3. Check that deployed environment is affected by the bug and
        verification scenario fails without applied patches

        Duration: 10m
        """

        logger.debug('Creating snapshot of environment deployed for patching.')
        self.env.make_snapshot(snapshot_name=self.snapshot_name, is_make=True)
        self.env.revert_snapshot(self.snapshot_name)
        cluster_id = self.fuel_web.get_last_created_cluster()
        assert_is_not_none(cluster_id, 'Environment for patching not found.')
        slaves = self.fuel_web.client.list_cluster_nodes(cluster_id)
        logger.info('Checking that environment is affected '
                    'by bug #{0}...'.format(settings.PATCHING_BUG_ID))
        is_environment_affected = False
        try:
            patching.verify_fix(self.env, target='environment', slaves=slaves)
        except AssertionError:
            is_environment_affected = True
        assert_true(
            is_environment_affected,
            'Deployed environment for testing patches is not affected'
            'by bug #{0} or provided verification scenario is not '
            'correct! Fix verification passed without applying '
            'patches!'.format(settings.PATCHING_BUG_ID))
        def assert_playlist_exists(plid):
            playlists = self.wc.get_all_playlist_ids(auto=False, user=True)

            found = playlists['user'].get(TEST_PLAYLIST_NAME, None)

            assert_is_not_none(found)
            assert_equal(found[-1], self.playlist_id)
Пример #21
0
    def test_cluster_shrink(self):

        if not getattr(self, 'cluster', None):
            raise SkipTest(
                "Skipping this test since cluster is not available.")

        foo_instance = None
        for instance in self.cluster.instances:
            if instance['name'] == 'foo':
                foo_instance = instance
                break
        asserts.assert_is_not_none(foo_instance, "Could not find foo instance")

        beginning_instance_count = len(self.cluster.instances)

        valid_request_body = [{"id": foo_instance['id']}]

        self.cluster = self.rd_client.clusters.shrink(self.cluster.id,
                                                      valid_request_body)

        asserts.assert_equal(
            -1,
            len(self.cluster.instances) - beginning_instance_count)
        asserts.assert_equal(202, self.rd_client.last_http_code)

        poll_until(self._cluster_is_active,
                   sleep_time=SLEEP_TIME,
                   time_out=TIMEOUT)
        def assert_name_equal(plid, name):
            playlists = self.wc.get_all_playlist_ids()

            found = playlists['user'].get(name, None)

            assert_is_not_none(found)
            assert_equal(found[-1], self.playlist_id)
Пример #23
0
 def test_get_systems_actions_reset(self):
     """ Testing GET /Systems/{identifier}/Actions/ComputerSystem.Reset """
     self.__membersList = self.__systemsList.get("Members")
     assert_is_not_none(self.__membersList)
     for member in self.__membersList:
         dataId = member.get("@odata.id")
         assert_is_not_none(dataId)
         dataId = dataId.split("/redfish/v1/Systems/")[1]
         redfish().list_reset_types(dataId)
         reset_actions = self.__get_data()
         LOG.debug(reset_actions, json=True)
         self.__resetActionTypes = reset_actions.get("*****@*****.**")
         assert_equal(
             dumps(self.__resetActionTypes),
             dumps(
                 [
                     "On",
                     "ForceOff",
                     "GracefulShutdown",
                     "GracefulRestart",
                     "ForceRestart",
                     "Nmi",
                     "ForceOn",
                     "PushPowerButton",
                 ]
             ),
         )
Пример #24
0
def get_package_test_info_local(package, pkg_type, tests_path, patch_target):
    packages_path = "{0}/{1}/packages.yaml".format(tests_path, pkg_type)
    tests = set()
    tests_file = 'test.yaml'
    all_packages = yaml.load(open(packages_path).read())
    assert_is_not_none(_get_target_and_project(package, all_packages),
                       "Package '{0}' doesn't belong to any installation "
                       "target / project".format(package))
    target, project = _get_target_and_project(package, all_packages)
    if patch_target == 'master':
        if target not in ['master', 'bootstrap']:
            return set([None])
    if patch_target == 'environment':
        if target not in ['deployment', 'provisioning']:
            return set([None])
    target_tests_path = "/".join((tests_path, pkg_type, target, tests_file))
    project_tests_path = "/".join((tests_path, pkg_type, target, project,
                                   tests_file))
    package_tests_path = "/".join((tests_path, pkg_type, target, project,
                                   package, tests_file))
    for path in (target_tests_path, project_tests_path, package_tests_path):
        try:
            test = yaml.load(open(path).read())
            if 'system_tests' in test.keys():
                tests.update(test['system_tests']['tags'])
        except IOError:
            pass
    return tests
        def assert_name_equal(plid, name):
            playlists = self.wc.get_all_playlist_ids()

            found = playlists["user"].get(name, None)

            assert_is_not_none(found)
            assert_equal(found[-1], self.playlist_id)
Пример #26
0
        def assert_download(sid):
            filename, audio = self.mm.download_song(sid)

            # TODO could use original filename to verify this
            # but, when manually checking, got modified title occasionally
            assert_true(filename.endswith('.mp3'))
            assert_is_not_none(audio)
Пример #27
0
 def test_deep_list_security_group_with_rules(self):
     securityGroupList = dbaas.security_groups.list()
     assert_is_not_none(securityGroupList)
     securityGroup = [x for x in securityGroupList
                      if x.name in self.secGroupName]
     assert_is_not_none(securityGroup[0])
     assert_equal(len(securityGroup[0].rules), 1)
Пример #28
0
def get_package_test_info(package, pkg_type, tests_path, patch_target):
    packages_path = "{0}/{1}/packages.yaml".format(tests_path, pkg_type)
    tests = set()
    tests_file = 'test.yaml'
    all_packages = yaml.load(open(packages_path).read())
    assert_is_not_none(
        _get_target_and_project(package, all_packages),
        "Package '{0}' doesn't belong to any installation "
        "target / project".format(package))
    target, project = _get_target_and_project(package, all_packages)
    if patch_target == 'master':
        if target not in ['master', 'bootstrap']:
            return {None}
    if patch_target == 'environment':
        if target not in ['deployment', 'provisioning']:
            return {None}
    target_tests_path = "/".join((tests_path, pkg_type, target, tests_file))
    project_tests_path = "/".join(
        (tests_path, pkg_type, target, project, tests_file))
    package_tests_path = "/".join(
        (tests_path, pkg_type, target, project, package, tests_file))
    for path in (target_tests_path, project_tests_path, package_tests_path):
        try:
            test = yaml.load(open(path).read())
            if 'system_tests' in test.keys():
                tests.update(test['system_tests']['tags'])
        except IOError as e:
            logger.warning('Ignoring exception: {!r}'.format(e))
            logger.debug(traceback.format_exc())
    return tests
Пример #29
0
 def test_get_list_tasks(self):
     """ Testing GET /TaskService/Tasks """
     redfish().list_tasks()
     self.__taskList = self.__get_data()
     LOG.debug(self.__taskList,json=True)
     members = self.__taskList.get('Members')
     assert_is_not_none(members)
     assert_not_equal(0, len(members), message='Task members list was empty!')
Пример #30
0
 def __get_workflow_status(self, id):
     Nodes().nodes_identifier_workflows_active_get(id)
     status = self.__client.last_response.status
     if status == 200:
         data = self.__get_data()
         status = data.get('_status')
         assert_is_not_none(status)
     return status
Пример #31
0
 def _verify_backup_exists(self, result, backup_id):
     assert_true(len(result) >= 1)
     backup = None
     for b in result:
         if b.id == backup_id:
             backup = b
     assert_is_not_none(backup, "Backup not found")
     return backup
Пример #32
0
 def test_list_managers(self):
     """ Testing GET /Managers """
     redfish().list_managers()
     manager = self.__get_data()
     LOG.debug(manager, json=True)
     assert_not_equal(0, len(manager), message="managers list was empty!")
     self.__managersList = manager.get("Members")
     assert_is_not_none(self.__managersList)
Пример #33
0
 def test_workflows_post(self):
     """Testing POST:/workflows"""
     Api().workflows_post(body={"name": 'Graph.noop-example'})
     assert_equal(201, self.__client.last_response.status)
     rawj = json.loads(self.__client.last_response.data)
     instance_id = rawj.get('instanceId')
     assert_is_not_none(instance_id)
     assert_equal('Graph.noop-example', str(rawj['definition'].get('injectableName')))
Пример #34
0
 def test_list_managers(self):
     """ Testing GET /Managers """
     redfish().list_managers()
     manager = self.__get_data()
     LOG.debug(manager, json=True)
     assert_not_equal(0, len(manager), message='managers list was empty!')
     self.__managersList = manager.get('Members')
     assert_is_not_none(self.__managersList)
Пример #35
0
 def create_instance(self):
     self.abort_count = count_notifications(notifier.ERROR,
                                            "reddwarf.instance.abort.guest")
     self._create_instance()
     metadata = ReddwarfInstanceMetaData(self.db,
         context.get_admin_context(), self.local_id)
     self.volume_id = metadata.volume_id
     assert_is_not_none(metadata.volume)
Пример #36
0
 def __get_workflow_status(self, id):
     Nodes().nodes_identifier_workflows_active_get(id)
     status = self.__client.last_response.status
     if status == 200:
         data = self.__get_data()
         status = data.get('_status')
         assert_is_not_none(status)
     return status
Пример #37
0
 def test_delete_security_group_rule(self):
     dbaas.security_group_rules.delete(self.testSecurityGroupRule.id)
     securityGroupList = dbaas.security_groups.list()
     assert_is_not_none(securityGroupList)
     securityGroup = [x for x in securityGroupList
                      if x.name in self.secGroupName]
     assert_is_not_none(securityGroup[0])
     assert_equal(len(securityGroup[0].rules), 0)
    def get_plugin_vip(self, vip_name):
        """Get plugin IP."""
        networks = self.fuel_web.client.get_networks(self.cluster_id)
        vip = networks.get('vips').get(vip_name, {}).get('ipaddr', None)
        asserts.assert_is_not_none(
            vip, "Failed to get the IP of {} server".format(vip_name))

        logger.debug("Check that {} is ready".format(vip_name))
        return vip
Пример #39
0
 def test_workflows_post(self):
     """Testing POST:/workflows"""
     Api().workflows_post(body={"name": 'Graph.noop-example'})
     assert_equal(201, self.__client.last_response.status)
     rawj = json.loads(self.__client.last_response.data)
     instance_id = rawj.get('instanceId')
     assert_is_not_none(instance_id)
     assert_equal('Graph.noop-example',
                  str(rawj['definition'].get('injectableName')))
Пример #40
0
 def test_get_backup(self):
     backup = instance_info.dbaas.backups.get(self.backup_id)
     assert_equal(backup.id, self.backup_id)
     assert_equal(backup.name, BACKUP_NAME)
     assert_equal(backup.description, BACKUP_DESC)
     assert_equal(backup.instance_id, instance_info.id)
     assert_equal(backup.status, 'COMPLETED')
     assert_is_not_none(backup.created, 'backup.created does not exist')
     assert_is_not_none(backup.updated, 'backup.updated does not exist')
Пример #41
0
    def wc_get_uploaded_stream_urls(self):
        urls = self.wc.get_stream_urls(self.user_songs[0].sid)

        assert_equal(len(urls), 1)

        url = urls[0]

        assert_is_not_none(url)
        assert_equal(url.split(':')[0], 'https')
Пример #42
0
 def test_workflows_id_get(self):
     """ Testing GET:/identifier"""
     # Getting the identifier of the first workflow in order to validate the get-id function
     Workflows().workflows_get()
     rawj = json.loads(self.__client.last_response.data)
     instance_id = rawj[0].get('instanceId')
     assert_is_not_none(instance_id)
     Workflows().workflows_instance_id_get(instance_id)
     assert_equal(200,self.__client.last_response.status)
Пример #43
0
    def get_flavor(self, flavor_name):
        flavor = None
        for item in self.instance_info.flavors:
            if item.name == flavor_name:
                flavor = item

        asserts.assert_is_not_none(flavor)

        return flavor
Пример #44
0
 def test_workflows_id_get(self):
     """ Testing GET:/identifier"""
     # Getting the identifier of the first workflow in order to validate the get-id function
     Workflows().workflows_get()
     rawj = json.loads(self.__client.last_response.data)
     instance_id = rawj[0].get('instanceId')
     assert_is_not_none(instance_id)
     Workflows().workflows_instance_id_get(instance_id)
     assert_equal(200, self.__client.last_response.status)
Пример #45
0
def erase_data_from_hdd(remote,
                        device=None,
                        mount_point=None,
                        source="/dev/zero",
                        block_size=512,
                        blocks_from_start=2 * 1024 * 8,
                        blocks_from_end=2 * 1024 * 8):
    """Erases data on "device" using "dd" utility.

    :param remote: devops.SSHClient, remote to node
    :param device: str, block device which should be corrupted. If none -
       drive mounted at "mount_point" will be used for erasing
    :param mount_point: str, mount point for auto-detecting drive for erasing
    :param source: str, block device or file that will be used as source for
       "dd", default - /dev/zero
    :param block_size: int, block size which will be pass to "dd"
    :param blocks_from_start: int, count of blocks which will be erased from
       the beginning of the hard drive. Default - 16,384 (with bs=512 - 8MB)
    :param blocks_from_end: int, count of blocks which will be erased from
       the end of the hard drive. Default - 16,384 (with bs=512 - 8MB)
    :raises Exception: if return code of any of commands is not 0
    """
    if not device:
        asserts.assert_is_not_none(
            mount_point, "Mount point is not defined, will do nothing")
        device = remote.execute(
            "awk '$2 == \"{mount_point}\" {{print $1}}' /proc/mounts".format(
                mount_point=mount_point))['stdout'][0]
    # get block device for partition
    try:
        device = re.findall(r"(/dev/[a-z]+)", device)[0]
    except IndexError:
        logger.error("Can not find any block device in output! "
                     "Output is:'{}'".format(device))
    commands = []
    logger.debug("Boot sector of device '{}' will be erased".format(device))
    if blocks_from_start > 0:
        commands.append("dd bs={block_size} if={source} of={device} "
                        "count={blocks_from_start}".format(
                            block_size=block_size,
                            source=source,
                            device=device,
                            blocks_from_start=blocks_from_start))
    if blocks_from_end > 0:
        commands.append(
            "dd bs={block_size} if={source} of={device} "
            "count={blocks_from_end} "
            "seek=$((`blockdev --getsz {device}` - {seek}))".format(
                block_size=block_size,
                source=source,
                device=device,
                blocks_from_end=blocks_from_end,
                seek=block_size * blocks_from_end))
    commands.append("sync")

    for cmd in commands:
        run_on_remote(remote, cmd)
Пример #46
0
 def __get_workflow_status(self, id):
     Api().nodes_get_active_workflow_by_id(identifier=id)
     status = self.__client.last_response.status
     if status == 200:
         data = self.__get_data()
         if data:
             status = data.get('_status')
             assert_is_not_none(status)
     return status
Пример #47
0
 def __get_workflow_status(self, id):
     Api().nodes_get_active_workflow_by_id(identifier=id)
     status = self.__client.last_response.status
     if status == 200:
         data = self.__get_data()
         if data:
             status = data.get('_status')
             assert_is_not_none(status)
     return status
Пример #48
0
    def wc_get_uploaded_stream_urls(self):
        urls = self.wc.get_stream_urls(self.user_songs[0].sid)

        assert_equal(len(urls), 1)

        url = urls[0]

        assert_is_not_none(url)
        assert_equal(url.split(':')[0], 'https')
Пример #49
0
 def test_get_list_tasks(self):
     """ Testing GET /TaskService/Tasks """
     redfish().list_tasks()
     self.__taskList = self.__get_data()
     LOG.debug(self.__taskList, json=True)
     members = self.__taskList.get('Members')
     assert_is_not_none(members)
     assert_not_equal(0,
                      len(members),
                      message='Task members list was empty!')
Пример #50
0
 def redfish_emc_catalogs_test(self):
     """ Testing EMC Redfish Service Catalog """
     for node in self.__nodes:
         id = node.get('id')
         assert_is_not_none(id)
         Nodes().nodes_identifier_catalogs_get(id)
         catalog = self.__get_data()
         assert_not_equal(len(catalog), 0, message='EMC Redfish Catalog size failure')
         for data in catalog:
             assert_not_equal(len(data), 0, message='Unexpected EMC Catalog data size')
        def assert_song_exists(sid):
            songs = self.wc.get_all_songs()

            found = [s for s in songs if s["id"] == sid] or None

            assert_is_not_none(found)
            assert_equal(len(found), 1)

            s = found[0]
            return TestSong(s["id"], s["title"], s["artist"], s["album"])
        def assert_download(sid=self.song.sid):
            filename, audio = self.mm.download_song(sid)

            # there's some kind of a weird race happening here with CI;
            # usually one will succeed and one will fail

            #TODO could use original filename to verify this
            # but, when manually checking, got modified title occasionally
            assert_true(filename.endswith('.mp3'))  # depends on specific file
            assert_is_not_none(audio)
        def assert_song_exists(sid):
            songs = self.wc.get_all_songs()

            found = [s for s in songs if s['id'] == sid] or None

            assert_is_not_none(found)
            assert_equal(len(found), 1)

            s = found[0]
            return TestSong(s['id'], s['title'], s['artist'], s['album'])
Пример #54
0
    def test_instance_resize_to_non_ephemeral_flavor_should_fail(self):
        flavor_name = CONFIG.values.get('instance_bigger_flavor_name',
                                        'm1-small')
        flavor_id = None
        for item in instance_info.flavors:
            if item.name == flavor_name:
                flavor_id = item.id

        asserts.assert_is_not_none(flavor_id)
        asserts.assert_raises(BadRequest, self.dbaas.instances.resize_instance,
                              self.instance_id, flavor_id)
Пример #55
0
 def test_created_security_group(self):
     assert_is_not_none(self.testSecurityGroup)
     with TypeCheck('SecurityGroup', self.testSecurityGroup) as secGrp:
         secGrp.has_field('id', basestring)
         secGrp.has_field('name', basestring)
         secGrp.has_field('description', basestring)
         secGrp.has_field('created', basestring)
         secGrp.has_field('updated', basestring)
     assert_equal(self.testSecurityGroup.name, self.secGroupName)
     assert_equal(self.testSecurityGroup.description,
                  self.secGroupDescription)