Skip to content

Commit aaefc84

Browse files
committed
tests: restore deterministic retry-limit validation
Close the prior functional test before deleting and reopening its SQLite database, so retry limits are tested against the intended persisted event. Use the optional-exception abstraction in OfflineStorage_SQLite batch writes so no-exception mini builds remain supported. Files changed: lib/offline/OfflineStorage_SQLite.cpp, tests/functests/BasicFuncTests.cpp Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c4cfcad8-1637-4e46-86cf-6bf200244b04
1 parent 5c749b9 commit aaefc84

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎lib/offline/OfflineStorage_SQLite.cpp‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ namespace MAT_NS_BEGIN {
364364
return 0;
365365
}
366366
#endif
367-
try
367+
MATSDK_TRY
368368
{
369369
for (auto const& r : records) {
370370
if (insertRecordUnsafe(r)) {
@@ -376,7 +376,8 @@ namespace MAT_NS_BEGIN {
376376
}
377377
}
378378
}
379-
catch (...)
379+
#if HAVE_EXCEPTIONS
380+
MATSDK_CATCH(...)
380381
{
381382
#ifdef ENABLE_LOCKING
382383
// DbTransaction commits on destruction by default for legacy
@@ -387,8 +388,9 @@ namespace MAT_NS_BEGIN {
387388
// insertRecordUnsafe updates the estimate before the
388389
// transaction commits; undo inserts that will be rolled back.
389390
m_DbSizeEstimate -= std::min(m_DbSizeEstimate.load(), addedSize);
390-
throw;
391+
MATSDK_THROW;
391392
}
393+
#endif
392394

393395
#ifdef ENABLE_LOCKING
394396
if (allInserted) {

‎tests/functests/BasicFuncTests.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,7 @@ TEST_F(BasicFuncTests, deleteEvents)
16331633
for (const auto &e: events2) {
16341634
verifyEvent(e, find(e.GetName()));
16351635
}
1636+
FlushAndTeardown();
16361637
}
16371638
#endif
16381639

0 commit comments

Comments
 (0)