def test_no_components_given(self, admin_node):
     """Test for ccp show-dep with no component given
     Scenario:
         1. exec ccp show-dep
         2. Verify that exit code 2
     """
     logger.info("Error code for no component")
     cmd = "ccp show-dep"
     expected = 2
     admin_node.check_call(cmd, expected=[expected])
예제 #2
0
 def test_no_components_given(self, admin_node):
     """Test for ccp show-dep with no component given
     Scenario:
         1. exec ccp show-dep
         2. Verify that exit code 2
     """
     logger.info("Error code for no component")
     cmd = "ccp show-dep"
     expected = 2
     admin_node.check_call(cmd, expected=[expected])
예제 #3
0
 def test_nonexistent_component_given(self, admin_node):
     """Test for ccp show-dep with non existing component exit code
     Scenario:
         1. exec ccp show-dep wrong_component
         2. Verify that exit code 1
     """
     logger.info("Error code for nonexistent component name")
     component = ["wrong_component"]
     expected = 1
     cmd = "ccp show-dep {}".format(component[0])
     admin_node.check_call(cmd, expected=[expected])
 def test_nonexistent_component_given(self, admin_node):
     """Test for ccp show-dep with non existing component exit code
     Scenario:
         1. exec ccp show-dep wrong_component
         2. Verify that exit code 1
     """
     logger.info("Error code for nonexistent component name")
     component = ["wrong_component"]
     expected = 1
     cmd = "ccp show-dep {}".format(component[0])
     admin_node.check_call(cmd, expected=[expected])
    def test_component_help_message_via_long(self, admin_node):
        """Test for help message with long option

        Scenario:
            1. exec ccp show-dep --help
            2. Verify ccp show-dep help message returned
        """
        logger.info("Show help message with long option")
        cmd = "ccp show-dep --help"
        result = admin_node.check_call(cmd, expected=[0])
        assert len(utils.reduce_occurrences(
            CliMessages.usage_show_dep_message + CliMessages.help_message,
            " ".join(result['stdout'])).strip()) == 0
예제 #6
0
    def test_component_help_message_via_long(self, admin_node):
        """Test for help message with long option

        Scenario:
            1. exec ccp show-dep --help
            2. Verify ccp show-dep help message returned
        """
        logger.info("Show help message with long option")
        cmd = "ccp show-dep --help"
        result = admin_node.check_call(cmd, expected=[0])
        assert len(
            utils.reduce_occurrences(
                CliMessages.usage_show_dep_message + CliMessages.help_message,
                " ".join(result['stdout'])).strip()) == 0
    def test_nonexistent_component_given(self, admin_node):
        """Test for ccp show-dep non-existent component

        Scenario:
            1. exec ccp show-dep wrong_component
            2. Verify exit code is 1
            3. Verify message "Wrong component name 'wrong_component' displayed
        """
        logger.info("Show error message for nonexistent component name")
        component = ["wrong_component"]
        expected = 1
        error_message = CliMessages.error_message_bad_component_name.format(
            component[0])
        cmd = "ccp show-dep {}".format(component[0])
        result = admin_node.check_call(cmd, expected=[expected])
        assert error_message in " ".join(result['stderr'])
예제 #8
0
    def test_nonexistent_component_given(self, admin_node):
        """Test for ccp show-dep non-existent component

        Scenario:
            1. exec ccp show-dep wrong_component
            2. Verify exit code is 1
            3. Verify message "Wrong component name 'wrong_component' displayed
        """
        logger.info("Show error message for nonexistent component name")
        component = ["wrong_component"]
        expected = 1
        error_message = CliMessages.error_message_bad_component_name.format(
            component[0])
        cmd = "ccp show-dep {}".format(component[0])
        result = admin_node.check_call(cmd, expected=[expected])
        assert error_message in " ".join(result['stderr'])
    def test_component_have_no_dependencies(self, admin_node):
        """Test for ccp show-dep with component having no dependencies

        Scenario:
            1. exec ccp show-dep etcd
            2. Verify that no component names returned
        """
        logger.info("Show info for component without dependencies")
        component = ["etcd"]
        dependencies = [""]
        cmd = "ccp show-dep {}".format(component[0])
        result = admin_node.check_call(cmd, expected=[0])
        result_no_fetch = filter(
            lambda s: "fuel_ccp.fetch" not in s, result['stdout'])
        result_normalized = \
            " ".join(result_no_fetch).replace("\n", " ").strip().split(' ')
        assert set(dependencies) == set(result_normalized)
