refactor(test): set up test configs with test::Configure()

- 33 places repeated the same session, shm segment size, shm monitor
  and expanded metadata properties
- call test::Configure() and set only the properties that differ

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-11-03 14:14:53 +00:00
committed by Dennis Klein
parent d4a85086aa
commit 0367c2a4a8
8 changed files with 39 additions and 124 deletions

View File

@@ -13,6 +13,7 @@
#include <fairmq/ProgOptions.h>
#include <fairmq/TransportFactory.h>
#include <fairmq/tools/Unique.h>
#include <helper/Transport.h>
#include <gtest/gtest.h>
#include <memory>
#include <sstream>
@@ -28,12 +29,7 @@ using namespace fair::mq;
auto RunSingleThreadedMultipart(string transport, string address1, string address2, bool expandedShmMetadata) -> void {
fair::mq::ProgOptions config;
config.SetProperty<string>("session", tools::Uuid());
config.SetProperty<size_t>("shm-segment-size", 100000000);
config.SetProperty<bool>("shm-monitor", true);
if (expandedShmMetadata) {
config.SetProperty<size_t>("shm-metadata-msg-size", 2048);
}
test::Configure(config, tools::Uuid(), expandedShmMetadata);
address1 += "_" + config.GetProperty<string>("session");
address2 += "_" + config.GetProperty<string>("session");
@@ -113,13 +109,9 @@ auto RunSingleThreadedMultipart(string transport, string address1, string addres
auto RunMultiThreadedMultipart(string transport, string address1, bool expandedShmMetadata) -> void
{
ProgOptions config;
config.SetProperty<string>("session", tools::Uuid());
test::Configure(config, tools::Uuid(), expandedShmMetadata);
config.SetProperty<int>("io-threads", 1);
config.SetProperty<size_t>("shm-segment-size", 20000000); // NOLINT
config.SetProperty<bool>("shm-monitor", true);
if (expandedShmMetadata) {
config.SetProperty<size_t>("shm-metadata-msg-size", 2048);
}
address1 += "_" + config.GetProperty<string>("session");