Bug 39269 - Create basic DNS tests
Create basic DNS tests
Status: CLOSED FIXED
Product: UCS Test
Classification: Unclassified
Component: DNS
unspecified
Other Linux
: P5 normal (vote)
: UCS 4.2
Assigned To: Julian Hupertz
Philipp Hahn
: interim-1
: 27651 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-27 07:22 CEST by Stefan Gohmann
Modified: 2017-04-04 18:29 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Gohmann univentionstaff 2015-08-27 07:22:44 CEST
We should add basic DNS tests, creating DNS entries via UDM and checking if the new created objects are resolvable via DNS.

Theses tests should include all parts, forward / reverse zones, a records, alias records, SRV records and so forth.

ucs-test/tests/67_udm-dns is a good starting point.
Comment 1 Stefan Gohmann univentionstaff 2015-08-27 07:24:31 CEST
*** Bug 27651 has been marked as a duplicate of this bug. ***
Comment 2 Julian Hupertz univentionstaff 2015-09-04 12:27:01 CEST
-test for forward-zone finished
Comment 3 Julian Hupertz univentionstaff 2015-09-14 16:12:46 CEST
Committed changes for 100_dns_forward_zone_check_resolve.

Test creates a SOA-Record and trys to resolve the name of the zone. It also compares the zone-name of the dns-response with the created one to check if the response-object is the same.

Test is tagged with WIP.
Comment 4 Julian Hupertz univentionstaff 2015-09-16 15:08:01 CEST
Revision 65772
Version 5.0.171-4.1205.201509161449

Added tests for resolving different dns records. Tests work with openldap and also with samba4. Tests are in section 67, no. 100-106.

In case of samba4-backend, resolving TXT-Records is aborted. Refer to Bug #37346.

Tests are tagged as WIP at the moment.
Comment 5 Stefan Gohmann univentionstaff 2016-10-13 11:48:26 CEST
It looks like essential.dns_helper is missing:

*** BEGIN *** ['/usr/bin/python', '100_dns_forward_zone_check_resolve'] ***
*** 67_udm-dns/100_dns_forward_zone_check_resolve *** Creates dns forward zone entry and trys to resolve it ***
*** START TIME: 2016-09-13 08:55:47 ***
Traceback (most recent call last):
  File "100_dns_forward_zone_check_resolve", line 18, in <module>
    from essential.dns_helper import resolveDnsEntry
ImportError: No module named essential.dns_helper
*** END TIME: 2016-09-13 08:55:47 ***
*** TEST DURATION (H:MM:SS.ms): 0:00:00.213270 ***
*** END *** 1 ***
Comment 6 Julian Hupertz univentionstaff 2016-10-13 12:50:52 CEST
Hinzufügen     67_udm-dns/essential
Hinzufügen     67_udm-dns/essential/__init__.py
Hinzufügen     67_udm-dns/essential/dns_helper.py
Übertrage Daten ..
Revision 73144 übertragen.


Added missing modules to ucs-4.1/ucs-4.1-3/test/ucs-test/tests/67_udm-dns
Comment 7 Stefan Gohmann univentionstaff 2016-10-13 13:14:11 CEST
Thanks, that looks better. Can you remove the WIP tag so that we get test results from our daily Jenkins tests. Please also merge the commits to the UCS 4.2 branch.
Comment 8 Julian Hupertz univentionstaff 2016-10-14 09:19:16 CEST
Sende          67_udm-dns/100_dns_forward_zone_check_resolve
Sende          67_udm-dns/101_dns_reverse_zone_check_resolve
Sende          67_udm-dns/102_dns_host_record_check_resolve
Sende          67_udm-dns/103_dns_alias_record_check_resolve
Sende          67_udm-dns/104_dns_srv_record_check_resolve
Sende          67_udm-dns/105_dns_pointer_record_check_resolve
Sende          67_udm-dns/106_dns_txt_record_check_resolve
Übertrage Daten .......
Revision 73202 übertragen.

Committed changes to ucs-4.1/ucs-4.1-3/test/ucs-test/tests/67_udm-dns
Comment 9 Julian Hupertz univentionstaff 2016-10-14 09:25:37 CEST
Sende          67_udm-dns/100_dns_forward_zone_check_resolve
Sende          67_udm-dns/101_dns_reverse_zone_check_resolve
Sende          67_udm-dns/102_dns_host_record_check_resolve
Sende          67_udm-dns/103_dns_alias_record_check_resolve
Sende          67_udm-dns/104_dns_srv_record_check_resolve
Sende          67_udm-dns/105_dns_pointer_record_check_resolve
Sende          67_udm-dns/106_dns_txt_record_check_resolve
Übertrage Daten .......
Revision 73203 übertragen.

Also added to ucs-4.2/ucs-4.2-0/test/ucs-test/tests/67_udm-dns
Comment 10 Florian Best univentionstaff 2016-11-17 18:06:18 CET
The following condition will never become True because e is not the class but the instance of the class:

+		except Exception as e:
+			if e is dns.resolver.YXDOMAIN:

Please use "except dns.resolver.YXDOMAIN:"

A better variable name for "e" would be "exc".
To check for instances use "isinstance(exc, dns.resolver.YXDOMAIN)".
Catching Exception should be prevented as it hides details when there are errors in the script. You could catch dns.exception.DNSException instead which is the base class of all pyhton-dnspython exceptions.
Comment 11 Florian Best univentionstaff 2017-01-12 17:22:26 CET
The changes haven't been merged to UCS 4.2 causes some tests to fail.

ucs-test (7.0.6-44):
r75724 | Bug #39269: merge r73144 to UCS 4.2
Comment 12 Philipp Hahn univentionstaff 2017-01-13 14:05:43 CET
I will review the tests ... Code-quality is very bad
Comment 13 Philipp Hahn univentionstaff 2017-01-15 08:14:22 CET
r75797 | Bug #39269 test/dns: Fix DNS query tests
    Fix busy loop.
    Remove exception wrapping, which only added debug info.
    Use ldap/base directly.
    Remove broken hand-rolled UDP-only resolver.
    Simplify iterative and redundant assignment of zoneName.
Comment 14 Philipp Hahn univentionstaff 2017-01-20 13:51:39 CET
Test failed on S3,master, because BIND9 refused to start up with a wrong zone NS: <http://jenkins.knut.univention.de:8080/job/UCS-4.2/job/UCS-4.2-0/job/AutotestJoin/lastCompletedBuild/SambaVersion=s3,Systemrolle=master/testReport/67_udm-dns/>

r75961 | Bug #39269 test/dns: Fix DNS query tests
Comment 15 Stefan Gohmann univentionstaff 2017-04-04 18:29:09 CEST
UCS 4.2 has been released:
 https://docs.software-univention.de/release-notes-4.2-0-en.html
 https://docs.software-univention.de/release-notes-4.2-0-de.html

If this error occurs again, please use "Clone This Bug".