feat(tests): allow running specific proto tests via --protocols

This commit is contained in:
Marshall Hallenbeck
2023-10-20 15:02:37 -04:00
parent 30c474cbd6
commit a68265bb13
+20 -7
View File
@@ -53,15 +53,19 @@ def get_cli_args():
required=False,
help="Use poetry to run commands",
)
parser.add_argument(
"--protocols",
nargs="+",
default=[],
required=False,
help="Protocols to test",
)
return parser.parse_args()
def generate_commands(args):
lines = []
kerberos = "-k " if args.kerberos else ""
file_loc = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
commands_file = os.path.join(file_loc, "e2e_commands.txt")
@@ -70,12 +74,21 @@ def generate_commands(args):
if line.startswith("#"):
continue
line = line.strip()
line = line.replace("TARGET_HOST", args.target).replace("LOGIN_USERNAME", f'"{args.username}"').replace("LOGIN_PASSWORD", f'"{args.password}"').replace("KERBEROS ", kerberos)
if args.poetry:
line = f"poetry run {line}"
lines.append(line)
if args.protocols:
if line.split()[1] in args.protocols:
lines.append(replace_command(args, line))
else:
lines.append(replace_command(args, line))
return lines
def replace_command(args, line):
kerberos = "-k " if args.kerberos else ""
line = line.replace("TARGET_HOST", args.target).replace("LOGIN_USERNAME", f'"{args.username}"').replace("LOGIN_PASSWORD", f'"{args.password}"').replace("KERBEROS ", kerberos)
if args.poetry:
line = f"poetry run {line}"
return line
def run_e2e_tests(args):
console = Console()