Merge branch 'master' of https://github.com/kmcdonell/pcp into kenj-merge
[pcp.git] / qa / 909
blob225aaf61a616d7e3cc0eb250f829ff1464cf996d
1 #!/bin/sh
2 # PCP QA Test No. 909
3 # exercise pmLookupName(), especially with dynamic metrics as
4 # per email enquiry from Martins Innus circa 03 Apr 2015
6 # Copyright (c) 2015 Ken McDonell. All Rights Reserved.
9 seq=`basename $0`
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
13 . ./common.product
14 . ./common.filter
15 . ./common.check
17 status=1 # failure is the default!
18 $sudo rm -rf $tmp.* $seq.full
19 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
21 host=`pmhostname`
23 _filter_host()
25 sed \
26 -e "s/$host/HOST/g" \
27 # end
30 _filter_tmp()
32 sed \
33 -e "s@$tmp@TMP@g" \
34 # end
37 cat >$tmp.pmns <<End-of-File
38 root {
39 sampledso
40 noagent 246:*:*
42 sampledso {
43 bin 30:0:6
44 drift 30:0:7
45 long
46 secret 30:*:*
48 sampledso.long {
49 one 30:0:10
50 ten 30:0:11
52 End-of-File
54 # real QA test starts here
56 echo "simple error cases ..."
57 src/lookupnametest
58 echo
59 src/lookupnametest sampledso.no.such.name
60 echo
61 src/lookupnametest bad.metric.name
62 echo
63 src/lookupnametest sampledso.long.one sampledso.no.such.name sampledso.long.ten bad.metric.name
64 echo
65 src/lookupnametest -n $tmp.pmns sampledso.long.one sampledso.no.such.name sampledso.long.ten bad.metric.name | _filter_tmp
67 echo
68 echo "simple cases ..."
69 src/lookupnametest sampledso.drift
70 echo
71 $sudo_local_ctx src/lookupnametest -L sampledso.drift
72 echo
73 src/lookupnametest -h $host sampledso.drift | _filter_host
74 echo
75 src/lookupnametest -a archives/dynmetric sampledso.drift
76 echo
77 src/lookupnametest -n $tmp.pmns sampledso.drift | _filter_tmp
79 echo
80 echo "add non-terminal ..."
81 src/lookupnametest sampledso.drift sampledso sampledso.bin
82 echo
83 $sudo_local_ctx src/lookupnametest -L sampledso.drift sampledso sampledso.bin
84 echo
85 src/lookupnametest -h $host sampledso.drift sampledso sampledso.bin | _filter_host
86 echo
87 src/lookupnametest -a archives/dynmetric sampledso.drift sampledso sampledso.bin
89 echo
90 echo "swap non-terminal for valid dynamic metric ..."
91 src/lookupnametest sampledso.drift sampledso.secret.bar sampledso.bin
92 echo
93 $sudo_local_ctx src/lookupnametest -L sampledso.drift sampledso.secret.bar sampledso.bin
94 echo
95 src/lookupnametest -h $host sampledso.drift sampledso.secret.bar sampledso.bin | _filter_host
96 echo
97 src/lookupnametest -a archives/dynmetric sampledso.drift sampledso.secret.bar sampledso.bin
99 echo
100 echo "swap valid dynamic metric for invalid dynamic metrics ..."
101 src/lookupnametest sampledso.drift sampledso.secret sampledso.secret.foo.zero sampledso.bin
102 echo
103 $sudo_local_ctx src/lookupnametest -L sampledso.drift sampledso.secret sampledso.secret.foo.zero sampledso.bin
104 echo
105 src/lookupnametest -h $host sampledso.drift sampledso.secret sampledso.secret.foo.zero sampledso.bin | _filter_host
106 echo
107 src/lookupnametest -a archives/dynmetric sampledso.secret sampledso.drift sampledso.secret.foo.zero sampledso.bin
109 echo
110 echo "some no agent cases ..."
111 echo
112 $sudo_local_ctx src/lookupnametest -L sampledso.secret.bar sample.secret.bar
113 echo
114 src/lookupnametest -n $tmp.pmns noagent sampledso.bin sampledso.secret.bar | _filter_tmp
115 #echo
116 #$sudo_local_ctx src/lookupnametest -L -n $tmp.pmns noagent | _filter_tmp
119 # success, all done
120 status=0
122 exit