diff --git a/.travis.yml b/.travis.yml index 6dc06ac..2196e86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,7 @@ script: - cargo install --debug cargo-make - cargo build --verbose - docker-compose up -d - - timeout 60 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8081/subjects)" != "200" ]]; do sleep 3; done' || false + - ./check_test_app_done.sh + - ./prepare_integration_test.sh - cargo test --verbose --all-features -- --test-threads=1 - cargo make --makefile make.toml ci-flow \ No newline at end of file diff --git a/README.md b/README.md index 33f89ee..4129f1d 100644 --- a/README.md +++ b/README.md @@ -190,7 +190,7 @@ Due to mockito, used for mocking the schema registry responses, being run in a s The integration tests require a Kafka cluster running on the default ports. It will create topics, register schema's, produce and consume some messages. They are only included when compiled with the `kafka_test` feature, so to include them in testing `cargo +stable test --all-features --color=always -- --nocapture --test-threads=1` needs to be run. -The easiest way to run them is with the confluent cli. The 'prepare_integration_test.sh' script can be used to create the 3 topics needed for the tests, but even without those the test pass. +The 'prepare_integration_test.sh' script can be used to create the 3 topics needed for the tests. To ensure Java compatibility it's also needed to run the [schema-registry-test-app](https://hub.docker.com/repository/docker/gklijs/schema-registry-test-app) docker image. # License diff --git a/check_test_app_done.sh b/check_test_app_done.sh new file mode 100755 index 0000000..f07f4d5 --- /dev/null +++ b/check_test_app_done.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do + failures=$(docker inspect -f '{{ .State.ExitCode }}' test-app) + if [[ "$failures" == "0" ]]; then + echo -e "Successful load java data in loop ${i}" + exit 0 + fi + sleep 3 +done +exit 1 \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 924bec1..c57bb12 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -51,6 +51,7 @@ services: it-test-java-app: image: gklijs/schema-registry-test-app:latest + container_name: test-app environment: SCHEMA_REGISTRY_URL: 'http://schema-registry:8081' BOOTSTRAP_SERVERS: 'broker:29092' diff --git a/prepare_integration_test.sh b/prepare_integration_test.sh index 66bcf65..428c6cb 100755 --- a/prepare_integration_test.sh +++ b/prepare_integration_test.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash -kafka-topics --create --topic topicnamestrategy --zookeeper localhost:2181 --partitions 1 --replication-factor 1 -kafka-topics --create --topic recordnamestrategy --zookeeper localhost:2181 --partitions 1 --replication-factor 1 -kafka-topics --create --topic topicrecordnamestrategy --zookeeper localhost:2181 --partitions 1 --replication-factor 1 \ No newline at end of file +docker exec broker kafka-topics --create --topic topicnamestrategy --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1 +docker exec broker kafka-topics --create --topic recordnamestrategy --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1 +docker exec broker kafka-topics --create --topic topicrecordnamestrategy --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1 \ No newline at end of file