I have a macro like this
and a test target below I have to run those smoke_tests targets in specific order on CI builds. Not sure how to proceed further?
rule implementation——————————————–
and below is macro
def ev_mediocker(name, command, dependent_rules = [], **kwargs):
"""
A macro for the ev_mediocker rule.
Args:
name (str): The name of this rule.
command (str): The mediocker command to run, such as init, up, down, rm, etc.
dependent_rules (list[str]): A list of dependent rules to ensure the order.
**kwargs: Additional keyword arguments to be passed to the mediocker rule.
"""
_ev_mediocker(
name = name,
command = command,
**kwargs
)
# Construct additional arguments for the test script
additional_args = ["--command", command]
if "substitute_images" in kwargs:
additional_args.append("--substitute_images")
substitute_images_args = " ".join(kwargs["substitute_images"].values())
additional_args.append(substitute_images_args)
ev_py_test(
name = name + "_smoke_test",
size = "large",
srcs = ["//products/mediator/mediocker/src/bazel:smoke_tests.py"],
args = additional_args,
main = "//products/mediator/mediocker/src/bazel:smoke_tests.py",
data = [
":{}".format(name),
],
deps = dependent_rules if dependent_rules else [],
)
and in BUILD file I have these four rules which are invoking the above macro
ev_mediocker(
name = "mediocker_init",
command = "init",
subnet = "",
system_name = "tcm_e2e",
)
ev_mediocker(
name = "mediocker_up",
command = "up",
config = glob(["tests/e2e/config/**"]),
dependent_rules = ["//products/mediator/tcm:mediocker_init_smoke_test"],
substitute_images = {
":tcm_container.tar": "cm:latest",
},
system_name = "tcm_e2e",
)
ev_mediocker(
name = "mediocker_down",
command = "down",
dependent_rules = [
# "//products/mediator/tcm:mediocker_init_smoke_test",
"//products/mediator/tcm:mediocker_up_smoke_test",
],
system_name = "tcm_e2e",
)
ev_mediocker(
name = "mediocker_rm",
command = "rm",
dependent_rules = [
# "//products/mediator/tcm:mediocker_init_smoke_test",
# "//products/mediator/tcm:mediocker_up_smoke_test",
"//products/mediator/tcm:mediocker_down_smoke_test",
],
system_name = "tcm_e2e",
)
and I want these smoke_test targets to be run in that sequence only(first init,up,down and rm) on CI builds .
tried with deps attribute and with tags=[“exclusive”] but no luck .I would appreciate if somebody have solution to this?Thanks
New contributor
Sivakumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.