Add simulation testing
This commit is contained in:
parent
7b5de42d43
commit
1e1e75123f
|
@ -1088,11 +1088,14 @@ void SimulationConfig::generateNormalConfig(int minimumReplication, int minimumR
|
|||
void setupSimulatedSystem(vector<Future<Void>>* systemActors, std::string baseFolder, int* pTesterCount,
|
||||
Optional<ClusterConnectionString>* pConnString, Standalone<StringRef>* pStartingConfiguration,
|
||||
int extraDB, int minimumReplication, int minimumRegions, Reference<TLSOptions> tlsOptions,
|
||||
std::string whitelistBinPaths) {
|
||||
std::string whitelistBinPaths, bool configureLocked) {
|
||||
// SOMEDAY: this does not test multi-interface configurations
|
||||
SimulationConfig simconfig(extraDB, minimumReplication, minimumRegions);
|
||||
StatusObject startingConfigJSON = simconfig.db.toJSON(true);
|
||||
std::string startingConfigString = "new";
|
||||
if (configureLocked) {
|
||||
startingConfigString += " locked";
|
||||
}
|
||||
for( auto kv : startingConfigJSON) {
|
||||
startingConfigString += " ";
|
||||
if( kv.second.type() == json_spirit::int_type ) {
|
||||
|
@ -1351,7 +1354,8 @@ void setupSimulatedSystem(vector<Future<Void>>* systemActors, std::string baseFo
|
|||
.detail("StartingConfiguration", pStartingConfiguration->toString());
|
||||
}
|
||||
|
||||
void checkExtraDB(const char *testFile, int &extraDB, int &minimumReplication, int &minimumRegions) {
|
||||
void checkTestConf(const char* testFile, int& extraDB, int& minimumReplication, int& minimumRegions,
|
||||
int& configureLocked) {
|
||||
std::ifstream ifs;
|
||||
ifs.open(testFile, std::ifstream::in);
|
||||
if (!ifs.good())
|
||||
|
@ -1383,6 +1387,10 @@ void checkExtraDB(const char *testFile, int &extraDB, int &minimumReplication, i
|
|||
if (attrib == "minimumRegions") {
|
||||
sscanf( value.c_str(), "%d", &minimumRegions );
|
||||
}
|
||||
|
||||
if (attrib == "configureLocked") {
|
||||
sscanf(value.c_str(), "%d", &configureLocked);
|
||||
}
|
||||
}
|
||||
|
||||
ifs.close();
|
||||
|
@ -1396,7 +1404,8 @@ ACTOR void setupAndRun(std::string dataFolder, const char *testFile, bool reboot
|
|||
state int extraDB = 0;
|
||||
state int minimumReplication = 0;
|
||||
state int minimumRegions = 0;
|
||||
checkExtraDB(testFile, extraDB, minimumReplication, minimumRegions);
|
||||
state int configureLocked = 0;
|
||||
checkTestConf(testFile, extraDB, minimumReplication, minimumRegions, configureLocked);
|
||||
|
||||
// TODO (IPv6) Use IPv6?
|
||||
wait(g_simulator.onProcess(
|
||||
|
@ -1427,7 +1436,7 @@ ACTOR void setupAndRun(std::string dataFolder, const char *testFile, bool reboot
|
|||
else {
|
||||
g_expect_full_pointermap = 1;
|
||||
setupSimulatedSystem(&systemActors, dataFolder, &testerCount, &connFile, &startingConfiguration, extraDB,
|
||||
minimumReplication, minimumRegions, tlsOptions, whitelistBinPaths);
|
||||
minimumReplication, minimumRegions, tlsOptions, whitelistBinPaths, configureLocked);
|
||||
wait( delay(1.0) ); // FIXME: WHY!!! //wait for machines to boot
|
||||
}
|
||||
std::string clusterFileDir = joinPath( dataFolder, deterministicRandom()->randomUniqueID().toString() );
|
||||
|
|
|
@ -27,12 +27,14 @@
|
|||
struct LockDatabaseWorkload : TestWorkload {
|
||||
double lockAfter, unlockAfter;
|
||||
bool ok;
|
||||
bool onlyCheckLocked;
|
||||
|
||||
LockDatabaseWorkload(WorkloadContext const& wcx)
|
||||
: TestWorkload(wcx), ok(true)
|
||||
{
|
||||
lockAfter = getOption( options, LiteralStringRef("lockAfter"), 0.0 );
|
||||
unlockAfter = getOption( options, LiteralStringRef("unlockAfter"), 10.0 );
|
||||
onlyCheckLocked = getOption(options, LiteralStringRef("onlyCheckLocked"), false);
|
||||
ASSERT(unlockAfter > lockAfter);
|
||||
}
|
||||
|
||||
|
@ -42,9 +44,8 @@ struct LockDatabaseWorkload : TestWorkload {
|
|||
return Void();
|
||||
}
|
||||
|
||||
virtual Future<Void> start( Database const& cx ) {
|
||||
if( clientId == 0 )
|
||||
return lockWorker( cx, this );
|
||||
virtual Future<Void> start(Database const& cx) {
|
||||
if (clientId == 0) return onlyCheckLocked ? checkLocked(cx, this) : lockWorker(cx, this);
|
||||
return Void();
|
||||
}
|
||||
|
||||
|
|
|
@ -100,6 +100,7 @@ add_fdb_test(TEST_FILES fast/BackupCorrectnessClean.txt)
|
|||
add_fdb_test(TEST_FILES fast/BackupToDBCorrectness.txt)
|
||||
add_fdb_test(TEST_FILES fast/BackupToDBCorrectnessClean.txt)
|
||||
add_fdb_test(TEST_FILES fast/CloggedSideband.txt)
|
||||
add_fdb_test(TEST_FILES fast/ConfigureLocked.txt)
|
||||
add_fdb_test(TEST_FILES fast/ConstrainedRandomSelector.txt)
|
||||
add_fdb_test(TEST_FILES fast/CycleAndLock.txt)
|
||||
add_fdb_test(TEST_FILES fast/CycleTest.txt)
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
testTitle=ConfigureLocked
|
||||
testName=LockDatabase
|
||||
configureLocked=1
|
||||
onlyCheckLocked=1
|
Loading…
Reference in New Issue