qa: update 660 to generate index.html, fixing pcp-testsuite runs
[pcp.git] / qa / 766
blob4ee91dedb456fa48e899f7f60f83590633fda7cf
1 #!/bin/sh
2 # PCP QA Test No. 766
3 # Test using the pmfind app to find PCP servers using the active probing
4 # discovery mechanism. Probe inet only.
6 # Copyright (c) 2014 Red Hat. All Rights Reserved.
9 seq=`basename $0`
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
13 . ./common.discovery
15 _get_libpcp_config
16 $service_discovery || _notrun "No support for service discovery"
18 status=1 # failure is the default!
19 $sudo rm -rf $tmp.* $seq.full
20 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
22 _sought_filter()
24 # Only pmcd is guaranteed to be running, but other services may also be.
25 # Transform two cases - no servers vs found servers - into deterministic
26 # output for the --all invocations
27 sed \
28 -e 's/No \(pmproxy servers\) discovered/Sought \1/g' \
29 -e 's/No \(pmwebd servers\) discovered/Sought \1/g' \
30 -e 's/Discovered \(pmproxy servers\):/Sought \1/g' \
31 -e 's/Discovered \(pmwebd servers\):/Sought \1/g' \
32 # end
35 _unresolved_filter()
37 sed -e '/ pcp:/d;
38 / proxy:/d;
39 / http:/d' \
40 | _sought_filter
43 _resolved_filter()
45 # Pass unresolved urls, filter the resolved ones.
46 sed -e '/ pcp:\/\/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/{p;b};
47 / proxy:\/\/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/{p;b};
48 / http:\/\/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/{p;b};
49 / pcp:/d;
50 / proxy:/d;
51 / http:/d' \
52 | _sought_filter
55 # real QA test starts here
56 _control_service_discovery
58 # Obtain the inet address of an active network interface
59 # We're extracting a metric of the form:
61 # inst [0 or "eth0"] value "172.31.0.12"
63 # and then extracting the address
65 addr=`pminfo -f network.interface.inet_addr | \
66 tail -n +3 | \
67 grep -v 127.0.0.1 | \
68 head -n1 | \
69 awk '{ print $6 }' | \
70 sed s/\"//g`
72 [ -z addr ] && _notrun "no active inet interfaces"
74 # Probe the obtained network.
75 # Test various combinations of service queries and subnet sizes. Keep the
76 # subnet size small -- say max 4 bits.
77 echo "-m probe=$addr/32" >> $seq.full
78 echo "-m probe=INET_ADDR/32"
79 pmfind -m probe=$addr/32 | _unresolved_filter
80 echo "Exit status: $?" | tee -a $seq.full
82 echo "-s pmcd -m probe=$addr/31" -r >> $seq.full
83 echo "-s pmcd -m probe=INET_ADDR/31 -r"
84 pmfind -s pmcd -m probe=$addr/30 -r | _resolved_filter
85 echo "Exit status: $?" | tee -a $seq.full
87 echo "-q -m probe=$addr/30" >> $seq.full
88 echo "-q -m probe=INET_ADDR/30"
89 pmfind -q -m probe=$addr/29 | _unresolved_filter
90 echo "Exit status: $?" | tee -a $seq.full
92 echo "-q -s pmcd -m probe=$addr/29 --resolve" >> $seq.full
93 echo "-q -s pmcd -m probe=INET_ADDR/29 --resolve"
94 pmfind -q -s pmcd -m probe=$addr/28 --resolve | _resolved_filter
95 echo "Exit status: $?" | tee -a $seq.full
97 echo "-q -s pmcd -m probe=$addr/28,maxThreads=8" >> $seq.full
98 echo "-q -s pmcd -m probe=INET_ADDR/28,maxThreads=8"
99 pmfind -q -s pmcd -m probe=$addr/28,maxThreads=8 | _unresolved_filter
100 echo "Exit status: $?" | tee -a $seq.full
102 # success, all done
103 status=0
105 exit