Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 892
blobf19542520726e181ba12263938efcac80ba440f4
1 #!/bin/sh
2 # PCP QA Test No. 892
3 # Exercise daemon local-only access in IPv6 mode.
5 # Copyright (c) 2015 Red Hat.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 _get_libpcp_config
17 $ipv6 || _notrun "IPv6 support is not available"
18 host=`hostname`
19 [ -z "$host" ] && _notrun "Cannot discover local host name"
20 addr=`_host_to_ipv6addrs $host | head -1`
21 [ -z "$addr" ] && _notrun "Cannot translate hostname ($host) to IPv6 address"
22 ipv6local=`_ipv6_localhost`
24 status=1 # failure is the default!
25 $sudo rm -rf $tmp.* $seq.full
27 _cleanup()
29 # ensure we do not leave local-only settings enabled
30 _restore_config $PCP_SYSCONFIG_DIR/pmcd
32 $sudo $PCP_RC_DIR/pcp restart 2>&1 | _filter_pcp_stop | _filter_pcp_start
33 _wait_for_pmcd
34 _wait_for_pmlogger
36 rm -rf $tmp.*
39 _filter()
41 tee -a $seq.full | \
42 sed \
43 -e "s/$host/HOSTNAME/g" \
44 -e "s/$addr/IPV6ADDR/g" \
45 #end
47 trap "_cleanup; exit \$status" 0 1 2 3 15
49 # real QA test starts here
50 echo "Using IPv6 addr=$addr" > $seq.full
52 _save_config $PCP_SYSCONFIG_DIR/pmcd
54 echo; echo "== checking loop pmcd access, expecting success"
55 pminfo -f -h "pcp://$ipv6local" pmcd.feature.local 2>&1 | _filter
57 echo; echo "== checking ipv6 pmcd access, expecting success"
58 pminfo -f -h "pcp://[$addr]" pmcd.feature.local 2>&1 | _filter
60 echo; echo "== changing default setup to local host only"; echo
61 echo "# Dummy entry added by PCP QA test $seq" > $tmp.local
62 echo PMCD_LOCAL=1 >> $tmp.local
63 $sudo cp $tmp.local $PCP_SYSCONFIG_DIR/pmcd
65 $sudo $PCP_RC_DIR/pmcd restart 2>&1 | _filter_pcp_stop | _filter_pcp_start
66 _wait_for_pmcd
68 echo; echo "== checking loop pmcd access, expecting success"
69 pminfo -f -h "pcp://$ipv6local" pmcd.feature.local 2>&1 | _filter
71 echo; echo "== checking bad pmcd access, expect no values"
72 pminfo -f -h "pcp://[$addr]" pmcd.feature.local 2>&1 | _filter
74 # success, all done
75 status=0
76 exit