Fix flaky test detection for upgrade tests

When run_test.py is run for an upgrade_.*_after.sql then, then
automatically run the corresponding uprade_.*_before.sql file first.
This is because all those upgrade_.*_after.sql files depend on the
objects created in upgrade_.*_before.sql files by definition.
pull/6628/head
Onur Tirtir 2023-01-16 13:08:51 +03:00
parent f68fc9e69c
commit 821f26cc74
1 changed files with 15 additions and 0 deletions

View File

@ -15,6 +15,16 @@ import common
import config
# Returns true if given test_schedule_line is of the form:
# "test: upgrade_ ... _after .."
def schedule_line_is_upgrade_after(test_schedule_line: str) -> bool:
return (
test_schedule_line.startswith("test: upgrade_")
and "_after" in test_schedule_line
)
if __name__ == "__main__":
args = argparse.ArgumentParser()
args.add_argument(
@ -172,6 +182,11 @@ if __name__ == "__main__":
if test_file_name in deps:
dependencies = deps[test_file_name]
elif schedule_line_is_upgrade_after(test_schedule_line):
dependencies = TestDeps(
default_base_schedule(test_schedule),
[test_file_name.replace("_after", "_before")],
)
else:
dependencies = TestDeps(default_base_schedule(test_schedule))