Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
None
-
Fully Compatible
-
ALL
-
Service Arch 2021-07-12, Service Arch 2021-08-09, Service Arch 2021-08-23
-
20
-
2
Description
The fixture creates a new instance of NetworkInterface for every test. The network interface is shutdown after every test using tearDown (see here).
void NetworkInterfaceIntegrationFixture::startNet( |
std::unique_ptr<NetworkConnectionHook> connectHook) {
|
|
createNet(std::move(connectHook));
|
net().startup();
|
}
|
|
void NetworkInterfaceIntegrationFixture::tearDown() { |
// Network interface will only shutdown once because of an internal shutdown guard |
_net->shutdown();
|
}
|
Integration tests use this network interface to run remote commands by calling into runCommand:
Future<RemoteCommandResponse> NetworkInterfaceIntegrationFixture::runCommand(
|
const TaskExecutor::CallbackHandle& cbHandle, RemoteCommandRequest request) { |
RemoteCommandRequestOnAny rcroa{request};
|
|
return net().startCommand(cbHandle, rcroa).then([](TaskExecutor::ResponseOnAnyStatus roa) { |
auto res = RemoteCommandResponse(roa);
|
if (res.isOK()) { |
LOGV2(4820500,
|
"Got command result: {response}", |
"Got command result", |
"response"_attr = res.toString()); |
} else { |
LOGV2(4820501, "Command failed: {error}", "Command failed", "error"_attr = res.status); |
}
|
return res; |
});
|
}
|
The fixture, however, does not track scheduled commands and may return from tearDown before all in progress commands finish. This violates the contract that different tests run in isolation, as a command may start in one test and complete in another.
To address this issue, NetworkInterfaceIntegrationFixture must ensure all in progress commands complete before returning from tearDown. We may use a similar approach to that used by ThreadPoolTaskExecutor to get notified once the execution of a command is complete (see here).
Attachments
Issue Links
- is related to
-
SERVER-58139 Avoid leaking state from NetworkInterfaceTest::CancelLocally
-
- Closed
-