Commit Graph

60 Commits

Author SHA1 Message Date
Daniel Harvey
9dc863e479 [server/tests] allow api-tests to be filtered by backend type
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7056
GitOrigin-RevId: 84618c3d5a0c2273b51584831287968b4df73fba
2022-11-25 15:40:41 +00:00
Tom Harding
b85a6572bf Make fixtureRepl work again
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6906
Co-authored-by: Philip Lykke Carlsen <358550+plcplc@users.noreply.github.com>
GitOrigin-RevId: cf00c31f610ad65305a007d8fbc6b7971ce9b7a9
2022-11-25 13:15:43 +00:00
Abby Sassel
eebeb5cc3b Server/tests: Remote Relationships > Citus
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7040
GitOrigin-RevId: 1a177e2d8a903144576990d047addcef70c69544
2022-11-24 13:31:04 +00:00
Karthikeyan Chinnakonda
e9794a6639 server: fix bug with customized remote schema enum variables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6993
GitOrigin-RevId: 0458c806176e752aea5a848e68246744c3e5b38a
2022-11-24 08:47:46 +00:00
Samir Talwar
c6557ced13 server/test-harness: Do not fail if the database cannot be dropped.
Sometimes this happens, especially in CI. It's alright. We can just leave it lying around and it will be destroyed when the container and associated volume are removed.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7003
GitOrigin-RevId: dcb74920c12341d7a15f9b6ebfe52d0864de4738
2022-11-23 07:54:44 +00:00
Daniel Harvey
80c3846aaa [server/tests] run setup for each set of tests again
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7000
GitOrigin-RevId: 2e85870c970144dbd417cf555b14b63c18f495ab
2022-11-23 07:54:28 +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
Lyndon Maydwell
7228d0327f Add display_name, release_name fields to MD Agent APIs - GDC-626
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6849
GitOrigin-RevId: 0ab90aaf281cc1c043f73fd6d63c4c18d58c7c92
2022-11-18 04:19:08 +00:00
Tom Harding
bb141dacb4 String interpolation for Postgres backend module
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6927
GitOrigin-RevId: 153975ec6e860a0bd1a06a85f11567d0fdc5b14d
2022-11-17 20:08:25 +00:00
Tom Harding
28af0a74e3 String interpolation for Cockroach backend module
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6922
GitOrigin-RevId: 62eb29eb9fcf1c11300a82682b0c1e246308e874
2022-11-17 15:11:44 +00:00
Tom Harding
0ff55c37f8 Remove MySQL tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6872
GitOrigin-RevId: 87a55e2384433c076c8815f991e753e4112d60dd
2022-11-16 11:26:01 +00:00
Tom Harding
93a2736c30 String interpolation for Citus backend modules
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6884
GitOrigin-RevId: abb15634de5c0a387284e2bed25622c302df6a3b
2022-11-16 10:38:50 +00:00
Tom Harding
502115f969 Bump aeson to v2.1, drop the Extended module
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6869
GitOrigin-RevId: ecb2f7dfe7d00c0a01999c12b0264be7850e0f42
2022-11-15 10:44:36 +00:00
Daniel Harvey
ab0f67cfd9 [server/tests] fallback to default postgres port when none is provided
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6860
GitOrigin-RevId: abe30f2fa1df89281dae0ffaf9ef20ef50cf7d33
2022-11-14 22:38:28 +00:00
Tom Harding
c0070bfd4b Add the ability to run api-tests against any (Postgres-like) connection string.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6791
GitOrigin-RevId: 5005eba75efbf7a0d7208be0a0794d63be82afd5
2022-11-10 09:44:11 +00:00
Samir Talwar
44a64ed983 server/test-harness: Wrap test resource setup/teardown.
When setting up a resource (typically some kind of web server) for use in tests, we need to remember to tear it down afterwards.

This moves this logic into one place, under the `TestResource` module.

Like `SetupAction`, it encapsulates setup and teardown, and also separates out waiting for the resource to be ready, so we don't accidentally leave it lying around in the case of a healthcheck failure.

Unlike `SetupAction`, it is monadic, and can be composed with other resources. In the future, we may want to adopt this logic for `SetupAction` too rather than using lists.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6806
GitOrigin-RevId: 74e2d76c5c09b8e0fe1cad84c9e77011f5a4d3db
2022-11-10 08:38:09 +00:00
Philip Lykke Carlsen
eb9506d954 server/tests: Structured logging in tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6805
GitOrigin-RevId: 4e4d3c12bad20948b5ad58b3ad6d1e882f4ceddb
2022-11-09 14:56:12 +00:00
Samir Talwar
8be01ae9aa server/api-tests: Use setupTablesAction everywhere.
This removes calls to `setup` and `teardown` in favor of `setupTablesAction`.

Because this action untracks and drops tables (at least until we figure out how to make throwaway databases), the teardown phase can fail. I have added a wrapper which logs and discards exceptions as a workaround for now.

In the future, when we can simply drop the database, it will probably be sensible to catch "table already untracked" exceptions specifically and let them slide, while still failing on all other exceptions.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6769
GitOrigin-RevId: 12cb8f81dd6aced892fe83c49b9a0bdbef8cc1ac
2022-11-09 09:36:43 +00:00
Solomon
1ff7d3535f Refactor DataConnector FixtureName constructors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6756
GitOrigin-RevId: 5f736a891ad15d4707f6a9d88037cbc89a4c00e5
2022-11-09 05:09:04 +00:00
Daniel Harvey
2d8e6372e9 [server/tests] - fresh CockroachDB per test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6788
GitOrigin-RevId: 71e1f0840de101796d2ebeec240a4f0075640a68
2022-11-08 18:59:17 +00:00
Daniel Harvey
48bb73ecb4 [server/tests] create new Postgres DB for each test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6741
GitOrigin-RevId: 0fa10ff8e3ab0ca9c36b1146ebf70434836f2531
2022-11-08 11:44:13 +00:00
Philip Lykke Carlsen
6720d77cd9 Perform fixture setup spec-by-spec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6708
GitOrigin-RevId: ac4b7350f6c0e9719f8b5973b267d72e3e4e444c
2022-11-03 20:27:02 +00:00
Philip Lykke Carlsen
1fa7f9b881 server/tests: Move 'emptySetupAction' to its single usage site
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6704
GitOrigin-RevId: 9adac1913fff3735b44c89c206e92544c9aa760b
2022-11-03 16:29:28 +00:00
Philip Lykke Carlsen
a4792a6b80 server/tests: Remove unnecessary complexity from Harness
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6700
GitOrigin-RevId: 3130097581b4e9284cd1074a5d74eb5165354eb4
2022-11-03 15:57:54 +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
Philip Lykke Carlsen
5b2877bc8f server/tests: Move subscriptions harness to a separate module
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6664
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: f5d7793606a50fb10f871ae757748fe5c21e50c8
2022-11-03 10:58:32 +00:00
Samir Talwar
342391f39d Upgrade Ormolu to v0.5.
This upgrades the version of Ormolu required by the HGE repository to v0.5.0.1, and reformats all code accordingly.

Ormolu v0.5 reformats code that uses infix operators. This is mostly useful, adding newlines and indentation to make it clear which operators are applied first, but in some cases, it's unpleasant. To make this easier on the eyes, I had to do the following:

* Add a few fixity declarations (search for `infix`)
* Add parentheses to make precedence clear, allowing Ormolu to keep everything on one line
* Rename `relevantEq` to `(==~)` in #6651 and set it to `infix 4`
* Add a few _.ormolu_ files (thanks to @hallettj for helping me get started), mostly for Autodocodec operators that don't have explicit fixity declarations

In general, I think these changes are quite reasonable. They mostly affect indentation.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6675
GitOrigin-RevId: cd47d87f1d089fb0bc9dcbbe7798dbceedcd7d83
2022-11-02 20:55:13 +00:00
Gil Mizrahi
60bd73e8d9 add a test for subscriptions with variables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6653
GitOrigin-RevId: b7d7f7392c50e983183812b270af3516c831d859
2022-11-02 12:47:04 +00:00
Daniel Harvey
11ff01f3e9 [server] Fix CockroachDB live queries
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6551
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: e78ce17d3ff5c677360b2927dca04a91e144952e
2022-11-02 11:41:02 +00:00
Tom Harding
7df6198b68 Add multiplexed subscription testing
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6637
GitOrigin-RevId: a92b333b88c548ba514e69598a86098d8f6243cc
2022-11-02 09:39:47 +00:00
Solomon
f5c68ee49e Fixes chinook table/column customizations to have consistent casing
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6642
GitOrigin-RevId: 629879fa057c3860aac1c3a83d2dfd199edb44e1
2022-11-01 22:08:59 +00:00
Daniel Harvey
cc87b25373 [tests] - allow Postgres source DB port to be overwritten in api-tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6646
GitOrigin-RevId: b96a68c5eab1ac33a226d2d89141e0de9eaeff93
2022-11-01 21:05:00 +00:00
Tom Harding
fbcf90d56f Add a test for Distinct queries
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6426
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 65387489ab0cabe0cb520799821380732ecef3e7
2022-11-01 19:58:46 +00:00
David Overton
87bcdb97c7 Use JSON instead of GraphQL for comparison operators
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6563
GitOrigin-RevId: 0819414df199292e0146ce3009295ce3e49f2439
2022-10-28 01:14:09 +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
Tom Harding
78f3754953 Add Cockroach and Postgres to DataValidation tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6343
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 9f5d98e180721eaf12fd4c4e60a42b6dee6b5cca
2022-10-27 12:20:41 +00:00
David Overton
9921823915 GDC-189 custom aggregations
>

## Description
->

This PR allows DC agents to define custom aggregate functions for their scalar types.

### Related Issues
->

GDC-189

### Solution and Design
>

We added a new property `aggregate_functions` to the scalar types capabilities. This allows the agent author to specify a set of aggregate functions supported by each scalar type, along with the function's result type.

During GraphQL schema generation, the custom aggregate functions are available via a new method `getCustomAggregateOperators` on the `Backend` type class.
Custom functions are merged with the builtin aggregate functions when building GraphQL schemas for table aggregate fields and for `order_by` operators on array relations.

