Skip to content

ci(bigtable): extract StaleResourceCleaner into nightly Kokoro job - #15058

Merged
blakeli0 merged 7 commits into
mainfrom
ci-bigtable-stale-resource-cleaner
Nov 18, 2026
Merged

blakeli0 merged 7 commits into
mainfrom
ci-bigtable-stale-resource-cleaner

Conversation

@igorbernstein2

@igorbernstein2 igorbernstein2 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Extracts stale resource cleanup out of TestEnvRule.after() into a standalone StaleResourceCleaner utility scheduled via a nightly Kokoro job, eliminating ~60+ redundant Admin API list scans per PR.

Merge Order: Standalone on main — merge before PR #15060, cl/1023908200, and the cloud-bigtable nightly cleanup CL.

Changes

  • Extract StaleResourceCleaner: Moves stale resource cleanup (>24h old temp-* views, tables, authorized views, app profiles, clusters, backups, and orphaned test instances) out of TestEnvRule.after() into StaleResourceCleaner using CloudEnv (AbstractTestEnv), with JUnit 5 unit tests in StaleResourceCleanerTest.
  • Clean up TestEnvRule & pom.xml: Removes cleanUpStale() and unused grpcLogHandler / bigtable.grpc-log-dir from TestEnvRule.java and google-cloud-bigtable/pom.xml, and configures an exec-maven-plugin execution (exec:java@cleanup-stale-resources) to run StaleResourceCleaner.
  • Nightly Kokoro Cleanup Config: Adds .kokoro/nightly/bigtable-cleanup.cfg and .kokoro/bigtable-cleanup.sh to run StaleResourceCleaner against gcloud-devel (google-cloud-bigtable and google-cloud-bigtable-session).

@igorbernstein2
igorbernstein2 requested review from a team as code owners November 17, 2026 19:21

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a standalone utility, StaleResourceCleaner, along with its corresponding unit tests, to handle the cleanup of stale Bigtable test resources older than 24 hours. This replaces the inline cleanup logic previously defined in TestEnvRule and is integrated into Kokoro as a nightly job. The review feedback highlights several areas in StaleResourceCleaner where exceptions (such as those caused by concurrent resource deletions) could propagate and prematurely abort the cleanup process. It is recommended to wrap these operations in broader try-catch blocks to ensure the cleanup process remains robust and continues executing even if individual resource deletions fail.

@igorbernstein2
igorbernstein2 marked this pull request as draft November 17, 2026 19:56
@igorbernstein2
igorbernstein2 marked this pull request as ready for review November 17, 2026 20:51
@blakeli0

Copy link
Copy Markdown
Contributor

The unit test error seems legit

22:10:47:089 [ERROR]   StaleResourceCleanerTest.testCleanUpStaleInstances:586->createTableStubForInstance:891 Mockito 
Mockito cannot mock this class: interface com.google.api.gax.core.BackgroundResource.

@blakeli0 blakeli0 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 17, 2026
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 17, 2026
@igorbernstein2

Copy link
Copy Markdown
Contributor Author

fixed the test - it was a jvm / mockito bug

@blakeli0
blakeli0 merged commit a819738 into main Nov 18, 2026
196 checks passed
@blakeli0
blakeli0 deleted the ci-bigtable-stale-resource-cleaner branch November 18, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants