nixpkgs/nixos/tests/mumble.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

96 lines
3.0 KiB
Nix

import ./make-test-python.nix (
{ pkgs, ... }:
let
client =
{ pkgs, ... }:
{
imports = [ ./common/x11.nix ];
environment.systemPackages = [ pkgs.mumble ];
};
# outside of tests, this file should obviously not come from the nix store
envFile = pkgs.writeText "nixos-test-mumble-murmurd.env" ''
MURMURD_PASSWORD=testpassword
'';
in
{
name = "mumble";
meta = with pkgs.lib.maintainers; {
maintainers = [ thoughtpolice ];
};
nodes = {
server =
{ config, ... }:
{
security.apparmor.enable = true;
services.murmur.enable = true;
services.murmur.registerName = "NixOS tests";
services.murmur.password = "$MURMURD_PASSWORD";
services.murmur.environmentFile = envFile;
networking.firewall.allowedTCPPorts = [ config.services.murmur.port ];
};
client1 = client;
client2 = client;
};
testScript = ''
start_all()
server.wait_for_unit("murmur.service")
client1.wait_for_x()
client2.wait_for_x()
client1.execute("mumble mumble://client1:testpassword\@server/test >&2 &")
client2.execute("mumble mumble://client2:testpassword\@server/test >&2 &")
# cancel client audio configuration
client1.wait_for_window(r"Audio Tuning Wizard")
client2.wait_for_window(r"Audio Tuning Wizard")
server.sleep(5) # wait because mumble is slow to register event handlers
client1.send_key("esc")
client2.send_key("esc")
# cancel client cert configuration
client1.wait_for_window(r"Certificate Management")
client2.wait_for_window(r"Certificate Management")
server.sleep(5) # wait because mumble is slow to register event handlers
client1.send_key("esc")
client2.send_key("esc")
# accept server certificate
client1.wait_for_window(r"^Mumble$")
client2.wait_for_window(r"^Mumble$")
server.sleep(5) # wait because mumble is slow to register event handlers
client1.send_chars("y")
client2.send_chars("y")
server.sleep(5) # wait because mumble is slow to register event handlers
# sometimes the wrong of the 2 windows is focused, we switch focus and try pressing "y" again
client1.send_key("alt-tab")
client2.send_key("alt-tab")
server.sleep(5) # wait because mumble is slow to register event handlers
client1.send_chars("y")
client2.send_chars("y")
# Find clients in logs
server.wait_until_succeeds(
"journalctl -eu murmur -o cat | grep -q 'client1.\+Authenticated'"
)
server.wait_until_succeeds(
"journalctl -eu murmur -o cat | grep -q 'client2.\+Authenticated'"
)
server.sleep(5) # wait to get screenshot
client1.screenshot("screen1")
client2.screenshot("screen2")
# check if apparmor denied anything
server.fail('journalctl -b --no-pager --grep "^audit: .*apparmor=\\"DENIED\\""')
'';
}
)