BF: guarantee order of dbfile to be before dbpurgeage (Closes #1048)

pull/1138/head
Yaroslav Halchenko 10 years ago committed by sebres
parent 0041bc3770
commit 17472a8b56

@ -139,6 +139,7 @@ class Transmitter:
elif name == "dbpurgeage":
db = self.__server.getDatabase()
if db is None:
logSys.warning("dbpurgeage setting was not in effect since no db yet")
return None
else:
db.purgeage = command[1]

@ -622,6 +622,21 @@ class JailsReaderTest(LogCaptureTestCase):
configurator.getOptions()
configurator.convertToProtocol()
commands = configurator.getConfigStream()
# verify that dbfile comes before dbpurgeage
def find_set(option):
for i, e in enumerate(commands):
if e[0] == 'set' and e[1] == option:
return i
raise ValueError("Did not find command 'set %s' among commands %s"
% (option, commands))
# Set up of logging should come first
self.assertEqual(find_set('logtarget'), 1)
self.assertEqual(find_set('loglevel'), 2)
# then dbfile should be before dbpurgeage
self.assertGreater(find_set('dbpurgeage'), find_set('dbfile'))
# and there is logging information left to be passed into the
# server
self.assertEqual(sorted(commands),

Loading…
Cancel
Save