diff --git a/libs/client-sdk/src/data_sources/data_source_event_handler.cpp b/libs/client-sdk/src/data_sources/data_source_event_handler.cpp index fe182d81d..a82961488 100644 --- a/libs/client-sdk/src/data_sources/data_source_event_handler.cpp +++ b/libs/client-sdk/src/data_sources/data_source_event_handler.cpp @@ -92,7 +92,7 @@ DataSourceEventHandler::MessageStatus DataSourceEventHandler::HandleMessage( status_manager_.SetError( DataSourceStatus::ErrorInfo::ErrorKind::kInvalidData, kErrorParsingPut); - return DataSourceEventHandler::MessageStatus::kInvalidMessage; + return MessageStatus::kInvalidMessage; } auto res = boost::json::value_to>, @@ -105,13 +105,13 @@ DataSourceEventHandler::MessageStatus DataSourceEventHandler::HandleMessage( handler_.Init(context_, std::move(map)); status_manager_.SetState(DataSourceStatus::DataSourceState::kValid); - return DataSourceEventHandler::MessageStatus::kMessageHandled; + return MessageStatus::kMessageHandled; } LD_LOG(logger_, LogLevel::kError) << kErrorPutInvalid; status_manager_.SetError( DataSourceStatus::ErrorInfo::ErrorKind::kInvalidData, kErrorPutInvalid); - return DataSourceEventHandler::MessageStatus::kInvalidMessage; + return MessageStatus::kInvalidMessage; } if (type == "patch") { boost::json::error_code error_code; @@ -121,21 +121,20 @@ DataSourceEventHandler::MessageStatus DataSourceEventHandler::HandleMessage( status_manager_.SetError( DataSourceStatus::ErrorInfo::ErrorKind::kInvalidData, kErrorParsingPatch); - return DataSourceEventHandler::MessageStatus::kInvalidMessage; + return MessageStatus::kInvalidMessage; } - auto res = boost::json::value_to< - tl::expected>(parsed); + auto res = + boost::json::value_to>(parsed); if (res.has_value()) { - handler_.Upsert( - context_, res.value().key, - launchdarkly::client_side::ItemDescriptor(res.value().flag)); - return DataSourceEventHandler::MessageStatus::kMessageHandled; + handler_.Upsert(context_, res.value().key, + ItemDescriptor(res.value().flag)); + return MessageStatus::kMessageHandled; } LD_LOG(logger_, LogLevel::kError) << kErrorPatchInvalid; status_manager_.SetError( DataSourceStatus::ErrorInfo::ErrorKind::kInvalidData, kErrorPatchInvalid); - return DataSourceEventHandler::MessageStatus::kInvalidMessage; + return MessageStatus::kInvalidMessage; } if (type == "delete") { boost::json::error_code error_code; @@ -145,22 +144,22 @@ DataSourceEventHandler::MessageStatus DataSourceEventHandler::HandleMessage( status_manager_.SetError( DataSourceStatus::ErrorInfo::ErrorKind::kInvalidData, kErrorParsingDelete); - return DataSourceEventHandler::MessageStatus::kInvalidMessage; + return MessageStatus::kInvalidMessage; } - auto res = boost::json::value_to< - tl::expected>( + auto res = boost::json::value_to>( boost::json::parse(data)); if (res.has_value()) { - handler_.Upsert(context_, res.value().key, - ItemDescriptor(res.value().version)); - return DataSourceEventHandler::MessageStatus::kMessageHandled; + handler_.Upsert( + context_, res.value().key, + ItemDescriptor(data_model::Tombstone(res.value().version))); + return MessageStatus::kMessageHandled; } LD_LOG(logger_, LogLevel::kError) << kErrorDeleteInvalid; status_manager_.SetError( DataSourceStatus::ErrorInfo::ErrorKind::kInvalidData, kErrorDeleteInvalid); - return DataSourceEventHandler::MessageStatus::kInvalidMessage; + return MessageStatus::kInvalidMessage; } - return DataSourceEventHandler::MessageStatus::kUnhandledVerb; + return MessageStatus::kUnhandledVerb; } } // namespace launchdarkly::client_side::data_sources diff --git a/libs/client-sdk/tests/data_source_event_handler_test.cpp b/libs/client-sdk/tests/data_source_event_handler_test.cpp index 8685bbeca..dc57830be 100644 --- a/libs/client-sdk/tests/data_source_event_handler_test.cpp +++ b/libs/client-sdk/tests/data_source_event_handler_test.cpp @@ -158,8 +158,8 @@ TEST(StreamingDataHandlerTests, HandlesDeleteMessage) { EXPECT_EQ(DataSourceEventHandler::MessageStatus::kMessageHandled, res); EXPECT_EQ(1, test_handler.count_); - auto expected_put = - std::pair{"flagA", ItemDescriptor(1)}; + auto expected_put = std::pair{ + "flagA", ItemDescriptor(data_model::Tombstone(1))}; EXPECT_EQ(expected_put, test_handler.upsert_data_[0]); } diff --git a/libs/client-sdk/tests/flag_store_test.cpp b/libs/client-sdk/tests/flag_store_test.cpp index 818c06fe8..56ba92988 100644 --- a/libs/client-sdk/tests/flag_store_test.cpp +++ b/libs/client-sdk/tests/flag_store_test.cpp @@ -11,6 +11,7 @@ using launchdarkly::EvaluationResult; using launchdarkly::Value; using launchdarkly::client_side::ItemDescriptor; using launchdarkly::client_side::flag_manager::FlagStore; +using Tombstone = launchdarkly::data_model::Tombstone; TEST(FlagstoreTests, HandlesEmptyInit) { FlagStore store; @@ -108,7 +109,7 @@ TEST(FlagstoreTests, HandleDelete) { EvaluationDetailInternal{Value("test"), std::nullopt, std::nullopt}}}}}}); - store.Upsert("flagA", ItemDescriptor{2}); + store.Upsert("flagA", ItemDescriptor{Tombstone{2}}); EXPECT_FALSE(store.GetAll().empty()); EXPECT_FALSE(store.Get("flagA")->item.has_value()); diff --git a/libs/client-sdk/tests/flag_updater_test.cpp b/libs/client-sdk/tests/flag_updater_test.cpp index 50b1067c4..228a695d6 100644 --- a/libs/client-sdk/tests/flag_updater_test.cpp +++ b/libs/client-sdk/tests/flag_updater_test.cpp @@ -17,15 +17,14 @@ using launchdarkly::client_side::flag_manager::FlagStore; using launchdarkly::client_side::flag_manager::FlagUpdater; using launchdarkly::client_side::flag_manager::FlagValueChangeEvent; using launchdarkly::client_side::flag_manager::IFlagNotifier; +using Tombstone = launchdarkly::data_model::Tombstone; TEST(FlagUpdaterDataTests, HandlesEmptyInit) { FlagStore manager; FlagUpdater updater(manager); - updater.Init( - ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{}); + updater.Init(ContextBuilder().Kind("user", "user-key").Build(), + std::unordered_map{}); EXPECT_TRUE(manager.GetAll().empty()); } @@ -36,8 +35,7 @@ TEST(FlagUpdaterDataTests, HandlesInitWithData) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 0, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -53,8 +51,7 @@ TEST(FlagUpdaterDataTests, HandlesSecondInit) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 0, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -62,8 +59,7 @@ TEST(FlagUpdaterDataTests, HandlesSecondInit) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagB", ItemDescriptor{EvaluationResult{ 0, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -80,8 +76,7 @@ TEST(FlagUpdaterDataTests, HandlePatchNewFlag) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 0, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -104,8 +99,7 @@ TEST(FlagUpdaterDataTests, HandlePatchUpdateFlag) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 0, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -127,8 +121,7 @@ TEST(FlagUpdaterDataTests, HandlePatchOutOfOrder) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -150,15 +143,14 @@ TEST(FlagUpdaterDataTests, HandleDelete) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, std::nullopt}}}}}}); updater.Upsert(ContextBuilder().Kind("user", "user-key").Build(), "flagA", - ItemDescriptor{2}); + ItemDescriptor{Tombstone{2}}); EXPECT_FALSE(manager.GetAll().empty()); EXPECT_FALSE(manager.Get("flagA")->item.has_value()); @@ -170,15 +162,14 @@ TEST(FlagUpdaterDataTests, HandleDeleteOutOfOrder) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, std::nullopt}}}}}}); updater.Upsert(ContextBuilder().Kind("user", "user-key").Build(), "flagA", - ItemDescriptor{0}); + ItemDescriptor{Tombstone{0}}); EXPECT_FALSE(manager.GetAll().empty()); EXPECT_EQ("test", manager.Get("flagA")->item.value().Detail().Value()); @@ -198,8 +189,7 @@ TEST(FlagUpdaterEventTests, InitialInitProducesNoEvents) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -228,8 +218,7 @@ TEST(FlagUpdaterEventTests, SecondInitWithUpdateProducesEvents) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -237,8 +226,7 @@ TEST(FlagUpdaterEventTests, SecondInitWithUpdateProducesEvents) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, @@ -268,8 +256,7 @@ TEST(FlagUpdaterEventTests, SecondInitWithNewFlagProducesEvents) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -277,8 +264,7 @@ TEST(FlagUpdaterEventTests, SecondInitWithNewFlagProducesEvents) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagB", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, @@ -308,8 +294,7 @@ TEST(FlagUpdaterDataTests, PatchWithUpdateProducesEvent) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 0, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -343,8 +328,7 @@ TEST(FlagUpdaterEventTests, PatchWithNewFlagProducesEvent) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -374,8 +358,7 @@ TEST(FlagUpdaterEventTests, OutOfOrderPatchProducesNoEvent) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -404,8 +387,7 @@ TEST(FlagUpdaterEventTests, EqualVersionProducesNoEvent) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -439,15 +421,14 @@ TEST(FlagUpdaterEventTests, DeleteProducesAnEvent) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, std::nullopt}}}}}}); updater.Upsert(ContextBuilder().Kind("user", "user-key").Build(), "flagA", - ItemDescriptor{2}); + ItemDescriptor{Tombstone{2}}); EXPECT_TRUE(got_event); } @@ -471,8 +452,7 @@ TEST(FlagUpdaterEventTests, FlagMissingFromSecondInitTreatedAsDelete) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -485,8 +465,7 @@ TEST(FlagUpdaterEventTests, FlagMissingFromSecondInitTreatedAsDelete) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -516,8 +495,7 @@ TEST(FlagUpdaterEventTests, InitWithoutEvaluationResultTreatedAsDelete) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -530,13 +508,12 @@ TEST(FlagUpdaterEventTests, InitWithoutEvaluationResultTreatedAsDelete) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, std::nullopt}}}}, - {"flagB", ItemDescriptor{2}}}}); + {"flagB", ItemDescriptor{Tombstone{2}}}}}); EXPECT_TRUE(got_event); } @@ -560,8 +537,7 @@ TEST(FlagUpdaterEventTests, DeletedFlagStillDeletedInit) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -574,8 +550,7 @@ TEST(FlagUpdaterEventTests, DeletedFlagStillDeletedInit) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -586,8 +561,7 @@ TEST(FlagUpdaterEventTests, DeletedFlagStillDeletedInit) { // Do another init where it is still deleted. updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -615,20 +589,19 @@ TEST(FlagUpdaterEventTests, SecondDeleteNoEventPatch) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, std::nullopt}}}}}}); updater.Upsert(ContextBuilder().Kind("user", "user-key").Build(), "flagA", - ItemDescriptor{2}); + ItemDescriptor{Tombstone{2}}); got_event.store(false); updater.Upsert(ContextBuilder().Kind("user", "user-key").Build(), "flagA", - ItemDescriptor{3}); + ItemDescriptor{Tombstone{3}}); EXPECT_FALSE(got_event); } @@ -652,8 +625,7 @@ TEST(FlagUpdaterDataTests, CanDisconnectEventAndStopGettingEvents) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 0, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, @@ -701,15 +673,14 @@ TEST(FlagUpdaterEventTests, UndeletedFlagProducesEvent) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{Value("test"), std::nullopt, std::nullopt}}}}}}); updater.Upsert(ContextBuilder().Kind("user", "user-key").Build(), "flagA", - ItemDescriptor{2}); + ItemDescriptor{Tombstone{2}}); got_event.store(false); @@ -752,8 +723,7 @@ TEST(FlagUpdaterEventTests, CanListenToMultipleFlags) { updater.Init( ContextBuilder().Kind("user", "user-key").Build(), - std::unordered_map{ + std::unordered_map{ {{"flagA", ItemDescriptor{EvaluationResult{ 1, std::nullopt, false, false, std::nullopt, EvaluationDetailInternal{ diff --git a/libs/internal/include/launchdarkly/data_model/item_descriptor.hpp b/libs/internal/include/launchdarkly/data_model/item_descriptor.hpp index cd6b58ad8..02c5c4254 100644 --- a/libs/internal/include/launchdarkly/data_model/item_descriptor.hpp +++ b/libs/internal/include/launchdarkly/data_model/item_descriptor.hpp @@ -26,8 +26,6 @@ struct ItemDescriptor { */ std::optional item; - explicit ItemDescriptor(uint64_t version); - explicit ItemDescriptor(Tombstone tombstone); explicit ItemDescriptor(T item); @@ -57,9 +55,6 @@ std::ostream& operator<<(std::ostream& out, return out; } -template -ItemDescriptor::ItemDescriptor(uint64_t const version) : version(version) {} - template ItemDescriptor::ItemDescriptor(Tombstone tombstone) : version(std::move(tombstone)) {} diff --git a/libs/server-sdk/src/data_components/serialization_adapters/json_deserializer.hpp b/libs/server-sdk/src/data_components/serialization_adapters/json_deserializer.hpp index 7fe49046f..b610d2f5a 100644 --- a/libs/server-sdk/src/data_components/serialization_adapters/json_deserializer.hpp +++ b/libs/server-sdk/src/data_components/serialization_adapters/json_deserializer.hpp @@ -46,7 +46,8 @@ class JsonDeserializer final : public data_interfaces::IDataReader { data_interfaces::IDataReader::Error> IntoStorageItem(integrations::SerializedItemDescriptor const& descriptor) { if (descriptor.deleted) { - return data_model::ItemDescriptor(descriptor.version); + return data_model::ItemDescriptor( + data_model::Tombstone(descriptor.version)); } auto const json_val = boost::json::parse(descriptor.serializedItem); diff --git a/libs/server-sdk/src/data_systems/background_sync/sources/streaming/event_handler.cpp b/libs/server-sdk/src/data_systems/background_sync/sources/streaming/event_handler.cpp index dfc197292..3eb15e653 100644 --- a/libs/server-sdk/src/data_systems/background_sync/sources/streaming/event_handler.cpp +++ b/libs/server-sdk/src/data_systems/background_sync/sources/streaming/event_handler.cpp @@ -214,12 +214,14 @@ DataSourceEventHandler::MessageStatus DataSourceEventHandler::HandleMessage( switch (res->kind) { case data_components::DataKind::kFlag: { handler_.Upsert(res->key, - data_model::FlagDescriptor(res->version)); + data_model::FlagDescriptor( + data_model::Tombstone(res->version))); return MessageStatus::kMessageHandled; } case data_components::DataKind::kSegment: { - handler_.Upsert( - res->key, data_model::SegmentDescriptor(res->version)); + handler_.Upsert(res->key, + data_model::SegmentDescriptor( + data_model::Tombstone(res->version))); return MessageStatus::kMessageHandled; } default: { diff --git a/libs/server-sdk/tests/json_destination_test.cpp b/libs/server-sdk/tests/json_destination_test.cpp index 6cd0ba54f..0e0fde53d 100644 --- a/libs/server-sdk/tests/json_destination_test.cpp +++ b/libs/server-sdk/tests/json_destination_test.cpp @@ -109,7 +109,7 @@ TEST_F(JsonDestinationTest, UpsertFlagErrorGeneratesErrorMessage) { EXPECT_CALL(mock_dest, Upsert) .WillOnce(Return(ISerializedDestination::UpsertResult::kError)); - dest.Upsert("foo", data_model::FlagDescriptor(1)); + dest.Upsert("foo", data_model::FlagDescriptor(data_model::Tombstone(1))); ASSERT_TRUE( spy_logger->Contains(0, LogLevel::kError, "failed to update flag foo")); @@ -119,7 +119,7 @@ TEST_F(JsonDestinationTest, UpsertSegmentErrorGeneratesErrorMessage) { EXPECT_CALL(mock_dest, Upsert) .WillOnce(Return(ISerializedDestination::UpsertResult::kError)); - dest.Upsert("foo", data_model::SegmentDescriptor(1)); + dest.Upsert("foo", data_model::SegmentDescriptor(data_model::Tombstone(1))); ASSERT_TRUE(spy_logger->Contains(0, LogLevel::kError, "failed to update segment foo")); @@ -129,7 +129,7 @@ TEST_F(JsonDestinationTest, UpsertStaleFlagGeneratesDebugMessage) { EXPECT_CALL(mock_dest, Upsert) .WillOnce(Return(ISerializedDestination::UpsertResult::kNotUpdated)); - dest.Upsert("foo", data_model::FlagDescriptor(1)); + dest.Upsert("foo", data_model::FlagDescriptor(data_model::Tombstone(1))); ASSERT_TRUE( spy_logger->Contains(0, LogLevel::kDebug, "flag foo not updated")); @@ -139,7 +139,7 @@ TEST_F(JsonDestinationTest, UpsertStaleSegmentGeneratesDebugMessage) { EXPECT_CALL(mock_dest, Upsert) .WillOnce(Return(ISerializedDestination::UpsertResult::kNotUpdated)); - dest.Upsert("foo", data_model::SegmentDescriptor(1)); + dest.Upsert("foo", data_model::SegmentDescriptor(data_model::Tombstone(1))); ASSERT_TRUE( spy_logger->Contains(0, LogLevel::kDebug, "segment foo not updated")); @@ -153,7 +153,7 @@ TEST_F(JsonDestinationTest, UpsertDeletedFlagCreatesTombstone) { 2, "{\"key\":\"flag\",\"version\":2,\"deleted\":true}"))) .WillOnce(Return(ISerializedDestination::UpsertResult::kSuccess)); - dest.Upsert("flag", data_model::FlagDescriptor(2)); + dest.Upsert("flag", data_model::FlagDescriptor(data_model::Tombstone(2))); } TEST_F(JsonDestinationTest, UpsertDeletedSegmentCreatesTombstone) { @@ -164,7 +164,7 @@ TEST_F(JsonDestinationTest, UpsertDeletedSegmentCreatesTombstone) { 2, "{\"key\":\"segment\",\"version\":2,\"deleted\":true}"))) .WillOnce(Return(ISerializedDestination::UpsertResult::kSuccess)); - dest.Upsert("segment", data_model::SegmentDescriptor(2)); + dest.Upsert("segment", data_model::SegmentDescriptor(data_model::Tombstone(2))); } TEST_F(JsonDestinationTest, UpsertFlagCreatesSerializedItem) {