Skip to content

Commit

Permalink
Tweak tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dirx committed Jan 21, 2023
1 parent 3a83fc7 commit f8f6750
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion resources/phpunit/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
16 changes: 8 additions & 8 deletions tests/RdKafka/ConfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ function (KafkaConsumer $consumer, int $err, array $topicPartitions, $opaque = n
break;

default:
throw new \Exception($err);
throw Exception::fromError($err);
}
}
);
Expand Down Expand Up @@ -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 = [];
Expand All @@ -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']);
}

/**
Expand Down Expand Up @@ -515,7 +515,7 @@ function (KafkaConsumer $consumer, int $err, array $topicPartitions, $opaque = n
break;

default:
throw new \Exception($err);
throw Exception::fromError($err);
}
}
);
Expand Down

0 comments on commit f8f6750

Please sign in to comment.