Wire up basics of dendriteHomeserver
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/28860/head
parent
fd447324b5
commit
0410574b20
|
@ -6,39 +6,32 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
|
||||||
Please see LICENSE files in the repository root for full details.
|
Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// export const dendriteHomeserver: Fixtures<BaseFixtures, {}, BaseFixtures> & Fixtures<Services, {}, Services> = {
|
import { Fixtures, PlaywrightTestArgs } from "@playwright/test";
|
||||||
// _homeserver: async ({ request }, use) => {
|
|
||||||
// const container = new SynapseContainer(request);
|
import { Fixtures as BaseFixtures } from "../../../element-web-test.ts";
|
||||||
// await use(container);
|
import { DendriteContainer, PineconeContainer } from "../../../testcontainers/dendrite.ts";
|
||||||
//
|
import { Services } from "../../../services.ts";
|
||||||
// container.withConfig({
|
|
||||||
// oidc_providers: [
|
type Fixture = PlaywrightTestArgs & Services & BaseFixtures;
|
||||||
// {
|
export const dendriteHomeserver: Fixtures<Fixture, {}, Fixture> = {
|
||||||
// idp_id: "test",
|
_homeserver: async ({ request }, use) => {
|
||||||
// idp_name: "OAuth test",
|
const container =
|
||||||
// issuer: `http://localhost:${port}/oauth`,
|
process.env["PLAYWRIGHT_HOMESERVER"] === "dendrite"
|
||||||
// authorization_endpoint: `http://localhost:${port}/oauth/auth.html`,
|
? new DendriteContainer(request)
|
||||||
// // the token endpoint receives requests from synapse,
|
: new PineconeContainer(request);
|
||||||
// // rather than the webapp, so needs to escape the docker container.
|
await use(container);
|
||||||
// token_endpoint: `http://host.testcontainers.internal:${port}/oauth/token`,
|
},
|
||||||
// userinfo_endpoint: `http://host.testcontainers.internal:${port}/oauth/userinfo`,
|
homeserver: async ({ logger, network, _homeserver: homeserver }, use) => {
|
||||||
// client_id: "synapse",
|
const container = await homeserver
|
||||||
// discover: false,
|
.withNetwork(network)
|
||||||
// scopes: ["profile"],
|
.withNetworkAliases("homeserver")
|
||||||
// skip_verification: true,
|
.withLogConsumer(logger.getConsumer("dendrite"))
|
||||||
// client_auth_method: "none",
|
.start();
|
||||||
// user_mapping_provider: {
|
|
||||||
// config: {
|
await use(container);
|
||||||
// display_name_template: "{{ user.name }}",
|
await container.stop();
|
||||||
// },
|
},
|
||||||
// },
|
};
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// });
|
|
||||||
// await use(container);
|
|
||||||
// server.stop();
|
|
||||||
// },
|
|
||||||
// };
|
|
||||||
|
|
||||||
export function isDendrite(): boolean {
|
export function isDendrite(): boolean {
|
||||||
return process.env["PLAYWRIGHT_HOMESERVER"] === "dendrite" || process.env["PLAYWRIGHT_HOMESERVER"] === "pinecone";
|
return process.env["PLAYWRIGHT_HOMESERVER"] === "dendrite" || process.env["PLAYWRIGHT_HOMESERVER"] === "pinecone";
|
||||||
|
|
|
@ -10,9 +10,10 @@ import mailhog from "mailhog";
|
||||||
import { GenericContainer, Network, StartedNetwork, StartedTestContainer, Wait } from "testcontainers";
|
import { GenericContainer, Network, StartedNetwork, StartedTestContainer, Wait } from "testcontainers";
|
||||||
import { PostgreSqlContainer, StartedPostgreSqlContainer } from "@testcontainers/postgresql";
|
import { PostgreSqlContainer, StartedPostgreSqlContainer } from "@testcontainers/postgresql";
|
||||||
|
|
||||||
import { StartedSynapseContainer, SynapseConfigOptions, SynapseContainer } from "./testcontainers/synapse.ts";
|
import { SynapseConfigOptions, SynapseContainer } from "./testcontainers/synapse.ts";
|
||||||
import { ContainerLogger } from "./testcontainers/utils.ts";
|
import { ContainerLogger } from "./testcontainers/utils.ts";
|
||||||
import { StartedMatrixAuthenticationServiceContainer } from "./testcontainers/mas.ts";
|
import { StartedMatrixAuthenticationServiceContainer } from "./testcontainers/mas.ts";
|
||||||
|
import { HomeserverContainer, StartedHomeserverContainer } from "./testcontainers/HomeserverContainer.ts";
|
||||||
|
|
||||||
export interface Services {
|
export interface Services {
|
||||||
logger: ContainerLogger;
|
logger: ContainerLogger;
|
||||||
|
@ -24,8 +25,8 @@ export interface Services {
|
||||||
mailhogClient: mailhog.API;
|
mailhogClient: mailhog.API;
|
||||||
|
|
||||||
synapseConfigOptions: SynapseConfigOptions;
|
synapseConfigOptions: SynapseConfigOptions;
|
||||||
_homeserver: SynapseContainer;
|
_homeserver: HomeserverContainer<any>;
|
||||||
homeserver: StartedSynapseContainer;
|
homeserver: StartedHomeserverContainer;
|
||||||
mas?: StartedMatrixAuthenticationServiceContainer;
|
mas?: StartedMatrixAuthenticationServiceContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
Copyright 2024 New Vector Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
|
Please see LICENSE files in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { AbstractStartedContainer, GenericContainer } from "testcontainers";
|
||||||
|
|
||||||
|
import { StartedSynapseContainer } from "./synapse.ts";
|
||||||
|
import { HomeserverInstance } from "../plugins/homeserver";
|
||||||
|
|
||||||
|
export interface HomeserverContainer<Config> extends GenericContainer {
|
||||||
|
withConfigField(key: string, value: any): this;
|
||||||
|
withConfig(config: Partial<Config>): this;
|
||||||
|
start(): Promise<StartedSynapseContainer>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StartedHomeserverContainer extends AbstractStartedContainer, HomeserverInstance {}
|
|
@ -13,6 +13,7 @@ import { set } from "lodash";
|
||||||
import { randB64Bytes } from "../plugins/utils/rand.ts";
|
import { randB64Bytes } from "../plugins/utils/rand.ts";
|
||||||
import { StartedSynapseContainer } from "./synapse.ts";
|
import { StartedSynapseContainer } from "./synapse.ts";
|
||||||
import { deepCopy } from "../plugins/utils/object.ts";
|
import { deepCopy } from "../plugins/utils/object.ts";
|
||||||
|
import { HomeserverContainer } from "./HomeserverContainer.ts";
|
||||||
|
|
||||||
const DEFAULT_CONFIG = {
|
const DEFAULT_CONFIG = {
|
||||||
version: 2,
|
version: 2,
|
||||||
|
@ -204,7 +205,7 @@ const DEFAULT_CONFIG = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export class DendriteContainer extends GenericContainer {
|
export class DendriteContainer extends GenericContainer implements HomeserverContainer<typeof DEFAULT_CONFIG> {
|
||||||
private config: typeof DEFAULT_CONFIG;
|
private config: typeof DEFAULT_CONFIG;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
|
|
@ -13,8 +13,9 @@ import { set } from "lodash";
|
||||||
|
|
||||||
import { getFreePort } from "../plugins/utils/port.ts";
|
import { getFreePort } from "../plugins/utils/port.ts";
|
||||||
import { randB64Bytes } from "../plugins/utils/rand.ts";
|
import { randB64Bytes } from "../plugins/utils/rand.ts";
|
||||||
import { Credentials, HomeserverInstance } from "../plugins/homeserver";
|
import { Credentials } from "../plugins/homeserver";
|
||||||
import { deepCopy } from "../plugins/utils/object.ts";
|
import { deepCopy } from "../plugins/utils/object.ts";
|
||||||
|
import { HomeserverContainer, StartedHomeserverContainer } from "./HomeserverContainer.ts";
|
||||||
|
|
||||||
const TAG = "develop@sha256:17cc0a301447430624afb860276e5c13270ddeb99a3f6d1c6d519a20b1a8f650";
|
const TAG = "develop@sha256:17cc0a301447430624afb860276e5c13270ddeb99a3f6d1c6d519a20b1a8f650";
|
||||||
|
|
||||||
|
@ -137,7 +138,7 @@ const DEFAULT_CONFIG = {
|
||||||
|
|
||||||
export type SynapseConfigOptions = Partial<typeof DEFAULT_CONFIG>;
|
export type SynapseConfigOptions = Partial<typeof DEFAULT_CONFIG>;
|
||||||
|
|
||||||
export class SynapseContainer extends GenericContainer {
|
export class SynapseContainer extends GenericContainer implements HomeserverContainer<typeof DEFAULT_CONFIG> {
|
||||||
private config: typeof DEFAULT_CONFIG;
|
private config: typeof DEFAULT_CONFIG;
|
||||||
|
|
||||||
constructor(private readonly request: APIRequestContext) {
|
constructor(private readonly request: APIRequestContext) {
|
||||||
|
@ -225,7 +226,7 @@ export class SynapseContainer extends GenericContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class StartedSynapseContainer extends AbstractStartedContainer implements HomeserverInstance {
|
export class StartedSynapseContainer extends AbstractStartedContainer implements StartedHomeserverContainer {
|
||||||
private adminToken?: string;
|
private adminToken?: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
|
Loading…
Reference in New Issue