connection-manager.test.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. 'use strict';
  2. const { expect } = require('chai');
  3. const Support = require('../../support');
  4. const { Sequelize } = require('@sequelize/core');
  5. const dialectName = Support.getTestDialect();
  6. describe('[MSSQL Specific] Connection Manager', () => {
  7. if (dialectName !== 'mssql') {
  8. return;
  9. }
  10. describe('Errors', () => {
  11. // TODO [>=7.0.0-beta]: Refactor so this is the only connection it tries to connect with
  12. it.skip('ECONNREFUSED', async () => {
  13. const sequelize = Support.createSingleTestSequelizeInstance({
  14. server: '127.0.0.1',
  15. port: 34_237,
  16. });
  17. await expect(sequelize.pool.acquire()).to.have.been.rejectedWith(
  18. Sequelize.ConnectionRefusedError,
  19. );
  20. await sequelize.close();
  21. });
  22. it('ENOTFOUND', async () => {
  23. const sequelize = Support.createSingleTestSequelizeInstance({
  24. server: 'wowow.example.com',
  25. });
  26. await expect(sequelize.pool.acquire()).to.have.been.rejectedWith(Sequelize.HostNotFoundError);
  27. await sequelize.close();
  28. });
  29. // TODO [>=7.0.0-beta]: Refactor so this is the only connection it tries to connect with
  30. it.skip('EHOSTUNREACH', async () => {
  31. const sequelize = Support.createSingleTestSequelizeInstance({ server: '255.255.255.255' });
  32. await expect(sequelize.pool.acquire()).to.have.been.rejectedWith(
  33. Sequelize.HostNotReachableError,
  34. );
  35. await sequelize.close();
  36. });
  37. it('ER_ACCESS_DENIED_ERROR | ELOGIN', async () => {
  38. const sequelize = Support.createSingleTestSequelizeInstance({
  39. database: 'db',
  40. authentication: {
  41. type: 'default',
  42. options: {
  43. userName: 'was',
  44. password: 'ddsd',
  45. },
  46. },
  47. });
  48. await expect(sequelize.pool.acquire()).to.have.been.rejectedWith(Sequelize.AccessDeniedError);
  49. await sequelize.close();
  50. });
  51. });
  52. });