Drop unused condition check
[pcp.git] / qa / 1008
blob3041981b2775494812b4a61af676bf2a50cc23f4
1 #!/bin/sh
2 # PCP QA Test No. 1008
3 # Metrics class error handling, instance matching etc.
5 seq=`basename $0`
6 echo "QA output created by $seq"
8 status=1 # failure is the default!
9 . ./common.qt
10 trap "_cleanup_qt; exit \$status" 0 1 2 3 15
12 which pmdumptext >/dev/null 2>&1 || _notrun "pmdumptext not installed"
14 # real QA test starts here
15 localhost=$host
16 otherhost=no.such.host.pcp.io
17 dump="pmdumptext -s 1"
18 tz=`pmprobe -v pmcd.timezone | sed -e 's/.* "//' -e 's/"//'`
20 _filter()
22 sed \
23 -e "s/$otherhost[\.a-zA-Z0-9\-]*/OTHER_HOST/g" \
24 -e "s/$localhost[\.a-zA-Z0-9\-]*/THIS_HOST/g" \
25 -e "s#$tz#TZ#"
28 echo "--- bogus host ---"
29 $dump -h bogus.host.i.hope hinv.ncpu 2>&1 | _filter
30 $dump bogus.host.i.hope:hinv.ncpu 2>&1 | _filter
32 echo "--- bogus archive ---"
33 $dump -a bogus_archive_i_hope 2>&1 | _filter
34 $dump bogus_archive_i_hope/hinv.ncpu 2>&1 | _filter
36 echo "--- bogus metric ---"
37 $dump go.faster 2>&1 | _filter
39 echo "--- bogus instance ---"
40 $dump "kernel.percpu.cpu.user[cpu999999]" 2>&1 | _filter
42 echo "--- metric has no instances ---"
43 $dump "hinv.ncpu[cpu0]" 2>&1 | _filter
45 echo "--- matching instances up to leading space ---"
46 $dump -imC "kernel.all.load[15,5,1]" 2>&1 | _filter
48 echo "--- two archives from the same host ---"
49 $dump -a archives/gap,archives/gap2 hinv.ncpu
50 $dump -a archives/gap2 archives/gap/hinv.ncpu
52 echo "--- no matching archive for host ---"
53 $dump -a archives/gap ${otherhost}:hinv.ncpu 2>&1 | _filter
55 echo "--- live and archive contexts ---"
56 $dump -h $localhost archives/gap/hinv.ncpu 2>&1 | _filter
58 echo "--- handle a string or aggregate metric ---"
59 $dump -f "TIME:" pmcd.timezone sample.sysinfo 2>&1 | _filter
61 # success, all done
62 status=0
63 exit