mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
test: Create single function for port generation
This reduces the chances of several integration tests re-using the same port.
This commit is contained in:
@@ -4,9 +4,10 @@ import fetch from 'cross-fetch';
|
||||
import type { Initializer } from '../../src/init/Initializer';
|
||||
import type { HttpServerFactory } from '../../src/server/HttpServerFactory';
|
||||
import { joinFilePath } from '../../src/util/PathUtil';
|
||||
import { getPort } from '../util/Util';
|
||||
import { getTestFolder, instantiateFromConfig, removeFolder } from './Config';
|
||||
|
||||
const port = 6006;
|
||||
const port = getPort('DynamicPods');
|
||||
const baseUrl = `http://localhost:${port}/`;
|
||||
const rootFilePath = getTestFolder('dynamicPods');
|
||||
const podConfigJson = joinFilePath(rootFilePath, 'config-pod.json');
|
||||
|
||||
@@ -4,9 +4,10 @@ import type { BaseHttpServerFactory } from '../../src/server/BaseHttpServerFacto
|
||||
import type { HttpHandlerInput } from '../../src/server/HttpHandler';
|
||||
import { HttpHandler } from '../../src/server/HttpHandler';
|
||||
import { StaticAsyncHandler } from '../util/StaticAsyncHandler';
|
||||
import { getPort } from '../util/Util';
|
||||
import { instantiateFromConfig } from './Config';
|
||||
|
||||
const port = 6002;
|
||||
const port = getPort('Middleware');
|
||||
|
||||
class SimpleHttpHandler extends HttpHandler {
|
||||
public async handle(input: HttpHandlerInput): Promise<void> {
|
||||
|
||||
@@ -2,9 +2,10 @@ import type { Server } from 'http';
|
||||
import fetch from 'cross-fetch';
|
||||
import type { HttpServerFactory } from '../../src/server/HttpServerFactory';
|
||||
import { readableToString } from '../../src/util/StreamUtil';
|
||||
import { getPort } from '../util/Util';
|
||||
import { instantiateFromConfig } from './Config';
|
||||
|
||||
const port = 6003;
|
||||
const port = getPort('PodCreation');
|
||||
const baseUrl = `http://localhost:${port}/`;
|
||||
|
||||
describe('A server with a pod handler', (): void => {
|
||||
|
||||
@@ -4,12 +4,14 @@ import type { RedisResourceLocker } from '../../src';
|
||||
import { joinFilePath } from '../../src';
|
||||
import type { HttpServerFactory } from '../../src/server/HttpServerFactory';
|
||||
import { describeIf } from '../util/TestHelpers';
|
||||
import { getPort } from '../util/Util';
|
||||
import { instantiateFromConfig } from './Config';
|
||||
|
||||
/**
|
||||
* Test the general functionality of the server using a RedisResourceLocker
|
||||
*/
|
||||
describeIf('docker', 'A server with a RedisResourceLocker as ResourceLocker', (): void => {
|
||||
const port = 6008;
|
||||
const port = getPort('RedisResourceLocker');
|
||||
const baseUrl = `http://localhost:${port}/`;
|
||||
let server: Server;
|
||||
let locker: RedisResourceLocker;
|
||||
|
||||
@@ -2,9 +2,10 @@ import type { Server } from 'http';
|
||||
import fetch from 'cross-fetch';
|
||||
import type { Initializer } from '../../src/init/Initializer';
|
||||
import type { HttpServerFactory } from '../../src/server/HttpServerFactory';
|
||||
import { getPort } from '../util/Util';
|
||||
import { instantiateFromConfig } from './Config';
|
||||
|
||||
const port = 6004;
|
||||
const port = getPort('ServerFetch');
|
||||
const baseUrl = `http://localhost:${port}/`;
|
||||
|
||||
// Some tests with real Requests/Responses until the mocking library has been removed from the tests
|
||||
|
||||
@@ -3,9 +3,10 @@ import fetch from 'cross-fetch';
|
||||
import type { Initializer } from '../../src/init/Initializer';
|
||||
import type { HttpServerFactory } from '../../src/server/HttpServerFactory';
|
||||
import type { ResourceStore } from '../../src/storage/ResourceStore';
|
||||
import { getPort } from '../util/Util';
|
||||
import { getTestFolder, instantiateFromConfig, removeFolder } from './Config';
|
||||
|
||||
const port = 6005;
|
||||
const port = getPort('Subdomains');
|
||||
const baseUrl = `http://localhost:${port}/`;
|
||||
|
||||
const rootFilePath = getTestFolder('subdomains');
|
||||
|
||||
@@ -2,9 +2,10 @@ import type { Server } from 'http';
|
||||
import fetch from 'cross-fetch';
|
||||
import WebSocket from 'ws';
|
||||
import type { HttpServerFactory } from '../../src/server/HttpServerFactory';
|
||||
import { getPort } from '../util/Util';
|
||||
import { instantiateFromConfig } from './Config';
|
||||
|
||||
const port = 6001;
|
||||
const port = getPort('WebSocketsProtocol');
|
||||
const serverUrl = `http://localhost:${port}/`;
|
||||
const headers = { forwarded: 'host=example.pod;proto=https' };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user