You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2018/08/10 23:35:04 UTC

[5/5] impala git commit: IMPALA-7415: Fix flakiness in test_multiline_queries_in_history

IMPALA-7415: Fix flakiness in test_multiline_queries_in_history

This fixes a flakiness in test_multiline_queries_in_history wherein a
part of the shell prompt would be absorbed in a previous regex search
that would ultimately result in the failure of the subsequent regex
search that looks for the prompt.

Also fixed a few formatting issues flagged by flake8.

Change-Id: If7474f832a88bc29b321f21b050c9665294e63d5
Reviewed-on: http://gerrit.cloudera.org:8080/11175
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/9961c33e
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/9961c33e
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/9961c33e

Branch: refs/heads/master
Commit: 9961c33e8af3b7b1fe8af671e77b4ab1cb9203a7
Parents: b7d509d
Author: Bikramjeet Vig <bi...@cloudera.com>
Authored: Wed Aug 8 17:59:56 2018 -0700
Committer: Impala Public Jenkins <im...@cloudera.com>
Committed: Fri Aug 10 19:50:11 2018 +0000

----------------------------------------------------------------------
 tests/shell/test_shell_interactive.py | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/impala/blob/9961c33e/tests/shell/test_shell_interactive.py
----------------------------------------------------------------------
diff --git a/tests/shell/test_shell_interactive.py b/tests/shell/test_shell_interactive.py
index bb8ff4b..860803d 100755
--- a/tests/shell/test_shell_interactive.py
+++ b/tests/shell/test_shell_interactive.py
@@ -302,14 +302,15 @@ class TestImpalaShellInteractive(object):
     for query, _ in queries:
       child_proc.expect(PROMPT_REGEX)
       child_proc.sendline(query)
-      child_proc.expect("Fetched 1 row\(s\) in .*s")
+      child_proc.expect("Fetched 1 row\(s\) in [0-9]+\.?[0-9]*s")
     child_proc.expect(PROMPT_REGEX)
     child_proc.sendline('quit;')
     p = ImpalaShell()
     p.send_cmd('history')
     result = p.get_result()
     for _, history_entry in queries:
-      assert history_entry in result.stderr, "'%s' not in '%s'" % (history_entry, result.stderr)
+      assert history_entry in result.stderr, "'%s' not in '%s'" % (history_entry,
+                                                                   result.stderr)
 
   def test_history_file_option(self, tmp_history_file):
     """
@@ -341,11 +342,11 @@ class TestImpalaShellInteractive(object):
     self._expect_with_cmd(child_proc, "select 'second_command'", ("second_command"))
     child_proc.sendline('history;')
     child_proc.expect(":21000] default>")
-    assert '[1]: select \'first_command\';' in child_proc.before;
-    assert '[2]: select \'second_command\';' in child_proc.before;
-    assert '[3]: history;' in child_proc.before;
+    assert '[1]: select \'first_command\';' in child_proc.before
+    assert '[2]: select \'second_command\';' in child_proc.before
+    assert '[3]: history;' in child_proc.before
     # Rerunning command should not add an entry into history.
-    assert '[4]' not in child_proc.before;
+    assert '[4]' not in child_proc.before
     self._expect_with_cmd(child_proc, "@0", ("Command index out of range"))
     self._expect_with_cmd(child_proc, "rerun   4", ("Command index out of range"))
     self._expect_with_cmd(child_proc, "@-4", ("Command index out of range"))
@@ -396,7 +397,8 @@ class TestImpalaShellInteractive(object):
       # Change working dir so that SOURCE command in shell.cmds can find shell2.cmds.
       os.chdir("%s/tests/shell/" % os.environ['IMPALA_HOME'])
       # IMPALA-5416: Test that a command following 'source' won't be run twice.
-      result = run_impala_shell_interactive("source shell.cmds;select \"second command\";")
+      result = run_impala_shell_interactive("source shell.cmds;select \"second "
+                                            "command\";")
       assert "Query: USE FUNCTIONAL" in result.stderr
       assert "Query: SHOW TABLES" in result.stderr
       assert "alltypes" in result.stdout
@@ -452,8 +454,8 @@ class TestImpalaShellInteractive(object):
     # Development, deprecated and removed options should not be shown.
     # Note: there are currently no deprecated options
     assert "Development Query Options:" not in result.stdout
-    assert "DEBUG_ACTION" not in result.stdout # Development option.
-    assert "MAX_IO_BUFFERS" not in result.stdout # Removed option.
+    assert "DEBUG_ACTION" not in result.stdout  # Development option.
+    assert "MAX_IO_BUFFERS" not in result.stdout  # Removed option.
 
     shell2 = ImpalaShell()
     shell2.send_cmd("set all")
@@ -730,6 +732,7 @@ class TestImpalaShellInteractive(object):
     assert "ERROR: Errors parsing query options" in results.stderr
     assert "Invalid timezone name 'BLA'" in results.stderr
 
+
 def run_impala_shell_interactive(input_lines, shell_args=None):
   """Runs a command in the Impala shell interactively."""
   # if argument "input_lines" is a string, makes it into a list