aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-02-23 09:14:03 +0100
committerGitHub <noreply@github.com>2022-02-23 09:14:03 +0100
commit9e315f9567a20b6a5d1c9b505628c547f85cfdc9 (patch)
treeda6ca17402cb5522d6fc34e1353ade85b6d5936f /searchlib/src/tests
parent6646b37c9c36793054e94881c52b5c675c0734fe (diff)
Revert "Revert "Revert "Revert "Use common tranport for TlsClient""""
Diffstat (limited to 'searchlib/src/tests')
-rw-r--r--searchlib/src/tests/transactionlog/translogclient_test.cpp38
-rw-r--r--searchlib/src/tests/transactionlogstress/translogstress.cpp29
2 files changed, 33 insertions, 34 deletions
diff --git a/searchlib/src/tests/transactionlog/translogclient_test.cpp b/searchlib/src/tests/transactionlog/translogclient_test.cpp
index afb1eb53417..bf3a269107c 100644
--- a/searchlib/src/tests/transactionlog/translogclient_test.cpp
+++ b/searchlib/src/tests/transactionlog/translogclient_test.cpp
@@ -482,7 +482,7 @@ createAndFillDomain(const vespalib::string & dir, const vespalib::string & name,
DummyFileHeaderContext fileHeaderContext;
TLS tlss(dir, 18377, ".", fileHeaderContext,
createDomainConfig(0x1000000).setEncoding(encoding), 4);
- TransLogClient tls("tcp/localhost:18377");
+ TransLogClient tls(tlss.transport, "tcp/localhost:18377");
createDomainTest(tls, name, preExistingDomains);
auto s1 = openDomainTest(tls, name);
@@ -493,7 +493,7 @@ void
verifyDomain(const vespalib::string & dir, const vespalib::string & name) {
DummyFileHeaderContext fileHeaderContext;
TLS tlss(dir, 18377, ".", fileHeaderContext, createDomainConfig(0x1000000));
- TransLogClient tls("tcp/localhost:18377");
+ TransLogClient tls(tlss.transport, "tcp/localhost:18377");
auto s1 = openDomainTest(tls, name);
visitDomainTest(tls, s1.get(), name);
}
@@ -504,7 +504,7 @@ void
testVisitOverGeneratedDomain(const vespalib::string & testDir) {
DummyFileHeaderContext fileHeaderContext;
TLS tlss(testDir, 18377, ".", fileHeaderContext, createDomainConfig(0x10000));
- TransLogClient tls("tcp/localhost:18377");
+ TransLogClient tls(tlss.transport, "tcp/localhost:18377");
vespalib::string name("test1");
createDomainTest(tls, name);
@@ -522,7 +522,7 @@ testVisitOverPreExistingDomain(const vespalib::string & testDir) {
// Depends on Test::testVisitOverGeneratedDomain()
DummyFileHeaderContext fileHeaderContext;
TLS tlss(testDir, 18377, ".", fileHeaderContext, createDomainConfig(0x10000));
- TransLogClient tls("tcp/localhost:18377");
+ TransLogClient tls(tlss.transport, "tcp/localhost:18377");
vespalib::string name("test1");
auto s1 = openDomainTest(tls, name);
@@ -533,7 +533,7 @@ void
partialUpdateTest(const vespalib::string & testDir) {
DummyFileHeaderContext fileHeaderContext;
TLS tlss(testDir, 18377, ".", fileHeaderContext, createDomainConfig(0x10000));
- TransLogClient tls("tcp/localhost:18377");
+ TransLogClient tls(tlss.transport, "tcp/localhost:18377");
auto s1 = openDomainTest(tls, "test1");
Session & session = *s1;
@@ -612,7 +612,7 @@ TEST("testRemove") {
test::DirectoryHandler testDir("testremove");
DummyFileHeaderContext fileHeaderContext;
TLS tlss(testDir.getDir(), 18377, ".", fileHeaderContext, createDomainConfig(0x10000));
- TransLogClient tls("tcp/localhost:18377");
+ TransLogClient tls(tlss.transport, "tcp/localhost:18377");
vespalib::string name("test-delete");
createDomainTest(tls, name);
@@ -667,7 +667,7 @@ testSendingAlotOfDataSync(const vespalib::string & testDir) {
{
DummyFileHeaderContext fileHeaderContext;
TLS tlss(testDir, 18377, ".", fileHeaderContext, createDomainConfig(0x80000));
- TransLogClient tls("tcp/localhost:18377");
+ TransLogClient tls(tlss.transport, "tcp/localhost:18377");
createDomainTest(tls, MANY, 0);
auto s1 = openDomainTest(tls, MANY);
@@ -690,7 +690,7 @@ testSendingAlotOfDataSync(const vespalib::string & testDir) {
{
DummyFileHeaderContext fileHeaderContext;
TLS tlss(testDir, 18377, ".", fileHeaderContext, createDomainConfig(0x1000000));
- TransLogClient tls("tcp/localhost:18377");
+ TransLogClient tls(tlss.transport, "tcp/localhost:18377");
auto s1 = openDomainTest(tls, "many");
SerialNum b(0), e(0);
@@ -711,7 +711,7 @@ testSendingAlotOfDataSync(const vespalib::string & testDir) {
{
DummyFileHeaderContext fileHeaderContext;
TLS tlss(testDir, 18377, ".", fileHeaderContext, createDomainConfig(0x1000000));
- TransLogClient tls("tcp/localhost:18377");
+ TransLogClient tls(tlss.transport, "tcp/localhost:18377");
auto s1 = openDomainTest(tls, MANY);
SerialNum b(0), e(0);
@@ -739,7 +739,7 @@ void testSendingAlotOfDataAsync(const vespalib::string & testDir) {
{
DummyFileHeaderContext fileHeaderContext;
TLS tlss(testDir, 18377, ".", fileHeaderContext, createDomainConfig(0x80000));
- TransLogClient tls("tcp/localhost:18377");
+ TransLogClient tls(tlss.transport, "tcp/localhost:18377");
createDomainTest(tls, MANY, 1);
auto s1 = openDomainTest(tls, MANY);
fillDomainTest(tlss.tls, MANY, NUM_PACKETS, NUM_ENTRIES);
@@ -761,7 +761,7 @@ void testSendingAlotOfDataAsync(const vespalib::string & testDir) {
{
DummyFileHeaderContext fileHeaderContext;
TLS tlss(testDir, 18377, ".", fileHeaderContext, createDomainConfig(0x1000000));
- TransLogClient tls("tcp/localhost:18377");
+ TransLogClient tls(tlss.transport, "tcp/localhost:18377");
auto s1 = openDomainTest(tls, MANY);
SerialNum b(0), e(0);
@@ -796,7 +796,7 @@ TEST("testErase") {
{
DummyFileHeaderContext fileHeaderContext;
TLS tlss(testDir.getDir(), 18377, ".", fileHeaderContext, createDomainConfig(0x80000));
- TransLogClient tls("tcp/localhost:18377");
+ TransLogClient tls(tlss.transport, "tcp/localhost:18377");
createDomainTest(tls, "erase", 0);
auto s1 = openDomainTest(tls, "erase");
@@ -805,7 +805,7 @@ TEST("testErase") {
{
DummyFileHeaderContext fileHeaderContext;
TLS tlss(testDir.getDir(), 18377, ".", fileHeaderContext, createDomainConfig(0x1000000));
- TransLogClient tls("tcp/localhost:18377");
+ TransLogClient tls(tlss.transport, "tcp/localhost:18377");
auto s1 = openDomainTest(tls, "erase");
@@ -893,7 +893,7 @@ TEST("testSync") {
DummyFileHeaderContext fileHeaderContext;
test::DirectoryHandler testDir("test9");
TLS tlss(testDir.getDir(), 18377, ".", fileHeaderContext, createDomainConfig(0x1000000));
- TransLogClient tls("tcp/localhost:18377");
+ TransLogClient tls(tlss.transport, "tcp/localhost:18377");
createDomainTest(tls, "sync", 0);
auto s1 = openDomainTest(tls, "sync");
@@ -916,7 +916,7 @@ TEST("test truncate on version mismatch") {
test::DirectoryHandler testDir("test11");
{
TLS tlss(testDir.getDir(), 18377, ".", fileHeaderContext, createDomainConfig(0x1000000));
- TransLogClient tls("tcp/localhost:18377");
+ TransLogClient tls(tlss.transport, "tcp/localhost:18377");
createDomainTest(tls, "sync", 0);
auto s1 = openDomainTest(tls, "sync");
@@ -937,7 +937,7 @@ TEST("test truncate on version mismatch") {
EXPECT_TRUE(f.Close());
{
TLS tlss(testDir.getDir(), 18377, ".", fileHeaderContext, createDomainConfig(0x10000));
- TransLogClient tls("tcp/localhost:18377");
+ TransLogClient tls(tlss.transport, "tcp/localhost:18377");
auto s1 = openDomainTest(tls, "sync");
uint64_t from(0), to(0);
size_t count(0);
@@ -963,7 +963,7 @@ TEST("test truncation after short read") {
DummyFileHeaderContext fileHeaderContext;
{
TLS tlss(topdir.getDir(), 18377, ".", fileHeaderContext, domainConfig);
- TransLogClient tls(tlsspec);
+ TransLogClient tls(tlss.transport, tlsspec);
createDomainTest(tls, domain, 0);
auto s1 = openDomainTest(tls, domain);
@@ -977,7 +977,7 @@ TEST("test truncation after short read") {
EXPECT_EQUAL(2u, countFiles(dir));
{
TLS tlss(topdir.getDir(), 18377, ".", fileHeaderContext, domainConfig);
- TransLogClient tls(tlsspec);
+ TransLogClient tls(tlss.transport, tlsspec);
auto s1 = openDomainTest(tls, domain);
checkFilledDomainTest(*s1, TOTAL_NUM_ENTRIES);
}
@@ -990,7 +990,7 @@ TEST("test truncation after short read") {
}
{
TLS tlss(topdir.getDir(), 18377, ".", fileHeaderContext, domainConfig);
- TransLogClient tls(tlsspec);
+ TransLogClient tls(tlss.transport, tlsspec);
auto s1 = openDomainTest(tls, domain);
checkFilledDomainTest(*s1, TOTAL_NUM_ENTRIES - 1);
}
diff --git a/searchlib/src/tests/transactionlogstress/translogstress.cpp b/searchlib/src/tests/transactionlogstress/translogstress.cpp
index 3d8379adba2..de0e1b60ca0 100644
--- a/searchlib/src/tests/transactionlogstress/translogstress.cpp
+++ b/searchlib/src/tests/transactionlogstress/translogstress.cpp
@@ -207,16 +207,16 @@ private:
bool addEntry(const Packet::Entry & e);
public:
- FeederThread(const std::string & tlsSpec, const std::string & domain,
+ FeederThread(FNET_Transport & transport, const std::string & tlsSpec, const std::string & domain,
const EntryGenerator & generator, uint32_t feedRate, size_t packetSize);
~FeederThread() override;
void doRun() override;
SerialNumRange getRange() const { return SerialNumRange(1, _lastCommited); }
};
-FeederThread::FeederThread(const std::string & tlsSpec, const std::string & domain,
+FeederThread::FeederThread(FNET_Transport & transport, const std::string & tlsSpec, const std::string & domain,
const EntryGenerator & generator, uint32_t feedRate, size_t packetSize)
- : _tlsSpec(tlsSpec), _domain(domain), _client(tlsSpec), _session(),
+ : _tlsSpec(tlsSpec), _domain(domain), _client(transport, tlsSpec), _session(),
_generator(generator), _feedRate(feedRate), _packet(packetSize), _current(1), _lastCommited(1), _timer()
{}
FeederThread::~FeederThread() = default;
@@ -301,10 +301,10 @@ protected:
bool _validate;
public:
- Agent(const std::string & tlsSpec, const std::string & domain,
+ Agent(FNET_Transport & transport, const std::string & tlsSpec, const std::string & domain,
const EntryGenerator & generator, const std::string & name, uint32_t id, bool validate) :
client::Callback(),
- _tlsSpec(tlsSpec), _domain(domain), _client(tlsSpec),
+ _tlsSpec(tlsSpec), _domain(domain), _client(transport, tlsSpec),
_generator(generator), _name(name), _id(id), _validate(validate)
{}
~Agent() override {}
@@ -339,9 +339,9 @@ private:
SerialNum getNext();
public:
- VisitorAgent(const std::string & tlsSpec, const std::string & domain,
+ VisitorAgent(FNET_Transport & transport, const std::string & tlsSpec, const std::string & domain,
const EntryGenerator & generator, uint32_t id, bool validate) :
- Agent(tlsSpec, domain, generator, "VisitorAgent", id, validate),
+ Agent(transport, tlsSpec, domain, generator, "VisitorAgent", id, validate),
_visitor(), _from(0), _to(0), _next(0), _state(IDLE) {}
~VisitorAgent() override = default;
void start(SerialNum from, SerialNum to);
@@ -470,24 +470,23 @@ private:
void makeRandomVisitorVector();
public:
- ControllerThread(const std::string & tlsSpec, const std::string & domain, const EntryGenerator & generator,
+ ControllerThread(FNET_Transport & transport, const std::string & tlsSpec, const std::string & domain, const EntryGenerator & generator,
uint32_t numVisitors, vespalib::duration visitorInterval, vespalib::duration pruneInterval);
~ControllerThread();
- uint32_t runningVisitors();
std::vector<std::shared_ptr<VisitorAgent> > & getVisitors() { return _visitors; }
virtual void doRun() override;
};
-ControllerThread::ControllerThread(const std::string & tlsSpec, const std::string & domain,
+ControllerThread::ControllerThread(FNET_Transport & transport, const std::string & tlsSpec, const std::string & domain,
const EntryGenerator & generator, uint32_t numVisitors,
vespalib::duration visitorInterval, vespalib::duration pruneInterval)
- : _tlsSpec(tlsSpec), _domain(domain), _client(tlsSpec.c_str()), _session(),
+ : _tlsSpec(tlsSpec), _domain(domain), _client(transport, tlsSpec.c_str()), _session(),
_generator(generator), _visitors(), _rndVisitors(), _visitorInterval(visitorInterval),
_pruneInterval(pruneInterval), _pruneTimer(), _begin(0), _end(0), _count(0)
{
for (uint32_t i = 0; i < numVisitors; ++i) {
- _visitors.push_back(std::make_shared<VisitorAgent>(tlsSpec, domain, generator, i, true));
+ _visitors.push_back(std::make_shared<VisitorAgent>(transport, tlsSpec, domain, generator, i, true));
}
}
ControllerThread::~ControllerThread() = default;
@@ -704,7 +703,7 @@ TransLogStress::Main()
FNET_Transport transport;
DummyFileHeaderContext fileHeaderContext;
TransLogServer tls(transport, "server", 17897, ".", fileHeaderContext, DomainConfig().setPartSizeLimit(_cfg.domainPartSize));
- TransLogClient client(tlsSpec);
+ TransLogClient client(transport, tlsSpec);
client.create(domain);
BufferGenerator bufferGenerator(_cfg.minStrLen, _cfg.maxStrLen);
@@ -720,12 +719,12 @@ TransLogStress::Main()
// start feeder and controller
- FeederThread feeder(tlsSpec, domain, generator, _cfg.feedRate, _cfg.packetSize);
+ FeederThread feeder(transport, tlsSpec, domain, generator, _cfg.feedRate, _cfg.packetSize);
threadPool.NewThread(&feeder);
std::this_thread::sleep_for(sleepTime);
- ControllerThread controller(tlsSpec, domain, generator, _cfg.numVisitors, _cfg.visitorInterval, _cfg.pruneInterval);
+ ControllerThread controller(transport, tlsSpec, domain, generator, _cfg.numVisitors, _cfg.visitorInterval, _cfg.pruneInterval);
threadPool.NewThread(&controller);
// stop feeder and controller