diff --git a/tests/kafkatest/services/kafka/kafka.py b/tests/kafkatest/services/kafka/kafka.py index 172bf4f5479f..c7e8a0a65efa 100644 --- a/tests/kafkatest/services/kafka/kafka.py +++ b/tests/kafkatest/services/kafka/kafka.py @@ -926,7 +926,7 @@ def run_features_command(self, op, new_version): def pids(self, node): """Return process ids associated with running processes on the given node.""" try: - cmd = "jcmd | grep -e %s -e %s | awk '{print $1}'" % (self.java_class_name(), self.deprecated_cp_java_class_name()) + cmd = "ps ax | grep -e %s -e %s | grep -v grep | awk '{print $1}'" % (self.java_class_name(), self.deprecated_cp_java_class_name()) pid_arr = [pid for pid in node.account.ssh_capture(cmd, allow_fail=True, callback=int)] return pid_arr except (RemoteCommandError, ValueError) as e: @@ -994,9 +994,9 @@ def thread_dump(self, node): def clean_node(self, node): JmxMixin.clean_node(self, node) self.security_config.clean_node(node) - node.account.kill_java_processes(self.java_class_name(), + node.account.kill_process(self.java_class_name(), clean_shutdown=False, allow_fail=True) - node.account.kill_java_processes(self.deprecated_cp_java_class_name(), + node.account.kill_process(self.deprecated_cp_java_class_name(), clean_shutdown=False, allow_fail=True) node.account.ssh("sudo rm -rf -- %s" % KafkaService.PERSISTENT_ROOT, allow_fail=False)