Author: ludo
Date: Thu Oct 7 16:58:07 2010
New Revision: 24148
URL: https://svn.nixos.org/websvn/nix/?rev=24148&sc=1
Log:
Add an Avahi (mDNS/DNS-SD) and NSS-mDNS test.
Added:
nixos/trunk/tests/avahi.nix
Modified:
nixos/trunk/tests/default.nix
Added: nixos/trunk/tests/avahi.nix
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ nixos/trunk/tests/avahi.nix Thu Oct 7 16:58:07 2010 (r24148)
@@ -0,0 +1,60 @@
+{ pkgs, ... }:
+
+with pkgs;
+
+{
+ nodes = {
+ one =
+ { config, pkgs, ... }: {
+ services.avahi.enable = true;
+ services.avahi.nssmdns = true;
+ };
+
+ two =
+ { config, pkgs, ... }: {
+ services.avahi.enable = true;
+ services.avahi.nssmdns = true;
+ };
+ };
+
+ # Test whether `avahi-daemon' and `libnss-mdns' work as expected.
+ testScript =
+ '' startAll;
+
+ # mDNS.
+ print STDERR
+ $one->mustSucceed("avahi-resolve-host-name one.local | tee out");
+ $one->mustSucceed("test \"`cut -f1 < out`\" = one.local");
+ print STDERR
+ $one->mustSucceed("avahi-resolve-host-name two.local | tee out");
+ $one->mustSucceed("test \"`cut -f1 < out`\" = two.local");
+
+ print STDERR
+ $two->mustSucceed("avahi-resolve-host-name one.local | tee out");
+ $two->mustSucceed("test \"`cut -f1 < out`\" = one.local");
+ print STDERR
+ $two->mustSucceed("avahi-resolve-host-name two.local | tee out");
+ $two->mustSucceed("test \"`cut -f1 < out`\" = two.local");
+
+ # Basic DNS-SD.
+ print STDERR
+ $one->mustSucceed("avahi-browse -r -t _workstation._tcp | tee out");
+ $one->mustSucceed("test `wc -l < out` -gt 0");
+ print STDERR
+ $two->mustSucceed("avahi-browse -r -t _workstation._tcp | tee out");
+ $two->mustSucceed("test `wc -l < out` -gt 0");
+
+ # More DNS-SD.
+ $one->execute("avahi-publish -s \"This is a test\" _test._tcp 123 one=1
&");
+ sleep 5;
+ print STDERR
+ $two->mustSucceed("avahi-browse -r -t _test._tcp | tee out");
+ $two->mustSucceed("test `wc -l < out` -gt 0");
+
+ # NSS-mDNS.
+ print STDERR $one->mustSucceed("ping -c1 one.local");
+ print STDERR $one->mustSucceed("ping -c1 two.local");
+ print STDERR $two->mustSucceed("ping -c1 one.local");
+ print STDERR $two->mustSucceed("ping -c1 two.local");
+ '';
+}
Modified: nixos/trunk/tests/default.nix
==============================================================================
--- nixos/trunk/tests/default.nix Thu Oct 7 15:14:15 2010 (r24147)
+++ nixos/trunk/tests/default.nix Thu Oct 7 16:58:07 2010 (r24148)
@@ -6,6 +6,7 @@
with import ../lib/testing.nix { inherit nixpkgs services system; };
{
+ avahi = makeTest (import ./avahi.nix);
bittorrent = makeTest (import ./bittorrent.nix);
firefox = makeTest (import ./firefox.nix);
installer = makeTests (import ./installer.nix);
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits