Skip to content

Commit

Permalink
Run integration test outside Docker network
Browse files Browse the repository at this point in the history
  • Loading branch information
slominskir committed Aug 2, 2023
1 parent b86f464 commit fa568d3
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 12 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 4 additions & 1 deletion examples/connect-config/distributed/channels
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
{"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"}
18 changes: 18 additions & 0 deletions examples/softioc-db/softioc.db
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
2 changes: 1 addition & 1 deletion scripts/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=','
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fa568d3

Please sign in to comment.