(c: Composition, args: argparse.Namespace)
| 222 | |
| 223 | |
| 224 | def 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)) |
no test coverage detected