Commit 506d10d9 authored by Ondřej Zajíček's avatar Ondřej Zajíček

Tests: Fix unnecessary test reruns

Because 'assert 1' does not end a test, the old code executed each test
60 times, even if it successed in the first iteration.
parent ba8aec28
......@@ -25,20 +25,17 @@ def check_krt_routes_timeout(key: str, dev: str, family: str, table: str) -> Non
timeout = 60
for sec in range(timeout):
if check_krt_routes(key, dev, family, table):
assert 1
elif sec == timeout - 1:
assert 0
return
else:
time.sleep(1)
assert 0
def check_krt_routes(key: str, dev: str, family: str, table: str) -> None:
save_krt_routes(key, dev, family, table, cf.tempdir)
current_table = read_file(f"{cf.tempdir}/{key}-{dev}")
saved_table = read_file(f"{cf.datadir}/{key}-{dev}")
for _ in current_table:
return saved_table == current_table
return saved_table == current_table
def test_bird_routes(key: str, dev: str, table: str) -> None:
......@@ -59,20 +56,17 @@ def check_bird_routes_timeout(key: str, dev: str, table: str) -> None:
timeout = 60
for sec in range(timeout):
if check_bird_routes(key, dev, table):
assert 1
elif sec == timeout - 1:
assert 0
return
else:
time.sleep(1)
assert 0
def check_bird_routes(key: str, dev: str, table: str) -> None:
save_bird_routes(key, dev, table, cf.tempdir)
current_table = read_file(f"{cf.tempdir}/{key}-{dev}")
saved_table = read_file(f"{cf.datadir}/{key}-{dev}")
for _ in current_table:
return saved_table == current_table
return saved_table == current_table
def wait(sec: int):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment