Skip to content

fix(test): address flaky healthcare integration test run#2742

Merged
helloeve merged 3 commits intomainfrom
healthcare-test
Mar 17, 2026
Merged

fix(test): address flaky healthcare integration test run#2742
helloeve merged 3 commits intomainfrom
healthcare-test

Conversation

@helloeve
Copy link
Contributor

This PR introduces an auto-cleanup mechanism to address flakiness in the Cloud Healthcare integration tests caused by accumulation of orphaned resources (arising from abrupt CI terminations or local cancellations).

@helloeve helloeve requested a review from a team as a code owner March 13, 2026 14:36
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the stability of Cloud Healthcare integration tests by implementing a robust pre-test cleanup mechanism. It ensures that tests run in a clean environment by automatically identifying and deleting any previously created, but not properly removed, FHIR and DICOM stores. This prevents test failures due to resource conflicts or accumulation from prior, potentially aborted, test runs.

Highlights

  • Automated Resource Cleanup: Introduced a TestMain function to automatically clean up orphaned Cloud Healthcare FHIR and DICOM stores older than 2 hours before test execution, addressing flakiness caused by leftover resources.
  • Resource Tracking: Implemented a created_at label for newly created FHIR and DICOM stores, storing their Unix timestamp to facilitate age-based cleanup.
Changelog
  • tests/cloudhealthcare/cloud_healthcare_integration_test.go
    • Imported the strconv package for string to integer conversions.
    • Added a TestMain function to orchestrate pre-test cleanup of orphaned resources.
    • Implemented the cleanupOrphanedStores function to list and delete FHIR and DICOM stores based on their creation timestamp.
    • Modified the setupHealthcareResources function to add a created_at label with the current Unix timestamp to newly created FHIR and DICOM stores.
Activity
  • No specific activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

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

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 an auto-cleanup mechanism for orphaned Cloud Healthcare resources to improve the reliability of integration tests. This is a good approach to address test flakiness. The implementation adds a created_at label to newly created resources and uses a TestMain function to trigger cleanup of old resources before tests run. My feedback focuses on improving the robustness and readability of the cleanup logic by adding error logging, using more descriptive constants for time durations, and reducing code duplication.

Copy link
Contributor

@Yuan325 Yuan325 left a comment

Choose a reason for hiding this comment

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

I created 2 dummy data stores (temporary-fhir for fhir store and temporary-testing-data for DICOM store) with created_at : 1257885000 but it doesn't seem like the integration tests are removing them.

@helloeve
Copy link
Contributor Author

helloeve commented Mar 14, 2026

@Yuan325 the cleanup logic will attempt to delete stores with prefix dicom-store- or fhir-store- so the temp ones your created won't be deleted. I tested for a manual created one with fhir-store-temporary-test and it was deleted successfully.

@Yuan325
Copy link
Contributor

Yuan325 commented Mar 16, 2026

/gcbrun

@Yuan325 Yuan325 self-requested a review March 16, 2026 17:01
@helloeve helloeve merged commit 9590821 into main Mar 17, 2026
19 checks passed
@helloeve helloeve deleted the healthcare-test branch March 17, 2026 03:00
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.

2 participants