From aee3e3a54c12e5a5e0a0c27138e63bd17b266c05 Mon Sep 17 00:00:00 2001 From: labkey-jeckels Date: Wed, 28 Oct 2026 11:38:34 -0700 Subject: [PATCH] Test UsageMetrics inconsistent descriptions in production mode too --- .../org/labkey/api/usageMetrics/UsageMetrics.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/api/src/org/labkey/api/usageMetrics/UsageMetrics.java b/api/src/org/labkey/api/usageMetrics/UsageMetrics.java index 933966f6267..0061dc9c07d 100644 --- a/api/src/org/labkey/api/usageMetrics/UsageMetrics.java +++ b/api/src/org/labkey/api/usageMetrics/UsageMetrics.java @@ -253,8 +253,18 @@ public void testRepeatedDescriptions() metrics.put("count", 1L, "Things"); assertEquals(List.of(new Description("count", "Things", Kind.CURRENT)), metrics.getDescriptions()); - assertThrows(IllegalStateException.class, () -> metrics.put("count", 1L, "Other things")); - assertThrows(IllegalStateException.class, () -> metrics.describe("count", "Things", Kind.CUMULATIVE)); + if (AppProps.getInstance().isDevMode()) + { + assertThrows(IllegalStateException.class, () -> metrics.put("count", 1L, "Other things")); + assertThrows(IllegalStateException.class, () -> metrics.describe("count", "Things", Kind.CUMULATIVE)); + } + else + { + metrics.put("count", 2L, "Other things"); + metrics.describe("count", "Things", Kind.CUMULATIVE); + assertEquals(Map.of("count", 2L), metrics.getValues()); + assertEquals(List.of(new Description("count", "Things", Kind.CURRENT)), metrics.getDescriptions()); + } } @Test