Tests galore

This commit is contained in:
Michael Telatynski 2026-03-03 18:25:22 +00:00
parent d11c2e880b
commit fd4bb50a14
2 changed files with 27 additions and 1 deletions

View File

@ -156,6 +156,7 @@ export class MatrixAuthenticationServiceContainer extends GenericContainer {
super(image);
const initialConfig = deepCopy(DEFAULT_CONFIG);
initialConfig.database.host = db.getHostname();
initialConfig.database.username = db.getUsername();
initialConfig.database.password = db.getPassword();
@ -205,6 +206,7 @@ export class MatrixAuthenticationServiceContainer extends GenericContainer {
await super.start(),
`http://localhost:${port}`,
this.args,
this.config.matrix.secret,
);
}
}
@ -219,6 +221,7 @@ export class StartedMatrixAuthenticationServiceContainer extends AbstractStarted
container: StartedTestContainer,
public readonly baseUrl: string,
private readonly args: string[],
public readonly sharedSecret: string,
) {
super(container);
}

View File

@ -184,6 +184,14 @@ const DEFAULT_CONFIG = {
},
room_list_publication_rules: [{ action: "allow" }],
modules: [] as Array<{ module: string; config?: Record<string, unknown> }>,
matrix_authentication_service: undefined as
| undefined
| {
enabled?: boolean;
endpoint?: string;
secret?: string | null;
secret_path?: string | null;
},
};
/**
@ -278,7 +286,22 @@ export class SynapseContainer extends GenericContainer implements HomeserverCont
}
public withMatrixAuthenticationService(mas?: StartedMatrixAuthenticationServiceContainer): this {
this.mas = mas;
if (mas) {
this.mas = mas;
this.withConfig({
matrix_authentication_service: {
enabled: true,
endpoint: `http://${mas.getHostname()}:8080/`,
secret: mas.sharedSecret,
},
// Must be disabled when using MAS.
password_config: {
enabled: false,
},
// Must be disabled when using MAS.
enable_registration: false,
});
}
return this;
}