Skip to content

Commit 2173850

Browse files
Add Docker environment for integration tests (#34) (#81)
* Add docker files * Add docker env for integ tests
1 parent 65c601d commit 2173850

File tree

4 files changed

+56
-7
lines changed

4 files changed

+56
-7
lines changed

package-lock.json

Lines changed: 1 addition & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schemaregistry/Makefile.schemaregistry

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ NODE ?= node
55
ESLINT ?= ../node_modules/.bin/eslint
66
JEST ?= ../node_modules/.bin/jest
77
TS_NODE ?= ../node_modules/.bin/ts-node
8+
DOCKER ?= ./run_docker_schemaregistry.sh
89

910
# Paths
1011
SRC_DIR = .
@@ -24,4 +25,4 @@ test:
2425
$(JEST) $(SR_TEST_DIR) $(DEK_TEST_DIR)
2526

2627
integtest:
27-
$(JEST) $(INTEG_DIR)
28+
$(DOCKER)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: '3'
2+
services:
3+
zookeeper:
4+
image: confluentinc/cp-zookeeper
5+
environment:
6+
ZOOKEEPER_CLIENT_PORT: 2181
7+
kafka:
8+
image: confluentinc/cp-kafka
9+
restart: always
10+
depends_on:
11+
- zookeeper
12+
ports:
13+
- 9092:9092
14+
environment:
15+
KAFKA_BROKER_ID: 0
16+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT_INTERNAL:PLAINTEXT,PLAINTEXT_EXTERNAL:PLAINTEXT
17+
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT_INTERNAL://kafka:9093,PLAINTEXT_EXTERNAL://localhost:9092
18+
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT_INTERNAL
19+
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
20+
KAFKA_ZOOKEEPER_CONNECTION_TIMEOUT_MS: 18000
21+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
22+
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
23+
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
24+
schema-registry:
25+
image: confluentinc/cp-schema-registry:7.6.0
26+
depends_on:
27+
- kafka
28+
ports:
29+
- "8081:8081"
30+
environment:
31+
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: PLAINTEXT://kafka:9093
32+
SCHEMA_REGISTRY_HOST_NAME: schema-registry
33+
SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
COMPOSE_VERSION=$(docker-compose --version)
4+
DOCKER_VERSION=$(docker --version)
5+
JEST=${JEST:-../node_modules/.bin/jest}
6+
INTEG_DIR=../e2e/schemaregistry
7+
8+
# Start the docker compose file
9+
echo "Running docker compose up. Docker version $DOCKER_VERSION. Compose version $COMPOSE_VERSION. "
10+
11+
docker-compose -f docker-compose.schemaregistry.yml up -d
12+
13+
if [ "$?" == "1" ]; then
14+
echo "Failed to start docker images."
15+
exit 1
16+
fi
17+
18+
echo "Running schema registry e2e tests"
19+
20+
$JEST $INTEG_DIR

0 commit comments

Comments
 (0)