Browse Source

[1845] also check new rollback behaviour

And add corresponding EXPECT statements on the 'running' transaction
Jelte Jansen 13 years ago
parent
commit
44d2850a0d
1 changed files with 8 additions and 3 deletions
  1. 8 3
      src/lib/datasrc/tests/sqlite3_accessor_unittest.cc

+ 8 - 3
src/lib/datasrc/tests/sqlite3_accessor_unittest.cc

@@ -777,15 +777,20 @@ TEST_F(SQLite3Update,  rollbackFailure) {
     // the rollback operation at the end of the test.
 
     // Since SQLite3 version 3.7.11, rollbacks do not fail on pending
-    // transactions anymore, making this test fail (and moot). So
-    // we'll only try on older versions
-#if SQLITE_VERSION_NUMBER < 3007011
+    // transactions anymore, making this test fail (and moot), but the
+    // transactions will fail after it, so, depending on version,
+    // we test whether that happens and is caught
     string columns[DatabaseAccessor::COLUMN_COUNT];
     iterator = accessor->getRecords("example.com.", zone_id);
     EXPECT_TRUE(iterator->getNext(columns));
 
     accessor->startUpdateZone("example.com.", true);
+#if SQLITE_VERSION_NUMBER < 3007011
     EXPECT_THROW(accessor->rollback(), DataSourceError);
+    EXPECT_NO_THROW(iterator->getNext(columns));
+#else
+    EXPECT_NO_THROW(accessor->rollback());
+    EXPECT_THROW(iterator->getNext(columns), DataSourceError);
 #endif
 }