-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(3010): add integration tests for dedupe (#3145)
Co-authored-by: laststylebender <[email protected]>
- Loading branch information
1 parent
47d6b0c
commit d053a88
Showing
7 changed files
with
230 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
source: tests/core/spec.rs | ||
expression: response | ||
--- | ||
{ | ||
"status": 200, | ||
"headers": { | ||
"content-type": "application/json" | ||
}, | ||
"body": { | ||
"data": { | ||
"posts": [ | ||
{ | ||
"id": 1, | ||
"userId": 1, | ||
"user": { | ||
"id": 1, | ||
"name": "user-1" | ||
}, | ||
"duplicateUser": { | ||
"id": 1, | ||
"name": "user-1" | ||
} | ||
}, | ||
{ | ||
"id": 2, | ||
"userId": 2, | ||
"user": { | ||
"id": 2, | ||
"name": "user-2" | ||
}, | ||
"duplicateUser": { | ||
"id": 2, | ||
"name": "user-2" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
source: tests/core/spec.rs | ||
expression: formatted | ||
--- | ||
type Post { | ||
body: String | ||
id: Int | ||
title: String | ||
user: User | ||
userId: Int! | ||
} | ||
|
||
type Query { | ||
posts: [Post] | ||
} | ||
|
||
type User { | ||
id: Int | ||
name: String | ||
} | ||
|
||
schema { | ||
query: Query | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
source: tests/core/spec.rs | ||
expression: formatter | ||
--- | ||
schema @server(port: 8000) @upstream(batch: {delay: 1, headers: []}) { | ||
query: Query | ||
} | ||
|
||
type Post { | ||
body: String | ||
id: Int | ||
title: String | ||
user: User | ||
@http( | ||
url: "http://jsonplaceholder.typicode.com/users" | ||
batchKey: ["id"] | ||
query: [{key: "id", value: "{{.value.userId}}"}] | ||
dedupe: true | ||
) | ||
userId: Int! | ||
} | ||
|
||
type Query { | ||
posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=1", dedupe: true) | ||
} | ||
|
||
type User { | ||
id: Int | ||
name: String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# testing dedupe functionality | ||
|
||
```graphql @config | ||
schema @server(port: 8000) @upstream(batch: {delay: 1}) { | ||
query: Query | ||
} | ||
|
||
type Query { | ||
posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=1", dedupe: true) | ||
} | ||
|
||
type Post { | ||
id: Int | ||
title: String | ||
body: String | ||
userId: Int! | ||
user: User | ||
@http( | ||
url: "http://jsonplaceholder.typicode.com/users" | ||
query: [{key: "id", value: "{{.value.userId}}"}] | ||
batchKey: ["id"] | ||
dedupe: true | ||
) | ||
} | ||
|
||
type User { | ||
id: Int | ||
name: String | ||
} | ||
``` | ||
|
||
```yml @mock | ||
- request: | ||
method: GET | ||
url: http://jsonplaceholder.typicode.com/posts?id=1 | ||
expectedHits: 1 | ||
delay: 10 | ||
response: | ||
status: 200 | ||
body: | ||
- id: 1 | ||
userId: 1 | ||
- id: 2 | ||
userId: 2 | ||
- request: | ||
method: GET | ||
url: http://jsonplaceholder.typicode.com/users?id=1&id=2 | ||
expectedHits: 1 | ||
delay: 10 | ||
response: | ||
status: 200 | ||
body: | ||
- id: 1 | ||
name: user-1 | ||
- id: 2 | ||
name: user-2 | ||
``` | ||
|
||
```yml @test | ||
- method: POST | ||
url: http://localhost:8080/graphql | ||
concurrency: 10 | ||
body: | ||
query: query { posts { id, userId user { id name } duplicateUser:user { id name } } } | ||
``` |
d053a88
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running 30s test @ http://localhost:8000/graphql
4 threads and 100 connections
756881 requests in 30.02s, 3.79GB read
Requests/sec: 25210.01
Transfer/sec: 129.39MB