From c726d31ab76049f01bcd83da3653b059dfc5273e Mon Sep 17 00:00:00 2001 From: Michael Davenport Date: Wed, 29 Jan 2020 10:48:30 +0000 Subject: [PATCH 1/4] Remove deprecated setDefaultTopic and fix tests --- src/PubSubConnectionFactory.php | 2 +- tests/PubSubConnectionFactoryTest.php | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/PubSubConnectionFactory.php b/src/PubSubConnectionFactory.php index e0e97fd..c9cf585 100644 --- a/src/PubSubConnectionFactory.php +++ b/src/PubSubConnectionFactory.php @@ -91,11 +91,11 @@ protected function makeKafkaAdapter(array $config) $topicConf->set('auto.offset.reset', 'smallest'); $conf = $this->container->makeWith('pubsub.kafka.conf'); + $conf->set('group.id', array_get($config, 'consumer_group_id', 'php-pubsub')); $conf->set('metadata.broker.list', $config['brokers']); $conf->set('enable.auto.commit', 'false'); $conf->set('offset.store.method', 'broker'); - $conf->setDefaultTopicConf($topicConf); $consumer = $this->container->makeWith('pubsub.kafka.consumer', ['conf' => $conf]); diff --git a/tests/PubSubConnectionFactoryTest.php b/tests/PubSubConnectionFactoryTest.php index e2dcebe..cf4ab92 100644 --- a/tests/PubSubConnectionFactoryTest.php +++ b/tests/PubSubConnectionFactoryTest.php @@ -122,18 +122,15 @@ public function testMakeKafkaAdapter() 'broker', ]) ->once(); - $conf->shouldReceive('setDefaultTopicConf') - ->with($topicConf) - ->once(); - $container->shouldReceive('make') + $container->shouldReceive('makeWith') ->with('pubsub.kafka.conf') ->once() ->andReturn($conf); $consumer = Mockery::mock(\RdKafka\KafkaConsumer::class); - $container->shouldReceive('make') + $container->shouldReceive('makeWith') ->withArgs([ 'pubsub.kafka.consumer', ['conf' => $conf], From 04e392e9c36e57287bcb7dbf60f1a7b33fa34290 Mon Sep 17 00:00:00 2001 From: Michael Davenport Date: Wed, 29 Jan 2020 10:48:44 +0000 Subject: [PATCH 2/4] Fixes to Dockerfile so will build and run --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7b8ff03..860c8e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ RUN docker-php-ext-install -j$(nproc) zip \ && mkdir php-rdkafka \ && cd php-rdkafka \ && git clone https://github.com/arnaud-lb/php-rdkafka.git . \ - && git checkout php7 \ + && git checkout master \ && phpize \ && ./configure \ && make -j$(nproc) \ @@ -60,4 +60,5 @@ COPY phpunit.xml /opt/laravel-pubsub/ RUN composer dump-autoload --no-interaction -CMD ["/bin/bash"] +# Keep the container running so that can run tests manually +CMD ["php-fpm"] \ No newline at end of file From 9730e64425002bd89ff0492b9274ea20f4c67627 Mon Sep 17 00:00:00 2001 From: Michael Davenport Date: Wed, 29 Jan 2020 12:24:33 +0000 Subject: [PATCH 3/4] Adding ENV var so passes travis CI --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index b12489d..f5357a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,9 @@ php: - 7.1 - nightly +env: + - VERSION=3.0.1 + before_script: - composer install From bf856b2f80d8b1a3e2cad3d3465be19168f68821 Mon Sep 17 00:00:00 2001 From: Michael Davenport Date: Wed, 29 Jan 2020 12:32:04 +0000 Subject: [PATCH 4/4] Remove nightly as won't compile in travis due to phpunit version mismatch --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f5357a7..eb2ecf3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ php: - 5.6 - 7.0 - 7.1 - - nightly env: - VERSION=3.0.1