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.
This commit is contained in:
Franz Pletz 2024-05-13 23:47:34 +02:00
parent a8a3cf536e
commit 8e7ebfe4f5
No known key found for this signature in database
GPG Key ID: 846FDED7792617B4

View File

@ -1,11 +1,12 @@
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$'")
'';
})
}
)