From 46bc173004eb6d2ed77abd98098cf90a1b99162d Mon Sep 17 00:00:00 2001 From: Ankit Kumar Date: Mon, 28 Apr 2025 11:40:35 +0530 Subject: [PATCH 1/2] fix `asyncapi.sse.kafka.proxy` example & enable `test` --- .github/workflows/build.yml | 1 - examples/asyncapi.sse.kafka.proxy/.github/test.sh | 11 +++-------- examples/asyncapi.sse.kafka.proxy/compose.yaml | 2 -- .../{ => etc/specs}/kafka-asyncapi.yaml | 2 +- .../{ => etc/specs}/sse-asyncapi.yaml | 5 ++++- 5 files changed, 8 insertions(+), 13 deletions(-) rename examples/asyncapi.sse.kafka.proxy/{ => etc/specs}/kafka-asyncapi.yaml (96%) rename examples/asyncapi.sse.kafka.proxy/{ => etc/specs}/sse-asyncapi.yaml (92%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8bbd536797..94f280b373 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -83,7 +83,6 @@ jobs: ^\.assets$ ^\.git$ ^\.vscode$ - ^\asyncapi.sse.kafka.proxy$ testing: strategy: diff --git a/examples/asyncapi.sse.kafka.proxy/.github/test.sh b/examples/asyncapi.sse.kafka.proxy/.github/test.sh index c5321c8239..67bd1274ca 100755 --- a/examples/asyncapi.sse.kafka.proxy/.github/test.sh +++ b/examples/asyncapi.sse.kafka.proxy/.github/test.sh @@ -7,7 +7,7 @@ EXIT=0 PORT="7114" KAFKA_BOOTSTRAP_SERVER="kafka.examples.dev:29092" INPUT='{"id": 1,"name":"Hello World!"}' -EXPECTED='data:{ "id": 1, "name": "Hello World!"}' +EXPECTED='data:{"id": 1,"name":"Hello World!"}' echo \# Testing asyncapi.sse.kafka.proxy/ echo PORT="$PORT" echo KAFKA_BOOTSTRAP_SERVER="$KAFKA_BOOTSTRAP_SERVER" @@ -21,7 +21,7 @@ timeout 3s curl -N --http2 -H "Accept:text/event-stream" "http://localhost:$PORT # push response to kafka with kafkacat echo "$INPUT" | - docker compose -p zilla-http-kafka-sync exec -T kafkacat \ + docker compose -p zilla-asyncapi-sse-kafka-proxy exec -T kafkacat \ kafkacat -P \ -b $KAFKA_BOOTSTRAP_SERVER \ -t events \ @@ -29,7 +29,7 @@ echo "$INPUT" | # fetch the output of zilla request; try 5 times for i in $(seq 0 2); do - sleep $i + sleep 5 OUTPUT=$(cat .testoutput | grep "^data:") if [ -n "$OUTPUT" ]; then break @@ -48,9 +48,4 @@ else EXIT=1 fi -# TODO remove once fixed -echo '❌ curl: (52) Empty reply from server. Tested on main. and does not work with described instructions' -echo 'Refer: https://github.com/aklivity/zilla/issues/1417' -EXIT=1 - exit $EXIT diff --git a/examples/asyncapi.sse.kafka.proxy/compose.yaml b/examples/asyncapi.sse.kafka.proxy/compose.yaml index ee3c370e35..89cd0a3294 100644 --- a/examples/asyncapi.sse.kafka.proxy/compose.yaml +++ b/examples/asyncapi.sse.kafka.proxy/compose.yaml @@ -16,8 +16,6 @@ services: ZILLA_INCUBATOR_ENABLED: "true" volumes: - ./etc:/etc/zilla - - ./sse-asyncapi.yaml:/etc/zilla/specs/sse-asyncapi.yaml - - ./kafka-asyncapi.yaml:/etc/zilla/specs/kafka-asyncapi.yaml command: start -v -e kafka: diff --git a/examples/asyncapi.sse.kafka.proxy/kafka-asyncapi.yaml b/examples/asyncapi.sse.kafka.proxy/etc/specs/kafka-asyncapi.yaml similarity index 96% rename from examples/asyncapi.sse.kafka.proxy/kafka-asyncapi.yaml rename to examples/asyncapi.sse.kafka.proxy/etc/specs/kafka-asyncapi.yaml index d5a677394b..4a33dec62b 100644 --- a/examples/asyncapi.sse.kafka.proxy/kafka-asyncapi.yaml +++ b/examples/asyncapi.sse.kafka.proxy/etc/specs/kafka-asyncapi.yaml @@ -24,7 +24,7 @@ operations: traits: - $ref: "#/components/operationTraits/kafka" messages: - - $ref: "#/channels/eventstore/messages/event" + - $ref: "#/channels/events/messages/event" components: messages: event: diff --git a/examples/asyncapi.sse.kafka.proxy/sse-asyncapi.yaml b/examples/asyncapi.sse.kafka.proxy/etc/specs/sse-asyncapi.yaml similarity index 92% rename from examples/asyncapi.sse.kafka.proxy/sse-asyncapi.yaml rename to examples/asyncapi.sse.kafka.proxy/etc/specs/sse-asyncapi.yaml index 589ad3620b..103acbdf7f 100644 --- a/examples/asyncapi.sse.kafka.proxy/sse-asyncapi.yaml +++ b/examples/asyncapi.sse.kafka.proxy/etc/specs/sse-asyncapi.yaml @@ -7,7 +7,7 @@ info: servers: plain_sse: host: localhost:7114 - protocol: sse + protocol: http defaultContentType: application/json channels: @@ -22,6 +22,9 @@ operations: action: receive channel: $ref: "#/channels/events" + bindings: + x-zilla-sse: + method: "GET" components: schemas: From e613345420d25a62a0fb8eccdd3d7e8c20665554 Mon Sep 17 00:00:00 2001 From: Ankit Kumar Date: Mon, 28 Apr 2025 12:11:46 +0530 Subject: [PATCH 2/2] fix `test` --- examples/asyncapi.sse.kafka.proxy/.github/test.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/asyncapi.sse.kafka.proxy/.github/test.sh b/examples/asyncapi.sse.kafka.proxy/.github/test.sh index 67bd1274ca..e5b793f07a 100755 --- a/examples/asyncapi.sse.kafka.proxy/.github/test.sh +++ b/examples/asyncapi.sse.kafka.proxy/.github/test.sh @@ -16,6 +16,9 @@ echo EXPECTED="$EXPECTED" echo # WHEN + +sleep 5 + # send request to zilla timeout 3s curl -N --http2 -H "Accept:text/event-stream" "http://localhost:$PORT/events" | tee .testoutput & @@ -28,7 +31,7 @@ echo "$INPUT" | -k "1" # fetch the output of zilla request; try 5 times -for i in $(seq 0 2); do +for i in $(seq 0 5); do sleep 5 OUTPUT=$(cat .testoutput | grep "^data:") if [ -n "$OUTPUT" ]; then