graphql-engine/server/tests-py/queries/naming_conventions/default_global_naming_convention.yaml
Samir Talwar 204ec89c61 server/tests-py: Get all tests passing with separate HGE binaries.
This rewrites the last couple of Python tests that were failing when run with a separate HGE binary per test class. The changes are as follows:

1. The event triggers tests, naming conventions tests, and subscriptions tests all generate a new source DB per test, so can run in parallel.
2. The scheduled triggers tests use the correct URL for the trigger service when the port is generated randomly.
3. Whitespace and trailing commas are added to the scheduled triggers tests.
4. Support for SQL Server is added to _hge.py_ so the naming conventions test that runs on SQL Server passes. (The other SQL Server tests do not pass and we're not going to bother with them for now.)
5. Container names are fixed in _run.sh_.
6. _run.sh_ and _run-new.sh_ don't pull images explicitly as it's annoying when running tests a lot. If you want to pull the latest versions, just run `docker compose pull` from the _server/tests-py_ directory, or the root directory. (If you don't have the images at all, they'll still be pulled automatically.)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7350
GitOrigin-RevId: db58f310f017b2a0884fcf61ccc56d15583f99bd
2022-12-21 15:56:41 +00:00

181 lines
3.4 KiB
YAML

- description: create table 1
url: /v1/query
status: 200
response:
result_type: CommandOk
result:
query:
type: run_sql
args:
source: pg1
sql: |
create table author_local(
author_id serial primary key,
name text unique
);
INSERT INTO author_local (name)
VALUES ('Author 1'), ('Author 2');
- description: track table
url: /v1/metadata
status: 200
response:
message: success
query:
type: pg_track_table
args:
table: author_local
source: pg1
- description: Simple GraphQL query to fetch items from the source table
url: /v1/graphql
status: 200
response:
data:
authorLocal:
- authorId: 1
name: "Author 1"
__typename: AuthorLocal
- authorId: 2
name: "Author 2"
__typename: AuthorLocal
query:
query: |
query {
authorLocal {
authorId
name
__typename
}
}
- description: Simple GraphQL query with field aliases to fetch items from the source table
url: /v1/graphql
status: 200
response:
data:
a:
- b: 1
c: "Author 1"
d: AuthorLocal
- b: 2
c: "Author 2"
d: AuthorLocal
query:
query: |
query {
a: authorLocal {
b: authorId
c: name
d: __typename
}
}
- description: Lookup by pk
url: /v1/graphql
status: 200
response:
data:
authorLocalByPk:
authorId: 1
name: "Author 1"
__typename: AuthorLocal
query:
query: |
query {
authorLocalByPk(authorId: 1) {
authorId
name
__typename
}
}
- description: Aggregate
url: /v1/graphql
status: 200
response:
data:
authorLocalAggregate:
__typename: AuthorLocalAggregate
aggregate:
__typename: AuthorLocalAggregateFields
count: 1
query:
query: |
query MyQuery {
authorLocalAggregate(where: {name: {_eq: "Author 2"}}) {
__typename
aggregate {
__typename
count
}
}
}
- description: Insert
url: /v1/graphql
status: 200
response:
data:
insertAuthorLocal:
__typename: AuthorLocalMutationResponse
returning:
- __typename: AuthorLocal
authorId: 3
name: Author 3
query:
query: |
mutation MyMutation {
insertAuthorLocal(objects: {name: "Author 3", authorId: 3}) {
__typename
returning {
__typename
authorId
name
}
}
}
- description: Delete by pk
url: /v1/graphql
status: 200
response:
data:
deleteAuthorLocalByPk:
__typename: AuthorLocal
authorId: 3
name: Author 3
query:
query: |
mutation MyMutation {
deleteAuthorLocalByPk(authorId: 3) {
__typename
authorId
name
}
}
- description: untrack table
url: /v1/metadata
status: 200
response:
message: success
query:
type: pg_untrack_table
args:
table: author_local
source: pg1
- description: drop table
url: /v1/query
status: 200
response:
result_type: CommandOk
result:
query:
type: run_sql
args:
source: pg1
sql: |
drop table author_local;