-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(cli-e2e): adding test with Kafka trigger on e2e (#3088)
* Adding test with Kafka trigger on e2e * Add close procedures to Kafka test
- Loading branch information
1 parent
847caca
commit 07289cd
Showing
5 changed files
with
253 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
160 changes: 160 additions & 0 deletions
160
testing/cli-e2etest/environment/jaeger/server-setup/docker-compose-pokeshop-with-stream.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
services: | ||
cache: | ||
healthcheck: | ||
test: | ||
- CMD | ||
- redis-cli | ||
- ping | ||
timeout: 3s | ||
interval: 1s | ||
retries: 60 | ||
image: redis:6 | ||
restart: unless-stopped | ||
|
||
demo-api: | ||
depends_on: | ||
cache: | ||
condition: service_healthy | ||
postgres: | ||
condition: service_healthy | ||
queue: | ||
condition: service_healthy | ||
environment: | ||
COLLECTOR_ENDPOINT: http://otel-collector:4317 | ||
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/postgres?schema=public | ||
NPM_RUN_COMMAND: api | ||
POKE_API_BASE_URL: https://pokeapi.co/api/v2 | ||
RABBITMQ_HOST: queue | ||
REDIS_URL: cache | ||
healthcheck: | ||
test: | ||
- CMD | ||
- wget | ||
- --spider | ||
- localhost:8081 | ||
timeout: 3s | ||
interval: 1s | ||
retries: 60 | ||
image: kubeshop/demo-pokemon-api:latest | ||
ports: | ||
- mode: ingress | ||
target: 8081 | ||
published: 8081 | ||
protocol: tcp | ||
pull_policy: always | ||
restart: unless-stopped | ||
|
||
demo-rpc: | ||
depends_on: | ||
cache: | ||
condition: service_healthy | ||
postgres: | ||
condition: service_healthy | ||
queue: | ||
condition: service_healthy | ||
environment: | ||
COLLECTOR_ENDPOINT: http://otel-collector:4317 | ||
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/postgres?schema=public | ||
NPM_RUN_COMMAND: rpc | ||
POKE_API_BASE_URL: https://pokeapi.co/api/v2 | ||
RABBITMQ_HOST: queue | ||
REDIS_URL: cache | ||
healthcheck: | ||
test: | ||
- CMD | ||
- lsof | ||
- -i | ||
- "8082" | ||
timeout: 3s | ||
interval: 1s | ||
retries: 60 | ||
image: kubeshop/demo-pokemon-api:latest | ||
ports: | ||
- mode: ingress | ||
target: 8082 | ||
published: 8082 | ||
protocol: tcp | ||
pull_policy: always | ||
restart: unless-stopped | ||
|
||
demo-worker: | ||
depends_on: | ||
cache: | ||
condition: service_healthy | ||
postgres: | ||
condition: service_healthy | ||
queue: | ||
condition: service_healthy | ||
environment: | ||
COLLECTOR_ENDPOINT: http://otel-collector:4317 | ||
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/postgres?schema=public | ||
NPM_RUN_COMMAND: worker | ||
POKE_API_BASE_URL: https://pokeapi.co/api/v2 | ||
RABBITMQ_HOST: queue | ||
REDIS_URL: cache | ||
image: kubeshop/demo-pokemon-api:latest | ||
pull_policy: always | ||
restart: unless-stopped | ||
|
||
demo-streaming-worker: | ||
image: kubeshop/demo-pokemon-api:latest | ||
environment: | ||
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/postgres?schema=public | ||
POKE_API_BASE_URL: https://pokeapi.co/api/v2 | ||
COLLECTOR_ENDPOINT: http://otel-collector:4317 | ||
ZIPKIN_URL: http://localhost:9411 | ||
NPM_RUN_COMMAND: stream-worker | ||
KAFKA_BROKER: 'stream:9092' | ||
KAFKA_TOPIC: 'pokemon' | ||
KAFKA_CLIENT_ID: 'streaming-worker' | ||
REDIS_URL: cache | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
stream: | ||
condition: service_healthy | ||
cache: | ||
condition: service_healthy | ||
otel-collector: | ||
condition: service_started | ||
|
||
queue: | ||
healthcheck: | ||
test: | ||
- CMD-SHELL | ||
- rabbitmq-diagnostics -q check_running | ||
timeout: 5s | ||
interval: 1s | ||
retries: 60 | ||
image: rabbitmq:3.8-management | ||
restart: unless-stopped | ||
|
||
stream: | ||
image: confluentinc/cp-kafka:latest-ubi8 | ||
environment: | ||
- KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://stream:9092 | ||
- KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092,CONTROLLER://0.0.0.0:9093 | ||
- [email protected]:9093 | ||
- KAFKA_CONTROLLER_LISTENER_NAMES=CONTROLLER | ||
- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT | ||
- KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS=0 | ||
- KAFKA_PROCESS_ROLES=controller,broker | ||
- KAFKA_NODE_ID=1 | ||
- KAFKA_METADATA_LOG_SEGMENT_MS=15000 | ||
- KAFKA_METADATA_MAX_RETENTION_MS=60000 | ||
- KAFKA_METADATA_LOG_MAX_RECORD_BYTES_BETWEEN_SNAPSHOTS=2800 | ||
- KAFKA_AUTO_CREATE_TOPICS_ENABLE=true | ||
- KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 | ||
- KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=1 | ||
- KAFKA_HEAP_OPTS=-Xmx200m -Xms200m | ||
- CLUSTER_ID=ckjPoprWQzOf0-FuNkGfFQ | ||
healthcheck: | ||
test: nc -z stream 9092 | ||
start_period: 10s | ||
interval: 5s | ||
timeout: 10s | ||
retries: 10 | ||
|
||
networks: | ||
default: | ||
name: _default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
testing/cli-e2etest/testscenarios/test/resources/kafka-trigger.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
type: Test | ||
spec: | ||
id: tf0tOTRSg | ||
name: Import a Pokemon reading a Stream | ||
description: Import a Pokemon via Stream | ||
trigger: | ||
type: kafka | ||
kafka: | ||
brokerUrls: | ||
- stream:9092 | ||
topic: pokemon | ||
headers: [] | ||
messageKey: snorlax-key | ||
messageValue: "{\"id\":143}" | ||
specs: | ||
- selector: span[tracetest.span.type="messaging" name="pokemon process" messaging.system="kafka" messaging.destination="pokemon" messaging.destination_kind="topic" messaging.operation="process"] | ||
name: A message was received from Kafka stream | ||
assertions: | ||
- attr:messaging.system = "kafka" | ||
- selector: span[tracetest.span.type="general" name="import pokemon"] | ||
name: Import Pokemon use case was triggered | ||
assertions: | ||
- attr:name = "import pokemon" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters