Skip to content

Commit c888dfb

Browse files
authored
Fix tests in --disable-postgres build (#4626)
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. # Checklist - [x] Reviewed the [contributing](https://github.com/stellar/stellar-core/blob/master/CONTRIBUTING.md#submitting-changes) document - [x] Rebased on top of master (no merge commits) - [x] Ran `clang-format` v8.0.0 (via `make format` or the Visual Studio extension) - [x] Compiles - [x] Ran all tests - [ ] If change impacts performance, include supporting evidence per the [performance document](https://github.com/stellar/stellar-core/blob/master/performance-eval/performance-eval.md)
2 parents e1cf3d1 + 2680210 commit c888dfb

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

src/herder/test/HerderTests.cpp

+15-6
Original file line numberDiff line numberDiff line change
@@ -3222,20 +3222,23 @@ 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) {
3230-
auto cfg = getTestConfig(
3231-
i, Config::TESTDB_BUCKET_DB_PERSISTENT_POSTGRES);
3233+
auto cfg = getTestConfig(i, Config::TESTDB_POSTGRESQL);
32323234
cfg.TESTING_UPGRADE_MAX_TX_SET_SIZE = 100;
32333235
cfg.EXPERIMENTAL_PARALLEL_LEDGER_CLOSE = true;
32343236
cfg.ARTIFICIALLY_DELAY_LEDGER_CLOSE_FOR_TESTING =
32353237
std::chrono::milliseconds(500);
32363238
return cfg;
32373239
});
32383240
}
3241+
#endif
32393242

32403243
simulation->startAllNodes();
32413244
auto nodes = simulation->getNodes();
@@ -3526,10 +3529,16 @@ herderExternalizesValuesWithProtocol(uint32_t version,
35263529
auto networkID = sha256(getTestConfig().NETWORK_PASSPHRASE);
35273530
auto simulation = std::make_shared<Simulation>(
35283531
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);
3532+
Config::TestDbMode dbMode = Config::TESTDB_BUCKET_DB_PERSISTENT;
3533+
if (parallelLedgerClose)
3534+
{
3535+
#ifdef USE_POSTGRES
3536+
dbMode = Config::TESTDB_POSTGRESQL;
3537+
#else
3538+
FAIL("Parallel ledger close requires postgres");
3539+
#endif
3540+
}
3541+
auto cfg = getTestConfig(i, dbMode);
35333542
cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = version;
35343543
if (parallelLedgerClose)
35353544
{

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)