ubuntu-server-iso-testing-dev team mailing list archive
-
ubuntu-server-iso-testing-dev team
-
Mailing list archive
-
Message #00147
[Merge] lp:~jibel/ubuntu-server-iso-testing/test-machineid into lp:ubuntu-server-iso-testing
Jean-Baptiste Lallement has proposed merging lp:~jibel/ubuntu-server-iso-testing/test-machineid into lp:ubuntu-server-iso-testing.
Requested reviews:
Ubuntu Server Iso Testing Developers (ubuntu-server-iso-testing-dev)
Related bugs:
Bug #322830 in ubuntu-server-iso-testing: "remove /var/lib/dbus/machine-id from installed image"
https://bugs.launchpad.net/ubuntu-server-iso-testing/+bug/322830
For more details, see:
https://code.launchpad.net/~jibel/ubuntu-server-iso-testing/test-machineid/+merge/79143
--
https://code.launchpad.net/~jibel/ubuntu-server-iso-testing/test-machineid/+merge/79143
Your team Ubuntu Server Iso Testing Developers is requested to review the proposed merge of lp:~jibel/ubuntu-server-iso-testing/test-machineid into lp:ubuntu-server-iso-testing.
=== modified file 'templates.desktop/test_cases/default/test'
--- templates.desktop/test_cases/default/test 2011-06-10 09:54:52 +0000
+++ templates.desktop/test_cases/default/test 2011-10-12 15:34:33 +0000
@@ -22,6 +22,7 @@
import logging
import os.path
import unittest
+import time, datetime
logging.basicConfig(level=logging.DEBUG)
@@ -33,5 +34,17 @@
self.assertEqual(t_fh.write('a'), None)
self.assertEqual(t_fh.close(), None)
+ def test_20DBusMachineId(self):
+ """Test that machine Id is there and freshly generated"""
+ machine_id = '/var/lib/dbus/machine-id'
+
+ self.assertTrue(os.path.exists(machine_id))
+
+ mid_mtime = os.path.getmtime(machine_id)
+ now = time.mktime(datetime.datetime.now().timetuple())
+
+ # Check that the machine-id is less than 120seconds old
+ self.assertTrue((now - mid_mtime ) < 120 )
+
if __name__ == '__main__':
unittest.main()
=== modified file 'templates.desktop/test_cases/livesession/test'
--- templates.desktop/test_cases/livesession/test 2011-08-19 10:49:45 +0000
+++ templates.desktop/test_cases/livesession/test 2011-10-12 15:34:33 +0000
@@ -22,10 +22,12 @@
import logging
import os.path
import unittest
+import time, datetime
logging.basicConfig(level=logging.DEBUG)
class DefaultTest(unittest.TestCase):
+ machine_id = '/var/lib/dbus/machine-id'
def test_10ReadWrite(self):
t_fh = open(os.path.join('/tmp', 'a'), 'w')
@@ -33,5 +35,21 @@
self.assertEqual(t_fh.write('a'), None)
self.assertEqual(t_fh.close(), None)
+ def test_20DBusMachineId(self):
+ """Test that machine Id is there and freshly generated"""
+
+ self.assertTrue(os.path.exists(self.machine_id))
+
+ mid_mtime = os.path.getmtime(self.machine_id)
+ now = time.mktime(datetime.datetime.now().timetuple())
+
+ # Check that the machine-id is less than 120seconds old
+ self.assertTrue((now - mid_mtime ) < 120 )
+
+ def test_30NoRofsMachineId(self):
+ """ machine-id must not exists on the rofs"""
+ rofs_machine_id = os.path.join('/rofs', self.machine_id)
+ self.assertFalse(os.path.exists(rofs_machine_id))
+
if __name__ == '__main__':
unittest.main()
Follow ups