Skip to content

Commit

Permalink
Fix Bucket tests after rector
Browse files Browse the repository at this point in the history
  • Loading branch information
SirTyson committed Sep 12, 2024
1 parent 39a9652 commit cc5599c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/history/test/HistoryTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1209,9 +1209,10 @@ TEST_CASE_VERSIONS(

while (hm.getPublishQueueCount() != 1)
{
uint32_t ledger = lm.getLastClosedLedgerNum() + 1;
bl.addBatch(
*app, ledger, cfg.LEDGER_PROTOCOL_VERSION, {},
auto lcl = lm.getLastClosedLedgerHeader();
lcl.header.ledgerSeq += 1;
BucketTestUtils::addBatchAndUpdateSnapshot(
bl, *app, lcl.header, {},
LedgerTestUtils::generateValidUniqueLedgerEntries(8), {});
clock.crank(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "bucket/BucketInputIterator.h"
#include "bucket/BucketManager.h"
#include "bucket/BucketOutputIterator.h"
#include "bucket/test/BucketTestUtils.h"
#include "catchup/ApplyBucketsWork.h"
#include "ledger/LedgerHashUtils.h"
#include "ledger/LedgerTxn.h"
Expand Down Expand Up @@ -143,8 +144,9 @@ struct BucketListGenerator
std::vector<LedgerKey> deadEntries;
auto header = ltx.loadHeader().current();
ltx.getAllEntries(initEntries, liveEntries, deadEntries);
app->getBucketManager().addBatch(*app, header, initEntries, liveEntries,
deadEntries);
BucketTestUtils::addBatchAndUpdateSnapshot(
app->getBucketManager().getBucketList(), *app, header, initEntries,
liveEntries, deadEntries);
ltx.commit();
}

Expand Down
6 changes: 4 additions & 2 deletions src/ledger/LedgerManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "ledger/LedgerManagerImpl.h"
#include "bucket/BucketList.h"
#include "bucket/BucketManager.h"
#include "bucket/test/BucketTestUtils.h"
#include "catchup/AssumeStateWork.h"
#include "crypto/Hex.h"
#include "crypto/KeyUtils.h"
Expand Down Expand Up @@ -1725,8 +1726,9 @@ LedgerManagerImpl::transferLedgerEntriesToBucketList(
ltx.getAllEntries(initEntries, liveEntries, deadEntries);
if (blEnabled)
{
mApp.getBucketManager().addBatch(mApp, lh, initEntries, liveEntries,
deadEntries);
BucketTestUtils::addBatchAndUpdateSnapshot(
mApp.getBucketManager().getBucketList(), mApp, lh, initEntries,
liveEntries, deadEntries);
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/simulation/CoreTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "bucket/BucketManager.h"
#include "bucket/BucketManagerImpl.h"
#include "bucket/LedgerCmp.h"
#include "bucket/test/BucketTestUtils.h"
#include "crypto/SHA.h"
#include "herder/HerderImpl.h"
#include "herder/LedgerCloseData.h"
Expand Down Expand Up @@ -685,8 +686,9 @@ TEST_CASE("Bucket list entries vs write throughput", "[scalability][!hide]")
LedgerHeader lh;
lh.ledgerVersion = Config::CURRENT_LEDGER_PROTOCOL_VERSION;
lh.ledgerSeq = i;
app->getBucketManager().addBatch(
*app, lh, LedgerTestUtils::generateValidLedgerEntries(100),
BucketTestUtils::addBatchAndUpdateSnapshot(
app->getBucketManager().getBucketList(), *app, lh,
LedgerTestUtils::generateValidLedgerEntries(100),
LedgerTestUtils::generateValidLedgerEntries(20),
LedgerTestUtils::generateValidLedgerEntryKeysWithExclusions(
{CONFIG_SETTING}, 5));
Expand Down

0 comments on commit cc5599c

Please sign in to comment.