aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilosz Wasilewski <milosz.wasilewski@linaro.org>2015-07-02 20:48:21 +0100
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2015-07-02 20:48:21 +0100
commitabaa8456927092c909f1ee3bcbef17542d26247e (patch)
treef156abc898f20e539f2cd4401f6f0f9be639e579
parent1ee075315d3980e7c8637380613578f3d2ef3f1f (diff)
added support for test job status
When test suites come from the same job, the job status is aggregated and displayed in the template Signed-off-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
-rw-r--r--templates/buildtestresults/builddetails.html4
-rw-r--r--testmanager/buildtestresults/migrations/0002_auto_20150702_1457.py24
-rw-r--r--testmanager/buildtestresults/models.py2
-rw-r--r--testmanager/buildtestresults/tasks.py5
-rw-r--r--testmanager/buildtestresults/templatetags/buildtestresults.py10
-rw-r--r--utils/buildminer.py3
6 files changed, 47 insertions, 1 deletions
diff --git a/templates/buildtestresults/builddetails.html b/templates/buildtestresults/builddetails.html
index dafde03..a029274 100644
--- a/templates/buildtestresults/builddetails.html
+++ b/templates/buildtestresults/builddetails.html
@@ -19,6 +19,7 @@
<table class="table table-striped">
<tr>
<th>test job</th>
+ <th>test job status</th>
<th>board</th>
<th>boot status</th>
<th>boot time</th>
@@ -29,6 +30,7 @@
{% for boot in build.boot_results.all %}
<tr {% if boot.boot_result == 'fail' %}class="danger"{% endif %}>
<td><a href="{{ boot.testjoburl }}">{{ boot.testjoburl }}</a></td>
+ <td>{{ boot.testjobstatus }}</td>
<td>{{ boot.board }}</td>
<td class="tm-color-replace-{{ boot.boot_result }}">{{ boot.boot_result }}</td>
<td>{{ boot.boot_time }}</td>
@@ -46,7 +48,7 @@
<div class="panel tm-color-replace-{% aggregate_test_status testgroup.grouper %}" data-toggle="collapse" data-target="#collapsible{{ forloop.counter }}" aria-expanded="false" aria-controls="a{{ forloop.counter }}">
<div class="panel-heading">
<h5 class="panel-title"><span class="glyphicon glyphicon glyphicon-chevron-down" aria-hidden="true" id="glyphicon-collapsible-{{ forloop.counter }}"></span>
- {{ testgroup.grouper }} <span class="pull-right">{% aggregate_test_results testgroup.grouper %}</span></h5>
+ {{ testgroup.grouper }} ({% aggregate_test_job_status testgroup.grouper %})<span class="pull-right">{% aggregate_test_results testgroup.grouper %}</span></h5>
</div>
<div class="panel-body collapse" id="collapsible{{ forloop.counter }}">
<div class="table-responsive">
diff --git a/testmanager/buildtestresults/migrations/0002_auto_20150702_1457.py b/testmanager/buildtestresults/migrations/0002_auto_20150702_1457.py
new file mode 100644
index 0000000..3d68e75
--- /dev/null
+++ b/testmanager/buildtestresults/migrations/0002_auto_20150702_1457.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('buildtestresults', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='bootresult',
+ name='testjobstatus',
+ field=models.CharField(max_length=16, null=True, blank=True),
+ ),
+ migrations.AddField(
+ model_name='testsuite',
+ name='testjobstatus',
+ field=models.CharField(max_length=16, null=True, blank=True),
+ ),
+ ]
diff --git a/testmanager/buildtestresults/models.py b/testmanager/buildtestresults/models.py
index f81ad9c..a6ac038 100644
--- a/testmanager/buildtestresults/models.py
+++ b/testmanager/buildtestresults/models.py
@@ -125,6 +125,7 @@ class Build(models.Model):
class BootResult(models.Model):
testjoburl = models.URLField()
+ testjobstatus = models.CharField(max_length=16, null=True, blank=True)
boot_result = models.CharField(max_length=16, choices=settings.STATUSES)
boot_time = models.FloatField(null=True, blank=True)
boot_attempts = models.IntegerField()
@@ -141,6 +142,7 @@ class BootResult(models.Model):
class TestSuite(models.Model):
testjoburl = models.URLField()
+ testjobstatus = models.CharField(max_length=16, null=True, blank=True)
version = models.CharField(max_length=128)
source = models.CharField(max_length=32) #source of the download request (manual/automatic)
repository = models.CharField(max_length=128)
diff --git a/testmanager/buildtestresults/tasks.py b/testmanager/buildtestresults/tasks.py
index bc5dd5c..8fe3925 100644
--- a/testmanager/buildtestresults/tasks.py
+++ b/testmanager/buildtestresults/tasks.py
@@ -39,6 +39,7 @@ def get_credentials(host):
@celery_app.task(bind=True)
def dig_build(self, builder, project, buildnumber=None, configuration=None):
+ print "start digging build for: %s %s %s %s" % (builder, project, buildnumber, configuration)
try:
builder_project_name = project.projectname
tester_class_name = project.testrunnerclass
@@ -90,6 +91,8 @@ def dig_build(self, builder, project, buildnumber=None, configuration=None):
print builder.get_test_job_ids(build)
for test_job_id in builder.get_test_job_ids(build):
download_test_results.delay(dbbuild, project, test_job_id)
+ else:
+ print "Something wrong, build is empty"
return True
except Exception as e:
print "Exception happened"
@@ -144,6 +147,7 @@ def dig_test(self, tester, test_job_id, build, source):
print "\t\tBoot %s: %s (%s)" % (boot_result['target'], boot_result['result'], boot_result['reason'])
dbboot = BootResult(
testjoburl = tester.get_job_url(test_job_id),
+ testjobstatus = tester.get_test_job_status(test_job_id),
boot_result = translate_results(boot_result['result']),
boot_attempts = boot_result['boot_attempts'],
#boot_time = boot_result['boot_time'],
@@ -175,6 +179,7 @@ def dig_test(self, tester, test_job_id, build, source):
parameters = result['parameters']
dbtestsuite = TestSuite(
testjoburl = tester.get_job_url(test_job_id),
+ testjobstatus = tester.get_test_job_status(test_job_id),
source = source,
version = version,
repository = result['git-repo'], #TODO change to 'repository'
diff --git a/testmanager/buildtestresults/templatetags/buildtestresults.py b/testmanager/buildtestresults/templatetags/buildtestresults.py
index e1c7440..29ba513 100644
--- a/testmanager/buildtestresults/templatetags/buildtestresults.py
+++ b/testmanager/buildtestresults/templatetags/buildtestresults.py
@@ -45,6 +45,16 @@ def aggregate_test_status(test_job_url):
return ""
@register.simple_tag
+def aggregate_test_job_status(test_job_url):
+ # job URL should be unique
+ try:
+ testjobs_results = models.TestSuite.objects.filter(testjoburl=test_job_url).values_list('testjobstatus', flat=True)
+ return testjobs_results[0]
+ except Exception,e:
+ pass
+ return ""
+
+@register.simple_tag
def aggregate_test_results(test_job_url):
# job URL should be unique
try:
diff --git a/utils/buildminer.py b/utils/buildminer.py
index e799ef0..79404b5 100644
--- a/utils/buildminer.py
+++ b/utils/buildminer.py
@@ -131,6 +131,7 @@ class JenkinsBuildSystem(BuildSystem):
configs = job._data['activeConfigurations']
build_config = None
for config in configs:
+ print "Active config: %s" % config
if config['name'] == configuration:
return config
return None
@@ -138,6 +139,7 @@ class JenkinsBuildSystem(BuildSystem):
def _get_build_with_config(self, project_id, build_id, configuration):
job = self.jenkins[project_id]
build_config = self._get_configuration(project_id, configuration)
+ print "build config from Jenkins: %s" % build_config
if build_config:
conf_url = build_config['url'] + "%s/" % build_id
try:
@@ -148,6 +150,7 @@ class JenkinsBuildSystem(BuildSystem):
return None
def get_build(self, project_id, build_id, configuration=None):
+ print "Retrieving build: %s %s %s" % (project_id, build_id, configuration)
if not configuration:
return JenkinsBuild(self.jenkins[project_id].get_build(int(build_id)))
return self._get_build_with_config(project_id, build_id, configuration)