graphql-engine/server/tests-py/queries/query_cache/setup.yaml
Samir Talwar 1e1a36a192 server/tests-py: Use environment variables for services in queries.
I'm trying to shore up the Python integration tests to make them more reliable. In doing so, I noticed this.

---

Rather than hard-coding hostnames and ports, we can (and already do) inject these into the HGE process using environment variables.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5255
GitOrigin-RevId: 6bb593999ece42cedef6619f31f9d9b2e39f30ef
2022-08-03 20:05:46 +00:00

82 lines
1.8 KiB
YAML

type: bulk
args:
- type: create_query_collection
args:
name: test_collection
definition:
queries:
- name: simple_query_cached
query: "query @cached(ttl: 5) { test_table { first_name last_name } }"
- type: run_sql
args:
sql: |
create table test_table(
first_name text,
last_name text
);
- type: track_table
args:
schema: public
name: test_table
- type: create_select_permission
args:
table: test_table
role: user
permission:
columns: '*'
filter: {"first_name": "X-Hasura-User-Id"}
- type: run_sql
args:
sql: |
insert into test_table (first_name, last_name)
values
('Foo', 'Bar'),
('Baz', 'Qux'),
('X%20Y', 'Test');
- type: run_sql
args:
sql: |
CREATE TABLE "user"(
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
email TEXT NOT NULL
);
INSERT INTO "user" (name, email) VALUES ('Clarke 1', 'clarke1@gmail.com');
INSERT INTO "user" (name, email) VALUES ('Clarke 2', 'clarke2@gmail.com');
- type: set_custom_types
args:
objects:
- name: EmailResponse
fields:
- name: user
type: String!
- type: create_action
args:
name: get_user_by_email_1 # this action is being created with forward_client_headers set to `true`
definition:
type: query
arguments:
- name: email
type: String!
output_type: EmailResponse
handler: "{{ACTION_WEBHOOK_HANDLER}}/get-user-by-email"
forward_client_headers: true
- type: create_action
args:
name: get_user_by_email_2 # this action is being created with forward_client_headers set to `false`
definition:
type: query
arguments:
- name: email
type: String!
output_type: EmailResponse
handler: "{{ACTION_WEBHOOK_HANDLER}}/get-user-by-email"