Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New partition test to cover edge case #498

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ class `batching-of-hydration-list-with-partition` : EngineTestHook {
}
}

@UseHook
class `new-batching-of-hydration-list-with-partition-2` : EngineTestHook {
override fun makeNadel(builder: Nadel.Builder): Nadel.Builder {
return builder.executionHooks(BatchHydrationHooks())
}
}

@UseHook
class `index-hydration-with-partitioned-inputs` : EngineTestHook {
override fun makeExecutionHints(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
name: "new batching of hydration list with partition 2"
enabled: true
overallSchema:
# language=GraphQL
UserService: |
type Query {
usersByIds(id: [ID]): [User]
}
type User {
id: ID
}
# language=GraphQL
Issues: |
type Query {
issues: [Issue]
}
type Issue {
id: ID
authors: [User]
@hydrated(
service: "UserService"
field: "usersByIds"
arguments: [{name: "id" value: "$source.authorIds"}]
identifiedBy: "id"
batchSize: 90
)
}
underlyingSchema:
# language=GraphQL
UserService: |
type Query {
usersByIds(id: [ID]): [User]
}

type User {
id: ID
}
# language=GraphQL
Issues: |
type Issue {
authorIds: [ID]
id: ID
}

type Query {
issues: [Issue]
}
# language=GraphQL
query: |
query {
issues {
id
authors {
id
}
}
}
variables: { }
serviceCalls:
- serviceName: "Issues"
request:
# language=GraphQL
query: |
query {
issues {
__typename__batch_hydration__authors: __typename
batch_hydration__authors__authorIds: authorIds
id
}
}
variables: { }
# language=JSON
response: |-
{
"data": {
"issues": [
{
"__typename__batch_hydration__authors": "Issue",
"batch_hydration__authors__authorIds": [
"site-1/user-1",
"site-2/user-2"
],
"id": "issue-1"
},
{
"__typename__batch_hydration__authors": "Issue",
"batch_hydration__authors__authorIds": [
],
"id": "issue-2"
},
{
"__typename__batch_hydration__authors": "Issue",
"batch_hydration__authors__authorIds": [
"site-2/user-4"
],
"id": "issue-3"
}
]
},
"extensions": {}
}
- serviceName: "UserService"
request:
# language=GraphQL
query: |
query {
usersByIds(id: ["site-1/user-1"]) {
id
batch_hydration__authors__id: id
}
}
variables: { }
# language=JSON
response: |-
{
"data": {
"usersByIds": [
{
"id": "site-1/user-1",
"batch_hydration__authors__id": "site-1/user-1"
}
]
},
"extensions": {}
}
- serviceName: "UserService"
request:
# language=GraphQL
query: |
query {
usersByIds(id: ["site-2/user-2", "site-2/user-4"]) {
id
batch_hydration__authors__id: id
}
}
variables: { }
# language=JSON
response: |-
{
"data": {
"usersByIds": [
{
"id": "site-2/user-2",
"batch_hydration__authors__id": "site-2/user-2"
},
{
"id": "site-2/user-4",
"batch_hydration__authors__id": "site-2/user-4"
}
]
},
"extensions": {}
}
# language=JSON
response: |-
{
"data": {
"issues": [
{
"id": "issue-1",
"authors": [
{
"id": "site-1/user-1"
},
{
"id": "site-2/user-2"
}
]
},
{
"id": "issue-2",
"authors": [
]
},
{
"id": "issue-3",
"authors": [
{
"id": "site-2/user-4"
}
]
}
]
},
"extensions": {}
}
Loading