Fix behing-proxy tests aren't running

The cause was that setup() first argument takes the name of the socket
used by home and doc servers to listen.
pull/915/head
fflorent 3 weeks ago
parent a7bae9a6ba
commit ac2857cd85

@ -79,12 +79,7 @@ describe('DocApi', function () {
before(async function () {
oldEnv = new testUtils.EnvironmentSnapshot();
// Clear redis test database if redis is in use.
if (process.env.TEST_REDIS_URL) {
const cli = createClient(process.env.TEST_REDIS_URL);
await cli.flushdbAsync();
await cli.quitAsync();
}
await flushAllRedis();
// Create the tmp dir removing any previous one
await prepareFilesystemDirectoryForTests(tmpDir);
@ -173,7 +168,7 @@ describe('DocApi', function () {
}
}
}
setup('separated', async () => {
setup('behind-proxy', async () => {
proxy = new TestServerProxy();
const additionalEnvConfiguration = {
ALLOWED_WEBHOOK_DOMAINS: `example.com,localhost:${webhooksTestPort}`,
@ -195,11 +190,12 @@ describe('DocApi', function () {
hasHomeApi = true;
});
after(() => {
after(async () => {
proxy.stop();
iterateOverAccountHeaders((account) => {
return originalHeaders.get(account)!;
});
await flushAllRedis();
});
testDocApi();
@ -5284,6 +5280,7 @@ function setup(name: string, cb: () => Promise<void>) {
before(async function () {
suitename = name;
dataDir = path.join(tmpDir, `${suitename}-data`);
await flushAllRedis();
await fse.mkdirs(dataDir);
await setupDataDir(dataDir);
await cb();
@ -5330,3 +5327,12 @@ async function flushAuth() {
await home.testingHooks.flushAuthorizerCache();
await docs.testingHooks.flushAuthorizerCache();
}
async function flushAllRedis() {
// Clear redis test database if redis is in use.
if (process.env.TEST_REDIS_URL) {
const cli = createClient(process.env.TEST_REDIS_URL);
await cli.flushdbAsync();
await cli.quitAsync();
}
}

@ -199,7 +199,7 @@ export class TestServer {
// FIXME: found that TestProxyServer exist, what should I do? :'(
export class TestServerProxy {
public static readonly HOSTNAME: string = 'grist-test-proxy.127.0.0.1.nip.io';
public static readonly HOSTNAME: string = 'grist-test-proxy.localhost';
private _stopped: boolean = false;
private _app = express();

Loading…
Cancel
Save