File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1122,3 +1122,24 @@ async def test_guard_against_low_ptr_ttl():
11221122 assert incoming_answer_normal .ttl == const ._DNS_OTHER_TTL
11231123 assert zc .cache .async_get_unique (good_bye_answer ) is None
11241124 await aiozc .async_close ()
1125+
1126+
1127+ @pytest .mark .asyncio
1128+ async def test_duplicate_answers_in_packet ():
1129+ """Ensure we do not throw an exception when there are duplicate records in a packet."""
1130+ aiozc = AsyncZeroconf (interfaces = ['127.0.0.1' ])
1131+ zc = aiozc .zeroconf
1132+ answer_with_normal_ttl = r .DNSPointer (
1133+ "myservicelow_tcp._tcp.local." ,
1134+ const ._TYPE_PTR ,
1135+ const ._CLASS_IN | const ._CLASS_UNIQUE ,
1136+ const ._DNS_OTHER_TTL ,
1137+ 'normal.local.' ,
1138+ )
1139+ response = r .DNSOutgoing (const ._FLAGS_QR_RESPONSE )
1140+ response .add_answer_at_time (answer_with_normal_ttl , 0 )
1141+ response .add_answer_at_time (answer_with_normal_ttl , 0 )
1142+ response .add_answer_at_time (answer_with_normal_ttl , 0 )
1143+ incoming = r .DNSIncoming (response .packets ()[0 ])
1144+ zc .record_manager .async_updates_from_response (incoming )
1145+ await aiozc .async_close ()
You can’t perform that action at this time.
0 commit comments