This is an automated email from the ASF dual-hosted git repository.

joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git


The following commit(s) were added to refs/heads/master by this push:
     new bf1034140 IMPALA-11523: Fix test_http_socket_timeout in Docker-based 
tests
bf1034140 is described below

commit bf103414012ba7596563c5f3292380f8b11524e9
Author: Joe McDonnell <[email protected]>
AuthorDate: Tue Aug 23 11:49:47 2022 -0700

    IMPALA-11523: Fix test_http_socket_timeout in Docker-based tests
    
    When running in the Docker-based tests, TestImpalaShell's
    test_http_socket_timeout fails with a mismatch in the
    error message. The test expected "Operation now in progress",
    but in Docker-based tests it throws "Cannot assign requested
    address". Since this is testing that a socket timeout of zero
    gets an error, it seems reasonable to tolerate this extra
    variant.
    
    This modifies the test to allow this error message.
    
    Testing:
     - TestImpalaShell.test_http_socket_timeout passes
       in the docker-based tests and in a normal core job
    
    Change-Id: If463f1100db673bb916b094c1402f1876342c80e
    Reviewed-on: http://gerrit.cloudera.org:8080/18899
    Reviewed-by: Wenzhe Zhou <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
---
 tests/shell/test_shell_commandline.py | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/tests/shell/test_shell_commandline.py 
b/tests/shell/test_shell_commandline.py
index dfaeaf814..5d334c30e 100644
--- a/tests/shell/test_shell_commandline.py
+++ b/tests/shell/test_shell_commandline.py
@@ -1237,14 +1237,23 @@ class TestImpalaShell(ImpalaTestSuite):
     args = ['--quiet', '-B', '--query', 'select 0;']
     result = run_impala_shell_cmd(vector, args + ['--http_socket_timeout_s=0'],
                                   expect_success=False)
-    expected_err_py2 = (
-      "Caught exception [Errno 115] Operation now in progress, "
-      "type=<class 'socket.error'> in OpenSession. Num remaining tries: 3")
-    expected_err_py3 = (
-      "Caught exception [Errno 115] Operation now in progress, "
-      "type=<class 'BlockingIOError'> in OpenSession. Num remaining tries: 3")
+
+    # Outside the docker-based tests, Python 2 and Python 3 produce "Operating
+    # now in progress" with slightly different error classes. When running with
+    # docker-based tests, it results in a different error code and "Cannot
+    # assign requested address" for both Python 2 and Python 3.
+    # Tolerate all three of these variants.
+    error_template = (
+      "Caught exception [Errno {0}] {1}, type=<class '{2}'> in OpenSession. "
+      "Num remaining tries: 3")
+    expected_err_py2 = \
+        error_template.format(115, "Operation now in progress", "socket.error")
+    expected_err_py3 = \
+        error_template.format(115, "Operation now in progress", 
"BlockingIOError")
+    expected_err_docker = \
+        error_template.format(99, "Cannot assign requested address", "OSError")
     actual_err = result.stderr.splitlines()[0]
-    assert actual_err == expected_err_py2 or actual_err == expected_err_py3
+    assert actual_err in [expected_err_py2, expected_err_py3, 
expected_err_docker]
 
     # Test http_socket_timeout_s=-1, expect errors
     result = run_impala_shell_cmd(vector, args + 
['--http_socket_timeout_s=-1'],

Reply via email to