moscajs / aedes-tests

Integration/Black Box tests for Aedes MQTT Broker
MIT License
5 stars 1 forks source link

[bug] Tests timeout on clean install #23

Open gerad opened 3 years ago

gerad commented 3 years ago

System Information

Describe the bug

Connect-Subscribe-Publish-Disconnect 300 clients using WS and MQTT/MQTTS test hangs when running

 FAIL  test/basic.test.js
 ✖ timeout!

  test: Connect-Subscribe-Publish-Disconnect 300 clients using WS and MQTT/MQTTS
    protocols

To Reproduce

Run the test: NO_CLUSTERS=true DB=default npm run test

Additional context

Here are the dependencies I have installed (just downloaded the repo and ran a fresh npm install).

> npm ls --depth=1
aedes-tests@0.0.1 /Users/Gerad/Development/aedes-tests
├─┬ aedes@0.42.6
│ ├── aedes-packet@2.3.1
│ ├── aedes-persistence@8.1.1 deduped
│ ├── aedes-protocol-decoder@1.0.0
│ ├── bulk-write-stream@2.0.1
│ ├── end-of-stream@1.4.4
│ ├── fastfall@1.5.1
│ ├── fastparallel@2.4.0
│ ├── fastseries@2.0.0
│ ├── mqemitter@4.4.0 deduped
│ ├── mqtt-packet@6.7.0
│ ├── proxy-protocol-js@4.0.5
│ ├── readable-stream@3.6.0
│ ├── retimer@2.0.0
│ ├── reusify@1.0.4
│ ├── shortid@2.2.16
│ └── uuid@8.3.1
├─┬ aedes-persistence@8.1.1
│ ├── aedes-packet@2.3.1 deduped
│ ├── from2@2.3.0
│ └── qlobber@5.0.3
├─┬ aedes-persistence-mongodb@8.1.2
│ ├── aedes-cached-persistence@8.1.0
│ ├── escape-string-regexp@4.0.0
│ ├── fastparallel@2.4.0 deduped
│ ├── mongodb@3.6.3
│ ├── native-url@0.3.4
│ ├── pump@3.0.0
│ ├── qlobber@5.0.3 deduped
│ └── through2@4.0.2
├─┬ aedes-persistence-redis@7.0.0
│ ├── aedes-cached-persistence@8.1.0 deduped
│ ├── from2@2.3.0 deduped
│ ├── hashlru@2.3.0
│ ├── ioredis@4.19.2
│ ├── msgpack-lite@0.1.26
│ ├── pump@3.0.0 deduped
│ ├── qlobber@5.0.3 deduped
│ ├── through2@3.0.2
│ └── throughv@1.0.4
├─┬ async-mqtt@2.6.1
│ └── mqtt@4.2.6
├─┬ mongo-clean@2.0.0
│ └── steed@1.1.3
├─┬ mqemitter@4.4.0
│ ├── fastparallel@2.4.0 deduped
│ └── qlobber@5.0.3 deduped
├─┬ mqemitter-mongodb@7.0.4
│ ├── inherits@2.0.4
│ ├── mongodb@3.6.3 deduped
│ ├── mqemitter@4.4.0 deduped
│ ├── pump@3.0.0 deduped
│ └── through2@4.0.2 deduped
├─┬ mqemitter-redis@4.0.3
│ ├── hyperid@2.0.5
│ ├── inherits@2.0.4 deduped
│ ├── ioredis@4.19.2 deduped
│ ├── ioredis-auto-pipeline@1.0.2
│ ├── lru-cache@5.1.1
│ ├── mqemitter@4.4.0 deduped
│ └── msgpack-lite@0.1.26 deduped
├─┬ p-map@4.0.0
│ └── aggregate-error@3.1.0
├─┬ snazzy@8.0.0
│ ├── chalk@2.4.2
│ ├── inherits@2.0.4 deduped
│ ├── minimist@1.2.5
│ ├── readable-stream@3.6.0 deduped
│ ├── standard-json@1.1.0
│ ├── strip-ansi@4.0.0
│ └── text-table@0.2.0
├─┬ standard@14.3.4
│ ├── eslint@6.8.0
│ ├── eslint-config-standard@14.1.1
│ ├── eslint-config-standard-jsx@8.1.0
│ ├── eslint-plugin-import@2.18.2
│ ├── eslint-plugin-node@10.0.0
│ ├── eslint-plugin-promise@4.2.1
│ ├── eslint-plugin-react@7.14.3
│ ├── eslint-plugin-standard@4.0.2
│ └── standard-engine@12.1.0
├─┬ tap@14.11.0
│ ├── @types/react@16.9.43
│ ├── async-hook-domain@1.1.3
│ ├── bind-obj-methods@2.0.0
│ ├── browser-process-hrtime@1.0.0
│ ├── chokidar@3.4.3
│ ├── color-support@1.1.3
│ ├── coveralls@3.1.0
│ ├── diff@4.0.2
│ ├── esm@3.2.25
│ ├── findit@2.0.0
│ ├── flow-remove-types@2.139.0
│ ├── foreground-child@1.5.6
│ ├── fs-exists-cached@1.0.0
│ ├── function-loop@1.0.2
│ ├── glob@7.1.6
│ ├── import-jsx@3.1.0
│ ├── ink@2.7.1
│ ├── isexe@2.0.0
│ ├── istanbul-lib-processinfo@1.0.0
│ ├── jackspeak@1.4.0
│ ├── minipass@3.1.3
│ ├── mkdirp@0.5.5
│ ├── nyc@14.1.1
│ ├── opener@1.5.2
│ ├── own-or@1.0.0
│ ├── own-or-env@1.0.1
│ ├── react@16.14.0
│ ├── rimraf@2.7.1
│ ├── signal-exit@3.0.3
│ ├── source-map-support@0.5.19
│ ├── stack-utils@1.0.4
│ ├── tap-mocha-reporter@5.0.1
│ ├── tap-parser@10.0.1
│ ├── tap-yaml@1.0.0
│ ├── tcompare@3.0.4
│ ├── treport@1.0.2
│ ├── trivial-deferred@1.0.1
│ ├── ts-node@8.10.2
│ ├── typescript@3.9.7
│ ├── which@2.0.2
│ ├── write-file-atomic@3.0.3
│ ├── yaml@1.10.0
│ └── yapool@1.0.0
└── ws@7.4.1
gerad commented 3 years ago

