This is an automated email from the ASF dual-hosted git repository. stigahuang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
commit d9476a99c454ca35de8658c2fcb97aa9a61773ff Author: Csaba Ringhofer <[email protected]> AuthorDate: Wed Jan 22 18:18:35 2025 +0100 IMPALA-13689: Fix webserver tests with curl 7.76.1 On Rocky Linux 9.5 a few checks started to fail because error 503 was expected to cause non 0 return value but it was not treated as error. The difference is likely caused by the newer curl version. curl documentation seems unclear about the return value of auth related status codes. The fix is to check the specific http status code instead of curl's return value. Testing: - webserver tests passed on Rocky Linux 9.5 Change-Id: I354aa87a1b6283aa617f0298861bd5e79d03efc7 Reviewed-on: http://gerrit.cloudera.org:8080/22379 Reviewed-by: Impala Public Jenkins <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> --- be/src/util/webserver-test.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/be/src/util/webserver-test.cc b/be/src/util/webserver-test.cc index e10fe3dec..cbe0651cd 100644 --- a/be/src/util/webserver-test.cc +++ b/be/src/util/webserver-test.cc @@ -434,6 +434,13 @@ string curl(const string& curl_options, int32_t port = FLAGS_webserver_port) { return cmd; } +string curl_status_code(const string& curl_options, int32_t port = FLAGS_webserver_port) { + string cmd = Substitute("curl -s -f -w \"%{http_code}\" $0 'http://127.0.0.1:$1'", + curl_options, port); + cout << cmd << endl; + return exec(cmd.c_str()); +} + class CookieJar { public: CookieJar() : dir_(filesystem::unique_path()), path_(dir_ / "cookiejar") { @@ -568,7 +575,7 @@ TEST(Webserver, TestPostWithSpnego) { string token = cookie.token(); ASSERT_FALSE(token.empty()); // Post with the cookie fails due to CSRF protection. - ASSERT_NE(system(curl("-d '' -b " + cookie.path().string()).c_str()), 0); + ASSERT_EQ(curl_status_code("-d '' -b " + cookie.path().string()), "403"); // Include the cookie's random token as csrf_token and request should succeed. ASSERT_EQ(system(curl(Substitute( @@ -619,8 +626,8 @@ TEST(Webserver, StartWithPasswordFileTest) { string token = cookie.token(); ASSERT_FALSE(token.empty()); // Post with the cookie fails due to CSRF protection. - ASSERT_NE(system(curl(Substitute("--digest -u test:test -b $0 -d ''", - cookie.path().string())).c_str()), 0); + ASSERT_EQ(curl_status_code(Substitute("--digest -u test:test -b $0 -d ''", + cookie.path().string()).c_str()), "403"); // Include the cookie's random token as csrf_token and request should succeed. ASSERT_EQ(system(curl(Substitute("--digest -u test:test -b $0 -d 'csrf_token=$1'",
