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.
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
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
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
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' \
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};
55 _error_tolerance_filter
()
57 grep Discovered.pmcd.servers
:
58 # ignore everything else, incl. errors
61 # real QA test starts here
62 _control_service_discovery
64 # Obtain the inet address of an active network interface
65 # We're extracting a metric of the form:
67 # inst [0 or "eth0"] value "172.31.0.12"
69 # and then extracting the address
71 addr
=`pminfo -f network.interface.inet_addr | \
75 awk '{ print $6 }' | \
78 [ -z addr
] && _notrun
"no active inet interfaces"
80 # Probe the obtained network.
81 # Test various combinations of service queries and subnet sizes. Keep the
82 # subnet size small -- say max 4 bits.
83 echo "-m probe=$addr/32" >> $seq.full
84 echo "-m probe=INET_ADDR/32"
85 pmfind
-m probe
=$addr/32 | _unresolved_filter
86 echo "Exit status: $?" |
tee -a $seq.full
88 echo "-s pmcd -m probe=$addr/31" -r >> $seq.full
89 echo "-s pmcd -m probe=INET_ADDR/31 -r"
90 pmfind
-s pmcd
-m probe
=$addr/30 -r | _resolved_filter
91 echo "Exit status: $?" |
tee -a $seq.full
93 echo "-q -m probe=$addr/30" >> $seq.full
94 echo "-q -m probe=INET_ADDR/30"
95 pmfind
-q -m probe
=$addr/29 | _unresolved_filter
96 echo "Exit status: $?" |
tee -a $seq.full
98 echo "-q -s pmcd -m probe=$addr/29 --resolve" >> $seq.full
99 echo "-q -s pmcd -m probe=INET_ADDR/29 --resolve"
100 pmfind
-q -s pmcd
-m probe
=$addr/28 --resolve | _resolved_filter
101 echo "Exit status: $?" |
tee -a $seq.full
103 echo "-q -s pmcd -m probe=$addr/28,maxThreads=8" >> $seq.full
104 echo "-q -s pmcd -m probe=INET_ADDR/28,maxThreads=8"
105 pmfind
-q -s pmcd
-m probe
=$addr/28,maxThreads
=8 | _unresolved_filter
106 echo "Exit status: $?" |
tee -a $seq.full
108 # Try to cause errors; check pmprintf path doesn't blow stack
109 # pmfind just needs to survive to its result message
110 echo "ulimit -n 10" >> $seq.full
112 bash
-c "ulimit -n 10; pmfind -s pmcd -m probe=127.0.0.1/24,maxThreads=64" 2>&1 |
tee -a $seq.full | _error_tolerance_filter
113 echo "Exit status: $?" |
tee -a $seq.full