multi_roller: Reformat tests
Change-Id: I864704ddb24f7991edbe1650d9036060700dd07e
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/229086
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Reviewed-by: Danielle Kay <danikay@google.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
diff --git a/recipes/multi_roller.py b/recipes/multi_roller.py
index 87efa4a..db4d248 100644
--- a/recipes/multi_roller.py
+++ b/recipes/multi_roller.py
@@ -285,12 +285,14 @@
def GenTests(api):
- def test(*args, **kwargs):
+ def test(name, *args, **kwargs):
kwargs.setdefault("execution_timeout", 100)
- return (
- api.buildbucket_util.test(*args, **kwargs)
- + api.time.seed(0)
- + api.time.step(1)
+ return api.buildbucket_util.test(
+ name,
+ api.time.seed(0),
+ api.time.step(1),
+ *args,
+ **kwargs,
)
def builder(name):
@@ -332,16 +334,16 @@
step_name=f"{launch_step}.buildbucket.get_multi",
)
- yield (
- test("success with two sub-rollers")
- + properties(builder("roller-1"), builder("roller-2"))
- + simulate_subroller_launch(
+ yield test(
+ "success with two sub-rollers",
+ properties(builder("roller-1"), builder("roller-2")),
+ simulate_subroller_launch(
builds=[
result_ci(name="roller-1", id=1000),
result_ci(name="roller-2", id=1001),
],
- )
- + simulate_get_multi(
+ ),
+ simulate_get_multi(
builds=[
result_ci(
name="roller-1",
@@ -360,8 +362,8 @@
),
],
launch_step="Launching Rollers.Get sub-roller change IDs (0)",
- )
- + simulate_get_multi(
+ ),
+ simulate_get_multi(
builds=[
result_ci(
name="roller-2",
@@ -374,8 +376,8 @@
),
],
launch_step="Launching Rollers.Get sub-roller change IDs (1)",
- )
- + api.step_data(
+ ),
+ api.step_data(
"Launching Rollers.Wait for Bypass-Presubmit or Presubmit-Verified for roll CLs (0).Get CL details for CL 11111111",
api.json.output(
{
@@ -387,8 +389,8 @@
},
}
),
- )
- + api.step_data(
+ ),
+ api.step_data(
"Launching Rollers.Wait for Bypass-Presubmit or Presubmit-Verified for roll CLs (0).Get CL details for CL 22222222",
api.json.output(
{
@@ -401,8 +403,8 @@
},
}
),
- )
- + api.step_data(
+ ),
+ api.step_data(
"Launching Rollers.Wait for Bypass-Presubmit or Presubmit-Verified for roll CLs (1).Get CL details for CL 22222222",
api.json.output(
{
@@ -414,16 +416,16 @@
},
}
),
- )
+ ),
)
- yield (
- test("presubmit fails", status='FAILURE')
- + properties(builder("roller-1"))
- + simulate_subroller_launch(
+ yield test(
+ "presubmit fails",
+ properties(builder("roller-1")),
+ simulate_subroller_launch(
builds=[result_ci(name="roller-1", id=1000)],
- )
- + simulate_get_multi(
+ ),
+ simulate_get_multi(
builds=[
result_ci(
name="roller-1",
@@ -436,8 +438,8 @@
),
],
launch_step="Launching Rollers.Get sub-roller change IDs (0)",
- )
- + api.step_data(
+ ),
+ api.step_data(
"Launching Rollers.Wait for Bypass-Presubmit or Presubmit-Verified for roll CLs (0).Get CL details for CL 11111111",
api.json.output(
{
@@ -449,16 +451,17 @@
},
}
),
- )
+ ),
+ status='FAILURE',
)
- yield (
- test("roll CL manually merged")
- + properties(builder("roller-1"))
- + simulate_subroller_launch(
+ yield test(
+ "roll CL manually merged",
+ properties(builder("roller-1")),
+ simulate_subroller_launch(
builds=[result_ci(name="roller-1", id=1000)],
- )
- + simulate_get_multi(
+ ),
+ simulate_get_multi(
builds=[
result_ci(
name="roller-1",
@@ -471,8 +474,8 @@
),
],
launch_step="Launching Rollers.Get sub-roller change IDs (0)",
- )
- + api.step_data(
+ ),
+ api.step_data(
"Launching Rollers.Wait for Bypass-Presubmit or Presubmit-Verified for roll CLs (0).Get CL details for CL 11111111",
api.json.output(
{
@@ -484,16 +487,16 @@
},
}
),
- )
+ ),
)
- yield (
- test("roll CL manually abandoned", status="FAILURE")
- + properties(builder("roller-1"))
- + simulate_subroller_launch(
+ yield test(
+ "roll CL manually abandoned",
+ properties(builder("roller-1")),
+ simulate_subroller_launch(
builds=[result_ci(name="roller-1", id=1000)],
- )
- + simulate_get_multi(
+ ),
+ simulate_get_multi(
builds=[
result_ci(
name="roller-1",
@@ -506,8 +509,8 @@
),
],
launch_step="Launching Rollers.Get sub-roller change IDs (0)",
- )
- + api.step_data(
+ ),
+ api.step_data(
"Launching Rollers.Wait for Bypass-Presubmit or Presubmit-Verified for roll CLs (0).Get CL details for CL 11111111",
api.json.output(
{
@@ -519,16 +522,17 @@
},
}
),
- )
+ ),
+ status="FAILURE",
)
- yield (
- test("presubmit-verified label does not exist", status="FAILURE")
- + properties(builder("roller-1"))
- + simulate_subroller_launch(
+ yield test(
+ "presubmit-verified label does not exist",
+ properties(builder("roller-1")),
+ simulate_subroller_launch(
builds=[result_ci(name="roller-1", id=1000)],
- )
- + simulate_get_multi(
+ ),
+ simulate_get_multi(
builds=[
result_ci(
name="roller-1",
@@ -541,8 +545,8 @@
)
],
launch_step="Launching Rollers.Get sub-roller change IDs (0)",
- )
- + api.step_data(
+ ),
+ api.step_data(
"Launching Rollers.Wait for Bypass-Presubmit or Presubmit-Verified for roll CLs (0).Get CL details for CL 11111111",
api.json.output(
{
@@ -553,16 +557,17 @@
},
}
),
- )
+ ),
+ status="FAILURE",
)
- yield (
- test("bypass-presubmit label does not exist", status="FAILURE")
- + properties(builder("roller-1"))
- + simulate_subroller_launch(
+ yield test(
+ "bypass-presubmit label does not exist",
+ properties(builder("roller-1")),
+ simulate_subroller_launch(
builds=[result_ci(name="roller-1", id=1000)],
- )
- + simulate_get_multi(
+ ),
+ simulate_get_multi(
builds=[
result_ci(
name="roller-1",
@@ -575,8 +580,8 @@
)
],
launch_step="Launching Rollers.Get sub-roller change IDs (0)",
- )
- + api.step_data(
+ ),
+ api.step_data(
"Launching Rollers.Wait for Bypass-Presubmit or Presubmit-Verified for roll CLs (0).Get CL details for CL 11111111",
api.json.output(
{
@@ -587,16 +592,17 @@
},
}
),
- )
+ ),
+ status="FAILURE",
)
- yield (
- test("get change id timeout", execution_timeout=10, status="FAILURE")
- + properties(builder("roller-1"))
- + simulate_subroller_launch(
+ yield test(
+ "get change id timeout",
+ properties(builder("roller-1")),
+ simulate_subroller_launch(
builds=[result_ci(name="roller-1", id=1000)],
- )
- + simulate_get_multi(
+ ),
+ simulate_get_multi(
builds=[
result_ci(
name="roller-1",
@@ -605,20 +611,18 @@
)
],
launch_step="Launching Rollers.Get sub-roller change IDs (0)",
- )
+ ),
+ execution_timeout=10,
+ status="FAILURE",
)
- yield (
- test(
- "check for presubmit-verified timeout",
- execution_timeout=6,
- status="FAILURE",
- )
- + properties(builder("roller-1"))
- + simulate_subroller_launch(
+ yield test(
+ "check for presubmit-verified timeout",
+ properties(builder("roller-1")),
+ simulate_subroller_launch(
builds=[result_ci(name="roller-1", id=1000)],
- )
- + simulate_get_multi(
+ ),
+ simulate_get_multi(
builds=[
result_ci(
name="roller-1",
@@ -631,8 +635,8 @@
)
],
launch_step="Launching Rollers.Get sub-roller change IDs (0)",
- )
- + api.step_data(
+ ),
+ api.step_data(
"Launching Rollers.Wait for Bypass-Presubmit or Presubmit-Verified for roll CLs (0).Get CL details for CL 11111111",
api.json.output(
{
@@ -644,5 +648,7 @@
},
}
),
- )
+ ),
+ execution_timeout=6,
+ status="FAILURE",
)