Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-4453

Test cleanup runs before async contract creation finishes, causing random test failures

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • None
    • None
    • swatch-contracts
    • None
    • 1
    • False
    • Hide

      None

      Show
      None
    • False
    • subs-swatch-lightning
    • Swatch Lightning Sprint 7

      We're seeing intermittent failures in ContractsSyncComponentTest.shouldReturnFailedStatusWhenNoContractsExist() where the test finds contracts in the database when it expects none.

      The test failure looks like this:

      Expected: No active contract found for the orgIds
        Actual: All Contract are Synced
      

      The issue happens because our test teardown (@AfterEach) runs immediately after a test completes, but some tests send messages to Artemis that trigger async operations. These operations can take several seconds to complete, especially in Konflux where WireMock responses can be slow (we've seen up to 3 seconds). When the cleanup runs before the async processing finishes, the contract gets created after the cleanup attempt, leaving orphaned data in the database.

      Acceptance Criteria

      • Remove the test plan "contracts-sync-TC004" and implement this test as a regular test in the service.

              jcarvaja@redhat.com Jose Carvajal Hilario
              jcarvaja@redhat.com Jose Carvajal Hilario
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: