Skip to content

Connection smoke test passes even when login fails #63

Description

@yeongseon

Summary

test/CUBRID.createConnection.js currently reports a passing smoke test even when client.connect() fails with a database login error.

Reproduction

The direct connection path fails in my environment:

cd /data/GitHub/node-cubrid
node - <<'NODE'
const CUBRID = require('./');
(async()=>{
  const client = new CUBRID.createConnection({ hosts:['localhost'], port:33000, user:'public', password:'', database:'demodb' });
  try {
    await client.connect();
    console.log('connect ok');
  } catch (err) {
    console.log(err.message);
  } finally {
    try { await client.close(); } catch {}
  }
})();
NODE

Output:

Failed to connect to database server, 'demodb', on the following host(s): 6097ef1c0bda:localhost

But the smoke test still passes:

./node_modules/mocha/bin/mocha test/CUBRID.createConnection.js --grep "create and close several client connections"

Why the test is a false positive

Inside test/CUBRID.createConnection.js, the promise chain catches any error and only rethrows ECONNREFUSED. Other failures, including login/auth/database errors, are swallowed and the test increments closedCount anyway.

That means the test can stay green while the core connection path is broken.

Expected

The smoke test should fail on any unexpected connect() or getEngineVersion() failure.

Suggested fix

Tighten the catch block so it only ignores explicitly intended failures, or remove the catch and assert the happy path directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions