Chun-Hung Hsiao created MESOS-8890:
--------------------------------------

             Summary: Improve debuggability of `MockResourceProvider::send()`.
                 Key: MESOS-8890
                 URL: https://issues.apache.org/jira/browse/MESOS-8890
             Project: Mesos
          Issue Type: Improvement
            Reporter: Chun-Hung Hsiao
            Assignee: Chun-Hung Hsiao


{{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:
{code:cpp}
process::Future<Nothing> send(const Call& call)
{
  return driver->send(call)
    .onAny([](const process::Future<Nothing>& future) {
      ASSERT_TRUE(future.isReady()) << future;
    });
}
{code:cpp}
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:
{noformat}
Value of: future.isReady()
  Actual: false
Expected: true
Failed: Disconnected
{noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to