Remove old test harness

This commit is contained in:
gnuxie 2021-09-23 16:34:24 +01:00
parent ff216f4918
commit a86afd3cc8
6 changed files with 1 additions and 219 deletions

View File

@ -1,32 +0,0 @@
# THIS IS TO BE USED FOR DEVELOPMENT AND TESTING PURPOSES ONLY
version: '3.8'
services:
synapse_release:
build:
context: .
dockerfile: test/harness/config/docker/Dockerfile.synapse.latest
ports:
- "9999:9999"
volumes:
- ./test/harness/synapse-data:/data
env_file:
- ./test/harness/config/synapse/synapse.env
synapse_registration:
build:
context: .
dockerfile: test/harness/config/docker/Dockerfile.synapse.registration
volumes:
- ./test/harness/synapse-data:/data
depends_on: [synapse_release]
mjolnir:
environment:
NODE_ENV: development
build:
context: .
dockerfile: Dockerfile
ports:
- "8005/tcp"
volumes:
- ./config:/data/config
- ./lib:/mjolnir/lib
depends_on: [synapse_registration]

View File

@ -12,8 +12,7 @@
"lint": "tslint --project ./tsconfig.json -t stylish",
"start:dev": "yarn build && node lib/index.js",
"test": "ts-mocha --project ./tsconfig.json test/**/*.ts",
"test-integration": "NODE_ENV=harness ts-mocha --require test/integration/fixtures.ts --project ./tsconfig.json test/integration/**/*Test.ts",
"harness": "NODE_ENV=harness ts-node test/harness/launchScript.ts"
"test-integration": "NODE_ENV=harness ts-mocha --require test/integration/fixtures.ts --project ./tsconfig.json test/integration/**/*Test.ts"
},
"devDependencies": {
"@types/axios": "^0.14.0",

View File

@ -1,12 +0,0 @@
# A custom Dockerfile to rebuild synapse from the official release + plugins
FROM matrixdotorg/synapse:latest
RUN pip show matrix-synapse
COPY synapse_antispam /synapse_antispam
RUN /usr/local/bin/python -m pip install /synapse_antispam
VOLUME ["/data"]
EXPOSE 8008/tcp 8009/tcp 8448/tcp

View File

@ -1,70 +0,0 @@
server_name: localhost:9999
pid_file: /data/homeserver.pid
public_baseurl: http://localhost:9999
listeners:
- port: 9999
tls: false
type: http
x_forwarded: true
resources:
- names: [client, federation]
compress: false
federation_ip_range_blacklist:
- '127.0.0.0/8'
- '10.0.0.0/8'
- '172.16.0.0/12'
- '192.168.0.0/16'
- '100.64.0.0/10'
- '169.254.0.0/16'
- '::1/128'
- 'fe80::/64'
- 'fc00::/7'
# can not figure out how to exclude the db from the /data volume
database:
name: sqlite3
args:
database: /data/homeserver.db
media_store_path: "/data/media_store"
enable_registration: true
report_stats: false
registration_shared_secret: "REGISTRATION_SHARED_SECRET"
macaroon_secret_key: "MACROON_SECRET_KEY"
#form_secret: ""
signing_key_path: "/data/localhost:9999.signing.key"
trusted_key_servers:
- server_name: "matrix.org"
suppress_key_server_warning: true
rc_message:
per_second: 10000
burst_count: 10000
rc_registration:
per_second: 10000
burst_count: 10000
rc_login:
address:
per_second: 10000
burst_count: 10000
account:
per_second: 10000
burst_count: 10000
failed_attempts:
per_second: 10000
burst_count: 10000
rc_admin_redaction:
per_second: 10000
burst_count: 10000
rc_joins:
local:
per_second: 10000
burst_count: 10000
remote:
per_second: 10000
burst_count: 10000

View File

@ -1,10 +0,0 @@
import * as mjolnirTesting from './mjolnirTesting';
switch (process.argv[2]) {
case 'up':
mjolnirTesting.upHarness();
break;
case 'down':
mjolnirTesting.downHarness();
break;
}

View File

@ -1,93 +0,0 @@
/*
Copyright 2021 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import * as compose from 'docker-compose';
import * as path from 'path';
import * as fs from 'fs/promises';
import * as HmacSHA1 from 'crypto-js/hmac-sha1';
import axios from 'axios';
import config from "../../src/config";
import * as mjolnirSetup from './mjolnirSetup';
import {
PantalaimonClient,
MemoryStorageProvider
} from "matrix-bot-sdk";
const composeConfig = path.join(__dirname, '../../docker-compose.test.yaml');
async function synapseGenerate() {
let synapseEnv = path.join(__dirname, 'config/synapse/synapse.env');
await fs.writeFile(synapseEnv, `# NOTE: This file is generated by the test harness.
UID=${process.getuid()}\n\
GID=${process.getuid()}\n\
SYNAPSE_SERVER_NAME=localhost:9999
SYNAPSE_REPORT_STATS=no\n\
SYNAPSE_CONFIG_DIR=/data`);
console.log('generating synapse keys');
await compose.run('synapse_release', 'generate', {config: composeConfig, log:true});
console.log(process.env.NODE_ENV)
}
async function configureSynapseData() {
let synapseData = path.join(__dirname, 'synapse-data');
let synapseConfig = path.join(__dirname, 'config/synapse');
await fs.mkdir(synapseData).catch(e => {
if (e.code === 'EEXIST') {
console.debug('synapse-data already exists')
} else {
throw e
}
}
);
await fs.mkdir(path.join(synapseData, 'media_store')).catch (e => {
if (e.code === 'EEXIST') {
console.debug('media_store already exists')
} else {
throw e
}
});
await fs.copyFile(path.join(synapseConfig, 'homeserver.yaml'),
path.join(synapseData, "homeserver.yaml"));
}
async function startSynpase() {
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
await synapseGenerate();
console.info('starting synapse.')
await compose.upOne('synapse_release', {config: composeConfig, log: true})
await sleep(5000);
await registerUser('admin', 'admin', 'admin', true);
}
export async function upHarness() {
try {
await configureSynapseData();
await startSynpase();
// This doesn't actually seem to be implented by the library authors (at least it doesn't do what you'd expect)?
// See their github issue https://github.com/PDMLab/docker-compose/issues/127
//await compose.logs(['mjolnir', 'synapse_release'], {config: composeConfig, follow: true});
} catch (e) {
console.error(e);
throw e;
}
await startMjolnir();
}
export async function downHarness() {
compose.down({config: composeConfig, log: true});
await fs.rm(path.join(__dirname, 'synapse-data'), {recursive: true, force: true});
await fs.rm(path.join(__dirname, 'mjolnir-data'), {recursive: true, force: true});
}