MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / validate

Method validate

test/orchestratord/mzcompose.py:1059–1138  ·  view source on GitHub ↗
(self, mods: dict[type[Modification], Any])

Source from the content-addressed store, hash-verified

1057 ] = configmap_name
1058
1059 def validate(self, mods: dict[type[Modification], Any]) -> None:
1060 if self.value is None:
1061 return
1062
1063 def check() -> None:
1064 environmentd = get_environmentd_data()
1065
1066 # Check that the volume is mounted
1067 volumes = environmentd["items"][0]["spec"]["volumes"]
1068 volume_found = False
1069 for volume in volumes:
1070 if volume.get("name") == "system-params":
1071 assert (
1072 volume.get("configMap") is not None
1073 ), f"Expected configMap in volume, but found {volume}"
1074 assert (
1075 volume["configMap"]["name"] == "system-params-test"
1076 ), f"Expected configmap name system-params-test, but found {volume['configMap']['name']}"
1077 volume_found = True
1078 break
1079 assert volume_found, f"Expected to find system-params volume in {volumes}"
1080
1081 # Check that the volume mount is present
1082 volume_mounts = environmentd["items"][0]["spec"]["containers"][0][
1083 "volumeMounts"
1084 ]
1085 volume_mount_found = False
1086 for mount in volume_mounts:
1087 if mount.get("name") == "system-params":
1088 assert (
1089 mount.get("mountPath") == "/system-params"
1090 ), f"Expected mount path /system-params, but found {mount['mountPath']}"
1091 volume_mount_found = True
1092 break
1093 assert (
1094 volume_mount_found
1095 ), f"Expected to find system-params volume mount in {volume_mounts}"
1096
1097 # Check that the config-sync-file-path arg is present
1098 args = environmentd["items"][0]["spec"]["containers"][0]["args"]
1099 expected_arg = "--config-sync-file-path=/system-params/system-params.json"
1100 assert any(
1101 expected_arg in arg for arg in args
1102 ), f"Expected {expected_arg} in environmentd args, but only found: {args}"
1103
1104 retry(check, 240)
1105
1106 version = MzVersion.parse_mz(mods[EnvironmentdImageRef])
1107 auth = mods[AuthenticatorKind]
1108 port = (
1109 6875
1110 if (version >= MzVersion.parse_mz("v0.147.0") and auth == "Password")
1111 or (version >= MzVersion.parse_mz("v26.0.0") and auth == "Sasl")
1112 or (version >= MzVersion.parse_mz("v26.16.0-dev.0") and auth == "Oidc")
1113 else 6877
1114 )
1115
1116 # Validate that the system parameters have actually been applied via SQL

Callers

nothing calls this directly

Calls 2

parse_mzMethod · 0.80
retryFunction · 0.70

Tested by

no test coverage detected