Commit Graph

6 Commits

Author SHA1 Message Date
Samir Talwar
fef1caabce server/tests-py: Support MSSQL and Citus with run.sh and run-new.sh.
This adds support for running the Python integration tests for MSSQL and Citus just as in CI, as follows:

```
./server/tests-py/run.sh backend-mssql
./server/tests-py/run.sh backend-citus
```

These run the named CI jobs, providing the appropriate backend.

(In reality, all backends are always provided, which is much simpler.)

It also provides the various databases to _server/tests-py/run-new.sh_, though the tests fail as they don't properly initialize the sources. (This will be fixed in the future by provisioning sources in the test framework itself.)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5997
GitOrigin-RevId: c276a4779a35bb538ef0dc02ac8b7cb2d5a8dec5
2022-09-22 19:03:44 +00:00
Samir Talwar
0b3c8ccaca server/tests-py: Support running BigQuery tests with run.sh.
This fixes a few issues so that we can run `./server/tests-py/run.sh backend-bigquery` to run the Python integration tests for BigQuery locally.

* We forward the relevant environment variables to the Docker container.
* We increase the HTTP timeout, as I'm seeing requests taking up to 90s locally.
* We rewrite the setup so that it avoids `INSERT INTO`, which is not available using the BigQuery free tier. Instead, we use `CREATE TABLE ... AS SELECT ...`. This is the same method used by the Haskell integration tests.

We also capture local server output in a volume so it's easier to figure out what went wrong later.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5921
GitOrigin-RevId: c628f8c08a84f2582958659ab6d6494832471f6f
2022-09-20 10:56:36 +00:00
Samir Talwar
a24cdd9b49 Prepare PostgreSQL for running tests in parallel.
This makes two changes to the Docker Compose files that we use for local testing:

1. We disable `fsync`. On my machine, this decreases the time taken to create a new database from ~5s to less than 0.1s. The trade-off is that you might lose data, which we don't care about, as this is for testing.
2. We increase the maximum number of connections from the default, 100, to 1000. This allows us to run more tests in parallel without hitting connection limits.

These changes won't have any meaningful effect for now; they simply allow us to parallelize tests against PostgreSQL in the future.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5892
GitOrigin-RevId: 5d0d0ab37fdfbf4c9e20084d3cbedf647f54a04e
2022-09-15 14:03:23 +00:00
Samir Talwar
1a5aaae9cf server/tests-py: Add a --hge-bin argument to the Pytest runner.
This argument allows the user to specify how to run HGE, rather than starting it beforehand. The runner will start a new instance of HGE for each test class.

This does not provide isolation, as the database is still re-used, but it helps us get closer.

You can try it yourself by executing:

```
$ cabal build graphql-engine:exe:graphql-engine
$ ./server/tests-py/run-new.sh
```

This doesn't affect CI at all.

I also fixed a few warnings flagged by Pylance.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5881
GitOrigin-RevId: ea6f0fd631a2c278b2c6b50e9dbdd9d804ebc9d4
2022-09-15 12:31:12 +00:00
Samir Talwar
bff1309344 server/tests-py: Make HGECtxGQLServer a fixture.
Starting it and stopping it for the various tests that actually use it.

There are only a few.

This also removes some dead code and fixes warnings in _test_webhook_request_context.py_.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5846
GitOrigin-RevId: 7760467f9de7b1f9718e7482275c298eeaa3ad3a
2022-09-14 21:42:40 +00:00
Samir Talwar
3e6013ddd2 server/tests-py: Run tests locally in the same way as CI.
This allows a developer, through Docker, to run the Python integration tests in pretty much exactly the same way as CI does.

Allowing us to more readily diagnose issues locally.

I'm hoping this is temporary and we won't need it for too long, but I have found it invaluable over the last few days so I would like to share it.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5818
GitOrigin-RevId: 18876fbbcbe7c5492afdf54d96af45ab2c519b77
2022-09-09 05:03:23 +00:00