Copilot commented on code in PR #12932: URL: https://github.com/apache/trafficserver/pull/12932#discussion_r2892701650
########## tests/gold_tests/dns/replay/connect_attempts_rr_retries.replay.yaml: ########## @@ -0,0 +1,165 @@ +# 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. + +meta: + version: "1.0" + +# Configuration section for autest integration +autest: + description: 'Verify connect attempts behavior - round robin' + + dns: + name: 'dns-rrr' + records: {"backend.example.com": ["0.0.0.1", "0.0.0.2"]} + + server: + name: 'server-rrr' + + client: + name: 'client-rrr' + + ats: + name: 'ts-rrr' + process_config: + enable_cache: false + + records_config: + proxy.config.diags.debug.enabled: 1 + proxy.config.diags.debug.tags: 'http|hostdb|dns' + proxy.config.http.connect_attempts_rr_retries: 2 + proxy.config.http.connect_attempts_max_retries: 0 + proxy.config.http.connect_attempts_max_retries_down_server: 0 Review Comment: The PR description says this covers the *combination* of `connect_attempts_rr_retries` and `connect_attempts_max_retries`, but in this replay config `connect_attempts_max_retries` is set to 0 so the retry path that uses `connect_attempts_rr_retries` to rotate RR targets is never exercised. Consider adding (or adjusting) a scenario where both settings are non-zero so the combined behavior is actually tested. ########## tests/gold_tests/dns/replay/connect_attempts_rr_max_retries.replay.yaml: ########## @@ -0,0 +1,129 @@ +# 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. + +meta: + version: "1.0" + +# Configuration section for autest integration +autest: + description: 'Verify connect attempts behavior - round robin' + + dns: + name: 'dns-rr' + records: {"backend.example.com": ["0.0.0.1", "0.0.0.2"]} + + server: + name: 'server-rr' + + client: + name: 'client-rr' + + ats: + name: 'ts-rr' + process_config: + enable_cache: false + + records_config: + proxy.config.diags.debug.enabled: 1 + proxy.config.diags.debug.tags: 'http|hostdb|dns' + proxy.config.http.connect_attempts_rr_retries: 0 + proxy.config.http.connect_attempts_max_retries: 1 + proxy.config.http.connect_attempts_max_retries_down_server: 0 + proxy.config.http.connect_attempts_timeout: 1 + proxy.config.http.down_server.cache_time: 10 + + remap_config: + - from: "http://example.com/" + to: "http://backend.example.com:{SERVER_HTTP_PORT}/" + + log_validation: + error_log: + gold_file: "gold/connect_attempts_rr_max_retries_error_log.gold" + +sessions: +- transactions: + # try 0.0.0.1 + - client-request: + method: GET + url: /path/ + version: '1.1' + headers: + fields: + - [Host, example.com] + - [uuid, 1] + + # should not hit + server-response: + status: 200 + reason: OK + + proxy-response: + status: 502 + + # try 0.0.0.2 + - client-request: + method: GET + url: /path/ + version: '1.1' + headers: + fields: + - [Host, example.com] + - [uuid, 2] + + # should not hit + server-response: + status: 200 + reason: OK + + proxy-response: + status: 502 + + # The request is expected to hit the down_server cache and immediately receive a 500 response. + - client-request: + method: GET + url: /path/ + version: '1.1' + headers: + fields: + - [Host, example.com] + - [uuid, 10] + + # should not hit + server-response: + status: 200 + reason: OK + + proxy-response: + status: 500 + + # when down_server.cache_time is expired, try connect attempts + - client-request: + method: GET + url: /path/ + version: '1.1' + headers: + fields: + - [Host, example.com] + - [uuid, 20] + delay: 10s + Review Comment: This request uses a 10s delay to wait for `proxy.config.http.down_server.cache_time` (10s) to expire. Using an equal delay makes the test timing-sensitive, and the fixed 10s sleep significantly slows the gold test suite. Consider reducing the cache_time for the test and using a delay slightly greater than it (or keep cache_time=10 but make the delay >10s). ########## tests/gold_tests/dns/replay/connect_attempts_rr_retries.replay.yaml: ########## @@ -0,0 +1,165 @@ +# 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. + +meta: + version: "1.0" + +# Configuration section for autest integration +autest: + description: 'Verify connect attempts behavior - round robin' + + dns: + name: 'dns-rrr' + records: {"backend.example.com": ["0.0.0.1", "0.0.0.2"]} + + server: + name: 'server-rrr' + + client: + name: 'client-rrr' + + ats: + name: 'ts-rrr' + process_config: + enable_cache: false + + records_config: + proxy.config.diags.debug.enabled: 1 + proxy.config.diags.debug.tags: 'http|hostdb|dns' + proxy.config.http.connect_attempts_rr_retries: 2 + proxy.config.http.connect_attempts_max_retries: 0 + proxy.config.http.connect_attempts_max_retries_down_server: 0 + proxy.config.http.connect_attempts_timeout: 1 + proxy.config.http.down_server.cache_time: 10 + + remap_config: + - from: "http://example.com/" + to: "http://backend.example.com:{SERVER_HTTP_PORT}/" + + log_validation: + error_log: + gold_file: "gold/connect_attempts_rr_retries_error_log.gold" + +sessions: +- transactions: + # try 0.0.0.1 + - client-request: + method: GET + url: /path/ + version: '1.1' + headers: + fields: + - [Host, example.com] + - [uuid, 1] + + # should not hit + server-response: + status: 200 + reason: OK + + proxy-response: + status: 502 + + # try 0.0.0.1 again + - client-request: + method: GET + url: /path/ + version: '1.1' + headers: + fields: + - [Host, example.com] + - [uuid, 2] + + # should not hit + server-response: + status: 200 + reason: OK + + proxy-response: + status: 502 + + # try 0.0.0.2 + - client-request: + method: GET + url: /path/ + version: '1.1' + headers: + fields: + - [Host, example.com] + - [uuid, 3] + + # should not hit + server-response: + status: 200 + reason: OK + + proxy-response: + status: 502 + + # try 0.0.0.2 again + - client-request: + method: GET + url: /path/ + version: '1.1' + headers: + fields: + - [Host, example.com] + - [uuid, 4] + + # should not hit + server-response: + status: 200 + reason: OK + + proxy-response: + status: 502 + + # The request is expected to hit the down_server cache and immediately receive a 500 response. + - client-request: + method: GET + url: /path/ + version: '1.1' + headers: + fields: + - [Host, example.com] + - [uuid, 10] + + # should not hit + server-response: + status: 200 + reason: OK + + proxy-response: + status: 500 + + # when down_server.cache_time is expired, try connect attempts + - client-request: + method: GET + url: /path/ + version: '1.1' + headers: + fields: + - [Host, example.com] + - [uuid, 20] + delay: 10s Review Comment: This request uses a 10s delay to wait for `proxy.config.http.down_server.cache_time` (10s) to expire. Using an equal delay can be timing-sensitive, and the fixed 10s sleep slows the suite. Consider reducing cache_time for the test and using a delay slightly greater than it (or keep cache_time=10 but make delay >10s). ```suggestion delay: 11s ``` ########## tests/gold_tests/dns/replay/connect_attempts_rr_no_retry.replay.yaml: ########## @@ -0,0 +1,129 @@ +# 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. + +meta: + version: "1.0" + +# Configuration section for autest integration +autest: + description: 'Verify connect attempts behavior - no retry' + + dns: + name: 'dns-no' + records: {"backend.example.com": ["0.0.0.1", "0.0.0.2"]} + + server: + name: 'server-no' + + client: + name: 'client-no' + + ats: + name: 'ts-no' + process_config: + enable_cache: false + + records_config: + proxy.config.diags.debug.enabled: 1 + proxy.config.diags.debug.tags: 'http|hostdb|dns' + proxy.config.http.connect_attempts_rr_retries: 0 + proxy.config.http.connect_attempts_max_retries: 0 + proxy.config.http.connect_attempts_max_retries_down_server: 0 + proxy.config.http.connect_attempts_timeout: 1 + proxy.config.http.down_server.cache_time: 5 + + remap_config: + - from: "http://example.com/" + to: "http://backend.example.com:{SERVER_HTTP_PORT}/" + + log_validation: + error_log: + gold_file: "gold/connect_attempts_rr_no_error_log.gold" + +sessions: +- transactions: + # try 0.0.0.1 + - client-request: + method: GET + url: /path/ + version: '1.1' + headers: + fields: + - [Host, example.com] + - [uuid, 1] + + # should not hit + server-response: + status: 200 + reason: OK + + proxy-response: + status: 502 + + # try 0.0.0.2 + - client-request: + method: GET + url: /path/ + version: '1.1' + headers: + fields: + - [Host, example.com] + - [uuid, 2] + + # should not hit + server-response: + status: 200 + reason: OK + + proxy-response: + status: 502 + + # This request is expected to hit the down_server cache and immediately receive a 500 response. + - client-request: + method: GET + url: /path/ + version: '1.1' + headers: + fields: + - [Host, example.com] + - [uuid, 10] + + # should not hit + server-response: + status: 200 + reason: OK + + proxy-response: + status: 500 + + # when down_server.cache_time is expired, try connect attempts + - client-request: + method: GET + url: /path/ + version: '1.1' + headers: + fields: + - [Host, example.com] + - [uuid, 20] + delay: 10s Review Comment: This request uses a 10s delay to wait for `proxy.config.http.down_server.cache_time` (5s) to expire. That makes the test unnecessarily slow; consider shrinking the delay to just over the cache_time (or lowering cache_time + delay together) to keep the suite fast while still ensuring the cache has expired. ```suggestion delay: 6s ``` ########## tests/gold_tests/autest-site/ats_replay.test.ext: ########## @@ -182,6 +197,8 @@ def ATSReplayTest(obj, replay_file: str): dns = tr.MakeDNServer(name, **process_config) else: dns = tr.MakeDNServer(name, default='127.0.0.1') + if 'records' in dns_config: + dns.addRecords(dns_config['records']) Review Comment: For consistency with the rest of the test suite, consider calling `dns.addRecords` using the named argument (`records=...`). Every other caller in `tests/gold_tests` uses the keyword form, which makes the call site clearer and consistent. ```suggestion dns.addRecords(records=dns_config['records']) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
