libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [13/45] libcloud git commit: added directories and started files for drs/test suite
Date Thu, 13 Dec 2018 11:26:22 GMT
added directories and started files for drs/test suite


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

Branch: refs/heads/trunk
Commit: c32aa10447c375a287f79aab2ba922cacf23bd25
Parents: f8c0da6
Author: mitch <mitch.raful@itaas.dimensiondata.com>
Authored: Wed Oct 31 17:14:03 2018 -0400
Committer: mitch <mitch.raful@itaas.dimensiondata.com>
Committed: Wed Oct 31 17:14:03 2018 -0400

----------------------------------------------------------------------
 libcloud/test/drs/__init__.py                   |  0
 .../test/drs/fixtures/nttcis/drs_ineligible.xml |  6 +++
 .../drs/fixtures/nttcis/oec_0_9_myaccount.xml   | 26 ++++++++++
 libcloud/test/drs/test_nttcis.py                | 51 ++++++++++++++++++++
 libcloud/test/drs_ineligible.xml                |  6 ---
 libcloud/test/file_fixtures.py                  |  7 +++
 tests/lib_create_test.py                        |  2 +-
 tests/lib_list_test.py                          |  4 +-
 8 files changed, 92 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/c32aa104/libcloud/test/drs/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/__init__.py b/libcloud/test/drs/__init__.py
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/libcloud/blob/c32aa104/libcloud/test/drs/fixtures/nttcis/drs_ineligible.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/drs_ineligible.xml b/libcloud/test/drs/fixtures/nttcis/drs_ineligible.xml
new file mode 100644
index 0000000..a0ff44c
--- /dev/null
+++ b/libcloud/test/drs/fixtures/nttcis/drs_ineligible.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181031T115504819-0400_9c995adf-a3e8-4b1e-9d1f-a34bf52b693d">
+    <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/c32aa104/libcloud/test/drs/fixtures/nttcis/oec_0_9_myaccount.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/fixtures/nttcis/oec_0_9_myaccount.xml b/libcloud/test/drs/fixtures/nttcis/oec_0_9_myaccount.xml
new file mode 100644
index 0000000..4f3b132
--- /dev/null
+++ b/libcloud/test/drs/fixtures/nttcis/oec_0_9_myaccount.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<ns3:Account xmlns="http://oec.api.opsource.net/schemas/server" xmlns:ns9="http://oec.api.opsource.net/schemas/reset"
xmlns:ns5="http://oec.api.opsource.net/schemas/vip" xmlns:ns12="http://oec.api.opsource.net/schemas/general"
xmlns:ns6="http://oec.api.opsource.net/schemas/imageimportexport" xmlns:ns13="http://oec.api.opsource.net/schemas/support"
xmlns:ns7="http://oec.api.opsource.net/schemas/whitelabel" xmlns:ns10="http://oec.api.opsource.net/schemas/ipplan"
xmlns:ns8="http://oec.api.opsource.net/schemas/datacenter" xmlns:ns11="http://oec.api.opsource.net/schemas/storage"
xmlns:ns2="http://oec.api.opsource.net/schemas/organization" xmlns:ns4="http://oec.api.opsource.net/schemas/network"
xmlns:ns3="http://oec.api.opsource.net/schemas/directory">
+    <ns3:userName>testuser</ns3:userName>
+    <ns3:fullName>Test User</ns3:fullName>
+    <ns3:firstName>Test</ns3:firstName>
+    <ns3:lastName>User</ns3:lastName>
+    <ns3:emailAddress>test@example.com</ns3:emailAddress>
+    <ns3:orgId>8a8f6abc-2745-4d8a-9cbc-8dabe5a7d0e4</ns3:orgId>
+    <ns3:roles>
+        <ns3:role>
+            <ns3:name>create image</ns3:name>
+        </ns3:role>
+        <ns3:role>
+            <ns3:name>reports</ns3:name>
+        </ns3:role>
+        <ns3:role>
+            <ns3:name>server</ns3:name>
+        </ns3:role>
+        <ns3:role>
+            <ns3:name>primary administrator</ns3:name>
+        </ns3:role>
+        <ns3:role>
+            <ns3:name>network</ns3:name>
+        </ns3:role>
+    </ns3:roles>
+</ns3:Account>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/c32aa104/libcloud/test/drs/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/drs/test_nttcis.py b/libcloud/test/drs/test_nttcis.py
new file mode 100644
index 0000000..a90f9e2
--- /dev/null
+++ b/libcloud/test/drs/test_nttcis.py
@@ -0,0 +1,51 @@
+import pytest
+
+
+import sys
+from types import GeneratorType
+from libcloud.utils.py3 import httplib
+from libcloud.utils.py3 import ET
+from libcloud.common.types import InvalidCredsError
+from libcloud.common.nttcis import NttCisAPIException, NetworkDomainServicePlan
+from libcloud.common.nttcis import TYPES_URN
+from libcloud.drs.drivers.nttcis import NttCisDRSDriver as NttCis
+from libcloud.compute.drivers.nttcis import NttCisNic
+from libcloud.compute.base import Node, NodeAuthPassword, NodeLocation
+from libcloud.test import MockHttp, unittest
+from libcloud.test.file_fixtures import DRSFileFixtures
+from libcloud.test.secrets import NTTCIS_PARAMS
+from libcloud.utils.xml import fixxpath, findtext, findall
+
+
+@pytest.fixture()
+def driver():
+    NttCis.connectionCls.active_api_version = "2.7"
+    NttCis.connectionCls.conn_class = NttCisMockHttp
+    NttCisMockHttp.type = None
+    driver = NttCis(*NTTCIS_PARAMS)
+    return driver
+
+
+def test_ineligible_server(driver):
+    exception_msg = driver.create_consistency_group(
+        "sdk_test2_cg", "100", "032f3967-00e4-4780-b4ef-8587460f9dd4",
+        "aee58575-38e2-495f-89d3-854e6a886411",
+        description="A test consistency group")
+
+
+    assert exception_msg == 'The drsEligible flag for target Server aee58575-38e2-495f-89d3-854e6a886411
must be set.'
+
+
+class NttCisMockHttp(MockHttp):
+
+    fixtures = DRSFileFixtures('nttcis')
+
+    def _oec_0_9_myaccount(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_consistencyGroup_createConsistencyGroup(self,
method, url, body, headers):
+        body = self.fixtures.load(
+            'drs_ineligible.xml'
+        )
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/c32aa104/libcloud/test/drs_ineligible.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/drs_ineligible.xml b/libcloud/test/drs_ineligible.xml
deleted file mode 100644
index a0ff44c..0000000
--- a/libcloud/test/drs_ineligible.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181031T115504819-0400_9c995adf-a3e8-4b1e-9d1f-a34bf52b693d">
-    <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/c32aa104/libcloud/test/file_fixtures.py
----------------------------------------------------------------------
diff --git a/libcloud/test/file_fixtures.py b/libcloud/test/file_fixtures.py
index 3d9bd32..185b3de 100644
--- a/libcloud/test/file_fixtures.py
+++ b/libcloud/test/file_fixtures.py
@@ -28,6 +28,7 @@ FIXTURES_ROOT = {
     'storage': 'storage/fixtures',
     'loadbalancer': 'loadbalancer/fixtures',
     'dns': 'dns/fixtures',
+    'drs': 'drs/fixtures',
     'backup': 'backup/fixtures',
     'openstack': 'compute/fixtures/openstack',
     'container': 'container/fixtures'
@@ -80,6 +81,12 @@ class DNSFileFixtures(FileFixtures):
                                               sub_dir=sub_dir)
 
 
+class DRSFileFixtures(FileFixtures):
+    def __init__(self, sub_dir=''):
+        super(DRSFileFixtures, self).__init__(fixtures_type='drs',
+                                              sub_dir=sub_dir)
+
+
 class OpenStackFixtures(FileFixtures):
     def __init__(self, sub_dir=''):
         super(OpenStackFixtures, self).__init__(fixtures_type='openstack',

http://git-wip-us.apache.org/repos/asf/libcloud/blob/c32aa104/tests/lib_create_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_create_test.py b/tests/lib_create_test.py
index aa0c7d0..9dc28ff 100644
--- a/tests/lib_create_test.py
+++ b/tests/lib_create_test.py
@@ -252,7 +252,7 @@ def test_fail_create_drs(na_compute_driver, drsdriver):
     assert exception_msg == 'DRS is not supported between source Data Center NA9 and target
Data Center NA12.'
 
 
-def test_inelligble_drs(na_compute_driver, drsdriver):
+def test_ineligble_drs(na_compute_driver, drsdriver):
     nodes = na_compute_driver.list_nodes(ex_name='src-sdk-test')
     src_id = nodes[0].id
     nodes = na_compute_driver.list_nodes(ex_name="tgt-sdk-test")

http://git-wip-us.apache.org/repos/asf/libcloud/blob/c32aa104/tests/lib_list_test.py
----------------------------------------------------------------------
diff --git a/tests/lib_list_test.py b/tests/lib_list_test.py
index ac26e44..5b519d7 100644
--- a/tests/lib_list_test.py
+++ b/tests/lib_list_test.py
@@ -394,6 +394,4 @@ def test_list_health_monitors(compute_driver, lbdriver):
 
 def test_list_consistency_groups(drsdriver):
     cgs = drsdriver.list_consistency_groups()
-    for cg in cgs:
-        print(vars(cg))
-        print()
\ No newline at end of file
+    return cgs
\ No newline at end of file


Mime
View raw message