#!/usr/share/ucs-test/runner python
## desc: Univention-s4-connector dns forward zone syncronisation
## exposure: dangerous
## packages:
##   - univention-config
##   - univention-directory-manager-tools
##   - univention-s4-connector
##   - dnsutils

import univention.testing.udm as udm_test
import univention.testing.utils as utils
import dnstests
import s4connector

if __name__ == '__main__':
	with udm_test.UCSTestUDM() as udm:
		s4connector.exit_if_connector_not_running()
		random_zone = dnstests.random_zone()
		host = dnstests.get_hostname()
		forward_zone = udm.create_object('dns/forward_zone', zone = random_zone, nameserver = host)
		dnstests.check_ldap_object(forward_zone, 'Forward Zone')
		s4connector.wait_for_sync()
		dnstests.test_dns_forward_zone(random_zone, host)
		dnstests.check_ldap_object(forward_zone, 'Forward Zone')
	s4connector.wait_for_sync()
