Skip to content

Refactor tests and code clean up#16129

Merged
abhishekrb19 merged 15 commits intoapache:masterfrom
abhishekrb19:cleanup_tests
Mar 15, 2024
Merged

Refactor tests and code clean up#16129
abhishekrb19 merged 15 commits intoapache:masterfrom
abhishekrb19:cleanup_tests

Conversation

@abhishekrb19
Copy link
Copy Markdown
Contributor

@abhishekrb19 abhishekrb19 commented Mar 15, 2024

Summary of changes in this patch by file:

Changes in TestDerbyConnector:

  • Introduce a static wrapper class SegmentsTable, which provides utilities for commonly used SQL commands for tests in update() and updateUsedStatusLastUpdated().
  • Clean up references in tests to use the above new methods where applicable. For example, see usages in SqlSegmentsMetadataManagerTest, IndexerSQLMetadataStorageCoordinatorTest, SQLMetadataConnectorTest.

Changes in KillUnusedSegmentsTaskTest:

  • Introduce a builder class KillUnusedSegmentsTaskBuilder and refactor usages.
  • Move common segment creation to setup() method.
  • Replace usages of Thread.sleep() with calls to the new updateSegmentsTable() method.
  • Miscellaneous indentation adjustments based on review feedback from Kill segments by versions #15994.

Change in IndexerSQLMetadataStorageCoordinator:

  • Refactor some code in favor of the verifySegmentsToCommit() method.

This PR has:

  • been self-reviewed.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.

Copy link
Copy Markdown
Contributor

@kfaraz kfaraz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clean up, @abhishekrb19 !
I have left minor suggestions but they are mostly optional.

Comment thread server/src/test/java/org/apache/druid/metadata/TestDerbyConnector.java Outdated
@abhishekrb19 abhishekrb19 merged commit 3eefc47 into apache:master Mar 15, 2024
@abhishekrb19 abhishekrb19 deleted the cleanup_tests branch March 15, 2024 17:13
@adarshsanjeev adarshsanjeev added this to the 30.0.0 milestone May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants