server: Add regression tests for hasura/graphql-engine#7172

In hasura/graphql-engine#7172, an issue was found where under certain conditions a JSON field from Postgres would be parsed as a GraphQL input object, which is not possible in general, and also unnecessary. Luckily, this was already fixed by the time `v2.0.6` got around, presumably thanks to 4a83bb1834. This adds a regression test.

https://github.com/hasura/graphql-engine-mono/pull/2158

GitOrigin-RevId: 1ded1456f6b89726e08f77cf3383ad88c04de451
This commit is contained in:
Auke Booij 2021-08-25 23:05:00 +02:00 committed by hasura-bot
parent 52aaf2751a
commit 88aa42a986
5 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,20 @@
description: Regression test for hasura/graphql-engine#7172
url: /v1/graphql
status: 200
response:
data:
regression_7172:
- features:
"Start Color": 44
project:
id: 1
query:
query: |
query {
regression_7172 {
features
project {
id
}
}
}

View File

@ -54,6 +54,11 @@ args:
returns integer as $$
select student_row.physics + student_row.maths - (hasura_session ->> 'x-hasura-offset')::integer
$$ language sql stable;
create table regression_7172 (
id serial primary key,
features json
);
insert into regression_7172 (features) values ('{"Start Color":44}');
- type: track_table
args:
@ -106,3 +111,8 @@ args:
function: total_marks_session
table_argument: student_row
session_argument: hasura_session
- type: track_table
args:
schema: public
name: regression_7172

View File

@ -0,0 +1,11 @@
type: create_remote_relationship
args:
name: project
table: regression_7172
hasura_fields:
- id
remote_schema: my-remote-schema
remote_field:
message:
arguments:
id: "$id"

View File

@ -11,6 +11,7 @@ args:
drop function if exists total_marks_offset(students, integer);
drop function if exists total_marks_session(students, json);
drop table if exists students;
drop table if exists regression_7172;
# also drops remote relationship as direct dep
- type: remove_remote_schema

View File

@ -186,6 +186,11 @@ class TestExecution:
assert st_code == 200, resp
check_query_f(hge_ctx, self.dir() + 'query_with_arr_rel.yaml')
def test_regression_7172(self, hge_ctx):
st_code, resp = hge_ctx.v1q_f(self.dir() + 'setup_regression_7172.yaml')
assert st_code == 200, resp
check_query_f(hge_ctx, self.dir() + 'regression_7172.yaml')
def test_basic_relationship_joining_singleton_to_array(self, hge_ctx):
st_code, resp = hge_ctx.v1q_f(self.dir() + 'setup_remote_rel_joining_singleton_with_array.yaml')
assert st_code == 200, resp