mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 07:40:00 -04:00
Improve key collision detection in ksr system test
MR !10238 added key collision detection in the ksr system test but it was flawed because for every "collide" in the output we also log "Generating an new key" and for each "Generating" we add the counter by one, nullifying the subtract by one. Use regular expressions to search in the output and make the string expression more strict.
This commit is contained in:
parent
c9dcc8c485
commit
abdb9a1334
1 changed files with 5 additions and 11 deletions
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
from datetime import timedelta
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import time
|
||||
|
||||
|
|
@ -651,17 +652,10 @@ def test_ksr_common(ns1):
|
|||
overlapping_zsks = isctest.kasp.keystr_to_keylist(out, zskdir)
|
||||
assert len(overlapping_zsks) == 4
|
||||
|
||||
verbose = err.split()
|
||||
selected = 0
|
||||
generated = 0
|
||||
for output in verbose:
|
||||
if "Selecting" in output:
|
||||
selected += 1
|
||||
if "Generating" in output:
|
||||
generated += 1
|
||||
# Subtract if there was a key collision.
|
||||
if "collide" in output:
|
||||
generated -= 1
|
||||
selected = len(re.findall("Selecting key pair", err))
|
||||
generated = len(re.findall("Generating key pair", err)) - len(
|
||||
re.findall("collide", err)
|
||||
)
|
||||
|
||||
assert selected == 2
|
||||
assert generated == 2
|
||||
|
|
|
|||
Loading…
Reference in a new issue