Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/iocore/hostdb/HostDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,9 @@ HostDBRecord::select_best_http(ts_time now, ts_seconds fail_window, sockaddr con
}
}
} else {
best_alive = &info[0];
if (info[0].select(now, fail_window)) {
best_alive = &info[0];
}
}

return best_alive;
Expand Down
14 changes: 1 addition & 13 deletions tests/gold_tests/dns/dns_host_down.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,13 @@ def _configure_trafficserver(self):
'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')
tr.AddVerifierClientProcess("client-1", DownCachedOriginServerTest.replay_file, http_ports=[self._ts.Variables.port])

# Verify error log marking host down exists
def _test_error_log(self):
Expand All @@ -86,7 +75,6 @@ def _test_error_log(self):

def run(self):
self._test_host_mark_down()
self._test_host_unreachable()
self._test_error_log()


Expand Down
5 changes: 4 additions & 1 deletion tests/gold_tests/dns/replay/server_down.replay.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ sessions:
status: 200

# Returns 502 since server connection is unreachable
# This transaction should mark the IP as down
proxy-response:
status: 502

Expand All @@ -55,5 +56,7 @@ sessions:
server-response:
status: 200

# After host has been marked down from previous test, HostDB should not return
# the host as available and HostDB lookup should fail.
proxy-response:
status: 502
status: 500