szaszm commented on a change in pull request #835:
URL: https://github.com/apache/nifi-minifi-cpp/pull/835#discussion_r456372190
##########
File path: extensions/http-curl/tests/ControllerServiceIntegrationTests.cpp
##########
@@ -126,34 +125,34 @@ int main(int argc, char **argv) {
// now let's disable one of the controller services.
std::shared_ptr<core::controller::ControllerServiceNode> cs_id =
controller->getControllerServiceNode("ID");
assert(cs_id != nullptr);
- {
- std::lock_guard<std::mutex> lock(control_mutex);
- controller->disableControllerService(cs_id);
- disabled = true;
- waitToVerifyProcessor();
- }
{
std::lock_guard<std::mutex> lock(control_mutex);
controller->enableControllerService(cs_id);
disabled = false;
- waitToVerifyProcessor();
}
std::shared_ptr<core::controller::ControllerServiceNode> mock_cont =
controller->getControllerServiceNode("MockItLikeIts1995");
- assert(cs_id->enabled());
-{
+ const bool test_success_01 =
verifyEventHappenedInPollTime(std::chrono::seconds(4), [&cs_id] {
+ return cs_id->enabled();
+ });
+ {
std::lock_guard<std::mutex> lock(control_mutex);
controller->disableReferencingServices(mock_cont);
disabled = true;
- waitToVerifyProcessor();
}
- assert(cs_id->enabled() == false);
-{
+ const bool test_success_02 =
verifyEventHappenedInPollTime(std::chrono::seconds(2), [&cs_id] {
+ return !cs_id->enabled();
+ });
+ {
std::lock_guard<std::mutex> lock(control_mutex);
controller->enableReferencingServices(mock_cont);
disabled = false;
- waitToVerifyProcessor();
}
- assert(cs_id->enabled() == true);
+ const bool test_success_03 =
verifyEventHappenedInPollTime(std::chrono::seconds(2), [&cs_id] {
Review comment:
You may want to use
[`std::not1`](https://en.cppreference.com/w/cpp/utility/functional/not1)
(<=C++17)/[`std::not_fn`](https://en.cppreference.com/w/cpp/utility/functional/not_fn)
(>=C++17) for the second test after extracting the lambda.
edit: outdated
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]