def check_word_count_eventing_log(self, function_name, word, expected_count, return_count_only=False): eventing_nodes = self.get_nodes_from_services_map( service_type="eventing", get_all_nodes=True) array_of_counts = [] command = "cat /opt/couchbase/var/lib/couchbase/data/@eventing/" + function_name + "* | grep -a \"" + word + "\" | wc -l" for eventing_node in eventing_nodes: shell = RemoteMachineShellConnection(eventing_node) count, error = shell.execute_non_sudo_command(command) self.log.info("count : {} and error : {} ".format(count, error)) if isinstance(count, list): count = int(count[0]) else: count = int(count) log.info("Node : {0} , word count on : {1}".format( eventing_node.ip, count)) array_of_counts.append(count) count_of_all_words = sum(array_of_counts) log.info("Total count: {}".format(count_of_all_words)) if return_count_only: return True, count_of_all_words if count_of_all_words == expected_count: return True, count_of_all_words return False, count_of_all_words
def check_number_of_files(self): eventing_nodes = self.get_nodes_from_services_map(service_type="eventing", get_all_nodes=True) array_of_counts = [] command = "cd /opt/couchbase/var/lib/couchbase/data/@eventing;ls | wc -l" for eventing_node in eventing_nodes: shell = RemoteMachineShellConnection(eventing_node) count, error = shell.execute_non_sudo_command(command) self.log.info("count : {} and error : {} ".format(count, error)) if isinstance(count, list): count = int(count[0]) else: count = int(count) log.info("Node : {0} , word count on : {1}".format(eventing_node.ip, count)) array_of_counts.append(count) count_of_all_files = sum(array_of_counts) log.info("Total count: {}".format(count_of_all_files)) return count_of_all_files
def check_if_eventing_consumers_are_cleaned_up(self): eventing_nodes = self.get_nodes_from_services_map(service_type="eventing", get_all_nodes=True) array_of_counts = [] command = "ps -ef | grep eventing-consumer | grep -v grep | wc -l" for eventing_node in eventing_nodes: shell = RemoteMachineShellConnection(eventing_node) count, error = shell.execute_non_sudo_command(command) if isinstance(count, list): count = int(count[0]) else: count = int(count) log.info("Node : {0} , eventing_consumer processes running : {1}".format(eventing_node.ip, count)) array_of_counts.append(count) count_of_all_eventing_consumers = sum(array_of_counts) if count_of_all_eventing_consumers != 0: return False return True