Uploaded image for project: 'Mesos'
  1. Mesos
  2. MESOS-8890

Improve debuggability of `MockResourceProvider::send()`.

    XMLWordPrintableJSON

Details

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

    Description

      MockResourceProvider::send uses Driver::send to send HTTP requests for v1 API calls, which returns a failure if the request is failed. However, we haven't established a programming pattern to reflect the failures properly in tests, and it makes debugging new tests hard.

      To improve the debuggability of the mock resource provider, we could keep track of all futures returned by Driver::send, and await for them to become ready before tearing down the mock resource provider.

      NOTE: At a first look, we could improve the debuggability by registering the following callback:

      process::Future<Nothing> send(const Call& call)
      {
        return driver->send(call)
          .onAny([](const process::Future<Nothing>& future) {
            ASSERT_TRUE(future.isReady()) << future;
          });
      }
      

      However, this could potentially introduce some test flakiness, as if the test is torn down before the driver process the HTTP response, the above future will fail due to disconnection when the the 202 Accept HTTP response is in transmission (so this cannot be fixed by simply adding a Clock::settle call:

      Value of: future.isReady()
        Actual: false
      Expected: true
      Failed: Disconnected
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            chhsia0 Chun-Hung Hsiao
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: