mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 11:45:45 +03:00
nixos/tests/mediamtx: make more robust
This commit is contained in:
parent
0554b1dde5
commit
b877d063fb
1 changed files with 12 additions and 8 deletions
|
@ -1,5 +1,8 @@
|
||||||
{ pkgs, lib, ... }:
|
{ pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
rtmpUrl = "rtmp://localhost:1935/test";
|
||||||
|
in
|
||||||
{
|
{
|
||||||
name = "mediamtx";
|
name = "mediamtx";
|
||||||
meta.maintainers = with lib.maintainers; [ fpletz ];
|
meta.maintainers = with lib.maintainers; [ fpletz ];
|
||||||
|
@ -23,8 +26,8 @@
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = "1s";
|
RestartSec = "1s";
|
||||||
TimeoutStartSec = "10s";
|
TimeoutStartSec = "30s";
|
||||||
ExecStart = "${lib.getBin pkgs.ffmpeg-headless}/bin/ffmpeg -re -f lavfi -i smptebars=size=800x600:rate=10 -c libx264 -f flv rtmp://localhost:1935/test";
|
ExecStart = "${lib.getBin pkgs.ffmpeg-headless}/bin/ffmpeg -re -f lavfi -i smptebars=size=800x600:rate=10 -c libx264 -f flv ${rtmpUrl}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -33,12 +36,13 @@
|
||||||
after = [ "rtmp-publish.service" ];
|
after = [ "rtmp-publish.service" ];
|
||||||
bindsTo = [ "rtmp-publish.service" ];
|
bindsTo = [ "rtmp-publish.service" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
unitConfig.StartLimitIntervalSec = 0;
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = "1s";
|
RestartSec = "1s";
|
||||||
TimeoutStartSec = "10s";
|
TimeoutStartSec = "30s";
|
||||||
ExecStart = "${lib.getBin pkgs.ffmpeg-headless}/bin/ffmpeg -y -re -i rtmp://localhost:1935/test -f flv /dev/null";
|
ExecStart = "${lib.getBin pkgs.ffmpeg-headless}/bin/ffmpeg -y -re -i ${rtmpUrl} -f flv /dev/null";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -48,11 +52,11 @@
|
||||||
start_all()
|
start_all()
|
||||||
|
|
||||||
machine.wait_for_unit("mediamtx.service")
|
machine.wait_for_unit("mediamtx.service")
|
||||||
|
|
||||||
machine.wait_for_unit("rtmp-publish.service")
|
machine.wait_for_unit("rtmp-publish.service")
|
||||||
machine.sleep(10)
|
machine.wait_until_succeeds("curl http://localhost:9998/metrics | grep '^rtmp_conns.*state=\"publish\".*1$'")
|
||||||
|
|
||||||
machine.wait_for_unit("rtmp-receive.service")
|
machine.wait_for_unit("rtmp-receive.service")
|
||||||
machine.wait_for_open_port(9998)
|
machine.wait_until_succeeds("curl http://localhost:9998/metrics | grep '^rtmp_conns.*state=\"read\".*1$'")
|
||||||
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$'")
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue