8000 if we run in maintainer mode, be more patient (#7050) · sita1999/arangodb@a95d117 · GitHub
[go: up one dir, main page]

Skip to content

Commit a95d117

Browse files
dothebartjsteemann
authored andcommitted
if we run in maintainer mode, be more patient (arangodb#7050)
1 parent a13f68b commit a95d117

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

js/actions/_admin/foxx/app.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,17 @@ function proxyLocal (method, url, qs, body, headers = {}) {
5555
if (body) {
5656
headers['content-length'] = body.length;
5757
}
58-
const res = request({
58+
const req = {
5959
method,
6060
url,
6161
qs,
6262
headers,
6363
body
64-
});
64+
};
65+
if (require('internal').db._version(true)['maintainer-mode'] === 'true') {
66+
req.timeout = 300;
67+
}
68+
const res = request(req);
6569
if (res.json && res.json.errorNum) {
6670
throw new ArangoError(res.json);
6771
}

tests/js/server/shell/shell-foxx-routing-consistency-spec.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ const SERVICE_PATH = fs.makeAbsolute(fs.join(
1212
));
1313
const MOUNT = '/consistencytest';
1414

15+
let options = {
16+
json: true
17+
};
18+
19+
if (require('internal').db._version(true)['maintainer-mode'] === 'true') {
20+
options.timeout = 300;
21+
}
22+
1523
describe('Foxx routing consistency', () => {
1624
beforeEach(() => {
1725
FoxxManager.install(SERVICE_PATH, MOUNT);
@@ -24,63 +32,63 @@ describe('Foxx routing consistency', () => {
2432

2533
it('serves service when everything is fine', () => {
2634
FoxxManager.initializeFoxx();
27-
const res = request.get(MOUNT, {json: true});
35+
const res = request.get(MOUNT, options);
2836
expect(res.statusCode).to.equal(200);
2937
expect(res.json).to.eql({hello: 'world'});
3038
});
3139

3240
it('serves ERROR_SERVICE_FILES_MISSING when bundle is missing', () => {
3341
fs.remove(FoxxService.bundlePath(MOUNT));
3442
FoxxManager.initializeFoxx();
35-
const res = request.get(MOUNT, {json: true});
43+
const res = request.get(MOUNT, options);
3644
expect(res.statusCode).to.equal(503);
3745
expect(res.json).to.have.property('errorNum', errors.ERROR_SERVICE_FILES_MISSING.code);
3846
});
3947

4048
it('serves ERROR_SERVICE_FILES_MISSING when service folder is missing', () => {
4149
fs.removeDirectoryRecursive(FoxxService.basePath(MOUNT), true);
4250
FoxxManager.initializeFoxx();
43-
const res = request.get(MOUNT, {json: true});
51+
const res = request.get(MOUNT, options);
4452
expect(res.statusCode).to.equal(503);
4553
expect(res.json).to.have.property('errorNum', errors.ERROR_SERVICE_FILES_MISSING.code);
4654
});
4755

4856
it('serves ERROR_SERVICE_FILES_OUTDATED when checksum is wrong', () => {
4957
fs.writeFileSync(FoxxService.bundlePath(MOUNT), 'keyboardcat');
5058
FoxxManager.initializeFoxx();
51-
const res = request.get(MOUNT, {json: true});
59+
const res = request.get(MOUNT, options);
5260
expect(res.statusCode).to.equal(503);
5361
expect(res.json).to.have.property('errorNum', errors.ERROR_SERVICE_FILES_OUTDATED.code);
5462
});
5563

5664
it('serves ERROR_MALFORMED_MANIFEST_FILE when manifest is mangled', () => {
5765
fs.writeFileSync(fs.join(FoxxService.basePath(MOUNT), 'manifest.json'), 'keyboardcat');
5866
FoxxManager.initializeFoxx();
59-
const res = request.get(MOUNT, {json: true});
67+
const res = request.get(MOUNT, options);
6068
expect(res.statusCode).to.equal(503);
6169
expect(res.json).to.have.property('errorNum', errors.ERROR_MALFORMED_MANIFEST_FILE.code);
6270
});
6371

6472
it('serves ERROR_SERVICE_MANIFEST_NOT_FOUND when manifest is deleted', () => {
6573
fs.remove(fs.join(FoxxService.basePath(MOUNT), 'manifest.json'));
6674
FoxxManager.initializeFoxx();
67-
const res = request.get(MOUNT, {json: true});
75+
const res = request.get(MOUNT, options);
6876
expect(res.statusCode).to.equal(503);
6977
expect(res.json).to.have.property('errorNum', errors.ERROR_SERVICE_MANIFEST_NOT_FOUND.code);
7078
});
7179

7280
it('serves ERROR_MODULE_SYNTAX_ERROR when entry file is mangled', () => {
7381
fs.writeFileSync(fs.join(FoxxService.basePath(MOUNT), 'index.js'), 'const keyboardcat;');
7482
FoxxManager.initializeFoxx();
75-
const res = request.get(MOUNT, {json: true});
83+
const res = request.get(MOUNT, options);
7684
expect(res.statusCode).to.equal(503);
7785
expect(res.json).to.have.property('errorNum', errors.ERROR_MODULE_SYNTAX_ERROR.code);
7886
});
7987

8088
it('serves ERROR_MODULE_NOT_FOUND when entry file is mangled', () => {
8189
fs.remove(fs.join(FoxxService.basePath(MOUNT), 'index.js'));
8290
FoxxManager.initializeFoxx();
83-
const res = request.get(MOUNT, {json: true});
91+
const res = request.get(MOUNT, options);
8492
expect(res.statusCode).to.equal(503);
8593
expect(res.json).to.have.property('errorNum', errors.ERROR_MODULE_NOT_FOUND.code);
8694
});

0 commit comments

Comments
 (0)
0