Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
gklijs committed Feb 21, 2021
1 parent e79d595 commit dfa5dd1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions check_test_app_done.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
6 changes: 3 additions & 3 deletions prepare_integration_test.sh
Original file line number Diff line number Diff line change
@@ -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
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

0 comments on commit dfa5dd1

Please sign in to comment.