mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-23 23:43:44 +03:00
e3d5c0217f
### Description Tests are not run the same way locally and on CI, which means that tests that work on CI can fail locally. In this case, the setup for each test is creating and dropping a table named `author`; a lot of the tests were also creating a table named `author` in source `pg1`. If `pg1` is the same as the default source, which is the case locally, then all of those tests fail, while the tests that use a default `pg1` such as CI would succeed. This PR fixes this by renaming `author` to `author_local` where appropriate. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2982 GitOrigin-RevId: 5bc0149bc5f6cb27de9864afaded8af071ade454
241 lines
4.8 KiB
YAML
241 lines
4.8 KiB
YAML
- description: PG add source
|
|
url: /v1/metadata
|
|
status: 200
|
|
response:
|
|
message: success
|
|
query:
|
|
type: pg_add_source
|
|
args:
|
|
name: pg1
|
|
configuration:
|
|
connection_info:
|
|
database_url:
|
|
from_env: HASURA_GRAPHQL_PG_SOURCE_URL_1
|
|
pool_settings:
|
|
max_connections: 50
|
|
idle_timeout: 180
|
|
retries:
|
|
customization:
|
|
root_fields:
|
|
namespace: my_source
|
|
prefix: fpref_
|
|
suffix: _fsuff
|
|
type_names:
|
|
prefix: tpref_
|
|
suffix: _tsuff
|
|
|
|
- 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(
|
|
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:
|
|
my_source:
|
|
__typename: tpref_my_source_query_tsuff
|
|
fpref_author_local_fsuff:
|
|
- id: 1
|
|
name: 'Author 1'
|
|
__typename: tpref_author_local_tsuff
|
|
- id: 2
|
|
name: 'Author 2'
|
|
__typename: tpref_author_local_tsuff
|
|
query:
|
|
query: |
|
|
query {
|
|
my_source {
|
|
__typename
|
|
fpref_author_local_fsuff {
|
|
id
|
|
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: tpref_my_source_query_tsuff
|
|
c:
|
|
- d: 1
|
|
e: 'Author 1'
|
|
f: tpref_author_local_tsuff
|
|
- d: 2
|
|
e: 'Author 2'
|
|
f: tpref_author_local_tsuff
|
|
query:
|
|
query: |
|
|
query {
|
|
a: my_source {
|
|
b: __typename
|
|
c: fpref_author_local_fsuff {
|
|
d: id
|
|
e: name
|
|
f: __typename
|
|
}
|
|
}
|
|
}
|
|
|
|
- description: Lookup by pk
|
|
url: /v1/graphql
|
|
status: 200
|
|
response:
|
|
data:
|
|
my_source:
|
|
fpref_author_local_by_pk_fsuff:
|
|
id: 1
|
|
name: 'Author 1'
|
|
__typename: tpref_author_local_tsuff
|
|
query:
|
|
query: |
|
|
query {
|
|
my_source {
|
|
fpref_author_local_by_pk_fsuff(id: 1) {
|
|
id
|
|
name
|
|
__typename
|
|
}
|
|
}
|
|
}
|
|
|
|
- description: Aggregate
|
|
url: /v1/graphql
|
|
status: 200
|
|
response:
|
|
data:
|
|
my_source:
|
|
fpref_author_local_aggregate_fsuff:
|
|
__typename: tpref_author_local_aggregate_tsuff
|
|
aggregate:
|
|
__typename: tpref_author_local_aggregate_fields_tsuff
|
|
count: 1
|
|
query:
|
|
query: |
|
|
query MyQuery {
|
|
my_source {
|
|
fpref_author_local_aggregate_fsuff(where: {name: {_eq: "Author 2"}}) {
|
|
__typename
|
|
aggregate {
|
|
__typename
|
|
count
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
- description: Insert
|
|
url: /v1/graphql
|
|
status: 200
|
|
response:
|
|
data:
|
|
my_source:
|
|
fpref_insert_author_local_fsuff:
|
|
__typename: tpref_author_local_mutation_response_tsuff
|
|
returning:
|
|
- __typename: tpref_author_local_tsuff
|
|
id: 3
|
|
name: Author 3
|
|
query:
|
|
query: |
|
|
mutation MyMutation {
|
|
my_source {
|
|
fpref_insert_author_local_fsuff(objects: {name: "Author 3", id: 3}) {
|
|
__typename
|
|
returning {
|
|
__typename
|
|
id
|
|
name
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- description: Delete by pk
|
|
url: /v1/graphql
|
|
status: 200
|
|
response:
|
|
data:
|
|
my_source:
|
|
fpref_delete_author_local_by_pk_fsuff:
|
|
__typename: tpref_author_local_tsuff
|
|
id: 3
|
|
name: Author 3
|
|
query:
|
|
query: |
|
|
mutation MyMutation {
|
|
my_source {
|
|
fpref_delete_author_local_by_pk_fsuff(id: 3) {
|
|
__typename
|
|
id
|
|
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;
|
|
|
|
- description: PG Drop Source 1
|
|
url: /v1/metadata
|
|
status: 200
|
|
response:
|
|
message: success
|
|
query:
|
|
type: pg_drop_source
|
|
args:
|
|
name: pg1
|