mirror of
https://github.com/graphql-hive/console
synced 2026-05-06 06:58:19 +00:00
4.4 KiB
4.4 KiB
Testing
Unit tests
We are using Jest. Simply run pnpm test to run all the tests.
Integration Tests
We are using Dockest to test the following concerns:
- Main application flows and integration of different services
- Containerize execution of all services
- Cross-service network calls
Integration tests are based pre-built Docker images, so you can run it in 2 modes:
Running from source code
To run integration tests locally, from the local source code, follow:
- Make sure you have Docker installed. If you are having issues, try to run
docker system pruneto clean the Docker caches. - Install all deps:
pnpm i - Generate types:
pnpm graphql:generate - Build source code:
pnpm build - Set env vars:
export COMMIT_SHA="local"
export RELEASE="local"
export BRANCH_NAME="local"
export BUILD_TYPE=""
export DOCKER_TAG=":local"
- Compile a local Docker image by running:
docker buildx bake -f docker.hcl build --load - Pull the images:
docker-compose -f integration-tests/docker-compose.yml pull - Run the tests:
pnpm --filter integration-tests dockest
Running from pre-built Docker image
To run integration tests locally, from the pre-build Docker image, follow:
- Make sure you have Docker installed. If you are having issues, try to run
docker system pruneto clean the Docker caches. - Install all deps:
pnpm i - Generate types:
pnpm graphql:generate - Build source code:
pnpm build - Decide on the commit ID / Docker image tag you would like to use.
- Set the needed env vars:
export DOCKER_REGISTRY="ghcr.io/kamilkisiela/graphql-hive/"
export DOCKER_TAG=":IMAGE_TAG_HERE"
- Pull the images:
docker-compose -f integration-tests/docker-compose.yml pull - Run the tests:
pnpm --filter integration-tests dockest
e2e Tests
e2e Tests are based on Cypress, and matches files that ends with .cy.ts. The tests flow runs from
a pre-build Docker image.
Running from source code
To run e2e tests locally, from the local source code, follow:
- Make sure you have Docker installed. If you are having issues, try to run
docker system pruneto clean the Docker caches. - Install all deps:
pnpm i - Generate types:
pnpm graphql:generate - Build source code:
pnpm build - Set env vars:
export COMMIT_SHA="local"
export RELEASE="local"
export BRANCH_NAME="local"
export BUILD_TYPE=""
export DOCKER_TAG=":local"
export HIVE_ENCRYPTION_SECRET=wowverysecuremuchsecret
export HIVE_EMAIL_FROM=no-reply@graphql-hive.com
export HIVE_APP_BASE_URL=http://localhost:8080
export SUPERTOKENS_API_KEY=wowverysecuremuchsecret
export CLICKHOUSE_USER=clickhouse
export CLICKHOUSE_PASSWORD=wowverysecuremuchsecret
export REDIS_PASSWORD=wowverysecuremuchsecret
export POSTGRES_PASSWORD=postgres
export POSTGRES_USER=postgres
export POSTGRES_DB=registry
export MINIO_ROOT_USER=minioadmin
export MINIO_ROOT_PASSWORD=minioadmin
export CDN_AUTH_PRIVATE_KEY=6b4721a99bd2ef6c00ce4328f34d95d7
- Compile a local Docker image by running:
docker buildx bake -f docker.hcl build --load - Run the e2e environment, by running:
docker compose -f docker-compose.community.yml up -d --wait - Run Cypress:
pnpm test:e2e
Running from pre-built Docker image
To run integration tests locally, from the pre-build Docker image, follow:
- Make sure you have Docker installed. If you are having issues, try to run
docker system pruneto clean the Docker caches. - Install all deps:
pnpm i - Generate types:
pnpm graphql:generate - Build source code:
pnpm build - Decide on the commit ID / Docker image tag you would like to use.
- Set the needed env vars:
export DOCKER_REGISTRY="ghcr.io/kamilkisiela/graphql-hive/"
export DOCKER_TAG=":IMAGE_TAG_HERE"
export HIVE_ENCRYPTION_SECRET=wowverysecuremuchsecret
export HIVE_EMAIL_FROM=no-reply@graphql-hive.com
export HIVE_APP_BASE_URL=http://localhost:8080
export SUPERTOKENS_API_KEY=wowverysecuremuchsecret
export CLICKHOUSE_USER=clickhouse
export CLICKHOUSE_PASSWORD=wowverysecuremuchsecret
export REDIS_PASSWORD=wowverysecuremuchsecret
export POSTGRES_PASSWORD=postgres
export POSTGRES_USER=postgres
export POSTGRES_DB=registry
export MINIO_ROOT_USER=minioadmin
export MINIO_ROOT_PASSWORD=minioadmin
export CDN_AUTH_PRIVATE_KEY=6b4721a99bd2ef6c00ce4328f34d95d7
- Run the e2e environment, by running:
docker compose -f docker-compose.community.yml up -d --wait - Run Cypress:
pnpm test:e2e