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

Spock Unroll tests rollback regression #911

Closed
mattlong-finocomp opened this issue Dec 5, 2023 · 1 comment · Fixed by #953
Closed

Spock Unroll tests rollback regression #911

mattlong-finocomp opened this issue Dec 5, 2023 · 1 comment · Fixed by #953
Assignees

Comments

@mattlong-finocomp
Copy link

Expected Behavior

When writing a Spock test that has Unroll semantics (which is now implicit) performs DB operations, the transaction should be rolled back for each iteration that is performed.
This used to be the case in Micronaut 3.

Actual Behaviour

The transaction is not rolled back until after all iterations of the Unroll are performed.
The transaction is rolled back for each iteration if the MicronautTest annotation has a transactionMode of SINGLE_TRANSACTION.

Steps To Reproduce

Run the following tests in the linked example application:
UnrollRollbackSpec - proves that the transaction isn't rolled back between iterations
UnrollRollbackSingleTransactionSpec - proves that the transaction is rolled back between iterations when transactionMode is SINGLE_TRANSACTION

Environment Information

OS: Pop!OS 22.04
Java: 17

Example Application

https://github.com/mattlong-finocomp/micronaut-unroll-rollback

Version

4.2.1

timyates added a commit that referenced this issue Feb 16, 2024
When a feature is using `@Unroll` (which is implicit in recent versions of Spock), we needed to
add the interceptor to the iteration interceptor handler instead of the standard handler.

This bug was visible in #911 where specs that were parameterized did not properly revert the
transaction between iterations.

Closes #911
sdelamo pushed a commit that referenced this issue Feb 16, 2024
When a feature is using `@Unroll` (which is implicit in recent versions of Spock), we needed to
add the interceptor to the iteration interceptor handler instead of the standard handler.

This bug was visible in #911 where specs that were parameterized did not properly revert the
transaction between iterations.

Closes #911
timyates added a commit that referenced this issue Feb 16, 2024
When a feature is using `@Unroll` (which is implicit in recent versions of Spock), we needed to
add the interceptor to the iteration interceptor handler instead of the standard handler.

This bug was visible in #911 where specs that were parameterized did not properly revert the
transaction between iterations.

Closes #911
@timyates
Copy link
Contributor

@mattlong-finocomp Thank you so much for the report and the reproducer! This is fixed by #953 and will be in the forthcoming micronaut-test 4.2.1 and 4.3.0 👍

sdelamo pushed a commit that referenced this issue Feb 16, 2024
When a feature is using `@Unroll` (which is implicit in recent versions of Spock), we needed to
add the interceptor to the iteration interceptor handler instead of the standard handler.

This bug was visible in #911 where specs that were parameterized did not properly revert the
transaction between iterations.

Closes #911
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants