コード例 #1
0
    def get_view_name_from_profile(self, name_substr, cs_profile=None, all_entries=False):
        mv_names = []

        if not cs_profile:
            stress_cmd = self.longevity_self_object.params.get(self.stress_cmds_part, default=[])
            cs_profile = [cmd for cmd in stress_cmd if self.user_profile_name in cmd]

        if not cs_profile:
            return mv_names

        if not isinstance(cs_profile, list):
            cs_profile = [cs_profile]

        for profile in cs_profile:
            _, profile_content = get_profile_content(profile)
            mv_create_cmd = self.get_view_cmd_from_profile(profile_content, name_substr, all_entries)
            LOGGER.debug(f'Create commands: {mv_create_cmd}')
            for cmd in mv_create_cmd:
                view_name = self.get_view_name_from_stress_cmd(cmd, name_substr)
                if view_name:
                    mv_names.append(view_name)
                    if not all_entries:
                        break

        return mv_names
コード例 #2
0
    def get_view_name_from_profile(self,
                                   name_substr,
                                   cs_profile=None,
                                   all_entries=False):
        mv_names = []

        if not cs_profile:
            stress_cmd = self.longevity_self_object.params.get(
                self.stress_cmds_part) or []
            cs_profile = [
                cmd for cmd in stress_cmd if self.user_profile_name in cmd
            ]

        if not cs_profile:
            return mv_names

        if not isinstance(cs_profile, list):
            cs_profile = [cs_profile]

        for profile in cs_profile:
            _, profile_content = get_profile_content(profile)
            mv_create_cmd = self.get_view_cmd_from_profile(
                profile_content, name_substr, all_entries)
            LOGGER.debug('Create commands: %s', mv_create_cmd)
            for cmd in mv_create_cmd:
                view_name = self.get_view_name_from_stress_cmd(
                    cmd, name_substr)
                if view_name:
                    mv_names.append(view_name)
                    if not all_entries:
                        break

        # If same user profile is called in parallel, the same MVs will be included few time in the list and test data
        # will be copied a few times. Return list of unique MVs to prevent to duplicate of copying test data
        return list(set(mv_names))
コード例 #3
0
    def create_stress_cmd(self, node, loader_idx, keyspace_idx):
        stress_cmd = self.stress_cmd
        if node.cassandra_stress_version == "unknown":  # Prior to 3.11, cassandra-stress didn't have version argument
            stress_cmd = stress_cmd.replace("throttle", "limit")  # after 3.11 limit was renamed to throttle

        # When using cassandra-stress with "user profile" the profile yaml should be provided
        if 'profile' in stress_cmd and not self.profile:
            # support of using -profile in sct test-case yaml, assumes they exists data_dir
            # TODO: move those profile to their own directory
            cs_profile, profile = get_profile_content(stress_cmd)
            keyspace_name = profile['keyspace']
            self.profile = cs_profile
            self.keyspace_name = keyspace_name

        if self.keyspace_name:
            stress_cmd = stress_cmd.replace(" -schema ", " -schema keyspace={} ".format(self.keyspace_name))
        elif 'keyspace=' not in stress_cmd:  # if keyspace is defined in the command respect that
            stress_cmd = stress_cmd.replace(" -schema ", " -schema keyspace=keyspace{} ".format(keyspace_idx))

        credentials = self.loader_set.get_db_auth()
        if credentials and 'user='******'(-mode.*?)-', r'\1 user={} password={} -'.format(*credentials), stress_cmd)
        if self.client_encrypt and 'transport' not in stress_cmd:
            stress_cmd += \
                ' -transport "truststore=/etc/scylla/ssl_conf/client/cacerts.jks truststore-password=cassandra"'

        if self.node_list and '-node' not in stress_cmd:
            first_node = [n for n in self.node_list if n.dc_idx == loader_idx %
                          3]  # make sure each loader is targeting on datacenter/region
            first_node = first_node[0] if first_node else self.node_list[0]
            stress_cmd += " -node {}".format(first_node.ip_address)
        if 'skip-unsupported-columns' in self._get_available_suboptions(node, '-errors'):
            stress_cmd = self._add_errors_option(stress_cmd, ['skip-unsupported-columns'])
        return stress_cmd
コード例 #4
0
    def keyspace_name(self):
        if not self._keyspace_name:
            prepare_write_cmd = self.longevity_self_object.params.get(self.stress_cmds_part, default=[])
            profiles = [cmd for cmd in prepare_write_cmd if self.user_profile_name in cmd]
            if not profiles:
                self._validate_not_updated_data = False
                self._validate_updated_data = False

                LOGGER.warning('Keyspace is not recognized. '
                               'Data validation can\'t be performed')
                return self._keyspace_name

            cs_profile = profiles[0]
            _, profile = get_profile_content(cs_profile)
            self._keyspace_name = profile['keyspace']

        return self._keyspace_name