Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit e26f62f2
authored
Sep 12, 2018
by
Andreas Lind
Committed by
Sushant
Sep 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(transaction): prevent rollback without connection (#9889)
1 parent
e3bba447
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
lib/transaction.js
test/integration/transaction.test.js
lib/transaction.js
View file @
e26f62f
...
@@ -85,6 +85,10 @@ class Transaction {
...
@@ -85,6 +85,10 @@ class Transaction {
return
Utils
.
Promise
.
reject
(
new
Error
(
'Transaction cannot be rolled back because it has been finished with state: '
+
this
.
finished
));
return
Utils
.
Promise
.
reject
(
new
Error
(
'Transaction cannot be rolled back because it has been finished with state: '
+
this
.
finished
));
}
}
if
(
!
this
.
connection
)
{
return
Promise
.
reject
(
new
Error
(
'Transaction cannot be rolled back because it never started'
));
}
this
.
_clearCls
();
this
.
_clearCls
();
return
this
return
this
...
...
test/integration/transaction.test.js
View file @
e26f62f
...
@@ -161,6 +161,16 @@ if (current.dialect.supports.transactions) {
...
@@ -161,6 +161,16 @@ if (current.dialect.supports.transactions) {
).
to
.
eventually
.
be
.
rejected
;
).
to
.
eventually
.
be
.
rejected
;
});
});
it
(
'should not rollback if connection was not acquired'
,
function
()
{
this
.
sinon
.
stub
(
this
.
sequelize
.
connectionManager
,
'_connect'
)
.
returns
(
new
Support
.
Sequelize
.
Promise
(()
=>
{}));
const
transaction
=
new
Transaction
(
this
.
sequelize
);
return
expect
(
transaction
.
rollback
())
.
to
.
eventually
.
be
.
rejectedWith
(
'Transaction cannot be rolled back because it never started'
);
});
it
(
'does not allow queries immediatly after rollback call'
,
function
()
{
it
(
'does not allow queries immediatly after rollback call'
,
function
()
{
const
self
=
this
;
const
self
=
this
;
return
expect
(
return
expect
(
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment