betodealmeida opened a new pull request, #30394: URL: https://github.com/apache/superset/pull/30394
<!--- Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/ Example: fix(dashboard): load charts correctly --> ### SUMMARY <!--- Describe the change below, including rationale and design decisions --> https://github.com/apache/superset/pull/24969 introduced the `@transaction` decorator, to be used in commands to ensure that commits are explicit and happen only once in the lifetime of a request, preventing eagers commits. The PR failed to catch a few cases where legacy API endpoints were not using commands, resulting in successful requests that wouldn't be persisted. These were fixed in https://github.com/apache/superset/pull/30215. Why did our integration tests fail to catch these endpoints that were not committing? Tests failed because by default SQLAlchemy will autoflush before running a `SELECT`. In real world, favoriting a chart and verifying that it was favorited are two separate requests. If the first one fails to commit, the second one won't see a change. But our integration tests share the same global session (`db.session`), so that an insert followed by a select will result in flush between them, and the non-committed data will be seen even though we use `READ COMMITTED` as the isolation level. To prevent this from happening again, this PR turns off the autoflush in the integration tests. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF <!--- Skip this if not applicable --> ### TESTING INSTRUCTIONS <!--- Required! What steps can be taken to manually verify the changes? --> ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
