|
1 | 1 | import { ProjectType } from 'testkit/gql/graphql';
|
2 | 2 | import { history } from '../../../testkit/external-composition';
|
3 |
| -import { enableExternalSchemaComposition } from '../../../testkit/flow'; |
| 3 | +import { updateSchemaComposition } from '../../../testkit/flow'; |
4 | 4 | import { initSeed } from '../../../testkit/seed';
|
5 | 5 | import { generateUnique, getServiceHost } from '../../../testkit/utils';
|
6 | 6 |
|
@@ -43,19 +43,20 @@ test.concurrent('call an external service to compose and validate services', asy
|
43 | 43 | // so we need to use the name and not resolved host
|
44 | 44 | const dockerAddress = await getServiceHost('external_composition', 3012, false);
|
45 | 45 | // enable external composition
|
46 |
| - const externalCompositionResult = await enableExternalSchemaComposition( |
| 46 | + const externalCompositionResult = await updateSchemaComposition( |
47 | 47 | {
|
48 |
| - endpoint: `http://${dockerAddress}/compose`, |
49 |
| - // eslint-disable-next-line no-process-env |
50 |
| - secret: process.env.EXTERNAL_COMPOSITION_SECRET!, |
51 |
| - projectSlug: project.slug, |
52 |
| - organizationSlug: organization.slug, |
| 48 | + external: { |
| 49 | + endpoint: `http://${dockerAddress}/compose`, |
| 50 | + // eslint-disable-next-line no-process-env |
| 51 | + secret: process.env.EXTERNAL_COMPOSITION_SECRET!, |
| 52 | + projectSlug: project.slug, |
| 53 | + organizationSlug: organization.slug, |
| 54 | + }, |
53 | 55 | },
|
54 | 56 | ownerToken,
|
55 | 57 | ).then(r => r.expectNoGraphQLErrors());
|
56 | 58 | expect(
|
57 |
| - externalCompositionResult.enableExternalSchemaComposition.ok?.externalSchemaComposition |
58 |
| - ?.endpoint, |
| 59 | + externalCompositionResult.updateSchemaComposition.ok?.externalSchemaComposition?.endpoint, |
59 | 60 | ).toBe(`http://${dockerAddress}/compose`);
|
60 | 61 |
|
61 | 62 | // set native federation to false to force external composition
|
@@ -126,19 +127,20 @@ test.concurrent(
|
126 | 127 | // so we need to use the name and not resolved host
|
127 | 128 | const dockerAddress = await getServiceHost('external_composition', 3012, false);
|
128 | 129 | // enable external composition
|
129 |
| - const externalCompositionResult = await enableExternalSchemaComposition( |
| 130 | + const externalCompositionResult = await updateSchemaComposition( |
130 | 131 | {
|
131 |
| - endpoint: `http://${dockerAddress}/fail_on_signature`, |
132 |
| - // eslint-disable-next-line no-process-env |
133 |
| - secret: process.env.EXTERNAL_COMPOSITION_SECRET!, |
134 |
| - projectSlug: project.slug, |
135 |
| - organizationSlug: organization.slug, |
| 132 | + external: { |
| 133 | + endpoint: `http://${dockerAddress}/fail_on_signature`, |
| 134 | + // eslint-disable-next-line no-process-env |
| 135 | + secret: process.env.EXTERNAL_COMPOSITION_SECRET!, |
| 136 | + projectSlug: project.slug, |
| 137 | + organizationSlug: organization.slug, |
| 138 | + }, |
136 | 139 | },
|
137 | 140 | ownerToken,
|
138 | 141 | ).then(r => r.expectNoGraphQLErrors());
|
139 | 142 | expect(
|
140 |
| - externalCompositionResult.enableExternalSchemaComposition.ok?.externalSchemaComposition |
141 |
| - ?.endpoint, |
| 143 | + externalCompositionResult.updateSchemaComposition.ok?.externalSchemaComposition?.endpoint, |
142 | 144 | ).toBe(`http://${dockerAddress}/fail_on_signature`);
|
143 | 145 |
|
144 | 146 | // set native federation to false to force external composition
|
@@ -225,19 +227,20 @@ test.concurrent(
|
225 | 227 | // so we need to use the name and not resolved host
|
226 | 228 | const dockerAddress = await getServiceHost('external_composition', 3012, false);
|
227 | 229 | // enable external composition
|
228 |
| - const externalCompositionResult = await enableExternalSchemaComposition( |
| 230 | + const externalCompositionResult = await updateSchemaComposition( |
229 | 231 | {
|
230 |
| - endpoint: `http://${dockerAddress}/non-existing-endpoint`, |
231 |
| - // eslint-disable-next-line no-process-env |
232 |
| - secret: process.env.EXTERNAL_COMPOSITION_SECRET!, |
233 |
| - projectSlug: project.slug, |
234 |
| - organizationSlug: organization.slug, |
| 232 | + external: { |
| 233 | + endpoint: `http://${dockerAddress}/non-existing-endpoint`, |
| 234 | + // eslint-disable-next-line no-process-env |
| 235 | + secret: process.env.EXTERNAL_COMPOSITION_SECRET!, |
| 236 | + projectSlug: project.slug, |
| 237 | + organizationSlug: organization.slug, |
| 238 | + }, |
235 | 239 | },
|
236 | 240 | ownerToken,
|
237 | 241 | ).then(r => r.expectNoGraphQLErrors());
|
238 | 242 | expect(
|
239 |
| - externalCompositionResult.enableExternalSchemaComposition.ok?.externalSchemaComposition |
240 |
| - ?.endpoint, |
| 243 | + externalCompositionResult.updateSchemaComposition.ok?.externalSchemaComposition?.endpoint, |
241 | 244 | ).toBe(`http://${dockerAddress}/non-existing-endpoint`);
|
242 | 245 | // set native federation to false to force external composition
|
243 | 246 | await setNativeFederation(false);
|
@@ -321,19 +324,20 @@ test.concurrent('a timeout error should be visible to the user', async ({ expect
|
321 | 324 | // so we need to use the name and not resolved host
|
322 | 325 | const dockerAddress = await getServiceHost('external_composition', 3012, false);
|
323 | 326 | // enable external composition
|
324 |
| - const externalCompositionResult = await enableExternalSchemaComposition( |
| 327 | + const externalCompositionResult = await updateSchemaComposition( |
325 | 328 | {
|
326 |
| - endpoint: `http://${dockerAddress}/timeout`, |
327 |
| - // eslint-disable-next-line no-process-env |
328 |
| - secret: process.env.EXTERNAL_COMPOSITION_SECRET!, |
329 |
| - projectSlug: project.slug, |
330 |
| - organizationSlug: organization.slug, |
| 329 | + external: { |
| 330 | + endpoint: `http://${dockerAddress}/timeout`, |
| 331 | + // eslint-disable-next-line no-process-env |
| 332 | + secret: process.env.EXTERNAL_COMPOSITION_SECRET!, |
| 333 | + projectSlug: project.slug, |
| 334 | + organizationSlug: organization.slug, |
| 335 | + }, |
331 | 336 | },
|
332 | 337 | ownerToken,
|
333 | 338 | ).then(r => r.expectNoGraphQLErrors());
|
334 | 339 | expect(
|
335 |
| - externalCompositionResult.enableExternalSchemaComposition.ok?.externalSchemaComposition |
336 |
| - ?.endpoint, |
| 340 | + externalCompositionResult.updateSchemaComposition.ok?.externalSchemaComposition?.endpoint, |
337 | 341 | ).toBe(`http://${dockerAddress}/timeout`);
|
338 | 342 | // set native federation to false to force external composition
|
339 | 343 | await setNativeFederation(false);
|
|
0 commit comments