Merge lp:~marjo-mercado/ubuntu-qa-tools/bug-735595 into lp:ubuntu-qa-tools

Proposed by Marjo F. Mercado
Status: Merged
Merged at revision: 535
Proposed branch: lp:~marjo-mercado/ubuntu-qa-tools/bug-735595
Merge into: lp:ubuntu-qa-tools
Diff against target: 119 lines (+56/-5)
4 files modified
qadashboard/desktop_tests.py (+48/-0)
qadashboard/qadashboard_utils.py (+4/-2)
qadashboard/run_report.sh (+3/-1)
qadashboard/server_tests.py (+1/-2)
To merge this branch: bzr merge lp:~marjo-mercado/ubuntu-qa-tools/bug-735595
Reviewer Review Type Date Requested Status
Brian Murray Approve
Review via email: mp+53483@code.launchpad.net

Description of the change

Added desktop_tests.py and modified run_report.sh and qadashboardutils.py to add Desktop and Alternate image test results to qadashboard.
Implements bug # 735595

How To Test
1. Run report.sh
2. Check that the generated html file includes the link for the Desktop and Alternate test results at: http://204.236.234.12:8080/view/natty-desktop/
3. Check for some failures (Red status in QA Dashboard) and no failures (Green status)

To post a comment you must log in.
Revision history for this message
Kees Cook (kees) wrote :

Hi, please don't use "(s)". Since the quantity is known, just use correct pluralization.

For example, instead of:
   status = "%d failure(s)" % failures

use:
   status = "%d failure%s" % (failures, '' if failures == 1 else 's')

535. By Marjo F. Mercado

Modified server_tests.py & desktop_tests.py to not use "(s)", per Kees Cook suggestion.

Revision history for this message
Kees Cook (kees) wrote :

Cool, thanks! :)

Revision history for this message
Brian Murray (brian-murray) wrote :

I removed a couple of unused sys imports but otherwise it looked good thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'qadashboard/desktop_tests.py'
2--- qadashboard/desktop_tests.py 1970-01-01 00:00:00 +0000
3+++ qadashboard/desktop_tests.py 2011-03-15 21:21:01 +0000
4@@ -0,0 +1,48 @@
5+#!/usr/bin/python
6+# This script creates the data to be used for reporting on
7+# the automated Desktop and Alternate image tests.
8+# It is based on the ubuntu weatherreport from Leann Ogasawara.
9+#
10+# Copyright 2011 Canonical, Ltd.
11+# Author: Marjo Mercado <marjo.mercado@canonical.com>
12+#
13+# This program is free software; you can redistribute it and/or modify it
14+# under the terms of the GNU General Public License as published by the
15+# Free Software Foundation; either version 2 of the License, or (at your
16+# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
17+# the full text of the license.
18+
19+from qadashboard_utils import *
20+import subprocess
21+import sys
22+import re
23+
24+def desktop_tests():
25+ # Setup for writing to the data file
26+ metric = "Desktop and Alternate Images Automated Tests Results"
27+ data = ""
28+ status = "Testing In Progress"
29+ url="http://204.236.234.12:8080/view/natty-desktop"
30+ prc = subprocess.Popen(['wget', '--output-document=-', url],
31+ stdout=subprocess.PIPE,
32+ stderr=subprocess.PIPE)
33+ (stdout, stderr) = prc.communicate()
34+ failures = 0
35+ pattern = re.compile('tooltip="Failed"')
36+ for line in stdout.splitlines():
37+ if pattern.search(line):
38+ failures += 1
39+ if failures == 0:
40+ color = GREEN
41+ status = "No failures"
42+ else:
43+ color = RED
44+ status = "%d failure%s" % (failures, '' if failures == 1 else 's')
45+
46+
47+ # Note: The name of the metric must not contain spaces
48+ data = "desktop_automated_tests: metric=\"%s\" color=\"%s\" url=\"%s\" status=\"%s\"" % (metric, color, url, status)
49+ create_file(DESKTOP_TESTS_FILE, data)
50+
51+desktop_tests()
52+
53
54=== modified file 'qadashboard/qadashboard_utils.py'
55--- qadashboard/qadashboard_utils.py 2011-02-14 17:21:47 +0000
56+++ qadashboard/qadashboard_utils.py 2011-03-15 21:21:01 +0000
57@@ -3,7 +3,7 @@
58 # scripts.
59 # It is based on the ubuntu weatherreport from Leann Ogasawara.
60 #
61-# Copyright 2010 Canonical, Ltd.
62+# Copyright 2010-2011 Canonical, Ltd.
63 # Author: Marjo Mercado <marjo.mercado@canonical.com>
64 #
65 # This program is free software; you can redistribute it and/or modify it
66@@ -68,7 +68,8 @@
67 "iso_testing.txt",
68 "automatic_upgrades.txt",
69 "mago_tests.txt",
70- "server_tests.txt"]
71+ "server_tests.txt",
72+ "desktop_tests.txt"]
73
74 BUGS_MOST_USERS_AFFECTED_FILE = DATA_DIR + "bugs_most_users_affected.txt"
75 BUGS_MOST_DUPLICATES_FILE = DATA_DIR + "bugs_most_duplicates.txt"
76@@ -81,6 +82,7 @@
77 MAGO_TESTS_FILE = DATA_DIR + "mago_tests.txt"
78 MAGO_UNITY_TESTS_FILE = DATA_DIR + "mago_unity_tests.txt"
79 SERVER_TESTS_FILE = DATA_DIR + "server_tests.txt"
80+DESKTOP_TESTS_FILE = DATA_DIR + "desktop_tests.txt"
81
82 def parse_url(url, reg_exp):
83 content = urllib2.urlopen(url).read()
84
85=== modified file 'qadashboard/run_report.sh'
86--- qadashboard/run_report.sh 2011-03-10 17:40:58 +0000
87+++ qadashboard/run_report.sh 2011-03-15 21:21:01 +0000
88@@ -2,7 +2,7 @@
89 # This shell scripts runs the individual python scripts and publishes the
90 # qadashboard web page
91 #
92-# Copyright 2010 Canonical, Ltd.
93+# Copyright 2010-2011 Canonical, Ltd.
94 # Author: Marjo Mercado <marjo.mercado@canonical.com>
95 #
96 # This program is free software; you can redistribute it and/or modify it
97@@ -43,6 +43,8 @@
98 python mago_tests.py
99 echo "Running server tests"
100 python server_tests.py
101+echo "Running desktop tests"
102+python desktop_tests.py
103
104 # Data must be generated for the web page to change
105 echo "Generating data"
106
107=== modified file 'qadashboard/server_tests.py'
108--- qadashboard/server_tests.py 2010-11-30 04:55:28 +0000
109+++ qadashboard/server_tests.py 2011-03-15 21:21:01 +0000
110@@ -37,8 +37,7 @@
111 status = "No failures"
112 else:
113 color = RED
114- status = "%d failure(s)" % failures
115-
116+ status = "%d failure%s" % (failures, '' if failures == 1 else 's')
117
118 # Note: The name of the metric must not contain spaces
119 data = "server_automated_tests: metric=\"%s\" color=\"%s\" url=\"%s\" status=\"%s\"" % (metric, color, url, status)