예제 #10
0
    def test_component_have_no_dependencies(self, admin_node):
        """Test for ccp show-dep with component having no dependencies

        Scenario:
            1. exec ccp show-dep etcd
            2. Verify that no component names returned
        """
        logger.info("Show info for component without dependencies")
        component = ["etcd"]
        dependencies = [""]
        cmd = "ccp show-dep {}".format(component[0])
        result = admin_node.check_call(cmd, expected=[0])
        result_no_fetch = filter(lambda s: "fuel_ccp.fetch" not in s,
                                 result['stdout'])
        result_normalized = \
            " ".join(result_no_fetch).replace("\n", " ").strip().split(' ')
        assert set(dependencies) == set(result_normalized)
예제 #11
0
    def test_multiple_components_given_cross_reference(self, admin_node):
        """Test for ccp show-dep multiple components(cross-referenced)

        Scenario:
            1. exec ccp show-dep keystone etcd
            2. Verify that only mariadb component name returned
        """
        logger.info("Show info for component with multiple dependencies with"
                    "cross referenced dependecies")
        component = ["keystone", "etcd"]
        dependencies = ["mariadb", "memcached"]
        cmd = "ccp show-dep {}".format(" ".join(component))
        result = admin_node.check_call(cmd, expected=[0])
        result_no_fetch = filter(lambda s: "fuel_ccp.fetch" not in s,
                                 result['stdout'])
        result_normalized = \
            " ".join(result_no_fetch).replace("\n", " ").strip().split(' ')
        assert set(dependencies) == set(result_normalized)
    def test_multiple_components_given_cross_reference(self, admin_node):
        """Test for ccp show-dep multiple components(cross-referenced)

        Scenario:
            1. exec ccp show-dep keystone etcd
            2. Verify that only mariadb component name returned
        """
        logger.info(
            "Show info for component with multiple dependencies with"
            "cross referenced dependecies")
        component = ["keystone", "etcd"]
        dependencies = ["mariadb", "memcached"]
        cmd = "ccp show-dep {}".format(" ".join(component))
        result = admin_node.check_call(cmd, expected=[0])
        result_no_fetch = filter(
            lambda s: "fuel_ccp.fetch" not in s, result['stdout'])
        result_normalized = \
            " ".join(result_no_fetch).replace("\n", " ").strip().split(' ')
        assert set(dependencies) == set(result_normalized)
예제 #13
0
    def test_no_components_given(self, admin_node):
        """Test for ccp show-dep no components

        Scenario:
            1. exec ccp show-dep wrong_component
            2. Verify exit code is 2
            3. Verify message "ccp show-dep: error: too few arguments' is shown
            4. Verify ccp show-dep usage message displayed
            5. Verify that no output in stdout
        """
        logger.info("Show error message for no component")
        cmd = "ccp show-dep"
        expected = 2
        result = admin_node.check_call(cmd, expected=[expected])
        assert len(
            utils.reduce_occurrences(
                CliMessages.error_message +
                [CliMessages.usage_show_dep_message[0]],
                "".join(result['stderr'])).strip()) == 0
        assert len(" ".join(result['stdout']).strip()) == 0
