-
-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup tests after app home internal url #982
Cleanup tests after app home internal url #982
Conversation
Opening this PR to know whether all the tests pass. |
106b041
to
03a8c4d
Compare
03a8c4d
to
579ed39
Compare
579ed39
to
354e177
Compare
1be171e
to
cb593da
Compare
@@ -257,25 +249,16 @@ export class TestServerReverseProxy { | |||
this._requireFromOutsideHeader = true; | |||
} | |||
|
|||
public async start(homeServer: TestServer, docServer: TestServer) { | |||
this._app.all(['/dw/dw1', '/dw/dw1/*'], (oreq, ores) => this._getRequestHandlerFor(docServer)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These endpoints seem to not have been called until I enabled the tests above. That's the reason why this error in the code had no impact until now (if I restore the old version I get tests that fail).
await docs.start(home.serverUrl, { | ||
...additionalEnvConfiguration, | ||
APP_DOC_URL: `${proxy.serverUrl}/dw/dw1`, | ||
APP_DOC_INTERNAL_URL: docs.serverUrl, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mentioned in the PR description that I had to rework the TestServer
class. That's the reason why.
You can see that the serverUrl
is now known before the server is started, which lets us provide the APP_DOC_INTERNAL_URL
to the doc worker.
@@ -28,31 +27,36 @@ export class TestServer { | |||
_homeUrl?: string, | |||
options: {output?: Writable} = {}, // Pipe server output to the given stream | |||
): Promise<TestServer> { | |||
|
|||
const server = new this(serverTypes, tempDirectory, suitename); | |||
const port = await getAvailablePort(parseInt(process.env.GET_AVAILABLE_PORT_START || '8080', 10)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is GET_AVAILABLE_PORT_START
used? getAvailablePort
has a default value for its first argument (8000)
7de1e98
to
d9598b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the follow up @fflorent !
Context and proposed solution
This PR is a follow-up of PR #864, which introduced many tests to ensure that the DocApi can work behind a proxy, and especially ensures that the requests initiated internally do not pass through the proxy when
APP_HOME_INTERNAL_URL
andAPP_DOC_INTERNAL_URL
are set.We especially set
APP_DOC_INTERNAL_URL
to the doc worker so until-now-skipped tests can be executed (namelydocument is protected during upload-and-import sequence
and/workspaces/{wid}/import handles empty filenames
).TestServer
andTestProxiedServer
have been reworked to achieve that, especially to separate the instanciation (during which a port is found for them) and their start.There are also other inconsistencies fixed, various cleanups, etc.
Tests?