Skip to content

Commit 4c291fb

Browse files
committed
orchestratord test: Change upgrade order
1 parent e74fbbd commit 4c291fb

File tree

2 files changed

+55
-32
lines changed

2 files changed

+55
-32
lines changed

ci/nightly/pipeline.template.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,6 +2367,7 @@ steps:
23672367
steps:
23682368
- id: orchestratord-defaults
23692369
label: "Orchestratord test (defaults from documentation)"
2370+
artifact_paths: ["mz_debug_*.zip"]
23702371
depends_on: devel-docker-tags
23712372
timeout_in_minutes: 120
23722373
plugins:
@@ -2379,6 +2380,7 @@ steps:
23792380

23802381
- id: orchestratord-default-properties
23812382
label: "Orchestratord test (defaults for properties)"
2383+
artifact_paths: ["mz_debug_*.zip"]
23822384
depends_on: devel-docker-tags
23832385
timeout_in_minutes: 120
23842386
plugins:
@@ -2391,6 +2393,7 @@ steps:
23912393

23922394
- id: orchestratord-individual
23932395
label: "Orchestratord test (individual properties)"
2396+
artifact_paths: ["mz_debug_*.zip"]
23942397
depends_on: devel-docker-tags
23952398
timeout_in_minutes: 120
23962399
plugins:
@@ -2403,6 +2406,7 @@ steps:
24032406

24042407
- id: orchestratord-combine
24052408
label: "Orchestratord test (combine properties)"
2409+
artifact_paths: ["mz_debug_*.zip"]
24062410
depends_on: build-aarch64
24072411
timeout_in_minutes: 120
24082412
plugins:
@@ -2415,6 +2419,7 @@ steps:
24152419

24162420
- id: orchestratord-upgrade-individual
24172421
label: "Orchestratord test (upgrade, individual props)"
2422+
artifact_paths: ["mz_debug_*.zip"]
24182423
depends_on: devel-docker-tags
24192424
timeout_in_minutes: 120
24202425
plugins:
@@ -2430,6 +2435,7 @@ steps:
24302435

24312436
- id: orchestratord-upgrade-combine
24322437
label: "Orchestratord test (upgrade, combine props)"
2438+
artifact_paths: ["mz_debug_*.zip"]
24332439
depends_on: devel-docker-tags
24342440
timeout_in_minutes: 120
24352441
plugins:
@@ -2445,6 +2451,7 @@ steps:
24452451

24462452
- id: orchestratord-upgrade-chain-individual
24472453
label: "Orchestratord test (upgrade chain, individual props)"
2454+
artifact_paths: ["mz_debug_*.zip"]
24482455
depends_on: devel-docker-tags
24492456
timeout_in_minutes: 120
24502457
plugins:
@@ -2460,6 +2467,7 @@ steps:
24602467

24612468
- id: orchestratord-upgrade-chain-combine
24622469
label: "Orchestratord test (upgrade chain, combine props)"
2470+
artifact_paths: ["mz_debug_*.zip"]
24632471
depends_on: devel-docker-tags
24642472
timeout_in_minutes: 120
24652473
plugins:

test/orchestratord/mzcompose.py

Lines changed: 47 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
import yaml
3131
from semver.version import Version
3232

33-
from materialize import MZ_ROOT, ci_util, git, spawn, ui
34-
from materialize.docker import MZ_GHCR_DEFAULT
33+
from materialize import MZ_ROOT, ci_util, git, spawn
3534
from materialize.mz_version import MzVersion
3635
from materialize.mzcompose.composition import (
3736
Composition,
@@ -41,6 +40,7 @@
4140
from materialize.mzcompose.services.balancerd import Balancerd
4241
from materialize.mzcompose.services.clusterd import Clusterd
4342
from materialize.mzcompose.services.environmentd import Environmentd
43+
from materialize.mzcompose.services.mz_debug import MzDebug
4444
from materialize.mzcompose.services.orchestratord import Orchestratord
4545
from materialize.mzcompose.services.testdrive import Testdrive
4646
from materialize.util import all_subclasses
@@ -55,9 +55,24 @@
5555
Environmentd(),
5656
Clusterd(),
5757
Balancerd(),
58+
MzDebug(),
5859
]
5960

6061

