mirror of
https://github.com/fail2ban/fail2ban.git
synced 2026-03-11 08:55:31 +00:00
BF: Database test keep ticket present in memory so address is reused
This bug only seemed to effect python2.6 which seemed hasty to reuse the memory id that was assigned to the ticket which was being used for reference
This commit is contained in:
parent
fb7511fdea
commit
802029d83a
1 changed files with 4 additions and 5 deletions
|
|
@ -163,17 +163,16 @@ class DatabaseTest(unittest.TestCase):
|
|||
self.assertEqual(ticket.getMatches(), ["abc\n", "123\n"])
|
||||
|
||||
# Should cache result if no extra bans added
|
||||
ticketID = id(ticket)
|
||||
self.assertEqual(
|
||||
ticketID,
|
||||
id(ticket),
|
||||
id(self.db.getBansMerged("127.0.0.1", jail=self.jail)))
|
||||
|
||||
ticket = FailTicket("127.0.0.1", 40, ["ABC\n"])
|
||||
newTicket = FailTicket("127.0.0.1", 40, ["ABC\n"])
|
||||
ticket.setAttempt(40)
|
||||
self.db.addBan(jail2, ticket)
|
||||
self.db.addBan(self.jail, newTicket)
|
||||
# Added ticket, so cache should have been cleared
|
||||
self.assertNotEqual(
|
||||
ticketID,
|
||||
id(ticket),
|
||||
id(self.db.getBansMerged("127.0.0.1", jail=self.jail)))
|
||||
|
||||
def testPurge(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue