Skip to content

Commit 96adb91

Browse files
committed
orchestratord: Test defaults from our documentation
1 parent 1159af5 commit 96adb91

File tree

5 files changed

+140
-1
lines changed

5 files changed

+140
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ flake.lock
5959
/src/testdrive/ci/protobuf-include
6060
/known-docker-images.txt
6161
/test/sqllogictest/sqlite
62+
my-local-mz/

ci/nightly/pipeline.template.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2295,6 +2295,18 @@ steps:
22952295
key: orchestratord-test
22962296
steps:
22972297
- id: orchestratord-defaults
2298+
label: "Orchestratord test (defaults from documentation)"
2299+
depends_on: build-aarch64
2300+
timeout_in_minutes: 120
2301+
plugins:
2302+
- ./ci/plugins/mzcompose:
2303+
composition: orchestratord
2304+
run: defaults
2305+
ci-builder: stable
2306+
agents:
2307+
queue: hetzner-aarch64-16cpu-32gb
2308+
2309+
- id: orchestratord-default-properties
22982310
label: "Orchestratord test (defaults for properties)"
22992311
depends_on: build-aarch64
23002312
timeout_in_minutes: 120

ci/test/lint-main/checks/check-mzcompose-files.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ check_default_workflow_references_others() {
4848
-not -wholename "./test/testdrive-old-kafka-src-syntax/mzcompose.py" `# Other workflow is run separately` \
4949
-not -wholename "./test/terraform/mzcompose.py" `# Handled differently` \
5050
-not -wholename "./test/cluster-spec-sheet/mzcompose.py" `# Handled differently` \
51+
-not -wholename "./test/orchestratord/mzcompose.py" `# Handled differently` \
5152
)
5253

5354
for file in "${MZCOMPOSE_TEST_FILES[@]}"; do

misc/helm-charts/testing/materialize.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ spec:
3131
environmentdImageRef: materialize/environmentd:v0.163.0-dev.0
3232
backendSecretName: materialize-backend
3333
authenticatorKind: None
34+
environmentId: 12345678-1234-1234-1234-123456789013
3435
#balancerdExternalCertificateSpec:
3536
# dnsNames:
3637
# - balancerd

test/orchestratord/mzcompose.py

Lines changed: 125 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import json
1818
import os
1919
import random
20+
import shutil
2021
import signal
2122
import subprocess
2223
import time
@@ -25,6 +26,7 @@
2526
from enum import Enum
2627
from typing import Any
2728

29+
import requests
2830
import yaml
2931
from semver.version import Version
3032

@@ -41,7 +43,10 @@
4143
from materialize.mzcompose.services.orchestratord import Orchestratord
4244
from materialize.mzcompose.services.testdrive import Testdrive
4345
from materialize.util import all_subclasses
44-
from materialize.version_list import get_all_self_managed_versions
46+
from materialize.version_list import (
47+
get_all_self_managed_versions,
48+
get_self_managed_versions,
49+
)
4550

