Merge lp:~om26er/ubuntu-test-cases/x_server_lightm_test into lp:ubuntu-test-cases/desktop

Proposed by Omer Akram
Status: Needs review
Proposed branch: lp:~om26er/ubuntu-test-cases/x_server_lightm_test
Merge into: lp:ubuntu-test-cases/desktop
Diff against target: 92 lines (+65/-1)
4 files modified
runlists/default.run (+1/-1)
testsuites/usit/tslist.run (+1/-0)
testsuites/usit/x_server_display/tc_control (+12/-0)
testsuites/usit/x_server_display/test.py (+51/-0)
To merge this branch: bzr merge lp:~om26er/ubuntu-test-cases/x_server_lightm_test
Reviewer Review Type Date Requested Status
Ubuntu Test Case Developers Pending
Review via email: mp+235459@code.launchpad.net

Description of the change

Add tests to check if xserver and lightdm are running.

To post a comment you must log in.

Unmerged revisions

50. By Omer Akram

add tests to check if xserver and lightdm are running.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'runlists/default.run'
2--- runlists/default.run 2013-01-30 09:30:58 +0000
3+++ runlists/default.run 2014-09-22 13:51:16 +0000
4@@ -5,4 +5,4 @@
5 include_tests:
6 - read_write
7 - dbus_machine_id
8- #- empty_startup_app
9+ - x_server_display
10
11=== modified file 'testsuites/usit/tslist.run'
12--- testsuites/usit/tslist.run 2013-01-18 17:52:04 +0000
13+++ testsuites/usit/tslist.run 2014-09-22 13:51:16 +0000
14@@ -12,3 +12,4 @@
15 - test: disk_not_full
16 - test: out_of_memory
17 - test: archive_location
18+- test: x_server_display
19
20=== added directory 'testsuites/usit/x_server_display'
21=== added file 'testsuites/usit/x_server_display/tc_control'
22--- testsuites/usit/x_server_display/tc_control 1970-01-01 00:00:00 +0000
23+++ testsuites/usit/x_server_display/tc_control 2014-09-22 13:51:16 +0000
24@@ -0,0 +1,12 @@
25+description: Check that xserver andlightdm are running
26+dependencies: procps, sysvinit-utils
27+
28+action: |
29+ 1. Check Xorg is running
30+ 2. Check Lightdm is running
31+expected_results: |
32+ 1. Xorg process is running
33+ 2. Lightdm upstart job is running
34+type: userland
35+command: ./test.py
36+run_as: utah
37
38=== added file 'testsuites/usit/x_server_display/test.py'
39--- testsuites/usit/x_server_display/test.py 1970-01-01 00:00:00 +0000
40+++ testsuites/usit/x_server_display/test.py 2014-09-22 13:51:16 +0000
41@@ -0,0 +1,51 @@
42+#!/usr/bin/python
43+#
44+# Copyright (C) 2014, Canonical Ltd.
45+#
46+# This file is part of ubuntu-test-cases.
47+#
48+# ubuntu-test-cases is free software: you can redistribute it
49+# and/or modify it under the terms of the GNU General Public License
50+# as published by the Free Software Foundation, either version 3 of
51+# the License, or (at your option) any later version.
52+#
53+# ubuntu-test-cases is distributed in the hope that it will
54+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
55+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56+# GNU General Public License for more details.
57+#
58+# You should have received a copy of the GNU General Public License
59+# along with ubuntu-test-cases. If not, see
60+# <http://www.gnu.org/licenses/>.
61+
62+import logging
63+import subprocess
64+import unittest
65+
66+
67+class XServerDisplayTest(unittest.TestCase):
68+ """Check if XServer and Lightdm are running in the environment."""
69+
70+ def test_x_server_running(self):
71+ """Check if XServer is running in the environment."""
72+ logging.info('Checking list of running processes.')
73+ command = ['ps', '-eo', 'comm']
74+ stdout = subprocess.check_output(command, universal_newlines=True)
75+
76+ self.assertTrue(
77+ 'Xorg' in stdout, 'X server does not seem to be running.')
78+
79+ def test_lightdm_running(self):
80+ """Check if lightmd is running in the environment."""
81+ logging.info('Checking status of lightdm')
82+ command = ['service', 'lightdm', 'status']
83+ stdout = subprocess.check_output(command, universal_newlines=True)
84+
85+ self.assertTrue(
86+ 'start/running' in stdout, 'Lightdm does not seem to be running.')
87+
88+
89+if __name__ == '__main__':
90+ logging.basicConfig(
91+ level=logging.DEBUG, format='%(levelname)s: %(message)s')
92+ unittest.main()

Subscribers

People subscribed via source and target branches