diff --git a/src/CommandSystem/Handler.cpp b/src/CommandSystem/Handler.cpp index 5561a3efae791c904ac743406f6332287ff15aa0..2571111c1b2deb1d91408d3739ea1171340ae0d0 100644 --- a/src/CommandSystem/Handler.cpp +++ b/src/CommandSystem/Handler.cpp @@ -197,15 +197,6 @@ CmdResponse Handler::startWritingProcess(const FileWriter::Msg &command_message, exception_message)}; } - if (!start_message.ServiceID.empty() && - start_message.ServiceID != ServiceId) { - return { - LogLevel::Debug, 400, - fmt::format( - R"(Rejected start command as the service id was wrong. It should be "{}", it was "{}".)", - ServiceId, start_message.ServiceID)}; - } - /// \note This test should never return false as consumption of new jobs /// should only be possible when the current one is finished. However, there /// is an indication that in some cases jobs will be consumed regardless. @@ -293,16 +284,6 @@ CmdResponse Handler::stopWritingProcess(const FileWriter::Msg &command_message, std::string ResponseMessage; - if (!(stop_message.ServiceID.empty()) && - ServiceId != stop_message.ServiceID) { - return { - LogLevel::Debug, 0, - fmt::format( - "Rejected stop command as the service ID did not match. Local ID " - "is {}, command ID was {}.", - ServiceId, stop_message.ServiceID)}; - } - if (!IsWritingNow()) { return {LogLevel::Warn, 400, fmt::format("Rejected stop command as there is " diff --git a/tests/CommandSystem/HandlerTests.cpp b/tests/CommandSystem/HandlerTests.cpp index c0813a09453ef87027de0811ec96895b13079f17..8f2b63397aeef18f9a28b8d6b199de4407e93754 100644 --- a/tests/CommandSystem/HandlerTests.cpp +++ b/tests/CommandSystem/HandlerTests.cpp @@ -130,22 +130,6 @@ TEST_F(StartHandlerTest, start_command_with_no_service_id_starts) { EXPECT_EQ(true, start_called); } -TEST_F(StartHandlerTest, start_command_with_mismatched_service_id_is_rejected) { - bool start_called = false; - _handlerUnderTest->registerIsWritingFunction([]() -> bool { return false; }); - _handlerUnderTest->registerStartFunction( - [&start_called]([[maybe_unused]] auto startMessage) -> void { - start_called = true; - }); - queue_start_message("new_command_topic", _valid_job_id, {"wrong_service_id"}); - // First poll connects the consumer - _handlerUnderTest->loopFunction(); - - _handlerUnderTest->loopFunction(); - - EXPECT_EQ(false, start_called); -} - TEST_F(StartHandlerTest, start_command_with_invalid_uuid_for_job_id_is_rejected) { bool start_called = false; @@ -351,22 +335,6 @@ TEST_F(StopHandlerTest, stop_actioned_if_service_id_in_message_is_empty) { EXPECT_EQ(true, stop_called); } -TEST_F(StopHandlerTest, stop_ignored_if_service_id_is_wrong) { - bool stop_called = false; - _handlerUnderTest->registerIsWritingFunction([]() -> bool { return true; }); - _handlerUnderTest->registerStopNowFunction( - [&stop_called]() -> void { stop_called = true; }); - _handlerUnderTest->registerGetJobIdFunction( - [this]() -> std::string { return this->_valid_job_id; }); - queue_stop_message(0, _valid_job_id, {"wrong_service_id"}, _valid_command_id); - // First poll connects the consumer - _handlerUnderTest->loopFunction(); - - _handlerUnderTest->loopFunction(); - - EXPECT_EQ(false, stop_called); -} - TEST_F(StopHandlerTest, stop_ignored_if_command_id_is_not_uuid) { bool stop_called = false; _handlerUnderTest->registerIsWritingFunction([]() -> bool { return true; });