Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 91f89f2

Browse files
loysollivierMiloCasagrande
authored andcommitted
Test views prototype
* Implement the test suite view add test set data. Get and display the test case information (name, results). * Create the links to the test set and case URLs. Create the links to the future test set and test case URLs. The links exists but they point to nothing as the URLs are not implemented yet. * New test view landing page. Created a new test view landing page. This page sorts the tests by name and displays a count of test sets and cases available for each suite. The code follows the same standard than other resources (boot, socs, ...). * New test view when sorted by board, job, kernel. New test view displaying the test results by lab for a specific board, job and kernel. * Test suite view by ID add log link. Add links to the log for the test suite view by ID. This log is unique and regroups the boot + test. A possible improvement would be to parse it and add on overlay for test case recognition. Signed-off-by: Loys Ollivier <lollivier@baylibre.com>
1 parent 5bcc301 commit 91f89f2

27 files changed

Lines changed: 3132 additions & 675 deletions

app/dashboard/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ def static_html_proxy(path):
179179
@app.route(
180180
"/_ajax/test/set",
181181
defaults={"api": "TEST_SET_API_ENDPOINT"}, methods=["GET"])
182+
@app.route(
183+
"/_ajax/test/case",
184+
defaults={"api": "TEST_CASE_API_ENDPOINT"}, methods=["GET"])
182185
def ajax_get(api):
183186
if validate_csrf(request.headers.get(CSRF_TOKEN_H, None)):
184187
return backend.ajax_get(request, app_conf_get(api), timeout=60 * 20)
@@ -315,6 +318,9 @@ def ajax_compare(doc_id, api):
315318
"/_ajax/<string:resource>/distinct/<string:field>/", methods=["GET"])
316319
def ajax_distinct(resource, field):
317320
if validate_csrf(request.headers.get(CSRF_TOKEN_H, None)):
321+
# Workaround because the backend uses /test/suite/...
322+
if (resource == "suite"):
323+
resource = "test/suite"
318324
return backend.ajax_get(
319325
request, "/%s/distinct" % resource, doc_id=field, timeout=60 * 30)
320326
else:

app/dashboard/default_settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
JOB_ID_LOGS_ENPOINT = "/job/%s/logs"
5454
TEST_SUITE_API_ENDPOINT = "/test/suite"
5555
TEST_SET_API_ENDPOINT = "/test/set"
56+
TEST_CASE_API_ENDPOINT = "/test/case"
5657

5758
# Default date range to show the results. The higher the value, the more
5859
# data will need to be loaded from the server and parsed. It can take time

app/dashboard/static/js/app/tables/test-set.js

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
/*! Kernel CI Dashboard | Licensed under the GNU GPL v3 (or later) */
2+
define([
3+
'utils/html',
4+
'tables/common'
5+
], function(html, tcommon) {
6+
'use strict';
7+
var gTestTable;
8+
var gStatusDefaults;
9+
10+
gTestTable = {};
11+
12+
gStatusDefaults = {
13+
pass: 'Test executed successfully',
14+
fail: 'Test execution failed',
15+
offline: 'Test offline',
16+
default: 'Test execution status unknown'
17+
};
18+
19+
/**
20+
* Function to render the Board column on a table.
21+
*
22+
* @param {string} board: The Board value.
23+
* @param {string} type: The type of the display option.
24+
* @return {string} The rendered element as string.
25+
**/
26+
gTestTable.renderBoard = function(board, type) {
27+
var aNode,
28+
rendered,
29+
tooltipNode;
30+
31+
if (type === 'display') {
32+
tooltipNode = html.tooltip();
33+
tooltipNode.setAttribute(
34+
'title', 'Test reports for board&nbsp;' + board);
35+
36+
aNode = document.createElement('a');
37+
aNode.setAttribute('href', '/test/board/' + board + '/');
38+
aNode.className = 'table-link';
39+
aNode.appendChild(document.createTextNode(board));
40+
41+
tooltipNode.appendChild(aNode);
42+
rendered = tooltipNode.outerHTML;
43+
44+
// Remove the nodes.
45+
aNode.remove();
46+
tooltipNode.remove();
47+
} else {
48+
rendered = board;
49+
}
50+
51+
return rendered;
52+
};
53+
54+
/**
55+
* Function to render the date.
56+
*
57+
* @param {object} date: The date object.
58+
* @return {Element} The DOM element.
59+
**/
60+
gTestTable.dateNode = function(date) {
61+
return tcommon.dateNode(date);
62+
};
63+
64+
/**
65+
* Create the test status element.
66+
*
67+
* @param {string} status: The test status.
68+
* @return {HTMLElement} The status node.
69+
**/
70+
gTestTable.statusNode = function(status) {
71+
return tcommon.statusNode(status, gStatusDefaults);
72+
};
73+
74+
/**
75+
* Function to render the case detail.
76+
*
77+
* @param {string} link: The href link to point to.
78+
* @return {Element} The DOM element.
79+
**/
80+
gTestTable.detailsNode = function(link) {
81+
var aNode;
82+
var str;
83+
var tooltipNode;
84+
85+
tooltipNode = html.tooltip();
86+
tooltipNode.setAttribute('title', 'More info');
87+
88+
aNode = document.createElement('a');
89+
str = link;
90+
aNode.setAttribute('href', str);
91+
92+
aNode.appendChild(html.search());
93+
tooltipNode.appendChild(aNode);
94+
95+
return tooltipNode;
96+
};
97+
98+
gTestTable.renderDate = function(date, type) {
99+
return tcommon.renderDate(date, type);
100+
};
101+
102+
gTestTable.renderDetails = function(href, type, title) {
103+
return tcommon.renderDetails(href, type, title);
104+
};
105+
106+
gTestTable.countBadge = function(settings) {
107+
return tcommon.countBadge(
108+
settings.data,
109+
settings.type, settings.extraClasses, settings.idStart).outerHTML;
110+
};
111+
112+
gTestTable.renderCasesCount = function(data, type, id_str, href) {
113+
return tcommon.countAll({
114+
data: data,
115+
type: type,
116+
href: href,
117+
extraClasses: ['extra-margin'],
118+
idStart: id_str
119+
});
120+
};
121+
122+
gTestTable.renderTree = function(tree, type, href) {
123+
return tcommon.renderTree(tree, type, href);
124+
};
125+
126+
gTestTable.getCountFail = function(idStart) {
127+
document.getElementById('cases-total-count-'+ idStart)
128+
.innerHTML ='&infin;';
129+
document.getElementById('cases-success-count-'+ idStart)
130+
.innerHTML ='&infin;';
131+
document.getElementById('cases-fail-count-'+ idStart)
132+
.innerHTML ='&infin;';
133+
document.getElementById('cases-unknown-count-'+ idStart)
134+
.innerHTML ='&infin;';
135+
};
136+
137+
return gTestTable;
138+
});

app/dashboard/static/js/app/view-socs-soc-job-kernel.2017.4.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ define([
672672
if (document.getElementById('job-name') !== null) {
673673
gJob = document.getElementById('job-name').value;
674674
}
675-
if (document.getElementById('job-name') !== null) {
675+
if (document.getElementById('kernel-name') !== null) {
676676
gKernel = document.getElementById('kernel-name').value;
677677
}
678678
if (document.getElementById('soc-name') !== null) {

0 commit comments

Comments
 (0)