libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [08/21] libcloud git commit: completed tests for drs without a drs driver
Date Wed, 19 Dec 2018 05:34:10 GMT
completed tests for drs without a drs driver


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

Branch: refs/heads/trunk
Commit: af20d3901cac5b57e9c9e004430d755efd35517f
Parents: 4cdc28d
Author: mitch <mitch.raful@itaas.dimensiondata.com>
Authored: Tue Dec 4 17:33:49 2018 -0500
Committer: mitch <mitch.raful@itaas.dimensiondata.com>
Committed: Tue Dec 4 17:33:49 2018 -0500

----------------------------------------------------------------------
 libcloud/compute/drivers/nttcis.py              |  1 -
 .../compute/fixtures/nttcis/drs_create_cg.xml   |  7 ++
 .../nttcis/drs_delete_consistency_group.xml     |  6 ++
 .../nttcis/drs_fail_create_cg_ineligible.xml    |  6 ++
 .../nttcis/drs_fail_create_cg_not_supported.xml |  6 ++
 libcloud/test/compute/test_nttcis.py            | 73 ++++++++++++++++++++
 6 files changed, 98 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/af20d390/libcloud/compute/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/nttcis.py b/libcloud/compute/drivers/nttcis.py
index 5dca8cd..9ac0f36 100644
--- a/libcloud/compute/drivers/nttcis.py
+++ b/libcloud/compute/drivers/nttcis.py
@@ -1017,7 +1017,6 @@ class NttCisNodeDriver(NodeDriver):
                         'urn:tag')
                     ET.SubElement(tag_elem,
                                   'urn:tagKeyName').text = k
-
                     if v is not None:
                         ET.SubElement(tag_elem,
                                       'urn:value').text = v

http://git-wip-us.apache.org/repos/asf/libcloud/blob/af20d390/libcloud/test/compute/fixtures/nttcis/drs_create_cg.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/drs_create_cg.xml b/libcloud/test/compute/fixtures/nttcis/drs_create_cg.xml
new file mode 100644
index 0000000..425fba0
--- /dev/null
+++ b/libcloud/test/compute/fixtures/nttcis/drs_create_cg.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181204T165435521-0500_b730567e-d306-40c5-a9a3-27b018f60fc7">
+    <operation>CREATE_CONSISTENCY_GROUP</operation>
+    <responseCode>IN_PROGRESS</responseCode>
+    <message>Request to Create Consistency Group has been accepted. Please use appropriate
Get or List API for status.</message>
+    <info name="consistencyGroupId" value="fad067be-6ca7-495d-99dc-7921c5f2ca5d"/>
+</response>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/af20d390/libcloud/test/compute/fixtures/nttcis/drs_delete_consistency_group.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/drs_delete_consistency_group.xml b/libcloud/test/compute/fixtures/nttcis/drs_delete_consistency_group.xml
new file mode 100644
index 0000000..c5fcffa
--- /dev/null
+++ b/libcloud/test/compute/fixtures/nttcis/drs_delete_consistency_group.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181204T172637824-0500_811c25d4-69f6-4a33-a0fc-1594eb014d9f">
+    <operation>DELETE_CONSISTENCY_GROUP</operation>
+    <responseCode>IN_PROGRESS</responseCode>
+    <message>Request to Delete Consistency Group 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/af20d390/libcloud/test/compute/fixtures/nttcis/drs_fail_create_cg_ineligible.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/drs_fail_create_cg_ineligible.xml b/libcloud/test/compute/fixtures/nttcis/drs_fail_create_cg_ineligible.xml
new file mode 100644
index 0000000..75f51ac
--- /dev/null
+++ b/libcloud/test/compute/fixtures/nttcis/drs_fail_create_cg_ineligible.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181204T161623175-0500_9fd3e8ab-a3b2-4c7d-a00b-bba07141d22f">
+    <operation>CREATE_CONSISTENCY_GROUP</operation>
+    <responseCode>INCOMPATIBLE_OPERATION</responseCode>
+    <message>The drsEligible flag for target Server aee58575-38e2-495f-89d3-854e6a886411
must be set.</message>
+</response>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/af20d390/libcloud/test/compute/fixtures/nttcis/drs_fail_create_cg_not_supported.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/drs_fail_create_cg_not_supported.xml b/libcloud/test/compute/fixtures/nttcis/drs_fail_create_cg_not_supported.xml
new file mode 100644
index 0000000..b78b5c8
--- /dev/null
+++ b/libcloud/test/compute/fixtures/nttcis/drs_fail_create_cg_not_supported.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181204T160840695-0500_fef252f1-a72b-4674-85a6-076057f93e16">
+    <operation>CREATE_CONSISTENCY_GROUP</operation>
+    <responseCode>OPERATION_NOT_SUPPORTED</responseCode>
+    <message>DRS is not supported between source Data Center NA9 and target Data Center
NA12.</message>
+</response>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/af20d390/libcloud/test/compute/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_nttcis.py b/libcloud/test/compute/test_nttcis.py
index 2187b97..b88b4e1 100644
--- a/libcloud/test/compute/test_nttcis.py
+++ b/libcloud/test/compute/test_nttcis.py
@@ -1934,6 +1934,42 @@ def test_initiate_drs_failover(driver):
     assert result is True
 
 
