-
-
Notifications
You must be signed in to change notification settings - Fork 234
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
Failing tests #588
Comments
Hello, @martin-ro. Inside the package for performance, a kind of saga is implemented. The work is described here #412 and here #564. Tests (pest) start with a transaction, which prevents correct verification. The package itself controls the race condition, locks and rolls back the state in case of an error in the transaction. Unfortunately, there are no other solutions available at the moment. This is a technical limitation that had to be taken to improve fault tolerance and performance. |
Hey @rez1dent3, thanks for taking the time to explain. I figured out that in my case tests are failing because I display a wallet balance in the front end. Currently, that's the only use case where I have trouble. Is there a way to get to the wallet balance without triggering an atomic lock? I think it would be helpful if the package offered some convenient method to do some operations without locks. Something like Do you think there is some way to get this to work? It's really a significant problem, the wallet obviously needs atomic locks but also I can't use it if I can't run the test suite anymore 😅 |
@martin-ro If you are interested in the balance within the tests, then get directly from the table. This can be done in the following way: $wallet->getOriginalBalanceAttribute(); You can try to write your own implementation of LockServiceInterface and change it through the config, but most likely you will have to change the DatabaseServiceInterface as well. I have ideas how I can drop my implementation of the DatabaseServiceInterface, but it is entirely framework dependent. I need a "committing" event for the commit method inside ManagesTransactions. Without this change, I will have to leave the current solution. Here is a link to the PR in the framework: laravel/framework#44608 The class can also be redefined inside the package, but there is a high probability of not keeping track of the changes. And this will negatively affect the support of the package. |
In my case I got all tests working with |
Hello, @martin-ro. Tag 9.6.0. |
Thanks a lot! |
Describe your task
When running my tests I get
Working inside an embedded transaction is not possible.
To Reproduce
Steps to reproduce the behavior:
Create a test:
Trace Error
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Server:
Additional context
I've read #463 but this behavior still doesn't really make any sense to me. What DB transaction is not closed using
actingAs
?The text was updated successfully, but these errors were encountered: