From d2ecf3a0867b7dc482e61b04e56737a5f6491e53 Mon Sep 17 00:00:00 2001 From: Alexander Taepper Date: Thu, 23 May 2024 14:15:09 +0200 Subject: [PATCH] fixup --- include/silo/common/data_version.h | 2 +- .../database_directory_watcher.test.cpp | 18 +++++++++++++----- .../dataDirectories/1236/data_version.silo | 2 ++ 3 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 testBaseData/dataDirectories/1236/data_version.silo diff --git a/include/silo/common/data_version.h b/include/silo/common/data_version.h index 0d2a53834..d53300226 100644 --- a/include/silo/common/data_version.h +++ b/include/silo/common/data_version.h @@ -30,7 +30,7 @@ class DataVersion { uint32_t value; }; - static constexpr SerializationVersion CURRENT_SILO_SERIALIZATION_VERSION{0}; + static constexpr SerializationVersion CURRENT_SILO_SERIALIZATION_VERSION{1}; private: Timestamp timestamp; diff --git a/src/silo_api/database_directory_watcher.test.cpp b/src/silo_api/database_directory_watcher.test.cpp index c06447157..30375d349 100644 --- a/src/silo_api/database_directory_watcher.test.cpp +++ b/src/silo_api/database_directory_watcher.test.cpp @@ -16,18 +16,26 @@ TEST(DatabaseDirectoryWatcher, validBackwardsCompatible) { auto under_test = DatabaseDirectoryWatcher::checkValidDataSource("testBaseData/dataDirectories/1234"); ASSERT_TRUE(under_test.has_value()); - ASSERT_TRUE(under_test.value().isCompatibleVersion()); + ASSERT_FALSE(under_test.value().isCompatibleVersion()); ASSERT_EQ(under_test->getTimestamp(), silo::DataVersion::Timestamp::fromString("1234")); } -TEST(DatabaseDirectoryWatcher, validNewFormat) { +TEST(DatabaseDirectoryWatcher, validNewFormatOldVersion) { auto under_test = DatabaseDirectoryWatcher::checkValidDataSource("testBaseData/dataDirectories/1235"); ASSERT_TRUE(under_test.has_value()); - ASSERT_TRUE(under_test.value().isCompatibleVersion()); + ASSERT_FALSE(under_test.value().isCompatibleVersion()); ASSERT_EQ(under_test->getTimestamp(), silo::DataVersion::Timestamp::fromString("1235")); } +TEST(DatabaseDirectoryWatcher, validNewFormatCurrentVersion) { + auto under_test = + DatabaseDirectoryWatcher::checkValidDataSource("testBaseData/dataDirectories/1236"); + ASSERT_TRUE(under_test.has_value()); + ASSERT_TRUE(under_test.value().isCompatibleVersion()); + ASSERT_EQ(under_test->getTimestamp(), silo::DataVersion::Timestamp::fromString("1236")); +} + TEST(DatabaseDirectoryWatcher, validNewFormatIncompatible) { auto under_test = DatabaseDirectoryWatcher::checkValidDataSource("testBaseData/dataDirectories/9999999999991234" @@ -61,9 +69,9 @@ TEST(DatabaseDirectoryWatcher, getsMostRecentCompatible) { auto under_test = DatabaseDirectoryWatcher::getMostRecentDataDirectory("testBaseData/dataDirectories"); ASSERT_TRUE(under_test.has_value()); - ASSERT_EQ(under_test.value().first, "testBaseData/dataDirectories/1235"); + ASSERT_EQ(under_test.value().first, "testBaseData/dataDirectories/1236"); ASSERT_TRUE(under_test.value().second.isCompatibleVersion()); ASSERT_EQ( - under_test.value().second.getTimestamp(), silo::DataVersion::Timestamp::fromString("1235") + under_test.value().second.getTimestamp(), silo::DataVersion::Timestamp::fromString("1236") ); } diff --git a/testBaseData/dataDirectories/1236/data_version.silo b/testBaseData/dataDirectories/1236/data_version.silo new file mode 100644 index 000000000..35a15a3eb --- /dev/null +++ b/testBaseData/dataDirectories/1236/data_version.silo @@ -0,0 +1,2 @@ +timestamp: 1236 +serializationVersion: 1 \ No newline at end of file