예제 #14
0
    def test_logging_log_rotate_for_mysql(self, admin_node, k8s_actions,
                                          show_step, os_deployed):
        """Test log rotate for mysql
        Precondition:
        1. Install k8s
        2. Install microservices
        3. Fetch all repos
        4. Build images or use external registry
        5. Deploy openstack

        Scenario:
        1. Clean mysql log on cron pod
        2. Simulate 8 days log rotation
        3. Ensure that count of log files is equal to 7(week rotation)
        """
        logger.info('Log rotate for mysql')
        log_path = '/var/log/ccp/mysql/'
        log_file = 'mysql.log'

        show_step(1)
        # get cron pod
        cron_pod = [
            pod for pod in k8s_actions.api.pods.list(
                namespace=ext.Namespace.BASE_NAMESPACE) if 'cron-' in pod.name
        ][0]
        # clean files
        utils.rm_files(admin_node, cron_pod, log_path + log_file + '*')

        show_step(2)
        for day in range(0, 8):
            utils.create_file(admin_node, cron_pod, log_path + log_file, 110)
            utils.run_daily_cron(admin_node, cron_pod, 'logrotate')
            sleep(5)

        show_step(3)
        log_files = utils.list_files(admin_node, cron_pod, log_path,
                                     log_file + '*')
        assert len(log_files) == 7,\
            "Count of log files after rotation is wrong. " \
            "Expected {} Actual {}".format(log_files, 7)
    def test_no_components_given(self, admin_node):
        """Test for ccp show-dep no components

        Scenario:
            1. exec ccp show-dep wrong_component
            2. Verify exit code is 2
            3. Verify message "ccp show-dep: error: too few arguments' is shown
            4. Verify ccp show-dep usage message displayed
            5. Verify that no output in stdout
        """
        logger.info("Show error message for no component")
        cmd = "ccp show-dep"
        expected = 2
        result = admin_node.check_call(cmd, expected=[expected])
        assert len(
            utils.reduce_occurrences(
                CliMessages.error_message +
                [CliMessages.usage_show_dep_message[0]],
                "".join(
                    result['stderr'])).strip()) == 0
        assert len(
            " ".join(result['stdout']).strip()) == 0
예제 #16
0
    def test_logging_search_for_logs_from_all_running_heka_instances(
            self, admin_node, k8scluster, elastic_client_public, show_step):
        """Heka connection test
        Precondition:
        1. Install k8s
        2. Install microservices
        3. Fetch all repos
        4. Build images or use external registry
        5. Deploy openstack

        Scenario:
        1. Find logs from all heka nodes
        2. Test that logs from each heka node exist
        """

        show_step(1)
        ec = elastic_client_public
        k8sclient = k8scluster.api
        # get all nodes
        nodes = k8sclient.nodes.list()
        # get all heka instances
        hekas = [
            pod for pod in k8sclient.pods.list(
                namespace=ext.Namespace.BASE_NAMESPACE) if 'heka' in pod.name
        ]
        # ensure heka is running on each node
        assert len(nodes) == len(hekas)

        show_step(2)
        for heka_job in hekas:
            logger.info(
                'Checking presense in aggregated log messages from {}'.format(
                    heka_job.name))
            assert ec.find('Hostname', heka_job.name).count > 0, \
                "Log message from heka node {} not found on elastic".format(
                    heka_job.name)
예제 #17
0
def admin_node(config, underlay, ccpcluster):
    logger.info("Get SSH access to admin node")
    with underlay.remote(host=config.k8s.kube_host) as remote:
        yield remote
def admin_node(config, underlay, ccpcluster):
    """Return <remote> object to k8s admin node"""
    logger.info("Get SSH access to admin node")
    with underlay.remote(host=config.k8s.kube_host) as remote:
        yield remote
예제 #19
0
def admin_node(config, underlay, ccpcluster):
    """Return <remote> object to k8s admin node"""
    logger.info("Get SSH access to admin node")
    with underlay.remote(host=config.k8s.kube_host) as remote:
        yield remote
def admin_node(config, underlay, ccpcluster):
    logger.info("Get SSH access to admin node")
    with underlay.remote(host=config.k8s.kube_host) as remote:
        yield remote