[tooling] start databases in parallel in makefiles

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6713
GitOrigin-RevId: bd1eb1e6f4cfff1e19f8284d74997208ceae5f98
This commit is contained in:
Daniel Harvey 2022-11-03 17:16:29 +00:00 committed by hasura-bot
parent 1fa7f9b881
commit 1f4a54347c
3 changed files with 28 additions and 61 deletions

View File

@ -65,38 +65,45 @@ ghcid-test-harness:
.PHONY: ghcid-test-backends
## ghcid-test-backends: run all api tests in ghcid
ghcid-test-backends: remove-tix-file
ghcid-test-backends: start-sqlserver remove-tix-file
docker compose up -d --wait postgres citus cockroach mariadb dc-reference-agent dc-sqlite-agent
$(call run_ghcid_api_tests,api-tests)
.PHONY: ghcid-test-bigquery
## ghcid-test-bigquery: run tests for BigQuery backend in ghcid
# will require some setup detailed here: https://github.com/hasura/graphql-engine-mono/tree/main/server/lib/api-tests#required-setup-for-bigquery-tests
ghcid-test-bigquery: start-postgres remove-tix-file
ghcid-test-bigquery: remove-tix-file
docker compose up -d --wait postgres
$(call run_ghcid_api_tests,api-tests,BigQuery)
.PHONY: ghcid-test-sqlserver
## ghcid-test-sqlserver: run tests for SQL Server backend in ghcid
ghcid-test-sqlserver: start-postgres start-sqlserver remove-tix-file
ghcid-test-sqlserver: start-sqlserver remove-tix-file
docker compose up -d --wait postgres
$(call run_ghcid_api_tests,api-tests,SQLServer)
.PHONY: ghcid-test-mysql
## ghcid-test-mysql: run tests for MySQL backend in ghcid
ghcid-test-mysql: start-postgres start-mysql remove-tix-file
ghcid-test-mysql: remove-tix-file
docker compose up -d --wait postgres mariadb
$(call run_ghcid_api_tests,api-tests,MySQL)
.PHONY: ghcid-test-citus
## ghcid-test-citus: run tests for Citus backend in ghcid
ghcid-test-citus: start-postgres start-citus remove-tix-file
ghcid-test-citus: remove-tix-file
docker compose -d --wait postgres citus
$(call run_ghcid_api_tests,api-tests,Citus)
.PHONY: ghcid-test-cockroach
## ghcid-test-cockroach: run tests for Cockroach backend in ghcid
ghcid-test-cockroach: start-postgres start-cockroach remove-tix-file
ghcid-test-cockroach: remove-tix-file
docker compose up -d --wait postgres cockroach
$(call run_ghcid_api_tests,api-tests,Cockroach)
.PHONY: ghcid-test-data-connectors
## ghcid-test-data-connectors: run tests for DataConnectors in ghcid
ghcid-test-data-connectors: start-postgres start-dc-reference-agent remove-tix-file
ghcid-test-data-connectors: remove-tix-file
docker compose up -d --wait postgres dc-reference-agent dc-sqlite-agent
$(call run_ghcid_api_tests,api-tests,DataConnector)
.PHONY: ghcid-library-pro

View File

