GDC Mysql integration tests

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7603
Co-authored-by: Daniel Chambers <1214352+daniel-chambers@users.noreply.github.com>
GitOrigin-RevId: 651bc2fb59a46449e2a4325a4c7af57592e53845
This commit is contained in:
Solomon 2023-02-15 22:29:19 -08:00 committed by hasura-bot
parent b7c71468ae
commit b3553ac88d
4 changed files with 53 additions and 20 deletions

View File

@ -147,3 +147,12 @@ services:
# depends_on:
# sqlserver:
# condition: service_started
mysql:
image: mysql
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: Password123#
ports:
- "3306:3306"

View File

@ -1,4 +1,5 @@
API_TESTS_DOCKER_COMPOSE = docker compose --project-directory=./server/lib/api-tests
API_PRO_TESTS_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.
@ -28,6 +29,7 @@ start-backends: build-backends
## stop-everything: tear down test databases
stop-everything:
$(API_TESTS_DOCKER_COMPOSE) down --volumes
$(API_PRO_TESTS_DOCKER_COMPOSE) down --volumes
$(PYTHON_TESTS_DOCKER_COMPOSE) down --volumes
.PHONY: remove-tix-file

View File

@ -76,7 +76,7 @@ test-matrix: build remove-tix-file
cabal run api-tests:exe:produce-feature-matrix +RTS -N4 -RTS
.PHONY: test-data-connectors-pro
## test-backends-pro: run tests for HGE pro for all backends
## test-data-connectors-pro: run tests for HGE pro for all backends
test-data-connectors-pro: build-pro remove-tix-file
docker compose up -d --wait postgres dc-sqlite-agent
GRAPHQL_ENGINE=$(GRAPHQL_ENGINE_PRO_PATH) \
@ -89,6 +89,22 @@ test-data-connectors-snowflake-pro: build-pro remove-tix-file
GRAPHQL_ENGINE=$(GRAPHQL_ENGINE_PRO_PATH) \
cabal run api-tests-pro:exe:api-tests-pro -- --match "DataConnector \"snowflake\""
.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\"")
.PHONY: test-backends-pro
## test-backends-pro: run tests for HGE pro for all backends
test-backends-pro: build-pro start-backends remove-tix-file

View File

@ -35,6 +35,7 @@ import Harness.Test.Fixture qualified as Fixture
import Harness.TestEnvironment (GlobalTestEnvironment, TestEnvironment)
import Harness.TestEnvironment qualified as TE
import Harness.Yaml (shouldReturnYaml)
import Hasura.Backends.DataConnector.API.V0 qualified as API
import Hasura.Prelude
import Test.Hspec (SpecWith, describe, it, pendingWith)
@ -271,7 +272,11 @@ objectRelatationshipsTests opts =
|]
describe "Foreign Key Constraint On" $ do
it "joins on PlaylistId" $ \(testEnvironment, _) ->
it "joins on PlaylistId" $ \(testEnvironment, _) -> do
let dataSchema = (TE.getBackendTypeConfig testEnvironment >>= BackendType.parseCapabilities) <&> API._cDataSchema
let supportsForeignKeys = any API._dscSupportsForeignKeys $ dataSchema
if supportsForeignKeys
then
shouldReturnYaml
opts
( GraphqlEngine.postGraphql
@ -292,6 +297,7 @@ objectRelatationshipsTests opts =
- Playlist:
Name: "Music"
|]
else pendingWith "Backend does not support Foreign Key Constraints"
whereClauseTests :: Fixture.Options -> SpecWith (TestEnvironment, a)
whereClauseTests opts =