diff options
author | Christopher Baines <mail@cbaines.net> | 2024-02-19 15:44:15 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2024-04-03 17:30:53 +0100 |
commit | c9cd16c630ccba655b93ff32fd9a99570b4f5373 (patch) | |
tree | 3ff7113554ae6a267b104a68369c35bf63325883 /tests | |
parent | c6cc9aeb87014cfb8f1eabb525e28ac633bf7af4 (diff) | |
download | guix-c9cd16c630ccba655b93ff32fd9a99570b4f5373.tar.gz guix-c9cd16c630ccba655b93ff32fd9a99570b4f5373.zip |
store: database: Rename a couple of procedures.
These names should be more descriptive.
* guix/store/database.scm (path-id): Rename to select-valid-path-id.
(sqlite-register): Rename to register-valid-path.
(register-items): Update accordingly.
Change-Id: I6d4a14d4cde9d71ab34d6ffdbfbfde51b2c0e1db
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pack.scm | 2 | ||||
-rw-r--r-- | tests/store-database.scm | 53 |
2 files changed, 27 insertions, 28 deletions
diff --git a/tests/pack.scm b/tests/pack.scm index 55445ea1e9..40897a5589 100644 --- a/tests/pack.scm +++ b/tests/pack.scm @@ -209,7 +209,7 @@ (and (every valid-file? '("α" "λ") '("alpha" "lambda")) - (integer? (path-id db #$tree))))))))))) + (integer? (valid-path-id db #$tree))))))))))) (built-derivations (list check)))) (unless store (test-skip 1)) diff --git a/tests/store-database.scm b/tests/store-database.scm index d8f3ce8070..67d464386d 100644 --- a/tests/store-database.scm +++ b/tests/store-database.scm @@ -87,23 +87,22 @@ (lambda (db-file port) (delete-file db-file) (with-database db-file db - (sqlite-register db - #:path "/gnu/foo" - #:references '() - #:deriver "/gnu/foo.drv" - #:hash (string-append "sha256:" (make-string 64 #\e)) - #:nar-size 1234) - (sqlite-register db - #:path "/gnu/bar" - #:references '("/gnu/foo") - #:deriver "/gnu/bar.drv" - #:hash (string-append "sha256:" (make-string 64 #\a)) - #:nar-size 4321) - (let ((path-id (@@ (guix store database) path-id))) - (list (path-id db "/gnu/foo") - (path-id db "/gnu/bar"))))))) + (register-valid-path db + #:path "/gnu/foo" + #:references '() + #:deriver "/gnu/foo.drv" + #:hash (string-append "sha256:" (make-string 64 #\e)) + #:nar-size 1234) + (register-valid-path db + #:path "/gnu/bar" + #:references '("/gnu/foo") + #:deriver "/gnu/bar.drv" + #:hash (string-append "sha256:" (make-string 64 #\a)) + #:nar-size 4321) + (list (valid-path-id db "/gnu/foo") + (valid-path-id db "/gnu/bar")))))) -(test-assert "sqlite-register with unregistered references" +(test-assert "register-valid-path with unregistered references" ;; Make sure we get a "NOT NULL constraint failed: Refs.reference" error ;; when we try to add references that are not registered yet. Better safe ;; than sorry. @@ -113,17 +112,17 @@ (catch 'sqlite-error (lambda () (with-database db-file db - (sqlite-register db #:path "/gnu/foo" - #:references '("/gnu/bar") - #:deriver "/gnu/foo.drv" - #:hash (string-append "sha256:" (make-string 64 #\e)) - #:nar-size 1234)) + (register-valid-path db #:path "/gnu/foo" + #:references '("/gnu/bar") + #:deriver "/gnu/foo.drv" + #:hash (string-append "sha256:" (make-string 64 #\e)) + #:nar-size 1234)) #f) (lambda args (pk 'welcome-exception! args) #t))))) -(test-equal "sqlite-register with incorrect size" +(test-equal "register-valid-path with incorrect size" 'out-of-range (call-with-temporary-output-file (lambda (db-file port) @@ -131,11 +130,11 @@ (catch #t (lambda () (with-database db-file db - (sqlite-register db #:path "/gnu/foo" - #:references '("/gnu/bar") - #:deriver "/gnu/foo.drv" - #:hash (string-append "sha256:" (make-string 64 #\e)) - #:nar-size -1234)) + (register-valid-path db #:path "/gnu/foo" + #:references '("/gnu/bar") + #:deriver "/gnu/foo.drv" + #:hash (string-append "sha256:" (make-string 64 #\e)) + #:nar-size -1234)) #f) (lambda (key . _) key))))) |