Commit Graph

22 Commits

Author SHA1 Message Date
Daniel Harvey
305eebb3ab feature(server): add Logical Models support for CockroachDB
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8500
GitOrigin-RevId: 0205bd207843f50ad4fa12ad6e6c07d1f2740912
2023-03-27 14:00:07 +00:00
Solomon
b3553ac88d 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
2023-02-16 06:30:51 +00:00
Samir Talwar
4175b53395 server/api-tests: Add a Docker Compose file for the API tests.
We were previously using the Docker Compose file in the root directory
for manual testing _and_ the server API tests.

This splits them so we can e.g. add Yugabyte for easy manual testing.

In the future, this will also allow us to use ephemeral ports for API
test databases, while keeping the fixed ports for manual testing.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7524
GitOrigin-RevId: 7244e296b0ed0ace9782b6f44f321933a9d9a49d
2023-01-16 16:44:10 +00:00
Daniel Harvey
ebe8f72f25 [tooling] reduce CRDB sleep in docker healthcheck
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7373
GitOrigin-RevId: 12032bdd29ce59ac65eff9e79a0f2f4fd8c729bf
2022-12-22 16:34:39 +00:00
Daniel Harvey
c10943f6cd [tooling] Increase sleep in healthcheck to avoid double restart issue
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7360
GitOrigin-RevId: 85260612f65beafd8a6dfe1eda35c3e57c75b118
2022-12-21 12:34:18 +00:00
Samir Talwar
5910864845 Docker: Upgrade CockroachDB and help all databases shut down correctly.
1.  Upgrade CockroachDB to v22.2 stable, so we're no longer testing against a beta release.

2.  Use init when databases refuse to honor shutdown signals.

    Sometimes programs need help. Without this, CockroachDB and Azure SQL Edge (SQL Server for arm64) ignore the signal sent by `docker compose down` and wait to be forcibly killed, which doesn't seem very sensible.

    This might also be true for SQL Server itself, but I haven't tested it.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7321
GitOrigin-RevId: b8085d1dd2974d3aaf09194916d7ceb3f459b6b5
2022-12-19 15:33:59 +00:00
Samir Talwar
9175ee3b33 Docker: Add explicit platforms for databases.
Some databases don't provide `arm64` Docker images, leading to warnings when running `docker compose up` on macOS arm64.

We can suppress these warnings by explicitly stating that we want the amd64 images, even on arm64 machines. (They run through virtualization.)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7309
GitOrigin-RevId: 8e5edfd2508d5c5007162ad4056c7ec32793faef
2022-12-18 23:07:22 +00:00
Daniel Harvey
bc2d173161 [server/tests] New SQLServer DB per test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6834
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 3ee30313e47ba64d5b50ff46345ce507735c4d1f
2022-11-23 07:54:10 +00:00
Daniel Harvey
4683d4786d [server/tests] new Citus DB per test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6833
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 343aba12ff30c67908160b4c153334d46c5655ff
2022-11-18 11:10:29 +00:00
Samir Talwar
f24f0c6ce7 CI: Use the same PostgreSQL base images where possible.
Rather than varying it, let's just use `postgis/postgis` everywhere.

