Skip to content

Commit

Permalink
Native Federation v2 support (#2822)
Browse files Browse the repository at this point in the history
Closes #712
Closes #1330

Want to opt-in? Create a support ticket.
  • Loading branch information
kamilkisiela authored Sep 28, 2023
1 parent 5b2330b commit 68e8c57
Show file tree
Hide file tree
Showing 36 changed files with 1,472 additions and 1,063 deletions.
2 changes: 1 addition & 1 deletion integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"slonik": "30.4.4",
"strip-ansi": "7.1.0",
"tslib": "2.6.2",
"vitest": "0.31.1",
"vitest": "0.34.3",
"zod": "3.22.2"
}
}
10 changes: 5 additions & 5 deletions integration-tests/testkit/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function createCLI(tokens: { readwrite: string; readonly: string }) {
legacy_force?: boolean;
legacy_acceptBreakingChanges?: boolean;
expect: 'latest' | 'latest-composable' | 'ignored' | 'rejected';
}) {
}): Promise<string> {
const publishName = ` #${++publishCount}`;
const commit = randomUUID();

Expand Down Expand Up @@ -116,7 +116,7 @@ export function createCLI(tokens: { readwrite: string; readonly: string }) {
`${publishName} was expected to be rejected but was published`,
).not.toEqual(expectedCommit);

return;
return '';
}

// throw if the command fails
Expand All @@ -133,7 +133,7 @@ export function createCLI(tokens: { readwrite: string; readonly: string }) {
latestSchemaCommit,
`${publishName} was expected to be ignored but it was published`,
).not.toEqual(expectedCommit);
return;
return '';
}
// Check if the schema was published
expect(latestSchemaCommit, `${publishName} was expected to be published`).toEqual(
Expand Down Expand Up @@ -172,7 +172,7 @@ export function createCLI(tokens: { readwrite: string; readonly: string }) {
sdl: string;
serviceName?: string;
expect: 'approved' | 'rejected';
}) {
}): Promise<string> {
const cmd = schemaCheck([
'--registry.accessToken',
tokens.readonly,
Expand All @@ -193,7 +193,7 @@ export function createCLI(tokens: { readwrite: string; readonly: string }) {
}: {
serviceName?: string;
expect: 'latest' | 'latest-composable' | 'rejected';
}) {
}): Promise<string> {
const cmd = schemaDelete(['--token', tokens.readwrite, '--confirm', serviceName ?? '']);

const before = {
Expand Down
9 changes: 4 additions & 5 deletions integration-tests/testkit/registry-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ export async function prepareProject(
const { createOrg } = await initSeed().createOwner();
const { organization, createProject, setFeatureFlag, setOrganizationSchemaPolicy } =
await createOrg();
const { project, createToken, target, targets, setProjectSchemaPolicy } = await createProject(
projectType,
{
const { project, createToken, target, targets, setProjectSchemaPolicy, setNativeFederation } =
await createProject(projectType, {
useLegacyRegistryModels: model === RegistryModel.Legacy,
},
);
});

// Create a token with write rights
const { secret: readwriteToken } = await createToken({
Expand Down Expand Up @@ -46,5 +44,6 @@ export async function prepareProject(
},
},
setFeatureFlag,
setNativeFederation,
};
}
7 changes: 7 additions & 0 deletions integration-tests/testkit/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ export function initSeed() {
project,
targets,
target,
async setNativeFederation(enabled: boolean) {
const pool = await poolPromise;

await pool.query(sql`
UPDATE public.projects SET native_federation = ${enabled} WHERE id = ${project.id}
`);
},
async setProjectSchemaPolicy(policy: SchemaPolicyInput) {
const result = await execute({
document: UpdateSchemaPolicyForProject,
Expand Down
Loading

0 comments on commit 68e8c57

Please sign in to comment.