aboutsummaryrefslogtreecommitdiff
path: root/tests/model-package.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2022-03-11 13:07:34 +0000
committerChristopher Baines <mail@cbaines.net>2022-03-11 13:27:55 +0000
commit097e22ab5e8c59b0ffce1867a54eb0622ab75ce4 (patch)
tree916c64f8809f4782ba1f6a980f0930d30284d578 /tests/model-package.scm
parentdf4e0a7a616fcea9c15f4c2af85680ab0e0ec55b (diff)
downloaddata-service-097e22ab5e8c59b0ffce1867a54eb0622ab75ce4.tar
data-service-097e22ab5e8c59b0ffce1867a54eb0622ab75ce4.tar.gz
Close the load revision inferior prior to inserting data
This means that the lock can be acquired after closing the inferior, freeing the large amount of memory that the inferior process is probably using.
Diffstat (limited to 'tests/model-package.scm')
-rw-r--r--tests/model-package.scm41
1 files changed, 22 insertions, 19 deletions
diff --git a/tests/model-package.scm b/tests/model-package.scm
index a0fdc45..814a6e1 100644
--- a/tests/model-package.scm
+++ b/tests/model-package.scm
@@ -5,6 +5,7 @@
#:use-module (guix utils)
#:use-module (guix tests)
#:use-module (tests mock-inferior)
+ #:use-module (guix-data-service model utils)
#:use-module (guix-data-service model license)
#:use-module (guix-data-service model license-set)
#:use-module (guix-data-service model package)
@@ -45,16 +46,18 @@
(list mock-inferior-package-foo
mock-inferior-package-foo-2))
-(mock
- ((guix-data-service model package-metadata)
- inferior-packages->translated-package-descriptions-and-synopsis
- (lambda (inferior inferior-package)
- (cons `(("en_US.UTF-8" . "Fake synopsis"))
- `(("en_US.UTF-8" . "Fake description")))))
+(define mock-package-metadata
+ (map (lambda (mock-inf-pkg)
+ (list
+ (mock-inferior-package-home-page mock-inf-pkg)
+ (mock-inferior-package-location mock-inf-pkg)
+ `(("en_US.UTF-8" . "Fake synopsis"))
+ `(("en_US.UTF-8" . "Fake description"))))
+ mock-inferior-packages))
+
(with-mock-inferior-packages
(lambda ()
- (use-modules (guix-data-service model utils)
- (guix-data-service model package)
+ (use-modules (guix-data-service model package)
(guix-data-service model git-repository)
(guix-data-service model guix-revision)
(guix-data-service model package-metadata))
@@ -68,11 +71,11 @@
conn
(lambda (conn)
(test-assert "inferior-packages->package-ids works once"
- (let ((package-metadata-ids (inferior-packages->package-metadata-ids
- conn
- ""
- mock-inferior-packages
- (test-license-set-ids conn)))
+ (let ((package-metadata-ids
+ (inferior-packages->package-metadata-ids
+ conn
+ mock-package-metadata
+ (test-license-set-ids conn)))
(package-replacement-package-ids
(make-list (length mock-inferior-packages)
(cons "integer" NULL))))
@@ -88,11 +91,11 @@
(with-postgresql-transaction
conn
(lambda (conn)
- (let ((package-metadata-ids (inferior-packages->package-metadata-ids
- conn
- ""
- mock-inferior-packages
- (test-license-set-ids conn)))
+ (let ((package-metadata-ids
+ (inferior-packages->package-metadata-ids
+ conn
+ mock-package-metadata
+ (test-license-set-ids conn)))
(package-replacement-package-ids
(make-list (length mock-inferior-packages)
(cons "integer" NULL))))
@@ -109,6 +112,6 @@
(map mock-inferior-package-version mock-inferior-packages)
package-metadata-ids
package-replacement-package-ids)))))
- #:always-rollback? #t))))))
+ #:always-rollback? #t)))))
(test-end)