| 85 | } |
| 86 | |
| 87 | void DBTest::runTest(std::vector<TestStatement>& statements, uint64_t checkpointWaitTimeout, |
| 88 | std::set<std::string> connNames) { |
| 89 | for (const auto& connName : connNames) { |
| 90 | concurrentTests.try_emplace(connName, connectionsPaused, *connMap[connName], databasePath); |
| 91 | } |
| 92 | |
| 93 | bool skipFsmLeakCheck = false; |
| 94 | |
| 95 | for (auto& statement : statements) { |
| 96 | // special for testing import and export test cases |
| 97 | if (statement.removeFileFlag) { |
| 98 | auto filePath = statement.removeFilePath; |
| 99 | filePath.erase(std::ranges::remove(filePath, '\"').begin(), filePath.end()); |
| 100 | removeFile(filePath); |
| 101 | continue; |
| 102 | } |
| 103 | if (statement.importDBFlag) { |
| 104 | auto filePath = statement.importFilePath; |
| 105 | filePath.erase(std::ranges::remove(filePath, '\"').begin(), filePath.end()); |
| 106 | createNewDB(); |
| 107 | setIEDatabasePath(filePath); |
| 108 | continue; |
| 109 | } |
| 110 | if (statement.reloadDBFlag) { |
| 111 | // For in-mem mode, we skip reload. |
| 112 | if (!inMemMode) { |
| 113 | spdlog::info("QUERY: RELOAD DB"); |
| 114 | for (auto& name : connNames) { |
| 115 | if (connMap.contains(name)) { |
| 116 | connMap.erase(name); |
| 117 | } |
| 118 | } |
| 119 | createDB(checkpointWaitTimeout); |
| 120 | createConns(connNames); |
| 121 | } |
| 122 | continue; |
| 123 | } |
| 124 | if (statement.expectedStorageVersion.has_value()) { |
| 125 | if (!inMemMode) { |
| 126 | conn.reset(); |
| 127 | connMap.clear(); |
| 128 | database.reset(); |
| 129 | const auto storageVersion = readStorageVersionFromHeader(databasePath); |
| 130 | createDB(checkpointWaitTimeout); |
| 131 | createConns(connNames); |
| 132 | ASSERT_EQ(storageVersion, statement.expectedStorageVersion.value()); |
| 133 | } |
| 134 | continue; |
| 135 | } |
| 136 | if (statement.storageVersionToSet.has_value()) { |
| 137 | if (!inMemMode) { |
| 138 | conn.reset(); |
| 139 | connMap.clear(); |
| 140 | database.reset(); |
| 141 | writeStorageVersionToHeader(databasePath, statement.storageVersionToSet.value()); |
| 142 | createDB(checkpointWaitTimeout); |
| 143 | createConns(connNames); |
| 144 | } |
nothing calls this directly
no test coverage detected