4651
SERVICES = [
4752
Testdrive(),
@@ -1127,6 +1132,125 @@ class Action(Enum):
11271132
UpgradeChain = "upgrade-chain"
11281133

11291134

1135+
def workflow_defaults(c: Composition, parser: WorkflowArgumentParser) -> None:
1136+
current_version = get_tag()
1137+
1138+
# Following https://materialize.com/docs/self-managed/v25.2/installation/install-on-local-kind/
1139+
for version in reversed(get_self_managed_versions() + [current_version]):
1140+
dir = "my-local-mz"
1141+
if os.path.exists(dir):
1142+
shutil.rmtree(dir)
1143+
os.mkdir(dir)
1144+
spawn.runv(["kind", "delete", "cluster"])
1145+
spawn.runv(["kind", "create", "cluster"])
1146+
1147+
shutil.copyfile(
1148+
"misc/helm-charts/operator/values.yaml",
1149+
os.path.join(dir, "sample-values.yaml"),
1150+
)
1151+
files = {
1152+
"sample-postgres.yaml": "misc/helm-charts/testing/postgres.yaml",
1153+
"sample-minio.yaml": "misc/helm-charts/testing/minio.yaml",
1154+
"sample-materialize.yaml": "misc/helm-charts/testing/materialize.yaml",
1155+
}
1156+
1157+
for file, path in files.items():
1158+
if version == current_version:
1159+
shutil.copyfile(path, os.path.join(dir, file))
1160+
else:
1161+
url = f"https://raw.githubusercontent.com/MaterializeInc/materialize/refs/tags/{version}/{path}"
1162+
response = requests.get(url)
1163+
assert (
1164+
response.status_code == 200
1165+
), f"Failed to download {file} from {url}: {response.status_code}"
1166+
with open(os.path.join(dir, file), "wb") as f:
1167+
f.write(response.content)
1168+
1169+
spawn.runv(
1170+
[
1171+
"helm",
1172+
"repo",
1173+
"add",
1174+
"materialize",
1175+
"https://materializeinc.github.io/materialize",
1176+
]
1177+
)
1178+
spawn.runv(["helm", "repo", "update", "materialize"])
1179+
spawn.runv(
1180+
[
1181+
"helm",
1182+
"install",
1183+
"my-materialize-operator",
1184+
"materialize/materialize-operator",
1185+
"--namespace=materialize",
1186+
"--create-namespace",
1187+
"--version",
1188+
"v25.2.13", # TODO: How to set this version?
1189+
"--set",
1190+
"observability.podMetrics.enabled=true",
1191+
"-f",
1192+
os.path.join(dir, "sample-values.yaml"),
1193+
]
1194+
)
1195+
spawn.runv(
1196+
["kubectl", "apply", "-f", os.path.join(dir, "sample-postgres.yaml")]
1197+
)
1198+
spawn.runv(["kubectl", "apply", "-f", os.path.join(dir, "sample-minio.yaml")])
1199+
spawn.runv(["kubectl", "get", "all", "-n", "materialize"])
1200+
spawn.runv(
1201+
[
1202+
"helm",
1203+
"repo",
1204+
"add",
1205+
"metrics-server",
1206+
"https://kubernetes-sigs.github.io/metrics-server/",
1207+
]
1208+
)
1209+
spawn.runv(["helm", "repo", "update", "metrics-server"])
1210+
spawn.runv(
1211+
[
1212+
"helm",
1213+
"install",
1214+
"metrics-server",
1215+
"metrics-server/metrics-server",
1216+
"--namespace",
1217+
"kube-system",
1218+
"--set",
1219+
"args={--kubelet-insecure-tls,--kubelet-preferred-address-types=InternalIP,Hostname,ExternalIP}",
1220+
]
1221+
)
1222+
for i in range(120):
1223+
try:
1224+
spawn.capture(
1225+
[
1226+
"kubectl",
1227+
"get",
1228+
"crd",
1229+
"materializes.materialize.cloud",
1230+
"-n",
1231+
"materialize",
1232+
"-o",
1233+
"name",
1234+
],
1235+
stderr=subprocess.DEVNULL,
1236+
)
1237+
break
1238+
1239+
except subprocess.CalledProcessError:
1240+
pass
1241+
time.sleep(1)
1242+
else:
1243+
raise ValueError("Never completed")
1244+
spawn.runv(
1245+
["kubectl", "apply", "-f", os.path.join(dir, "sample-materialize.yaml")]
1246+
)
1247+
# TODO: Verify that everything is there:
1248+
spawn.runv(["kubectl", "get", "all", "-n", "materialize-environment"])
1249+
1250+
# TODO: Remove the break once environmentId is set in older versions
1251+
break
1252+
1253+
11301254
def workflow_default(c: Composition, parser: WorkflowArgumentParser) -> None:
11311255
parser.add_argument(
11321256
"--recreate-cluster",

0 commit comments

Comments
 (0)