Remove unnecessary global configuration unit test
This commit is contained in:
parent
80137f3806
commit
5b4a40fa81
|
|
@ -23,9 +23,7 @@
|
|||
#include "fdbclient/SpecialKeySpace.h"
|
||||
#include "fdbclient/SystemData.h"
|
||||
#include "fdbclient/Tuple.h"
|
||||
#include "fdbrpc/FailureMonitor.h"
|
||||
#include "flow/Error.h"
|
||||
#include "flow/UnitTest.h"
|
||||
#include "flow/flow.h"
|
||||
#include "flow/genericactors.actor.h"
|
||||
|
||||
|
|
@ -262,79 +260,3 @@ Future<Void> GlobalConfig::updater(const ClientDBInfo* dbInfo) {
|
|||
co_await delay(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
Future<Void> serveGlobalConfigTestRefresh(GrvProxyInterface proxy, Version version) {
|
||||
GlobalConfigRefreshRequest request = co_await proxy.refreshGlobalConfig.getFuture();
|
||||
RangeResult result;
|
||||
request.reply.send(GlobalConfigRefreshReply{ result.arena(), version, result });
|
||||
co_return;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_CASE("/fdbclient/GlobalConfig/PreservesReentrantHistoryUpdate") {
|
||||
GrvProxyInterface grvProxy;
|
||||
grvProxy.provisional = false;
|
||||
grvProxy.initEndpoints();
|
||||
IFailureMonitor::failureMonitor().setStatus(grvProxy.address(), FailureStatus(false));
|
||||
ASSERT(IFailureMonitor::failureMonitor().getState(grvProxy.address()).isAvailable());
|
||||
|
||||
CommitProxyInterface commitProxy;
|
||||
commitProxy.provisional = false;
|
||||
commitProxy.initEndpoints();
|
||||
|
||||
ClientDBInfo initialInfo;
|
||||
initialInfo.id = UID(1, 1);
|
||||
initialInfo.grvProxies.push_back(grvProxy);
|
||||
initialInfo.commitProxies.push_back(commitProxy);
|
||||
|
||||
auto clientInfo = makeReference<AsyncVar<ClientDBInfo>>(initialInfo);
|
||||
Database db =
|
||||
DatabaseContext::create(clientInfo, Future<Void>(Never()), LocalityData(), EnableLocalityLoadBalance::False);
|
||||
Future<Void> refresh = serveGlobalConfigTestRefresh(grvProxy, 1);
|
||||
db->globalConfig->init(Reference<AsyncVar<ClientDBInfo> const>(clientInfo), std::addressof(clientInfo->get()));
|
||||
|
||||
co_await timeoutError(db->globalConfig->onInitialized(), 1.0);
|
||||
co_await timeoutError(refresh, 1.0);
|
||||
|
||||
VersionHistory sentinel(1);
|
||||
VersionHistory enabled(2);
|
||||
enabled.mutations.emplace_back_deep(
|
||||
enabled.mutations.arena(),
|
||||
MutationRef(MutationRef::SetValue, fdbClientInfoTxnSampleRate, Tuple::makeTuple(0.1).pack()));
|
||||
|
||||
VersionHistory disabled(3);
|
||||
disabled.mutations.emplace_back_deep(
|
||||
disabled.mutations.arena(),
|
||||
MutationRef(MutationRef::SetValue, fdbClientInfoTxnSampleRate, Tuple::makeTuple(0.0).pack()));
|
||||
|
||||
ClientDBInfo enabledInfo = clientInfo->get();
|
||||
enabledInfo.id = UID(1, 2);
|
||||
enabledInfo.history.push_back(sentinel);
|
||||
enabledInfo.history.push_back(enabled);
|
||||
|
||||
ClientDBInfo disabledInfo = enabledInfo;
|
||||
disabledInfo.id = UID(1, 3);
|
||||
disabledInfo.history.push_back(disabled);
|
||||
|
||||
Future<Void> disabledApplied;
|
||||
Future<Void> deferredDisable;
|
||||
Future<Void> publishDisabled = trigger(
|
||||
[&]() {
|
||||
ASSERT_EQ(db->globalConfig->get<double>(fdbClientInfoTxnSampleRate, -1.0), 0.1);
|
||||
disabledApplied = db->globalConfig->onChange();
|
||||
deferredDisable = trigger([&]() { clientInfo->set(disabledInfo); }, delay(0));
|
||||
},
|
||||
db->globalConfig->onChange());
|
||||
|
||||
clientInfo->set(enabledInfo);
|
||||
co_await timeoutError(publishDisabled, 1.0);
|
||||
ASSERT(deferredDisable.isValid());
|
||||
co_await timeoutError(deferredDisable, 1.0);
|
||||
ASSERT(disabledApplied.isValid());
|
||||
co_await timeoutError(disabledApplied, 1.0);
|
||||
ASSERT_EQ(db->globalConfig->get<double>(fdbClientInfoTxnSampleRate, -1.0), 0.0);
|
||||
co_return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue