Skip to content

Commit

Permalink
Add descriptions to assertions in testMetrics (elastic#102386)
Browse files Browse the repository at this point in the history
In elastic#101608 we saw one of these assertions fail, but it's impossible to
know which one without some more details. This commit adds descriptions
to the assertions in the loop.
  • Loading branch information
DaveCTurner authored Nov 20, 2023
1 parent c0782c1 commit 86e0599
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,12 @@ public void testMetrics() throws Exception {
operation,
OperationPurpose.parse((String) metric.attributes().get("purpose"))
);
assertThat(statsCollectors, hasKey(statsKey));
assertThat(metric.getLong(), equalTo(statsCollectors.get(statsKey).counter.sum()));
assertThat(nodeName + "/" + statsKey + " exists", statsCollectors, hasKey(statsKey));
assertThat(
nodeName + "/" + statsKey + " has correct sum",
metric.getLong(),
equalTo(statsCollectors.get(statsKey).counter.sum())
);

aggregatedMetrics.compute(operation.getKey(), (k, v) -> v == null ? metric.getLong() : v + metric.getLong());
});
Expand Down

0 comments on commit 86e0599

Please sign in to comment.