Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DMP-4380: Dev Only: Flakey tests - DataIntegrityViolationException: could not execute statement [ERROR: update or delete on table "media" violates foreign key constraint "eod_media_fk" on table "external_object_directory" #2482

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Ben-Edwards-cgi
Copy link
Contributor

Links

Jira

Change description

Summary of Git Diff

The Git diff introduces changes to the DartsDatabaseStub.java and TestUtils.java files. It enhances the database clearing functionality by incorporating a retry mechanism to handle potential failures during the deletion of database entries. This is achieved through the new retryLoop method in TestUtils.

Highlights

  • New Import: Added the TestUtils import in DartsDatabaseStub.java.

  • Database Clearing Enhancement:

    • The clearDatabaseInThisOrder method now wraps the database clearing logic within a TestUtils.retryLoop method.
    • This change allows for retrying the database clear operation up to 10 times with a 500 milliseconds wait between attempts, improving reliability.
  • New Method in TestUtils:

    • retryLoop(int maxRetries, int waitBetweenTries, Runnable runnable) method added to handle retries for any runnable task, logging errors if the task fails.
  • Logging:

    • The @Slf4j annotation is added to TestUtils, enabling logging capabilities for error handling within the retryLoop method.

Does this PR introduce a breaking change? (check one with "x")

[ ] Yes
[X] No

@Ben-Edwards-cgi Ben-Edwards-cgi requested review from a team as code owners January 23, 2025 09:45
@Ben-Edwards-cgi Ben-Edwards-cgi requested review from davet1985, jackmaloney, cakeben, c4seyla, ozzyib and manohar-hmcts and removed request for a team January 23, 2025 09:45
@hmcts-jenkins-cnp hmcts-jenkins-cnp bot requested a deployment to preview January 24, 2025 07:20 Abandoned
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.

2 participants