Commit Graph

295 Commits

Author SHA1 Message Date
paritosh-08
7f1f0606ed add config to prioritize data/error for remote schema fields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10528
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
GitOrigin-RevId: 49d0d7cbcc73fb0876d7ac3f5a1a8ff61ff800e8
2023-12-19 13:30:30 +00:00
Samir Talwar
397e95fc6a Upgrade Citus to v11.3.0 in tests.
Upgrades Citus to v11.3.0 in tests.

This breaks an assumption made by the tests for the `get_source_tables` metadata API, in which data is expected to be ordered. We fix it by explicitly ordering rather than relying on the goodwill of the database.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9039
GitOrigin-RevId: ee86db7e1c264d5009bb0203ac2f3fb2cda7b39f
2023-05-04 11:40:10 +00:00
Samir Talwar
c1705a09df api-tests: Fix the error messages to match those reported by Citus v11.3.0.
I also pinned Citus to v11.3. This should hopefully stop us from being surprised with random test failures in the future. We will need to bump this every now and again.

I have updated the Makefile to standardize Docker commands, and made sure we start all the containers even when running tests for a single database, as we need to test cross-DB remote joins. This ensures `make test-citus` actually works and runs all tests.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9035
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: 9c36ab65eb05206bfddd639c257d6c5c5cedd2bd
2023-05-03 20:22:26 +00:00
Samir Talwar
6ed9f36125 Remove the server upgrade/downgrade tests.
These tests are intended to catch issues in upgrading HGE. However:

* the tests are very convoluted and hard to understand,
* we can only run a small subset of Python tests that don't mutate any data or metadata, and
* I have never seen them fail for a legitimate reason, but I've seen a lot of flakes.

While we do believe it's important to test that upgrades don't break the stored introspection, these tests don't seem to be doing that any more. I humbly request that we delete them now and either (a) figure out how to test this properly, or (b) just wait for v3, which does away with reintrospecting on server startup entirely.

[NDAT-259]: https://hasurahq.atlassian.net/browse/NDAT-259?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8844
GitOrigin-RevId: 528bc632fce377b7eff2026b832bd58586ac5a0b
2023-04-24 10:04:15 +00:00
Samir Talwar
ffa3f5e3cc server/tests-py: Remove test_horizontal_scale.py.
This removes *test_horizontal_scale.py*, which tests horizontal scaling by running some tests against two HGE servers, both talking to PgBouncer.

This doesn't really test HGE; it's testing whether PgBouncer guarantees the same level of consistency as PostgreSQL. I'm not convinced that it's worthwhile, so I am deleting it.

[NDAT-542]: https://hasurahq.atlassian.net/browse/NDAT-542?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8821
GitOrigin-RevId: 2029f2fea11c7fd58ed47e724cb3cd50e67d5a43
2023-04-20 09:28:15 +00:00
Samir Talwar
832fac9c69 server/tests-py: Remove test_startup_db_calls.py.
This removes the *test_startup_db_calls.py* tests. These tests are looking for a specific regression on resolving sources multiple times on startup. I have never seen them fail and I'm not convinced the tests are worthwhile.

This is compounded by the roundabout way in which we verify that we resolve the sources; we do it by inspecting the logs. This is a real pain to port to the fixture-based method of spinning HGE, and I don't believe it's worth the effort; I'd rather just delete it.

[NDAT-540]: https://hasurahq.atlassian.net/browse/NDAT-540?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8813
GitOrigin-RevId: 0a313e7998fa034fa96aaa10924d9d11dd1856f4
2023-04-19 15:30:19 +00:00
Samir Talwar
26e03a07bb server/tests-py: Parallelize JWT tests.
This rewrites the JWT tests to generate and specify the secrets per test class, and to provide the server configuration to the HGE fixture.

It covers the tests in:

  - *test_jwt.py*
  - *test_jwt_claims_map.py*
  - *test_config_api.py*
  - *test_graphql_queries.py* (just a couple here)

This does reduce the number of code paths exercised with JWT, as we were previously running *all* tests with JWT tokens. However, this seems excessive; we don't need to tread every code path, just enough to ensure we handle the tokens appropriately. I believe that the test coverage in *test_jwt.py* does this well enough (though I'd prefer if we moved the coverage lower down in the stack as unit tests).

These tests were configured in multiple different ways by *test-server.sh*; this configuration is now moved to test subclasses within the various files. This results in a bit of duplication.

Unfortunately, the tests would ideally use parameterization rather than subclassing, but that doesn't work because of `hge_fixture_env`, which creates a "soft" dependency between the environment variables and `hge_server`. Parameterizing the former *should* force the latter to be recreated for each new set of environment variables, but `hge_server` isn't actually aware there's a dependency.

It currently looks like this adds lines of code; we'll more than make up for it when we delete the relevant lines from *test-server.sh*. I am not doing that here because I plan on deleting the whole file in a subsequent changeset.

[NDAT-538]: https://hasurahq.atlassian.net/browse/NDAT-538?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8803
GitOrigin-RevId: f7f2caa62de0b0a45e42964b69a8ae73d1575fe8
2023-04-19 10:30:21 +00:00
Samir Talwar
0ea8bd8df8 server/tests-py: Parallelize test_logging.py.
This adds the ability to capture logs to the HGE fixture, and uses this in test_logging.py to analyze the logs, instead of relying on a shell script redirecting the logs to a file.

We then inject the logs into the tests and parse the JSON. Because we're no longer reading a file, we need to do this in a separate thread, as we'll block on reading rather than the stream ending. (Once HGE stops, the stream will be closed.)

Some of the tests require a JWK server, so this has been extracted from test_jwk.py.

[NDAT-540]: https://hasurahq.atlassian.net/browse/NDAT-540?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8772
GitOrigin-RevId: 9413e714f1c42b8a0991d0d30c4358209fd30c0c
2023-04-17 13:09:34 +00:00
Samir Talwar
5677446ff3 server/tests-py: Run test_websocket_init_cookie.py in parallel.
This requires rewriting the test class to split it into 3, each specifying the correct environment variables for HGE.

It would be lovely to use parameterization rather than subclassing, but that doesn't work because of `hge_fixture_env`, which creates a "soft" dependency between the environment variables and `hge_server`. Parameterizing the former *should* force the latter to be recreated for each new set of environment variables, but `hge_server` isn't actually aware there's a dependency. See `TestParameterizedFixtures` in test_tests.py for more information.

[NDAT-539]: https://hasurahq.atlassian.net/browse/NDAT-539?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8747
GitOrigin-RevId: 878b2fc20f39f962a67cd950046a99c283cfc6fc
2023-04-12 16:26:22 +00:00
Samir Talwar
43f179688c server/tests-py: Run test_graphql_read_only_source.py in parallel.
This requires making it add its own source, rather than expecting one to be provided.

[NDAT-537]: https://hasurahq.atlassian.net/browse/NDAT-537?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8745
GitOrigin-RevId: 65c818e4f065e9f98e9cfd65c158eff5d768ae31
2023-04-12 14:37:21 +00:00
paritosh-08
91552a1a05 server: move apollo-federation to GA
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8163
Co-authored-by: Tirumarai Selvan <8663570+tirumaraiselvan@users.noreply.github.com>
GitOrigin-RevId: d971720e79d5e08d1e68b31f7475c0eb6f06cac8
2023-03-15 08:15:51 +00:00
Samir Talwar
0271094df7 CI: Disable Python integration test groups covered by the new job.
We now run a lot of these at once by spawning a new HGE instance per
test class. The commented-out tests are now duplicated.

We have a lot of work to do to take care of the rest, but this should be
a decent start. With this change, we drop from 42 to 19 test groups.

[NDAT-533]: https://hasurahq.atlassian.net/browse/NDAT-533?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8060
GitOrigin-RevId: e38e1a72cfa6eafac97065a435d2c8e1508b834e
2023-02-23 15:45:20 +00:00
Daniel Harvey
4b0c737f0b [server] re-add native sql output
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7692
GitOrigin-RevId: c4e8d6ff2defe6c0ecd96a7233636fe0ebae1a85
2023-01-27 14:38:07 +00:00
Daniel Harvey
4c20c46bdd [server]: revert native sql output
Reverts hasura/graphql-engine-mono#7617 whilst we look at server upgrade / downgrade tests.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7690
GitOrigin-RevId: e6e48f1bd90a8db36f372bf9f09c26e43d123ce5
2023-01-27 10:05:16 +00:00
Daniel Harvey
b80113912c server: generate native access sql
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7617
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 48e0ccdda50a09bcbad1a86b7015a02f883889ab
2023-01-26 18:02:44 +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
80c977da85 server: Split the integration tests out into their own directories.
We currently have a fairly intricate way of running our PostgreSQL and MSSQL integration tests (not the API tests). By splitting them out, we can simplify this a lot. Most prominently, we can rely on Cabal to be our argument parser instead of writing our own.

We can also simplify how they're run in CI. They are currently (weirdly) run alongside the Python integration tests. This breaks them out into their own jobs for better visibility, and to avoid conflating the two.

The changes are as follows:

- The "unit" tests that rely on a running PostgreSQL database are extracted out to a new test directory so they can be run separately.
  - Most of the `Main` module comes with them.
  - We now refer to these as "integration" tests instead.
- Likewise for the "unit" tests that rely on a running MS SQL Server database. These are a little simpler and we can use `hspec-discover`, with a `SpecHook` to extract the connection string from an environment variable.
  - Henceforth, these are the MS SQL Server integration tests.
- New CI jobs have been added for each of these.
  - There wasn't actually a job for the MS SQL Server integration tests. It's pretty amazing they still run well.
- The "haskell-tests" CI job, which used to run the PostgreSQL integration tests, has been removed.
- The makefiles and contributing guide have been updated to run these.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6912
GitOrigin-RevId: 67bbe2941bba31793f63d04a9a693779d4463ee1
2022-11-17 12:56:26 +00:00
Samir Talwar
7c452bfca1 server/tests-py: Spawn a new PostgreSQL schema ("database") per test.
When running using the "new" style (with a HGE binary, not a URL), a new PostgreSQL metadata and source database are created for each test. When we get this into CI, this should drastically reduce the flakiness.

I have also enabled parallelization by default when using `run-new.sh`. It's much faster.

I had to basically rewrite _server/tests-py/test_graphql_read_only_source.py_ so that it does two different things depending on how it's run. It's unfortunate, but it should eventually go away.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6879
GitOrigin-RevId: a121b9035f8da3e61a3e36d8b1fbc6ccae918fad
2022-11-15 19:08:53 +00:00
pranshi06
7b7845f697 server: add jwk-refresh-log type to default enabled logs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6775
GitOrigin-RevId: 23fbeceb91e51380ccf0bb5830a4471d8964a3f5
2022-11-08 16:48:44 +00:00
pranshi06
fd6aa0a266 server: add jwk-refresh-log as configurable log type
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6705
GitOrigin-RevId: 1f6f45ce555cefc24836a2fc5363660e351fa13b
2022-11-08 07:37:50 +00:00
Samir Talwar
82d897efda CI: In upgrade+downgrade tests, run the current graphql_server.py.
There doesn't seem to be a good reason to run the release version, and if there's a problem, we can't fix it without making a new release.

This also means we should catch bugs much earlier.

Co-Authored-By: Abby Sassel <3883855+sassela@users.noreply.github.com>

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6678
GitOrigin-RevId: 7b32cd721089dccabc634598b333b94a3933221a
2022-11-03 12:02:45 +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
Samir Talwar
c2cb07f7e8 server/tests-py: Start webhook.py inside the test harness.
We use a helper service to start a webhook-based authentication service for some tests. This moves the initialization of the service out of _test-server.sh_ and into the Python test harness, as a fixture.

In order to do this, I had to make a few changes. The main deviation is that we no longer run _all_ tests against an HGE with this authentication service, just a few (those in _test_webhook.py_). Because this reduced coverage, I have added some more tests there, which actually cover some areas not exacerbated elsewhere (mainly trying to use webhook credentials to talk to an admin-only endpoint).

The webhook service can run both with and without TLS, and decide whether it's necessary to skip one of these based on the arguments passed and how HGE is started, according to the following logic:

* If a TLS CA certificate is passed in, it will run with TLS, otherwise it will skip it.
* If HGE was started externally and a TLS certificate is provided, it will skip running without TLS, as it will assume that HGE was configured to talk to a webhook over HTTPS.
* Some tests should only be run with TLS; this is marked with a `tls_webhook_server` marker.
* Some tests should only be run _without_ TLS; this is marked with a `no_tls_webhook_server` marker.

The actual parameterization of the webhook service configuration is done through test subclasses, because normal pytest parameterization doesn't work with the `hge_fixture_env` hack that we use. Because `hge_fixture_env` is not a sanctioned way of conveying data between fixtures (and, unfortunately, there isn't a sanctioned way of doing this when the fixtures in question may not know about each other directly), parameterizing the `webhook_server` fixture doesn't actually parameterize `hge_server` properly. Subclassing forces this to work correctly.

