Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Taepper committed May 23, 2024
1 parent 66685b4 commit d2ecf3a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/silo/common/data_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 13 additions & 5 deletions src/silo_api/database_directory_watcher.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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")
);
}
2 changes: 2 additions & 0 deletions testBaseData/dataDirectories/1236/data_version.silo
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
timestamp: 1236
serializationVersion: 1

0 comments on commit d2ecf3a

Please sign in to comment.