Skip to content

Commit 2ec2f3f

Browse files
Update orchestratord tests to use helper function for stored version
1 parent 96ff119 commit 2ec2f3f

1 file changed

Lines changed: 17 additions & 44 deletions

File tree

test/orchestratord/mzcompose.py

Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2411,9 +2411,14 @@ def get_materialize_v1alpha1() -> dict[str, Any]:
24112411
return data["items"][0]
24122412

24132413

2414-
def get_materialize_status_v1alpha1() -> dict[str, Any] | None:
2415-
"""Get the status of the first Materialize resource at v1alpha1."""
2416-
return get_materialize_v1alpha1().get("status")
2414+
def get_materialize_at_stored_version() -> dict[str, Any]:
2415+
"""Get the first Materialize resource at the stored version (currently v1alpha1)."""
2416+
return get_materialize_v1alpha1()
2417+
2418+
2419+
def get_materialize_status_at_stored_version() -> dict[str, Any] | None:
2420+
"""Get the status of the first Materialize resource at the stored version."""
2421+
return get_materialize_at_stored_version().get("status")
24172422

24182423

24192424
def get_materialize_v1alpha2() -> dict[str, Any]:
@@ -2686,44 +2691,22 @@ def wait_for_ready_to_promote() -> None:
26862691
if is_ready_to_manually_promote():
26872692
break
26882693
else:
2689-
spawn.runv(
2690-
[
2691-
"kubectl",
2692-
"get",
2693-
"materializes",
2694-
"-n",
2695-
"materialize-environment",
2696-
"-o",
2697-
"yaml",
2698-
],
2699-
)
2694+
print(yaml.dump(get_materialize_at_stored_version()))
27002695
raise RuntimeError("Never became ready for manual promotion")
27012696

27022697
# Verify it stays in ReadyToPromote (doesn't auto-promote).
27032698
time.sleep(30)
27042699
if not is_ready_to_manually_promote():
2705-
spawn.runv(
2706-
[
2707-
"kubectl",
2708-
"get",
2709-
"materializes",
2710-
"-n",
2711-
"materialize-environment",
2712-
"-o",
2713-
"yaml",
2714-
],
2715-
)
2716-
raise RuntimeError(
2717-
"Stopped being ready for manual promotion before promoting"
2718-
)
2700+
print(yaml.dump(get_materialize_at_stored_version()))
2701+
raise RuntimeError("Stopped being ready for manual promotion before promoting")
27192702

27202703

27212704
def wait_for_rollout_complete() -> None:
27222705
"""Wait for the rollout to complete (UpToDate condition becomes True)."""
27232706
for _ in range(900):
27242707
time.sleep(1)
27252708
try:
2726-
status = get_materialize_status_v1alpha1()
2709+
status = get_materialize_status_at_stored_version()
27272710
if not status:
27282711
continue
27292712
conditions = status.get("conditions", [])
@@ -2735,17 +2718,7 @@ def wait_for_rollout_complete() -> None:
27352718
return
27362719
except subprocess.CalledProcessError:
27372720
pass
2738-
spawn.runv(
2739-
[
2740-
"kubectl",
2741-
"get",
2742-
"materializes",
2743-
"-n",
2744-
"materialize-environment",
2745-
"-o",
2746-
"yaml",
2747-
],
2748-
)
2721+
print(yaml.dump(get_materialize_at_stored_version()))
27492722
raise RuntimeError("Rollout never completed")
27502723

27512724

@@ -3402,7 +3375,7 @@ def run(definition: dict[str, Any], expect_fail: bool) -> None:
34023375

34033376

34043377
def is_ready_to_manually_promote():
3405-
mz = get_materialize_v1alpha1()
3378+
mz = get_materialize_at_stored_version()
34063379
conditions = mz.get("status", {}).get("conditions")
34073380
return (
34083381
conditions is not None
@@ -3414,12 +3387,12 @@ def is_ready_to_manually_promote():
34143387

34153388

34163389
def post_run_check(definition: dict[str, Any], expect_fail: bool) -> None:
3417-
# Read at v1alpha1 explicitly to avoid going through the conversion
3418-
# webhook, which may not be ready yet during initial deployment.
3390+
# Read at the stored version explicitly to avoid going through the
3391+
# conversion webhook, which may not be ready yet during initial deployment.
34193392
for i in range(900):
34203393
time.sleep(1)
34213394
try:
3422-
status = get_materialize_status_v1alpha1()
3395+
status = get_materialize_status_at_stored_version()
34233396
if not status:
34243397
continue
34253398
if expect_fail:

0 commit comments

Comments
 (0)