Merge pull request #191 from matrix-org/gnuxie/manual-test-cleanup

Improvements to manual testing with the test:manual script.
This commit is contained in:
Gnuxie 2022-01-21 10:23:17 +00:00 committed by GitHub
commit 47e3d8ae2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 4 deletions

View File

@ -9,6 +9,9 @@ homeserverUrl: "http://localhost:8081"
# Where the homeserver is located (client-server URL). NOT pantalaimon. # Where the homeserver is located (client-server URL). NOT pantalaimon.
rawHomeserverUrl: "http://localhost:8081" rawHomeserverUrl: "http://localhost:8081"
# README: We use the Pantalaimon client WITHOUT Pantalaimon itself in tests (and the manual test)
# as an easy way to login with passwords from the config without having
# to resolve a chicken-vs-egg problem in regards to access tokens.
# Pantalaimon options (https://github.com/matrix-org/pantalaimon) # Pantalaimon options (https://github.com/matrix-org/pantalaimon)
pantalaimon: pantalaimon:
# If true, accessToken above is ignored and the username/password below will be # If true, accessToken above is ignored and the username/password below will be

View File

@ -1,5 +1,4 @@
name: mjolnir name: mjolnir
up: up:
before: before:
# Launch the reverse proxy, listening for connections *only* on the local host. # Launch the reverse proxy, listening for connections *only* on the local host.
@ -19,6 +18,8 @@ homeserver:
server_name: localhost:9999 server_name: localhost:9999
public_baseurl: http://localhost:9999 public_baseurl: http://localhost:9999
registration_shared_secret: REGISTRATION_SHARED_SECRET registration_shared_secret: REGISTRATION_SHARED_SECRET
# Make manual testing easier
enable_registration: true
# Getting rid of throttling. # Getting rid of throttling.
rc_message: rc_message:

View File

@ -1,6 +1,5 @@
import axios from "axios"; import axios from "axios";
import { HmacSHA1 } from "crypto-js"; import { HmacSHA1 } from "crypto-js";
import e from "express";
import { LogService, MatrixClient, MemoryStorageProvider, PantalaimonClient } from "matrix-bot-sdk"; import { LogService, MatrixClient, MemoryStorageProvider, PantalaimonClient } from "matrix-bot-sdk";
import config from "../../src/config"; import config from "../../src/config";
@ -43,6 +42,7 @@ export async function registerUser(username: string, displayname: string, passwo
throw ex; throw ex;
} }
} }
throw new Error(`Retried registration ${REGISTRATION_ATTEMPTS} times, is Mjolnir or Synapse misconfigured?`);
} }
/** /**

View File

@ -50,12 +50,12 @@ export async function ensureAliasedRoomExists(client: MatrixClient, alias: strin
async function configureMjolnir() { async function configureMjolnir() {
try { try {
await registerUser('mjolnir', 'mjolnir', 'mjolnir', true) await registerUser(config.pantalaimon.username, config.pantalaimon.username, config.pantalaimon.password, true)
} catch (e) { } catch (e) {
if (e.isAxiosError) { if (e.isAxiosError) {
console.log('Received error while registering', e.response.data || e.response); console.log('Received error while registering', e.response.data || e.response);
if (e.response.data && e.response.data.errcode === 'M_USER_IN_USE') { if (e.response.data && e.response.data.errcode === 'M_USER_IN_USE') {
console.log('mjolnir already registered, skipping'); console.log(`${config.pantalaimon.username} already registered, skipping`);
return; return;
} }
} }