Home | History | Annotate | Line # | Download | only in query-source
      1 #!/usr/bin/python3
      2 
      3 # Copyright (C) Internet Systems Consortium, Inc. ("ISC")
      4 #
      5 # SPDX-License-Identifier: MPL-2.0
      6 #
      7 # This Source Code Form is subject to the terms of the Mozilla Public
      8 # License, v. 2.0.  If a copy of the MPL was not distributed with this
      9 # file, you can obtain one at https://mozilla.org/MPL/2.0/.
     10 #
     11 # See the COPYRIGHT file distributed with this work for additional
     12 # information regarding copyright ownership.
     13 
     14 import pytest
     15 
     16 import isctest
     17 
     18 
     19 pytestmark = pytest.mark.extra_artifacts(
     20     [
     21         "ns*/named.pid",
     22         "ns*/managed-keys.bind*",
     23     ]
     24 )
     25 
     26 
     27 def test_querysource_none():
     28     msg = isctest.query.create("example.", "A", dnssec=False)
     29 
     30     res = isctest.query.udp(msg, "10.53.0.2")
     31     isctest.check.noerror(res)
     32 
     33     res = isctest.query.udp(msg, "10.53.0.3")
     34     isctest.check.noerror(res)
     35 
     36     res = isctest.query.udp(msg, "10.53.0.4")
     37     isctest.check.servfail(res)
     38 
     39     res = isctest.query.udp(msg, "10.53.0.5")
     40     isctest.check.servfail(res)
     41 
     42     # using a different name below to make sure we don't use the
     43     # resolver cache
     44 
     45     msg = isctest.query.create("exampletwo.", "A", dnssec=False)
     46 
     47     res = isctest.query.udp(msg, "fd92:7065:b8e:ffff::2")
     48     isctest.check.noerror(res)
     49 
     50     res = isctest.query.udp(msg, "fd92:7065:b8e:ffff::3")
     51     isctest.check.noerror(res)
     52 
     53     res = isctest.query.udp(msg, "fd92:7065:b8e:ffff::4")
     54     isctest.check.servfail(res)
     55 
     56     res = isctest.query.udp(msg, "fd92:7065:b8e:ffff::5")
     57     isctest.check.servfail(res)
     58