Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-4173

Replace use sleep in SyncMongoCursor test class

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Test Coverage
    • Labels:
      None

      Description

      Some of the new load balancer unified tests assert on expected events which occur when creating and closing a cursor.  But the SyncMongoCursor test class is, necessarily, built on top of a Reactive Streams Publisher, which make it difficult to determine when:

      • the cursor has been established
      • the cursor has been closed

      To work around these problems, short sleep}}s were added to both the {{SyncMongoCursor constructor and close method.

      In limited usage, these sleeps are effective, but ultimately they are racy and some non-zero percentage of time will cause test failures (the percentage can be decreased by increasing the sleep time, but that will slow down test runs).

      We should consider alternative approaches that are both less expensive in the happy path and generated clearer test failures in the sad path.

        Attachments

          Activity

            People

            Assignee:
            jeff.yemin Jeffrey Yemin
            Reporter:
            jeff.yemin Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: