-
Notifications
You must be signed in to change notification settings - Fork 25
Hive Gateway tester and testing utilities #1625
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
Changes from all commits
ee748a0
825f7da
8f1f2a9
3fe1550
c36d6b3
5de48c4
ac2c4bb
d560b9a
0959980
2d4355f
9a72245
a0bfd37
c758f4f
76f75ec
bd3d405
a00b314
b9e8871
32071c8
f26cd28
8977282
1a00156
4c85a61
aae0514
aa8eb81
f6cc854
b32b8ab
cacff36
7e6c17b
36b9ff6
c86b839
cb6291e
533f2a0
80cf1f9
23e9828
f555607
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@graphql-hive/plugin-aws-sigv4': patch | ||
| --- | ||
|
|
||
| dependencies updates: | ||
|
|
||
| - Updated dependency [`@aws-sdk/client-sts@^3.916.0` ↗︎](https://www.npmjs.com/package/@aws-sdk/client-sts/v/3.916.0) (from `^3.914.0`, in `dependencies`) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@graphql-hive/gateway-testing': major | ||
| --- | ||
|
|
||
| Hive Gateway tester and testing utilities |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,7 @@ | ||
| import { buildSubgraphSchema } from '@apollo/subgraph'; | ||
| import { createInlineSigningKeyProvider, useJWT } from '@graphql-hive/gateway'; | ||
| import { | ||
| createGatewayRuntime, | ||
| useCustomFetch, | ||
| } from '@graphql-hive/gateway-runtime'; | ||
| import { composeLocalSchemasWithApollo } from '@internal/testing'; | ||
| import { createGatewayTester } from '@graphql-hive/gateway-testing'; | ||
| import { parse } from 'graphql'; | ||
| import { createYoga } from 'graphql-yoga'; | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { useAWSSigv4 } from '../src'; | ||
|
|
||
|
|
@@ -23,18 +18,14 @@ describe('AWS Sigv4 Incoming requests', () => { | |
| }, | ||
| }, | ||
| }); | ||
| const subgraphServer = createYoga({ | ||
| schema: subgraphSchema, | ||
| }); | ||
| it('validates incoming requests', async () => { | ||
| await using gw = createGatewayRuntime({ | ||
| supergraph: composeLocalSchemasWithApollo([ | ||
| await using gw = createGatewayTester({ | ||
| subgraphs: [ | ||
| { | ||
| name: 'subgraph', | ||
| schema: subgraphSchema, | ||
| url: 'http://localhost:4000/graphql', | ||
| }, | ||
| ]), | ||
| ], | ||
| landingPage: false, | ||
| graphqlEndpoint: '/', | ||
| plugins: () => [ | ||
|
|
@@ -43,10 +34,6 @@ describe('AWS Sigv4 Incoming requests', () => { | |
| secretAccessKey: () => 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY', | ||
| }, | ||
| }), | ||
| useCustomFetch( | ||
| // @ts-expect-error - MeshFetch is not compatible with Yoga.fetch | ||
| subgraphServer.fetch, | ||
| ), | ||
| ], | ||
| }); | ||
| const response = await gw.fetch( | ||
|
|
@@ -59,7 +46,7 @@ describe('AWS Sigv4 Incoming requests', () => { | |
| Date: 'Mon, 29 Dec 2015 00:00:00 GMT', | ||
| 'content-type': 'application/json', | ||
| Host: 'sigv4examplegraphqlbucket.s3-eu-central-1.amazonaws.com', | ||
| 'Content-Length': 30, | ||
| 'Content-Length': '30', | ||
| 'X-Amz-Content-Sha256': | ||
| '34c77dc7b593717e0231ac99a16ae3be5ee2e8d652bce6518738a6449dfd2647', | ||
| 'X-Amz-Date': '20151229T000000Z', | ||
|
|
@@ -82,14 +69,13 @@ describe('AWS Sigv4 Incoming requests', () => { | |
| }); | ||
| it('works with JWT', async () => { | ||
| const JWT_SECRET = 'a-string-secret-at-least-256-bits-long'; | ||
| await using gw = createGatewayRuntime({ | ||
| supergraph: composeLocalSchemasWithApollo([ | ||
| await using gw = createGatewayTester({ | ||
| subgraphs: [ | ||
| { | ||
| name: 'subgraph', | ||
| schema: subgraphSchema, | ||
| url: 'http://localhost:4000/graphql', | ||
| }, | ||
| ]), | ||
| ], | ||
| landingPage: false, | ||
| graphqlEndpoint: '/', | ||
| plugins: () => [ | ||
|
|
@@ -108,10 +94,6 @@ describe('AWS Sigv4 Incoming requests', () => { | |
| secretAccessKey: () => 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY', | ||
| }, | ||
| }), | ||
| useCustomFetch( | ||
| // @ts-expect-error - MeshFetch is not compatible with Yoga.fetch | ||
| subgraphServer.fetch, | ||
| ), | ||
| ], | ||
| }); | ||
|
|
||
|
|
@@ -125,7 +107,7 @@ describe('AWS Sigv4 Incoming requests', () => { | |
| Date: 'Mon, 29 Dec 2015 00:00:00 GMT', | ||
| 'content-type': 'application/json', | ||
| Host: 'sigv4examplegraphqlbucket.s3-eu-central-1.amazonaws.com', | ||
| 'Content-Length': 30, | ||
| 'Content-Length': '30', | ||
|
||
| 'X-Amz-Content-Sha256': | ||
| '34c77dc7b593717e0231ac99a16ae3be5ee2e8d652bce6518738a6449dfd2647', | ||
| 'X-Amz-Date': '20151229T000000Z', | ||
|
|
||
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.
The Content-Length header value has been changed from a number (30) to a string ('30'). This may indicate a breaking change in how headers are handled. Verify that the gateway and AWS SigV4 signing logic correctly handle Content-Length as a string, as HTTP headers are typically strings but the signature calculation might expect specific formatting.