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

Function test_cluster_replica_sizes

test/cloudtest/test_compute.py:148–241  ·  view source on GitHub ↗

Test that --cluster-replica-sizes mapping is respected

(mz: MaterializeApplication)

Source from the content-addressed store, hash-verified

146 reason="Keeps flaking, see https://linear.app/materializeinc/issue/SQL-410"
147)
148def test_cluster_replica_sizes(mz: MaterializeApplication) -> None:
149 """Test that --cluster-replica-sizes mapping is respected"""
150 # Some time for existing cluster drops to complete so we don't try to spin them up again
151 time.sleep(5)
152 cluster_replica_size_map = {
153 "small": {
154 "scale": 1,
155 "workers": 1,
156 "cpu_limit": None,
157 "memory_limit": None,
158 "disk_limit": None,
159 "credits_per_hour": "1",
160 "disabled": False,
161 "selectors": {"key1": "value1"},
162 },
163 "medium": {
164 "scale": 1,
165 "workers": 1,
166 "cpu_limit": None,
167 "memory_limit": None,
168 "disk_limit": None,
169 "credits_per_hour": "1",
170 "disabled": False,
171 "selectors": {"key2": "value2", "key3": "value3"},
172 },
173 # for existing clusters
174 "1": {
175 "scale": 1,
176 "workers": 1,
177 "cpu_limit": None,
178 "memory_limit": None,
179 "disk_limit": None,
180 "disabled": False,
181 "credits_per_hour": "1",
182 },
183 "2-1": {
184 "scale": 2,
185 "workers": 2,
186 "cpu_limit": None,
187 "memory_limit": None,
188 "disk_limit": None,
189 "disabled": False,
190 "credits_per_hour": "2",
191 },
192 }
193
194 stateful_set = [
195 resource
196 for resource in mz.resources
197 if type(resource) == EnvironmentdStatefulSet
198 ]
199 assert len(stateful_set) == 1
200 stateful_set = copy.deepcopy(stateful_set[0])
201 stateful_set.env["MZ_CLUSTER_REPLICA_SIZES"] = json.dumps(cluster_replica_size_map)
202 stateful_set.extra_args.append("--bootstrap-default-cluster-replica-size=1")
203 stateful_set.replace()
204 mz.wait_for_sql()
205

Callers

nothing calls this directly

Calls 9

get_node_selectorFunction · 0.85
wait_for_sqlMethod · 0.80
sleepMethod · 0.45
appendMethod · 0.45
replaceMethod · 0.45
itemsMethod · 0.45
sqlMethod · 0.45
sql_queryMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected