Commit Graph

5575 Commits

Author SHA1 Message Date
ananya-2410
e2dc37ab60 ci: tag release v2.14.0-beta.2
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6540
GitOrigin-RevId: 20cfc7b281e3664b67b4fa8be44a307716efef63
2022-10-26 08:47:06 +00:00
Matthew Goodwin
2a64d1a002 feature (console): allow user to update GQL configuration for GDC source tables from the Modify Tab
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6463
Co-authored-by: Vijay Prasanna <11921040+vijayprasanna13@users.noreply.github.com>
GitOrigin-RevId: b583d1d7e4eef4e796b820903a6be9c4e32fa316
2022-10-26 08:28:12 +00:00
Mohd Bilal
edc40ea7be cli: refactor internal/scripts package to use internal/errors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6458
GitOrigin-RevId: 579a7cba6780feee81f9ee06cab6ccb5f7a4cae3
2022-10-26 07:30:25 +00:00
Matt Hardman
0ed17e543c console: implement permissions builder for GDC
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6429
GitOrigin-RevId: ce956e93920f7edcd032814e6f7b4daad068bb77
2022-10-26 06:58:15 +00:00
Mohd Bilal
6ecf34ade6 cli: refactor seed package to use internal/errors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6506
GitOrigin-RevId: cd7fbe3404b337e946022b351188f58b8bfbf6d3
2022-10-26 06:02:09 +00:00
Mohd Bilal
bf6f36a552 cli: refactor migrate/cmd package to use internal/errors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6510
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: d34597728fdf2070bba35a8e85b5859e30f5c3e4
2022-10-26 05:28:42 +00:00
Mohd Bilal
e3fc8b6e27 cli: refactor migrate/database package to use internal/errors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6511
GitOrigin-RevId: f8ed9c2f3cc5014d6e4b6258452109b452c17c39
2022-10-26 04:59:50 +00:00
Mohd Bilal
a34d610e6a cli: refactor plugins/paths to use internal/errors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6527
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 044fb0c845f02dcaa3906b9a575f5bd8842b9056
2022-10-26 02:20:57 +00:00
Vijay Prasanna
7452472726 feature (console): allow user to add/update/delete local relationships for GDC sources
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6443
GitOrigin-RevId: bb4537438cd256c80be10759a1475d666014a284
2022-10-25 21:31:02 +00:00
Rikin Kachhia
a1b2882c70 console: fix API explorer headers action icons alignment
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6525
GitOrigin-RevId: 535e7d74ae0397fa34fc2aefcb99fc2377e6a498
2022-10-25 16:04:56 +00:00
Vamshi Surabhi
40de5f21f9 remove cyclic dependencies in 'Hasura.GraphQL.Schema' module
Prior to this commit, various definition types representing GraphQL schema internally and the logic which collected a schema from the definition types were in a single module called `Hasura.GraphQL.Schema`. This created cyclic dependencies between `Hasura.GraphQL.Schema` module and `Hasura.GraphQL.Schema.Convert` module.

This is now fixed by:
1. Moving all the definition related types into `Hasura.GraphQL.Schema.Definition` module
1. The logic that collects a GraphQL Schema from these types into `Hasura.GraphQL.Schema.Collect`

With these changes, `Hasura.GraphQL.Schema` module just exports both these modules.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6517
GitOrigin-RevId: d5207cf31335aeeddd874ed6f921a17892580b4c
2022-10-25 15:02:28 +00:00
Erik Magnusson
e40b10b428 console: added ssl mode information to cockroach db
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6522
GitOrigin-RevId: aa5f1d881522c304d424d6927477d063d52467dc
2022-10-25 14:01:01 +00:00
Philip Lykke Carlsen
8cb14a592d server: Add an ExperimentalFeatureFlag for Aggregation Predicates
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6523
GitOrigin-RevId: 76861a1bf0d9895901564935b0778e7bda75c6a9
2022-10-25 13:21:40 +00:00
Vijay Prasanna
f5c7eac7fd feature (console): allow user to edit column comments and custom GQL field names for GDC tables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6469
GitOrigin-RevId: b08f45788966e7bf1636adf55939308432d64397
2022-10-25 12:16:48 +00:00
Vamshi Surabhi
c2a1d30765 simplify type collection for introspection
No user facing changes. Minor cleanup.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6519
GitOrigin-RevId: 7d9b6077a609175642059895800e9c540cf62790
2022-10-25 11:13:38 +00:00
Erik Magnusson
4c216cd2e7 removed dependency of needing gdc to be enabled to reach connect db page
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6516
GitOrigin-RevId: 8c9a42fd87b16b48d0b296a7160566df129b3b80
2022-10-25 09:57:03 +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
Luca Restagno
49e9c47db3 Docs: improve Console contributing instructions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6471
GitOrigin-RevId: bec885589e9e8e631e73dc288dea60375d5e9248
2022-10-25 08:14:52 +00:00
Erik Magnusson
3fee21f2a0 console: disable connection parameters field for cockroachdb
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6495
GitOrigin-RevId: e23a1212c3e35bc2dec5dccca5a8eda0a1636402
2022-10-25 06:25:58 +00:00
Antoine Leblanc
50bdd9610e [documentation] add more details to remote joins engineering documentation
### Description

This small PR develops a bit the existing documentation about remote joins. It adds a new section that details where each piece of the feature is located, and adds two paragraphs detailing some of the implementation details of the execution.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6505
GitOrigin-RevId: 6edd5459e4081cc6c9a80fdc92c2d479dedb2be9
2022-10-24 20:54:26 +00:00
Chris Martin
28eb51939d Chrism/docs/api allowed methods
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6213
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
GitOrigin-RevId: 9684940fb3b48f85e8176651d4260e0f28fd0d66
2022-10-24 18:34:05 +00:00
hasura-bot
06849912a3 docs: add docs to connect ms sql server on azure to hasura
GITHUB_PR_NUMBER: 9137
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/9137

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6453
Co-authored-by: Alok Kumar Sahoo <45600289+aloks98@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
GitOrigin-RevId: 1a038bbe09e1ef83c1bdf788cbd844b93078c39e
2022-10-24 17:30:58 +00:00
Rob Dominguez
2efc24e823 docs: clarify env var instructions for cockroach using ssl
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6502
GitOrigin-RevId: b3691a0b976e954ab35e67a58627bcdb1124b077
2022-10-24 17:16:12 +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
hasura-bot
18a9308a6a Update README.md
GITHUB_PR_NUMBER: 9125
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/9125

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6428
Co-authored-by: JensColman <19571117+JensColman@users.noreply.github.com>
GitOrigin-RevId: e577d1b6e4fdff2d8d870f2fb0d9715ae7dcfbec
2022-10-24 16:06:20 +00:00
Daniele Cammareri
484e3c25e7 docs: add type generator doc
## Description ✍️

Add type generator doc to action section.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6459
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
GitOrigin-RevId: 0d924c5f34b1f6ef09b37843fa2aae6e5e1d8d19
2022-10-24 16:01:06 +00:00
Samir Talwar
0fa76e8abb direnv: Default to the Azure SQL Edge image on macOS.
Sometimes you just want to run `docker compose up` without faffing about with `make`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6499
GitOrigin-RevId: 1a88dae933e314ea8204c6c22a831b38808776c1
2022-10-24 15:54:41 +00:00
Erik Magnusson
63e576cce3 docs: updated cloud docs to include ssl specific information
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6496
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
GitOrigin-RevId: b45adcead78227d6321ee11232578357fb4ea696
2022-10-24 15:01:46 +00:00
Stefano Magni
040a281392 platform(console): Refactor everything Analytics
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6153
GitOrigin-RevId: e0dea3acf995d8f73eed8fabae374e215ebcd964
2022-10-24 08:30:01 +00:00
Aravind K P
5d759189d0 cli: port metadataobject/query_collections to use internal/errors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6410
GitOrigin-RevId: d82eb90669f3a915f2a2fc9d87347ff64f4ee97b
2022-10-24 03:22:47 +00:00
Daniel Chambers
792ef3117d Export Chinook dataset to JSON lines for Athena consumption
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6489
GitOrigin-RevId: 36a068179d595f3d838995fb057b8ee590d1fd02
2022-10-24 02:10:51 +00:00
Stef Moreno
ef386ccee1 docs: update outdated heroku screenshots
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6479
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
GitOrigin-RevId: e5040782501ac64f537ea2fb5d02eee02d602b21
2022-10-21 19:55:27 +00:00
Raju Sunny
28b93adbe9 docs: best practices db observability
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6301
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
GitOrigin-RevId: c84755c70e66ee04ad8274f8a2ac94d2cfab00fd
2022-10-21 19:16:01 +00:00
Abby Sassel
3427488c68 NDAT-206 Disable the relay schema for cockroach sources
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6468
GitOrigin-RevId: 9c7735c2318580f1b853d6a8d2d586cffef72c59
2022-10-21 19:11:41 +00:00
paritosh-08
b8bbb8a621 server: optional query params in REST connector
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6381
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
GitOrigin-RevId: b777b373b2fbe19ceb32f812d4eaba45ef0a5a58
2022-10-21 18:40:48 +00:00
Daniel Harvey
15d90cca9f tests: use release Postgres 15 Docker image for testing
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6405
GitOrigin-RevId: 9aa65ae0f7d80fa56f5cb96cce843dcd3d5205eb
2022-10-21 18:10:33 +00:00
Samir Talwar
133a9b7452 server/tests-py: Generate random ports for helper services.
If the tests are run with specific ports assigned to specific services,
set through the environment variables, we continue to use those ports.
We just don't hard-code them now, we pick them up from the environment
variables.

However, if the environment variables are not set, we generate a random
port for each service. This allows us to run multiple tests in parallel
in the future, independently.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6218
GitOrigin-RevId: 3d2a1880bf67544c848951888ce7b4fa1ba379dc
2022-10-21 17:34:21 +00:00
Aravind K P
1aa5cbb195 cli: port metadataobject/allowlist package to use internal/errors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6396
GitOrigin-RevId: 180eaa60613985334681bd9011f910c3f3d6afb2
2022-10-21 16:57:31 +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
Aravind K P
3cec172f6f cli: port metadataobject/rest_endpoints to use internal/errors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6424
GitOrigin-RevId: 3b210e6f6b47756e7941fcb14e960674718855a1
2022-10-21 14:51:38 +00:00
Gil Mizrahi
d12827561b NDAT-207 fix unique constraints and indexes for cockroachdb
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6444
GitOrigin-RevId: 2baf2c954aeead47b82396cafe703e41e0f201a2
2022-10-21 14:03:55 +00:00
Gil Mizrahi
9c3bd2f0d0 server/postgres: fix the schema types conflict between aggregation predicates and table selection aggregates
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6452
GitOrigin-RevId: ed43442c7ade298659bdc42ff76e8e229825f0f1
2022-10-21 13:28:43 +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
hasura-bot
bbe61bff60 add italian translation for README.md
GITHUB_PR_NUMBER: 9096
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/9096

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6299
Co-authored-by: Befire <92724051+Francesca-Belfiore@users.noreply.github.com>
GitOrigin-RevId: 2a15a2e07c7101658039360830d92a998f8938bc
2022-10-21 09:57:33 +00:00
Luca Restagno
b591d68d81 Console: refactor the table Modify tab
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6419
GitOrigin-RevId: 620e37be5275e339bff2d3da6758d894f035987f
2022-10-21 09:52:06 +00:00
paritosh-08
e692c3b20d server: add IF EXISTS while dropping the constraint in source migration
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6457
GitOrigin-RevId: 1e76ca71c35cf117da7a073080df8a39e5820ddd
2022-10-21 04:44:08 +00:00
Vamshi Surabhi
a01d1188f2 scaffolding for remote-schemas module
The main aim of the PR is:

1. To set up a module structure for 'remote-schemas' package.
2. Move parts by the remote schema codebase into the new module structure to validate it.

## Notes to the reviewer

Why a PR with large-ish diff?

1. We've been making progress on the MM project but we don't yet know long it is going to take us to get to the first milestone. To understand this better, we need to figure out the unknowns as soon as possible. Hence I've taken a stab at the first two items in the [end-state](https://gist.github.com/0x777/ca2bdc4284d21c3eec153b51dea255c9) document to figure out the unknowns. Unsurprisingly, there are a bunch of issues that we haven't discussed earlier. These are documented in the 'open questions' section.

1. The diff is large but that is only code moved around and I've added a section that documents how things are moved. In addition, there are fair number of PR comments to help with the review process.

## Changes in the PR

### Module structure

Sets up the module structure as follows:

```
Hasura/
  RemoteSchema/
    Metadata/
      Types.hs
    SchemaCache/
      Types.hs
      Permission.hs
      RemoteRelationship.hs
      Build.hs
    MetadataAPI/
      Types.hs
      Execute.hs
```

### 1. Types representing metadata are moved

Types that capture metadata information (currently scattered across several RQL modules) are moved into `Hasura.RemoteSchema.Metadata.Types`.

- This new module only depends on very 'core' modules such as
  `Hasura.Session` for the notion of roles and `Hasura.Incremental` for `Cacheable` typeclass.

- The requirement on database modules is avoided by generalizing the remote schemas metadata to accept an arbitrary 'r' for a remote relationship
  definition.

### 2. SchemaCache related types and build logic have been moved

Types that represent remote schemas information in SchemaCache are moved into `Hasura.RemoteSchema.SchemaCache.Types`.

Similar to `H.RS.Metadata.Types`, this module depends on 'core' modules except for `Hasura.GraphQL.Parser.Variable`. It has something to do with remote relationships but I haven't spent time looking into it. The validation of 'remote relationships to remote schema' is also something that needs to be looked at.

Rips out the logic that builds remote schema's SchemaCache information from the monolithic `buildSchemaCacheRule` and moves it into `Hasura.RemoteSchema.SchemaCache.Build`. Further, the `.SchemaCache.Permission` and `.SchemaCache.RemoteRelationship` have been created from existing modules that capture schema cache building logic for those two components.

This was a fair amount of work. On main, currently remote schema's SchemaCache information is built in two phases - in the first phase, 'permissions' and 'remote relationships' are ignored and in the second phase they are filled in.

While remote relationships can only be resolved after partially resolving sources and other remote schemas, the same isn't true for permissions. Further, most of the work that is done to resolve remote relationships can be moved to the first phase so that the second phase can be a very simple traversal.

This is the approach that was taken - resolve permissions and as much as remote relationships information in the first phase.

### 3. Metadata APIs related types and build logic have been moved

The types that represent remote schema related metadata APIs and the execution logic have been moved to `Hasura.RemoteSchema.MetadataAPI.Types` and `.Execute` modules respectively.

## Open questions:

1. `Hasura.RemoteSchema.Metadata.Types` is so called because I was hoping that all of the metadata related APIs of remote schema can be brought in at `Hasura.RemoteSchema.Metadata.API`. However, as metadata APIs depended on functions from `SchemaCache` module (see [1](ceba6d6226/server/src-lib/Hasura/RQL/DDL/RemoteSchema.hs (L55)) and [2](ceba6d6226/server/src-lib/Hasura/RQL/DDL/RemoteSchema.hs (L91)), it made more sense to create a separate top-level module for `MetadataAPI`s.

   Maybe we can just have `Hasura.RemoteSchema.Metadata` and get rid of the extra nesting or have `Hasura.RemoteSchema.Metadata.{Core,Permission,RemoteRelationship}` if we want to break them down further.

1. `buildRemoteSchemas` in `H.RS.SchemaCache.Build` has the following type:

   ```haskell
   buildRemoteSchemas ::
     ( ArrowChoice arr,
       Inc.ArrowDistribute arr,
       ArrowWriter (Seq CollectedInfo) arr,
       Inc.ArrowCache m arr,
       MonadIO m,
       HasHttpManagerM m,
       Inc.Cacheable remoteRelationshipDefinition,
       ToJSON remoteRelationshipDefinition,
       MonadError QErr m
     ) =>
     Env.Environment ->
     ( (Inc.Dependency (HashMap RemoteSchemaName Inc.InvalidationKey), OrderedRoles),
       [RemoteSchemaMetadataG remoteRelationshipDefinition]
     )
       `arr` HashMap RemoteSchemaName (PartiallyResolvedRemoteSchemaCtxG remoteRelationshipDefinition, MetadataObject)
   ```

   Note the dependence on `CollectedInfo` which is defined as

   ```haskell
   data CollectedInfo
     = CIInconsistency InconsistentMetadata
     | CIDependency
         MetadataObject
         -- ^ for error reporting on missing dependencies
         SchemaObjId
         SchemaDependency
     deriving (Eq)
   ```

   this pretty much means that remote schemas is dependent on types from databases, actions, ....

   How do we fix this? Maybe introduce a typeclass such as `ArrowCollectRemoteSchemaDependencies` which is defined in `Hasura.RemoteSchema` and then implemented in graphql-engine?

1. The dependency on `buildSchemaCacheFor` in `.MetadataAPI.Execute` which has the following signature:

   ```haskell
   buildSchemaCacheFor ::
     (QErrM m, CacheRWM m, MetadataM m) =>
     MetadataObjId ->
     MetadataModifier ->
   ```

   This can be easily resolved if we restrict what the metadata APIs are allowed to do. Currently, they operate in an unfettered access to modify SchemaCache (the `CacheRWM` constraint):

   ```haskell
   runAddRemoteSchema ::
     ( QErrM m,
       CacheRWM m,
       MonadIO m,
       HasHttpManagerM m,
       MetadataM m,
       Tracing.MonadTrace m
     ) =>
     Env.Environment ->
     AddRemoteSchemaQuery ->
     m EncJSON
   ```

   This should instead be changed to restrict remote schema APIs to only modify remote schema metadata (but has access to the remote schemas part of the schema cache), this dependency is completely removed.

   ```haskell
   runAddRemoteSchema ::
     ( QErrM m,
       MonadIO m,
       HasHttpManagerM m,
       MonadReader RemoteSchemasSchemaCache m,
       MonadState RemoteSchemaMetadata m,
       Tracing.MonadTrace m
     ) =>
     Env.Environment ->
     AddRemoteSchemaQuery ->
     m RemoteSchemeMetadataObjId
   ```

   The idea is that the core graphql-engine would call these functions and then call
   `buildSchemaCacheFor`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6291
GitOrigin-RevId: 51357148c6404afe70219afa71bd1d59bdf4ffc6
2022-10-21 03:15:04 +00:00
hasura-bot
be0d64b5d8 Update troubleshooting.mdx adding client-side error solution
GITHUB_PR_NUMBER: 9077
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/9077

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6216
Co-authored-by: Utsav Paul <91927689+Smartmind12@users.noreply.github.com>
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
GitOrigin-RevId: 3e1c1c089bdd0755203dba859dfca85baf38d96d
2022-10-20 19:05:50 +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
Abby Sassel
639ce90c4c NDAT-164 CockroachDB 'Getting Started' Docs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6386
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
GitOrigin-RevId: 92b7fce2e63c0baab84271d74116a27187dfa270
2022-10-20 17:07:40 +00:00