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

Function run_test

test/sql-feature-flags/mzcompose.py:224–281  ·  view source on GitHub ↗
(c: Composition, args: argparse.Namespace)

Source from the content-addressed store, hash-verified

222
223
224def run_test(c: Composition, args: argparse.Namespace) -> None:
225 c.up("redpanda", "materialized", Service("testdrive", idle=True))
226
227 scenarios = (
228 [globals()[args.scenario]]
229 if args.scenario
230 else all_subclasses(FeatureTestScenario)
231 )
232
233 # To add a new scenario create a new FeatureTestScenario subclass
234 for scenario in scenarios:
235 print(f"--- Running scenario {scenario.__name__} phase 1")
236 c.testdrive(scenario.phase1())
237
238 c.stop("materialized")
239 c.up("materialized")
240
241 print(f"--- Running scenario {scenario.__name__} phase 2")
242 c.testdrive(scenario.phase2())
243
244 materialized = Materialized(
245 unsafe_mode=False,
246 additional_system_parameter_defaults={
247 scenario.feature_name(): "on",
248 },
249 )
250
251 with c.override(materialized):
252 c.stop("materialized")
253 c.up("materialized")
254
255 print(f"--- Running scenario {scenario.__name__} phase 3")
256 c.testdrive(scenario.phase3())
257
258 # Dedicated test for ALTER SYSTEM RESET ALL
259 print("--- Running ALTER SYSTEM RESET ALL")
260 tmp = [header("(phase reset-all)", drop_schema=False)]
261 for scenario in scenarios:
262 # Turn all features off.
263 tmp.append(alter_system_set(scenario.feature_name(), "off"))
264
265 # Run ALTER SYSTEM RESET ALL
266 tmp.append(alter_system_reset_all())
267 for scenario in scenarios:
268 # Write each scenarios reset all data
269 tmp.append(scenario.reset_all())
270
271 # Create MZ config with all features set on by default
272 materialized = Materialized(
273 unsafe_mode=False,
274 additional_system_parameter_defaults={
275 scenario.feature_name(): "on" for scenario in scenarios
276 },
277 )
278 with c.override(materialized):
279 c.stop("materialized")
280 c.up("materialized")
281 c.testdrive("\n\n".join(tmp))

Callers 1

workflow_defaultFunction · 0.70

Calls 15

ServiceClass · 0.90
all_subclassesFunction · 0.90
MaterializedClass · 0.90
alter_system_setFunction · 0.85
alter_system_reset_allFunction · 0.85
phase1Method · 0.80
phase2Method · 0.80
feature_nameMethod · 0.80
overrideMethod · 0.80
phase3Method · 0.80
headerFunction · 0.70
upMethod · 0.45

Tested by

no test coverage detected