pytests: import test_ignore_garbage (test10)

parent 3315894d
"""TCP Connection Management tests"""
import dns
import dns.message
import utils
def test_ignore_garbage(kresd_sock):
"""
Send chunk of garbage, correctly prefixed by garbage length. Then, send
correct DNS query.
Expected: garbage must be ignored and the second query must be answered
"""
MSG_ID = 1
msg = utils.get_msgbuf('localhost.', dns.rdatatype.A, MSG_ID)
garbage = utils.get_prefixed_garbage(1024)
buf = garbage + msg
kresd_sock.sendall(buf)
msg_answer = utils.receive_parse_answer(kresd_sock)
assert msg_answer.id == MSG_ID
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment