mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00: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.
(cherry picked from commit abdb9a1334
)
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user