不要怂,就是干,撸起袖子干!

Commit a914a470 by papb

ci: fix ci

Note: this commit repeats on top of the v5 branch the same modifications done by 2a79df36 and c8ca9b22 for v6.
1 parent 4b54342a
'use strict'; 'use strict';
const fs = require('fs');
let mssqlConfig;
try {
mssqlConfig = JSON.parse(fs.readFileSync(`${__dirname}/mssql.json`, 'utf8'));
} catch (e) {
// ignore
}
const env = process.env; const env = process.env;
module.exports = { module.exports = {
...@@ -23,15 +16,16 @@ module.exports = { ...@@ -23,15 +16,16 @@ module.exports = {
return parseInt(Math.random() * 999, 10); return parseInt(Math.random() * 999, 10);
}, },
mssql: mssqlConfig || { mssql: {
database: env.SEQ_MSSQL_DB || env.SEQ_DB || 'sequelize_test', host: env.SEQ_MSSQL_HOST || env.SEQ_HOST || 'localhost',
username: env.SEQ_MSSQL_USER || env.SEQ_USER || 'sequelize', username: env.SEQ_MSSQL_USER || env.SEQ_USER || 'SA',
password: env.SEQ_MSSQL_PW || env.SEQ_PW || 'nEGkLma26gXVHFUAHJxcmsrK', password: env.SEQ_MSSQL_PW || env.SEQ_PW || 'Password12!',
host: env.SEQ_MSSQL_HOST || env.SEQ_HOST || '127.0.0.1',
port: env.SEQ_MSSQL_PORT || env.SEQ_PORT || 1433, port: env.SEQ_MSSQL_PORT || env.SEQ_PORT || 1433,
database: env.SEQ_MSSQL_DB || env.SEQ_DB || 'sequelize_test',
dialectOptions: { dialectOptions: {
options: { options: {
requestTimeout: 60000 encrypt: false,
requestTimeout: 25000
} }
}, },
pool: { pool: {
......
...@@ -17,7 +17,17 @@ if (dialect === 'sqlite') { ...@@ -17,7 +17,17 @@ if (dialect === 'sqlite') {
describe(Support.getTestDialectTeaser('Configuration'), () => { describe(Support.getTestDialectTeaser('Configuration'), () => {
describe('Connections problems should fail with a nice message', () => { describe('Connections problems should fail with a nice message', () => {
it('when we don\'t have the correct server details', () => { it('when we don\'t have the correct server details', () => {
const seq = new Sequelize(config[dialect].database, config[dialect].username, config[dialect].password, { storage: '/path/to/no/where/land', logging: false, host: '0.0.0.1', port: config[dialect].port, dialect }); const seq = new Sequelize(
config[dialect].database,
config[dialect].username,
config[dialect].password,
{
storage: '/path/to/no/where/land',
logging: false,
host: 'localhost',
port: 19999, // Wrong port
dialect
});
if (dialect === 'sqlite') { if (dialect === 'sqlite') {
// SQLite doesn't have a breakdown of error codes, so we are unable to discern between the different types of errors. // SQLite doesn't have a breakdown of error codes, so we are unable to discern between the different types of errors.
return expect(seq.query('select 1 as hello')).to.eventually.be.rejectedWith(Sequelize.ConnectionError, 'SQLITE_CANTOPEN: unable to open database file'); return expect(seq.query('select 1 as hello')).to.eventually.be.rejectedWith(Sequelize.ConnectionError, 'SQLITE_CANTOPEN: unable to open database file');
...@@ -27,8 +37,7 @@ describe(Support.getTestDialectTeaser('Configuration'), () => { ...@@ -27,8 +37,7 @@ describe(Support.getTestDialectTeaser('Configuration'), () => {
it('when we don\'t have the correct login information', () => { it('when we don\'t have the correct login information', () => {
if (dialect === 'mssql') { if (dialect === 'mssql') {
// NOTE: Travis seems to be having trouble with this test against the // TODO: GitHub Actions seems to be having trouble with this test. Works perfectly fine on a local setup.
// AWS instance. Works perfectly fine on a local setup.
expect(true).to.be.true; expect(true).to.be.true;
return; return;
} }
......
...@@ -559,7 +559,7 @@ if (current.dialect.supports.transactions) { ...@@ -559,7 +559,7 @@ if (current.dialect.supports.transactions) {
return User.findAll({ transaction }) return User.findAll({ transaction })
.then(users => expect( users ).to.have.lengthOf(0)) .then(users => expect( users ).to.have.lengthOf(0))
.then(() => User.create({ username: 'jan' })) // Create a User outside of the transaction .then(() => User.create({ username: 'jan' })) // Create a User outside of the transaction
.then(() => User.findAll({ transaction })) .then(() => User.findAll({ transaction }))
.then(users => expect( users ).to.have.lengthOf(0)); // We SHOULD NOT see the created user inside the transaction .then(users => expect( users ).to.have.lengthOf(0)); // We SHOULD NOT see the created user inside the transaction
}); });
}) })
...@@ -579,17 +579,23 @@ if (current.dialect.supports.transactions) { ...@@ -579,17 +579,23 @@ if (current.dialect.supports.transactions) {
return User.create({ username: 'jan' }); return User.create({ username: 'jan' });
}).then(() => { }).then(() => {
return this.sequelize.transaction({ isolationLevel: Transaction.ISOLATION_LEVELS.SERIALIZABLE }).then(transaction => { return this.sequelize.transaction({ isolationLevel: Transaction.ISOLATION_LEVELS.SERIALIZABLE }).then(transaction => {
return User.findAll( { transaction } ) return User.findAll({ transaction }).then(() => {
.then(() => Promise.join( return Promise.all([
// Update should not succeed before transaction has committed
User.update({ username: 'joe' }, { User.update({ username: 'joe' }, {
where: { where: {
username: 'jan' username: 'jan'
} }
}).then(() => expect(transactionSpy).to.have.been.called ), // Update should not succeed before transaction has committed }).then(() => {
Promise.delay(2000) expect(transactionSpy).to.have.been.called;
.then(() => transaction.commit()) expect(transaction.finished).to.equal('commit');
}),
Promise.delay(4000)
.then(transactionSpy) .then(transactionSpy)
)); .then(() => transaction.commit())
]);
});
}); });
}); });
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!