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/d73eb3b2 Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/d73eb3b2 Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/d73eb3b2 Branch: refs/heads/2.x Commit: d73eb3b297c07bdecb48fe29b2702628be6484ca Parents: caaa137 Author: Tim Armstrong <tarmstr...@cloudera.com> Authored: Tue Mar 27 15:03:04 2018 -0700 Committer: Impala Public Jenkins <impala-public-jenk...@gerrit.cloudera.org> Committed: Wed Apr 11 22:56:00 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/d73eb3b2/tests/shell/test_shell_interactive.py ---------------------------------------------------------------------- diff --git a/tests/shell/test_shell_interactive.py b/tests/shell/test_shell_interactive.py index e23acc4..deb75ea 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')