maple525866 commented on code in PR #7482: URL: https://github.com/apache/incubator-seata/pull/7482#discussion_r2188048649
########## spring/src/test/java/org/apache/seata/spring/kt/TransactionScopeTest.kt: ########## @@ -72,63 +94,236 @@ class TransactionScopeTest { return globalStatus } }) + + // Clean up context + RootContext.unbind() } + /** + * Cleans up the test environment after each test method. + * + * This method: + * - Unbinds any remaining transaction context + * - Restores the original TransactionManager + */ + @AfterEach + fun tearDown() { + // Clean up global state to avoid affecting other tests + RootContext.unbind() Review Comment: > @BeforeEach But I think adding RootContext.unbind() in @AfterEach may prevent other tests from being polluted (double protection with @BeforeEach), what do you think? ########## spring/src/test/java/org/apache/seata/spring/kt/TransactionScopeTest.kt: ########## @@ -72,63 +94,236 @@ class TransactionScopeTest { return globalStatus } }) + + // Clean up context + RootContext.unbind() } + /** + * Cleans up the test environment after each test method. + * + * This method: + * - Unbinds any remaining transaction context + * - Restores the original TransactionManager + */ + @AfterEach + fun tearDown() { + // Clean up global state to avoid affecting other tests + RootContext.unbind() Review Comment: > If RootContext is cleared in `@BeforeEach`, wouldn’t it be unnecessary to do it again in `@AfterEach`? But I think adding RootContext.unbind() in @AfterEach may prevent other tests from being polluted (double protection with @BeforeEach), what do you think? -- 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: notifications-unsubscr...@seata.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For additional commands, e-mail: notifications-h...@seata.apache.org