Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MockChannel don't clear transaction when rollback #133

Closed
KayWu opened this issue Jul 16, 2020 · 2 comments
Closed

MockChannel don't clear transaction when rollback #133

KayWu opened this issue Jul 16, 2020 · 2 comments

Comments

@KayWu
Copy link
Contributor

KayWu commented Jul 16, 2020

MockChannel reuses transaction when rollback, which leaves wrong published messages in transaction.

// modify origin commit_or_rollback_can_be_called_multiple_times_after_a_single_select
String thirdMsg = "third message";
channel.basicPublish("", queue, null, thirdMsg.getBytes());
assertThat(channel.basicGet(queue, true)).isNull();
channel.txRollback();
assertThat(channel.basicGet(queue, true)).isNull();
                                                                                    
String fourthMsg = "fourth message";
channel.basicPublish("", queue, null, fourthMsg.getBytes());
assertThat(channel.basicGet(queue, true)).isNull();
channel.txCommit();
assertThat(channel.basicGet(queue, true).getBody()).isEqualTo(fourthMsg.getBytes());
@KayWu
Copy link
Contributor Author

KayWu commented Jul 16, 2020

I raised a PR #134

@ledoyen
Copy link
Contributor

ledoyen commented Jul 16, 2020

In the future, don't bother opening an issue and a PR if you plan to propose a fix, the PR is sufficient (and very welcome, thank you again)

@KayWu KayWu closed this as completed Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants