aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/encode/json/json_ut.cpp
diff options
context:
space:
mode:
authormiktorius <miktorius@yandex-team.com>2025-03-06 12:11:55 +0300
committermiktorius <miktorius@yandex-team.com>2025-03-06 14:53:44 +0300
commit618663dff0c22bb5fc2a8b1d946d6b91ac572fb4 (patch)
tree09d317c27318a1bf8b5c2ab3cba9415990432321 /library/cpp/monlib/encode/json/json_ut.cpp
parent89948053154b88163e209389b19a93d81f8235e7 (diff)
downloadydb-618663dff0c22bb5fc2a8b1d946d6b91ac572fb4.tar.gz
monlib : memOnly support for JSON encoding/decoding (cpp)
json encoder memonly attempt commit_hash:0cef79f66356a94c398c76dc9baf2fe3ea9a6948
Diffstat (limited to 'library/cpp/monlib/encode/json/json_ut.cpp')
-rw-r--r--library/cpp/monlib/encode/json/json_ut.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/library/cpp/monlib/encode/json/json_ut.cpp b/library/cpp/monlib/encode/json/json_ut.cpp
index 49de352062..78103a42b5 100644
--- a/library/cpp/monlib/encode/json/json_ut.cpp
+++ b/library/cpp/monlib/encode/json/json_ut.cpp
@@ -136,7 +136,7 @@ Y_UNIT_TEST_SUITE(TJsonTest) {
const TInstant now = TInstant::ParseIso8601Deprecated("2017-11-05T01:02:03Z");
Y_UNIT_TEST(Encode) {
- auto check = [](bool cloud, bool buffered, TStringBuf expectedResourceKey) {
+ auto check = [](bool cloud, bool buffered, bool memOnly, TStringBuf expectedResourceKey) {
TString json;
TStringOutput out(json);
auto e = cloud
@@ -158,6 +158,7 @@ Y_UNIT_TEST_SUITE(TJsonTest) {
e->OnLabel("metric", "single");
e->OnLabel("labels", "l1");
e->OnLabelsEnd();
+ e->OnMemOnly(memOnly);
}
e->OnUint64(now, 17);
e->OnMetricEnd();
@@ -219,6 +220,7 @@ Y_UNIT_TEST_SUITE(TJsonTest) {
e->OnLabel("labels", "l6");
e->OnLabelsEnd();
}
+ e->OnMemOnly(memOnly);
e->OnMetricEnd();
}
e->OnStreamEnd();
@@ -235,10 +237,12 @@ Y_UNIT_TEST_SUITE(TJsonTest) {
UNIT_ASSERT_EQUAL(parseJson(json), parseJson(expectedJson));
};
- check(false, false, "/expected.json");
- check(false, true, "/expected_buffered.json");
- check(true, false, "/expected_cloud.json");
- check(true, true, "/expected_cloud_buffered.json");
+ check(false, false, false, "/expected.json");
+ check(true, false, false, "/expected_cloud.json");
+ check(false, true, false, "/expected_buffered.json");
+ check(true, true, false, "/expected_cloud_buffered.json");
+ check(false, false, true, "/expected_memOnly.json");
+ check(false, true, true, "/expected_buffered_memOnly.json");
}
TLogHistogramSnapshotPtr TestLogHistogram(ui32 v = 1) {
@@ -478,7 +482,7 @@ Y_UNIT_TEST_SUITE(TJsonTest) {
UNIT_ASSERT_VALUES_EQUAL(s.LabelsSize(), 2);
AssertLabelEqual(s.GetLabels(0), "export", "Oxygen");
AssertLabelEqual(s.GetLabels(1), "metric", "QueueSize");
-
+ UNIT_ASSERT_EQUAL(s.GetIsMemOnly(), true);
UNIT_ASSERT_VALUES_EQUAL(s.PointsSize(), 1);
auto ts = TInstant::ParseIso8601Deprecated("2017-11-05T12:34:56.000Z");
AssertPointEqual(s.GetPoints(0), ts, 3.14159);
@@ -487,6 +491,7 @@ Y_UNIT_TEST_SUITE(TJsonTest) {
const NProto::TMultiSample& s = samples.GetSamples(3);
UNIT_ASSERT_EQUAL(s.GetMetricType(), NProto::GAUGE);
UNIT_ASSERT_VALUES_EQUAL(s.LabelsSize(), 1);
+ UNIT_ASSERT_EQUAL(s.GetIsMemOnly(), true);
AssertLabelEqual(s.GetLabels(0), "metric", "Writes");
UNIT_ASSERT_VALUES_EQUAL(s.PointsSize(), 2);
@@ -1286,5 +1291,4 @@ Y_UNIT_TEST_SUITE(TJsonTest) {
AssertLabelEqual(s.GetLabels(1), "export", "Oxygen");
}
}
-
}