From 85043189238dee61a9af65e22eabf5b362327082 Mon Sep 17 00:00:00 2001 From: vasraz Date: Thu, 25 Feb 2021 20:24:02 +0000 Subject: Disable unstable NodeSpecificCliTest Signed-off-by: Vasyl Razinkov Issue-ID: SDC-3490 Change-Id: I0f491942225860b08b767444e831ba10f0f923d4 --- .../onap-configuration-management-core/pom.xml | 7 +++ .../org/onap/config/test/NodeSpecificCliTest.java | 53 ++++++++++++---------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/pom.xml b/common/onap-common-configuration-management/onap-configuration-management-core/pom.xml index 83dfa8e59c..5077a64518 100755 --- a/common/onap-common-configuration-management/onap-configuration-management-core/pom.xml +++ b/common/onap-common-configuration-management/onap-configuration-management-core/pom.xml @@ -31,6 +31,13 @@ + + + org.awaitility + awaitility + 4.0.3 + test + com.fasterxml.jackson.core jackson-databind diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/NodeSpecificCliTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/NodeSpecificCliTest.java index f61830c169..e3f7833a80 100644 --- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/NodeSpecificCliTest.java +++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/NodeSpecificCliTest.java @@ -16,7 +16,10 @@ package org.onap.config.test; -import static org.junit.Assert.assertTrue; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.awaitility.Awaitility.await; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.io.FileOutputStream; @@ -24,63 +27,63 @@ import java.io.OutputStream; import java.util.HashMap; import java.util.Map; import java.util.Properties; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.onap.config.api.ConfigurationManager; import org.onap.config.impl.CliConfigurationImpl; import org.onap.config.util.ConfigTestConstant; import org.onap.config.util.TestUtil; /** - * Created by sheetalm on 10/19/2016. - * Scenario 19 - * Pre-requisite - set -Dnode.config.location=${"user.home"}/TestResources/ while running test - * Verify node specific override using CLI + * Created by sheetalm on 10/19/2016. Scenario 19 Pre-requisite - set -Dnode.config.location=${"user.home"}/TestResources/ while running test Verify + * node specific override using CLI */ -public class NodeSpecificCliTest { +@Disabled("Investigate instability (random failures)") +class NodeSpecificCliTest { private static final String NAMESPACE = "NodeCLI"; + private static final File FILE = new File(TestUtil.jsonSchemaLoc + "config.properties"); - @AfterClass + @AfterAll public static void tearDown() throws Exception { TestUtil.cleanUp(); - File f = new File(TestUtil.jsonSchemaLoc + "config.properties"); - if (f.exists()) { - assertTrue(f.delete()); + if (FILE.exists()) { + assertTrue(FILE.delete()); } } @Test - public void testCliApi() throws Exception { + void testCliApi() throws Exception { //Verify without fallback - Map input = new HashMap<>(); + final Map input = new HashMap<>(); input.put("ImplClass", "org.onap.config.type.ConfigurationQuery"); input.put("namespace", NAMESPACE); input.put("key", ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH); - ConfigurationManager conf = new CliConfigurationImpl(); - String maxLength = conf.getConfigurationValue(input); + final ConfigurationManager conf = new CliConfigurationImpl(); + final String maxLength = conf.getConfigurationValue(input); //Verify Property from Namespace configurations - Assert.assertEquals("30", maxLength); + assertEquals("30", maxLength); //Add node specific configurations - Properties props = new Properties(); + final Properties props = new Properties(); props.setProperty(ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, "50"); props.setProperty("_config.namespace", NAMESPACE); - File f = new File(TestUtil.jsonSchemaLoc + "config.properties"); - try (OutputStream out = new FileOutputStream(f)) { + + await().atMost(30, SECONDS).pollInterval(1, SECONDS).until(() -> FILE.exists()); + try (final OutputStream out = new FileOutputStream(FILE)) { props.store(out, "Node Config Property"); } //Verify property from node specific configuration input.put("nodeSpecific", true); - String nodeVal = conf.getConfigurationValue(input); - Assert.assertEquals("30", nodeVal); + final String nodeVal = conf.getConfigurationValue(input); + assertEquals("30", nodeVal); - if (f.exists()) { - assertTrue(f.delete()); + if (FILE.exists()) { + assertTrue(FILE.delete()); } } } -- cgit 1.2.3-korg