Skip to content

Commit 541a6dc

Browse files
committed
Fix tests in --disable-postgres build
Resolves #4625 and #4614. This change fixes the tests in the `--disable-postgres` build by disabling parallel ledger close tests when postgres is disabled. This is necessary because parallel ledger close requires postgres. As part of this, I also removed the `TESTDB_BUCKET_DB_PERSISTENT_POSTGRES` test mode, as it's made redundant by the `TESTDB_POSTGRESQL` mode.
1 parent e1cf3d1 commit 541a6dc

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

src/herder/test/HerderTests.cpp

+15-5
Original file line numberDiff line numberDiff line change
@@ -3222,20 +3222,24 @@ TEST_CASE("overlay parallel processing")
32223222
return cfg;
32233223
});
32243224
}
3225+
3226+
// Background ledger close requires postgres
3227+
#ifdef USE_POSTGRES
32253228
SECTION("background ledger close")
32263229
{
32273230
// Set threshold to 1 so all have to vote
32283231
simulation =
32293232
Topologies::core(4, 1, Simulation::OVER_TCP, networkID, [](int i) {
32303233
auto cfg = getTestConfig(
3231-
i, Config::TESTDB_BUCKET_DB_PERSISTENT_POSTGRES);
3234+
i, Config::TESTDB_POSTGRESQL);
32323235
cfg.TESTING_UPGRADE_MAX_TX_SET_SIZE = 100;
32333236
cfg.EXPERIMENTAL_PARALLEL_LEDGER_CLOSE = true;
32343237
cfg.ARTIFICIALLY_DELAY_LEDGER_CLOSE_FOR_TESTING =
32353238
std::chrono::milliseconds(500);
32363239
return cfg;
32373240
});
32383241
}
3242+
#endif
32393243

32403244
simulation->startAllNodes();
32413245
auto nodes = simulation->getNodes();
@@ -3526,10 +3530,16 @@ herderExternalizesValuesWithProtocol(uint32_t version,
35263530
auto networkID = sha256(getTestConfig().NETWORK_PASSPHRASE);
35273531
auto simulation = std::make_shared<Simulation>(
35283532
Simulation::OVER_LOOPBACK, networkID, [&](int i) {
3529-
auto cfg = getTestConfig(
3530-
i, parallelLedgerClose
3531-
? Config::TESTDB_BUCKET_DB_PERSISTENT_POSTGRES
3532-
: Config::TESTDB_BUCKET_DB_PERSISTENT);
3533+
Config::TestDbMode dbMode = Config::TESTDB_BUCKET_DB_PERSISTENT;
3534+
if (parallelLedgerClose)
3535+
{
3536+
#ifdef USE_POSTGRES
3537+
dbMode = Config::TESTDB_POSTGRESQL;
3538+
#else
3539+
FAIL("Parallel ledger close requires postgres");
3540+
#endif
3541+
}
3542+
auto cfg = getTestConfig(i, dbMode);
35333543
cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = version;
35343544
if (parallelLedgerClose)
35353545
{

src/main/Config.h

-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ class Config : public std::enable_shared_from_this<Config>
163163
#endif
164164
TESTDB_BUCKET_DB_VOLATILE,
165165
TESTDB_BUCKET_DB_PERSISTENT,
166-
TESTDB_BUCKET_DB_PERSISTENT_POSTGRES,
167166
TESTDB_MODES
168167
};
169168

src/test/test.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,6 @@ getTestConfig(int instanceNumber, Config::TestDbMode mode)
291291
thisConfig.DISABLE_XDR_FSYNC = false;
292292
break;
293293
#ifdef USE_POSTGRES
294-
case Config::TESTDB_BUCKET_DB_PERSISTENT_POSTGRES:
295-
dbname << "postgresql://dbname=test" << instanceNumber;
296-
thisConfig.DISABLE_XDR_FSYNC = false;
297-
break;
298294
case Config::TESTDB_POSTGRESQL:
299295
dbname << "postgresql://dbname=test" << instanceNumber;
300296
thisConfig.DISABLE_XDR_FSYNC = false;

0 commit comments

Comments
 (0)