def test_delete_nonexistant_scope(self): try: BucketUtils.drop_scope(self.cluster.master, self.bucket, "sumedh") except Exception as e: self.log.info("Non existant collection deletion failed as expected") else: self.fail("deletion of non existing scope did not fail")
def test_delete_default_scope(self): try: BucketUtils.drop_scope(self.cluster.master, self.bucket, "_default") except Exception as e: self.log.info("Deafult Scope deletion failed as expected") else: self.fail("Default scope deletion did not fail")
def test_delete_nonexistant_scope(self): try: BucketUtils.drop_scope(self.cluster.master, self.bucket, "non_existent_col_123") except Exception: self.log.info("Drop scope failed as expected") else: self.fail("deletion of non existing scope did not fail")
def test_create_delete_recreate_scope(self): bucket_dict = BucketUtils.get_random_scopes(self.bucket_util.buckets, "all", 1) # Delete scopes for bucket_name, scope_dict in bucket_dict.items(): bucket = BucketUtils.get_bucket_obj(self.bucket_util.buckets, bucket_name) for scope_name, _ in scope_dict["scopes"].items(): BucketUtils.drop_scope(self.cluster.master, bucket, scope_name) # Recreate scopes for bucket_name, scope_dict in bucket_dict.items(): bucket = BucketUtils.get_bucket_obj(self.bucket_util.buckets, bucket_name) for scope_name, _ in scope_dict["scopes"].items(): BucketUtils.create_scope(self.cluster.master, bucket, scope_name) # Validate doc count as per bucket collections self.bucket_util.validate_docs_per_collections_all_buckets() self.validate_test_failure()
def test_create_delete_recreate_scope(self): scope_drop_fails = False bucket_dict = BucketUtils.get_random_scopes(self.bucket_util.buckets, "all", 1) # Delete scopes for bucket_name, scope_dict in bucket_dict.items(): bucket = BucketUtils.get_bucket_obj(self.bucket_util.buckets, bucket_name) for scope_name, _ in scope_dict["scopes"].items(): if scope_name == CbServer.default_scope: scope_drop_fails = True try: BucketUtils.drop_scope(self.cluster.master, bucket, scope_name) if scope_drop_fails: raise Exception("default scope deleted") except Exception as drop_exception: if scope_drop_fails \ and "delete_scope failed" in str(drop_exception): pass else: raise drop_exception # Recreate scopes for bucket_name, scope_dict in bucket_dict.items(): bucket = BucketUtils.get_bucket_obj(self.bucket_util.buckets, bucket_name) for scope_name, _ in scope_dict["scopes"].items(): # Cannot create a _default scope if scope_name == CbServer.default_collection: continue BucketUtils.create_scope(self.cluster.master, bucket, {"name": scope_name}) # Validate doc count as per bucket collections self.bucket_util.validate_docs_per_collections_all_buckets() self.validate_test_failure()