vuls: init at 0.27.0
[NixPkgs.git] / nixos / tests / jibri.nix
blob45e30af9a9a55bd64b1da45da8e862adc2443117
1 import ./make-test-python.nix ({ pkgs, ... }: {
2   name = "jibri";
3   meta = with pkgs.lib; {
4     maintainers = teams.jitsi.members;
5   };
7     nodes.machine = { config, pkgs, ... }: {
8       virtualisation.memorySize = 5120;
10       services.jitsi-meet = {
11         enable = true;
12         hostName = "machine";
13         jibri.enable = true;
14       };
15       services.jibri.ignoreCert = true;
16       services.jitsi-videobridge.openFirewall = true;
18       networking.firewall.allowedTCPPorts = [ 80 443 ];
20       services.nginx.virtualHosts.machine = {
21         enableACME = true;
22         forceSSL = true;
23       };
25       security.acme.email = "me@example.org";
26       security.acme.acceptTerms = true;
27       security.acme.server = "https://example.com"; # self-signed only
28     };
30   testScript = ''
31     machine.wait_for_unit("jitsi-videobridge2.service")
32     machine.wait_for_unit("jicofo.service")
33     machine.wait_for_unit("nginx.service")
34     machine.wait_for_unit("prosody.service")
35     machine.wait_for_unit("jibri.service")
37     machine.wait_until_succeeds(
38         "journalctl -b -u prosody -o cat | grep -q 'Authenticated as focus@auth.machine'", timeout=31
39     )
40     machine.wait_until_succeeds(
41         "journalctl -b -u prosody -o cat | grep -q 'Authenticated as jvb@auth.machine'", timeout=32
42     )
43     machine.wait_until_succeeds(
44         "journalctl -b -u prosody -o cat | grep -q 'Authenticated as jibri@auth.machine'", timeout=33
45     )
46     machine.wait_until_succeeds(
47         "cat /var/log/jitsi/jibri/log.0.txt | grep -q 'Joined MUC: jibribrewery@internal.machine'", timeout=34
48     )
50     assert '"busyStatus":"IDLE","health":{"healthStatus":"HEALTHY"' in machine.succeed(
51         "curl -X GET http://machine:2222/jibri/api/v1.0/health"
52     )
53     machine.succeed(
54         """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"}'"""
55     )
56     machine.wait_until_succeeds(
57         "cat /var/log/jitsi/jibri/log.0.txt | grep -q 'File recording service transitioning from state Starting up to Running'", timeout=35
58     )
59     machine.succeed(
60         """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"}'"""
61     )
62     machine.wait_until_succeeds(
63         "cat /var/log/jitsi/jibri/log.0.txt | grep -q 'Finalize script finished with exit value 0'", timeout=36
64     )
65   '';