summaryrefslogtreecommitdiff
path: root/tests/unittests/test_datasource/test_altcloud.py
diff options
context:
space:
mode:
authorJoe VLcek <JoeV@RedHat.com>2012-08-13 16:41:18 -0400
committerJoe VLcek <JoeV@RedHat.com>2012-08-13 16:41:18 -0400
commit213e18a5cd826445c36ac613e7e7459f24cffb4b (patch)
treee58f709da2aff0d956ff2419199a72c99369e7e1 /tests/unittests/test_datasource/test_altcloud.py
parent6205d39ad5fed1bba31e4a97656beb213db251bc (diff)
downloadvyos-cloud-init-213e18a5cd826445c36ac613e7e7459f24cffb4b.tar.gz
vyos-cloud-init-213e18a5cd826445c36ac613e7e7459f24cffb4b.zip
add test to excercise udevadm usage.
Diffstat (limited to 'tests/unittests/test_datasource/test_altcloud.py')
-rw-r--r--tests/unittests/test_datasource/test_altcloud.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/unittests/test_datasource/test_altcloud.py b/tests/unittests/test_datasource/test_altcloud.py
index b828711c..54e152e9 100644
--- a/tests/unittests/test_datasource/test_altcloud.py
+++ b/tests/unittests/test_datasource/test_altcloud.py
@@ -291,6 +291,8 @@ class TestUserDataRhevm(TestCase):
'/etc/sysconfig/cloud-info'
cloudinit.sources.DataSourceAltCloud.CMD_PROBE_FLOPPY = \
['/sbin/modprobe', 'floppy']
+ cloudinit.sources.DataSourceAltCloud.CMD_UDEVADM_SETTLE = \
+ ['/sbin/udevadm', 'settle', '--quiet', '--timeout=5']
def test_mount_cb_fails(self):
'''Test user_data_rhevm() where mount_cb fails'''
@@ -322,6 +324,26 @@ class TestUserDataRhevm(TestCase):
self.assertEquals(False, dsrc.user_data_rhevm())
+ def test_udevadm_fails(self):
+ '''Test user_data_rhevm() where udevadm fails. '''
+
+ cloudinit.sources.DataSourceAltCloud.CMD_UDEVADM_SETTLE = \
+ ['ls', 'udevadm floppy']
+
+ dsrc = DataSourceAltCloud({}, None, self.paths)
+
+ self.assertEquals(False, dsrc.user_data_rhevm())
+
+ def test_no_udevadm_cmd(self):
+ '''Test user_data_rhevm() with no udevadm command. '''
+
+ cloudinit.sources.DataSourceAltCloud.CMD_UDEVADM_SETTLE = \
+ ['bad command', 'udevadm floppy']
+
+ dsrc = DataSourceAltCloud({}, None, self.paths)
+
+ self.assertEquals(False, dsrc.user_data_rhevm())
+
class TestUserDataVsphere(TestCase):
'''
Test to exercise method: DataSourceAltCloud.user_data_vsphere()