diff options
author | vasraz <vasyl.razinkov@est.tech> | 2021-02-25 20:24:02 +0000 |
---|---|---|
committer | Vasyl Razinkov <vasyl.razinkov@est.tech> | 2021-03-02 09:29:36 +0000 |
commit | 85043189238dee61a9af65e22eabf5b362327082 (patch) | |
tree | 87b74772fc55097836d25c85fa729f4de989600b | |
parent | dfc9cdee69426b48d683e119dda9fae9154e6fde (diff) |
Disable unstable NodeSpecificCliTest
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-3490
Change-Id: I0f491942225860b08b767444e831ba10f0f923d4
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 @@ <dependencies> + <!-- https://mvnrepository.com/artifact/org.awaitility/awaitility --> + <dependency> + <groupId>org.awaitility</groupId> + <artifactId>awaitility</artifactId> + <version>4.0.3</version> + <scope>test</scope> + </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> 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<String, Object> input = new HashMap<>(); + final Map<String, Object> 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()); } } } |