diff options
| author | Ed Leafe <ed@leafe.com> | 2011-01-14 07:49:41 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-01-14 07:49:41 +0000 |
| commit | 9fb1e7b1f627b10fda1249754e4bc612d697110c (patch) | |
| tree | 0876e5de69ff6d0f0c40a93759f939081c65c451 /nova/tests | |
| parent | 8a4eb03ec32144381e8defa791e923675a1c2314 (diff) | |
| parent | 01a1ad3d2cdf61c73ca3ab7aa14e82f0e4450103 (diff) | |
| download | nova-9fb1e7b1f627b10fda1249754e4bc612d697110c.tar.gz nova-9fb1e7b1f627b10fda1249754e4bc612d697110c.tar.xz nova-9fb1e7b1f627b10fda1249754e4bc612d697110c.zip | |
Implements the blueprint for enabling the setting of the root/admin password on an instance.
It uses a new xenapi plugin 'agent' that handles communication to/from the agent running on the guest.
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/test_compute.py | 7 | ||||
| -rw-r--r-- | nova/tests/test_xenapi.py | 27 |
2 files changed, 34 insertions, 0 deletions
diff --git a/nova/tests/test_compute.py b/nova/tests/test_compute.py index 52660ee74..a7d47961c 100644 --- a/nova/tests/test_compute.py +++ b/nova/tests/test_compute.py @@ -151,6 +151,13 @@ class ComputeTestCase(test.TestCase): self.compute.reboot_instance(self.context, instance_id) self.compute.terminate_instance(self.context, instance_id) + def test_set_admin_password(self): + """Ensure instance can have its admin password set""" + instance_id = self._create_instance() + self.compute.run_instance(self.context, instance_id) + self.compute.set_admin_password(self.context, instance_id) + self.compute.terminate_instance(self.context, instance_id) + def test_snapshot(self): """Ensure instance can be snapshotted""" instance_id = self._create_instance() diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index ec9462ada..261ee0fde 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -31,6 +31,7 @@ from nova.compute import power_state from nova.virt import xenapi_conn from nova.virt.xenapi import fake as xenapi_fake from nova.virt.xenapi import volume_utils +from nova.virt.xenapi.vmops import SimpleDH from nova.tests.db import fakes as db_fakes from nova.tests.xenapi import stubs @@ -262,3 +263,29 @@ class XenAPIVMTestCase(test.TestCase): instance = db.instance_create(values) self.conn.spawn(instance) return instance + + +class XenAPIDiffieHellmanTestCase(test.TestCase): + """ + Unit tests for Diffie-Hellman code + """ + def setUp(self): + super(XenAPIDiffieHellmanTestCase, self).setUp() + self.alice = SimpleDH() + self.bob = SimpleDH() + + def test_shared(self): + alice_pub = self.alice.get_public() + bob_pub = self.bob.get_public() + alice_shared = self.alice.compute_shared(bob_pub) + bob_shared = self.bob.compute_shared(alice_pub) + self.assertEquals(alice_shared, bob_shared) + + def test_encryption(self): + msg = "This is a top-secret message" + enc = self.alice.encrypt(msg) + dec = self.bob.decrypt(enc) + self.assertEquals(dec, msg) + + def tearDown(self): + super(XenAPIDiffieHellmanTestCase, self).tearDown() |
