libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbe...@apache.org
Subject svn commit: r1240458 - in /libcloud/trunk/test/compute: fixtures/opennebula_1_4/compute_25.xml fixtures/opennebula_1_4/computes.xml fixtures/opennebula_2_0/compute_25.xml test_opennebula.py
Date Sat, 04 Feb 2012 06:31:49 GMT
Author: hbetts
Date: Sat Feb  4 06:31:49 2012
New Revision: 1240458

URL: http://svn.apache.org/viewvc?rev=1240458&view=rev
Log:
Modifed OpenNebula compute fixtures for additional test coverage.

Added:
    libcloud/trunk/test/compute/fixtures/opennebula_1_4/compute_25.xml
Modified:
    libcloud/trunk/test/compute/fixtures/opennebula_1_4/computes.xml
    libcloud/trunk/test/compute/fixtures/opennebula_2_0/compute_25.xml
    libcloud/trunk/test/compute/test_opennebula.py

Added: libcloud/trunk/test/compute/fixtures/opennebula_1_4/compute_25.xml
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/fixtures/opennebula_1_4/compute_25.xml?rev=1240458&view=auto
==============================================================================
--- libcloud/trunk/test/compute/fixtures/opennebula_1_4/compute_25.xml (added)
+++ libcloud/trunk/test/compute/fixtures/opennebula_1_4/compute_25.xml Sat Feb  4 06:31:49
2012
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<COMPUTE>
+    <ID>25</ID>
+    <NAME>Compute 25</NAME>
+    <STATE>none</STATE>
+    <NETWORK>
+        <NIC network="5" ip="192.168.0.3"/>
+        <NIC network="15" ip="192.168.1.3"/>
+    </NETWORK>
+</COMPUTE>

Modified: libcloud/trunk/test/compute/fixtures/opennebula_1_4/computes.xml
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/fixtures/opennebula_1_4/computes.xml?rev=1240458&r1=1240457&r2=1240458&view=diff
==============================================================================
--- libcloud/trunk/test/compute/fixtures/opennebula_1_4/computes.xml (original)
+++ libcloud/trunk/test/compute/fixtures/opennebula_1_4/computes.xml Sat Feb  4 06:31:49 2012
@@ -2,4 +2,5 @@
 <COMPUTES>  
     <COMPUTE href="http://www.opennebula.org/compute/5"/>  
     <COMPUTE href="http://www.opennebula.org/compute/15"/>
+    <COMPUTE href="http://www.opennebula.org/compute/25"/>
 </COMPUTES>

Modified: libcloud/trunk/test/compute/fixtures/opennebula_2_0/compute_25.xml
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/fixtures/opennebula_2_0/compute_25.xml?rev=1240458&r1=1240457&r2=1240458&view=diff
==============================================================================
--- libcloud/trunk/test/compute/fixtures/opennebula_2_0/compute_25.xml (original)
+++ libcloud/trunk/test/compute/fixtures/opennebula_2_0/compute_25.xml Sat Feb  4 06:31:49
2012
@@ -14,7 +14,4 @@
         <IP>192.168.1.3</IP>
         <MAC>02:00:c0:a8:01:03</MAC>
     </NIC>
-    <CONTEXT>
-        <HOSTNAME>compute-25</HOSTNAME>
-    </CONTEXT>
 </COMPUTE>

Modified: libcloud/trunk/test/compute/test_opennebula.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_opennebula.py?rev=1240458&r1=1240457&r2=1240458&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_opennebula.py (original)
+++ libcloud/trunk/test/compute/test_opennebula.py Sat Feb  4 06:31:49 2012
@@ -117,7 +117,7 @@ class OpenNebula_1_4_Tests(unittest.Test
         """
         nodes = self.driver.list_nodes()
 
-        self.assertEqual(len(nodes), 2)
+        self.assertEqual(len(nodes), 3)
         node = nodes[0]
         self.assertEqual(node.id, '5')
         self.assertEqual(node.name, 'Compute 5')
@@ -150,6 +150,21 @@ class OpenNebula_1_4_Tests(unittest.Test
         self.assertEqual(node.private_ips, [])
         self.assertEqual(node.image.id, '15')
         self.assertEqual(node.image.extra['dev'], 'sda1')
+        node = nodes[2]
+        self.assertEqual(node.id, '25')
+        self.assertEqual(node.name, 'Compute 25')
+        self.assertEqual(node.state,
+                         NodeState.UNKNOWN)
+        self.assertEqual(node.public_ips[0].id, '5')
+        self.assertEqual(node.public_ips[0].name, None)
+        self.assertEqual(node.public_ips[0].address, '192.168.0.3')
+        self.assertEqual(node.public_ips[0].size, 1)
+        self.assertEqual(node.public_ips[1].id, '15')
+        self.assertEqual(node.public_ips[1].name, None)
+        self.assertEqual(node.public_ips[1].address, '192.168.1.3')
+        self.assertEqual(node.public_ips[1].size, 1)
+        self.assertEqual(node.private_ips, [])
+        self.assertEqual(node.image, None)
 
     def test_list_images(self):
         """
@@ -405,7 +420,7 @@ class OpenNebula_2_0_Tests(unittest.Test
         self.assertEqual(node.size, None)
         self.assertEqual(node.image, None)
         context = node.extra['context']
-        self.assertEqual(context['hostname'], 'compute-25')
+        self.assertEqual(context, {})
 
     def test_list_images(self):
         """
@@ -699,6 +714,24 @@ class OpenNebula_1_4_MockHttp(MockHttp):
             return (httplib.OK, body, {},
                     httplib.responses[httplib.OK])
 
+    def _compute_25(self, method, url, body, headers):
+        """
+        Compute entry resource.
+        """
+        if method == 'GET':
+            body = self.fixtures.load('compute_25.xml')
+            return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+        if method == 'PUT':
+            body = ""
+            return (httplib.ACCEPTED, body, {},
+                    httplib.responses[httplib.ACCEPTED])
+
+        if method == 'DELETE':
+            body = ""
+            return (httplib.OK, body, {},
+                    httplib.responses[httplib.OK])
+
     def _storage_5(self, method, url, body, headers):
         """
         Storage entry resource.



Mime
View raw message