kafka_neu-76e4d1b5-8b7b-4eb8-ad4b-86e90f693c1d.zip-extract/kafka-4.2.0-src/tests/kafkatest/sanity_checks/test_bounce.py

Path
kafka_neu-76e4d1b5-8b7b-4eb8-ad4b-86e90f693c1d.zip-extract/kafka-4.2.0-src/tests/kafkatest/sanity_checks/test_bounce.py
Status
scanned
Type
file
Name
test_bounce.py
Extension
.py
Programming language
Python
Mime type
text/x-script.python
File type
Python script, ASCII text executable
Tag

      
    
Rootfs path

      
    
Size
3730 (3.6 KB)
MD5
1d3e1d79b7811d15a43afdfb0f8ea454
SHA1
6db2043e22257e665ed86300adea23c4a094462e
SHA256
e760683ea0e3e5222672e82b5783b1687b6668cdfb0455a8feed2bc0476a2bfc
SHA512

      
    
SHA1_git
1ccd05135d0da4a7b7fac68a11e30db8498a3e11
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
test_bounce.py | 3.6 KB |

# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from ducktape.mark import matrix from ducktape.mark.resource import cluster from ducktape.tests.test import Test from ducktape.utils.util import wait_until from kafkatest.services.kafka import KafkaService, quorum from kafkatest.services.verifiable_producer import VerifiableProducer class TestBounce(Test): """Sanity checks on verifiable producer service class with cluster roll.""" def __init__(self, test_context): super(TestBounce, self).__init__(test_context) quorum_size_arg_name = 'quorum_size' default_quorum_size = 1 quorum_size = default_quorum_size if not test_context.injected_args else test_context.injected_args.get(quorum_size_arg_name, default_quorum_size) if quorum_size < 1: raise Exception("Illegal %s value provided for the test: %s" % (quorum_size_arg_name, quorum_size)) self.topic = "topic" num_kafka_nodes = quorum_size if quorum.for_test(test_context) == quorum.combined_kraft else 1 self.kafka = KafkaService(test_context, num_nodes=num_kafka_nodes, zk=None, topics={self.topic: {"partitions": 1, "replication-factor": 1}}, controller_num_nodes_override=quorum_size) self.num_messages = 1000 def create_producer(self): # This will produce to source kafka cluster self.producer = VerifiableProducer(self.test_context, num_nodes=1, kafka=self.kafka, topic=self.topic, max_messages=self.num_messages, throughput=self.num_messages // 10) # Isolated and Combined KRaft, quorum size = 3 @cluster(num_nodes=4) @matrix(metadata_quorum=quorum.all_kraft, quorum_size=[1]) # Isolated and Combined KRaft, quorum size = 3 @cluster(num_nodes=6) @matrix(metadata_quorum=quorum.all_kraft, quorum_size=[3]) def test_simple_run(self, metadata_quorum, quorum_size): """ Test that we can start VerifiableProducer on the current branch snapshot version, and verify that we can produce a small number of messages both before and after a subsequent roll. """ self.kafka.start() for first_time in [True, False]: self.create_producer() self.producer.start() wait_until(lambda: self.producer.num_acked > 5, timeout_sec=15, err_msg="Producer failed to start in a reasonable amount of time.") self.producer.wait() num_produced = self.producer.num_acked assert num_produced == self.num_messages, "num_produced: %d, num_messages: %d" % (num_produced, self.num_messages) if first_time: self.producer.stop() if self.kafka.quorum_info.using_kraft and self.kafka.isolated_controller_quorum: self.kafka.isolated_controller_quorum.restart_cluster() self.kafka.restart_cluster()
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
24.39
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 8 8
Package URL License Primary language
pkg:pypi/kafkatest@4.2.0 apache-2.0 Python