From fa568d30d9022e8c39858bc4d293ce3efa05c009 Mon Sep 17 00:00:00 2001 From: slominskir Date: Wed, 2 Aug 2023 15:28:22 -0400 Subject: [PATCH] Run integration test outside Docker network --- .github/workflows/ci.yml | 16 ++++++++++------ build.gradle | 4 ++-- docker-compose.yml | 4 ++-- examples/connect-config/distributed/channels | 5 ++++- examples/softioc-db/softioc.db | 18 ++++++++++++++++++ scripts/docker-entrypoint.sh | 2 +- .../kafka/connect/SourceConnectorTest.java | 2 ++ 7 files changed, 39 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d7b3a27..8c1f834 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,18 +13,22 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + - uses: gradle/gradle-build-action@v2 + with: + gradle-version: wrapper - name: Start containers - run: docker compose -f "test.yml" up -d + run: docker compose -f "build.yml" up -d - name: Wait for containers to settle run: docker exec -i connect bash -c "sleep 20" - name: Run integration test - run: docker exec -i tester sh -c "cd /app; gradle integrationTest" + run: ./gradlew integrationTest - name: Dump connect logs if: always() run: docker logs connect - - name: Dump tester logs - if: always() - run: docker logs tester - name: Stop containers if: always() - run: docker compose -f "test.yml" down + run: docker compose -f "build.yml" down diff --git a/build.gradle b/build.gradle index a6ae3bc..0577314 100644 --- a/build.gradle +++ b/build.gradle @@ -50,8 +50,8 @@ task integrationTest(type: Test) { testClassesDirs = sourceSets.integration.output.classesDirs classpath = sourceSets.integration.runtimeClasspath - //environment 'BOOTSTRAP_SERVERS', 'localhost:9094' - //environment 'EPICS_CA_ADDR_LIST', 'localhost' + environment 'BOOTSTRAP_SERVERS', 'localhost:9094' + environment 'EPICS_CA_ADDR_LIST', 'localhost' testLogging { events "passed", "skipped", "failed" diff --git a/docker-compose.yml b/docker-compose.yml index d5523a1..2290499 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,8 +22,8 @@ services: OFFSET_STORAGE_TOPIC: connect-offsets STATUS_STORAGE_TOPIC: connect-status CONNECT_MAX_REQUEST_SIZE: 5242880 - #MONITOR_CHANNELS: "/config/channels" - MONITOR_CHANNELS: "channel1|topic1|v|key1,channel2|topic2|v|key2,channel3|topic3|v|key3" + MONITOR_CHANNELS: "/config/channels" + #MONITOR_CHANNELS: "channel1|topic1|v|key1,channel2|topic2|v|key2,channel3|topic3|v|key3,channela|channela|a|ca,channelb|channelb|v|cb,channelac|channelc|va|cc" #CREATE_TOPICS: "topic1:1:1:compact,topic2:1:1:compact,topic3:1:1:compact" volumes: - ./examples/connect-config/distributed:/config diff --git a/examples/connect-config/distributed/channels b/examples/connect-config/distributed/channels index 9d7da1f..4198e94 100644 --- a/examples/connect-config/distributed/channels +++ b/examples/connect-config/distributed/channels @@ -3,4 +3,7 @@ {"topic":"channels","channel":"channel3"}={"mask":"a", "outkey": "c3"} {"topic":"channels","channel":"channel4"}={"mask":"a", "outkey": "c4"} {"topic":"channels","channel":"channel5"}={"mask":"a", "outkey": "c5"} -{"topic":"channels","channel":"channel6"}={"mask":"a", "outkey": "c6"} \ No newline at end of file +{"topic":"channels","channel":"channel6"}={"mask":"a", "outkey": "c6"} +{"topic":"channela","channel":"channela"}={"mask":"a", "outkey": "ca"} +{"topic":"channelb","channel":"channelb"}={"mask":"v", "outkey": "cb"} +{"topic":"channelc","channel":"channelc"}={"mask":"va", "outkey": "cc"} \ No newline at end of file diff --git a/examples/softioc-db/softioc.db b/examples/softioc-db/softioc.db index ce7ce2e..1578465 100644 --- a/examples/softioc-db/softioc.db +++ b/examples/softioc-db/softioc.db @@ -27,4 +27,22 @@ record(ao,"channel6") { field(DTYP,"Soft Channel") field(HHSV,MAJOR) field(HIHI,1) +} +record(ao,"channela") { + field(DTYP,"Soft Channel") + field(HHSV,MAJOR) + field(HIHI,1) +} +record(calc,"counter_channelb") { + field(SCAN, ".2 second") + field(CALC, "(A+1)%17") + field(INPA, "counter_channelb.VAL") + field(FLNK, "channelb.PROC") + field(VAL, "0") +} +record(calc,"channelb") { + field(SCAN, "Passive") + field(CALC, "(A<=8)*(2**A)+(A>8)*(2**(17-A))") + field(INPA, "counter_channelb.VAL") + field(VAL, "0") } \ No newline at end of file diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh index f02ce78..9d31102 100755 --- a/scripts/docker-entrypoint.sh +++ b/scripts/docker-entrypoint.sh @@ -47,7 +47,7 @@ if [[ -z "${MONITOR_CHANNELS}" ]]; then echo "No channels specified to be monitored" elif [[ -f "$MONITOR_CHANNELS" ]]; then echo "Attempting to setup channel monitors from file $MONITOR_CHANNELS" - /kafka/bin/kafka-console-producer.sh --bootstrap-server $BOOTSTRAP_SERVER --topic epics-channels --property "parse.key=true" --property "key.separator==" --property "linger.ms=100" --property "compression.type=snappy" < $MONITOR_CHANNELS + $KAFKA_HOME/bin/kafka-console-producer.sh --bootstrap-server $BOOTSTRAP_SERVER --topic epics-channels --property "parse.key=true" --property "key.separator==" --property "linger.ms=100" --property "compression.type=snappy" < $MONITOR_CHANNELS else echo "Attempting to setup channel monitors from CSV string" IFS=',' diff --git a/src/integration/java/org/jlab/kafka/connect/SourceConnectorTest.java b/src/integration/java/org/jlab/kafka/connect/SourceConnectorTest.java index 1d6afe0..f93b1e7 100644 --- a/src/integration/java/org/jlab/kafka/connect/SourceConnectorTest.java +++ b/src/integration/java/org/jlab/kafka/connect/SourceConnectorTest.java @@ -32,6 +32,8 @@ public void testCAPut() { @Test public void testBasicMonitor() throws InterruptedException, IOException, CAException, TimeoutException { + System.err.println("Using EPICS_CA_ADDR_LIST: " + System.getenv("EPICS_CA_ADDR_LIST")); + TestConsumer consumer = new TestConsumer(Arrays.asList("channela"), "basic-monitor-consumer"); CAWriter writer = new CAWriter("channela", null);