summaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src/test/java
diff options
context:
space:
mode:
authorMnushkin, Dmitry <dmitry.mnushkin@att.com>2020-09-23 16:26:31 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-10-01 11:56:16 -0400
commit7c996cbd1735e4c570bef411c8fbbec0db44faea (patch)
treecafdde68d7f16eab23ce04626dfdf5b4e764ce4f /adapters/mso-adapter-utils/src/test/java
parentabe12dca0faad2a6d79750d559d2a80fe8532996 (diff)
use timeout interval in minutes for poll duration
use timeout interval in minutes for poll duration do not ignore retry test with 1 min delay rename variable and debug info for clarity Issue-ID: SO-3264 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: Ia3c6d789b0e93df909476e92764ccbb32d7472e7
Diffstat (limited to 'adapters/mso-adapter-utils/src/test/java')
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java25
1 files changed, 19 insertions, 6 deletions
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
index 4938bff748..4f7fed7df4 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
@@ -36,6 +36,7 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -106,7 +107,6 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
@Before
public void setup() {
doReturn("15").when(env).getProperty("org.onap.so.adapters.po.pollInterval", "15");
- doReturn("1").when(env).getProperty("org.onap.so.adapters.po.pollMultiplier", "60");
}
@Test
@@ -130,9 +130,8 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
assertEquals(true, actual != null);
}
-
@Test
- public final void pollStackForStatus_Polling_Exhausted_Test() throws MsoException, IOException {
+ public final void pollStackForStatus_No_Polling_Test() throws MsoException, IOException {
Stack stack = new Stack();
stack.setId("id");
stack.setStackName("stackName");
@@ -141,6 +140,7 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
doNothing().when(stackStatusHandler).updateStackStatus(stack);
doReturn(stack).when(heatUtils).queryHeatStack(isA(Heat.class), eq("stackName/id"));
doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
+ doReturn("61").when(env).getProperty("org.onap.so.adapters.po.pollInterval", "15");
Stack actual = heatUtils.pollStackForStatus(1, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId, false);
Mockito.verify(stackStatusHandler, times(1)).updateStackStatus(stack);
Mockito.verify(heatUtils, times(1)).queryHeatStack(isA(Heat.class), eq("stackName/id"));
@@ -148,6 +148,22 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
}
@Test
+ public final void pollStackForStatus_Polling_Exhausted_Test() throws MsoException, IOException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_IN_PROGRESS");
+ stack.setStackStatusReason("Stack Finished");
+ doNothing().when(stackStatusHandler).updateStackStatus(stack);
+ doReturn(stack).when(heatUtils).queryHeatStack(isA(Heat.class), eq("stackName/id"));
+ doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
+ Stack actual = heatUtils.pollStackForStatus(1, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId, false);
+ Mockito.verify(stackStatusHandler, times(5)).updateStackStatus(stack);
+ Mockito.verify(heatUtils, times(5)).queryHeatStack(isA(Heat.class), eq("stackName/id"));
+ assertEquals(true, actual != null);
+ }
+
+ @Test
public final void postProcessStackCreate_CREATE_IN_PROGRESS_Test() throws MsoException, IOException {
Stack stack = new Stack();
stack.setId("id");
@@ -255,12 +271,9 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
CreateStackParam createStackParam = new CreateStackParam();
createStackParam.setStackName("stackName");
doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
- doNothing().when(heatUtils).postProcessStackDelete(deletedStack);
doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(mockDeleteStack);
doReturn(stackResource).when(heatClient).getStacks();
doReturn(mockDeleteStack).when(stackResource).deleteByName("stackName/id");
- doReturn(deletedStack).when(heatUtils).pollStackForStatus(120, stack, "DELETE_IN_PROGRESS", cloudSiteId,
- tenantId, true);
heatUtils.handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
Mockito.verify(heatUtils, times(1)).executeAndRecordOpenstackRequest(mockDeleteStack);