Skip to content

Commit 42c3c8b

Browse files
committed
Pass scenario to UseClusterdCompute
1 parent 57f990e commit 42c3c8b

4 files changed

Lines changed: 12 additions & 9 deletions

File tree

doc/developer/platform-checks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,5 +199,5 @@ later in the execution. This will confirm that the database is able to perform a
199199

200200
When you add new features or have SQL syntax changes, this can be handled in platform checks by comparing against the `base_version`. In a `Check` this can be done directly, see for example `UUID`:
201201
https://github.com/MaterializeInc/materialize/blob/fef9d6a00de4ff2bc6a92968470a2c88f85cab12/misc/python/materialize/checks/uuid.py#L17-L19
202-
For an action you have to pass the `base_version` parameter explicitly, see for example `UseClusterdCompute`:
202+
For an action you have to access the `scenario.base_version`, see for example `UseClusterdCompute`:
203203
https://github.com/MaterializeInc/materialize/blob/fef9d6a00de4ff2bc6a92968470a2c88f85cab12/misc/python/materialize/checks/mzcompose_actions.py#L74-L97

misc/python/materialize/checks/mzcompose_actions.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77
# the Business Source License, use of this software will be governed
88
# by the Apache License, Version 2.0.
99

10-
from typing import List, Optional
10+
from typing import TYPE_CHECKING, List, Optional
1111

1212
from materialize.checks.actions import Action
1313
from materialize.checks.executors import Executor
1414
from materialize.mzcompose.services import Clusterd, Materialized
1515
from materialize.util import MzVersion
1616

17+
if TYPE_CHECKING:
18+
from materialize.checks.scenarios import Scenario
19+
1720

1821
class MzcomposeAction(Action):
1922
pass
@@ -72,8 +75,8 @@ def execute(self, e: Executor) -> None:
7275

7376

7477
class UseClusterdCompute(MzcomposeAction):
75-
def __init__(self, base_version: MzVersion) -> None:
76-
self.base_version = base_version
78+
def __init__(self, scenario: "Scenario") -> None:
79+
self.base_version = scenario.base_version()
7780

7881
def execute(self, e: Executor) -> None:
7982
c = e.mzcompose_composition()

misc/python/materialize/checks/scenarios.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def actions(self) -> List[Action]:
110110
return [
111111
StartMz(),
112112
StartClusterdCompute(),
113-
UseClusterdCompute(base_version=self.base_version()),
113+
UseClusterdCompute(self),
114114
Initialize(self),
115115
KillClusterdCompute(),
116116
StartClusterdCompute(),
@@ -131,7 +131,7 @@ def actions(self) -> List[Action]:
131131
return [
132132
StartMz(),
133133
StartClusterdCompute(),
134-
UseClusterdCompute(base_version=self.base_version()),
134+
UseClusterdCompute(self),
135135
Initialize(self),
136136
KillMz(),
137137
StartMz(),
@@ -152,7 +152,7 @@ def actions(self) -> List[Action]:
152152
return [
153153
StartMz(),
154154
StartClusterdCompute(),
155-
UseClusterdCompute(base_version=self.base_version()),
155+
UseClusterdCompute(self),
156156
Initialize(self),
157157
KillClusterdStorageAction(),
158158
Manipulate(self, phase=1),

misc/python/materialize/checks/scenarios_upgrade.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def actions(self) -> List[Action]:
7878
return [
7979
StartMz(tag=self.base_version()),
8080
StartClusterdCompute(tag=self.base_version()),
81-
UseClusterdCompute(base_version=self.base_version()),
81+
UseClusterdCompute(self),
8282
Initialize(self),
8383
Manipulate(self, phase=1),
8484
KillMz(),
@@ -110,7 +110,7 @@ def actions(self) -> List[Action]:
110110
return [
111111
StartMz(tag=self.base_version()),
112112
StartClusterdCompute(tag=self.base_version()),
113-
UseClusterdCompute(base_version=self.base_version()),
113+
UseClusterdCompute(self),
114114
Initialize(self),
115115
Manipulate(self, phase=1),
116116
KillClusterdCompute(),

0 commit comments

Comments
 (0)