[
https://issues.apache.org/jira/browse/IMPALA-11317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17542265#comment-17542265
]
ASF subversion and git services commented on IMPALA-11317:
----------------------------------------------------------
Commit 0ee5f8084f1bb34fc261c729f736ac093ba59c41 in impala's branch
refs/heads/master from Joe McDonnell
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=0ee5f8084 ]
IMPALA-11317/IMPALA-11316/IMPALA-11315: impala-shell Python 3 fixes
This fixes a few impala-shell Python 3 issues:
1. In ImpalaShell's do_history(), the decode() call needs to be
avoided in Python 3, because in Python 3 the cmd is already
a string and doesn't need further decoding. (IMPALA-11315)
2. TestImpalaShell.test_http_socket_timeout() gets a different
error message in Python 3. It throws the "BlockingIOError"
rather than "socker.error". (IMPALA-11316)
3. ImpalaHttpClient.py's code to retrieve the body when
handling an HTTP error needs to have a decode() call
for the body. Otherwise, the body remains bytes and
causes TestImpalaShellInteractive.test_http_interactions_extra()
to fail. (IMPALA-11317)
Testing:
- Ran shell tests in the standard way
- Ran shell tests with the impala-shell executable coming from
a Python 3 virtualenv using the PyPi package
Change-Id: Ie58380a17d7e011f4ce96b27d34717509a0b80a6
Reviewed-on: http://gerrit.cloudera.org:8080/18556
Reviewed-by: Impala Public Jenkins <[email protected]>
Reviewed-by: Wenzhe Zhou <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
> TestImpalaShellInteractive.test_http_interactions_extra fails on Python 3
> -------------------------------------------------------------------------
>
> Key: IMPALA-11317
> URL: https://issues.apache.org/jira/browse/IMPALA-11317
> Project: IMPALA
> Issue Type: Bug
> Components: Clients
> Affects Versions: Impala 4.2.0
> Reporter: Joe McDonnell
> Assignee: Joe McDonnell
> Priority: Major
>
> TestImpalaShellInteractive.test_http_interactions_extra is failing when using
> a Python 3 impala-shell:
> {noformat}
> [gw2] linux2 -- Python 2.7.16
> /home/joe/view2/Impala/bin/../infra/python/env-gcc7.5.0/bin/python
> self = <tests.shell.test_shell_interactive.TestImpalaShellInteractive object
> at 0x7fe5b9dacb50>
> vector = <tests.common.test_vector.ImpalaTestVector object at 0x7fe5ba153dd0>
> http_503_server_extra = <tests.shell.test_shell_interactive.TestHTTPServer503
> object at 0x7fe5b9dacbd0> def test_http_interactions_extra(self, vector,
> http_503_server_extra):
> """Test interactions with the http server when using hs2-http protocol.
> Check that the shell prints a good message when the server returns a
> 503 error,
> including the body text from the message."""
> protocol = vector.get_value("protocol")
> if protocol != 'hs2-http':
> pytest.skip()
>
> # Check that we get a message about the 503 error when we try to
> connect.
> shell_args = ["--protocol={0}".format(protocol),
> "-i{0}:{1}".format(http_503_server_extra.HOST,
> http_503_server_extra.PORT)]
> shell_proc = spawn_shell([IMPALA_SHELL_EXECUTABLE] + shell_args)
> > shell_proc.expect("HTTP code 503: Service Unavailable \[EXTRA\]",
> > timeout=10)shell/test_shell_interactive.py:1201:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _
> ../infra/python/env-gcc7.5.0/lib/python2.7/site-packages/pexpect/__init__.py:1451:
> in expect
> timeout, searchwindowsize)
> ../infra/python/env-gcc7.5.0/lib/python2.7/site-packages/pexpect/__init__.py:1466:
> in expect_list
> timeout, searchwindowsize)
> {noformat}
> It is expecting "HTTP code 503: Service Unavailable \[EXTRA\]", but it gets
> "HTTP code 503: Service Unavailable [b'EXTRA']". Python 3 is treating the
> "EXTRA" as a series of bytes, and that changes the printing. This could use a
> decode() call here:
> https://github.com/apache/impala/blob/master/shell/ImpalaHttpClient.py#L365-L366
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]