2023-01-03 17:03:35 +03:00
GRAPHQL_ENGINE_PATH = $( shell cabal list-bin exe:graphql-engine)
GRAPHQL_ENGINE_PRO_PATH = $( shell cabal list-bin exe:graphql-engine-pro)
2022-06-20 16:33:04 +03:00
.PHONY : test -bigquery
## test-bigquery: run tests for BigQuery backend
2022-10-04 11:30:09 +03:00
# will require some setup detailed here: https://github.com/hasura/graphql-engine-mono/tree/main/server/lib/api-tests#required-setup-for-bigquery-tests
2023-01-03 17:03:35 +03:00
test-bigquery : build remove -tix -file
2023-01-16 19:42:45 +03:00
$( API_TESTS_DOCKER_COMPOSE) up -d --wait postgres
2023-01-31 19:58:43 +03:00
HASURA_TEST_BACKEND_TYPE = BigQuery \
2023-01-03 17:03:35 +03:00
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PATH) \
2023-01-31 19:58:43 +03:00
cabal run api-tests:exe:api-tests
2022-06-20 16:33:04 +03:00
.PHONY : test -sqlserver
2022-11-17 15:55:05 +03:00
## test-sqlserver: run tests for MS SQL Server backend
2023-01-03 17:03:35 +03:00
test-sqlserver : build remove -tix -file
2023-01-16 19:42:45 +03:00
$( API_TESTS_DOCKER_COMPOSE) up -d --wait postgres sqlserver-healthcheck
2023-01-31 19:58:43 +03:00
HASURA_TEST_BACKEND_TYPE = SQLServer \
2023-01-03 17:03:35 +03:00
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PATH) \
2023-01-31 19:58:43 +03:00
cabal run api-tests:exe:api-tests
2022-06-20 16:33:04 +03:00
2022-08-03 14:05:59 +03:00
.PHONY : test -citus
## test-citus: run tests for Citus backend
2023-01-03 17:03:35 +03:00
test-citus : build remove -tix -file
2023-01-16 19:42:45 +03:00
$( API_TESTS_DOCKER_COMPOSE) up -d --wait postgres citus
2023-01-31 19:58:43 +03:00
HASURA_TEST_BACKEND_TYPE = Citus \
2023-01-03 17:03:35 +03:00
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PATH) \
2023-01-31 19:58:43 +03:00
cabal run api-tests:exe:api-tests
2022-08-03 14:05:59 +03:00
2022-08-25 15:08:07 +03:00
.PHONY : test -data -connectors
## test-data-connectors: run tests for Data Connectors
2023-01-03 17:03:35 +03:00
test-data-connectors : build remove -tix -file
2023-01-16 19:42:45 +03:00
$( API_TESTS_DOCKER_COMPOSE) build
$( API_TESTS_DOCKER_COMPOSE) up -d --wait postgres dc-reference-agent dc-sqlite-agent
2023-01-31 19:58:43 +03:00
HASURA_TEST_BACKEND_TYPE = DataConnector \
2023-01-03 17:03:35 +03:00
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PATH) \
2023-01-31 19:58:43 +03:00
cabal run api-tests:exe:api-tests
2022-08-25 15:08:07 +03:00
2022-08-25 20:17:28 +03:00
.PHONY : test -cockroach
## test-cockroach: run tests for Cockroach backend
2023-01-03 17:03:35 +03:00
test-cockroach : build remove -tix -file
2023-01-16 19:42:45 +03:00
$( API_TESTS_DOCKER_COMPOSE) up -d --wait postgres cockroach
2023-01-31 19:58:43 +03:00
HASURA_TEST_BACKEND_TYPE = Cockroach \
2023-01-03 17:03:35 +03:00
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PATH) \
2023-01-31 19:58:43 +03:00
cabal run api-tests:exe:api-tests
2022-08-25 20:17:28 +03:00
2022-11-01 18:17:45 +03:00
.PHONY : test -postgres
## test-postgres: run tests for Postgres backend
2022-11-18 01:34:02 +03:00
# we have a few tests labeled with 'Postgres' which test their variants, too,
# so this also starts containers for Postgres variants
2023-01-03 17:03:35 +03:00
test-postgres : build remove -tix -file
2023-01-16 19:42:45 +03:00
$( API_TESTS_DOCKER_COMPOSE) up -d --wait postgres cockroach citus dc-sqlite-agent
2023-01-31 19:58:43 +03:00
HASURA_TEST_BACKEND_TYPE = Postgres \
2023-01-03 17:03:35 +03:00
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PATH) \
2023-01-31 19:58:43 +03:00
cabal run api-tests:exe:api-tests
2022-11-25 18:07:57 +03:00
.PHONY : test -no -backends
## test-no-backends
# the leftover tests with no particular backend, like Remote Schemas
2023-01-03 17:03:35 +03:00
test-no-backends : build start -backends remove -tix -file
2023-01-31 19:58:43 +03:00
HASURA_TEST_BACKEND_TYPE = None \
2023-01-03 17:03:35 +03:00
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PATH) \
2023-01-31 19:58:43 +03:00
cabal run api-tests:exe:api-tests
2022-11-01 18:17:45 +03:00
2022-06-20 16:33:04 +03:00
.PHONY : test -backends
## test-backends: run tests for all backends
2022-10-04 11:30:09 +03:00
# BigQuery tests will require some setup detailed here: https://github.com/hasura/graphql-engine-mono/tree/main/server/lib/api-tests#required-setup-for-bigquery-tests
2023-01-03 17:03:35 +03:00
test-backends : build start -backends remove -tix -file
2023-01-31 19:58:43 +03:00
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PATH) \
cabal run api-tests:exe:api-tests
2022-12-12 20:44:47 +03:00
.PHONY : test -matrix
## test-matrix: postgres test matrix generator
2023-01-03 17:03:35 +03:00
test-matrix : build remove -tix -file
2023-01-16 19:42:45 +03:00
$( API_TESTS_DOCKER_COMPOSE) up -d --wait postgres cockroach citus dc-sqlite-agent
2023-01-31 19:58:43 +03:00
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PATH) \
cabal run api-tests:exe:produce-feature-matrix +RTS -N4 -RTS
2022-08-19 14:22:28 +03:00
2023-01-25 08:53:05 +03:00
.PHONY : test -data -connectors -pro
2023-02-16 09:29:19 +03:00
## test-data-connectors-pro: run tests for HGE pro for all backends
2023-01-25 08:53:05 +03:00
test-data-connectors-pro : build -pro remove -tix -file
docker compose up -d --wait postgres dc-sqlite-agent
2023-01-31 19:58:43 +03:00
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PRO_PATH) \
cabal run api-tests-pro:exe:api-tests-pro
2023-01-25 08:53:05 +03:00
.PHONY : test -data -connectors -snowflake -pro
## test-data-connectors-snowflake-pro: run tests for HGE pro for all backends
test-data-connectors-snowflake-pro : build -pro remove -tix -file
docker compose up -d --wait postgres dc-sqlite-agent
2023-01-31 19:58:43 +03:00
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PRO_PATH) \
cabal run api-tests-pro:exe:api-tests-pro -- --match "DataConnector \"snowflake\""
2023-01-25 08:53:05 +03:00
2023-02-16 09:29:19 +03:00
.PHONY : test -data -connectors -athena -pro
## test-data-connectors-athena-pro: run tests for HGE pro for all backends
test-data-connectors-athena-pro : build -pro remove -tix -file
docker compose up -d --wait postgres dc-sqlite-agent
$( call stop_after, \
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PRO_PATH) \
cabal run api-tests-pro:exe:api-tests-pro -- --match "DataConnector \"athena\"" )
.PHONY : test -data -connectors -mysql -pro
## test-data-connectors-mysql-pro: run tests for HGE pro for all backends
test-data-connectors-mysql-pro : build -pro remove -tix -file
cd pro/server/lib/api-tests && docker compose up -d --wait postgres dc-sqlite-agent --wait mysql
$( call stop_after, \
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PRO_PATH) \
cabal run api-tests-pro:exe:api-tests-pro -- --match "DataConnector \"mysql2\"" )
2022-12-14 06:46:10 +03:00
.PHONY : test -backends -pro
## test-backends-pro: run tests for HGE pro for all backends
2023-01-03 17:03:35 +03:00
test-backends-pro : build -pro start -backends remove -tix -file
2023-01-31 19:58:43 +03:00
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PRO_PATH) \
cabal run api-tests-pro:exe:api-tests-pro
2022-12-14 06:46:10 +03:00
2022-08-19 14:22:28 +03:00
.PHONY : test -unit
## test-unit: run unit tests from main suite
test-unit : remove -tix -file
2022-11-17 15:55:05 +03:00
cabal run graphql-engine:test:graphql-engine-tests
.PHONY : test -integration -mssql
## test-integration-mssql: run MS SQL Server integration tests
test-integration-mssql : remove -tix -file
docker compose up -d --wait sqlserver{ ,-healthcheck,-init}
2023-01-31 19:58:43 +03:00
HASURA_MSSQL_CONN_STR = '$(TEST_MSSQL_CONNECTION_STRING)' \
cabal run graphql-engine:test:graphql-engine-test-mssql
2022-11-17 15:55:05 +03:00
.PHONY : test -integration -postgres
## test-integration-postgres: run PostgreSQL integration tests
test-integration-postgres : remove -tix -file
docker compose up -d --wait postgres
2023-01-31 19:58:43 +03:00
HASURA_GRAPHQL_DATABASE_URL = '$(TEST_POSTGRES_URL)' \
cabal run graphql-engine:test:graphql-engine-test-postgres
2022-12-07 17:11:43 +03:00
2023-02-21 16:45:12 +03:00
.PHONY : test -logical -models
## test-logical-models: run all tests for the Logical Model feature
test-logical-models :
2023-03-13 21:13:56 +03:00
cabal build exe:graphql-engine
2023-03-22 20:09:55 +03:00
docker compose up -d --wait postgres citus sqlserver-healthcheck
2023-02-21 16:45:12 +03:00
HSPEC_MATCH = LogicalModels make test-unit
2023-03-02 19:33:39 +03:00
HASURA_TEST_BACKEND_TYPE = Postgres \
HSPEC_MATCH = LogicalModels \
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PATH) \
cabal run api-tests:exe:api-tests
2023-03-22 20:09:55 +03:00
HASURA_TEST_BACKEND_TYPE = Citus \
HSPEC_MATCH = LogicalModels \
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PATH) \
cabal run api-tests:exe:api-tests
HASURA_TEST_BACKEND_TYPE = BigQuery \
2023-03-24 18:15:24 +03:00
HSPEC_MATCH = LogicalModel \
2023-03-22 20:09:55 +03:00
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PATH) \
cabal run api-tests:exe:api-tests
HASURA_TEST_BACKEND_TYPE = SQLServer \
HSPEC_MATCH = Metadata.LogicalModel \
GRAPHQL_ENGINE = $( GRAPHQL_ENGINE_PATH) \
cabal run api-tests:exe:api-tests
2022-12-07 17:11:43 +03:00
.PHONY : py -tests
## py-tests: run the python-based test suite
py-tests :
2023-01-31 19:58:43 +03:00
./server/tests-py/run-new.sh