From a52a7242fac4f2fbddb577e26587bed246b1f23a Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Wed, 2 Dec 2020 11:53:58 +0100 Subject: [PATCH] relax test for trigger count, it might have been incremented but not persisted fixes #52931 --- .../xpack/transform/integration/TransformUsageIT.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/x-pack/plugin/transform/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/TransformUsageIT.java b/x-pack/plugin/transform/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/TransformUsageIT.java index bd4a542162b10..6cc1875d20da7 100644 --- a/x-pack/plugin/transform/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/TransformUsageIT.java +++ b/x-pack/plugin/transform/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/TransformUsageIT.java @@ -75,8 +75,6 @@ public void testUsage() throws Exception { Request getRequest = new Request("GET", getTransformEndpoint() + "test_usage/_stats"); Map stats = entityAsMap(client().performRequest(getRequest)); - // temporary debug logs for https://github.com/elastic/elasticsearch/issues/52931 - logger.info("test_usage/_stats response: [{}]", stats); Map expectedStats = new HashMap<>(); for (String statName : PROVIDED_STATS) { @SuppressWarnings("unchecked") @@ -87,8 +85,6 @@ public void testUsage() throws Exception { getRequest = new Request("GET", getTransformEndpoint() + "test_usage_continuous/_stats"); stats = entityAsMap(client().performRequest(getRequest)); - // temporary debug logs for https://github.com/elastic/elasticsearch/issues/52931 - logger.info("test_usage_continuous/_stats response: [{}]", stats); for (String statName : PROVIDED_STATS) { @SuppressWarnings("unchecked") List specificStatistic = (List) (XContentMapValues.extractValue("transforms.stats." + statName, stats)); @@ -107,12 +103,14 @@ public void testUsage() throws Exception { assertEquals(2, XContentMapValues.extractValue("transform.transforms.stopped", statsMap)); assertEquals(1, XContentMapValues.extractValue("transform.transforms.started", statsMap)); for (String statName : PROVIDED_STATS) { - // the trigger count can be higher if the scheduler kicked before usage has been called, therefore check for gte + // the trigger count can be off: e.g. if the scheduler kicked before usage has been called, + // or if the the scheduler triggered later, but state hasn't been persisted (by design) + // however, we know that as we have 2 transforms, the trigger count must be greater or equal to 2 if (statName.equals(TransformIndexerStats.NUM_INVOCATIONS.getPreferredName())) { assertThat( "Incorrect stat " + statName + ", got: " + statsMap.get("transform"), extractStatsAsDouble(XContentMapValues.extractValue("transform.stats." + statName, statsMap)), - greaterThanOrEqualTo(expectedStats.get(statName).doubleValue()) + greaterThanOrEqualTo(2.0) ); } else { assertThat(