From e0b541da28721998ce7c5a26765b7b3f37468c26 Mon Sep 17 00:00:00 2001 From: Serris Lew Date: Tue, 1 Apr 2025 11:15:03 -0700 Subject: [PATCH 1/5] Run autests with curl UDS default --- CMakePresets.json | 12 + tests/CMakeLists.txt | 51 ++- tests/autest.sh.in | 2 +- .../autest-site/conditions.test.ext | 5 + tests/gold_tests/autest-site/curl.test.ext | 10 +- tests/gold_tests/autest-site/setup.cli.ext | 2 +- .../autest-site/trafficserver.test.ext | 2 + tests/gold_tests/basic/config.test.py | 4 +- tests/gold_tests/basic/copy_config.test.py | 1 + .../gold_tests/basic/copy_config_uds.test.py | 45 +++ tests/gold_tests/bigobj/bigobj.test.py | 1 + tests/gold_tests/bigobj/bigobj_uds.test.py | 112 ++++++ .../gold_tests/cache/background_fill.test.py | 1 + .../cache/background_fill_uds.test.py | 132 +++++++ tests/gold_tests/cache/cache-control.test.py | 2 +- .../cache/cache-control_uds.test.py | 367 ++++++++++++++++++ .../chunked_encoding/chunked_encoding.test.py | 1 + .../chunked_encoding_h2.test.py | 1 + .../chunked_encoding_uds.test.py | 238 ++++++++++++ .../gold/chunked_GET_200.gold | 2 +- .../gold/chunked_GET_200_uds.gold | 13 + tests/gold_tests/connect/connect.test.py | 1 + tests/gold_tests/connect/connect_uds.test.py | 247 ++++++++++++ .../connect/gold/connect_0_stderr_uds.gold | 19 + .../continuations/double_h2.test.py | 1 + .../continuations/openclose_h2.test.py | 1 + .../continuations/session_id.test.py | 1 + .../continuations/session_id_uds.test.py | 96 +++++ .../early_hints/early_hints.test.py | 5 +- .../forward_proxy/forward_proxy.test.py | 1 + tests/gold_tests/headers/accept_webp.test.py | 1 + .../headers/cache_and_req_body.test.py | 2 +- .../gold_tests/headers/cachedIMSRange.test.py | 1 + .../headers/cachedIMSRange_uds.test.py | 257 ++++++++++++ .../headers/field_name_space.test.py | 2 +- .../headers/field_name_space_uds.test.py | 48 +++ tests/gold_tests/headers/forwarded.test.py | 1 + .../general-connection-failure-502.gold | 2 +- tests/gold_tests/headers/hsts.test.py | 2 +- tests/gold_tests/headers/normalize_ae.test.py | 1 + .../headers/normalize_ae_uds.test.py | 143 +++++++ tests/gold_tests/headers/syntax.test.py | 1 + tests/gold_tests/headers/syntax_uds.test.py | 87 +++++ tests/gold_tests/headers/via.test.py | 2 +- tests/gold_tests/headers/via_uds.gold | 3 + tests/gold_tests/headers/via_uds.test.py | 95 +++++ tests/gold_tests/ip_allow/ip_allow.test.py | 2 +- .../gold_tests/ip_allow/ip_allow_uds.test.py | 259 ++++++++++++ .../replays/http_proxy_protocol.replay.yaml | 54 +++ tests/gold_tests/logging/all_headers.test.py | 2 +- .../logging/all_headers_uds.test.py | 108 ++++++ tests/gold_tests/logging/custom-log.test.py | 1 + .../gold_tests/logging/custom-log_uds.test.py | 92 +++++ tests/gold_tests/logging/gold/custom_uds.gold | 8 + .../logging/gold/test_all_headers_uds.gold | 58 +++ .../gold_tests/logging/log-filenames.test.py | 1 + .../logging/log-filenames_uds.test.py | 268 +++++++++++++ tests/gold_tests/logging/new_log_flds.test.py | 1 + .../logging/new_log_flds_uds.test.py | 105 +++++ .../parent_config_dest_ip.test.py | 2 +- .../parent_config_dest_ip_uds.test.py | 125 ++++++ .../gold/null_transform-200.gold | 2 +- .../per_server_connection_max.test.py | 4 +- .../pluginTest/TSVConnFd/TSVConnFd.test.py | 1 + .../TSVConnFd/TSVConnFd_uds.test.py | 67 ++++ .../cert_update/cert_update.test.py | 1 + .../pluginTest/compress/compress.gold | 44 +-- .../gold/header_rewrite-303.gold | 2 +- .../gold/header_rewrite-client.gold | 2 +- .../gold/header_rewrite-l_value.gold | 2 +- .../gold/header_rewrite_cond_method.gold | 2 +- .../pluginTest/polite_hook_wait/curl.gold | 1 + .../polite_hook_wait/polite_hook_wait.test.py | 1 + .../polite_hook_wait_uds.test.py | 63 +++ .../pluginTest/prefetch/prefetch_bignum.gold | 2 +- .../prefetch/prefetch_bignum.test.py | 2 +- .../pluginTest/prefetch/prefetch_cmcd.test.py | 2 +- .../prefetch/prefetch_overflow.gold | 2 +- .../prefetch/prefetch_overflow.test.py | 2 +- .../pluginTest/prefetch/prefetch_simple.gold | 2 +- .../prefetch/prefetch_simple.test.py | 2 +- .../pluginTest/sslheaders/sslheaders.test.py | 1 + .../pluginTest/test_hooks/body_buffer.test.py | 2 + .../pluginTest/test_hooks/hook_add.test.py | 1 + .../test_hooks/hook_add_uds.test.py | 54 +++ .../pluginTest/test_hooks/log_uds.gold | 12 + .../test_hooks/ssn_start_delay_hook.test.py | 1 + .../ssn_start_delay_hook_uds.test.py | 56 +++ .../pluginTest/test_hooks/test_hooks.test.py | 1 + .../test_hooks/test_hooks_uds.test.py | 77 ++++ .../gold_tests/pluginTest/tsapi/log_uds.gold | 100 +++++ .../gold_tests/pluginTest/tsapi/tsapi.test.py | 1 + .../pluginTest/tsapi/tsapi_uds.test.py | 90 +++++ .../pluginTest/url_sig/url_sig.test.py | 1 + .../pluginTest/url_sig/url_sig_uds.test.py | 266 +++++++++++++ tests/gold_tests/post/post-continue.test.py | 1 + .../gold_tests/post/post-early-return.test.py | 1 + .../post_slow_server_max_requests_in.test.py | 4 +- .../proxy_serve_stale_dns_fail.test.py | 8 +- .../gold/number_of_redirections_0.gold | 14 +- .../gold/number_of_redirections_2.gold | 6 +- .../gold_tests/redirect/redirect_post.test.py | 2 +- .../remap/basic_conf_remap_yaml.test.py | 1 + .../remap/basic_conf_remap_yaml_uds.test.py | 183 +++++++++ .../gold_tests/remap/gold/200OK_test_uds.gold | 13 + .../remap/gold/remap-ws-metrics-uds.gold | 21 + tests/gold_tests/remap/remap_https.test.py | 1 + tests/gold_tests/remap/remap_ws.test.py | 1 + tests/gold_tests/remap/remap_ws_uds.test.py | 97 +++++ .../gold_tests/slow_post/server_abort.test.py | 1 + .../gold_tests/timeout/active_timeout.test.py | 1 + .../timeout/active_timeout_uds.test.py | 42 ++ .../timeout/inactive_client_timeout.test.py | 1 + .../inactive_client_timeout_uds.test.py | 57 +++ .../timeout/inactive_timeout.test.py | 1 + .../timeout/inactive_timeout_uds.test.py | 44 +++ tests/gold_tests/timeout/slow_server_uds.yaml | 83 ++++ .../tunnel/tunnel_transform.test.py | 1 + tests/gold_tests/tunnel/txn_type.test.py | 1 + 119 files changed, 4478 insertions(+), 86 deletions(-) create mode 100644 tests/gold_tests/basic/copy_config_uds.test.py create mode 100644 tests/gold_tests/bigobj/bigobj_uds.test.py create mode 100644 tests/gold_tests/cache/background_fill_uds.test.py create mode 100644 tests/gold_tests/cache/cache-control_uds.test.py create mode 100644 tests/gold_tests/chunked_encoding/chunked_encoding_uds.test.py create mode 100644 tests/gold_tests/chunked_encoding/gold/chunked_GET_200_uds.gold create mode 100644 tests/gold_tests/connect/connect_uds.test.py create mode 100644 tests/gold_tests/connect/gold/connect_0_stderr_uds.gold create mode 100644 tests/gold_tests/continuations/session_id_uds.test.py create mode 100644 tests/gold_tests/headers/cachedIMSRange_uds.test.py create mode 100644 tests/gold_tests/headers/field_name_space_uds.test.py create mode 100644 tests/gold_tests/headers/normalize_ae_uds.test.py create mode 100644 tests/gold_tests/headers/syntax_uds.test.py create mode 100644 tests/gold_tests/headers/via_uds.gold create mode 100644 tests/gold_tests/headers/via_uds.test.py create mode 100644 tests/gold_tests/ip_allow/ip_allow_uds.test.py create mode 100644 tests/gold_tests/ip_allow/replays/http_proxy_protocol.replay.yaml create mode 100644 tests/gold_tests/logging/all_headers_uds.test.py create mode 100644 tests/gold_tests/logging/custom-log_uds.test.py create mode 100644 tests/gold_tests/logging/gold/custom_uds.gold create mode 100644 tests/gold_tests/logging/gold/test_all_headers_uds.gold create mode 100644 tests/gold_tests/logging/log-filenames_uds.test.py create mode 100644 tests/gold_tests/logging/new_log_flds_uds.test.py create mode 100644 tests/gold_tests/next_hop/parent_config/parent_config_dest_ip_uds.test.py create mode 100644 tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd_uds.test.py create mode 100644 tests/gold_tests/pluginTest/polite_hook_wait/polite_hook_wait_uds.test.py create mode 100644 tests/gold_tests/pluginTest/test_hooks/hook_add_uds.test.py create mode 100644 tests/gold_tests/pluginTest/test_hooks/log_uds.gold create mode 100644 tests/gold_tests/pluginTest/test_hooks/ssn_start_delay_hook_uds.test.py create mode 100644 tests/gold_tests/pluginTest/test_hooks/test_hooks_uds.test.py create mode 100644 tests/gold_tests/pluginTest/tsapi/log_uds.gold create mode 100644 tests/gold_tests/pluginTest/tsapi/tsapi_uds.test.py create mode 100644 tests/gold_tests/pluginTest/url_sig/url_sig_uds.test.py create mode 100644 tests/gold_tests/remap/basic_conf_remap_yaml_uds.test.py create mode 100644 tests/gold_tests/remap/gold/200OK_test_uds.gold create mode 100644 tests/gold_tests/remap/gold/remap-ws-metrics-uds.gold create mode 100644 tests/gold_tests/remap/remap_ws_uds.test.py create mode 100644 tests/gold_tests/timeout/active_timeout_uds.test.py create mode 100644 tests/gold_tests/timeout/inactive_client_timeout_uds.test.py create mode 100644 tests/gold_tests/timeout/inactive_timeout_uds.test.py create mode 100644 tests/gold_tests/timeout/slow_server_uds.yaml diff --git a/CMakePresets.json b/CMakePresets.json index 218a4654246..842bccb8f30 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -61,6 +61,18 @@ "ENABLE_EXAMPLE": "ON" } }, + { + "name": "autest-uds", + "inherits": ["default"], + "binaryDir": "${sourceDir}/build-autest", + "cacheVariables": { + "ENABLE_AUTEST": "ON", + "ENABLE_AUTEST_UDS": "ON", + "CMAKE_INSTALL_PREFIX": "/tmp/ts-autest", + "BUILD_EXPERIMENTAL_PLUGINS": "ON", + "ENABLE_EXAMPLE": "ON" + } + }, { "name": "dev", "displayName": "development", diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7704edf3bcb..11f51a4b652 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -36,34 +36,53 @@ function(ADD_AUTEST_PLUGIN _NAME) endfunction() add_subdirectory(tools/plugins) -add_subdirectory(gold_tests/chunked_encoding) -add_subdirectory(gold_tests/continuations/plugins) -add_subdirectory(gold_tests/jsonrpc/plugins) -add_subdirectory(gold_tests/pluginTest/polite_hook_wait) -add_subdirectory(gold_tests/pluginTest/tsapi) -add_subdirectory(gold_tests/pluginTest/TSVConnFd) -add_subdirectory(gold_tests/timeout) -add_subdirectory(gold_tests/tls) - set(RUNPIPENV PIPENV_VENV_IN_PROJECT=True ${PipEnv}) -configure_file(Pipfile Pipfile COPYONLY) -configure_file(autest.sh.in autest.sh) - +set(CMAKE_GOLD_DIR "${CMAKE_CURRENT_SOURCE_DIR}/gold_tests_filtered") set(CURL_UDS_FLAG "") if(ENABLE_AUTEST_UDS) set(CURL_UDS_FLAG "--curl-uds") + # Copy everything except dirs: h2, tls + # Other specific tests will be skipped + file( + COPY ${CMAKE_CURRENT_SOURCE_DIR}/gold_tests/ + DESTINATION ${CMAKE_GOLD_DIR} + FILES_MATCHING + PATTERN "*" + PATTERN "h2" EXCLUDE + PATTERN "tls*" EXCLUDE + ) +else() + # Copy everything except autest_uds tests that are only for curl uds option + file( + COPY ${CMAKE_CURRENT_SOURCE_DIR}/gold_tests/ + DESTINATION ${CMAKE_GOLD_DIR} + FILES_MATCHING + PATTERN "*" + PATTERN "*_uds.test.py" EXCLUDE + ) + add_subdirectory(gold_tests_filtered/tls) endif() +add_subdirectory(gold_tests_filtered/chunked_encoding) +add_subdirectory(gold_tests_filtered/continuations/plugins) +add_subdirectory(gold_tests_filtered/jsonrpc/plugins) +add_subdirectory(gold_tests_filtered/pluginTest/polite_hook_wait) +add_subdirectory(gold_tests_filtered/pluginTest/tsapi) +add_subdirectory(gold_tests_filtered/pluginTest/TSVConnFd) +add_subdirectory(gold_tests_filtered/timeout) + +configure_file(Pipfile Pipfile COPYONLY) +configure_file(autest.sh.in autest.sh) + add_custom_target( autest COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target install COMMAND ${RUNPIPENV} install COMMAND - ${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR}/gold_tests/remap:$ENV{PYTHONPATH} ${RUNPIPENV} run - env autest --directory ${CMAKE_CURRENT_SOURCE_DIR}/gold_tests --ats-bin=${CMAKE_INSTALL_PREFIX}/bin - --proxy-verifier-bin ${PROXY_VERIFIER_PATH} --build-root ${CMAKE_BINARY_DIR} --sandbox ${AUTEST_SANDBOX} - ${CURL_UDS_FLAG} ${AUTEST_OPTIONS} + ${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_GOLD_DIR}/remap:$ENV{PYTHONPATH} ${RUNPIPENV} run env autest --directory + ${CMAKE_GOLD_DIR} --ats-bin=${CMAKE_INSTALL_PREFIX}/bin --proxy-verifier-bin ${PROXY_VERIFIER_PATH} --build-root + ${CMAKE_BINARY_DIR} --sandbox ${AUTEST_SANDBOX} ${CURL_UDS_FLAG} ${AUTEST_OPTIONS} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} USES_TERMINAL ) diff --git a/tests/autest.sh.in b/tests/autest.sh.in index bd6c433ff2d..c5f491e432d 100755 --- a/tests/autest.sh.in +++ b/tests/autest.sh.in @@ -9,7 +9,7 @@ export PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR}/gold_tests/remap:$PYTHONPATH ${RUNPIPENV} run env autest \ --sandbox ${AUTEST_SANDBOX} \ - --directory ${CMAKE_CURRENT_SOURCE_DIR}/gold_tests \ + --directory ${CMAKE_GOLD_DIR} \ --ats-bin=${CMAKE_INSTALL_PREFIX}/bin \ --proxy-verifier-bin ${PROXY_VERIFIER_PATH} \ --build-root ${CMAKE_BINARY_DIR} \ diff --git a/tests/gold_tests/autest-site/conditions.test.ext b/tests/gold_tests/autest-site/conditions.test.ext index 37db31338b3..12112a47a8c 100644 --- a/tests/gold_tests/autest-site/conditions.test.ext +++ b/tests/gold_tests/autest-site/conditions.test.ext @@ -110,6 +110,10 @@ def PluginExists(self, pluginname): return self.Condition(lambda: os.path.isfile(path), path + " not found.") +def CurlUds(self): + return self.Condition(lambda: self.Variables.get("CurlUds", False), "Curl using UDS. Not relevant for test") + + ExtendCondition(HasOpenSSLVersion) ExtendCondition(HasProxyVerifierVersion) ExtendCondition(IsBoringSSL) @@ -119,3 +123,4 @@ ExtendCondition(HasCurlVersion) ExtendCondition(HasCurlFeature) ExtendCondition(HasCurlOption) ExtendCondition(PluginExists) +ExtendCondition(CurlUds) diff --git a/tests/gold_tests/autest-site/curl.test.ext b/tests/gold_tests/autest-site/curl.test.ext index f99dc833c13..35bbd49d9e0 100644 --- a/tests/gold_tests/autest-site/curl.test.ext +++ b/tests/gold_tests/autest-site/curl.test.ext @@ -34,7 +34,8 @@ def spawn_curl_commands(self, cmdstr, count, retcode=0, use_default=True): ret = [] if self.Variables.get("CurlUds", False): - cmdstr = 'curl --unix-socket /tmp/socket ' + cmdstr + uds_path = os.path.join(self.Processes.Default.RunDirectory, 'uds.socket') + cmdstr = f'curl --unix-socket {uds_path} ' + cmdstr else: cmdstr = 'curl ' + cmdstr if use_default: @@ -48,11 +49,12 @@ def spawn_curl_commands(self, cmdstr, count, retcode=0, use_default=True): return ret -def curl_command(self, cmd, p=None): +def curl_command(self, cmd, uds_suffix="", p=None): if p == None: p = self.Processes.Default if self.Variables.get("CurlUds", False): uds_path = os.path.join(p.RunDirectory, 'uds.socket') + uds_path += uds_suffix p.Command = f'curl --unix-socket {uds_path} ' + cmd else: p.Command = 'curl ' + cmd @@ -63,9 +65,9 @@ def curl_multiple_commands(self, cmd): p = self.Processes.Default if self.Variables.get("CurlUds", False): uds_path = os.path.join(p.RunDirectory, 'uds.socket') - p.Command = cmd.format(curl=f'curl --unix-socket {uds_path}') + p.Command = cmd.format(curl=f'curl --unix-socket {uds_path}', curl_base='curl') else: - p.Command = cmd.format(curl='curl') + p.Command = cmd.format(curl='curl', curl_base='curl') return p diff --git a/tests/gold_tests/autest-site/setup.cli.ext b/tests/gold_tests/autest-site/setup.cli.ext index 8f16da423fe..937e1887ea8 100644 --- a/tests/gold_tests/autest-site/setup.cli.ext +++ b/tests/gold_tests/autest-site/setup.cli.ext @@ -116,7 +116,7 @@ Variables.VerifierBinPath = ENV['VERIFIER_BIN'] Variables.BuildRoot = ENV['BUILD_ROOT'] Variables.RepoDir = repo_root Variables.AtsTestPluginsDir = os.path.join(Variables.BuildRoot, 'tests', 'tools', 'plugins', '.libs') -Variables.AtsBuildGoldTestsDir = os.path.join(Variables.BuildRoot, 'tests', 'gold_tests') +Variables.AtsBuildGoldTestsDir = os.path.join(Variables.BuildRoot, 'tests', 'gold_tests_filtered') Variables.CurlUds = Arguments.curl_uds # modify delay times as we always have to kill Trafficserver diff --git a/tests/gold_tests/autest-site/trafficserver.test.ext b/tests/gold_tests/autest-site/trafficserver.test.ext index a9a2a3f2129..fe74fafc0ef 100755 --- a/tests/gold_tests/autest-site/trafficserver.test.ext +++ b/tests/gold_tests/autest-site/trafficserver.test.ext @@ -53,6 +53,7 @@ def MakeATSProcess( enable_cache=True, enable_quic=False, enable_uds=True, + uds_path_suffix='', block_for_debug=False, log_data=default_log_data, use_traffic_out=True, @@ -369,6 +370,7 @@ def MakeATSProcess( # unix domain socket path uds_path = os.path.join(obj.RunDirectory, 'uds.socket') + uds_path += uds_path_suffix # to allow multiple sockets in one test file p.Variables.uds_path = uds_path get_port(p, "manager_port") diff --git a/tests/gold_tests/basic/config.test.py b/tests/gold_tests/basic/config.test.py index 24efd11adcc..20b34853155 100644 --- a/tests/gold_tests/basic/config.test.py +++ b/tests/gold_tests/basic/config.test.py @@ -15,13 +15,15 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import os Test.Summary = "Test start up of Traffic server with configuration modification of starting port" ts = Test.MakeATSProcess("ts", select_ports=False) ts.Variables.port = 8090 +uds_path = os.path.join(Test.RunDirectory, 'uds.socket') ts.Disk.records_config.update({ - 'proxy.config.http.server_ports': str(ts.Variables.port), + 'proxy.config.http.server_ports': str(ts.Variables.port) + f" {uds_path}", }) ts.Ready = When.PortOpen(ts.Variables.port) t = Test.AddTestRun("Test traffic server started properly") diff --git a/tests/gold_tests/basic/copy_config.test.py b/tests/gold_tests/basic/copy_config.test.py index 57bd32496ad..9074e76ce3c 100644 --- a/tests/gold_tests/basic/copy_config.test.py +++ b/tests/gold_tests/basic/copy_config.test.py @@ -17,6 +17,7 @@ # limitations under the License. Test.Summary = "Test start up of Traffic server with configuration modification of starting port of different servers at the same time" +Test.SkipIf(Condition.CurlUds()) # set up some ATS processes ts1 = Test.MakeATSProcess("ts1", select_ports=False) diff --git a/tests/gold_tests/basic/copy_config_uds.test.py b/tests/gold_tests/basic/copy_config_uds.test.py new file mode 100644 index 00000000000..bbe366fd2f1 --- /dev/null +++ b/tests/gold_tests/basic/copy_config_uds.test.py @@ -0,0 +1,45 @@ +''' +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import os + +Test.Summary = "Test start up of Traffic server with configuration modification of starting port of different servers at the same time" + +# set up some ATS processes +ts1 = Test.MakeATSProcess("ts1", select_ports=False) +ts1.Variables.port = 8090 +uds_path = os.path.join(Test.RunDirectory, 'uds.socket') +ts1.Disk.records_config.update({ + 'proxy.config.http.server_ports': str(ts1.Variables.port) + f" {uds_path}", +}) +ts1.Ready = When.PortOpen(ts1.Variables.port) + +ts2 = Test.MakeATSProcess("ts2", select_ports=False) +ts2.Variables.port = 8091 +ts2.Disk.records_config.update({ + 'proxy.config.http.server_ports': str(ts2.Variables.port), +}) +ts2.Ready = When.PortOpen(ts2.Variables.port) + +# setup a testrun +t = Test.AddTestRun("Talk to ts1") +t.Processes.Default.StartBefore(ts1) +t.Processes.Default.StartBefore(ts2) +t.MakeCurlCommand("127.0.0.1:{port}".format(port=ts1.Variables.port)) +t.ReturnCode = 0 +t.StillRunningAfter = ts1 +t.StillRunningAfter += ts2 diff --git a/tests/gold_tests/bigobj/bigobj.test.py b/tests/gold_tests/bigobj/bigobj.test.py index 9f3235f5c6a..e2901102936 100644 --- a/tests/gold_tests/bigobj/bigobj.test.py +++ b/tests/gold_tests/bigobj/bigobj.test.py @@ -19,6 +19,7 @@ Test.Summary = ''' Test PUSHing an object into the cache and the GETting it with a few variations on the client connection protocol. ''' +Test.SkipIf(Condition.CurlUds()) # NOTE: You can also use this to test client-side communication when GET-ing very large (multi-GB) objects # by increasing the value of the obj_kilobytes variable below. (But do not increase it on any shared branch diff --git a/tests/gold_tests/bigobj/bigobj_uds.test.py b/tests/gold_tests/bigobj/bigobj_uds.test.py new file mode 100644 index 00000000000..eb9942bf73c --- /dev/null +++ b/tests/gold_tests/bigobj/bigobj_uds.test.py @@ -0,0 +1,112 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +Test.Summary = ''' +Test PUSHing an object into the cache and the GETting it with a few variations on the client connection protocol. +''' + +# NOTE: You can also use this to test client-side communication when GET-ing very large (multi-GB) objects +# by increasing the value of the obj_kilobytes variable below. (But do not increase it on any shared branch +# that we do CI runs on.) + +Test.SkipUnless(Condition.HasCurlFeature('http2')) + +ts = Test.MakeATSProcess("ts1", enable_tls=True) +ts.addDefaultSSLFiles() + +ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'http|dns|cache', + 'proxy.config.http.cache.required_headers': 0, # No required headers for caching + 'proxy.config.http.push_method_enabled': 1, + 'proxy.config.proxy_name': 'Poxy_Proxy', # This will be the server name. + 'proxy.config.ssl.server.cert.path': ts.Variables.SSLDir, + 'proxy.config.ssl.server.private_key.path': ts.Variables.SSLDir, + 'proxy.config.url_remap.remap_required': 0 + }) + +ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') + +ts.Disk.remap_config.AddLine(f'map https://localhost:{ts.Variables.ssl_port} http://localhost:{ts.Variables.port}') +ts.Disk.remap_config.AddLine(f'map https://localhost:{ts.Variables.ssl_portv6} http://localhost:{ts.Variables.port}') + +# Size of object to get. (NOTE: If you increase this significantly you may also have to increase cache +# capacity in tests/gold_tests/autest-size/min_cfg/storage.config. Also, for very large objects, if +# proxy.config.diags.debug.enabled is 1, the PUSH request will timeout and fail.) +# +obj_kilobytes = 10 * 1024 +obj_bytes = obj_kilobytes * 10 +header = "HTTP/1.1 200 OK\r\nContent-length: {}\r\n\r\n".format(obj_bytes) + + +def create_pushfile(): + f = open(Test.RunDirectory + "/objfile", "w") + f.write(header) + f.write("x" * obj_bytes) + f.close() + return True + + +tr = Test.AddTestRun("PUSH an object to the cache") +# Delay on readiness of TS IPv4 ssl port +tr.Processes.Default.StartBefore(ts, ready=lambda: create_pushfile()) +# Put object with URL http://localhost/bigobj in cache using PUSH request. +tr.MakeCurlCommand( + "-v -H 'Content-Type: application/octet-stream' --data-binary @{}/objfile -X PUSH http://localhost:{}/bigobj -H 'Content-Length:{}'" + .format(Test.RunDirectory, ts.Variables.port, + len(header) + obj_bytes)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/1.1 201 Created", "The PUSH request should have succeeded") + +tr = Test.AddTestRun("GET bigobj: cleartext, HTTP/1.1, IPv4") +tr.MakeCurlCommand(f'--verbose --http1.1 http://localhost:{ts.Variables.port}/bigobj') +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/1.1 200 OK", "Should fetch pushed object") +tr.Processes.Default.Streams.All = Testers.ContainsExpression("Content-length: 102400", "Content size should be accurate") + +# Verify that PUSH requests are rejected when push_method_enabled is 0 (the +# default configuration). +ts = Test.MakeATSProcess("ts2", enable_tls=True) +ts.addDefaultSSLFiles() + +ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'http|dns|cache', + 'proxy.config.http.cache.required_headers': 0, # No required headers for caching + 'proxy.config.proxy_name': 'Poxy_Proxy', # This will be the server name. + 'proxy.config.ssl.server.cert.path': ts.Variables.SSLDir, + 'proxy.config.ssl.server.private_key.path': ts.Variables.SSLDir, + 'proxy.config.url_remap.remap_required': 0 + }) + +ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') + +ts.Disk.remap_config.AddLine(f'map https://localhost:{ts.Variables.ssl_port} http://localhost:{ts.Variables.port}') +ts.Disk.remap_config.AddLine(f'map https://localhost:{ts.Variables.ssl_portv6} http://localhost:{ts.Variables.port}') + +tr = Test.AddTestRun("PUSH request is rejected when push_method_enabled is 0") +tr.Processes.Default.StartBefore(ts) +tr.MakeCurlCommand( + "-v -H 'Content-Type: application/octet-stream' --data-binary @{}/objfile -X PUSH http://localhost:{}/bigobj -H 'Content-Length:{}'" + .format(Test.RunDirectory, ts.Variables.port, + len(header) + obj_bytes)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.All = Testers.ContainsExpression( + "403 Access Denied", "The PUSH request should have received a 403 response.") diff --git a/tests/gold_tests/cache/background_fill.test.py b/tests/gold_tests/cache/background_fill.test.py index 8546b0b547d..d7a281cf946 100644 --- a/tests/gold_tests/cache/background_fill.test.py +++ b/tests/gold_tests/cache/background_fill.test.py @@ -20,6 +20,7 @@ Test.Summary = 'Exercise Background Fill' Test.SkipUnless(Condition.HasCurlFeature('http2'), Condition.HasProxyVerifierVersion('2.8.0')) +Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True diff --git a/tests/gold_tests/cache/background_fill_uds.test.py b/tests/gold_tests/cache/background_fill_uds.test.py new file mode 100644 index 00000000000..a6313d71ec3 --- /dev/null +++ b/tests/gold_tests/cache/background_fill_uds.test.py @@ -0,0 +1,132 @@ +''' +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from enum import Enum +import os + +Test.Summary = 'Exercise Background Fill' +Test.SkipUnless(Condition.HasCurlFeature('http2'), Condition.HasProxyVerifierVersion('2.8.0')) +Test.ContinueOnFail = True + + +class BackgroundFillTest: + """ + https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#proxy-config-http-background-fill-completed-threshold + """ + + class State(Enum): + """ + State of process + """ + INIT = 0 + RUNNING = 1 + + def __init__(self): + self.state = self.State.INIT + self.ts = {} + self.__setupOriginServer() + self.__setupTS(['for_httpbin', 'for_pv']) + + def __setupOriginServer(self): + self.httpbin = Test.MakeHttpBinServer("httpbin") + self.pv_server = Test.MakeVerifierServerProcess("server0", "replay/bg_fill.yaml") + + def __setupTS(self, ts_names=['default']): + for name in ts_names: + self.ts[name] = Test.MakeATSProcess(name, select_ports=True, enable_tls=True, enable_cache=True) + + self.ts[name].addDefaultSSLFiles() + self.ts[name].Disk.ssl_multicert_config.AddLine("dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key") + + # Only add uds path to TS instance + uds_path = "" + if name == 'for_httpbin': + uds_path = os.path.join(Test.RunDirectory, 'uds.socket') + + self.ts[name].Disk.records_config.update( + { + "proxy.config.http.server_ports": + f"{self.ts[name].Variables.port} {self.ts[name].Variables.ssl_port}:ssl {uds_path}", + "proxy.config.http.background_fill_active_timeout": "0", + "proxy.config.http.background_fill_completed_threshold": "0.0", + "proxy.config.http.cache.required_headers": 0, # Force cache + "proxy.config.http.insert_response_via_str": 2, + 'proxy.config.http.server_session_sharing.pool': 'thread', + 'proxy.config.http.server_session_sharing.match': 'ip,sni,cert', + 'proxy.config.exec_thread.autoconfig.enabled': 0, + 'proxy.config.exec_thread.limit': 1, + 'proxy.config.ssl.server.cert.path': f"{self.ts[name].Variables.SSLDir}", + 'proxy.config.ssl.server.private_key.path': f"{self.ts[name].Variables.SSLDir}", + 'proxy.config.ssl.client.alpn_protocols': 'h2,http/1.1', + 'proxy.config.ssl.client.verify.server.policy': 'PERMISSIVE', + "proxy.config.diags.debug.enabled": 3, + "proxy.config.diags.debug.tags": "http", + }) + + if name == 'for_httpbin' or name == 'default': + self.ts[name].Disk.remap_config.AddLines([ + f"map / http://127.0.0.1:{self.httpbin.Variables.Port}", + ]) + else: + self.ts[name].Disk.remap_config.AddLines([ + f'map / https://127.0.0.1:{self.pv_server.Variables.https_port}', + ]) + + def __checkProcessBefore(self, tr): + if self.state == self.State.RUNNING: + tr.StillRunningBefore = self.httpbin + tr.StillRunningBefore = self.pv_server + tr.StillRunningBefore = self.ts['for_httpbin'] + tr.StillRunningBefore = self.ts['for_pv'] + else: + tr.Processes.Default.StartBefore(self.httpbin, ready=When.PortOpen(self.httpbin.Variables.Port)) + tr.Processes.Default.StartBefore(self.pv_server) + tr.Processes.Default.StartBefore(self.ts['for_httpbin']) + tr.Processes.Default.StartBefore(self.ts['for_pv']) + self.state = self.State.RUNNING + + def __checkProcessAfter(self, tr): + assert (self.state == self.State.RUNNING) + tr.StillRunningAfter = self.httpbin + tr.StillRunningAfter = self.pv_server + tr.StillRunningAfter = self.ts['for_httpbin'] + tr.StillRunningAfter = self.ts['for_pv'] + + def __testCase0(self): + """ + HTTP/1.1 over TCP + """ + tr = Test.AddTestRun() + self.__checkProcessBefore(tr) + tr.MakeCurlCommandMulti( + f""" +{{curl}} -X PURGE --http1.1 -vs http://127.0.0.1:{self.ts['for_httpbin'].Variables.port}/drip?duration=4; +timeout 2 {{curl}} --http1.1 -vs http://127.0.0.1:{self.ts['for_httpbin'].Variables.port}/drip?duration=4; +sleep 4; +{{curl}} --http1.1 -vs http://127.0.0.1:{self.ts['for_httpbin'].Variables.port}/drip?duration=4 +""") + tr.Processes.Default.ReturnCode = 0 + tr.Processes.Default.Streams.stderr = Testers.Any( + "gold/background_fill_0_stderr_H.gold", "gold/background_fill_0_stderr_W.gold") + self.__checkProcessAfter(tr) + + def run(self): + self.__testCase0() + + +BackgroundFillTest().run() diff --git a/tests/gold_tests/cache/cache-control.test.py b/tests/gold_tests/cache/cache-control.test.py index a1c0b00de8a..7590e06329f 100644 --- a/tests/gold_tests/cache/cache-control.test.py +++ b/tests/gold_tests/cache/cache-control.test.py @@ -20,7 +20,7 @@ Test.Summary = ''' Test cached responses and requests with bodies ''' - +Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True # Define default ATS diff --git a/tests/gold_tests/cache/cache-control_uds.test.py b/tests/gold_tests/cache/cache-control_uds.test.py new file mode 100644 index 00000000000..60b2e9cf143 --- /dev/null +++ b/tests/gold_tests/cache/cache-control_uds.test.py @@ -0,0 +1,367 @@ +''' +Test cached responses and requests with bodies +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +Test.Summary = ''' +Test cached responses and requests with bodies +''' + +Test.ContinueOnFail = True + +# Define default ATS +ts = Test.MakeATSProcess("ts") +server = Test.MakeOriginServer("server") + +# **testname is required** +testName = "" +request_header1 = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +response_header1 = { + "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nCache-Control: max-age=300\r\n\r\n", + "timestamp": "1469733493.993", + "body": "xxx" +} +request_header2 = { + "headers": "GET /no_cache_control HTTP/1.1\r\nHost: www.example.com\r\n\r\n", + "timestamp": "1469733493.993", + "body": "" +} +response_header2 = { + "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", + "timestamp": "1469733493.993", + "body": "the flinstones" +} +request_header3 = { + "headers": "GET /max_age_10sec HTTP/1.1\r\nHost: www.example.com\r\n\r\n", + "timestamp": "1469733493.993", + "body": "" +} +response_header3 = { + "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nCache-Control: max-age=10,public\r\n\r\n", + "timestamp": "1469733493.993", + "body": "yabadabadoo" +} +server.addResponse("sessionlog.json", request_header1, response_header1) +server.addResponse("sessionlog.json", request_header2, response_header2) +server.addResponse("sessionlog.json", request_header3, response_header3) + +# ATS Configuration +ts.Disk.plugin_config.AddLine('xdebug.so --enable=x-cache,x-cache-key,via') +ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'http', + 'proxy.config.http.response_via_str': 3, + 'proxy.config.http.insert_age_in_response': 0, + }) + +ts.Disk.remap_config.AddLine('map / http://127.0.0.1:{0}'.format(server.Variables.Port)) + +# Test 1 - 200 response and cache fill +tr = Test.AddTestRun() +tr.Processes.Default.StartBefore(server) +tr.Processes.Default.StartBefore(Test.Processes.ts) +tr.MakeCurlCommand( + '-s -D - -v --http1.1 -H "x-debug: x-cache,via" -H "Host: www.example.com" http://localhost:{port}/max_age_10sec'.format( + port=ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "gold/cache_and_req_body-miss.gold" +tr.StillRunningAfter = ts + +# Test 2 - 200 cached response and using netcat +tr = Test.AddTestRun() +tr.Processes.Default.Command = "printf 'GET /max_age_10sec HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format( + port=ts.Variables.port) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "gold/cache_and_req_body-hit.gold" +tr.StillRunningAfter = ts + +# Test 3 - response doesn't have cache control directive, so cache-miss every +# time +tr = Test.AddTestRun() +tr.Processes.Default.Command = "printf 'GET /no_cache_control HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format( + port=ts.Variables.port) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "gold/cache_no_cc.gold" +tr.StillRunningAfter = ts + +# Test 4 - hit stale cache. +tr = Test.AddTestRun() +tr.Processes.Default.Command = "sleep 15; printf 'GET /max_age_10sec HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format( + port=ts.Variables.port) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "gold/cache_hit_stale.gold" +tr.StillRunningAfter = ts + +# Test 5 - only-if-cached. 504 "Not Cached" should be returned if not in cache +tr = Test.AddTestRun() +tr.Processes.Default.Command = "printf 'GET /no_cache_control HTTP/1.1\r\n''Cache-Control: only-if-cached\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''Cache-control: max-age=300\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format( + port=ts.Variables.port) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "gold/cache_no_cache.gold" +tr.StillRunningAfter = ts + +# +# Verify correct handling of various max-age directives in both clients and +# responses. +# +ts = Test.MakeATSProcess("ts-for-proxy-verifier") +replay_file = "replay/cache-control-max-age.replay.yaml" +server = Test.MakeVerifierServerProcess("proxy-verifier-server", replay_file) +ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'http', + 'proxy.config.http.insert_age_in_response': 0, + + # Disable ignoring max-age in the client request so we can test that + # behavior too. + 'proxy.config.http.cache.ignore_client_cc_max_age': 0, + }) +ts.Disk.remap_config.AddLine('map / http://127.0.0.1:{0}'.format(server.Variables.http_port)) +tr = Test.AddTestRun("Verify correct max-age cache-control behavior.") +tr.Processes.Default.StartBefore(server) +tr.Processes.Default.StartBefore(ts) +tr.AddVerifierClientProcess("proxy-verifier-client", replay_file, http_ports=[ts.Variables.port]) + +# +# Verify correct handling of various s-maxage directives in responses. +# +ts = Test.MakeATSProcess("ts-s-maxage") +replay_file = "replay/cache-control-s-maxage.replay.yaml" +server = Test.MakeVerifierServerProcess("s-maxage-server", replay_file) +ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'http', + 'proxy.config.http.insert_age_in_response': 0, + }) +ts.Disk.remap_config.AddLine('map / http://127.0.0.1:{0}'.format(server.Variables.http_port)) +tr = Test.AddTestRun("Verify correct max-age cache-control behavior.") +tr.Processes.Default.StartBefore(server) +tr.Processes.Default.StartBefore(ts) +tr.AddVerifierClientProcess("s-maxage-client", replay_file, http_ports=[ts.Variables.port]) + +# +# Verify correct interaction between cache-control no-cache and pragma header +# +ts = Test.MakeATSProcess("ts-cache-control-pragma") +ts.Disk.records_config.update({ + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'http|cache', +}) +tr = Test.AddTestRun("Verify Pragma: no-cache does not conflict with Cache-Control headers") +replay_file = "replay/cache-control-pragma.replay.yaml" +server = tr.AddVerifierServerProcess("pragma-server", replay_file) +tr.AddVerifierClientProcess("pragma-client", replay_file, http_ports=[ts.Variables.port]) +ts.Disk.remap_config.AddLine('map / http://127.0.0.1:{0}'.format(server.Variables.http_port)) +tr.Processes.Default.StartBefore(server) +tr.Processes.Default.StartBefore(ts) +tr.StillRunningAfter = ts + + +class RequestCacheControlDefaultTest: + # Verify the proper handling of cache-control directives in requests in + # default configuration + requestCacheControlReplayFile = "replay/request-cache-control-default.replay.yaml" + + def __init__(self): + self.setupOriginServer() + self.setupTS() + + def setupOriginServer(self): + self.server = Test.MakeVerifierServerProcess( + "request-cache-control-default-verifier-server", self.requestCacheControlReplayFile) + + def setupTS(self): + self.ts = Test.MakeATSProcess("ts-request-cache-control-default") + self.ts.Disk.records_config.update({ + "proxy.config.diags.debug.enabled": 1, + "proxy.config.diags.debug.tags": "http", + }) + self.ts.Disk.remap_config.AddLine(f"map / http://127.0.0.1:{self.server.Variables.http_port}/",) + + def runTraffic(self): + tr = Test.AddTestRun("Verify the proper handling of cache-control directives in requests in default configuration") + tr.AddVerifierClientProcess( + "request-cache-control-default-client", + self.requestCacheControlReplayFile, + http_ports=[self.ts.Variables.port], + other_args='--thread-limit 1') + tr.Processes.Default.StartBefore(self.server) + tr.Processes.Default.StartBefore(self.ts) + tr.StillRunningAfter = self.server + tr.StillRunningAfter = self.ts + + def run(self): + self.runTraffic() + + +RequestCacheControlDefaultTest().run() + + +class RequestCacheControlHonorClientTest: + # Verify the proper handling of cache-control directives in requests when + # ATS is configured to honor client's request to bypass the cache + requestCacheControlReplayFile = "replay/request-cache-control-honor-client.replay.yaml" + + def __init__(self): + self.setupOriginServer() + self.setupTS() + + def setupOriginServer(self): + self.server = Test.MakeVerifierServerProcess( + "request-cache-control-honor-client-verifier-server", self.requestCacheControlReplayFile) + + def setupTS(self): + self.ts = Test.MakeATSProcess("ts-request-cache-control-honor-client") + self.ts.Disk.records_config.update( + { + "proxy.config.diags.debug.enabled": 1, + "proxy.config.diags.debug.tags": "http", + # Configured to honor client requests to bypass the cache + "proxy.config.http.cache.ignore_client_no_cache": 0 + }) + self.ts.Disk.remap_config.AddLine(f"map / http://127.0.0.1:{self.server.Variables.http_port}/",) + + # Verify logs for the request containing no-cache + self.ts.Disk.traffic_out.Content += Testers.ContainsExpression( + "Revalidate document with server", "Verify that ATS honors the no-cache and performs a revalidation.") + # Verify logs for the request containing no-store + self.ts.Disk.traffic_out.Content += Testers.ContainsExpression( + "client does not permit storing, and cache control does not say to ignore client no-cache", + "Verify that ATS honors the no-store.") + + def runTraffic(self): + tr = Test.AddTestRun( + "Verify the proper handling of cache-control directives in requests when ATS is configured to honor client's request to bypass the cache" + ) + tr.AddVerifierClientProcess( + "request-cache-control-honor-client-client", + self.requestCacheControlReplayFile, + http_ports=[self.ts.Variables.port], + other_args='--thread-limit 1') + tr.Processes.Default.StartBefore(self.server) + tr.Processes.Default.StartBefore(self.ts) + tr.StillRunningAfter = self.server + tr.StillRunningAfter = self.ts + + def run(self): + self.runTraffic() + + +RequestCacheControlHonorClientTest().run() + + +class ResponseCacheControlDefaultTest: + # Verify the proper handling of cache-control directives in responses in + # default configuration + responseCacheControlReplayFile = "replay/response-cache-control-default.replay.yaml" + + def __init__(self): + self.setupOriginServer() + self.setupTS() + + def setupOriginServer(self): + self.server = Test.MakeVerifierServerProcess( + "response-cache-control-default-verifier-server", self.responseCacheControlReplayFile) + + def setupTS(self): + self.ts = Test.MakeATSProcess("ts-response-cache-control-default") + self.ts.Disk.records_config.update({ + "proxy.config.diags.debug.enabled": 1, + "proxy.config.diags.debug.tags": "http", + }) + self.ts.Disk.remap_config.AddLine(f"map / http://127.0.0.1:{self.server.Variables.http_port}/",) + + # Verify logs for the response containing no-cache + self.ts.Disk.traffic_out.Content += Testers.ContainsExpression( + "Revalidate document with server", "Verify that ATS honors the no-cache in response and performs a revalidation.") + # Verify logs for the response containing no-store + self.ts.Disk.traffic_out.Content += Testers.ContainsExpression( + "server does not permit storing and config file does not indicate that server directive should be ignored", + "Verify that ATS honors the no-store in response and bypasses the cache.") + + def runTraffic(self): + tr = Test.AddTestRun("Verify the proper handling of cache-control directives in responses in default configuration") + tr.AddVerifierClientProcess( + "response-cache-control-client-default", + self.responseCacheControlReplayFile, + http_ports=[self.ts.Variables.port], + other_args='--thread-limit 1') + tr.Processes.Default.StartBefore(self.server) + tr.Processes.Default.StartBefore(self.ts) + tr.StillRunningAfter = self.server + tr.StillRunningAfter = self.ts + + def run(self): + self.runTraffic() + + +ResponseCacheControlDefaultTest().run() + + +class ResponseCacheControlIgnoredTest: + # Verify the proper handling of cache-control directives in responses when + # ATS is configured to ignore server's request to bypass the cache + responseCacheControlReplayFile = "replay/response-cache-control-ignored.replay.yaml" + + def __init__(self): + self.setupOriginServer() + self.setupTS() + + def setupOriginServer(self): + self.server = Test.MakeVerifierServerProcess( + "response-cache-control-ignored-verifier-server", self.responseCacheControlReplayFile) + + def setupTS(self): + self.ts = Test.MakeATSProcess("ts-response-cache-control-ignored") + self.ts.Disk.records_config.update( + { + "proxy.config.diags.debug.enabled": 1, + "proxy.config.diags.debug.tags": "http", + "proxy.config.http.cache.ignore_server_no_cache": 1 + }) + self.ts.Disk.remap_config.AddLine(f"map / http://127.0.0.1:{self.server.Variables.http_port}/",) + + # Verify logs for the response containing no-cache or no-store + self.ts.Disk.traffic_out.Content += Testers.ExcludesExpression( + "Revalidate document with server", + "Verify that ATS ignores the no-cache in response and therefore doesn't perform a revalidation.") + self.ts.Disk.traffic_out.Content += Testers.ExcludesExpression( + "server does not permit storing and config file does not indicate that server directive should be ignored", + "Verify that ATS ignores the no-store in response and caches the responses despite its presence.") + + def runTraffic(self): + tr = Test.AddTestRun( + "Verify the proper handling of cache-control directives in responses when ATS is configured to ignore server's request to bypass the cache" + ) + tr.AddVerifierClientProcess( + "response-cache-control-client-ignored", + self.responseCacheControlReplayFile, + http_ports=[self.ts.Variables.port], + other_args='--thread-limit 1') + tr.Processes.Default.StartBefore(self.server) + tr.Processes.Default.StartBefore(self.ts) + tr.StillRunningAfter = self.server + tr.StillRunningAfter = self.ts + + def run(self): + self.runTraffic() + + +ResponseCacheControlIgnoredTest().run() diff --git a/tests/gold_tests/chunked_encoding/chunked_encoding.test.py b/tests/gold_tests/chunked_encoding/chunked_encoding.test.py index adc0d995b20..68c1cb60e06 100644 --- a/tests/gold_tests/chunked_encoding/chunked_encoding.test.py +++ b/tests/gold_tests/chunked_encoding/chunked_encoding.test.py @@ -23,6 +23,7 @@ ''' Test.SkipUnless(Condition.HasCurlFeature('http2')) +Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True Test.GetTcpPort("upstream_port") diff --git a/tests/gold_tests/chunked_encoding/chunked_encoding_h2.test.py b/tests/gold_tests/chunked_encoding/chunked_encoding_h2.test.py index 318a1d5eaa0..a52fcb9005f 100644 --- a/tests/gold_tests/chunked_encoding/chunked_encoding_h2.test.py +++ b/tests/gold_tests/chunked_encoding/chunked_encoding_h2.test.py @@ -19,6 +19,7 @@ Test.Summary = ''' Test interaction of H2 and chunked encoding ''' +Test.SkipIf(Condition.CurlUds()) Test.SkipUnless( Condition.HasProgram("nghttp", "Nghttp need to be installed on system for this test to work"), diff --git a/tests/gold_tests/chunked_encoding/chunked_encoding_uds.test.py b/tests/gold_tests/chunked_encoding/chunked_encoding_uds.test.py new file mode 100644 index 00000000000..b61615dabc0 --- /dev/null +++ b/tests/gold_tests/chunked_encoding/chunked_encoding_uds.test.py @@ -0,0 +1,238 @@ +''' +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +Test.Summary = ''' +Test chunked encoding processing +''' + +Test.SkipUnless(Condition.HasCurlFeature('http2')) +Test.ContinueOnFail = True + +Test.GetTcpPort("upstream_port") + +# Define default ATS +ts = Test.MakeATSProcess("ts", enable_tls=True) +server = Test.MakeOriginServer("server") +server2 = Test.MakeOriginServer("server2", ssl=True) +server3 = Test.MakeOriginServer("server3") + +server4 = Test.Processes.Process( + "server4", "bash -c '" + Test.TestDirectory + "/server4.sh {} outserver4'".format(Test.Variables.upstream_port)) + +testName = "" +request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +response_header = { + "headers": "HTTP/1.1 200 OK\r\nServer: uServer\r\nConnection: close\r\nTransfer-Encoding: chunked\r\n\r\n", + "timestamp": "1469733493.993", + "body": "" +} + +request_header2 = { + "headers": + "POST / HTTP/1.1\r\nHost: www.anotherexample.com\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 11\r\n\r\n", + "timestamp": "1415926535.898", + "body": "knock knock" +} +response_header2 = { + "headers": "HTTP/1.1 200 OK\r\nServer: uServer\r\nConnection: close\r\nTransfer-Encoding: chunked\r\n\r\n", + "timestamp": "1415926535.898", + "body": "12345678901234567890" +} + +request_header3 = { + "headers": + "POST / HTTP/1.1\r\nHost: www.yetanotherexample.com\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 11\r\n\r\n", + "timestamp": "1415926535.898", + "body": "knock knock" +} +response_header3 = { + "headers": "HTTP/1.1 200 OK\r\nServer: uServer\r\nConnection: close\r\nTransfer-Encoding: chunked\r\n\r\n", + "timestamp": "1415926535.898", + "body": "" +} + +server.addResponse("sessionlog.json", request_header, response_header) +server2.addResponse("sessionlog.json", request_header2, response_header2) +server3.addResponse("sessionlog.json", request_header3, response_header3) + +# add ssl materials like key, certificates for the server +ts.addDefaultSSLFiles() + +ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'http', + 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), + 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), + 'proxy.config.ssl.client.verify.server.policy': 'PERMISSIVE', + }) + +ts.Disk.remap_config.AddLine('map http://www.example.com http://127.0.0.1:{0}'.format(server.Variables.Port)) +ts.Disk.remap_config.AddLine('map http://www.yetanotherexample.com http://127.0.0.1:{0}'.format(server3.Variables.Port)) +ts.Disk.remap_config.AddLine( + 'map https://www.anotherexample.com https://127.0.0.1:{0}'.format(server2.Variables.SSL_Port, ts.Variables.ssl_port)) +ts.Disk.remap_config.AddLine('map / http://127.0.0.1:{0}'.format(Test.Variables.upstream_port)) + +ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') + +# smuggle-client is built via `make`. Here we copy the built binary down to the +# test directory so that the test runs in this file can use it. +Test.Setup.Copy(os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'chunked_encoding', 'smuggle-client')) + +# HTTP1.1 GET: www.example.com +tr = Test.AddTestRun() +tr.TimeOut = 5 +tr.MakeCurlCommand('--http1.1 -H "Host: www.example.com" "http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.StartBefore(server) +tr.Processes.Default.StartBefore(server2) +tr.Processes.Default.StartBefore(server3) +# Delay on readiness of our ssl ports +tr.Processes.Default.StartBefore(Test.Processes.ts) +tr.Processes.Default.Streams.stderr = "gold/chunked_GET_200_uds.gold" +tr.StillRunningAfter = server +tr.StillRunningAfter = ts + +# HTTP1.1 POST: www.yetanotherexample.com Host, explicit size +tr = Test.AddTestRun() +tr.TimeOut = 5 +tr.MakeCurlCommand('http://127.0.0.1:{0} -H "Host: www.yetanotherexample.com" --verbose -d "knock knock"'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stderr = "gold/chunked_POST_200.gold" +tr.StillRunningAfter = server + +# HTTP1.1 POST: www.example.com Host, chunked body +tr = Test.AddTestRun() +tr.TimeOut = 5 +tr.MakeCurlCommand( + 'http://127.0.0.1:{0} -H "Host: www.yetanotherexample.com" --verbose -H "Transfer-Encoding: chunked" -d "Knock knock"'.format( + ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stderr = "gold/chunked_POST_200.gold" +tr.StillRunningAfter = server + +server4_out = Test.Disk.File("outserver4") +server4_out.Content = Testers.ExcludesExpression("sneaky", "Extra body bytes should not be delivered") + +# HTTP/1.1 Try to smuggle another request to the origin +tr = Test.AddTestRun() +tr.Processes.Default.StartBefore(server4) +tr.TimeOut = 5 +tr.Processes.Default.Command = "./smuggle-client 127.0.0.1 {0}".format(ts.Variables.ssl_port) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.All = Testers.ExcludesExpression("content-length:", "Response should not include content length") +# Transfer encoding to origin, but no content-length +# No extra bytes in body seen by origin + + +class TestChunkedTrailers: + """Verify chunked trailer proxy behavior.""" + + _chunked_dropped_replay: str = "replays/chunked_trailer_dropped.replay.yaml" + _proxied_dropped_replay: str = "replays/chunked_trailer_proxied.replay.yaml" + + def __init__(self, configure_drop_trailers: bool): + """Create a test to verify chunked trailer behavior. + + :param configure_drop_trailers: Whether to configure ATS to drop + trailers or not. + """ + self._configure_drop_trailers = configure_drop_trailers + self._replay_file = self._chunked_dropped_replay if configure_drop_trailers else self._proxied_dropped_replay + behavior_description = "drop" if configure_drop_trailers else "proxy" + tr = Test.AddTestRun(f'Verify chunked tailers behavior: {behavior_description}') + self._configure_dns(tr) + self._configure_server(tr) + self._configure_ts(tr) + self._configure_client(tr) + + def _configure_dns(self, tr: 'TestRun') -> "Process": + """Configure DNS for the test run. + + :param tr: The TestRun to configure DNS for. + :return: The DNS process. + """ + name = 'dns-drop-trailers' if self._configure_drop_trailers else 'dns-proxy-trailers' + self._dns = tr.MakeDNServer(name, default='127.0.0.1') + return self._dns + + def _configure_server(self, tr: 'TestRun') -> 'Process': + """Configure the origin server for the test run. + + :param tr: The TestRun to configure the server for. + :return: The origin server process. + """ + name = 'server-drop-trailers' if self._configure_drop_trailers else 'server-proxy-trailers' + self._server = tr.AddVerifierServerProcess(name, self._replay_file) + if self._configure_drop_trailers: + self._server.Streams.All += Testers.ExcludesExpression('Client: ATS', 'Verify the Client trailer was dropped.') + self._server.Streams.All += Testers.ExcludesExpression('ETag: "abc"', 'Verify the ETag trailer was dropped.') + else: + self._server.Streams.All += Testers.ContainsExpression('Client: ATS', 'Verify the Client trailer was proxied.') + self._server.Streams.All += Testers.ContainsExpression('ETag: "abc"', 'Verify the ETag trailer was proxied.') + return self._server + + def _configure_ts(self, tr: 'TestRun') -> 'Process': + """Configure ATS for the test run. + + :param tr: The TestRun to configure ATS for. + :return: The ATS process. + """ + name = 'ts-drop-trailers' if self._configure_drop_trailers else 'ts-proxy-trailers' + ts = tr.MakeATSProcess(name, enable_cache=False) + self._ts = ts + port = self._server.Variables.http_port + ts.Disk.remap_config.AddLine(f'map / http://backend.example.com:{port}/') + ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'http', + 'proxy.config.dns.nameservers': f'127.0.0.1:{self._dns.Variables.Port}', + 'proxy.config.dns.resolv_conf': 'NULL' + }) + if not self._configure_drop_trailers: + ts.Disk.records_config.update({ + 'proxy.config.http.drop_chunked_trailers': 0, + }) + return ts + + def _configure_client(self, tr: 'TestRun') -> 'Process': + """Configure the client for the test run. + + :param tr: The TestRun to configure the client for. + :return: The client process. + """ + name = 'client-drop-trailers' if self._configure_drop_trailers else 'client-proxy-trailers' + self._client = tr.AddVerifierClientProcess(name, self._replay_file, http_ports=[self._ts.Variables.port]) + self._client.StartBefore(self._dns) + self._client.StartBefore(self._server) + self._client.StartBefore(self._ts) + + if self._configure_drop_trailers: + self._client.Streams.All += Testers.ExcludesExpression('Sever: ATS', 'Verify the Server trailer was dropped.') + self._client.Streams.All += Testers.ExcludesExpression('ETag: "def"', 'Verify the ETag trailer was dropped.') + else: + self._client.Streams.All += Testers.ContainsExpression('Sever: ATS', 'Verify the Server trailer was proxied.') + self._client.Streams.All += Testers.ContainsExpression('ETag: "def"', 'Verify the ETag trailer was proxied.') + return self._client + + +TestChunkedTrailers(configure_drop_trailers=True) +TestChunkedTrailers(configure_drop_trailers=False) diff --git a/tests/gold_tests/chunked_encoding/gold/chunked_GET_200.gold b/tests/gold_tests/chunked_encoding/gold/chunked_GET_200.gold index ddf57d3d3e0..cd121917092 100644 --- a/tests/gold_tests/chunked_encoding/gold/chunked_GET_200.gold +++ b/tests/gold_tests/chunked_encoding/gold/chunked_GET_200.gold @@ -1,5 +1,5 @@ `` -> GET http://www.example.com/ HTTP/1.1 +> GET `` HTTP/1.1 > Host: www.example.com`` > User-Agent: curl/`` > Accept: */* diff --git a/tests/gold_tests/chunked_encoding/gold/chunked_GET_200_uds.gold b/tests/gold_tests/chunked_encoding/gold/chunked_GET_200_uds.gold new file mode 100644 index 00000000000..e2b5594b734 --- /dev/null +++ b/tests/gold_tests/chunked_encoding/gold/chunked_GET_200_uds.gold @@ -0,0 +1,13 @@ +`` +> GET `` HTTP/1.1 +> Host: www.example.com`` +> User-Agent: curl/`` +> Accept: */* +`` +< HTTP/1.1 200 OK +< Server: ATS/`` +< Date:`` +< Age: `` +< Transfer-Encoding: chunked`` +< Connection: keep-alive`` +`` diff --git a/tests/gold_tests/connect/connect.test.py b/tests/gold_tests/connect/connect.test.py index f6ff46670c3..aac7a3a9dd0 100644 --- a/tests/gold_tests/connect/connect.test.py +++ b/tests/gold_tests/connect/connect.test.py @@ -22,6 +22,7 @@ Test.Summary = 'Exercise HTTP CONNECT Method' Test.ContinueOnFail = True +Test.SkipIf(Condition.CurlUds()) class ConnectTest: diff --git a/tests/gold_tests/connect/connect_uds.test.py b/tests/gold_tests/connect/connect_uds.test.py new file mode 100644 index 00000000000..6766cabec57 --- /dev/null +++ b/tests/gold_tests/connect/connect_uds.test.py @@ -0,0 +1,247 @@ +''' +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from enum import Enum +import os +import re + +Test.Summary = 'Exercise HTTP CONNECT Method' +Test.ContinueOnFail = True + + +class ConnectTest: + + class State(Enum): + """ + State of process + """ + INIT = 0 + RUNNING = 1 + + def __init__(self): + self.state = self.State.INIT + self.__setupOriginServer() + self.__setupTS() + + def __setupOriginServer(self): + self.httpbin = Test.MakeHttpBinServer("httpbin") + + def __setupTS(self): + self.ts = Test.MakeATSProcess("ts") + + uds_path = os.path.join(Test.RunDirectory, 'uds.socket') + self.ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'http|connect', + 'proxy.config.http.server_ports': f"{self.ts.Variables.port} {uds_path}", + 'proxy.config.http.connect_ports': f"{self.httpbin.Variables.Port}", + }) + + self.ts.Disk.remap_config.AddLines([ + f"map http://foo.com/ http://127.0.0.1:{self.httpbin.Variables.Port}/", + ]) + + self.ts.Disk.logging_yaml.AddLines( + ''' +logging: + formats: + - name: common + format: '% - % [%] "% % %" % %' + logs: + - filename: access + format: common +'''.split("\n")) + + def __checkProcessBefore(self, tr): + if self.state == self.State.RUNNING: + tr.StillRunningBefore = self.httpbin + tr.StillRunningBefore = self.ts + else: + tr.Processes.Default.StartBefore(self.httpbin, ready=When.PortOpen(self.httpbin.Variables.Port)) + tr.Processes.Default.StartBefore(self.ts) + self.state = self.State.RUNNING + + def __checkProcessAfter(self, tr): + assert (self.state == self.State.RUNNING) + tr.StillRunningAfter = self.httpbin + tr.StillRunningAfter = self.ts + + def __testCase0(self): + tr = Test.AddTestRun() + self.__checkProcessBefore(tr) + tr.MakeCurlCommand(f"-v --fail -s -X CONNECT -p -x 127.0.0.1:{self.ts.Variables.port} 'http://foo.com/get'") + tr.Processes.Default.ReturnCode = 0 + tr.Processes.Default.Streams.stderr = "gold/connect_0_stderr_uds.gold" + tr.Processes.Default.TimeOut = 3 + self.__checkProcessAfter(tr) + + def __testAccessLog(self): + """Wait for log file to appear, then wait one extra second to make sure TS is done writing it.""" + Test.Disk.File(os.path.join(self.ts.Variables.LOGDIR, 'access.log'), exists=True, content='gold/connect_access.gold') + + tr = Test.AddTestRun() + tr.Processes.Default.Command = ( + os.path.join(Test.Variables.AtsTestToolsDir, 'condwait') + ' 60 1 -f ' + + os.path.join(self.ts.Variables.LOGDIR, 'access.log')) + tr.Processes.Default.ReturnCode = 0 + + def run(self): + self.__testCase0() + self.__testAccessLog() + + +ConnectTest().run() + + +class ConnectViaPVTest: + # This test also executes the CONNECT request but using proxy verifier to + # generate traffic + connectReplayFile = "replays/connect.replay.yaml" + + def __init__(self): + self.setupOriginServer() + self.setupTS() + + def setupOriginServer(self): + self.server = Test.MakeVerifierServerProcess("connect-verifier-server", self.connectReplayFile) + # Verify server output + self.server.Streams.stdout += Testers.ExcludesExpression("uuid: 1", "Verify the CONNECT request doesn't reach the server.") + self.server.Streams.stdout += Testers.ContainsExpression( + "GET /get HTTP/1.1\nuuid: 2", reflags=re.MULTILINE, description="Verify the server gets the second request.") + + def setupTS(self): + self.ts = Test.MakeATSProcess("connect-ts") + + self.ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'http|iocore_net|rec', + 'proxy.config.http.server_ports': f"{self.ts.Variables.port}", + 'proxy.config.http.connect_ports': f"{self.server.Variables.http_port}", + }) + + self.ts.Disk.remap_config.AddLines([ + f"map / http://127.0.0.1:{self.server.Variables.http_port}/", + ]) + # Verify ts logs + self.ts.Disk.traffic_out.Content += Testers.ContainsExpression( + f"Proxy's Request.*\n.*\nCONNECT 127.0.0.1:{self.server.Variables.http_port} HTTP/1.1", + reflags=re.MULTILINE, + description="Verify that ATS recognizes the CONNECT request.") + + def runTraffic(self): + tr = Test.AddTestRun("Verify correct handling of CONNECT request") + tr.AddVerifierClientProcess( + "connect-client", self.connectReplayFile, http_ports=[self.ts.Variables.port], other_args='--thread-limit 1') + tr.Processes.Default.StartBefore(self.server) + tr.Processes.Default.StartBefore(self.ts) + tr.StillRunningAfter = self.server + tr.StillRunningAfter = self.ts + + def __testMetrics(self): + tr = Test.AddTestRun("Test metrics") + tr.Processes.Default.Command = ( + f"{Test.Variables.AtsTestToolsDir}/stdout_wait" + " 'traffic_ctl metric get" + + " proxy.process.http.total_incoming_connections" + " proxy.process.http.total_client_connections" + + " proxy.process.http.total_client_connections_ipv4" + " proxy.process.http.total_client_connections_ipv6" + + " proxy.process.http.total_server_connections" + " proxy.process.http2.total_client_connections" + + " proxy.process.http.connect_requests" + " proxy.process.tunnel.total_client_connections_blind_tcp" + + " proxy.process.tunnel.current_client_connections_blind_tcp" + + " proxy.process.tunnel.total_server_connections_blind_tcp" + + " proxy.process.tunnel.current_server_connections_blind_tcp" + + " proxy.process.tunnel.total_client_connections_tls_tunnel" + + " proxy.process.tunnel.current_client_connections_tls_tunnel" + + " proxy.process.tunnel.total_client_connections_tls_forward" + + " proxy.process.tunnel.current_client_connections_tls_forward" + + " proxy.process.tunnel.total_client_connections_tls_partial_blind" + + " proxy.process.tunnel.current_client_connections_tls_partial_blind" + + " proxy.process.tunnel.total_client_connections_tls_http" + + " proxy.process.tunnel.current_client_connections_tls_http" + " proxy.process.tunnel.total_server_connections_tls" + + " proxy.process.tunnel.current_server_connections_tls'" + f" {Test.TestDirectory}/gold/metrics.gold") + # Need to copy over the environment so traffic_ctl knows where to find the unix domain socket + tr.Processes.Default.Env = self.ts.Env + tr.Processes.Default.ReturnCode = 0 + tr.StillRunningAfter = self.server + tr.StillRunningAfter = self.ts + + def run(self): + self.runTraffic() + self.__testMetrics() + + +ConnectViaPVTest().run() + + +class ConnectViaPVTest2: + # This test executes a HTTP/2 CONNECT request with Proxy Verifier. + connectReplayFile = "replays/connect_h2.replay.yaml" + + def __init__(self): + self.setupOriginServer() + self.setupTS() + + def setupOriginServer(self): + self.server = Test.MakeVerifierServerProcess("connect-verifier-server2", self.connectReplayFile) + # Verify server output + self.server.Streams.stdout += Testers.ExcludesExpression( + "test: connect-request", "Verify the CONNECT request doesn't reach the server.") + self.server.Streams.stdout += Testers.ContainsExpression( + "GET /get HTTP/1.1\nuuid: 1\ntest: real-request", + reflags=re.MULTILINE, + description="Verify the server gets the second(tunneled) request.") + + def setupTS(self): + self.ts = Test.MakeATSProcess("connect-ts2", enable_tls=True) + + self.ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'http|hpack', + 'proxy.config.ssl.server.cert.path': f'{self.ts.Variables.SSLDir}', + 'proxy.config.ssl.server.private_key.path': f'{self.ts.Variables.SSLDir}', + 'proxy.config.http.server_ports': f"{self.ts.Variables.ssl_port}:ssl", + 'proxy.config.http.connect_ports': f"{self.server.Variables.http_port}", + }) + + self.ts.addDefaultSSLFiles() + self.ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') + + self.ts.Disk.remap_config.AddLines([ + f"map / http://127.0.0.1:{self.server.Variables.http_port}/", + ]) + # Verify ts logs + self.ts.Disk.traffic_out.Content += Testers.ContainsExpression( + f"Proxy's Request.*\n.*\nCONNECT 127.0.0.1:{self.server.Variables.http_port} HTTP/1.1", + reflags=re.MULTILINE, + description="Verify that ATS recognizes the CONNECT request.") + + def runTraffic(self): + tr = Test.AddTestRun("Verify correct handling of CONNECT request on HTTP/2") + tr.AddVerifierClientProcess( + "connect-client2", self.connectReplayFile, https_ports=[self.ts.Variables.ssl_port], other_args='--thread-limit 1') + tr.Processes.Default.StartBefore(self.server) + tr.Processes.Default.StartBefore(self.ts) + tr.StillRunningAfter = self.server + tr.StillRunningAfter = self.ts + + def run(self): + self.runTraffic() + + +ConnectViaPVTest2().run() diff --git a/tests/gold_tests/connect/gold/connect_0_stderr_uds.gold b/tests/gold_tests/connect/gold/connect_0_stderr_uds.gold new file mode 100644 index 00000000000..60d4b8d8983 --- /dev/null +++ b/tests/gold_tests/connect/gold/connect_0_stderr_uds.gold @@ -0,0 +1,19 @@ +`` +* Connected to `` port `` +`` +> CONNECT /get HTTP/1.1 +> Host: foo.com +`` +>`` +< HTTP/1.1 200 OK +`` +<`` +`` CONNECT `` +`` +> GET /get HTTP/1.1 +> Host: foo.com +>`` +< HTTP/1.1 200 OK +`` +<`` +`` diff --git a/tests/gold_tests/continuations/double_h2.test.py b/tests/gold_tests/continuations/double_h2.test.py index 52298b37bb9..4075d6e7620 100644 --- a/tests/gold_tests/continuations/double_h2.test.py +++ b/tests/gold_tests/continuations/double_h2.test.py @@ -23,6 +23,7 @@ Test transactions and sessions for http2, making sure the two continuations catch the same number of hooks. ''' Test.SkipUnless(Condition.HasCurlFeature('http2')) +Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True # Define default ATS. Disable the cache to simplify the test. ts = Test.MakeATSProcess("ts", enable_tls=True, enable_cache=False) diff --git a/tests/gold_tests/continuations/openclose_h2.test.py b/tests/gold_tests/continuations/openclose_h2.test.py index da1f8eef841..b2056c0950f 100644 --- a/tests/gold_tests/continuations/openclose_h2.test.py +++ b/tests/gold_tests/continuations/openclose_h2.test.py @@ -24,6 +24,7 @@ ''' Test.SkipUnless(Condition.HasCurlFeature('http2')) +Test.SkipIf(Condition.CurlUds()) # Define default ATS. Disable the cache to simplify the test. ts = Test.MakeATSProcess("ts", enable_tls=True, enable_cache=False) diff --git a/tests/gold_tests/continuations/session_id.test.py b/tests/gold_tests/continuations/session_id.test.py index 47f22eba185..204fca2252c 100644 --- a/tests/gold_tests/continuations/session_id.test.py +++ b/tests/gold_tests/continuations/session_id.test.py @@ -23,6 +23,7 @@ ''' Test.SkipUnless(Condition.HasCurlFeature('http2')) +Test.SkipIf(Condition.CurlUds()) # Configure the server. server = Test.MakeOriginServer("server") diff --git a/tests/gold_tests/continuations/session_id_uds.test.py b/tests/gold_tests/continuations/session_id_uds.test.py new file mode 100644 index 00000000000..d9c18d52f89 --- /dev/null +++ b/tests/gold_tests/continuations/session_id_uds.test.py @@ -0,0 +1,96 @@ +''' +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +Test.Summary = ''' +Verify session ID properties. +''' + +Test.SkipUnless(Condition.HasCurlFeature('http2')) + +# Configure the server. +server = Test.MakeOriginServer("server") +request_header = {"headers": "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +response_header = { + "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Length:0\r\n\r\n", + "timestamp": "1469733493.993", + "body": "" +} +server.addResponse("sessionfile.log", request_header, response_header) + +# Configure ATS. Disable the cache to simplify the test. +ts = Test.MakeATSProcess("ts", enable_tls=True, enable_cache=False) + +ts.addDefaultSSLFiles() + +Test.PrepareTestPlugin( + os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'continuations', 'plugins', '.libs', 'session_id_verify.so'), ts) + +ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'session_id_verify', + 'proxy.config.cache.enable_read_while_writer': 0, + 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), + 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), + }) + +ts.Disk.remap_config.AddLine('map / http://127.0.0.1:{0}'.format(server.Variables.Port)) + +ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') + +# +# Run some HTTP/1 traffic. +# +tr = Test.AddTestRun("Perform HTTP/1 transactions") +cmd = '-v -H "host:example.com" http://127.0.0.1:{0}'.format(ts.Variables.port) +numberOfRequests = 100 +# Create a bunch of curl commands to be executed in parallel. Default.Process +# is set in SpawnCurlCommands. On Fedora 28/29, it seems that curl will +# occasionally timeout after a couple seconds and return exitcode 2 +# Examining the packet capture shows that Traffic Server dutifully sends the response +ps = tr.SpawnCurlCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0, 2)) +tr.Processes.Default.Env = ts.Env +tr.Processes.Default.ReturnCode = Any(0, 2) +tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) +tr.Processes.Default.StartBefore(Test.Processes.ts) +ts.StartAfter(*ps) +server.StartAfter(*ps) + +tr.StillRunningAfter = ts +tr.StillRunningAfter = server + +# +# Verify that the session ids are unique. +# + +# AuTest already searches for errors in diags.log and fails if it encounters +# them. The test plugin prints an error to this log if it sees duplicate ids. +# The following is to verify that we encountered the expected ids. + + +def verify_session_count(output): + global numberOfRequests + session_ids = [line[0:line.find("\n")] for line in str(output).split("session id: ")[1:]] + if len(session_ids) != numberOfRequests: + return "Found {} session_id's, expected {}".format(len(session_ids), nReq) + return "" + + +ts.Disk.traffic_out.Content += Testers.FileContentCallback(verify_session_count, 'verify_session_count') diff --git a/tests/gold_tests/early_hints/early_hints.test.py b/tests/gold_tests/early_hints/early_hints.test.py index 7bacf4144ad..ec616502d84 100644 --- a/tests/gold_tests/early_hints/early_hints.test.py +++ b/tests/gold_tests/early_hints/early_hints.test.py @@ -154,5 +154,6 @@ def _configure_client(self, tr: 'TestRun'): TestEarlyHints(Protocol.HTTP) -TestEarlyHints(Protocol.HTTPS) -TestEarlyHints(Protocol.HTTP2) +if not Condition.CurlUds(): + TestEarlyHints(Protocol.HTTPS) + TestEarlyHints(Protocol.HTTP2) diff --git a/tests/gold_tests/forward_proxy/forward_proxy.test.py b/tests/gold_tests/forward_proxy/forward_proxy.test.py index fddf1351fe1..945c51cabf7 100644 --- a/tests/gold_tests/forward_proxy/forward_proxy.test.py +++ b/tests/gold_tests/forward_proxy/forward_proxy.test.py @@ -20,6 +20,7 @@ Test.Summary = 'Verify ATS can function as a forward proxy' Test.ContinueOnFail = True +Test.SkipIf(Condition.CurlUds()) class ForwardProxyTest: diff --git a/tests/gold_tests/headers/accept_webp.test.py b/tests/gold_tests/headers/accept_webp.test.py index 8fdd4041a24..7a905e2e8e9 100644 --- a/tests/gold_tests/headers/accept_webp.test.py +++ b/tests/gold_tests/headers/accept_webp.test.py @@ -20,6 +20,7 @@ Test.Summary = ''' Checking that we don't serve image/webp to clients that do not support it ''' +Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True diff --git a/tests/gold_tests/headers/cache_and_req_body.test.py b/tests/gold_tests/headers/cache_and_req_body.test.py index 91ad4299d34..1af39e9d0e9 100644 --- a/tests/gold_tests/headers/cache_and_req_body.test.py +++ b/tests/gold_tests/headers/cache_and_req_body.test.py @@ -20,7 +20,7 @@ Test.Summary = ''' Test cached responses and requests with bodies using CurlHeader tester ''' - +Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True # Define default ATS diff --git a/tests/gold_tests/headers/cachedIMSRange.test.py b/tests/gold_tests/headers/cachedIMSRange.test.py index 774a0be8a25..37498db8e69 100644 --- a/tests/gold_tests/headers/cachedIMSRange.test.py +++ b/tests/gold_tests/headers/cachedIMSRange.test.py @@ -21,6 +21,7 @@ Test revalidating cached objects ''' +Test.SkipIf(Condition.CurlUds()) testName = "RevalidateCacheObject" Test.ContinueOnFail = True diff --git a/tests/gold_tests/headers/cachedIMSRange_uds.test.py b/tests/gold_tests/headers/cachedIMSRange_uds.test.py new file mode 100644 index 00000000000..861dd05c475 --- /dev/null +++ b/tests/gold_tests/headers/cachedIMSRange_uds.test.py @@ -0,0 +1,257 @@ +''' +Test cached responses and requests with bodies +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +Test.Summary = ''' +Test revalidating cached objects +''' + +testName = "RevalidateCacheObject" +Test.ContinueOnFail = True + +# Set up Origin server +# request_header is from ATS to origin; response from Origin to ATS +# lookup_key is to make unique response in origin for header "UID" that will pass in ATS request +server = Test.MakeOriginServer("server", lookup_key="{%UID}") +# Initial request +request_header = { + "headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\nUID: Fill\r\n\r\n", + "timestamp": "1469733493.993", + "body": "" +} +response_header = { + "headers": + "HTTP/1.1 200 OK\r\nConnection: close\r\nLast-Modified: Tue, 08 May 2018 15:49:41 GMT\r\nCache-Control: max-age=1\r\n\r\n", + "timestamp": "1469733493.993", + "body": "xxx" +} +server.addResponse("sessionlog.json", request_header, response_header) +# IMS revalidation request +request_IMS_header = { + "headers": "GET / HTTP/1.1\r\nUID: IMS\r\nIf-Modified-Since: Tue, 08 May 2018 15:49:41 GMT\r\nHost: www.example.com\r\n\r\n", + "timestamp": "1469733493.993", + "body": "" +} +response_IMS_header = { + "headers": "HTTP/1.1 304 Not Modified\r\nConnection: close\r\nCache-Control: max-age=1\r\n\r\n", + "timestamp": "1469733493.993", + "body": None +} +server.addResponse("sessionlog.json", request_IMS_header, response_IMS_header) + +# EtagFill +request_etagfill_header = { + "headers": "GET /etag HTTP/1.1\r\nHost: www.example.com\r\nUID: EtagFill\r\n\r\n", + "timestamp": "1469733493.993", + "body": None +} +response_etagfill_header = { + "headers": "HTTP/1.1 200 OK\r\nETag: myetag\r\nConnection: close\r\nCache-Control: max-age=1\r\n\r\n", + "timestamp": "1469733493.993", + "body": "xxx" +} +server.addResponse("sessionlog.json", request_etagfill_header, response_etagfill_header) +# INM revalidation +request_INM_header = { + "headers": "GET /etag HTTP/1.1\r\nUID: INM\r\nIf-None-Match: myetag\r\nHost: www.example.com\r\n\r\n", + "timestamp": "1469733493.993", + "body": None +} +response_INM_header = { + "headers": "HTTP/1.1 304 Not Modified\r\nConnection: close\r\nETag: myetag\r\nCache-Control: max-age=1\r\n\r\n", + "timestamp": "1469733493.993", + "body": None +} +server.addResponse("sessionlog.json", request_INM_header, response_INM_header) + +# object changed to 0 byte +request_noBody_header = { + "headers": "GET / HTTP/1.1\r\nUID: noBody\r\nHost: www.example.com\r\n\r\n", + "timestamp": "1469733493.993", + "body": "" +} +response_noBody_header = { + "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Length: 0\r\nCache-Control: max-age=3\r\n\r\n", + "timestamp": "1469733493.993", + "body": "" +} +server.addResponse("sessionlog.json", request_noBody_header, response_noBody_header) + +# etag object now is a 404. Yeah, 404s don't usually have Cache-Control, but, ATS's default is to cache 404s for a while. +request_etagfill_header = { + "headers": "GET /etag HTTP/1.1\r\nHost: www.example.com\r\nUID: EtagError\r\n\r\n", + "timestamp": "1469733493.993", + "body": None +} +response_etagfill_header = { + "headers": "HTTP/1.1 404 Not Found\r\nConnection: close\r\nContent-Length: 0\r\nCache-Control: max-age=3\r\n\r\n", + "timestamp": "1469733493.993", + "body": "" +} +server.addResponse("sessionlog.json", request_etagfill_header, response_etagfill_header) + +# ATS Configuration +ts = Test.MakeATSProcess("ts", enable_tls=True) +ts.Disk.plugin_config.AddLine('xdebug.so --enable=x-cache,x-cache-key,via') +ts.addDefaultSSLFiles() +ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') +ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'http', + 'proxy.config.http.response_via_str': 3, + 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), + 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), + }) + +default_304_host = 'www.default304.test' +regex_remap_conf_file = "maps.reg" +ts.Disk.remap_config.AddLines( + [ + f'map https://{default_304_host}/ http://127.0.0.1:{server.Variables.Port}/ ' + f'@plugin=regex_remap.so @pparam={regex_remap_conf_file} @pparam=no-query-string @pparam=host', + f'map http://{default_304_host}/ http://127.0.0.1:{server.Variables.Port}/ ' + f'@plugin=regex_remap.so @pparam={regex_remap_conf_file} @pparam=no-query-string @pparam=host', + f'map / http://127.0.0.1:{server.Variables.Port}', + ]) + +ts.Disk.MakeConfigFile(regex_remap_conf_file).AddLine(f'//.*/ http://127.0.0.1:{server.Variables.Port} @status=304') + +# Test 0 - Fill a 3 byte object with Last-Modified time into cache. +tr = Test.AddTestRun() +tr.Processes.Default.StartBefore(server) +tr.Processes.Default.StartBefore(ts) +tr.MakeCurlCommand( + '-s -D - -v --http1.1 -H"UID: Fill" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/' + .format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "cache_and_req_body-miss.gold" +tr.StillRunningAfter = ts +tr.StillRunningAfter = server + +# Test 1 - Once it goes stale, fetch it again. We expect Origin to get IMS +# request, and serve a 304. We expect ATS to refresh the object, and give +# a 200 to user +tr = Test.AddTestRun() +tr.DelayStart = 2 +tr.MakeCurlCommand( + '-s -D - -v --http1.1 -H"UID: IMS" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/' + .format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "cache_and_req_body-hit-stale.gold" +tr.StillRunningAfter = ts +tr.StillRunningAfter = server + +# Test 2 - Once it goes stale, fetch it via a range request. We expect +# Origin to get IMS request, and serve a 304. We expect ATS to refresh the +# object, and give a 206 to user +tr = Test.AddTestRun() +tr.DelayStart = 2 +tr.MakeCurlCommand( + '--range 0-1 -s -D - -v --http1.1 -H"UID: IMS" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/' + .format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "cache_and_req_body-hit-stale-206.gold" +tr.StillRunningAfter = ts +tr.StillRunningAfter = server + +# Test 3 - Test 304 response served from a regex-remap rule with HTTP. +tr = Test.AddTestRun() +tr.MakeCurlCommand(f'-vs http://127.0.0.1:{ts.Variables.port}/ -H "Host: {default_304_host}"') +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.All = Testers.GoldFile("gold/http1_304.gold", case_insensitive=True) +tr.StillRunningAfter = server + +# Test 6 - Fill a new object with an Etag. Not checking the output here. +tr = Test.AddTestRun() +tr.MakeCurlCommand( + '-s -D - -v --http1.1 -H"UID: EtagFill" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag' + .format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.StillRunningAfter = ts +tr.StillRunningAfter = server + +# Test 7 - Once the etag object goes stale, fetch it again. We expect +# Origin to get INM request, and serve a 304. We expect ATS to refresh the +# object, and give a 200 to user +tr = Test.AddTestRun() +tr.DelayStart = 2 +tr.MakeCurlCommand( + '-s -D - -v --http1.1 -H"UID: INM" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag' + .format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "cache_and_req_body-hit-stale-INM.gold" +tr.StillRunningAfter = ts +tr.StillRunningAfter = server + +# Test 8 - Once the etag object goes stale, fetch it via a range request. +# We expect Origin to get INM request, and serve a 304. We expect ATS to +# refresh the object, and give a 206 to user +tr = Test.AddTestRun() +tr.DelayStart = 2 +tr.MakeCurlCommand( + '--range 0-1 -s -D - -v --http1.1 -H"UID: INM" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag' + .format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "cache_and_req_body-hit-stale-206-etag.gold" +tr.StillRunningAfter = ts +tr.StillRunningAfter = server + +# Test 9 - The origin changes the initial LMT object to 0 byte. We expect ATS to fetch and serve the new 0 byte object. +tr = Test.AddTestRun() +tr.DelayStart = 3 +tr.MakeCurlCommand( + '-s -D - -v --http1.1 -H"UID: noBody" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/' + .format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "cache_and_req_nobody-hit-stale.gold" +tr.StillRunningAfter = ts +tr.StillRunningAfter = server + +# Test 10 - Fetch the new 0 byte object again when fresh in cache to ensure its still a 0 byte object. +tr = Test.AddTestRun() +tr.DelayStart = 3 +tr.MakeCurlCommand( + '-s -D - -v --http1.1 -H"UID: noBody" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/' + .format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "cache_and_req_nobody-hit-stale.gold" +tr.StillRunningAfter = ts +tr.StillRunningAfter = server + +# Test 11 - The origin changes the etag object to 0 byte 404. We expect ATS to fetch and serve the 404 0 byte object. +tr = Test.AddTestRun() +tr.DelayStart = 2 +tr.MakeCurlCommand( + '-s -D - -v --http1.1 -H"UID: EtagError" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag' + .format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "cache_and_error_nobody.gold" +tr.StillRunningAfter = ts +tr.StillRunningAfter = server + +# Test 12 - Fetch the 0 byte etag object again when fresh in cache to ensure its still a 0 byte object +tr = Test.AddTestRun() +tr.DelayStart = 2 +tr.MakeCurlCommand( + '-s -D - -v --http1.1 -H"UID: EtagError" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag' + .format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "cache_and_error_nobody.gold" +tr.StillRunningAfter = ts +tr.StillRunningAfter = server diff --git a/tests/gold_tests/headers/field_name_space.test.py b/tests/gold_tests/headers/field_name_space.test.py index 015254c00e9..0638f1f39fa 100644 --- a/tests/gold_tests/headers/field_name_space.test.py +++ b/tests/gold_tests/headers/field_name_space.test.py @@ -20,7 +20,7 @@ Test.Summary = ''' Checking on handling spaces after the field name and before the colon ''' - +Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True # Define default ATS diff --git a/tests/gold_tests/headers/field_name_space_uds.test.py b/tests/gold_tests/headers/field_name_space_uds.test.py new file mode 100644 index 00000000000..3c1364124c4 --- /dev/null +++ b/tests/gold_tests/headers/field_name_space_uds.test.py @@ -0,0 +1,48 @@ +''' +Test on handling spaces after the field name and before the colon +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +Test.Summary = ''' +Checking on handling spaces after the field name and before the colon +''' + +Test.ContinueOnFail = True + +# Define default ATS +ts = Test.MakeATSProcess("ts") +server = Test.MakeOriginServer("server") + +testName = "field_name_space" +request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +response_header = { + "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nFoo : 123\r\nFoo: 456\r\n", + "timestamp": "1469733493.993", + "body": "xxx" +} +server.addResponse("sessionlog.json", request_header, response_header) + +ts.Disk.remap_config.AddLine('map http://www.example.com http://127.0.0.1:{0}'.format(server.Variables.Port)) + +# Test spaces at the end of the field name and before the : +tr = Test.AddTestRun() +tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) +tr.Processes.Default.StartBefore(Test.Processes.ts) +tr.MakeCurlCommand('-s -D - -v --http1.1 -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stderr = "gold/field_name_space.gold" +tr.StillRunningAfter = ts diff --git a/tests/gold_tests/headers/forwarded.test.py b/tests/gold_tests/headers/forwarded.test.py index 706ffd9bb4e..f9904a108be 100644 --- a/tests/gold_tests/headers/forwarded.test.py +++ b/tests/gold_tests/headers/forwarded.test.py @@ -22,6 +22,7 @@ Test.Summary = ''' Test FORWARDED header. ''' +Test.SkipIf(Condition.CurlUds()) Test.SkipUnless( Condition.HasCurlFeature('http2'), diff --git a/tests/gold_tests/headers/general-connection-failure-502.gold b/tests/gold_tests/headers/general-connection-failure-502.gold index d0de59d2574..836a41d63f7 100644 --- a/tests/gold_tests/headers/general-connection-failure-502.gold +++ b/tests/gold_tests/headers/general-connection-failure-502.gold @@ -1,4 +1,4 @@ -HTTP/1.1 502 Connection refused +HTTP/1.1 502 `` Connection: keep-alive Cache-Control: no-store Content-Type: text/html diff --git a/tests/gold_tests/headers/hsts.test.py b/tests/gold_tests/headers/hsts.test.py index c39481f98da..59041e4aca1 100644 --- a/tests/gold_tests/headers/hsts.test.py +++ b/tests/gold_tests/headers/hsts.test.py @@ -20,7 +20,7 @@ Test.Summary = ''' heck hsts header is set correctly ''' - +Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True # Define default ATS diff --git a/tests/gold_tests/headers/normalize_ae.test.py b/tests/gold_tests/headers/normalize_ae.test.py index ffc53735a19..a410487628a 100644 --- a/tests/gold_tests/headers/normalize_ae.test.py +++ b/tests/gold_tests/headers/normalize_ae.test.py @@ -23,6 +23,7 @@ Test normalizations of the Accept-Encoding header field. ''' +Test.SkipIf(Condition.CurlUds()) Test.SkipUnless(Condition.HasATSFeature('TS_HAS_BROTLI')) Test.ContinueOnFail = True diff --git a/tests/gold_tests/headers/normalize_ae_uds.test.py b/tests/gold_tests/headers/normalize_ae_uds.test.py new file mode 100644 index 00000000000..dd289ba0902 --- /dev/null +++ b/tests/gold_tests/headers/normalize_ae_uds.test.py @@ -0,0 +1,143 @@ +''' +Test normalizations of the Accept-Encoding header field. +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +Test.Summary = ''' +Test normalizations of the Accept-Encoding header field. +''' + +Test.SkipUnless(Condition.HasATSFeature('TS_HAS_BROTLI')) + +Test.ContinueOnFail = True + +server = Test.MakeOriginServer("server", options={'--load': os.path.join(Test.TestDirectory, 'normalize_ae_observer.py')}) + +testName = "NORMALIZE_AE" + +request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.no-oride.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +server.addResponse("sessionlog.json", request_header, response_header) +request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.ae-0.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +server.addResponse("sessionlog.json", request_header, response_header) +request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.ae-1.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +server.addResponse("sessionlog.json", request_header, response_header) +request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.ae-2.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +server.addResponse("sessionlog.json", request_header, response_header) + +# Define first ATS. Disable the cache to make sure each request is sent to the +# origin server. +ts = Test.MakeATSProcess("ts", enable_cache=False) + + +def baselineTsSetup(ts): + + ts.Disk.records_config.update({ + # 'proxy.config.diags.debug.enabled': 1, + }) + + ts.Disk.remap_config.AddLine('map http://www.no-oride.com http://127.0.0.1:{0}'.format(server.Variables.Port)) + ts.Disk.remap_config.AddLine( + 'map http://www.ae-0.com http://127.0.0.1:{0}'.format(server.Variables.Port) + + ' @plugin=conf_remap.so @pparam=proxy.config.http.normalize_ae=0') + ts.Disk.remap_config.AddLine( + 'map http://www.ae-1.com http://127.0.0.1:{0}'.format(server.Variables.Port) + + ' @plugin=conf_remap.so @pparam=proxy.config.http.normalize_ae=1') + ts.Disk.remap_config.AddLine( + 'map http://www.ae-2.com http://127.0.0.1:{0}'.format(server.Variables.Port) + + ' @plugin=conf_remap.so @pparam=proxy.config.http.normalize_ae=2') + ts.Disk.remap_config.AddLine( + 'map http://www.ae-3.com http://127.0.0.1:{0}'.format(server.Variables.Port) + + ' @plugin=conf_remap.so @pparam=proxy.config.http.normalize_ae=3') + + +baselineTsSetup(ts) + +# set up to check the output after the tests have run. +# +normalize_ae_log_id = Test.Disk.File("normalize_ae.log") +normalize_ae_log_id.Content = "normalize_ae.gold" + +# Try various Accept-Encoding header fields for a particular traffic server and host. + + +def allAEHdrs(shouldWaitForUServer, shouldWaitForTs, ts, host): + + tr = test.AddTestRun() + + if shouldWaitForUServer: + # wait for the micro server + tr.Processes.Default.StartBefore(server) + + if shouldWaitForTs: + # wait for the micro server + # delay on readiness of port + tr.Processes.Default.StartBefore(ts) + + baseCurl = '--verbose --http1.1 --proxy localhost:{} '.format(ts.Variables.port) + + # No Accept-Encoding header. + # + tr.MakeCurlCommand(baseCurl + '--header "X-Au-Test: {0}" http://{0}'.format(host)) + tr.Processes.Default.ReturnCode = 0 + + def curlTail(hdrValue): + return '--header "Accept-Encoding: {}" http://'.format(hdrValue) + host + + tr = test.AddTestRun() + tr.MakeCurlCommand(baseCurl + curlTail('gzip')) + tr.Processes.Default.ReturnCode = 0 + + tr = test.AddTestRun() + tr.MakeCurlCommand(baseCurl + curlTail('x-gzip')) + tr.Processes.Default.ReturnCode = 0 + + tr = test.AddTestRun() + tr.MakeCurlCommand(baseCurl + curlTail('br')) + tr.Processes.Default.ReturnCode = 0 + + tr = test.AddTestRun() + tr.MakeCurlCommand(baseCurl + curlTail('gzip, br')) + tr.Processes.Default.ReturnCode = 0 + + tr = test.AddTestRun() + tr.MakeCurlCommand(baseCurl + curlTail('gzip;q=0.3, whatever;q=0.666, br;q=0.7')) + tr.Processes.Default.ReturnCode = 0 + + +def perTsTest(shouldWaitForUServer, ts): + allAEHdrs(shouldWaitForUServer, True, ts, 'www.no-oride.com') + allAEHdrs(False, False, ts, 'www.ae-0.com') + allAEHdrs(False, False, ts, 'www.ae-1.com') + allAEHdrs(False, False, ts, 'www.ae-2.com') + allAEHdrs(False, False, ts, 'www.ae-3.com') + + +perTsTest(True, ts) + +# Define second ATS +ts2 = Test.MakeATSProcess("ts2") + +baselineTsSetup(ts2) + +ts2.Disk.records_config.update({ + 'proxy.config.http.normalize_ae': 0, +}) + +perTsTest(False, ts2) diff --git a/tests/gold_tests/headers/syntax.test.py b/tests/gold_tests/headers/syntax.test.py index a906c3777f0..f46aeb45ce3 100644 --- a/tests/gold_tests/headers/syntax.test.py +++ b/tests/gold_tests/headers/syntax.test.py @@ -21,6 +21,7 @@ Test whitespace between field name and colon in the header ''' +Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True # Define default ATS diff --git a/tests/gold_tests/headers/syntax_uds.test.py b/tests/gold_tests/headers/syntax_uds.test.py new file mode 100644 index 00000000000..95811d3134b --- /dev/null +++ b/tests/gold_tests/headers/syntax_uds.test.py @@ -0,0 +1,87 @@ +''' +Test whitespace between field name and colon in the header +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +Test.Summary = ''' +Test whitespace between field name and colon in the header +''' + +Test.ContinueOnFail = True + +# Define default ATS +ts = Test.MakeATSProcess("ts") +server = Test.MakeOriginServer("server") + +# **testname is required** +testName = "" +request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +server.addResponse("sessionlog.json", request_header, response_header) + +ts.Disk.remap_config.AddLine('map http://www.example.com http://127.0.0.1:{0}'.format(server.Variables.Port)) + +# Test 0 - 200 Response +tr = Test.AddTestRun() +tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) +tr.Processes.Default.StartBefore(Test.Processes.ts) +tr.MakeCurlCommand('-s -D - -v --http1.1 -H " foo: bar" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "syntax.200.gold" +tr.StillRunningAfter = ts + +# Test 1 - 400 Response - Single space after field name +tr = Test.AddTestRun() +tr.MakeCurlCommand('-s -D - -v --http1.1 -H "foo : bar" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "syntax.400.gold" +tr.StillRunningAfter = ts + +# Test 2 - 400 Response - Double space after field name +tr = Test.AddTestRun() +tr.MakeCurlCommand( + '-s -D - -v --http1.1 -H "foo : bar" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "syntax.400.gold" +tr.StillRunningAfter = ts + +# Test 3 - 400 Response - Three different Content-Length headers +tr = Test.AddTestRun() +tr.MakeCurlCommand( + '-s -D - -v --http1.1 -d "hello world" -H "Content-Length: 11" -H "Content-Length: 10" -H "Content-Length: 9" -H "Host: www.example.com" http://localhost:{0}/' + .format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "syntax.400.gold" +tr.StillRunningAfter = ts + +# Test 4 - 200 Response - Three same Content-Length headers +tr = Test.AddTestRun() +tr.MakeCurlCommand( + '-s -D - -v --http1.1 -d "hello world" -H "Content-Length: 11" -H "Content-Length: 11" -H "Content-Length: 11" -H "Host: www.example.com" http://localhost:{0}/' + .format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "syntax.200.gold" +tr.StillRunningAfter = ts + +# Test 5 - 200 Response - Three different Content-Length headers with a Transfer encoding header +tr = Test.AddTestRun() +tr.MakeCurlCommand( + '-s -D - -v --http1.1 -d "hello world" -H "Transfer-Encoding: chunked" -H "Content-Length: 11" -H "Content-Length: 10" -H "Content-Length: 9" -H "Host: www.example.com" http://localhost:{0}/' + .format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stdout = "syntax.200.gold" +tr.StillRunningAfter = ts diff --git a/tests/gold_tests/headers/via.test.py b/tests/gold_tests/headers/via.test.py index 4f1562abafd..a9272c18728 100644 --- a/tests/gold_tests/headers/via.test.py +++ b/tests/gold_tests/headers/via.test.py @@ -23,7 +23,7 @@ Test.Summary = ''' Check VIA header for protocol stack data. ''' - +Test.SkipIf(Condition.CurlUds()) Test.SkipUnless(Condition.HasCurlFeature('http2'), Condition.HasCurlFeature('IPv6')) Test.ContinueOnFail = True diff --git a/tests/gold_tests/headers/via_uds.gold b/tests/gold_tests/headers/via_uds.gold new file mode 100644 index 00000000000..8b16c0e6b16 --- /dev/null +++ b/tests/gold_tests/headers/via_uds.gold @@ -0,0 +1,3 @@ +Via: http/1.1 = http/1.1 tcp +Via: http/1.0 = http/1.0 tcp +Via: http/1.1 = http/1.1 tcp diff --git a/tests/gold_tests/headers/via_uds.test.py b/tests/gold_tests/headers/via_uds.test.py new file mode 100644 index 00000000000..d44e7ef91e0 --- /dev/null +++ b/tests/gold_tests/headers/via_uds.test.py @@ -0,0 +1,95 @@ +''' +Test the VIA header. This runs several requests through ATS and extracts the upstream VIA headers. +Those are then checked against a gold file to verify the protocol stack based output is correct. +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +Test.Summary = ''' +Check VIA header for protocol stack data. +''' + +Test.SkipUnless(Condition.HasCurlFeature('http2'), Condition.HasCurlFeature('IPv6')) +Test.ContinueOnFail = True + +# Define default ATS +if Condition.HasATSFeature('TS_USE_QUIC') and Condition.HasCurlFeature('http3'): + ts = Test.MakeATSProcess("ts", enable_tls=True, enable_quic=True) +else: + ts = Test.MakeATSProcess("ts", enable_tls=True) + +server = Test.MakeOriginServer("server", options={'--load': os.path.join(Test.TestDirectory, 'via-observer.py')}) + +testName = "VIA" + +# We only need one transaction as only the VIA header will be checked. +request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +server.addResponse("sessionlog.json", request_header, response_header) + +# These should be promoted rather than other tests like this reaching around. +ts.addDefaultSSLFiles() + +ts.Disk.records_config.update( + { + 'proxy.config.http.insert_request_via_str': 4, + 'proxy.config.http.insert_response_via_str': 4, + 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), + 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), + }) + +ts.Disk.remap_config.AddLine('map http://www.example.com http://127.0.0.1:{0}'.format(server.Variables.Port)) +ts.Disk.remap_config.AddLine( + 'map https://www.example.com http://127.0.0.1:{0}'.format(server.Variables.Port, ts.Variables.ssl_port)) + +ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') + +# Set up to check the output after the tests have run. +via_log_id = Test.Disk.File("via.log") +if Condition.HasATSFeature('TS_USE_QUIC') and Condition.HasCurlFeature('http3'): + via_log_id.Content = "via_h3.gold" +else: + via_log_id.Content = "via_uds.gold" + +# Basic HTTP 1.1 +tr = Test.AddTestRun() +# Wait for the micro server +tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) +# Delay on readiness of our ssl ports +tr.Processes.Default.StartBefore(Test.Processes.ts) + +tr.MakeCurlCommand('--verbose --http1.1 --proxy localhost:{} http://www.example.com'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +tr.StillRunningAfter = server +tr.StillRunningAfter = ts + +# HTTP 1.0 +tr = Test.AddTestRun() +tr.MakeCurlCommand('--verbose --http1.0 --proxy localhost:{} http://www.example.com'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +tr.StillRunningAfter = server +tr.StillRunningAfter = ts + +# IPv6 +tr = Test.AddTestRun() +tr.MakeCurlCommand('--verbose --http1.1 --proxy localhost:{} http://www.example.com'.format(ts.Variables.portv6)) +tr.Processes.Default.ReturnCode = 0 +tr.StillRunningAfter = server +tr.StillRunningAfter = ts diff --git a/tests/gold_tests/ip_allow/ip_allow.test.py b/tests/gold_tests/ip_allow/ip_allow.test.py index 8ae0a186625..a6a8bf32ec8 100644 --- a/tests/gold_tests/ip_allow/ip_allow.test.py +++ b/tests/gold_tests/ip_allow/ip_allow.test.py @@ -22,7 +22,7 @@ Test.Summary = ''' Verify ip_allow filtering behavior. ''' - +Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True # Define default ATS diff --git a/tests/gold_tests/ip_allow/ip_allow_uds.test.py b/tests/gold_tests/ip_allow/ip_allow_uds.test.py new file mode 100644 index 00000000000..8ce0d684229 --- /dev/null +++ b/tests/gold_tests/ip_allow/ip_allow_uds.test.py @@ -0,0 +1,259 @@ +''' +Verify ip_allow filtering behavior. +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +Test.Summary = ''' +Verify ip_allow filtering behavior. +''' + +Test.ContinueOnFail = True + +# Define default ATS +ts = Test.MakeATSProcess("ts", enable_tls=True, enable_cache=False) +server = Test.MakeOriginServer("server", ssl=True) + +testName = "" +request = { + "headers": "GET /get HTTP/1.1\r\n" + "Host: www.example.com:80\r\n\r\n", + "timestamp": "1469733493.993", + "body": "" +} +response = { + "headers": "HTTP/1.1 200 OK\r\n" + "Content-Length: 3\r\n" + "Connection: close\r\n\r\n", + "timestamp": "1469733493.993", + "body": "xxx" +} +server.addResponse("sessionlog.json", request, response) + +# The following shouldn't come to the server, but in the event that there is a +# bug in ip_allow and they are sent through, have them return a 200 OK. This +# will fail the match with the gold file which expects a 403. +request = { + "headers": "CONNECT www.example.com:80/connect HTTP/1.1\r\n" + "Host: www.example.com:80\r\n\r\n", + "timestamp": "1469733493.993", + "body": "" +} +response = { + "headers": "HTTP/1.1 200 OK\r\n" + "Content-Length: 3\r\n" + "Connection: close\r\n\r\n", + "timestamp": "1469733493.993", + "body": "xxx" +} +server.addResponse("sessionlog.json", request, response) +request = { + "headers": "PUSH www.example.com:80/h2_push HTTP/2\r\n" + "Host: www.example.com:80\r\n\r\n", + "timestamp": "1469733493.993", + "body": "" +} +response = { + "headers": "HTTP/2 200 OK\r\n" + "Content-Length: 3\r\n" + "Connection: close\r\n\r\n", + "timestamp": "1469733493.993", + "body": "xxx" +} +server.addResponse("sessionlog.json", request, response) + +# Configure TLS for Traffic Server for HTTP/2. +ts.addDefaultSSLFiles() + +ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') + +ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'ip_allow', + 'proxy.config.http.push_method_enabled': 1, + 'proxy.config.http.connect_ports': '{0}'.format(server.Variables.SSL_Port), + 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), + 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), + 'proxy.config.ssl.client.verify.server.policy': 'PERMISSIVE', + 'proxy.config.http2.active_timeout_in': 3, + 'proxy.config.http2.max_concurrent_streams_in': 65535, + }) + +format_string = ( + '%-% % % % %/% % ' + '% % % % %<{Y-RID}pqh> ' + '%<{Y-YPCS}pqh> %<{Host}cqh> %<{CHAD}pqh> ' + 'sftover=%<{x-safet-overlimit-rules}cqh> sftmat=%<{x-safet-matched-rules}cqh> ' + 'sftcls=%<{x-safet-classification}cqh> ' + 'sftbadclf=%<{x-safet-bad-classifiers}cqh> yra=%<{Y-RA}cqh> scheme=%') + +ts.Disk.logging_yaml.AddLines( + ''' logging: + formats: + - name: custom + format: '{}' + logs: + - filename: squid.log + format: custom +'''.format(format_string).split("\n")) + +ts.Disk.remap_config.AddLine('map / https://127.0.0.1:{0}'.format(server.Variables.SSL_Port)) + +# Note that CONNECT is not in the allowed list. +ts.Disk.ip_allow_yaml.AddLines( + '''ip_allow: + - apply: in + ip_addrs: 0/0 + action: allow + methods: [GET, HEAD, POST ] + - apply: in + ip_addrs: ::/0 + action: allow + methods: [GET, HEAD, POST ] + +'''.split("\n")) + +ts.Disk.traffic_out.Content += Testers.ContainsExpression( + "Line 1 denial for 'CONNECT' from 127.0.0.1", "The CONNECT request should be denied by ip_allow") +ts.Disk.traffic_out.Content += Testers.ContainsExpression( + "Line 1 denial for 'PUSH' from 127.0.0.1", "The PUSH request should be denied by ip_allow") + + +class Test_ip_allow: + """Configure a test to verify ip_allow behavior.""" + + client_counter: int = 0 + ts_counter: int = 0 + server_counter: int = 0 + + def __init__( + self, + name: str, + replay_file: str, + ip_allow_config: str, + gold_file="", + replay_keys="", + is_h3=False, + expect_request_rejected=False): + """Initialize the test. + + :param name: The name of the test. + :param ip_allow_config: The ip_allow configuration to be used. + :param replay_file: The replay file to be used. + :param gold_file: (Optional) Gold file to be checked. + :param replay_keys: (Optional) Keys to be used by pv. + :param expect_request_rejected: (Optional) Whether or not the client request is expected to be rejected. + """ + self.name = name + self.replay_file = replay_file + self.ip_allow_config = ip_allow_config + self.gold_file = gold_file + self.replay_keys = replay_keys + self.is_h3 = is_h3 + self.expect_request_rejected = expect_request_rejected + + def _configure_server(self, tr: 'TestRun'): + """Configure the server. + + :param tr: The TestRun object to associate the server process with. + """ + server = tr.AddVerifierServerProcess(f"server_{Test_ip_allow.server_counter}", self.replay_file) + Test_ip_allow.server_counter += 1 + self._server = server + + def _configure_traffic_server(self, tr: 'TestRun'): + """Configure Traffic Server. + + :param tr: The TestRun object to associate the ts process with. + """ + ts = tr.MakeATSProcess( + f"ts-{Test_ip_allow.ts_counter}", enable_quic=self.is_h3, enable_tls=True, enable_proxy_protocol=True) + + Test_ip_allow.ts_counter += 1 + self._ts = ts + # Configure TLS for Traffic Server. + self._ts.addDefaultSSLFiles() + self._ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') + self._ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'v_quic|quic|http|proxyprotocol|ip_allow', + 'proxy.config.http.push_method_enabled': 1, + 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), + 'proxy.config.quic.no_activity_timeout_in': 0, + 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), + 'proxy.config.ssl.client.verify.server.policy': 'PERMISSIVE', + 'proxy.config.http.connect_ports': f"{self._server.Variables.http_port}", + }) + + self._ts.Disk.remap_config.AddLine(f'map / http://127.0.0.1:{self._server.Variables.http_port}') + + # Set ip_allow policy based on the input configuration. + self._ts.Disk.ip_allow_yaml.AddLines(self.ip_allow_config.split("\n")) + + def run(self): + """Run the test.""" + tr = Test.AddTestRun(self.name) + self._configure_server(tr) + self._configure_traffic_server(tr) + + tr.Processes.Default.StartBefore(self._server) + tr.Processes.Default.StartBefore(self._ts) + + tr.AddVerifierClientProcess( + f'client-{Test_ip_allow.client_counter}', + self.replay_file, + http_ports=[self._ts.Variables.proxy_protocol_port], + https_ports=[self._ts.Variables.ssl_port], + http3_ports=[self._ts.Variables.ssl_port], + keys=self.replay_keys) + Test_ip_allow.client_counter += 1 + + if self.expect_request_rejected: + # The client request should time out because ATS rejects it and does + # not send a response. + tr.Processes.Default.ReturnCode = 1 + self._ts.Disk.diags_log.Content += Testers.ContainsExpression( + "client.*prohibited by ip-allow policy", "Request should be rejected by ip_allow") + else: + # Verify the client request is successful. + tr.Processes.Default.ReturnCode = 0 + self._ts.Disk.diags_log.Content += Testers.ExcludesExpression( + "client.*allowed by ip-allow policy", "Request should be allowed by ip_allow") + + if self.gold_file: + tr.Processes.Default.Streams.all = self.gold_file + + +# TEST 1: Verify IP address from PROXY protocol is used. +IP_ALLOW_CONFIG_PROXY_PROTOCOL = '''ip_allow: + - apply: in + ip_addrs: 1.2.3.4 + action: allow + - apply: in + ip_addrs: 0/0 + action: deny +''' +test_ip_allow_proxy_protocol = Test_ip_allow( + "ip_allow_proxy_protocol", + replay_file='replays/http_proxy_protocol.replay.yaml', + ip_allow_config=IP_ALLOW_CONFIG_PROXY_PROTOCOL, + is_h3=False, + expect_request_rejected=False) +test_ip_allow_proxy_protocol.run() diff --git a/tests/gold_tests/ip_allow/replays/http_proxy_protocol.replay.yaml b/tests/gold_tests/ip_allow/replays/http_proxy_protocol.replay.yaml new file mode 100644 index 00000000000..ae3c9038b09 --- /dev/null +++ b/tests/gold_tests/ip_allow/replays/http_proxy_protocol.replay.yaml @@ -0,0 +1,54 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# The replay file executes various HTTP requests to verify the ip_allow policy +# applies by default to all methods. + +meta: + version: "1.0" + + blocks: + - standard_response: &standard_response + server-response: + status: 200 + reason: OK + headers: + fields: + - [ Content-Length, 20 ] +sessions: +- protocol: + - name: http + version: 1 + - name: proxy-protocol + version: 2 + src-addr: "1.2.3.4:1111" + dst-addr: "5.6.7.8:2222" + transactions: + + # GET + - client-request: + method: "GET" + version: "1.1" + url: /test/ip_allow/test_get + headers: + fields: + - [ Content-Length, 0 ] + - [ uuid, 1 ] + + <<: *standard_response + + proxy-response: + status: 200 \ No newline at end of file diff --git a/tests/gold_tests/logging/all_headers.test.py b/tests/gold_tests/logging/all_headers.test.py index 8c29548ec96..49df877de3b 100644 --- a/tests/gold_tests/logging/all_headers.test.py +++ b/tests/gold_tests/logging/all_headers.test.py @@ -22,7 +22,7 @@ Test.Summary = ''' Test new "all headers" log fields ''' - +Test.SkipIf(Condition.CurlUds()) # Define ATS. # ts = Test.MakeATSProcess("ts") diff --git a/tests/gold_tests/logging/all_headers_uds.test.py b/tests/gold_tests/logging/all_headers_uds.test.py new file mode 100644 index 00000000000..292ece442e0 --- /dev/null +++ b/tests/gold_tests/logging/all_headers_uds.test.py @@ -0,0 +1,108 @@ +''' +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import sys + +Test.Summary = ''' +Test new "all headers" log fields +''' + +# Define ATS. +# +ts = Test.MakeATSProcess("ts", enable_proxy_protocol=True) + +# Define MicroServer. +# +server = Test.MakeOriginServer("server") + +request_header = {"headers": "GET / HTTP/1.1\r\nHost: does.not.matter\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +response_header = { + "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nCache-control: max-age=85000\r\n\r\n", + "timestamp": "1469733493.993", + "body": "xxx" +} +server.addResponse("sessionlog.json", request_header, response_header) + +ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 0, + 'proxy.config.diags.debug.tags': 'http|dns', + 'proxy.config.http.insert_forwarded': 'for', + }) + +ts.Disk.remap_config.AddLine('map http://127.0.0.1:{0} http://127.0.0.1:{1}'.format(ts.Variables.port, server.Variables.Port)) + +# Mix in a numeric log field. Hopefull this will detect any binary alignment problems. +# +ts.Disk.logging_yaml.AddLines( + ''' +logging: + formats: + - name: custom + format: "% ___FS___ % ___FS___ % ___FS___ % ___FS___ % ___FS___ % ___FS___ END_TXN" + logs: + - filename: test_all_headers + format: custom +'''.split("\n")) + +# Configure comparison of "sanitized" log file with gold file at end of test. +# +sanitized_log_path = os.path.join(ts.Variables.LOGDIR, 'test_all_headers.log.san') +Test.Disk.File(sanitized_log_path, exists=True, content='gold/test_all_headers_uds.gold') + + +def reallyLong(): + value = 'abcdefghijklmnop' + value = value + value + value = value + value + value = value + value + retval = "" + for i in range(3): + retval += ' -H "x-header{}: {}"'.format(i, value) + return retval + + +tr = Test.AddTestRun() +tr.Processes.Default.StartBefore(server) +tr.Processes.Default.StartBefore(Test.Processes.ts) +tr.MakeCurlCommand( + '"http://127.0.0.1:{0}" --user-agent "007" --haproxy-protocol 1 --haproxy-clientip 127.0.0.1 --verbose '.format( + ts.Variables.port) + reallyLong()) +tr.Processes.Default.ReturnCode = 0 + +# Repeat same curl, will be answered from the ATS cache. +# +tr = Test.AddTestRun() +tr.MakeCurlCommand( + '"http://127.0.0.1:{0}" --user-agent "007" --haproxy-protocol 1 --haproxy-clientip 127.0.0.1 --verbose '.format( + ts.Variables.port) + reallyLong()) +tr.Processes.Default.ReturnCode = 0 + +# Delay to allow TS to flush report to disk, then "sanitize" generated log. +# +tr = Test.AddTestRun() + +log_path = os.path.join(ts.Variables.LOGDIR, 'test_all_headers.log') +sanitizer_python_script = os.path.join(Test.TestDirectory, 'all_headers_sanitizer.py') +sanitizer_shell_script = os.path.join(Test.TestDirectory, 'all_headers_sanitizer.sh') + +tr.Processes.Default.Command = \ + (f'{sys.executable} {sanitizer_python_script} {log_path} {server.Variables.Port} | ' + f'sh {sanitizer_shell_script} > {sanitized_log_path}') +tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/logging/custom-log.test.py b/tests/gold_tests/logging/custom-log.test.py index 159b444394c..e2d7553e2e3 100644 --- a/tests/gold_tests/logging/custom-log.test.py +++ b/tests/gold_tests/logging/custom-log.test.py @@ -22,6 +22,7 @@ Test custom log file format ''' +Test.SkipIf(Condition.CurlUds()) # this test depends on Linux specific behavior regarding loopback addresses Test.SkipUnless(Condition.IsPlatform("linux")) diff --git a/tests/gold_tests/logging/custom-log_uds.test.py b/tests/gold_tests/logging/custom-log_uds.test.py new file mode 100644 index 00000000000..5554dfaeeb6 --- /dev/null +++ b/tests/gold_tests/logging/custom-log_uds.test.py @@ -0,0 +1,92 @@ +''' +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +Test.Summary = ''' +Test custom log file format +''' + +# this test depends on Linux specific behavior regarding loopback addresses +Test.SkipUnless(Condition.IsPlatform("linux")) + +# Define default ATS +ts = Test.MakeATSProcess("ts", enable_proxy_protocol=True) + +# setup some config file for this server +ts.Disk.remap_config.AddLine('map / http://www.linkedin.com/ @action=deny') + +ts.Disk.logging_yaml.AddLines( + ''' +logging: + formats: + - name: custom + format: "%" + logs: + - filename: test_log_field + format: custom +'''.split("\n")) + +# ######################################################################### +# at the end of the different test run a custom log file should exist +# Because of this we expect the testruns to pass the real test is if the +# customlog file exists and passes the format check +Test.Disk.File(os.path.join(ts.Variables.LOGDIR, 'test_log_field.log'), exists=True, content='gold/custom_uds.gold') + +# first test is a miss for default +tr = Test.AddTestRun() +tr.MakeCurlCommand('"http://127.0.0.1:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.0.0.1'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.StartBefore(Test.Processes.ts) + +tr = Test.AddTestRun() +tr.MakeCurlCommand('"http://127.1.1.1:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.1.1.1'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +tr = Test.AddTestRun() +tr.MakeCurlCommand('"http://127.2.2.2:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.2.2.2'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +tr = Test.AddTestRun() +tr.MakeCurlCommand('"http://127.3.3.3:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.3.3.3'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +tr = Test.AddTestRun() +tr.MakeCurlCommand('"http://127.3.0.1:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.3.0.1'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +tr = Test.AddTestRun() +tr.MakeCurlCommand('"http://127.43.2.1:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.43.2.1'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +tr = Test.AddTestRun() +tr.MakeCurlCommand( + '"http://127.213.213.132:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.213.213.132'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +tr = Test.AddTestRun() +tr.MakeCurlCommand( + '"http://127.123.32.243:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.123.32.243'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +# Wait for log file to appear, then wait one extra second to make sure TS is done writing it. +test_run = Test.AddTestRun() +test_run.Processes.Default.Command = ( + os.path.join(Test.Variables.AtsTestToolsDir, 'condwait') + ' 60 1 -f ' + + os.path.join(ts.Variables.LOGDIR, 'test_log_field.log')) +test_run.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/logging/gold/custom_uds.gold b/tests/gold_tests/logging/gold/custom_uds.gold new file mode 100644 index 00000000000..d4c9b6f9a4d --- /dev/null +++ b/tests/gold_tests/logging/gold/custom_uds.gold @@ -0,0 +1,8 @@ +127.0.0.1 +127.1.1.1 +127.2.2.2 +127.3.3.3 +127.3.0.1 +127.43.2.1 +127.213.213.132 +127.123.32.243 diff --git a/tests/gold_tests/logging/gold/test_all_headers_uds.gold b/tests/gold_tests/logging/gold/test_all_headers_uds.gold new file mode 100644 index 00000000000..9f25fc147cb --- /dev/null +++ b/tests/gold_tests/logging/gold/test_all_headers_uds.gold @@ -0,0 +1,58 @@ + +{{Accept}:{*/*}} +{{Host}:{127.0.0.1__TS_PORT__}} +{{User-Agent}:{007}} +{{x-header0}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}} +{{x-header1}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}} +{{x-header2}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}} +200 + +({__AGE__}} +({__ATS_SERVER__}} +{{Cache-Control}:{max-age=85000}} +{{Connection}:{keep-alive}} +{{Content-Length}:{3}} +({__DATE__}} + +{{Cache-Control}:{max-age=85000}} +{{Connection}:{close}} +{{Content-Length}:{3}} +({__DATE__}} + +{{Accept}:{*/*}} +{{Forwarded}:{for=127.0.0.1}} +{{Host}:{127.0.0.1__TS_PORT__}} +{{User-Agent}:{007}} +({__VIA__}} +{{x-header0}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}} +{{x-header1}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}} +{{x-header2}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}} + +END_TXN + + +{{Accept}:{*/*}} +{{Host}:{127.0.0.1__TS_PORT__}} +{{User-Agent}:{007}} +{{x-header0}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}} +{{x-header1}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}} +{{x-header2}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}} +200 + +({__AGE__}} +({__ATS_SERVER__}} +{{Cache-Control}:{max-age=85000}} +{{Connection}:{keep-alive}} +{{Content-Length}:{3}} +({__DATE__}} + + + +({__AGE__}} +({__ATS_SERVER__}} +{{Cache-Control}:{max-age=85000}} +{{Connection}:{keep-alive}} +{{Content-Length}:{3}} +({__DATE__}} +END_TXN + diff --git a/tests/gold_tests/logging/log-filenames.test.py b/tests/gold_tests/logging/log-filenames.test.py index 35b518a2ac2..03d90cfee0d 100644 --- a/tests/gold_tests/logging/log-filenames.test.py +++ b/tests/gold_tests/logging/log-filenames.test.py @@ -23,6 +23,7 @@ Test.Summary = ''' Verify log file naming behavior. ''' +Test.SkipIf(Condition.CurlUds()) class LogFilenamesTest: diff --git a/tests/gold_tests/logging/log-filenames_uds.test.py b/tests/gold_tests/logging/log-filenames_uds.test.py new file mode 100644 index 00000000000..b02bf0b413d --- /dev/null +++ b/tests/gold_tests/logging/log-filenames_uds.test.py @@ -0,0 +1,268 @@ +''' +Verify log file naming behavior. +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import ports + +Test.Summary = ''' +Verify log file naming behavior. +''' + + +class LogFilenamesTest: + """ Common test configuration logic across the filename tests. + """ + + # A counter for the ATS process to make each of them unique. + __ts_counter = 1 + + # The default log names for the various system logs. + default_log_data = {'diags': 'diags.log', 'error': 'error.log'} + + def __init__(self, description, log_data=default_log_data): + ''' Handle initialization tasks common across the tests. + + Args: + description (str): The description of the test. This is passed to + the TestRun. + + log_data (dict): The log name information passed to the + MakeATSProcess extension. + ''' + self.__description = description + self.ts = self.__configure_traffic_server(log_data) + self.tr = self.__configure_traffic_TestRun(description) + self.__configure_await_TestRun(self.sentinel_log_path) + + def __configure_traffic_server(self, log_data): + ''' Common ATS configuration logic. + + Args: + log_data (dict): The log name information passed to the + MakeATSProcess extension. + + Return: + The traffic_server process. + ''' + self._ts_name = f"ts{LogFilenamesTest.__ts_counter}" + LogFilenamesTest.__ts_counter += 1 + self.ts = Test.MakeATSProcess( + self._ts_name, use_traffic_out=False, log_data=log_data, uds_path_suffix=f"{LogFilenamesTest.__ts_counter}") + self.ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 0, + 'proxy.config.diags.debug.tags': 'log', + 'proxy.config.log.periodic_tasks_interval': 1, + }) + + # Intentionally retrieve a port that is closed, that is no server is + # listening on it. We will use this to attempt talking with a + # non-existent server, which will result in an error log entry. + ports.get_port(self.ts, 'closed_port') + self.ts.Disk.remap_config.AddLines( + [ + f'map /server/down http://127.0.0.1:{self.ts.Variables.closed_port}', + 'map / https://trafficserver.apache.org @action=deny', + ]) + + # The following log is configured so that we can wait upon it being + # written so we know that ATS is done writing logs. + self.sentinel_log_filename = "sentinel" + self.ts.Disk.logging_yaml.AddLine( + f''' + logging: + formats: + - name: url_and_return_code + format: "%: %" + logs: + - filename: {self.sentinel_log_filename} + format: url_and_return_code + ''') + + self.sentinel_log_path = os.path.join(self.ts.Variables.LOGDIR, f"{self.sentinel_log_filename}.log") + + return self.ts + + def __configure_await_TestRun(self, log_path): + ''' Configure a TestRun that awaits upon the provided log_path to + exist. + + Args: + log_path (str): The log file upon which we will wait. + ''' + description = self.__description + tr = Test.AddTestRun(f'Awaiting log files to be written for: {description}') + condwait_path = os.path.join(Test.Variables.AtsTestToolsDir, 'condwait') + tr.Processes.Default.Command = f'{condwait_path} 60 1 -f {log_path}' + tr.Processes.Default.ReturnCode = 0 + + def __configure_traffic_TestRun(self, description): + ''' Configure a TestRun to run the expected transactions. + + Args: + description (str): The description to use for the TestRun. + ''' + tr = Test.AddTestRun(f'Run traffic for: {description}') + tr.MakeCurlCommand( + f'http://127.0.0.1:{self.ts.Variables.port}/some/path --verbose --next ' + f'http://127.0.0.1:{self.ts.Variables.port}/server/down --verbose', + uds_suffix=f"{LogFilenamesTest.__ts_counter}") + tr.Processes.Default.ReturnCode = 0 + tr.Processes.Default.StartBefore(self.ts) + + def configure_named_custom_log(self, custom_log_filename): + """ Configure ATS to log to the custom log file via logging.yaml. + + Args: + custom_log_filename (str): The name of the custom log file to + configure. + + Return: + The path to the configured custom log file. + """ + self.custom_log_filename = custom_log_filename + self.ts.Disk.logging_yaml.AddLine( + f''' + - filename: {custom_log_filename} + format: url_and_return_code + ''') + + if custom_log_filename in ('stdout', 'stderr'): + self.custom_log_path = custom_log_filename + if custom_log_filename == 'stdout': + self.ts.Disk.custom_log = self.ts.Streams.stdout + else: + self.ts.Disk.custom_log = self.ts.Streams.stderr + else: + self.custom_log_path = os.path.join(self.ts.Variables.LOGDIR, f"{custom_log_filename}.log") + self.ts.Disk.File(self.custom_log_path, id="custom_log") + return self.custom_log_path + + def set_log_expectations(self): + ''' Configure sanity checks for each of the log types (diags, error, + etc.) to verify they are emitting the expected content. + ''' + + diags_path = self.ts.Disk.diags_log.AbsPath + self.ts.Disk.diags_log.Content += Testers.ContainsExpression( + "Traffic Server is fully initialized", f"{diags_path} should contain traffic_server diag messages") + + error_log_path = self.ts.Disk.error_log.AbsPath + self.ts.Disk.error_log.Content += Testers.ContainsExpression( + "CONNECT: attempt fail", f"{error_log_path} should contain connection error messages") + + custom_log_path = self.ts.Disk.custom_log.AbsPath + self.ts.Disk.custom_log.Content += Testers.ContainsExpression( + "https://trafficserver.apache.org/some/path: 403", f"{custom_log_path} should contain the custom transaction logs") + + +class DefaultNamedTest(LogFilenamesTest): + ''' Verify that if custom names are not configured, then the default + 'diags.log' and 'error.log' are written to. + ''' + + def __init__(self): + super().__init__('default log filename configuration') + + self.configure_named_custom_log('my_custom_log') + self.set_log_expectations() + + +class CustomNamedTest(LogFilenamesTest): + ''' Verify that the user can assign custom filenames to diags.log, etc. + ''' + + def __init__(self): + log_data = {'diags': 'my_diags.log', 'error': 'my_error.log'} + super().__init__('specify log filename configuration', log_data) + + # Configure custom names for diags.log, etc. + self.ts.Disk.records_config.update( + { + 'proxy.config.diags.logfile.filename': 'my_diags.log', + 'proxy.config.error.logfile.filename': 'my_error.log', + }) + + self.configure_named_custom_log('my_custom_log') + self.set_log_expectations() + + +class stdoutTest(LogFilenamesTest): + ''' Verify that we can configure the logs to go to stdout. + ''' + + def __init__(self): + + log_data = {'diags': 'stdout', 'error': 'stdout'} + super().__init__('specify logs to go to stdout', log_data) + + # Configure custom names for diags.log, etc. + self.ts.Disk.records_config.update( + { + 'proxy.config.diags.logfile.filename': 'stdout', + 'proxy.config.error.logfile.filename': 'stdout', + }) + + self.configure_named_custom_log('stdout') + + # The diags.log file will not be created since we are piping to stdout. + # Therefore, simply wait upon the port being open. + self.ts.Ready = When.PortOpen(self.ts.Variables.port) + self.set_log_expectations() + + +class stderrTest(LogFilenamesTest): + ''' + Verify that we can configure the logs to go to stderr. + ''' + + def __init__(self): + + log_data = {'diags': 'stderr', 'error': 'stderr'} + super().__init__('specify logs to go to stderr', log_data) + + # Configure custom names for diags.log, etc. + self.ts.Disk.records_config.update( + { + 'proxy.config.diags.logfile.filename': 'stderr', + 'proxy.config.error.logfile.filename': 'stderr', + }) + + self.configure_named_custom_log('stderr') + + # The diags.log file will not be created since we are piping to stderr. + # Therefore, simply wait upon the port being open. + self.ts.Ready = When.PortOpen(self.ts.Variables.port) + self.set_log_expectations() + + +# +# Run the tests. +# +DefaultNamedTest() +CustomNamedTest() +stdoutTest() + +# The following stderr test can be run successfully by hand using the replay +# files from the sandbox. All the expected output goes to stderr. However, for +# some reason during the AuTest run, the stderr output stops emitting after the +# logging.yaml file is parsed. This is left here for now because it is valuable +# for use during development, but it is left commented out so that it doesn't +# produce the false failure in CI and developer test runs. +# stderrTest() diff --git a/tests/gold_tests/logging/new_log_flds.test.py b/tests/gold_tests/logging/new_log_flds.test.py index 4d105b71e60..bed4bfccedd 100644 --- a/tests/gold_tests/logging/new_log_flds.test.py +++ b/tests/gold_tests/logging/new_log_flds.test.py @@ -23,6 +23,7 @@ Test new log fields ''' +Test.SkipIf(Condition.CurlUds()) Test.SkipUnless(Condition.HasCurlFeature('http2')) # ---- diff --git a/tests/gold_tests/logging/new_log_flds_uds.test.py b/tests/gold_tests/logging/new_log_flds_uds.test.py new file mode 100644 index 00000000000..01e271a7ee3 --- /dev/null +++ b/tests/gold_tests/logging/new_log_flds_uds.test.py @@ -0,0 +1,105 @@ +''' +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import sys + +Test.Summary = ''' +Test new log fields +''' + +Test.SkipUnless(Condition.HasCurlFeature('http2')) + +# ---- +# Setup httpbin Origin Server +# ---- +httpbin = Test.MakeHttpBinServer("httpbin") + +# ---- +# Setup ATS +# ---- +ts = Test.MakeATSProcess("ts", enable_tls=True) + +ts.addDefaultSSLFiles() + +ts.Disk.records_config.update( + { + # 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), + 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), + }) + +ts.Disk.remap_config.AddLine('map http://127.0.0.1:{0} http://127.0.0.1:{1}/ip'.format(ts.Variables.port, httpbin.Variables.Port)) + +ts.Disk.remap_config.AddLine( + 'map https://127.0.0.1:{0} http://127.0.0.1:{1}/ip'.format(ts.Variables.ssl_port, httpbin.Variables.Port)) + +ts.Disk.remap_config.AddLine( + 'map https://reallyreallyreallyreallylong.com http://127.0.0.1:{1}/ip'.format(ts.Variables.ssl_port, httpbin.Variables.Port)) + +ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') + +ts.Disk.logging_yaml.AddLines( + ''' +logging: + formats: + - name: custom + format: "% % %" + logs: + - filename: test_new_log_flds + format: custom +'''.split("\n")) + +tr = Test.AddTestRun() +# Delay on readiness of ssl port +tr.Processes.Default.StartBefore(Test.Processes.ts) +tr.Processes.Default.StartBefore(httpbin, ready=When.PortOpen(httpbin.Variables.Port)) +# +tr.MakeCurlCommand('"http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +tr = Test.AddTestRun() +tr.MakeCurlCommand('"http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +tr = Test.AddTestRun() +tr.MakeCurlCommand('"http://127.0.0.1:{0}" "http://127.0.0.1:{0}" --http1.1 --verbose'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +tr = Test.AddTestRun() +tr.MakeCurlCommand( + ( + '"https://reallyreallyreallyreallylong.com:{0}" --http2 --insecure --verbose' + + ' --resolve reallyreallyreallyreallylong.com:{0}:127.0.0.1').format(ts.Variables.ssl_port)) +tr.Processes.Default.ReturnCode = 0 + +# Wait for log file to appear, then wait one extra second to make sure TS is done writing it. +# +test_run = Test.AddTestRun() +test_run.Processes.Default.Command = ( + os.path.join(Test.Variables.AtsTestToolsDir, 'condwait') + ' 60 1 -f ' + + os.path.join(ts.Variables.LOGDIR, 'test_new_log_flds.log')) +test_run.Processes.Default.ReturnCode = 0 + +# Validate generated log. +# +tr = Test.AddTestRun() +observer_script = os.path.join(Test.TestDirectory, 'new_log_flds_observer.py') +log_path = os.path.join(ts.Variables.LOGDIR, 'test_new_log_flds.log') +tr.Processes.Default.Command = f'{sys.executable} {observer_script} < {log_path}' +tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/next_hop/parent_config/parent_config_dest_ip.test.py b/tests/gold_tests/next_hop/parent_config/parent_config_dest_ip.test.py index d32e0447102..d5c4d8f9bdb 100644 --- a/tests/gold_tests/next_hop/parent_config/parent_config_dest_ip.test.py +++ b/tests/gold_tests/next_hop/parent_config/parent_config_dest_ip.test.py @@ -20,7 +20,7 @@ Test.Summary = ''' Verify ATS parent_config with dest_ip=... ''' - +Test.SkipIf(Condition.CurlUds()) # Create origin origin = Test.MakeOriginServer("origin") diff --git a/tests/gold_tests/next_hop/parent_config/parent_config_dest_ip_uds.test.py b/tests/gold_tests/next_hop/parent_config/parent_config_dest_ip_uds.test.py new file mode 100644 index 00000000000..07c2d9ee6bc --- /dev/null +++ b/tests/gold_tests/next_hop/parent_config/parent_config_dest_ip_uds.test.py @@ -0,0 +1,125 @@ +''' +Verify ATS parent.config dest_ip dns bug fix. +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +Test.Summary = ''' +Verify ATS parent_config with dest_ip=... +''' + +# Create origin +origin = Test.MakeOriginServer("origin") + +# default root +request_header_chk = { + "headers": "GET / HTTP/1.1\r\n" + "Host: ats\r\n" + "\r\n", + "timestamp": "1469733493.993", + "body": "", +} + +response_header_chk = { + "headers": "HTTP/1.1 200 OK\r\n" + "Connection: close\r\n" + "\r\n", + "timestamp": "1469733493.993", + "body": "", +} + +origin.addResponse("sessionlog.json", request_header_chk, response_header_chk) + +request_header = { + "headers": + f"GET /foo.txt HTTP/1.1\r\n" + "Host: does.not.matter\r\n" # But cant be omitted + "\r\n", + "timestamp": "1469733493.993", + "body": "" +} + +response_header = { + "headers": "HTTP/1.1 200 OK\r\n" + "Connection: close\r\n" + "Cache-control: max-age=60\r\n" + "\r\n", + "timestamp": "1469733493.993", + "body": f"This is the body for foo.txt\n" +} +origin.addResponse("sessionlog.json", request_header, response_header) + +# Configure DNS for cache layering +dns = Test.MakeDNServer("dns") +dns.addRecords(records={f"origin": ["127.0.0.1"]}) +dns.addRecords(records={f"ts1": ["127.0.0.1"]}) +dns.addRecords(records={f"ts0": ["127.0.0.1"]}) +dns.addRecords(records={f"foo.bar": ["142.250.72.14"]}) # google.com + +# Configure Traffic Server Mid +ts1 = Test.MakeATSProcess("ts1", enable_uds=False) +ts1.Disk.remap_config.AddLine(f"map / http://origin:{origin.Variables.Port}") + +ts1.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'http|dns|hostdb|parent', + 'proxy.config.dns.nameservers': f"127.0.0.1:{dns.Variables.Port}", + 'proxy.config.dns.resolv_conf': "NULL", + 'proxy.config.hostdb.lookup_timeout': 2, + 'proxy.config.http.connect_attempts_timeout': 1, + 'proxy.config.http.parent_proxy.self_detect': 0, + 'proxy.config.http.insert_response_via_str': 1, + 'proxy.config.proxy_name': 'ts1', + }) + +# Configure Traffic Server Edge +ts0 = Test.MakeATSProcess("ts0") +ts0.Disk.remap_config.AddLine("map http://foo.bar http://foo.bar") + +ts0.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'http|dns|hostdb|parent', + 'proxy.config.dns.nameservers': f"127.0.0.1:{dns.Variables.Port}", + 'proxy.config.dns.resolv_conf': "NULL", + 'proxy.config.hostdb.lookup_timeout': 2, + 'proxy.config.http.connect_attempts_timeout': 1, + 'proxy.config.http.parent_proxy.self_detect': 0, + 'proxy.config.http.insert_response_via_str': 1, + 'proxy.config.proxy_name': 'ts0', + }) + +ts0.Disk.parent_config.AddLines( + [ + f"dest_ip=93.184.216.34 port=80 go_direct=true", # example.com + f'dest_host=foo.bar port=80 parent="ts1:{ts1.Variables.port}|1;" go_direct="false" parent_is_proxy="true"', + ]) + +# Start everything up +tr = Test.AddTestRun("init") +tr.Processes.Default.StartBefore(origin) +tr.Processes.Default.StartBefore(dns) +tr.Processes.Default.StartBefore(ts0) +tr.Processes.Default.StartBefore(ts1) +tr.Processes.Default.Command = 'echo start TS, TSH_N, HTTP origin and DNS.' +tr.Processes.Default.ReturnCode = 0 + +curl_and_args = f"-s -D /dev/stdout -o /dev/stderr -x http://127.0.0.1:{ts0.Variables.port}" + +# Request asset that goes through the layers +tr = Test.AddTestRun("request") +ps = tr.Processes.Default +tr.MakeCurlCommand(curl_and_args + ' http://foo.bar/foo.txt') +ps.ReturnCode = 0 +ps.Streams.stdout.Content = Testers.ContainsExpression("Via:.* ts1 .* ts0 ", "expected via header") +tr.StillRunningAfter = ts0 diff --git a/tests/gold_tests/null_transform/gold/null_transform-200.gold b/tests/gold_tests/null_transform/gold/null_transform-200.gold index bd7333074de..2bcd41890f6 100644 --- a/tests/gold_tests/null_transform/gold/null_transform-200.gold +++ b/tests/gold_tests/null_transform/gold/null_transform-200.gold @@ -1,5 +1,5 @@ `` -> GET http://www.example.com/ HTTP/1.1 +> GET ``/ HTTP/1.1 `` > Host: www.example.com`` `` diff --git a/tests/gold_tests/origin_connection/per_server_connection_max.test.py b/tests/gold_tests/origin_connection/per_server_connection_max.test.py index 6c7253fdb3a..22a61e13f5d 100644 --- a/tests/gold_tests/origin_connection/per_server_connection_max.test.py +++ b/tests/gold_tests/origin_connection/per_server_connection_max.test.py @@ -18,6 +18,7 @@ # limitations under the License. Test.Summary = __doc__ +import os class PerServerConnectionMaxTest: @@ -89,13 +90,14 @@ def _configure_origin_server(self) -> None: def _configure_trafficserver(self) -> None: self._ts = Test.MakeATSProcess("ts2") + uds_path = os.path.join(Test.RunDirectory, 'uds.socket') self._ts.Disk.records_config.update( { 'proxy.config.dns.nameservers': f"127.0.0.1:{self._dns.Variables.Port}", 'proxy.config.dns.resolv_conf': 'NULL', 'proxy.config.diags.debug.enabled': 1, 'proxy.config.diags.debug.tags': 'http|dns|hostdb', - 'proxy.config.http.server_ports': f"{self._ts.Variables.port}", + 'proxy.config.http.server_ports': f"{self._ts.Variables.port} {uds_path}", 'proxy.config.http.connect_ports': f"{self._server.Variables.Port}", 'proxy.config.http.per_server.connection.max': self._origin_max_connections, }) diff --git a/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.test.py b/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.test.py index ed5f4661d6a..22c5c0f3c24 100644 --- a/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.test.py +++ b/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.test.py @@ -19,6 +19,7 @@ Test.Summary = ''' Test TSVConnFdCreate() TS API call. ''' +Test.SkipIf(Condition.CurlUds()) plugin_name = "TSVConnFd" diff --git a/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd_uds.test.py b/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd_uds.test.py new file mode 100644 index 00000000000..3ccd98b11b7 --- /dev/null +++ b/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd_uds.test.py @@ -0,0 +1,67 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +Test.Summary = ''' +Test TSVConnFdCreate() TS API call. +''' + +plugin_name = "TSVConnFd" + +server = Test.MakeOriginServer("server") + +request_header = {"headers": "GET / HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": "112233"} +server.addResponse("sessionlog.json", request_header, response_header) + +# File to be deleted when tests are fully completed. +# +InProgressFilePathspec = os.path.join(Test.RunDirectory, "in_progress") + +ts = Test.MakeATSProcess("ts", block_for_debug=False) + +ts.Disk.records_config.update( + { + 'proxy.config.proxy_name': 'Poxy_Proxy', # This will be the server name. + 'proxy.config.url_remap.remap_required': 1, + 'proxy.config.diags.debug.enabled': 3, + 'proxy.config.diags.debug.tags': f'{plugin_name}', + }) + +rp = os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'pluginTest', 'TSVConnFd', '.libs', f'{plugin_name}.so') +ts.Setup.Copy(rp, ts.Env['PROXY_CONFIG_PLUGIN_PLUGIN_DIR']) + +Test.GetTcpPort("tcp_port") + +ts.Disk.plugin_config.AddLine(f"{plugin_name}.so {InProgressFilePathspec} {ts.Variables.tcp_port}") + +ts.Disk.remap_config.AddLine("map http://myhost.test http://127.0.0.1:{0}".format(server.Variables.Port)) + +# Dummy transaction to trigger plugin. +# +tr = Test.AddTestRun() +tr.Processes.Default.StartBefore(server) +tr.Processes.Default.StartBefore(ts) +tr.MakeCurlCommandMulti( + f'touch {InProgressFilePathspec} ; ' + f'{{curl}} --verbose --header "Host:myhost.test" http://localhost:{ts.Variables.port}/') +tr.Processes.Default.ReturnCode = 0 + +# Give tests up to 10 seconds to complete. +# +tr = Test.AddTestRun() +tr.Processes.Default.Command = (os.path.join(Test.Variables.AtsTestToolsDir, 'condwait') + ' 15 1 -f ' + InProgressFilePathspec) +tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/pluginTest/cert_update/cert_update.test.py b/tests/gold_tests/pluginTest/cert_update/cert_update.test.py index 1bb20b12376..86e0d31ba66 100644 --- a/tests/gold_tests/pluginTest/cert_update/cert_update.test.py +++ b/tests/gold_tests/pluginTest/cert_update/cert_update.test.py @@ -23,6 +23,7 @@ Test cert_update plugin. ''' +Test.SkipIf(Condition.CurlUds()) Test.SkipUnless( Condition.HasProgram("openssl", "Openssl need to be installed on system for this test to work"), Condition.PluginExists('cert_update.so')) diff --git a/tests/gold_tests/pluginTest/compress/compress.gold b/tests/gold_tests/pluginTest/compress/compress.gold index 6ea1a62eee8..6745b65f0ae 100644 --- a/tests/gold_tests/pluginTest/compress/compress.gold +++ b/tests/gold_tests/pluginTest/compress/compress.gold @@ -1,4 +1,4 @@ -> GET http://ae-0/obj0 HTTP/1.1 +> GET ``/obj0 HTTP/1.1 > X-Ats-Compress-Test: 0/gzip, deflate, sdch, br > Accept-Encoding: gzip, deflate, sdch, br < HTTP/1.1 200 OK @@ -7,7 +7,7 @@ < Vary: Accept-Encoding < Content-Length: 46 === -> GET http://ae-0/obj0 HTTP/1.1 +> GET ``/obj0 HTTP/1.1 > X-Ats-Compress-Test: 0/gzip > Accept-Encoding: gzip < HTTP/1.1 200 OK @@ -16,7 +16,7 @@ < Vary: Accept-Encoding < Content-Length: 7`` === -> GET http://ae-0/obj0 HTTP/1.1 +> GET ``/obj0 HTTP/1.1 > X-Ats-Compress-Test: 0/br > Accept-Encoding: br < HTTP/1.1 200 OK @@ -25,14 +25,14 @@ < Vary: Accept-Encoding < Content-Length: 46 === -> GET http://ae-0/obj0 HTTP/1.1 +> GET ``/obj0 HTTP/1.1 > X-Ats-Compress-Test: 0/deflate > Accept-Encoding: deflate < HTTP/1.1 200 OK < Content-Type: text/javascript < Content-Length: 1049 === -> GET http://ae-1/obj1 HTTP/1.1 +> GET ``/obj1 HTTP/1.1 > X-Ats-Compress-Test: 1/gzip, deflate, sdch, br > Accept-Encoding: gzip, deflate, sdch, br < HTTP/1.1 200 OK @@ -41,7 +41,7 @@ < Vary: Accept-Encoding < Content-Length: 7`` === -> GET http://ae-1/obj1 HTTP/1.1 +> GET ``/obj1 HTTP/1.1 > X-Ats-Compress-Test: 1/gzip > Accept-Encoding: gzip < HTTP/1.1 200 OK @@ -50,21 +50,21 @@ < Vary: Accept-Encoding < Content-Length: 7`` === -> GET http://ae-1/obj1 HTTP/1.1 +> GET ``/obj1 HTTP/1.1 > X-Ats-Compress-Test: 1/br > Accept-Encoding: br < HTTP/1.1 200 OK < Content-Type: text/javascript < Content-Length: 1049 === -> GET http://ae-1/obj1 HTTP/1.1 +> GET ``/obj1 HTTP/1.1 > X-Ats-Compress-Test: 1/deflate > Accept-Encoding: deflate < HTTP/1.1 200 OK < Content-Type: text/javascript < Content-Length: 1049 === -> GET http://ae-2/obj2 HTTP/1.1 +> GET ``/obj2 HTTP/1.1 > X-Ats-Compress-Test: 2/gzip, deflate, sdch, br > Accept-Encoding: gzip, deflate, sdch, br < HTTP/1.1 200 OK @@ -73,7 +73,7 @@ < Vary: Accept-Encoding < Content-Length: 46 === -> GET http://ae-2/obj2 HTTP/1.1 +> GET ``/obj2 HTTP/1.1 > X-Ats-Compress-Test: 2/gzip > Accept-Encoding: gzip < HTTP/1.1 200 OK @@ -82,7 +82,7 @@ < Vary: Accept-Encoding < Content-Length: 7`` === -> GET http://ae-2/obj2 HTTP/1.1 +> GET ``/obj2 HTTP/1.1 > X-Ats-Compress-Test: 2/br > Accept-Encoding: br < HTTP/1.1 200 OK @@ -91,14 +91,14 @@ < Vary: Accept-Encoding < Content-Length: 46 === -> GET http://ae-2/obj2 HTTP/1.1 +> GET ``/obj2 HTTP/1.1 > X-Ats-Compress-Test: 2/deflate > Accept-Encoding: deflate < HTTP/1.1 200 OK < Content-Type: text/javascript < Content-Length: 1049 === -> GET http://ae-0/obj0 HTTP/1.1 +> GET ``/obj0 HTTP/1.1 > X-Ats-Compress-Test: 0/gzip;q=0.666 > Accept-Encoding: gzip;q=0.666 < HTTP/1.1 200 OK @@ -107,7 +107,7 @@ < Vary: Accept-Encoding < Content-Length: 7`` === -> GET http://ae-0/obj0 HTTP/1.1 +> GET ``/obj0 HTTP/1.1 > X-Ats-Compress-Test: 0/gzip;q=0.666x > Accept-Encoding: gzip;q=0.666x < HTTP/1.1 200 OK @@ -116,7 +116,7 @@ < Vary: Accept-Encoding < Content-Length: 7`` === -> GET http://ae-0/obj0 HTTP/1.1 +> GET ``/obj0 HTTP/1.1 > X-Ats-Compress-Test: 0/gzip;q=#0.666 > Accept-Encoding: gzip;q=#0.666 < HTTP/1.1 200 OK @@ -125,7 +125,7 @@ < Vary: Accept-Encoding < Content-Length: 7`` === -> GET http://ae-0/obj0 HTTP/1.1 +> GET ``/obj0 HTTP/1.1 > X-Ats-Compress-Test: 0/gzip; Q = 0.666 > Accept-Encoding: gzip; Q = 0.666 < HTTP/1.1 200 OK @@ -134,14 +134,14 @@ < Vary: Accept-Encoding < Content-Length: 7`` === -> GET http://ae-0/obj0 HTTP/1.1 +> GET ``obj0 HTTP/1.1 > X-Ats-Compress-Test: 0/gzip;q=0.0 > Accept-Encoding: gzip;q=0.0 < HTTP/1.1 200 OK < Content-Type: text/javascript < Content-Length: 1049 === -> GET http://ae-0/obj0 HTTP/1.1 +> GET ``obj0 HTTP/1.1 > X-Ats-Compress-Test: 0/gzip;q=-0.1 > Accept-Encoding: gzip;q=-0.1 < HTTP/1.1 200 OK @@ -150,7 +150,7 @@ < Vary: Accept-Encoding < Content-Length: 7`` === -> GET http://ae-0/obj0 HTTP/1.1 +> GET ``/obj0 HTTP/1.1 > X-Ats-Compress-Test: 0/aaa, gzip;q=0.666, bbb > Accept-Encoding: aaa, gzip;q=0.666, bbb < HTTP/1.1 200 OK @@ -159,7 +159,7 @@ < Vary: Accept-Encoding < Content-Length: 7`` === -> GET http://ae-0/obj0 HTTP/1.1 +> GET ``/obj0 HTTP/1.1 > X-Ats-Compress-Test: 0/ br ; q=0.666, bbb > Accept-Encoding: br ; q=0.666, bbb < HTTP/1.1 200 OK @@ -168,7 +168,7 @@ < Vary: Accept-Encoding < Content-Length: 46 === -> GET http://ae-0/obj0 HTTP/1.1 +> GET ``/obj0 HTTP/1.1 > X-Ats-Compress-Test: 0/aaa, gzip;q=0.666 , > Accept-Encoding: aaa, gzip;q=0.666 , < HTTP/1.1 200 OK @@ -177,7 +177,7 @@ < Vary: Accept-Encoding < Content-Length: 7`` === -> POST http://ae-3/obj3 HTTP/1.1 +> POST ``/obj3 HTTP/1.1 > X-Ats-Compress-Test: 3/gzip > Accept-Encoding: gzip < HTTP/1.1 200 OK diff --git a/tests/gold_tests/pluginTest/header_rewrite/gold/header_rewrite-303.gold b/tests/gold_tests/pluginTest/header_rewrite/gold/header_rewrite-303.gold index 94a42adfb5c..971c4bcf781 100644 --- a/tests/gold_tests/pluginTest/header_rewrite/gold/header_rewrite-303.gold +++ b/tests/gold_tests/pluginTest/header_rewrite/gold/header_rewrite-303.gold @@ -1,5 +1,5 @@ `` -> GET http://www.example.com`` +> GET `` > Host: www.example.com`` > User-Agent: curl/`` > Accept: */* diff --git a/tests/gold_tests/pluginTest/header_rewrite/gold/header_rewrite-client.gold b/tests/gold_tests/pluginTest/header_rewrite/gold/header_rewrite-client.gold index 418608bcb57..b8f23d74dfc 100644 --- a/tests/gold_tests/pluginTest/header_rewrite/gold/header_rewrite-client.gold +++ b/tests/gold_tests/pluginTest/header_rewrite/gold/header_rewrite-client.gold @@ -1,5 +1,5 @@ `` -> GET http://www.example.com`` +> GET `` > Host: www.example.com`` > User-Agent: curl/`` > Accept: */* diff --git a/tests/gold_tests/pluginTest/header_rewrite/gold/header_rewrite-l_value.gold b/tests/gold_tests/pluginTest/header_rewrite/gold/header_rewrite-l_value.gold index 8c3cf6649a8..9e2e304abc6 100644 --- a/tests/gold_tests/pluginTest/header_rewrite/gold/header_rewrite-l_value.gold +++ b/tests/gold_tests/pluginTest/header_rewrite/gold/header_rewrite-l_value.gold @@ -1,5 +1,5 @@ `` -> GET http://www.example.com`` +> GET `` > Host: www.example.com`` > User-Agent: curl/`` > Accept: */* diff --git a/tests/gold_tests/pluginTest/header_rewrite/gold/header_rewrite_cond_method.gold b/tests/gold_tests/pluginTest/header_rewrite/gold/header_rewrite_cond_method.gold index 3fb44fbfe33..0afb37beead 100644 --- a/tests/gold_tests/pluginTest/header_rewrite/gold/header_rewrite_cond_method.gold +++ b/tests/gold_tests/pluginTest/header_rewrite/gold/header_rewrite_cond_method.gold @@ -1,5 +1,5 @@ `` -> `` http://www.example.com/ HTTP/1.1 +> `` `` HTTP/1.1 > Host: www.example.com `` < HTTP/1.1 200 OK diff --git a/tests/gold_tests/pluginTest/polite_hook_wait/curl.gold b/tests/gold_tests/pluginTest/polite_hook_wait/curl.gold index 049e84e196f..d39edb08c6f 100644 --- a/tests/gold_tests/pluginTest/polite_hook_wait/curl.gold +++ b/tests/gold_tests/pluginTest/polite_hook_wait/curl.gold @@ -1,2 +1,3 @@ +`` > GET / HTTP/1.1 `` HTTP/1.1 403 Forbidden diff --git a/tests/gold_tests/pluginTest/polite_hook_wait/polite_hook_wait.test.py b/tests/gold_tests/pluginTest/polite_hook_wait/polite_hook_wait.test.py index 0a57285d917..ec2aa9f67c3 100644 --- a/tests/gold_tests/pluginTest/polite_hook_wait/polite_hook_wait.test.py +++ b/tests/gold_tests/pluginTest/polite_hook_wait/polite_hook_wait.test.py @@ -20,6 +20,7 @@ Test spawning a thread in a transaction hook continuation, and getting a result from it, without blocking event task. ''' +Test.SkipIf(Condition.CurlUds()) plugin_name = "polite_hook_wait" server = Test.MakeOriginServer("server") diff --git a/tests/gold_tests/pluginTest/polite_hook_wait/polite_hook_wait_uds.test.py b/tests/gold_tests/pluginTest/polite_hook_wait/polite_hook_wait_uds.test.py new file mode 100644 index 00000000000..2b0d75bbfde --- /dev/null +++ b/tests/gold_tests/pluginTest/polite_hook_wait/polite_hook_wait_uds.test.py @@ -0,0 +1,63 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +Test.Summary = ''' +Test spawning a thread in a transaction hook continuation, and getting a result from it, without blocking event task. +''' + +plugin_name = "polite_hook_wait" + +server = Test.MakeOriginServer("server") + +request_header = {"headers": "GET / HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": "112233"} +server.addResponse("sessionlog.json", request_header, response_header) + +# Disable the cache to make sure each request is forwarded to the origin +# server. +ts = Test.MakeATSProcess("ts", enable_cache=False, block_for_debug=False) + +ts.Disk.records_config.update( + { + 'proxy.config.proxy_name': 'Poxy_Proxy', # This will be the server name. + 'proxy.config.url_remap.remap_required': 1, + 'proxy.config.diags.debug.enabled': 3, + 'proxy.config.diags.debug.tags': f'{plugin_name}', + }) + +rp = os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'pluginTest', 'polite_hook_wait', '.libs', f'{plugin_name}.so') +ts.Setup.Copy(rp, ts.Env['PROXY_CONFIG_PLUGIN_PLUGIN_DIR']) + +ts.Disk.plugin_config.AddLine(f"{plugin_name}.so") + +ts.Disk.remap_config.AddLine("map http://myhost.test http://127.0.0.1:{0}".format(server.Variables.Port)) + +tr = Test.AddTestRun() +tr.Processes.Default.StartBefore(server) +tr.Processes.Default.StartBefore(ts) +tr.MakeCurlCommand('--verbose --header "Host:myhost.test" http://localhost:{}/ 2>curl.txt'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +tr = Test.AddTestRun() +tr.MakeCurlCommand('--verbose --header "Host:myhost.test" http://localhost:{}/ 2>curl.txt'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +tr = Test.AddTestRun() +tr.Processes.Default.Command = "grep -F HTTP/ curl.txt" +tr.Processes.Default.Streams.stdout = "curl.gold" +tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/pluginTest/prefetch/prefetch_bignum.gold b/tests/gold_tests/pluginTest/prefetch/prefetch_bignum.gold index 0cb9cc380c8..7d9890b5ad4 100644 --- a/tests/gold_tests/pluginTest/prefetch/prefetch_bignum.gold +++ b/tests/gold_tests/pluginTest/prefetch/prefetch_bignum.gold @@ -1,4 +1,4 @@ -GET http://domain.in/texts/demo-3842948374928374982374982374.txt HTTP/1.1 +GET http://``/texts/demo-3842948374928374982374982374.txt HTTP/1.1 GET http://domain.in/texts/demo-3842948374928374982374982375.txt HTTP/1.1 GET http://domain.in/texts/demo-3842948374928374982374982376.txt HTTP/1.1 GET http://domain.in/texts/demo-3842948374928374982374982377.txt HTTP/1.1 diff --git a/tests/gold_tests/pluginTest/prefetch/prefetch_bignum.test.py b/tests/gold_tests/pluginTest/prefetch/prefetch_bignum.test.py index 264689a959c..e32768230ad 100644 --- a/tests/gold_tests/pluginTest/prefetch/prefetch_bignum.test.py +++ b/tests/gold_tests/pluginTest/prefetch/prefetch_bignum.test.py @@ -73,6 +73,6 @@ Test.AddAwaitFileContainsTestRun('Await transactions to finish logging.', ts.Disk.traffic_out.Name, '3842948374928374982374982377') tr = Test.AddTestRun() -tr.Processes.Default.Command = (f"grep 'GET http://domain.in' {ts.Disk.traffic_out.Name}") +tr.Processes.Default.Command = (f"grep 'GET http://' {ts.Disk.traffic_out.Name} | grep -v '127.0.0.1' ") tr.Streams.stdout = "prefetch_bignum.gold" tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/pluginTest/prefetch/prefetch_cmcd.test.py b/tests/gold_tests/pluginTest/prefetch/prefetch_cmcd.test.py index 702c3be0bf3..2f81d3a5d94 100644 --- a/tests/gold_tests/pluginTest/prefetch/prefetch_cmcd.test.py +++ b/tests/gold_tests/pluginTest/prefetch/prefetch_cmcd.test.py @@ -165,7 +165,7 @@ dns = Test.MakeDNServer("dns") # next hop trafficserver instance -ts1 = Test.MakeATSProcess("ts1") +ts1 = Test.MakeATSProcess("ts1", enable_uds=False) ts1.Disk.records_config.update( { 'proxy.config.diags.debug.enabled': 1, diff --git a/tests/gold_tests/pluginTest/prefetch/prefetch_overflow.gold b/tests/gold_tests/pluginTest/prefetch/prefetch_overflow.gold index 68cdadc2ef1..08fa1800a3d 100644 --- a/tests/gold_tests/pluginTest/prefetch/prefetch_overflow.gold +++ b/tests/gold_tests/pluginTest/prefetch/prefetch_overflow.gold @@ -1,4 +1,4 @@ -GET http://domain.in/texts/demo-3594967639391.txt HTTP/1.1 +GET http://``/texts/demo-3594967639391.txt HTTP/1.1 GET http://domain.in/texts/demo-3594967639392.txt HTTP/1.1 GET http://domain.in/texts/demo-3594967639393.txt HTTP/1.1 GET http://domain.in/texts/demo-3594967639394.txt HTTP/1.1 diff --git a/tests/gold_tests/pluginTest/prefetch/prefetch_overflow.test.py b/tests/gold_tests/pluginTest/prefetch/prefetch_overflow.test.py index 8889f854784..ccdf0712bb2 100644 --- a/tests/gold_tests/pluginTest/prefetch/prefetch_overflow.test.py +++ b/tests/gold_tests/pluginTest/prefetch/prefetch_overflow.test.py @@ -70,6 +70,6 @@ Test.AddAwaitFileContainsTestRun('Await transactions to finish logging.', ts.Disk.traffic_out.Name, '3594967639394') tr = Test.AddTestRun() -tr.Processes.Default.Command = (f"grep 'GET http://domain.in' {ts.Disk.traffic_out.Name}") +tr.Processes.Default.Command = (f"grep 'GET http://' {ts.Disk.traffic_out.Name} | grep -v '127.0.0.1'") tr.Streams.stdout = "prefetch_overflow.gold" tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/pluginTest/prefetch/prefetch_simple.gold b/tests/gold_tests/pluginTest/prefetch/prefetch_simple.gold index 56638a70d86..fcc69e218de 100644 --- a/tests/gold_tests/pluginTest/prefetch/prefetch_simple.gold +++ b/tests/gold_tests/pluginTest/prefetch/prefetch_simple.gold @@ -1,4 +1,4 @@ -GET http://domain.in/texts/demo-1.txt HTTP/1.1 +GET http://``/texts/demo-1.txt HTTP/1.1 GET http://domain.in/texts/demo-2.txt HTTP/1.1 GET http://domain.in/texts/demo-3.txt HTTP/1.1 GET http://domain.in/texts/demo-4.txt HTTP/1.1 diff --git a/tests/gold_tests/pluginTest/prefetch/prefetch_simple.test.py b/tests/gold_tests/pluginTest/prefetch/prefetch_simple.test.py index f3fdace8000..1474eaa8794 100644 --- a/tests/gold_tests/pluginTest/prefetch/prefetch_simple.test.py +++ b/tests/gold_tests/pluginTest/prefetch/prefetch_simple.test.py @@ -70,6 +70,6 @@ Test.AddAwaitFileContainsTestRun('Await transactions to finish logging.', ts.Disk.traffic_out.Name, 'demo-4.txt') tr = Test.AddTestRun() -tr.Processes.Default.Command = (f"grep 'GET http://domain.in' {ts.Disk.traffic_out.Name}") +tr.Processes.Default.Command = (f"grep 'GET http://' {ts.Disk.traffic_out.Name} | grep -v '127.0.0.1'") tr.Streams.stdout = "prefetch_simple.gold" tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/pluginTest/sslheaders/sslheaders.test.py b/tests/gold_tests/pluginTest/sslheaders/sslheaders.test.py index 9147172a92b..7fa2d607dcc 100644 --- a/tests/gold_tests/pluginTest/sslheaders/sslheaders.test.py +++ b/tests/gold_tests/pluginTest/sslheaders/sslheaders.test.py @@ -21,6 +21,7 @@ Test sslheaders plugin. ''' +Test.SkipIf(Condition.CurlUds()) Test.SkipUnless( Condition.PluginExists('sslheaders.so'), Condition.HasCurlFeature('http2'), diff --git a/tests/gold_tests/pluginTest/test_hooks/body_buffer.test.py b/tests/gold_tests/pluginTest/test_hooks/body_buffer.test.py index dedce2bc0c6..505df1161d5 100644 --- a/tests/gold_tests/pluginTest/test_hooks/body_buffer.test.py +++ b/tests/gold_tests/pluginTest/test_hooks/body_buffer.test.py @@ -105,10 +105,12 @@ def setupTS(self): self._ts = Test.MakeATSProcess("ts", select_ports=False) self._ts.Disk.remap_config.AddLine(f'map / http://127.0.0.1:{self._server.Variables.Port}') Test.PrepareInstalledPlugin('request_buffer.so', self._ts) + uds_path = os.path.join(Test.RunDirectory, 'uds.socket') self._ts.Disk.records_config.update( { 'proxy.config.diags.debug.enabled': 1, 'proxy.config.diags.debug.tags': 'request_buffer', + 'proxy.config.http.server_ports': str(self._ts.Variables.port) + f" {uds_path}", }) self._ts.Disk.traffic_out.Content = Testers.ContainsExpression( diff --git a/tests/gold_tests/pluginTest/test_hooks/hook_add.test.py b/tests/gold_tests/pluginTest/test_hooks/hook_add.test.py index 19df23ac55b..3e9f97e343c 100644 --- a/tests/gold_tests/pluginTest/test_hooks/hook_add.test.py +++ b/tests/gold_tests/pluginTest/test_hooks/hook_add.test.py @@ -20,6 +20,7 @@ Test adding hooks ''' +Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True server = Test.MakeOriginServer("server") diff --git a/tests/gold_tests/pluginTest/test_hooks/hook_add_uds.test.py b/tests/gold_tests/pluginTest/test_hooks/hook_add_uds.test.py new file mode 100644 index 00000000000..5d899c79e65 --- /dev/null +++ b/tests/gold_tests/pluginTest/test_hooks/hook_add_uds.test.py @@ -0,0 +1,54 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +Test.Summary = ''' +Test adding hooks +''' + +Test.ContinueOnFail = True + +server = Test.MakeOriginServer("server") + +request_header = {"headers": "GET /argh HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +server.addResponse("sessionlog.json", request_header, response_header) + +ts = Test.MakeATSProcess("ts", enable_cache=False) + +ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.tags': 'test', + 'proxy.config.diags.show_location': 0, + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.url_remap.remap_required': 0, + }) + +Test.PrepareTestPlugin(os.path.join(Test.Variables.AtsTestPluginsDir, 'hook_add_plugin.so'), ts) + +ts.Disk.remap_config.AddLine("map http://one http://127.0.0.1:{0}".format(server.Variables.Port)) + +tr = Test.AddTestRun() +# Probe server port to check if ready. +tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) +tr.Processes.Default.StartBefore(Test.Processes.ts) +# +tr.MakeCurlCommand('--verbose --header "Host: one" http://localhost:{0}/argh'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +# Look at the debug output from the plugin +ts.Disk.traffic_out.Content = "hook_add.gold" diff --git a/tests/gold_tests/pluginTest/test_hooks/log_uds.gold b/tests/gold_tests/pluginTest/test_hooks/log_uds.gold new file mode 100644 index 00000000000..defcc76f489 --- /dev/null +++ b/tests/gold_tests/pluginTest/test_hooks/log_uds.gold @@ -0,0 +1,12 @@ +Global: event=TS_EVENT_HTTP_SSN_START +Global: event=TS_EVENT_HTTP_TXN_START +Session: event=TS_EVENT_HTTP_TXN_START +Global: event=TS_EVENT_HTTP_READ_REQUEST_HDR +Session: event=TS_EVENT_HTTP_READ_REQUEST_HDR +Transaction: event=TS_EVENT_HTTP_READ_REQUEST_HDR +Global: event=TS_EVENT_HTTP_TXN_CLOSE +Session: event=TS_EVENT_HTTP_TXN_CLOSE +Transaction: event=TS_EVENT_HTTP_TXN_CLOSE +Global: event=TS_EVENT_HTTP_SSN_CLOSE +Session: event=TS_EVENT_HTTP_SSN_CLOSE +`` diff --git a/tests/gold_tests/pluginTest/test_hooks/ssn_start_delay_hook.test.py b/tests/gold_tests/pluginTest/test_hooks/ssn_start_delay_hook.test.py index d31b656dee1..e94004f21d5 100644 --- a/tests/gold_tests/pluginTest/test_hooks/ssn_start_delay_hook.test.py +++ b/tests/gold_tests/pluginTest/test_hooks/ssn_start_delay_hook.test.py @@ -20,6 +20,7 @@ Test adding hooks, and rescheduling the ssn start hook from a non-net thread ''' +Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True server = Test.MakeOriginServer("server") diff --git a/tests/gold_tests/pluginTest/test_hooks/ssn_start_delay_hook_uds.test.py b/tests/gold_tests/pluginTest/test_hooks/ssn_start_delay_hook_uds.test.py new file mode 100644 index 00000000000..c7626b77236 --- /dev/null +++ b/tests/gold_tests/pluginTest/test_hooks/ssn_start_delay_hook_uds.test.py @@ -0,0 +1,56 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +Test.Summary = ''' +Test adding hooks, and rescheduling the ssn start hook from a non-net thread +''' + +Test.ContinueOnFail = True + +server = Test.MakeOriginServer("server") + +request_header = {"headers": "GET /argh HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +server.addResponse("sessionlog.json", request_header, response_header) + +ts = Test.MakeATSProcess("ts") + +ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.tags': 'test', + 'proxy.config.diags.show_location': 0, + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.http.cache.http': 0, + 'proxy.config.url_remap.remap_required': 0, + }) + +Test.PrepareTestPlugin(os.path.join(Test.Variables.AtsTestPluginsDir, 'hook_add_plugin.so'), ts, '-delay') + +ts.Disk.remap_config.AddLine("map http://one http://127.0.0.1:{0}".format(server.Variables.Port)) + +tr = Test.AddTestRun() +# Probe server port to check if ready. +tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) +# Probe TS cleartext port to check if ready (probing TLS port causes spurious VCONN hook triggers). +tr.Processes.Default.StartBefore(Test.Processes.ts, ready=When.PortOpen(ts.Variables.port)) +# +tr.MakeCurlCommand('--verbose --header "Host: one" http://localhost:{0}/argh'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +# Look at the debug output from the plugin +ts.Disk.traffic_out.Content = "ssn_delay.gold" diff --git a/tests/gold_tests/pluginTest/test_hooks/test_hooks.test.py b/tests/gold_tests/pluginTest/test_hooks/test_hooks.test.py index 950b3fd5c0b..528807c8f8d 100644 --- a/tests/gold_tests/pluginTest/test_hooks/test_hooks.test.py +++ b/tests/gold_tests/pluginTest/test_hooks/test_hooks.test.py @@ -20,6 +20,7 @@ Test TS API Hooks. ''' +Test.SkipIf(Condition.CurlUds()) Test.SkipUnless(Condition.HasCurlFeature('http2'),) Test.ContinueOnFail = True diff --git a/tests/gold_tests/pluginTest/test_hooks/test_hooks_uds.test.py b/tests/gold_tests/pluginTest/test_hooks/test_hooks_uds.test.py new file mode 100644 index 00000000000..4dc22f32b7d --- /dev/null +++ b/tests/gold_tests/pluginTest/test_hooks/test_hooks_uds.test.py @@ -0,0 +1,77 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +Test.Summary = ''' +Test TS API Hooks. +''' + +Test.SkipUnless(Condition.HasCurlFeature('http2'),) +Test.ContinueOnFail = True + +server = Test.MakeOriginServer("server") + +request_header = {"headers": "GET /argh HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +server.addResponse("sessionlog.json", request_header, response_header) + +# Disable the cache to make sure each request is forwarded to the origin +# server. +ts = Test.MakeATSProcess("ts", enable_tls=True, enable_cache=False) + +# test_hooks.so will output test logging to this file. +log_path = os.path.join(ts.Variables.LOGDIR, "log.txt") +Test.Env["OUTPUT_FILE"] = log_path + +ts.addDefaultSSLFiles() + +ts.Disk.records_config.update( + { + 'proxy.config.proxy_name': 'Poxy_Proxy', # This will be the server name. + 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), + 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), + 'proxy.config.url_remap.remap_required': 0, + 'proxy.config.diags.debug.enabled': 0, + 'proxy.config.diags.debug.tags': 'http|test_hooks', + }) + +ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') + +Test.PrepareTestPlugin(os.path.join(Test.Variables.AtsTestPluginsDir, 'test_hooks.so'), ts) + +ts.Disk.remap_config.AddLine("map http://one http://127.0.0.1:{0}".format(server.Variables.Port)) + +tr = Test.AddTestRun() +# Probe server port to check if ready. +tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) +tr.Processes.Default.StartBefore(Test.Processes.ts) +# +tr.MakeCurlCommand('--verbose --header "Host: one" http://localhost:{0}/argh'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +# The probing of the ATS port to detect when ATS is ready may be seen by ATS as a VCONN start/close, so filter out these +# events from the log file. +# +tr = Test.AddTestRun() +tr.Processes.Default.Command = "cd " + Test.RunDirectory + " ; . " + Test.TestDirectory + "/clean.sh" +tr.Processes.Default.ReturnCode = 0 + +tr = Test.AddTestRun() +tr.Processes.Default.Command = "echo check log" +tr.Processes.Default.ReturnCode = 0 +f = tr.Disk.File(log_path) +f.Content = "log_uds.gold" diff --git a/tests/gold_tests/pluginTest/tsapi/log_uds.gold b/tests/gold_tests/pluginTest/tsapi/log_uds.gold new file mode 100644 index 00000000000..ec6ec60a645 --- /dev/null +++ b/tests/gold_tests/pluginTest/tsapi/log_uds.gold @@ -0,0 +1,100 @@ +TSRemapNewInstance(): +argv[0]=http://myhost.test/ +argv[1]=http://127.0.0.1:SERVER_PORT/ +TSRemapNewInstance(): +argv[0]=http://myhost.test/ +argv[1]=http://127.0.0.1:SERVER_PORT/ +Global: event=TS_EVENT_HTTP_TXN_START +Global: event=TS_EVENT_HTTP_READ_REQUEST_HDR +TSHttpTxnEffectiveUrlStringGet(): http://mYhOsT.teSt/ +Client Request: +TSHttpHdrEffectiveUrlBufGet(): http://myhost.test/ +TSUrlSchemeGet(): http +TSUrlRawSchemeGet(): http +TSUrlPortGet(): 80 +TSUrlRawPortGet(): 0 +Transaction: event=TS_EVENT_HTTP_READ_REQUEST_HDR +TSHttpTxnEffectiveUrlStringGet(): http://mYhOsT.teSt/ +Client Request: +TSHttpHdrEffectiveUrlBufGet(): http://myhost.test/ +TSUrlSchemeGet(): http +TSUrlRawSchemeGet(): http +TSUrlPortGet(): 80 +TSUrlRawPortGet(): 0 +TSRemapDoRemap(): instance=0 redirect=0 +Remap Request: +TSHttpHdrEffectiveUrlBufGet(): http://127.0.0.1:SERVER_PORT/ +TSUrlSchemeGet(): http +TSUrlRawSchemeGet(): http +TSUrlPortGet(): SERVER_PORT +TSUrlRawPortGet(): SERVER_PORT +TSRemapDoRemap(): instance=1 redirect=0 +Remap Request: +TSHttpHdrEffectiveUrlBufGet(): http://127.0.0.1:SERVER_PORT/ +TSUrlSchemeGet(): http +TSUrlRawSchemeGet(): http +TSUrlPortGet(): SERVER_PORT +TSUrlRawPortGet(): SERVER_PORT +Global: event=TS_EVENT_HTTP_SEND_REQUEST_HDR +TSHttpTxnEffectiveUrlStringGet(): http://127.0.0.1:SERVER_PORT/ +Request To Server: +TSHttpHdrEffectiveUrlBufGet(): http://127.0.0.1:SERVER_PORT/ +TSUrlSchemeGet(): http +TSUrlRawSchemeGet(): failed to get raw URL scheme +TSUrlPortGet(): 80 +TSUrlRawPortGet(): 0 +Transaction: event=TS_EVENT_HTTP_SEND_REQUEST_HDR +TSHttpTxnEffectiveUrlStringGet(): http://127.0.0.1:SERVER_PORT/ +Request To Server: +TSHttpHdrEffectiveUrlBufGet(): http://127.0.0.1:SERVER_PORT/ +TSUrlSchemeGet(): http +TSUrlRawSchemeGet(): failed to get raw URL scheme +TSUrlPortGet(): 80 +TSUrlRawPortGet(): 0 +Global: event=TS_EVENT_HTTP_TXN_START +Global: event=TS_EVENT_HTTP_READ_REQUEST_HDR +TSHttpTxnEffectiveUrlStringGet(): http://mYhOsT.teSt/xYz +Client Request: +TSHttpHdrEffectiveUrlBufGet(): http://myhost.test/xYz +TSUrlSchemeGet(): http +TSUrlRawSchemeGet(): http +TSUrlPortGet(): 80 +TSUrlRawPortGet(): 0 +Transaction: event=TS_EVENT_HTTP_READ_REQUEST_HDR +TSHttpTxnEffectiveUrlStringGet(): http://mYhOsT.teSt/xYz +Client Request: +TSHttpHdrEffectiveUrlBufGet(): http://myhost.test/xYz +TSUrlSchemeGet(): http +TSUrlRawSchemeGet(): http +TSUrlPortGet(): 80 +TSUrlRawPortGet(): 0 +TSRemapDoRemap(): instance=0 redirect=0 +Remap Request: +TSHttpHdrEffectiveUrlBufGet(): http://127.0.0.1:SERVER_PORT/xYz +TSUrlSchemeGet(): http +TSUrlRawSchemeGet(): http +TSUrlPortGet(): SERVER_PORT +TSUrlRawPortGet(): SERVER_PORT +TSRemapDoRemap(): instance=1 redirect=0 +Remap Request: +TSHttpHdrEffectiveUrlBufGet(): http://127.0.0.1:SERVER_PORT/xYz +TSUrlSchemeGet(): http +TSUrlRawSchemeGet(): http +TSUrlPortGet(): SERVER_PORT +TSUrlRawPortGet(): SERVER_PORT +Global: event=TS_EVENT_HTTP_SEND_REQUEST_HDR +TSHttpTxnEffectiveUrlStringGet(): http://127.0.0.1:SERVER_PORT/xYz +Request To Server: +TSHttpHdrEffectiveUrlBufGet(): http://127.0.0.1:SERVER_PORT/xYz +TSUrlSchemeGet(): http +TSUrlRawSchemeGet(): failed to get raw URL scheme +TSUrlPortGet(): 80 +TSUrlRawPortGet(): 0 +Transaction: event=TS_EVENT_HTTP_SEND_REQUEST_HDR +TSHttpTxnEffectiveUrlStringGet(): http://127.0.0.1:SERVER_PORT/xYz +Request To Server: +TSHttpHdrEffectiveUrlBufGet(): http://127.0.0.1:SERVER_PORT/xYz +TSUrlSchemeGet(): http +TSUrlRawSchemeGet(): failed to get raw URL scheme +TSUrlPortGet(): 80 +TSUrlRawPortGet(): 0 diff --git a/tests/gold_tests/pluginTest/tsapi/tsapi.test.py b/tests/gold_tests/pluginTest/tsapi/tsapi.test.py index 3d77367fdb5..f6f8a82ef93 100644 --- a/tests/gold_tests/pluginTest/tsapi/tsapi.test.py +++ b/tests/gold_tests/pluginTest/tsapi/tsapi.test.py @@ -20,6 +20,7 @@ Test TS API. ''' +Test.SkipIf(Condition.CurlUds()) Test.SkipUnless(Condition.HasCurlFeature('http2'),) Test.ContinueOnFail = True diff --git a/tests/gold_tests/pluginTest/tsapi/tsapi_uds.test.py b/tests/gold_tests/pluginTest/tsapi/tsapi_uds.test.py new file mode 100644 index 00000000000..6a928592257 --- /dev/null +++ b/tests/gold_tests/pluginTest/tsapi/tsapi_uds.test.py @@ -0,0 +1,90 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +Test.Summary = ''' +Test TS API. +''' + +Test.SkipUnless(Condition.HasCurlFeature('http2'),) +Test.ContinueOnFail = True + +plugin_name = "test_tsapi" + +server = Test.MakeOriginServer("server") + +request_header = {"headers": "GET / HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": "112233"} +server.addResponse("sessionlog.json", request_header, response_header) + +request_header = {"headers": "GET /xYz HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": "445566"} +server.addResponse("sessionlog.json", request_header, response_header) + +# Disable the cache to make sure each request is forwarded to the origin +# server. +ts = Test.MakeATSProcess("ts", enable_tls=True, enable_cache=False) + +# The test plugin will output test logging to this file. +log_file_name = os.path.join(ts.Variables.LOGDIR, "log.txt") +Test.Env["OUTPUT_FILE"] = log_file_name + +ts.addDefaultSSLFiles() + +ts.Disk.records_config.update( + { + 'proxy.config.proxy_name': 'Poxy_Proxy', # This will be the server name. + 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), + 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), + 'proxy.config.url_remap.remap_required': 1, + 'proxy.config.diags.debug.enabled': 3, + 'proxy.config.diags.debug.tags': f'http|{plugin_name}', + }) + +ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') + +rp = os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'pluginTest', 'tsapi', '.libs', f'{plugin_name}.so') +ts.Setup.Copy(rp, ts.Env['PROXY_CONFIG_PLUGIN_PLUGIN_DIR']) + +ts.Disk.remap_config.AddLine( + "map http://myhost.test http://127.0.0.1:{0} @plugin={1} @plugin={1}".format(server.Variables.Port, f"{plugin_name}.so")) + +# For some reason, without this delay, traffic_server cannot reliably open the cleartext port for listening without an +# error. +# +tr = Test.AddTestRun() +tr.Processes.Default.Command = "sleep 3" +tr.Processes.Default.ReturnCode = 0 + +tr = Test.AddTestRun() +tr.Processes.Default.StartBefore(server) +tr.Processes.Default.StartBefore(ts) +# +tr.MakeCurlCommand('--verbose --header "Host: mYhOsT.teSt" hTtP://loCalhOst:{}/'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +tr = Test.AddTestRun() +tr.MakeCurlCommand('--verbose --proxy localhost:{} http://mYhOsT.teSt/xYz'.format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 + +tr = Test.AddTestRun() +# Change server port number (which can vary) to a fixed string for compare to gold file. +second_log_file_name = os.path.join(ts.Variables.LOGDIR, "log2.txt") +tr.Processes.Default.Command = f"sed 's/{server.Variables.Port}/SERVER_PORT/' < {log_file_name} > {second_log_file_name}" +tr.Processes.Default.ReturnCode = 0 +f = tr.Disk.File(second_log_file_name) +f.Content = "log_uds.gold" diff --git a/tests/gold_tests/pluginTest/url_sig/url_sig.test.py b/tests/gold_tests/pluginTest/url_sig/url_sig.test.py index 1c5843ed23b..137d95d8bf8 100644 --- a/tests/gold_tests/pluginTest/url_sig/url_sig.test.py +++ b/tests/gold_tests/pluginTest/url_sig/url_sig.test.py @@ -25,6 +25,7 @@ Test.ContinueOnFail = True +Test.SkipIf(Condition.CurlUds()) # Skip if plugins not present. Test.SkipUnless(Condition.PluginExists('url_sig.so')) diff --git a/tests/gold_tests/pluginTest/url_sig/url_sig_uds.test.py b/tests/gold_tests/pluginTest/url_sig/url_sig_uds.test.py new file mode 100644 index 00000000000..95a2e9e1849 --- /dev/null +++ b/tests/gold_tests/pluginTest/url_sig/url_sig_uds.test.py @@ -0,0 +1,266 @@ +''' +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import hashlib +import hmac + +Test.Summary = ''' +Test url_sig plugin +''' + +Test.ContinueOnFail = True + +# Skip if plugins not present. +Test.SkipUnless(Condition.PluginExists('url_sig.so')) + +# Set up to check the output after the tests have run. +# +url_sig_log_id = Test.Disk.File("url_sig_short.log") +url_sig_log_id.Content = "url_sig.gold" + +server = Test.MakeOriginServer("server") + +request_header = { + "headers": "GET /foo/abcde/qrstuvwxyz HTTP/1.1\r\nHost: just.any.thing\r\n\r\n", + "timestamp": "1469733493.993", + "body": "" +} +# expected response from the origin server +response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""} +# add response to the server dictionary +server.addResponse("sessionfile.log", request_header, response_header) + +# Define default ATS. Disable the cache to make sure each request is forwarded +# to the origin server. +ts = Test.MakeATSProcess("ts", enable_tls=True, enable_cache=False) + +ts.addDefaultSSLFiles() + +ts.Disk.records_config.update( + { + # 'proxy.config.diags.debug.enabled': 1, + # 'proxy.config.diags.debug.tags': 'http|url_sig', + 'proxy.config.proxy_name': 'Poxy_Proxy', # This will be the server name. + 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), + 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), + }) + +ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') + +# Use unchanged incoming URL. +# +ts.Setup.Copy("url_sig.config", ts.Variables.CONFIGDIR) +ts.Disk.remap_config.AddLine( + f'map http://one.two.three/ http://127.0.0.1:{server.Variables.Port}/' + ' @plugin=url_sig.so @pparam=url_sig.config') + +# Use unchanged incoming HTTPS URL. +# +ts.Disk.remap_config.AddLine( + f'map https://one.two.three/ http://127.0.0.1:{server.Variables.Port}/' + ' @plugin=url_sig.so @pparam=url_sig.config') + +# Use pristine URL, incoming URL unchanged. +# +ts.Disk.remap_config.AddLine( + f'map http://four.five.six/ http://127.0.0.1:{server.Variables.Port}/' + + ' @plugin=url_sig.so @pparam=url_sig.config @pparam=pristineurl') + +# Use pristine URL, incoming URL changed. +# +ts.Disk.remap_config.AddLine( + f'map http://seven.eight.nine/ http://127.0.0.1:{server.Variables.Port}' + + ' @plugin=url_sig.so @pparam=url_sig.config @pparam=PristineUrl') + +# Use config with all settings set +# +ts.Setup.Copy("url_sig.all.config", ts.Variables.CONFIGDIR) +ts.Disk.remap_config.AddLine( + f'map http://ten.eleven.twelve/ http://127.0.0.1:{server.Variables.Port}/' + ' @plugin=url_sig.so @pparam=url_sig.all.config') + +# Validation failure tests. + +LogTee = f" 2>&1 | grep '^<' | tee -a {Test.RunDirectory}/url_sig_long.log" + +# Bad client / MD5 / P=101 / URL pristine / URL altered. +# +tr = Test.AddTestRun() +tr.Processes.Default.StartBefore(ts) +tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommand( + f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + + "foo/abcde/qrstuvwxyz?C=127.0.0.2&E=33046620008&A=2&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) + +# With client / MD5 / P=010 / URL pristine / URL altered -- Expired. +# +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommand( + f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=1&A=2&K=13&P=010&S=f237aad1fa010234d7bf8108a0e36387'" + LogTee) + +# With client / No algorithm / P=101 / URL pristine / URL altered. +# +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommand( + f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) + +# With client / Bad algorithm / P=101 / URL pristine / URL altered. +# +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommand( + f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=3&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) + +# With client / MD5 / No parts / URL pristine / URL altered. +# +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommand( + f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) + +# With client / MD5 / P=10 (bad) / URL pristine / URL altered. +# +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommand( + f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=10&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) + +# With client / MD5 / P=101 / URL pristine / URL altered -- No signature. +# +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommand( + f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101'" + LogTee) + +# With client / MD5 / P=101 / URL pristine / URL altered -- Bad signature. +# +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommand( + f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=d1f452d4f1d931ad2f441013402d93f8'" + LogTee) + +# With client / MD5 / P=101 / URL pristine / URL altered -- Spurious &. +# +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommand( + f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8#'" + LogTee) + +# Success tests. + +# With client / SHA1 / P=1 / URL pristine / URL not altered. +# +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommand( + f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://four.five.six/" + + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046618556&A=1&K=15&P=1&S=f4103561a23adab7723a89b9831d77e0afb61d92'" + LogTee) + +# No client / MD5 / P=1 / URL pristine / URL altered. +# +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommand( + f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + + "foo/abcde/qrstuvwxyz?E=33046618586&A=2&K=0&P=1&S=0364efa28afe345544596705b92d20ac'" + LogTee) + +# With client / MD5 / P=010 / URL pristine / URL altered. +# +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommand( + f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046619717&A=2&K=13&P=010&S=f237aad1fa010234d7bf8108a0e36387'" + LogTee) + +# With client / MD5 / P=101 / URL pristine / URL altered. +# +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommand( + f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) + + +def sign(payload, key): + secret = bytes(key, 'utf-8') + data = bytes(payload, 'utf-8') + md = bytes(hmac.new(secret, data, digestmod=hashlib.sha1).digest().hex(), 'utf-8') + return md.decode("utf-8") + + +# No client / SHA1 / P=1 / URL not pristine / URL not altered. +# +path = "foo/abcde/qrstuvwxyz?E=33046618506&A=1&K=7&P=1&S=" +to_sign = f"127.0.0.1:{server.Variables.Port}/{path}" +url = "http://one.two.three/" + path + sign(to_sign, "dqsgopTSM_doT6iAysasQVUKaPykyb6e") + +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommand(f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} '{url}'" + LogTee) + +# With client / MD5 / P=101 / URL pristine / URL altered. +# uses url_type pristine in config +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommand( + f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://ten.eleven.twelve/" + + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=586ef8e808caeeea025c525c89ff2638'" + LogTee) + +# Single fail test - check for bad path param inserted +# With client / MD5 / P=101 / URL pristine / URL altered. Bad Path Param +# uses url_type pristine in config +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommand( + f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://ten.eleven.twelve/" + + "foo/abcde/qrstuvwxyz;badparam=true?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=586ef8e808caeeea025c525c89ff2638'" + LogTee) + +# Success +# With client / SHA1 / P=1 / URL pristine / URL altered. Base64 Encoded Path Param +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommand( + f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://ten.eleven.twelve/" + + "foo/abcde;urlsig=Qz0xMjcuMC4wLjE7RT0zMzA0NjYyMDAwODtBPTI7Sz0xMztQPTEwMTtTPTA1MDllZjljY2VlNjUxZWQ1OTQxM2MyZjE3YmVhODZh/qrstuvwxyz'" + + LogTee) + +# Success +# This test must be last since it converts from the long to the short log output +# No client / SHA1 / P=1 / URL not pristine / URL not altered -- HTTPS. +# +path = "foo/abcde/qrstuvwxyz?E=33046618506&A=1&K=7&P=1&S=" +to_sign = f"127.0.0.1:{server.Variables.Port}/{path}" +url = f"https://127.0.0.1:{ts.Variables.ssl_port}/{path}" + sign(to_sign, "dqsgopTSM_doT6iAysasQVUKaPykyb6e") + +tr = Test.AddTestRun() +tr.Processes.Default.ReturnCode = 0 +tr.MakeCurlCommandMulti( + f"{curl_base} --verbose --http1.1 --insecure --header 'Host: one.two.three' '{url}'" + LogTee + + " ; grep -F -e '< HTTP' -e Authorization {0}/url_sig_long.log > {0}/url_sig_short.log ".format(ts.RunDirectory)) + +# Overriding the built in ERROR check since we expect some ERROR messages +ts.Disk.diags_log.Content = Testers.ContainsExpression("ERROR", "Some tests are failure tests") +ts.Disk.diags_log.Content += Testers.ExcludesExpression("Error parsing", "Verify that we can accept long comment lines") diff --git a/tests/gold_tests/post/post-continue.test.py b/tests/gold_tests/post/post-continue.test.py index 20f43e8a4dd..d85cf952426 100644 --- a/tests/gold_tests/post/post-continue.test.py +++ b/tests/gold_tests/post/post-continue.test.py @@ -25,6 +25,7 @@ Test the Expect header in post ''' # Require HTTP/2 enabled Curl +Test.SkipIf(Condition.CurlUds()) Test.SkipUnless(Condition.HasCurlFeature('http2'),) Test.ContinueOnFail = True diff --git a/tests/gold_tests/post/post-early-return.test.py b/tests/gold_tests/post/post-early-return.test.py index cbf447e3c83..1acb5567b98 100644 --- a/tests/gold_tests/post/post-early-return.test.py +++ b/tests/gold_tests/post/post-early-return.test.py @@ -24,6 +24,7 @@ Test.Summary = ''' Test a case when the origin returns before the post is completed ''' +Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True Test.GetTcpPort("upstream_port1") diff --git a/tests/gold_tests/post_slow_server/post_slow_server_max_requests_in.test.py b/tests/gold_tests/post_slow_server/post_slow_server_max_requests_in.test.py index f18d83a290d..59de42ce27a 100644 --- a/tests/gold_tests/post_slow_server/post_slow_server_max_requests_in.test.py +++ b/tests/gold_tests/post_slow_server/post_slow_server_max_requests_in.test.py @@ -17,6 +17,7 @@ # limitations under the License. from enum import Enum +import os Test.Summary = 'Exercise POST request with max_requests_in' Test.ContinueOnFail = True @@ -39,9 +40,10 @@ def __setupOriginServer(self): def __setupTS(self): self.ts = Test.MakeATSProcess("ts") + uds_path = os.path.join(Test.RunDirectory, 'uds.socket') self.ts.Disk.records_config.update( { - "proxy.config.http.server_ports": f"{self.ts.Variables.port}", + "proxy.config.http.server_ports": f"{self.ts.Variables.port} {uds_path}", "proxy.config.net.max_requests_in": 1000, 'proxy.config.http.connect_attempts_timeout': 1, "proxy.config.diags.debug.enabled": 1, diff --git a/tests/gold_tests/proxy_protocol/proxy_serve_stale_dns_fail.test.py b/tests/gold_tests/proxy_protocol/proxy_serve_stale_dns_fail.test.py index e3ddd17f5ef..af8ef77b05b 100644 --- a/tests/gold_tests/proxy_protocol/proxy_serve_stale_dns_fail.test.py +++ b/tests/gold_tests/proxy_protocol/proxy_serve_stale_dns_fail.test.py @@ -20,7 +20,7 @@ Test.ContinueOnFail = True # Set up hierarchical caching processes ts_child = Test.MakeATSProcess("ts_child") -ts_parent = Test.MakeATSProcess("ts_parent") +ts_parent = Test.MakeATSProcess("ts_parent", enable_uds=False) nameserver = Test.MakeDNServer("dns") server_name = "http://unknown.domain.com/" @@ -65,9 +65,9 @@ f'sleep 7; {{curl}} -s -v http://localhost:{ts_child.Variables.port};' f'sleep 15; {{curl}} -s -v http://localhost:{ts_child.Variables.port};' # Test parent serving stale with failed DNS OS lookup - f'{{curl}} -X PUSH -d "{stale_5}" "http://localhost:{ts_parent.Variables.port}";' - f'sleep 7; {{curl}} -s -v http://localhost:{ts_parent.Variables.port};' - f'sleep 15; {{curl}} -s -v http://localhost:{ts_parent.Variables.port};') + f'{{curl_base}} -X PUSH -d "{stale_5}" "http://localhost:{ts_parent.Variables.port}";' + f'sleep 7; {{curl_base}} -s -v http://localhost:{ts_parent.Variables.port};' + f'sleep 15; {{curl_base}} -s -v http://localhost:{ts_parent.Variables.port};') # Test case for when parent server is down but child proxy can serve cache object tr = Test.AddTestRun() diff --git a/tests/gold_tests/redirect/gold/number_of_redirections_0.gold b/tests/gold_tests/redirect/gold/number_of_redirections_0.gold index 66e43b735f2..7587005db37 100644 --- a/tests/gold_tests/redirect/gold/number_of_redirections_0.gold +++ b/tests/gold_tests/redirect/gold/number_of_redirections_0.gold @@ -1,9 +1,9 @@ `` -> GET http://a.test/ping HTTP/1.1 +> GET ``ping HTTP/1.1 > Host: a.test > User-Agent: curl/`` > Accept: */* -> Proxy-Connection: Keep-Alive +`` > uuid: redirect_test_1 `` < HTTP/1.1 302 Redirect @@ -11,7 +11,7 @@ < Date: `` < Age: `` < Transfer-Encoding: chunked -< Proxy-Connection: keep-alive +< ``Connection: keep-alive < Server: ATS/`` `` < HTTP/1.1 302 Redirect @@ -19,20 +19,20 @@ < Date: `` < Age: `` < Transfer-Encoding: chunked -< Proxy-Connection: keep-alive +< ``Connection: keep-alive < Server: ATS/`` `` -> GET http://c.test:`` +> GET `` > Host: c.test:`` > User-Agent: curl/`` > Accept: */* -> Proxy-Connection: Keep-Alive +`` > uuid: redirect_test_1 `` < HTTP/1.1 200 OK < date: `` < Age: `` < Transfer-Encoding: chunked -< Proxy-Connection: keep-alive +< ``Connection: keep-alive < Server: ATS/`` `` \ No newline at end of file diff --git a/tests/gold_tests/redirect/gold/number_of_redirections_2.gold b/tests/gold_tests/redirect/gold/number_of_redirections_2.gold index 86360afb3cd..7de7c35eba2 100644 --- a/tests/gold_tests/redirect/gold/number_of_redirections_2.gold +++ b/tests/gold_tests/redirect/gold/number_of_redirections_2.gold @@ -1,15 +1,15 @@ `` -> GET http://a.test/ping HTTP/1.1 +> GET ``/ping HTTP/1.1 > Host: a.test > User-Agent: curl/`` > Accept: */* -> Proxy-Connection: Keep-Alive +`` > uuid: redirect_test_1 `` < HTTP/1.1 200 OK < date: `` < Age: `` < Transfer-Encoding: chunked -< Proxy-Connection: keep-alive +< ``Connection: keep-alive < Server: ATS/`` `` \ No newline at end of file diff --git a/tests/gold_tests/redirect/redirect_post.test.py b/tests/gold_tests/redirect/redirect_post.test.py index 84a8d6fd069..1ceab0c9b6c 100644 --- a/tests/gold_tests/redirect/redirect_post.test.py +++ b/tests/gold_tests/redirect/redirect_post.test.py @@ -79,7 +79,7 @@ tr = Test.AddTestRun() tr.MakeCurlCommandMulti( - 'touch largefile.txt && truncate largefile.txt -s 50M && {{curl}} -H "Expect: " -i http://127.0.0.1:{0}/redirect1 -F "filename=@./largefile.txt" && rm -f largefile.txt' + 'touch largefile.txt && truncate -s 50M largefile.txt && {{curl}} -H "Expect: " -i http://127.0.0.1:{0}/redirect1 -F "filename=@./largefile.txt" && rm -f largefile.txt' .format(ts.Variables.port)) tr.TimeOut = 10 tr.Processes.Default.StartBefore(ts) diff --git a/tests/gold_tests/remap/basic_conf_remap_yaml.test.py b/tests/gold_tests/remap/basic_conf_remap_yaml.test.py index d42639348ab..9f39db2b4b2 100644 --- a/tests/gold_tests/remap/basic_conf_remap_yaml.test.py +++ b/tests/gold_tests/remap/basic_conf_remap_yaml.test.py @@ -20,6 +20,7 @@ Test conf_remap using a yaml file. ''' +Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True diff --git a/tests/gold_tests/remap/basic_conf_remap_yaml_uds.test.py b/tests/gold_tests/remap/basic_conf_remap_yaml_uds.test.py new file mode 100644 index 00000000000..96502933295 --- /dev/null +++ b/tests/gold_tests/remap/basic_conf_remap_yaml_uds.test.py @@ -0,0 +1,183 @@ +''' +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +Test.Summary = ''' +Test conf_remap using a yaml file. +''' + +Test.ContinueOnFail = True + + +class conf_remap_yaml_load_test: + """Test conf_remap using a yaml file.""" + + client_counter: int = 0 + ts_counter: int = 0 + server_counter: int = 0 + + def __init__(self, name: str, gold_file="", remap_filename="", remap_content=""): + """Initialize the test. + :param name: The name of the test. + :param gold_file: Gold file to be checked. + :param remap_filename: Remap yaml filename. + :param remap_content: remap yaml file content. + """ + self.name = name + self.gold_file = gold_file + self._remap_filename = remap_filename + self._remap_content = remap_content + + def _configure_server(self, tr: 'TestRun'): + """Configure the server. + + :param tr: The TestRun object to associate the server process with. + """ + server = Test.MakeOriginServer(f"server-{conf_remap_yaml_load_test.ts_counter}", lookup_key="{%Host}{PATH}") + request_header2 = { + "headers": "GET /test HTTP/1.1\r\nHost: www.testexample.com\r\n\r\n", + "timestamp": "1469733493.993", + "body": "" + } + response_header2 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""} + + server.addResponse("sessionfile.log", request_header2, response_header2) + conf_remap_yaml_load_test.server_counter += 1 + self._server = server + + def _configure_traffic_server(self, tr: 'TestRun'): + """Configure Traffic Server. + + :param tr: The TestRun object to associate the ts process with. + """ + ts = Test.MakeATSProcess(f"ts-{conf_remap_yaml_load_test.ts_counter}") + + conf_remap_yaml_load_test.ts_counter += 1 + ts.Disk.records_config.update( + ''' + diags: + debug: + enabled: 1 + tags: conf_remap + dns: + resolv_conf: NULL + http: + referer_filter: 1 + url_remap: + pristine_host_hdr: 0 # make sure is 0 + + ''') + self._ts = ts + + def run(self, diags_fail_exp="", ts_retcode=0): + """Run the test. + :param diags_fail_exp: Text to be included to validate the error. + :param ts_retcode: Expected return code from TS. + """ + tr = Test.AddTestRun(self.name) + self._configure_server(tr) + self._configure_traffic_server(tr) + + tr.Processes.Default.StartBefore(self._server) + tr.Processes.Default.StartBefore(self._ts) + + self._ts.ReturnCode = ts_retcode + + if ts_retcode > 0: # we could have errors logged and yet, we still want to move on. + self._ts.Ready = 0 + + if diags_fail_exp != "": + # some error logs will be written to the diags. + self._ts.Disk.diags_log.Content = Testers.IncludesExpression(diags_fail_exp, "Have a look.") + else: + tr.Processes.Default.ReturnCode = 0 + + if self.gold_file: + tr.Processes.Default.Streams.stderr = self.gold_file + + if self._remap_filename != "" and self._remap_content != "": + self._ts.Disk.MakeConfigFile(self._remap_filename).update(self._remap_content) + self._ts.Disk.remap_config.AddLine( + f'map http://www.testexample.com/ http://127.0.0.1:{self._server.Variables.Port} @plugin=conf_remap.so @pparam={self._remap_filename}' + ) + + tr.MakeCurlCommand('-H "Host: www.testexample.com" "http://127.0.0.1:{0}/test" --verbose'.format(self._ts.Variables.port)) + conf_remap_yaml_load_test.client_counter += 1 + + +test0 = conf_remap_yaml_load_test( + "Test success", + gold_file="gold/200OK_test_uds.gold", + remap_filename="testexample_remap.yaml", + remap_content=''' + records: + url_remap: + pristine_host_hdr: 1 + ''') +test0.run() + +test1 = conf_remap_yaml_load_test( + "Test mismatch type", + remap_filename="mismatch_field_type_remap.yaml", + remap_content=''' + records: + url_remap: + pristine_host_hdr: !!float '1' + ''') +test1.run(diags_fail_exp="'proxy.config.url_remap.pristine_host_hdr' variable type mismatch", ts_retcode=33) + +test2 = conf_remap_yaml_load_test( + "Test invalid variable", + remap_filename="invalid1_field_type_remap.yaml", + remap_content=''' + records: + plugin: + dynamic_reload_mode: 1 + ''') + +test2.run( + diags_fail_exp="'proxy.config.plugin.dynamic_reload_mode' is not a configuration variable or cannot be overridden", + ts_retcode=33) + +# We let the conf_remap parse two fields, only one is valid, we expect ATS to start and the invalid fields ignored. +test3 = conf_remap_yaml_load_test( + "Test success", + gold_file="gold/200OK_test_uds.gold", + remap_filename="testexample2_remap.yaml", + remap_content=''' + records: + plugin: + dynamic_reload_mode: 1 + + url_remap: + pristine_host_hdr: 1 + ''') +test3.run(diags_fail_exp="'proxy.config.plugin.dynamic_reload_mode' is not a configuration variable or cannot be overridden") + +# Check null values +test4 = conf_remap_yaml_load_test( + "Test success - with NULL variable", + gold_file="gold/200OK_test_uds.gold", + remap_filename="testexample_remap.yaml", + remap_content=''' + records: + url_remap: + pristine_host_hdr: 1 + hostdb: + ip_resolve: "NULL" # We want to make sure this gets read as it should. "NULL" could be the value of this field. + ''') +test4.run() diff --git a/tests/gold_tests/remap/gold/200OK_test_uds.gold b/tests/gold_tests/remap/gold/200OK_test_uds.gold new file mode 100644 index 00000000000..5d588e039e5 --- /dev/null +++ b/tests/gold_tests/remap/gold/200OK_test_uds.gold @@ -0,0 +1,13 @@ +`` +> GET /test`` +> Host: www.testexample.com`` +> User-Agent: curl/`` +> Accept: */* +`` +< HTTP/1.1 200 OK +< Date: `` +< Age: `` +< Transfer-Encoding: chunked +< Connection: keep-alive +< Server: ATS/`` +`` diff --git a/tests/gold_tests/remap/gold/remap-ws-metrics-uds.gold b/tests/gold_tests/remap/gold/remap-ws-metrics-uds.gold new file mode 100644 index 00000000000..d88a74be335 --- /dev/null +++ b/tests/gold_tests/remap/gold/remap-ws-metrics-uds.gold @@ -0,0 +1,21 @@ +proxy.process.http.total_incoming_connections 2 +proxy.process.http.total_client_connections 2 +proxy.process.http.total_client_connections_ipv4 0 +proxy.process.http.total_client_connections_ipv6 0 +proxy.process.http.total_server_connections 1 +proxy.process.http2.total_client_connections 0 +proxy.process.http.connect_requests 0 +proxy.process.tunnel.total_client_connections_blind_tcp 1 +proxy.process.tunnel.current_client_connections_blind_tcp 0 +proxy.process.tunnel.total_server_connections_blind_tcp 1 +proxy.process.tunnel.current_server_connections_blind_tcp 0 +proxy.process.tunnel.total_client_connections_tls_tunnel 0 +proxy.process.tunnel.current_client_connections_tls_tunnel 0 +proxy.process.tunnel.total_client_connections_tls_forward 0 +proxy.process.tunnel.current_client_connections_tls_forward 0 +proxy.process.tunnel.total_client_connections_tls_partial_blind 0 +proxy.process.tunnel.current_client_connections_tls_partial_blind 0 +proxy.process.tunnel.total_client_connections_tls_http 0 +proxy.process.tunnel.current_client_connections_tls_http 0 +proxy.process.tunnel.total_server_connections_tls 0 +proxy.process.tunnel.current_server_connections_tls 0 diff --git a/tests/gold_tests/remap/remap_https.test.py b/tests/gold_tests/remap/remap_https.test.py index 02375286e3c..973edcb6226 100644 --- a/tests/gold_tests/remap/remap_https.test.py +++ b/tests/gold_tests/remap/remap_https.test.py @@ -20,6 +20,7 @@ Test a basic remap of a http connection ''' +Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True # Define default ATS ts = Test.MakeATSProcess("ts", enable_tls=True) diff --git a/tests/gold_tests/remap/remap_ws.test.py b/tests/gold_tests/remap/remap_ws.test.py index bcd2842758a..a25dccb17ef 100644 --- a/tests/gold_tests/remap/remap_ws.test.py +++ b/tests/gold_tests/remap/remap_ws.test.py @@ -20,6 +20,7 @@ Test a basic remap of a websocket connections ''' +Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True ts = Test.MakeATSProcess("ts", enable_tls=True) diff --git a/tests/gold_tests/remap/remap_ws_uds.test.py b/tests/gold_tests/remap/remap_ws_uds.test.py new file mode 100644 index 00000000000..6c3d6f7aa30 --- /dev/null +++ b/tests/gold_tests/remap/remap_ws_uds.test.py @@ -0,0 +1,97 @@ +''' +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +Test.Summary = ''' +Test a basic remap of a websocket connections +''' + +Test.ContinueOnFail = True + +ts = Test.MakeATSProcess("ts", enable_tls=True) +server = Test.MakeOriginServer("server") + +testName = "Test WebSocket Remaps" +request_header = { + "headers": "GET /chat HTTP/1.1\r\nHost: www.example.com\r\nUpgrade: websocket\r\nConnection: Upgrade\r\n\r\n", + "body": None +} +response_header = { + "headers": + "HTTP/1.1 101 OK\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n\r\n", + "body": None +} +server.addResponse("sessionlog.json", request_header, response_header) + +ts.addDefaultSSLFiles() + +ts.Disk.records_config.update( + { + 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), + 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), + }) + +ts.Disk.remap_config.AddLines( + [ + 'map ws://www.example.com:{1} ws://127.0.0.1:{0}'.format(server.Variables.Port, ts.Variables.port), + 'map wss://www.example.com:{1} ws://127.0.0.1:{0}'.format(server.Variables.Port, ts.Variables.ssl_port), + ]) + +ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') + +# ws mapping +tr = Test.AddTestRun() +tr.MakeCurlCommand( + '--max-time 2 -v -s -q -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" -H "Sec-WebSocket-Version: 13" --http1.1 --resolve www.example.com:{0}:127.0.0.1 -k http://www.example.com:{0}/chat' + .format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 28 +tr.Processes.Default.Streams.stderr = "gold/remap-ws-upgrade.gold" +tr.StillRunningAfter = server +tr.StillRunningAfter = ts + +# Missing required headers (should result in 400) +tr = Test.AddTestRun() +tr.MakeCurlCommand( + '--max-time 2 -v -s -q -H "Connection: Upgrade" -H "Upgrade: websocket" --http1.1 --resolve www.example.com:{0}:127.0.0.1 -k http://www.example.com:{0}/chat' + .format(ts.Variables.port)) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stderr = "gold/remap-ws-upgrade-400.gold" +tr.StillRunningAfter = server +tr.StillRunningAfter = ts + +# Test metrics +tr = Test.AddTestRun() +tr.Processes.Default.Command = ( + f"{Test.Variables.AtsTestToolsDir}/stdout_wait" + " 'traffic_ctl metric get" + + " proxy.process.http.total_incoming_connections" + " proxy.process.http.total_client_connections" + + " proxy.process.http.total_client_connections_ipv4" + " proxy.process.http.total_client_connections_ipv6" + + " proxy.process.http.total_server_connections" + " proxy.process.http2.total_client_connections" + + " proxy.process.http.connect_requests" + " proxy.process.tunnel.total_client_connections_blind_tcp" + + " proxy.process.tunnel.current_client_connections_blind_tcp" + " proxy.process.tunnel.total_server_connections_blind_tcp" + + " proxy.process.tunnel.current_server_connections_blind_tcp" + " proxy.process.tunnel.total_client_connections_tls_tunnel" + + " proxy.process.tunnel.current_client_connections_tls_tunnel" + " proxy.process.tunnel.total_client_connections_tls_forward" + + " proxy.process.tunnel.current_client_connections_tls_forward" + + " proxy.process.tunnel.total_client_connections_tls_partial_blind" + + " proxy.process.tunnel.current_client_connections_tls_partial_blind" + + " proxy.process.tunnel.total_client_connections_tls_http" + " proxy.process.tunnel.current_client_connections_tls_http" + + " proxy.process.tunnel.total_server_connections_tls" + " proxy.process.tunnel.current_server_connections_tls'" + + f" {Test.TestDirectory}/gold/remap-ws-metrics.gold") +# Need to copy over the environment so traffic_ctl knows where to find the unix domain socket +tr.Processes.Default.Env = ts.Env +tr.Processes.Default.ReturnCode = 0 +tr.StillRunningAfter = server +tr.StillRunningAfter = ts diff --git a/tests/gold_tests/slow_post/server_abort.test.py b/tests/gold_tests/slow_post/server_abort.test.py index aaf4e266ab1..f0f65a5d3f4 100644 --- a/tests/gold_tests/slow_post/server_abort.test.py +++ b/tests/gold_tests/slow_post/server_abort.test.py @@ -20,6 +20,7 @@ Test.Summary = ''' AuTest with bad configuration of microserver to simulate server aborting the connection unexpectedly ''' +Test.SkipIf(Condition.CurlUds()) ts = Test.MakeATSProcess("ts", enable_tls=True) # note the microserver by default is not configured to use ssl server = Test.MakeOriginServer("server") diff --git a/tests/gold_tests/timeout/active_timeout.test.py b/tests/gold_tests/timeout/active_timeout.test.py index 5b9a3947f2e..36269874993 100644 --- a/tests/gold_tests/timeout/active_timeout.test.py +++ b/tests/gold_tests/timeout/active_timeout.test.py @@ -18,6 +18,7 @@ Test.Summary = 'Testing ATS active timeout' +Test.SkipIf(Condition.CurlUds()) Test.SkipUnless(Condition.HasCurlFeature('http2')) if Condition.HasATSFeature('TS_USE_QUIC') and Condition.HasCurlFeature('http3'): diff --git a/tests/gold_tests/timeout/active_timeout_uds.test.py b/tests/gold_tests/timeout/active_timeout_uds.test.py new file mode 100644 index 00000000000..97efafa38a5 --- /dev/null +++ b/tests/gold_tests/timeout/active_timeout_uds.test.py @@ -0,0 +1,42 @@ +''' +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +Test.Summary = 'Testing ATS active timeout' + +Test.SkipUnless(Condition.HasCurlFeature('http2')) + +ts = Test.MakeATSProcess("ts") +server = Test.MakeOriginServer("server", delay=8) + +request_header = {"headers": "GET /file HTTP/1.1\r\nHost: *\r\n\r\n", "timestamp": "5678", "body": ""} +response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "5678", "body": ""} + +server.addResponse("sessionfile.log", request_header, response_header) + +ts.Disk.records_config.update({ + 'proxy.config.url_remap.remap_required': 1, + 'proxy.config.http.transaction_active_timeout_out': 2, +}) + +ts.Disk.remap_config.AddLine('map / http://127.0.0.1:{0}/'.format(server.Variables.Port)) + +tr = Test.AddTestRun("tr") +tr.Processes.Default.StartBefore(server) +tr.Processes.Default.StartBefore(ts) +tr.MakeCurlCommand('-i http://127.0.0.1:{0}/file'.format(ts.Variables.port)) +tr.Processes.Default.Streams.stdout = Testers.ContainsExpression("Activity Timeout", "Request should fail with active timeout") diff --git a/tests/gold_tests/timeout/inactive_client_timeout.test.py b/tests/gold_tests/timeout/inactive_client_timeout.test.py index 272cb2fdc41..2518cc77da3 100644 --- a/tests/gold_tests/timeout/inactive_client_timeout.test.py +++ b/tests/gold_tests/timeout/inactive_client_timeout.test.py @@ -18,6 +18,7 @@ Test.Summary = 'Testing ATS client inactivity timeout' +Test.SkipIf(Condition.CurlUds()) ts = Test.MakeATSProcess("ts", enable_tls=True) replay_file = "slow_server.yaml" server = Test.MakeVerifierServerProcess("server", replay_file) diff --git a/tests/gold_tests/timeout/inactive_client_timeout_uds.test.py b/tests/gold_tests/timeout/inactive_client_timeout_uds.test.py new file mode 100644 index 00000000000..9e596915203 --- /dev/null +++ b/tests/gold_tests/timeout/inactive_client_timeout_uds.test.py @@ -0,0 +1,57 @@ +''' +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +Test.Summary = 'Testing ATS client inactivity timeout' + +ts = Test.MakeATSProcess("ts", enable_tls=True) +replay_file = "slow_server_uds.yaml" +server = Test.MakeVerifierServerProcess("server", replay_file) + +Test.ContinueOnFail = True + +ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 1, + 'proxy.config.diags.debug.tags': 'http', + 'proxy.config.url_remap.remap_required': 1, + 'proxy.config.http.transaction_no_activity_timeout_in': 2, + 'proxy.config.ssl.client.verify.server.policy': 'PERMISSIVE', + }) + +ts.Disk.remap_config.AddLines( + [ + 'map https://www.tls.com/ https://127.0.0.1:{0}'.format(server.Variables.https_port), + 'map / http://127.0.0.1:{0}'.format(server.Variables.http_port), + ]) +# +# Test 1: Verify that server delay does not trigger client activity timeout. +# + +# The Proxy Verifier server will delay for 3 seconds before returning a response. This is more than +# the 2 second proxy.config.http.transaction_no_activity_timeout_in (the client inactivity timeout), +# but less than the default 30 second proxy.config.http.transaction_no_activity_timeout_out (server +# inactivity timeout). These tests therefore exercise that the client inactivity timeout does not +# get applied after the request is sent. In other words, a slow to respond server should not +# trigger the client inactivity timeout. +tr = Test.AddTestRun("Verify that server delay does not trigger client activity timeout.") +client = tr.AddVerifierClientProcess("client", replay_file, http_ports=[ts.Variables.port], https_ports=[ts.Variables.ssl_port]) +tr.Processes.Default.StartBefore(ts) +tr.Processes.Default.StartBefore(server) + +client.Streams.All += Testers.ContainsExpression('x-response: 1', 'Verify that the first response is received') +client.Streams.All += Testers.ContainsExpression('x-response: 2', 'Verify that the second response is received') \ No newline at end of file diff --git a/tests/gold_tests/timeout/inactive_timeout.test.py b/tests/gold_tests/timeout/inactive_timeout.test.py index 94ccde20f9f..58fbe5c9c53 100644 --- a/tests/gold_tests/timeout/inactive_timeout.test.py +++ b/tests/gold_tests/timeout/inactive_timeout.test.py @@ -18,6 +18,7 @@ Test.Summary = 'Testing ATS inactivity timeout' +Test.SkipIf(Condition.CurlUds()) Test.SkipUnless(Condition.HasCurlFeature('http2')) ts = Test.MakeATSProcess("ts", enable_tls=True) diff --git a/tests/gold_tests/timeout/inactive_timeout_uds.test.py b/tests/gold_tests/timeout/inactive_timeout_uds.test.py new file mode 100644 index 00000000000..dde30442900 --- /dev/null +++ b/tests/gold_tests/timeout/inactive_timeout_uds.test.py @@ -0,0 +1,44 @@ +''' +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +Test.Summary = 'Testing ATS inactivity timeout' + +Test.SkipUnless(Condition.HasCurlFeature('http2')) + +ts = Test.MakeATSProcess("ts", enable_tls=True) +server = Test.MakeOriginServer("server", delay=8) + +request_header = {"headers": "GET /file HTTP/1.1\r\nHost: *\r\n\r\n", "timestamp": "5678", "body": ""} +response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "5678", "body": ""} + +server.addResponse("sessionfile.log", request_header, response_header) + +ts.Disk.records_config.update( + { + 'proxy.config.url_remap.remap_required': 1, + 'proxy.config.http.transaction_no_activity_timeout_out': 2, + }) + +ts.Disk.remap_config.AddLine('map / http://127.0.0.1:{0}/'.format(server.Variables.Port)) + +tr = Test.AddTestRun("tr") +tr.Processes.Default.StartBefore(server) +tr.Processes.Default.StartBefore(ts) +tr.MakeCurlCommand('-i http://127.0.0.1:{0}/file'.format(ts.Variables.port)) +tr.Processes.Default.Streams.stdout = Testers.ContainsExpression( + "Inactivity Timeout", "Request should fail with inactivity timeout") diff --git a/tests/gold_tests/timeout/slow_server_uds.yaml b/tests/gold_tests/timeout/slow_server_uds.yaml new file mode 100644 index 00000000000..fe97edf6d47 --- /dev/null +++ b/tests/gold_tests/timeout/slow_server_uds.yaml @@ -0,0 +1,83 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# This replay file assumes that caching is enabled and +# proxy.config.http.cache.ignore_client_cc_max_age is set to 0 so that we can +# test max-age in the client requests. +# + +meta: + version: "1.0" + + blocks: + - delayed_response: &delayed_response + delay: 3s + + status: 200 + reason: OK + headers: + fields: + - [ Content-Length, 16 ] + - [ Connection, close ] + +sessions: + +# +# An HTTP GET request. +# +- transactions: + - client-request: + method: "GET" + version: "1.1" + url: "/path/1" + headers: + fields: + - [ Host, www.no_tls.com ] + - [ uuid, 1 ] + + server-response: + <<: *delayed_response + headers: + fields: + - [ X-Response, 1 ] + + proxy-response: + status: 200 + +# +# An HTTP POST request. +# +- transactions: + - client-request: + method: "POST" + version: "1.1" + url: "/path/2" + headers: + fields: + - [ Host, www.no_tls.com ] + - [ Content-Length, 10 ] + - [ uuid, 2 ] + + server-response: + <<: *delayed_response + headers: + fields: + - [ X-Response, 2 ] + + proxy-response: + status: 200 + diff --git a/tests/gold_tests/tunnel/tunnel_transform.test.py b/tests/gold_tests/tunnel/tunnel_transform.test.py index 99db8124869..e8fd59fb786 100644 --- a/tests/gold_tests/tunnel/tunnel_transform.test.py +++ b/tests/gold_tests/tunnel/tunnel_transform.test.py @@ -26,6 +26,7 @@ Test the reported type of HTTP transactions and tunnels ''' +Test.SkipIf(Condition.CurlUds()) # Define default ATS. Disable the cache to simplify the test. ts = Test.MakeATSProcess("ts", enable_cache=False, enable_tls=True) ts.addSSLfile("../tls/ssl/server.pem") diff --git a/tests/gold_tests/tunnel/txn_type.test.py b/tests/gold_tests/tunnel/txn_type.test.py index 29681737b9e..8248bc10fb0 100644 --- a/tests/gold_tests/tunnel/txn_type.test.py +++ b/tests/gold_tests/tunnel/txn_type.test.py @@ -23,6 +23,7 @@ Test the reported type of HTTP transactions and tunnels ''' +Test.SkipIf(Condition.CurlUds()) # Define default ATS. Disable the cache to simplify the test. ts = Test.MakeATSProcess("ts", enable_cache=False, enable_tls=True) ts.addSSLfile("../tls/ssl/server.pem") From 32cf34a757ff1412a366955943609eb7cbaf0228 Mon Sep 17 00:00:00 2001 From: Serris Lew Date: Tue, 8 Apr 2025 11:39:12 -0700 Subject: [PATCH 2/5] Conditionalize bigobj & copy_config autests --- tests/gold_tests/basic/copy_config.test.py | 9 ++-- .../gold_tests/basic/copy_config_uds.test.py | 45 ------------------- tests/gold_tests/bigobj/bigobj.test.py | 42 +++++++++-------- 3 files changed, 28 insertions(+), 68 deletions(-) delete mode 100644 tests/gold_tests/basic/copy_config_uds.test.py diff --git a/tests/gold_tests/basic/copy_config.test.py b/tests/gold_tests/basic/copy_config.test.py index 9074e76ce3c..60d54ebef7d 100644 --- a/tests/gold_tests/basic/copy_config.test.py +++ b/tests/gold_tests/basic/copy_config.test.py @@ -15,19 +15,20 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import os Test.Summary = "Test start up of Traffic server with configuration modification of starting port of different servers at the same time" -Test.SkipIf(Condition.CurlUds()) # set up some ATS processes ts1 = Test.MakeATSProcess("ts1", select_ports=False) ts1.Variables.port = 8090 +uds_path = os.path.join(Test.RunDirectory, 'uds.socket') ts1.Disk.records_config.update({ - 'proxy.config.http.server_ports': str(ts1.Variables.port), + 'proxy.config.http.server_ports': str(ts1.Variables.port) + f" {uds_path}", }) ts1.Ready = When.PortOpen(ts1.Variables.port) -ts2 = Test.MakeATSProcess("ts2", select_ports=False) +ts2 = Test.MakeATSProcess("ts2", select_ports=False, enable_uds=False) ts2.Variables.port = 8091 ts2.Disk.records_config.update({ 'proxy.config.http.server_ports': str(ts2.Variables.port), @@ -45,7 +46,7 @@ # setup a testrun t = Test.AddTestRun("Talk to ts2") -t.MakeCurlCommand("127.0.0.1:{port}".format(port=ts2.Variables.port)) +t.MakeCurlCommandMulti("{{curl_base}} 127.0.0.1:{port}".format(port=ts2.Variables.port)) t.ReturnCode = 0 t.StillRunningAfter = ts1 t.StillRunningAfter += ts2 diff --git a/tests/gold_tests/basic/copy_config_uds.test.py b/tests/gold_tests/basic/copy_config_uds.test.py deleted file mode 100644 index bbe366fd2f1..00000000000 --- a/tests/gold_tests/basic/copy_config_uds.test.py +++ /dev/null @@ -1,45 +0,0 @@ -''' -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import os - -Test.Summary = "Test start up of Traffic server with configuration modification of starting port of different servers at the same time" - -# set up some ATS processes -ts1 = Test.MakeATSProcess("ts1", select_ports=False) -ts1.Variables.port = 8090 -uds_path = os.path.join(Test.RunDirectory, 'uds.socket') -ts1.Disk.records_config.update({ - 'proxy.config.http.server_ports': str(ts1.Variables.port) + f" {uds_path}", -}) -ts1.Ready = When.PortOpen(ts1.Variables.port) - -ts2 = Test.MakeATSProcess("ts2", select_ports=False) -ts2.Variables.port = 8091 -ts2.Disk.records_config.update({ - 'proxy.config.http.server_ports': str(ts2.Variables.port), -}) -ts2.Ready = When.PortOpen(ts2.Variables.port) - -# setup a testrun -t = Test.AddTestRun("Talk to ts1") -t.Processes.Default.StartBefore(ts1) -t.Processes.Default.StartBefore(ts2) -t.MakeCurlCommand("127.0.0.1:{port}".format(port=ts1.Variables.port)) -t.ReturnCode = 0 -t.StillRunningAfter = ts1 -t.StillRunningAfter += ts2 diff --git a/tests/gold_tests/bigobj/bigobj.test.py b/tests/gold_tests/bigobj/bigobj.test.py index e2901102936..3263074bf41 100644 --- a/tests/gold_tests/bigobj/bigobj.test.py +++ b/tests/gold_tests/bigobj/bigobj.test.py @@ -19,7 +19,6 @@ Test.Summary = ''' Test PUSHing an object into the cache and the GETting it with a few variations on the client connection protocol. ''' -Test.SkipIf(Condition.CurlUds()) # NOTE: You can also use this to test client-side communication when GET-ing very large (multi-GB) objects # by increasing the value of the obj_kilobytes variable below. (But do not increase it on any shared branch @@ -64,6 +63,10 @@ def create_pushfile(): return True +ipv4flag = "" +if not Condition.CurlUds(): + ipv4flag = "--ipv4" + tr = Test.AddTestRun("PUSH an object to the cache") # Delay on readiness of TS IPv4 ssl port tr.Processes.Default.StartBefore(ts, ready=lambda: create_pushfile()) @@ -76,28 +79,29 @@ def create_pushfile(): tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/1.1 201 Created", "The PUSH request should have succeeded") tr = Test.AddTestRun("GET bigobj: cleartext, HTTP/1.1, IPv4") -tr.MakeCurlCommand(f'--verbose --ipv4 --http1.1 http://localhost:{ts.Variables.port}/bigobj') -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/1.1 200 OK", "Should fetch pushed object") -tr.Processes.Default.Streams.All = Testers.ContainsExpression("Content-length: 102400", "Content size should be accurate") - -tr = Test.AddTestRun("GET bigobj: TLS, HTTP/1.1, IPv4") -tr.MakeCurlCommand(f'--verbose --ipv4 --http1.1 --insecure https://localhost:{ts.Variables.ssl_port}/bigobj') +tr.MakeCurlCommand(f'--verbose {ipv4flag} --http1.1 http://localhost:{ts.Variables.port}/bigobj') tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/1.1 200 OK", "Should fetch pushed object") tr.Processes.Default.Streams.All = Testers.ContainsExpression("Content-length: 102400", "Content size should be accurate") -tr = Test.AddTestRun("GET bigobj: TLS, HTTP/2, IPv4") -tr.MakeCurlCommand(f'--verbose --ipv4 --http2 --insecure https://localhost:{ts.Variables.ssl_port}/bigobj') -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/2 200", "Should fetch pushed object") -tr.Processes.Default.Streams.All = Testers.ContainsExpression("content-length: 102400", "Content size should be accurate") - -tr = Test.AddTestRun("GET bigobj: TLS, HTTP/2, IPv6") -tr.MakeCurlCommand(f'--verbose --ipv6 --http2 --insecure https://localhost:{ts.Variables.ssl_portv6}/bigobj') -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/2 200", "Should fetch pushed object") -tr.Processes.Default.Streams.All = Testers.ContainsExpression("content-length: 102400", "Content size should be accurate") +if not Condition.CurlUds(): + tr = Test.AddTestRun("GET bigobj: TLS, HTTP/1.1, IPv4") + tr.MakeCurlCommand(f'--verbose --ipv4 --http1.1 --insecure https://localhost:{ts.Variables.ssl_port}/bigobj') + tr.Processes.Default.ReturnCode = 0 + tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/1.1 200 OK", "Should fetch pushed object") + tr.Processes.Default.Streams.All = Testers.ContainsExpression("Content-length: 102400", "Content size should be accurate") + + tr = Test.AddTestRun("GET bigobj: TLS, HTTP/2, IPv4") + tr.MakeCurlCommand(f'--verbose --ipv4 --http2 --insecure https://localhost:{ts.Variables.ssl_port}/bigobj') + tr.Processes.Default.ReturnCode = 0 + tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/2 200", "Should fetch pushed object") + tr.Processes.Default.Streams.All = Testers.ContainsExpression("content-length: 102400", "Content size should be accurate") + + tr = Test.AddTestRun("GET bigobj: TLS, HTTP/2, IPv6") + tr.MakeCurlCommand(f'--verbose --ipv6 --http2 --insecure https://localhost:{ts.Variables.ssl_portv6}/bigobj') + tr.Processes.Default.ReturnCode = 0 + tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/2 200", "Should fetch pushed object") + tr.Processes.Default.Streams.All = Testers.ContainsExpression("content-length: 102400", "Content size should be accurate") # Verify that PUSH requests are rejected when push_method_enabled is 0 (the # default configuration). From 4f35a44185903855f3d81ebe029234cf2d8dba5e Mon Sep 17 00:00:00 2001 From: Serris Lew Date: Fri, 11 Apr 2025 17:59:22 -0700 Subject: [PATCH 3/5] set uds_path in ts runtime dir, not test runtime dir --- tests/gold_tests/autest-site/curl.test.ext | 10 +++------- tests/gold_tests/autest-site/trafficserver.test.ext | 4 +--- tests/gold_tests/bigobj/bigobj.test.py | 8 +++++--- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/tests/gold_tests/autest-site/curl.test.ext b/tests/gold_tests/autest-site/curl.test.ext index 35bbd49d9e0..07d8934ff2a 100644 --- a/tests/gold_tests/autest-site/curl.test.ext +++ b/tests/gold_tests/autest-site/curl.test.ext @@ -30,11 +30,10 @@ Tools to help with TestRun commands # -def spawn_curl_commands(self, cmdstr, count, retcode=0, use_default=True): +def spawn_curl_commands(self, cmdstr, count, retcode=0, use_default=True, uds_path=""): ret = [] if self.Variables.get("CurlUds", False): - uds_path = os.path.join(self.Processes.Default.RunDirectory, 'uds.socket') cmdstr = f'curl --unix-socket {uds_path} ' + cmdstr else: cmdstr = 'curl ' + cmdstr @@ -49,22 +48,19 @@ def spawn_curl_commands(self, cmdstr, count, retcode=0, use_default=True): return ret -def curl_command(self, cmd, uds_suffix="", p=None): +def curl_command(self, cmd, uds_path="", p=None): if p == None: p = self.Processes.Default if self.Variables.get("CurlUds", False): - uds_path = os.path.join(p.RunDirectory, 'uds.socket') - uds_path += uds_suffix p.Command = f'curl --unix-socket {uds_path} ' + cmd else: p.Command = 'curl ' + cmd return p -def curl_multiple_commands(self, cmd): +def curl_multiple_commands(self, cmd, uds_path=""): p = self.Processes.Default if self.Variables.get("CurlUds", False): - uds_path = os.path.join(p.RunDirectory, 'uds.socket') p.Command = cmd.format(curl=f'curl --unix-socket {uds_path}', curl_base='curl') else: p.Command = cmd.format(curl='curl', curl_base='curl') diff --git a/tests/gold_tests/autest-site/trafficserver.test.ext b/tests/gold_tests/autest-site/trafficserver.test.ext index fe74fafc0ef..59a4849b087 100755 --- a/tests/gold_tests/autest-site/trafficserver.test.ext +++ b/tests/gold_tests/autest-site/trafficserver.test.ext @@ -53,7 +53,6 @@ def MakeATSProcess( enable_cache=True, enable_quic=False, enable_uds=True, - uds_path_suffix='', block_for_debug=False, log_data=default_log_data, use_traffic_out=True, @@ -369,8 +368,7 @@ def MakeATSProcess( p.Variables.ssl_portv6 = 4444 # unix domain socket path - uds_path = os.path.join(obj.RunDirectory, 'uds.socket') - uds_path += uds_path_suffix # to allow multiple sockets in one test file + uds_path = os.path.join(runtime_dir, 'uds.socket') p.Variables.uds_path = uds_path get_port(p, "manager_port") diff --git a/tests/gold_tests/bigobj/bigobj.test.py b/tests/gold_tests/bigobj/bigobj.test.py index 3263074bf41..9fe9045e642 100644 --- a/tests/gold_tests/bigobj/bigobj.test.py +++ b/tests/gold_tests/bigobj/bigobj.test.py @@ -74,12 +74,13 @@ def create_pushfile(): tr.MakeCurlCommand( "-v -H 'Content-Type: application/octet-stream' --data-binary @{}/objfile -X PUSH http://localhost:{}/bigobj -H 'Content-Length:{}'" .format(Test.RunDirectory, ts.Variables.port, - len(header) + obj_bytes)) + len(header) + obj_bytes), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/1.1 201 Created", "The PUSH request should have succeeded") tr = Test.AddTestRun("GET bigobj: cleartext, HTTP/1.1, IPv4") -tr.MakeCurlCommand(f'--verbose {ipv4flag} --http1.1 http://localhost:{ts.Variables.port}/bigobj') +tr.MakeCurlCommand(f'--verbose {ipv4flag} --http1.1 http://localhost:{ts.Variables.port}/bigobj', uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/1.1 200 OK", "Should fetch pushed object") tr.Processes.Default.Streams.All = Testers.ContainsExpression("Content-length: 102400", "Content size should be accurate") @@ -129,7 +130,8 @@ def create_pushfile(): tr.MakeCurlCommand( "-v -H 'Content-Type: application/octet-stream' --data-binary @{}/objfile -X PUSH http://localhost:{}/bigobj -H 'Content-Length:{}'" .format(Test.RunDirectory, ts.Variables.port, - len(header) + obj_bytes)) + len(header) + obj_bytes), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = Testers.ContainsExpression( "403 Access Denied", "The PUSH request should have received a 403 response.") From f454a3b89cdabbae42b003e4b57c3ac7472df27b Mon Sep 17 00:00:00 2001 From: Serris Lew Date: Fri, 25 Apr 2025 14:23:33 -0700 Subject: [PATCH 4/5] Add ts runtimedir path, update existing autest for uds case instead of adding new autest --- tests/CMakeLists.txt | 2 +- tests/README.md | 2 +- .../autest-site/conditions.test.ext | 4 +- tests/gold_tests/basic/basic.test.py | 2 +- tests/gold_tests/basic/config.test.py | 5 +- tests/gold_tests/basic/copy_config.test.py | 5 +- tests/gold_tests/basic/copy_config2.test.py | 4 +- tests/gold_tests/bigobj/bigobj.test.py | 4 +- tests/gold_tests/bigobj/bigobj_uds.test.py | 112 ------ .../gold_tests/cache/background_fill.test.py | 20 +- .../cache/background_fill_uds.test.py | 132 ------- tests/gold_tests/cache/cache-control.test.py | 11 +- .../cache/cache-control_uds.test.py | 367 ------------------ .../cache/cache-generation-clear.test.py | 15 +- .../cache/cache-generation-disjoint.test.py | 18 +- .../cache/disjoint-wait-for-cache.test.py | 18 +- .../bad_chunked_encoding.test.py | 6 +- .../chunked_encoding/chunked_encoding.test.py | 36 +- .../chunked_encoding_h2.test.py | 2 +- .../chunked_encoding_uds.test.py | 238 ------------ tests/gold_tests/connect/connect.test.py | 20 +- tests/gold_tests/connect/connect_uds.test.py | 247 ------------ tests/gold_tests/continuations/double.test.py | 2 +- .../continuations/double_h2.test.py | 2 +- .../continuations/openclose.test.py | 2 +- .../continuations/openclose_h2.test.py | 2 +- .../continuations/session_id.test.py | 19 +- .../continuations/session_id_uds.test.py | 96 ----- tests/gold_tests/cripts/cripts.test.py | 3 +- tests/gold_tests/dns/splitdns.test.py | 4 +- .../early_hints/early_hints.test.py | 5 +- .../forward_proxy/forward_proxy.test.py | 2 +- tests/gold_tests/headers/accept_webp.test.py | 2 +- .../headers/cache_and_req_body.test.py | 2 +- .../gold_tests/headers/cachedIMSRange.test.py | 82 ++-- .../headers/cachedIMSRange_uds.test.py | 257 ------------ .../headers/field_name_space.test.py | 10 +- .../headers/field_name_space_uds.test.py | 48 --- tests/gold_tests/headers/forwarded.test.py | 2 +- .../headers/good_request_after_bad.test.py | 5 +- tests/gold_tests/headers/hsts.test.py | 2 +- tests/gold_tests/headers/normalize_ae.test.py | 19 +- .../headers/normalize_ae_uds.test.py | 143 ------- tests/gold_tests/headers/range.test.py | 23 +- tests/gold_tests/headers/syntax.test.py | 29 +- tests/gold_tests/headers/syntax_uds.test.py | 87 ----- tests/gold_tests/headers/via.test.py | 74 ++-- tests/gold_tests/headers/via_uds.test.py | 95 ----- tests/gold_tests/ip_allow/ip_allow.test.py | 2 +- ...ow_uds.test.py => ip_allow_pp_uds.test.py} | 2 +- tests/gold_tests/logging/all_headers.test.py | 45 ++- .../logging/all_headers_uds.test.py | 108 ------ ..._uds.test.py => custom-log-pp-uds.test.py} | 32 +- tests/gold_tests/logging/custom-log.test.py | 2 +- .../gold_tests/logging/log-field-json.test.py | 12 +- tests/gold_tests/logging/log-field.test.py | 9 +- .../gold_tests/logging/log-filenames.test.py | 4 +- .../logging/log-filenames_uds.test.py | 268 ------------- tests/gold_tests/logging/new_log_flds.test.py | 29 +- .../logging/new_log_flds_observer.py | 4 +- .../logging/new_log_flds_uds.test.py | 105 ----- tests/gold_tests/logging/pqsi-pqsp.test.py | 4 +- .../parent_config_dest_ip.test.py | 4 +- .../parent_config_dest_ip_uds.test.py | 125 ------ .../strategies_ch/strategies_ch.test.py | 2 +- .../strategies_ch2/strategies_ch2.test.py | 4 +- .../strategies_stale/strategies_stale.test.py | 4 +- .../zzz_strategies_peer.test.py | 8 +- .../zzz_strategies_peer2.test.py | 8 +- .../null_transform/null_transform.test.py | 3 +- .../per_server_connection_max.test.py | 11 +- .../pluginTest/TSVConnFd/TSVConnFd.test.py | 7 +- .../TSVConnFd/TSVConnFd_uds.test.py | 67 ---- .../cache_range_requests.test.py | 31 +- ..._requests_cache_complete_responses.test.py | 30 +- .../cache_range_requests_cachekey.test.py | 6 +- ...che_range_requests_cachekey_global.test.py | 2 +- .../cache_range_requests_ident.test.py | 18 +- .../cache_range_requests_ims.test.py | 8 +- .../cert_update/cert_update.test.py | 2 +- .../client_context_dump.test.py | 2 +- .../pluginTest/compress/compress.test.py | 28 +- .../cookie_remap/bucketcookie.test.py | 6 +- .../cookie_remap/collapseslashes.test.py | 3 +- .../pluginTest/cookie_remap/connector.test.py | 6 +- .../cookie_remap/existscookie.test.py | 6 +- .../cookie_remap/matchcookie.test.py | 6 +- .../pluginTest/cookie_remap/matchuri.test.py | 6 +- .../cookie_remap/notexistscookie.test.py | 6 +- .../cookie_remap/pcollapseslashes.test.py | 3 +- .../cookie_remap/psubstitute.test.py | 12 +- .../cookie_remap/regexcookie.test.py | 6 +- .../pluginTest/cookie_remap/setstatus.test.py | 6 +- .../pluginTest/cookie_remap/subcookie.test.py | 6 +- .../cookie_remap/substitute.test.py | 12 +- tests/gold_tests/pluginTest/esi/esi.test.py | 21 +- .../gold_tests/pluginTest/esi/esi_304.test.py | 6 +- .../header_rewrite/header_rewrite.test.py | 3 +- .../header_rewrite_cond_cache.test.py | 2 +- .../header_rewrite_cond_method.test.py | 6 +- .../header_rewrite_cond_ssn_txn_count.test.py | 2 +- .../header_rewrite_l_value.test.py | 3 +- .../header_rewrite_set_body_from.test.py | 20 +- .../header_rewrite/header_rewrite_url.test.py | 6 +- .../header_rewrite_url_glob.test.py | 6 +- .../pluginTest/lua/lua_client_hook.test.py | 2 +- .../pluginTest/lua/lua_debug_tags.test.py | 2 +- .../pluginTest/lua/lua_header_table.test.py | 3 +- .../pluginTest/lua/lua_states_stats.test.py | 2 +- .../pluginTest/lua/lua_watermark.test.py | 2 +- .../money_trace/money_trace.test.py | 29 +- .../money_trace/money_trace_global.test.py | 6 +- .../origin_server_auth.test.py | 7 +- .../polite_hook_wait/polite_hook_wait.test.py | 13 +- .../polite_hook_wait_uds.test.py | 63 --- .../prefetch/prefetch_bignum.test.py | 4 +- .../pluginTest/prefetch/prefetch_cmcd.test.py | 29 +- .../prefetch/prefetch_overflow.test.py | 4 +- .../prefetch/prefetch_simple.test.py | 3 +- .../regex_remap/regex_remap.test.py | 11 +- .../regex_revalidate/regex_revalidate.test.py | 18 +- .../regex_revalidate_miss.test.py | 18 +- .../remap_stats/remap_stats.test.py | 6 +- .../remap_stats/remap_stats_post.test.py | 6 +- .../gold_tests/pluginTest/slice/slice.test.py | 20 +- .../slice/slice_conditional.test.py | 12 +- .../pluginTest/slice/slice_crr_ident.test.py | 10 +- .../pluginTest/slice/slice_error.test.py | 8 +- .../pluginTest/slice/slice_ident.test.py | 14 +- .../pluginTest/slice/slice_prefetch.test.py | 12 +- .../pluginTest/slice/slice_regex.test.py | 8 +- .../slice/slice_selfhealing.test.py | 33 +- .../pluginTest/sslheaders/sslheaders.test.py | 2 +- .../stats_over_http/stats_over_http.test.py | 2 +- .../pluginTest/test_hooks/body_buffer.test.py | 9 +- .../pluginTest/test_hooks/hook_add.test.py | 9 +- .../test_hooks/hook_add_uds.test.py | 54 --- .../test_hooks/ssn_start_delay_hook.test.py | 9 +- .../ssn_start_delay_hook_uds.test.py | 56 --- .../pluginTest/test_hooks/test_hooks.test.py | 33 +- .../test_hooks/test_hooks_uds.test.py | 77 ---- .../gold_tests/pluginTest/tsapi/log_uds.gold | 6 + .../gold_tests/pluginTest/tsapi/tsapi.test.py | 29 +- .../pluginTest/tsapi/tsapi_uds.test.py | 90 ----- .../uri_signing/uri_signing.test.py | 48 +-- .../pluginTest/url_sig/url_sig.test.py | 58 ++- .../pluginTest/url_sig/url_sig_uds.test.py | 266 ------------- tests/gold_tests/post/post-continue.test.py | 2 +- .../gold_tests/post/post-early-return.test.py | 2 +- .../post_slow_server/post_slow_server.test.py | 3 +- .../post_slow_server_max_requests_in.test.py | 8 +- .../proxy_serve_stale_dns_fail.test.py | 2 +- .../redirect/number_of_redirects.test.py | 3 +- .../gold_tests/redirect/redirect_post.test.py | 3 +- .../remap/basic_conf_remap_yaml.test.py | 23 +- .../remap/basic_conf_remap_yaml_uds.test.py | 183 --------- tests/gold_tests/remap/regex_map.test.py | 3 +- tests/gold_tests/remap/remap_http.test.py | 36 +- tests/gold_tests/remap/remap_https.test.py | 2 +- .../gold_tests/remap/remap_ip_resolve.test.py | 6 +- tests/gold_tests/remap/remap_ws.test.py | 33 +- tests/gold_tests/remap/remap_ws_uds.test.py | 97 ----- .../session_sharing/session_match.test.py | 3 +- .../gold_tests/slow_post/server_abort.test.py | 2 +- .../gold_tests/timeout/active_timeout.test.py | 28 +- .../timeout/active_timeout_uds.test.py | 42 -- .../timeout/inactive_client_timeout.test.py | 18 +- .../inactive_client_timeout_uds.test.py | 57 --- .../timeout/inactive_timeout.test.py | 23 +- .../timeout/inactive_timeout_uds.test.py | 44 --- .../gold_tests/tls/tls_client_verify3.test.py | 18 +- .../traffic_ctl/remap_inc/remap_inc.test.py | 2 +- .../tunnel/tunnel_transform.test.py | 2 +- tests/gold_tests/tunnel/txn_type.test.py | 2 +- 174 files changed, 1005 insertions(+), 4177 deletions(-) delete mode 100644 tests/gold_tests/bigobj/bigobj_uds.test.py delete mode 100644 tests/gold_tests/cache/background_fill_uds.test.py delete mode 100644 tests/gold_tests/cache/cache-control_uds.test.py delete mode 100644 tests/gold_tests/chunked_encoding/chunked_encoding_uds.test.py delete mode 100644 tests/gold_tests/connect/connect_uds.test.py delete mode 100644 tests/gold_tests/continuations/session_id_uds.test.py delete mode 100644 tests/gold_tests/headers/cachedIMSRange_uds.test.py delete mode 100644 tests/gold_tests/headers/field_name_space_uds.test.py delete mode 100644 tests/gold_tests/headers/normalize_ae_uds.test.py delete mode 100644 tests/gold_tests/headers/syntax_uds.test.py delete mode 100644 tests/gold_tests/headers/via_uds.test.py rename tests/gold_tests/ip_allow/{ip_allow_uds.test.py => ip_allow_pp_uds.test.py} (99%) delete mode 100644 tests/gold_tests/logging/all_headers_uds.test.py rename tests/gold_tests/logging/{custom-log_uds.test.py => custom-log-pp-uds.test.py} (67%) delete mode 100644 tests/gold_tests/logging/log-filenames_uds.test.py delete mode 100644 tests/gold_tests/logging/new_log_flds_uds.test.py delete mode 100644 tests/gold_tests/next_hop/parent_config/parent_config_dest_ip_uds.test.py delete mode 100644 tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd_uds.test.py delete mode 100644 tests/gold_tests/pluginTest/polite_hook_wait/polite_hook_wait_uds.test.py delete mode 100644 tests/gold_tests/pluginTest/test_hooks/hook_add_uds.test.py delete mode 100644 tests/gold_tests/pluginTest/test_hooks/ssn_start_delay_hook_uds.test.py delete mode 100644 tests/gold_tests/pluginTest/test_hooks/test_hooks_uds.test.py delete mode 100644 tests/gold_tests/pluginTest/tsapi/tsapi_uds.test.py delete mode 100644 tests/gold_tests/pluginTest/url_sig/url_sig_uds.test.py delete mode 100644 tests/gold_tests/remap/basic_conf_remap_yaml_uds.test.py delete mode 100644 tests/gold_tests/remap/remap_ws_uds.test.py delete mode 100644 tests/gold_tests/timeout/active_timeout_uds.test.py delete mode 100644 tests/gold_tests/timeout/inactive_client_timeout_uds.test.py delete mode 100644 tests/gold_tests/timeout/inactive_timeout_uds.test.py diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 11f51a4b652..5c1a415601b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -51,6 +51,7 @@ if(ENABLE_AUTEST_UDS) PATTERN "*" PATTERN "h2" EXCLUDE PATTERN "tls*" EXCLUDE + PATTERN "tls/ssl/**" ) else() # Copy everything except autest_uds tests that are only for curl uds option @@ -59,7 +60,6 @@ else() DESTINATION ${CMAKE_GOLD_DIR} FILES_MATCHING PATTERN "*" - PATTERN "*_uds.test.py" EXCLUDE ) add_subdirectory(gold_tests_filtered/tls) endif() diff --git a/tests/README.md b/tests/README.md index a1dea3cf1cd..0f7b19bd72f 100644 --- a/tests/README.md +++ b/tests/README.md @@ -132,7 +132,7 @@ ts=Test.MakeATSProcess("ts") #first test is a miss for default tr=Test.AddTestRun() # get port for command from Variables -tr.MakeCurlCommand('"http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port)) +tr.MakeCurlCommand('"http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) ``` diff --git a/tests/gold_tests/autest-site/conditions.test.ext b/tests/gold_tests/autest-site/conditions.test.ext index 12112a47a8c..ed2656a32c7 100644 --- a/tests/gold_tests/autest-site/conditions.test.ext +++ b/tests/gold_tests/autest-site/conditions.test.ext @@ -110,7 +110,7 @@ def PluginExists(self, pluginname): return self.Condition(lambda: os.path.isfile(path), path + " not found.") -def CurlUds(self): +def CurlUsingUnixDomainSocket(self): return self.Condition(lambda: self.Variables.get("CurlUds", False), "Curl using UDS. Not relevant for test") @@ -123,4 +123,4 @@ ExtendCondition(HasCurlVersion) ExtendCondition(HasCurlFeature) ExtendCondition(HasCurlOption) ExtendCondition(PluginExists) -ExtendCondition(CurlUds) +ExtendCondition(CurlUsingUnixDomainSocket) diff --git a/tests/gold_tests/basic/basic.test.py b/tests/gold_tests/basic/basic.test.py index 1b8e7db599f..6c0f02ed6f0 100644 --- a/tests/gold_tests/basic/basic.test.py +++ b/tests/gold_tests/basic/basic.test.py @@ -25,6 +25,6 @@ t.StillRunningAfter = Test.Processes.ts p = t.Processes.Default -t.MakeCurlCommand("http://127.0.0.1:{0}".format(ts.Variables.port)) +t.MakeCurlCommand("http://127.0.0.1:{0}".format(ts.Variables.port), uds_path=ts.Variables.uds_path) p.ReturnCode = 0 p.StartBefore(Test.Processes.ts) diff --git a/tests/gold_tests/basic/config.test.py b/tests/gold_tests/basic/config.test.py index 20b34853155..eb2e5ea94b5 100644 --- a/tests/gold_tests/basic/config.test.py +++ b/tests/gold_tests/basic/config.test.py @@ -21,13 +21,12 @@ ts = Test.MakeATSProcess("ts", select_ports=False) ts.Variables.port = 8090 -uds_path = os.path.join(Test.RunDirectory, 'uds.socket') ts.Disk.records_config.update({ - 'proxy.config.http.server_ports': str(ts.Variables.port) + f" {uds_path}", + 'proxy.config.http.server_ports': str(ts.Variables.port) + f" {ts.Variables.uds_path}", }) ts.Ready = When.PortOpen(ts.Variables.port) t = Test.AddTestRun("Test traffic server started properly") t.Processes.Default.StartBefore(ts) -t.MakeCurlCommand("127.0.0.1:{port}".format(port=ts.Variables.port)) +t.MakeCurlCommand("127.0.0.1:{port}".format(port=ts.Variables.port), uds_path=ts.Variables.uds_path) t.ReturnCode = 0 t.StillRunningAfter = ts diff --git a/tests/gold_tests/basic/copy_config.test.py b/tests/gold_tests/basic/copy_config.test.py index 60d54ebef7d..7f35a843e99 100644 --- a/tests/gold_tests/basic/copy_config.test.py +++ b/tests/gold_tests/basic/copy_config.test.py @@ -22,9 +22,8 @@ # set up some ATS processes ts1 = Test.MakeATSProcess("ts1", select_ports=False) ts1.Variables.port = 8090 -uds_path = os.path.join(Test.RunDirectory, 'uds.socket') ts1.Disk.records_config.update({ - 'proxy.config.http.server_ports': str(ts1.Variables.port) + f" {uds_path}", + 'proxy.config.http.server_ports': str(ts1.Variables.port) + f" {ts1.Variables.uds_path}", }) ts1.Ready = When.PortOpen(ts1.Variables.port) @@ -39,7 +38,7 @@ t = Test.AddTestRun("Talk to ts1") t.Processes.Default.StartBefore(ts1) t.Processes.Default.StartBefore(ts2) -t.MakeCurlCommand("127.0.0.1:{port}".format(port=ts1.Variables.port)) +t.MakeCurlCommand("127.0.0.1:{port}".format(port=ts1.Variables.port), uds_path=ts1.Variables.uds_path) t.ReturnCode = 0 t.StillRunningAfter = ts1 t.StillRunningAfter += ts2 diff --git a/tests/gold_tests/basic/copy_config2.test.py b/tests/gold_tests/basic/copy_config2.test.py index 8a6332f4af3..1eb5a5bf01e 100644 --- a/tests/gold_tests/basic/copy_config2.test.py +++ b/tests/gold_tests/basic/copy_config2.test.py @@ -27,7 +27,7 @@ t.StillRunningAfter = ts1 t.StillRunningAfter += ts2 p = t.Processes.Default -t.MakeCurlCommand("127.0.0.1:{0}".format(ts1.Variables.port)) +t.MakeCurlCommand("127.0.0.1:{0}".format(ts1.Variables.port), uds_path=ts1.Variables.uds_path) p.ReturnCode = 0 p.StartBefore(Test.Processes.ts1) p.StartBefore(Test.Processes.ts2) @@ -39,5 +39,5 @@ t.StillRunningAfter = ts1 t.StillRunningAfter += ts2 p = t.Processes.Default -t.MakeCurlCommand("127.0.0.1:{0}".format(ts2.Variables.port)) +t.MakeCurlCommand("127.0.0.1:{0}".format(ts2.Variables.port), uds_path=ts2.Variables.uds_path) p.ReturnCode = 0 diff --git a/tests/gold_tests/bigobj/bigobj.test.py b/tests/gold_tests/bigobj/bigobj.test.py index 9fe9045e642..b8a64c37d55 100644 --- a/tests/gold_tests/bigobj/bigobj.test.py +++ b/tests/gold_tests/bigobj/bigobj.test.py @@ -64,7 +64,7 @@ def create_pushfile(): ipv4flag = "" -if not Condition.CurlUds(): +if not Condition.CurlUsingUnixDomainSocket(): ipv4flag = "--ipv4" tr = Test.AddTestRun("PUSH an object to the cache") @@ -85,7 +85,7 @@ def create_pushfile(): tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/1.1 200 OK", "Should fetch pushed object") tr.Processes.Default.Streams.All = Testers.ContainsExpression("Content-length: 102400", "Content size should be accurate") -if not Condition.CurlUds(): +if not Condition.CurlUsingUnixDomainSocket(): tr = Test.AddTestRun("GET bigobj: TLS, HTTP/1.1, IPv4") tr.MakeCurlCommand(f'--verbose --ipv4 --http1.1 --insecure https://localhost:{ts.Variables.ssl_port}/bigobj') tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/bigobj/bigobj_uds.test.py b/tests/gold_tests/bigobj/bigobj_uds.test.py deleted file mode 100644 index eb9942bf73c..00000000000 --- a/tests/gold_tests/bigobj/bigobj_uds.test.py +++ /dev/null @@ -1,112 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -Test.Summary = ''' -Test PUSHing an object into the cache and the GETting it with a few variations on the client connection protocol. -''' - -# NOTE: You can also use this to test client-side communication when GET-ing very large (multi-GB) objects -# by increasing the value of the obj_kilobytes variable below. (But do not increase it on any shared branch -# that we do CI runs on.) - -Test.SkipUnless(Condition.HasCurlFeature('http2')) - -ts = Test.MakeATSProcess("ts1", enable_tls=True) -ts.addDefaultSSLFiles() - -ts.Disk.records_config.update( - { - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.diags.debug.tags': 'http|dns|cache', - 'proxy.config.http.cache.required_headers': 0, # No required headers for caching - 'proxy.config.http.push_method_enabled': 1, - 'proxy.config.proxy_name': 'Poxy_Proxy', # This will be the server name. - 'proxy.config.ssl.server.cert.path': ts.Variables.SSLDir, - 'proxy.config.ssl.server.private_key.path': ts.Variables.SSLDir, - 'proxy.config.url_remap.remap_required': 0 - }) - -ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') - -ts.Disk.remap_config.AddLine(f'map https://localhost:{ts.Variables.ssl_port} http://localhost:{ts.Variables.port}') -ts.Disk.remap_config.AddLine(f'map https://localhost:{ts.Variables.ssl_portv6} http://localhost:{ts.Variables.port}') - -# Size of object to get. (NOTE: If you increase this significantly you may also have to increase cache -# capacity in tests/gold_tests/autest-size/min_cfg/storage.config. Also, for very large objects, if -# proxy.config.diags.debug.enabled is 1, the PUSH request will timeout and fail.) -# -obj_kilobytes = 10 * 1024 -obj_bytes = obj_kilobytes * 10 -header = "HTTP/1.1 200 OK\r\nContent-length: {}\r\n\r\n".format(obj_bytes) - - -def create_pushfile(): - f = open(Test.RunDirectory + "/objfile", "w") - f.write(header) - f.write("x" * obj_bytes) - f.close() - return True - - -tr = Test.AddTestRun("PUSH an object to the cache") -# Delay on readiness of TS IPv4 ssl port -tr.Processes.Default.StartBefore(ts, ready=lambda: create_pushfile()) -# Put object with URL http://localhost/bigobj in cache using PUSH request. -tr.MakeCurlCommand( - "-v -H 'Content-Type: application/octet-stream' --data-binary @{}/objfile -X PUSH http://localhost:{}/bigobj -H 'Content-Length:{}'" - .format(Test.RunDirectory, ts.Variables.port, - len(header) + obj_bytes)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/1.1 201 Created", "The PUSH request should have succeeded") - -tr = Test.AddTestRun("GET bigobj: cleartext, HTTP/1.1, IPv4") -tr.MakeCurlCommand(f'--verbose --http1.1 http://localhost:{ts.Variables.port}/bigobj') -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/1.1 200 OK", "Should fetch pushed object") -tr.Processes.Default.Streams.All = Testers.ContainsExpression("Content-length: 102400", "Content size should be accurate") - -# Verify that PUSH requests are rejected when push_method_enabled is 0 (the -# default configuration). -ts = Test.MakeATSProcess("ts2", enable_tls=True) -ts.addDefaultSSLFiles() - -ts.Disk.records_config.update( - { - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.diags.debug.tags': 'http|dns|cache', - 'proxy.config.http.cache.required_headers': 0, # No required headers for caching - 'proxy.config.proxy_name': 'Poxy_Proxy', # This will be the server name. - 'proxy.config.ssl.server.cert.path': ts.Variables.SSLDir, - 'proxy.config.ssl.server.private_key.path': ts.Variables.SSLDir, - 'proxy.config.url_remap.remap_required': 0 - }) - -ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') - -ts.Disk.remap_config.AddLine(f'map https://localhost:{ts.Variables.ssl_port} http://localhost:{ts.Variables.port}') -ts.Disk.remap_config.AddLine(f'map https://localhost:{ts.Variables.ssl_portv6} http://localhost:{ts.Variables.port}') - -tr = Test.AddTestRun("PUSH request is rejected when push_method_enabled is 0") -tr.Processes.Default.StartBefore(ts) -tr.MakeCurlCommand( - "-v -H 'Content-Type: application/octet-stream' --data-binary @{}/objfile -X PUSH http://localhost:{}/bigobj -H 'Content-Length:{}'" - .format(Test.RunDirectory, ts.Variables.port, - len(header) + obj_bytes)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.All = Testers.ContainsExpression( - "403 Access Denied", "The PUSH request should have received a 403 response.") diff --git a/tests/gold_tests/cache/background_fill.test.py b/tests/gold_tests/cache/background_fill.test.py index d7a281cf946..e321eadc49b 100644 --- a/tests/gold_tests/cache/background_fill.test.py +++ b/tests/gold_tests/cache/background_fill.test.py @@ -20,7 +20,6 @@ Test.Summary = 'Exercise Background Fill' Test.SkipUnless(Condition.HasCurlFeature('http2'), Condition.HasProxyVerifierVersion('2.8.0')) -Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True @@ -55,7 +54,8 @@ def __setupTS(self, ts_names=['default']): self.ts[name].Disk.records_config.update( { - "proxy.config.http.server_ports": f"{self.ts[name].Variables.port} {self.ts[name].Variables.ssl_port}:ssl", + "proxy.config.http.server_ports": + f"{self.ts[name].Variables.port} {self.ts[name].Variables.ssl_port}:ssl {self.ts[name].Variables.uds_path}", "proxy.config.http.background_fill_active_timeout": "0", "proxy.config.http.background_fill_completed_threshold": "0.0", "proxy.config.http.cache.required_headers": 0, # Force cache @@ -113,7 +113,8 @@ def __testCase0(self): timeout 2 {{curl}} --http1.1 -vs http://127.0.0.1:{self.ts['for_httpbin'].Variables.port}/drip?duration=4; sleep 4; {{curl}} --http1.1 -vs http://127.0.0.1:{self.ts['for_httpbin'].Variables.port}/drip?duration=4 -""") +""", + uds_path=self.ts['for_httpbin'].Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = Testers.Any( "gold/background_fill_0_stderr_H.gold", "gold/background_fill_0_stderr_W.gold") @@ -131,7 +132,8 @@ def __testCase1(self): timeout 3 {{curl}} --http1.1 -vsk https://127.0.0.1:{self.ts['for_httpbin'].Variables.ssl_port}/drip?duration=4; sleep 5; {{curl}} --http1.1 -vsk https://127.0.0.1:{self.ts['for_httpbin'].Variables.ssl_port}/drip?duration=4 -""") +""", + uds_path=self.ts['for_httpbin'].Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = Testers.Any( "gold/background_fill_1_stderr_H.gold", "gold/background_fill_1_stderr_W.gold") @@ -149,7 +151,8 @@ def __testCase2(self): timeout 3 {{curl}} --http2 -vsk https://127.0.0.1:{self.ts['for_httpbin'].Variables.ssl_port}/drip?duration=4; sleep 5; {{curl}} --http2 -vsk https://127.0.0.1:{self.ts['for_httpbin'].Variables.ssl_port}/drip?duration=4 -""") +""", + uds_path=self.ts['for_httpbin'].Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = Testers.Any( "gold/background_fill_2_stderr_H.gold", "gold/background_fill_2_stderr_W.gold") @@ -173,9 +176,10 @@ def __testCase3(self): def run(self): self.__testCase0() - self.__testCase1() - self.__testCase2() - self.__testCase3() + if not Condition.CurlUsingUnixDomainSocket(): + self.__testCase1() + self.__testCase2() + self.__testCase3() BackgroundFillTest().run() diff --git a/tests/gold_tests/cache/background_fill_uds.test.py b/tests/gold_tests/cache/background_fill_uds.test.py deleted file mode 100644 index a6313d71ec3..00000000000 --- a/tests/gold_tests/cache/background_fill_uds.test.py +++ /dev/null @@ -1,132 +0,0 @@ -''' -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from enum import Enum -import os - -Test.Summary = 'Exercise Background Fill' -Test.SkipUnless(Condition.HasCurlFeature('http2'), Condition.HasProxyVerifierVersion('2.8.0')) -Test.ContinueOnFail = True - - -class BackgroundFillTest: - """ - https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#proxy-config-http-background-fill-completed-threshold - """ - - class State(Enum): - """ - State of process - """ - INIT = 0 - RUNNING = 1 - - def __init__(self): - self.state = self.State.INIT - self.ts = {} - self.__setupOriginServer() - self.__setupTS(['for_httpbin', 'for_pv']) - - def __setupOriginServer(self): - self.httpbin = Test.MakeHttpBinServer("httpbin") - self.pv_server = Test.MakeVerifierServerProcess("server0", "replay/bg_fill.yaml") - - def __setupTS(self, ts_names=['default']): - for name in ts_names: - self.ts[name] = Test.MakeATSProcess(name, select_ports=True, enable_tls=True, enable_cache=True) - - self.ts[name].addDefaultSSLFiles() - self.ts[name].Disk.ssl_multicert_config.AddLine("dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key") - - # Only add uds path to TS instance - uds_path = "" - if name == 'for_httpbin': - uds_path = os.path.join(Test.RunDirectory, 'uds.socket') - - self.ts[name].Disk.records_config.update( - { - "proxy.config.http.server_ports": - f"{self.ts[name].Variables.port} {self.ts[name].Variables.ssl_port}:ssl {uds_path}", - "proxy.config.http.background_fill_active_timeout": "0", - "proxy.config.http.background_fill_completed_threshold": "0.0", - "proxy.config.http.cache.required_headers": 0, # Force cache - "proxy.config.http.insert_response_via_str": 2, - 'proxy.config.http.server_session_sharing.pool': 'thread', - 'proxy.config.http.server_session_sharing.match': 'ip,sni,cert', - 'proxy.config.exec_thread.autoconfig.enabled': 0, - 'proxy.config.exec_thread.limit': 1, - 'proxy.config.ssl.server.cert.path': f"{self.ts[name].Variables.SSLDir}", - 'proxy.config.ssl.server.private_key.path': f"{self.ts[name].Variables.SSLDir}", - 'proxy.config.ssl.client.alpn_protocols': 'h2,http/1.1', - 'proxy.config.ssl.client.verify.server.policy': 'PERMISSIVE', - "proxy.config.diags.debug.enabled": 3, - "proxy.config.diags.debug.tags": "http", - }) - - if name == 'for_httpbin' or name == 'default': - self.ts[name].Disk.remap_config.AddLines([ - f"map / http://127.0.0.1:{self.httpbin.Variables.Port}", - ]) - else: - self.ts[name].Disk.remap_config.AddLines([ - f'map / https://127.0.0.1:{self.pv_server.Variables.https_port}', - ]) - - def __checkProcessBefore(self, tr): - if self.state == self.State.RUNNING: - tr.StillRunningBefore = self.httpbin - tr.StillRunningBefore = self.pv_server - tr.StillRunningBefore = self.ts['for_httpbin'] - tr.StillRunningBefore = self.ts['for_pv'] - else: - tr.Processes.Default.StartBefore(self.httpbin, ready=When.PortOpen(self.httpbin.Variables.Port)) - tr.Processes.Default.StartBefore(self.pv_server) - tr.Processes.Default.StartBefore(self.ts['for_httpbin']) - tr.Processes.Default.StartBefore(self.ts['for_pv']) - self.state = self.State.RUNNING - - def __checkProcessAfter(self, tr): - assert (self.state == self.State.RUNNING) - tr.StillRunningAfter = self.httpbin - tr.StillRunningAfter = self.pv_server - tr.StillRunningAfter = self.ts['for_httpbin'] - tr.StillRunningAfter = self.ts['for_pv'] - - def __testCase0(self): - """ - HTTP/1.1 over TCP - """ - tr = Test.AddTestRun() - self.__checkProcessBefore(tr) - tr.MakeCurlCommandMulti( - f""" -{{curl}} -X PURGE --http1.1 -vs http://127.0.0.1:{self.ts['for_httpbin'].Variables.port}/drip?duration=4; -timeout 2 {{curl}} --http1.1 -vs http://127.0.0.1:{self.ts['for_httpbin'].Variables.port}/drip?duration=4; -sleep 4; -{{curl}} --http1.1 -vs http://127.0.0.1:{self.ts['for_httpbin'].Variables.port}/drip?duration=4 -""") - tr.Processes.Default.ReturnCode = 0 - tr.Processes.Default.Streams.stderr = Testers.Any( - "gold/background_fill_0_stderr_H.gold", "gold/background_fill_0_stderr_W.gold") - self.__checkProcessAfter(tr) - - def run(self): - self.__testCase0() - - -BackgroundFillTest().run() diff --git a/tests/gold_tests/cache/cache-control.test.py b/tests/gold_tests/cache/cache-control.test.py index 7590e06329f..694f822d775 100644 --- a/tests/gold_tests/cache/cache-control.test.py +++ b/tests/gold_tests/cache/cache-control.test.py @@ -20,7 +20,7 @@ Test.Summary = ''' Test cached responses and requests with bodies ''' -Test.SkipIf(Condition.CurlUds()) + Test.ContinueOnFail = True # Define default ATS @@ -71,13 +71,18 @@ ts.Disk.remap_config.AddLine('map / http://127.0.0.1:{0}'.format(server.Variables.Port)) +ipv4flag = "" +if not Condition.CurlUsingUnixDomainSocket(): + ipv4flag = "--ipv4" + # Test 1 - 200 response and cache fill tr = Test.AddTestRun() tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(Test.Processes.ts) tr.MakeCurlCommand( - '-s -D - -v --ipv4 --http1.1 -H "x-debug: x-cache,via" -H "Host: www.example.com" http://localhost:{port}/max_age_10sec'.format( - port=ts.Variables.port)) + '-s -D - -v {ipv4} --http1.1 -H "x-debug: x-cache,via" -H "Host: www.example.com" http://localhost:{port}/max_age_10sec'.format( + port=ts.Variables.port, ipv4=ipv4flag), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/cache_and_req_body-miss.gold" tr.StillRunningAfter = ts diff --git a/tests/gold_tests/cache/cache-control_uds.test.py b/tests/gold_tests/cache/cache-control_uds.test.py deleted file mode 100644 index 60b2e9cf143..00000000000 --- a/tests/gold_tests/cache/cache-control_uds.test.py +++ /dev/null @@ -1,367 +0,0 @@ -''' -Test cached responses and requests with bodies -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -Test.Summary = ''' -Test cached responses and requests with bodies -''' - -Test.ContinueOnFail = True - -# Define default ATS -ts = Test.MakeATSProcess("ts") -server = Test.MakeOriginServer("server") - -# **testname is required** -testName = "" -request_header1 = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -response_header1 = { - "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nCache-Control: max-age=300\r\n\r\n", - "timestamp": "1469733493.993", - "body": "xxx" -} -request_header2 = { - "headers": "GET /no_cache_control HTTP/1.1\r\nHost: www.example.com\r\n\r\n", - "timestamp": "1469733493.993", - "body": "" -} -response_header2 = { - "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", - "timestamp": "1469733493.993", - "body": "the flinstones" -} -request_header3 = { - "headers": "GET /max_age_10sec HTTP/1.1\r\nHost: www.example.com\r\n\r\n", - "timestamp": "1469733493.993", - "body": "" -} -response_header3 = { - "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nCache-Control: max-age=10,public\r\n\r\n", - "timestamp": "1469733493.993", - "body": "yabadabadoo" -} -server.addResponse("sessionlog.json", request_header1, response_header1) -server.addResponse("sessionlog.json", request_header2, response_header2) -server.addResponse("sessionlog.json", request_header3, response_header3) - -# ATS Configuration -ts.Disk.plugin_config.AddLine('xdebug.so --enable=x-cache,x-cache-key,via') -ts.Disk.records_config.update( - { - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.diags.debug.tags': 'http', - 'proxy.config.http.response_via_str': 3, - 'proxy.config.http.insert_age_in_response': 0, - }) - -ts.Disk.remap_config.AddLine('map / http://127.0.0.1:{0}'.format(server.Variables.Port)) - -# Test 1 - 200 response and cache fill -tr = Test.AddTestRun() -tr.Processes.Default.StartBefore(server) -tr.Processes.Default.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand( - '-s -D - -v --http1.1 -H "x-debug: x-cache,via" -H "Host: www.example.com" http://localhost:{port}/max_age_10sec'.format( - port=ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "gold/cache_and_req_body-miss.gold" -tr.StillRunningAfter = ts - -# Test 2 - 200 cached response and using netcat -tr = Test.AddTestRun() -tr.Processes.Default.Command = "printf 'GET /max_age_10sec HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format( - port=ts.Variables.port) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "gold/cache_and_req_body-hit.gold" -tr.StillRunningAfter = ts - -# Test 3 - response doesn't have cache control directive, so cache-miss every -# time -tr = Test.AddTestRun() -tr.Processes.Default.Command = "printf 'GET /no_cache_control HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format( - port=ts.Variables.port) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "gold/cache_no_cc.gold" -tr.StillRunningAfter = ts - -# Test 4 - hit stale cache. -tr = Test.AddTestRun() -tr.Processes.Default.Command = "sleep 15; printf 'GET /max_age_10sec HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format( - port=ts.Variables.port) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "gold/cache_hit_stale.gold" -tr.StillRunningAfter = ts - -# Test 5 - only-if-cached. 504 "Not Cached" should be returned if not in cache -tr = Test.AddTestRun() -tr.Processes.Default.Command = "printf 'GET /no_cache_control HTTP/1.1\r\n''Cache-Control: only-if-cached\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''Cache-control: max-age=300\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format( - port=ts.Variables.port) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "gold/cache_no_cache.gold" -tr.StillRunningAfter = ts - -# -# Verify correct handling of various max-age directives in both clients and -# responses. -# -ts = Test.MakeATSProcess("ts-for-proxy-verifier") -replay_file = "replay/cache-control-max-age.replay.yaml" -server = Test.MakeVerifierServerProcess("proxy-verifier-server", replay_file) -ts.Disk.records_config.update( - { - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.diags.debug.tags': 'http', - 'proxy.config.http.insert_age_in_response': 0, - - # Disable ignoring max-age in the client request so we can test that - # behavior too. - 'proxy.config.http.cache.ignore_client_cc_max_age': 0, - }) -ts.Disk.remap_config.AddLine('map / http://127.0.0.1:{0}'.format(server.Variables.http_port)) -tr = Test.AddTestRun("Verify correct max-age cache-control behavior.") -tr.Processes.Default.StartBefore(server) -tr.Processes.Default.StartBefore(ts) -tr.AddVerifierClientProcess("proxy-verifier-client", replay_file, http_ports=[ts.Variables.port]) - -# -# Verify correct handling of various s-maxage directives in responses. -# -ts = Test.MakeATSProcess("ts-s-maxage") -replay_file = "replay/cache-control-s-maxage.replay.yaml" -server = Test.MakeVerifierServerProcess("s-maxage-server", replay_file) -ts.Disk.records_config.update( - { - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.diags.debug.tags': 'http', - 'proxy.config.http.insert_age_in_response': 0, - }) -ts.Disk.remap_config.AddLine('map / http://127.0.0.1:{0}'.format(server.Variables.http_port)) -tr = Test.AddTestRun("Verify correct max-age cache-control behavior.") -tr.Processes.Default.StartBefore(server) -tr.Processes.Default.StartBefore(ts) -tr.AddVerifierClientProcess("s-maxage-client", replay_file, http_ports=[ts.Variables.port]) - -# -# Verify correct interaction between cache-control no-cache and pragma header -# -ts = Test.MakeATSProcess("ts-cache-control-pragma") -ts.Disk.records_config.update({ - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.diags.debug.tags': 'http|cache', -}) -tr = Test.AddTestRun("Verify Pragma: no-cache does not conflict with Cache-Control headers") -replay_file = "replay/cache-control-pragma.replay.yaml" -server = tr.AddVerifierServerProcess("pragma-server", replay_file) -tr.AddVerifierClientProcess("pragma-client", replay_file, http_ports=[ts.Variables.port]) -ts.Disk.remap_config.AddLine('map / http://127.0.0.1:{0}'.format(server.Variables.http_port)) -tr.Processes.Default.StartBefore(server) -tr.Processes.Default.StartBefore(ts) -tr.StillRunningAfter = ts - - -class RequestCacheControlDefaultTest: - # Verify the proper handling of cache-control directives in requests in - # default configuration - requestCacheControlReplayFile = "replay/request-cache-control-default.replay.yaml" - - def __init__(self): - self.setupOriginServer() - self.setupTS() - - def setupOriginServer(self): - self.server = Test.MakeVerifierServerProcess( - "request-cache-control-default-verifier-server", self.requestCacheControlReplayFile) - - def setupTS(self): - self.ts = Test.MakeATSProcess("ts-request-cache-control-default") - self.ts.Disk.records_config.update({ - "proxy.config.diags.debug.enabled": 1, - "proxy.config.diags.debug.tags": "http", - }) - self.ts.Disk.remap_config.AddLine(f"map / http://127.0.0.1:{self.server.Variables.http_port}/",) - - def runTraffic(self): - tr = Test.AddTestRun("Verify the proper handling of cache-control directives in requests in default configuration") - tr.AddVerifierClientProcess( - "request-cache-control-default-client", - self.requestCacheControlReplayFile, - http_ports=[self.ts.Variables.port], - other_args='--thread-limit 1') - tr.Processes.Default.StartBefore(self.server) - tr.Processes.Default.StartBefore(self.ts) - tr.StillRunningAfter = self.server - tr.StillRunningAfter = self.ts - - def run(self): - self.runTraffic() - - -RequestCacheControlDefaultTest().run() - - -class RequestCacheControlHonorClientTest: - # Verify the proper handling of cache-control directives in requests when - # ATS is configured to honor client's request to bypass the cache - requestCacheControlReplayFile = "replay/request-cache-control-honor-client.replay.yaml" - - def __init__(self): - self.setupOriginServer() - self.setupTS() - - def setupOriginServer(self): - self.server = Test.MakeVerifierServerProcess( - "request-cache-control-honor-client-verifier-server", self.requestCacheControlReplayFile) - - def setupTS(self): - self.ts = Test.MakeATSProcess("ts-request-cache-control-honor-client") - self.ts.Disk.records_config.update( - { - "proxy.config.diags.debug.enabled": 1, - "proxy.config.diags.debug.tags": "http", - # Configured to honor client requests to bypass the cache - "proxy.config.http.cache.ignore_client_no_cache": 0 - }) - self.ts.Disk.remap_config.AddLine(f"map / http://127.0.0.1:{self.server.Variables.http_port}/",) - - # Verify logs for the request containing no-cache - self.ts.Disk.traffic_out.Content += Testers.ContainsExpression( - "Revalidate document with server", "Verify that ATS honors the no-cache and performs a revalidation.") - # Verify logs for the request containing no-store - self.ts.Disk.traffic_out.Content += Testers.ContainsExpression( - "client does not permit storing, and cache control does not say to ignore client no-cache", - "Verify that ATS honors the no-store.") - - def runTraffic(self): - tr = Test.AddTestRun( - "Verify the proper handling of cache-control directives in requests when ATS is configured to honor client's request to bypass the cache" - ) - tr.AddVerifierClientProcess( - "request-cache-control-honor-client-client", - self.requestCacheControlReplayFile, - http_ports=[self.ts.Variables.port], - other_args='--thread-limit 1') - tr.Processes.Default.StartBefore(self.server) - tr.Processes.Default.StartBefore(self.ts) - tr.StillRunningAfter = self.server - tr.StillRunningAfter = self.ts - - def run(self): - self.runTraffic() - - -RequestCacheControlHonorClientTest().run() - - -class ResponseCacheControlDefaultTest: - # Verify the proper handling of cache-control directives in responses in - # default configuration - responseCacheControlReplayFile = "replay/response-cache-control-default.replay.yaml" - - def __init__(self): - self.setupOriginServer() - self.setupTS() - - def setupOriginServer(self): - self.server = Test.MakeVerifierServerProcess( - "response-cache-control-default-verifier-server", self.responseCacheControlReplayFile) - - def setupTS(self): - self.ts = Test.MakeATSProcess("ts-response-cache-control-default") - self.ts.Disk.records_config.update({ - "proxy.config.diags.debug.enabled": 1, - "proxy.config.diags.debug.tags": "http", - }) - self.ts.Disk.remap_config.AddLine(f"map / http://127.0.0.1:{self.server.Variables.http_port}/",) - - # Verify logs for the response containing no-cache - self.ts.Disk.traffic_out.Content += Testers.ContainsExpression( - "Revalidate document with server", "Verify that ATS honors the no-cache in response and performs a revalidation.") - # Verify logs for the response containing no-store - self.ts.Disk.traffic_out.Content += Testers.ContainsExpression( - "server does not permit storing and config file does not indicate that server directive should be ignored", - "Verify that ATS honors the no-store in response and bypasses the cache.") - - def runTraffic(self): - tr = Test.AddTestRun("Verify the proper handling of cache-control directives in responses in default configuration") - tr.AddVerifierClientProcess( - "response-cache-control-client-default", - self.responseCacheControlReplayFile, - http_ports=[self.ts.Variables.port], - other_args='--thread-limit 1') - tr.Processes.Default.StartBefore(self.server) - tr.Processes.Default.StartBefore(self.ts) - tr.StillRunningAfter = self.server - tr.StillRunningAfter = self.ts - - def run(self): - self.runTraffic() - - -ResponseCacheControlDefaultTest().run() - - -class ResponseCacheControlIgnoredTest: - # Verify the proper handling of cache-control directives in responses when - # ATS is configured to ignore server's request to bypass the cache - responseCacheControlReplayFile = "replay/response-cache-control-ignored.replay.yaml" - - def __init__(self): - self.setupOriginServer() - self.setupTS() - - def setupOriginServer(self): - self.server = Test.MakeVerifierServerProcess( - "response-cache-control-ignored-verifier-server", self.responseCacheControlReplayFile) - - def setupTS(self): - self.ts = Test.MakeATSProcess("ts-response-cache-control-ignored") - self.ts.Disk.records_config.update( - { - "proxy.config.diags.debug.enabled": 1, - "proxy.config.diags.debug.tags": "http", - "proxy.config.http.cache.ignore_server_no_cache": 1 - }) - self.ts.Disk.remap_config.AddLine(f"map / http://127.0.0.1:{self.server.Variables.http_port}/",) - - # Verify logs for the response containing no-cache or no-store - self.ts.Disk.traffic_out.Content += Testers.ExcludesExpression( - "Revalidate document with server", - "Verify that ATS ignores the no-cache in response and therefore doesn't perform a revalidation.") - self.ts.Disk.traffic_out.Content += Testers.ExcludesExpression( - "server does not permit storing and config file does not indicate that server directive should be ignored", - "Verify that ATS ignores the no-store in response and caches the responses despite its presence.") - - def runTraffic(self): - tr = Test.AddTestRun( - "Verify the proper handling of cache-control directives in responses when ATS is configured to ignore server's request to bypass the cache" - ) - tr.AddVerifierClientProcess( - "response-cache-control-client-ignored", - self.responseCacheControlReplayFile, - http_ports=[self.ts.Variables.port], - other_args='--thread-limit 1') - tr.Processes.Default.StartBefore(self.server) - tr.Processes.Default.StartBefore(self.ts) - tr.StillRunningAfter = self.server - tr.StillRunningAfter = self.ts - - def run(self): - self.runTraffic() - - -ResponseCacheControlIgnoredTest().run() diff --git a/tests/gold_tests/cache/cache-generation-clear.test.py b/tests/gold_tests/cache/cache-generation-clear.test.py index 07fb23f9a98..993fd546c6e 100644 --- a/tests/gold_tests/cache/cache-generation-clear.test.py +++ b/tests/gold_tests/cache/cache-generation-clear.test.py @@ -50,7 +50,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '"http://127.0.0.1:{0}/default/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format( - ts.Variables.port, objectid)) + ts.Variables.port, objectid), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(Test.Processes.ts) tr.Processes.Default.Streams.All = "gold/miss_default-1.gold" @@ -59,7 +60,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '"http://127.0.0.1:{0}/default/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format( - ts.Variables.port, objectid)) + ts.Variables.port, objectid), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = "gold/hit_default-1.gold" @@ -76,7 +78,8 @@ # create a new traffic_ctrl call and the environment tr.MakeCurlCommand( '"http://127.0.0.1:{0}/default/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format( - ts.Variables.port, objectid)) + ts.Variables.port, objectid), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = "gold/miss_default77.gold" @@ -84,7 +87,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '"http://127.0.0.1:{0}/default/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format( - ts.Variables.port, objectid)) + ts.Variables.port, objectid), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = "gold/hit_default77.gold" @@ -92,6 +96,7 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '"http://127.0.0.1:{0}/default/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format( - ts.Variables.port, objectid)) + ts.Variables.port, objectid), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = "gold/hit_default77.gold" diff --git a/tests/gold_tests/cache/cache-generation-disjoint.test.py b/tests/gold_tests/cache/cache-generation-disjoint.test.py index 58adffa6cce..14714790d06 100644 --- a/tests/gold_tests/cache/cache-generation-disjoint.test.py +++ b/tests/gold_tests/cache/cache-generation-disjoint.test.py @@ -50,7 +50,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '"http://127.0.0.1:{0}/default/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format( - ts.Variables.port, objectid)) + ts.Variables.port, objectid), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(Test.Processes.ts) tr.Processes.Default.Streams.All = "gold/miss_default-1.gold" @@ -59,7 +60,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '"http://127.0.0.1:{0}/generation1/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format( - ts.Variables.port, objectid)) + ts.Variables.port, objectid), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = "gold/miss_gen1.gold" @@ -67,7 +69,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '"http://127.0.0.1:{0}/generation2/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format( - ts.Variables.port, objectid)) + ts.Variables.port, objectid), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = "gold/miss_gen2.gold" @@ -75,7 +78,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '"http://127.0.0.1:{0}/default/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format( - ts.Variables.port, objectid)) + ts.Variables.port, objectid), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = "gold/hit_default-1.gold" @@ -83,7 +87,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '"http://127.0.0.1:{0}/generation1/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format( - ts.Variables.port, objectid)) + ts.Variables.port, objectid), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = "gold/hit_gen1.gold" @@ -91,6 +96,7 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '"http://127.0.0.1:{0}/generation2/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format( - ts.Variables.port, objectid)) + ts.Variables.port, objectid), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = "gold/hit_gen2.gold" diff --git a/tests/gold_tests/cache/disjoint-wait-for-cache.test.py b/tests/gold_tests/cache/disjoint-wait-for-cache.test.py index db34b0d3784..4cae3d6cb92 100644 --- a/tests/gold_tests/cache/disjoint-wait-for-cache.test.py +++ b/tests/gold_tests/cache/disjoint-wait-for-cache.test.py @@ -53,7 +53,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '"http://127.0.0.1:{0}/default/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format( - ts.Variables.port, objectid)) + ts.Variables.port, objectid), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(Test.Processes.ts) tr.Processes.Default.Streams.All = "gold/miss_default-1.gold" @@ -62,7 +63,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '"http://127.0.0.1:{0}/generation1/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose -o /dev/null' - .format(ts.Variables.port, objectid)) + .format(ts.Variables.port, objectid), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = "gold/miss_gen1.gold" @@ -70,7 +72,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '"http://127.0.0.1:{0}/generation2/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose -o /dev/null' - .format(ts.Variables.port, objectid)) + .format(ts.Variables.port, objectid), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = "gold/miss_gen2.gold" @@ -78,7 +81,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '"http://127.0.0.1:{0}/default/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose -o /dev/null' - .format(ts.Variables.port, objectid)) + .format(ts.Variables.port, objectid), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = "gold/hit_default-1.gold" @@ -86,7 +90,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '"http://127.0.0.1:{0}/generation1/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose -o /dev/null' - .format(ts.Variables.port, objectid)) + .format(ts.Variables.port, objectid), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = "gold/hit_gen1.gold" @@ -94,6 +99,7 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '"http://127.0.0.1:{0}/generation2/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose -o /dev/null' - .format(ts.Variables.port, objectid)) + .format(ts.Variables.port, objectid), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = "gold/hit_gen2.gold" diff --git a/tests/gold_tests/chunked_encoding/bad_chunked_encoding.test.py b/tests/gold_tests/chunked_encoding/bad_chunked_encoding.test.py index f57861d1b24..4d4baf82aab 100644 --- a/tests/gold_tests/chunked_encoding/bad_chunked_encoding.test.py +++ b/tests/gold_tests/chunked_encoding/bad_chunked_encoding.test.py @@ -51,7 +51,8 @@ tr.TimeOut = 5 tr.MakeCurlCommand( '-H "host: example.com" -H "transfer-encoding: gzip" -d "stuff" http://127.0.0.1:{0}/case1 --verbose'.format( - ts.Variables.port)) + ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(ts) @@ -65,7 +66,8 @@ tr.TimeOut = 5 tr.MakeCurlCommand( '-H "host: example.com" -H "transfer-encoding: gzip" -H "transfer-encoding: chunked" -d "stuff" http://127.0.0.1:{0}/case1 --verbose' - .format(ts.Variables.port)) + .format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = Testers.ContainsExpression("501 Field not implemented", "Should fail") tr.Processes.Default.Streams.All = Testers.ExcludesExpression("200 OK", "Should not succeed") diff --git a/tests/gold_tests/chunked_encoding/chunked_encoding.test.py b/tests/gold_tests/chunked_encoding/chunked_encoding.test.py index 68c1cb60e06..e6e5e1f9e53 100644 --- a/tests/gold_tests/chunked_encoding/chunked_encoding.test.py +++ b/tests/gold_tests/chunked_encoding/chunked_encoding.test.py @@ -23,7 +23,6 @@ ''' Test.SkipUnless(Condition.HasCurlFeature('http2')) -Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True Test.GetTcpPort("upstream_port") @@ -100,29 +99,41 @@ # HTTP1.1 GET: www.example.com tr = Test.AddTestRun() tr.TimeOut = 5 -tr.MakeCurlCommand('--http1.1 --proxy 127.0.0.1:{0} http://www.example.com --verbose'.format(ts.Variables.port)) +if Condition.CurlUsingUnixDomainSocket(): + tr.MakeCurlCommand( + '--http1.1 --proxy 127.0.0.1:{0} http://www.example.com --verbose'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) +else: + tr.MakeCurlCommand('--http1.1 -H "Host: www.example.com" "http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port)) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(server2) tr.Processes.Default.StartBefore(server3) # Delay on readiness of our ssl ports tr.Processes.Default.StartBefore(Test.Processes.ts) -tr.Processes.Default.Streams.stderr = "gold/chunked_GET_200.gold" +if Condition.CurlUsingUnixDomainSocket(): + tr.Processes.Default.Streams.stderr = "gold/chunked_GET_200_uds.gold" +else: + tr.Processes.Default.Streams.stderr = "gold/chunked_GET_200.gold" tr.StillRunningAfter = server tr.StillRunningAfter = ts -# HTTP2 POST: www.example.com Host, chunked body -tr = Test.AddTestRun() -tr.TimeOut = 5 -tr.MakeCurlCommand( - '--http2 -k https://127.0.0.1:{0} --verbose -H "Host: www.anotherexample.com" -d "Knock knock"'.format(ts.Variables.ssl_port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stderr = "gold/h2_chunked_POST_200.gold" +if not Condition.CurlUsingUnixDomainSocket(): + # HTTP2 POST: www.example.com Host, chunked body + tr = Test.AddTestRun() + tr.TimeOut = 5 + tr.MakeCurlCommand( + '--http2 -k https://127.0.0.1:{0} --verbose -H "Host: www.anotherexample.com" -d "Knock knock"'.format( + ts.Variables.ssl_port)) + tr.Processes.Default.ReturnCode = 0 + tr.Processes.Default.Streams.stderr = "gold/h2_chunked_POST_200.gold" # HTTP1.1 POST: www.yetanotherexample.com Host, explicit size tr = Test.AddTestRun() tr.TimeOut = 5 -tr.MakeCurlCommand('http://127.0.0.1:{0} -H "Host: www.yetanotherexample.com" --verbose -d "knock knock"'.format(ts.Variables.port)) +tr.MakeCurlCommand( + 'http://127.0.0.1:{0} -H "Host: www.yetanotherexample.com" --verbose -d "knock knock"'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/chunked_POST_200.gold" tr.StillRunningAfter = server @@ -132,7 +143,8 @@ tr.TimeOut = 5 tr.MakeCurlCommand( 'http://127.0.0.1:{0} -H "Host: www.yetanotherexample.com" --verbose -H "Transfer-Encoding: chunked" -d "Knock knock"'.format( - ts.Variables.port)) + ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/chunked_POST_200.gold" tr.StillRunningAfter = server diff --git a/tests/gold_tests/chunked_encoding/chunked_encoding_h2.test.py b/tests/gold_tests/chunked_encoding/chunked_encoding_h2.test.py index a52fcb9005f..a07c99db4c6 100644 --- a/tests/gold_tests/chunked_encoding/chunked_encoding_h2.test.py +++ b/tests/gold_tests/chunked_encoding/chunked_encoding_h2.test.py @@ -19,7 +19,7 @@ Test.Summary = ''' Test interaction of H2 and chunked encoding ''' -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) Test.SkipUnless( Condition.HasProgram("nghttp", "Nghttp need to be installed on system for this test to work"), diff --git a/tests/gold_tests/chunked_encoding/chunked_encoding_uds.test.py b/tests/gold_tests/chunked_encoding/chunked_encoding_uds.test.py deleted file mode 100644 index b61615dabc0..00000000000 --- a/tests/gold_tests/chunked_encoding/chunked_encoding_uds.test.py +++ /dev/null @@ -1,238 +0,0 @@ -''' -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -Test.Summary = ''' -Test chunked encoding processing -''' - -Test.SkipUnless(Condition.HasCurlFeature('http2')) -Test.ContinueOnFail = True - -Test.GetTcpPort("upstream_port") - -# Define default ATS -ts = Test.MakeATSProcess("ts", enable_tls=True) -server = Test.MakeOriginServer("server") -server2 = Test.MakeOriginServer("server2", ssl=True) -server3 = Test.MakeOriginServer("server3") - -server4 = Test.Processes.Process( - "server4", "bash -c '" + Test.TestDirectory + "/server4.sh {} outserver4'".format(Test.Variables.upstream_port)) - -testName = "" -request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -response_header = { - "headers": "HTTP/1.1 200 OK\r\nServer: uServer\r\nConnection: close\r\nTransfer-Encoding: chunked\r\n\r\n", - "timestamp": "1469733493.993", - "body": "" -} - -request_header2 = { - "headers": - "POST / HTTP/1.1\r\nHost: www.anotherexample.com\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 11\r\n\r\n", - "timestamp": "1415926535.898", - "body": "knock knock" -} -response_header2 = { - "headers": "HTTP/1.1 200 OK\r\nServer: uServer\r\nConnection: close\r\nTransfer-Encoding: chunked\r\n\r\n", - "timestamp": "1415926535.898", - "body": "12345678901234567890" -} - -request_header3 = { - "headers": - "POST / HTTP/1.1\r\nHost: www.yetanotherexample.com\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 11\r\n\r\n", - "timestamp": "1415926535.898", - "body": "knock knock" -} -response_header3 = { - "headers": "HTTP/1.1 200 OK\r\nServer: uServer\r\nConnection: close\r\nTransfer-Encoding: chunked\r\n\r\n", - "timestamp": "1415926535.898", - "body": "" -} - -server.addResponse("sessionlog.json", request_header, response_header) -server2.addResponse("sessionlog.json", request_header2, response_header2) -server3.addResponse("sessionlog.json", request_header3, response_header3) - -# add ssl materials like key, certificates for the server -ts.addDefaultSSLFiles() - -ts.Disk.records_config.update( - { - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.diags.debug.tags': 'http', - 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), - 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), - 'proxy.config.ssl.client.verify.server.policy': 'PERMISSIVE', - }) - -ts.Disk.remap_config.AddLine('map http://www.example.com http://127.0.0.1:{0}'.format(server.Variables.Port)) -ts.Disk.remap_config.AddLine('map http://www.yetanotherexample.com http://127.0.0.1:{0}'.format(server3.Variables.Port)) -ts.Disk.remap_config.AddLine( - 'map https://www.anotherexample.com https://127.0.0.1:{0}'.format(server2.Variables.SSL_Port, ts.Variables.ssl_port)) -ts.Disk.remap_config.AddLine('map / http://127.0.0.1:{0}'.format(Test.Variables.upstream_port)) - -ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') - -# smuggle-client is built via `make`. Here we copy the built binary down to the -# test directory so that the test runs in this file can use it. -Test.Setup.Copy(os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'chunked_encoding', 'smuggle-client')) - -# HTTP1.1 GET: www.example.com -tr = Test.AddTestRun() -tr.TimeOut = 5 -tr.MakeCurlCommand('--http1.1 -H "Host: www.example.com" "http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.StartBefore(server) -tr.Processes.Default.StartBefore(server2) -tr.Processes.Default.StartBefore(server3) -# Delay on readiness of our ssl ports -tr.Processes.Default.StartBefore(Test.Processes.ts) -tr.Processes.Default.Streams.stderr = "gold/chunked_GET_200_uds.gold" -tr.StillRunningAfter = server -tr.StillRunningAfter = ts - -# HTTP1.1 POST: www.yetanotherexample.com Host, explicit size -tr = Test.AddTestRun() -tr.TimeOut = 5 -tr.MakeCurlCommand('http://127.0.0.1:{0} -H "Host: www.yetanotherexample.com" --verbose -d "knock knock"'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stderr = "gold/chunked_POST_200.gold" -tr.StillRunningAfter = server - -# HTTP1.1 POST: www.example.com Host, chunked body -tr = Test.AddTestRun() -tr.TimeOut = 5 -tr.MakeCurlCommand( - 'http://127.0.0.1:{0} -H "Host: www.yetanotherexample.com" --verbose -H "Transfer-Encoding: chunked" -d "Knock knock"'.format( - ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stderr = "gold/chunked_POST_200.gold" -tr.StillRunningAfter = server - -server4_out = Test.Disk.File("outserver4") -server4_out.Content = Testers.ExcludesExpression("sneaky", "Extra body bytes should not be delivered") - -# HTTP/1.1 Try to smuggle another request to the origin -tr = Test.AddTestRun() -tr.Processes.Default.StartBefore(server4) -tr.TimeOut = 5 -tr.Processes.Default.Command = "./smuggle-client 127.0.0.1 {0}".format(ts.Variables.ssl_port) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.All = Testers.ExcludesExpression("content-length:", "Response should not include content length") -# Transfer encoding to origin, but no content-length -# No extra bytes in body seen by origin - - -class TestChunkedTrailers: - """Verify chunked trailer proxy behavior.""" - - _chunked_dropped_replay: str = "replays/chunked_trailer_dropped.replay.yaml" - _proxied_dropped_replay: str = "replays/chunked_trailer_proxied.replay.yaml" - - def __init__(self, configure_drop_trailers: bool): - """Create a test to verify chunked trailer behavior. - - :param configure_drop_trailers: Whether to configure ATS to drop - trailers or not. - """ - self._configure_drop_trailers = configure_drop_trailers - self._replay_file = self._chunked_dropped_replay if configure_drop_trailers else self._proxied_dropped_replay - behavior_description = "drop" if configure_drop_trailers else "proxy" - tr = Test.AddTestRun(f'Verify chunked tailers behavior: {behavior_description}') - self._configure_dns(tr) - self._configure_server(tr) - self._configure_ts(tr) - self._configure_client(tr) - - def _configure_dns(self, tr: 'TestRun') -> "Process": - """Configure DNS for the test run. - - :param tr: The TestRun to configure DNS for. - :return: The DNS process. - """ - name = 'dns-drop-trailers' if self._configure_drop_trailers else 'dns-proxy-trailers' - self._dns = tr.MakeDNServer(name, default='127.0.0.1') - return self._dns - - def _configure_server(self, tr: 'TestRun') -> 'Process': - """Configure the origin server for the test run. - - :param tr: The TestRun to configure the server for. - :return: The origin server process. - """ - name = 'server-drop-trailers' if self._configure_drop_trailers else 'server-proxy-trailers' - self._server = tr.AddVerifierServerProcess(name, self._replay_file) - if self._configure_drop_trailers: - self._server.Streams.All += Testers.ExcludesExpression('Client: ATS', 'Verify the Client trailer was dropped.') - self._server.Streams.All += Testers.ExcludesExpression('ETag: "abc"', 'Verify the ETag trailer was dropped.') - else: - self._server.Streams.All += Testers.ContainsExpression('Client: ATS', 'Verify the Client trailer was proxied.') - self._server.Streams.All += Testers.ContainsExpression('ETag: "abc"', 'Verify the ETag trailer was proxied.') - return self._server - - def _configure_ts(self, tr: 'TestRun') -> 'Process': - """Configure ATS for the test run. - - :param tr: The TestRun to configure ATS for. - :return: The ATS process. - """ - name = 'ts-drop-trailers' if self._configure_drop_trailers else 'ts-proxy-trailers' - ts = tr.MakeATSProcess(name, enable_cache=False) - self._ts = ts - port = self._server.Variables.http_port - ts.Disk.remap_config.AddLine(f'map / http://backend.example.com:{port}/') - ts.Disk.records_config.update( - { - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.diags.debug.tags': 'http', - 'proxy.config.dns.nameservers': f'127.0.0.1:{self._dns.Variables.Port}', - 'proxy.config.dns.resolv_conf': 'NULL' - }) - if not self._configure_drop_trailers: - ts.Disk.records_config.update({ - 'proxy.config.http.drop_chunked_trailers': 0, - }) - return ts - - def _configure_client(self, tr: 'TestRun') -> 'Process': - """Configure the client for the test run. - - :param tr: The TestRun to configure the client for. - :return: The client process. - """ - name = 'client-drop-trailers' if self._configure_drop_trailers else 'client-proxy-trailers' - self._client = tr.AddVerifierClientProcess(name, self._replay_file, http_ports=[self._ts.Variables.port]) - self._client.StartBefore(self._dns) - self._client.StartBefore(self._server) - self._client.StartBefore(self._ts) - - if self._configure_drop_trailers: - self._client.Streams.All += Testers.ExcludesExpression('Sever: ATS', 'Verify the Server trailer was dropped.') - self._client.Streams.All += Testers.ExcludesExpression('ETag: "def"', 'Verify the ETag trailer was dropped.') - else: - self._client.Streams.All += Testers.ContainsExpression('Sever: ATS', 'Verify the Server trailer was proxied.') - self._client.Streams.All += Testers.ContainsExpression('ETag: "def"', 'Verify the ETag trailer was proxied.') - return self._client - - -TestChunkedTrailers(configure_drop_trailers=True) -TestChunkedTrailers(configure_drop_trailers=False) diff --git a/tests/gold_tests/connect/connect.test.py b/tests/gold_tests/connect/connect.test.py index aac7a3a9dd0..8a70fba4a3d 100644 --- a/tests/gold_tests/connect/connect.test.py +++ b/tests/gold_tests/connect/connect.test.py @@ -22,7 +22,6 @@ Test.Summary = 'Exercise HTTP CONNECT Method' Test.ContinueOnFail = True -Test.SkipIf(Condition.CurlUds()) class ConnectTest: @@ -49,7 +48,7 @@ def __setupTS(self): { 'proxy.config.diags.debug.enabled': 1, 'proxy.config.diags.debug.tags': 'http', - 'proxy.config.http.server_ports': f"{self.ts.Variables.port}", + 'proxy.config.http.server_ports': f"{self.ts.Variables.port} {self.ts.Variables.uds_path}", 'proxy.config.http.connect_ports': f"{self.httpbin.Variables.Port}", }) @@ -85,11 +84,18 @@ def __checkProcessAfter(self, tr): def __testCase0(self): tr = Test.AddTestRun() self.__checkProcessBefore(tr) - tr.MakeCurlCommand(f"-v --fail -s -p -x 127.0.0.1:{self.ts.Variables.port} 'http://foo.com/get'") + if Condition.CurlUsingUnixDomainSocket(): + tr.MakeCurlCommand( + f"-v --fail -s -X CONNECT -p -x 127.0.0.1:{self.ts.Variables.port} 'http://foo.com/get'", + uds_path=self.ts.Variables.uds_path) + tr.Processes.Default.Streams.stderr = "gold/connect_0_stderr_uds.gold" + else: + tr.MakeCurlCommand( + f"-v --fail -s -p -x 127.0.0.1:{self.ts.Variables.port} 'http://foo.com/get'", uds_path=self.ts.Variables.uds_path) + tr.Processes.Default.Streams.stderr = "gold/connect_0_stderr.gold" + tr.Processes.Default.Streams.stderr = Testers.ContainsExpression( + f'Connected to 127.0.0.1.*{self.ts.Variables.port}', 'Curl should connect through the ATS proxy port.') tr.Processes.Default.ReturnCode = 0 - tr.Processes.Default.Streams.stderr = "gold/connect_0_stderr.gold" - tr.Processes.Default.Streams.stderr = Testers.ContainsExpression( - f'Connected to 127.0.0.1.*{self.ts.Variables.port}', 'Curl should connect through the ATS proxy port.') tr.Processes.Default.TimeOut = 3 self.__checkProcessAfter(tr) @@ -217,7 +223,7 @@ def setupTS(self): 'proxy.config.diags.debug.tags': 'http|hpack', 'proxy.config.ssl.server.cert.path': f'{self.ts.Variables.SSLDir}', 'proxy.config.ssl.server.private_key.path': f'{self.ts.Variables.SSLDir}', - 'proxy.config.http.server_ports': f"{self.ts.Variables.ssl_port}:ssl", + 'proxy.config.http.server_ports': f"{self.ts.Variables.ssl_port}:ssl {self.ts.Variables.uds_path}", 'proxy.config.http.connect_ports': f"{self.server.Variables.http_port}", }) diff --git a/tests/gold_tests/connect/connect_uds.test.py b/tests/gold_tests/connect/connect_uds.test.py deleted file mode 100644 index 6766cabec57..00000000000 --- a/tests/gold_tests/connect/connect_uds.test.py +++ /dev/null @@ -1,247 +0,0 @@ -''' -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from enum import Enum -import os -import re - -Test.Summary = 'Exercise HTTP CONNECT Method' -Test.ContinueOnFail = True - - -class ConnectTest: - - class State(Enum): - """ - State of process - """ - INIT = 0 - RUNNING = 1 - - def __init__(self): - self.state = self.State.INIT - self.__setupOriginServer() - self.__setupTS() - - def __setupOriginServer(self): - self.httpbin = Test.MakeHttpBinServer("httpbin") - - def __setupTS(self): - self.ts = Test.MakeATSProcess("ts") - - uds_path = os.path.join(Test.RunDirectory, 'uds.socket') - self.ts.Disk.records_config.update( - { - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.diags.debug.tags': 'http|connect', - 'proxy.config.http.server_ports': f"{self.ts.Variables.port} {uds_path}", - 'proxy.config.http.connect_ports': f"{self.httpbin.Variables.Port}", - }) - - self.ts.Disk.remap_config.AddLines([ - f"map http://foo.com/ http://127.0.0.1:{self.httpbin.Variables.Port}/", - ]) - - self.ts.Disk.logging_yaml.AddLines( - ''' -logging: - formats: - - name: common - format: '% - % [%] "% % %" % %' - logs: - - filename: access - format: common -'''.split("\n")) - - def __checkProcessBefore(self, tr): - if self.state == self.State.RUNNING: - tr.StillRunningBefore = self.httpbin - tr.StillRunningBefore = self.ts - else: - tr.Processes.Default.StartBefore(self.httpbin, ready=When.PortOpen(self.httpbin.Variables.Port)) - tr.Processes.Default.StartBefore(self.ts) - self.state = self.State.RUNNING - - def __checkProcessAfter(self, tr): - assert (self.state == self.State.RUNNING) - tr.StillRunningAfter = self.httpbin - tr.StillRunningAfter = self.ts - - def __testCase0(self): - tr = Test.AddTestRun() - self.__checkProcessBefore(tr) - tr.MakeCurlCommand(f"-v --fail -s -X CONNECT -p -x 127.0.0.1:{self.ts.Variables.port} 'http://foo.com/get'") - tr.Processes.Default.ReturnCode = 0 - tr.Processes.Default.Streams.stderr = "gold/connect_0_stderr_uds.gold" - tr.Processes.Default.TimeOut = 3 - self.__checkProcessAfter(tr) - - def __testAccessLog(self): - """Wait for log file to appear, then wait one extra second to make sure TS is done writing it.""" - Test.Disk.File(os.path.join(self.ts.Variables.LOGDIR, 'access.log'), exists=True, content='gold/connect_access.gold') - - tr = Test.AddTestRun() - tr.Processes.Default.Command = ( - os.path.join(Test.Variables.AtsTestToolsDir, 'condwait') + ' 60 1 -f ' + - os.path.join(self.ts.Variables.LOGDIR, 'access.log')) - tr.Processes.Default.ReturnCode = 0 - - def run(self): - self.__testCase0() - self.__testAccessLog() - - -ConnectTest().run() - - -class ConnectViaPVTest: - # This test also executes the CONNECT request but using proxy verifier to - # generate traffic - connectReplayFile = "replays/connect.replay.yaml" - - def __init__(self): - self.setupOriginServer() - self.setupTS() - - def setupOriginServer(self): - self.server = Test.MakeVerifierServerProcess("connect-verifier-server", self.connectReplayFile) - # Verify server output - self.server.Streams.stdout += Testers.ExcludesExpression("uuid: 1", "Verify the CONNECT request doesn't reach the server.") - self.server.Streams.stdout += Testers.ContainsExpression( - "GET /get HTTP/1.1\nuuid: 2", reflags=re.MULTILINE, description="Verify the server gets the second request.") - - def setupTS(self): - self.ts = Test.MakeATSProcess("connect-ts") - - self.ts.Disk.records_config.update( - { - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.diags.debug.tags': 'http|iocore_net|rec', - 'proxy.config.http.server_ports': f"{self.ts.Variables.port}", - 'proxy.config.http.connect_ports': f"{self.server.Variables.http_port}", - }) - - self.ts.Disk.remap_config.AddLines([ - f"map / http://127.0.0.1:{self.server.Variables.http_port}/", - ]) - # Verify ts logs - self.ts.Disk.traffic_out.Content += Testers.ContainsExpression( - f"Proxy's Request.*\n.*\nCONNECT 127.0.0.1:{self.server.Variables.http_port} HTTP/1.1", - reflags=re.MULTILINE, - description="Verify that ATS recognizes the CONNECT request.") - - def runTraffic(self): - tr = Test.AddTestRun("Verify correct handling of CONNECT request") - tr.AddVerifierClientProcess( - "connect-client", self.connectReplayFile, http_ports=[self.ts.Variables.port], other_args='--thread-limit 1') - tr.Processes.Default.StartBefore(self.server) - tr.Processes.Default.StartBefore(self.ts) - tr.StillRunningAfter = self.server - tr.StillRunningAfter = self.ts - - def __testMetrics(self): - tr = Test.AddTestRun("Test metrics") - tr.Processes.Default.Command = ( - f"{Test.Variables.AtsTestToolsDir}/stdout_wait" + " 'traffic_ctl metric get" + - " proxy.process.http.total_incoming_connections" + " proxy.process.http.total_client_connections" + - " proxy.process.http.total_client_connections_ipv4" + " proxy.process.http.total_client_connections_ipv6" + - " proxy.process.http.total_server_connections" + " proxy.process.http2.total_client_connections" + - " proxy.process.http.connect_requests" + " proxy.process.tunnel.total_client_connections_blind_tcp" + - " proxy.process.tunnel.current_client_connections_blind_tcp" + - " proxy.process.tunnel.total_server_connections_blind_tcp" + - " proxy.process.tunnel.current_server_connections_blind_tcp" + - " proxy.process.tunnel.total_client_connections_tls_tunnel" + - " proxy.process.tunnel.current_client_connections_tls_tunnel" + - " proxy.process.tunnel.total_client_connections_tls_forward" + - " proxy.process.tunnel.current_client_connections_tls_forward" + - " proxy.process.tunnel.total_client_connections_tls_partial_blind" + - " proxy.process.tunnel.current_client_connections_tls_partial_blind" + - " proxy.process.tunnel.total_client_connections_tls_http" + - " proxy.process.tunnel.current_client_connections_tls_http" + " proxy.process.tunnel.total_server_connections_tls" + - " proxy.process.tunnel.current_server_connections_tls'" + f" {Test.TestDirectory}/gold/metrics.gold") - # Need to copy over the environment so traffic_ctl knows where to find the unix domain socket - tr.Processes.Default.Env = self.ts.Env - tr.Processes.Default.ReturnCode = 0 - tr.StillRunningAfter = self.server - tr.StillRunningAfter = self.ts - - def run(self): - self.runTraffic() - self.__testMetrics() - - -ConnectViaPVTest().run() - - -class ConnectViaPVTest2: - # This test executes a HTTP/2 CONNECT request with Proxy Verifier. - connectReplayFile = "replays/connect_h2.replay.yaml" - - def __init__(self): - self.setupOriginServer() - self.setupTS() - - def setupOriginServer(self): - self.server = Test.MakeVerifierServerProcess("connect-verifier-server2", self.connectReplayFile) - # Verify server output - self.server.Streams.stdout += Testers.ExcludesExpression( - "test: connect-request", "Verify the CONNECT request doesn't reach the server.") - self.server.Streams.stdout += Testers.ContainsExpression( - "GET /get HTTP/1.1\nuuid: 1\ntest: real-request", - reflags=re.MULTILINE, - description="Verify the server gets the second(tunneled) request.") - - def setupTS(self): - self.ts = Test.MakeATSProcess("connect-ts2", enable_tls=True) - - self.ts.Disk.records_config.update( - { - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.diags.debug.tags': 'http|hpack', - 'proxy.config.ssl.server.cert.path': f'{self.ts.Variables.SSLDir}', - 'proxy.config.ssl.server.private_key.path': f'{self.ts.Variables.SSLDir}', - 'proxy.config.http.server_ports': f"{self.ts.Variables.ssl_port}:ssl", - 'proxy.config.http.connect_ports': f"{self.server.Variables.http_port}", - }) - - self.ts.addDefaultSSLFiles() - self.ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') - - self.ts.Disk.remap_config.AddLines([ - f"map / http://127.0.0.1:{self.server.Variables.http_port}/", - ]) - # Verify ts logs - self.ts.Disk.traffic_out.Content += Testers.ContainsExpression( - f"Proxy's Request.*\n.*\nCONNECT 127.0.0.1:{self.server.Variables.http_port} HTTP/1.1", - reflags=re.MULTILINE, - description="Verify that ATS recognizes the CONNECT request.") - - def runTraffic(self): - tr = Test.AddTestRun("Verify correct handling of CONNECT request on HTTP/2") - tr.AddVerifierClientProcess( - "connect-client2", self.connectReplayFile, https_ports=[self.ts.Variables.ssl_port], other_args='--thread-limit 1') - tr.Processes.Default.StartBefore(self.server) - tr.Processes.Default.StartBefore(self.ts) - tr.StillRunningAfter = self.server - tr.StillRunningAfter = self.ts - - def run(self): - self.runTraffic() - - -ConnectViaPVTest2().run() diff --git a/tests/gold_tests/continuations/double.test.py b/tests/gold_tests/continuations/double.test.py index 7eedeba40c8..52881b5d021 100644 --- a/tests/gold_tests/continuations/double.test.py +++ b/tests/gold_tests/continuations/double.test.py @@ -68,7 +68,7 @@ # Create a bunch of curl commands to be executed in parallel. Default.Process is set in SpawnCurlCommands. # On Fedora 28/29, it seems that curl will occasionally timeout after a couple seconds and return exitcode 2 # Examining the packet capture shows that Traffic Server dutifully sends the response -ps = tr.SpawnCurlCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0, 2)) +ps = tr.SpawnCurlCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0, 2), uds_path=ts.Variables.uds_path) tr.Processes.Default.Env = ts.Env tr.Processes.Default.ReturnCode = Any(0, 2) diff --git a/tests/gold_tests/continuations/double_h2.test.py b/tests/gold_tests/continuations/double_h2.test.py index 4075d6e7620..e8a66667f2f 100644 --- a/tests/gold_tests/continuations/double_h2.test.py +++ b/tests/gold_tests/continuations/double_h2.test.py @@ -23,7 +23,7 @@ Test transactions and sessions for http2, making sure the two continuations catch the same number of hooks. ''' Test.SkipUnless(Condition.HasCurlFeature('http2')) -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) Test.ContinueOnFail = True # Define default ATS. Disable the cache to simplify the test. ts = Test.MakeATSProcess("ts", enable_tls=True, enable_cache=False) diff --git a/tests/gold_tests/continuations/openclose.test.py b/tests/gold_tests/continuations/openclose.test.py index fafc6a57024..e0ae9ccc7e2 100644 --- a/tests/gold_tests/continuations/openclose.test.py +++ b/tests/gold_tests/continuations/openclose.test.py @@ -59,7 +59,7 @@ # Create a bunch of curl commands to be executed in parallel. Default.Process is set in SpawnCurlCommands. # On Fedora 28/29, it seems that curl will occasionally timeout after a couple seconds and return exitcode 2 # Examining the packet capture shows that Traffic Server dutifully sends the response -ps = tr.SpawnCurlCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0, 2)) +ps = tr.SpawnCurlCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0, 2), uds_path=ts.Variables.uds_path) tr.Processes.Default.Env = ts.Env tr.Processes.Default.ReturnCode = Any(0, 2) diff --git a/tests/gold_tests/continuations/openclose_h2.test.py b/tests/gold_tests/continuations/openclose_h2.test.py index b2056c0950f..33918d7afcd 100644 --- a/tests/gold_tests/continuations/openclose_h2.test.py +++ b/tests/gold_tests/continuations/openclose_h2.test.py @@ -24,7 +24,7 @@ ''' Test.SkipUnless(Condition.HasCurlFeature('http2')) -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) # Define default ATS. Disable the cache to simplify the test. ts = Test.MakeATSProcess("ts", enable_tls=True, enable_cache=False) diff --git a/tests/gold_tests/continuations/session_id.test.py b/tests/gold_tests/continuations/session_id.test.py index 204fca2252c..825e5fd77df 100644 --- a/tests/gold_tests/continuations/session_id.test.py +++ b/tests/gold_tests/continuations/session_id.test.py @@ -23,7 +23,6 @@ ''' Test.SkipUnless(Condition.HasCurlFeature('http2')) -Test.SkipIf(Condition.CurlUds()) # Configure the server. server = Test.MakeOriginServer("server") @@ -66,7 +65,7 @@ # is set in SpawnCurlCommands. On Fedora 28/29, it seems that curl will # occasionally timeout after a couple seconds and return exitcode 2 # Examining the packet capture shows that Traffic Server dutifully sends the response -ps = tr.SpawnCurlCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0, 2)) +ps = tr.SpawnCurlCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0, 2), uds_path=ts.Variables.uds_path) tr.Processes.Default.Env = ts.Env tr.Processes.Default.ReturnCode = Any(0, 2) tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) @@ -80,11 +79,12 @@ # # Run some HTTP/2 traffic. # -tr = Test.AddTestRun("Perform HTTP/2 transactions") -cmd = '-v -k --http2 -H "host:example.com" https://127.0.0.1:{0}'.format(ts.Variables.ssl_port) -ps = tr.SpawnCurlCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0, 2)) -tr.Processes.Default.Env = ts.Env -tr.Processes.Default.ReturnCode = Any(0, 2) +if not Condition.CurlUsingUnixDomainSocket(): + tr = Test.AddTestRun("Perform HTTP/2 transactions") + cmd = '-v -k --http2 -H "host:example.com" https://127.0.0.1:{0}'.format(ts.Variables.ssl_port) + ps = tr.SpawnCurlCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0, 2)) + tr.Processes.Default.Env = ts.Env + tr.Processes.Default.ReturnCode = Any(0, 2) # # Verify that the session ids are unique. @@ -97,7 +97,10 @@ def verify_session_count(output): global numberOfRequests - nReq = numberOfRequests * 2 + if Condition.CurlUsingUnixDomainSocket(): + nReq = numberOfRequests + else: + nReq = numberOfRequests * 2 session_ids = [line[0:line.find("\n")] for line in str(output).split("session id: ")[1:]] if len(session_ids) != nReq: return "Found {} session_id's, expected {}".format(len(session_ids), nReq) diff --git a/tests/gold_tests/continuations/session_id_uds.test.py b/tests/gold_tests/continuations/session_id_uds.test.py deleted file mode 100644 index d9c18d52f89..00000000000 --- a/tests/gold_tests/continuations/session_id_uds.test.py +++ /dev/null @@ -1,96 +0,0 @@ -''' -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -Test.Summary = ''' -Verify session ID properties. -''' - -Test.SkipUnless(Condition.HasCurlFeature('http2')) - -# Configure the server. -server = Test.MakeOriginServer("server") -request_header = {"headers": "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -response_header = { - "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Length:0\r\n\r\n", - "timestamp": "1469733493.993", - "body": "" -} -server.addResponse("sessionfile.log", request_header, response_header) - -# Configure ATS. Disable the cache to simplify the test. -ts = Test.MakeATSProcess("ts", enable_tls=True, enable_cache=False) - -ts.addDefaultSSLFiles() - -Test.PrepareTestPlugin( - os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'continuations', 'plugins', '.libs', 'session_id_verify.so'), ts) - -ts.Disk.records_config.update( - { - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.diags.debug.tags': 'session_id_verify', - 'proxy.config.cache.enable_read_while_writer': 0, - 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), - 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), - }) - -ts.Disk.remap_config.AddLine('map / http://127.0.0.1:{0}'.format(server.Variables.Port)) - -ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') - -# -# Run some HTTP/1 traffic. -# -tr = Test.AddTestRun("Perform HTTP/1 transactions") -cmd = '-v -H "host:example.com" http://127.0.0.1:{0}'.format(ts.Variables.port) -numberOfRequests = 100 -# Create a bunch of curl commands to be executed in parallel. Default.Process -# is set in SpawnCurlCommands. On Fedora 28/29, it seems that curl will -# occasionally timeout after a couple seconds and return exitcode 2 -# Examining the packet capture shows that Traffic Server dutifully sends the response -ps = tr.SpawnCurlCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0, 2)) -tr.Processes.Default.Env = ts.Env -tr.Processes.Default.ReturnCode = Any(0, 2) -tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) -tr.Processes.Default.StartBefore(Test.Processes.ts) -ts.StartAfter(*ps) -server.StartAfter(*ps) - -tr.StillRunningAfter = ts -tr.StillRunningAfter = server - -# -# Verify that the session ids are unique. -# - -# AuTest already searches for errors in diags.log and fails if it encounters -# them. The test plugin prints an error to this log if it sees duplicate ids. -# The following is to verify that we encountered the expected ids. - - -def verify_session_count(output): - global numberOfRequests - session_ids = [line[0:line.find("\n")] for line in str(output).split("session id: ")[1:]] - if len(session_ids) != numberOfRequests: - return "Found {} session_id's, expected {}".format(len(session_ids), nReq) - return "" - - -ts.Disk.traffic_out.Content += Testers.FileContentCallback(verify_session_count, 'verify_session_count') diff --git a/tests/gold_tests/cripts/cripts.test.py b/tests/gold_tests/cripts/cripts.test.py index 1e6b9ba7e02..49546b1b430 100644 --- a/tests/gold_tests/cripts/cripts.test.py +++ b/tests/gold_tests/cripts/cripts.test.py @@ -71,7 +71,8 @@ def updateCompilerForTest(self): def runHeaderTest(self): tr = Test.AddTestRun('Exercise traffic through cripts.') - tr.MakeCurlCommand(f'-v -H "Host: www.example.com" http://127.0.0.1:{self.ts.Variables.port}') + tr.MakeCurlCommand( + f'-v -H "Host: www.example.com" http://127.0.0.1:{self.ts.Variables.port}', uds_path=self.ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(self.server, ready=When.PortOpen(self.server.Variables.Port)) tr.Processes.Default.StartBefore(self.ts) diff --git a/tests/gold_tests/dns/splitdns.test.py b/tests/gold_tests/dns/splitdns.test.py index eff722417d4..ea345e9c79d 100644 --- a/tests/gold_tests/dns/splitdns.test.py +++ b/tests/gold_tests/dns/splitdns.test.py @@ -50,7 +50,7 @@ def setupTS(self): def addTestCase0(self): tr = Test.AddTestRun() - tr.MakeCurlCommand(f"-v http://localhost:{self.ts.Variables.port}/foo/") + tr.MakeCurlCommand(f"-v http://localhost:{self.ts.Variables.port}/foo/", uds_path=self.ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/test_case_0_stderr.gold" tr.Processes.Default.StartBefore(self.dns) @@ -62,7 +62,7 @@ def addTestCase0(self): def addTestCase1(self): tr = Test.AddTestRun() - tr.MakeCurlCommand(f"-v http://localhost:{self.ts.Variables.port}/bar/") + tr.MakeCurlCommand(f"-v http://localhost:{self.ts.Variables.port}/bar/", uds_path=self.ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/test_case_1_stderr.gold" tr.StillRunningAfter = self.dns diff --git a/tests/gold_tests/early_hints/early_hints.test.py b/tests/gold_tests/early_hints/early_hints.test.py index ec616502d84..58d42533089 100644 --- a/tests/gold_tests/early_hints/early_hints.test.py +++ b/tests/gold_tests/early_hints/early_hints.test.py @@ -135,7 +135,8 @@ def _configure_client(self, tr: 'TestRun'): f'-v {protocol_arg} ' f'--resolve "server.com:{ts_port}:127.0.0.1" ' f'-H "Host: server.com" ' - f'{scheme}://server.com:{ts_port}/{self._protocol_str}') + f'{scheme}://server.com:{ts_port}/{self._protocol_str}', + uds_path=self._ts.Variables.uds_path) client.ReturnCode = 0 self._ts.StartBefore(self._dns) @@ -154,6 +155,6 @@ def _configure_client(self, tr: 'TestRun'): TestEarlyHints(Protocol.HTTP) -if not Condition.CurlUds(): +if not Condition.CurlUsingUnixDomainSocket(): TestEarlyHints(Protocol.HTTPS) TestEarlyHints(Protocol.HTTP2) diff --git a/tests/gold_tests/forward_proxy/forward_proxy.test.py b/tests/gold_tests/forward_proxy/forward_proxy.test.py index 945c51cabf7..d6dd37f0fc4 100644 --- a/tests/gold_tests/forward_proxy/forward_proxy.test.py +++ b/tests/gold_tests/forward_proxy/forward_proxy.test.py @@ -20,7 +20,7 @@ Test.Summary = 'Verify ATS can function as a forward proxy' Test.ContinueOnFail = True -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) class ForwardProxyTest: diff --git a/tests/gold_tests/headers/accept_webp.test.py b/tests/gold_tests/headers/accept_webp.test.py index 7a905e2e8e9..892ee862c4c 100644 --- a/tests/gold_tests/headers/accept_webp.test.py +++ b/tests/gold_tests/headers/accept_webp.test.py @@ -20,7 +20,7 @@ Test.Summary = ''' Checking that we don't serve image/webp to clients that do not support it ''' -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) Test.ContinueOnFail = True diff --git a/tests/gold_tests/headers/cache_and_req_body.test.py b/tests/gold_tests/headers/cache_and_req_body.test.py index 1af39e9d0e9..e015a819ac8 100644 --- a/tests/gold_tests/headers/cache_and_req_body.test.py +++ b/tests/gold_tests/headers/cache_and_req_body.test.py @@ -20,7 +20,7 @@ Test.Summary = ''' Test cached responses and requests with bodies using CurlHeader tester ''' -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) Test.ContinueOnFail = True # Define default ATS diff --git a/tests/gold_tests/headers/cachedIMSRange.test.py b/tests/gold_tests/headers/cachedIMSRange.test.py index 37498db8e69..5c40cd67855 100644 --- a/tests/gold_tests/headers/cachedIMSRange.test.py +++ b/tests/gold_tests/headers/cachedIMSRange.test.py @@ -21,7 +21,6 @@ Test revalidating cached objects ''' -Test.SkipIf(Condition.CurlUds()) testName = "RevalidateCacheObject" Test.ContinueOnFail = True @@ -133,13 +132,18 @@ ts.Disk.MakeConfigFile(regex_remap_conf_file).AddLine(f'//.*/ http://127.0.0.1:{server.Variables.Port} @status=304') +ipv4flag = "" +if not Condition.CurlUsingUnixDomainSocket(): + ipv4flag = "--ipv4" + # Test 0 - Fill a 3 byte object with Last-Modified time into cache. tr = Test.AddTestRun() tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(ts) tr.MakeCurlCommand( - '-s -D - -v --ipv4 --http1.1 -H"UID: Fill" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/' - .format(ts.Variables.port)) + '-s -D - -v {0} --http1.1 -H"UID: Fill" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{1}/' + .format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "cache_and_req_body-miss.gold" tr.StillRunningAfter = ts @@ -151,8 +155,9 @@ tr = Test.AddTestRun() tr.DelayStart = 2 tr.MakeCurlCommand( - '-s -D - -v --ipv4 --http1.1 -H"UID: IMS" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/' - .format(ts.Variables.port)) + '-s -D - -v {0} --http1.1 -H"UID: IMS" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{1}/' + .format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "cache_and_req_body-hit-stale.gold" tr.StillRunningAfter = ts @@ -164,8 +169,9 @@ tr = Test.AddTestRun() tr.DelayStart = 2 tr.MakeCurlCommand( - '--range 0-1 -s -D - -v --ipv4 --http1.1 -H"UID: IMS" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/' - .format(ts.Variables.port)) + '--range 0-1 -s -D - -v {0} --http1.1 -H"UID: IMS" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{1}/' + .format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "cache_and_req_body-hit-stale-206.gold" tr.StillRunningAfter = ts @@ -173,30 +179,32 @@ # Test 3 - Test 304 response served from a regex-remap rule with HTTP. tr = Test.AddTestRun() -tr.MakeCurlCommand(f'-vs http://127.0.0.1:{ts.Variables.port}/ -H "Host: {default_304_host}"') +tr.MakeCurlCommand(f'-vs http://127.0.0.1:{ts.Variables.port}/ -H "Host: {default_304_host}"', uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = Testers.GoldFile("gold/http1_304.gold", case_insensitive=True) tr.StillRunningAfter = server -# Test 4 - Test 304 response served from a regex-remap rule with HTTPS. -tr = Test.AddTestRun() -tr.MakeCurlCommand(f'-vs -k https://127.0.0.1:{ts.Variables.ssl_port}/ -H "Host: {default_304_host}"') -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.All = Testers.GoldFile("gold/http1_304.gold", case_insensitive=True) -tr.StillRunningAfter = server +if not Condition.CurlUsingUnixDomainSocket(): + # Test 4 - Test 304 response served from a regex-remap rule with HTTPS. + tr = Test.AddTestRun() + tr.MakeCurlCommand(f'-vs -k https://127.0.0.1:{ts.Variables.ssl_port}/ -H "Host: {default_304_host}"') + tr.Processes.Default.ReturnCode = 0 + tr.Processes.Default.Streams.All = Testers.GoldFile("gold/http1_304.gold", case_insensitive=True) + tr.StillRunningAfter = server -# Test 5 - Test 304 response served from a regex-remap rule with HTTP/2. -tr = Test.AddTestRun() -tr.MakeCurlCommand(f'-vs -k --http2 https://127.0.0.1:{ts.Variables.ssl_port}/ -H "Host: {default_304_host}"') -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.All = Testers.GoldFile("gold/http2_304.gold", case_insensitive=True) -tr.StillRunningAfter = server + # Test 5 - Test 304 response served from a regex-remap rule with HTTP/2. + tr = Test.AddTestRun() + tr.MakeCurlCommand(f'-vs -k --http2 https://127.0.0.1:{ts.Variables.ssl_port}/ -H "Host: {default_304_host}"') + tr.Processes.Default.ReturnCode = 0 + tr.Processes.Default.Streams.All = Testers.GoldFile("gold/http2_304.gold", case_insensitive=True) + tr.StillRunningAfter = server # Test 6 - Fill a new object with an Etag. Not checking the output here. tr = Test.AddTestRun() tr.MakeCurlCommand( - '-s -D - -v --ipv4 --http1.1 -H"UID: EtagFill" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag' - .format(ts.Variables.port)) + '-s -D - -v {0} --http1.1 -H"UID: EtagFill" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{1}/etag' + .format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -207,8 +215,9 @@ tr = Test.AddTestRun() tr.DelayStart = 2 tr.MakeCurlCommand( - '-s -D - -v --ipv4 --http1.1 -H"UID: INM" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag' - .format(ts.Variables.port)) + '-s -D - -v {0} --http1.1 -H"UID: INM" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{1}/etag' + .format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "cache_and_req_body-hit-stale-INM.gold" tr.StillRunningAfter = ts @@ -220,8 +229,9 @@ tr = Test.AddTestRun() tr.DelayStart = 2 tr.MakeCurlCommand( - '--range 0-1 -s -D - -v --ipv4 --http1.1 -H"UID: INM" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag' - .format(ts.Variables.port)) + '--range 0-1 -s -D - -v {0} --http1.1 -H"UID: INM" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{1}/etag' + .format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "cache_and_req_body-hit-stale-206-etag.gold" tr.StillRunningAfter = ts @@ -231,8 +241,9 @@ tr = Test.AddTestRun() tr.DelayStart = 3 tr.MakeCurlCommand( - '-s -D - -v --ipv4 --http1.1 -H"UID: noBody" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/' - .format(ts.Variables.port)) + '-s -D - -v {0} --http1.1 -H"UID: noBody" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{1}/' + .format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "cache_and_req_nobody-hit-stale.gold" tr.StillRunningAfter = ts @@ -242,8 +253,9 @@ tr = Test.AddTestRun() tr.DelayStart = 3 tr.MakeCurlCommand( - '-s -D - -v --ipv4 --http1.1 -H"UID: noBody" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/' - .format(ts.Variables.port)) + '-s -D - -v {0} --http1.1 -H"UID: noBody" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{1}/' + .format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "cache_and_req_nobody-hit-stale.gold" tr.StillRunningAfter = ts @@ -253,8 +265,9 @@ tr = Test.AddTestRun() tr.DelayStart = 2 tr.MakeCurlCommand( - '-s -D - -v --ipv4 --http1.1 -H"UID: EtagError" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag' - .format(ts.Variables.port)) + '-s -D - -v {0} --http1.1 -H"UID: EtagError" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{1}/etag' + .format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "cache_and_error_nobody.gold" tr.StillRunningAfter = ts @@ -264,8 +277,9 @@ tr = Test.AddTestRun() tr.DelayStart = 2 tr.MakeCurlCommand( - '-s -D - -v --ipv4 --http1.1 -H"UID: EtagError" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag' - .format(ts.Variables.port)) + '-s -D - -v {0} --http1.1 -H"UID: EtagError" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{1}/etag' + .format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "cache_and_error_nobody.gold" tr.StillRunningAfter = ts diff --git a/tests/gold_tests/headers/cachedIMSRange_uds.test.py b/tests/gold_tests/headers/cachedIMSRange_uds.test.py deleted file mode 100644 index 861dd05c475..00000000000 --- a/tests/gold_tests/headers/cachedIMSRange_uds.test.py +++ /dev/null @@ -1,257 +0,0 @@ -''' -Test cached responses and requests with bodies -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -Test.Summary = ''' -Test revalidating cached objects -''' - -testName = "RevalidateCacheObject" -Test.ContinueOnFail = True - -# Set up Origin server -# request_header is from ATS to origin; response from Origin to ATS -# lookup_key is to make unique response in origin for header "UID" that will pass in ATS request -server = Test.MakeOriginServer("server", lookup_key="{%UID}") -# Initial request -request_header = { - "headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\nUID: Fill\r\n\r\n", - "timestamp": "1469733493.993", - "body": "" -} -response_header = { - "headers": - "HTTP/1.1 200 OK\r\nConnection: close\r\nLast-Modified: Tue, 08 May 2018 15:49:41 GMT\r\nCache-Control: max-age=1\r\n\r\n", - "timestamp": "1469733493.993", - "body": "xxx" -} -server.addResponse("sessionlog.json", request_header, response_header) -# IMS revalidation request -request_IMS_header = { - "headers": "GET / HTTP/1.1\r\nUID: IMS\r\nIf-Modified-Since: Tue, 08 May 2018 15:49:41 GMT\r\nHost: www.example.com\r\n\r\n", - "timestamp": "1469733493.993", - "body": "" -} -response_IMS_header = { - "headers": "HTTP/1.1 304 Not Modified\r\nConnection: close\r\nCache-Control: max-age=1\r\n\r\n", - "timestamp": "1469733493.993", - "body": None -} -server.addResponse("sessionlog.json", request_IMS_header, response_IMS_header) - -# EtagFill -request_etagfill_header = { - "headers": "GET /etag HTTP/1.1\r\nHost: www.example.com\r\nUID: EtagFill\r\n\r\n", - "timestamp": "1469733493.993", - "body": None -} -response_etagfill_header = { - "headers": "HTTP/1.1 200 OK\r\nETag: myetag\r\nConnection: close\r\nCache-Control: max-age=1\r\n\r\n", - "timestamp": "1469733493.993", - "body": "xxx" -} -server.addResponse("sessionlog.json", request_etagfill_header, response_etagfill_header) -# INM revalidation -request_INM_header = { - "headers": "GET /etag HTTP/1.1\r\nUID: INM\r\nIf-None-Match: myetag\r\nHost: www.example.com\r\n\r\n", - "timestamp": "1469733493.993", - "body": None -} -response_INM_header = { - "headers": "HTTP/1.1 304 Not Modified\r\nConnection: close\r\nETag: myetag\r\nCache-Control: max-age=1\r\n\r\n", - "timestamp": "1469733493.993", - "body": None -} -server.addResponse("sessionlog.json", request_INM_header, response_INM_header) - -# object changed to 0 byte -request_noBody_header = { - "headers": "GET / HTTP/1.1\r\nUID: noBody\r\nHost: www.example.com\r\n\r\n", - "timestamp": "1469733493.993", - "body": "" -} -response_noBody_header = { - "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Length: 0\r\nCache-Control: max-age=3\r\n\r\n", - "timestamp": "1469733493.993", - "body": "" -} -server.addResponse("sessionlog.json", request_noBody_header, response_noBody_header) - -# etag object now is a 404. Yeah, 404s don't usually have Cache-Control, but, ATS's default is to cache 404s for a while. -request_etagfill_header = { - "headers": "GET /etag HTTP/1.1\r\nHost: www.example.com\r\nUID: EtagError\r\n\r\n", - "timestamp": "1469733493.993", - "body": None -} -response_etagfill_header = { - "headers": "HTTP/1.1 404 Not Found\r\nConnection: close\r\nContent-Length: 0\r\nCache-Control: max-age=3\r\n\r\n", - "timestamp": "1469733493.993", - "body": "" -} -server.addResponse("sessionlog.json", request_etagfill_header, response_etagfill_header) - -# ATS Configuration -ts = Test.MakeATSProcess("ts", enable_tls=True) -ts.Disk.plugin_config.AddLine('xdebug.so --enable=x-cache,x-cache-key,via') -ts.addDefaultSSLFiles() -ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') -ts.Disk.records_config.update( - { - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.diags.debug.tags': 'http', - 'proxy.config.http.response_via_str': 3, - 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), - 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), - }) - -default_304_host = 'www.default304.test' -regex_remap_conf_file = "maps.reg" -ts.Disk.remap_config.AddLines( - [ - f'map https://{default_304_host}/ http://127.0.0.1:{server.Variables.Port}/ ' - f'@plugin=regex_remap.so @pparam={regex_remap_conf_file} @pparam=no-query-string @pparam=host', - f'map http://{default_304_host}/ http://127.0.0.1:{server.Variables.Port}/ ' - f'@plugin=regex_remap.so @pparam={regex_remap_conf_file} @pparam=no-query-string @pparam=host', - f'map / http://127.0.0.1:{server.Variables.Port}', - ]) - -ts.Disk.MakeConfigFile(regex_remap_conf_file).AddLine(f'//.*/ http://127.0.0.1:{server.Variables.Port} @status=304') - -# Test 0 - Fill a 3 byte object with Last-Modified time into cache. -tr = Test.AddTestRun() -tr.Processes.Default.StartBefore(server) -tr.Processes.Default.StartBefore(ts) -tr.MakeCurlCommand( - '-s -D - -v --http1.1 -H"UID: Fill" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/' - .format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "cache_and_req_body-miss.gold" -tr.StillRunningAfter = ts -tr.StillRunningAfter = server - -# Test 1 - Once it goes stale, fetch it again. We expect Origin to get IMS -# request, and serve a 304. We expect ATS to refresh the object, and give -# a 200 to user -tr = Test.AddTestRun() -tr.DelayStart = 2 -tr.MakeCurlCommand( - '-s -D - -v --http1.1 -H"UID: IMS" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/' - .format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "cache_and_req_body-hit-stale.gold" -tr.StillRunningAfter = ts -tr.StillRunningAfter = server - -# Test 2 - Once it goes stale, fetch it via a range request. We expect -# Origin to get IMS request, and serve a 304. We expect ATS to refresh the -# object, and give a 206 to user -tr = Test.AddTestRun() -tr.DelayStart = 2 -tr.MakeCurlCommand( - '--range 0-1 -s -D - -v --http1.1 -H"UID: IMS" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/' - .format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "cache_and_req_body-hit-stale-206.gold" -tr.StillRunningAfter = ts -tr.StillRunningAfter = server - -# Test 3 - Test 304 response served from a regex-remap rule with HTTP. -tr = Test.AddTestRun() -tr.MakeCurlCommand(f'-vs http://127.0.0.1:{ts.Variables.port}/ -H "Host: {default_304_host}"') -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.All = Testers.GoldFile("gold/http1_304.gold", case_insensitive=True) -tr.StillRunningAfter = server - -# Test 6 - Fill a new object with an Etag. Not checking the output here. -tr = Test.AddTestRun() -tr.MakeCurlCommand( - '-s -D - -v --http1.1 -H"UID: EtagFill" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag' - .format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.StillRunningAfter = ts -tr.StillRunningAfter = server - -# Test 7 - Once the etag object goes stale, fetch it again. We expect -# Origin to get INM request, and serve a 304. We expect ATS to refresh the -# object, and give a 200 to user -tr = Test.AddTestRun() -tr.DelayStart = 2 -tr.MakeCurlCommand( - '-s -D - -v --http1.1 -H"UID: INM" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag' - .format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "cache_and_req_body-hit-stale-INM.gold" -tr.StillRunningAfter = ts -tr.StillRunningAfter = server - -# Test 8 - Once the etag object goes stale, fetch it via a range request. -# We expect Origin to get INM request, and serve a 304. We expect ATS to -# refresh the object, and give a 206 to user -tr = Test.AddTestRun() -tr.DelayStart = 2 -tr.MakeCurlCommand( - '--range 0-1 -s -D - -v --http1.1 -H"UID: INM" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag' - .format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "cache_and_req_body-hit-stale-206-etag.gold" -tr.StillRunningAfter = ts -tr.StillRunningAfter = server - -# Test 9 - The origin changes the initial LMT object to 0 byte. We expect ATS to fetch and serve the new 0 byte object. -tr = Test.AddTestRun() -tr.DelayStart = 3 -tr.MakeCurlCommand( - '-s -D - -v --http1.1 -H"UID: noBody" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/' - .format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "cache_and_req_nobody-hit-stale.gold" -tr.StillRunningAfter = ts -tr.StillRunningAfter = server - -# Test 10 - Fetch the new 0 byte object again when fresh in cache to ensure its still a 0 byte object. -tr = Test.AddTestRun() -tr.DelayStart = 3 -tr.MakeCurlCommand( - '-s -D - -v --http1.1 -H"UID: noBody" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/' - .format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "cache_and_req_nobody-hit-stale.gold" -tr.StillRunningAfter = ts -tr.StillRunningAfter = server - -# Test 11 - The origin changes the etag object to 0 byte 404. We expect ATS to fetch and serve the 404 0 byte object. -tr = Test.AddTestRun() -tr.DelayStart = 2 -tr.MakeCurlCommand( - '-s -D - -v --http1.1 -H"UID: EtagError" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag' - .format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "cache_and_error_nobody.gold" -tr.StillRunningAfter = ts -tr.StillRunningAfter = server - -# Test 12 - Fetch the 0 byte etag object again when fresh in cache to ensure its still a 0 byte object -tr = Test.AddTestRun() -tr.DelayStart = 2 -tr.MakeCurlCommand( - '-s -D - -v --http1.1 -H"UID: EtagError" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag' - .format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "cache_and_error_nobody.gold" -tr.StillRunningAfter = ts -tr.StillRunningAfter = server diff --git a/tests/gold_tests/headers/field_name_space.test.py b/tests/gold_tests/headers/field_name_space.test.py index 0638f1f39fa..f4e8fe87e01 100644 --- a/tests/gold_tests/headers/field_name_space.test.py +++ b/tests/gold_tests/headers/field_name_space.test.py @@ -20,7 +20,7 @@ Test.Summary = ''' Checking on handling spaces after the field name and before the colon ''' -Test.SkipIf(Condition.CurlUds()) + Test.ContinueOnFail = True # Define default ATS @@ -38,11 +38,17 @@ ts.Disk.remap_config.AddLine('map http://www.example.com http://127.0.0.1:{0}'.format(server.Variables.Port)) +ipv4flag = "" +if not Condition.CurlUsingUnixDomainSocket(): + ipv4flag = "--ipv4" + # Test spaces at the end of the field name and before the : tr = Test.AddTestRun() tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand('-s -D - -v --ipv4 --http1.1 -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '-s -D - -v {0} --http1.1 -H "Host: www.example.com" http://localhost:{1}/'.format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/field_name_space.gold" tr.StillRunningAfter = ts diff --git a/tests/gold_tests/headers/field_name_space_uds.test.py b/tests/gold_tests/headers/field_name_space_uds.test.py deleted file mode 100644 index 3c1364124c4..00000000000 --- a/tests/gold_tests/headers/field_name_space_uds.test.py +++ /dev/null @@ -1,48 +0,0 @@ -''' -Test on handling spaces after the field name and before the colon -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -Test.Summary = ''' -Checking on handling spaces after the field name and before the colon -''' - -Test.ContinueOnFail = True - -# Define default ATS -ts = Test.MakeATSProcess("ts") -server = Test.MakeOriginServer("server") - -testName = "field_name_space" -request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -response_header = { - "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nFoo : 123\r\nFoo: 456\r\n", - "timestamp": "1469733493.993", - "body": "xxx" -} -server.addResponse("sessionlog.json", request_header, response_header) - -ts.Disk.remap_config.AddLine('map http://www.example.com http://127.0.0.1:{0}'.format(server.Variables.Port)) - -# Test spaces at the end of the field name and before the : -tr = Test.AddTestRun() -tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) -tr.Processes.Default.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand('-s -D - -v --http1.1 -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stderr = "gold/field_name_space.gold" -tr.StillRunningAfter = ts diff --git a/tests/gold_tests/headers/forwarded.test.py b/tests/gold_tests/headers/forwarded.test.py index f9904a108be..db34e6fc333 100644 --- a/tests/gold_tests/headers/forwarded.test.py +++ b/tests/gold_tests/headers/forwarded.test.py @@ -22,7 +22,7 @@ Test.Summary = ''' Test FORWARDED header. ''' -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) Test.SkipUnless( Condition.HasCurlFeature('http2'), diff --git a/tests/gold_tests/headers/good_request_after_bad.test.py b/tests/gold_tests/headers/good_request_after_bad.test.py index 86d5b128af1..cfec8e6cd76 100644 --- a/tests/gold_tests/headers/good_request_after_bad.test.py +++ b/tests/gold_tests/headers/good_request_after_bad.test.py @@ -123,14 +123,15 @@ tr = Test.AddTestRun("Trace request with a chunked body via curl") tr.MakeCurlCommand( '-v --http1.1 --header "Transfer-Encoding: chunked" -d aaa -X TRACE -o trace_curl.txt -k http://127.0.0.1:{}/foo'.format( - ts.Variables.port)) + ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = 'gold/bad_good_request_header.gold' trace_out.Content = Testers.ContainsExpression("Bad Request", "ATS error msg") trace_out.Content += Testers.ContainsExpression("Description: Could not process this request.", "ATS error msg") tr = Test.AddTestRun("Trace request via curl") -tr.MakeCurlCommand('-v --http1.1 -X TRACE -k http://127.0.0.1:{}/bar'.format(ts.Variables.port)) +tr.MakeCurlCommand('-v --http1.1 -X TRACE -k http://127.0.0.1:{}/bar'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = Testers.ContainsExpression( r"HTTP/1.1 501 Unsupported method \('TRACE'\)", "microserver does not support TRACE") diff --git a/tests/gold_tests/headers/hsts.test.py b/tests/gold_tests/headers/hsts.test.py index 59041e4aca1..fb6c7a005a4 100644 --- a/tests/gold_tests/headers/hsts.test.py +++ b/tests/gold_tests/headers/hsts.test.py @@ -20,7 +20,7 @@ Test.Summary = ''' heck hsts header is set correctly ''' -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) Test.ContinueOnFail = True # Define default ATS diff --git a/tests/gold_tests/headers/normalize_ae.test.py b/tests/gold_tests/headers/normalize_ae.test.py index a410487628a..9cbcbd413c7 100644 --- a/tests/gold_tests/headers/normalize_ae.test.py +++ b/tests/gold_tests/headers/normalize_ae.test.py @@ -23,7 +23,6 @@ Test normalizations of the Accept-Encoding header field. ''' -Test.SkipIf(Condition.CurlUds()) Test.SkipUnless(Condition.HasATSFeature('TS_HAS_BROTLI')) Test.ContinueOnFail = True @@ -77,6 +76,10 @@ def baselineTsSetup(ts): # Try various Accept-Encoding header fields for a particular traffic server and host. +ipv4flag = "" +if not Condition.CurlUsingUnixDomainSocket(): + ipv4flag = "--ipv4" + def allAEHdrs(shouldWaitForUServer, shouldWaitForTs, ts, host): @@ -91,34 +94,34 @@ def allAEHdrs(shouldWaitForUServer, shouldWaitForTs, ts, host): # delay on readiness of port tr.Processes.Default.StartBefore(ts) - baseCurl = '--verbose --ipv4 --http1.1 --proxy localhost:{} '.format(ts.Variables.port) + baseCurl = '--verbose {0} --http1.1 --proxy localhost:{1} '.format(ipv4flag, ts.Variables.port) # No Accept-Encoding header. # - tr.MakeCurlCommand(baseCurl + '--header "X-Au-Test: {0}" http://{0}'.format(host)) + tr.MakeCurlCommand(baseCurl + '--header "X-Au-Test: {0}" http://{0}'.format(host), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 def curlTail(hdrValue): return '--header "Accept-Encoding: {}" http://'.format(hdrValue) + host tr = test.AddTestRun() - tr.MakeCurlCommand(baseCurl + curlTail('gzip')) + tr.MakeCurlCommand(baseCurl + curlTail('gzip'), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = test.AddTestRun() - tr.MakeCurlCommand(baseCurl + curlTail('x-gzip')) + tr.MakeCurlCommand(baseCurl + curlTail('x-gzip'), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = test.AddTestRun() - tr.MakeCurlCommand(baseCurl + curlTail('br')) + tr.MakeCurlCommand(baseCurl + curlTail('br'), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = test.AddTestRun() - tr.MakeCurlCommand(baseCurl + curlTail('gzip, br')) + tr.MakeCurlCommand(baseCurl + curlTail('gzip, br'), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = test.AddTestRun() - tr.MakeCurlCommand(baseCurl + curlTail('gzip;q=0.3, whatever;q=0.666, br;q=0.7')) + tr.MakeCurlCommand(baseCurl + curlTail('gzip;q=0.3, whatever;q=0.666, br;q=0.7'), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/headers/normalize_ae_uds.test.py b/tests/gold_tests/headers/normalize_ae_uds.test.py deleted file mode 100644 index dd289ba0902..00000000000 --- a/tests/gold_tests/headers/normalize_ae_uds.test.py +++ /dev/null @@ -1,143 +0,0 @@ -''' -Test normalizations of the Accept-Encoding header field. -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -Test.Summary = ''' -Test normalizations of the Accept-Encoding header field. -''' - -Test.SkipUnless(Condition.HasATSFeature('TS_HAS_BROTLI')) - -Test.ContinueOnFail = True - -server = Test.MakeOriginServer("server", options={'--load': os.path.join(Test.TestDirectory, 'normalize_ae_observer.py')}) - -testName = "NORMALIZE_AE" - -request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.no-oride.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -server.addResponse("sessionlog.json", request_header, response_header) -request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.ae-0.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -server.addResponse("sessionlog.json", request_header, response_header) -request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.ae-1.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -server.addResponse("sessionlog.json", request_header, response_header) -request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.ae-2.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -server.addResponse("sessionlog.json", request_header, response_header) - -# Define first ATS. Disable the cache to make sure each request is sent to the -# origin server. -ts = Test.MakeATSProcess("ts", enable_cache=False) - - -def baselineTsSetup(ts): - - ts.Disk.records_config.update({ - # 'proxy.config.diags.debug.enabled': 1, - }) - - ts.Disk.remap_config.AddLine('map http://www.no-oride.com http://127.0.0.1:{0}'.format(server.Variables.Port)) - ts.Disk.remap_config.AddLine( - 'map http://www.ae-0.com http://127.0.0.1:{0}'.format(server.Variables.Port) + - ' @plugin=conf_remap.so @pparam=proxy.config.http.normalize_ae=0') - ts.Disk.remap_config.AddLine( - 'map http://www.ae-1.com http://127.0.0.1:{0}'.format(server.Variables.Port) + - ' @plugin=conf_remap.so @pparam=proxy.config.http.normalize_ae=1') - ts.Disk.remap_config.AddLine( - 'map http://www.ae-2.com http://127.0.0.1:{0}'.format(server.Variables.Port) + - ' @plugin=conf_remap.so @pparam=proxy.config.http.normalize_ae=2') - ts.Disk.remap_config.AddLine( - 'map http://www.ae-3.com http://127.0.0.1:{0}'.format(server.Variables.Port) + - ' @plugin=conf_remap.so @pparam=proxy.config.http.normalize_ae=3') - - -baselineTsSetup(ts) - -# set up to check the output after the tests have run. -# -normalize_ae_log_id = Test.Disk.File("normalize_ae.log") -normalize_ae_log_id.Content = "normalize_ae.gold" - -# Try various Accept-Encoding header fields for a particular traffic server and host. - - -def allAEHdrs(shouldWaitForUServer, shouldWaitForTs, ts, host): - - tr = test.AddTestRun() - - if shouldWaitForUServer: - # wait for the micro server - tr.Processes.Default.StartBefore(server) - - if shouldWaitForTs: - # wait for the micro server - # delay on readiness of port - tr.Processes.Default.StartBefore(ts) - - baseCurl = '--verbose --http1.1 --proxy localhost:{} '.format(ts.Variables.port) - - # No Accept-Encoding header. - # - tr.MakeCurlCommand(baseCurl + '--header "X-Au-Test: {0}" http://{0}'.format(host)) - tr.Processes.Default.ReturnCode = 0 - - def curlTail(hdrValue): - return '--header "Accept-Encoding: {}" http://'.format(hdrValue) + host - - tr = test.AddTestRun() - tr.MakeCurlCommand(baseCurl + curlTail('gzip')) - tr.Processes.Default.ReturnCode = 0 - - tr = test.AddTestRun() - tr.MakeCurlCommand(baseCurl + curlTail('x-gzip')) - tr.Processes.Default.ReturnCode = 0 - - tr = test.AddTestRun() - tr.MakeCurlCommand(baseCurl + curlTail('br')) - tr.Processes.Default.ReturnCode = 0 - - tr = test.AddTestRun() - tr.MakeCurlCommand(baseCurl + curlTail('gzip, br')) - tr.Processes.Default.ReturnCode = 0 - - tr = test.AddTestRun() - tr.MakeCurlCommand(baseCurl + curlTail('gzip;q=0.3, whatever;q=0.666, br;q=0.7')) - tr.Processes.Default.ReturnCode = 0 - - -def perTsTest(shouldWaitForUServer, ts): - allAEHdrs(shouldWaitForUServer, True, ts, 'www.no-oride.com') - allAEHdrs(False, False, ts, 'www.ae-0.com') - allAEHdrs(False, False, ts, 'www.ae-1.com') - allAEHdrs(False, False, ts, 'www.ae-2.com') - allAEHdrs(False, False, ts, 'www.ae-3.com') - - -perTsTest(True, ts) - -# Define second ATS -ts2 = Test.MakeATSProcess("ts2") - -baselineTsSetup(ts2) - -ts2.Disk.records_config.update({ - 'proxy.config.http.normalize_ae': 0, -}) - -perTsTest(False, ts2) diff --git a/tests/gold_tests/headers/range.test.py b/tests/gold_tests/headers/range.test.py index a98f1ead096..23a18fd887c 100644 --- a/tests/gold_tests/headers/range.test.py +++ b/tests/gold_tests/headers/range.test.py @@ -135,7 +135,7 @@ def curl_range(ts, path="", ifrange=None, start=1, end=5): # ATS should ignore the Range header when given an If-Range header with the incorrect etag tr = Test.AddTestRun() -tr.MakeCurlCommand(curl_range(ts, ifrange='"should-not-match"')) +tr.MakeCurlCommand(curl_range(ts, ifrange='"should-not-match"'), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(microserver, ready=When.PortOpen(microserver.Variables.Port)) tr.Processes.Default.StartBefore(origin, ready=When.PortOpen(origin.Variables.port)) @@ -147,66 +147,67 @@ def curl_range(ts, path="", ifrange=None, start=1, end=5): # ATS should respond to Range requests with partial content tr = Test.AddTestRun() -tr.MakeCurlCommand(curl_range(ts)) +tr.MakeCurlCommand(curl_range(ts), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/range-206.gold" # ATS should respond to Range requests with partial content when given an If-Range header with # the correct etag tr = Test.AddTestRun() -tr.MakeCurlCommand(curl_range(ts, ifrange='"range"')) +tr.MakeCurlCommand(curl_range(ts, ifrange='"range"'), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/range-206.gold" # ATS should respond to Range requests with partial content when given an If-Range header # that matches the Last-Modified header of the cached response tr = Test.AddTestRun() -tr.MakeCurlCommand(curl_range(ts, ifrange="Thu, 10 Feb 2022 00:00:00 GMT")) +tr.MakeCurlCommand(curl_range(ts, ifrange="Thu, 10 Feb 2022 00:00:00 GMT"), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/range-206.gold" # ATS should respond to Range requests with the full content when given an If-Range header # that doesn't match the Last-Modified header of the cached response tr = Test.AddTestRun() -tr.MakeCurlCommand(curl_range(ts, ifrange="Thu, 10 Feb 2022 01:00:00 GMT")) +tr.MakeCurlCommand(curl_range(ts, ifrange="Thu, 10 Feb 2022 01:00:00 GMT"), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/range-200.gold" # ATS should respond to Range requests with a 416 error code when the given Range is invalid tr = Test.AddTestRun() -tr.MakeCurlCommand(curl_range(ts, start=100, end=105)) +tr.MakeCurlCommand(curl_range(ts, start=100, end=105), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/range-416.gold" # ATS should ignore the Range header when given an If-Range header with the incorrect etag tr = Test.AddTestRun() -tr.MakeCurlCommand(curl_range(ts, ifrange='"should-not-match"')) +tr.MakeCurlCommand(curl_range(ts, ifrange='"should-not-match"'), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/range-200.gold" # ATS should ignore the Range header when given an If-Range header with weak etags tr = Test.AddTestRun() -tr.MakeCurlCommand(curl_range(ts, ifrange='W/"range"')) +tr.MakeCurlCommand(curl_range(ts, ifrange='W/"range"'), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/range-200.gold" # ATS should ignore the Range header when given an If-Range header with a date older than the # Last-Modified header of the cached response tr = Test.AddTestRun() -tr.MakeCurlCommand(curl_range(ts, ifrange="Wed, 09 Feb 2022 23:00:00 GMT")) +tr.MakeCurlCommand(curl_range(ts, ifrange="Wed, 09 Feb 2022 23:00:00 GMT"), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/range-200.gold" # Write to the cache by requesting the entire content tr = Test.AddTestRun() -tr.MakeCurlCommand(curl_whole(ts, path="short")) +tr.MakeCurlCommand(curl_whole(ts, path="short"), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/range-200.gold" # ATS should respond to range requests with partial content for stale caches in response to # valid If-Range requests if the origin responds with 304 Not Modified. tr = Test.AddTestRun() -tr.MakeCurlCommandMulti(f"sleep {2 * CACHE_SHORT_MAXAGE}; {{curl}} " + curl_range(ts, path="short", ifrange='"range"')) +tr.MakeCurlCommandMulti( + f"sleep {2 * CACHE_SHORT_MAXAGE}; {{curl}} " + curl_range(ts, path="short", ifrange='"range"'), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/range-206-revalidated.gold" diff --git a/tests/gold_tests/headers/syntax.test.py b/tests/gold_tests/headers/syntax.test.py index f46aeb45ce3..9d4c9113eb3 100644 --- a/tests/gold_tests/headers/syntax.test.py +++ b/tests/gold_tests/headers/syntax.test.py @@ -21,7 +21,6 @@ Test whitespace between field name and colon in the header ''' -Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True # Define default ATS @@ -36,12 +35,17 @@ ts.Disk.remap_config.AddLine('map http://www.example.com http://127.0.0.1:{0}'.format(server.Variables.Port)) +ipv4flag = "" +if not Condition.CurlUsingUnixDomainSocket(): + ipv4flag = "--ipv4" + # Test 0 - 200 Response tr = Test.AddTestRun() tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) tr.MakeCurlCommand( - '-s -D - -v --ipv4 --http1.1 -H " foo: bar" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)) + '-s -D - -v {0} --http1.1 -H " foo: bar" -H "Host: www.example.com" http://localhost:{1}/'.format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "syntax.200.gold" tr.StillRunningAfter = ts @@ -49,7 +53,8 @@ # Test 1 - 400 Response - Single space after field name tr = Test.AddTestRun() tr.MakeCurlCommand( - '-s -D - -v --ipv4 --http1.1 -H "foo : bar" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)) + '-s -D - -v {0} --http1.1 -H "foo : bar" -H "Host: www.example.com" http://localhost:{1}/'.format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "syntax.400.gold" tr.StillRunningAfter = ts @@ -57,7 +62,8 @@ # Test 2 - 400 Response - Double space after field name tr = Test.AddTestRun() tr.MakeCurlCommand( - '-s -D - -v --ipv4 --http1.1 -H "foo : bar" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)) + '-s -D - -v {0} --http1.1 -H "foo : bar" -H "Host: www.example.com" http://localhost:{1}/'.format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "syntax.400.gold" tr.StillRunningAfter = ts @@ -65,8 +71,9 @@ # Test 3 - 400 Response - Three different Content-Length headers tr = Test.AddTestRun() tr.MakeCurlCommand( - '-s -D - -v --ipv4 --http1.1 -d "hello world" -H "Content-Length: 11" -H "Content-Length: 10" -H "Content-Length: 9" -H "Host: www.example.com" http://localhost:{0}/' - .format(ts.Variables.port)) + '-s -D - -v {0} --http1.1 -d "hello world" -H "Content-Length: 11" -H "Content-Length: 10" -H "Content-Length: 9" -H "Host: www.example.com" http://localhost:{1}/' + .format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "syntax.400.gold" tr.StillRunningAfter = ts @@ -74,8 +81,9 @@ # Test 4 - 200 Response - Three same Content-Length headers tr = Test.AddTestRun() tr.MakeCurlCommand( - '-s -D - -v --ipv4 --http1.1 -d "hello world" -H "Content-Length: 11" -H "Content-Length: 11" -H "Content-Length: 11" -H "Host: www.example.com" http://localhost:{0}/' - .format(ts.Variables.port)) + '-s -D - -v {0} --http1.1 -d "hello world" -H "Content-Length: 11" -H "Content-Length: 11" -H "Content-Length: 11" -H "Host: www.example.com" http://localhost:{1}/' + .format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "syntax.200.gold" tr.StillRunningAfter = ts @@ -83,8 +91,9 @@ # Test 5 - 200 Response - Three different Content-Length headers with a Transfer encoding header tr = Test.AddTestRun() tr.MakeCurlCommand( - '-s -D - -v --ipv4 --http1.1 -d "hello world" -H "Transfer-Encoding: chunked" -H "Content-Length: 11" -H "Content-Length: 10" -H "Content-Length: 9" -H "Host: www.example.com" http://localhost:{0}/' - .format(ts.Variables.port)) + '-s -D - -v {0} --http1.1 -d "hello world" -H "Transfer-Encoding: chunked" -H "Content-Length: 11" -H "Content-Length: 10" -H "Content-Length: 9" -H "Host: www.example.com" http://localhost:{1}/' + .format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "syntax.200.gold" tr.StillRunningAfter = ts diff --git a/tests/gold_tests/headers/syntax_uds.test.py b/tests/gold_tests/headers/syntax_uds.test.py deleted file mode 100644 index 95811d3134b..00000000000 --- a/tests/gold_tests/headers/syntax_uds.test.py +++ /dev/null @@ -1,87 +0,0 @@ -''' -Test whitespace between field name and colon in the header -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -Test.Summary = ''' -Test whitespace between field name and colon in the header -''' - -Test.ContinueOnFail = True - -# Define default ATS -ts = Test.MakeATSProcess("ts") -server = Test.MakeOriginServer("server") - -# **testname is required** -testName = "" -request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -server.addResponse("sessionlog.json", request_header, response_header) - -ts.Disk.remap_config.AddLine('map http://www.example.com http://127.0.0.1:{0}'.format(server.Variables.Port)) - -# Test 0 - 200 Response -tr = Test.AddTestRun() -tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) -tr.Processes.Default.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand('-s -D - -v --http1.1 -H " foo: bar" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "syntax.200.gold" -tr.StillRunningAfter = ts - -# Test 1 - 400 Response - Single space after field name -tr = Test.AddTestRun() -tr.MakeCurlCommand('-s -D - -v --http1.1 -H "foo : bar" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "syntax.400.gold" -tr.StillRunningAfter = ts - -# Test 2 - 400 Response - Double space after field name -tr = Test.AddTestRun() -tr.MakeCurlCommand( - '-s -D - -v --http1.1 -H "foo : bar" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "syntax.400.gold" -tr.StillRunningAfter = ts - -# Test 3 - 400 Response - Three different Content-Length headers -tr = Test.AddTestRun() -tr.MakeCurlCommand( - '-s -D - -v --http1.1 -d "hello world" -H "Content-Length: 11" -H "Content-Length: 10" -H "Content-Length: 9" -H "Host: www.example.com" http://localhost:{0}/' - .format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "syntax.400.gold" -tr.StillRunningAfter = ts - -# Test 4 - 200 Response - Three same Content-Length headers -tr = Test.AddTestRun() -tr.MakeCurlCommand( - '-s -D - -v --http1.1 -d "hello world" -H "Content-Length: 11" -H "Content-Length: 11" -H "Content-Length: 11" -H "Host: www.example.com" http://localhost:{0}/' - .format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "syntax.200.gold" -tr.StillRunningAfter = ts - -# Test 5 - 200 Response - Three different Content-Length headers with a Transfer encoding header -tr = Test.AddTestRun() -tr.MakeCurlCommand( - '-s -D - -v --http1.1 -d "hello world" -H "Transfer-Encoding: chunked" -H "Content-Length: 11" -H "Content-Length: 10" -H "Content-Length: 9" -H "Host: www.example.com" http://localhost:{0}/' - .format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stdout = "syntax.200.gold" -tr.StillRunningAfter = ts diff --git a/tests/gold_tests/headers/via.test.py b/tests/gold_tests/headers/via.test.py index a9272c18728..8458b69f760 100644 --- a/tests/gold_tests/headers/via.test.py +++ b/tests/gold_tests/headers/via.test.py @@ -23,7 +23,7 @@ Test.Summary = ''' Check VIA header for protocol stack data. ''' -Test.SkipIf(Condition.CurlUds()) + Test.SkipUnless(Condition.HasCurlFeature('http2'), Condition.HasCurlFeature('IPv6')) Test.ContinueOnFail = True @@ -63,9 +63,17 @@ via_log_id = Test.Disk.File("via.log") if Condition.HasATSFeature('TS_USE_QUIC') and Condition.HasCurlFeature('http3'): via_log_id.Content = "via_h3.gold" +elif Condition.CurlUsingUnixDomainSocket(): + via_log_id.Content = "via_uds.gold" else: via_log_id.Content = "via.gold" +ipv4flag = "" +ipv6flag = "" +if not Condition.CurlUsingUnixDomainSocket(): + ipv4flag = "--ipv4" + ipv6flag = "--ipv6" + # Basic HTTP 1.1 tr = Test.AddTestRun() # Wait for the micro server @@ -73,7 +81,9 @@ # Delay on readiness of our ssl ports tr.Processes.Default.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand('--verbose --ipv4 --http1.1 --proxy localhost:{} http://www.example.com'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '--verbose {0} --http1.1 --proxy localhost:{1} http://www.example.com'.format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = server @@ -81,50 +91,58 @@ # HTTP 1.0 tr = Test.AddTestRun() -tr.MakeCurlCommand('--verbose --ipv4 --http1.0 --proxy localhost:{} http://www.example.com'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 - -tr.StillRunningAfter = server -tr.StillRunningAfter = ts - -# HTTP 2 -tr = Test.AddTestRun() tr.MakeCurlCommand( - '--verbose --ipv4 --http2 --insecure --header "Host: www.example.com" https://localhost:{}'.format(ts.Variables.ssl_port)) + '--verbose {0} --http1.0 --proxy localhost:{1} http://www.example.com'.format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = server tr.StillRunningAfter = ts -# HTTP 3 -if Condition.HasATSFeature('TS_HAS_QUICHE') and Condition.HasCurlFeature('http3'): +if not Condition.CurlUsingUnixDomainSocket(): + # HTTP 2 tr = Test.AddTestRun() tr.MakeCurlCommand( - '--verbose --ipv4 --http3 --insecure --header "Host: www.example.com" https://localhost:{}'.format(ts.Variables.ssl_port)) + '--verbose --ipv4 --http2 --insecure --header "Host: www.example.com" https://localhost:{}'.format(ts.Variables.ssl_port)) tr.Processes.Default.ReturnCode = 0 + tr.StillRunningAfter = server tr.StillRunningAfter = ts -# TLS -tr = Test.AddTestRun() -tr.MakeCurlCommand( - '--verbose --ipv4 --http1.1 --insecure --header "Host: www.example.com" https://localhost:{}'.format(ts.Variables.ssl_port)) -tr.Processes.Default.ReturnCode = 0 + # HTTP 3 + if Condition.HasATSFeature('TS_HAS_QUICHE') and Condition.HasCurlFeature('http3'): + tr = Test.AddTestRun() + tr.MakeCurlCommand( + '--verbose --ipv4 --http3 --insecure --header "Host: www.example.com" https://localhost:{}'.format( + ts.Variables.ssl_port)) + tr.Processes.Default.ReturnCode = 0 + tr.StillRunningAfter = server + tr.StillRunningAfter = ts + + # TLS + tr = Test.AddTestRun() + tr.MakeCurlCommand( + '--verbose --ipv4 --http1.1 --insecure --header "Host: www.example.com" https://localhost:{}'.format(ts.Variables.ssl_port)) + tr.Processes.Default.ReturnCode = 0 -tr.StillRunningAfter = server -tr.StillRunningAfter = ts + tr.StillRunningAfter = server + tr.StillRunningAfter = ts # IPv6 tr = Test.AddTestRun() -tr.MakeCurlCommand('--verbose --ipv6 --http1.1 --proxy localhost:{} http://www.example.com'.format(ts.Variables.portv6)) +tr.MakeCurlCommand( + '--verbose {0} --http1.1 --proxy localhost:{1} http://www.example.com'.format(ipv6flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = server tr.StillRunningAfter = ts -tr = Test.AddTestRun() -tr.MakeCurlCommand( - '--verbose --ipv6 --http1.1 --insecure --header "Host: www.example.com" https://localhost:{}'.format(ts.Variables.ssl_portv6)) -tr.Processes.Default.ReturnCode = 0 +if not Condition.CurlUsingUnixDomainSocket(): + tr = Test.AddTestRun() + tr.MakeCurlCommand( + '--verbose --ipv6 --http1.1 --insecure --header "Host: www.example.com" https://localhost:{}'.format( + ts.Variables.ssl_portv6)) + tr.Processes.Default.ReturnCode = 0 -tr.StillRunningAfter = server -tr.StillRunningAfter = ts + tr.StillRunningAfter = server + tr.StillRunningAfter = ts diff --git a/tests/gold_tests/headers/via_uds.test.py b/tests/gold_tests/headers/via_uds.test.py deleted file mode 100644 index d44e7ef91e0..00000000000 --- a/tests/gold_tests/headers/via_uds.test.py +++ /dev/null @@ -1,95 +0,0 @@ -''' -Test the VIA header. This runs several requests through ATS and extracts the upstream VIA headers. -Those are then checked against a gold file to verify the protocol stack based output is correct. -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -Test.Summary = ''' -Check VIA header for protocol stack data. -''' - -Test.SkipUnless(Condition.HasCurlFeature('http2'), Condition.HasCurlFeature('IPv6')) -Test.ContinueOnFail = True - -# Define default ATS -if Condition.HasATSFeature('TS_USE_QUIC') and Condition.HasCurlFeature('http3'): - ts = Test.MakeATSProcess("ts", enable_tls=True, enable_quic=True) -else: - ts = Test.MakeATSProcess("ts", enable_tls=True) - -server = Test.MakeOriginServer("server", options={'--load': os.path.join(Test.TestDirectory, 'via-observer.py')}) - -testName = "VIA" - -# We only need one transaction as only the VIA header will be checked. -request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -server.addResponse("sessionlog.json", request_header, response_header) - -# These should be promoted rather than other tests like this reaching around. -ts.addDefaultSSLFiles() - -ts.Disk.records_config.update( - { - 'proxy.config.http.insert_request_via_str': 4, - 'proxy.config.http.insert_response_via_str': 4, - 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), - 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), - }) - -ts.Disk.remap_config.AddLine('map http://www.example.com http://127.0.0.1:{0}'.format(server.Variables.Port)) -ts.Disk.remap_config.AddLine( - 'map https://www.example.com http://127.0.0.1:{0}'.format(server.Variables.Port, ts.Variables.ssl_port)) - -ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') - -# Set up to check the output after the tests have run. -via_log_id = Test.Disk.File("via.log") -if Condition.HasATSFeature('TS_USE_QUIC') and Condition.HasCurlFeature('http3'): - via_log_id.Content = "via_h3.gold" -else: - via_log_id.Content = "via_uds.gold" - -# Basic HTTP 1.1 -tr = Test.AddTestRun() -# Wait for the micro server -tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) -# Delay on readiness of our ssl ports -tr.Processes.Default.StartBefore(Test.Processes.ts) - -tr.MakeCurlCommand('--verbose --http1.1 --proxy localhost:{} http://www.example.com'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 - -tr.StillRunningAfter = server -tr.StillRunningAfter = ts - -# HTTP 1.0 -tr = Test.AddTestRun() -tr.MakeCurlCommand('--verbose --http1.0 --proxy localhost:{} http://www.example.com'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 - -tr.StillRunningAfter = server -tr.StillRunningAfter = ts - -# IPv6 -tr = Test.AddTestRun() -tr.MakeCurlCommand('--verbose --http1.1 --proxy localhost:{} http://www.example.com'.format(ts.Variables.portv6)) -tr.Processes.Default.ReturnCode = 0 -tr.StillRunningAfter = server -tr.StillRunningAfter = ts diff --git a/tests/gold_tests/ip_allow/ip_allow.test.py b/tests/gold_tests/ip_allow/ip_allow.test.py index a6a8bf32ec8..d12a15ec22a 100644 --- a/tests/gold_tests/ip_allow/ip_allow.test.py +++ b/tests/gold_tests/ip_allow/ip_allow.test.py @@ -22,7 +22,7 @@ Test.Summary = ''' Verify ip_allow filtering behavior. ''' -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) Test.ContinueOnFail = True # Define default ATS diff --git a/tests/gold_tests/ip_allow/ip_allow_uds.test.py b/tests/gold_tests/ip_allow/ip_allow_pp_uds.test.py similarity index 99% rename from tests/gold_tests/ip_allow/ip_allow_uds.test.py rename to tests/gold_tests/ip_allow/ip_allow_pp_uds.test.py index 8ce0d684229..9bea8b10c93 100644 --- a/tests/gold_tests/ip_allow/ip_allow_uds.test.py +++ b/tests/gold_tests/ip_allow/ip_allow_pp_uds.test.py @@ -22,7 +22,7 @@ Test.Summary = ''' Verify ip_allow filtering behavior. ''' - +Test.SkipUnless(Condition.CurlUsingUnixDomainSocket()) Test.ContinueOnFail = True # Define default ATS diff --git a/tests/gold_tests/logging/all_headers.test.py b/tests/gold_tests/logging/all_headers.test.py index 49df877de3b..acf5e0ec34a 100644 --- a/tests/gold_tests/logging/all_headers.test.py +++ b/tests/gold_tests/logging/all_headers.test.py @@ -22,10 +22,10 @@ Test.Summary = ''' Test new "all headers" log fields ''' -Test.SkipIf(Condition.CurlUds()) + # Define ATS. # -ts = Test.MakeATSProcess("ts") +ts = Test.MakeATSProcess("ts", enable_proxy_protocol=True) # Define MicroServer. # @@ -39,10 +39,18 @@ } server.addResponse("sessionlog.json", request_header, response_header) -ts.Disk.records_config.update({ - 'proxy.config.diags.debug.enabled': 0, - 'proxy.config.diags.debug.tags': 'http|dns', -}) +if Condition.CurlUsingUnixDomainSocket(): + ts.Disk.records_config.update( + { + 'proxy.config.diags.debug.enabled': 0, + 'proxy.config.diags.debug.tags': 'http|dns', + 'proxy.config.http.insert_forwarded': 'for', + }) +else: + ts.Disk.records_config.update({ + 'proxy.config.diags.debug.enabled': 0, + 'proxy.config.diags.debug.tags': 'http|dns', + }) ts.Disk.remap_config.AddLine('map http://127.0.0.1:{0} http://127.0.0.1:{1}'.format(ts.Variables.port, server.Variables.Port)) @@ -62,7 +70,10 @@ # Configure comparison of "sanitized" log file with gold file at end of test. # sanitized_log_path = os.path.join(ts.Variables.LOGDIR, 'test_all_headers.log.san') -Test.Disk.File(sanitized_log_path, exists=True, content='gold/test_all_headers.gold') +if Condition.CurlUsingUnixDomainSocket(): + Test.Disk.File(sanitized_log_path, exists=True, content='gold/test_all_headers_uds.gold') +else: + Test.Disk.File(sanitized_log_path, exists=True, content='gold/test_all_headers.gold') def reallyLong(): @@ -79,13 +90,29 @@ def reallyLong(): tr = Test.AddTestRun() tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand('"http://127.0.0.1:{0}" --user-agent "007" --verbose '.format(ts.Variables.port) + reallyLong()) +if Condition.CurlUsingUnixDomainSocket(): + tr.MakeCurlCommand( + '"http://127.0.0.1:{0}" --user-agent "007" --haproxy-protocol 1 --haproxy-clientip 127.0.0.1 --verbose '.format( + ts.Variables.port) + reallyLong(), + uds_path=ts.Variables.uds_path) +else: + tr.MakeCurlCommand( + '"http://127.0.0.1:{0}" --user-agent "007" --verbose '.format(ts.Variables.port) + reallyLong(), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 # Repeat same curl, will be answered from the ATS cache. # tr = Test.AddTestRun() -tr.MakeCurlCommand('"http://127.0.0.1:{0}" --user-agent "007" --verbose '.format(ts.Variables.port) + reallyLong()) +if Condition.CurlUsingUnixDomainSocket(): + tr.MakeCurlCommand( + '"http://127.0.0.1:{0}" --user-agent "007" --haproxy-protocol 1 --haproxy-clientip 127.0.0.1 --verbose '.format( + ts.Variables.port) + reallyLong(), + uds_path=ts.Variables.uds_path) +else: + tr.MakeCurlCommand( + '"http://127.0.0.1:{0}" --user-agent "007" --verbose '.format(ts.Variables.port) + reallyLong(), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 # Delay to allow TS to flush report to disk, then "sanitize" generated log. diff --git a/tests/gold_tests/logging/all_headers_uds.test.py b/tests/gold_tests/logging/all_headers_uds.test.py deleted file mode 100644 index 292ece442e0..00000000000 --- a/tests/gold_tests/logging/all_headers_uds.test.py +++ /dev/null @@ -1,108 +0,0 @@ -''' -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os -import sys - -Test.Summary = ''' -Test new "all headers" log fields -''' - -# Define ATS. -# -ts = Test.MakeATSProcess("ts", enable_proxy_protocol=True) - -# Define MicroServer. -# -server = Test.MakeOriginServer("server") - -request_header = {"headers": "GET / HTTP/1.1\r\nHost: does.not.matter\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -response_header = { - "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nCache-control: max-age=85000\r\n\r\n", - "timestamp": "1469733493.993", - "body": "xxx" -} -server.addResponse("sessionlog.json", request_header, response_header) - -ts.Disk.records_config.update( - { - 'proxy.config.diags.debug.enabled': 0, - 'proxy.config.diags.debug.tags': 'http|dns', - 'proxy.config.http.insert_forwarded': 'for', - }) - -ts.Disk.remap_config.AddLine('map http://127.0.0.1:{0} http://127.0.0.1:{1}'.format(ts.Variables.port, server.Variables.Port)) - -# Mix in a numeric log field. Hopefull this will detect any binary alignment problems. -# -ts.Disk.logging_yaml.AddLines( - ''' -logging: - formats: - - name: custom - format: "% ___FS___ % ___FS___ % ___FS___ % ___FS___ % ___FS___ % ___FS___ END_TXN" - logs: - - filename: test_all_headers - format: custom -'''.split("\n")) - -# Configure comparison of "sanitized" log file with gold file at end of test. -# -sanitized_log_path = os.path.join(ts.Variables.LOGDIR, 'test_all_headers.log.san') -Test.Disk.File(sanitized_log_path, exists=True, content='gold/test_all_headers_uds.gold') - - -def reallyLong(): - value = 'abcdefghijklmnop' - value = value + value - value = value + value - value = value + value - retval = "" - for i in range(3): - retval += ' -H "x-header{}: {}"'.format(i, value) - return retval - - -tr = Test.AddTestRun() -tr.Processes.Default.StartBefore(server) -tr.Processes.Default.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand( - '"http://127.0.0.1:{0}" --user-agent "007" --haproxy-protocol 1 --haproxy-clientip 127.0.0.1 --verbose '.format( - ts.Variables.port) + reallyLong()) -tr.Processes.Default.ReturnCode = 0 - -# Repeat same curl, will be answered from the ATS cache. -# -tr = Test.AddTestRun() -tr.MakeCurlCommand( - '"http://127.0.0.1:{0}" --user-agent "007" --haproxy-protocol 1 --haproxy-clientip 127.0.0.1 --verbose '.format( - ts.Variables.port) + reallyLong()) -tr.Processes.Default.ReturnCode = 0 - -# Delay to allow TS to flush report to disk, then "sanitize" generated log. -# -tr = Test.AddTestRun() - -log_path = os.path.join(ts.Variables.LOGDIR, 'test_all_headers.log') -sanitizer_python_script = os.path.join(Test.TestDirectory, 'all_headers_sanitizer.py') -sanitizer_shell_script = os.path.join(Test.TestDirectory, 'all_headers_sanitizer.sh') - -tr.Processes.Default.Command = \ - (f'{sys.executable} {sanitizer_python_script} {log_path} {server.Variables.Port} | ' - f'sh {sanitizer_shell_script} > {sanitized_log_path}') -tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/logging/custom-log_uds.test.py b/tests/gold_tests/logging/custom-log-pp-uds.test.py similarity index 67% rename from tests/gold_tests/logging/custom-log_uds.test.py rename to tests/gold_tests/logging/custom-log-pp-uds.test.py index 5554dfaeeb6..6f17af90137 100644 --- a/tests/gold_tests/logging/custom-log_uds.test.py +++ b/tests/gold_tests/logging/custom-log-pp-uds.test.py @@ -23,7 +23,7 @@ ''' # this test depends on Linux specific behavior regarding loopback addresses -Test.SkipUnless(Condition.IsPlatform("linux")) +Test.SkipUnless(Condition.IsPlatform("linux"), Condition.CurlUsingUnixDomainSocket()) # Define default ATS ts = Test.MakeATSProcess("ts", enable_proxy_protocol=True) @@ -50,38 +50,52 @@ # first test is a miss for default tr = Test.AddTestRun() -tr.MakeCurlCommand('"http://127.0.0.1:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.0.0.1'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '"http://127.0.0.1:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.0.0.1'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(Test.Processes.ts) tr = Test.AddTestRun() -tr.MakeCurlCommand('"http://127.1.1.1:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.1.1.1'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '"http://127.1.1.1:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.1.1.1'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() -tr.MakeCurlCommand('"http://127.2.2.2:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.2.2.2'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '"http://127.2.2.2:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.2.2.2'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() -tr.MakeCurlCommand('"http://127.3.3.3:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.3.3.3'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '"http://127.3.3.3:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.3.3.3'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() -tr.MakeCurlCommand('"http://127.3.0.1:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.3.0.1'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '"http://127.3.0.1:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.3.0.1'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() -tr.MakeCurlCommand('"http://127.43.2.1:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.43.2.1'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '"http://127.43.2.1:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.43.2.1'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() tr.MakeCurlCommand( - '"http://127.213.213.132:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.213.213.132'.format(ts.Variables.port)) + '"http://127.213.213.132:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.213.213.132'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() tr.MakeCurlCommand( - '"http://127.123.32.243:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.123.32.243'.format(ts.Variables.port)) + '"http://127.123.32.243:{0}" --verbose --haproxy-protocol 1 --haproxy-clientip 127.123.32.243'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 # Wait for log file to appear, then wait one extra second to make sure TS is done writing it. diff --git a/tests/gold_tests/logging/custom-log.test.py b/tests/gold_tests/logging/custom-log.test.py index e2d7553e2e3..6c9400c886c 100644 --- a/tests/gold_tests/logging/custom-log.test.py +++ b/tests/gold_tests/logging/custom-log.test.py @@ -22,7 +22,7 @@ Test custom log file format ''' -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) # this test depends on Linux specific behavior regarding loopback addresses Test.SkipUnless(Condition.IsPlatform("linux")) diff --git a/tests/gold_tests/logging/log-field-json.test.py b/tests/gold_tests/logging/log-field-json.test.py index db6d217cbed..5bb44c9cf78 100644 --- a/tests/gold_tests/logging/log-field-json.test.py +++ b/tests/gold_tests/logging/log-field-json.test.py @@ -93,22 +93,26 @@ tr.Processes.Default.StartBefore(Test.Processes.ts) tr.MakeCurlCommand( - '--verbose --header "Host: test-1" --header "Foo: ab\td/ef" http://localhost:{0}/test-1'.format(ts.Variables.port)) + '--verbose --header "Host: test-1" --header "Foo: ab\td/ef" http://localhost:{0}/test-1'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() tr.MakeCurlCommand( - '--verbose --header "Host: test-2" --header "Foo: ab\x1fd/ef" http://localhost:{0}/test-2'.format(ts.Variables.port)) + '--verbose --header "Host: test-2" --header "Foo: ab\x1fd/ef" http://localhost:{0}/test-2'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() tr.MakeCurlCommand( - '--verbose --header "Host: test-3" --header "Foo: abc\x7fde" http://localhost:{0}/test-3'.format(ts.Variables.port)) + '--verbose --header "Host: test-3" --header "Foo: abc\x7fde" http://localhost:{0}/test-3'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() tr.MakeCurlCommand( - '--verbose --header "Host: test-2" --header "Foo: ab\x80d/ef" http://localhost:{0}/test-4'.format(ts.Variables.port)) + '--verbose --header "Host: test-2" --header "Foo: ab\x80d/ef" http://localhost:{0}/test-4'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 # Wait for log file to appear, then wait one extra second to make sure TS is done writing it. diff --git a/tests/gold_tests/logging/log-field.test.py b/tests/gold_tests/logging/log-field.test.py index 211c479d3cc..eac595d4e40 100644 --- a/tests/gold_tests/logging/log-field.test.py +++ b/tests/gold_tests/logging/log-field.test.py @@ -91,15 +91,18 @@ # Delay on readiness of our ssl ports tr.Processes.Default.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand('--verbose --header "Host: test-1" http://localhost:{0}/test-1'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '--verbose --header "Host: test-1" http://localhost:{0}/test-1'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() -tr.MakeCurlCommand('--verbose --header "Host: test-2" http://localhost:{0}/test-2'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '--verbose --header "Host: test-2" http://localhost:{0}/test-2'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() -tr.MakeCurlCommand('--verbose --header "Host: test-3" http://localhost:{0}/test-3'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '--verbose --header "Host: test-3" http://localhost:{0}/test-3'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 # Wait for log file to appear, then wait one extra second to make sure TS is done writing it. diff --git a/tests/gold_tests/logging/log-filenames.test.py b/tests/gold_tests/logging/log-filenames.test.py index 03d90cfee0d..1b59f850b71 100644 --- a/tests/gold_tests/logging/log-filenames.test.py +++ b/tests/gold_tests/logging/log-filenames.test.py @@ -23,7 +23,6 @@ Test.Summary = ''' Verify log file naming behavior. ''' -Test.SkipIf(Condition.CurlUds()) class LogFilenamesTest: @@ -121,7 +120,8 @@ def __configure_traffic_TestRun(self, description): tr = Test.AddTestRun(f'Run traffic for: {description}') tr.MakeCurlCommand( f'http://127.0.0.1:{self.ts.Variables.port}/some/path --verbose --next ' - f'http://127.0.0.1:{self.ts.Variables.port}/server/down --verbose') + f'http://127.0.0.1:{self.ts.Variables.port}/server/down --verbose', + uds_path=self.ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(self.ts) diff --git a/tests/gold_tests/logging/log-filenames_uds.test.py b/tests/gold_tests/logging/log-filenames_uds.test.py deleted file mode 100644 index b02bf0b413d..00000000000 --- a/tests/gold_tests/logging/log-filenames_uds.test.py +++ /dev/null @@ -1,268 +0,0 @@ -''' -Verify log file naming behavior. -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os -import ports - -Test.Summary = ''' -Verify log file naming behavior. -''' - - -class LogFilenamesTest: - """ Common test configuration logic across the filename tests. - """ - - # A counter for the ATS process to make each of them unique. - __ts_counter = 1 - - # The default log names for the various system logs. - default_log_data = {'diags': 'diags.log', 'error': 'error.log'} - - def __init__(self, description, log_data=default_log_data): - ''' Handle initialization tasks common across the tests. - - Args: - description (str): The description of the test. This is passed to - the TestRun. - - log_data (dict): The log name information passed to the - MakeATSProcess extension. - ''' - self.__description = description - self.ts = self.__configure_traffic_server(log_data) - self.tr = self.__configure_traffic_TestRun(description) - self.__configure_await_TestRun(self.sentinel_log_path) - - def __configure_traffic_server(self, log_data): - ''' Common ATS configuration logic. - - Args: - log_data (dict): The log name information passed to the - MakeATSProcess extension. - - Return: - The traffic_server process. - ''' - self._ts_name = f"ts{LogFilenamesTest.__ts_counter}" - LogFilenamesTest.__ts_counter += 1 - self.ts = Test.MakeATSProcess( - self._ts_name, use_traffic_out=False, log_data=log_data, uds_path_suffix=f"{LogFilenamesTest.__ts_counter}") - self.ts.Disk.records_config.update( - { - 'proxy.config.diags.debug.enabled': 0, - 'proxy.config.diags.debug.tags': 'log', - 'proxy.config.log.periodic_tasks_interval': 1, - }) - - # Intentionally retrieve a port that is closed, that is no server is - # listening on it. We will use this to attempt talking with a - # non-existent server, which will result in an error log entry. - ports.get_port(self.ts, 'closed_port') - self.ts.Disk.remap_config.AddLines( - [ - f'map /server/down http://127.0.0.1:{self.ts.Variables.closed_port}', - 'map / https://trafficserver.apache.org @action=deny', - ]) - - # The following log is configured so that we can wait upon it being - # written so we know that ATS is done writing logs. - self.sentinel_log_filename = "sentinel" - self.ts.Disk.logging_yaml.AddLine( - f''' - logging: - formats: - - name: url_and_return_code - format: "%: %" - logs: - - filename: {self.sentinel_log_filename} - format: url_and_return_code - ''') - - self.sentinel_log_path = os.path.join(self.ts.Variables.LOGDIR, f"{self.sentinel_log_filename}.log") - - return self.ts - - def __configure_await_TestRun(self, log_path): - ''' Configure a TestRun that awaits upon the provided log_path to - exist. - - Args: - log_path (str): The log file upon which we will wait. - ''' - description = self.__description - tr = Test.AddTestRun(f'Awaiting log files to be written for: {description}') - condwait_path = os.path.join(Test.Variables.AtsTestToolsDir, 'condwait') - tr.Processes.Default.Command = f'{condwait_path} 60 1 -f {log_path}' - tr.Processes.Default.ReturnCode = 0 - - def __configure_traffic_TestRun(self, description): - ''' Configure a TestRun to run the expected transactions. - - Args: - description (str): The description to use for the TestRun. - ''' - tr = Test.AddTestRun(f'Run traffic for: {description}') - tr.MakeCurlCommand( - f'http://127.0.0.1:{self.ts.Variables.port}/some/path --verbose --next ' - f'http://127.0.0.1:{self.ts.Variables.port}/server/down --verbose', - uds_suffix=f"{LogFilenamesTest.__ts_counter}") - tr.Processes.Default.ReturnCode = 0 - tr.Processes.Default.StartBefore(self.ts) - - def configure_named_custom_log(self, custom_log_filename): - """ Configure ATS to log to the custom log file via logging.yaml. - - Args: - custom_log_filename (str): The name of the custom log file to - configure. - - Return: - The path to the configured custom log file. - """ - self.custom_log_filename = custom_log_filename - self.ts.Disk.logging_yaml.AddLine( - f''' - - filename: {custom_log_filename} - format: url_and_return_code - ''') - - if custom_log_filename in ('stdout', 'stderr'): - self.custom_log_path = custom_log_filename - if custom_log_filename == 'stdout': - self.ts.Disk.custom_log = self.ts.Streams.stdout - else: - self.ts.Disk.custom_log = self.ts.Streams.stderr - else: - self.custom_log_path = os.path.join(self.ts.Variables.LOGDIR, f"{custom_log_filename}.log") - self.ts.Disk.File(self.custom_log_path, id="custom_log") - return self.custom_log_path - - def set_log_expectations(self): - ''' Configure sanity checks for each of the log types (diags, error, - etc.) to verify they are emitting the expected content. - ''' - - diags_path = self.ts.Disk.diags_log.AbsPath - self.ts.Disk.diags_log.Content += Testers.ContainsExpression( - "Traffic Server is fully initialized", f"{diags_path} should contain traffic_server diag messages") - - error_log_path = self.ts.Disk.error_log.AbsPath - self.ts.Disk.error_log.Content += Testers.ContainsExpression( - "CONNECT: attempt fail", f"{error_log_path} should contain connection error messages") - - custom_log_path = self.ts.Disk.custom_log.AbsPath - self.ts.Disk.custom_log.Content += Testers.ContainsExpression( - "https://trafficserver.apache.org/some/path: 403", f"{custom_log_path} should contain the custom transaction logs") - - -class DefaultNamedTest(LogFilenamesTest): - ''' Verify that if custom names are not configured, then the default - 'diags.log' and 'error.log' are written to. - ''' - - def __init__(self): - super().__init__('default log filename configuration') - - self.configure_named_custom_log('my_custom_log') - self.set_log_expectations() - - -class CustomNamedTest(LogFilenamesTest): - ''' Verify that the user can assign custom filenames to diags.log, etc. - ''' - - def __init__(self): - log_data = {'diags': 'my_diags.log', 'error': 'my_error.log'} - super().__init__('specify log filename configuration', log_data) - - # Configure custom names for diags.log, etc. - self.ts.Disk.records_config.update( - { - 'proxy.config.diags.logfile.filename': 'my_diags.log', - 'proxy.config.error.logfile.filename': 'my_error.log', - }) - - self.configure_named_custom_log('my_custom_log') - self.set_log_expectations() - - -class stdoutTest(LogFilenamesTest): - ''' Verify that we can configure the logs to go to stdout. - ''' - - def __init__(self): - - log_data = {'diags': 'stdout', 'error': 'stdout'} - super().__init__('specify logs to go to stdout', log_data) - - # Configure custom names for diags.log, etc. - self.ts.Disk.records_config.update( - { - 'proxy.config.diags.logfile.filename': 'stdout', - 'proxy.config.error.logfile.filename': 'stdout', - }) - - self.configure_named_custom_log('stdout') - - # The diags.log file will not be created since we are piping to stdout. - # Therefore, simply wait upon the port being open. - self.ts.Ready = When.PortOpen(self.ts.Variables.port) - self.set_log_expectations() - - -class stderrTest(LogFilenamesTest): - ''' - Verify that we can configure the logs to go to stderr. - ''' - - def __init__(self): - - log_data = {'diags': 'stderr', 'error': 'stderr'} - super().__init__('specify logs to go to stderr', log_data) - - # Configure custom names for diags.log, etc. - self.ts.Disk.records_config.update( - { - 'proxy.config.diags.logfile.filename': 'stderr', - 'proxy.config.error.logfile.filename': 'stderr', - }) - - self.configure_named_custom_log('stderr') - - # The diags.log file will not be created since we are piping to stderr. - # Therefore, simply wait upon the port being open. - self.ts.Ready = When.PortOpen(self.ts.Variables.port) - self.set_log_expectations() - - -# -# Run the tests. -# -DefaultNamedTest() -CustomNamedTest() -stdoutTest() - -# The following stderr test can be run successfully by hand using the replay -# files from the sandbox. All the expected output goes to stderr. However, for -# some reason during the AuTest run, the stderr output stops emitting after the -# logging.yaml file is parsed. This is left here for now because it is valuable -# for use during development, but it is left commented out so that it doesn't -# produce the false failure in CI and developer test runs. -# stderrTest() diff --git a/tests/gold_tests/logging/new_log_flds.test.py b/tests/gold_tests/logging/new_log_flds.test.py index bed4bfccedd..cb6a1c1b8d2 100644 --- a/tests/gold_tests/logging/new_log_flds.test.py +++ b/tests/gold_tests/logging/new_log_flds.test.py @@ -23,7 +23,6 @@ Test new log fields ''' -Test.SkipIf(Condition.CurlUds()) Test.SkipUnless(Condition.HasCurlFeature('http2')) # ---- @@ -71,28 +70,30 @@ tr.Processes.Default.StartBefore(Test.Processes.ts) tr.Processes.Default.StartBefore(httpbin, ready=When.PortOpen(httpbin.Variables.Port)) # -tr.MakeCurlCommand('"http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port)) +tr.MakeCurlCommand('"http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() -tr.MakeCurlCommand('"http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 - -tr = Test.AddTestRun() -tr.MakeCurlCommand('"http://127.0.0.1:{0}" "http://127.0.0.1:{0}" --http1.1 --verbose'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 - -tr = Test.AddTestRun() -tr.MakeCurlCommand('"https://127.0.0.1:{0}" "https://127.0.0.1:{0}" --http2 --insecure --verbose'.format(ts.Variables.ssl_port)) +tr.MakeCurlCommand('"http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() tr.MakeCurlCommand( - ( - '"https://reallyreallyreallyreallylong.com:{0}" --http2 --insecure --verbose' + - ' --resolve reallyreallyreallyreallylong.com:{0}:127.0.0.1').format(ts.Variables.ssl_port)) + '"http://127.0.0.1:{0}" "http://127.0.0.1:{0}" --http1.1 --verbose'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 +if not Condition.CurlUsingUnixDomainSocket(): + tr = Test.AddTestRun() + tr.MakeCurlCommand('"https://127.0.0.1:{0}" "https://127.0.0.1:{0}" --http2 --insecure --verbose'.format(ts.Variables.ssl_port)) + tr.Processes.Default.ReturnCode = 0 + + tr = Test.AddTestRun() + tr.MakeCurlCommand( + ( + '"https://reallyreallyreallyreallylong.com:{0}" --http2 --insecure --verbose' + + ' --resolve reallyreallyreallyreallylong.com:{0}:127.0.0.1').format(ts.Variables.ssl_port)) + tr.Processes.Default.ReturnCode = 0 + # Wait for log file to appear, then wait one extra second to make sure TS is done writing it. # test_run = Test.AddTestRun() diff --git a/tests/gold_tests/logging/new_log_flds_observer.py b/tests/gold_tests/logging/new_log_flds_observer.py index 59bd4dc1953..77a9cbd3ff9 100644 --- a/tests/gold_tests/logging/new_log_flds_observer.py +++ b/tests/gold_tests/logging/new_log_flds_observer.py @@ -47,8 +47,8 @@ # Validate contents of report. # -if (ccid[0] != ccid[1] and ccid[1] != ccid[2] and ccid[2] == ccid[3] and ctid[2] != ctid[3] and ccid[3] != ccid[4] and - ccid[4] == ccid[5] and ctid[4] != ctid[5] and ccid[5] != ccid[6]): +if (ccid[0] != ccid[1] and ccid[1] != ccid[2] and ccid[2] == ccid[3] and ctid[2] != ctid[3] and + (len(ccid) < 5 or (ccid[3] != ccid[4] and ccid[4] == ccid[5] and ctid[4] != ctid[5] and ccid[5] != ccid[6]))): exit(code=0) # Failure exit if report was not valid. diff --git a/tests/gold_tests/logging/new_log_flds_uds.test.py b/tests/gold_tests/logging/new_log_flds_uds.test.py deleted file mode 100644 index 01e271a7ee3..00000000000 --- a/tests/gold_tests/logging/new_log_flds_uds.test.py +++ /dev/null @@ -1,105 +0,0 @@ -''' -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os -import sys - -Test.Summary = ''' -Test new log fields -''' - -Test.SkipUnless(Condition.HasCurlFeature('http2')) - -# ---- -# Setup httpbin Origin Server -# ---- -httpbin = Test.MakeHttpBinServer("httpbin") - -# ---- -# Setup ATS -# ---- -ts = Test.MakeATSProcess("ts", enable_tls=True) - -ts.addDefaultSSLFiles() - -ts.Disk.records_config.update( - { - # 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), - 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), - }) - -ts.Disk.remap_config.AddLine('map http://127.0.0.1:{0} http://127.0.0.1:{1}/ip'.format(ts.Variables.port, httpbin.Variables.Port)) - -ts.Disk.remap_config.AddLine( - 'map https://127.0.0.1:{0} http://127.0.0.1:{1}/ip'.format(ts.Variables.ssl_port, httpbin.Variables.Port)) - -ts.Disk.remap_config.AddLine( - 'map https://reallyreallyreallyreallylong.com http://127.0.0.1:{1}/ip'.format(ts.Variables.ssl_port, httpbin.Variables.Port)) - -ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') - -ts.Disk.logging_yaml.AddLines( - ''' -logging: - formats: - - name: custom - format: "% % %" - logs: - - filename: test_new_log_flds - format: custom -'''.split("\n")) - -tr = Test.AddTestRun() -# Delay on readiness of ssl port -tr.Processes.Default.StartBefore(Test.Processes.ts) -tr.Processes.Default.StartBefore(httpbin, ready=When.PortOpen(httpbin.Variables.Port)) -# -tr.MakeCurlCommand('"http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 - -tr = Test.AddTestRun() -tr.MakeCurlCommand('"http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 - -tr = Test.AddTestRun() -tr.MakeCurlCommand('"http://127.0.0.1:{0}" "http://127.0.0.1:{0}" --http1.1 --verbose'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 - -tr = Test.AddTestRun() -tr.MakeCurlCommand( - ( - '"https://reallyreallyreallyreallylong.com:{0}" --http2 --insecure --verbose' + - ' --resolve reallyreallyreallyreallylong.com:{0}:127.0.0.1').format(ts.Variables.ssl_port)) -tr.Processes.Default.ReturnCode = 0 - -# Wait for log file to appear, then wait one extra second to make sure TS is done writing it. -# -test_run = Test.AddTestRun() -test_run.Processes.Default.Command = ( - os.path.join(Test.Variables.AtsTestToolsDir, 'condwait') + ' 60 1 -f ' + - os.path.join(ts.Variables.LOGDIR, 'test_new_log_flds.log')) -test_run.Processes.Default.ReturnCode = 0 - -# Validate generated log. -# -tr = Test.AddTestRun() -observer_script = os.path.join(Test.TestDirectory, 'new_log_flds_observer.py') -log_path = os.path.join(ts.Variables.LOGDIR, 'test_new_log_flds.log') -tr.Processes.Default.Command = f'{sys.executable} {observer_script} < {log_path}' -tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/logging/pqsi-pqsp.test.py b/tests/gold_tests/logging/pqsi-pqsp.test.py index 2a4896e2fff..29e301184c8 100644 --- a/tests/gold_tests/logging/pqsi-pqsp.test.py +++ b/tests/gold_tests/logging/pqsi-pqsp.test.py @@ -68,12 +68,12 @@ tr.Processes.Default.StartBefore(nameserver) # Delay on readiness of our ssl ports tr.Processes.Default.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(f'--verbose http://localhost:{ts.Variables.port}/test') +tr.MakeCurlCommand(f'--verbose http://localhost:{ts.Variables.port}/test', uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 # Response for this duplicate request should come from cache. tr = Test.AddTestRun() -tr.MakeCurlCommand(f'--verbose http://localhost:{ts.Variables.port}/test') +tr.MakeCurlCommand(f'--verbose http://localhost:{ts.Variables.port}/test', uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 log_filespec = os.path.join(ts.Variables.LOGDIR, 'field-test.log') diff --git a/tests/gold_tests/next_hop/parent_config/parent_config_dest_ip.test.py b/tests/gold_tests/next_hop/parent_config/parent_config_dest_ip.test.py index d5c4d8f9bdb..02240393a0a 100644 --- a/tests/gold_tests/next_hop/parent_config/parent_config_dest_ip.test.py +++ b/tests/gold_tests/next_hop/parent_config/parent_config_dest_ip.test.py @@ -20,7 +20,7 @@ Test.Summary = ''' Verify ATS parent_config with dest_ip=... ''' -Test.SkipIf(Condition.CurlUds()) + # Create origin origin = Test.MakeOriginServer("origin") @@ -119,7 +119,7 @@ # Request asset that goes through the layers tr = Test.AddTestRun("request") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://foo.bar/foo.txt') +tr.MakeCurlCommand(curl_and_args + ' http://foo.bar/foo.txt', uds_path=ts0.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("Via:.* ts1 .* ts0 ", "expected via header") tr.StillRunningAfter = ts0 diff --git a/tests/gold_tests/next_hop/parent_config/parent_config_dest_ip_uds.test.py b/tests/gold_tests/next_hop/parent_config/parent_config_dest_ip_uds.test.py deleted file mode 100644 index 07c2d9ee6bc..00000000000 --- a/tests/gold_tests/next_hop/parent_config/parent_config_dest_ip_uds.test.py +++ /dev/null @@ -1,125 +0,0 @@ -''' -Verify ATS parent.config dest_ip dns bug fix. -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -Test.Summary = ''' -Verify ATS parent_config with dest_ip=... -''' - -# Create origin -origin = Test.MakeOriginServer("origin") - -# default root -request_header_chk = { - "headers": "GET / HTTP/1.1\r\n" + "Host: ats\r\n" + "\r\n", - "timestamp": "1469733493.993", - "body": "", -} - -response_header_chk = { - "headers": "HTTP/1.1 200 OK\r\n" + "Connection: close\r\n" + "\r\n", - "timestamp": "1469733493.993", - "body": "", -} - -origin.addResponse("sessionlog.json", request_header_chk, response_header_chk) - -request_header = { - "headers": - f"GET /foo.txt HTTP/1.1\r\n" - "Host: does.not.matter\r\n" # But cant be omitted - "\r\n", - "timestamp": "1469733493.993", - "body": "" -} - -response_header = { - "headers": "HTTP/1.1 200 OK\r\n" - "Connection: close\r\n" - "Cache-control: max-age=60\r\n" - "\r\n", - "timestamp": "1469733493.993", - "body": f"This is the body for foo.txt\n" -} -origin.addResponse("sessionlog.json", request_header, response_header) - -# Configure DNS for cache layering -dns = Test.MakeDNServer("dns") -dns.addRecords(records={f"origin": ["127.0.0.1"]}) -dns.addRecords(records={f"ts1": ["127.0.0.1"]}) -dns.addRecords(records={f"ts0": ["127.0.0.1"]}) -dns.addRecords(records={f"foo.bar": ["142.250.72.14"]}) # google.com - -# Configure Traffic Server Mid -ts1 = Test.MakeATSProcess("ts1", enable_uds=False) -ts1.Disk.remap_config.AddLine(f"map / http://origin:{origin.Variables.Port}") - -ts1.Disk.records_config.update( - { - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.diags.debug.tags': 'http|dns|hostdb|parent', - 'proxy.config.dns.nameservers': f"127.0.0.1:{dns.Variables.Port}", - 'proxy.config.dns.resolv_conf': "NULL", - 'proxy.config.hostdb.lookup_timeout': 2, - 'proxy.config.http.connect_attempts_timeout': 1, - 'proxy.config.http.parent_proxy.self_detect': 0, - 'proxy.config.http.insert_response_via_str': 1, - 'proxy.config.proxy_name': 'ts1', - }) - -# Configure Traffic Server Edge -ts0 = Test.MakeATSProcess("ts0") -ts0.Disk.remap_config.AddLine("map http://foo.bar http://foo.bar") - -ts0.Disk.records_config.update( - { - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.diags.debug.tags': 'http|dns|hostdb|parent', - 'proxy.config.dns.nameservers': f"127.0.0.1:{dns.Variables.Port}", - 'proxy.config.dns.resolv_conf': "NULL", - 'proxy.config.hostdb.lookup_timeout': 2, - 'proxy.config.http.connect_attempts_timeout': 1, - 'proxy.config.http.parent_proxy.self_detect': 0, - 'proxy.config.http.insert_response_via_str': 1, - 'proxy.config.proxy_name': 'ts0', - }) - -ts0.Disk.parent_config.AddLines( - [ - f"dest_ip=93.184.216.34 port=80 go_direct=true", # example.com - f'dest_host=foo.bar port=80 parent="ts1:{ts1.Variables.port}|1;" go_direct="false" parent_is_proxy="true"', - ]) - -# Start everything up -tr = Test.AddTestRun("init") -tr.Processes.Default.StartBefore(origin) -tr.Processes.Default.StartBefore(dns) -tr.Processes.Default.StartBefore(ts0) -tr.Processes.Default.StartBefore(ts1) -tr.Processes.Default.Command = 'echo start TS, TSH_N, HTTP origin and DNS.' -tr.Processes.Default.ReturnCode = 0 - -curl_and_args = f"-s -D /dev/stdout -o /dev/stderr -x http://127.0.0.1:{ts0.Variables.port}" - -# Request asset that goes through the layers -tr = Test.AddTestRun("request") -ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://foo.bar/foo.txt') -ps.ReturnCode = 0 -ps.Streams.stdout.Content = Testers.ContainsExpression("Via:.* ts1 .* ts0 ", "expected via header") -tr.StillRunningAfter = ts0 diff --git a/tests/gold_tests/next_hop/strategies_ch/strategies_ch.test.py b/tests/gold_tests/next_hop/strategies_ch/strategies_ch.test.py index 509ec6392de..285bd292fd5 100644 --- a/tests/gold_tests/next_hop/strategies_ch/strategies_ch.test.py +++ b/tests/gold_tests/next_hop/strategies_ch/strategies_ch.test.py @@ -128,7 +128,7 @@ for i in range(num_objects): tr = Test.AddTestRun() - tr.MakeCurlCommand(f'--verbose --proxy 127.0.0.1:{ts.Variables.port} http://dummy.com/obj{i}') + tr.MakeCurlCommand(f'--verbose --proxy 127.0.0.1:{ts.Variables.port} http://dummy.com/obj{i}', uds_path=ts.Variables.uds_path) tr.Processes.Default.Streams.stdout = "body.gold" tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/next_hop/strategies_ch2/strategies_ch2.test.py b/tests/gold_tests/next_hop/strategies_ch2/strategies_ch2.test.py index 811b406c013..a7e28f131dc 100644 --- a/tests/gold_tests/next_hop/strategies_ch2/strategies_ch2.test.py +++ b/tests/gold_tests/next_hop/strategies_ch2/strategies_ch2.test.py @@ -132,7 +132,7 @@ for i in range(num_objects): tr = Test.AddTestRun() - tr.MakeCurlCommand(f'--verbose --proxy 127.0.0.1:{ts.Variables.port} http://dummy.com/obj{i}') + tr.MakeCurlCommand(f'--verbose --proxy 127.0.0.1:{ts.Variables.port} http://dummy.com/obj{i}', uds_path=ts.Variables.uds_path) tr.Processes.Default.Streams.stdout = "body.gold" tr.Processes.Default.ReturnCode = 0 @@ -144,7 +144,7 @@ for i in range(num_objects): tr = Test.AddTestRun() - tr.MakeCurlCommand(f'--verbose --proxy 127.0.0.1:{ts.Variables.port} http://dummy.com/obj{i}') + tr.MakeCurlCommand(f'--verbose --proxy 127.0.0.1:{ts.Variables.port} http://dummy.com/obj{i}', uds_path=ts.Variables.uds_path) tr.Processes.Default.Streams.stdout = "body.gold" tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/next_hop/strategies_stale/strategies_stale.test.py b/tests/gold_tests/next_hop/strategies_stale/strategies_stale.test.py index 342c6f79e34..fee5ba17245 100644 --- a/tests/gold_tests/next_hop/strategies_stale/strategies_stale.test.py +++ b/tests/gold_tests/next_hop/strategies_stale/strategies_stale.test.py @@ -120,7 +120,7 @@ tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() -tr.MakeCurlCommand(f'--verbose --proxy 127.0.0.1:{ts.Variables.port} http://dummy.com/obj0') +tr.MakeCurlCommand(f'--verbose --proxy 127.0.0.1:{ts.Variables.port} http://dummy.com/obj0', uds_path=ts.Variables.uds_path) tr.Processes.Default.Streams.stdout = "body.gold" tr.Processes.Default.ReturnCode = 0 @@ -131,7 +131,7 @@ # Request should come back as 200 tr = Test.AddTestRun() -tr.MakeCurlCommand(f'--verbose --proxy 127.0.0.1:{ts.Variables.port} http://dummy.com/obj0') +tr.MakeCurlCommand(f'--verbose --proxy 127.0.0.1:{ts.Variables.port} http://dummy.com/obj0', uds_path=ts.Variables.uds_path) tr.Processes.Default.Streams.stdout = "body.gold" tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/next_hop/zzz_strategies_peer/zzz_strategies_peer.test.py b/tests/gold_tests/next_hop/zzz_strategies_peer/zzz_strategies_peer.test.py index a7658c6696a..59d97275f14 100644 --- a/tests/gold_tests/next_hop/zzz_strategies_peer/zzz_strategies_peer.test.py +++ b/tests/gold_tests/next_hop/zzz_strategies_peer/zzz_strategies_peer.test.py @@ -155,14 +155,18 @@ for i in range(num_object): tr = Test.AddTestRun() - tr.MakeCurlCommand(f'--verbose --proxy 127.0.0.1:{ts_peer[i % num_peer].Variables.port} http://dummy.com/obj{i}') + tr.MakeCurlCommand( + f'--verbose --proxy 127.0.0.1:{ts_peer[i % num_peer].Variables.port} http://dummy.com/obj{i}', + uds_path=ts_peer[i % num_peer].Variables.uds_path) tr.Processes.Default.Streams.stdout = "body.gold" tr.Processes.Default.ReturnCode = 0 for i in range(num_object): tr = Test.AddTestRun() # num_peer must not be a multiple of 3 - tr.MakeCurlCommand(f'--verbose --proxy 127.0.0.1:{ts_peer[(i * 3) % num_peer].Variables.port} http://dummy.com/obj{i}') + tr.MakeCurlCommand( + f'--verbose --proxy 127.0.0.1:{ts_peer[(i * 3) % num_peer].Variables.port} http://dummy.com/obj{i}', + uds_path=ts_peer[(i * 3) % num_peer].Variables.uds_path) tr.Processes.Default.Streams.stdout = "body.gold" tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/next_hop/zzz_strategies_peer2/zzz_strategies_peer2.test.py b/tests/gold_tests/next_hop/zzz_strategies_peer2/zzz_strategies_peer2.test.py index 370ae3223a1..d6eec637323 100644 --- a/tests/gold_tests/next_hop/zzz_strategies_peer2/zzz_strategies_peer2.test.py +++ b/tests/gold_tests/next_hop/zzz_strategies_peer2/zzz_strategies_peer2.test.py @@ -143,8 +143,8 @@ for i in range(num_object): tr = Test.AddTestRun() tr.MakeCurlCommand( - f'--verbose --proxy 127.0.0.1:{ts_peer[i % num_peer].Variables.port} http://ts_upstream0:{ts_upstream[0].Variables.port}/obj{i}' - ) + f'--verbose --proxy 127.0.0.1:{ts_peer[i % num_peer].Variables.port} http://ts_upstream0:{ts_upstream[0].Variables.port}/obj{i}', + uds_path=ts_peer[i % num_peer].Variables.uds_path) tr.Processes.Default.Streams.stdout = "body.gold" tr.Processes.Default.ReturnCode = 0 @@ -152,8 +152,8 @@ tr = Test.AddTestRun() # num_peer must not be a multiple of 3 tr.MakeCurlCommand( - f'--verbose --proxy 127.0.0.1:{ts_peer[(i * 3) % num_peer].Variables.port} http://ts_upstream0:{ts_upstream[0].Variables.port}/obj{i}' - ) + f'--verbose --proxy 127.0.0.1:{ts_peer[(i * 3) % num_peer].Variables.port} http://ts_upstream0:{ts_upstream[0].Variables.port}/obj{i}', + uds_path=ts_peer[(i * 3) % num_peer].Variables.uds_path) tr.Processes.Default.Streams.stdout = "body.gold" tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/null_transform/null_transform.test.py b/tests/gold_tests/null_transform/null_transform.test.py index 476643afde2..c99257ab22f 100644 --- a/tests/gold_tests/null_transform/null_transform.test.py +++ b/tests/gold_tests/null_transform/null_transform.test.py @@ -53,7 +53,8 @@ # www.example.com Host tr = Test.AddTestRun() tr.MakeCurlCommand( - '--proxy 127.0.0.1:{0} "http://www.example.com" --verbose -H "Proxy-Connection: keep-alive"'.format(ts.Variables.port)) + '--proxy 127.0.0.1:{0} "http://www.example.com" --verbose -H "Proxy-Connection: keep-alive"'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(Test.Processes.ts) diff --git a/tests/gold_tests/origin_connection/per_server_connection_max.test.py b/tests/gold_tests/origin_connection/per_server_connection_max.test.py index 22a61e13f5d..818a218e17d 100644 --- a/tests/gold_tests/origin_connection/per_server_connection_max.test.py +++ b/tests/gold_tests/origin_connection/per_server_connection_max.test.py @@ -90,14 +90,13 @@ def _configure_origin_server(self) -> None: def _configure_trafficserver(self) -> None: self._ts = Test.MakeATSProcess("ts2") - uds_path = os.path.join(Test.RunDirectory, 'uds.socket') self._ts.Disk.records_config.update( { 'proxy.config.dns.nameservers': f"127.0.0.1:{self._dns.Variables.Port}", 'proxy.config.dns.resolv_conf': 'NULL', 'proxy.config.diags.debug.enabled': 1, 'proxy.config.diags.debug.tags': 'http|dns|hostdb', - 'proxy.config.http.server_ports': f"{self._ts.Variables.port} {uds_path}", + 'proxy.config.http.server_ports': f"{self._ts.Variables.port} {self._ts.Variables.uds_path}", 'proxy.config.http.connect_ports': f"{self._server.Variables.Port}", 'proxy.config.http.per_server.connection.max': self._origin_max_connections, }) @@ -110,7 +109,10 @@ def _configure_client_with_slow_response(self, tr) -> 'Test.Process': """Configure a client to perform a CONNECT request with a slow response from the server.""" p = tr.Processes.Process(f'slow_client_{self._client_counter}') self._client_counter += 1 - tr.MakeCurlCommand(f"-v --fail -s -p -x 127.0.0.1:{self._ts.Variables.port} 'http://foo.com/delay/2'", p=p) + tr.MakeCurlCommand( + f"-v --fail -s -p -x 127.0.0.1:{self._ts.Variables.port} 'http://foo.com/delay/2'", + p=p, + uds_path=self._ts.Variables.uds_path) return p def run(self) -> None: @@ -133,7 +135,8 @@ def run(self) -> None: # response. tr.MakeCurlCommandMulti( f"sleep 1; {{curl}} -v --fail -s -p -x 127.0.0.1:{self._ts.Variables.port} 'http://foo.com/get'" - f"--next -v --fail -s -p -x 127.0.0.1:{self._ts.Variables.port} 'http://foo.com/get'") + f"--next -v --fail -s -p -x 127.0.0.1:{self._ts.Variables.port} 'http://foo.com/get'", + uds_path=self._ts.Variables.uds_path) # Curl will have a 22 exit code if it receives a 5XX response (and we # expect a 503). tr.Processes.Default.ReturnCode = 22 diff --git a/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.test.py b/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.test.py index 22c5c0f3c24..d235c6147a2 100644 --- a/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.test.py +++ b/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.test.py @@ -19,7 +19,6 @@ Test.Summary = ''' Test TSVConnFdCreate() TS API call. ''' -Test.SkipIf(Condition.CurlUds()) plugin_name = "TSVConnFd" @@ -52,6 +51,9 @@ ts.Disk.remap_config.AddLine("map http://myhost.test http://127.0.0.1:{0}".format(server.Variables.Port)) +ipv4flag = "" +if not Condition.CurlUsingUnixDomainSocket(): + ipv4flag = "--ipv4" # Dummy transaction to trigger plugin. # tr = Test.AddTestRun() @@ -59,7 +61,8 @@ tr.Processes.Default.StartBefore(ts) tr.MakeCurlCommandMulti( f'touch {InProgressFilePathspec} ; ' + - f'{{curl}} --verbose --ipv4 --header "Host:myhost.test" http://localhost:{ts.Variables.port}/') + f'{{curl}} --verbose {ipv4flag} --header "Host:myhost.test" http://localhost:{ts.Variables.port}/', + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 # Give tests up to 10 seconds to complete. diff --git a/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd_uds.test.py b/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd_uds.test.py deleted file mode 100644 index 3ccd98b11b7..00000000000 --- a/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd_uds.test.py +++ /dev/null @@ -1,67 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -Test.Summary = ''' -Test TSVConnFdCreate() TS API call. -''' - -plugin_name = "TSVConnFd" - -server = Test.MakeOriginServer("server") - -request_header = {"headers": "GET / HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": "112233"} -server.addResponse("sessionlog.json", request_header, response_header) - -# File to be deleted when tests are fully completed. -# -InProgressFilePathspec = os.path.join(Test.RunDirectory, "in_progress") - -ts = Test.MakeATSProcess("ts", block_for_debug=False) - -ts.Disk.records_config.update( - { - 'proxy.config.proxy_name': 'Poxy_Proxy', # This will be the server name. - 'proxy.config.url_remap.remap_required': 1, - 'proxy.config.diags.debug.enabled': 3, - 'proxy.config.diags.debug.tags': f'{plugin_name}', - }) - -rp = os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'pluginTest', 'TSVConnFd', '.libs', f'{plugin_name}.so') -ts.Setup.Copy(rp, ts.Env['PROXY_CONFIG_PLUGIN_PLUGIN_DIR']) - -Test.GetTcpPort("tcp_port") - -ts.Disk.plugin_config.AddLine(f"{plugin_name}.so {InProgressFilePathspec} {ts.Variables.tcp_port}") - -ts.Disk.remap_config.AddLine("map http://myhost.test http://127.0.0.1:{0}".format(server.Variables.Port)) - -# Dummy transaction to trigger plugin. -# -tr = Test.AddTestRun() -tr.Processes.Default.StartBefore(server) -tr.Processes.Default.StartBefore(ts) -tr.MakeCurlCommandMulti( - f'touch {InProgressFilePathspec} ; ' + f'{{curl}} --verbose --header "Host:myhost.test" http://localhost:{ts.Variables.port}/') -tr.Processes.Default.ReturnCode = 0 - -# Give tests up to 10 seconds to complete. -# -tr = Test.AddTestRun() -tr.Processes.Default.Command = (os.path.join(Test.Variables.AtsTestToolsDir, 'condwait') + ' 15 1 -f ' + InProgressFilePathspec) -tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests.test.py b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests.test.py index 72089907ee3..19e85feaf4e 100644 --- a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests.test.py +++ b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests.test.py @@ -192,7 +192,7 @@ ps = tr.Processes.Default ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -H "uuid: full"') +tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -H "uuid: full"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/full.stderr.gold" tr.StillRunningAfter = ts @@ -201,7 +201,8 @@ # 1 Test - Fetch range into cache tr = Test.AddTestRun("inner range cache miss") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -r {} -H "uuid: inner"'.format(inner_str)) +tr.MakeCurlCommand( + curl_and_args + ' http://www.example.com/path -r {} -H "uuid: inner"'.format(inner_str), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/inner.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss") @@ -212,7 +213,7 @@ # 2 Test - Fetch from cache tr = Test.AddTestRun("inner range cache hit") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -r {}'.format(inner_str)) +tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -r {}'.format(inner_str), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/inner.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit", "expected cache hit") @@ -225,7 +226,8 @@ # 3 Test - 0- request tr = Test.AddTestRun("0- request miss") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -r {} -H "uuid: frange"'.format(frange_str)) +tr.MakeCurlCommand( + curl_and_args + ' http://www.example.com/path -r {} -H "uuid: frange"'.format(frange_str), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/full.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss") @@ -236,7 +238,7 @@ # 4 Test - 0- request tr = Test.AddTestRun("0- request hit") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -r {}'.format(frange_str)) +tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -r {}'.format(frange_str), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/full.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit", "expected cache hit") @@ -249,7 +251,8 @@ # 5 Test - -5 request miss tr = Test.AddTestRun("-5 request miss") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -r {} -H "uuid: last"'.format(last_str)) +tr.MakeCurlCommand( + curl_and_args + ' http://www.example.com/path -r {} -H "uuid: last"'.format(last_str), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/last.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss") @@ -260,7 +263,7 @@ # 6 Test - -5 request hit tr = Test.AddTestRun("-5 request hit") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -r {}'.format(last_str)) +tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -r {}'.format(last_str), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/last.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit", "expected cache hit") @@ -273,7 +276,7 @@ # 7 Test - 404 tr = Test.AddTestRun("404 request 1st") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/404 -r 0-') +tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/404 -r 0-', uds_path=ts.Variables.uds_path) ps.Streams.stdout = "gold/404.stdout.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss") tr.StillRunningAfter = ts @@ -281,7 +284,7 @@ # 8 Test - 404 tr = Test.AddTestRun("404 request 2nd") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/404 -r 0-') +tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/404 -r 0-', uds_path=ts.Variables.uds_path) ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss") ps.Streams.stdout.Content += Testers.ContainsExpression("404 Not Found", "expected 404 response") tr.StillRunningAfter = ts @@ -289,7 +292,7 @@ # 9 Test - origin returns 200 response to range request tr = Test.AddTestRun("origin returns 200") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -r {} -H "uuid: full"') +tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -r {} -H "uuid: full"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 3 # <--- note the return code ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss") ps.Streams.stdout.Content += Testers.ContainsExpression("200 OK", "expected full 200 response") @@ -301,7 +304,8 @@ # 10 Test - cache_key_url request tr = Test.AddTestRun("cache_key_url request") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://parentselect/path -r {} -H "uuid: pselect"'.format(pselect_str)) +tr.MakeCurlCommand( + curl_and_args + ' http://parentselect/path -r {} -H "uuid: pselect"'.format(pselect_str), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression( "X-ParentSelection-Key: .*-bytes=", @@ -313,7 +317,8 @@ # 11 Test - non cache_key_url request ... no X-ParentSelection-Key tr = Test.AddTestRun("non cache_key_url request") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -r {} -H "uuid: inner"'.format(inner_str)) +tr.MakeCurlCommand( + curl_and_args + ' http://www.example.com/path -r {} -H "uuid: inner"'.format(inner_str), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ExcludesExpression("X-ParentSelection-Key", "parent select key shouldn't show up") tr.StillRunningAfter = ts @@ -322,7 +327,7 @@ # 12 Test - cache_key_url request -- deprecated tr = Test.AddTestRun("cache_key_url request - deprecated") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://psd/path -r {} -H "uuid: pselect"'.format(pselect_str)) +tr.MakeCurlCommand(curl_and_args + ' http://psd/path -r {} -H "uuid: pselect"'.format(pselect_str), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression( "X-ParentSelection-Key: .*-bytes=", diff --git a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cache_complete_responses.test.py b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cache_complete_responses.test.py index c4b6cbf3b99..df5f1e11b56 100644 --- a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cache_complete_responses.test.py +++ b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cache_complete_responses.test.py @@ -207,7 +207,7 @@ ps = tr.Processes.Default ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(curl_and_args + ' -H "UID: SMALL" http://example.com/obj -r 0-5000') +tr.MakeCurlCommand(curl_and_args + ' -H "UID: SMALL" http://example.com/obj -r 0-5000', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK") ps.Streams.stdout.Content = Testers.ExcludesExpression("Content-Range:", "expected no Content-Range header") @@ -219,7 +219,7 @@ # 1 Test - Fetch /obj with a different range but less than 4MB tr = Test.AddTestRun("cache hit-fresh on /obj") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' -H "UID: SMALL" http://example.com/obj -r 5001-5999') +tr.MakeCurlCommand(curl_and_args + ' -H "UID: SMALL" http://example.com/obj -r 5001-5999', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK") ps.Streams.stdout.Content = Testers.ExcludesExpression("Content-Range:", "expected no Content-Range header") @@ -232,7 +232,7 @@ tr = Test.AddTestRun("cache hit-stale on /obj") tr.DelayStart = 2 ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' -H "UID: SMALL-INM" http://example.com/obj -r 0-403') +tr.MakeCurlCommand(curl_and_args + ' -H "UID: SMALL-INM" http://example.com/obj -r 0-403', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK") ps.Streams.stdout.Content = Testers.ExcludesExpression("Content-Range:", "expected no Content-Range header") @@ -244,7 +244,7 @@ # 3 Test - Fetch /obj with a different range but less than 4MB tr = Test.AddTestRun("cache hit on /obj post revalidation") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' -H "UID: SMALL" http://example.com/obj -r 0-3999') +tr.MakeCurlCommand(curl_and_args + ' -H "UID: SMALL" http://example.com/obj -r 0-3999', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK") ps.Streams.stdout.Content = Testers.ExcludesExpression("Content-Range:", "expected no Content-Range header") @@ -259,7 +259,7 @@ # 4 Test - Fetch /slice with a Range header but less than 4MB tr = Test.AddTestRun("cache miss on /slice") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' -H "UID: SLICE" http://example.com/slice -r 0-5000') +tr.MakeCurlCommand(curl_and_args + ' -H "UID: SLICE" http://example.com/slice -r 0-5000', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("206 Partial Content", "expected 206 Partial Content") ps.Streams.stdout.Content = Testers.ContainsExpression( @@ -272,7 +272,7 @@ # 5 Test - Fetch /slice with a different range but less than 4MB tr = Test.AddTestRun("cache hit-fresh on /slice") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' -H "UID: SLICE" http://example.com/slice -r 5001-5999') +tr.MakeCurlCommand(curl_and_args + ' -H "UID: SLICE" http://example.com/slice -r 5001-5999', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("206 Partial Content", "expected 206 Partial Content") ps.Streams.stdout.Content = Testers.ContainsExpression( @@ -286,7 +286,7 @@ tr = Test.AddTestRun("cache hit-stale on /slice") tr.DelayStart = 2 ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' -H "UID: SLICE-INM" http://example.com/slice -r 0-403') +tr.MakeCurlCommand(curl_and_args + ' -H "UID: SLICE-INM" http://example.com/slice -r 0-403', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("206 Partial Content", "expected 206 Partial Content") ps.Streams.stdout.Content = Testers.ContainsExpression( @@ -299,7 +299,7 @@ # 7 Test - Fetch /slice with a different range but less than 4MB tr = Test.AddTestRun("cache hit on /slice post revalidation") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' -H "UID: SLICE" http://example.com/slice -r 0-3999') +tr.MakeCurlCommand(curl_and_args + ' -H "UID: SLICE" http://example.com/slice -r 0-3999', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("206 Partial Content", "expected 206 Partial Content") ps.Streams.stdout.Content = Testers.ContainsExpression( @@ -317,7 +317,7 @@ # 8 Test - Fetch /naieve/obj with a Range header tr = Test.AddTestRun("cache miss on /naieve/obj") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' -H "UID: NAIEVE" http://example.com/naieve/obj -r 0-5000') +tr.MakeCurlCommand(curl_and_args + ' -H "UID: NAIEVE" http://example.com/naieve/obj -r 0-5000', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK") ps.Streams.stdout.Content = Testers.ExcludesExpression("Content-Range:", "expected no Content-Range header") @@ -329,7 +329,7 @@ # 9 Test - Fetch /naieve/obj with the same Range header tr = Test.AddTestRun("cache hit-fresh on /naieve/obj") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' -H "UID: NAIEVE" http://example.com/naieve/obj -r 0-5000') +tr.MakeCurlCommand(curl_and_args + ' -H "UID: NAIEVE" http://example.com/naieve/obj -r 0-5000', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK") ps.Streams.stdout.Content = Testers.ExcludesExpression("Content-Range:", "expected no Content-Range header") @@ -342,7 +342,7 @@ tr = Test.AddTestRun("cache hit-stale on /naieve/obj") tr.DelayStart = 2 ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' -H "UID: NAIEVE-INM" http://example.com/naieve/obj -r 0-5000') +tr.MakeCurlCommand(curl_and_args + ' -H "UID: NAIEVE-INM" http://example.com/naieve/obj -r 0-5000', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK") ps.Streams.stdout.Content = Testers.ExcludesExpression("Content-Range:", "expected no Content-Range header") @@ -354,7 +354,7 @@ # 11 Test - Fetch /naieve/obj with the same Range header tr = Test.AddTestRun("cache hit on /naieve/obj post revalidation") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' -H "UID: NAIEVE" http://example.com/naieve/obj -r 0-5000') +tr.MakeCurlCommand(curl_and_args + ' -H "UID: NAIEVE" http://example.com/naieve/obj -r 0-5000', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK") ps.Streams.stdout.Content = Testers.ExcludesExpression("Content-Range:", "expected no Content-Range header") @@ -366,7 +366,7 @@ # 12 Test - Fetch /naieve/obj with a *different* Range header; note the cache key changes and is a miss for the same object tr = Test.AddTestRun("cache miss on /naieve/obj") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' -H "UID: NAIEVE" http://example.com/naieve/obj -r 444-777') +tr.MakeCurlCommand(curl_and_args + ' -H "UID: NAIEVE" http://example.com/naieve/obj -r 444-777', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK") ps.Streams.stdout.Content = Testers.ExcludesExpression("Content-Range:", "expected no Content-Range header") @@ -379,7 +379,7 @@ # this is why a Range normalization strategy should _always_ be employed when using `--cache-complete-responses` tr = Test.AddTestRun("cache hit on /naieve/obj") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' -H "UID: NAIEVE" http://example.com/naieve/obj -r 444-777') +tr.MakeCurlCommand(curl_and_args + ' -H "UID: NAIEVE" http://example.com/naieve/obj -r 444-777', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK") ps.Streams.stdout.Content = Testers.ExcludesExpression("Content-Range:", "expected no Content-Range header") @@ -391,7 +391,7 @@ # 14 Test - Fetch /naieve/obj with the original Range header (0-5000); still a cache hit tr = Test.AddTestRun("cache hit on /naieve/obj after requesting with a different Range") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' -H "UID: NAIEVE" http://example.com/naieve/obj -r 0-5000') +tr.MakeCurlCommand(curl_and_args + ' -H "UID: NAIEVE" http://example.com/naieve/obj -r 0-5000', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK") ps.Streams.stdout.Content = Testers.ExcludesExpression("Content-Range:", "expected no Content-Range header") diff --git a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cachekey.test.py b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cachekey.test.py index 6384c6ebf10..352e2f722b8 100644 --- a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cachekey.test.py +++ b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cachekey.test.py @@ -136,7 +136,7 @@ ps = tr.Processes.Default ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -H "uuid: full"') +tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -H "uuid: full"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss for load") tr.StillRunningAfter = ts @@ -144,7 +144,7 @@ # 1 Test - Fetch whole asset into cache via range request (ensure cold) tr = Test.AddTestRun("0- asset fetch") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -r 0- -H "uuid: range_full"') +tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -r 0- -H "uuid: range_full"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss for load") tr.StillRunningAfter = ts @@ -152,7 +152,7 @@ # 2 Test - Ensure assert happens instead of possible cache poisoning. tr = Test.AddTestRun("Attempt poisoning") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://www.fail.com/path -r 0- -H "uuid: range_fail"') +tr.MakeCurlCommand(curl_and_args + ' http://www.fail.com/path -r 0- -H "uuid: range_fail"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cachekey_global.test.py b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cachekey_global.test.py index 3603b6c5cb7..37c7ef162bc 100644 --- a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cachekey_global.test.py +++ b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cachekey_global.test.py @@ -138,7 +138,7 @@ ps = tr.Processes.Default ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -r0- -H "uuid: full"') +tr.MakeCurlCommand(curl_and_args + ' http://www.example.com/path -r0- -H "uuid: full"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression( "X-Cache-Key: /foo/Range:bytes=0-/path", "expected cachekey style range request in cachekey") diff --git a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_ident.test.py b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_ident.test.py index 6fc52aa1eda..2039311c7a1 100644 --- a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_ident.test.py +++ b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_ident.test.py @@ -116,7 +116,7 @@ ps = tr.Processes.Default ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(curl_and_args + ' http://ident/path -r 0-') +tr.MakeCurlCommand(curl_and_args + ' http://ident/path -r 0-', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss for load") tr.StillRunningAfter = ts @@ -124,7 +124,7 @@ # 1 Test - Fetch asset into cache tr = Test.AddTestRun("0- range cache load") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://identheader/pathheader -r 0-') +tr.MakeCurlCommand(curl_and_args + ' http://identheader/pathheader -r 0-', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss for load") tr.StillRunningAfter = ts @@ -132,7 +132,7 @@ # 2 Test - Ensure range is fetched tr = Test.AddTestRun("0- cache hit check") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://ident/path -r 0-') +tr.MakeCurlCommand(curl_and_args + ' http://ident/path -r 0-', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit", "expected cache hit") tr.StillRunningAfter = ts @@ -140,7 +140,7 @@ # 3 Test - Ensure range is fetched tr = Test.AddTestRun("0- cache hit check") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://identheader/pathheader -r 0-') +tr.MakeCurlCommand(curl_and_args + ' http://identheader/pathheader -r 0-', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit", "expected cache hit") tr.StillRunningAfter = ts @@ -151,7 +151,7 @@ tr = Test.AddTestRun("0- range X-Crr-Ident Etag check") tr.DelayStart = 2 ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + f" http://ident/path -r 0- -H 'X-Crr-Ident: Etag: {etag}'") +tr.MakeCurlCommand(curl_and_args + f" http://ident/path -r 0- -H 'X-Crr-Ident: Etag: {etag}'", uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-fresh", "expected cache hit-fresh") tr.StillRunningAfter = ts @@ -160,7 +160,8 @@ tr = Test.AddTestRun("0- range CrrIdent Etag check") tr.DelayStart = 2 ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + f" http://identheader/pathheader -r 0- -H 'CrrIdent: Etag: {etag_custom}'") +tr.MakeCurlCommand( + curl_and_args + f" http://identheader/pathheader -r 0- -H 'CrrIdent: Etag: {etag_custom}'", uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-fresh", "expected cache hit-fresh") tr.StillRunningAfter = ts @@ -168,7 +169,8 @@ # 6 Test - Ensure X-Crr-Ident Last-Modified header results in hit-fresh tr = Test.AddTestRun("0- range X-Crr-Ident Last-Modified check") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + f' http://ident/path -r 0- -H "X-Crr-Ident: Last-Modified: {last_modified}"') +tr.MakeCurlCommand( + curl_and_args + f' http://ident/path -r 0- -H "X-Crr-Ident: Last-Modified: {last_modified}"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-fresh", "expected cache hit-fresh") tr.StillRunningAfter = ts @@ -176,7 +178,7 @@ # 7 Test - Provide a mismatch Etag force IMS request tr = Test.AddTestRun("0- range X-Crr-Ident check") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + f' http://ident/path -r 0- -H "X-Crr-Ident: Last-Modified: foo"') +tr.MakeCurlCommand(curl_and_args + f' http://ident/path -r 0- -H "X-Crr-Ident: Last-Modified: foo"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-stale", "expected cache hit-stale") tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_ims.test.py b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_ims.test.py index a4f70716f1d..f462becc72c 100644 --- a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_ims.test.py +++ b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_ims.test.py @@ -95,7 +95,7 @@ ps = tr.Processes.Default ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(curl_and_args + ' http://ims/path -r 0-') +tr.MakeCurlCommand(curl_and_args + ' http://ims/path -r 0-', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss for load") tr.StillRunningAfter = ts @@ -104,7 +104,7 @@ # 1 Test - Fetch range into cache tr = Test.AddTestRun("0- cache hit check") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://ims/path -r 0-') +tr.MakeCurlCommand(curl_and_args + ' http://ims/path -r 0-', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit", "expected cache hit") tr.StillRunningAfter = ts @@ -116,7 +116,7 @@ # 2 Test - Ensure X-CRR-IMS header results in hit-stale tr = Test.AddTestRun("0- range X-CRR-IMS check") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://ims/path -r 0- -H "X-CRR-IMS: {}"'.format(futurestr)) +tr.MakeCurlCommand(curl_and_args + ' http://ims/path -r 0- -H "X-CRR-IMS: {}"'.format(futurestr), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-stale", "expected cache hit-stale") tr.StillRunningAfter = ts @@ -127,7 +127,7 @@ # 3 Test - Ensure CrrIms header results in hit-stale tr = Test.AddTestRun("0- range CrrIms check, override header") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://imsheader/path -r 0- -H "CrrIms: {}"'.format(futurestr)) +tr.MakeCurlCommand(curl_and_args + ' http://imsheader/path -r 0- -H "CrrIms: {}"'.format(futurestr), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-stale", "expected cache hit-stale") tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/cert_update/cert_update.test.py b/tests/gold_tests/pluginTest/cert_update/cert_update.test.py index 86e0d31ba66..c8ccb9157d7 100644 --- a/tests/gold_tests/pluginTest/cert_update/cert_update.test.py +++ b/tests/gold_tests/pluginTest/cert_update/cert_update.test.py @@ -23,7 +23,7 @@ Test cert_update plugin. ''' -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) Test.SkipUnless( Condition.HasProgram("openssl", "Openssl need to be installed on system for this test to work"), Condition.PluginExists('cert_update.so')) diff --git a/tests/gold_tests/pluginTest/client_context_dump/client_context_dump.test.py b/tests/gold_tests/pluginTest/client_context_dump/client_context_dump.test.py index a77add485f8..640af0d6e8a 100644 --- a/tests/gold_tests/pluginTest/client_context_dump/client_context_dump.test.py +++ b/tests/gold_tests/pluginTest/client_context_dump/client_context_dump.test.py @@ -64,7 +64,7 @@ t.StillRunningAfter = Test.Processes.ts p = t.Processes.Default -t.MakeCurlCommand("http://127.0.0.1:{0}".format(ts.Variables.port)) +t.MakeCurlCommand("http://127.0.0.1:{0}".format(ts.Variables.port), uds_path=ts.Variables.uds_path) p.ReturnCode = 0 p.StartBefore(Test.Processes.ts) diff --git a/tests/gold_tests/pluginTest/compress/compress.test.py b/tests/gold_tests/pluginTest/compress/compress.test.py index 079b5406dbf..defb4b256d1 100644 --- a/tests/gold_tests/pluginTest/compress/compress.test.py +++ b/tests/gold_tests/pluginTest/compress/compress.test.py @@ -133,7 +133,7 @@ def get_verify_command(out_path, decrompressor): waitForServer = False tr.Processes.Default.ReturnCode = 0 out_path = get_out_path() - tr.MakeCurlCommand(curl(ts, i, 'gzip, deflate, sdch, br', out_path)) + tr.MakeCurlCommand(curl(ts, i, 'gzip, deflate, sdch, br', out_path), uds_path=ts.Variables.uds_path) tr = Test.AddTestRun(f'verify gzip, deflate, sdch, br: {i}') tr.ReturnCode = 0 if i == 0: @@ -146,7 +146,7 @@ def get_verify_command(out_path, decrompressor): tr = Test.AddTestRun(f'gzip: {i}') tr.Processes.Default.ReturnCode = 0 out_path = get_out_path() - tr.MakeCurlCommand(curl(ts, i, "gzip", out_path)) + tr.MakeCurlCommand(curl(ts, i, "gzip", out_path), uds_path=ts.Variables.uds_path) tr = Test.AddTestRun(f'verify gzip: {i}') tr.ReturnCode = 0 tr.Processes.Default.Command = get_verify_command(out_path, "gunzip -k") @@ -154,7 +154,7 @@ def get_verify_command(out_path, decrompressor): tr = Test.AddTestRun(f'br: {i}') tr.Processes.Default.ReturnCode = 0 out_path = get_out_path() - tr.MakeCurlCommand(curl(ts, i, "br", out_path)) + tr.MakeCurlCommand(curl(ts, i, "br", out_path), uds_path=ts.Variables.uds_path) tr = Test.AddTestRun(f'verify br: {i}') tr.ReturnCode = 0 if i == 1: @@ -165,7 +165,7 @@ def get_verify_command(out_path, decrompressor): tr = Test.AddTestRun(f'deflate: {i}') tr.Processes.Default.ReturnCode = 0 out_path = get_out_path() - tr.MakeCurlCommand(curl(ts, i, "deflate", out_path)) + tr.MakeCurlCommand(curl(ts, i, "deflate", out_path), uds_path=ts.Variables.uds_path) tr = Test.AddTestRun(f'verify deflate: {i}') tr.ReturnCode = 0 tr.Processes.Default.Command = f"diff {out_path} {orig_path}" @@ -175,7 +175,7 @@ def get_verify_command(out_path, decrompressor): tr = Test.AddTestRun() tr.Processes.Default.ReturnCode = 0 out_path = get_out_path() -tr.MakeCurlCommand(curl(ts, 0, "gzip;q=0.666", out_path)) +tr.MakeCurlCommand(curl(ts, 0, "gzip;q=0.666", out_path), uds_path=ts.Variables.uds_path) tr = Test.AddTestRun(f'verify gzip;q=0.666') tr.ReturnCode = 0 tr.Processes.Default.Command = get_verify_command(out_path, "gunzip -k") @@ -183,7 +183,7 @@ def get_verify_command(out_path, decrompressor): tr = Test.AddTestRun() tr.Processes.Default.ReturnCode = 0 out_path = get_out_path() -tr.MakeCurlCommand(curl(ts, 0, "gzip;q=0.666x", out_path)) +tr.MakeCurlCommand(curl(ts, 0, "gzip;q=0.666x", out_path), uds_path=ts.Variables.uds_path) tr = Test.AddTestRun(f'verify gzip;q=0.666x') tr.ReturnCode = 0 tr.Processes.Default.Command = get_verify_command(out_path, "gunzip -k") @@ -191,7 +191,7 @@ def get_verify_command(out_path, decrompressor): tr = Test.AddTestRun() tr.Processes.Default.ReturnCode = 0 out_path = get_out_path() -tr.MakeCurlCommand(curl(ts, 0, "gzip;q=#0.666", out_path)) +tr.MakeCurlCommand(curl(ts, 0, "gzip;q=#0.666", out_path), uds_path=ts.Variables.uds_path) tr = Test.AddTestRun(f'verify gzip;q=#0.666') tr.ReturnCode = 0 tr.Processes.Default.Command = get_verify_command(out_path, "gunzip -k") @@ -199,7 +199,7 @@ def get_verify_command(out_path, decrompressor): tr = Test.AddTestRun() tr.Processes.Default.ReturnCode = 0 out_path = get_out_path() -tr.MakeCurlCommand(curl(ts, 0, "gzip; Q = 0.666", out_path)) +tr.MakeCurlCommand(curl(ts, 0, "gzip; Q = 0.666", out_path), uds_path=ts.Variables.uds_path) tr = Test.AddTestRun(f'verify gzip; Q = 0.666') tr.ReturnCode = 0 tr.Processes.Default.Command = get_verify_command(out_path, "gunzip -k") @@ -207,7 +207,7 @@ def get_verify_command(out_path, decrompressor): tr = Test.AddTestRun() tr.Processes.Default.ReturnCode = 0 out_path = get_out_path() -tr.MakeCurlCommand(curl(ts, 0, "gzip;q=0.0", out_path)) +tr.MakeCurlCommand(curl(ts, 0, "gzip;q=0.0", out_path), uds_path=ts.Variables.uds_path) tr = Test.AddTestRun(f'verify gzip;q=0.0') tr.ReturnCode = 0 tr.Processes.Default.Command = f"diff {out_path} {orig_path}" @@ -215,7 +215,7 @@ def get_verify_command(out_path, decrompressor): tr = Test.AddTestRun() tr.Processes.Default.ReturnCode = 0 out_path = get_out_path() -tr.MakeCurlCommand(curl(ts, 0, "gzip;q=-0.1", out_path)) +tr.MakeCurlCommand(curl(ts, 0, "gzip;q=-0.1", out_path), uds_path=ts.Variables.uds_path) tr = Test.AddTestRun(f'verify gzip;q=-0.1') tr.ReturnCode = 0 tr.Processes.Default.Command = get_verify_command(out_path, "gunzip -k") @@ -223,7 +223,7 @@ def get_verify_command(out_path, decrompressor): tr = Test.AddTestRun() tr.Processes.Default.ReturnCode = 0 out_path = get_out_path() -tr.MakeCurlCommand(curl(ts, 0, "aaa, gzip;q=0.666, bbb", out_path)) +tr.MakeCurlCommand(curl(ts, 0, "aaa, gzip;q=0.666, bbb", out_path), uds_path=ts.Variables.uds_path) tr = Test.AddTestRun(f'verify aaa, gzip;q=0.666, bbb') tr.ReturnCode = 0 tr.Processes.Default.Command = get_verify_command(out_path, "gunzip -k") @@ -231,7 +231,7 @@ def get_verify_command(out_path, decrompressor): tr = Test.AddTestRun() tr.Processes.Default.ReturnCode = 0 out_path = get_out_path() -tr.MakeCurlCommand(curl(ts, 0, " br ; q=0.666, bbb", out_path)) +tr.MakeCurlCommand(curl(ts, 0, " br ; q=0.666, bbb", out_path), uds_path=ts.Variables.uds_path) tr = Test.AddTestRun(f'verify br ; q=0.666, bbb') tr.ReturnCode = 0 tr.Processes.Default.Command = get_verify_command(out_path, "brotli -d") @@ -239,7 +239,7 @@ def get_verify_command(out_path, decrompressor): tr = Test.AddTestRun() tr.Processes.Default.ReturnCode = 0 out_path = get_out_path() -tr.MakeCurlCommand(curl(ts, 0, "aaa, gzip;q=0.666 , ", out_path)) +tr.MakeCurlCommand(curl(ts, 0, "aaa, gzip;q=0.666 , ", out_path), uds_path=ts.Variables.uds_path) tr = Test.AddTestRun(f'verify aaa, gzip;q=0.666 , ') tr.ReturnCode = 0 tr.Processes.Default.Command = get_verify_command(out_path, "gunzip -k") @@ -248,7 +248,7 @@ def get_verify_command(out_path, decrompressor): tr = Test.AddTestRun() tr.Processes.Default.ReturnCode = 0 out_path = get_out_path() -tr.MakeCurlCommand(curl_post(ts, 3, "gzip", out_path)) +tr.MakeCurlCommand(curl_post(ts, 3, "gzip", out_path), uds_path=ts.Variables.uds_path) tr = Test.AddTestRun(f'verify gzip post') tr.ReturnCode = 0 tr.Processes.Default.Command = get_verify_command(out_path, "gunzip -k") diff --git a/tests/gold_tests/pluginTest/cookie_remap/bucketcookie.test.py b/tests/gold_tests/pluginTest/cookie_remap/bucketcookie.test.py index 97a4eb17a18..755b5ed751b 100644 --- a/tests/gold_tests/pluginTest/cookie_remap/bucketcookie.test.py +++ b/tests/gold_tests/pluginTest/cookie_remap/bucketcookie.test.py @@ -83,7 +83,8 @@ -H"Cookie: fpbeta=333" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) @@ -99,7 +100,8 @@ -H"Cookie: fpbeta=etc" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server2, ready=When.PortOpen(server2.Variables.Port)) tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/cookie_remap/collapseslashes.test.py b/tests/gold_tests/pluginTest/cookie_remap/collapseslashes.test.py index b0c868875dd..82e12fc4410 100644 --- a/tests/gold_tests/pluginTest/cookie_remap/collapseslashes.test.py +++ b/tests/gold_tests/pluginTest/cookie_remap/collapseslashes.test.py @@ -68,7 +68,8 @@ "http://www.example.com/magic" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) diff --git a/tests/gold_tests/pluginTest/cookie_remap/connector.test.py b/tests/gold_tests/pluginTest/cookie_remap/connector.test.py index cc5cca8d75d..11d52af45c8 100644 --- a/tests/gold_tests/pluginTest/cookie_remap/connector.test.py +++ b/tests/gold_tests/pluginTest/cookie_remap/connector.test.py @@ -83,7 +83,8 @@ -H"Cookie: fpbeta=abcd icecream=donteat" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) @@ -99,7 +100,8 @@ -H"Cookie: fpbeta=somethingelse" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server2, ready=When.PortOpen(server2.Variables.Port)) tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/cookie_remap/existscookie.test.py b/tests/gold_tests/pluginTest/cookie_remap/existscookie.test.py index ab6b4c89a15..253048e0747 100644 --- a/tests/gold_tests/pluginTest/cookie_remap/existscookie.test.py +++ b/tests/gold_tests/pluginTest/cookie_remap/existscookie.test.py @@ -83,7 +83,8 @@ -H"Cookie: fpbeta=fdkfkdfkdfkdkdfkdfk" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) @@ -99,7 +100,8 @@ -H"Cookie: breadcrumb=etc" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server2, ready=When.PortOpen(server2.Variables.Port)) tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/cookie_remap/matchcookie.test.py b/tests/gold_tests/pluginTest/cookie_remap/matchcookie.test.py index fcd1069c4ea..f2e9e671025 100644 --- a/tests/gold_tests/pluginTest/cookie_remap/matchcookie.test.py +++ b/tests/gold_tests/pluginTest/cookie_remap/matchcookie.test.py @@ -83,7 +83,8 @@ -H"Cookie: fpbeta=magic" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) @@ -99,7 +100,8 @@ -H"Cookie: fpbeta=magit" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server2, ready=When.PortOpen(server2.Variables.Port)) tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/cookie_remap/matchuri.test.py b/tests/gold_tests/pluginTest/cookie_remap/matchuri.test.py index c986761b9d2..e85d6fe4e96 100644 --- a/tests/gold_tests/pluginTest/cookie_remap/matchuri.test.py +++ b/tests/gold_tests/pluginTest/cookie_remap/matchuri.test.py @@ -82,7 +82,8 @@ "http://www.example.com/magic/thisispartofthepath" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) @@ -98,7 +99,8 @@ -H"Cookie: fpbeta=etc" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server2, ready=When.PortOpen(server2.Variables.Port)) tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/cookie_remap/notexistscookie.test.py b/tests/gold_tests/pluginTest/cookie_remap/notexistscookie.test.py index d984c3fd4fb..68caad87a09 100644 --- a/tests/gold_tests/pluginTest/cookie_remap/notexistscookie.test.py +++ b/tests/gold_tests/pluginTest/cookie_remap/notexistscookie.test.py @@ -82,7 +82,8 @@ "http://www.example.com/magic" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) @@ -98,7 +99,8 @@ -H"Cookie: fpbeta=etc" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server2, ready=When.PortOpen(server2.Variables.Port)) tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/cookie_remap/pcollapseslashes.test.py b/tests/gold_tests/pluginTest/cookie_remap/pcollapseslashes.test.py index 9004490aea5..288ff782d27 100644 --- a/tests/gold_tests/pluginTest/cookie_remap/pcollapseslashes.test.py +++ b/tests/gold_tests/pluginTest/cookie_remap/pcollapseslashes.test.py @@ -68,7 +68,8 @@ "http://www.example.com/orig_path" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) diff --git a/tests/gold_tests/pluginTest/cookie_remap/psubstitute.test.py b/tests/gold_tests/pluginTest/cookie_remap/psubstitute.test.py index 2848ee1b17c..59b2e26185d 100644 --- a/tests/gold_tests/pluginTest/cookie_remap/psubstitute.test.py +++ b/tests/gold_tests/pluginTest/cookie_remap/psubstitute.test.py @@ -93,7 +93,8 @@ -H"Cookie: fpbeta=abcd" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) @@ -107,7 +108,8 @@ -H"Cookie: oxalpha=3333" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -119,7 +121,8 @@ -H"Cookie: acgamma=dfndfdfd" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -130,7 +133,8 @@ "http://www.example.com/magic/foobar" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server diff --git a/tests/gold_tests/pluginTest/cookie_remap/regexcookie.test.py b/tests/gold_tests/pluginTest/cookie_remap/regexcookie.test.py index df70434740b..7f1d984f964 100644 --- a/tests/gold_tests/pluginTest/cookie_remap/regexcookie.test.py +++ b/tests/gold_tests/pluginTest/cookie_remap/regexcookie.test.py @@ -83,7 +83,8 @@ -H"Cookie: fpbeta=ilove-oreos-chipsahoy-icecream" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) @@ -99,7 +100,8 @@ -H"Cookie: fpbeta=etc" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server2, ready=When.PortOpen(server2.Variables.Port)) tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/cookie_remap/setstatus.test.py b/tests/gold_tests/pluginTest/cookie_remap/setstatus.test.py index 142126bf848..36dd326372e 100644 --- a/tests/gold_tests/pluginTest/cookie_remap/setstatus.test.py +++ b/tests/gold_tests/pluginTest/cookie_remap/setstatus.test.py @@ -53,7 +53,8 @@ -H"Cookie: fpbeta=magic" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(Test.Processes.ts) tr.StillRunningAfter = ts @@ -68,7 +69,8 @@ -H "Proxy-Connection: keep-alive" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/cookie_remap/subcookie.test.py b/tests/gold_tests/pluginTest/cookie_remap/subcookie.test.py index f94c3f735d9..065ec8ed76c 100644 --- a/tests/gold_tests/pluginTest/cookie_remap/subcookie.test.py +++ b/tests/gold_tests/pluginTest/cookie_remap/subcookie.test.py @@ -81,7 +81,8 @@ # be interpreted by the autest framework or the shell (tried escaping with \) tr.MakeCurlCommand( '--proxy 127.0.0.1:{0} "http://www.example.com" -H"Cookie: fpbeta=a=1&b=2&c=3" -H "Proxy-Connection: keep-alive" --verbose ' - .format(ts.Variables.port)) + .format(ts.Variables.port), + uds_path=ts.Variables.uds_path) # tr.Processes.Default.Command = ''' # curl # --proxy 127.0.0.1:{0} @@ -101,7 +102,8 @@ tr = Test.AddTestRun("cookie value doesn't match") tr.MakeCurlCommand( '--proxy 127.0.0.1:{0} "http://www.example.com" -H"Cookie: fpbeta=a=1&b=2&c=4" -H "Proxy-Connection: keep-alive" --verbose ' - .format(ts.Variables.port)) + .format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server2, ready=When.PortOpen(server2.Variables.Port)) tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/cookie_remap/substitute.test.py b/tests/gold_tests/pluginTest/cookie_remap/substitute.test.py index ce8900d9ca0..754717aaa31 100644 --- a/tests/gold_tests/pluginTest/cookie_remap/substitute.test.py +++ b/tests/gold_tests/pluginTest/cookie_remap/substitute.test.py @@ -83,7 +83,8 @@ -H"Cookie: fpbeta=abcd" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) @@ -97,7 +98,8 @@ -H"Cookie: oxalpha=3333" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -109,7 +111,8 @@ -H"Cookie: acgamma=dfndfdfd" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -120,7 +123,8 @@ "http://www.example.com/magic/foobar" \ -H "Proxy-Connection: keep-alive" \ --verbose \ -'''.format(ts.Variables.port)) +'''.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server diff --git a/tests/gold_tests/pluginTest/esi/esi.test.py b/tests/gold_tests/pluginTest/esi/esi.test.py index 7217d6bcfc9..f439f1db557 100644 --- a/tests/gold_tests/pluginTest/esi/esi.test.py +++ b/tests/gold_tests/pluginTest/esi/esi.test.py @@ -202,7 +202,8 @@ def run_cases_expecting_gzip(self): tr = Test.AddTestRun(f"First request for esi.php: not cached: {self._plugin_config}") tr.MakeCurlCommand( f'http://127.0.0.1:{self._ts.Variables.port}/esi.php -H"Host: www.example.com" ' - '-H"Accept: */*" --verbose') + '-H"Accept: */*" --verbose', + uds_path=self._ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 self._configure_client_output_expectations(tr.Processes.Default) tr.StillRunningAfter = self._server @@ -212,7 +213,8 @@ def run_cases_expecting_gzip(self): tr = Test.AddTestRun(f"Second request for esi.php: will be cached: {self._plugin_config}") tr.MakeCurlCommand( f'http://127.0.0.1:{self._ts.Variables.port}/esi.php -H"Host: www.example.com" ' - '-H"Accept: */*" --verbose') + '-H"Accept: */*" --verbose', + uds_path=self._ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 self._configure_client_output_expectations(tr.Processes.Default) tr.StillRunningAfter = self._server @@ -225,7 +227,8 @@ def run_cases_expecting_gzip(self): gzipped_body_file = unzipped_body_file + ".gz" tr.MakeCurlCommand( f'http://127.0.0.1:{self._ts.Variables.port}/esi.php -H"Host: www.example.com" ' - f'-H "Accept-Encoding: gzip" -H"Accept: */*" --verbose --output {gzipped_body_file}') + f'-H "Accept-Encoding: gzip" -H"Accept: */*" --verbose --output {gzipped_body_file}', + uds_path=self._ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Ready = When.FileExists(gzipped_body_file) tr.Processes.Default.Streams.stderr = "gold/esi_gzipped.gold" @@ -250,7 +253,8 @@ def run_cases_expecting_gzip(self): tr.MakeCurlCommand( f'http://127.0.0.1:{self._ts.Variables.port}/expect_empty_body ' '-H"Host: www.example.com" -H"Accept-Encoding: gzip" -H"Accept: */*" ' - f'--verbose --output {gzipped_empty_body}') + f'--verbose --output {gzipped_empty_body}', + uds_path=self._ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Ready = When.FileExists(gzipped_empty_body) tr.Processes.Default.Streams.stderr = "gold/empty_response_body.gold" @@ -273,7 +277,8 @@ def run_case_max_doc_size_too_small(self): tr = Test.AddTestRun(f"Max doc size too small: {self._plugin_config}") tr.MakeCurlCommand( f'http://127.0.0.1:{self._ts.Variables.port}/esi.php ' - '-H"Host: www.example.com" -H"Accept: */*" --verbose') + '-H"Host: www.example.com" -H"Accept: */*" --verbose', + uds_path=self._ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 self._ts.Disk.diags_log.Content = Testers.ContainsExpression( r"ERROR: \[_setup\] Cannot allow attempted doc of size 121; Max allowed size is 100", @@ -286,7 +291,8 @@ def run_cases_expecting_no_gzip(self): tr = Test.AddTestRun(f"First request for esi.php: gzip not accepted: {self._plugin_config}") tr.MakeCurlCommand( f'http://127.0.0.1:{self._ts.Variables.port}/esi.php ' - '-H"Host: www.example.com" -H"Accept: */*" --verbose') + '-H"Host: www.example.com" -H"Accept: */*" --verbose', + uds_path=self._ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 self._configure_client_output_expectations(tr.Processes.Default) tr.StillRunningAfter = self._server @@ -297,7 +303,8 @@ def run_cases_expecting_no_gzip(self): tr = Test.AddTestRun(f"Verify the ESI plugin refuses to gzip responses with: {self._plugin_config}") tr.MakeCurlCommand( f'http://127.0.0.1:{self._ts.Variables.port}/esi.php ' - '-H"Host: www.example.com" -H "Accept-Encoding: gzip" -H"Accept: */*" --verbose') + '-H"Host: www.example.com" -H "Accept-Encoding: gzip" -H"Accept: */*" --verbose', + uds_path=self._ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 self._configure_client_output_expectations(tr.Processes.Default) tr.StillRunningAfter = self._server diff --git a/tests/gold_tests/pluginTest/esi/esi_304.test.py b/tests/gold_tests/pluginTest/esi/esi_304.test.py index 7aa78b0cc55..0ed2dbaaec2 100644 --- a/tests/gold_tests/pluginTest/esi/esi_304.test.py +++ b/tests/gold_tests/pluginTest/esi/esi_304.test.py @@ -152,7 +152,8 @@ def run_cases(self): tr = Test.AddTestRun("First request for esi_etag.php: not cached") tr.MakeCurlCommand( 'http://127.0.0.1:{0}/esi_etag.php -H"Host: www.example.com" ' - '-H"Accept: */*" -H"uuid: first" --verbose -o /dev/stderr'.format(self._ts.Variables.port)) + '-H"Accept: */*" -H"uuid: first" --verbose -o /dev/stderr'.format(self._ts.Variables.port), + uds_path=self._ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/esi_private_headers.gold" tr.StillRunningAfter = self._server @@ -162,7 +163,8 @@ def run_cases(self): tr = Test.AddTestRun("Second request for esi_etag.php: will be cached") tr.MakeCurlCommand( 'http://127.0.0.1:{0}/esi_etag.php -H"Host: www.example.com" ' - '-H"Accept: */*" -H"uuid: second" --verbose -o /dev/stderr'.format(self._ts.Variables.port)) + '-H"Accept: */*" -H"uuid: second" --verbose -o /dev/stderr'.format(self._ts.Variables.port), + uds_path=self._ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/esi_private_headers.gold" tr.StillRunningAfter = self._server diff --git a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite.test.py b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite.test.py index 6e72b6b1076..2aade345b35 100644 --- a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite.test.py +++ b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite.test.py @@ -47,7 +47,8 @@ # call localhost straight tr = Test.AddTestRun() tr.MakeCurlCommand( - '--proxy 127.0.0.1:{0} "http://www.example.com" -H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port)) + '--proxy 127.0.0.1:{0} "http://www.example.com" -H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) diff --git a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_cond_cache.test.py b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_cond_cache.test.py index 6b85d07ecec..446647bd1ea 100644 --- a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_cond_cache.test.py +++ b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_cond_cache.test.py @@ -59,7 +59,7 @@ # Test Case tr = Test.AddTestRun() -tr.MakeCurlCommandMulti(curlRequest.format(ts.Variables.port)) +tr.MakeCurlCommandMulti(curlRequest.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(ts) diff --git a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_cond_method.test.py b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_cond_method.test.py index 434f6faad57..df8ad8da235 100644 --- a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_cond_method.test.py +++ b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_cond_method.test.py @@ -53,7 +53,8 @@ expected_log = "gold/header_rewrite-tag.gold" tr = Test.AddTestRun() tr.MakeCurlCommand( - '--proxy 127.0.0.1:{0} "http://www.example.com" -H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port)) + '--proxy 127.0.0.1:{0} "http://www.example.com" -H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) @@ -65,7 +66,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '--request DELETE --proxy 127.0.0.1:{0} "http://www.example.com" -H "Proxy-Connection: keep-alive" --verbose'.format( - ts.Variables.port)) + ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = expected_output tr.StillRunningAfter = server diff --git a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_cond_ssn_txn_count.test.py b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_cond_ssn_txn_count.test.py index 98aab8f52df..8d88cd1b116 100644 --- a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_cond_ssn_txn_count.test.py +++ b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_cond_ssn_txn_count.test.py @@ -93,7 +93,7 @@ '{{curl}} -v -H\'Host: www.example.com\' -H\'Connection: close\' http://127.0.0.1:{0}/world') tr = Test.AddTestRun("Add connection close header when ssn-txn-count > 2") -tr.MakeCurlCommandMulti(curlRequest.format(ts.Variables.port)) +tr.MakeCurlCommandMulti(curlRequest.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(ts) diff --git a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_l_value.test.py b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_l_value.test.py index 49a0f3bf19f..aba987d0595 100644 --- a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_l_value.test.py +++ b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_l_value.test.py @@ -51,7 +51,8 @@ # [L] test tr = Test.AddTestRun("Header Rewrite End [L]") tr.MakeCurlCommand( - '--proxy 127.0.0.1:{0} "http://www.example.com" -H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port)) + '--proxy 127.0.0.1:{0} "http://www.example.com" -H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) diff --git a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_set_body_from.test.py b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_set_body_from.test.py index cd40544d749..71af155839c 100644 --- a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_set_body_from.test.py +++ b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_set_body_from.test.py @@ -83,7 +83,9 @@ def test_setBodyFromFails_remap(self): This uses the case where no remap rule is provided ''' tr = Test.AddTestRun() - tr.MakeCurlCommand('-s -v --proxy 127.0.0.1:{0} "http://www.example.com/remap_fail"'.format(self.ts.Variables.port)) + tr.MakeCurlCommand( + '-s -v --proxy 127.0.0.1:{0} "http://www.example.com/remap_fail"'.format(self.ts.Variables.port), + uds_path=self.ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(self.server) tr.Processes.Default.StartBefore(self.ts) @@ -97,7 +99,9 @@ def test_setBodyFromSucceeds_remap(self): Triggered from remap file ''' tr = Test.AddTestRun() - tr.MakeCurlCommand('-s -v --proxy 127.0.0.1:{0} "http://www.example.com/remap_success"'.format(self.ts.Variables.port)) + tr.MakeCurlCommand( + '-s -v --proxy 127.0.0.1:{0} "http://www.example.com/remap_success"'.format(self.ts.Variables.port), + uds_path=self.ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/header_rewrite-set_body_from_success.gold" tr.Processes.Default.Streams.stderr.Content = Testers.ContainsExpression("404 Not Found", "Expected 404 response") @@ -109,7 +113,9 @@ def test_setBodyFromSucceeds_plugin(self): Triggered from plugin file ''' tr = Test.AddTestRun() - tr.MakeCurlCommand('-s -v --proxy 127.0.0.1:{0} "http://www.example.com/plugin_success"'.format(self.ts.Variables.port)) + tr.MakeCurlCommand( + '-s -v --proxy 127.0.0.1:{0} "http://www.example.com/plugin_success"'.format(self.ts.Variables.port), + uds_path=self.ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/header_rewrite-set_body_from_success.gold" tr.Processes.Default.Streams.stderr.Content = Testers.ContainsExpression("404 Not Found", "Expected 404 response") @@ -122,7 +128,9 @@ def test_setBodyFromFails_plugin(self): Triggered from plugin file ''' tr = Test.AddTestRun() - tr.MakeCurlCommand('-s -v --proxy 127.0.0.1:{0} "http://www.example.com/plugin_fail"'.format(self.ts.Variables.port)) + tr.MakeCurlCommand( + '-s -v --proxy 127.0.0.1:{0} "http://www.example.com/plugin_fail"'.format(self.ts.Variables.port), + uds_path=self.ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/header_rewrite-set_body_from_conn_fail.gold" tr.Processes.Default.Streams.stderr.Content = Testers.ContainsExpression("404 Not Found", "Expected 404 response") @@ -136,7 +144,9 @@ def test_setBodyFromSucceeds_200(self): Ideally, this would not occur. ''' tr = Test.AddTestRun() - tr.MakeCurlCommand('-s -v --proxy 127.0.0.1:{0} "http://www.example.com/200"'.format(self.ts.Variables.port)) + tr.MakeCurlCommand( + '-s -v --proxy 127.0.0.1:{0} "http://www.example.com/200"'.format(self.ts.Variables.port), + uds_path=self.ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/header_rewrite-set_body_from_200.gold" tr.Processes.Default.Streams.stderr.Content = Testers.ContainsExpression("500 INKApi Error", "Expected 500 response") diff --git a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_url.test.py b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_url.test.py index db4fb86e1f6..6b451d2d81d 100644 --- a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_url.test.py +++ b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_url.test.py @@ -60,7 +60,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '--proxy 127.0.0.1:{0} "http://www.example.com/from_path/hello?=foo=bar" ' - '-H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port)) + '-H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) @@ -70,7 +71,8 @@ # Test TO-URL in a set-redirect operator. tr = Test.AddTestRun() -tr.MakeCurlCommand('--head 127.0.0.1:{0} -H "Host: no_path.com" --verbose'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '--head 127.0.0.1:{0} -H "Host: no_path.com" --verbose'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/set-redirect.gold" tr.StillRunningAfter = server diff --git a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_url_glob.test.py b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_url_glob.test.py index 18b5577878a..8dbba54d668 100644 --- a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_url_glob.test.py +++ b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_url_glob.test.py @@ -47,7 +47,8 @@ tr = Test.AddTestRun() tr.Processes.Default.StartBefore(ts) tr.Processes.Default.StartBefore(server) -tr.MakeCurlCommand(f'--head 127.0.0.1:{ts.Variables.port} -H "Host: 127.0.0.1:{server.Variables.Port}" --verbose') +tr.MakeCurlCommand( + f'--head 127.0.0.1:{ts.Variables.port} -H "Host: 127.0.0.1:{server.Variables.Port}" --verbose', uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/set-redirect-glob.gold" tr.StillRunningAfter = server @@ -56,7 +57,8 @@ # Run operator on Send Response Hdr hook (ID:REQUEST == 1). tr = Test.AddTestRun() -tr.MakeCurlCommand(f'--head 127.0.0.1:{ts.Variables.port} -H "Host: 127.0.0.1:{server.Variables.Port}" --verbose') +tr.MakeCurlCommand( + f'--head 127.0.0.1:{ts.Variables.port} -H "Host: 127.0.0.1:{server.Variables.Port}" --verbose', uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/set-redirect-glob.gold" tr.StillRunningAfter = server diff --git a/tests/gold_tests/pluginTest/lua/lua_client_hook.test.py b/tests/gold_tests/pluginTest/lua/lua_client_hook.test.py index ef447943dfb..6e53564c9b0 100644 --- a/tests/gold_tests/pluginTest/lua/lua_client_hook.test.py +++ b/tests/gold_tests/pluginTest/lua/lua_client_hook.test.py @@ -50,7 +50,7 @@ # Test if watermark upstream is set tr = Test.AddTestRun("Lua Response Client Hook") -tr.MakeCurlCommand("-v http://127.0.0.1:{0}".format(ts.Variables.port)) +tr.MakeCurlCommand("-v http://127.0.0.1:{0}".format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(ts) diff --git a/tests/gold_tests/pluginTest/lua/lua_debug_tags.test.py b/tests/gold_tests/pluginTest/lua/lua_debug_tags.test.py index 1e7b611d2be..f7c4e38a27b 100644 --- a/tests/gold_tests/pluginTest/lua/lua_debug_tags.test.py +++ b/tests/gold_tests/pluginTest/lua/lua_debug_tags.test.py @@ -46,6 +46,6 @@ ps = tr.Processes.Default tr.StillRunningAfter = ts ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommandMulti(f"bash ./tags.sh {curl_and_args}") +tr.MakeCurlCommandMulti(f"bash ./tags.sh {curl_and_args}", uds_path=ts.Variables.uds_path) ps.Env = ts.Env ps.ReturnCode = 0 diff --git a/tests/gold_tests/pluginTest/lua/lua_header_table.test.py b/tests/gold_tests/pluginTest/lua/lua_header_table.test.py index 73c8dc7f86f..774df9b2dc5 100644 --- a/tests/gold_tests/pluginTest/lua/lua_header_table.test.py +++ b/tests/gold_tests/pluginTest/lua/lua_header_table.test.py @@ -34,7 +34,8 @@ tr = Test.AddTestRun("Lua Header Table") ps = tr.Processes.Default # alias ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(f"-s -D /dev/stderr -H 'X-Test: test1' -H 'X-Test: test2' http://127.0.0.1:{ts.Variables.port}") +tr.MakeCurlCommand( + f"-s -D /dev/stderr -H 'X-Test: test1' -H 'X-Test: test2' http://127.0.0.1:{ts.Variables.port}", uds_path=ts.Variables.uds_path) ps.Env = ts.Env ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("test1test2", "expected header table results") diff --git a/tests/gold_tests/pluginTest/lua/lua_states_stats.test.py b/tests/gold_tests/pluginTest/lua/lua_states_stats.test.py index 0e79852c1b5..67388d9859e 100644 --- a/tests/gold_tests/pluginTest/lua/lua_states_stats.test.py +++ b/tests/gold_tests/pluginTest/lua/lua_states_stats.test.py @@ -74,7 +74,7 @@ # 1 Test - Exercise lua script tr = Test.AddTestRun("Lua hello") ps = tr.Processes.Default # alias -tr.MakeCurlCommand(curl_and_args + ' http://hello/hello') +tr.MakeCurlCommand(curl_and_args + ' http://hello/hello', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr.Content = Testers.ContainsExpression("Hello, World", "hello world content") tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/lua/lua_watermark.test.py b/tests/gold_tests/pluginTest/lua/lua_watermark.test.py index ca82e1fba83..7ad3f257ceb 100644 --- a/tests/gold_tests/pluginTest/lua/lua_watermark.test.py +++ b/tests/gold_tests/pluginTest/lua/lua_watermark.test.py @@ -49,7 +49,7 @@ # Test if watermark upstream is set tr = Test.AddTestRun("Lua Watermark") -tr.MakeCurlCommand("-v http://127.0.0.1:{0}".format(ts.Variables.port)) +tr.MakeCurlCommand("-v http://127.0.0.1:{0}".format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(ts) diff --git a/tests/gold_tests/pluginTest/money_trace/money_trace.test.py b/tests/gold_tests/pluginTest/money_trace/money_trace.test.py index b0a656d6af5..cb03feb44b7 100644 --- a/tests/gold_tests/pluginTest/money_trace/money_trace.test.py +++ b/tests/gold_tests/pluginTest/money_trace/money_trace.test.py @@ -78,7 +78,7 @@ ps = tr.Processes.Default ps.StartBefore(server) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(curl_and_args + " http://none/path") +tr.MakeCurlCommand(curl_and_args + " http://none/path", uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -86,7 +86,7 @@ # 1 Test tr = Test.AddTestRun("basic config, no money trace client header") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + " http://basic/path") +tr.MakeCurlCommand(curl_and_args + " http://basic/path", uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -99,7 +99,8 @@ def maketrace(name): # 2 Test tr = Test.AddTestRun("basic config, money trace client header") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://basic/path -H "X-MoneyTrace: ' + maketrace("basic") + '"') +tr.MakeCurlCommand( + curl_and_args + ' http://basic/path -H "X-MoneyTrace: ' + maketrace("basic") + '"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -107,7 +108,7 @@ def maketrace(name): # 3 Test tr = Test.AddTestRun("header config, mt client header") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://header/path -H "mt: ' + maketrace("header") + '"') +tr.MakeCurlCommand(curl_and_args + ' http://header/path -H "mt: ' + maketrace("header") + '"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -115,7 +116,7 @@ def maketrace(name): # 4 Test tr = Test.AddTestRun("pregen config, but no header passed in") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://pregen/path') +tr.MakeCurlCommand(curl_and_args + ' http://pregen/path', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -123,7 +124,8 @@ def maketrace(name): # 5 Test tr = Test.AddTestRun("pregen config, money trace client header") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://pregen/path -H "X-MoneyTrace: ' + maketrace("pregen") + '"') +tr.MakeCurlCommand( + curl_and_args + ' http://pregen/path -H "X-MoneyTrace: ' + maketrace("pregen") + '"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -131,7 +133,7 @@ def maketrace(name): # 6 Test tr = Test.AddTestRun("pregen config, mt client header") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://pgh/path -H "mt: ' + maketrace("pgh") + '"') +tr.MakeCurlCommand(curl_and_args + ' http://pgh/path -H "mt: ' + maketrace("pgh") + '"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -139,7 +141,7 @@ def maketrace(name): # 7 Test tr = Test.AddTestRun("create config, money trace client header") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://create/path') +tr.MakeCurlCommand(curl_and_args + ' http://create/path', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -147,7 +149,7 @@ def maketrace(name): # 8 Test tr = Test.AddTestRun("create config, mt client header") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://cheader/path') +tr.MakeCurlCommand(curl_and_args + ' http://cheader/path', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -155,7 +157,7 @@ def maketrace(name): # 9 Test tr = Test.AddTestRun("create config, pregen client header") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://cpregen/path') +tr.MakeCurlCommand(curl_and_args + ' http://cpregen/path', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -163,7 +165,8 @@ def maketrace(name): # 10 Test tr = Test.AddTestRun("passthru mode") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://passthru/path -H "X-MoneyTrace: ' + maketrace("passthru") + '"') +tr.MakeCurlCommand( + curl_and_args + ' http://passthru/path -H "X-MoneyTrace: ' + maketrace("passthru") + '"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -183,7 +186,7 @@ def maketrace(name): for trace in trace_strings: tr = Test.AddTestRun(trace) ps = tr.Processes.Default - tr.MakeCurlCommand(curl_and_args + ' http://pregen/path -H "X-MoneyTrace: ' + trace + '"') + tr.MakeCurlCommand(curl_and_args + ' http://pregen/path -H "X-MoneyTrace: ' + trace + '"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -192,7 +195,7 @@ def maketrace(name): for trace in trace_strings: tr = Test.AddTestRun(trace) ps = tr.Processes.Default - tr.MakeCurlCommand(curl_and_args + ' http://cpregen/path -H "X-MoneyTrace: ' + trace + '"') + tr.MakeCurlCommand(curl_and_args + ' http://cpregen/path -H "X-MoneyTrace: ' + trace + '"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server diff --git a/tests/gold_tests/pluginTest/money_trace/money_trace_global.test.py b/tests/gold_tests/pluginTest/money_trace/money_trace_global.test.py index 140cfce67aa..7a532a7e29e 100644 --- a/tests/gold_tests/pluginTest/money_trace/money_trace_global.test.py +++ b/tests/gold_tests/pluginTest/money_trace/money_trace_global.test.py @@ -77,7 +77,7 @@ ps = tr.Processes.Default ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(curl_and_args + ' http://ats/path -H "MoneyTrace: ' + clientvalue + '"') +tr.MakeCurlCommand(curl_and_args + ' http://ats/path -H "MoneyTrace: ' + clientvalue + '"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -85,7 +85,7 @@ # 1 Test tr = Test.AddTestRun("skip plugin test - pregen will still be set") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://ats/path -H "Skip-Global-MoneyTrace: true"') +tr.MakeCurlCommand(curl_and_args + ' http://ats/path -H "Skip-Global-MoneyTrace: true"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server @@ -93,7 +93,7 @@ # 2 Test tr = Test.AddTestRun("create header test") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://ats/path') +tr.MakeCurlCommand(curl_and_args + ' http://ats/path', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server diff --git a/tests/gold_tests/pluginTest/origin_server_auth/origin_server_auth.test.py b/tests/gold_tests/pluginTest/origin_server_auth/origin_server_auth.test.py index 22f8014431f..a3164520d98 100644 --- a/tests/gold_tests/pluginTest/origin_server_auth/origin_server_auth.test.py +++ b/tests/gold_tests/pluginTest/origin_server_auth/origin_server_auth.test.py @@ -97,7 +97,9 @@ def test_s3_origin_remap(self): Test s3 v4 origin server ''' tr = Test.AddTestRun() - tr.MakeCurlCommand(f'-s -v -H "Host: www.example.com" http://127.0.0.1:{self.ts.Variables.port}/s3-bucket;') + tr.MakeCurlCommand( + f'-s -v -H "Host: www.example.com" http://127.0.0.1:{self.ts.Variables.port}/s3-bucket;', + uds_path=self.ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(self.server) tr.Processes.Default.StartBefore(self.ts) @@ -110,7 +112,8 @@ def test_gcp_origin_remap(self): Test GCP origin server ''' tr = Test.AddTestRun() - tr.MakeCurlCommand(f'-s -v -H "Host: www.example.com" http://127.0.0.1:{self.ts.Variables.port}/gcp;') + tr.MakeCurlCommand( + f'-s -v -H "Host: www.example.com" http://127.0.0.1:{self.ts.Variables.port}/gcp;', uds_path=self.ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr.Content = Testers.ContainsExpression("200 OK", "expected 200 response") tr.Processes.Default.Streams.stderr.Content += Testers.ContainsExpression("Content-Length: 8", "expected content-length 8") diff --git a/tests/gold_tests/pluginTest/polite_hook_wait/polite_hook_wait.test.py b/tests/gold_tests/pluginTest/polite_hook_wait/polite_hook_wait.test.py index ec2aa9f67c3..4b3eccdad9b 100644 --- a/tests/gold_tests/pluginTest/polite_hook_wait/polite_hook_wait.test.py +++ b/tests/gold_tests/pluginTest/polite_hook_wait/polite_hook_wait.test.py @@ -20,7 +20,6 @@ Test spawning a thread in a transaction hook continuation, and getting a result from it, without blocking event task. ''' -Test.SkipIf(Condition.CurlUds()) plugin_name = "polite_hook_wait" server = Test.MakeOriginServer("server") @@ -48,14 +47,22 @@ ts.Disk.remap_config.AddLine("map http://myhost.test http://127.0.0.1:{0}".format(server.Variables.Port)) +ipv4flag = "" +if not Condition.CurlUsingUnixDomainSocket(): + ipv4flag = "--ipv4" + tr = Test.AddTestRun() tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(ts) -tr.MakeCurlCommand('--verbose --ipv4 --header "Host:myhost.test" http://localhost:{}/ 2>curl.txt'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '--verbose {0} --header "Host:myhost.test" http://localhost:{1}/ 2>curl.txt'.format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() -tr.MakeCurlCommand('--verbose --ipv4 --header "Host:myhost.test" http://localhost:{}/ 2>curl.txt'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '--verbose {0} --header "Host:myhost.test" http://localhost:{1}/ 2>curl.txt'.format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() diff --git a/tests/gold_tests/pluginTest/polite_hook_wait/polite_hook_wait_uds.test.py b/tests/gold_tests/pluginTest/polite_hook_wait/polite_hook_wait_uds.test.py deleted file mode 100644 index 2b0d75bbfde..00000000000 --- a/tests/gold_tests/pluginTest/polite_hook_wait/polite_hook_wait_uds.test.py +++ /dev/null @@ -1,63 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -Test.Summary = ''' -Test spawning a thread in a transaction hook continuation, and getting a result from it, without blocking event task. -''' - -plugin_name = "polite_hook_wait" - -server = Test.MakeOriginServer("server") - -request_header = {"headers": "GET / HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": "112233"} -server.addResponse("sessionlog.json", request_header, response_header) - -# Disable the cache to make sure each request is forwarded to the origin -# server. -ts = Test.MakeATSProcess("ts", enable_cache=False, block_for_debug=False) - -ts.Disk.records_config.update( - { - 'proxy.config.proxy_name': 'Poxy_Proxy', # This will be the server name. - 'proxy.config.url_remap.remap_required': 1, - 'proxy.config.diags.debug.enabled': 3, - 'proxy.config.diags.debug.tags': f'{plugin_name}', - }) - -rp = os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'pluginTest', 'polite_hook_wait', '.libs', f'{plugin_name}.so') -ts.Setup.Copy(rp, ts.Env['PROXY_CONFIG_PLUGIN_PLUGIN_DIR']) - -ts.Disk.plugin_config.AddLine(f"{plugin_name}.so") - -ts.Disk.remap_config.AddLine("map http://myhost.test http://127.0.0.1:{0}".format(server.Variables.Port)) - -tr = Test.AddTestRun() -tr.Processes.Default.StartBefore(server) -tr.Processes.Default.StartBefore(ts) -tr.MakeCurlCommand('--verbose --header "Host:myhost.test" http://localhost:{}/ 2>curl.txt'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 - -tr = Test.AddTestRun() -tr.MakeCurlCommand('--verbose --header "Host:myhost.test" http://localhost:{}/ 2>curl.txt'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 - -tr = Test.AddTestRun() -tr.Processes.Default.Command = "grep -F HTTP/ curl.txt" -tr.Processes.Default.Streams.stdout = "curl.gold" -tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/pluginTest/prefetch/prefetch_bignum.test.py b/tests/gold_tests/pluginTest/prefetch/prefetch_bignum.test.py index e32768230ad..e3577f99008 100644 --- a/tests/gold_tests/pluginTest/prefetch/prefetch_bignum.test.py +++ b/tests/gold_tests/pluginTest/prefetch/prefetch_bignum.test.py @@ -67,7 +67,9 @@ tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() -tr.MakeCurlCommand(f'--verbose --proxy 127.0.0.1:{ts.Variables.port} http://domain.in/texts/demo-3842948374928374982374982374.txt') +tr.MakeCurlCommand( + f'--verbose --proxy 127.0.0.1:{ts.Variables.port} http://domain.in/texts/demo-3842948374928374982374982374.txt', + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 Test.AddAwaitFileContainsTestRun('Await transactions to finish logging.', ts.Disk.traffic_out.Name, '3842948374928374982374982377') diff --git a/tests/gold_tests/pluginTest/prefetch/prefetch_cmcd.test.py b/tests/gold_tests/pluginTest/prefetch/prefetch_cmcd.test.py index 2f81d3a5d94..6137242a935 100644 --- a/tests/gold_tests/pluginTest/prefetch/prefetch_cmcd.test.py +++ b/tests/gold_tests/pluginTest/prefetch/prefetch_cmcd.test.py @@ -227,50 +227,61 @@ # attempt to get normal asset tr = Test.AddTestRun() -tr.MakeCurlCommand(f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} http://ts0/tests/{asset_name}") +tr.MakeCurlCommand( + f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} http://ts0/tests/{asset_name}", uds_path=ts0.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 # issue curl form same asset, with prefetch tr = Test.AddTestRun() tr.DelayStart = 1 -tr.MakeCurlCommand(f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} http://ts0/tests/{asset_name} -H \'{pf_header}\'") +tr.MakeCurlCommand( + f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} http://ts0/tests/{asset_name} -H \'{pf_header}\'", + uds_path=ts0.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 # fetch the prefetched asset (only cached on ts1) tr = Test.AddTestRun() tr.DelayStart = 1 -tr.MakeCurlCommand(f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} http://ts0/tests/{pf_name}") +tr.MakeCurlCommand(f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} http://ts0/tests/{pf_name}", uds_path=ts0.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 # attempt to prefetch again tr = Test.AddTestRun() -tr.MakeCurlCommand(f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} http://ts0/tests/{asset_name} -H \'{pf_header}\'") +tr.MakeCurlCommand( + f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} http://ts0/tests/{asset_name} -H \'{pf_header}\'", + uds_path=ts0.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 # request the prefetched asset tr = Test.AddTestRun() -tr.MakeCurlCommand(f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} http://ts0/tests/{pf_name}") +tr.MakeCurlCommand(f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} http://ts0/tests/{pf_name}", uds_path=ts0.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 # prefetch using query params with query prefetch perc encoded tr = Test.AddTestRun() tr.MakeCurlCommand( - f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} \'http://ts0/tests/{query_name}\' -H \'{query_pf_perc_header}\'") + f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} \'http://ts0/tests/{query_name}\' -H \'{query_pf_perc_header}\'", + uds_path=ts0.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 # request the prefetched asset without perc encoding tr = Test.AddTestRun() -tr.MakeCurlCommand(f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} \'http://ts0/tests/{query_pf_name}\'") +tr.MakeCurlCommand( + f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} \'http://ts0/tests/{query_pf_name}\'", uds_path=ts0.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 # ensure root path prefetch works tr = Test.AddTestRun() -tr.MakeCurlCommand(f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} \'http://ts0/{root_name}\' -H \'{root_header}\'") +tr.MakeCurlCommand( + f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} \'http://ts0/{root_name}\' -H \'{root_header}\'", + uds_path=ts0.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 # ensure request with nrr= field is skipped tr = Test.AddTestRun() -tr.MakeCurlCommand(f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} \'http://ts0/{crr_name}\' -H \'{crr_header}\'") +tr.MakeCurlCommand( + f"--verbose --proxy 127.0.0.1:{ts0.Variables.port} \'http://ts0/{crr_name}\' -H \'{crr_header}\'", + uds_path=ts0.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 condwaitpath = os.path.join(Test.Variables.AtsTestToolsDir, 'condwait') diff --git a/tests/gold_tests/pluginTest/prefetch/prefetch_overflow.test.py b/tests/gold_tests/pluginTest/prefetch/prefetch_overflow.test.py index ccdf0712bb2..332be8539a9 100644 --- a/tests/gold_tests/pluginTest/prefetch/prefetch_overflow.test.py +++ b/tests/gold_tests/pluginTest/prefetch/prefetch_overflow.test.py @@ -64,7 +64,9 @@ tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() -tr.MakeCurlCommand(f'--verbose --proxy 127.0.0.1:{ts.Variables.port} http://domain.in/texts/demo-3594967639391.txt') +tr.MakeCurlCommand( + f'--verbose --proxy 127.0.0.1:{ts.Variables.port} http://domain.in/texts/demo-3594967639391.txt', + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 Test.AddAwaitFileContainsTestRun('Await transactions to finish logging.', ts.Disk.traffic_out.Name, '3594967639394') diff --git a/tests/gold_tests/pluginTest/prefetch/prefetch_simple.test.py b/tests/gold_tests/pluginTest/prefetch/prefetch_simple.test.py index 1474eaa8794..28792e1a7d4 100644 --- a/tests/gold_tests/pluginTest/prefetch/prefetch_simple.test.py +++ b/tests/gold_tests/pluginTest/prefetch/prefetch_simple.test.py @@ -64,7 +64,8 @@ tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() -tr.MakeCurlCommand(f'--verbose --proxy 127.0.0.1:{ts.Variables.port} http://domain.in/texts/demo-1.txt') +tr.MakeCurlCommand( + f'--verbose --proxy 127.0.0.1:{ts.Variables.port} http://domain.in/texts/demo-1.txt', uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 Test.AddAwaitFileContainsTestRun('Await transactions to finish logging.', ts.Disk.traffic_out.Name, 'demo-4.txt') diff --git a/tests/gold_tests/pluginTest/regex_remap/regex_remap.test.py b/tests/gold_tests/pluginTest/regex_remap/regex_remap.test.py index b32bf40cc78..e86d51376c7 100644 --- a/tests/gold_tests/pluginTest/regex_remap/regex_remap.test.py +++ b/tests/gold_tests/pluginTest/regex_remap/regex_remap.test.py @@ -93,7 +93,8 @@ tr.Processes.Default.StartBefore(nameserver) tr.Processes.Default.StartBefore(Test.Processes.ts) creq = replay_txns[0]['client-request'] -tr.MakeCurlCommand(curl_and_args + '--header "uuid: {}" '.format(creq["headers"]["fields"][1][1]) + creq["url"]) +tr.MakeCurlCommand( + curl_and_args + '--header "uuid: {}" '.format(creq["headers"]["fields"][1][1]) + creq["url"], uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/regex_remap_smoke.gold" tr.StillRunningAfter = ts @@ -102,7 +103,8 @@ tr = Test.AddTestRun("pristine test") tr.MakeCurlCommand( curl_and_args + "'http://example.two/alpha/bravo/?action=newsfed;param0001=00003E;param0002=00004E;param0003=00005E'" + - f" | grep -e '^HTTP/' -e '^Location' | sed 's/{server.Variables.Port}/SERVER_PORT/'") + f" | grep -e '^HTTP/' -e '^Location' | sed 's/{server.Variables.Port}/SERVER_PORT/'", + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/regex_remap_redirect.gold" tr.StillRunningAfter = ts @@ -112,7 +114,8 @@ tr.MakeCurlCommand( curl_and_args + '--header "uuid: {}" '.format(creq["headers"]["fields"][1][1]) + " 'http://example.three/alpha/bravo/?action=newsfed;param0001=00003E;param0002=00004E;param0003=00005E'" + - " | grep -e '^HTTP/' -e '^Content-Length'") + " | grep -e '^HTTP/' -e '^Content-Length'", + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/regex_remap_simple.gold" tr.StillRunningAfter = ts @@ -121,7 +124,7 @@ tr = Test.AddTestRun("crash test") creq = replay_txns[1]['client-request'] tr.MakeCurlCommand(curl_and_args + \ - '--header "uuid: {}" '.format(creq["headers"]["fields"][1][1]) + '"{}"'.format(creq["url"])) + '--header "uuid: {}" '.format(creq["headers"]["fields"][1][1]) + '"{}"'.format(creq["url"]), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/regex_remap_crash.gold" ts.Disk.diags_log.Content = Testers.ContainsExpression( diff --git a/tests/gold_tests/pluginTest/regex_revalidate/regex_revalidate.test.py b/tests/gold_tests/pluginTest/regex_revalidate/regex_revalidate.test.py index adc9291ed1b..910b4c6edee 100644 --- a/tests/gold_tests/pluginTest/regex_revalidate/regex_revalidate.test.py +++ b/tests/gold_tests/pluginTest/regex_revalidate/regex_revalidate.test.py @@ -136,7 +136,7 @@ ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) ps.StartBefore(Test.Processes.ts) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path1'.format(ts.Variables.port)) +tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path1'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss response") tr.StillRunningAfter = ts @@ -144,7 +144,7 @@ # 1 Test - Load cache (miss) for later test (path1a) tr = Test.AddTestRun("Cache miss path1a") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path1a'.format(ts.Variables.port)) +tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path1a'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss response") tr.StillRunningAfter = ts @@ -152,7 +152,7 @@ # 2 Test - Load cache (miss) for later test (path2a) tr = Test.AddTestRun("Cache miss path2a") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path2a'.format(ts.Variables.port)) +tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path2a'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss response") tr.StillRunningAfter = ts @@ -160,7 +160,7 @@ # 3 Test - Cache hit path1 tr = Test.AddTestRun("Cache hit fresh path1") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path1'.format(ts.Variables.port)) +tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path1'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-fresh", "expected cache hit fresh response") tr.StillRunningAfter = ts @@ -186,7 +186,7 @@ tr = Test.AddTestRun("Revalidate stale path1") ps = tr.Processes.Default tr.DelayStart = 5 -tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path1'.format(ts.Variables.port)) +tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path1'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-stale", "expected cache hit stale response") tr.StillRunningAfter = ts @@ -194,7 +194,7 @@ # 6 Test - Cache hit (path1) tr = Test.AddTestRun("Cache hit fresh path1") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path1'.format(ts.Variables.port)) +tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path1'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-fresh", "expected cache hit fresh response") tr.StillRunningAfter = ts @@ -221,7 +221,7 @@ tr = Test.AddTestRun("Cache hit fresh path1") tr.DelayStart = 5 ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path1'.format(ts.Variables.port)) +tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path1'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-fresh", "expected cache hit fresh response") tr.StillRunningAfter = ts @@ -229,7 +229,7 @@ # 9 Test - Cache stale (check rule is still loaded) (path1a) tr = Test.AddTestRun("Revalidate stale path1a") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path1a'.format(ts.Variables.port)) +tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path1a'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-stale", "expected cache hit stale response") tr.StillRunningAfter = ts @@ -259,7 +259,7 @@ tr = Test.AddTestRun("Cache hit stale path2a") tr.DelayStart = 5 ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path2a'.format(ts.Variables.port)) +tr.MakeCurlCommand(curl_and_args + ' http://127.0.0.1:{}/path2a'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-stale", "expected cache hit stale response") tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/regex_revalidate/regex_revalidate_miss.test.py b/tests/gold_tests/pluginTest/regex_revalidate/regex_revalidate_miss.test.py index 788c8a2361e..c6e029c44f8 100644 --- a/tests/gold_tests/pluginTest/regex_revalidate/regex_revalidate_miss.test.py +++ b/tests/gold_tests/pluginTest/regex_revalidate/regex_revalidate_miss.test.py @@ -101,7 +101,7 @@ ps = tr.Processes.Default ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(curl_and_args + ' http://ats/path1') +tr.MakeCurlCommand(curl_and_args + ' http://ats/path1', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss response") tr.StillRunningAfter = ts @@ -109,7 +109,7 @@ # 1 Request, cache hit expected tr = Test.AddTestRun("Cache hit fresh path1") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://ats/path1') +tr.MakeCurlCommand(curl_and_args + ' http://ats/path1', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-fresh", "expected cache hit fresh response") tr.StillRunningAfter = ts @@ -133,7 +133,7 @@ tr = Test.AddTestRun("Revalidate MISS path1") ps = tr.Processes.Default tr.DelayStart = 7 -tr.MakeCurlCommand(curl_and_args + ' http://ats/path1') +tr.MakeCurlCommand(curl_and_args + ' http://ats/path1', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss response") tr.StillRunningAfter = ts @@ -141,7 +141,7 @@ # 4 Request, cache hit (path1) tr = Test.AddTestRun("Cache hit fresh path1") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://ats/path1') +tr.MakeCurlCommand(curl_and_args + ' http://ats/path1', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-fresh", "expected cache hit fresh response") tr.StillRunningAfter = ts @@ -164,7 +164,7 @@ tr = Test.AddTestRun("Cache stale path1") ps = tr.Processes.Default tr.DelayStart = 7 -tr.MakeCurlCommand(curl_and_args + ' http://ats/path1') +tr.MakeCurlCommand(curl_and_args + ' http://ats/path1', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-stale", "expected cache hit stale response") tr.StillRunningAfter = ts @@ -187,7 +187,7 @@ tr = Test.AddTestRun("Cache mis path1") ps = tr.Processes.Default tr.DelayStart = 7 -tr.MakeCurlCommand(curl_and_args + ' http://ats/path1') +tr.MakeCurlCommand(curl_and_args + ' http://ats/path1', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss response") tr.StillRunningAfter = ts @@ -196,7 +196,7 @@ tr = Test.AddTestRun("Cache hit path1") ps = tr.Processes.Default tr.DelayStart = 5 -tr.MakeCurlCommand(curl_and_args + ' http://ats/path1') +tr.MakeCurlCommand(curl_and_args + ' http://ats/path1', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-fresh", "expected cache hit response") tr.StillRunningAfter = ts @@ -217,7 +217,7 @@ tr = Test.AddTestRun("Cache hit path1") ps = tr.Processes.Default tr.DelayStart = 7 -tr.MakeCurlCommand(curl_and_args + ' http://ats/path1') +tr.MakeCurlCommand(curl_and_args + ' http://ats/path1', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-fresh", "expected cache hit response") tr.StillRunningAfter = ts @@ -237,7 +237,7 @@ tr = Test.AddTestRun("Cache hit path1") ps = tr.Processes.Default tr.DelayStart = 5 -tr.MakeCurlCommand(curl_and_args + ' http://ats/path1') +tr.MakeCurlCommand(curl_and_args + ' http://ats/path1', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit-fresh", "expected cache hit response") tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/remap_stats/remap_stats.test.py b/tests/gold_tests/pluginTest/remap_stats/remap_stats.test.py index c7b3b875f1d..f53f95cc645 100644 --- a/tests/gold_tests/pluginTest/remap_stats/remap_stats.test.py +++ b/tests/gold_tests/pluginTest/remap_stats/remap_stats.test.py @@ -46,14 +46,16 @@ tr = Test.AddTestRun("curl host one") tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand('-o /dev/null -H "Host: one"' + ' http://127.0.0.1:{}/argh'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '-o /dev/null -H "Host: one"' + ' http://127.0.0.1:{}/argh'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server # 1 Test - Curl host Two tr = Test.AddTestRun("curl host two") -tr.MakeCurlCommand('-o /dev/null -H "Host: two"' + ' http://127.0.0.1:{}/badpath'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '-o /dev/null -H "Host: two"' + ' http://127.0.0.1:{}/badpath'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server diff --git a/tests/gold_tests/pluginTest/remap_stats/remap_stats_post.test.py b/tests/gold_tests/pluginTest/remap_stats/remap_stats_post.test.py index b72cf793283..a6f44858908 100644 --- a/tests/gold_tests/pluginTest/remap_stats/remap_stats_post.test.py +++ b/tests/gold_tests/pluginTest/remap_stats/remap_stats_post.test.py @@ -46,14 +46,16 @@ tr = Test.AddTestRun("curl host one") tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand('-o /dev/null -H "Host: one"' + ' http://127.0.0.1:{}/argh'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '-o /dev/null -H "Host: one"' + ' http://127.0.0.1:{}/argh'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server # 1 Test - Curl host Two tr = Test.AddTestRun("curl host two") -tr.MakeCurlCommand('-o /dev/null -H "Host: two"' + ' http://127.0.0.1:{}/badpath'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '-o /dev/null -H "Host: two"' + ' http://127.0.0.1:{}/badpath'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server diff --git a/tests/gold_tests/pluginTest/slice/slice.test.py b/tests/gold_tests/pluginTest/slice/slice.test.py index 30ddff49731..156c631d7b2 100644 --- a/tests/gold_tests/pluginTest/slice/slice.test.py +++ b/tests/gold_tests/pluginTest/slice/slice.test.py @@ -89,7 +89,7 @@ ps = tr.Processes.Default ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(curl_and_args + ' http://preload/path') +tr.MakeCurlCommand(curl_and_args + ' http://preload/path', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/slice_200.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK response") @@ -98,7 +98,7 @@ # 1 Test - First complete slice tr = Test.AddTestRun("Fetch first slice range") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/path' + ' -r 0-6') +tr.MakeCurlCommand(curl_and_args + ' http://slice/path' + ' -r 0-6', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/slice_first.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("206 Partial Content", "expected 206 response") @@ -108,7 +108,7 @@ # 2 Test - Last slice auto tr = Test.AddTestRun("Last slice -- 14-") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/path' + ' -r 14-') +tr.MakeCurlCommand(curl_and_args + ' http://slice/path' + ' -r 14-', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/slice_last.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("206 Partial Content", "expected 206 response") @@ -118,7 +118,7 @@ # 3 Test - Last slice exact tr = Test.AddTestRun("Last slice 14-17") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/path' + ' -r 14-17') +tr.MakeCurlCommand(curl_and_args + ' http://slice/path' + ' -r 14-17', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/slice_last.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("206 Partial Content", "expected 206 response") @@ -128,7 +128,7 @@ # 4 Test - Last slice truncated tr = Test.AddTestRun("Last truncated slice 14-20") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/path' + ' -r 14-20') +tr.MakeCurlCommand(curl_and_args + ' http://slice/path' + ' -r 14-20', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/slice_last.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("206 Partial Content", "expected 206 response") @@ -138,7 +138,7 @@ # 5 Test - Whole asset via slices tr = Test.AddTestRun("Whole asset via slices") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/path') +tr.MakeCurlCommand(curl_and_args + ' http://slice/path', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/slice_200.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK response") @@ -147,7 +147,7 @@ # 6 Test - Whole asset via range tr = Test.AddTestRun("Whole asset via range") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/path' + ' -r 0-') +tr.MakeCurlCommand(curl_and_args + ' http://slice/path' + ' -r 0-', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/slice_206.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("206 Partial Content", "expected 206 response") @@ -157,7 +157,7 @@ # 7 Test - Non aligned slice request tr = Test.AddTestRun("Non aligned slice request") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/path' + ' -r 5-16') +tr.MakeCurlCommand(curl_and_args + ' http://slice/path' + ' -r 5-16', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/slice_mid.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("206 Partial Content", "expected 206 response") @@ -169,7 +169,7 @@ beg = len(body) + 1 end = beg + block_bytes ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/path' + ' -r {}-{}'.format(beg, end)) +tr.MakeCurlCommand(curl_and_args + ' http://slice/path' + ' -r {}-{}'.format(beg, end), uds_path=ts.Variables.uds_path) ps.Streams.stdout.Content = Testers.ContainsExpression("416 Requested Range Not Satisfiable", "expected 416 response") tr.StillRunningAfter = ts @@ -177,7 +177,7 @@ # if this fails it will infinite loop tr = Test.AddTestRun("Fetch first slice range") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slicehdr/path' + ' -r 0-6') +tr.MakeCurlCommand(curl_and_args + ' http://slicehdr/path' + ' -r 0-6', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/slice_first.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("206 Partial Content", "expected 206 response") diff --git a/tests/gold_tests/pluginTest/slice/slice_conditional.test.py b/tests/gold_tests/pluginTest/slice/slice_conditional.test.py index 023cd494c53..1e797eb4c3c 100644 --- a/tests/gold_tests/pluginTest/slice/slice_conditional.test.py +++ b/tests/gold_tests/pluginTest/slice/slice_conditional.test.py @@ -104,7 +104,7 @@ ps = tr.Processes.Default ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(curl_and_args + ' http://slice/small') +tr.MakeCurlCommand(curl_and_args + ' http://slice/small', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr.Content = Testers.ContainsExpression('smol', 'expected smol') ps.Streams.stdout.Content = Testers.ContainsExpression('X-Cache: miss', 'expected cache miss') @@ -113,7 +113,7 @@ # Test case: second request of small object - expect cache hit tr = Test.AddTestRun("Small request 2") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/small') +tr.MakeCurlCommand(curl_and_args + ' http://slice/small', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr.Content = Testers.ContainsExpression('smol', 'expected smol') ps.Streams.stdout.Content = Testers.ContainsExpression('X-Cache: hit-fresh', 'expected cache hit-fresh') @@ -122,7 +122,7 @@ # Test case: range request of small object - expect cache hit (proxy.config.http.cache.range.lookup = 1) tr = Test.AddTestRun("Small request - ranged") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' -r 1-2 http://slice/small') +tr.MakeCurlCommand(curl_and_args + ' -r 1-2 http://slice/small', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr.Content = Testers.ContainsExpression('mo', 'expected mo') ps.Streams.stdout.Content = Testers.ContainsExpression('X-Cache: hit-fresh', 'expected cache hit-fresh') @@ -131,7 +131,7 @@ # Test case: first request of large object - expect unsliced, cache write disabled tr = Test.AddTestRun("Large request 1") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/large') +tr.MakeCurlCommand(curl_and_args + ' http://slice/large', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr.Content = Testers.ContainsExpression('unsliced large object!', 'expected large object') ps.Streams.stdout.Content = Testers.ContainsExpression('X-Cache: miss', 'expected cache miss') @@ -140,7 +140,7 @@ # Test case: first request of large object - expect sliced, cache miss tr = Test.AddTestRun("Large request 2") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/large') +tr.MakeCurlCommand(curl_and_args + ' http://slice/large', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr.Content = Testers.ContainsExpression('large object sliced!', 'expected large object') ps.Streams.stdout.Content = Testers.ContainsExpression('X-Cache: miss', 'expected cache miss') @@ -149,7 +149,7 @@ ## Test case: first request of large object - expect cache hit tr = Test.AddTestRun("Large request 3") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/large') +tr.MakeCurlCommand(curl_and_args + ' http://slice/large', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr.Content = Testers.ContainsExpression('large object sliced!', 'expected large object') ps.Streams.stdout.Content = Testers.ContainsExpression('X-Cache: hit-fresh', 'expected cache hit-fresh') diff --git a/tests/gold_tests/pluginTest/slice/slice_crr_ident.test.py b/tests/gold_tests/pluginTest/slice/slice_crr_ident.test.py index 6440ac9d694..715364163ef 100644 --- a/tests/gold_tests/pluginTest/slice/slice_crr_ident.test.py +++ b/tests/gold_tests/pluginTest/slice/slice_crr_ident.test.py @@ -132,7 +132,7 @@ ps = tr.Processes.Default ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(curl_and_args + ' http://slice/plain -H "UID: plain"') +tr.MakeCurlCommand(curl_and_args + ' http://slice/plain -H "UID: plain"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr.Content = Testers.ContainsExpression("aaaBB", "expected aaaBB") ps.Streams.stdout.Content = Testers.ContainsExpression('Etag: "plain"', "expected etag plain") @@ -142,7 +142,7 @@ tr = Test.AddTestRun("Request 2nd slice (expect slice1 to be fresh)") tr.DelayStart = 2 # ensure its really stale ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/plain -H "UID: plain"') +tr.MakeCurlCommand(curl_and_args + ' http://slice/plain -H "UID: plain"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = Testers.ContainsExpression("aaaBB", "expected aaaBB") ps.Streams.stdout.Content = Testers.ContainsExpression('Etag: "plain"', "expected etag plain") @@ -186,7 +186,7 @@ tr = Test.AddTestRun("Request again, asset replaced") tr.DelayStart = 2 # ensure its really stale ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/plain -H "UID: chg"') +tr.MakeCurlCommand(curl_and_args + ' http://slice/plain -H "UID: chg"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = Testers.ContainsExpression("AAAbb", "expected AAAbb") ps.Streams.stdout.Content = Testers.ContainsExpression('Etag: "chg"', "expected etag chg") @@ -196,7 +196,7 @@ tr = Test.AddTestRun("Request again, asset replaced but hit") tr.DelayStart = 2 # ensure its really stale ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/plain -H "UID: chg"') +tr.MakeCurlCommand(curl_and_args + ' http://slice/plain -H "UID: chg"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = Testers.ContainsExpression("AAAbb", "expected AAAbb") ps.Streams.stdout.Content = Testers.ContainsExpression('Etag: "chg"', "expected etag chg") @@ -205,7 +205,7 @@ # 5 Test - add token to transaction log tr = Test.AddTestRun("Fetch 404.txt asset") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://crr/404.txt') +tr.MakeCurlCommand(curl_and_args + ' http://crr/404.txt', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("404", "expected 404 Not Found response") tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/slice/slice_error.test.py b/tests/gold_tests/pluginTest/slice/slice_error.test.py index 8db1d0e2b83..464caff9a3f 100644 --- a/tests/gold_tests/pluginTest/slice/slice_error.test.py +++ b/tests/gold_tests/pluginTest/slice/slice_error.test.py @@ -257,7 +257,7 @@ ps = tr.Processes.Default ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(curl_and_args + ' http://ats/etag') +tr.MakeCurlCommand(curl_and_args + ' http://ats/etag', uds_path=ts.Variables.uds_path) # ps.ReturnCode = 0 # curl will return fail status ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK response") ps.Streams.stderr = "gold_error/contents.stderr.gold" @@ -273,7 +273,7 @@ # 2 Test - Last Modified mismatch test tr = Test.AddTestRun("Last-Modified test") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://ats/lastmodified') +tr.MakeCurlCommand(curl_and_args + ' http://ats/lastmodified', uds_path=ts.Variables.uds_path) # ps.ReturnCode = 0 # curl will return fail status ps.Streams.stderr = "gold_error/contents.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK response") @@ -289,7 +289,7 @@ # 4 Test - Block content-range tr = Test.AddTestRun("Content-Range test") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://ats/crr') +tr.MakeCurlCommand(curl_and_args + ' http://ats/crr', uds_path=ts.Variables.uds_path) # ps.ReturnCode = 0 # curl will return fail status ps.Streams.stderr = "gold_error/contents.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK response") @@ -305,7 +305,7 @@ # 6 Test - 404 internal test tr = Test.AddTestRun("Internal 404 test") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://ats/internal404') +tr.MakeCurlCommand(curl_and_args + ' http://ats/internal404', uds_path=ts.Variables.uds_path) # ps.ReturnCode = 0 # curl will return fail status ps.Streams.stderr = "gold_error/contents.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK response") diff --git a/tests/gold_tests/pluginTest/slice/slice_ident.test.py b/tests/gold_tests/pluginTest/slice/slice_ident.test.py index 670b24b8e53..bfa0d0c550a 100644 --- a/tests/gold_tests/pluginTest/slice/slice_ident.test.py +++ b/tests/gold_tests/pluginTest/slice/slice_ident.test.py @@ -123,7 +123,7 @@ ps = tr.Processes.Default ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(curl_and_args + ' http://preload/etag') +tr.MakeCurlCommand(curl_and_args + ' http://preload/etag', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK response") tr.StillRunningAfter = ts @@ -131,7 +131,7 @@ # 1 Test - Preload last-modified asset tr = Test.AddTestRun("Preload last-modified asset") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://preload/lm') +tr.MakeCurlCommand(curl_and_args + ' http://preload/lm', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK response") tr.StillRunningAfter = ts @@ -139,7 +139,7 @@ # 2 Test - Fetch etag asset tr = Test.AddTestRun("Fetch etag asset") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/etag') +tr.MakeCurlCommand(curl_and_args + ' http://slice/etag', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK response") tr.StillRunningAfter = ts @@ -147,7 +147,7 @@ # 3 Test - Fetch etag asset tr = Test.AddTestRun("Fetch etag asset, custom") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slicecustom/etag') +tr.MakeCurlCommand(curl_and_args + ' http://slicecustom/etag', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK response") tr.StillRunningAfter = ts @@ -155,7 +155,7 @@ # 4 Test - Fetch last-modified asset tr = Test.AddTestRun("Fetch last-modified asset, custom") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/lm') +tr.MakeCurlCommand(curl_and_args + ' http://slice/lm', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK response") tr.StillRunningAfter = ts @@ -163,7 +163,7 @@ # 5 Test - Fetch last-modified asset, custom tr = Test.AddTestRun("Fetch last-modified asset") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slicecustom/lm') +tr.MakeCurlCommand(curl_and_args + ' http://slicecustom/lm', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK response") tr.StillRunningAfter = ts @@ -171,7 +171,7 @@ # 6 Test - add token to transaction log tr = Test.AddTestRun("Fetch last-modified asset") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://prefetch/404.txt') +tr.MakeCurlCommand(curl_and_args + ' http://prefetch/404.txt', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("404", "expected 404 Not Found response") tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/slice/slice_prefetch.test.py b/tests/gold_tests/pluginTest/slice/slice_prefetch.test.py index 7d97d78b0bb..4557a3511c4 100644 --- a/tests/gold_tests/pluginTest/slice/slice_prefetch.test.py +++ b/tests/gold_tests/pluginTest/slice/slice_prefetch.test.py @@ -114,7 +114,7 @@ ps = tr.Processes.Default ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommandMulti(curl_and_args + ' http://sliceprefetchbytes1/path') +tr.MakeCurlCommandMulti(curl_and_args + ' http://sliceprefetchbytes1/path', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/slice_200.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK response") @@ -124,7 +124,7 @@ # 1 Test - Full object slice (hit-fresh) with no prefetched blocks, block bytes= 7 tr = Test.AddTestRun("Full object slice: first block is hit-fresh, no blocks prefetched") ps = tr.Processes.Default -tr.MakeCurlCommandMulti('sleep 1; ' + curl_and_args + ' http://sliceprefetchbytes1/path') +tr.MakeCurlCommandMulti('sleep 1; ' + curl_and_args + ' http://sliceprefetchbytes1/path', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/slice_200.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK response") @@ -134,7 +134,7 @@ # 2 Test - Full object slice with only next block prefetched in background, block bytes= 7 tr = Test.AddTestRun("Full object slice: first block is hit-stale, only block 14-20 prefetched") ps = tr.Processes.Default -tr.MakeCurlCommandMulti('sleep 5; ' + curl_and_args + ' http://sliceprefetchbytes1/path') +tr.MakeCurlCommandMulti('sleep 5; ' + curl_and_args + ' http://sliceprefetchbytes1/path', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/slice_200.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200 OK response") @@ -144,7 +144,7 @@ # 3 Test - Full object slice (hit-fresh) with no prefetched blocks, block bytes= 7 tr = Test.AddTestRun("Full object slice: first block is hit-fresh with range 0-, no blocks prefetched") ps = tr.Processes.Default -tr.MakeCurlCommandMulti(curl_and_args + ' http://sliceprefetchbytes1/path' + ' -r 0-') +tr.MakeCurlCommandMulti(curl_and_args + ' http://sliceprefetchbytes1/path' + ' -r 0-', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/slice_200.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("206 Partial Content", "expected 206 response") @@ -155,7 +155,7 @@ # 4 Test - Client range request (hit-stale/miss) enables prefetching tr = Test.AddTestRun("Client range request") ps = tr.Processes.Default -tr.MakeCurlCommandMulti(curl_and_args + ' http://sliceprefetchbytes2/path' + ' -r 5-16') +tr.MakeCurlCommandMulti(curl_and_args + ' http://sliceprefetchbytes2/path' + ' -r 5-16', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/slice_mid.stderr.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("206 Partial Content", "expected 206 response") @@ -168,7 +168,7 @@ beg = len(body) + 1 end = beg + block_bytes ps = tr.Processes.Default -tr.MakeCurlCommandMulti(curl_and_args + f' http://sliceprefetchbytes1/path -r {beg}-{end}') +tr.MakeCurlCommandMulti(curl_and_args + f' http://sliceprefetchbytes1/path -r {beg}-{end}', uds_path=ts.Variables.uds_path) ps.Streams.stdout.Content = Testers.ContainsExpression("416 Requested Range Not Satisfiable", "expected 416 response") tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/slice/slice_regex.test.py b/tests/gold_tests/pluginTest/slice/slice_regex.test.py index a7a975df978..b091a6f5a53 100644 --- a/tests/gold_tests/pluginTest/slice/slice_regex.test.py +++ b/tests/gold_tests/pluginTest/slice/slice_regex.test.py @@ -115,7 +115,7 @@ ps = tr.Processes.Default ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(curl_and_args + ' http://exclude/slice.txt') +tr.MakeCurlCommand(curl_and_args + ' http://exclude/slice.txt', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Info: notsliced", "expected not sliced header") tr.StillRunningAfter = ts @@ -123,7 +123,7 @@ # 1 Test - Exclude mp4 gets sliced tr = Test.AddTestRun("Exclude - asset is sliced") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://exclude/slice.mp4') +tr.MakeCurlCommand(curl_and_args + ' http://exclude/slice.mp4', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Info: sliced", "expected sliced header") tr.StillRunningAfter = ts @@ -132,7 +132,7 @@ # 2 Test - Exclude: ensure txt passes through tr = Test.AddTestRun("Include - asset passed through") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://include/slice.txt') +tr.MakeCurlCommand(curl_and_args + ' http://include/slice.txt', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Info: notsliced", "expected not sliced header") tr.StillRunningAfter = ts @@ -140,7 +140,7 @@ # 3 Test - Exclude mp4 gets sliced tr = Test.AddTestRun("Include - asset is sliced") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://include/slice.mp4') +tr.MakeCurlCommand(curl_and_args + ' http://include/slice.mp4', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Info: sliced", "expected sliced header") tr.StillRunningAfter = ts diff --git a/tests/gold_tests/pluginTest/slice/slice_selfhealing.test.py b/tests/gold_tests/pluginTest/slice/slice_selfhealing.test.py index 84658ae2d55..e81dddbd59a 100644 --- a/tests/gold_tests/pluginTest/slice/slice_selfhealing.test.py +++ b/tests/gold_tests/pluginTest/slice/slice_selfhealing.test.py @@ -144,7 +144,7 @@ def to_httpdate(dt): ps = tr.Processes.Default ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) ps.StartBefore(Test.Processes.ts) -tr.MakeCurlCommand(curl_and_args + ' http://crr/second -r 0-2 -H "uuid: etagnew-0"') +tr.MakeCurlCommand(curl_and_args + ' http://crr/second -r 0-2 -H "uuid: etagnew-0"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/bbb.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("etagnew", "expected etagnew") @@ -153,7 +153,7 @@ def to_httpdate(dt): # 1 Test - Preload slice etagold-1 tr = Test.AddTestRun("Preload slice etagold-1") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://crr/second -r 3-5 -H "uuid: etagold-1"') +tr.MakeCurlCommand(curl_and_args + ' http://crr/second -r 3-5 -H "uuid: etagold-1"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/aa.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("etagold", "expected etagold") @@ -162,7 +162,7 @@ def to_httpdate(dt): # 2 Test - Request second slice via slice plugin, with instructions to fetch new 2nd slice tr = Test.AddTestRun("Request 2nd slice (expect refetch)") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/second -r 3- -H "uuid: etagnew-1"') +tr.MakeCurlCommand(curl_and_args + ' http://slice/second -r 3- -H "uuid: etagnew-1"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/bb.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("etagnew", "expected etagnew") @@ -171,7 +171,7 @@ def to_httpdate(dt): # 3 Test - Request fully healed asset via slice plugin tr = Test.AddTestRun("Request full healed slice") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/second') +tr.MakeCurlCommand(curl_and_args + ' http://slice/second', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr.Content = Testers.ContainsExpression("bbbbb", "expected bbbbb content") ps.Streams.stdout.Content = Testers.ContainsExpression("etagnew", "expected etagnew") @@ -233,7 +233,7 @@ def to_httpdate(dt): # 4 Test - Preload reference etagold-0 tr = Test.AddTestRun("Preload reference etagold-0") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://crr/reference -r 0-2 -H "uuid: etagold-0"') +tr.MakeCurlCommand(curl_and_args + ' http://crr/reference -r 0-2 -H "uuid: etagold-0"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/aaa.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("etagold", "expected etagold") @@ -242,7 +242,7 @@ def to_httpdate(dt): # 5 Test - Preload reference etagnew-1 tr = Test.AddTestRun("Preload slice etagnew-1") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://crr/reference -r 3-5 -H "uuid: etagnew-1"') +tr.MakeCurlCommand(curl_and_args + ' http://crr/reference -r 3-5 -H "uuid: etagnew-1"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/bb.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("etagnew", "expected etagnew") @@ -253,7 +253,9 @@ def to_httpdate(dt): # refetch it tr = Test.AddTestRun("Request 2nd slice (expect abort)") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/reference -r 3- -H "uuid: etagnew-0" -w "SENT: \'%{size_download}\'"') +tr.MakeCurlCommand( + curl_and_args + ' http://slice/reference -r 3- -H "uuid: etagnew-0" -w "SENT: \'%{size_download}\'"', + uds_path=ts.Variables.uds_path) # ps.ReturnCode = 0 # curl will fail here ps.Streams.stdout.Content = Testers.ContainsExpression("etagold", "expected etagold") ps.Streams.stdout.Content += Testers.ContainsExpression("SENT: '0'", "expected empty payload") @@ -262,7 +264,7 @@ def to_httpdate(dt): # 7 Test - Request full healed asset via slice plugin tr = Test.AddTestRun("Request full healed slice") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/reference') +tr.MakeCurlCommand(curl_and_args + ' http://slice/reference', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr.Content = Testers.ContainsExpression("bbbbb", "expected bbbbb content") ps.Streams.stdout.Content = Testers.ContainsExpression("etagnew", "expected etagnew") @@ -288,7 +290,7 @@ def to_httpdate(dt): # 8 test - Request through slice but get a 200 back tr = Test.AddTestRun("Request gets a 200") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/code200 -r 3-5 -H "uuid: code200"') +tr.MakeCurlCommand(curl_and_args + ' http://slice/code200 -r 3-5 -H "uuid: code200"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr.Content = Testers.ContainsExpression("ccccc", "expected full ccccc content") ps.Streams.stdout.Content = Testers.ContainsExpression("200 OK", "expected 200") @@ -317,7 +319,7 @@ def to_httpdate(dt): # 9 test - Preload reference slice tr = Test.AddTestRun("Preload reference assetgone-0") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/assetgone -r 0-2 -H "uuid: assetgone-0"') +tr.MakeCurlCommand(curl_and_args + ' http://slice/assetgone -r 0-2 -H "uuid: assetgone-0"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/aaa.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("etag", "expected etag") @@ -326,7 +328,7 @@ def to_httpdate(dt): # 10 test - Fetch full asset, 2nd slice should trigger 404 response tr = Test.AddTestRun("Fetch full asset") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/assetgone') +tr.MakeCurlCommand(curl_and_args + ' http://slice/assetgone', uds_path=ts.Variables.uds_path) # ps.ReturnCode = 0 # curl will return non zero ps.Streams.stderr = "gold/aaa.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("etag", "expected etag") @@ -336,7 +338,7 @@ def to_httpdate(dt): # 11 test - Fetch full asset again, full blown 404 tr = Test.AddTestRun("Fetch full asset, 404") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slice/assetgone') +tr.MakeCurlCommand(curl_and_args + ' http://slice/assetgone', uds_path=ts.Variables.uds_path) # ps.ReturnCode = 0 # curl will return non zero ps.Streams.stdout.Content = Testers.ContainsExpression("404 Not Found", "Expected 404") tr.StillRunningAfter = ts @@ -405,7 +407,9 @@ def to_httpdate(dt): # 12 Test - Preload reference etagold-1 tr = Test.AddTestRun("Preload slice etagold-custom-1") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + f' http://crrhdr/second-custom -r 3-5 -H "uuid: etagold-custom-1" -H "crr-foo: {edate}"') +tr.MakeCurlCommand( + curl_and_args + f' http://crrhdr/second-custom -r 3-5 -H "uuid: etagold-custom-1" -H "crr-foo: {edate}"', + uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/aa.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("etagold-custom", "expected etagold-custom") @@ -414,7 +418,8 @@ def to_httpdate(dt): # 13 Test - Request second slice via slice plugin, with instructions to fetch new 2nd slice tr = Test.AddTestRun("Request 2nd slice (expect refetch)") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + ' http://slicehdr/second-custom -r 3- -H "uuid: etagnew-custom-1"') +tr.MakeCurlCommand( + curl_and_args + ' http://slicehdr/second-custom -r 3- -H "uuid: etagnew-custom-1"', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/bb.gold" ps.Streams.stdout.Content = Testers.ContainsExpression("etagnew-custom", "expected etagnew-custom") diff --git a/tests/gold_tests/pluginTest/sslheaders/sslheaders.test.py b/tests/gold_tests/pluginTest/sslheaders/sslheaders.test.py index 7fa2d607dcc..8276de9f365 100644 --- a/tests/gold_tests/pluginTest/sslheaders/sslheaders.test.py +++ b/tests/gold_tests/pluginTest/sslheaders/sslheaders.test.py @@ -21,7 +21,7 @@ Test sslheaders plugin. ''' -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) Test.SkipUnless( Condition.PluginExists('sslheaders.so'), Condition.HasCurlFeature('http2'), diff --git a/tests/gold_tests/pluginTest/stats_over_http/stats_over_http.test.py b/tests/gold_tests/pluginTest/stats_over_http/stats_over_http.test.py index c330573a39a..3262993d628 100644 --- a/tests/gold_tests/pluginTest/stats_over_http/stats_over_http.test.py +++ b/tests/gold_tests/pluginTest/stats_over_http/stats_over_http.test.py @@ -65,7 +65,7 @@ def __checkProcessAfter(self, tr): def __testCase0(self): tr = Test.AddTestRun() self.__checkProcessBefore(tr) - tr.MakeCurlCommand(f"-vs --http1.1 http://127.0.0.1:{self.ts.Variables.port}/_stats") + tr.MakeCurlCommand(f"-vs --http1.1 http://127.0.0.1:{self.ts.Variables.port}/_stats", uds_path=self.ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/stats_over_http_0_stdout.gold" tr.Processes.Default.Streams.stderr = "gold/stats_over_http_0_stderr.gold" diff --git a/tests/gold_tests/pluginTest/test_hooks/body_buffer.test.py b/tests/gold_tests/pluginTest/test_hooks/body_buffer.test.py index 505df1161d5..9c3afa423fe 100644 --- a/tests/gold_tests/pluginTest/test_hooks/body_buffer.test.py +++ b/tests/gold_tests/pluginTest/test_hooks/body_buffer.test.py @@ -17,8 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os - Test.SkipUnless(Condition.PluginExists('request_buffer.so')) @@ -105,12 +103,11 @@ def setupTS(self): self._ts = Test.MakeATSProcess("ts", select_ports=False) self._ts.Disk.remap_config.AddLine(f'map / http://127.0.0.1:{self._server.Variables.Port}') Test.PrepareInstalledPlugin('request_buffer.so', self._ts) - uds_path = os.path.join(Test.RunDirectory, 'uds.socket') self._ts.Disk.records_config.update( { 'proxy.config.diags.debug.enabled': 1, 'proxy.config.diags.debug.tags': 'request_buffer', - 'proxy.config.http.server_ports': str(self._ts.Variables.port) + f" {uds_path}", + 'proxy.config.http.server_ports': str(self._ts.Variables.port) + f" {self._ts.Variables.uds_path}", }) self._ts.Disk.traffic_out.Content = Testers.ContainsExpression( @@ -125,8 +122,8 @@ def run(self): # Send both a Content-Length request and a chunked-encoded request. tr.MakeCurlCommand( f'-v http://127.0.0.1:{self._ts.Variables.port}/contentlength -d "{self.content_length_request_body}" --next ' - f'-v http://127.0.0.1:{self._ts.Variables.port}/chunked -H "Transfer-Encoding: chunked" -d "{self.chunked_request_body}"' - ) + f'-v http://127.0.0.1:{self._ts.Variables.port}/chunked -H "Transfer-Encoding: chunked" -d "{self.chunked_request_body}"', + uds_path=self._ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(self._server) tr.Processes.Default.StartBefore(Test.Processes.ts) diff --git a/tests/gold_tests/pluginTest/test_hooks/hook_add.test.py b/tests/gold_tests/pluginTest/test_hooks/hook_add.test.py index 3e9f97e343c..c60d28e612f 100644 --- a/tests/gold_tests/pluginTest/test_hooks/hook_add.test.py +++ b/tests/gold_tests/pluginTest/test_hooks/hook_add.test.py @@ -20,7 +20,6 @@ Test adding hooks ''' -Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True server = Test.MakeOriginServer("server") @@ -43,12 +42,18 @@ ts.Disk.remap_config.AddLine("map http://one http://127.0.0.1:{0}".format(server.Variables.Port)) +ipv4flag = "" +if not Condition.CurlUsingUnixDomainSocket(): + ipv4flag = "--ipv4" + tr = Test.AddTestRun() # Probe server port to check if ready. tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) # -tr.MakeCurlCommand('--verbose --ipv4 --header "Host: one" http://localhost:{0}/argh'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '--verbose {0} --header "Host: one" http://localhost:{1}/argh'.format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 # Look at the debug output from the plugin diff --git a/tests/gold_tests/pluginTest/test_hooks/hook_add_uds.test.py b/tests/gold_tests/pluginTest/test_hooks/hook_add_uds.test.py deleted file mode 100644 index 5d899c79e65..00000000000 --- a/tests/gold_tests/pluginTest/test_hooks/hook_add_uds.test.py +++ /dev/null @@ -1,54 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -Test.Summary = ''' -Test adding hooks -''' - -Test.ContinueOnFail = True - -server = Test.MakeOriginServer("server") - -request_header = {"headers": "GET /argh HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -server.addResponse("sessionlog.json", request_header, response_header) - -ts = Test.MakeATSProcess("ts", enable_cache=False) - -ts.Disk.records_config.update( - { - 'proxy.config.diags.debug.tags': 'test', - 'proxy.config.diags.show_location': 0, - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.url_remap.remap_required': 0, - }) - -Test.PrepareTestPlugin(os.path.join(Test.Variables.AtsTestPluginsDir, 'hook_add_plugin.so'), ts) - -ts.Disk.remap_config.AddLine("map http://one http://127.0.0.1:{0}".format(server.Variables.Port)) - -tr = Test.AddTestRun() -# Probe server port to check if ready. -tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) -tr.Processes.Default.StartBefore(Test.Processes.ts) -# -tr.MakeCurlCommand('--verbose --header "Host: one" http://localhost:{0}/argh'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 - -# Look at the debug output from the plugin -ts.Disk.traffic_out.Content = "hook_add.gold" diff --git a/tests/gold_tests/pluginTest/test_hooks/ssn_start_delay_hook.test.py b/tests/gold_tests/pluginTest/test_hooks/ssn_start_delay_hook.test.py index e94004f21d5..a2dcee5ea6d 100644 --- a/tests/gold_tests/pluginTest/test_hooks/ssn_start_delay_hook.test.py +++ b/tests/gold_tests/pluginTest/test_hooks/ssn_start_delay_hook.test.py @@ -20,7 +20,6 @@ Test adding hooks, and rescheduling the ssn start hook from a non-net thread ''' -Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True server = Test.MakeOriginServer("server") @@ -44,13 +43,19 @@ ts.Disk.remap_config.AddLine("map http://one http://127.0.0.1:{0}".format(server.Variables.Port)) +ipv4flag = "" +if not Condition.CurlUsingUnixDomainSocket(): + ipv4flag = "--ipv4" + tr = Test.AddTestRun() # Probe server port to check if ready. tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) # Probe TS cleartext port to check if ready (probing TLS port causes spurious VCONN hook triggers). tr.Processes.Default.StartBefore(Test.Processes.ts, ready=When.PortOpen(ts.Variables.port)) # -tr.MakeCurlCommand('--verbose --ipv4 --header "Host: one" http://localhost:{0}/argh'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '--verbose {0} --header "Host: one" http://localhost:{1}/argh'.format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 # Look at the debug output from the plugin diff --git a/tests/gold_tests/pluginTest/test_hooks/ssn_start_delay_hook_uds.test.py b/tests/gold_tests/pluginTest/test_hooks/ssn_start_delay_hook_uds.test.py deleted file mode 100644 index c7626b77236..00000000000 --- a/tests/gold_tests/pluginTest/test_hooks/ssn_start_delay_hook_uds.test.py +++ /dev/null @@ -1,56 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -Test.Summary = ''' -Test adding hooks, and rescheduling the ssn start hook from a non-net thread -''' - -Test.ContinueOnFail = True - -server = Test.MakeOriginServer("server") - -request_header = {"headers": "GET /argh HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -server.addResponse("sessionlog.json", request_header, response_header) - -ts = Test.MakeATSProcess("ts") - -ts.Disk.records_config.update( - { - 'proxy.config.diags.debug.tags': 'test', - 'proxy.config.diags.show_location': 0, - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.http.cache.http': 0, - 'proxy.config.url_remap.remap_required': 0, - }) - -Test.PrepareTestPlugin(os.path.join(Test.Variables.AtsTestPluginsDir, 'hook_add_plugin.so'), ts, '-delay') - -ts.Disk.remap_config.AddLine("map http://one http://127.0.0.1:{0}".format(server.Variables.Port)) - -tr = Test.AddTestRun() -# Probe server port to check if ready. -tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) -# Probe TS cleartext port to check if ready (probing TLS port causes spurious VCONN hook triggers). -tr.Processes.Default.StartBefore(Test.Processes.ts, ready=When.PortOpen(ts.Variables.port)) -# -tr.MakeCurlCommand('--verbose --header "Host: one" http://localhost:{0}/argh'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 - -# Look at the debug output from the plugin -ts.Disk.traffic_out.Content = "ssn_delay.gold" diff --git a/tests/gold_tests/pluginTest/test_hooks/test_hooks.test.py b/tests/gold_tests/pluginTest/test_hooks/test_hooks.test.py index 528807c8f8d..85f32276982 100644 --- a/tests/gold_tests/pluginTest/test_hooks/test_hooks.test.py +++ b/tests/gold_tests/pluginTest/test_hooks/test_hooks.test.py @@ -20,7 +20,6 @@ Test TS API Hooks. ''' -Test.SkipIf(Condition.CurlUds()) Test.SkipUnless(Condition.HasCurlFeature('http2'),) Test.ContinueOnFail = True @@ -57,23 +56,30 @@ ts.Disk.remap_config.AddLine("map http://one http://127.0.0.1:{0}".format(server.Variables.Port)) ts.Disk.remap_config.AddLine("map https://one http://127.0.0.1:{0}".format(server.Variables.Port)) +ipv4flag = "" +if not Condition.CurlUsingUnixDomainSocket(): + ipv4flag = "--ipv4" + tr = Test.AddTestRun() # Probe server port to check if ready. tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) tr.Processes.Default.StartBefore(Test.Processes.ts) # -tr.MakeCurlCommand('--verbose --ipv4 --header "Host: one" http://localhost:{0}/argh'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 - -tr = Test.AddTestRun() tr.MakeCurlCommand( - '--verbose --ipv4 --http2 --insecure --header "Host: one" https://localhost:{0}/argh'.format(ts.Variables.ssl_port)) + '--verbose {0} --header "Host: one" http://localhost:{1}/argh'.format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 -tr = Test.AddTestRun() -tr.MakeCurlCommand( - '--verbose --ipv4 --http1.1 --insecure --header "Host: one" https://localhost:{0}/argh'.format(ts.Variables.ssl_port)) -tr.Processes.Default.ReturnCode = 0 +if not Condition.CurlUsingUnixDomainSocket(): + tr = Test.AddTestRun() + tr.MakeCurlCommand( + '--verbose --ipv4 --http2 --insecure --header "Host: one" https://localhost:{0}/argh'.format(ts.Variables.ssl_port)) + tr.Processes.Default.ReturnCode = 0 + + tr = Test.AddTestRun() + tr.MakeCurlCommand( + '--verbose --ipv4 --http1.1 --insecure --header "Host: one" https://localhost:{0}/argh'.format(ts.Variables.ssl_port)) + tr.Processes.Default.ReturnCode = 0 # The probing of the ATS port to detect when ATS is ready may be seen by ATS as a VCONN start/close, so filter out these # events from the log file. @@ -86,5 +92,8 @@ tr.Processes.Default.Command = "echo check log" tr.Processes.Default.ReturnCode = 0 f = tr.Disk.File(log_path) -f.Content = "log.gold" -f.Content += Testers.ContainsExpression("Global: event=TS_EVENT_VCONN_CLOSE", "VCONN_CLOSE should trigger 2 times") +if Condition.CurlUsingUnixDomainSocket(): + f.Content = "log_uds.gold" +else: + f.Content = "log.gold" + f.Content += Testers.ContainsExpression("Global: event=TS_EVENT_VCONN_CLOSE", "VCONN_CLOSE should trigger 2 times") diff --git a/tests/gold_tests/pluginTest/test_hooks/test_hooks_uds.test.py b/tests/gold_tests/pluginTest/test_hooks/test_hooks_uds.test.py deleted file mode 100644 index 4dc22f32b7d..00000000000 --- a/tests/gold_tests/pluginTest/test_hooks/test_hooks_uds.test.py +++ /dev/null @@ -1,77 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -Test.Summary = ''' -Test TS API Hooks. -''' - -Test.SkipUnless(Condition.HasCurlFeature('http2'),) -Test.ContinueOnFail = True - -server = Test.MakeOriginServer("server") - -request_header = {"headers": "GET /argh HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -server.addResponse("sessionlog.json", request_header, response_header) - -# Disable the cache to make sure each request is forwarded to the origin -# server. -ts = Test.MakeATSProcess("ts", enable_tls=True, enable_cache=False) - -# test_hooks.so will output test logging to this file. -log_path = os.path.join(ts.Variables.LOGDIR, "log.txt") -Test.Env["OUTPUT_FILE"] = log_path - -ts.addDefaultSSLFiles() - -ts.Disk.records_config.update( - { - 'proxy.config.proxy_name': 'Poxy_Proxy', # This will be the server name. - 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), - 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), - 'proxy.config.url_remap.remap_required': 0, - 'proxy.config.diags.debug.enabled': 0, - 'proxy.config.diags.debug.tags': 'http|test_hooks', - }) - -ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') - -Test.PrepareTestPlugin(os.path.join(Test.Variables.AtsTestPluginsDir, 'test_hooks.so'), ts) - -ts.Disk.remap_config.AddLine("map http://one http://127.0.0.1:{0}".format(server.Variables.Port)) - -tr = Test.AddTestRun() -# Probe server port to check if ready. -tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) -tr.Processes.Default.StartBefore(Test.Processes.ts) -# -tr.MakeCurlCommand('--verbose --header "Host: one" http://localhost:{0}/argh'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 - -# The probing of the ATS port to detect when ATS is ready may be seen by ATS as a VCONN start/close, so filter out these -# events from the log file. -# -tr = Test.AddTestRun() -tr.Processes.Default.Command = "cd " + Test.RunDirectory + " ; . " + Test.TestDirectory + "/clean.sh" -tr.Processes.Default.ReturnCode = 0 - -tr = Test.AddTestRun() -tr.Processes.Default.Command = "echo check log" -tr.Processes.Default.ReturnCode = 0 -f = tr.Disk.File(log_path) -f.Content = "log_uds.gold" diff --git a/tests/gold_tests/pluginTest/tsapi/log_uds.gold b/tests/gold_tests/pluginTest/tsapi/log_uds.gold index ec6ec60a645..7444e77b0d0 100644 --- a/tests/gold_tests/pluginTest/tsapi/log_uds.gold +++ b/tests/gold_tests/pluginTest/tsapi/log_uds.gold @@ -4,6 +4,12 @@ argv[1]=http://127.0.0.1:SERVER_PORT/ TSRemapNewInstance(): argv[0]=http://myhost.test/ argv[1]=http://127.0.0.1:SERVER_PORT/ +TSRemapNewInstance(): +argv[0]=https://myhost.test:123/ +argv[1]=http://127.0.0.1:SERVER_PORT/ +TSRemapNewInstance(): +argv[0]=https://myhost.test:123/ +argv[1]=http://127.0.0.1:SERVER_PORT/ Global: event=TS_EVENT_HTTP_TXN_START Global: event=TS_EVENT_HTTP_READ_REQUEST_HDR TSHttpTxnEffectiveUrlStringGet(): http://mYhOsT.teSt/ diff --git a/tests/gold_tests/pluginTest/tsapi/tsapi.test.py b/tests/gold_tests/pluginTest/tsapi/tsapi.test.py index f6f8a82ef93..dfc060c1543 100644 --- a/tests/gold_tests/pluginTest/tsapi/tsapi.test.py +++ b/tests/gold_tests/pluginTest/tsapi/tsapi.test.py @@ -20,7 +20,6 @@ Test TS API. ''' -Test.SkipIf(Condition.CurlUds()) Test.SkipUnless(Condition.HasCurlFeature('http2'),) Test.ContinueOnFail = True @@ -66,6 +65,10 @@ ts.Disk.remap_config.AddLine( "map https://myhost.test:123 http://127.0.0.1:{0} @plugin={1} @plugin={1}".format(server.Variables.Port, f"{plugin_name}.so")) +ipv4flag = "" +if not Condition.CurlUsingUnixDomainSocket(): + ipv4flag = "--ipv4" + # For some reason, without this delay, traffic_server cannot reliably open the cleartext port for listening without an # error. # @@ -77,17 +80,22 @@ tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(ts) # -tr.MakeCurlCommand('--verbose --ipv4 --header "Host: mYhOsT.teSt" hTtP://loCalhOst:{}/'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 - -tr = Test.AddTestRun() -tr.MakeCurlCommand('--verbose --ipv4 --proxy localhost:{} http://mYhOsT.teSt/xYz'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '--verbose {0} --header "Host: mYhOsT.teSt" hTtP://loCalhOst:{1}/'.format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() tr.MakeCurlCommand( - '--verbose --ipv4 --http2 --insecure --header ' + '"Host: myhost.test:123" HttPs://LocalHost:{}/'.format(ts.Variables.ssl_port)) -tr.Processes.Default.ReturnCode = 0 + '--verbose {0} --proxy localhost:{1} http://mYhOsT.teSt/xYz'.format(ipv4flag, ts.Variables.port), + uds_path=ts.Variables.uds_path) + +if not Condition.CurlUsingUnixDomainSocket(): + tr = Test.AddTestRun() + tr.MakeCurlCommand( + '--verbose --ipv4 --http2 --insecure --header ' + + '"Host: myhost.test:123" HttPs://LocalHost:{}/'.format(ts.Variables.ssl_port)) + tr.Processes.Default.ReturnCode = 0 tr = Test.AddTestRun() # Change server port number (which can vary) to a fixed string for compare to gold file. @@ -95,4 +103,7 @@ tr.Processes.Default.Command = f"sed 's/{server.Variables.Port}/SERVER_PORT/' < {log_file_name} > {second_log_file_name}" tr.Processes.Default.ReturnCode = 0 f = tr.Disk.File(second_log_file_name) -f.Content = "log.gold" +if Condition.CurlUsingUnixDomainSocket(): + f.Content = "log_uds.gold" +else: + f.Content = "log.gold" diff --git a/tests/gold_tests/pluginTest/tsapi/tsapi_uds.test.py b/tests/gold_tests/pluginTest/tsapi/tsapi_uds.test.py deleted file mode 100644 index 6a928592257..00000000000 --- a/tests/gold_tests/pluginTest/tsapi/tsapi_uds.test.py +++ /dev/null @@ -1,90 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -Test.Summary = ''' -Test TS API. -''' - -Test.SkipUnless(Condition.HasCurlFeature('http2'),) -Test.ContinueOnFail = True - -plugin_name = "test_tsapi" - -server = Test.MakeOriginServer("server") - -request_header = {"headers": "GET / HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": "112233"} -server.addResponse("sessionlog.json", request_header, response_header) - -request_header = {"headers": "GET /xYz HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": "445566"} -server.addResponse("sessionlog.json", request_header, response_header) - -# Disable the cache to make sure each request is forwarded to the origin -# server. -ts = Test.MakeATSProcess("ts", enable_tls=True, enable_cache=False) - -# The test plugin will output test logging to this file. -log_file_name = os.path.join(ts.Variables.LOGDIR, "log.txt") -Test.Env["OUTPUT_FILE"] = log_file_name - -ts.addDefaultSSLFiles() - -ts.Disk.records_config.update( - { - 'proxy.config.proxy_name': 'Poxy_Proxy', # This will be the server name. - 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), - 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), - 'proxy.config.url_remap.remap_required': 1, - 'proxy.config.diags.debug.enabled': 3, - 'proxy.config.diags.debug.tags': f'http|{plugin_name}', - }) - -ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') - -rp = os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'pluginTest', 'tsapi', '.libs', f'{plugin_name}.so') -ts.Setup.Copy(rp, ts.Env['PROXY_CONFIG_PLUGIN_PLUGIN_DIR']) - -ts.Disk.remap_config.AddLine( - "map http://myhost.test http://127.0.0.1:{0} @plugin={1} @plugin={1}".format(server.Variables.Port, f"{plugin_name}.so")) - -# For some reason, without this delay, traffic_server cannot reliably open the cleartext port for listening without an -# error. -# -tr = Test.AddTestRun() -tr.Processes.Default.Command = "sleep 3" -tr.Processes.Default.ReturnCode = 0 - -tr = Test.AddTestRun() -tr.Processes.Default.StartBefore(server) -tr.Processes.Default.StartBefore(ts) -# -tr.MakeCurlCommand('--verbose --header "Host: mYhOsT.teSt" hTtP://loCalhOst:{}/'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 - -tr = Test.AddTestRun() -tr.MakeCurlCommand('--verbose --proxy localhost:{} http://mYhOsT.teSt/xYz'.format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 - -tr = Test.AddTestRun() -# Change server port number (which can vary) to a fixed string for compare to gold file. -second_log_file_name = os.path.join(ts.Variables.LOGDIR, "log2.txt") -tr.Processes.Default.Command = f"sed 's/{server.Variables.Port}/SERVER_PORT/' < {log_file_name} > {second_log_file_name}" -tr.Processes.Default.ReturnCode = 0 -f = tr.Disk.File(second_log_file_name) -f.Content = "log_uds.gold" diff --git a/tests/gold_tests/pluginTest/uri_signing/uri_signing.test.py b/tests/gold_tests/pluginTest/uri_signing/uri_signing.test.py index 5425673008c..a39df4b9f69 100644 --- a/tests/gold_tests/pluginTest/uri_signing/uri_signing.test.py +++ b/tests/gold_tests/pluginTest/uri_signing/uri_signing.test.py @@ -102,7 +102,7 @@ ps = tr.Processes.Default ps.StartBefore(ts) ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) -tr.MakeCurlCommand(curl_and_args + 'http://somehost/someasset.ts') +tr.MakeCurlCommand(curl_and_args + 'http://somehost/someasset.ts', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/403.gold" tr.StillRunningAfter = server @@ -111,7 +111,7 @@ # 1 - accept a passthru request tr = Test.AddTestRun("passthru request") ps = tr.Processes.Default -tr.MakeCurlCommand(curl_and_args + 'http://somehost/crossdomain.xml') +tr.MakeCurlCommand(curl_and_args + 'http://somehost/crossdomain.xml', uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/200.gold" tr.StillRunningAfter = server @@ -122,8 +122,8 @@ ps = tr.Processes.Default tr.MakeCurlCommand( curl_and_args + - '"http://somehost/someasset.ts?URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjE5MjMwNTYwODR9.zw_wFQ-wvrWmfPLGj3hAUWn-GOHkiJZi2but4KV0paY"' -) + '"http://somehost/someasset.ts?URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjE5MjMwNTYwODR9.zw_wFQ-wvrWmfPLGj3hAUWn-GOHkiJZi2but4KV0paY"', + uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/200.gold" tr.StillRunningAfter = server @@ -134,8 +134,8 @@ ps = tr.Processes.Default tr.MakeCurlCommand( curl_and_args + - '"http://somehost/someasset.ts?URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjF9.GkdlOPHQc6BqS4Q6x79GeYuVFO2zuGbaPZZsJfD6ir8"' -) + '"http://somehost/someasset.ts?URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjF9.GkdlOPHQc6BqS4Q6x79GeYuVFO2zuGbaPZZsJfD6ir8"', + uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/403.gold" tr.StillRunningAfter = server @@ -146,8 +146,8 @@ ps = tr.Processes.Default tr.MakeCurlCommand( curl_and_args + - '"http://somehost/someasset.ts?URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjE5MjMwNTYwODR9.ozH4sNwgcOlTZT0l4RQlVCH_osxz9yI1HCBesEv-jYg"' -) + '"http://somehost/someasset.ts?URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjE5MjMwNTYwODR9.ozH4sNwgcOlTZT0l4RQlVCH_osxz9yI1HCBesEv-jYg"', + uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/200.gold" tr.StillRunningAfter = server @@ -158,8 +158,8 @@ ps = tr.Processes.Default tr.MakeCurlCommand( curl_and_args + - '"http://somehost/URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjE5MjMwNTYwODR9.zw_wFQ-wvrWmfPLGj3hAUWn-GOHkiJZi2but4KV0paY/someasset.ts"' -) + '"http://somehost/URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjE5MjMwNTYwODR9.zw_wFQ-wvrWmfPLGj3hAUWn-GOHkiJZi2but4KV0paY/someasset.ts"', + uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/200.gold" tr.StillRunningAfter = server @@ -170,8 +170,8 @@ ps = tr.Processes.Default tr.MakeCurlCommand( curl_and_args + - '"http://somehost/URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjF9.GkdlOPHQc6BqS4Q6x79GeYuVFO2zuGbaPZZsJfD6ir8/someasset.ts"' -) + '"http://somehost/URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjF9.GkdlOPHQc6BqS4Q6x79GeYuVFO2zuGbaPZZsJfD6ir8/someasset.ts"', + uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/403.gold" tr.StillRunningAfter = server @@ -182,8 +182,8 @@ ps = tr.Processes.Default tr.MakeCurlCommand( curl_and_args + - '"http://somehost/someasset.ts;URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjE5MjMwNTYwODR9.zw_wFQ-wvrWmfPLGj3hAUWn-GOHkiJZi2but4KV0paY"' -) + '"http://somehost/someasset.ts;URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjE5MjMwNTYwODR9.zw_wFQ-wvrWmfPLGj3hAUWn-GOHkiJZi2but4KV0paY"', + uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/200.gold" tr.StillRunningAfter = server @@ -194,8 +194,8 @@ ps = tr.Processes.Default tr.MakeCurlCommand( curl_and_args + - '"http://somehost/someasset.ts;URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjF9.GkdlOPHQc6BqS4Q6x79GeYuVFO2zuGbaPZZsJfD6ir8"' -) + '"http://somehost/someasset.ts;URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjF9.GkdlOPHQc6BqS4Q6x79GeYuVFO2zuGbaPZZsJfD6ir8"', + uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/403.gold" tr.StillRunningAfter = server @@ -206,8 +206,8 @@ ps = tr.Processes.Default tr.MakeCurlCommand( curl_and_args + - '"http://somehost/someasset.ts" -H "Cookie: URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjE5MjMwNTYwODR9.zw_wFQ-wvrWmfPLGj3hAUWn-GOHkiJZi2but4KV0paY"' -) + '"http://somehost/someasset.ts" -H "Cookie: URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjE5MjMwNTYwODR9.zw_wFQ-wvrWmfPLGj3hAUWn-GOHkiJZi2but4KV0paY"', + uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/200.gold" tr.StillRunningAfter = server @@ -218,8 +218,8 @@ ps = tr.Processes.Default tr.MakeCurlCommand( curl_and_args + - '"http://somehost/someasset.ts" -H "Cookie: URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjF9.GkdlOPHQc6BqS4Q6x79GeYuVFO2zuGbaPZZsJfD6ir8"' -) + '"http://somehost/someasset.ts" -H "Cookie: URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjF9.GkdlOPHQc6BqS4Q6x79GeYuVFO2zuGbaPZZsJfD6ir8"', + uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/403.gold" tr.StillRunningAfter = server @@ -230,8 +230,8 @@ ps = tr.Processes.Default tr.MakeCurlCommand( curl_and_args + - '"http://somehost/someasset.ts" -H "Cookie: URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjF9.GkdlOPHQc6BqS4Q6x79GeYuVFO2zuGbaPZZsJfD6ir8;URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjE5MjMwNTYwODR9.zw_wFQ-wvrWmfPLGj3hAUWn-GOHkiJZi2but4KV0paY"' -) + '"http://somehost/someasset.ts" -H "Cookie: URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjF9.GkdlOPHQc6BqS4Q6x79GeYuVFO2zuGbaPZZsJfD6ir8;URISigningPackage=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjE5MjMwNTYwODR9.zw_wFQ-wvrWmfPLGj3hAUWn-GOHkiJZi2but4KV0paY"', + uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/200.gold" tr.StillRunningAfter = server @@ -242,8 +242,8 @@ ps = tr.Processes.Default tr.MakeCurlCommand( curl_and_args + - '"http://somehost/someasset.ts?URISigningPackage=ewogICJ0eXAiOiAiSldUIiwKICAiYWxnIjogIkhTMjU2Igp9.ewogICJleHAiOiAxOTIzMDU2MDg0Cn0.zw_wFQ-wvrWmfPLGj3hAUWn-GOHkiJZi2but4KV0paY"' -) + '"http://somehost/someasset.ts?URISigningPackage=ewogICJ0eXAiOiAiSldUIiwKICAiYWxnIjogIkhTMjU2Igp9.ewogICJleHAiOiAxOTIzMDU2MDg0Cn0.zw_wFQ-wvrWmfPLGj3hAUWn-GOHkiJZi2but4KV0paY"', + uds_path=ts.Variables.uds_path) ps.ReturnCode = 0 ps.Streams.stderr = "gold/403.gold" ts.Disk.traffic_out.Content = Testers.ContainsExpression( diff --git a/tests/gold_tests/pluginTest/url_sig/url_sig.test.py b/tests/gold_tests/pluginTest/url_sig/url_sig.test.py index 137d95d8bf8..6d3f8018db2 100644 --- a/tests/gold_tests/pluginTest/url_sig/url_sig.test.py +++ b/tests/gold_tests/pluginTest/url_sig/url_sig.test.py @@ -25,7 +25,6 @@ Test.ContinueOnFail = True -Test.SkipIf(Condition.CurlUds()) # Skip if plugins not present. Test.SkipUnless(Condition.PluginExists('url_sig.so')) @@ -104,7 +103,8 @@ tr.Processes.Default.ReturnCode = 0 tr.MakeCurlCommand( f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.2&E=33046620008&A=2&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) + "foo/abcde/qrstuvwxyz?C=127.0.0.2&E=33046620008&A=2&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee, + uds_path=ts.Variables.uds_path) # With client / MD5 / P=010 / URL pristine / URL altered -- Expired. # @@ -112,7 +112,8 @@ tr.Processes.Default.ReturnCode = 0 tr.MakeCurlCommand( f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=1&A=2&K=13&P=010&S=f237aad1fa010234d7bf8108a0e36387'" + LogTee) + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=1&A=2&K=13&P=010&S=f237aad1fa010234d7bf8108a0e36387'" + LogTee, + uds_path=ts.Variables.uds_path) # With client / No algorithm / P=101 / URL pristine / URL altered. # @@ -120,7 +121,8 @@ tr.Processes.Default.ReturnCode = 0 tr.MakeCurlCommand( f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee, + uds_path=ts.Variables.uds_path) # With client / Bad algorithm / P=101 / URL pristine / URL altered. # @@ -128,7 +130,8 @@ tr.Processes.Default.ReturnCode = 0 tr.MakeCurlCommand( f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=3&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=3&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee, + uds_path=ts.Variables.uds_path) # With client / MD5 / No parts / URL pristine / URL altered. # @@ -136,7 +139,8 @@ tr.Processes.Default.ReturnCode = 0 tr.MakeCurlCommand( f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee, + uds_path=ts.Variables.uds_path) # With client / MD5 / P=10 (bad) / URL pristine / URL altered. # @@ -144,7 +148,8 @@ tr.Processes.Default.ReturnCode = 0 tr.MakeCurlCommand( f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=10&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=10&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee, + uds_path=ts.Variables.uds_path) # With client / MD5 / P=101 / URL pristine / URL altered -- No signature. # @@ -152,7 +157,8 @@ tr.Processes.Default.ReturnCode = 0 tr.MakeCurlCommand( f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101'" + LogTee) + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101'" + LogTee, + uds_path=ts.Variables.uds_path) # With client / MD5 / P=101 / URL pristine / URL altered -- Bad signature. # @@ -160,7 +166,8 @@ tr.Processes.Default.ReturnCode = 0 tr.MakeCurlCommand( f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=d1f452d4f1d931ad2f441013402d93f8'" + LogTee) + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=d1f452d4f1d931ad2f441013402d93f8'" + LogTee, + uds_path=ts.Variables.uds_path) # With client / MD5 / P=101 / URL pristine / URL altered -- Spurious &. # @@ -168,7 +175,8 @@ tr.Processes.Default.ReturnCode = 0 tr.MakeCurlCommand( f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8#'" + LogTee) + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8#'" + LogTee, + uds_path=ts.Variables.uds_path) # Success tests. @@ -178,7 +186,8 @@ tr.Processes.Default.ReturnCode = 0 tr.MakeCurlCommand( f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://four.five.six/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046618556&A=1&K=15&P=1&S=f4103561a23adab7723a89b9831d77e0afb61d92'" + LogTee) + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046618556&A=1&K=15&P=1&S=f4103561a23adab7723a89b9831d77e0afb61d92'" + LogTee, + uds_path=ts.Variables.uds_path) # No client / MD5 / P=1 / URL pristine / URL altered. # @@ -186,7 +195,8 @@ tr.Processes.Default.ReturnCode = 0 tr.MakeCurlCommand( f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?E=33046618586&A=2&K=0&P=1&S=0364efa28afe345544596705b92d20ac'" + LogTee) + "foo/abcde/qrstuvwxyz?E=33046618586&A=2&K=0&P=1&S=0364efa28afe345544596705b92d20ac'" + LogTee, + uds_path=ts.Variables.uds_path) # With client / MD5 / P=010 / URL pristine / URL altered. # @@ -194,7 +204,8 @@ tr.Processes.Default.ReturnCode = 0 tr.MakeCurlCommand( f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046619717&A=2&K=13&P=010&S=f237aad1fa010234d7bf8108a0e36387'" + LogTee) + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046619717&A=2&K=13&P=010&S=f237aad1fa010234d7bf8108a0e36387'" + LogTee, + uds_path=ts.Variables.uds_path) # With client / MD5 / P=101 / URL pristine / URL altered. # @@ -202,7 +213,8 @@ tr.Processes.Default.ReturnCode = 0 tr.MakeCurlCommand( f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee, + uds_path=ts.Variables.uds_path) def sign(payload, key): @@ -220,7 +232,7 @@ def sign(payload, key): tr = Test.AddTestRun() tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand(f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} '{url}'" + LogTee) +tr.MakeCurlCommand(f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} '{url}'" + LogTee, uds_path=ts.Variables.uds_path) # With client / MD5 / P=101 / URL pristine / URL altered. # uses url_type pristine in config @@ -228,7 +240,8 @@ def sign(payload, key): tr.Processes.Default.ReturnCode = 0 tr.MakeCurlCommand( f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://ten.eleven.twelve/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=586ef8e808caeeea025c525c89ff2638'" + LogTee) + "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=586ef8e808caeeea025c525c89ff2638'" + LogTee, + uds_path=ts.Variables.uds_path) # Single fail test - check for bad path param inserted # With client / MD5 / P=101 / URL pristine / URL altered. Bad Path Param @@ -237,7 +250,8 @@ def sign(payload, key): tr.Processes.Default.ReturnCode = 0 tr.MakeCurlCommand( f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://ten.eleven.twelve/" + - "foo/abcde/qrstuvwxyz;badparam=true?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=586ef8e808caeeea025c525c89ff2638'" + LogTee) + "foo/abcde/qrstuvwxyz;badparam=true?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=586ef8e808caeeea025c525c89ff2638'" + LogTee, + uds_path=ts.Variables.uds_path) # Success # With client / SHA1 / P=1 / URL pristine / URL altered. Base64 Encoded Path Param @@ -246,7 +260,8 @@ def sign(payload, key): tr.MakeCurlCommand( f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://ten.eleven.twelve/" + "foo/abcde;urlsig=Qz0xMjcuMC4wLjE7RT0zMzA0NjYyMDAwODtBPTI7Sz0xMztQPTEwMTtTPTA1MDllZjljY2VlNjUxZWQ1OTQxM2MyZjE3YmVhODZh/qrstuvwxyz'" - + LogTee) + + LogTee, + uds_path=ts.Variables.uds_path) # Success # This test must be last since it converts from the long to the short log output @@ -258,9 +273,10 @@ def sign(payload, key): tr = Test.AddTestRun() tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand( - f"--verbose --http1.1 --insecure --header 'Host: one.two.three' '{url}'" + LogTee + - " ; grep -F -e '< HTTP' -e Authorization {0}/url_sig_long.log > {0}/url_sig_short.log ".format(ts.RunDirectory)) +tr.MakeCurlCommandMulti( + f"{{curl_base}} --verbose --http1.1 --insecure --header 'Host: one.two.three' '{url}'" + LogTee + + " ; grep -F -e '< HTTP' -e Authorization {0}/url_sig_long.log > {0}/url_sig_short.log ".format(ts.RunDirectory), + uds_path=ts.Variables.uds_path) # Overriding the built in ERROR check since we expect some ERROR messages ts.Disk.diags_log.Content = Testers.ContainsExpression("ERROR", "Some tests are failure tests") diff --git a/tests/gold_tests/pluginTest/url_sig/url_sig_uds.test.py b/tests/gold_tests/pluginTest/url_sig/url_sig_uds.test.py deleted file mode 100644 index 95a2e9e1849..00000000000 --- a/tests/gold_tests/pluginTest/url_sig/url_sig_uds.test.py +++ /dev/null @@ -1,266 +0,0 @@ -''' -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import hashlib -import hmac - -Test.Summary = ''' -Test url_sig plugin -''' - -Test.ContinueOnFail = True - -# Skip if plugins not present. -Test.SkipUnless(Condition.PluginExists('url_sig.so')) - -# Set up to check the output after the tests have run. -# -url_sig_log_id = Test.Disk.File("url_sig_short.log") -url_sig_log_id.Content = "url_sig.gold" - -server = Test.MakeOriginServer("server") - -request_header = { - "headers": "GET /foo/abcde/qrstuvwxyz HTTP/1.1\r\nHost: just.any.thing\r\n\r\n", - "timestamp": "1469733493.993", - "body": "" -} -# expected response from the origin server -response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""} -# add response to the server dictionary -server.addResponse("sessionfile.log", request_header, response_header) - -# Define default ATS. Disable the cache to make sure each request is forwarded -# to the origin server. -ts = Test.MakeATSProcess("ts", enable_tls=True, enable_cache=False) - -ts.addDefaultSSLFiles() - -ts.Disk.records_config.update( - { - # 'proxy.config.diags.debug.enabled': 1, - # 'proxy.config.diags.debug.tags': 'http|url_sig', - 'proxy.config.proxy_name': 'Poxy_Proxy', # This will be the server name. - 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), - 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), - }) - -ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') - -# Use unchanged incoming URL. -# -ts.Setup.Copy("url_sig.config", ts.Variables.CONFIGDIR) -ts.Disk.remap_config.AddLine( - f'map http://one.two.three/ http://127.0.0.1:{server.Variables.Port}/' + ' @plugin=url_sig.so @pparam=url_sig.config') - -# Use unchanged incoming HTTPS URL. -# -ts.Disk.remap_config.AddLine( - f'map https://one.two.three/ http://127.0.0.1:{server.Variables.Port}/' + ' @plugin=url_sig.so @pparam=url_sig.config') - -# Use pristine URL, incoming URL unchanged. -# -ts.Disk.remap_config.AddLine( - f'map http://four.five.six/ http://127.0.0.1:{server.Variables.Port}/' + - ' @plugin=url_sig.so @pparam=url_sig.config @pparam=pristineurl') - -# Use pristine URL, incoming URL changed. -# -ts.Disk.remap_config.AddLine( - f'map http://seven.eight.nine/ http://127.0.0.1:{server.Variables.Port}' + - ' @plugin=url_sig.so @pparam=url_sig.config @pparam=PristineUrl') - -# Use config with all settings set -# -ts.Setup.Copy("url_sig.all.config", ts.Variables.CONFIGDIR) -ts.Disk.remap_config.AddLine( - f'map http://ten.eleven.twelve/ http://127.0.0.1:{server.Variables.Port}/' + ' @plugin=url_sig.so @pparam=url_sig.all.config') - -# Validation failure tests. - -LogTee = f" 2>&1 | grep '^<' | tee -a {Test.RunDirectory}/url_sig_long.log" - -# Bad client / MD5 / P=101 / URL pristine / URL altered. -# -tr = Test.AddTestRun() -tr.Processes.Default.StartBefore(ts) -tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand( - f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.2&E=33046620008&A=2&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) - -# With client / MD5 / P=010 / URL pristine / URL altered -- Expired. -# -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand( - f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=1&A=2&K=13&P=010&S=f237aad1fa010234d7bf8108a0e36387'" + LogTee) - -# With client / No algorithm / P=101 / URL pristine / URL altered. -# -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand( - f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) - -# With client / Bad algorithm / P=101 / URL pristine / URL altered. -# -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand( - f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=3&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) - -# With client / MD5 / No parts / URL pristine / URL altered. -# -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand( - f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) - -# With client / MD5 / P=10 (bad) / URL pristine / URL altered. -# -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand( - f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=10&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) - -# With client / MD5 / P=101 / URL pristine / URL altered -- No signature. -# -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand( - f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101'" + LogTee) - -# With client / MD5 / P=101 / URL pristine / URL altered -- Bad signature. -# -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand( - f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=d1f452d4f1d931ad2f441013402d93f8'" + LogTee) - -# With client / MD5 / P=101 / URL pristine / URL altered -- Spurious &. -# -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand( - f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8#'" + LogTee) - -# Success tests. - -# With client / SHA1 / P=1 / URL pristine / URL not altered. -# -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand( - f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://four.five.six/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046618556&A=1&K=15&P=1&S=f4103561a23adab7723a89b9831d77e0afb61d92'" + LogTee) - -# No client / MD5 / P=1 / URL pristine / URL altered. -# -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand( - f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?E=33046618586&A=2&K=0&P=1&S=0364efa28afe345544596705b92d20ac'" + LogTee) - -# With client / MD5 / P=010 / URL pristine / URL altered. -# -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand( - f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046619717&A=2&K=13&P=010&S=f237aad1fa010234d7bf8108a0e36387'" + LogTee) - -# With client / MD5 / P=101 / URL pristine / URL altered. -# -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand( - f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://seven.eight.nine/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=d1f352d4f1d931ad2f441013402d93f8'" + LogTee) - - -def sign(payload, key): - secret = bytes(key, 'utf-8') - data = bytes(payload, 'utf-8') - md = bytes(hmac.new(secret, data, digestmod=hashlib.sha1).digest().hex(), 'utf-8') - return md.decode("utf-8") - - -# No client / SHA1 / P=1 / URL not pristine / URL not altered. -# -path = "foo/abcde/qrstuvwxyz?E=33046618506&A=1&K=7&P=1&S=" -to_sign = f"127.0.0.1:{server.Variables.Port}/{path}" -url = "http://one.two.three/" + path + sign(to_sign, "dqsgopTSM_doT6iAysasQVUKaPykyb6e") - -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand(f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} '{url}'" + LogTee) - -# With client / MD5 / P=101 / URL pristine / URL altered. -# uses url_type pristine in config -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand( - f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://ten.eleven.twelve/" + - "foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=586ef8e808caeeea025c525c89ff2638'" + LogTee) - -# Single fail test - check for bad path param inserted -# With client / MD5 / P=101 / URL pristine / URL altered. Bad Path Param -# uses url_type pristine in config -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand( - f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://ten.eleven.twelve/" + - "foo/abcde/qrstuvwxyz;badparam=true?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=586ef8e808caeeea025c525c89ff2638'" + LogTee) - -# Success -# With client / SHA1 / P=1 / URL pristine / URL altered. Base64 Encoded Path Param -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommand( - f"--verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://ten.eleven.twelve/" + - "foo/abcde;urlsig=Qz0xMjcuMC4wLjE7RT0zMzA0NjYyMDAwODtBPTI7Sz0xMztQPTEwMTtTPTA1MDllZjljY2VlNjUxZWQ1OTQxM2MyZjE3YmVhODZh/qrstuvwxyz'" - + LogTee) - -# Success -# This test must be last since it converts from the long to the short log output -# No client / SHA1 / P=1 / URL not pristine / URL not altered -- HTTPS. -# -path = "foo/abcde/qrstuvwxyz?E=33046618506&A=1&K=7&P=1&S=" -to_sign = f"127.0.0.1:{server.Variables.Port}/{path}" -url = f"https://127.0.0.1:{ts.Variables.ssl_port}/{path}" + sign(to_sign, "dqsgopTSM_doT6iAysasQVUKaPykyb6e") - -tr = Test.AddTestRun() -tr.Processes.Default.ReturnCode = 0 -tr.MakeCurlCommandMulti( - f"{curl_base} --verbose --http1.1 --insecure --header 'Host: one.two.three' '{url}'" + LogTee + - " ; grep -F -e '< HTTP' -e Authorization {0}/url_sig_long.log > {0}/url_sig_short.log ".format(ts.RunDirectory)) - -# Overriding the built in ERROR check since we expect some ERROR messages -ts.Disk.diags_log.Content = Testers.ContainsExpression("ERROR", "Some tests are failure tests") -ts.Disk.diags_log.Content += Testers.ExcludesExpression("Error parsing", "Verify that we can accept long comment lines") diff --git a/tests/gold_tests/post/post-continue.test.py b/tests/gold_tests/post/post-continue.test.py index d85cf952426..197ec92e92e 100644 --- a/tests/gold_tests/post/post-continue.test.py +++ b/tests/gold_tests/post/post-continue.test.py @@ -25,7 +25,7 @@ Test the Expect header in post ''' # Require HTTP/2 enabled Curl -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) Test.SkipUnless(Condition.HasCurlFeature('http2'),) Test.ContinueOnFail = True diff --git a/tests/gold_tests/post/post-early-return.test.py b/tests/gold_tests/post/post-early-return.test.py index 1acb5567b98..7df9350c246 100644 --- a/tests/gold_tests/post/post-early-return.test.py +++ b/tests/gold_tests/post/post-early-return.test.py @@ -24,7 +24,7 @@ Test.Summary = ''' Test a case when the origin returns before the post is completed ''' -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) Test.ContinueOnFail = True Test.GetTcpPort("upstream_port1") diff --git a/tests/gold_tests/post_slow_server/post_slow_server.test.py b/tests/gold_tests/post_slow_server/post_slow_server.test.py index c51f88c71ed..a1e616b301e 100644 --- a/tests/gold_tests/post_slow_server/post_slow_server.test.py +++ b/tests/gold_tests/post_slow_server/post_slow_server.test.py @@ -52,7 +52,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '--request POST --verbose --ipv4 --http2 --insecure --header "Content-Length: 0"' + - " --header 'Host: localhost' https://localhost:{}/xyz >curl.log 2>curl.err".format(ts.Variables.ssl_port)) + " --header 'Host: localhost' https://localhost:{}/xyz >curl.log 2>curl.err".format(ts.Variables.ssl_port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(ts) diff --git a/tests/gold_tests/post_slow_server/post_slow_server_max_requests_in.test.py b/tests/gold_tests/post_slow_server/post_slow_server_max_requests_in.test.py index 59de42ce27a..3c8cfc56ac5 100644 --- a/tests/gold_tests/post_slow_server/post_slow_server_max_requests_in.test.py +++ b/tests/gold_tests/post_slow_server/post_slow_server_max_requests_in.test.py @@ -17,7 +17,6 @@ # limitations under the License. from enum import Enum -import os Test.Summary = 'Exercise POST request with max_requests_in' Test.ContinueOnFail = True @@ -40,10 +39,9 @@ def __setupOriginServer(self): def __setupTS(self): self.ts = Test.MakeATSProcess("ts") - uds_path = os.path.join(Test.RunDirectory, 'uds.socket') self.ts.Disk.records_config.update( { - "proxy.config.http.server_ports": f"{self.ts.Variables.port} {uds_path}", + "proxy.config.http.server_ports": f"{self.ts.Variables.port} {self.ts.Variables.uds_path}", "proxy.config.net.max_requests_in": 1000, 'proxy.config.http.connect_attempts_timeout': 1, "proxy.config.diags.debug.enabled": 1, @@ -63,7 +61,9 @@ def __testCase0(self): tr = Test.AddTestRun() tr.Processes.Default.StartBefore(self.origin_server) tr.Processes.Default.StartBefore(self.ts) - tr.MakeCurlCommand(f"-X POST --http1.1 -vs http://127.0.0.1:{self.ts.Variables.port}/ --data key=value") + tr.MakeCurlCommand( + f"-X POST --http1.1 -vs http://127.0.0.1:{self.ts.Variables.port}/ --data key=value", + uds_path=self.ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/post_slow_server_max_requests_in_0_stdout.gold" tr.Processes.Default.Streams.stderr = "gold/post_slow_server_max_requests_in_0_stderr.gold" diff --git a/tests/gold_tests/proxy_protocol/proxy_serve_stale_dns_fail.test.py b/tests/gold_tests/proxy_protocol/proxy_serve_stale_dns_fail.test.py index af8ef77b05b..c861207c332 100644 --- a/tests/gold_tests/proxy_protocol/proxy_serve_stale_dns_fail.test.py +++ b/tests/gold_tests/proxy_protocol/proxy_serve_stale_dns_fail.test.py @@ -71,7 +71,7 @@ # Test case for when parent server is down but child proxy can serve cache object tr = Test.AddTestRun() -tr.MakeCurlCommandMulti(child_curl_request) +tr.MakeCurlCommandMulti(child_curl_request, uds_path=ts_child.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(ts_child) tr.Processes.Default.StartBefore(ts_parent) diff --git a/tests/gold_tests/redirect/number_of_redirects.test.py b/tests/gold_tests/redirect/number_of_redirects.test.py index 2c4b8108ee9..72ed17e53ca 100644 --- a/tests/gold_tests/redirect/number_of_redirects.test.py +++ b/tests/gold_tests/redirect/number_of_redirects.test.py @@ -84,7 +84,8 @@ def run(self): self._tr.Processes.Default.StartBefore(self._dns) self._tr.Processes.Default.StartBefore(self._ts) self._tr.MakeCurlCommand( - "-L -v a.test/ping --proxy 127.0.0.1:{0} -H 'uuid: redirect_test_1'".format(self._ts.Variables.port)) + "-L -v a.test/ping --proxy 127.0.0.1:{0} -H 'uuid: redirect_test_1'".format(self._ts.Variables.port), + uds_path=self._ts.Variables.uds_path) self._tr.Processes.Default.Streams.All = f"gold/number_of_redirections_{self._numberOfRedirections}.gold" self._tr.ReturnCode = 0 self._tr.StillRunningAfter = self._ts diff --git a/tests/gold_tests/redirect/redirect_post.test.py b/tests/gold_tests/redirect/redirect_post.test.py index 1ceab0c9b6c..7b288821cc1 100644 --- a/tests/gold_tests/redirect/redirect_post.test.py +++ b/tests/gold_tests/redirect/redirect_post.test.py @@ -80,7 +80,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommandMulti( 'touch largefile.txt && truncate -s 50M largefile.txt && {{curl}} -H "Expect: " -i http://127.0.0.1:{0}/redirect1 -F "filename=@./largefile.txt" && rm -f largefile.txt' - .format(ts.Variables.port)) + .format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.TimeOut = 10 tr.Processes.Default.StartBefore(ts) tr.Processes.Default.StartBefore(redirect_serv1) diff --git a/tests/gold_tests/remap/basic_conf_remap_yaml.test.py b/tests/gold_tests/remap/basic_conf_remap_yaml.test.py index 9f39db2b4b2..dd464cd7cd4 100644 --- a/tests/gold_tests/remap/basic_conf_remap_yaml.test.py +++ b/tests/gold_tests/remap/basic_conf_remap_yaml.test.py @@ -20,7 +20,6 @@ Test conf_remap using a yaml file. ''' -Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True @@ -115,16 +114,24 @@ def run(self, diags_fail_exp="", ts_retcode=0): self._ts.Disk.remap_config.AddLine( f'map http://www.testexample.com/ http://127.0.0.1:{self._server.Variables.Port} @plugin=conf_remap.so @pparam={self._remap_filename}' ) - - tr.MakeCurlCommand( - '--proxy 127.0.0.1:{0} "http://www.testexample.com/test" -H "Host: www.testexample.com" --verbose'.format( - self._ts.Variables.port)) + if Condition.CurlUsingUnixDomainSocket(): + tr.MakeCurlCommand( + '-H "Host: www.testexample.com" "http://127.0.0.1:{0}/test" --verbose'.format(self._ts.Variables.port), + uds_path=self._ts.Variables.uds_path) + else: + tr.MakeCurlCommand( + '--proxy 127.0.0.1:{0} "http://www.testexample.com/test" -H "Host: www.testexample.com" --verbose'.format( + self._ts.Variables.port)) conf_remap_yaml_load_test.client_counter += 1 +gold_file = "gold/200OK_test.gold" +if Condition.CurlUsingUnixDomainSocket(): + gold_file = "gold/200OK_test_uds.gold" + test0 = conf_remap_yaml_load_test( "Test success", - gold_file="gold/200OK_test.gold", + gold_file=gold_file, remap_filename="testexample_remap.yaml", remap_content=''' records: @@ -159,7 +166,7 @@ def run(self, diags_fail_exp="", ts_retcode=0): # We let the conf_remap parse two fields, only one is valid, we expect ATS to start and the invalid fields ignored. test3 = conf_remap_yaml_load_test( "Test success", - gold_file="gold/200OK_test.gold", + gold_file=gold_file, remap_filename="testexample2_remap.yaml", remap_content=''' records: @@ -174,7 +181,7 @@ def run(self, diags_fail_exp="", ts_retcode=0): # Check null values test4 = conf_remap_yaml_load_test( "Test success - with NULL variable", - gold_file="gold/200OK_test.gold", + gold_file=gold_file, remap_filename="testexample_remap.yaml", remap_content=''' records: diff --git a/tests/gold_tests/remap/basic_conf_remap_yaml_uds.test.py b/tests/gold_tests/remap/basic_conf_remap_yaml_uds.test.py deleted file mode 100644 index 96502933295..00000000000 --- a/tests/gold_tests/remap/basic_conf_remap_yaml_uds.test.py +++ /dev/null @@ -1,183 +0,0 @@ -''' -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -Test.Summary = ''' -Test conf_remap using a yaml file. -''' - -Test.ContinueOnFail = True - - -class conf_remap_yaml_load_test: - """Test conf_remap using a yaml file.""" - - client_counter: int = 0 - ts_counter: int = 0 - server_counter: int = 0 - - def __init__(self, name: str, gold_file="", remap_filename="", remap_content=""): - """Initialize the test. - :param name: The name of the test. - :param gold_file: Gold file to be checked. - :param remap_filename: Remap yaml filename. - :param remap_content: remap yaml file content. - """ - self.name = name - self.gold_file = gold_file - self._remap_filename = remap_filename - self._remap_content = remap_content - - def _configure_server(self, tr: 'TestRun'): - """Configure the server. - - :param tr: The TestRun object to associate the server process with. - """ - server = Test.MakeOriginServer(f"server-{conf_remap_yaml_load_test.ts_counter}", lookup_key="{%Host}{PATH}") - request_header2 = { - "headers": "GET /test HTTP/1.1\r\nHost: www.testexample.com\r\n\r\n", - "timestamp": "1469733493.993", - "body": "" - } - response_header2 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""} - - server.addResponse("sessionfile.log", request_header2, response_header2) - conf_remap_yaml_load_test.server_counter += 1 - self._server = server - - def _configure_traffic_server(self, tr: 'TestRun'): - """Configure Traffic Server. - - :param tr: The TestRun object to associate the ts process with. - """ - ts = Test.MakeATSProcess(f"ts-{conf_remap_yaml_load_test.ts_counter}") - - conf_remap_yaml_load_test.ts_counter += 1 - ts.Disk.records_config.update( - ''' - diags: - debug: - enabled: 1 - tags: conf_remap - dns: - resolv_conf: NULL - http: - referer_filter: 1 - url_remap: - pristine_host_hdr: 0 # make sure is 0 - - ''') - self._ts = ts - - def run(self, diags_fail_exp="", ts_retcode=0): - """Run the test. - :param diags_fail_exp: Text to be included to validate the error. - :param ts_retcode: Expected return code from TS. - """ - tr = Test.AddTestRun(self.name) - self._configure_server(tr) - self._configure_traffic_server(tr) - - tr.Processes.Default.StartBefore(self._server) - tr.Processes.Default.StartBefore(self._ts) - - self._ts.ReturnCode = ts_retcode - - if ts_retcode > 0: # we could have errors logged and yet, we still want to move on. - self._ts.Ready = 0 - - if diags_fail_exp != "": - # some error logs will be written to the diags. - self._ts.Disk.diags_log.Content = Testers.IncludesExpression(diags_fail_exp, "Have a look.") - else: - tr.Processes.Default.ReturnCode = 0 - - if self.gold_file: - tr.Processes.Default.Streams.stderr = self.gold_file - - if self._remap_filename != "" and self._remap_content != "": - self._ts.Disk.MakeConfigFile(self._remap_filename).update(self._remap_content) - self._ts.Disk.remap_config.AddLine( - f'map http://www.testexample.com/ http://127.0.0.1:{self._server.Variables.Port} @plugin=conf_remap.so @pparam={self._remap_filename}' - ) - - tr.MakeCurlCommand('-H "Host: www.testexample.com" "http://127.0.0.1:{0}/test" --verbose'.format(self._ts.Variables.port)) - conf_remap_yaml_load_test.client_counter += 1 - - -test0 = conf_remap_yaml_load_test( - "Test success", - gold_file="gold/200OK_test_uds.gold", - remap_filename="testexample_remap.yaml", - remap_content=''' - records: - url_remap: - pristine_host_hdr: 1 - ''') -test0.run() - -test1 = conf_remap_yaml_load_test( - "Test mismatch type", - remap_filename="mismatch_field_type_remap.yaml", - remap_content=''' - records: - url_remap: - pristine_host_hdr: !!float '1' - ''') -test1.run(diags_fail_exp="'proxy.config.url_remap.pristine_host_hdr' variable type mismatch", ts_retcode=33) - -test2 = conf_remap_yaml_load_test( - "Test invalid variable", - remap_filename="invalid1_field_type_remap.yaml", - remap_content=''' - records: - plugin: - dynamic_reload_mode: 1 - ''') - -test2.run( - diags_fail_exp="'proxy.config.plugin.dynamic_reload_mode' is not a configuration variable or cannot be overridden", - ts_retcode=33) - -# We let the conf_remap parse two fields, only one is valid, we expect ATS to start and the invalid fields ignored. -test3 = conf_remap_yaml_load_test( - "Test success", - gold_file="gold/200OK_test_uds.gold", - remap_filename="testexample2_remap.yaml", - remap_content=''' - records: - plugin: - dynamic_reload_mode: 1 - - url_remap: - pristine_host_hdr: 1 - ''') -test3.run(diags_fail_exp="'proxy.config.plugin.dynamic_reload_mode' is not a configuration variable or cannot be overridden") - -# Check null values -test4 = conf_remap_yaml_load_test( - "Test success - with NULL variable", - gold_file="gold/200OK_test_uds.gold", - remap_filename="testexample_remap.yaml", - remap_content=''' - records: - url_remap: - pristine_host_hdr: 1 - hostdb: - ip_resolve: "NULL" # We want to make sure this gets read as it should. "NULL" could be the value of this field. - ''') -test4.run() diff --git a/tests/gold_tests/remap/regex_map.test.py b/tests/gold_tests/remap/regex_map.test.py index b030ac949fd..5e05add38ef 100644 --- a/tests/gold_tests/remap/regex_map.test.py +++ b/tests/gold_tests/remap/regex_map.test.py @@ -50,7 +50,8 @@ r'https://www.example.com:{}/one/two/three/blah12345.html'.format(server.Variables.Port)) tr = Test.AddTestRun() -tr.MakeCurlCommand('-H"Host: zero.one.two.three.com" http://127.0.0.1:{0}/ --verbose'.format(ts.Variables.port)) +tr.MakeCurlCommand( + '-H"Host: zero.one.two.three.com" http://127.0.0.1:{0}/ --verbose'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(dns) diff --git a/tests/gold_tests/remap/remap_http.test.py b/tests/gold_tests/remap/remap_http.test.py index 9d573c056d9..3be16cab01d 100644 --- a/tests/gold_tests/remap/remap_http.test.py +++ b/tests/gold_tests/remap/remap_http.test.py @@ -66,7 +66,7 @@ # call localhost straight tr = Test.AddTestRun() -tr.MakeCurlCommand('"http://127.0.0.1:{0}/" --verbose'.format(ts.Variables.port)) +tr.MakeCurlCommand('"http://127.0.0.1:{0}/" --verbose'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(dns) @@ -77,73 +77,85 @@ # www.example.com host tr = Test.AddTestRun() tr.MakeCurlCommand( - '--proxy 127.0.0.1:{0} "http://www.example.com" -H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port)) + '--proxy 127.0.0.1:{0} "http://www.example.com" -H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/remap-200.gold" # www.example2.com host (match on receive port) tr = Test.AddTestRun() tr.MakeCurlCommand( - '--proxy 127.0.0.1:{0} "http://www.example2.com" -H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port)) + '--proxy 127.0.0.1:{0} "http://www.example2.com" -H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/remap2-200.gold" # www.example.com:80 host tr = Test.AddTestRun() tr.MakeCurlCommand( - ' --proxy 127.0.0.1:{0} "http://www.example.com:80/" -H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port)) + ' --proxy 127.0.0.1:{0} "http://www.example.com:80/" -H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/remap-200.gold" # www.example.com:8080 host tr = Test.AddTestRun() tr.MakeCurlCommand( - ' --proxy 127.0.0.1:{0} "http://www.example.com:8080" -H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port)) + ' --proxy 127.0.0.1:{0} "http://www.example.com:8080" -H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/remap-200.gold" # no rule for this tr = Test.AddTestRun() tr.MakeCurlCommand( - ' --proxy 127.0.0.1:{0} "http://www.test.com/" -H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port)) + ' --proxy 127.0.0.1:{0} "http://www.test.com/" -H "Proxy-Connection: keep-alive" --verbose'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/remap-404.gold" # redirect result tr = Test.AddTestRun() -tr.MakeCurlCommand(' --proxy 127.0.0.1:{0} "http://test3.com" --verbose'.format(ts.Variables.port)) +tr.MakeCurlCommand(' --proxy 127.0.0.1:{0} "http://test3.com" --verbose'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/remap-redirect.gold" # referer hit tr = Test.AddTestRun() -tr.MakeCurlCommand(' --proxy 127.0.0.1:{0} "http://test4.com" --header "Referer: persia.com" --verbose'.format(ts.Variables.port)) +tr.MakeCurlCommand( + ' --proxy 127.0.0.1:{0} "http://test4.com" --header "Referer: persia.com" --verbose'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/remap-referer-hit.gold" # referer miss tr = Test.AddTestRun() -tr.MakeCurlCommand(' --proxy 127.0.0.1:{0} "http://test4.com" --header "Referer: monkey.com" --verbose'.format(ts.Variables.port)) +tr.MakeCurlCommand( + ' --proxy 127.0.0.1:{0} "http://test4.com" --header "Referer: monkey.com" --verbose'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/remap-referer-miss.gold" # referer hit tr = Test.AddTestRun() tr.MakeCurlCommand( - ' --proxy 127.0.0.1:{0} "http://test4.com" --header "Referer: www.persia.com" --verbose'.format(ts.Variables.port)) + ' --proxy 127.0.0.1:{0} "http://test4.com" --header "Referer: www.persia.com" --verbose'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/remap-referer-hit.gold" # DNS test tr = Test.AddTestRun() -tr.MakeCurlCommand(' --proxy 127.0.0.1:{0} "http://testDNS.com" --verbose'.format(ts.Variables.port)) +tr.MakeCurlCommand( + ' --proxy 127.0.0.1:{0} "http://testDNS.com" --verbose'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/remap-DNS-200.gold" # microserver lookup test tr = Test.AddTestRun() tr.MakeCurlCommand( - '--proxy 127.0.0.1:{0} "http://www.testexample.com/test" -H "Host: www.testexample.com" --verbose'.format(ts.Variables.port)) + '--proxy 127.0.0.1:{0} "http://www.testexample.com/test" -H "Host: www.testexample.com" --verbose'.format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server2) tr.Processes.Default.Streams.stderr = "gold/lookupTest.gold" diff --git a/tests/gold_tests/remap/remap_https.test.py b/tests/gold_tests/remap/remap_https.test.py index 973edcb6226..e116129046d 100644 --- a/tests/gold_tests/remap/remap_https.test.py +++ b/tests/gold_tests/remap/remap_https.test.py @@ -20,7 +20,7 @@ Test a basic remap of a http connection ''' -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) Test.ContinueOnFail = True # Define default ATS ts = Test.MakeATSProcess("ts", enable_tls=True) diff --git a/tests/gold_tests/remap/remap_ip_resolve.test.py b/tests/gold_tests/remap/remap_ip_resolve.test.py index 4be4665b090..691662b0398 100644 --- a/tests/gold_tests/remap/remap_ip_resolve.test.py +++ b/tests/gold_tests/remap/remap_ip_resolve.test.py @@ -57,7 +57,8 @@ dns.addRecords(records={"test.ipv6.only.com": ["127.0.0.1", "::1"]}) tr = Test.AddTestRun() -tr.MakeCurlCommand(' --proxy 127.0.0.1:{0} "http://testDNS.com" --verbose'.format(ts.Variables.port)) +tr.MakeCurlCommand( + ' --proxy 127.0.0.1:{0} "http://testDNS.com" --verbose'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(dns) @@ -66,7 +67,8 @@ tr.StillRunningAfter = server tr = Test.AddTestRun() -tr.MakeCurlCommand(' --proxy 127.0.0.1:{0} "http://testDNS2.com" --verbose'.format(ts.Variables.port)) +tr.MakeCurlCommand( + ' --proxy 127.0.0.1:{0} "http://testDNS2.com" --verbose'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server_v6) tr.Processes.Default.Streams.stderr = "gold/remap-DNS-ipv6-200.gold" diff --git a/tests/gold_tests/remap/remap_ws.test.py b/tests/gold_tests/remap/remap_ws.test.py index a25dccb17ef..74d9861eaa0 100644 --- a/tests/gold_tests/remap/remap_ws.test.py +++ b/tests/gold_tests/remap/remap_ws.test.py @@ -20,7 +20,6 @@ Test a basic remap of a websocket connections ''' -Test.SkipIf(Condition.CurlUds()) Test.ContinueOnFail = True ts = Test.MakeATSProcess("ts", enable_tls=True) @@ -54,23 +53,28 @@ ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') -# wss mapping -tr = Test.AddTestRun() -tr.Processes.Default.StartBefore(server) -tr.Processes.Default.StartBefore(Test.Processes.ts, ready=1) -tr.MakeCurlCommand( - '--max-time 2 -v -s -q -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" -H "Sec-WebSocket-Version: 13" --http1.1 --resolve www.example.com:{0}:127.0.0.1 -k https://www.example.com:{0}/chat' - .format(ts.Variables.ssl_port)) -tr.Processes.Default.ReturnCode = 28 -tr.Processes.Default.Streams.stderr = "gold/remap-ws-upgrade.gold" -tr.StillRunningAfter = server -tr.StillRunningAfter = ts +if not Condition.CurlUsingUnixDomainSocket(): + # wss mapping + tr = Test.AddTestRun() + tr.Processes.Default.StartBefore(server) + tr.Processes.Default.StartBefore(Test.Processes.ts, ready=1) + tr.MakeCurlCommand( + '--max-time 2 -v -s -q -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" -H "Sec-WebSocket-Version: 13" --http1.1 --resolve www.example.com:{0}:127.0.0.1 -k https://www.example.com:{0}/chat' + .format(ts.Variables.ssl_port)) + tr.Processes.Default.ReturnCode = 28 + tr.Processes.Default.Streams.stderr = "gold/remap-ws-upgrade.gold" + tr.StillRunningAfter = server + tr.StillRunningAfter = ts # ws mapping tr = Test.AddTestRun() +if Condition.CurlUsingUnixDomainSocket(): + tr.Processes.Default.StartBefore(server) + tr.Processes.Default.StartBefore(Test.Processes.ts, ready=1) tr.MakeCurlCommand( '--max-time 2 -v -s -q -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" -H "Sec-WebSocket-Version: 13" --http1.1 --resolve www.example.com:{0}:127.0.0.1 -k http://www.example.com:{0}/chat' - .format(ts.Variables.port)) + .format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 28 tr.Processes.Default.Streams.stderr = "gold/remap-ws-upgrade.gold" tr.StillRunningAfter = server @@ -80,7 +84,8 @@ tr = Test.AddTestRun() tr.MakeCurlCommand( '--max-time 2 -v -s -q -H "Connection: Upgrade" -H "Upgrade: websocket" --http1.1 --resolve www.example.com:{0}:127.0.0.1 -k http://www.example.com:{0}/chat' - .format(ts.Variables.port)) + .format(ts.Variables.port), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stderr = "gold/remap-ws-upgrade-400.gold" tr.StillRunningAfter = server diff --git a/tests/gold_tests/remap/remap_ws_uds.test.py b/tests/gold_tests/remap/remap_ws_uds.test.py deleted file mode 100644 index 6c3d6f7aa30..00000000000 --- a/tests/gold_tests/remap/remap_ws_uds.test.py +++ /dev/null @@ -1,97 +0,0 @@ -''' -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -Test.Summary = ''' -Test a basic remap of a websocket connections -''' - -Test.ContinueOnFail = True - -ts = Test.MakeATSProcess("ts", enable_tls=True) -server = Test.MakeOriginServer("server") - -testName = "Test WebSocket Remaps" -request_header = { - "headers": "GET /chat HTTP/1.1\r\nHost: www.example.com\r\nUpgrade: websocket\r\nConnection: Upgrade\r\n\r\n", - "body": None -} -response_header = { - "headers": - "HTTP/1.1 101 OK\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n\r\n", - "body": None -} -server.addResponse("sessionlog.json", request_header, response_header) - -ts.addDefaultSSLFiles() - -ts.Disk.records_config.update( - { - 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), - 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), - }) - -ts.Disk.remap_config.AddLines( - [ - 'map ws://www.example.com:{1} ws://127.0.0.1:{0}'.format(server.Variables.Port, ts.Variables.port), - 'map wss://www.example.com:{1} ws://127.0.0.1:{0}'.format(server.Variables.Port, ts.Variables.ssl_port), - ]) - -ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key') - -# ws mapping -tr = Test.AddTestRun() -tr.MakeCurlCommand( - '--max-time 2 -v -s -q -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" -H "Sec-WebSocket-Version: 13" --http1.1 --resolve www.example.com:{0}:127.0.0.1 -k http://www.example.com:{0}/chat' - .format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 28 -tr.Processes.Default.Streams.stderr = "gold/remap-ws-upgrade.gold" -tr.StillRunningAfter = server -tr.StillRunningAfter = ts - -# Missing required headers (should result in 400) -tr = Test.AddTestRun() -tr.MakeCurlCommand( - '--max-time 2 -v -s -q -H "Connection: Upgrade" -H "Upgrade: websocket" --http1.1 --resolve www.example.com:{0}:127.0.0.1 -k http://www.example.com:{0}/chat' - .format(ts.Variables.port)) -tr.Processes.Default.ReturnCode = 0 -tr.Processes.Default.Streams.stderr = "gold/remap-ws-upgrade-400.gold" -tr.StillRunningAfter = server -tr.StillRunningAfter = ts - -# Test metrics -tr = Test.AddTestRun() -tr.Processes.Default.Command = ( - f"{Test.Variables.AtsTestToolsDir}/stdout_wait" + " 'traffic_ctl metric get" + - " proxy.process.http.total_incoming_connections" + " proxy.process.http.total_client_connections" + - " proxy.process.http.total_client_connections_ipv4" + " proxy.process.http.total_client_connections_ipv6" + - " proxy.process.http.total_server_connections" + " proxy.process.http2.total_client_connections" + - " proxy.process.http.connect_requests" + " proxy.process.tunnel.total_client_connections_blind_tcp" + - " proxy.process.tunnel.current_client_connections_blind_tcp" + " proxy.process.tunnel.total_server_connections_blind_tcp" + - " proxy.process.tunnel.current_server_connections_blind_tcp" + " proxy.process.tunnel.total_client_connections_tls_tunnel" + - " proxy.process.tunnel.current_client_connections_tls_tunnel" + " proxy.process.tunnel.total_client_connections_tls_forward" + - " proxy.process.tunnel.current_client_connections_tls_forward" + - " proxy.process.tunnel.total_client_connections_tls_partial_blind" + - " proxy.process.tunnel.current_client_connections_tls_partial_blind" + - " proxy.process.tunnel.total_client_connections_tls_http" + " proxy.process.tunnel.current_client_connections_tls_http" + - " proxy.process.tunnel.total_server_connections_tls" + " proxy.process.tunnel.current_server_connections_tls'" + - f" {Test.TestDirectory}/gold/remap-ws-metrics.gold") -# Need to copy over the environment so traffic_ctl knows where to find the unix domain socket -tr.Processes.Default.Env = ts.Env -tr.Processes.Default.ReturnCode = 0 -tr.StillRunningAfter = server -tr.StillRunningAfter = ts diff --git a/tests/gold_tests/session_sharing/session_match.test.py b/tests/gold_tests/session_sharing/session_match.test.py index ff330ea254d..85659fd0d27 100644 --- a/tests/gold_tests/session_sharing/session_match.test.py +++ b/tests/gold_tests/session_sharing/session_match.test.py @@ -90,7 +90,8 @@ def _runTraffic(self): '{{curl}} -v -H\'Host: www.example.com\' -H\'Connection: close\' http://127.0.0.1:{port}/one &&' '{{curl}} -v -H\'Host: www.example.com\' -H\'Connection: close\' http://127.0.0.1:{port}/two &&' '{{curl}} -v -H\'Host: www.example.com\' -H\'Connection: close\' http://127.0.0.1:{port}/three'.format( - port=self._ts.Variables.port)) + port=self._ts.Variables.port), + uds_path=self._ts.Variables.uds_path) self._tr.Processes.Default.ReturnCode = 0 self._tr.Processes.Default.StartBefore(self._server) self._tr.Processes.Default.StartBefore(self._ts) diff --git a/tests/gold_tests/slow_post/server_abort.test.py b/tests/gold_tests/slow_post/server_abort.test.py index f0f65a5d3f4..066dd4fb0f5 100644 --- a/tests/gold_tests/slow_post/server_abort.test.py +++ b/tests/gold_tests/slow_post/server_abort.test.py @@ -20,7 +20,7 @@ Test.Summary = ''' AuTest with bad configuration of microserver to simulate server aborting the connection unexpectedly ''' -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) ts = Test.MakeATSProcess("ts", enable_tls=True) # note the microserver by default is not configured to use ssl server = Test.MakeOriginServer("server") diff --git a/tests/gold_tests/timeout/active_timeout.test.py b/tests/gold_tests/timeout/active_timeout.test.py index 36269874993..b09db96d3f8 100644 --- a/tests/gold_tests/timeout/active_timeout.test.py +++ b/tests/gold_tests/timeout/active_timeout.test.py @@ -18,7 +18,6 @@ Test.Summary = 'Testing ATS active timeout' -Test.SkipIf(Condition.CurlUds()) Test.SkipUnless(Condition.HasCurlFeature('http2')) if Condition.HasATSFeature('TS_USE_QUIC') and Condition.HasCurlFeature('http3'): @@ -32,8 +31,7 @@ server.addResponse("sessionfile.log", request_header, response_header) -ts.addSSLfile("../tls/ssl/server.pem") -ts.addSSLfile("../tls/ssl/server.key") +ts.addDefaultSSLFiles() ts.Disk.records_config.update( { @@ -50,18 +48,20 @@ tr = Test.AddTestRun("tr") tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(ts) -tr.MakeCurlCommand('-i http://127.0.0.1:{0}/file'.format(ts.Variables.port)) +tr.MakeCurlCommand('-i http://127.0.0.1:{0}/file'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.Streams.stdout = Testers.ContainsExpression("Activity Timeout", "Request should fail with active timeout") -tr2 = Test.AddTestRun("tr") -tr2.MakeCurlCommand('-k -i --http1.1 https://127.0.0.1:{0}/file'.format(ts.Variables.ssl_port)) -tr2.Processes.Default.Streams.stdout = Testers.ContainsExpression("Activity Timeout", "Request should fail with active timeout") +if not Condition.CurlUsingUnixDomainSocket(): + tr2 = Test.AddTestRun("tr") + tr2.MakeCurlCommand('-k -i --http1.1 https://127.0.0.1:{0}/file'.format(ts.Variables.ssl_port)) + tr2.Processes.Default.Streams.stdout = Testers.ContainsExpression("Activity Timeout", "Request should fail with active timeout") -tr3 = Test.AddTestRun("tr") -tr3.MakeCurlCommand('-k -i --http2 https://127.0.0.1:{0}/file'.format(ts.Variables.ssl_port)) -tr3.Processes.Default.Streams.stdout = Testers.ContainsExpression("Activity Timeout", "Request should fail with active timeout") + tr3 = Test.AddTestRun("tr") + tr3.MakeCurlCommand('-k -i --http2 https://127.0.0.1:{0}/file'.format(ts.Variables.ssl_port)) + tr3.Processes.Default.Streams.stdout = Testers.ContainsExpression("Activity Timeout", "Request should fail with active timeout") -if Condition.HasATSFeature('TS_HAS_QUICHE') and Condition.HasCurlFeature('http3'): - tr4 = Test.AddTestRun("tr") - tr4.MakeCurlCommand('-k -i --http3 https://localhost:{0}/file'.format(ts.Variables.ssl_port)) - tr4.Processes.Default.Streams.stdout = Testers.ContainsExpression("Activity Timeout", "Request should fail with active timeout") + if Condition.HasATSFeature('TS_HAS_QUICHE') and Condition.HasCurlFeature('http3'): + tr4 = Test.AddTestRun("tr") + tr4.MakeCurlCommand('-k -i --http3 https://localhost:{0}/file'.format(ts.Variables.ssl_port)) + tr4.Processes.Default.Streams.stdout = Testers.ContainsExpression( + "Activity Timeout", "Request should fail with active timeout") diff --git a/tests/gold_tests/timeout/active_timeout_uds.test.py b/tests/gold_tests/timeout/active_timeout_uds.test.py deleted file mode 100644 index 97efafa38a5..00000000000 --- a/tests/gold_tests/timeout/active_timeout_uds.test.py +++ /dev/null @@ -1,42 +0,0 @@ -''' -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -Test.Summary = 'Testing ATS active timeout' - -Test.SkipUnless(Condition.HasCurlFeature('http2')) - -ts = Test.MakeATSProcess("ts") -server = Test.MakeOriginServer("server", delay=8) - -request_header = {"headers": "GET /file HTTP/1.1\r\nHost: *\r\n\r\n", "timestamp": "5678", "body": ""} -response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "5678", "body": ""} - -server.addResponse("sessionfile.log", request_header, response_header) - -ts.Disk.records_config.update({ - 'proxy.config.url_remap.remap_required': 1, - 'proxy.config.http.transaction_active_timeout_out': 2, -}) - -ts.Disk.remap_config.AddLine('map / http://127.0.0.1:{0}/'.format(server.Variables.Port)) - -tr = Test.AddTestRun("tr") -tr.Processes.Default.StartBefore(server) -tr.Processes.Default.StartBefore(ts) -tr.MakeCurlCommand('-i http://127.0.0.1:{0}/file'.format(ts.Variables.port)) -tr.Processes.Default.Streams.stdout = Testers.ContainsExpression("Activity Timeout", "Request should fail with active timeout") diff --git a/tests/gold_tests/timeout/inactive_client_timeout.test.py b/tests/gold_tests/timeout/inactive_client_timeout.test.py index 2518cc77da3..6c0a06f3f2c 100644 --- a/tests/gold_tests/timeout/inactive_client_timeout.test.py +++ b/tests/gold_tests/timeout/inactive_client_timeout.test.py @@ -18,15 +18,16 @@ Test.Summary = 'Testing ATS client inactivity timeout' -Test.SkipIf(Condition.CurlUds()) ts = Test.MakeATSProcess("ts", enable_tls=True) -replay_file = "slow_server.yaml" +if Condition.CurlUsingUnixDomainSocket(): + replay_file = "slow_server_uds.yaml" +else: + replay_file = "slow_server.yaml" server = Test.MakeVerifierServerProcess("server", replay_file) Test.ContinueOnFail = True -ts.addSSLfile("../tls/ssl/server.pem") -ts.addSSLfile("../tls/ssl/server.key") +ts.addDefaultSSLFiles() ts.Disk.records_config.update( { @@ -64,7 +65,8 @@ client.Streams.All += Testers.ContainsExpression('x-response: 1', 'Verify that the first response is received') client.Streams.All += Testers.ContainsExpression('x-response: 2', 'Verify that the second response is received') -client.Streams.All += Testers.ContainsExpression('x-response: 3', 'Verify that the third response is received') -client.Streams.All += Testers.ContainsExpression('x-response: 4', 'Verify that the fourth response is received') -client.Streams.All += Testers.ContainsExpression('x-response: 5', 'Verify that the fifth response is received') -client.Streams.All += Testers.ContainsExpression('x-response: 6', 'Verify that the sixth response is received') +if not Condition.CurlUsingUnixDomainSocket(): + client.Streams.All += Testers.ContainsExpression('x-response: 3', 'Verify that the third response is received') + client.Streams.All += Testers.ContainsExpression('x-response: 4', 'Verify that the fourth response is received') + client.Streams.All += Testers.ContainsExpression('x-response: 5', 'Verify that the fifth response is received') + client.Streams.All += Testers.ContainsExpression('x-response: 6', 'Verify that the sixth response is received') diff --git a/tests/gold_tests/timeout/inactive_client_timeout_uds.test.py b/tests/gold_tests/timeout/inactive_client_timeout_uds.test.py deleted file mode 100644 index 9e596915203..00000000000 --- a/tests/gold_tests/timeout/inactive_client_timeout_uds.test.py +++ /dev/null @@ -1,57 +0,0 @@ -''' -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -Test.Summary = 'Testing ATS client inactivity timeout' - -ts = Test.MakeATSProcess("ts", enable_tls=True) -replay_file = "slow_server_uds.yaml" -server = Test.MakeVerifierServerProcess("server", replay_file) - -Test.ContinueOnFail = True - -ts.Disk.records_config.update( - { - 'proxy.config.diags.debug.enabled': 1, - 'proxy.config.diags.debug.tags': 'http', - 'proxy.config.url_remap.remap_required': 1, - 'proxy.config.http.transaction_no_activity_timeout_in': 2, - 'proxy.config.ssl.client.verify.server.policy': 'PERMISSIVE', - }) - -ts.Disk.remap_config.AddLines( - [ - 'map https://www.tls.com/ https://127.0.0.1:{0}'.format(server.Variables.https_port), - 'map / http://127.0.0.1:{0}'.format(server.Variables.http_port), - ]) -# -# Test 1: Verify that server delay does not trigger client activity timeout. -# - -# The Proxy Verifier server will delay for 3 seconds before returning a response. This is more than -# the 2 second proxy.config.http.transaction_no_activity_timeout_in (the client inactivity timeout), -# but less than the default 30 second proxy.config.http.transaction_no_activity_timeout_out (server -# inactivity timeout). These tests therefore exercise that the client inactivity timeout does not -# get applied after the request is sent. In other words, a slow to respond server should not -# trigger the client inactivity timeout. -tr = Test.AddTestRun("Verify that server delay does not trigger client activity timeout.") -client = tr.AddVerifierClientProcess("client", replay_file, http_ports=[ts.Variables.port], https_ports=[ts.Variables.ssl_port]) -tr.Processes.Default.StartBefore(ts) -tr.Processes.Default.StartBefore(server) - -client.Streams.All += Testers.ContainsExpression('x-response: 1', 'Verify that the first response is received') -client.Streams.All += Testers.ContainsExpression('x-response: 2', 'Verify that the second response is received') \ No newline at end of file diff --git a/tests/gold_tests/timeout/inactive_timeout.test.py b/tests/gold_tests/timeout/inactive_timeout.test.py index 58fbe5c9c53..8b08545fe2c 100644 --- a/tests/gold_tests/timeout/inactive_timeout.test.py +++ b/tests/gold_tests/timeout/inactive_timeout.test.py @@ -18,7 +18,6 @@ Test.Summary = 'Testing ATS inactivity timeout' -Test.SkipIf(Condition.CurlUds()) Test.SkipUnless(Condition.HasCurlFeature('http2')) ts = Test.MakeATSProcess("ts", enable_tls=True) @@ -29,8 +28,7 @@ server.addResponse("sessionfile.log", request_header, response_header) -ts.addSSLfile("../tls/ssl/server.pem") -ts.addSSLfile("../tls/ssl/server.key") +ts.addDefaultSSLFiles() ts.Disk.records_config.update( { @@ -47,16 +45,17 @@ tr = Test.AddTestRun("tr") tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(ts) -tr.MakeCurlCommand('-i http://127.0.0.1:{0}/file'.format(ts.Variables.port)) +tr.MakeCurlCommand('-i http://127.0.0.1:{0}/file'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) tr.Processes.Default.Streams.stdout = Testers.ContainsExpression( "Inactivity Timeout", "Request should fail with inactivity timeout") -tr2 = Test.AddTestRun("tr") -tr2.MakeCurlCommand('-k -i --http1.1 https://127.0.0.1:{0}/file'.format(ts.Variables.ssl_port)) -tr2.Processes.Default.Streams.stdout = Testers.ContainsExpression( - "Inactivity Timeout", "Request should fail with inactivity timeout") +if not Condition.CurlUsingUnixDomainSocket(): + tr2 = Test.AddTestRun("tr") + tr2.MakeCurlCommand('-k -i --http1.1 https://127.0.0.1:{0}/file'.format(ts.Variables.ssl_port)) + tr2.Processes.Default.Streams.stdout = Testers.ContainsExpression( + "Inactivity Timeout", "Request should fail with inactivity timeout") -tr3 = Test.AddTestRun("tr") -tr3.MakeCurlCommand('-k -i --http2 https://127.0.0.1:{0}/file'.format(ts.Variables.ssl_port)) -tr3.Processes.Default.Streams.stdout = Testers.ContainsExpression( - "Inactivity Timeout", "Request should fail with inactivity timeout") + tr3 = Test.AddTestRun("tr") + tr3.MakeCurlCommand('-k -i --http2 https://127.0.0.1:{0}/file'.format(ts.Variables.ssl_port)) + tr3.Processes.Default.Streams.stdout = Testers.ContainsExpression( + "Inactivity Timeout", "Request should fail with inactivity timeout") diff --git a/tests/gold_tests/timeout/inactive_timeout_uds.test.py b/tests/gold_tests/timeout/inactive_timeout_uds.test.py deleted file mode 100644 index dde30442900..00000000000 --- a/tests/gold_tests/timeout/inactive_timeout_uds.test.py +++ /dev/null @@ -1,44 +0,0 @@ -''' -''' -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -Test.Summary = 'Testing ATS inactivity timeout' - -Test.SkipUnless(Condition.HasCurlFeature('http2')) - -ts = Test.MakeATSProcess("ts", enable_tls=True) -server = Test.MakeOriginServer("server", delay=8) - -request_header = {"headers": "GET /file HTTP/1.1\r\nHost: *\r\n\r\n", "timestamp": "5678", "body": ""} -response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "5678", "body": ""} - -server.addResponse("sessionfile.log", request_header, response_header) - -ts.Disk.records_config.update( - { - 'proxy.config.url_remap.remap_required': 1, - 'proxy.config.http.transaction_no_activity_timeout_out': 2, - }) - -ts.Disk.remap_config.AddLine('map / http://127.0.0.1:{0}/'.format(server.Variables.Port)) - -tr = Test.AddTestRun("tr") -tr.Processes.Default.StartBefore(server) -tr.Processes.Default.StartBefore(ts) -tr.MakeCurlCommand('-i http://127.0.0.1:{0}/file'.format(ts.Variables.port)) -tr.Processes.Default.Streams.stdout = Testers.ContainsExpression( - "Inactivity Timeout", "Request should fail with inactivity timeout") diff --git a/tests/gold_tests/tls/tls_client_verify3.test.py b/tests/gold_tests/tls/tls_client_verify3.test.py index e0ef8b2815e..9dad86f0f94 100644 --- a/tests/gold_tests/tls/tls_client_verify3.test.py +++ b/tests/gold_tests/tls/tls_client_verify3.test.py @@ -80,7 +80,8 @@ tr.StillRunningAfter = server tr.MakeCurlCommand( ("-v -k --tls-max 1.2 --cert {1}.pem --key {1}.key --resolve 'aaa.com:{0}:127.0.0.1'" + " https://aaa.com:{0}/xyz").format( - ts.Variables.ssl_port, Test.TestDirectory + "/ssl/aaa-signed")) + ts.Variables.ssl_port, Test.TestDirectory + "/ssl/aaa-signed"), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = Testers.ExcludesExpression("error", "Check response") @@ -89,7 +90,8 @@ tr.StillRunningAfter = server tr.MakeCurlCommand( ("-v -k --tls-max 1.2 --cert {1}.pem --key {1}.key --resolve 'bbb-signed:{0}:127.0.0.1'" + - " https://bbb-signed:{0}/xyz").format(ts.Variables.ssl_port, Test.TestDirectory + "/ssl/bbb-signed")) + " https://bbb-signed:{0}/xyz").format(ts.Variables.ssl_port, Test.TestDirectory + "/ssl/bbb-signed"), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = Testers.ExcludesExpression("error", "Check response") @@ -98,7 +100,8 @@ tr.StillRunningAfter = server tr.MakeCurlCommand( ("-v -k --tls-max 1.2 --cert {1}.pem --key {1}.key --resolve 'ccc.com:{0}:127.0.0.1'" + " https://ccc.com:{0}/xyz").format( - ts.Variables.ssl_port, Test.TestDirectory + "/ssl/ccc-signed")) + ts.Variables.ssl_port, Test.TestDirectory + "/ssl/ccc-signed"), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.All = Testers.ExcludesExpression("error", "Check response") @@ -109,7 +112,8 @@ tr.StillRunningAfter = server tr.MakeCurlCommand( ("-v -k --tls-max 1.2 --cert {1}.pem --key {1}.key --resolve 'aaa.com:{0}:127.0.0.1'" + " https://aaa.com:{0}/xyz").format( - ts.Variables.ssl_port, Test.TestDirectory + "/ssl/bbb-signed")) + ts.Variables.ssl_port, Test.TestDirectory + "/ssl/bbb-signed"), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 35 tr = Test.AddTestRun() @@ -117,7 +121,8 @@ tr.StillRunningAfter = server tr.MakeCurlCommand( ("-v -k --tls-max 1.2 --cert {1}.pem --key {1}.key --resolve 'bbb.com:{0}:127.0.0.1'" + " https://bbb.com:{0}/xyz").format( - ts.Variables.ssl_port, Test.TestDirectory + "/ssl/ccc-signed")) + ts.Variables.ssl_port, Test.TestDirectory + "/ssl/ccc-signed"), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 35 tr = Test.AddTestRun() @@ -125,5 +130,6 @@ tr.StillRunningAfter = server tr.MakeCurlCommand( (" -v -k --tls-max 1.2 --cert {1}.pem --key {1}.key --resolve 'ccc.com:{0}:127.0.0.1'" + " https://ccc.com:{0}/xyz").format( - ts.Variables.ssl_port, Test.TestDirectory + "/ssl/aaa-signed")) + ts.Variables.ssl_port, Test.TestDirectory + "/ssl/aaa-signed"), + uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 35 diff --git a/tests/gold_tests/traffic_ctl/remap_inc/remap_inc.test.py b/tests/gold_tests/traffic_ctl/remap_inc/remap_inc.test.py index ae67d89963d..be7f4f85d41 100644 --- a/tests/gold_tests/traffic_ctl/remap_inc/remap_inc.test.py +++ b/tests/gold_tests/traffic_ctl/remap_inc/remap_inc.test.py @@ -66,7 +66,7 @@ tr.StillRunningAfter = ts tr = Test.AddTestRun("Get response from generator") -tr.MakeCurlCommand(f'--proxy 127.0.0.1:{ts.Variables.port} http://example.four/nocache/5') +tr.MakeCurlCommand(f'--proxy 127.0.0.1:{ts.Variables.port} http://example.four/nocache/5', uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = ts tr.Processes.Default.Streams.All = Testers.ContainsExpression("xxxxx", "Contains generated text") diff --git a/tests/gold_tests/tunnel/tunnel_transform.test.py b/tests/gold_tests/tunnel/tunnel_transform.test.py index e8fd59fb786..313c1ee87ac 100644 --- a/tests/gold_tests/tunnel/tunnel_transform.test.py +++ b/tests/gold_tests/tunnel/tunnel_transform.test.py @@ -26,7 +26,7 @@ Test the reported type of HTTP transactions and tunnels ''' -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) # Define default ATS. Disable the cache to simplify the test. ts = Test.MakeATSProcess("ts", enable_cache=False, enable_tls=True) ts.addSSLfile("../tls/ssl/server.pem") diff --git a/tests/gold_tests/tunnel/txn_type.test.py b/tests/gold_tests/tunnel/txn_type.test.py index 8248bc10fb0..2031853bf64 100644 --- a/tests/gold_tests/tunnel/txn_type.test.py +++ b/tests/gold_tests/tunnel/txn_type.test.py @@ -23,7 +23,7 @@ Test the reported type of HTTP transactions and tunnels ''' -Test.SkipIf(Condition.CurlUds()) +Test.SkipIf(Condition.CurlUsingUnixDomainSocket()) # Define default ATS. Disable the cache to simplify the test. ts = Test.MakeATSProcess("ts", enable_cache=False, enable_tls=True) ts.addSSLfile("../tls/ssl/server.pem") From a50781b43160e483058667415c0c9e58bea35b01 Mon Sep 17 00:00:00 2001 From: Serris Lew Date: Tue, 29 Apr 2025 10:00:06 -0700 Subject: [PATCH 5/5] syntax error --- tests/gold_tests/chunked_encoding/chunked_encoding.test.py | 4 ++-- tests/gold_tests/headers/via.test.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/gold_tests/chunked_encoding/chunked_encoding.test.py b/tests/gold_tests/chunked_encoding/chunked_encoding.test.py index e6e5e1f9e53..483396aa9fd 100644 --- a/tests/gold_tests/chunked_encoding/chunked_encoding.test.py +++ b/tests/gold_tests/chunked_encoding/chunked_encoding.test.py @@ -100,11 +100,11 @@ tr = Test.AddTestRun() tr.TimeOut = 5 if Condition.CurlUsingUnixDomainSocket(): + tr.MakeCurlCommand('--http1.1 -H "Host: www.example.com" "http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port)) +else: tr.MakeCurlCommand( '--http1.1 --proxy 127.0.0.1:{0} http://www.example.com --verbose'.format(ts.Variables.port), uds_path=ts.Variables.uds_path) -else: - tr.MakeCurlCommand('--http1.1 -H "Host: www.example.com" "http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port)) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(server2) diff --git a/tests/gold_tests/headers/via.test.py b/tests/gold_tests/headers/via.test.py index 8458b69f760..7becc19c454 100644 --- a/tests/gold_tests/headers/via.test.py +++ b/tests/gold_tests/headers/via.test.py @@ -131,7 +131,7 @@ # IPv6 tr = Test.AddTestRun() tr.MakeCurlCommand( - '--verbose {0} --http1.1 --proxy localhost:{1} http://www.example.com'.format(ipv6flag, ts.Variables.port), + '--verbose {0} --http1.1 --proxy localhost:{1} http://www.example.com'.format(ipv6flag, ts.Variables.portv6), uds_path=ts.Variables.uds_path) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = server