graphql-engine/server/tests-py/queries/v1/metadata/pg_source_namespace_query.yaml
Antoine Leblanc e3d5c0217f Rename tables in metadata tests to avoid conflicts.
### 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
2021-11-26 11:40:23 +00:00

114 lines
2.1 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
type_names:
prefix: foo_
- 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: foo_my_source_query
author_local:
- id: 1
name: 'Author 1'
__typename: foo_author_local
- id: 2
name: 'Author 2'
__typename: foo_author_local
query:
query: |
query {
my_source {
__typename
author_local {
id
name
__typename
}
}
}
- 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