def test_MB_41383(self):
        """
        1. Introduce network split between orchestrator(node1) and the last node.
        2. Create collections on node1
        3. Create collections on the last node.
        4. Perform data validation
        """
        self.involve_orchestrator = True
        self.node1 = self.cluster.servers[0]
        self.node2 = self.cluster.servers[self.nodes_init - 1]
        self.split_brain(self.node1, self.node2)
        self.split_brain(self.node2, self.node1)
        self.sleep(120, "wait for network split to finish")

        BucketUtils.create_collections(
            self.cluster,
            self.bucket_util.buckets[0],
            5,
            CbServer.default_scope,
            collection_name="collection_from_first_node")

        self.cluster.master = self.master = self.node2
        BucketUtils.create_collections(
            self.cluster,
            self.bucket_util.buckets[0],
            5,
            CbServer.default_scope,
            collection_name="collection_from_last_node")
        self.remove_network_split()
        self.sleep(30, "wait for iptables rules to take effect")
        self.data_validation_collection()
Beispiel #2
0
 def test_more_than_max_collections_single_scope(self):
     BucketUtils.create_scope(self.cluster.master, self.bucket,
                              {"name": "scope1"})
     # Max_collections count, after considering default collection in setup
     max_collections = 1000
     BucketUtils.create_collections(self.cluster, self.bucket, max_collections - 1, "scope1")
     try:
         BucketUtils.create_collections(self.cluster, self.bucket, 500, "scope1")
     except Exception as e:
         self.log.info("Creating more than max collections failed as expected")
     else:
         self.fail("Creating more than max collections did not fail")
 def test_more_than_max_collections_single_scope(self):
     BucketUtils.create_scope(self.cluster.master, self.bucket,
                              {"name": "scope1"})
     # create max collections under single scope
     collects_dict = BucketUtils.create_collections(self.cluster, self.bucket, self.MAX_COLLECTIONS, "scope1")
     actual_count = len(collects_dict)
     if actual_count != self.MAX_COLLECTIONS:
         self.fail("failed to create max number of collections")
     try:
         # create one more than the max allowed
         BucketUtils.create_collections(self.cluster, self.bucket, 1, "scope1")
     except Exception as e:
         self.log.info("Creating more than max collections failed as expected")
     else:
         self.fail("Creating more than max collections did not fail")
Beispiel #4
0
    def test_create_collections(self):
        """
        1. Load data into '_default' collection (if required by test)
        2. Create collection(s) under the specific 'scope'
        3. Validate the collections are created properly
        4. Validate '_default' collection is intact
        """

        num_collections = self.input.param("num_collections", 1)
        use_default_scope = self.input.param("use_default_scope", False)
        use_scope_name_for_collection = \
            self.input.param("use_scope_name_for_collection", False)
        scope_name = CbServer.default_scope
        collection_with_scope_name = use_scope_name_for_collection
        if use_default_scope:
            collection_with_scope_name = False

        # Create custom scope if not using 'default' scope
        if not use_default_scope:
            scope_name = self.bucket_util.get_random_name()
            self.log.info("Creating scope '%s'" % scope_name)
            BucketUtils.create_scope(self.cluster.master, self.bucket,
                                     {"name": scope_name})

        if self.action_phase == "before_default_load":
            BucketUtils.create_collections(
                self.cluster,
                self.bucket,
                num_collections,
                scope_name,
                create_collection_with_scope_name=collection_with_scope_name)

        load_gen = doc_generator(self.key, 0, self.num_items)
        task = self.task.async_load_gen_docs(
            self.cluster,
            self.bucket,
            load_gen,
            "create",
            self.maxttl,
            batch_size=10,
            process_concurrency=8,
            replicate_to=self.replicate_to,
            persist_to=self.persist_to,
            durability=self.durability_level,
            compression=self.sdk_compression,
            timeout_secs=self.sdk_timeout,
            scope=CbServer.default_scope,
            collection=CbServer.default_collection)

        self.bucket.scopes[CbServer.default_scope] \
            .collections[CbServer.default_collection] \
            .num_items += self.num_items

        # Create collections(s) while CRUDs are running in background
        if self.action_phase == "during_default_load":
            BucketUtils.create_collections(
                self.cluster,
                self.bucket,
                num_collections,
                scope_name,
                create_collection_with_scope_name=collection_with_scope_name)

        self.task_manager.get_task_result(task)

        # Doc count validation
        self.bucket_util._wait_for_stats_all_buckets()
        # Prints bucket stats after doc_ops
        self.bucket_util.print_bucket_stats()
        self.bucket_util.validate_doc_count_as_per_collections(self.bucket)
        self.validate_test_failure()