diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-01-16 13:26:42 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-01-16 13:26:42 +0100 |
commit | e56166cf75aff15eda05be5c33825bd926b9ccb2 (patch) | |
tree | f1f7a7b2c236a1a638bb97bcd864b0da661484b7 /tests/storagetest.cpp | |
parent | 0faf38f2ad9672fb46c77cae7317f44c72ebd10e (diff) | |
download | sink-e56166cf75aff15eda05be5c33825bd926b9ccb2.tar.gz sink-e56166cf75aff15eda05be5c33825bd926b9ccb2.zip |
Fixed storage removal.
We have to remove any open environments as well.
Diffstat (limited to 'tests/storagetest.cpp')
-rw-r--r-- | tests/storagetest.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp index 516fe85..5b4a0ba 100644 --- a/tests/storagetest.cpp +++ b/tests/storagetest.cpp | |||
@@ -63,12 +63,21 @@ private Q_SLOTS: | |||
63 | storage.removeFromDisk(); | 63 | storage.removeFromDisk(); |
64 | } | 64 | } |
65 | 65 | ||
66 | void cleanupTestCase() | 66 | void cleanup() |
67 | { | 67 | { |
68 | Akonadi2::Storage storage(testDataPath, dbName); | 68 | Akonadi2::Storage storage(testDataPath, dbName); |
69 | storage.removeFromDisk(); | 69 | storage.removeFromDisk(); |
70 | } | 70 | } |
71 | 71 | ||
72 | void testCleanup() | ||
73 | { | ||
74 | populate(1); | ||
75 | Akonadi2::Storage storage(testDataPath, dbName); | ||
76 | storage.removeFromDisk(); | ||
77 | QFileInfo info(testDataPath + "/" + dbName); | ||
78 | QVERIFY(!info.exists()); | ||
79 | } | ||
80 | |||
72 | void testRead() | 81 | void testRead() |
73 | { | 82 | { |
74 | const int count = 100; | 83 | const int count = 100; |
@@ -82,9 +91,6 @@ private Q_SLOTS: | |||
82 | QVERIFY(verify(storage, i)); | 91 | QVERIFY(verify(storage, i)); |
83 | } | 92 | } |
84 | } | 93 | } |
85 | |||
86 | Akonadi2::Storage storage(testDataPath, dbName); | ||
87 | storage.removeFromDisk(); | ||
88 | } | 94 | } |
89 | 95 | ||
90 | void testScan() | 96 | void testScan() |
@@ -120,9 +126,6 @@ private Q_SLOTS: | |||
120 | QVERIFY(!foundInvalidValue); | 126 | QVERIFY(!foundInvalidValue); |
121 | QCOMPARE(hit, 1); | 127 | QCOMPARE(hit, 1); |
122 | } | 128 | } |
123 | |||
124 | Akonadi2::Storage storage(testDataPath, dbName); | ||
125 | storage.removeFromDisk(); | ||
126 | } | 129 | } |
127 | 130 | ||
128 | void testTurnReadToWrite() | 131 | void testTurnReadToWrite() |
@@ -135,14 +138,13 @@ private Q_SLOTS: | |||
135 | }); | 138 | }); |
136 | return false; | 139 | return false; |
137 | }); | 140 | }); |
138 | store.removeFromDisk(); | ||
139 | } | 141 | } |
140 | 142 | ||
141 | void testReadEmptyDb() | 143 | void testReadEmptyDb() |
142 | { | 144 | { |
143 | bool gotResult = false; | 145 | bool gotResult = false; |
144 | bool gotError = false; | 146 | bool gotError = false; |
145 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 147 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadOnly); |
146 | store.scan(0, 0, [&](void *keyValue, int keySize, void *dataValue, int dataSize) -> bool { | 148 | store.scan(0, 0, [&](void *keyValue, int keySize, void *dataValue, int dataSize) -> bool { |
147 | gotResult = true; | 149 | gotResult = true; |
148 | return false; | 150 | return false; |
@@ -152,7 +154,6 @@ private Q_SLOTS: | |||
152 | }); | 154 | }); |
153 | QVERIFY(!gotResult); | 155 | QVERIFY(!gotResult); |
154 | QVERIFY(!gotError); | 156 | QVERIFY(!gotError); |
155 | store.removeFromDisk(); | ||
156 | } | 157 | } |
157 | 158 | ||
158 | void testConcurrentRead() | 159 | void testConcurrentRead() |