diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-04-05 22:15:20 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2018-04-05 22:15:20 +0200 |
commit | fc24ca2eac708695f663623a50f715db5ca914bd (patch) | |
tree | aca7bf9665e27c618884f6b06b721e0875c2882e /tests | |
parent | 2feb3b8100d7a6e1db042ef24e9f2a897c953346 (diff) | |
download | cuirass-fc24ca2eac708695f663623a50f715db5ca914bd.tar cuirass-fc24ca2eac708695f663623a50f715db5ca914bd.tar.gz |
database: Add 'db-get-pending-derivations'.
* src/cuirass/database.scm (db-get-pending-derivations): New procedure.
* tests/database.scm ("database")["db-get-pending-derivations"]: New test.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/database.scm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/database.scm b/tests/database.scm index f534f2b..847c8a6 100644 --- a/tests/database.scm +++ b/tests/database.scm @@ -192,6 +192,29 @@ INSERT INTO Evaluations (specification, revision) VALUES (3, 3);") (map summarize (db-get-builds db '((order status+submission-time)))))))) + (test-equal "db-get-pending-derivations" + '("/bar.drv" "/foo.drv") + (with-temporary-database db + ;; Populate the 'Builds', 'Derivations', 'Evaluations', and + ;; 'Specifications' tables. Here, two builds map to the same derivation + ;; but the result of 'db-get-pending-derivations' must not contain any + ;; duplicate. + (db-add-build db (make-dummy-build 1 #:drv "/foo.drv" + #:outputs `(("out" . "/foo")))) + (db-add-build db (make-dummy-build 2 #:drv "/bar.drv" + #:outputs `(("out" . "/bar")))) + (db-add-build db (make-dummy-build 3 #:drv "/foo.drv" + #:outputs `(("out" . "/foo")))) + (db-add-derivation db (make-dummy-derivation "/foo.drv" 1)) + (db-add-derivation db (make-dummy-derivation "/bar.drv" 2)) + (db-add-derivation db (make-dummy-derivation "/foo.drv" 3)) + (db-add-evaluation db (make-dummy-eval)) + (db-add-evaluation db (make-dummy-eval)) + (db-add-evaluation db (make-dummy-eval)) + (db-add-specification db example-spec) + + (sort (db-get-pending-derivations db) string<?))) + (test-assert "db-close" (db-close (%db))) |