Skip to content

Commit ba926e9

Browse files
authored
Merge pull request #34282 from def-/pr-terraform-fix-upgrade
terraform test: Fix --no-setup in upgrade tests
2 parents 28e6bd5 + 3892166 commit ba926e9

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

test/terraform/mzcompose.py

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ def upgrade(self, tag: str) -> None:
834834
raise ValueError("Never completed")
835835

836836
# Wait a bit for the status to stabilize
837-
print("--- Waiting and get status:")
837+
print("Waiting and get status:")
838838
time.sleep(120)
839839
self._kubectl_debug_namespace("materialize-environment")
840840

@@ -843,7 +843,7 @@ def upgrade(self, tag: str) -> None:
843843
def _verify_upgrade_completed(self, expected_tag: str) -> None:
844844
"""Verify that the upgrade has completed by checking the Docker image of environmentd pods."""
845845
print(
846-
f"--- Verifying upgrade to {expected_tag} completed by checking Docker images"
846+
f"Verifying upgrade to {expected_tag} completed by checking Docker images"
847847
)
848848

849849
expected_image = f"materialize/environmentd:{expected_tag}"
@@ -870,54 +870,53 @@ def _verify_upgrade_completed(self, expected_tag: str) -> None:
870870
.split()
871871
)
872872

873-
print(f"--- Found environmentd pod images: {pod_images}")
873+
print(f"Found environmentd pod images: {pod_images}")
874874

875875
# Check if all pods are using the expected image
876876
if pod_images and all(image == expected_image for image in pod_images):
877877
pod_count = len(pod_images)
878878
if pod_count == 1:
879879
print(
880-
f"--- Upgrade verification successful: Single pod running {expected_image}"
880+
f"Upgrade verification successful: Single pod running {expected_image}"
881881
)
882882
return
883883
else:
884884
print(
885-
f"--- Still {pod_count} environmentd pods running, waiting for rollout to complete..."
885+
f"Still {pod_count} environmentd pods running, waiting for rollout to complete..."
886886
)
887887
else:
888888
print(
889-
f"--- Pod images don't match expected {expected_image}, waiting..."
889+
f"Pod images don't match expected {expected_image}, waiting..."
890890
)
891891

892892
time.sleep(5)
893893
except subprocess.CalledProcessError as e:
894-
print(f"--- Failed to get pod images: {e}")
894+
print(f"Failed to get pod images: {e}")
895895
time.sleep(5)
896896
else:
897-
print("--- WARNING: Upgrade verification timed out after 5 minutes")
897+
print("WARNING: Upgrade verification timed out after 5 minutes")
898898
# Still log the final state for debugging
899-
try:
900-
pod_images = (
901-
spawn.capture(
902-
[
903-
"kubectl",
904-
"get",
905-
"pods",
906-
"-l",
907-
"app=environmentd",
908-
"-n",
909-
"materialize-environment",
910-
"-o",
911-
"jsonpath={.items[*].spec.containers[0].image}",
912-
],
913-
cwd=self.path,
914-
)
915-
.strip()
916-
.split()
899+
pod_images = (
900+
spawn.capture(
901+
[
902+
"kubectl",
903+
"get",
904+
"pods",
905+
"-l",
906+
"app=environmentd",
907+
"-n",
908+
"materialize-environment",
909+
"-o",
910+
"jsonpath={.items[*].spec.containers[0].image}",
911+
],
912+
cwd=self.path,
917913
)
918-
print(f"--- Final pod images: {pod_images}, expected: {expected_image}")
919-
except:
920-
pass
914+
.strip()
915+
.split()
916+
)
917+
raise ValueError(
918+
f"Final pod images: {pod_images}, expected: {expected_image}"
919+
)
921920

922921

923922
def workflow_aws_temporary(c: Composition, parser: WorkflowArgumentParser) -> None:
@@ -965,16 +964,17 @@ def workflow_aws_upgrade(c: Composition, parser: WorkflowArgumentParser) -> None
965964
try:
966965
if args.run_mz_debug:
967966
mz_debug_build_thread = build_mz_debug_async()
968-
aws.setup(
969-
"aws-upgrade",
970-
args.setup,
971-
str(previous_tags[0]),
972-
str(tag),
973-
orchestratord_override=args.orchestratord_override,
974-
)
975-
for previous_tag in previous_tags[1:]:
976-
aws.upgrade(str(previous_tag))
977-
aws.upgrade(tag)
967+
if args.setup:
968+
aws.setup(
969+
"aws-upgrade",
970+
args.setup,
971+
str(previous_tags[0]),
972+
str(tag),
973+
orchestratord_override=args.orchestratord_override,
974+
)
975+
for previous_tag in previous_tags[1:]:
976+
aws.upgrade(str(previous_tag))
977+
aws.upgrade(tag)
978978
if args.test:
979979
print("--- Running tests")
980980
# Try waiting a bit, otherwise connection error, should be handled better

0 commit comments

Comments
 (0)