Skip to content

Fix tests in --disable-postgres build #4626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading