Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(cat-gateway): Add schema testing into Scylla integration test #1432

Draft
wants to merge 2 commits into
base: test/indexdb-queries
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 1 addition & 44 deletions catalyst-gateway/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -123,47 +123,4 @@ check-builder-src-cache:

RUN diff ../src_fingerprint.txt ../src_fingerprint_uncached.txt \
|| (echo "ERROR: Source fingerprints do not match. Caching Error Detected!!" && exit 1) \
&& echo "Source fingerprints match. Caching OK."

test-postgres:
FROM +builder-src

COPY docker-compose.yml .

ENV EVENT_DB_URL "postgres://catalyst-event-dev:CHANGE_ME@localhost/CatalystEventDev"

WITH DOCKER \
--compose "./docker-compose.yml" \
--load ./event-db+build \
--pull alpine:3.20.3 \
--service event-db-is-running
RUN --mount=$EARTHLY_RUST_CARGO_HOME_CACHE --mount=$EARTHLY_RUST_TARGET_CACHE \
cargo nextest run --release --run-ignored=only signed_docs
END

# test-scylla - Runs the integration test for scylla.
test-scylla:
FROM +builder-src

DO +INSTALL_SCYLLA --VERSION=6.2

RUN --mount=$EARTHLY_RUST_CARGO_HOME_CACHE --mount=$EARTHLY_RUST_TARGET_CACHE \
scylla --options-file /etc/scylla/scylla.yaml --smp=2 --memory=4G --overprovisioned --developer-mode=1 & \
cargo nextest run --release --run-ignored=only scylla_session

# INSTALL_SCYLLA - Installs scylla for bookworm-slim/debian
INSTALL_SCYLLA:
FUNCTION

ARG --required VERSION

RUN apt-get update && \
apt-get install -y --no-install-recommends \
wget gnupg ca-certificates && \
mkdir -p /etc/apt/keyrings && \
gpg --homedir /tmp --no-default-keyring --keyring /etc/apt/keyrings/scylladb.gpg \
--keyserver hkp://keyserver.ubuntu.com:80 --recv-keys a43e06657bac99e3 && \
wget -O /etc/apt/sources.list.d/scylla.list http://downloads.scylladb.com/deb/debian/scylla-$VERSION.list && \
apt-get update && \
apt-get install -y --no-install-recommends \
scylla
&& echo "Source fingerprints match. Caching OK."
1 change: 1 addition & 0 deletions catalyst-gateway/bin/src/db/index/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! Integration tests of the `IndexDB` queries

mod scylla_schema;
mod scylla_session;
1 change: 1 addition & 0 deletions catalyst-gateway/bin/src/db/index/tests/scylla_schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//! Integration tests of the `IndexDB` queries testing on its schema setup and integrity
8 changes: 0 additions & 8 deletions catalyst-gateway/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ services:
timeout: 5s
retries: 10

# it is a helper service to wait until the event-db will be ready
# mainly its a trick for Earthly how to wait until service will be fully functional
event-db-is-running:
image: alpine:3.20.3
depends_on:
event-db:
condition: service_healthy

cat-gateway:
image: cat-gateway:latest
environment:
Expand Down
43 changes: 43 additions & 0 deletions catalyst-gateway/tests/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,46 @@ test-lint-openapi:
COPY --dir ./openapi-v3.0-lints/* .
# Scan the doc directory where type of file is JSON.
DO spectral-ci+LINT --dir=./doc

test-postgres:
FROM +builder-src

COPY ./docker/docker-compose.postgres.yml docker-compose.yml

ENV EVENT_DB_URL "postgres://catalyst-event-dev:CHANGE_ME@localhost/CatalystEventDev"

WITH DOCKER \
--compose "./docker-compose.yml" \
--load ../event-db+build \
--pull alpine:3.20.3 \
--service event-db-is-running
RUN --mount=$EARTHLY_RUST_CARGO_HOME_CACHE --mount=$EARTHLY_RUST_TARGET_CACHE \
cargo nextest run --release --run-ignored=only signed_docs
END

# test-scylla - Runs the integration test for scylla.
test-scylla:
FROM +builder-src

DO +INSTALL_SCYLLA --VERSION=6.2

RUN --mount=$EARTHLY_RUST_CARGO_HOME_CACHE --mount=$EARTHLY_RUST_TARGET_CACHE \
scylla --options-file /etc/scylla/scylla.yaml --smp=2 --memory=4G --overprovisioned --developer-mode=1 & \
cargo nextest run --release --run-ignored=only scylla_session

# INSTALL_SCYLLA - Installs scylla for bookworm-slim/debian
INSTALL_SCYLLA:
FUNCTION

ARG --required VERSION

RUN apt-get update && \
apt-get install -y --no-install-recommends \
wget gnupg ca-certificates && \
mkdir -p /etc/apt/keyrings && \
gpg --homedir /tmp --no-default-keyring --keyring /etc/apt/keyrings/scylladb.gpg \
--keyserver hkp://keyserver.ubuntu.com:80 --recv-keys a43e06657bac99e3 && \
wget -O /etc/apt/sources.list.d/scylla.list http://downloads.scylladb.com/deb/debian/scylla-$VERSION.list && \
apt-get update && \
apt-get install -y --no-install-recommends \
scylla
30 changes: 30 additions & 0 deletions catalyst-gateway/tests/docker/docker-compose.postgres.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
services:
event-db:
image: event-db:latest
environment:
- DB_HOST=localhost
- DB_PORT=5432
- DB_NAME=CatalystEventDev
- DB_DESCRIPTION="Catalyst Event DB"
- DB_SUPERUSER=postgres
- DB_SUPERUSER_PASSWORD=postgres
- DB_USER=catalyst-event-dev
- DB_USER_PASSWORD=CHANGE_ME

- INIT_AND_DROP_DB=true
- WITH_MIGRATIONS=true
ports:
- 5432:5432
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${DB_SUPERUSER} -d $${DB_SUPERUSER_PASSWORD}"]
interval: 10s
timeout: 5s
retries: 10

# it is a helper service to wait until the event-db will be ready
# mainly its a trick for Earthly how to wait until service will be fully functional
event-db-is-running:
image: alpine:3.20.3
depends_on:
event-db:
condition: service_healthy
Loading