62+
def run_mz_debug() -> None:
63+
# Only using capture because it's too noisy
64+
spawn.capture(
65+
[
66+
"./mz-debug",
67+
"self-managed",
68+
"--k8s-namespace",
69+
"materialize-environment",
70+
"--mz-instance-name",
71+
"12345678-1234-1234-1234-123456789012",
72+
]
73+
)
74+
75+
6176
def get_tag(tag: str | None = None) -> str:
6277
# We can't use the mzbuild tag because it has a different fingerprint for
6378
# environmentd/clusterd/balancerd and the orchestratord depends on them
@@ -498,14 +513,9 @@ def validate(self, mods: dict[type[Modification], Any]) -> None:
498513
def check() -> None:
499514
environmentd = get_environmentd_data()
500515
image = environmentd["items"][0]["spec"]["containers"][0]["image"]
501-
image_registry = (
502-
"ghcr.io/materializeinc/materialize"
503-
if ui.env_is_truthy("MZ_GHCR", MZ_GHCR_DEFAULT)
504-
else "materialize"
505-
)
506-
expected = f"{image_registry}/environmentd:{self.value}"
516+
expected = f"materialize/environmentd:{self.value}"
507517
assert (
508-
image == expected
518+
image == expected or f"ghcr.io/materializeinc/{image}" == expected
509519
), f"Expected environmentd image {expected}, but found {image}"
510520

511521
retry(check, 240)
@@ -1070,11 +1080,11 @@ def check_pods() -> None:
10701080
class AuthenticatorKind(Modification):
10711081
@classmethod
10721082
def values(cls, version: MzVersion) -> list[Any]:
1073-
# Test None, Password (v0.147.7+), and Sasl (v0.147.16+)
1083+
# Test None, Password (v0.147.7+), and Sasl
10741084
result = ["None"]
10751085
if version >= MzVersion.parse_mz("v0.147.7"):
10761086
result.append("Password")
1077-
if version >= MzVersion.parse_mz("v0.147.16"):
1087+
if version >= MzVersion.parse_mz("v26.0.0"):
10781088
result.append("Sasl")
10791089
return result
10801090

@@ -1100,13 +1110,13 @@ def validate(self, mods: dict[type[Modification], Any]) -> None:
11001110
if self.value == "Password" and version <= MzVersion.parse_mz("v0.147.6"):
11011111
return
11021112

1103-
if self.value == "Sasl" and version < MzVersion.parse_mz("v0.147.16"):
1113+
if self.value == "Sasl" and version < MzVersion.parse_mz("v26.0.0"):
11041114
return
11051115

11061116
port = (
11071117
6875
11081118
if (version >= MzVersion.parse_mz("v0.147.0") and self.value == "Password")
1109-
or (version >= MzVersion.parse_mz("v0.147.16") and self.value == "Sasl")
1119+
or (version >= MzVersion.parse_mz("v26.0.0") and self.value == "Sasl")
11101120
else 6877
11111121
)
11121122
for i in range(120):
@@ -1252,10 +1262,23 @@ def workflow_defaults(c: Composition, parser: WorkflowArgumentParser) -> None:
12521262
)
12531263
args = parser.parse_args()
12541264

1255-
current_version = get_tag(args.tag)
1265+
c.up(Service("mz-debug", idle=True))
1266+
c.invoke("cp", "mz-debug:/usr/local/bin/mz-debug", ".")
1267+
1268+
current_version = get_version(args.tag)
12561269

12571270
# Following https://materialize.com/docs/installation/install-on-local-kind/
1258-
for version in reversed(get_self_managed_versions() + [get_version(args.tag)]):
1271+
# orchestratord test can't run against future versions, so ignore those
1272+
versions = reversed(
1273+
[
1274+
version
1275+
for version in get_self_managed_versions()
1276+
if version < current_version
1277+
]
1278+
+ [current_version]
1279+
)
1280+
for version in versions:
1281+
print(f"--- Running with defaults against {version}")
12591282
dir = "my-local-mz"
12601283
if os.path.exists(dir):
12611284
shutil.rmtree(dir)
@@ -1392,9 +1415,6 @@ def workflow_defaults(c: Composition, parser: WorkflowArgumentParser) -> None:
13921415
materialize_setup = list(yaml.load_all(f, Loader=yaml.Loader))
13931416
assert len(materialize_setup) == 3
13941417

