IMPALA-6711: loosen shell test prompt regex

We have seen this test fail because the fully-qualified domain name
differed between the python test process and the impala shell process
(see JIRA for details). The exact domain name is irrelevant to the test
- we only really care about whether the prompt appeared or not.

Change-Id: I24078ef97d56e5bb32fd866af861e3a1d19c8c44
Reviewed-on: http://gerrit.cloudera.org:8080/9831
Reviewed-by: Tim Armstrong <tarmstr...@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com>


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

Branch: refs/heads/master
Commit: 65f25c767c9125bc7c2bd1a75269f82ab5709cfe
Parents: 2995be8
Author: Tim Armstrong <tarmstr...@cloudera.com>
Authored: Tue Mar 27 15:03:04 2018 -0700
Committer: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
Committed: Tue Apr 10 04:26:04 2018 +0000

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


http://git-wip-us.apache.org/repos/asf/impala/blob/65f25c76/tests/shell/test_shell_interactive.py
----------------------------------------------------------------------
diff --git a/tests/shell/test_shell_interactive.py 
b/tests/shell/test_shell_interactive.py
index 17eac5b..e9049fa 100755
--- a/tests/shell/test_shell_interactive.py
+++ b/tests/shell/test_shell_interactive.py
@@ -43,6 +43,9 @@ SHELL_CMD = "%s/bin/impala-shell.sh" % 
os.environ['IMPALA_HOME']
 SHELL_HISTORY_FILE = os.path.expanduser("~/.impalahistory")
 QUERY_FILE_PATH = os.path.join(os.environ['IMPALA_HOME'], 'tests', 'shell')
 
+# Regex to match the interactive shell prompt that is expected after each 
command.
+PROMPT_REGEX = r'\[[^:]+:2100[0-9]\]'
+
 class TestImpalaShellInteractive(object):
   """Test the impala shell interactively"""
 
@@ -226,8 +229,6 @@ class TestImpalaShellInteractive(object):
     Ensure that multiline queries are preserved when they're read back from 
history.
     Additionally, also test that comments are preserved.
     """
-    # regex for pexpect, a shell prompt is expected after each command..
-    prompt_regex = '\[{0}:2100[0-9]\]'.format(socket.getfqdn())
     # readline gets its input from tty, so using stdin does not work.
     child_proc = pexpect.spawn(SHELL_CMD)
     # List of (input query, expected text in output).
@@ -240,10 +241,10 @@ class TestImpalaShellInteractive(object):
         ("select /*comment*/\n1;", "[4]: select /*comment*/\n1;"),
         ("select\n/*comm\nent*/\n1;", "[5]: select\n/*comm\nent*/\n1;")]
     for query, _ in queries:
-      child_proc.expect(prompt_regex)
+      child_proc.expect(PROMPT_REGEX)
       child_proc.sendline(query)
       child_proc.expect("Fetched 1 row\(s\) in .*s")
-    child_proc.expect(prompt_regex)
+    child_proc.expect(PROMPT_REGEX)
     child_proc.sendline('quit;')
     p = ImpalaShell()
     p.send_cmd('history')

Reply via email to