summaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src/test/java
diff options
context:
space:
mode:
authorSmokowski, Steven <steve.smokowski@att.com>2019-06-14 09:12:10 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-06-14 10:22:29 -0400
commite29b04bca6367c14fdbd403bbd275e6c8c10fa60 (patch)
tree737376817c0c143992691f1ff74dbcb583f09c6e /adapters/mso-adapter-utils/src/test/java
parent1f8aa8ef6deade96a53fa57c28d1aacab6cf7e5e (diff)
fix delete stack error not propogating
Update logic to properly format rollback error messages Change-Id: I66ad4fd78758661be297810f393e6da759daa17b Issue-ID: SO-2014 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
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.java29
1 files changed, 27 insertions, 2 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 6673e69a09..de55e85ad6 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
@@ -188,6 +188,31 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
}
@Test
+ public final void postProcessStackCreate_Backout_True_Delete_Fail_Test() throws MsoException, IOException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_IN_PROGRESS");
+ stack.setStackStatusReason("Stack Finished");
+
+ Stack deletedStack = new Stack();
+ deletedStack.setId("id");
+ deletedStack.setStackName("stackName");
+ deletedStack.setStackStatus("DELETE_COMPLETE");
+ deletedStack.setStackStatusReason("Stack Deleted");
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+ doThrow(new MsoOpenstackException(500, "Error In Delete", "Error In Delete")).when(heatUtils)
+ .handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ exceptionRule.expect(MsoException.class);
+ exceptionRule.expectMessage(
+ "Stack Creation Failed Openstack Status: CREATE_IN_PROGRESS Status Reason: Stack Finished , Rollback of Stack Creation failed with sync error: Error In Delete");
+ heatUtils.postProcessStackCreate(stack, true, 120, false, cloudSiteId, tenantId, createStackParam);
+ Mockito.verify(heatUtils, times(1)).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ }
+
+ @Test
public final void postProcessStackCreate_Keypair_True_Test() throws MsoException, IOException {
Stack stack = new Stack();
stack.setId("id");
@@ -375,12 +400,12 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
doThrow(new StackCreationException("Error")).when(heatUtils).pollStackForStatus(120, stack,
"CREATE_IN_PROGRESS", cloudSiteId, tenantId);
- doReturn(deletedStack).when(heatUtils).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
exceptionRule.expect(MsoException.class);
exceptionRule.expectMessage("Error");
heatUtils.processCreateStack(cloudSiteId, tenantId, 120, true, stack, createStackParam, true);
Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
- Mockito.verify(heatUtils, times(1)).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(1)).postProcessStackCreate(stack, true, 120, true, cloudSiteId, tenantId,
+ createStackParam);
}