1395-
print(version)
1396-
print(current_version)
1397-
print(version == current_version)
13981418
if version == current_version:
13991419
materialize_setup[2]["spec"][
14001420
"environmentdImageRef"
@@ -1493,6 +1513,7 @@ def workflow_defaults(c: Composition, parser: WorkflowArgumentParser) -> None:
14931513
]
14941514
)
14951515
raise ValueError("Never completed")
1516+
run_mz_debug()
14961517

14971518

14981519
def workflow_default(c: Composition, parser: WorkflowArgumentParser) -> None:
@@ -1534,7 +1555,8 @@ def workflow_default(c: Composition, parser: WorkflowArgumentParser) -> None:
15341555
"0.29.0"
15351556
), f"kind >= v0.29.0 required, while you are on {kind_version}"
15361557

1537-
c.up(Service("testdrive", idle=True))
1558+
c.up(Service("testdrive", idle=True), Service("mz-debug", idle=True))
1559+
c.invoke("cp", "mz-debug:/usr/local/bin/mz-debug", ".")
15381560

15391561
cluster = "kind"
15401562
clusters = spawn.capture(["kind", "get", "clusters"]).strip().split("\n")
@@ -1658,9 +1680,6 @@ def get_mods() -> Iterator[list[Modification]]:
16581680
mods.append(EnvironmentdImageRef(str(args.tag)))
16591681
run_scenario([mods], definition)
16601682
elif action == Action.Upgrade:
1661-
assert not ui.env_is_truthy(
1662-
"MZ_GHCR", MZ_GHCR_DEFAULT
1663-
), "Manually set MZ_GHCR=0 as an environment variable for upgrade testing"
16641683
assert args.runtime
16651684
end_time = (
16661685
datetime.datetime.now() + datetime.timedelta(seconds=args.runtime)
@@ -1683,9 +1702,6 @@ def get_mods() -> Iterator[list[Modification]]:
16831702
]
16841703
run_scenario(scenario, definition)
16851704
elif action == Action.UpgradeChain:
1686-
assert not ui.env_is_truthy(
1687-
"MZ_GHCR", MZ_GHCR_DEFAULT
1688-
), "Manually set MZ_GHCR=0 as an environment variable for upgrade testing"
16891705
assert args.runtime
16901706
end_time = (
16911707
datetime.datetime.now() + datetime.timedelta(seconds=args.runtime)
@@ -1806,18 +1822,14 @@ def run_scenario(
18061822
mod.modify(definition)
18071823
if mod.value in mod.failed_reconciliation_values():
18081824
expect_fail = True
1809-
if not initialize:
1810-
definition["materialize"]["spec"][
1811-
"rolloutStrategy"
1812-
] = "ImmediatelyPromoteCausingDowntime"
1813-
definition["materialize"]["spec"]["requestRollout"] = str(uuid.uuid4())
1814-
run(definition, expect_fail)
18151825
if initialize:
18161826
init(definition)
18171827
run(definition, expect_fail)
18181828
initialize = False # only initialize once
18191829
else:
18201830
upgrade(definition, expect_fail)
1831+
definition["materialize"]["spec"]["requestRollout"] = str(uuid.uuid4())
1832+
run(definition, expect_fail)
18211833
mod_dict = {mod.__class__: mod.value for mod in mods}
18221834
for subclass in all_subclasses(Modification):
18231835
if subclass not in mod_dict:
@@ -1831,6 +1843,9 @@ def run_scenario(
18311843
f"Reproduce with bin/mzcompose --find orchestratord run default --recreate-cluster --scenario='{scenario_json}'"
18321844
)
18331845
raise
1846+
finally:
1847+
if not expect_fail:
1848+
run_mz_debug()
18341849

18351850

18361851
def init(definition: dict[str, Any]) -> None:
@@ -2006,4 +2021,4 @@ def post_run_check(definition: dict[str, Any], expect_fail: bool) -> None:
20062021
)
20072022
raise ValueError("Never completed")
20082023
# Wait a bit for the status to stabilize
2009-
time.sleep(60)
2024+
time.sleep(180)

0 commit comments

Comments
 (0)