summary refs log tree commit diff
path: root/gnu/tests
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-08-01 00:49:07 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-08-01 12:49:44 -0400
commitf5cc7d03a778f20e2ad487e2c17cc8853bc871f0 (patch)
tree25c92a13db0bec936e5458614f744705915878df /gnu/tests
parenta2b89a3319dc1d621c546855f578acae5baaf6da (diff)
downloadguix-f5cc7d03a778f20e2ad487e2c17cc8853bc871f0.tar.gz
gnu: telephony: Add a Jami test for a partially defined jami-account.
* gnu/tests/telephony.scm (%dummy-jami-account-partial): New variable.
(make-jami-os): Add a PARTIAL? argument and use it to select the jami-account
variant to use.
(%jami-os-provisioning-partial): New variable.
(run-jami-test): Add a PARTIAL? argument, and use it to select operating
system variant.  Skip allowed-contacts and moderators test when PARTIAL? is
true.
(%test-jami-provisioning-partial): New test.
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/telephony.scm53
1 files changed, 43 insertions, 10 deletions
diff --git a/gnu/tests/telephony.scm b/gnu/tests/telephony.scm
index 16ee313f69..83fa7228c8 100644
--- a/gnu/tests/telephony.scm
+++ b/gnu/tests/telephony.scm
@@ -31,7 +31,8 @@
   #:use-module (guix gexp)
   #:use-module (guix modules)
   #:export (%test-jami
-            %test-jami-provisioning))
+            %test-jami-provisioning
+            %test-jami-provisioning-partial))
 
 ;;;
 ;;; Jami daemon.
@@ -67,7 +68,18 @@
                                                     "fallback.another.host"))
                              (name-server-uri "https://my.name.server")))
 
-(define* (make-jami-os #:key provisioning?)
+;;; Like %dummy-jami-account, but with allowed-contacts and moderators left
+;;; unset (thus taking the value *unspecified*).
+(define %dummy-jami-account-partial
+  (jami-account
+   (archive %dummy-jami-account-archive)
+   (rendezvous-point? #t)
+   (peer-discovery? #f)
+   (bootstrap-hostnames '("bootstrap.me"
+                          "fallback.another.host"))
+   (name-server-uri "https://my.name.server")))
+
+(define* (make-jami-os #:key provisioning? partial?)
   (operating-system
     (host-name "jami")
     (timezone "America/Montreal")
@@ -87,7 +99,10 @@
                               (if provisioning?
                                   (jami-configuration
                                    (debug? #t)
-                                   (accounts (list %dummy-jami-account)))
+                                   (accounts
+                                    (list (if partial?
+                                              %dummy-jami-account-partial
+                                              %dummy-jami-account))))
                                   (jami-configuration
                                    (debug? #t))))
                      (service dbus-root-service-type)
@@ -109,12 +124,18 @@
 (define %jami-os-provisioning
   (make-jami-os #:provisioning? #t))
 
-(define* (run-jami-test #:key provisioning?)
-  "Run tests in %JAMI-OS.  When PROVISIONING? is true, test the
-accounts provisioning feature of the service."
+(define %jami-os-provisioning-partial
+  (make-jami-os #:provisioning? #t #:partial? #t))
+
+(define* (run-jami-test #:key provisioning? partial?)
+  "Run tests in %JAMI-OS.  When PROVISIONING? is true, test the accounts
+provisioning feature of the service.  When PARTIAL? is #t, some fields of the
+jami account used as part of the jami configuration are left *unspecified*."
   (define os (marionette-operating-system
               (if provisioning?
-                  %jami-os-provisioning
+                  (if partial?
+                      %jami-os-provisioning-partial
+                      %jami-os-provisioning)
                   %jami-os)
               #:imported-modules '((gnu services herd)
                                    (guix combinators))))
@@ -202,7 +223,7 @@ accounts provisioning feature of the service."
                                                      "Account.username")))))))
                marionette))
 
-            (unless #$provisioning? (test-skip 1))
+            (unless #$(and provisioning? (not partial?)) (test-skip 1))
             (test-assert "jami accounts provisioning, allowed-contacts"
               (marionette-eval
                '(begin
@@ -224,7 +245,7 @@ accounts provisioning feature of the service."
                       (assert (lset= string-ci=? contacts '#$%allowed-contacts)))))
                marionette))
 
-            (unless #$provisioning? (test-skip 1))
+            (unless #$(and provisioning? (not partial?)) (test-skip 1))
             (test-assert "jami accounts provisioning, moderators"
               (marionette-eval
                '(begin
@@ -326,7 +347,9 @@ accounts provisioning feature of the service."
             (test-end)))))
 
   (gexp->derivation (if provisioning?
-                        "jami-provisioning-test"
+                        (if partial?
+                            "jami-provisioning-partial-test"
+                            "jami-provisioning-partial")
                         "jami-test")
     test))
 
@@ -341,3 +364,13 @@ accounts provisioning feature of the service."
    (name "jami-provisioning")
    (description "Provisioning test for the jami service.")
    (value (run-jami-test #:provisioning? #t))))
+
+;;; Thi test verifies that <jami-account> values can be left unspecified
+;;; without causing any issue (see: https://issues.guix.gnu.org/56799).
+(define %test-jami-provisioning-partial
+  (system-test
+   (name "jami-provisioning-partial")
+   (description "Provisioning test for the jami service, when some of the
+'maybe' fields aren't provided (such that their value end up being
+*unspecified*.")
+   (value (run-jami-test #:provisioning? #t #:partial? #t))))