Skip to content

Commit

Permalink
fixed graph sql sharded
Browse files Browse the repository at this point in the history
  • Loading branch information
kofoworola committed Nov 6, 2023
1 parent 24e1479 commit 7e2bc77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 51 deletions.
47 changes: 0 additions & 47 deletions pumps/graph_mongo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ X-Ratelimit-Reset: 0
{"data":{"country":null}}`

const rawGQLResponseWithError = `HTTP/0.0 200 OK
Content-Length: 61
Connection: close
Content-Type: application/json
X-Ratelimit-Limit: 0
X-Ratelimit-Remaining: 0
X-Ratelimit-Reset: 0
{"data":{"country":null},"errors":[{"message":"test error"}]}`

const schema = `type Query {
countries(filter: CountryFilterInput): [Country!]!
country(code: ID!): Country
Expand Down Expand Up @@ -106,43 +96,6 @@ input LanguageFilterInput {
code: StringQueryOperatorInput
}`

const rawHTTPReq = `GET /get HTTP/1.1
Host: localhost:8181
User-Agent: PostmanRuntime/7.29.2
Accept: */*
Accept-Encoding: gzip, deflate, br
Postman-Token: a67c3054-aa1a-47f3-9bca-5dbde04c8565
`

const rawHTTPResponse = `
HTTP/1.1 200 OK
Content-Length: 376
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Connection: close
Content-Type: application/json
Date: Tue, 04 Oct 2022 06:33:23 GMT
Server: gunicorn/19.9.0
X-Ratelimit-Limit: 0
X-Ratelimit-Remaining: 0
X-Ratelimit-Reset: 0
{
"args": {},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, br",
"Host": "httpbin.org",
"Postman-Token": "a67c3054-aa1a-47f3-9bca-5dbde04c8565",
"User-Agent": "PostmanRuntime/7.29.2",
"X-Amzn-Trace-Id": "Root=1-633bd3b3-6345504724f3295b68d7dcd3"
},
"origin": "::1, 102.89.45.253",
"url": "http://httpbin.org/get"
}
`

func TestGraphMongoPump_WriteData(t *testing.T) {
conf := defaultConf()
pump := GraphMongoPump{
Expand Down
13 changes: 9 additions & 4 deletions pumps/graph_sql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,18 @@ func TestGraphSQLPump_Sharded(t *testing.T) {
baseRecord := analytics.AnalyticsRecord{
APIID: "test-api",
Path: "/test-api",
RawRequest: convToBase64(rawGQLRequest),
RawResponse: convToBase64(rawGQLResponse),
ApiSchema: convToBase64(schema),
Tags: []string{analytics.PredefinedTagGraphAnalytics},
APIName: "test-api",
ResponseCode: 200,
Method: "POST",
GraphQLStats: analytics.GraphQLStats{
IsGraphQL: true,
Types: map[string][]string{
"Country": {"code"},
},
RootFields: []string{"country"},
OperationType: analytics.OperationQuery,
HasErrors: false,
},
}

expectedTables := make([]string, 0)
Expand Down

0 comments on commit 7e2bc77

Please sign in to comment.