dataroaring commented on PR #55751:
URL: https://github.com/apache/doris/pull/55751#issuecomment-3284193219
**🧹 MINOR: Test Cleanup Missing**
**File**: `regression-test/suites/load_p0/test_too_many_versions.groovy`
**Issue**: The test creates a table but doesn't clean up afterward, which
could affect other tests or leave test artifacts.
**Current Pattern**:
```groovy
sql """ DROP TABLE IF EXISTS t """ // At the beginning
// ... test logic ...
// No cleanup at the end
```
**Best Practice**: Add cleanup at the end to ensure test isolation:
```groovy
try {
sql """ DROP TABLE IF EXISTS t """
// Create table and run test logic...
sql """ CREATE TABLE t (...) """
// Test logic here...
} finally {
// Cleanup - ensure table is removed even if test fails
sql """ DROP TABLE IF EXISTS t """
}
```
**Benefits**:
- **Test Isolation**: Prevents interference between test runs
- **Clean Test Environment**: Removes artifacts that could affect subsequent
tests
- **Failure Resilience**: Cleanup happens even if test fails partway through
**Alternative** (simpler approach):
```groovy
sql """ DROP TABLE IF EXISTS t """ // Beginning
// ... test logic ...
sql """ DROP TABLE IF EXISTS t """ // End
```
This ensures the test environment is clean both before and after execution.
--
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]