1 { system ? builtins.currentSystem
3 , pkgs ? import ../.. { inherit system config; }
4 # bool: whether to use networkd in the tests
8 # Test whether `avahi-daemon' and `libnss-mdns' work as expected.
9 import ./make-test-python.nix {
11 meta = with pkgs.lib.maintainers; {
20 publish.addresses = true;
21 publish.domain = true;
22 publish.enable = true;
23 publish.userServices = true;
24 publish.workstation = true;
25 extraServiceFiles.ssh = "${pkgs.avahi}/etc/avahi/services/ssh.service";
27 } // pkgs.lib.optionalAttrs (networkd) {
42 one.wait_for_unit("network.target")
43 two.wait_for_unit("network.target")
45 one.succeed("avahi-resolve-host-name one.local | tee out >&2")
46 one.succeed('test "`cut -f1 < out`" = one.local')
47 one.succeed("avahi-resolve-host-name two.local | tee out >&2")
48 one.succeed('test "`cut -f1 < out`" = two.local')
50 two.succeed("avahi-resolve-host-name one.local | tee out >&2")
51 two.succeed('test "`cut -f1 < out`" = one.local')
52 two.succeed("avahi-resolve-host-name two.local | tee out >&2")
53 two.succeed('test "`cut -f1 < out`" = two.local')
56 one.succeed("avahi-browse -r -t _workstation._tcp | tee out >&2")
57 one.succeed("test `wc -l < out` -gt 0")
58 two.succeed("avahi-browse -r -t _workstation._tcp | tee out >&2")
59 two.succeed("test `wc -l < out` -gt 0")
62 one.execute('avahi-publish -s "This is a test" _test._tcp 123 one=1 >&2 &')
64 two.succeed("avahi-browse -r -t _test._tcp | tee out >&2")
65 two.succeed("test `wc -l < out` -gt 0")
68 one.succeed("getent hosts one.local >&2")
69 one.succeed("getent hosts two.local >&2")
70 two.succeed("getent hosts one.local >&2")
71 two.succeed("getent hosts two.local >&2")
73 # extra service definitions
74 one.succeed("avahi-browse -r -t _ssh._tcp | tee out >&2")
75 one.succeed("test `wc -l < out` -gt 0")
76 two.succeed("avahi-browse -r -t _ssh._tcp | tee out >&2")
77 two.succeed("test `wc -l < out` -gt 0")