Uploaded image for project: 'PHP Driver: Library'
  1. PHP Driver: Library
  2. PHPLIB-399

Track sessions used during tests to explicitly end them in tearDown()

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Tests
    • Labels:
      None

      As mentioned in this comment from PR #591 and PR #564, failing to end a session in a test where an exception is thrown could cause future test methods to encounter delays in execution. This is mainly an issue with transaction tests, where an exception's backtrace can hold a reference to the session object and prevent it from being garbage-collected after the test function exits.

      If the test class is able to track sessions that are used within tests (e.g. creating them through a convenience method instead of directly calling Manager::startSession() within the test), we should be able to hold a reference to them and ensure they are explicitly ended in tearDown(). This would allow us to remove try / finally code blocks in various tests that currently work around this issue.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: