Skip to content

Commit 596d993

Browse files
committed
Fix tests
1 parent 589770e commit 596d993

File tree

2 files changed

+18
-36
lines changed

2 files changed

+18
-36
lines changed

x-pack/plugin/profiling/src/test/java/org/elasticsearch/xpack/profiling/action/TransportGetFlamegraphActionTests.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,21 @@ public void testCreateFlamegraph() {
6262
assertEquals(1.0d, response.getSamplingRate(), 0.001d);
6363
assertEquals(List.of(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), response.getCountInclusive());
6464
assertEquals(List.of(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L), response.getCountExclusive());
65+
// {145245218=3}, {145245218=4}, {145245218=5}, {145245218=6}, {145245218=7}, {145245218=8}, {145245218=9}, {145245218=10},
66+
// {145245218=11}
6567
assertEquals(
6668
List.of(
6769
Map.of("1220", 1),
6870
Map.of("1219", 2),
69-
Map.of("174640828", 3),
70-
Map.of("181190529", 4),
71-
Map.of("181192637", 5),
72-
Map.of("180652335", 6),
73-
Map.of("180479184", 7),
74-
Map.of("180475689", 8),
75-
Map.of("174846197", 9),
76-
Map.of("175515318", 10),
77-
Map.of("178196121", 11),
71+
Map.of("145245218", 3),
72+
Map.of("145245218", 4),
73+
Map.of("145245218", 5),
74+
Map.of("145245218", 6),
75+
Map.of("145245218", 7),
76+
Map.of("145245218", 8),
77+
Map.of("145245218", 9),
78+
Map.of("145245218", 10),
79+
Map.of("145245218", 11),
7880
Map.of()
7981
),
8082
response.getEdges()

x-pack/plugin/profiling/src/test/java/org/elasticsearch/xpack/profiling/action/TransportGetTopNFunctionsActionTests.java

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -60,26 +60,13 @@ public void testCreateAllTopNFunctions() {
6060
GetTopNFunctionsResponse response = TransportGetTopNFunctionsAction.buildTopNFunctions(stacktraces, null);
6161
assertNotNull(response);
6262
assertEquals(1, response.getSelfCount());
63-
assertEquals(9, response.getTotalCount());
63+
assertEquals(1, response.getTotalCount());
6464

6565
List<TopNFunction> topNFunctions = response.getTopN();
6666
assertNotNull(topNFunctions);
67-
assertEquals(9, topNFunctions.size());
68-
69-
assertEquals(
70-
List.of(
71-
topN("178196121", 1, 16339645, 1L, 1L, 0.3d, 0.3d, 2.7d, 2.7d),
72-
topN("181192637", 2, 19336161, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d),
73-
topN("181190529", 3, 19334053, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d),
74-
topN("180652335", 4, 18795859, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d),
75-
topN("180479184", 5, 18622708, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d),
76-
topN("180475689", 6, 18619213, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d),
77-
topN("175515318", 7, 13658842, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d),
78-
topN("174846197", 8, 12989721, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d),
79-
topN("174640828", 9, 12784352, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d)
80-
),
81-
topNFunctions
82-
);
67+
assertEquals(1, topNFunctions.size());
68+
69+
assertEquals(List.of(topN("145245218", 1, 12784352, 1L, 1L, 0.3d, 0.3d, 2.7d, 2.7d)), topNFunctions);
8370
}
8471

8572
public void testCreateTopNFunctionsWithLimit() {
@@ -129,20 +116,13 @@ public void testCreateTopNFunctionsWithLimit() {
129116
GetTopNFunctionsResponse response = TransportGetTopNFunctionsAction.buildTopNFunctions(stacktraces, 3);
130117
assertNotNull(response);
131118
assertEquals(1, response.getSelfCount());
132-
assertEquals(9, response.getTotalCount());
119+
assertEquals(1, response.getTotalCount());
133120

134121
List<TopNFunction> topNFunctions = response.getTopN();
135122
assertNotNull(topNFunctions);
136-
assertEquals(3, topNFunctions.size());
123+
assertEquals(1, topNFunctions.size());
137124

138-
assertEquals(
139-
List.of(
140-
topN("178196121", 1, 16339645, 1L, 1L, 0.3d, 0.3d, 2.7d, 2.7d),
141-
topN("181192637", 2, 19336161, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d),
142-
topN("181190529", 3, 19334053, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d)
143-
),
144-
topNFunctions
145-
);
125+
assertEquals(List.of(topN("145245218", 1, 12784352, 1L, 1L, 0.3d, 0.3d, 2.7d, 2.7d)), topNFunctions);
146126
}
147127

148128
private TopNFunction topN(

0 commit comments

Comments
 (0)