diff options
author | Ludovic Courtès <ludo@gnu.org> | 2017-08-26 10:42:40 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2017-08-26 10:45:43 +0200 |
commit | 72f2b6b77cc4e3d7629bdf34e6daee05398b8de1 (patch) | |
tree | e8f147eac2e638d0089897e66f218a6e07e48273 /tests | |
parent | 6f85bc04f31ae5853ceaa0bb3e1dedfe8412a189 (diff) | |
download | cuirass-72f2b6b77cc4e3d7629bdf34e6daee05398b8de1.tar cuirass-72f2b6b77cc4e3d7629bdf34e6daee05398b8de1.tar.gz |
database: 'db-add-build' is now idempotent.
Fixes <https://bugs.gnu.org/28094>.
Reported by Ricardo Wurmus <rekado@elephly.net>.
* src/cuirass/database.scm (SQLITE_CONSTRAINT)
(SQLITE_CONSTRAINT_PRIMARYKEY): New variables.
(db-add-build): Catch 'sqlite-error, and swallow
SQLITE_CONSTRAINT_PRIMARYKEY errors.
* tests/database.scm ("db-add-build"): New test.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/database.scm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/database.scm b/tests/database.scm index 7f3b972..46b245e 100644 --- a/tests/database.scm +++ b/tests/database.scm @@ -78,6 +78,16 @@ INSERT INTO Evaluations (specification, revision) VALUES (3, 3);") (test-assert "db-get-derivation" (db-get-derivation (%db) (%id))) + (test-assert "db-add-build" + (let ((build `((#:derivation . "/foo.drv") + (#:eval-id . 42) + (#:log . "log") + (#:output . "/foo")))) + (db-add-build (%db) build) + + ;; This should be idempotent, see <https://bugs.gnu.org/28094>. + (db-add-build (%db) build))) + (test-assert "db-close" (db-close (%db))) |