Unverified Commit 8e7ebfe4 authored by Franz Pletz's avatar Franz Pletz
Browse files

nixos/tests/mediamtx: make more robust, reformat

We're sleeping now until the timeout of the receive service is reached
to check for its state since it might fail until the stream is
available.
parent a8a3cf53
Loading
Loading
Loading
Loading
+49 −46
Original line number Diff line number Diff line
import ./make-test-python.nix ({ pkgs, lib, ...} :
import ./make-test-python.nix (
  { pkgs, lib, ... }:

  {
    name = "mediamtx";
    meta.maintainers = with lib.maintainers; [ fpletz ];

    nodes = {
    machine = { config, ... }: {
      machine = {
        services.mediamtx = {
          enable = true;
          settings = {
@@ -49,9 +50,11 @@ import ./make-test-python.nix ({ pkgs, lib, ...} :

      machine.wait_for_unit("mediamtx.service")
      machine.wait_for_unit("rtmp-publish.service")
      machine.sleep(10)
      machine.wait_for_unit("rtmp-receive.service")
      machine.wait_for_open_port(9998)
      machine.succeed("curl http://localhost:9998/metrics | grep '^rtmp_conns.*state=\"publish\".*1$'")
      machine.succeed("curl http://localhost:9998/metrics | grep '^rtmp_conns.*state=\"read\".*1$'")
    '';
})
  }
)