Rework dns_test_makezone()
The dns_test_makezone() helper function always assigns the created zone to some view, which is not always necessary and complicates cleanup of non-managed zones as they are required not to be assigned to any view. Rework dns_test_makezone() in order to make it easier to use in unit tests operating on non-managed zones. Use dns_name_fromstring() instead of dns_name_fromtext() to simplify code. Do not use the CHECK() macro and add comments to make code flow simpler to follow. Use dns_test_makeview() instead of dns_view_create(). Adjust existing unit tests using this function so that they still pass.
This commit is contained in:
@@ -9,8 +9,6 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <config.h>
|
||||
@@ -222,13 +220,13 @@ ATF_TC_BODY(asyncload_zt, tc) {
|
||||
dns_masterformat_text, &dns_master_style_default);
|
||||
view = dns_zone_getview(zone1);
|
||||
|
||||
result = dns_test_makezone("bar", &zone2, view, ISC_TRUE);
|
||||
result = dns_test_makezone("bar", &zone2, view, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
dns_zone_setfile(zone2, "testdata/zt/zone1.db",
|
||||
dns_masterformat_text, &dns_master_style_default);
|
||||
|
||||
/* This one will fail to load */
|
||||
result = dns_test_makezone("fake", &zone3, view, ISC_TRUE);
|
||||
result = dns_test_makezone("fake", &zone3, view, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
dns_zone_setfile(zone3, "testdata/zt/nonexistent.db",
|
||||
dns_masterformat_text, &dns_master_style_default);
|
||||
|
||||
Reference in New Issue
Block a user