CLI: Add test coverage for stored procedures.

This asserts that reading and writing metadata does not modify the stored procedures. We do not provide any support for working with them; this just ensures we do not accidentally corrupt them.

[NDAT-640]: https://hasurahq.atlassian.net/browse/NDAT-640?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9081
GitOrigin-RevId: 7c9b31f060325cbdffd8803ea085d4957dc1c680
This commit is contained in:
Samir Talwar 2023-05-08 16:45:04 +02:00 committed by hasura-bot
parent 7e2e5190b4
commit f42f1111cc
4 changed files with 132 additions and 14 deletions

View File

@ -51,6 +51,14 @@
- question
filter: {}
role: user
- name: nonsense
fields:
something:
nullable: false
type: integer
something_else:
nullable: false
type: text
native_queries:
- arguments:
unused:
@ -60,6 +68,21 @@
code: select question, answer, added_by_user_id from questions
returns: quiz_answer
root_field_name: quiz_answers
stored_procedures:
- stored_procedure:
schema: public
name: swap
configuration:
custom_name: swap_it
exposed_as: query
arguments:
one:
nullable: false
type: text
two:
nullable: false
type: integer
returns: nonsense
tables: !include "s1/tables/tables.yaml"
functions: !include "s1/functions/functions.yaml"
- name: s2

View File

@ -79,6 +79,19 @@
"role": "user"
}
]
},
{
"name": "nonsense",
"fields": {
"something": {
"nullable": false,
"type": "integer"
},
"something_else": {
"nullable": false,
"type": "text"
}
}
}
],
"native_queries": [
@ -95,6 +108,29 @@
"root_field_name": "quiz_answers"
}
],
"stored_procedures": [
{
"stored_procedure": {
"schema": "public",
"name": "swap"
},
"configuration": {
"custom_name": "swap_it",
"exposed_as": "query"
},
"arguments": {
"one": {
"nullable": false,
"type": "text"
},
"two": {
"nullable": false,
"type": "integer"
}
},
"returns": "nonsense"
}
],
"tables": [
{
"table": {

View File

@ -81,20 +81,6 @@
}
}
],
"native_queries": [
{
"arguments": {
"unused": {
"description": "An integer argument that we completely ignore",
"nullable": true,
"type": "integer"
}
},
"code": "select question, answer, added_by_user_id from questions",
"returns": "quiz_answer",
"root_field_name": "quiz_answers"
}
],
"logical_models": [
{
"name": "quiz_answer",
@ -137,6 +123,56 @@
"role": "user"
}
]
},
{
"name": "nonsense",
"fields": {
"something": {
"nullable": false,
"type": "integer"
},
"something_else": {
"nullable": false,
"type": "text"
}
}
}
],
"native_queries": [
{
"arguments": {
"unused": {
"description": "An integer argument that we completely ignore",
"nullable": true,
"type": "integer"
}
},
"code": "select question, answer, added_by_user_id from questions",
"returns": "quiz_answer",
"root_field_name": "quiz_answers"
}
],
"stored_procedures": [
{
"stored_procedure": {
"schema": "public",
"name": "swap"
},
"configuration": {
"custom_name": "swap_it",
"exposed_as": "query"
},
"arguments": {
"one": {
"nullable": false,
"type": "text"
},
"two": {
"nullable": false,
"type": "integer"
}
},
"returns": "nonsense"
}
],
"configuration": {

View File

@ -51,6 +51,14 @@
- question
filter: {}
role: user
- name: nonsense
fields:
something:
nullable: false
type: integer
something_else:
nullable: false
type: text
native_queries:
- arguments:
unused:
@ -60,6 +68,21 @@
code: select question, answer, added_by_user_id from questions
returns: quiz_answer
root_field_name: quiz_answers
stored_procedures:
- stored_procedure:
schema: public
name: swap
configuration:
custom_name: swap_it
exposed_as: query
arguments:
one:
nullable: false
type: text
two:
nullable: false
type: integer
returns: nonsense
tables: "!include default/tables/tables.yaml"
functions: "!include default/functions/functions.yaml"
- name: bg