示例#1
0
    def test_run_queries_cbas_shutdown(self):
        '''
        Description: This test the ongoing queries while cbas node goes down.

        Steps:
        1. Add first cbas node.
        2. Start rebalance, wait for rebalance complete.
        3. Create bucket, datasets, connect bucket. Data ingestion should start.
        4. Add another cbas node, rebalance.
        5. Start concurrent queries on first cbas node.
        6. Second cbas node added in step 4 should be able to serve queries.

        Author: Ritesh Agarwal
        '''
        self.bucket_util.load_sample_bucket(self.cluster, self.sample_bucket)
        otpNode = self.cluster_util.add_node(self.cluster.cbas_nodes[0], services=["cbas"])
        self.setup_cbas_bucket_dataset_connect(self.cb_bucket_name,
                                               self.sample_bucket.stats.expected_item_count)
        self.cluster_util.add_node(self.cluster.cbas_nodes[1], services=["cbas"])

        query = "select count(*) from {0};".format(self.cbas_dataset_name)
        self.cbas_util._run_concurrent_queries(query, None, 2000, rest=RestConnection(self.cluster.cbas_nodes[0]),batch_size=self.concurrent_batch_size)
        shell = RemoteMachineShellConnection(self.cluster.cbas_nodes[0])
        shell.stop_couchbase()
        self.rest.fail_over(otpNode=otpNode.id)
        self.assertTrue(self.cluster_util.rebalance(self.cluster),
                        "Rebalance Failed")
        shell.start_couchbase(self.cluster.cbas_nodes[0])

        self.log.info("Wait for cluster to be active")
        self.assertTrue(self.cbas_util.wait_for_cbas_to_recover(), msg="Analytics service unavailable")
示例#2
0
    def test_primary_cbas_shutdown(self):
        '''
        Description: This test will add the second cbas node then start rebalance and cancel rebalance
        before rebalance completes.

        Steps:
        1. Add first cbas node.
        2. Start rebalance, wait for rebalance complete.
        3. Create bucket, datasets, connect bucket. Data ingestion should start.
        4. Add another cbas node, rebalance.
        5. Stop Couchbase service for Node1 added in step 1. Failover the node and rebalance.
        6. Second cbas node added in step 4 should be able to serve queries.

        Author: Ritesh Agarwal
        '''
        self.bucket_util.load_sample_bucket(self.cluster, self.sample_bucket)
        otpNode = self.cluster_util.add_node(self.cluster.cbas_nodes[0], services=["cbas"])
        self.setup_cbas_bucket_dataset_connect(self.cb_bucket_name,
                                               self.sample_bucket.stats.expected_item_count)
        self.cluster_util.add_node(self.cluster.cbas_nodes[1], services=["cbas"])
        remote_client = RemoteMachineShellConnection(self.cluster.cbas_nodes[0])
        remote_client.stop_couchbase()
        self.rest.fail_over(otpNode=otpNode.id)
        self.assertTrue(self.cluster_util.rebalance(self.cluster),
                        "Rebalance Failed")

        query = "select count(*) from {0};".format(self.cbas_dataset_name)
        self.cbas_util._run_concurrent_queries(query, "immediate", 100,
                                               rest=RestConnection(self.cluster.cbas_nodes[1]),
                                               batch_size=self.concurrent_batch_size)
        remote_client.start_couchbase()
        remote_client.disconnect()
        self.cluster_util.wait_for_ns_servers_or_assert([self.cluster.cbas_nodes[0]])
示例#3
0
    def test_restart_cb(self):
        '''
        Description: This test will restart CB and verify that CBAS is also up and running with CB.

        Steps:
        1. Add first cbas node.
        2. Start rebalance, wait for rebalance complete.
        3. Stop Couchbase service, Start Couchbase Service. Wait for service to get started.
        4. Verify that CBAS service is also up Create bucket, datasets, connect bucket. Data ingestion should start.

        Author: Ritesh Agarwal
        '''
        self.bucket_util.load_sample_bucket(self.cluster, self.sample_bucket)
        self.cluster_util.add_node(self.cluster.cbas_nodes[0], services=["cbas"])

        remote_client = RemoteMachineShellConnection(self.cluster.cbas_nodes[0])
        remote_client.stop_couchbase()
        remote_client.start_couchbase()
        remote_client.disconnect()

        self.log.info("Wait for cluster to be active")
        self.assertTrue(self.cbas_util.wait_for_cbas_to_recover(), msg="Analytics service unavailable")

        self.setup_cbas_bucket_dataset_connect(self.cb_bucket_name,
                                               self.sample_bucket.stats.expected_item_count)
        self.assertTrue(self.cbas_util.validate_cbas_dataset_items_count(
            self.cbas_dataset_name,
            self.sample_bucket.stats.expected_item_count), "Data loss in CBAS.")