aboutsummaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorMilo Casagrande <milo.casagrande@linaro.org>2014-12-02 09:32:06 +0100
committerMilo Casagrande <milo.casagrande@linaro.org>2014-12-02 09:32:06 +0100
commitebd0c7358eccf100f56afa040d7372551a339004 (patch)
tree8b356e02aad159ee4264a51e31c57a7124dc3d3d /app/models
parent08d1e3f0eb03d74fb8446edfd472ab23fbd0a7c2 (diff)
parenta1e72e1a7b5aac2eed6fc4877b9c05f41e856b74 (diff)
Merge branch 'build-bisect' into boot-labs
Diffstat (limited to 'app/models')
-rw-r--r--app/models/__init__.py3
-rw-r--r--app/models/bisect.py21
-rw-r--r--app/models/tests/test_bisect_model.py33
3 files changed, 56 insertions, 1 deletions
diff --git a/app/models/__init__.py b/app/models/__init__.py
index de1c0fc..55b4ff9 100644
--- a/app/models/__init__.py
+++ b/app/models/__init__.py
@@ -198,5 +198,6 @@ VALID_JOB_STATUS = [
# The valid collections for the bisect handler.
BISECT_VALID_COLLECTIONS = [
- BOOT_COLLECTION
+ BOOT_COLLECTION,
+ DEFCONFIG_COLLECTION,
]
diff --git a/app/models/bisect.py b/app/models/bisect.py
index a05cc43..4d8d8e9 100644
--- a/app/models/bisect.py
+++ b/app/models/bisect.py
@@ -135,3 +135,24 @@ class BootBisectDocument(BisectDocument):
boot_b_dict[models.DEFCONFIG_ID_KEY] = self.defconfig_id
boot_b_dict[models.BOOT_ID_KEY] = self.boot_id
return boot_b_dict
+
+
+class DefconfigBisectDocument(BisectDocument):
+ """The bisect document class for defconfig/build bisection."""
+
+ def __init__(self, name):
+ super(DefconfigBisectDocument, self).__init__(name)
+
+ self.defconfig = None
+ self.defconfig_id = None
+ self.defconfig_full = None
+ self.arch = None
+
+ def to_dict(self):
+ def_b_dict = super(DefconfigBisectDocument, self).to_dict()
+ def_b_dict[models.DEFCONFIG_ID_KEY] = self.defconfig_id
+ def_b_dict[models.DEFCONFIG_KEY] = self.defconfig
+ def_b_dict[models.DEFCONFIG_FULL_KEY] = self.defconfig_full
+ def_b_dict[models.ARCHITECTURE_KEY] = self.arch
+
+ return def_b_dict
diff --git a/app/models/tests/test_bisect_model.py b/app/models/tests/test_bisect_model.py
index 3cc1b9b..874835b 100644
--- a/app/models/tests/test_bisect_model.py
+++ b/app/models/tests/test_bisect_model.py
@@ -135,3 +135,36 @@ class TestBisectModel(unittest.TestCase):
bisect_doc.board = "bar"
self.assertEqual(bisect_doc.board, "bar")
+
+ def test_bisect_defconfig_to_dict(self):
+ bisect_doc = modbs.DefconfigBisectDocument("foo")
+ bisect_doc.id = "bar"
+ bisect_doc.defconfig_id = "defconfig-id"
+ bisect_doc.defconfig = "defconfig-name"
+ bisect_doc.version = "1.0"
+ bisect_doc.job = "job"
+ bisect_doc.job_id = "job-id"
+ bisect_doc.defconfig_full = "defconfig-full"
+ bisect_doc.arch = "arm"
+
+ expected = {
+ "_id": "bar",
+ "created_on": None,
+ "job": "job",
+ "name": "foo",
+ "bisect_data": [],
+ "good_commit": None,
+ "good_commit_date": None,
+ "good_commit_url": None,
+ "bad_commit": None,
+ "bad_commit_date": None,
+ "bad_commit_url": None,
+ "version": "1.0",
+ "defconfig_id": "defconfig-id",
+ "defconfig": "defconfig-name",
+ "job_id": "job-id",
+ "defconfig_full": "defconfig-full",
+ "arch": "arm"
+ }
+
+ self.assertDictEqual(expected, bisect_doc.to_dict())