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:
@@ -54,9 +54,25 @@ dns_test_end(void);
|
||||
isc_result_t
|
||||
dns_test_makeview(const char *name, dns_view_t **viewp);
|
||||
|
||||
/*%
|
||||
* Create a zone with origin 'name', return a pointer to the zone object in
|
||||
* 'zonep'.
|
||||
*
|
||||
* If 'view' is set, the returned zone will be assigned to the passed view.
|
||||
* 'createview' must be set to false when 'view' is non-NULL.
|
||||
*
|
||||
* If 'view' is not set and 'createview' is true, a new view is also created
|
||||
* and the returned zone is assigned to it. This imposes two requirements on
|
||||
* the caller: 1) the returned zone has to be subsequently assigned to a zone
|
||||
* manager, otherwise its cleanup will fail, 2) the created view has to be
|
||||
* cleaned up by the caller.
|
||||
*
|
||||
* If 'view' is not set and 'createview' is false, the returned zone will not
|
||||
* be assigned to any view.
|
||||
*/
|
||||
isc_result_t
|
||||
dns_test_makezone(const char *name, dns_zone_t **zonep, dns_view_t *view,
|
||||
isc_boolean_t keepview);
|
||||
isc_boolean_t createview);
|
||||
|
||||
isc_result_t
|
||||
dns_test_setupzonemgr(void);
|
||||
|
||||
Reference in New Issue
Block a user