Skip to content

Commit 0bb28a5

Browse files
authored
Fix TKeyValueTracingTest unit tests (#26430)
1 parent 280fc84 commit 0bb28a5

File tree

2 files changed

+27
-35
lines changed

2 files changed

+27
-35
lines changed

.github/config/muted_ya.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ ydb/core/fq/libs/row_dispatcher/format_handler/ut TestFormatHandler.WatermarkWhe
1818
ydb/core/fq/libs/row_dispatcher/format_handler/ut TestFormatHandler.WatermarkWhereFalse
1919
ydb/core/kafka_proxy/ut KafkaProtocol.TopicsCompactionSwitchOnAndOff
2020
ydb/core/kafka_proxy/ut unittest.sole chunk
21-
ydb/core/keyvalue/ut_trace TKeyValueTracingTest.ReadHuge
22-
ydb/core/keyvalue/ut_trace TKeyValueTracingTest.ReadSmall
23-
ydb/core/keyvalue/ut_trace TKeyValueTracingTest.WriteHuge
24-
ydb/core/keyvalue/ut_trace TKeyValueTracingTest.WriteSmall
2521
ydb/core/kqp/ut/close_with_load KqpQueryService.CloseSessionsWithLoad
2622
ydb/core/kqp/ut/close_with_load KqpService.CloseSessionsWithLoad
2723
ydb/core/kqp/ut/close_with_load unittest.[*/*] chunk

ydb/core/keyvalue/keyvalue_ut_trace.cpp

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,18 @@ void TestOneWrite(TString value, TVector<TString> &&expectedTraceVariants) {
100100
env.DoKVRequest(CreateWrite("key", std::move(value)));
101101

102102
UNIT_ASSERT(env.WilsonUploader->BuildTraceTrees());
103-
UNIT_ASSERT_VALUES_EQUAL(env.WilsonUploader->Traces.size(), 1);
104-
auto& trace = env.WilsonUploader->Traces.begin()->second;
103+
// we expect one trace from DSProxy and one from KV-tablet
104+
UNIT_ASSERT_VALUES_EQUAL(env.WilsonUploader->Traces.size(), 2);
105+
106+
bool oneIsGood = std::any_of(env.WilsonUploader->Traces.begin(), env.WilsonUploader->Traces.end(),
107+
[&](const auto& v) {
108+
const auto& [_, trace] = v;
109+
return std::any_of(expectedTraceVariants.begin(), expectedTraceVariants.end(),
110+
[&](const TString& var) { return var == trace.ToString(); });
111+
}
112+
);
105113

106-
bool found = false;
107-
for (const TString &expectedTrace : expectedTraceVariants) {
108-
found |= trace.ToString() == expectedTrace;
109-
}
110-
UNIT_ASSERT_C(found, trace.ToString());
114+
UNIT_ASSERT(oneIsGood);
111115
}
112116

113117
void TestOneRead(TString value, TString expectedTrace) {
@@ -121,10 +125,16 @@ void TestOneRead(TString value, TString expectedTrace) {
121125
UNIT_ASSERT_EQUAL(response.value(), value);
122126

123127
UNIT_ASSERT(env.WilsonUploader->BuildTraceTrees());
124-
UNIT_ASSERT_EQUAL(env.WilsonUploader->Traces.size(), 1);
125-
auto& trace = env.WilsonUploader->Traces.begin()->second;
128+
// we expect one trace from DSProxy and one from KV-tablet
129+
UNIT_ASSERT_VALUES_EQUAL(env.WilsonUploader->Traces.size(), 2);
126130

127-
UNIT_ASSERT_EQUAL(trace.ToString(), expectedTrace);
131+
bool oneIsGood = std::any_of(env.WilsonUploader->Traces.begin(), env.WilsonUploader->Traces.end(),
132+
[&](const auto& v) {
133+
const auto& [_, trace] = v;
134+
return trace.ToString() == expectedTrace;
135+
}
136+
);
137+
UNIT_ASSERT(oneIsGood);
128138
}
129139

130140
Y_UNIT_TEST_SUITE(TKeyValueTracingTest) {
@@ -146,6 +156,7 @@ TVector<std::string> PDiskLogWriteVariants = {
146156
"(PDisk.LogWrite -> "
147157
"[(PDisk.InScheduler) , (PDisk.InBlockDevice)]"
148158
")",
159+
"(PDisk.LogWrite)",
149160
};
150161

151162
TVector<std::string> TabletWriteLogTempaltes = {
@@ -224,14 +235,10 @@ Y_UNIT_TEST(WriteSmall) {
224235
TVector<TString> canons = MakeCanons(
225236
"(KeyValue.Intermediate -> "
226237
"[(KeyValue.StorageRequest -> "
227-
"[(DSProxy.Put -> "
228-
"[(Backpressure.InFlight -> "
229-
"[(VDisk.Log.Put)]"
230-
")]"
231-
")]"
238+
"[(DSProxy.Put)]"
232239
") , "
233240
"(Tablet.Transaction -> "
234-
"[(Tablet.Transaction.Execute) , {TABLET_LOG_WRITE}]"
241+
"[(Tablet.Transaction.Execute) , {TABLET_LOG_WRITE} , (Tablet.Transaction.Complete)]"
235242
")]"
236243
")"
237244
);
@@ -242,34 +249,23 @@ Y_UNIT_TEST(WriteHuge) {
242249
TVector<TString> canons = MakeCanons(
243250
"(KeyValue.Intermediate -> "
244251
"[(KeyValue.StorageRequest -> "
245-
"[(DSProxy.Put -> "
246-
"[(Backpressure.InFlight -> "
247-
"[(VDisk.HullHugeBlobChunkAllocator) , "
248-
"(VDisk.HullHugeKeeper.InWaitQueue -> "
249-
"[(VDisk.HugeBlobKeeper.Write -> "
250-
"[(VDisk.Log.PutHuge)]"
251-
")]"
252-
")]"
253-
")]"
254-
")]"
252+
"[(DSProxy.Put)]"
255253
") , "
256254
"(Tablet.Transaction -> "
257-
"[(Tablet.Transaction.Execute) , {TABLET_LOG_WRITE}]"
255+
"[(Tablet.Transaction.Execute) , {TABLET_LOG_WRITE} , (Tablet.Transaction.Complete)]"
258256
")]"
259257
")"
260258
);
261259
TestOneWrite(HugeValue, std::move(canons));
262260
}
263261

264262
Y_UNIT_TEST(ReadSmall) {
265-
TString canon = "(KeyValue.Intermediate -> [(KeyValue.StorageReadRequest -> [(DSProxy.Get -> [(Backpressure.InFlight -> "
266-
"[(VDisk.LevelIndexExtremeQueryViaBatcherMergeData)])])])])";
263+
TString canon = "(KeyValue.Intermediate -> [(KeyValue.StorageReadRequest -> [(DSProxy.Get)])])";
267264
TestOneRead(SmallValue, std::move(canon));
268265
}
269266

270267
Y_UNIT_TEST(ReadHuge) {
271-
TString canon = "(KeyValue.Intermediate -> [(KeyValue.StorageReadRequest -> [(DSProxy.Get -> [(Backpressure.InFlight -> "
272-
"[(VDisk.LevelIndexExtremeQueryViaBatcherMergeData -> [(VDisk.Query.ReadBatcher)])])])])])";
268+
TString canon = "(KeyValue.Intermediate -> [(KeyValue.StorageReadRequest -> [(DSProxy.Get)])])";
273269
TestOneRead(HugeValue, std::move(canon));
274270
}
275271

0 commit comments

Comments
 (0)