mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
test: Add integration test that simulates running 2 hours
This commit is contained in:
parent
f08cdf75f7
commit
ce5a98b16f
39
test/integration/ExpiringDataCleanup.test.ts
Normal file
39
test/integration/ExpiringDataCleanup.test.ts
Normal file
@ -0,0 +1,39 @@
|
||||
import fetch from 'cross-fetch';
|
||||
import type { App } from '../../src/init/App';
|
||||
import { getPort } from '../util/Util';
|
||||
import {
|
||||
getDefaultVariables,
|
||||
getTestConfigPath,
|
||||
instantiateFromConfig,
|
||||
} from './Config';
|
||||
|
||||
jest.useFakeTimers('legacy');
|
||||
|
||||
const port = getPort('ExpiringDataCleanup');
|
||||
const baseUrl = `http://localhost:${port}/`;
|
||||
|
||||
describe('A server with expiring storage', (): void => {
|
||||
let app: App;
|
||||
|
||||
beforeAll(async(): Promise<void> => {
|
||||
const instances = await instantiateFromConfig(
|
||||
'urn:solid-server:test:Instances',
|
||||
getTestConfigPath('server-memory.json'),
|
||||
getDefaultVariables(port, baseUrl),
|
||||
) as Record<string, any>;
|
||||
({ app } = instances);
|
||||
await app.start();
|
||||
});
|
||||
|
||||
afterAll(async(): Promise<void> => {
|
||||
await app.stop();
|
||||
});
|
||||
|
||||
it('does not crash after the interval timeout.', async(): Promise<void> => {
|
||||
// Default timeout is 1 hour
|
||||
// This test would fail if something goes wrong in an interval timer
|
||||
jest.advanceTimersByTime(2 * 60 * 60 * 1000);
|
||||
const res = await fetch(baseUrl, { method: 'HEAD' });
|
||||
expect(res.status).toBe(200);
|
||||
});
|
||||
});
|
@ -7,6 +7,7 @@ const portNames = [
|
||||
'Conditions',
|
||||
'ContentNegotiation',
|
||||
'DynamicPods',
|
||||
'ExpiringDataCleanup',
|
||||
'GlobalQuota',
|
||||
'Identity',
|
||||
'LpdHandlerWithAuth',
|
||||
|
Loading…
x
Reference in New Issue
Block a user