aboutsummaryrefslogtreecommitdiff
path: root/tests/database.scm
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2016-07-23 17:00:38 +0200
committerMathieu Lirzin <mthl@gnu.org>2016-07-25 02:12:41 +0200
commitc7c9e918763cd0e4c3fb85fe610c3971a0040d87 (patch)
tree8551f106eace452996484ff05da017ce66c62bae /tests/database.scm
parentcf7e290dc25fdc379d650bb4594628d4a654e59b (diff)
downloadcuirass-c7c9e918763cd0e4c3fb85fe610c3971a0040d87.tar
cuirass-c7c9e918763cd0e4c3fb85fe610c3971a0040d87.tar.gz
schema: Separate 'Evaluations' from 'Builds'.
Adapt src/cuirass/database.scm and its tests.
Diffstat (limited to 'tests/database.scm')
-rw-r--r--tests/database.scm21
1 files changed, 15 insertions, 6 deletions
diff --git a/tests/database.scm b/tests/database.scm
index 75431e9..964cd00 100644
--- a/tests/database.scm
+++ b/tests/database.scm
@@ -22,7 +22,8 @@
(define* (make-dummy-job #:optional (name "foo"))
`((#:name . ,name)
- (#:derivation . ,(string-append name ".drv"))))
+ (#:derivation . ,(string-append name ".drv"))
+ (#:specification 0)))
(define %db
;; Global Slot for a database object.
@@ -45,19 +46,27 @@
(test-assert "sqlite-exec"
(begin
(sqlite-exec (%db) "\
-INSERT INTO build (job_spec, drv) VALUES ('job1', 'drv1');")
+INSERT INTO Evaluations (derivation, job_name, specification)\
+ VALUES ('drv1', 'job1', 1);")
(sqlite-exec (%db) "\
-INSERT INTO build (job_spec, drv) VALUES ('job2', 'drv2');")
+INSERT INTO Evaluations (derivation, job_name, specification)\
+ VALUES ('drv2', 'job2', 2);")
(sqlite-exec (%db) "\
-INSERT INTO build (job_spec, drv) VALUES ('job3', 'drv3');")
- (sqlite-exec (%db) "SELECT * FROM build;")))
+INSERT INTO Evaluations (derivation, job_name, specification)\
+ VALUES ('drv3', 'job3', 3);")
+ (sqlite-exec (%db) "SELECT * FROM Evaluations;")))
(test-assert "db-add-evaluation"
- (%id (db-add-evaluation (%db) (make-dummy-job))))
+ (let* ((job (make-dummy-job))
+ (key (assq-ref job #:derivation)))
+ (db-add-evaluation (%db) job)
+ (%id key)))
(test-assert "db-get-evaluation"
(db-get-evaluation (%db) (%id)))
+ (test-expect-fail "db-add-build-log")
+ ;; XXX: 'Builds' database table is not implemented yet.
(test-equal "db-add-build-log"
"foo log"
(let ((job (acons #:id (%id) (make-dummy-job)))