The certificate generation is moved to a Python fixture, so that we don't have to revoke the CA certificate for _test_webhook_insecure.py_; we can just generate a bogus certificate instead. The CA certificate is still generated in the _test-server.sh_ script, as it needs to be installed into the OS certificate store.

Interestingly, the CA certificate installation wasn't actually working, because the certificates were written to the wrong location. This didn't cause any failures, as we weren't actually testing this behavior. This is now fixed with the other changes.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6363
GitOrigin-RevId: 0f277d374daa64f657257ed2a4c2057c74b911db
2022-10-20 19:00:01 +00:00
Samir Talwar
0a66d87305 server/tests-py: Upgrade to postgresql-client-15.
This means we can run `TestPGDump` against it.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6372
GitOrigin-RevId: 2512a1f372342e5793b97aeb34f19b92be99b6b2
2022-10-20 05:57:30 +00:00
Samir Talwar
0d4d7e6b1e server/tests-py: Start helper services in the test harness.
This makes it possible for the test harness to start the test JWK server and the test remote schema server.

In order to do this, we still generate the TLS certificates in the test script (because we need to install the generated CA certificate in the OS certificate store), and then pass the certificate and key paths into the test runner.

Because we are still using _test-server.sh_ for now, we don't use the JWK server fixture in that case, as HGE needs the JWK server to be up and running when it starts. Instead, we keep running it outside (for now).

This is also the case for the GraphQL server fixture when we are running the server upgrade/downgrade tests.

I have also refactored _graphql_server.py_ so there isn't a global `HGE_URLS` value, but instead the value is passed through.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6303
GitOrigin-RevId: 06f05ff674372dc5d632e55d68e661f5c7a17c10
2022-10-13 15:45:24 +00:00
pranshi06
dccc2cea03 server: unauthenticated behaviour with Apollo ws
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4862
GitOrigin-RevId: 14db3fa732c7d6430795193e425769b63a221f19
2022-10-13 09:33:53 +00:00
Samir Talwar
bebff269a6 server/tests-py: If a port is busy, try to figure out why.
Every now and again, I see in CI that a test will abort early because port 8080 is busy. Given that we're running in a fresh Docker container, this makes no sense to me.

On failure, it will now run `lsof -i :$PORT` to try and figure out what's listening on that port.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6285
GitOrigin-RevId: 5eb58d016b2f43872e2c78a7d89d27cfc3e22312
2022-10-12 13:28:03 +00:00
Daniel Harvey
f2f83be6cc tests: re-enable pg-dump tests for Postgres 14
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6248
GitOrigin-RevId: f64989caa0768a5f309f38b147062e0bf3a61155
2022-10-11 17:53:25 +00:00
Samir Talwar
f9ff7ae00c CI: Remove the custom Microsoft SQL Server image.
Now that we use the mssql-tools image for running `sqlcmd`, we no longer need this (or indeed use it very much).

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6152
GitOrigin-RevId: be8852a93889553c3ffd2ec00c0dda81b36c3d05
2022-10-06 16:21:44 +00:00
Daniel Harvey
87ca46f79b tests: add Postgres 14 and Postgres 15 pytests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5968
GitOrigin-RevId: 6569e58b89f014268152cfe7bf1f6c11233fbe49
2022-10-06 09:46:38 +00:00
Samir Talwar
3cb9bab9f1 server/tests-py: Provide the admin secret to the HGE server.
When we run the HGE server inside the test harness, it needs to run with
an admin secret for some tests to make sense. This tags each test that
requires an admin secret with `pytest.mark.admin_secret`, which then
generates a UUID and injects that into both the server and the test case
(if required).

It also simplifies the way the test harness picks up an existing admin
secret, allowing it to use the environment variable instead of requiring
it via a parameter.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6120
GitOrigin-RevId: 55c5b9e8c99bdad9c8304098444ddb9516749a2c
2022-09-29 17:20:07 +00:00
Samir Talwar
60f81023db server/tests-py: Run the auth hook inside the test harness.
This teaches `hge_server` how to run more tests, thanks to `hge_env`.

It also simplifies the logic a bit more.

I have also modified _run.sh_ and _docker-compose.yml_ so we can run multiple test suites, one after another.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6105
GitOrigin-RevId: eff009362eb6bb90c07cedaf96dfe6ec9336ff32
2022-09-29 10:44:03 +00:00
Samir Talwar
cbdacd1c6c CI: Fix all shellcheck warnings in test-server.sh
* Add `source=` directives.
* Quote variables.
* Don't export variables that can fail to assign; instead, export afterwards.
* Write HGE stderr to the log file.
* Fix warnings around the PIDs.
* Disable a couple of false positives.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6097
GitOrigin-RevId: ed1c696b8735cd5d63ba30b3105040a0a9eca63c
2022-09-28 16:08:15 +00:00
Samir Talwar
8cb2738cbe server/tests-py: Declaratively state the HGE environment variables.
This has two purposes:

* When running the Python integration tests against a running HGE instance, with `--hge-url`, it will check the environment variables available and actively skip the test if they aren't set. This replaces the previous ad-hoc skip behavior.
* More interestingly, when running against a binary with `--hge-bin`, the environment variables are passed through, which means different tests can run with different environment variables.

  On top of this, the various services we use for testing now also provide their own environment variables, rather than expecting a test script to do it.

In order to make this work, I also had to invert the dependency between various services and `hge_ctx`. I extracted a `pg_version` fixture to provide the PostgreSQL version, and now pass the `hge_url` and `hge_key` explicitly to `ActionsWebhookServer`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6028
GitOrigin-RevId: 16d866741dba5887da1adf4e1ade8182ccc9d344
2022-09-28 09:21:02 +00:00
Samir Talwar
1b20bb55b5 Create a Docker image specifically for running the Python tests.
This separates out the dependencies from the server builder.

I am using Python 3.9 as it has improved support for type annotations, which I would like to use.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5761
GitOrigin-RevId: d57b4a5ace050861e516dd79a4a38ff4844d4093
2022-09-07 14:29:42 +00:00
Samir Talwar
ecd3989722 CI: Increase the verbosity of reporting when running pytest.
This passes the `-vv` argument to pytest, [which tells it not to truncate assertions](https://docs.pytest.org/en/7.1.x/how-to/output.html?highlight=verbose#verbosity), and the `-r a` argument, which tells it to print a summary of all skipped, failed, errored, xfailed, etc. tests (i.e. everything that didn't pass).

This should help us understand what's going on when tests fail.

I have also pulled out other common parameters into variables, and added newlines.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5510
GitOrigin-RevId: 7d2410820b6c9372b1cf7867ce0450af728b7fc1
2022-08-22 05:12:54 +00:00
Samir Talwar
b67bc98c14 server/tests-py: Split the naming convention tests.
This splits two naming convention tests into four classes (and four YAML
files), which might seem overkill, but allows us to provision sources
declaratively in the future. As each class will require a custom source
configuration, we are able to annotate them accordingly, which means the
test cases are decoupled from the source database URL, letting us
generate a new database for each test case and automatically add it as a
source to HGE.

The future changes are already prepared, but this has been extracted out
as it splits the YAML files, which is a large change best reviewed in
isolation.

The test case `test_type_and_field_names` has been split into:

* `TestNamingConventionsTypeAndFieldNamesGraphqlDefault`
* `TestNamingConventionsTypeAndFieldNamesHasuraDefault`

The test case `test_type_and_field_names_with_prefix_and_suffix` has
been split into:

* `TestNamingConventionsTypeAndFieldNamesGraphqlDefaultWithPrefixAndSuffix`
* `TestNamingConventionsTypeAndFieldNamesHasuraDefaultWithPrefixAndSuffix`

The YAML files have been split in the same way. This was fairly trivial
as each test case would add a source, run some tests with
the `graphql_default` naming convention, drop the source, and then
repeat for the `hasura_default` naming convention. I simply split the
file in two. There is a little bit of duplication for provisioning the
various database tables, which I think is worth it.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5496
GitOrigin-RevId: 94825e755c427a5414230f69985b534991b3aad6
2022-08-17 04:36:07 +00:00
Samir Talwar
2757c2156b server/tests-py: Move installing node_modules to the makefile.
This means that if `remote_schemas/nodejs/package.json` changes, the
dependencies will be automatically reinstalled.

It also moves `package-lock.json` to the correct location (in the
directory in which we run `npm install`), and updates it.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5481
GitOrigin-RevId: f3fb431afd19de150f39ec2e4cb6572b896c870f
2022-08-16 09:27:04 +00:00
Samir Talwar
b856d96989 server/tests-py: Factor out service URLs as environment variables.
Making it easier to inject different ones later.

I also included a change to _.prettierignore_ so Visual Studio Code doesn't keep trying to reformat the JavaScript or YAML files in `server/tests-py`, as it can cause diffs to balloon for no obvious benefit.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5456
GitOrigin-RevId: bc6d548708160a328e1e61a00e19be8e124da025
2022-08-15 14:59:05 +00:00
Samir Talwar
1e1a36a192 server/tests-py: Use environment variables for services in queries.
I'm trying to shore up the Python integration tests to make them more reliable. In doing so, I noticed this.

---

Rather than hard-coding hostnames and ports, we can (and already do) inject these into the HGE process using environment variables.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5255
GitOrigin-RevId: 6bb593999ece42cedef6619f31f9d9b2e39f30ef
2022-08-03 20:05:46 +00:00
pranshi06
5203559173 server: Add warning log for no admin secret
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5034
GitOrigin-RevId: 82498837c38c66882aa1cc7c78131aa965fe70ac
2022-07-27 11:47:32 +00:00
paritosh-08
95adde4ce2 server: support for Apollo federation
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4584
Co-authored-by: Auke Booij <164426+abooij@users.noreply.github.com>
GitOrigin-RevId: 0f60c263efb5fbaa25620dd8159e8cfda25a61b2
2022-07-25 15:54:41 +00:00
Gil Mizrahi
ee15c804bc server/postgres: prefix identifiers longer than 63 characters with their md5 hash
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5080
GitOrigin-RevId: 58e5e6aab136617d1bbfc6621c89942da358b04d
2022-07-22 15:29:02 +00:00
Karthikeyan Chinnakonda
584aa666bd server: add support to customize streaming subscriptions root field
Earlier, if the `select` root field had a custom root field set, the same custom root field was then used for the streaming subscription root field as well. This leads to duplicate root fields being generated in the `subscription_root`.

This PR fixes that. It provides a way to customize the streaming subscription root field and not use the `select` root field's custom root field name for the streaming subscription root field.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4967
Co-authored-by: Anon Ray <616387+ecthiender@users.noreply.github.com>
GitOrigin-RevId: 54e74ce97561b0e5cfdfc60d1ca340aaebecf7d4
2022-07-06 12:14:25 +00:00
paritosh-08
3d001fedb8 server: respect experimental flag for naming convention of table column names
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4845
GitOrigin-RevId: f1347ec64ff883d1dcc87e588a063557d37cb968
2022-06-30 05:57:18 +00:00
Brandon Martin
5e29a1304d Revert "Add _cast support for other postgres datatypes fix #6050 and …
…fix #5426"

This reverts commit f85742318167d1e51f463c45fcd00f26269c2555.

## Description ✍️
With this commit there is the possiblity that you could get conflicting
type definitions with remote schemas. Reverting for now as we determine
a solution. At which point we will add this back in.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4879
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 932b4a9226717c826d4bde7e375695354cee8c0c
2022-06-29 12:09:40 +00:00
Brandon Simmons
6e8da71ece server: migrate to aeson-2 in preparation for ghc 9.2 upgrade
(Work here originally done by awjchen, rebased and fixed up for merge by
jberryman)

This is part of a merge train towards GHC 9.2 compatibility. The main
issue is the use of the new abstract `KeyMap` in 2.0. See:
https://hackage.haskell.org/package/aeson-2.0.3.0/changelog

Alex's original work is here:
#4305

BEHAVIOR CHANGE NOTE: This change causes a different arbitrary ordering
of serialized Json, for example during metadata export. CLI users care
about this in particular, and so we need to call it out as a _behavior
change_ as we did in v2.5.0. The good news though is that after this
change ordering should be more stable (alphabetical key order).

See: https://hasurahq.slack.com/archives/C01M20G1YRW/p1654012632634389

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4611
Co-authored-by: awjchen <13142944+awjchen@users.noreply.github.com>
GitOrigin-RevId: 700265162c782739b2bb88300ee3cda3819b2e87
2022-06-08 15:32:27 +00:00
paritosh-08
42da1dbc2e server/docs: follow up on the naming convention
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4563
GitOrigin-RevId: 0ae1f226a63dae34e6cb0d001b4915c05b0974cf
2022-05-27 05:56:52 +00:00
paritosh-08
fd30fb343b server: naming conventions for auto generated fields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3982
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
GitOrigin-RevId: f90b2e8f394e7bd69780f003d2d980475f104f42
2022-05-26 11:55:29 +00:00
Puru Gupta
d5e46b6041 server: do not serialize env vars in logs or errors: PR II - Actions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4486
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
GitOrigin-RevId: 35bb05f9a3c98689c05f2865e0923c00b46e5419
2022-05-23 11:13:49 +00:00