2019-12-24 15:10:34 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} :
|
2014-04-01 04:33:46 +00:00
|
|
|
|
|
|
|
let
|
2018-07-20 20:56:59 +00:00
|
|
|
client = { pkgs, ... }: {
|
2014-04-01 04:33:46 +00:00
|
|
|
imports = [ ./common/x11.nix ];
|
|
|
|
environment.systemPackages = [ pkgs.mumble ];
|
|
|
|
};
|
2020-10-07 09:27:05 +00:00
|
|
|
|
|
|
|
# outside of tests, this file should obviously not come from the nix store
|
|
|
|
envFile = pkgs.writeText "nixos-test-mumble-murmurd.env" ''
|
|
|
|
MURMURD_PASSWORD=testpassword
|
|
|
|
'';
|
|
|
|
|
2014-04-01 04:33:46 +00:00
|
|
|
in
|
|
|
|
{
|
2014-06-28 14:04:49 +00:00
|
|
|
name = "mumble";
|
2021-01-10 19:08:30 +00:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2019-02-22 15:14:13 +00:00
|
|
|
maintainers = [ thoughtpolice eelco ];
|
2015-07-12 10:09:40 +00:00
|
|
|
};
|
2014-06-28 14:04:49 +00:00
|
|
|
|
2014-04-01 04:33:46 +00:00
|
|
|
nodes = {
|
2018-07-20 20:56:59 +00:00
|
|
|
server = { config, ... }: {
|
2023-07-08 23:01:03 +00:00
|
|
|
security.apparmor.enable = true;
|
2020-10-07 09:27:05 +00:00
|
|
|
services.murmur.enable = true;
|
2014-04-01 04:33:46 +00:00
|
|
|
services.murmur.registerName = "NixOS tests";
|
2020-10-07 09:27:05 +00:00
|
|
|
services.murmur.password = "$MURMURD_PASSWORD";
|
|
|
|
services.murmur.environmentFile = envFile;
|
2014-04-11 15:15:56 +00:00
|
|
|
networking.firewall.allowedTCPPorts = [ config.services.murmur.port ];
|
2014-04-01 04:33:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
client1 = client;
|
|
|
|
client2 = client;
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
2019-12-24 15:10:34 +00:00
|
|
|
start_all()
|
2014-04-01 04:33:46 +00:00
|
|
|
|
2019-12-24 15:10:34 +00:00
|
|
|
server.wait_for_unit("murmur.service")
|
|
|
|
client1.wait_for_x()
|
|
|
|
client2.wait_for_x()
|
2014-04-01 04:33:46 +00:00
|
|
|
|
2021-11-05 00:43:22 +00:00
|
|
|
client1.execute("mumble mumble://client1:testpassword\@server/test >&2 &")
|
|
|
|
client2.execute("mumble mumble://client2:testpassword\@server/test >&2 &")
|
2014-04-01 04:33:46 +00:00
|
|
|
|
|
|
|
# cancel client audio configuration
|
2019-12-24 15:10:34 +00:00
|
|
|
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")
|
2014-04-01 04:33:46 +00:00
|
|
|
|
|
|
|
# cancel client cert configuration
|
2019-12-24 15:10:34 +00:00
|
|
|
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")
|
2014-04-01 04:33:46 +00:00
|
|
|
|
|
|
|
# accept server certificate
|
2019-12-24 15:10:34 +00:00
|
|
|
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
|
2016-09-12 21:07:48 +00:00
|
|
|
|
|
|
|
# sometimes the wrong of the 2 windows is focused, we switch focus and try pressing "y" again
|
2019-12-24 15:10:34 +00:00
|
|
|
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")
|
2014-04-01 04:33:46 +00:00
|
|
|
|
|
|
|
# Find clients in logs
|
2020-10-07 09:27:05 +00:00
|
|
|
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'"
|
|
|
|
)
|
2014-04-01 04:33:46 +00:00
|
|
|
|
2019-12-24 15:10:34 +00:00
|
|
|
server.sleep(5) # wait to get screenshot
|
|
|
|
client1.screenshot("screen1")
|
|
|
|
client2.screenshot("screen2")
|
2023-07-08 23:01:03 +00:00
|
|
|
|
|
|
|
# check if apparmor denied anything
|
|
|
|
server.fail('journalctl -b --no-pager --grep "^audit: .*apparmor=\\"DENIED\\""')
|
2014-04-01 04:33:46 +00:00
|
|
|
'';
|
2014-04-14 12:02:44 +00:00
|
|
|
})
|