Merge lp:~jibel/ubuntu-server-iso-testing/test-machineid into lp:ubuntu-server-iso-testing

Proposed by Jean-Baptiste Lallement
Status: Merged
Merged at revision: 249
Proposed branch: lp:~jibel/ubuntu-server-iso-testing/test-machineid
Merge into: lp:ubuntu-server-iso-testing
Diff against target: 68 lines (+31/-0)
2 files modified
templates.desktop/test_cases/default/test (+13/-0)
templates.desktop/test_cases/livesession/test (+18/-0)
To merge this branch: bzr merge lp:~jibel/ubuntu-server-iso-testing/test-machineid
Reviewer Review Type Date Requested Status
C de-Avillez (community) Approve
Review via email: mp+79143@code.launchpad.net
To post a comment you must log in.
Revision history for this message
C de-Avillez (hggdh2) wrote :

Go for it. Does it affect servers?

review: Approve
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

On 10/12/2011 08:34 PM, C de-Avillez wrote:
> Review: Approve
>
> Go for it. Does it affect servers?
No only desktop images installed from a live cd.

--
Jean-Baptiste
irc: jibel

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'templates.desktop/test_cases/default/test'
2--- templates.desktop/test_cases/default/test 2011-06-10 09:54:52 +0000
3+++ templates.desktop/test_cases/default/test 2011-10-12 15:34:33 +0000
4@@ -22,6 +22,7 @@
5 import logging
6 import os.path
7 import unittest
8+import time, datetime
9
10 logging.basicConfig(level=logging.DEBUG)
11
12@@ -33,5 +34,17 @@
13 self.assertEqual(t_fh.write('a'), None)
14 self.assertEqual(t_fh.close(), None)
15
16+ def test_20DBusMachineId(self):
17+ """Test that machine Id is there and freshly generated"""
18+ machine_id = '/var/lib/dbus/machine-id'
19+
20+ self.assertTrue(os.path.exists(machine_id))
21+
22+ mid_mtime = os.path.getmtime(machine_id)
23+ now = time.mktime(datetime.datetime.now().timetuple())
24+
25+ # Check that the machine-id is less than 120seconds old
26+ self.assertTrue((now - mid_mtime ) < 120 )
27+
28 if __name__ == '__main__':
29 unittest.main()
30
31=== modified file 'templates.desktop/test_cases/livesession/test'
32--- templates.desktop/test_cases/livesession/test 2011-08-19 10:49:45 +0000
33+++ templates.desktop/test_cases/livesession/test 2011-10-12 15:34:33 +0000
34@@ -22,10 +22,12 @@
35 import logging
36 import os.path
37 import unittest
38+import time, datetime
39
40 logging.basicConfig(level=logging.DEBUG)
41
42 class DefaultTest(unittest.TestCase):
43+ machine_id = '/var/lib/dbus/machine-id'
44
45 def test_10ReadWrite(self):
46 t_fh = open(os.path.join('/tmp', 'a'), 'w')
47@@ -33,5 +35,21 @@
48 self.assertEqual(t_fh.write('a'), None)
49 self.assertEqual(t_fh.close(), None)
50
51+ def test_20DBusMachineId(self):
52+ """Test that machine Id is there and freshly generated"""
53+
54+ self.assertTrue(os.path.exists(self.machine_id))
55+
56+ mid_mtime = os.path.getmtime(self.machine_id)
57+ now = time.mktime(datetime.datetime.now().timetuple())
58+
59+ # Check that the machine-id is less than 120seconds old
60+ self.assertTrue((now - mid_mtime ) < 120 )
61+
62+ def test_30NoRofsMachineId(self):
63+ """ machine-id must not exists on the rofs"""
64+ rofs_machine_id = os.path.join('/rofs', self.machine_id)
65+ self.assertFalse(os.path.exists(rofs_machine_id))
66+
67 if __name__ == '__main__':
68 unittest.main()

Subscribers

People subscribed via source and target branches