This uses the latest version of PostGIS, in which some of the raster codes have changed. This seems benign (it's just one digit) in the hex stream. I can't find the relevant release notes though.

Also syncs _images.go_ and _databases.yaml_ so we use the same thing where possible.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6903
GitOrigin-RevId: bb5c56f2e7ff69e4c008f1d658850af08c96badc
2022-11-17 13:54:19 +00:00
Samir Talwar
3670a10ee5 Share database configuration across tests.
This enables sharing the Docker Compose-based database configuration across the Haskell-based API tests and the legacy Python integration tests.

Why? Because we depend on different database versions and I keep running out of disk space. I am far too lazy to buy another disk and set up my operating system _again_.

The files in question are:

- _docker-compose/databases.yaml_, which is the base specification for the databases
- _docker-compose.yml_, used by the API tests locally (and for other manual testing), which extends the above
- _.buildkite/docker-compose-files/test-oss-server-hspec.yml_, used by the API tests in CI, which extends _databases.yaml_
- _server/tests-py/docker-compose.yml_, used by the Python integration tests

The changes are summarized as follows:

1. The following snippets are moved from _docker-compose/databases.yaml_ to _docker-compose.yml_ and _.buildkite/docker-compose-files/test-oss-server-hspec.yml_, as they're not strictly necessary for other forms of testing:
    - the fixed port mappings (in the range 65000–65010)
    - the PostgreSQL initialization
    - the SQL Server initialization
2. Environment variables are used a little more in health checks and initialization scripts, as usernames, passwords, etc. can be overridden.
3. The volumes in _docker-compose/databases.yaml_ are made anonymous (unnamed), and the names are only specified in _docker-compose.yml_. We don't need to do this elsewhere.
    - For extra fun, I have removed all named volumes from the CI Docker Compose files, as they seem to be unnecessary.
4. _server/tests-py/docker-compose.yml_ now depends on _docker-compose/databases.yaml_.
    - This was the point.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6864
GitOrigin-RevId: f22f2839716f543ce8a62f890da244de7e23abaa
2022-11-15 14:32:46 +00:00
Samir Talwar
9fe793e828 Split the Docker Compose files into pieces.
With the vague idea that we can eventually avoid publishing ports at all, at least in CI, while still having the flexibility to publish ports locally.

If we can get there, it should help with the issues we're seeing on CI, where ports are already allocated from previous runs and containers aren't properly cleaned up.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6836
GitOrigin-RevId: 1d636c73ae889e45e80ad52042c56daa1b9d5838
2022-11-14 12:39:37 +00:00
Tom Harding
d823d201b9 CREATE SCHEMA _ IF NOT EXISTS in api-tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6701
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: 13ab91a8c4241fb4e60df9e8856bc926afac6be9
2022-11-03 14:54:48 +00:00
Daniel Harvey
4e630170ac [tests] Add Yugabyte to docker compose
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6532
GitOrigin-RevId: 1915c8f073ffb5f97d9e92faf436a8f03f4694b7
2022-11-01 15:19:18 +00:00
Daniel Harvey
8ad0c65051 [tests] api-tests use separate metadata database
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6573
GitOrigin-RevId: baa425216fc7394d01d0e2923d7c7e54598da40b
2022-10-27 19:08:45 +00:00
Daniel Harvey
f4f4221d04 tests: Docker Compose healthchecks
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6282
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
Co-authored-by: Samir Talwar <47582+SamirTalwar@users.noreply.github.com>
GitOrigin-RevId: c2b1f958364ce5e1ef704fa1275d18ac810ca35b
2022-10-17 13:20:31 +00:00
Samir Talwar
8b8d7ab96d server/tests-hspec: Simplifying the steps required to run these on macOS on aarch64.
This makes a few changes to the test scripts and makefiles in order to make things simpler for the average Apple user.

First of all, we change the `wait_for_mysql` function to use "localhost", not "127.0.0.1", as this fixed an issue on my system when attempting to connect to the MySQL server.

Secondly, we split the SQL Server test image into two:

* The first is the server itself, which now automatically uses `azure-sql-edge` as the image if you are on an aarch64 chip and using the `make` commands.
* The second is the initialization script. Because `sqlcmd` is not available in the `azure-sql-edge` image on aarch64, we use a separate container based on `mssql-tools` to initialize the server.

The README has been updated.

Tested on both macOS/aarch64 (with other changes) and Linux/x86_64.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5986
GitOrigin-RevId: b16e079861dcbcc66773295c47d715e443b67eea
2022-09-21 16:48:21 +00:00
Gil Mizrahi
5aab7e5ce9 add cockroach to docker compose and tests-hspec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5558
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: b7f242939e718d5bb4f22b11c093ae77d21cdcce
2022-08-25 17:18:40 +00:00
Gil Mizrahi
a598ca47c2 tests-hspec init mssql - use 127.0.0.1 instead of localhost for sqlcmd
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4590
GitOrigin-RevId: 67e3c6a5d1aa77e2fd180678ec5a619f7b78e65a
2022-05-30 21:05:05 +00:00
Gil Mizrahi
b091c75372 Add README.md to tests-hspec and reorganize module namespace
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3421
GitOrigin-RevId: 8802d7e6a360edee62011ef371cc8930f36b25b1
2022-01-21 07:49:31 +00:00
Chris Done
15071a3bc9 Add SQL Server & Citus to hspec test suite harness and a BasicFields test for each
Relates to https://github.com/hasura/graphql-engine/issues/7755

This includes:

1. SQL Server
2. Citus

And removes the persistent-based testing in favor of duplicating the schema setup, data insertion and teardown.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3030
Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com>
GitOrigin-RevId: ab03e68436d2ae07a9ddeb5a499ff41e48d0e2d6
2021-12-30 11:01:43 +00:00
Chris Done
926da74819 Auto-launch graphql-engine (close hasura/graphql-engine#7801, hasura/graphql-engine#7827 )
Dupe of https://github.com/hasura/graphql-engine-mono/pull/2853 with branch renamed so it doesn't break a tool.

prev pr: https://github.com/hasura/graphql-engine-mono/pull/2911

next pr: https://github.com/hasura/graphql-engine-mono/pull/2922

This implements https://github.com/hasura/graphql-engine/issues/7801

Some points to keep in mind for review:

* How state is passed to the tests. Do we like how this works?
   * I quite like it, with the opaque type [`State`](68f33051ca/server/tests-hspec/Harness/State.hs (L17)), we can avoid churn when adding things.
   * The [setup/teardown](68f33051ca/server/tests-hspec/Spec.hs (L19-L31)) seems clean.
   * By using hspec's own means to pass and denote context, we avoid "getting new ideas" for how to structure the tests -- we use a standard. Hopefully, that means the tests' structure rarely change.
* The various flags passed in the [ServeOptions](68f33051ca/server/tests-hspec/Harness/Constants.hs (L123)) - if there are any causes for concern, raise them here. My thinking is that, there are lots. I've picked some "sane" defaults (mostly empty). The tests pass. I think as we add more complex tests, these flags will be scrutinised and updated as needed. I think it's valuable that all flags are explicitly listed here, though.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2921
GitOrigin-RevId: 2c2e70bf784ef571a48509a7e5006fd0f48773b5
2021-11-23 18:16:15 +00:00