Merge lp:~milo/lava-dashboard/get-test-names into lp:lava-dashboard

Proposed by Milo Casagrande
Status: Merged
Merged at revision: 348
Proposed branch: lp:~milo/lava-dashboard/get-test-names
Merge into: lp:lava-dashboard
Diff against target: 48 lines (+31/-0)
1 file modified
dashboard_app/xmlrpc.py (+31/-0)
To merge this branch: bzr merge lp:~milo/lava-dashboard/get-test-names
Reviewer Review Type Date Requested Status
Andy Doan (community) Approve
Review via email: mp+124959@code.launchpad.net

Description of the change

Hi,

with this small branch here I added a simple XML-RPC 'get_test_names' to retrieve test names from lava-dashboard.

To post a comment you must log in.
Revision history for this message
Andy Doan (doanac) wrote :

I have one small nitpick. Can you change the method signature from:

 def get_tests_names(self, device=None):

to

 def get_tests_names(self, device_type=None):

Just to keep the wording of things in code consistent.

346. By Milo Casagrande

Renamed method argument.

Revision history for this message
Milo Casagrande (milo) wrote :

On Fri, Sep 21, 2012 at 4:39 PM, Andy Doan <email address hidden> wrote:
> I have one small nitpick. Can you change the method signature from:
>
> def get_tests_names(self, device=None):
>
> to
>
> def get_tests_names(self, device_type=None):
>
> Just to keep the wording of things in code consistent.

Absolutely!
This is now done.

Thanks.

--
Milo Casagrande
Infrastructure Engineer
Linaro.org <www.linaro.org> │ Open source software for ARM SoCs

347. By Milo Casagrande

Refactored method name.

Revision history for this message
Milo Casagrande (milo) wrote :

I refactored the method name, since it contained a typo: it was "get_tests_names" instead of "get_test_names".

Revision history for this message
Andy Doan (doanac) wrote :

I think this is sufficient for now. My team is discussing a real way to support this in the future, but I don't see anything in the MP that would hinder that process.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dashboard_app/xmlrpc.py'
2--- dashboard_app/xmlrpc.py 2012-03-15 03:09:06 +0000
3+++ dashboard_app/xmlrpc.py 2012-09-25 10:58:30 +0000
4@@ -38,6 +38,7 @@
5 Bundle,
6 BundleStream,
7 DataView,
8+ Test,
9 )
10
11
12@@ -407,6 +408,36 @@
13 'is_deserialized': bundle.is_deserialized
14 } for bundle in bundle_stream.bundles.all().order_by("uploaded_on")]
15
16+ @xml_rpc_signature('str', 'str')
17+ def get_test_names(self, device_type=None):
18+ """
19+ Name
20+ ----
21+ `get_test_names` ([`device`]])
22+
23+ Description
24+ -----------
25+ Get the name of all the tests ran.
26+
27+ Arguments
28+ ---------
29+ `device`: string
30+ The type of device the retrieved test names should apply to.
31+
32+ Return value
33+ ------------
34+ This function returns an XML-RPC array of test names.
35+ """
36+ test_names = []
37+ if device_type:
38+ for test in Test.objects.filter(
39+ test_runs__attributes__name='target.device_type',
40+ test_runs__attributes__value=device_type).distinct():
41+ test_names.append(test.name)
42+ else:
43+ for test in Test.objects.all():
44+ test_names.append(test.name)
45+ return test_names
46
47 def deserialize(self, content_sha1):
48 """

Subscribers

People subscribed via source and target branches