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

Function workflow_default

test/pubsub-disruption/mzcompose.py:77–173  ·  view source on GitHub ↗

Test that the system is able to make progress in the face of PubSub disruptions.

(c: Composition, parser: WorkflowArgumentParser)

Source from the content-addressed store, hash-verified

75
76
77def workflow_default(c: Composition, parser: WorkflowArgumentParser) -> None:
78 """Test that the system is able to make progress in the face of PubSub disruptions."""
79 parser.add_argument("disruptions", nargs="*", default=[d.name for d in disruptions])
80
81 args = parser.parse_args()
82
83 for disruption in selected_by_name(args.disruptions, disruptions):
84 c.down(destroy_volumes=True)
85 c.up("redpanda", "materialized", Service("testdrive", idle=True))
86
87 toxiproxy_start(c)
88
89 c.testdrive(input=SCHEMA + dedent("""
90 > CREATE TABLE t1 (f1 INTEGER, f2 INTEGER);
91 $ kafka-create-topic topic=pubsub-disruption partitions=4
92
93 > CREATE CONNECTION IF NOT EXISTS csr_conn
94 TO CONFLUENT SCHEMA REGISTRY (URL '${testdrive.schema-registry-url}');
95
96 > CREATE CONNECTION IF NOT EXISTS kafka_conn
97 TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
98
99 > INSERT INTO t1 SELECT generate_series, 1 FROM generate_series(1,1000000);
100 $ kafka-ingest format=avro key-format=avro topic=pubsub-disruption schema=${schema} key-schema=${keyschema} start-iteration=1 repeat=1000000
101 {"f1": ${kafka-ingest.iteration}} {"f2": 1}
102
103 > CREATE SOURCE s1
104 FROM KAFKA CONNECTION kafka_conn
105 (TOPIC 'testdrive-pubsub-disruption-${testdrive.seed}')
106
107 > CREATE TABLE s1_tbl FROM SOURCE s1 (REFERENCE "testdrive-pubsub-disruption-${testdrive.seed}")
108 FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
109 ENVELOPE UPSERT
110
111 > CREATE MATERIALIZED VIEW v1 AS
112 SELECT COUNT(*) AS c1, COUNT(DISTINCT f1) AS c2, COUNT(DISTINCT f2) AS c3,
113 MIN(f1) AS min1, MIN(f2) AS min2, MAX(f1) AS max1, MAX(f2) AS max2
114 FROM t1;
115
116 > CREATE MATERIALIZED VIEW v2 AS
117 SELECT COUNT(*) AS c1, COUNT(DISTINCT f1) AS c2, COUNT(DISTINCT f2) AS c3,
118 MIN(f1) AS min1, MIN(f2) AS min2, MAX(f1) AS max1, MAX(f2) AS max2
119 FROM s1_tbl;
120
121 > UPDATE t1 SET f2 = 2;
122 $ kafka-ingest format=avro key-format=avro topic=pubsub-disruption schema=${schema} key-schema=${keyschema} start-iteration=1 repeat=1000000
123 {"f1": ${kafka-ingest.iteration}} {"f2": 2}
124 """))
125
126 disruption.breakage(c)
127
128 c.testdrive(input=SCHEMA + dedent("""
129 $ set-sql-timeout duration=120s
130
131 > UPDATE t1 SET f2 = 3;
132 $ kafka-ingest format=avro key-format=avro topic=pubsub-disruption schema=${schema} key-schema=${keyschema} start-iteration=1 repeat=1000000
133 {"f1": ${kafka-ingest.iteration}} {"f2": 3}
134

Callers

nothing calls this directly

Calls 6

selected_by_nameFunction · 0.90
ServiceClass · 0.90
downMethod · 0.80
toxiproxy_startFunction · 0.70
upMethod · 0.45
testdriveMethod · 0.45

Tested by

no test coverage detected