mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 04:21:51 +00:00
Add testListenValueEdit to DhtRunnerTester: verifies that editing a value triggers an add callback (not an expire+add), and that the edited value eventually expires. Add testListenValueEdit and testPushListenValueEdit to DhtProxyTester: same semantics tested over the long-poll and push notification proxy paths. Fix proxy tearDown order to destroy DhtProxyServer before shutting down the proxy DhtRunner, preventing use-after-free on cancel.
110 lines
3.0 KiB
C++
110 lines
3.0 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 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
|