mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 04:21:51 +00:00
Require immediate completion before run and after join, including a burst of notifications. Keep active-runner coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
126 lines
3.5 KiB
C++
126 lines
3.5 KiB
C++
// Copyright (c) 2014-2026 Savoir-faire Linux Inc.
|
|
// SPDX-License-Identifier: MIT
|
|
#pragma once
|
|
|
|
// cppunit
|
|
#include <cppunit/TestFixture.h>
|
|
#include <cppunit/extensions/HelperMacros.h>
|
|
|
|
#include <opendht/dhtrunner.h>
|
|
|
|
namespace test {
|
|
|
|
class DhtRunnerPushTester : public CppUnit::TestFixture
|
|
{
|
|
CPPUNIT_TEST_SUITE(DhtRunnerPushTester);
|
|
CPPUNIT_TEST(testPushBeforeRun);
|
|
CPPUNIT_TEST(testPushAfterJoin);
|
|
CPPUNIT_TEST(testPushBurstAfterJoin);
|
|
CPPUNIT_TEST(testPushWhileRunning);
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
|
public:
|
|
void testPushBeforeRun();
|
|
void testPushAfterJoin();
|
|
void testPushBurstAfterJoin();
|
|
void testPushWhileRunning();
|
|
};
|
|
|
|
class DhtRunnerTester : public CppUnit::TestFixture
|
|
{
|
|
CPPUNIT_TEST_SUITE(DhtRunnerTester);
|
|
CPPUNIT_TEST(testConstructors);
|
|
CPPUNIT_TEST(testGetPut);
|
|
CPPUNIT_TEST(testPutDuplicate);
|
|
CPPUNIT_TEST(testPutOverride);
|
|
CPPUNIT_TEST(testListen);
|
|
CPPUNIT_TEST(testListenValueEdit);
|
|
CPPUNIT_TEST(testListenLotOfBytes);
|
|
CPPUNIT_TEST(testStoreEmptyValue);
|
|
CPPUNIT_TEST(testIdOps);
|
|
CPPUNIT_TEST(testImportValuesPreservesRemoteQuota);
|
|
CPPUNIT_TEST(testExportValuesUsesSystemTime);
|
|
CPPUNIT_TEST(testImportValuesPreservesStoredExpiration);
|
|
CPPUNIT_TEST(testImportPermanentValueExpires);
|
|
CPPUNIT_TEST(testBootstrapSetsConnectingState);
|
|
CPPUNIT_TEST(testBootstrapThenPutNoRace);
|
|
CPPUNIT_TEST(testBootstrapMissingNodeThenPutFails);
|
|
CPPUNIT_TEST(testShutdownCompletesWithPendingPut);
|
|
CPPUNIT_TEST(testSavedPortFallback);
|
|
CPPUNIT_TEST(testGetAfterListen);
|
|
CPPUNIT_TEST(testListenDuplicatePut);
|
|
CPPUNIT_TEST(testListenMultiSourceExpire);
|
|
CPPUNIT_TEST(testListenEditChainThenExpire);
|
|
CPPUNIT_TEST(testListenMultiValuePartialExpire);
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
|
dht::DhtRunner node1 {};
|
|
dht::DhtRunner node2 {};
|
|
|
|
public:
|
|
/**
|
|
* Method automatically called before each test by CppUnit
|
|
*/
|
|
void setUp();
|
|
/**
|
|
* Method automatically called after each test CppUnit
|
|
*/
|
|
void tearDown();
|
|
/**
|
|
* Test the differents behaviors of constructors
|
|
*/
|
|
void testConstructors();
|
|
/**
|
|
* Test get and put methods
|
|
*/
|
|
void testGetPut();
|
|
/**
|
|
* Test get and multiple put
|
|
*/
|
|
void testPutDuplicate();
|
|
/**
|
|
* Test get and multiple put with changing value
|
|
*/
|
|
void testPutOverride();
|
|
/**
|
|
* Test listen method
|
|
*/
|
|
void testListen();
|
|
/**
|
|
* Test methods requiring a node identity
|
|
*/
|
|
void testIdOps();
|
|
void testImportValuesPreservesRemoteQuota();
|
|
void testExportValuesUsesSystemTime();
|
|
void testImportValuesPreservesStoredExpiration();
|
|
void testImportPermanentValueExpires();
|
|
void testBootstrapSetsConnectingState();
|
|
void testBootstrapThenPutNoRace();
|
|
void testBootstrapMissingNodeThenPutFails();
|
|
void testShutdownCompletesWithPendingPut();
|
|
void testSavedPortFallback();
|
|
void testGetAfterListen();
|
|
void testListenDuplicatePut();
|
|
void testListenMultiSourceExpire();
|
|
void testListenEditChainThenExpire();
|
|
void testListenMultiValuePartialExpire();
|
|
/**
|
|
* Test that editing a value only triggers an add callback, no expire
|
|
*/
|
|
void testListenValueEdit();
|
|
/**
|
|
* Test listen method with lot of datas
|
|
*/
|
|
void testListenLotOfBytes();
|
|
/**
|
|
* Test storing an empty value
|
|
*/
|
|
void testStoreEmptyValue();
|
|
/**
|
|
* Test multithread
|
|
*/
|
|
void testMultithread();
|
|
};
|
|
|
|
} // namespace test
|