Skip to content

Commit

Permalink
[RELEASE] Replace flix-tech with wikimedia avro fork for 1.2 (#24)
Browse files Browse the repository at this point in the history
[RELEASE] Replace flix-tech with wikimedia avro fork for 1.2
  • Loading branch information
tPl0ch authored Nov 7, 2018
1 parent 7b84345 commit db93dba
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .env.dist
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SCHEMA_REGISTRY_HOST="http://172.68.0.103:8081"
SCHEMA_REGISTRY_HOST="http://192.168.104.103:8081"
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,25 @@ env:
matrix:
- DEPENDENCIES="low"
- DEPENDENCIES="stable"
- DEPENDENCIES="stable" INTEGRATION_TEST="enabled" CONFLUENT_VERSION="3.2.4"
- DEPENDENCIES="stable" INTEGRATION_TEST="enabled" CONFLUENT_VERSION="3.3.2"
- DEPENDENCIES="stable" INTEGRATION_TEST="enabled" CONFLUENT_VERSION="4.0.2"
- DEPENDENCIES="stable" INTEGRATION_TEST="enabled" CONFLUENT_VERSION="4.1.2"
- DEPENDENCIES="stable" INTEGRATION_TEST="enabled" CONFLUENT_VERSION="5.0.1"

before_script:
- make install-phars
- if [ "$INTEGRATION_TEST" == "enabled" ]; then sudo rm /usr/local/bin/docker-compose; fi;
- if [ "$INTEGRATION_TEST" == "enabled" ]; then sudo rm -f /usr/local/bin/docker-compose; fi;
- if [ "$INTEGRATION_TEST" == "enabled" ]; then curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose; fi;
- if [ "$INTEGRATION_TEST" == "enabled" ]; then chmod +x docker-compose; fi;
- if [ "$INTEGRATION_TEST" == "enabled" ]; then sudo mv docker-compose /usr/local/bin; fi;
- if [ "$INTEGRATION_TEST" == "enabled" ]; then make platform; fi;
- composer self-update
- if [ "$DEPENDENCIES" == "stable" ]; then composer update --prefer-stable; fi;
- if [ "$DEPENDENCIES" == "low" ]; then composer update --prefer-lowest --prefer-stable; fi;

script:
- COMPOSER=composer PHP=php make ci-local
- if [ "$INTEGRATION_TEST" == "enabled" ]; then COMPOSER=composer PHP=php make phpunit-integration ; else COMPOSER=composer PHP=php make ci-local; fi;

jobs:
include:
Expand Down
56 changes: 16 additions & 40 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,15 @@ MAKEFLAGS =+ -rR --warn-undefined-variables

.PHONY: composer-install composer-update phpstan cs-fixer examples docker run

ifndef CONFLUENT_VERSION
CONFLUENT_VERSION := latest
endif

ifndef CONFLUENT_NETWORK_SUBNET
CONFLUENT_NETWORK_SUBNET := 172.68.0.0/24
endif

ifndef SCHEMA_REGISTRY_IPV4
SCHEMA_REGISTRY_IPV4 := 172.68.0.103
endif

ifndef KAFKA_BROKER_IPV4
KAFKA_BROKER_IPV4 := 172.68.0.102
endif

ifndef ZOOKEEPER_IPV4
ZOOKEEPER_IPV4 := 172.68.0.101
endif

ifndef COMPOSER
COMPOSER := bin/composer.phar
endif

ifndef PHP
PHP := bin/php
endif

ifndef PHP_VERSION
PHP_VERSION := 7.1
endif

ifndef XDEBUG_VERSION
XDEBUG_VERSION := 2.6.1
endif

-include variables.mk
CONFLUENT_VERSION ?= latest
CONFLUENT_NETWORK_SUBNET ?= 192.168.104.0/24
SCHEMA_REGISTRY_IPV4 ?= 192.168.104.103
KAFKA_BROKER_IPV4 ?= 192.168.104.102
ZOOKEEPER_IPV4 ?= 192.168.104.101
COMPOSER ?= bin/composer.phar
PHP ?= bin/php
PHP_VERSION ?= 7.2
XDEBUG_VERSION ?= 2.6.1
export

docker:
Expand Down Expand Up @@ -68,11 +40,15 @@ cs-fixer-modify:
--path-mode=intersection --allow-risky=yes src test

phpunit:
PHP_VERSION=$(PHP_VERSION) $(PHP) vendor/bin/phpunit
PHP_VERSION=$(PHP_VERSION) $(PHP) vendor/bin/phpunit --exclude-group integration

phpunit-integration:
PHP_VERSION=$(PHP_VERSION) $(PHP) vendor/bin/phpunit --group integration

coverage:
mkdir -p build
PHP_VERSION=$(PHP_VERSION) $(PHP) vendor/bin/phpunit --coverage-clover=build/coverage.clover --coverage-text
PHP_VERSION=$(PHP_VERSION) $(PHP) vendor/bin/phpunit --exclude-group integration \
--coverage-clover=build/coverage.clover --coverage-text
PHP_VERSION=$(PHP_VERSION) $(PHP) bin/ocular.phar code-coverage:upload --format=php-clover \
--repository=g/flix-tech/avro-serde-php build/coverage.clover

Expand All @@ -93,7 +69,7 @@ install-phars:
platform:
docker-compose down
docker-compose up -d
sleep 15
sleep 20

clean:
rm -rf build
Expand Down
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"require": {
"php": "^7.1",
"beberlei/assert": "~2.7",
"flix-tech/avro-php": "^2.0",
"flix-tech/confluent-schema-registry-api": "^5.0",
"wikimedia/avro": "dev-master@dev",
"flix-tech/confluent-schema-registry-api": "^5.0.3",
"widmogrod/php-functional": "^4.2|^5.0"
},
"require-dev": {
Expand All @@ -50,6 +50,9 @@
"suggest": {
"symfony/serializer": "To integrate avro-serde-php into symfony ecosystem"
},
"replace": {
"flix-tech/avro-php": "*"
},
"autoload-dev": {
"psr-4": {
"FlixTech\\AvroSerializer\\Test\\": "test/",
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://172.68.0.102:9092'
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://${KAFKA_BROKER_IPV4}:9092'
networks:
avro-serializer-net:
ipv4_address: ${KAFKA_BROKER_IPV4}
Expand Down
68 changes: 68 additions & 0 deletions test/Objects/RecordSerializerIntegrationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php

declare(strict_types=1);

namespace FlixTech\AvroSerializer\Test\Objects;

use FlixTech\AvroSerializer\Objects\DefaultRecordSerializerFactory;
use FlixTech\AvroSerializer\Objects\RecordSerializer;
use FlixTech\AvroSerializer\Test\AbstractFunctionalTestCase;

/**
* @group integration
*/
class RecordSerializerIntegrationTest extends AbstractFunctionalTestCase
{
/**
* @test
*
* @throws \FlixTech\SchemaRegistryApi\Exception\SchemaRegistryException
*/
public function it_encodes_valid_records(): RecordSerializer
{
$serializer = DefaultRecordSerializerFactory::get(\getenv('SCHEMA_REGISTRY_HOST'));
$encoded = $serializer->encodeRecord('test-value', $this->avroSchema, self::TEST_RECORD);
$decoded = $serializer->decodeMessage($encoded);

$this->assertEquals(self::TEST_RECORD, $decoded);

return $serializer;
}

/**
* @test
*
* @depends it_encodes_valid_records
*
* @expectedException \FlixTech\SchemaRegistryApi\Exception\IncompatibleAvroSchemaException
*
* @param \FlixTech\AvroSerializer\Objects\RecordSerializer $serializer
*
* @throws \FlixTech\SchemaRegistryApi\Exception\SchemaRegistryException
*/
public function it_cannot_evolve_incompatible_schema(RecordSerializer $serializer): void
{
$serializer->encodeRecord('test-value', $this->invalidSchema, self::TEST_RECORD);
}

/**
* @test
*
* @depends it_encodes_valid_records
*
* @param \FlixTech\AvroSerializer\Objects\RecordSerializer $serializer
*
* @return \FlixTech\AvroSerializer\Objects\RecordSerializer
*
* @throws \FlixTech\SchemaRegistryApi\Exception\SchemaRegistryException
*/
public function it_decodes_with_readers_schema(RecordSerializer $serializer): RecordSerializer
{
$encoded = $serializer->encodeRecord('test-value', $this->avroSchema, self::TEST_RECORD);
$decoded = $serializer->decodeMessage($encoded, $this->readersSchema);

$this->assertEquals(self::READERS_TEST_RECORD, $decoded);

return $serializer;
}
}
2 changes: 2 additions & 0 deletions test/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

require __DIR__ . '/../vendor/autoload.php';

(new Dotenv\Dotenv(__DIR__ . '/..', '.env.dist'))->load();
7 changes: 0 additions & 7 deletions variables.mk.dist

This file was deleted.

0 comments on commit db93dba

Please sign in to comment.