Skip to content

Commit

Permalink
Fix tests in --disable-postgres build
Browse files Browse the repository at this point in the history
Resolves stellar#4625 and stellar#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.
  • Loading branch information
bboston7 committed Jan 17, 2025
1 parent e1cf3d1 commit 2680210
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
21 changes: 15 additions & 6 deletions src/herder/test/HerderTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3222,20 +3222,23 @@ TEST_CASE("overlay parallel processing")
return cfg;
});
}

// Background ledger close requires postgres
#ifdef USE_POSTGRES
SECTION("background ledger close")
{
// Set threshold to 1 so all have to vote
simulation =
Topologies::core(4, 1, Simulation::OVER_TCP, networkID, [](int i) {
auto cfg = getTestConfig(
i, Config::TESTDB_BUCKET_DB_PERSISTENT_POSTGRES);
auto cfg = getTestConfig(i, Config::TESTDB_POSTGRESQL);
cfg.TESTING_UPGRADE_MAX_TX_SET_SIZE = 100;
cfg.EXPERIMENTAL_PARALLEL_LEDGER_CLOSE = true;
cfg.ARTIFICIALLY_DELAY_LEDGER_CLOSE_FOR_TESTING =
std::chrono::milliseconds(500);
return cfg;
});
}
#endif

simulation->startAllNodes();
auto nodes = simulation->getNodes();
Expand Down Expand Up @@ -3526,10 +3529,16 @@ herderExternalizesValuesWithProtocol(uint32_t version,
auto networkID = sha256(getTestConfig().NETWORK_PASSPHRASE);
auto simulation = std::make_shared<Simulation>(
Simulation::OVER_LOOPBACK, networkID, [&](int i) {
auto cfg = getTestConfig(
i, parallelLedgerClose
? Config::TESTDB_BUCKET_DB_PERSISTENT_POSTGRES
: Config::TESTDB_BUCKET_DB_PERSISTENT);
Config::TestDbMode dbMode = Config::TESTDB_BUCKET_DB_PERSISTENT;
if (parallelLedgerClose)
{
#ifdef USE_POSTGRES
dbMode = Config::TESTDB_POSTGRESQL;
#else
FAIL("Parallel ledger close requires postgres");
#endif
}
auto cfg = getTestConfig(i, dbMode);
cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = version;
if (parallelLedgerClose)
{
Expand Down
1 change: 0 additions & 1 deletion src/main/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ class Config : public std::enable_shared_from_this<Config>
#endif
TESTDB_BUCKET_DB_VOLATILE,
TESTDB_BUCKET_DB_PERSISTENT,
TESTDB_BUCKET_DB_PERSISTENT_POSTGRES,
TESTDB_MODES
};

Expand Down
4 changes: 0 additions & 4 deletions src/test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,6 @@ getTestConfig(int instanceNumber, Config::TestDbMode mode)
thisConfig.DISABLE_XDR_FSYNC = false;
break;
#ifdef USE_POSTGRES
case Config::TESTDB_BUCKET_DB_PERSISTENT_POSTGRES:
dbname << "postgresql://dbname=test" << instanceNumber;
thisConfig.DISABLE_XDR_FSYNC = false;
break;
case Config::TESTDB_POSTGRESQL:
dbname << "postgresql://dbname=test" << instanceNumber;
thisConfig.DISABLE_XDR_FSYNC = false;
Expand Down

0 comments on commit 2680210

Please sign in to comment.