@ -1,25 +1,9 @@
# the following variables are set up in Docker Compose
# and are also defined in Harness.Constants for use in api tests
PG_PORT = 65002
PG_DBNAME = hasura
PG_DBUSER = hasura
PG_DBPASSWORD = hasura
MYSQL_PORT = 65001
MYSQL_DBNAME = hasura
MYSQL_DBUSER = hasura
MYSQL_DBPASSWORD = hasura
MSSQL_PORT = 65003
MSSQL_DBNAME = hasura
MSSQL_DBUSER = hasura
MSSQL_DBPASSWORD = Hasura1!
CITUS_PORT = 65004
DC_REFERENCE_PORT = 65005
DC_REFERENCE_AGENT_URL = localhost:$(DC_REFERENCE_PORT)/health
DC_SQLITE_PORT = 65007
DC_SQLITE_AGENT_URL = localhost:$(DC_SQLITE_PORT)/health
COCKROACH_PORT = 65008
COCKROACH_DBNAME = hasura
COCKROACH_DBUSER = root
# Use the Azure SQL Edge image instead of the SQL Server image on arm64.
# The latter doesn't work yet.
@ -46,46 +30,16 @@ else \
fi
endef
.PHONY: start-cockroach
## start-cockroach: start local PostgreSQL DB in Docker and wait for it to be ready
start-cockroach:
docker compose up -d --wait cockroach
.PHONY: start-postgres
## start-postgres: start local PostgreSQL DB in Docker and wait for it to be ready
start-postgres:
docker compose up -d --wait postgres
.PHONY: start-citus
## start-citus: start local Citus DB in Docker and wait for it to be ready
start-citus:
docker compose up -d --wait citus
.PHONY: start-sqlserver
## start-sqlserver: start local MS SQL Server DB in Docker and wait for it to be ready
start-sqlserver:
docker compose up -d --wait sqlserver
docker compose run sqlserver-init
.PHONY: start-mysql
## start-mysql: start local MariaDB in Docker and wait for it to be ready
start-mysql:
docker compose up -d --wait mariadb
.PHONY: start-dc-reference-agent
## start-dc-reference-agent: start the Data Connectors reference agent in Docker and wait for it to be ready
start-dc-reference-agent:
docker compose up -d --wait --build dc-reference-agent
.PHONY: start-dc-sqlite-agent
## start-dc-sqlite-agent: start the Data Connectors SQLite agent in Docker and wait for it to be ready
start-dc-sqlite-agent:
docker compose up -d --wait --build dc-sqlite-agent
.PHONY: start-backends
## start-backends: start all known backends in Docker and wait for them to be ready
start-backends: \
start-postgres start-sqlserver start-mysql start-citus start-dc-reference-agent start-dc-sqlite-agent start-cockroach
start-backends: start-sqlserver
docker compose up -d --wait postgres mariadb citus dc-reference-agent dc-sqlite-agent cockroach
.PHONY: stop-everything
## stop-everything: tear down test databases

View File

@ -1,37 +1,43 @@
.PHONY: test-bigquery
## test-bigquery: run tests for BigQuery backend
# will require some setup detailed here: https://github.com/hasura/graphql-engine-mono/tree/main/server/lib/api-tests#required-setup-for-bigquery-tests
test-bigquery: start-postgres remove-tix-file
test-bigquery: remove-tix-file
docker compose up -d --wait postgres
$(call stop_after, \
cabal run api-tests -- -m 'BigQuery')
.PHONY: test-sqlserver
## test-sqlserver: run tests for SQL Server backend
test-sqlserver: start-postgres start-sqlserver remove-tix-file
test-sqlserver: start-sqlserver remove-tix-file
docker compose up -d --wait postgres
$(call stop_after, \
cabal run api-tests -- -m 'SQLServer')
.PHONY: test-mysql
## test-mysql: run tests for MySQL backend
test-mysql: start-postgres start-mysql remove-tix-file
test-mysql: remove-tix-file
docker compose up -d --wait postgres mariadb
$(call stop_after, \
cabal run api-tests -- -m 'MySQL')
.PHONY: test-citus
## test-citus: run tests for Citus backend
test-citus: start-postgres start-citus remove-tix-file
test-citus: remove-tix-file
docker compose -d --wait postgres citus
$(call stop_after, \
cabal run api-tests -- -m 'Citus')
.PHONY: test-data-connectors
## test-data-connectors: run tests for Data Connectors
test-data-connectors: start-postgres start-dc-reference-agent start-dc-sqlite-agent remove-tix-file
test-data-connectors: remove-tix-file
docker compose up -d --wait postgres dc-reference-agent dc-sqlite-agent
$(call stop_after, \
cabal run api-tests -- -m 'DataConnector')
.PHONY: test-cockroach
## test-cockroach: run tests for Cockroach backend
test-cockroach: start-postgres start-cockroach remove-tix-file
test-cockroach: remove-tix-file
docker compose up -d --wait postgres cockroach
$(call stop_after, \
cabal run api-tests -- -m 'Cockroach')