aboutsummaryrefslogtreecommitdiff
path: root/tests/database.scm
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2016-07-26 16:53:57 +0200
committerMathieu Lirzin <mthl@gnu.org>2016-07-27 14:17:09 +0200
commitd493a58823aed8c556bf795d02207e57718b96c9 (patch)
tree1fbb66eda8315b3d7cfa5074049779c02462c920 /tests/database.scm
parent0225d696424b0826af210fdeef770a2310252c64 (diff)
downloadcuirass-d493a58823aed8c556bf795d02207e57718b96c9.tar
cuirass-d493a58823aed8c556bf795d02207e57718b96c9.tar.gz
schema: Separate "Derivations" from "Evaluations".
* src/schema.sql (Derivations): New table. (Evaluations): Remove 'derivation' and 'job_name' columns. Add 'id' column. * src/cuirass/database.scm (db-add-evaluation): Adapt. (db-get-derivation, db-add-derivation): New procedures. (evaluation-exists?, db-get-evaluation): Delete. * bin/evaluate.in (main): Adapt. * tests/database.scm ("sqlite-exec"): Likewise. ("db-add-derivation", "db-get-derivation"): New tests. ("db-add-evaluation", "db-get-evaluation"): Delete.
Diffstat (limited to 'tests/database.scm')
-rw-r--r--tests/database.scm23
1 files changed, 10 insertions, 13 deletions
diff --git a/tests/database.scm b/tests/database.scm
index 29a1e50..7fa9f1b 100644
--- a/tests/database.scm
+++ b/tests/database.scm
@@ -57,15 +57,12 @@
(test-assert "sqlite-exec"
(begin
- (sqlite-exec (%db) "\
-INSERT INTO Evaluations (derivation, job_name, specification)\
- VALUES ('drv1', 'job1', 1);")
- (sqlite-exec (%db) "\
-INSERT INTO Evaluations (derivation, job_name, specification)\
- VALUES ('drv2', 'job2', 2);")
- (sqlite-exec (%db) "\
-INSERT INTO Evaluations (derivation, job_name, specification)\
- VALUES ('drv3', 'job3', 3);")
+ (sqlite-exec (%db)
+ "INSERT INTO Evaluations (specification) VALUES (1);")
+ (sqlite-exec (%db)
+ "INSERT INTO Evaluations (specification) VALUES (2);")
+ (sqlite-exec (%db)
+ "INSERT INTO Evaluations (specification) VALUES (3);")
(sqlite-exec (%db) "SELECT * FROM Evaluations;")))
(test-equal "db-add-specification"
@@ -74,14 +71,14 @@ INSERT INTO Evaluations (derivation, job_name, specification)\
(db-add-specification (%db) example-spec)
(car (db-get-specifications (%db)))))
- (test-assert "db-add-evaluation"
+ (test-assert "db-add-derivation"
(let* ((job (make-dummy-job))
(key (assq-ref job #:derivation)))
- (db-add-evaluation (%db) job)
+ (db-add-derivation (%db) job)
(%id key)))
- (test-assert "db-get-evaluation"
- (db-get-evaluation (%db) (%id)))
+ (test-assert "db-get-derivation"
+ (db-get-derivation (%db) (%id)))
(test-assert "db-close"
(db-close (%db))))