-
Notifications
You must be signed in to change notification settings - Fork 857
Adding back set_connect_fail for generic I/O error #9181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+183
−3
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| ''' | ||
| Verify ATS handles down origin servers with domain cached correctly. | ||
| ''' | ||
| # 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 ports import get_port | ||
| import os | ||
|
|
||
| Test.Summary = ''' | ||
| Verify ATS handles down origin servers with cached domain correctly. | ||
| ''' | ||
|
|
||
|
|
||
| class DownCachedOriginServerTest: | ||
| replay_file = "replay/server_down.replay.yaml" | ||
|
|
||
| def __init__(self): | ||
| """Initialize the Test processes for the test runs.""" | ||
| self._server = Test.MakeVerifierServerProcess("server", DownCachedOriginServerTest.replay_file) | ||
| self._configure_trafficserver() | ||
|
|
||
| def _configure_trafficserver(self): | ||
| """Configure Traffic Server.""" | ||
| self._ts = Test.MakeATSProcess("ts", enable_cache=False) | ||
|
|
||
| self._ts.Disk.remap_config.AddLine( | ||
| f"map / http://resolve.this.com:{self._server.Variables.http_port}/" | ||
| ) | ||
|
|
||
| self._ts.Disk.records_config.update({ | ||
| 'proxy.config.diags.debug.enabled': 1, | ||
| 'proxy.config.diags.debug.tags': 'hostdb|dns|http|socket', | ||
| 'proxy.config.http.connect_attempts_max_retries': 0, | ||
| 'proxy.config.http.connect_attempts_rr_retries': 0, | ||
| 'proxy.config.hostdb.fail.timeout': 10, | ||
| 'proxy.config.dns.resolv_conf': 'NULL', | ||
| 'proxy.config.hostdb.ttl_mode': 1, | ||
| 'proxy.config.hostdb.timeout': 2, | ||
| 'proxy.config.hostdb.lookup_timeout': 2, | ||
| 'proxy.config.http.transaction_no_activity_timeout_in': 2, | ||
| 'proxy.config.http.connect_attempts_timeout': 2, | ||
| 'proxy.config.hostdb.host_file.interval': 1, | ||
| 'proxy.config.hostdb.host_file.path': os.path.join(Test.TestDirectory, "hosts_file"), | ||
| }) | ||
|
|
||
| # Even when the origin server is down, SM will return a hit-fresh domain from HostDB. | ||
| # After request has failed, SM should mark the IP as down | ||
| def _test_host_mark_down(self): | ||
| tr = Test.AddTestRun() | ||
|
|
||
| tr.Processes.Default.StartBefore(self._server) | ||
| tr.Processes.Default.StartBefore(self._ts) | ||
|
|
||
| tr.AddVerifierClientProcess( | ||
| "client-1", | ||
| DownCachedOriginServerTest.replay_file, | ||
| http_ports=[self._ts.Variables.port], | ||
| other_args='--keys 1') | ||
|
|
||
| # After host has been marked down from previous test, HostDB should not return | ||
| # the host as available and DNS lookup should fail. | ||
| def _test_host_unreachable(self): | ||
| tr = Test.AddTestRun() | ||
|
|
||
| tr.AddVerifierClientProcess( | ||
| "client-2", | ||
| DownCachedOriginServerTest.replay_file, | ||
| http_ports=[self._ts.Variables.port], | ||
| other_args='--keys 2') | ||
|
|
||
| # Verify error log marking host down exists | ||
| def _test_error_log(self): | ||
| tr = Test.AddTestRun() | ||
| tr.Processes.Default.Command = ( | ||
| os.path.join(Test.Variables.AtsTestToolsDir, 'condwait') + ' 60 1 -f ' + | ||
| os.path.join(self._ts.Variables.LOGDIR, 'error.log') | ||
| ) | ||
|
|
||
| self._ts.Disk.error_log.Content = Testers.ContainsExpression("/dns/mark/down' marking down", "host should be marked down") | ||
| self._ts.Disk.error_log.Content = Testers.ContainsExpression( | ||
| "DNS Error: no valid server http://resolve.this.com", "DNS lookup should fail") | ||
|
|
||
| def run(self): | ||
| self._test_host_mark_down() | ||
| self._test_host_unreachable() | ||
| self._test_error_log() | ||
|
|
||
|
|
||
| DownCachedOriginServerTest().run() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # 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. | ||
|
|
||
| 0.0.0.1 resolve.this.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # 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" | ||
|
|
||
| sessions: | ||
| - transactions: | ||
| - client-request: | ||
| # Delay to allow hostdb to sync external host file | ||
| delay: 2s | ||
|
serrislew marked this conversation as resolved.
|
||
| method: "GET" | ||
| version: "1.1" | ||
| url: /dns/mark/down | ||
| headers: | ||
| fields: | ||
| - [ Host, example.com ] | ||
| - [ X-Request, request ] | ||
| - [ uuid, 1 ] | ||
|
|
||
| # Shouldn't be reached since server IP is unreachable | ||
| server-response: | ||
| status: 200 | ||
|
|
||
| # Returns 502 since server connection is unreachable | ||
| proxy-response: | ||
| status: 502 | ||
|
serrislew marked this conversation as resolved.
|
||
|
|
||
| - client-request: | ||
| # Delay to allow hostdb to sync external host file | ||
| delay: 2s | ||
| method: "GET" | ||
| version: "1.1" | ||
| url: /dns/unreachable | ||
| headers: | ||
| fields: | ||
| - [ Host, example.com ] | ||
| - [ X-Request, request ] | ||
| - [ uuid, 2 ] | ||
|
|
||
| # Shouldn't be reached since server IP is unreachable | ||
| server-response: | ||
| status: 200 | ||
|
|
||
| # Previous request marked host down so DNS lookup returns unsuccessful | ||
| # 500 response indicates no valid server | ||
| proxy-response: | ||
| status: 500 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.