+def test_create_drs_fail_not_supported(driver):
+    NttCisMockHttp.type = "FAIL_NOT_SUPPORTED"
+    src_id = "032f3967-00e4-4780-b4ef-8587460f9dd4"
+    target_id = "aee58575-38e2-495f-89d3-854e6a886411"
+    with pytest.raises(NttCisAPIException) as excinfo:
+        result = driver.create_consistency_group(
+            "sdk_cg", "100", src_id, target_id, description="A test consistency group")
+    exception_msg = excinfo.value.msg
+    assert exception_msg == 'DRS is not supported between source Data Center NA9 and target
Data Center NA12.'
+
+
+def test_create_drs_cg_fail_ineligble(driver):
+    NttCisMockHttp.type = "FAIL_INELIGIBLE"
+    src_id = "032f3967-00e4-4780-b4ef-8587460f9dd4"
+    target_id = "aee58575-38e2-495f-89d3-854e6a886411"
+    with pytest.raises(NttCisAPIException) as excinfo:
+        driver.create_consistency_group(
+            "sdk_test2_cg", "100", src_id, target_id, description="A test consistency group")
+    exception_msg = excinfo.value.msg
+    assert exception_msg == 'The drsEligible flag for target Server aee58575-38e2-495f-89d3-854e6a886411
must be set.'
+
+
+def test_create_drs_cg(driver):
+    src_id = "032f3967-00e4-4780-b4ef-8587460f9dd4"
+    target_id = "aee58575-38e2-495f-89d3-854e6a886411"
+    result = driver.create_consistency_group(
+        "sdk_test2_cg2", "100", src_id, target_id, description="A test consistency group")
+    assert result is True
+
+
+def test_delete_consistency_group(driver):
+    cg_id = "fad067be-6ca7-495d-99dc-7921c5f2ca5"
+    result = driver.delete_consistency_group(cg_id)
+    assert result is True
+
+
 class InvalidRequestError(Exception):
     def __init__(self, tag):
         super(InvalidRequestError, self).__init__("Invalid Request - %s" % tag)
@@ -1982,6 +2018,14 @@ 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_FAIL_INELIGIBLE(self, method, url, body, headers):
+        body = self.fixtures.load('oec_0_9_myaccount.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+    def _oec_0_9_myaccount_FAIL_NOT_SUPPORTED(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')
@@ -3302,3 +3346,32 @@ class NttCisMockHttp(MockHttp):
             "drs_initiate_failover.xml"
         )
         return httplib.OK, body, {}, httplib.responses[httplib.OK]
+
+    def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_createConsistencyGroup_FAIL_INELIGIBLE(
+        self, method, url, body, headers):
+        body = self.fixtures.load(
+            "drs_fail_create_cg_ineligible.xml"
+        )
+        return httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]
+
+    def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_createConsistencyGroup_FAIL_NOT_SUPPORTED(
+        self, method, url, body, headers):
+        body = self.fixtures.load(
+            "drs_fail_create_cg_not_supported.xml"
+        )
+        return httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]
+
+    def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_createConsistencyGroup(
+        self, method, url, body, headers):
+        body = self.fixtures.load(
+            "drs_create_cg.xml"
+        )
+        return httplib.OK, body, {}, httplib.responses[httplib.OK]
+
+    def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_deleteConsistencyGroup(
+        self, method, url, body, headers):
+        body = self.fixtures.load(
+            "drs_delete_consistency_group.xml"
+        )
+        return httplib.OK, body, {}, httplib.responses[httplib.OK]
+


Mime
View raw message