Index: lnt/trunk/lnt/server/ui/templates/reporting/runs.html
===================================================================
--- lnt/trunk/lnt/server/ui/templates/reporting/runs.html
+++ lnt/trunk/lnt/server/ui/templates/reporting/runs.html
@@ -94,7 +94,9 @@
{{ r.start_time.isoformat() }} |
{{ r.end_time - r.start_time }} |
{% if show_producers %}
- {{ r.parameters.producer|producerAsHTML }} |
+
+ {{ r.parameters.producer|producerAsHTML|safe if 'producer' in r.parameters else "" }}
+ |
{% endif %}
{% else %}
Index: lnt/trunk/lnt/server/ui/util.py
===================================================================
--- lnt/trunk/lnt/server/ui/util.py
+++ lnt/trunk/lnt/server/ui/util.py
@@ -298,8 +298,8 @@
builder = m.group(2)
build = m.group(3)
- png_url = 'http://%(url)s/png?builder=%(builder)s&number=%(build)s' % locals()
- img = '' % locals()
+ png_url = 'http://%(url)s/png?builder=%(builder)s&number=%(build)s' % locals()
+ img = '' % locals()
return '%(builder)s #%(build)s %(img)s' % locals()
elif producer.startswith('http://'):
Index: lnt/trunk/tests/server/ui/Inputs/V4Pages_extra_records.sql
===================================================================
--- lnt/trunk/tests/server/ui/Inputs/V4Pages_extra_records.sql
+++ lnt/trunk/tests/server/ui/Inputs/V4Pages_extra_records.sql
@@ -40,7 +40,8 @@
INSERT INTO "NT_Run" ("MachineID", "OrderID", "ImportedFrom", "StartTime",
"EndTime", "SimpleRunID", "Parameters")
VALUES(2,5,'run5.json','2012-05-01 16:28:23.000000',
- '2012-05-01 16:28:58.000000',NULL,'[]'); -- ID 5
+ '2012-05-01 16:28:58.000000',NULL,
+ '[["producer", "http://buildbot.server.url/builders/some-builder/builds/987"]]'); -- ID 5
INSERT INTO "NT_Sample" ("RunID", "TestID", "compile_status",
"execution_status", "compile_time", "execution_time",
"score", "mem_bytes")
@@ -76,7 +77,8 @@
INSERT INTO "NT_Run" ("MachineID", "OrderID", "ImportedFrom", "StartTime",
"EndTime", "SimpleRunID", "Parameters")
VALUES(2,6,'run7.json','2012-05-10 16:28:23.000000',
- '2012-05-10 16:28:58.000000',NULL,'[]'); -- ID 7
+ '2012-05-10 16:28:58.000000',NULL,
+ '[["producer", "http://my.build.server/buildResult"]]'); -- ID 7
INSERT INTO "NT_Run" ("MachineID", "OrderID", "ImportedFrom", "StartTime",
"EndTime", "SimpleRunID", "Parameters")
VALUES(2,7,'run8.json','2012-05-11 16:28:23.000000',
Index: lnt/trunk/tests/server/ui/V4Pages.py
===================================================================
--- lnt/trunk/tests/server/ui/V4Pages.py
+++ lnt/trunk/tests/server/ui/V4Pages.py
@@ -74,6 +74,16 @@
return tree
+def find_table_by_thead_content(tree, table_head_contents):
+ all_tables = tree.findall(".//thead/..")
+ found_header = False
+ for table in all_tables:
+ for child in table.findall('./thead/tr/th'):
+ if child.text == table_head_contents:
+ return table
+ return None
+
+
def find_table_with_heading(tree, table_heading):
table_parent_elements = tree.findall(".//table/..")
found_header = False
@@ -124,10 +134,21 @@
return get_table_by_header(client, url, table_header)
+def get_table_body_content(table):
+ return [[convert_html_to_text(cell).strip()
+ for cell in row.findall("./td")]
+ for row in table.findall("./tbody/tr")]
+
+
+def check_row_is_in_table(table, expected_row_content):
+ body_content = get_table_body_content(table)
+ assert expected_row_content in body_content, \
+ "Expected row content %s not found in %s" % \
+ (expected_row_content, body_content)
+
+
def check_table_content(table, expected_content):
- body_content = [[convert_html_to_text(cell).strip()
- for cell in row.findall("./td")]
- for row in table.findall("./tbody/tr")]
+ body_content = get_table_body_content(table)
assert expected_content == body_content, \
"Expected table content %s, found %s" % \
(expected_content, body_content)
@@ -144,6 +165,14 @@
check_table_content(table, expected_content)
+def check_producer_label(client, url, label):
+ table_header = "Produced by"
+ resp = check_code(client, url)
+ tree = get_xml_tree(resp.data)
+ table = find_table_by_thead_content(tree, table_header)
+ check_row_is_in_table(table, label)
+
+
def get_sparkline(table, testname, machinename):
body_content = [[cell
for cell in row.findall("./td")]
@@ -288,6 +317,16 @@
check_redirect(client, '/v4/nts/1/graph?test.3=2',
'v4/nts/graph\?plot\.0=1\.3\.2&highlight_run=1$')
+ # Get a run that contains generic producer information
+ check_producer_label(client, '/v4/nts/7',
+ ['Current', '152293', '2012-05-10T16:28:23',
+ '0:00:35', 'Producer'])
+
+ # Get a run that contains Buildbot producer information
+ check_producer_label(client, '/v4/nts/7',
+ ['Previous', '152292', '2012-05-01T16:28:23',
+ '0:00:35', 'some-builder #987'])
+
# Get the new graph page.
check_code(client, '/v4/nts/graph?plot.0=1.3.2')
# Don't crash when requesting non-existing data