Unit test failure if no nameserver specified in /etc/resolv.conf

Bug #2064916 reported by Thomas Goirand
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Designate
In Progress
Low
Michael Johnson

Bug Description

Hi,

As per: https://bugs.debian.org/1070332 test_handler.MdnsHandleTest.test_notify and test_handler.MdnsHandleTest.test_notify_same_serial need to be fixed so that they don't require /etc/resolv.conf to be populated with a nameserver.

Cheers,

Thomas Goirand

Revision history for this message
Michael Johnson (johnsom) wrote :

I can see that dnspython has a class BaseResolver that has an init that attempts to read the resolv.conf.

https://github.com/rthalley/dnspython/blob/main/dns/resolver.py#L944

This the stack trace from the Debian bug:
======================================================================
FAIL: designate.tests.unit.mdns.test_handler.MdnsHandleTest.test_notify
designate.tests.unit.mdns.test_handler.MdnsHandleTest.test_notify
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/usr/lib/python3.12/unittest/mock.py", line 1390, in patched
    return func(*newargs, **newkeywargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<<PKGBUILDDIR>>/designate/tests/unit/mdns/test_handler.py", line 79, in test_notify
    self.assertEqual(dns.rcode.NOERROR, tuple(response)[0].rcode())
                                        ^^^^^^^^^^^^^^^
  File "/<<PKGBUILDDIR>>/designate/mdns/handler.py", line 142, in _handle_notify
    resolver = dns.resolver.Resolver()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/dns/resolver.py", line 944, in __init__
    self.read_resolv_conf(filename)
  File "/usr/lib/python3/dist-packages/dns/resolver.py", line 1038, in read_resolv_conf
    raise NoResolverConfiguration("no nameservers")
dns.resolver.NoResolverConfiguration: no nameservers

Changed in designate:
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/designate/+/918364

Changed in designate:
status: Confirmed → In Progress
Changed in designate:
importance: Undecided → Low
assignee: nobody → Michael Johnson (johnsom)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.