From e8bfea2c70d63c675c435d8cf18a33b550a62a55 Mon Sep 17 00:00:00 2001 From: Jose Carvajal Hilario Date: Wed, 18 Dec 2024 10:26:20 +0100 Subject: [PATCH] DBZ-3226: Cover kinesis sink in CI --- .github/workflows/cross-maven.yml | 10 +++++++-- .../src/test/resources/kinesis/.env | 2 ++ .../resources/kinesis/application.properties | 14 +++++++++++++ .../test/resources/kinesis/docker-compose.yml | 21 +++++++++++++++++++ .../src/test/resources/kinesis/post-script.sh | 17 +++++++++++++++ 5 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 debezium-server-dist/src/test/resources/kinesis/.env create mode 100644 debezium-server-dist/src/test/resources/kinesis/application.properties create mode 100644 debezium-server-dist/src/test/resources/kinesis/docker-compose.yml create mode 100755 debezium-server-dist/src/test/resources/kinesis/post-script.sh diff --git a/.github/workflows/cross-maven.yml b/.github/workflows/cross-maven.yml index c6d29874..1fcca3ae 100644 --- a/.github/workflows/cross-maven.yml +++ b/.github/workflows/cross-maven.yml @@ -82,7 +82,7 @@ jobs: strategy: fail-fast: false matrix: - sink: [ redis ] + sink: [ redis, kinesis ] needs: build steps: - name: Set up JDK @@ -109,12 +109,18 @@ jobs: # Start Up dependant services docker compose -f $CONFIG_FOLDER/docker-compose.yml up -d + if [[ -f "$CONFIG_FOLDER/post-script.sh" ]]; then + $CONFIG_FOLDER/post-script.sh + fi # Copy configuration file cp $CONFIG_FOLDER/application.properties $DISTRIBUTION_FOLDER/config/application.properties # Run debezium server at background - docker run --name server-$SINK -d -v $DISTRIBUTION_FOLDER:/opt:z -p 8080:8080 --network debezium-backend -w /opt registry.access.redhat.com/ubi8/openjdk-21 ./run.sh + if [[ -f "$CONFIG_FOLDER/.env" ]]; then + ENV_ARGS="--env-file $CONFIG_FOLDER/.env" + fi + docker run --name server-$SINK -d -v $DISTRIBUTION_FOLDER:/opt:z -p 8080:8080 --network debezium-backend -w /opt $ENV_ARGS registry.access.redhat.com/ubi8/openjdk-21 ./run.sh # Verify timeout 60 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/q/health)" != "200" ]]; do sleep 5; done' || false diff --git a/debezium-server-dist/src/test/resources/kinesis/.env b/debezium-server-dist/src/test/resources/kinesis/.env new file mode 100644 index 00000000..97ff4c82 --- /dev/null +++ b/debezium-server-dist/src/test/resources/kinesis/.env @@ -0,0 +1,2 @@ +AWS_ACCESS_KEY_ID=test +AWS_SECRET_ACCESS_KEY=test \ No newline at end of file diff --git a/debezium-server-dist/src/test/resources/kinesis/application.properties b/debezium-server-dist/src/test/resources/kinesis/application.properties new file mode 100644 index 00000000..fe5af3e1 --- /dev/null +++ b/debezium-server-dist/src/test/resources/kinesis/application.properties @@ -0,0 +1,14 @@ +# Docker file used by GitHub actions to verify the debezium-server-dist works. +debezium.sink.type=kinesis +debezium.sink.kinesis.region=eu-central-1 +debezium.source.connector.class=io.debezium.connector.postgresql.PostgresConnector +debezium.source.offset.storage.file.filename=data/offsets.dat +debezium.source.offset.flush.interval.ms=0 +debezium.source.database.hostname=postgres +debezium.source.database.port=5432 +debezium.source.database.user=postgres +debezium.source.database.password=postgres +debezium.source.database.dbname=postgres +debezium.source.topic.prefix=tutorial +debezium.source.schema.include.list=inventory +quarkus.log.console.json=false diff --git a/debezium-server-dist/src/test/resources/kinesis/docker-compose.yml b/debezium-server-dist/src/test/resources/kinesis/docker-compose.yml new file mode 100644 index 00000000..74de89ee --- /dev/null +++ b/debezium-server-dist/src/test/resources/kinesis/docker-compose.yml @@ -0,0 +1,21 @@ +# Docker file used by GitHub actions to verify the debezium-server-dist works. +services: + postgres: + image: quay.io/debezium/example-postgres:3.0 + ports: + - "5432:5432" + environment: + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + networks: + - backend + localstack: + image: localstack/localstack:4.0 + ports: + - "4566:4566" # LocalStack Gateway + - "4510-4559:4510-4559" # external services port range + networks: + - backend +networks: + backend: + name: debezium-backend \ No newline at end of file diff --git a/debezium-server-dist/src/test/resources/kinesis/post-script.sh b/debezium-server-dist/src/test/resources/kinesis/post-script.sh new file mode 100755 index 00000000..ccdaccd0 --- /dev/null +++ b/debezium-server-dist/src/test/resources/kinesis/post-script.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +STREAMS=('tutorial.inventory.customers' + 'tutorial.inventory.products' + 'tutorial.inventory.geom' + 'tutorial.inventory.products_on_hand' + 'tutorial.inventory.orders') +REGION=eu-central-1 + +for stream in ${STREAMS[@]} +do + echo "Creating stream '$stream' in Kinesis" + docker exec kinesis-localstack-1 awslocal kinesis create-stream --stream-name $stream --region $REGION +done + +echo "List all the streams in Kinesis" +docker exec kinesis-localstack-1 awslocal kinesis list-streams --region $REGION \ No newline at end of file