<commit_before>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 = "<EMAIL>";
      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 <EMAIL>'", timeout=31
    )
    machine.wait_until_succeeds(
        "journalctl -b -u prosody -o cat | grep -q 'Authenticated as <EMAIL>'", timeout=32
    )
    machine.wait_until_succeeds(
        "journalctl -b -u prosody -o cat | grep -q 'Authenticated as <EMAIL>'", timeout=33
    )
    machine.wait_until_succeeds(
        "cat /var/log/jitsi/jibri/log.0.txt | grep -q 'Joined MUC: <EMAIL>'", 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
    )
  '';
})
<commit_msg>nixos/tests/jibri: updated test with a new log message<commit_after>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 = "<EMAIL>";
      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 <EMAIL>'", timeout=31
    )
    machine.wait_until_succeeds(
        "journalctl -b -u prosody -o cat | grep -q 'Authenticated as <EMAIL>'", timeout=32
    )
    machine.wait_until_succeeds(
        "journalctl -b -u prosody -o cat | grep -q 'Authenticated as <EMAIL>'", timeout=33
    )
    machine.wait_until_succeeds(
        "cat /var/log/jitsi/jibri/log.0.txt | grep -q 'Joined MUC: <EMAIL>'", 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 'Finalize script finished with exit value 0'", timeout=36
    )
  '';
})

{'fraction_non_alphanumeric': 0.16718215855445223, 'fraction_numerical': 0.015953117369363504, 'mean_word_length': 3.2460262612301314, 'pattern_counts': {'":': 46, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '620807', 'n_tokens_mistral': 2251, 'n_tokens_neox': 2117, 'n_words': 392}