summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-05-05 10:42:28 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-05-05 10:42:28 +0200
commit8eab2b67fdf83c657f996debfc238703a78b337b (patch)
treeaf23c674490c9e05c281ecd56b3e439f32229795 /tests
parent4bc39b1b771aaf9ae5f7c96aeaddb06f2bd101ac (diff)
downloadsink-8eab2b67fdf83c657f996debfc238703a78b337b.tar.gz
sink-8eab2b67fdf83c657f996debfc238703a78b337b.zip
Don't leak transactions when copying them.
Previsouly we would hit the maxreaders limit
Diffstat (limited to 'tests')
-rw-r--r--tests/storagetest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp
index 7202628..dfb91ec 100644
--- a/tests/storagetest.cpp
+++ b/tests/storagetest.cpp
@@ -487,6 +487,24 @@ private slots:
487 } 487 }
488 } 488 }
489 489
490 void testCopyTransaction()
491 {
492 Sink::Storage::DataStore store(testDataPath, dbName, Sink::Storage::DataStore::ReadWrite);
493 {
494 auto transaction = store.createTransaction(Sink::Storage::DataStore::ReadWrite);
495 transaction.openDatabase("a", nullptr, false);
496 transaction.openDatabase("b", nullptr, false);
497 transaction.openDatabase("c", nullptr, false);
498 transaction.commit();
499 }
500 auto transaction = store.createTransaction(Sink::Storage::DataStore::ReadOnly);
501 for (int i = 0; i < 1000; i++) {
502 transaction.openDatabase("a", nullptr, false);
503 transaction.openDatabase("b", nullptr, false);
504 transaction.openDatabase("c", nullptr, false);
505 transaction = store.createTransaction(Sink::Storage::DataStore::ReadOnly);
506 }
507 }
490}; 508};
491 509
492QTEST_MAIN(StorageTest) 510QTEST_MAIN(StorageTest)