I was able to get the test passing by switching to using Promise.all and adding a { qos: 1 } to the publish.

diff --git a/test/basic.test.js b/test/basic.test.js
index 296c55a..c6d3ff6 100644
--- a/test/basic.test.js
+++ b/test/basic.test.js
@@ -24,9 +24,9 @@ test('Connect-Subscribe-Publish-Disconnect 300 clients using WS and MQTT/MQTTS p
   }

   var clients = await Promise.all(connects)
-  await pMap(clients, c => c.subscribe('my/topic'), pMapOptions)
-  await pMap(clients, c => c.publish('my/topic', 'I\'m client ' + c._client.options.clientId), pMapOptions)
-  await pMap(clients, c => c.end(), pMapOptions)
+  await Promise.all(clients.map(c => c.subscribe('my/topic')))
+  await Promise.all(clients.map(c => c.publish('my/topic', 'I\'m client ' + c._client.options.clientId, { qos: 1 })))
+  await Promise.all(clients.map(c => c.end()))
 })

 test('Unhautorized client', async function (t) {

Note adding { qos: 1 } to the subscribe caused it to hang again.

robertsLando commented 3 years ago

Hi @gerad , I don't think the problem is pMap, tests are always been very flaky and the reason is something else and I wasn't able to debug this last time I tried.