Closed ntraut closed 4 years ago
I did not manage to add a label.
I saw that I was unable to run npm start
. I was able before but since I divided my modifications into several branches it was no more the case.
hi @ntraut ! There were a lot of changes lately. In particular, the code was changed to be able to pass brainbox to https. When was the last time you managed to npm start
successfully? Like, during the last month? Or before that? Depending on the answer, the answer may be very different.
This is how a successful run of the mocha tests looks like now:
UNIT TESTING ATLASMAKER SERVER MRI IO ✓ Should load a nii.gz file (197ms) ✓ Should get the dimensions right ✓ Should load a mgz file (244ms) ✓ Should get the dimensions right ✓ Should recognize nii.gz from a filename ✓ Should recognize mgz from a filename ✓ Should return undefined if filename is not nii.gz nor mgz ✓ Subtract vectors correctly Painting ✓ Convert screen coordinates to volume index Database (node:90973) DeprecationWarning: collection.find option [fields] is deprecated and will be removed in a later version. ✓ Find user name given their nickname ✓ Find user nickname given their name ✓ Find project ✓ Find similar project names Volume slice server ✓ Should load a nii.gz file (153ms) ✓ Serve one slice (134ms) UNIT TESTING DATABASE Query user ✓ should return user object if present ✓ should not return user object if not present UNIT TEST TRIVIAL CHECK #indexOf() ✓ should return -1 when the value is not present TESTING CLIENT-SIDE RENDERING Test website rendering ✓ Browser opens (159ms) ✓ Can access index page (264ms) ✓ Home page renders as expected (6325ms) ✓ MRI page renders as expected (5702ms) ✓ "Ask for login" renders as expected (5581ms) ✓ Project page renders as expected (5562ms) ✓ Project Settings page for an existing project renders as expected (5525ms) ✓ Project Settings page for an empty project renders as expected (5530ms) ✓ User page renders as expected (5543ms) ✓ Browser closes successfully (62ms) ✓ Remove test MRI from db and disk TESTING THE /mri ROUTE /mri route ✓ get("/") should return status 200 ✓ Should return an error message requesting page for an empty GET /mri/json/ ✓ POST /mri/json without parameters should fail ✓ POST /mri/json with url should start a download (6022ms) ✓ POST /mri/json with url should return MRI info once the file is downloaded (3011ms) ✓ GET /mri/json?page=0 should return an array with >=1 file ✓ GET /mri/json should provide MRI info for an existing file ✓ Remove test MRI from db and disk TESTING THE /project ROUTE Get project information ✓ get("/") should return status 200 ✓ get("/project/json/") should get an error message requesting page ✓ get("/project/json?page=0") should return an array ✓ get("/project/json/test") should return status 200 ✓ get("/project/json/test") should return an object with appropriate keys ✓ get("/project/json/test/files") should return an array with >=1 file ✓ get("/project/json/test/files") should return objects with appropriate keys ✓ get("/project/json/test/files") should return only sources and names if required ✓ Remove test MRI from db and disk TESTING THE /user ROUTE Obtaining user information ✓ Add test MRI (6031ms) ✓ get("/") should return status 200 ✓ get("/user/json/") should get an error message requesting page ✓ get("/user/json?page=0") should return an array ✓ get("/user/json/foo") should return status 200 ✓ get("/user/json/foo/files") should return an object with an array of files ✓ get("/user/json/foo/atlas") should return an object with an array of atlas ✓ get("/user/json/foo/projects") should return an object with an array of projects ✓ get("/user/foo") should return status 200 ✓ get("/user/json/foo") should return expected values ✓ Remove test MRI from db and disk TESTING WEBSOCKET WORKFLOW WS connection (node:90973) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification. ✓ Can create a WS connection ✓ Can send little data ✓ Can trigger a data download (3019ms) ✓ Can send larger data ✓ Can request data ✓ Can receive data (113ms) ✓ Remove test MRI from db and disk TESTING AN MRI UPLOAD/DOWNLOAD WORKFLOW Fail soon ✓ Returns 404 (257ms) Create a test token ✓ Can create a test token Simple upload workflow ✓ Does not find a non-existent user ✓ Can insert a test user in the DB ✓ Finds the inserted user ✓ Removes test user from the DB ✓ Does not find the removed user Remove a test token ✓ Can remove a test token 72 passing (1m)
Hi, before my modifications I was not able to run but I made modifications to be able (mainly allowing again ws), but then I divided and I was unable again but since I saw this problem I fixed it.
Now the tests don't fail as soon but I get a bunch of new errors. I need to look closer to see what's happening:
> mocha --exit ./test/runner.js test/unit/*.js test/integration/*.js
UNIT TESTING ATLASMAKER SERVER
MRI IO
√ Should load a nii.gz file (395ms)
√ Should get the dimensions right
1) Should load a mgz file
2) Should get the dimensions right
√ Should recognize nii.gz from a filename
√ Should recognize mgz from a filename
√ Should return undefined if filename is not nii.gz nor mgz
√ Subtract vectors correctly
Painting
√ Convert screen coordinates to volume index
Database
(node:11480) DeprecationWarning: collection.find option [fields] is deprecated and will be removed in a later version.
√ Find user name given their nickname (355ms)
√ Find user nickname given their name
√ Find project
√ Find similar project names
Volume slice server
√ Should load a nii.gz file (314ms)
3) Serve one slice
UNIT TESTING DATABASE
Query user
√ should return user object if present
√ should not return user object if not present
UNIT TEST TRIVIAL CHECK
#indexOf()
√ should return -1 when the value is not present
TESTING CLIENT-SIDE RENDERING
Test website rendering
√ Browser opens (162ms)
4) Can access index page
5) Home page renders as expected
6) MRI page renders as expected
7) "Ask for login" renders as expected
8) Project page renders as expected
9) Project Settings page for an existing project renders as expected
10) Project Settings page for an empty project renders as expected
11) User page renders as expected
√ Browser closes successfully (171ms)
12) Remove test MRI from db and disk
TESTING THE /mri ROUTE
/mri route
13) get("/") should return status 200
14) Should return an error message requesting page for an empty GET /mri/json/
15) POST /mri/json without parameters should fail
16) POST /mri/json with url should start a download
17) POST /mri/json with url should return MRI info once the file is downloaded
18) GET /mri/json?page=0 should return an array with >=1 file
19) GET /mri/json should provide MRI info for an existing file
20) Remove test MRI from db and disk
TESTING THE /project ROUTE
21) "before all" hook in "TESTING THE /project ROUTE"
TESTING THE /user ROUTE
Obtaining user information
22) Add test MRI
23) get("/") should return status 200
24) get("/user/json/") should get an error message requesting page
25) get("/user/json?page=0") should return an array
26) get("/user/json/foo") should return status 200
27) get("/user/json/foo/files") should return an object with an array of files
28) get("/user/json/foo/atlas") should return an object with an array of atlas
29) get("/user/json/foo/projects") should return an object with an array of projects
30) get("/user/foo") should return status 200
31) get("/user/json/foo") should return expected values
32) Remove test MRI from db and disk
TESTING WEBSOCKET WORKFLOW
WS connection
(node:11480) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
33) Can create a WS connection
34) Can send little data
35) Can trigger a data download
36) Can send larger data
37) Can request data
38) Can receive data
39) Remove test MRI from db and disk
TESTING AN MRI UPLOAD/DOWNLOAD WORKFLOW
Fail soon
40) Returns 404
Create a test token
√ Can create a test token
Simple upload workflow
√ Does not find a non-existent user
√ Can insert a test user in the DB
√ Finds the inserted user
√ Removes test user from the DB
√ Does not find the removed user
Remove a test token
√ Can remove a test token
24 passing (42s)
40 failing
1) UNIT TESTING ATLASMAKER SERVER
MRI IO
Should load a mgz file:
Uncaught Error: Buffer size too small for struct layout !
at Struct._setBuff.setBuffer (node_modules\struct\index.js:355:19)
at Object._readMGZHeader (controller\atlasmakerServer\atlasmakerServer.js:1236:17)
at BrainBox\controller\atlasmakerServer\atlasmakerServer.js:1354:20
at exithandler (child_process.js:310:5)
at ChildProcess.errorhandler (child_process.js:322:5)
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
2) UNIT TESTING ATLASMAKER SERVER
MRI IO
Should get the dimensions right:
TypeError: Cannot read property 'dim' of undefined
at Context.<anonymous> (test\unit\atlasmakerServer.test.js:30:19)
at processImmediate (internal/timers.js:456:21)
3) UNIT TESTING ATLASMAKER SERVER
Volume slice server
Serve one slice:
Error: ENOENT: no such file or directory, open './test/images/slice-bert-cor-50.jpg'
at Object.openSync (fs.js:458:3)
at Object.writeFileSync (fs.js:1279:35)
at Context.<anonymous> (test\unit\atlasmakerServer.test.js:108:10)
4) TESTING CLIENT-SIDE RENDERING
Test website rendering
Can access index page:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (BrainBox\test\integration\client.js)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
5) TESTING CLIENT-SIDE RENDERING
Test website rendering
Home page renders as expected:
TypeError: Cannot read property 'goto' of undefined
at BrainBox\test\utils.js:178:14
at new Promise (<anonymous>)
at Object.comparePageScreenshots (test\utils.js:174:14)
at Context.<anonymous> (test\integration\client.js:44:34)
at processImmediate (internal/timers.js:456:21)
6) TESTING CLIENT-SIDE RENDERING
Test website rendering
MRI page renders as expected:
TypeError: Cannot read property 'goto' of undefined
at BrainBox\test\utils.js:178:14
at new Promise (<anonymous>)
at Object.comparePageScreenshots (test\utils.js:174:14)
at Context.<anonymous> (test\integration\client.js:54:34)
at processImmediate (internal/timers.js:456:21)
7) TESTING CLIENT-SIDE RENDERING
Test website rendering
"Ask for login" renders as expected:
TypeError: Cannot read property 'goto' of undefined
at BrainBox\test\utils.js:178:14
at new Promise (<anonymous>)
at Object.comparePageScreenshots (test\utils.js:174:14)
at Context.<anonymous> (test\integration\client.js:64:34)
at processImmediate (internal/timers.js:456:21)
8) TESTING CLIENT-SIDE RENDERING
Test website rendering
Project page renders as expected:
TypeError: Cannot read property 'goto' of undefined
at BrainBox\test\utils.js:178:14
at new Promise (<anonymous>)
at Object.comparePageScreenshots (test\utils.js:174:14)
at Context.<anonymous> (test\integration\client.js:74:34)
at processImmediate (internal/timers.js:456:21)
9) TESTING CLIENT-SIDE RENDERING
Test website rendering
Project Settings page for an existing project renders as expected:
TypeError: Cannot read property 'goto' of undefined
at BrainBox\test\utils.js:178:14
at new Promise (<anonymous>)
at Object.comparePageScreenshots (test\utils.js:174:14)
at Context.<anonymous> (test\integration\client.js:82:34)
at processImmediate (internal/timers.js:456:21)
10) TESTING CLIENT-SIDE RENDERING
Test website rendering
Project Settings page for an empty project renders as expected:
TypeError: Cannot read property 'goto' of undefined
at BrainBox\test\utils.js:178:14
at new Promise (<anonymous>)
at Object.comparePageScreenshots (test\utils.js:174:14)
at Context.<anonymous> (test\integration\client.js:92:34)
at processImmediate (internal/timers.js:456:21)
11) TESTING CLIENT-SIDE RENDERING
Test website rendering
User page renders as expected:
TypeError: Cannot read property 'goto' of undefined
at BrainBox\test\utils.js:178:14
at new Promise (<anonymous>)
at Object.comparePageScreenshots (test\utils.js:174:14)
at Context.<anonymous> (test\integration\client.js:102:34)
at processImmediate (internal/timers.js:456:21)
12) TESTING CLIENT-SIDE RENDERING
Test website rendering
Remove test MRI from db and disk:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
13) TESTING THE /mri ROUTE
/mri route
get("/") should return status 200:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
14) TESTING THE /mri ROUTE
/mri route
Should return an error message requesting page for an empty GET /mri/json/:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
15) TESTING THE /mri ROUTE
/mri route
POST /mri/json without parameters should fail:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
16) TESTING THE /mri ROUTE
/mri route
POST /mri/json with url should start a download:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
17) TESTING THE /mri ROUTE
/mri route
POST /mri/json with url should return MRI info once the file is downloaded:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
18) TESTING THE /mri ROUTE
/mri route
GET /mri/json?page=0 should return an array with >=1 file:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
19) TESTING THE /mri ROUTE
/mri route
GET /mri/json should provide MRI info for an existing file:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
20) TESTING THE /mri ROUTE
/mri route
Remove test MRI from db and disk:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
21) TESTING THE /project ROUTE
"before all" hook in "TESTING THE /project ROUTE":
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
22) TESTING THE /user ROUTE
Obtaining user information
Add test MRI:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
23) TESTING THE /user ROUTE
Obtaining user information
get("/") should return status 200:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
24) TESTING THE /user ROUTE
Obtaining user information
get("/user/json/") should get an error message requesting page:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
25) TESTING THE /user ROUTE
Obtaining user information
get("/user/json?page=0") should return an array:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
26) TESTING THE /user ROUTE
Obtaining user information
get("/user/json/foo") should return status 200:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
27) TESTING THE /user ROUTE
Obtaining user information
get("/user/json/foo/files") should return an object with an array of files:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
28) TESTING THE /user ROUTE
Obtaining user information
get("/user/json/foo/atlas") should return an object with an array of atlas:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
29) TESTING THE /user ROUTE
Obtaining user information
get("/user/json/foo/projects") should return an object with an array of projects:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
30) TESTING THE /user ROUTE
Obtaining user information
get("/user/foo") should return status 200:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
31) TESTING THE /user ROUTE
Obtaining user information
get("/user/json/foo") should return expected values:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
32) TESTING THE /user ROUTE
Obtaining user information
Remove test MRI from db and disk:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
33) TESTING WEBSOCKET WORKFLOW
WS connection
Can create a WS connection:
Uncaught Error: connect ECONNREFUSED 127.0.0.1:8080
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
34) TESTING WEBSOCKET WORKFLOW
WS connection
Can send little data:
Error: WebSocket is not open: readyState 2 (CLOSING)
at WebSocket.send (node_modules\ws\lib\websocket.js:314:19)
at Context.<anonymous> (test\integration\workflow-ws.js:42:10)
at processImmediate (internal/timers.js:456:21)
35) TESTING WEBSOCKET WORKFLOW
WS connection
Can trigger a data download:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
36) TESTING WEBSOCKET WORKFLOW
WS connection
Can send larger data:
TypeError: Cannot read property 'url' of undefined
at Context.<anonymous> (test\integration\workflow-ws.js:67:41)
at processImmediate (internal/timers.js:456:21)
37) TESTING WEBSOCKET WORKFLOW
WS connection
Can request data:
Error: WebSocket is not open: readyState 2 (CLOSING)
at WebSocket.send (node_modules\ws\lib\websocket.js:314:19)
at Context.<anonymous> (test\integration\workflow-ws.js:76:10)
at processImmediate (internal/timers.js:456:21)
38) TESTING WEBSOCKET WORKFLOW
WS connection
Can receive data:
Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (BrainBox\test\integration\workflow-ws.js)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
39) TESTING WEBSOCKET WORKFLOW
WS connection
Remove test MRI from db and disk:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
40) TESTING AN MRI UPLOAD/DOWNLOAD WORKFLOW
Fail soon
Returns 404:
Error: connect ECONNREFUSED 127.0.0.1:3001
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 40
npm ERR! brainbox@0.1.0 mocha-test: `mocha --exit ./test/runner.js test/unit/*.js test/integration/*.js`
npm ERR! Exit status 40
npm ERR!
npm ERR! Failed at the brainbox@0.1.0 mocha-test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! npm-cache\_logs\2020-05-17T10_40_12_080Z-debug.log
one tricky/hacky thing to do (which we need to describe in the Installation instructions...) is that you need to generate a self-signed certificate, put the paths in the cfg.json
file, and accept the certificate in a web browser (this is the funny bit). You have to:
npm start
https://localhost:8080
(not to port 3001, but to port 8080, which is the wss port)after that all calls involving ssl should work.
I tried to allow the possibility not use ssl by specifying it in cfg.json
via the the secure
option, but maybe you don't want to preserve that option for ease of maintenance.
One thing I did not understand is that I had to run npm start
in a separate terminal before running npm run mocha-test
maybe you should explicit this in the instructions.
At the moment I'm failing at the test "Home page renders as expected". My image is very near the expected one but not exactly the same, maybe we would need to increase the maximum number of different pixel (I get 10161 different pixels which is 0.5% of the total, but the threshold is set at 1000).
secure
flag is not being used anymore and should go away.npm start
for testingare the remaining tests passing fine?
I had to increase a lot the timeouts because my computer is very slow, but now everything is passing!
great! the slowness is a real issue... and jquery is a big part of the problem. I started removing it from some pages, and the gain in speed is huge! but that's for another issue. I'll close this one :)
Hi @r03ert0 @ntraut @katjaq I'm also failing in this test can you please help me in this. actually the problem is how I'm generate the self asigned certificate and what is the path that I have put in cfg.json file.
hello @keshavg2, i since made change in brainbox to be able to run locally without using https. you just have to set secure=false in the configuration file (which should already be set like that in the example file)
Thank you for your feedback.
Please tag your issue as a feature request or a bug report using the labels on the right.
Current behaviour
I don't manage to run
npm run mocha-test
without error before doing a pull request. I don't think it is related to my modifications, maybe with my set up.Expected behaviour
tests are passing
Version information (for bug reports)
v12.16.3 6.14.4