test-fatal-auth-error-going-to-all-callbacks.js 632 B

1234567891011121314151617181920212223242526
  1. var common = require('../../common');
  2. var connection = common.createConnection({password: common.bogusPassword});
  3. var assert = require('assert');
  4. var errors = {};
  5. connection.connect(function(err) {
  6. assert.equal(errors.a, undefined);
  7. errors.a = err;
  8. });
  9. connection.query('SELECT 1', function(err) {
  10. assert.equal(errors.b, undefined);
  11. errors.b = err;
  12. connection.end();
  13. });
  14. process.on('exit', function() {
  15. if (process.env.NO_GRANT == '1' && errors.a === null) return;
  16. assert.equal(errors.a.code, 'ER_ACCESS_DENIED_ERROR');
  17. assert.equal(errors.a.fatal, true);
  18. assert.strictEqual(errors.a, errors.b);
  19. });