9
9
from ducktape .mark import parametrize
10
10
from ducktape .mark .resource import cluster
11
11
from ducktape .tests .test import Test
12
- from kafkatest .automq .automq_e2e_util import (run_simple_load , TOPIC , append_info )
12
+ from ducktape .mark import matrix
13
+ from kafkatest .automq .automq_e2e_util import (FILE_WAL , S3_WAL , run_simple_load , TOPIC , append_info )
13
14
from kafkatest .services .kafka import KafkaService
14
15
15
16
# Configuration constants for the AutoBalancer
@@ -94,7 +95,7 @@ def __init__(self, test_context):
94
95
self .avg_deviation = 0.2
95
96
self .maximum_broker_deviation_percentage = 0.15
96
97
97
- def create_kafka (self , num_nodes = 1 , partition = 1 , exclude_broker = None , exclude_topic = None , replica_assignment = None ):
98
+ def create_kafka (self , num_nodes = 1 , partition = 1 , exclude_broker = None , exclude_topic = None , replica_assignment = None , wal = 'file' ):
98
99
"""
99
100
Create and configure a Kafka cluster for testing.
100
101
@@ -123,6 +124,7 @@ def create_kafka(self, num_nodes=1, partition=1, exclude_broker=None, exclude_to
123
124
[REPORT_INTERVAL , str (4000 )],
124
125
[DETECT_INTERVAL , str (8000 )],
125
126
[METRIC_REPORTERS , 'kafka.autobalancer.metricsreporter.AutoBalancerMetricsReporter' ],
127
+ ['s3.wal.path' , FILE_WAL if wal == 'file' else S3_WAL ],
126
128
]
127
129
128
130
if exclude_broker :
@@ -153,16 +155,16 @@ def create_kafka(self, num_nodes=1, partition=1, exclude_broker=None, exclude_to
153
155
self .start = True
154
156
155
157
@cluster (num_nodes = 5 )
156
- @parametrize (automq_num_nodes = 2 , partition = 4 , replica_assignment = '1,1,1,2' )
157
- def test_action (self , automq_num_nodes , partition , replica_assignment ):
158
+ @matrix (automq_num_nodes = [ 2 ] , partition = [ 4 ] , replica_assignment = [ '1,1,1,2' ], wal = [ 'file' , 's3' ] )
159
+ def test_action (self , automq_num_nodes , partition , replica_assignment , wal ):
158
160
"""
159
161
Test throughput distribution across brokers
160
162
:param automq_num_nodes: Number of automq
161
163
:param partition: Number of partitions
162
164
:param replica_assignment: Replica assignment for partitions
163
165
"""
164
166
success , msg = True , ''
165
- self .create_kafka (num_nodes = automq_num_nodes , partition = partition , replica_assignment = replica_assignment )
167
+ self .create_kafka (num_nodes = automq_num_nodes , partition = partition , replica_assignment = replica_assignment , wal = wal )
166
168
self .kafka .start ()
167
169
168
170
run_simple_load (test_context = self .context , kafka = self .kafka , logger = self .logger , topic = self .topic ,
@@ -176,8 +178,8 @@ def test_action(self, automq_num_nodes, partition, replica_assignment):
176
178
assert success , msg
177
179
178
180
@cluster (num_nodes = 4 )
179
- @parametrize (automq_num_nodes = 2 , exclude_broker = '2' , partition = 4 , replica_assignment = '1,1,1,2' )
180
- def test_broker_white_list (self , automq_num_nodes , exclude_broker , partition , replica_assignment ):
181
+ @matrix (automq_num_nodes = [ 2 ] , exclude_broker = [ '2' ] , partition = [ 4 ] , replica_assignment = [ '1,1,1,2' ], wal = [ 'file' , 's3' ] )
182
+ def test_broker_white_list (self , automq_num_nodes , exclude_broker , partition , replica_assignment , wal ):
181
183
"""
182
184
Test broker exclusion functionality
183
185
:param automq_num_nodes: Number of automq
@@ -187,22 +189,23 @@ def test_broker_white_list(self, automq_num_nodes, exclude_broker, partition, re
187
189
"""
188
190
success , msg = True , ''
189
191
self .create_kafka (num_nodes = automq_num_nodes , exclude_broker = exclude_broker , partition = partition ,
190
- replica_assignment = replica_assignment )
192
+ replica_assignment = replica_assignment , wal = wal )
191
193
self .kafka .start ()
192
194
before = self .kafka .parse_describe_topic (self .kafka .describe_topic (TOPIC ))
193
195
run_simple_load (test_context = self .context , kafka = self .kafka , logger = self .logger , topic = self .topic ,
194
196
num_records = 20000 , throughput = 1300 )
195
197
after = self .kafka .parse_describe_topic (self .kafka .describe_topic (TOPIC ))
196
198
197
- success_ , msg_ = check_partition_eq (topic_info1 = before , topic_info2 = after )
199
+ success_ , msg_ = check_partition_eq (topic_info1 = before ,
200
+ topic_info2 = after )
198
201
success = success and success_
199
202
msg = append_info (msg , success_ , msg_ )
200
203
201
204
assert success , msg
202
205
203
206
@cluster (num_nodes = 6 )
204
- @parametrize (automq_num_nodes = 2 )
205
- def test_topic_white_list (self , automq_num_nodes ):
207
+ @matrix (automq_num_nodes = [ 2 ], wal = [ 'file' , 's3' ] )
208
+ def test_topic_white_list (self , automq_num_nodes , wal ):
206
209
"""
207
210
Test topic exclusion functionality
208
211
:param automq_num_nodes: Number of automq
@@ -224,7 +227,7 @@ def test_topic_white_list(self, automq_num_nodes):
224
227
"configs" : {"min.insync.replicas" : 1 },
225
228
"replica-assignment" : '1,1,1,2' ,
226
229
}
227
- self .create_kafka (num_nodes = automq_num_nodes , exclude_topic = topic1 , partition = 1 , replica_assignment = '1' )
230
+ self .create_kafka (num_nodes = automq_num_nodes , exclude_topic = topic1 , partition = 1 , replica_assignment = '1' , wal = wal )
228
231
self .kafka .start ()
229
232
self .kafka .create_topic (topic_cfg1 )
230
233
self .kafka .create_topic (topic_cfg2 )
0 commit comments