You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/02/05 08:51:43 UTC

[GitHub] [ignite] Vladsz83 commented on a change in pull request #8522: GNITE-13835 : Improve discovery ducktape test to research small timeouts and behavior on large cluster.

Vladsz83 commented on a change in pull request #8522:
URL: https://github.com/apache/ignite/pull/8522#discussion_r570809855



##########
File path: modules/ducktests/tests/ignitetest/services/ignite.py
##########
@@ -90,3 +91,19 @@ def get_event_time(service, log_node, log_pattern, from_the_beginning=True, time
 
     return datetime.strptime(re.match("^\\[[^\\[]+\\]", stdout.read().decode("utf-8")).group(),
                              "[%Y-%m-%d %H:%M:%S,%f]")
+
+
+def exec_command(node, cmd):
+    """Executes the command passed on the given node and returns result as string."""
+    return str(node.account.ssh_client.exec_command(cmd)[1].read(), sys.getdefaultencoding())
+
+
+def node_id(node):
+    """
+    Returns node id from its log if started.
+    This is a remote call. Reuse its results if possible.
+    """
+    regexp = "^>>> Local node \\[ID=([^,]+),.+$"
+    cmd = "grep -E '%s' %s | sed -r 's/%s/\\1/'" % (regexp, node.log_file, regexp)
+
+    return exec_command(node, cmd).strip().lower()

Review comment:
       Because it is 'statuc' helpers to binded to any instanse. Is it ok?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite.py
##########
@@ -90,3 +91,19 @@ def get_event_time(service, log_node, log_pattern, from_the_beginning=True, time
 
     return datetime.strptime(re.match("^\\[[^\\[]+\\]", stdout.read().decode("utf-8")).group(),
                              "[%Y-%m-%d %H:%M:%S,%f]")
+
+
+def exec_command(node, cmd):
+    """Executes the command passed on the given node and returns result as string."""
+    return str(node.account.ssh_client.exec_command(cmd)[1].read(), sys.getdefaultencoding())
+
+
+def node_id(node):
+    """
+    Returns node id from its log if started.
+    This is a remote call. Reuse its results if possible.
+    """
+    regexp = "^>>> Local node \\[ID=([^,]+),.+$"
+    cmd = "grep -E '%s' %s | sed -r 's/%s/\\1/'" % (regexp, node.log_file, regexp)
+
+    return exec_command(node, cmd).strip().lower()

Review comment:
       Because it is 'static' helpers to binded to any instanse. Is it ok?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org