def test_error_response_type_mismatch_object(self): self.log.info("Create a reference to SDK client") client = SDKClient(hosts=[self.cluster.master.ip], bucket=self.cb_bucket_name, password=self.cluster.master.rest_password) self.log.info("Insert documents in KV bucket") documents = ['{"address":{"city":"NY"}}'] client.insert_json_documents("id-", documents) self.log.info("Create dataset and connect link") self.create_dataset_connect_link() status, _, errors, _, _ = self.cbas_util.execute_statement_on_cbas_util(self.error_response["query"]) self.validate_error_response(status, errors, self.error_response["msg"], self.error_response["code"])
def setUp(self): super(CBASLimitPushdown, self).setUp() self.log.info("Create a reference to SDK client") client = SDKClient(hosts=[self.cluster.master.ip], bucket=self.cb_bucket_name, password=self.cluster.master.rest_password) self.log.info("Insert documents in KV bucket") documents = [ '{"name":"dave","age":19,"gender":"Male","salary":50.0, "married":false, "employed":""}', '{"name":"evan","age":25,"gender":"Female","salary":100.15, "married":true}', '{"name":"john","age":44,"gender":"Male","salary":150.55, "married":null}', '{"name": "sara", "age": 20, "gender": "Female", "salary": 200.34, "married":false}', '{"name":"tom","age":31,"gender":"Male","salary":250.99, "married":true}' ] client.insert_json_documents("id-", documents) self.log.info("Create connection") self.cbas_util.createConn(self.cb_bucket_name) self.log.info("Create primary index on KV bucket") self.rest.query_tool("create primary index pri_idx on default") self.log.info("Create dataset") self.cbas_util.create_dataset_on_bucket(self.cb_bucket_name, self.cbas_dataset_name) self.log.info("Connect to Local link") self.cbas_util.connect_link() self.log.info("Wait for ingestion to complete") self.total_documents = self.rest.query_tool( CBASLimitQueries.BUCKET_COUNT_QUERY)['results'][0]['$1'] self.cbas_util.wait_for_ingestion_complete([self.cbas_dataset_name], self.total_documents) self.log.info("Fetch partitions") shell = RemoteMachineShellConnection(self.cbas_node) response = self.cbas_util.fetch_analytics_cluster_response(shell) if 'partitions' in response: self.partitions = len(response['partitions']) self.log.info("Number of data partitions on cluster %d" % self.partitions) else: self.fail( msg= "Partitions not found. Failing early to avoid unexpected results" )