Skip to content

Commit

Permalink
updated runner test snapshots to include GetStatus call
Browse files Browse the repository at this point in the history
  • Loading branch information
gabehamilton committed Aug 16, 2023
1 parent 369c4cd commit 5e3a317
Showing 1 changed file with 57 additions and 5 deletions.
62 changes: 57 additions & 5 deletions runner/src/indexer/__snapshots__/indexer.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ exports[`Indexer unit tests Indexer.runFunctions() allows imperative execution o
[
"mock-hasura-endpoint/v1/graphql",
{
"body": "{"query":"mutation writeLog($function_name: String!, $block_height: numeric!, $message: String!){\\n insert_indexer_log_entries_one(object: {function_name: $function_name, block_height: $block_height, message: $message}) {id}\\n }","variables":{"function_name":"buildnear.testnet/test","block_height":82699904,"message":"Running function buildnear.testnet/test, lag is: NaNms from block timestamp"}}",
"body": "{"query":"\\n query GetStatus($function_name: String) {\\n indexer_state(where: {function_name: {_eq: $function_name}}) {\\n status\\n }\\n }\\n ","variables":{"function_name":"buildnear.testnet/test"}}",
"headers": {
"Content-Type": "application/json",
"X-Hasura-Admin-Secret": "mock-hasura-secret",
Expand All @@ -33,7 +33,7 @@ exports[`Indexer unit tests Indexer.runFunctions() allows imperative execution o
[
"mock-hasura-endpoint/v1/graphql",
{
"body": "{"query":"\\n mutation SetStatus($function_name: String, $status: String) {\\n insert_indexer_state_one(object: {function_name: $function_name, status: $status, current_block_height: 0 }, on_conflict: { constraint: indexer_state_pkey, update_columns: status }) {\\n function_name\\n status\\n }\\n }\\n ","variables":{"function_name":"buildnear.testnet/test","status":"RUNNING"}}",
"body": "{"query":"mutation writeLog($function_name: String!, $block_height: numeric!, $message: String!){\\n insert_indexer_log_entries_one(object: {function_name: $function_name, block_height: $block_height, message: $message}) {id}\\n }","variables":{"function_name":"buildnear.testnet/test","block_height":82699904,"message":"Running function buildnear.testnet/test, lag is: NaNms from block timestamp"}}",
"headers": {
"Content-Type": "application/json",
"X-Hasura-Admin-Secret": "mock-hasura-secret",
Expand All @@ -46,11 +46,11 @@ exports[`Indexer unit tests Indexer.runFunctions() allows imperative execution o
[
"mock-hasura-endpoint/v1/graphql",
{
"body": "{"query":"\\n query {\\n posts(where: { id: { _eq: 1 } }) {\\n id\\n }\\n }\\n "}",
"body": "{"query":"\\n mutation SetStatus($function_name: String, $status: String) {\\n insert_indexer_state_one(object: {function_name: $function_name, status: $status, current_block_height: 0 }, on_conflict: { constraint: indexer_state_pkey, update_columns: status }) {\\n function_name\\n status\\n }\\n }\\n ","variables":{"function_name":"buildnear.testnet/test","status":"RUNNING"}}",
"headers": {
"Content-Type": "application/json",
"X-Hasura-Admin-Secret": "mock-hasura-secret",
"X-Hasura-Role": "buildnear_testnet",
"X-Hasura-Role": "append",
"X-Hasura-Use-Backend-Only-Permissions": "true",
},
"method": "POST",
Expand All @@ -59,7 +59,7 @@ exports[`Indexer unit tests Indexer.runFunctions() allows imperative execution o
[
"mock-hasura-endpoint/v1/graphql",
{
"body": "{"query":"\\n mutation {\\n insert_comments(\\n objects: {account_id: \\"morgs.near\\", block_height: 82699904, content: \\"cool post\\", post_id: 1}\\n ) {\\n returning {\\n id\\n }\\n }\\n }\\n "}",
"body": "{"query":"\\n query {\\n posts(where: { id: { _eq: 1 } }) {\\n id\\n }\\n }\\n "}",
"headers": {
"Content-Type": "application/json",
"X-Hasura-Admin-Secret": "mock-hasura-secret",
Expand Down Expand Up @@ -87,6 +87,19 @@ exports[`Indexer unit tests Indexer.runFunctions() allows imperative execution o

exports[`Indexer unit tests Indexer.runFunctions() catches errors 1`] = `
[
[
"mock-hasura-endpoint/v1/graphql",
{
"body": "{"query":"\\n query GetStatus($function_name: String) {\\n indexer_state(where: {function_name: {_eq: $function_name}}) {\\n status\\n }\\n }\\n ","variables":{"function_name":"buildnear.testnet/test"}}",
"headers": {
"Content-Type": "application/json",
"X-Hasura-Admin-Secret": "mock-hasura-secret",
"X-Hasura-Role": "append",
"X-Hasura-Use-Backend-Only-Permissions": "true",
},
"method": "POST",
},
],
[
"mock-hasura-endpoint/v1/graphql",
{
Expand Down Expand Up @@ -144,6 +157,19 @@ exports[`Indexer unit tests Indexer.runFunctions() catches errors 1`] = `

exports[`Indexer unit tests Indexer.runFunctions() logs provisioning failures 1`] = `
[
[
"mock-hasura-endpoint/v1/graphql",
{
"body": "{"query":"\\n query GetStatus($function_name: String) {\\n indexer_state(where: {function_name: {_eq: $function_name}}) {\\n status\\n }\\n }\\n ","variables":{"function_name":"morgs.near/test"}}",
"headers": {
"Content-Type": "application/json",
"X-Hasura-Admin-Secret": "mock-hasura-secret",
"X-Hasura-Role": "append",
"X-Hasura-Use-Backend-Only-Permissions": "true",
},
"method": "POST",
},
],
[
"mock-hasura-endpoint/v1/graphql",
{
Expand Down Expand Up @@ -214,6 +240,19 @@ exports[`Indexer unit tests Indexer.runFunctions() logs provisioning failures 1`

exports[`Indexer unit tests Indexer.runFunctions() should execute all functions against the current block 1`] = `
[
[
"mock-hasura-endpoint/v1/graphql",
{
"body": "{"query":"\\n query GetStatus($function_name: String) {\\n indexer_state(where: {function_name: {_eq: $function_name}}) {\\n status\\n }\\n }\\n ","variables":{"function_name":"buildnear.testnet/test"}}",
"headers": {
"Content-Type": "application/json",
"X-Hasura-Admin-Secret": "mock-hasura-secret",
"X-Hasura-Role": "append",
"X-Hasura-Use-Backend-Only-Permissions": "true",
},
"method": "POST",
},
],
[
"mock-hasura-endpoint/v1/graphql",
{
Expand Down Expand Up @@ -271,6 +310,19 @@ exports[`Indexer unit tests Indexer.runFunctions() should execute all functions

exports[`Indexer unit tests Indexer.runFunctions() supplies the required role to the GraphQL endpoint 1`] = `
[
[
"mock-hasura-endpoint/v1/graphql",
{
"body": "{"query":"\\n query GetStatus($function_name: String) {\\n indexer_state(where: {function_name: {_eq: $function_name}}) {\\n status\\n }\\n }\\n ","variables":{"function_name":"morgs.near/test"}}",
"headers": {
"Content-Type": "application/json",
"X-Hasura-Admin-Secret": "mock-hasura-secret",
"X-Hasura-Role": "append",
"X-Hasura-Use-Backend-Only-Permissions": "true",
},
"method": "POST",
},
],
[
"mock-hasura-endpoint/v1/graphql",
{
Expand Down

0 comments on commit 5e3a317

Please sign in to comment.