mkozjak / node-telnet-client

A simple telnet client for Node.js
Other
350 stars 97 forks source link

Unit tests fail #202

Open kshetline opened 2 years ago

kshetline commented 2 years ago

With a fresh checkout of the latest code, npm run test yields these results, with a final report of "1/16 assertions failed", but more failures than just one single test along the way.

001_generic
Unhandled rejection Error: Socket ends
    at Socket.<anonymous> (/Users/kshetline/programming_projects/temp2/node-telnet-client/lib/index.js:116:18)
    at Socket.emit (node:events:402:35)
    at Socket.emit (node:domain:475:12)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

✔ generic - connect

002_busybox
(node:41170) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
✔ busybox - exec_string_shellprompt
✔ busybox - exec_regex_shellprompt

003_server_push
✔ server_push - receive_pushed_data

004_negotiation_optional
✔ negotiation_optional - send_data
✔ negotiation_optional - send_data_without_options
✔ negotiation_optional - send_data_without_options_promise

005_login
✔ login - ok
✔ login - fail

006_stress
Unhandled rejection Error: Socket closes
    at Socket.<anonymous> (/Users/kshetline/programming_projects/temp2/node-telnet-client/lib/index.js:123:18)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at TCP.<anonymous> (node:net:687:12)
    at TCP.callbackTrampoline (node:internal/async_hooks:130:17)

✔ stress - buffer_exceeded

007_streams
✖ streams - shell

AssertionError:
'23:14  up 1 day, 21:50, 6 users, load averages: 1.41 1.43 1.41\r\n' +
  '/ # /dev/disk1     112Gi   87Gi   25Gi    78% 1913034 4293054245    0%   /\r\n' +
  '/ # '
==
'uptime\n' +
  '23:14  up 1 day, 21:50, 6 users, load averages: 1.41 1.43 1.41\r\n' +
  '/ # df\n' +
  '/dev/disk1     112Gi   87Gi   25Gi    78% 1913034 4293054245    0%   /\r\n' +
  '/ # '
    at Object.equals (/Users/kshetline/programming_projects/temp2/node-telnet-client/node_modules/nodeunit/lib/types.js:83:39)
    at /Users/kshetline/programming_projects/temp2/node-telnet-client/test/007_streams.js:65:18
    at tryCatcher (/Users/kshetline/programming_projects/temp2/node-telnet-client/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/kshetline/programming_projects/temp2/node-telnet-client/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/Users/kshetline/programming_projects/temp2/node-telnet-client/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromiseCtx (/Users/kshetline/programming_projects/temp2/node-telnet-client/node_modules/bluebird/js/release/promise.js:606:10)
    at _drainQueueStep (/Users/kshetline/programming_projects/temp2/node-telnet-client/node_modules/bluebird/js/release/async.js:142:12)
    at _drainQueue (/Users/kshetline/programming_projects/temp2/node-telnet-client/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/Users/kshetline/programming_projects/temp2/node-telnet-client/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues (/Users/kshetline/programming_projects/temp2/node-telnet-client/node_modules/bluebird/js/release/async.js:17:14)
    at processImmediate (node:internal/timers:464:21)
    at process.topLevelDomainCallback (node:domain:152:15)
    at process.callbackTrampoline (node:internal/async_hooks:128:24)

008_connection_hopping
✔ connection_hopping - connection_hopping

009_initial_lfcr
✔ initial_lfcr - initial_lfcr

010_initial_lfcr_before_login
✔ initial_lfcr_before_login - initial_lfcr_before_login

011_dynamic_shellprompt
✔ dynamic_shellprompt - dynamic_prompt_with_regex

012_prompt_same_line
✔ prompt_same_line - prompt_same_line

FAILURES: 1/16 assertions failed (726ms)

I'm trying to make some upgrades to the code, but without the current unit tests fully succeeding I can't tell for sure if and when any of my changes might break something that wasn't previously broken.