from recursortests import RecursorTest
import pytest
-@pytest.fixture(scope='session', autouse=True)
+@pytest.fixture(scope='session')
def run_auths() -> str:
confdir = 'configs/auths'
shutil.rmtree(confdir, True)
os.mkdir(confdir)
- print('Starting auths from fixture..')
+ print('\nStarting auths from fixture...')
RecursorTest.generateAllAuthConfig(confdir)
RecursorTest.startAllAuth(confdir)
yield "Here's Johnny!"
@classmethod
def generateAuthConfig(cls, confdir, threads, extra=''):
bind_dnssec_db = os.path.join(confdir, 'bind-dnssec.sqlite3')
- print('writing to ' + os.path.join(confdir, 'pdns.conf'))
with open(os.path.join(confdir, 'pdns.conf'), 'w') as pdnsconf:
pdnsconf.write("""
module-dir={moduledir}
'create-bind-db',
bind_dnssec_db]
- print(' '.join(pdnsutilCmd))
try:
subprocess.check_output(pdnsutilCmd, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
@classmethod
def generateAllAuthConfig(cls, confdir):
- print("generateAllAuthConfig")
if cls._auth_zones:
for auth_suffix, zoneinfo in cls._auth_zones.items():
- print(auth_suffix)
threads = zoneinfo['threads']
zones = zoneinfo['zones']
authconfdir = os.path.join(confdir, 'auth-%s' % auth_suffix)
os.mkdir(authconfdir)
- print(authconfdir)
cls.generateAuthConfig(authconfdir, threads)
cls.generateAuthNamedConf(authconfdir, zones)