diff options
author | Cleeyv <cleeyv@riseup.net> | 2021-10-15 11:00:24 -0700 |
---|---|---|
committer | tomberek <tomberek@users.noreply.github.com> | 2021-10-25 20:46:24 -0400 |
commit | 29f4cb4b0accf703f042bd3f5a54dd4225ae20c1 (patch) | |
tree | 85100317efab6798ba7d196f913dbb8efd0289ed /nixos | |
parent | 917c5fae70f9d8ec43653e5a6e3ea764ce7bd2c8 (diff) | |
download | nixlib-29f4cb4b0accf703f042bd3f5a54dd4225ae20c1.tar nixlib-29f4cb4b0accf703f042bd3f5a54dd4225ae20c1.tar.gz nixlib-29f4cb4b0accf703f042bd3f5a54dd4225ae20c1.tar.bz2 nixlib-29f4cb4b0accf703f042bd3f5a54dd4225ae20c1.tar.lz nixlib-29f4cb4b0accf703f042bd3f5a54dd4225ae20c1.tar.xz nixlib-29f4cb4b0accf703f042bd3f5a54dd4225ae20c1.tar.zst nixlib-29f4cb4b0accf703f042bd3f5a54dd4225ae20c1.zip |
nixos/jibri: add nixos test
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/networking/jibri/default.nix | 15 | ||||
-rw-r--r-- | nixos/tests/all-tests.nix | 1 | ||||
-rw-r--r-- | nixos/tests/jibri.nix | 69 |
3 files changed, 84 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/jibri/default.nix b/nixos/modules/services/networking/jibri/default.nix index 4aa60e31052f..96832b0eb552 100644 --- a/nixos/modules/services/networking/jibri/default.nix +++ b/nixos/modules/services/networking/jibri/default.nix @@ -67,7 +67,10 @@ let "--enabled" "--disable-infobars" "--autoplay-policy=no-user-gesture-required" - ]; + ] + ++ lists.optional cfg.ignoreCert + "--ignore-certificate-errors"; + stats.enable-stats-d = true; webhook.subscribers = [ ]; @@ -138,6 +141,16 @@ in ''; }; + ignoreCert = mkOption { + type = bool; + default = false; + example = true; + description = '' + Whether to enable the flag "--ignore-certificate-errors" for the Chromium browser opened by Jibri. + Intended for use in automated tests or anywhere else where using a verified cert for Jitsi-Meet is not possible. + ''; + }; + xmppEnvironments = mkOption { description = '' XMPP servers to connect to. diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 945d42344a3c..9e5dbf1052bb 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -207,6 +207,7 @@ in jackett = handleTest ./jackett.nix {}; jellyfin = handleTest ./jellyfin.nix {}; jenkins = handleTest ./jenkins.nix {}; + jibri = handleTest ./jibri.nix {}; jirafeau = handleTest ./jirafeau.nix {}; jitsi-meet = handleTest ./jitsi-meet.nix {}; k3s = handleTest ./k3s.nix {}; diff --git a/nixos/tests/jibri.nix b/nixos/tests/jibri.nix new file mode 100644 index 000000000000..3dd28e6aac1a --- /dev/null +++ b/nixos/tests/jibri.nix @@ -0,0 +1,69 @@ +import ./make-test-python.nix ({ pkgs, ... }: { + name = "jibri"; + meta = with pkgs.lib; { + maintainers = teams.jitsi.members; + }; + + machine = { config, pkgs, ... }: { + virtualisation.memorySize = 5120; + + services.jitsi-meet = { + enable = true; + hostName = "machine"; + jibri.enable = true; + }; + services.jibri.ignoreCert = true; + services.jitsi-videobridge.openFirewall = true; + + networking.firewall.allowedTCPPorts = [ 80 443 ]; + + services.nginx.virtualHosts.machine = { + enableACME = true; + forceSSL = true; + }; + + security.acme.email = "me@example.org"; + security.acme.acceptTerms = true; + security.acme.server = "https://example.com"; # self-signed only + }; + + testScript = '' + machine.wait_for_unit("jitsi-videobridge2.service") + machine.wait_for_unit("jicofo.service") + machine.wait_for_unit("nginx.service") + machine.wait_for_unit("prosody.service") + machine.wait_for_unit("jibri.service") + + machine.wait_until_succeeds( + "journalctl -b -u jitsi-videobridge2 -o cat | grep -q 'Performed a successful health check'", timeout=30 + ) + machine.wait_until_succeeds( + "journalctl -b -u prosody -o cat | grep -q 'Authenticated as focus@auth.machine'", timeout=31 + ) + machine.wait_until_succeeds( + "journalctl -b -u prosody -o cat | grep -q 'Authenticated as jvb@auth.machine'", timeout=32 + ) + machine.wait_until_succeeds( + "journalctl -b -u prosody -o cat | grep -q 'Authenticated as jibri@auth.machine'", timeout=33 + ) + machine.wait_until_succeeds( + "cat /var/log/jitsi/jibri/log.0.txt | grep -q 'Joined MUC: jibribrewery@internal.machine'", timeout=34 + ) + + assert '"busyStatus":"IDLE","health":{"healthStatus":"HEALTHY"' in machine.succeed( + "curl -X GET http://machine:2222/jibri/api/v1.0/health" + ) + machine.succeed( + """curl -H "Content-Type: application/json" -X POST http://localhost:2222/jibri/api/v1.0/startService -d '{"sessionId": "RecordTest","callParams":{"callUrlInfo":{"baseUrl": "https://machine","callName": "TestCall"}},"callLoginParams":{"domain": "recorder.machine", "username": "recorder", "password": "'"$(cat /var/lib/jitsi-meet/jibri-recorder-secret)"'" },"sinkType": "file"}'""" + ) + machine.wait_until_succeeds( + "cat /var/log/jitsi/jibri/log.0.txt | grep -q 'File recording service transitioning from state Starting up to Running'", timeout=35 + ) + machine.succeed( + """sleep 15 && curl -H "Content-Type: application/json" -X POST http://localhost:2222/jibri/api/v1.0/stopService -d '{"sessionId": "RecordTest","callParams":{"callUrlInfo":{"baseUrl": "https://machine","callName": "TestCall"}},"callLoginParams":{"domain": "recorder.machine", "username": "recorder", "password": "'"$(cat /var/lib/jitsi-meet/jibri-recorder-secret)"'" },"sinkType": "file"}'""" + ) + machine.wait_until_succeeds( + "cat /var/log/jitsi/jibri/log.0.txt | grep -q 'Recording finalize script finished with exit value 0'", timeout=36 + ) + ''; +}) |