Fix intermittent failure in metrics test 27/127127/2
authorrameshiyer27 <ramesh.murugan.iyer@est.tech>
Tue, 15 Feb 2022 09:29:32 +0000 (09:29 +0000)
committerRamesh Murugan Iyer <ramesh.murugan.iyer@est.tech>
Tue, 15 Feb 2022 10:49:02 +0000 (10:49 +0000)
When the registry is cleared, it removes the Prometheus counters that
are initialized by static definition causing the metrics test to fail.
This issue occurs when this test is not invoked first in the order of
test execution in feature-lifecycle.

Issue-ID: POLICY-3832
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: I9a55910bc39dbe1ad9f1153809bdf78bac3040b1

feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java

index b8139e6..7676929 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  * Copyright (C) 2019-2022 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2022 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -109,7 +110,6 @@ public class RestLifecycleManagerTest {
      */
     @Before
      public void setUp() throws Exception {
-        CollectorRegistry.defaultRegistry.clear();
 
         SystemPersistenceConstants.getManager().setConfigurationDir("target/test-classes");
         fsm = newFsmInstance();
@@ -170,7 +170,6 @@ public class RestLifecycleManagerTest {
         PolicyControllerConstants.getFactory().destroy();
         SystemPersistenceConstants.getManager().setConfigurationDir(null);
 
-        CollectorRegistry.defaultRegistry.clear();
     }
 
     @Test