Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-16696

Add Breakpoint injection for CommonTestInjection

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • SolrCloud
    • None

    Description

      While writing test cases to verify our fix on a race condition, we used `CommonTestInjection` to inject artificial delay to trigger the race condition.

      However, it's argued that using arbitrary delay to force such condition might not be the most reliable in our case as in certain edge timing condition, the test might not be creating the expected code execution order.

      Therefore, we are proposing an extra injection feature in `CommonTestInjection` (PR to follow) that injects a "breakpoint" to hold off certain code execution until certain condition/piece of code is executed:

      1. In the code that is susceptible to race condition, we can call `assert CommonTestInjection#injectBreakpoint(String)` which would hold and execute the code defined (see point 2) for such breakpoint IFF assertion is turned on (for unit testing etc). The string here refers to a "Breakpoint key", which could simply be a class name or something more specific.
      2. In the unit test case, set the breakpoint using CommonTestInjection#setBreakpoint(String, Breakpoint), Breakpoint is a new interface with a single method void executeAndResume() - Code execution should break at where the breakpoint was injected, then it would execute this method and resumes the execution afterwards

      With the above in place, then we can more precisely trigger race condition or even verify caught exception did get triggered as expected. (more details in the PR)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              patson Patson Luk
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m