graphql-engine/scripts/make/test-infrastructure.mk

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

44 lines
1.7 KiB
Makefile
Raw Normal View History

API_TESTS_DOCKER_COMPOSE = docker compose --project-directory=./server/lib/api-tests
API_TESTS_PRO_DOCKER_COMPOSE = docker compose --project-directory=./pro/server/lib/api-tests
PYTHON_TESTS_DOCKER_COMPOSE = docker compose --project-directory=./server/tests-py
# Use the Azure SQL Edge image instead of the SQL Server image on arm64.
# The latter doesn't work yet.
ifeq ($(shell uname -m),arm64)
MSSQL_IMAGE=mcr.microsoft.com/azure-sql-edge
else
MSSQL_IMAGE= # allow the Docker Compose file to set the image
endif
export MSSQL_IMAGE
server: Split the integration tests out into their own directories. We currently have a fairly intricate way of running our PostgreSQL and MSSQL integration tests (not the API tests). By splitting them out, we can simplify this a lot. Most prominently, we can rely on Cabal to be our argument parser instead of writing our own. We can also simplify how they're run in CI. They are currently (weirdly) run alongside the Python integration tests. This breaks them out into their own jobs for better visibility, and to avoid conflating the two. The changes are as follows: - The "unit" tests that rely on a running PostgreSQL database are extracted out to a new test directory so they can be run separately. - Most of the `Main` module comes with them. - We now refer to these as "integration" tests instead. - Likewise for the "unit" tests that rely on a running MS SQL Server database. These are a little simpler and we can use `hspec-discover`, with a `SpecHook` to extract the connection string from an environment variable. - Henceforth, these are the MS SQL Server integration tests. - New CI jobs have been added for each of these. - There wasn't actually a job for the MS SQL Server integration tests. It's pretty amazing they still run well. - The "haskell-tests" CI job, which used to run the PostgreSQL integration tests, has been removed. - The makefiles and contributing guide have been updated to run these. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6912 GitOrigin-RevId: 67bbe2941bba31793f63d04a9a693779d4463ee1
2022-11-17 15:55:05 +03:00
TEST_MSSQL_CONNECTION_STRING = Driver={ODBC Driver 18 for SQL Server};Server=localhost,65003;Uid=sa;Pwd=Password!;Encrypt=optional
TEST_POSTGRES_URL = postgres://hasura:hasura@localhost:65002/hasura
.PHONY: start-api-tests-backends
## start-api-tests-backends: start all known backends in Docker and wait for them to be ready
start-api-tests-backends:
$(API_TESTS_DOCKER_COMPOSE) up --build --detach --wait
.PHONY: start-api-tests-pro-backends
## start-api-tests-pro-backends: start all known backends in Docker and wait for them to be ready
start-api-tests-pro-backends:
$(API_TESTS_PRO_DOCKER_COMPOSE) up --build --detach --wait
.PHONY: start-api-tests-pro-postgres
## start-api-tests-pro-backends: start the Postgres backend in Docker and wait for it to be ready
start-api-tests-pro-postgres:
$(API_TESTS_PRO_DOCKER_COMPOSE) up --build --detach --wait postgres
.PHONY: stop-everything
## stop-everything: tear down test databases
stop-everything:
docker compose down --volumes
$(API_TESTS_DOCKER_COMPOSE) down --volumes
$(API_TESTS_PRO_DOCKER_COMPOSE) down --volumes
$(PYTHON_TESTS_DOCKER_COMPOSE) down --volumes
.PHONY: remove-tix-file
remove-tix-file:
@ find . -name '*.tix' -delete