summary refs log tree commit diff
path: root/tests/services.scm
diff options
context:
space:
mode:
authorBrian Cully <bjc@spork.org>2023-05-26 18:30:16 -0400
committerLudovic Courtès <ludo@gnu.org>2023-06-02 16:16:12 +0200
commitae707b62e71b1fae054eb422412384bcc8d39fa9 (patch)
tree2f8be3edefd0a87cba9dba3a0b21db1bb96fd057 /tests/services.scm
parent09fcf261c1f66a07891ec2fe80f8652fd286bd3e (diff)
downloadguix-ae707b62e71b1fae054eb422412384bcc8d39fa9.tar.gz
tests: Check for service existence in MODIFY-SERVICES
* tests/services.scm ("modify-services: delete non-existing service")
("modify-services: change value for non-existing service"): New tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'tests/services.scm')
-rw-r--r--tests/services.scm37
1 files changed, 35 insertions, 2 deletions
diff --git a/tests/services.scm b/tests/services.scm
index 435f39e59b..8cdb1b2a31 100644
--- a/tests/services.scm
+++ b/tests/services.scm
@@ -303,7 +303,7 @@
           <)))
 
 (test-equal "modify-services: delete service"
-  '(1 3)
+  '(1)
   (let* ((t1 (service-type (name 't1)
                            (extensions '())
                            (description "")))
@@ -316,11 +316,27 @@
          (services (list (service t1 1) (service t2 2) (service t3 3))))
     (sort (map service-value
                (modify-services services
+                 (delete t3)
                  (delete t2)))
           <)))
 
+(test-error "modify-services: delete non-existing service"
+  #t
+  (let* ((t1 (service-type (name 't1)
+                           (extensions '())
+                           (description "")))
+         (t2 (service-type (name 't2)
+                           (extensions '())
+                           (description "")))
+         (t3 (service-type (name 't2)
+                           (extensions '())
+                           (description "")))
+         (services (list (service t1 1) (service t2 2))))
+    (modify-services services
+      (delete t3))))
+
 (test-equal "modify-services: change value"
-  '(1 2 33)
+  '(2 11 33)
   (let* ((t1 (service-type (name 't1)
                            (extensions '())
                            (description "")))
@@ -333,7 +349,24 @@
          (services (list (service t1 1) (service t2 2) (service t3 3))))
     (sort (map service-value
                (modify-services services
+                 (t1 value => 11)
                  (t3 value => 33)))
           <)))
 
+(test-error "modify-services: change value for non-existing service"
+  #t
+  (let* ((t1 (service-type (name 't1)
+                           (extensions '())
+                           (description "")))
+         (t2 (service-type (name 't2)
+                           (extensions '())
+                           (description "")))
+         (t3 (service-type (name 't3)
+                           (extensions '())
+                           (description "")))
+         (services (list (service t1 1) (service t3 3))))
+    (map service-value
+         (modify-services services
+           (t2 value => 22)))))
+
 (test-end)