Debian Codegraph @

debian/tests/remove-reinstall

raw
1 #!/bin/sh
2
3 set -e
4
5 . debian/tests/lib.sh
6
7 require_apt
8 require_host_getent
9
10 distinctive_hostname="nss-mdns-test-$(dbus-uuidgen)"
11
12 assert_succeeds avahi-set-host-name "$distinctive_hostname"
13 sleep 3
14
15 pkg="libnss-mdns${host_suffix}"
16 assert_succeeds apt-get -y purge "$pkg"
17
18 assert_succeeds perl -i -pe 's/^hosts:.*/hosts: files dns/' /etc/nsswitch.conf
19
20 assert_succeeds apt-get -y install "$pkg"
21 assert_hosts "hosts: files mdns4_minimal [NOTFOUND=return] dns"
22
23 assert_succeeds "$host_getent" hosts "$distinctive_hostname.local"
24
25 assert_succeeds apt-get -y remove "$pkg"
26 # No assertion about whether it's in nsswitch.conf: debian/tests/nss-behaviour
27 # demonstrates that it doesn't actually matter
28 assert_status 2 "$host_getent" hosts "$distinctive_hostname.local"
29
30 echo "# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=500478"
31 echo "# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=782282"
32 assert_succeeds apt-get -y install "$pkg"
33 assert_hosts "hosts: files mdns4_minimal [NOTFOUND=return] dns"
34 if [ -z "$DEB_HOST_ARCH" ]; then
35 assert_succeeds "$host_getent" hosts "$distinctive_hostname.local"
36 fi
37
38 assert_succeeds apt-get -y purge "$pkg"
39 assert_hosts "hosts: files dns"
40 assert_status 2 "$host_getent" hosts "$distinctive_hostname.local"
41
42 finish
43
44 # vim:set sw=4 sts=4 et: