From 4aa67cc73e2cab767f4e970d2b50ab22725cbaab Mon Sep 17 00:00:00 2001 From: David Halls Date: Tue, 8 Sep 2020 08:57:46 +0100 Subject: [PATCH] Fix tests, re-run coverage --- coverage/lcov-report/index.html | 2 +- coverage/lcov-report/mqlobber/index.html | 2 +- coverage/lcov-report/mqlobber/index.js.html | 2 +- .../lcov-report/mqlobber/lib/client.js.html | 16 ++-- coverage/lcov-report/mqlobber/lib/index.html | 2 +- .../lcov-report/mqlobber/lib/server.js.html | 28 +++---- coverage/lcov.info | 80 +++++++++---------- test/in-mem.js | 4 +- test/runner.js | 25 +++++- 9 files changed, 90 insertions(+), 71 deletions(-) diff --git a/coverage/lcov-report/index.html b/coverage/lcov-report/index.html index 11b7626..8f363be 100644 --- a/coverage/lcov-report/index.html +++ b/coverage/lcov-report/index.html @@ -110,7 +110,7 @@

All files

diff --git a/coverage/lcov-report/mqlobber/index.html b/coverage/lcov-report/mqlobber/index.html index 187cdeb..f10a5b4 100644 --- a/coverage/lcov-report/mqlobber/index.html +++ b/coverage/lcov-report/mqlobber/index.html @@ -95,7 +95,7 @@

All files mqlobber

diff --git a/coverage/lcov-report/mqlobber/index.js.html b/coverage/lcov-report/mqlobber/index.js.html index 1c017ec..bda1d69 100644 --- a/coverage/lcov-report/mqlobber/index.js.html +++ b/coverage/lcov-report/mqlobber/index.js.html @@ -76,7 +76,7 @@

All files / mqlobber in diff --git a/coverage/lcov-report/mqlobber/lib/client.js.html b/coverage/lcov-report/mqlobber/lib/client.js.html index 0611a59..8aed404 100644 --- a/coverage/lcov-report/mqlobber/lib/client.js.html +++ b/coverage/lcov-report/mqlobber/lib/client.js.html @@ -1058,7 +1058,7 @@

All files / mqlobber/lib       -520900x +520904x   2x   @@ -1069,7 +1069,7 @@

All files / mqlobber/lib   1909x   -33x +7x     1909x @@ -1079,17 +1079,17 @@

All files / mqlobber/lib   1909x   -498766x +504765x     1909x   -1909x +1906x     1909x   -1909x +1907x     1909x @@ -1106,7 +1106,7 @@

All files / mqlobber/lib   1909x   -440426x +440424x     1909x @@ -1730,7 +1730,7 @@

All files / mqlobber/lib grunt coverage ```   -[Instanbul](http://gotwarlost.github.io/istanbul/) results are available [here](http://rawgit.davedoesdev.com/davedoesdev/mqlobber/master/coverage/lcov-report/index.html). +[Istanbul](http://gotwarlost.github.io/istanbul/) results are available [here](http://rawgit.davedoesdev.com/davedoesdev/mqlobber/master/coverage/lcov-report/index.html).   Coveralls page is [here](https://coveralls.io/r/davedoesdev/mqlobber).   @@ -2317,7 +2317,7 @@

All files / mqlobber/lib diff --git a/coverage/lcov-report/mqlobber/lib/index.html b/coverage/lcov-report/mqlobber/lib/index.html index b9d9a83..1165bde 100644 --- a/coverage/lcov-report/mqlobber/lib/index.html +++ b/coverage/lcov-report/mqlobber/lib/index.html @@ -110,7 +110,7 @@

All files mqlobber/lib

diff --git a/coverage/lcov-report/mqlobber/lib/server.js.html b/coverage/lcov-report/mqlobber/lib/server.js.html index e0b6e54..a4663c2 100644 --- a/coverage/lcov-report/mqlobber/lib/server.js.html +++ b/coverage/lcov-report/mqlobber/lib/server.js.html @@ -681,15 +681,15 @@

All files / mqlobber/lib       -14x +15x           -515095x +515097x   -85x +87x     1907x @@ -709,7 +709,7 @@

All files / mqlobber/lib   1907x   -51x +3x     1907x @@ -719,7 +719,7 @@

All files / mqlobber/lib   1907x   -498766x +503868x     1907x @@ -752,15 +752,15 @@

All files / mqlobber/lib       -440453x +440455x   -440453x +440455x   440426x 440426x     -440453x +440455x   8x   @@ -769,7 +769,7 @@

All files / mqlobber/lib 6x     -440445x +440447x     440426x @@ -818,19 +818,19 @@

All files / mqlobber/lib   440416x   -23x +25x     440416x   440416x   -440418x -  -440420x +440416x   440418x   +440416x +    2x   @@ -1795,7 +1795,7 @@

All files / mqlobber/lib diff --git a/coverage/lcov.info b/coverage/lcov.info index 184129e..828b407 100644 --- a/coverage/lcov.info +++ b/coverage/lcov.info @@ -46,14 +46,14 @@ FNDA:1909,MQlobberClient FNDA:47,error FNDA:6030,warning FNDA:58360,(anonymous_3) -FNDA:520900,handshake_sent -FNDA:33,(anonymous_5) +FNDA:520904,handshake_sent +FNDA:7,(anonymous_5) FNDA:4,(anonymous_6) -FNDA:498766,(anonymous_7) -FNDA:1909,(anonymous_8) -FNDA:1909,(anonymous_9) +FNDA:504765,(anonymous_7) +FNDA:1906,(anonymous_8) +FNDA:1907,(anonymous_9) FNDA:2,end -FNDA:440426,(anonymous_11) +FNDA:440424,(anonymous_11) FNDA:498792,(anonymous_12) FNDA:440427,dend FNDA:134234,done @@ -98,27 +98,27 @@ DA:238,58366 DA:240,58360 DA:243,6 DA:247,1909 -DA:251,520900 +DA:251,520904 DA:253,2 DA:257,1909 DA:258,1909 DA:260,1909 -DA:262,33 +DA:262,7 DA:265,1909 DA:267,4 DA:270,1909 -DA:272,498766 +DA:272,504765 DA:275,1909 -DA:277,1909 +DA:277,1906 DA:280,1909 -DA:282,1909 +DA:282,1907 DA:285,1909 DA:290,2 DA:293,1909 DA:294,1909 DA:295,1909 DA:297,1909 -DA:299,440426 +DA:299,440424 DA:302,1909 DA:304,498792 DA:306,1903 @@ -295,7 +295,7 @@ BRDA:227,1,1,6022 BRDA:238,2,0,58360 BRDA:238,2,1,6 BRDA:251,3,0,2 -BRDA:251,3,1,520898 +BRDA:251,3,1,520902 BRDA:304,4,0,1903 BRDA:304,4,1,496889 BRDA:311,5,0,56465 @@ -444,20 +444,20 @@ FN:572,(anonymous_37) FNF:38 FNH:38 FNDA:1907,MQlobberServer -FNDA:14,error -FNDA:515095,warning +FNDA:15,error +FNDA:515097,warning FNDA:548477,handshake_sent -FNDA:51,(anonymous_4) +FNDA:3,(anonymous_4) FNDA:4,(anonymous_5) -FNDA:498766,(anonymous_6) +FNDA:503868,(anonymous_6) FNDA:1907,(anonymous_7) FNDA:5120,(anonymous_8) FNDA:5095,(anonymous_9) FNDA:440426,(anonymous_10) -FNDA:440453,cb +FNDA:440455,cb FNDA:440418,multiplex -FNDA:23,(anonymous_13) -FNDA:440418,(anonymous_14) +FNDA:25,(anonymous_13) +FNDA:440416,(anonymous_14) FNDA:2,(anonymous_15) FNDA:16132,(anonymous_16) FNDA:2,end @@ -496,9 +496,9 @@ DA:36,1907 DA:37,1907 DA:38,1907 DA:43,1907 -DA:48,14 -DA:54,515095 -DA:56,85 +DA:48,15 +DA:54,515097 +DA:56,87 DA:59,1907 DA:61,1907 DA:65,548477 @@ -506,11 +506,11 @@ DA:67,2 DA:71,1907 DA:72,1907 DA:74,1907 -DA:76,51 +DA:76,3 DA:79,1907 DA:81,4 DA:84,1907 -DA:86,498766 +DA:86,503868 DA:89,1907 DA:91,1907 DA:93,1907 @@ -521,15 +521,15 @@ DA:106,5120 DA:108,5095 DA:113,1907 DA:115,440426 -DA:119,440453 -DA:121,440453 +DA:119,440455 +DA:121,440455 DA:123,440426 DA:124,440426 -DA:127,440453 +DA:127,440455 DA:129,8 DA:131,2 DA:133,6 -DA:136,440445 +DA:136,440447 DA:139,440426 DA:140,440426 DA:142,440426 @@ -550,12 +550,12 @@ DA:171,440422 DA:174,440426 DA:178,440418 DA:183,440416 -DA:185,23 +DA:185,25 DA:188,440416 DA:190,440416 -DA:192,440418 -DA:194,440420 -DA:196,440418 +DA:192,440416 +DA:194,440418 +DA:196,440416 DA:199,2 DA:203,440416 DA:205,16134 @@ -699,20 +699,20 @@ LF:214 LH:214 BRDA:33,0,0,1907 BRDA:33,0,1,5 -BRDA:54,1,0,85 +BRDA:54,1,0,87 BRDA:54,1,1,515010 -BRDA:54,2,0,515095 -BRDA:54,2,1,18255 +BRDA:54,2,0,515097 +BRDA:54,2,1,18257 BRDA:65,3,0,2 BRDA:65,3,1,548475 BRDA:93,4,0,5 BRDA:93,4,1,1902 BRDA:103,5,0,5120 BRDA:121,6,0,440426 -BRDA:121,6,1,27 +BRDA:121,6,1,29 BRDA:127,7,0,8 -BRDA:127,7,1,440445 -BRDA:127,8,0,440453 +BRDA:127,7,1,440447 +BRDA:127,8,0,440455 BRDA:127,8,1,12 BRDA:129,9,0,2 BRDA:129,9,1,6 @@ -732,7 +732,7 @@ BRDA:166,16,0,440422 BRDA:166,16,1,4 BRDA:188,17,0,440416 BRDA:188,17,1,440416 -BRDA:194,18,0,440418 +BRDA:194,18,0,440416 BRDA:194,18,1,2 BRDA:203,19,0,16134 BRDA:203,19,1,424282 diff --git a/test/in-mem.js b/test/in-mem.js index b00120c..3864505 100644 --- a/test/in-mem.js +++ b/test/in-mem.js @@ -8,7 +8,7 @@ var common = require('./runner'), function RightDuplex(left) { - Duplex.call(this); + Duplex.call(this, { autoDestroy: false }); this.left = left; } @@ -44,7 +44,7 @@ RightDuplex.prototype._write = function (chunk, encoding, cb) function LeftDuplex() { - Duplex.call(this); + Duplex.call(this, { autoDestroy: false }); this.right = new RightDuplex(this); } diff --git a/test/runner.js b/test/runner.js index 0a5e9e4..9c88c2e 100644 --- a/test/runner.js +++ b/test/runner.js @@ -191,10 +191,19 @@ describe(type + ', use_qlobber_pg=' + use_qlobber_pg, function () { mq.server.on('error', function (err) { - expect(err.message).to.equal('This socket has been ended by the other party'); + expect(err.message).to.be.oneOf([ + 'This socket has been ended by the other party', + 'write EPIPE' + ]); }); } + mq.client_stream.on('error', function () + { + // In the tests we keep going on error + this._readableState.errorEmitted = false; + }); + mq.client_stream.on('end', cb); mq.server_stream.on('end', function () { @@ -1174,6 +1183,7 @@ describe(type + ', use_qlobber_pg=' + use_qlobber_pg, function () mqs[0].client.on('removed', function () { removed += 1; + check(); }); mqs[0].client.subscribe('foo', function (s, info) @@ -1265,7 +1275,8 @@ describe(type + ', use_qlobber_pg=' + use_qlobber_pg, function () [ 'carrier stream ended before end message received', 'carrier stream finished before duplex finished', - 'This socket has been ended by the other party' + 'This socket has been ended by the other party', + 'write EPIPE' ]); }); @@ -1275,7 +1286,8 @@ describe(type + ', use_qlobber_pg=' + use_qlobber_pg, function () [ 'carrier stream ended before end message received', 'carrier stream finished before duplex finished', - 'This socket has been ended by the other party' + 'This socket has been ended by the other party', + 'write EPIPE' ]); }); @@ -3342,6 +3354,13 @@ describe(type + ', use_qlobber_pg=' + use_qlobber_pg, function () } } + cs.on('error', function (err) + { + expect(err.message).to.equal('write after end'); + // In the test we keep going on error + this._readableState.errorEmitted = false; + }); + cs.on('end', function () { expect(ended).to.equal(false);