Skip to content

Commit

Permalink
Achieved to make test that test doc worker work
Browse files Browse the repository at this point in the history
  • Loading branch information
fflorent committed May 14, 2024
1 parent e1569b8 commit ceefd82
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
13 changes: 9 additions & 4 deletions test/server/lib/DocApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,10 @@ describe('DocApi', function () {
...overrideEnvConf
};
const home = await TestServer.startServer('home', tmpDir, suitename, additionalEnvConfiguration);
const docs = await TestServer.startServer(
'docs', tmpDir, suitename, additionalEnvConfiguration, home.serverUrl
const docs = await TestServer.startServer('docs', tmpDir, suitename, {
...additionalEnvConfiguration,
APP_DOC_URL: `${await proxy.getServerUrl()}/dw/dw1`,
}, home.serverUrl
);
proxy.requireFromOutsideHeader();

Expand Down Expand Up @@ -2915,7 +2917,7 @@ function testDocApi() {
});

it('POST /workspaces/{wid}/import handles empty filenames', async function () {
if (!process.env.TEST_REDIS_URL || docs.proxiedServer) {
if (!process.env.TEST_REDIS_URL) {
this.skip();
}
const worker1 = await userApi.getWorkerAPI('import');
Expand Down Expand Up @@ -5356,7 +5358,10 @@ function setup(name: string, cb: () => Promise<void>) {
await cb();

// create TestDoc as an empty doc into Private workspace
userApi = api = home.makeUserApi(ORG_NAME);
userApi = api = home.makeUserApi(ORG_NAME, 'chimpy', {
headers: makeConfig('chimpy').headers as Record<string, string>,
serverUrl
});
const wid = await getWorkspaceId(api, 'Private');
docIds.TestDoc = await api.newDoc({name: 'TestDoc'}, wid);
});
Expand Down
5 changes: 4 additions & 1 deletion test/server/lib/helpers/TestServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ export class TestServer {
APP_HOME_INTERNAL_URL: homeUrl,
GRIST_TESTING_SOCKET: this.testingSocket,
GRIST_PORT: String(port),
...(this._serverTypes.includes('docs') ? {
APP_DOC_INTERNAL_URL: this._serverUrl,
}: {}),
...this._defaultEnv,
...customEnv
};
Expand Down Expand Up @@ -258,7 +261,7 @@ export class TestServerReverseProxy {
}

public async start(homeServer: TestServer, docServer: TestServer) {
this._app.all(['/dw/dw1', '/dw/dw1/*'], (oreq, ores) => this._getRequestHandlerFor(docServer));
this._app.all(['/dw/dw1', '/dw/dw1/*'], this._getRequestHandlerFor(docServer));
this._app.all('/*', this._getRequestHandlerFor(homeServer));

// Forbid now the use of serverUrl property, so we don't allow the tests to
Expand Down

0 comments on commit ceefd82

Please sign in to comment.