Added more coverage and Documentation

This commit is contained in:
Steffen Gaisser 2022-02-23 12:12:49 +01:00
parent 2cb254a556
commit d6508e23b6
2 changed files with 32 additions and 6 deletions

View File

@ -1,22 +1,34 @@
#ifndef INTERNALERRORREPORTERIF_H_
#define INTERNALERRORREPORTERIF_H_
/**
* @brief Interface which is used to report internal errors like full message queues or stores.
* @details
* This interface smust be used for the InteralErrorReporter object.
* It should be used to indicate that there was a Problem with Queues or Stores.
*
* It can be used to report missing Telemetry which could not be sent due to a internal problem.
*
*/
class InternalErrorReporterIF {
public:
virtual ~InternalErrorReporterIF() {}
/**
* Thread safe
* @brief Function to be called if a message queue could not be sent.
* @details OSAL Implementations should call this function to indicate that
* a message was lost.
*
* Implementations are required to be Thread safe
*/
virtual void queueMessageNotSent() = 0;
/**
* Thread safe
* @brief Function to be called if Telemetry could not be sent
* @details Implementations must be Thread safe
*/
virtual void lostTm() = 0;
/**
* Thread safe
* @brief Function to be called if a onboard storage is full
* @details Implementations must be Thread safe
*/
virtual void storeFull() = 0;
};

View File

@ -98,6 +98,20 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
REQUIRE(dataset.tmHits.value == (lostTm + 1));
REQUIRE(dataset.storeHits.value == (storeHits + 1));
}
// Complete Coverage
internalErrorReporter->setDiagnosticPrintout(true);
internalErrorReporter->setMutexTimeout(MutexIF::TimeoutType::BLOCKING, 0);
{
// Message Queue Id
MessageQueueId_t id = internalErrorReporter->getCommandQueue();
REQUIRE(id != MessageQueueIF::NO_QUEUE);
CommandMessage message;
sid_t sid(objects::INTERNAL_ERROR_REPORTER, InternalErrorDataset::ERROR_SET_ID);
HousekeepingMessage::setToggleReportingCommand(&message, sid, true, false);
result = hkQueue->sendMessage(id, &message);
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
internalErrorReporter->performOperation(0);
}
}
QueueFactory::instance()->deleteMessageQueue(testQueue);
QueueFactory::instance()->deleteMessageQueue(hkQueue);