Skip to content

Commit

Permalink
Add integration test for importer
Browse files Browse the repository at this point in the history
  • Loading branch information
mullr committed May 28, 2024
1 parent 481099e commit b4e0401
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 10 deletions.
6 changes: 6 additions & 0 deletions Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM rust:slim-bullseye
RUN apt-get update && apt-get install pkg-config libssl-dev -y
COPY Cargo.toml Cargo.lock /plugin-src/
COPY src/ /plugin-src/src
WORKDIR /plugin-src
RUN cargo build --release
1 change: 0 additions & 1 deletion integration-test/dlt-example-user.speqtr
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
behavior "connect messages"
nominal case "connect messages are observed"
log@ECU1(_.payload = "Daemon launched.*") ->
log@ECU1(_.payload = "New client connection * established*")
end
end
Expand Down
32 changes: 25 additions & 7 deletions integration-test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,7 @@ services:
build:
context: ..
dockerfile_inline: |
FROM rust:slim-bullseye
RUN apt-get update && apt-get install pkg-config libssl-dev -y
COPY Cargo.toml Cargo.lock /plugin-src/
COPY src/ /plugin-src/src
WORKDIR /plugin-src
RUN ls && cargo build --release
FROM modality-dlt-build:latest
FROM ghcr.io/auxoncorp/modality-reflector:latest
COPY --from=0 /plugin-src/target/release/modality-dlt-importer /modality-reflector-plugins/importers/
COPY --from=0 /plugin-src/target/release/modality-dlt-collector /modality-reflector-plugins/collectors/
Expand All @@ -70,6 +64,8 @@ services:
start_interval: 1s

test-collector:
profiles:
- test-collector
build:
dockerfile_inline: |
FROM ghcr.io/auxoncorp/modality-reflector:latest
Expand All @@ -84,3 +80,25 @@ services:
- dlt_tmp:/tmp
environment: { MODALITY_URL: http://modalityd:14181/v1 }
restart: no

test-import:
profiles:
- test-import
build:
dockerfile_inline: |
FROM modality-dlt-build:latest
FROM ghcr.io/auxoncorp/modality-reflector:latest
COPY --from=0 /plugin-src/target/release/modality-dlt-importer /modality-reflector-plugins/importers/
COPY --from=0 /plugin-src/target/release/modality-dlt-collector /modality-reflector-plugins/collectors/
COPY *.sh /
COPY *.speqtr /
COPY test-data/* /
ENTRYPOINT []
CMD /test-import.sh
volumes:
- modality_client_config:/root/.config/modality_cli
- dlt_tmp:/tmp
environment:
MODALITY_URL: http://modalityd:14181/v1
INGEST_PROTOCOL_PARENT_URL: modality-ingest://modalityd
restart: no
12 changes: 10 additions & 2 deletions integration-test/go.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
#!/usr/bin/env bash
set -ex

(
cd ..
docker build -f Dockerfile.build -t modality-dlt-build .
)

if [ -f ~/.config/modality/license ]; then
key=$(< ~/.config/modality/license)
echo "MODALITY_LICENSE_KEY=${key}" > .env
fi

docker compose build
docker compose up --abort-on-container-exit test-collector
docker compose --profile test-collector build
docker compose --profile test-import build

docker compose --profile test-collector up --abort-on-container-exit test-collector
docker compose --profile test-import up --abort-on-container-exit test-import
8 changes: 8 additions & 0 deletions integration-test/imported.speqtr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
behavior "injected log messages"
nominal case "injected log messages are observed"
log@ECU1(_.payload.0 = 1 and _.payload.1 = "fooo") ->
log@ECU1(_.payload.0 = 2 and _.payload.1 = "fooo") ->
log@ECU1(_.payload.0 = 3 and _.payload.1 = "fooo") ->
log@ECU1(_.payload.0 = 4 and _.payload.1 = "fooo")
end
end
Binary file added integration-test/test-data/foo.dlt
Binary file not shown.
7 changes: 7 additions & 0 deletions integration-test/test-import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -ex

/modality-reflector import --ingest-protocol-parent-url ${INGEST_PROTOCOL_PARENT_URL} dlt /foo.dlt

/modality workspace sync-indices
/conform spec eval --file /imported.speqtr --dry-run

0 comments on commit b4e0401

Please sign in to comment.