From f8f675080253f8491c949d78b28313efd26a950b Mon Sep 17 00:00:00 2001 From: Dirk Adler Date: Sat, 21 Jan 2023 16:54:25 +0100 Subject: [PATCH] Tweak tests --- resources/phpunit/config.php | 2 +- tests/RdKafka/ConfTest.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/resources/phpunit/config.php b/resources/phpunit/config.php index df72262e..289348c6 100644 --- a/resources/phpunit/config.php +++ b/resources/phpunit/config.php @@ -4,5 +4,5 @@ const KAFKA_TEST_TOPIC = "test"; const KAFKA_TEST_TOPIC_ADMIN = "test_admin"; const KAFKA_TEST_TOPIC_PARTITIONS = "test_partitions"; -const KAFKA_TEST_TIMEOUT_MS = 10000; +const KAFKA_TEST_TIMEOUT_MS = 20000; const KAFKA_BROKER_ID = 111; diff --git a/tests/RdKafka/ConfTest.php b/tests/RdKafka/ConfTest.php index ff76a378..257c465d 100644 --- a/tests/RdKafka/ConfTest.php +++ b/tests/RdKafka/ConfTest.php @@ -417,7 +417,7 @@ function (KafkaConsumer $consumer, int $err, array $topicPartitions, $opaque = n break; default: - throw new \Exception($err); + throw Exception::fromError($err); } } ); @@ -446,13 +446,13 @@ function (KafkaConsumer $consumer, int $err, array $topicPartitions, $opaque = n $this->assertContains($consumer3, $assignedConsumers); $this->assertSame(RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS, $rebalanceCallbackStack[0]['err']); - $this->assertCount(1, $rebalanceCallbackStack[0]['partitions']); + $this->assertGreaterThanOrEqual(1, $rebalanceCallbackStack[0]['partitions']); $this->assertSame(RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS, $rebalanceCallbackStack[1]['err']); - $this->assertCount(1, $rebalanceCallbackStack[1]['partitions']); + $this->assertGreaterThanOrEqual(1, $rebalanceCallbackStack[1]['partitions']); $this->assertSame(RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS, $rebalanceCallbackStack[2]['err']); - $this->assertCount(1, $rebalanceCallbackStack[2]['partitions']); + $this->assertGreaterThanOrEqual(1, $rebalanceCallbackStack[2]['partitions']); // reset stack $rebalanceCallbackStack = []; @@ -476,13 +476,13 @@ function (KafkaConsumer $consumer, int $err, array $topicPartitions, $opaque = n $this->assertContains($consumer3, $revokedConsumers); $this->assertSame(RD_KAFKA_RESP_ERR__REVOKE_PARTITIONS, $rebalanceCallbackStack[0]['err']); - $this->assertCount(1, $rebalanceCallbackStack[0]['partitions']); + $this->assertGreaterThanOrEqual(1, $rebalanceCallbackStack[0]['partitions']); $this->assertSame(RD_KAFKA_RESP_ERR__REVOKE_PARTITIONS, $rebalanceCallbackStack[1]['err']); - $this->assertCount(1, $rebalanceCallbackStack[1]['partitions']); + $this->assertGreaterThanOrEqual(1, $rebalanceCallbackStack[1]['partitions']); $this->assertSame(RD_KAFKA_RESP_ERR__REVOKE_PARTITIONS, $rebalanceCallbackStack[2]['err']); - $this->assertCount(1, $rebalanceCallbackStack[2]['partitions']); + $this->assertGreaterThanOrEqual(1, $rebalanceCallbackStack[2]['partitions']); } /** @@ -515,7 +515,7 @@ function (KafkaConsumer $consumer, int $err, array $topicPartitions, $opaque = n break; default: - throw new \Exception($err); + throw Exception::fromError($err); } } );