libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [07/21] libcloud git commit: added tests for fail create and fail failover with invalid status
Date Wed, 19 Dec 2018 05:34:09 GMT
added tests for fail create and fail failover with invalid status


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4cdc28d0
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4cdc28d0
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4cdc28d0

Branch: refs/heads/trunk
Commit: 4cdc28d0c55c64cde3c5e9acbb71781bc593b025
Parents: facbea2
Author: mitch <mitch.raful@itaas.dimensiondata.com>
Authored: Sun Dec 2 18:44:59 2018 -0500
Committer: mitch <mitch.raful@itaas.dimensiondata.com>
Committed: Sun Dec 2 18:44:59 2018 -0500

----------------------------------------------------------------------
 .../drs_fail_create_consistency_group.xml       |  6 ++++
 .../fixtures/nttcis/drs_initiate_failover.xml   |  6 ++++
 .../fixtures/nttcis/drs_invalid_status.xml      |  6 ++++
 libcloud/test/compute/test_nttcis.py            | 32 ++++++++++++++++++++
 4 files changed, 50 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/4cdc28d0/libcloud/test/compute/fixtures/nttcis/drs_fail_create_consistency_group.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/drs_fail_create_consistency_group.xml b/libcloud/test/compute/fixtures/nttcis/drs_fail_create_consistency_group.xml
new file mode 100644
index 0000000..6ab6fa6
--- /dev/null
+++ b/libcloud/test/compute/fixtures/nttcis/drs_fail_create_consistency_group.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181202T181715908-0500_f5fe1a96-ba61-449a-a33f-36b7d92375c1">
+    <operation>CREATE_CONSISTENCY_GROUP</operation>
+    <responseCode>NAME_NOT_UNIQUE</responseCode>
+    <message>Another Consistency Group named 'sdk_test2_cg' already exists.</message>
+</response>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4cdc28d0/libcloud/test/compute/fixtures/nttcis/drs_initiate_failover.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/drs_initiate_failover.xml b/libcloud/test/compute/fixtures/nttcis/drs_initiate_failover.xml
new file mode 100644
index 0000000..28f52e8
--- /dev/null
+++ b/libcloud/test/compute/fixtures/nttcis/drs_initiate_failover.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181202T123146961-0500_c16e0e02-1ba2-4baf-9adb-55e850cfa2d8">
+    <operation>INITIATE_FAILOVER</operation>
+    <responseCode>IN_PROGRESS</responseCode>
+    <message>Request to Initiate Failover has been accepted. Please use appropriate
Get or List API for status.</message>
+</response>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4cdc28d0/libcloud/test/compute/fixtures/nttcis/drs_invalid_status.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/drs_invalid_status.xml b/libcloud/test/compute/fixtures/nttcis/drs_invalid_status.xml
new file mode 100644
index 0000000..e707d85
--- /dev/null
+++ b/libcloud/test/compute/fixtures/nttcis/drs_invalid_status.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181202T120424113-0500_b4d3b67b-08f4-432b-8e88-48625180ff32">
+    <operation>INITIATE_FAILOVER</operation>
+    <responseCode>INVALID_STATUS</responseCode>
+    <message>You cannot Initiate Failover because Consistency Group with id 195a426b-4559-4c79-849e-f22cdf2bfb6e
is not in PREVIEWING_SNAPSHOT Operation Status.</message>
+</response>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4cdc28d0/libcloud/test/compute/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_nttcis.py b/libcloud/test/compute/test_nttcis.py
index cbc4fdb..2187b97 100644
--- a/libcloud/test/compute/test_nttcis.py
+++ b/libcloud/test/compute/test_nttcis.py
@@ -1920,6 +1920,20 @@ def test_stop_drs_snapshot_preivew(driver):
     assert result is True
 
 
+def test_start_drs_failover_invalid_status(driver):
+    NttCisMockHttp.type = "INVALID_STATUS"
+    cg_id = "195a426b-4559-4c79-849e-f22cdf2bfb6e"
+    with pytest.raises(NttCisAPIException) as excinfo:
+        result = driver.initiate_drs_failover(cg_id)
+    assert "INVALID_STATUS" in excinfo.value.code
+
+
+def test_initiate_drs_failover(driver):
+    cg_id = "195a426b-4559-4c79-849e-f22cdf2bfb6e"
+    result = driver.initiate_drs_failover(cg_id)
+    assert result is True
+
+
 class InvalidRequestError(Exception):
     def __init__(self, tag):
         super(InvalidRequestError, self).__init__("Invalid Request - %s" % tag)
@@ -1964,6 +1978,10 @@ class NttCisMockHttp(MockHttp):
         body = self.fixtures.load('oec_0_9_myaccount.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
+    def _oec_0_9_myaccount_INVALID_STATUS(self, method, url, body, headers):
+        body = self.fixtures.load('oec_0_9_myaccount.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
     def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkWithLocation(self, method,
url, body, headers):
         body = self.fixtures.load(
             'networkWithLocation.xml')
@@ -3270,3 +3288,17 @@ class NttCisMockHttp(MockHttp):
             "drs_stop_failover_preview.xml"
         )
         return httplib.OK, body, {}, httplib.responses[httplib.OK]
+
+    def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_initiateFailover_INVALID_STATUS(
+        self, method, url, body, headers):
+        body = self.fixtures.load(
+            "drs_invalid_status.xml"
+        )
+        return httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]
+
+    def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_initiateFailover(
+        self, method, url, body, headers):
+        body = self.fixtures.load(
+            "drs_initiate_failover.xml"
+        )
+        return httplib.OK, body, {}, httplib.responses[httplib.OK]


Mime
View raw message