mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-27 12:13:20 -04:00
[9.18] chg: test: Remove unused sbytes, stime, n, response, and rtime variables
Backport of MR !9617 Merge branch 'backport-mnowak/drop-unused-variables-9.18' into 'bind-9.18' See merge request isc-projects/bind9!9644
This commit is contained in:
commit
8ce45e2a72
3 changed files with 58 additions and 58 deletions
|
|
@ -535,6 +535,12 @@ black:
|
|||
expire_in: "1 week"
|
||||
when: on_failure
|
||||
|
||||
vulture:
|
||||
<<: *precheck_job
|
||||
needs: []
|
||||
script:
|
||||
- vulture --exclude "*/ans*/ans.py,conftest.py,get_algorithms.py,isctest" --ignore-names "pytestmark" bin/tests/system/
|
||||
|
||||
ci-variables:
|
||||
stage: precheck
|
||||
<<: *precheck_job
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ def create_socket(host, port):
|
|||
def test_tcp_garbage(named_port):
|
||||
with create_socket("10.53.0.7", named_port) as sock:
|
||||
msg = create_msg("a.example.", "A")
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
|
||||
wire = msg.to_wire()
|
||||
assert len(wire) > 0
|
||||
|
|
@ -58,8 +58,8 @@ def test_tcp_garbage(named_port):
|
|||
|
||||
with pytest.raises(EOFError):
|
||||
try:
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
except ConnectionError as e:
|
||||
raise EOFError from e
|
||||
|
||||
|
|
@ -67,8 +67,8 @@ def test_tcp_garbage(named_port):
|
|||
def test_tcp_garbage_response(named_port):
|
||||
with create_socket("10.53.0.7", named_port) as sock:
|
||||
msg = create_msg("a.example.", "A")
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
|
||||
wire = msg.to_wire()
|
||||
assert len(wire) > 0
|
||||
|
|
@ -77,11 +77,11 @@ def test_tcp_garbage_response(named_port):
|
|||
# the connection to be terminated
|
||||
|
||||
rmsg = dns.message.make_response(msg)
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, rmsg, timeout())
|
||||
dns.query.send_tcp(sock, rmsg, timeout())
|
||||
|
||||
with pytest.raises(EOFError):
|
||||
try:
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
except ConnectionError as e:
|
||||
raise EOFError from e
|
||||
|
||||
|
|
@ -90,11 +90,11 @@ def test_tcp_garbage_response(named_port):
|
|||
def test_close_wait(named_port):
|
||||
with create_socket("10.53.0.7", named_port) as sock:
|
||||
msg = create_msg("a.example.", "A")
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
|
||||
msg = dns.message.make_query("a.example.", "A", use_edns=0, payload=1232)
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
|
||||
# Shutdown the socket, but ignore the other side closing the socket
|
||||
# first because we sent DNS message with EDNS0
|
||||
|
|
@ -112,5 +112,5 @@ def test_close_wait(named_port):
|
|||
# available for the query below and it will time out.
|
||||
with create_socket("10.53.0.7", named_port) as sock:
|
||||
msg = create_msg("a.example.", "A")
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@ def test_initial_timeout(named_port):
|
|||
|
||||
with pytest.raises(EOFError):
|
||||
try:
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
except ConnectionError as e:
|
||||
raise EOFError from e
|
||||
|
||||
|
|
@ -72,20 +72,20 @@ def test_idle_timeout(named_port):
|
|||
|
||||
time.sleep(1)
|
||||
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
|
||||
time.sleep(2)
|
||||
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
|
||||
time.sleep(6)
|
||||
|
||||
with pytest.raises(EOFError):
|
||||
try:
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
except ConnectionError as e:
|
||||
raise EOFError from e
|
||||
|
||||
|
|
@ -103,18 +103,18 @@ def test_keepalive_timeout(named_port):
|
|||
|
||||
time.sleep(1)
|
||||
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
|
||||
time.sleep(2)
|
||||
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
|
||||
time.sleep(6)
|
||||
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
|
||||
|
||||
def test_pipelining_timeout(named_port):
|
||||
|
|
@ -128,25 +128,25 @@ def test_pipelining_timeout(named_port):
|
|||
time.sleep(1)
|
||||
|
||||
# Send and receive 25 DNS queries
|
||||
for n in range(25):
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
for n in range(25):
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
for _ in range(25):
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
for _ in range(25):
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
# Send and receive 25 DNS queries
|
||||
for n in range(25):
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
for n in range(25):
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
for _ in range(25):
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
for _ in range(25):
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
|
||||
time.sleep(6)
|
||||
|
||||
with pytest.raises(EOFError):
|
||||
try:
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
except ConnectionError as e:
|
||||
raise EOFError from e
|
||||
|
||||
|
|
@ -161,12 +161,10 @@ def test_long_axfr(named_port):
|
|||
|
||||
name = dns.name.from_text("example.")
|
||||
msg = create_msg("example.", "AXFR")
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
|
||||
# Receive the initial DNS message with SOA
|
||||
(response, rtime) = dns.query.receive_tcp(
|
||||
sock, timeout(), one_rr_per_rrset=True
|
||||
)
|
||||
(response, _) = dns.query.receive_tcp(sock, timeout(), one_rr_per_rrset=True)
|
||||
soa = response.get_rrset(
|
||||
dns.message.ANSWER, name, dns.rdataclass.IN, dns.rdatatype.SOA
|
||||
)
|
||||
|
|
@ -174,7 +172,7 @@ def test_long_axfr(named_port):
|
|||
|
||||
# Pull DNS message from wire until the second SOA is received
|
||||
while True:
|
||||
(response, rtime) = dns.query.receive_tcp(
|
||||
(response, _) = dns.query.receive_tcp(
|
||||
sock, timeout(), one_rr_per_rrset=True
|
||||
)
|
||||
soa = response.get_rrset(
|
||||
|
|
@ -192,13 +190,13 @@ def test_send_timeout(named_port):
|
|||
|
||||
# Send and receive single large RDATA over TCP
|
||||
msg = create_msg("large.example.", "TXT")
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
|
||||
# Send and receive 28 large (~32k) DNS queries that should
|
||||
# fill the default maximum 208k TCP send buffer
|
||||
for n in range(28):
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
for _ in range(28):
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
|
||||
# configure idle interval is 5 seconds, sleep 6 to make sure we are
|
||||
# above the interval
|
||||
|
|
@ -206,8 +204,8 @@ def test_send_timeout(named_port):
|
|||
|
||||
with pytest.raises(EOFError):
|
||||
try:
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
(response, rtime) = dns.query.receive_tcp(sock, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.receive_tcp(sock, timeout())
|
||||
except ConnectionError as e:
|
||||
raise EOFError from e
|
||||
|
||||
|
|
@ -219,12 +217,10 @@ def test_max_transfer_idle_out(named_port):
|
|||
|
||||
name = dns.name.from_text("example.")
|
||||
msg = create_msg("example.", "AXFR")
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
|
||||
# Receive the initial DNS message with SOA
|
||||
(response, rtime) = dns.query.receive_tcp(
|
||||
sock, timeout(), one_rr_per_rrset=True
|
||||
)
|
||||
(response, _) = dns.query.receive_tcp(sock, timeout(), one_rr_per_rrset=True)
|
||||
soa = response.get_rrset(
|
||||
dns.message.ANSWER, name, dns.rdataclass.IN, dns.rdatatype.SOA
|
||||
)
|
||||
|
|
@ -235,7 +231,7 @@ def test_max_transfer_idle_out(named_port):
|
|||
with pytest.raises(ConnectionResetError):
|
||||
# Process queued TCP messages
|
||||
while True:
|
||||
(response, rtime) = dns.query.receive_tcp(
|
||||
(response, _) = dns.query.receive_tcp(
|
||||
sock, timeout(), one_rr_per_rrset=True
|
||||
)
|
||||
soa = response.get_rrset(
|
||||
|
|
@ -253,12 +249,10 @@ def test_max_transfer_time_out(named_port):
|
|||
|
||||
name = dns.name.from_text("example.")
|
||||
msg = create_msg("example.", "AXFR")
|
||||
(sbytes, stime) = dns.query.send_tcp(sock, msg, timeout())
|
||||
dns.query.send_tcp(sock, msg, timeout())
|
||||
|
||||
# Receive the initial DNS message with SOA
|
||||
(response, rtime) = dns.query.receive_tcp(
|
||||
sock, timeout(), one_rr_per_rrset=True
|
||||
)
|
||||
(response, _) = dns.query.receive_tcp(sock, timeout(), one_rr_per_rrset=True)
|
||||
soa = response.get_rrset(
|
||||
dns.message.ANSWER, name, dns.rdataclass.IN, dns.rdatatype.SOA
|
||||
)
|
||||
|
|
@ -268,7 +262,7 @@ def test_max_transfer_time_out(named_port):
|
|||
with pytest.raises(EOFError):
|
||||
while True:
|
||||
time.sleep(1)
|
||||
(response, rtime) = dns.query.receive_tcp(
|
||||
(response, _) = dns.query.receive_tcp(
|
||||
sock, timeout(), one_rr_per_rrset=True
|
||||
)
|
||||
soa = response.get_rrset(
|
||||
|
|
|
|||
Loading…
Reference in a new issue