Skip to content

Commit

Permalink
ducktape: Fix constant in connection_rate test
Browse files Browse the repository at this point in the history
Fixes #5276
  • Loading branch information
VadimPlh committed Jul 22, 2022
1 parent 78365c8 commit a0ed303
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions tests/rptest/tests/connection_rate_limit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,19 @@ class ConnectionRateLimitTest(PreallocNodesTest):
PRODUCE_COUNT = 10
READ_COUNT = 10
RANDOM_READ_PARALLEL = 3
REFRESH_TOKENS_TIME_SEC = 2.0
RATE_LIMIT = 4
REFRESH_TOKENS_TIME_SEC = 2

topics = (TopicSpec(partition_count=1, replication_factor=1), )

def __init__(self, test_context):
resource_setting = ResourceSettings(num_cpus=1)
super(ConnectionRateLimitTest,
self).__init__(test_context=test_context,
num_brokers=1,
node_prealloc_count=1,
extra_rp_conf={"kafka_connection_rate_limit": 6},
resource_settings=resource_setting)
super(ConnectionRateLimitTest, self).__init__(
test_context=test_context,
num_brokers=1,
node_prealloc_count=1,
extra_rp_conf={"kafka_connection_rate_limit": self.RATE_LIMIT},
resource_settings=resource_setting)

self._producer = FranzGoVerifiableProducer(test_context, self.redpanda,
self.topics[0],
Expand Down Expand Up @@ -90,7 +91,9 @@ def consumed():

return need_finish

wait_until(consumed, timeout_sec=190, backoff_sec=0.1)
wait_until(consumed,
timeout_sec=190,
backoff_sec=(1 / self.RATE_LIMIT))

finish = time.time()

Expand Down Expand Up @@ -119,8 +122,8 @@ def connection_rate_test(self):
time1 = self.get_read_time(self.RANDOM_READ_PARALLEL)
time2 = self.get_read_time(self.RANDOM_READ_PARALLEL * 2)

assert time2 >= time1 * 1.7

metrics = MetricCheck(self.logger, self.redpanda,
self.redpanda.nodes[0], RATE_METRIC, {})
metrics.evaluate([(RATE_METRIC, lambda a, b: b > 0)])

assert time2 >= time1 * 1.7, f'Time for first iteration:{time1} Time for second iteration:{time2}'

0 comments on commit a0ed303

Please sign in to comment.