### Steps to test and verify
>

• Codec tests for aggregate function capabilities have been added to the unit tests.
• Some custom aggregate operators have been added to the reference agent and are used in a new test in `api-tests`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6199
GitOrigin-RevId: e9c0d1617af93847c1493671fdbb794f573bde0c
2022-10-27 00:44:06 +00:00
Philip Lykke Carlsen
064095abdb server/tests: Add ability to test subscriptions in test-harness
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6494
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: d773139d59e590a5dbbc1c596958e2731dff3e76
2022-10-25 09:06:45 +00:00
Daniel Harvey
daf55101f4 tests: force remove BigQuery datasets and don't bother manually removing tables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6473
GitOrigin-RevId: 15cefa76cfd472f4197ae965970dfbc203f694a4
2022-10-24 16:54:35 +00:00
Samir Talwar
c3afa0fdd7 Install and use ODBC Driver 18 for SQL Server (msodbcsql18).
This installs the ODBC Driver 18 for SQL Server in all our shipped Docker images, and update our tests and documentation accordingly.

This version supports arm64, and therefore can run natively (or via Docker) on macOS on aarch64.

`msodbcsql17` is still installed in production-targeted Docker images so that users do not _have_ to migrate to the new driver.

Nix expressions are packaged for the new driver, as it is not yet available in nixpkgs.

In this version, [the default encryption setting was changed from "no" to "yes"](https://techcommunity.microsoft.com/t5/sql-server-blog/odbc-driver-18-0-for-sql-server-released/ba-p/3169228). In addition, "mandatory" and "optional" were added as synonyms for "yes" and "no" respectively.

I have therefore modified all connection strings in tests to specify `Encrypt=optional` (and changed some from `Encrypt=no`). I chose "optional" rather than "no" because I feel it's more honest; these connection strings will work with or without an encrypted connection.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6241
GitOrigin-RevId: 959f88dd1f271ef06a3616bc46b358f364f6cdfd
2022-10-21 16:25:04 +00:00
Daniel Harvey
ac4b15c07b CI: reject unused imports
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6466
GitOrigin-RevId: 157a51f338e4e80dffedb8b0dcf57173ba6bd126
2022-10-21 11:12:53 +00:00
Daniel Harvey
be9c3e5a66 tests: remove unused imports
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6456
GitOrigin-RevId: 563ce912236552c4bf75dc7f7f506b7dced25118
2022-10-20 13:14:00 +00:00
Lyndon Maydwell
37c65d4395 Support MetadataDefaults Options - GDC-108
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6286
GitOrigin-RevId: ef861e6070e667322fb2657166d3d343d6cab4bc
2022-10-20 12:46:45 +00:00
Antoine Leblanc
49d0594759 [server] prune join fields of remote relationships to remote schema (close hasura/graphql-engine#8345)
## Description

This PR fixes hasura/graphql-engine#8345: when creating the final representation of a remote relationship to a remote schema (a `RemoteJoin`), we would mistakenly label ALL join fields in the selection set as being relevant to that one relationship: if there are more than one remote relationship to process in that selection set, that would be the union of all their join fields. The problem with this error is that, when processing remote relationships, we correctly ignore all the ones for which at least one join key is null. Consequently, this error would result in us ignoring remote relationships for which an _unrelated_ join key was null, resulting in that data missing in the final JSON result.

This PR simply ensures that the aggregation of fields that are passed to `createRemoteJoin` is pruned to only contain the fields relevant to the join being created. This is a very small change, and the bulk of this PR is the regression tests.

## Changelog

__Component__ : server
__Type__: bugfix
__Product__: community-edition

### Short Changelog

fix remote relationship to remote schema sometimes being erroneously null when multiple relationships are defined on the same table / graphql object ([#8345](https://github.com/hasura/graphql-engine/issues/8345))

### Long Changelog

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6420
GitOrigin-RevId: eb54462724b007f80b674dcf234adf6d9cfaaf79
2022-10-20 00:11:51 +00:00
Gil Mizrahi
c6fdb44388 Test on_conflict on cockroachdb.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6423
GitOrigin-RevId: 58e1c3f60934332720cadb74c8cb29730e797287
2022-10-19 08:51:49 +00:00
Gil Mizrahi
666f34d564 Add cockroach to default and on_conflict tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6412
GitOrigin-RevId: 637abad70096a06c39a13b9c8683444e2bebdecf
2022-10-18 19:48:27 +00:00
Solomon
1e8846d27d Refactor GDC Fixture Modules for Hspec Tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6358
GitOrigin-RevId: 19b63d1db75998875463eb2a88e938eba688ecb0
2022-10-18 05:33:46 +00:00
Solomon
15ac95d446 Adds GDC Fixture to query specs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6352
GitOrigin-RevId: 2abba0743648e7f24baddd7591eee737ba795869
2022-10-18 02:48:33 +00:00
Solomon
5e85b0c534 Mutable Sqlite GDC Fixture - GDC-455
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6351
GitOrigin-RevId: bdcb3cfa694dda6a0d1473331bc689aae418a5bb
2022-10-17 22:53:14 +00:00