From 829a71ceebae62a34bdbc228452cd4bd3f36c69d Mon Sep 17 00:00:00 2001 From: Harshit Kumar Date: Wed, 28 Aug 2024 21:11:44 +0530 Subject: [PATCH] revert to using upsert (#233) --- .../hypertrace/config/service/store/DocumentConfigStore.java | 2 +- .../config/service/store/DocumentConfigStoreTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config-service-impl/src/main/java/org/hypertrace/config/service/store/DocumentConfigStore.java b/config-service-impl/src/main/java/org/hypertrace/config/service/store/DocumentConfigStore.java index 0fd9e749..d62deb4c 100644 --- a/config-service-impl/src/main/java/org/hypertrace/config/service/store/DocumentConfigStore.java +++ b/config-service-impl/src/main/java/org/hypertrace/config/service/store/DocumentConfigStore.java @@ -94,7 +94,7 @@ public UpsertedConfig writeConfig( .asRuntimeException(); } } else { - collection.createOrReplace(latestDocKey, latestConfigDocument); + collection.upsert(latestDocKey, latestConfigDocument); } return optionalPreviousConfig diff --git a/config-service-impl/src/test/java/org/hypertrace/config/service/store/DocumentConfigStoreTest.java b/config-service-impl/src/test/java/org/hypertrace/config/service/store/DocumentConfigStoreTest.java index 9fe2c406..d2f97e8c 100644 --- a/config-service-impl/src/test/java/org/hypertrace/config/service/store/DocumentConfigStoreTest.java +++ b/config-service-impl/src/test/java/org/hypertrace/config/service/store/DocumentConfigStoreTest.java @@ -89,7 +89,7 @@ void WriteConfigForCreate() throws IOException { ArgumentCaptor keyCaptor = ArgumentCaptor.forClass(Key.class); ArgumentCaptor documentCaptor = ArgumentCaptor.forClass(Document.class); - verify(collection, times(1)).createOrReplace(keyCaptor.capture(), documentCaptor.capture()); + verify(collection, times(1)).upsert(keyCaptor.capture(), documentCaptor.capture()); Key key = keyCaptor.getValue(); Document document = documentCaptor.getValue(); @@ -129,7 +129,7 @@ void WriteConfigForUpdateWithoutUpsertCondition() throws IOException { ArgumentCaptor keyCaptor = ArgumentCaptor.forClass(Key.class); ArgumentCaptor documentCaptor = ArgumentCaptor.forClass(Document.class); - verify(collection, times(1)).createOrReplace(keyCaptor.capture(), documentCaptor.capture()); + verify(collection, times(1)).upsert(keyCaptor.capture(), documentCaptor.capture()); Key key = keyCaptor.getValue(); Document document = documentCaptor.getValue();