Beispiel #1
0
    def test_os_databases(self):
        """Check amount of tables in databases is the same on each node
        Target Service: HA mysql

        Scenario:
            1. Request list of tables for os databases on each node.
            2. Check that amount of tables for each database is the same
        Duration: 100 s.
        """
        dbs = ['nova', 'glance', 'keystone']
        cmd = "mysql -e 'SHOW TABLES FROM %(database)s'"
        for database in dbs:
            LOG.info('Current database name is %s' % database)
            temp_set = set()
            for node in self.config.compute.online_controllers:
                LOG.info('Current controller node is %s' % node)
                cmd1 = cmd % {'database': database}
                LOG.info('Try to execute command %s' % cmd1)
                tables = SSHClient(node,
                                   self.controller_user,
                                   key_filename=self.controller_key,
                                   timeout=self.config.compute.ssh_timeout)
                output = self.verify(40, tables.exec_command, 1,
                                     'Can list tables',
                                     'get amount of tables for each database',
                                     cmd1)
                tables = set(output.splitlines())
                if len(temp_set) == 0:
                    temp_set = tables
                self.verify_response_true(
                    len(tables.symmetric_difference(temp_set)) == 0,
                    "Step 2 failed: Tables in %s database are "
                    "different" % database)

            del temp_set
    def test_os_databases(self):
        """Check amount of tables in databases is the same on each node
        Target Service: HA mysql

        Scenario:
            1. Request list of tables for os databases on each node.
            2. Check that amount of tables for each database is the same
        Duration: 100 s.
        """
        dbs = ['nova', 'glance', 'keystone']
        cmd = "mysql -e 'SHOW TABLES FROM %(database)s'"
        for database in dbs:
            LOG.info('Current database name is %s' % database)
            temp_set = set()
            for node in self.config.compute.online_controllers:
                LOG.info('Current controller node is %s' % node)
                cmd1 = cmd % {'database': database}
                LOG.info('Try to execute command %s' % cmd1)
                tables = SSHClient(
                    node, self.controller_user,
                    key_filename=self.controller_key,
                    timeout=self.config.compute.ssh_timeout)
                output = self.verify(40, tables.exec_command, 1,
                                     'Can list tables',
                                     'get amount of tables for each database',
                                     cmd1)
                tables = set(output.splitlines())
                if len(temp_set) == 0:
                    temp_set = tables
                self.verify_response_true(
                    len(tables.symmetric_difference(temp_set)) == 0,
                    "Step 2 failed: Tables in %s database are "
                    "different" % database)

            del temp_set
    def test_os_databases(self):
        """Check if amount of tables in databases is the same on each node
        Target Service: HA mysql

        Scenario:
            1. Detect there are online database nodes.
            2. Request list of tables for os databases on each node.
            3. Check if amount of tables in databases is the same on each node
        Duration: 10 s.
        """
        LOG.info("'Test OS Databases' started")
        dbs = ['nova', 'glance', 'keystone']
        cmd = "mysql -h localhost -e 'SHOW TABLES FROM %(database)s'"

        databases = self.verify(20,
                                self.get_database_nodes,
                                1, "Can not get database hostnames. Check that"
                                " at least one controller is operable",
                                "get database nodes",
                                self.controller_ip,
                                self.node_user,
                                key=self.node_key)
        self.verify_response_body_not_equal(0, len(databases), self.no_db_msg,
                                            1)
        if len(databases) == 1:
            self.skipTest(self.one_db_msg)

        for database in dbs:
            LOG.info('Current database name is %s' % database)
            temp_set = set()
            for node in databases:
                LOG.info('Current database node is %s' % node)
                cmd1 = cmd % {'database': database}
                LOG.info('Try to execute command %s' % cmd1)
                tables = SSHClient(node,
                                   self.node_user,
                                   key_filename=self.node_key,
                                   timeout=self.config.compute.ssh_timeout)
                output = self.verify(40, tables.exec_command, 2,
                                     'Can list tables',
                                     'get amount of tables for each database',
                                     cmd1)
                tables = set(output.splitlines())
                if len(temp_set) == 0:
                    temp_set = tables
                self.verify_response_true(
                    len(tables.symmetric_difference(temp_set)) == 0,
                    "Step 3 failed: Tables in %s database are "
                    "different" % database)

            del temp_set
    def test_os_databases(self):
        """Check if amount of tables in databases is the same on each node
        Target Service: HA mysql

        Scenario:
            1. Detect there are online database nodes.
            2. Request list of tables for os databases on each node.
            3. Check if amount of tables in databases is the same on each node
        Duration: 10 s.
        """
        LOG.info("'Test OS Databases' started")
        dbs = ["nova", "glance", "keystone"]
        cmd = "mysql -h localhost -e 'SHOW TABLES FROM %(database)s'"

        databases = self.verify(
            20,
            self.get_database_nodes,
            1,
            "Can not get database hostnames. Check that" " at least one controller is operable",
            "get database nodes",
            self.controller_ip,
            self.node_user,
            key=self.node_key,
        )

        if len(databases) == 1:
            self.skipTest("There is only one database online. " "Nothing to check")

        for database in dbs:
            LOG.info("Current database name is %s" % database)
            temp_set = set()
            for node in databases:
                LOG.info("Current database node is %s" % node)
                cmd1 = cmd % {"database": database}
                LOG.info("Try to execute command %s" % cmd1)
                tables = SSHClient(
                    node, self.node_user, key_filename=self.node_key, timeout=self.config.compute.ssh_timeout
                )
                output = self.verify(
                    40, tables.exec_command, 2, "Can list tables", "get amount of tables for each database", cmd1
                )
                tables = set(output.splitlines())
                if len(temp_set) == 0:
                    temp_set = tables
                self.verify_response_true(
                    len(tables.symmetric_difference(temp_set)) == 0,
                    "Step 3 failed: Tables in %s database are " "different" % database,
                )

            del temp_set