Commit 6542cd23 authored by Ondřej Zajíček's avatar Ondřej Zajíček

Tests: Allow optional arguments for show route test

parent 24cbf6f8
#!/bin/sh
. tests/strip_output
cd $1 && ./birdc -l show route $2 \
cd $1 && ./birdc -l show route $2 $3 \
| strip_version \
| strip_timestamp \
| strip_addresses \
......
......@@ -38,32 +38,32 @@ def check_krt_routes(key: str, dev: str, family: str, table: str) -> None:
return saved_table == current_table
def test_bird_routes(key: str, dev: str, table: str) -> None:
def test_bird_routes(key: str, dev: str, table: str, opts: str = "") -> None:
if cf.save:
save_bird_routes(key, dev, table)
save_bird_routes(key, dev, table, opts)
else:
check_bird_routes_timeout(key, dev, table)
check_bird_routes_timeout(key, dev, table, opts)
def save_bird_routes(key: str, dev: str, table: str, loc: str = cf.datadir) -> None:
def save_bird_routes(key: str, dev: str, table: str, opts: str, loc: str = cf.datadir) -> None:
os.system(f""" \
./tests/get_stdout_bird '{dev}' 'table {table}' \
./tests/get_stdout_bird '{dev}' 'table {table}' '{opts}' \
> {loc}/{key}-{dev} \
""")
def check_bird_routes_timeout(key: str, dev: str, table: str) -> None:
def check_bird_routes_timeout(key: str, dev: str, table: str, opts: str) -> None:
timeout = 60
for sec in range(timeout):
if check_bird_routes(key, dev, table):
if check_bird_routes(key, dev, table, opts):
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)
def check_bird_routes(key: str, dev: str, table: str, opts: str) -> None:
save_bird_routes(key, dev, table, opts, cf.tempdir)
current_table = read_file(f"{cf.tempdir}/{key}-{dev}")
saved_table = read_file(f"{cf.datadir}/{key}-{dev}")
return saved_table == current_table
......
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