tests are working again

This commit is contained in:
2024-11-07 13:32:09 +01:00
parent 639b210666
commit b619c1f06f
15 changed files with 22 additions and 25 deletions

View File

@ -11,7 +11,7 @@
TEST_CASE("Action Helper", "[action]") {
ActionHelperOwnerMockBase testDhMock;
// TODO: Setting another number here breaks the test. Find out why
MessageQueueMock testMqMock(MessageQueueIF::NO_QUEUE);
MessageQueueMock testMqMock(MessageQueueIF::NO_QUEUE, MessageQueueIF::NO_QUEUE);
ActionHelper actionHelper = ActionHelper(&testDhMock, dynamic_cast<MessageQueueIF*>(&testMqMock));
CommandMessage actionMessage;
ActionId_t testActionId = 777;

View File

@ -24,7 +24,7 @@ TEST_CASE("CFDP Dest Handler", "[cfdp]") {
using namespace returnvalue;
MessageQueueId_t destQueueId = 2;
AcceptsTmMock tmReceiver(destQueueId);
MessageQueueMock mqMock(destQueueId);
MessageQueueMock mqMock(destQueueId, MessageQueueIF::NO_QUEUE);
auto localId = EntityId(UnsignedByteField<uint16_t>(2));
auto remoteId = EntityId(UnsignedByteField<uint16_t>(3));
FaultHandlerMock fhMock;

View File

@ -12,7 +12,7 @@
TEST_CASE("CFDP Distributor", "[cfdp][distributor]") {
LocalPool::LocalPoolConfig cfg = {{5, 32}, {2, 64}};
StorageManagerMock pool(objects::NO_OBJECT, cfg);
auto queue = MessageQueueMock(1);
auto queue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE);
CfdpDistribCfg distribCfg(1, pool, &queue);
auto distributor = CfdpDistributor(distribCfg);
auto obswEntityId = cfdp::EntityId(UnsignedByteField<uint16_t>(2));

View File

@ -20,7 +20,7 @@ TEST_CASE("Reserved Message Parser", "[cfdp]") {
std::string srcFileName = "hello.txt";
std::string destFileName = "hello2.txt";
MessageQueueId_t destQueueId = 2;
MessageQueueMock msgQueue(1);
MessageQueueMock msgQueue(1, destQueueId);
LocalPool::LocalPoolConfig storeCfg = {{10, 32}, {10, 64}, {10, 128}, {10, 1024}};
StorageManagerMock ipcStore(0, storeCfg);
std::array<uint8_t, 128> buffer{};

View File

@ -15,7 +15,7 @@ using namespace returnvalue;
using namespace lpool;
TEST_CASE("DataSetTest", "[DataSetTest]") {
auto queue = MessageQueueMock(1);
auto queue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE);
TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
poolOwner.initialize();
StaticTestDataset localSet;

View File

@ -16,12 +16,11 @@
using namespace lpool;
TEST_CASE("Pool Owner and Periodic HK", "[datapool]") {
constexpr MessageQueueId_t defaultDestId = 1;
constexpr MessageQueueId_t hkDest = defaultDestId;
const MessageQueueId_t subscriberId = 2;
auto hkReceiver = HkReceiverMock(hkDest);
auto queue = MessageQueueMock(3);
TestPoolOwner poolOwner(queue, hkDest, objects::TEST_LOCAL_POOL_OWNER_BASE);
constexpr MessageQueueId_t DEFAULT_DEST_ID = 1;
constexpr MessageQueueId_t HK_DEST = DEFAULT_DEST_ID;
auto hkReceiver = HkReceiverMock(HK_DEST);
auto queue = MessageQueueMock(3, HK_DEST);
TestPoolOwner poolOwner(queue, HK_DEST, objects::TEST_LOCAL_POOL_OWNER_BASE);
REQUIRE(poolOwner.initialize() == returnvalue::OK);
@ -42,7 +41,7 @@ TEST_CASE("Pool Owner and Periodic HK", "[datapool]") {
CommandMessageCleaner::clearCommandMessage(&messageSent);
}
SECTION("PeriodicHKAndMessaging") {
SECTION("Periodic HK And Messaging") {
// Now we subcribe for a HK periodic generation. Even when it's difficult to simulate
// the temporal behaviour correctly the HK manager should generate a HK packet
// immediately and the periodic helper depends on HK op function calls anyway instead of

View File

@ -12,7 +12,7 @@ using namespace lpool;
using namespace dp;
TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") {
auto queue = MessageQueueMock(1);
auto queue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE);
lpool::TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
REQUIRE(poolOwner.initialize() == OK);

View File

@ -11,7 +11,7 @@ using namespace dp;
using namespace lpool;
TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") {
auto queue = MessageQueueMock(1);
auto queue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE);
lpool::TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
REQUIRE(poolOwner.initialize() == OK);

View File

@ -14,7 +14,7 @@ TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") {
// Will be deleted with DHB destructor
auto* cookieIFMock = new CookieIFMock;
ComIFMock comIF(objects::COM_IF_MOCK);
MessageQueueMock mqMock(1);
MessageQueueMock mqMock(1, MessageQueueIF::NO_QUEUE);
HkReceiverMock hkReceiver(1);
DeviceFdirMock deviceFdirMock(objects::DEVICE_HANDLER_MOCK, objects::NO_OBJECT);
DeviceHandlerMock deviceHandlerMock(objects::DEVICE_HANDLER_MOCK, objects::COM_IF_MOCK,

View File

@ -3,8 +3,8 @@
#include <algorithm>
#include <stdexcept>
MessageQueueMock::MessageQueueMock(MessageQueueId_t queueId)
: MessageQueueBase(queueId, MessageQueueIF::NO_QUEUE, nullptr) {}
MessageQueueMock::MessageQueueMock(MessageQueueId_t queueId, MessageQueueId_t defaultDest)
: MessageQueueBase(queueId, defaultDest, nullptr) {}
bool MessageQueueMock::wasMessageSent() const {
return std::any_of(

View File

@ -23,7 +23,7 @@ struct SendInfo {
class MessageQueueMock : public MessageQueueBase {
public:
void addReceivedMessage(MessageQueueMessageIF& msg);
explicit MessageQueueMock(MessageQueueId_t queueId);
explicit MessageQueueMock(MessageQueueId_t queueId, MessageQueueId_t defaultDest);
//! Get next message which was sent to the default destination
ReturnValue_t getNextSentMessageToDefaultDest(MessageQueueMessageIF& message);

View File

@ -11,7 +11,7 @@
TEST_CASE("CCSDS Distributor", "[ccsds][tmtcdistrib]") {
LocalPool::LocalPoolConfig cfg = {{5, 32}, {2, 64}};
LocalPool pool(objects::NO_OBJECT, cfg);
auto queue = MessageQueueMock(1);
auto queue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE);
auto checkerMock = CcsdsCheckerMock();
uint16_t unregisteredApid = 0;
uint16_t defaultApid = 4;

View File

@ -14,7 +14,7 @@
TEST_CASE("Pus Service Base", "[pus-service-base]") {
uint16_t apid = 2;
auto verificationReporter = PusVerificationReporterMock();
auto msgQueue = MessageQueueMock(1);
auto msgQueue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE);
auto tmReceiver = AcceptsTmMock(2);
auto psbParams = PsbParams(0, apid, 17);
@ -117,7 +117,7 @@ TEST_CASE("Pus Service Base", "[pus-service-base]") {
}
SECTION("Set Request Queue") {
auto msgQueueMock = MessageQueueMock(2);
auto msgQueueMock = MessageQueueMock(2, MessageQueueIF::NO_QUEUE);
psb.setRequestQueue(msgQueueMock);
auto& p = psb.getParams();
REQUIRE(p.reqQueue == &msgQueueMock);

View File

@ -10,8 +10,7 @@
TEST_CASE("TM Send Helper", "[tm-send-helper]") {
MessageQueueId_t destId = 2;
auto errReporter = InternalErrorReporterMock();
auto msgQueue = MessageQueueMock(1);
msgQueue.setDefaultDestination(destId);
auto msgQueue = MessageQueueMock(1, destId);
TmSendHelper sendHelper(msgQueue, errReporter, destId);
auto timeStamper = CdsShortTimestamperMock();
LocalPool::LocalPoolConfig cfg = {{5, 32}, {2, 64}};

View File

@ -17,8 +17,7 @@ TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") {
MessageQueueId_t destId = 1;
auto errReporter = InternalErrorReporterMock();
auto msgQueue = MessageQueueMock(2);
msgQueue.setDefaultDestination(destId);
auto msgQueue = MessageQueueMock(2, destId);
TmSendHelper sendHelper(msgQueue, errReporter, destId);
TmStoreAndSendWrapper tmHelper(17, storeHelper, sendHelper);