File: 1389

package info (click to toggle)
pcp 4.3.2%2Breally4.3.1-0.1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 175,188 kB
  • sloc: ansic: 261,305; sh: 123,606; xml: 107,279; cpp: 72,127; perl: 18,283; python: 15,453; yacc: 8,249; lex: 2,585; makefile: 1,957; fortran: 60; java: 52
file content (108 lines) | stat: -rwxr-xr-x 2,533 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#! /bin/sh
# PCP QA Test No. 1389
# checks pmwebd graphite support for multi-volume archives
#
# Copyright (c) 2018 Red Hat.
#
seq=`basename $0`
echo "QA output created by $seq"

. ./common.webapi

_check_pmwebd
which curl >/dev/null 2>&1 || _notrun "No curl binary installed"

$sudo rm -fr $tmp.dir
$sudo rm -f $tmp.*
rm -f $seq.full

signal=$PCP_BINADM_DIR/pmsignal
status=1	# failure is the default!
username=`id -u -n`

_cleanup()
{
    $sudo rm -fr $tmp.dir
    $sudo rm -f $tmp.*
    kill $pmlogger_pid 2>/dev/null
    kill $pmwebd_pid 2>/dev/null
}
trap "_cleanup; exit \$status" 0 1 2 3 15

_filter_datapoints()
{
    sed -e 's/.datapoints.*$/DATAPOINTS]/g'
}

# real QA test starts here
webport=44339   # not 44323, so system pmwebd is unaffected by test case
webargs="-U $username -p $webport"

echo
echo "=== start pmlogger ===" | tee -a $seq.full

mkdir -p -m 777 $tmp.dir   # 777: as pmlogger runs as uid=pcp
cat > $tmp.dir/pmlogger.config <<EOF
log mandatory on every 1 sec { simple.numfetch }
EOF

_start_up_pmlogger -c $tmp.dir/pmlogger.config -l $tmp.pmlogger.log $tmp.dir/archive # sets $pid
pmlogger_pid=$pid
pmsleep 5

echo
echo "=== create a few volumes ===" | tee -a $seq.full

pmsleep 5
$sudo $signal -s HUP $pid

pmsleep 5
$sudo $signal -s HUP $pid


# Force super early mtimes, so as to trigger the pmwebd
# freshness_ratio optimization.  In reality, the subject
# phenomenon can be observed with a few hours' difference.

$sudo touch -t 201801010001 $tmp.dir/archive.0
$sudo touch -t 201801010001 $tmp.dir/archive.1

ls -al $tmp.dir >> $seq.full

echo
echo "=== start pmwebd ===" | tee -a $seq.full

$PCP_BINADM_DIR/pmwebd $webargs -GX -I -i 1 -A $tmp.dir -N -M8 -d1 -vvvvv -l $tmp.pmwebd.log &
pmwebd_pid=$!
_wait_for_pmwebd_logfile $tmp.pmwebd.log $webport

echo
echo "=== talk to pmwebd for a few minutes ===" | tee -a $seq.full

url="http://localhost:$webport/graphite/render?format=json&target=*.simple.numfetch&from=-5s&until=now"

curl -s -S "$url" | tee -a $seq.full | _filter_datapoints
echo

pmsleep 60   # pmgraphite.cxx ac_refresh_all() min_refresh_interval
$sudo $signal -s HUP $pid; pmsleep 1.1
curl -s -S "$url" | tee -a $seq.full | _filter_datapoints
echo

pmsleep 60
$sudo $signal -s HUP $pid; pmsleep 1.1
curl -s -S "$url" | tee -a $seq.full | _filter_datapoints
echo

echo
echo "=== cleanup ===" | tee -a $seq.full

grep . $tmp.*.log >> $seq.full

$sudo $signal -s TERM $pmwebd_pid
$sudo $signal -s TERM $pid
_wait_pmlogger_end $pid
_filter_pmlogger_log <$tmp.pmlogger.log

status=0
exit