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
|
#!/bin/sh
# PCP QA Test No. 1877
# Verify that pmproxy does not connect to key server if not required
#
# Copyright (c) 2021 Red Hat. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
_check_key_server
_cleanup()
{
cd $here
[ -n "$pmproxy_pid" ] && $signal -s TERM $pmproxy_pid
$sudo rm -rf $tmp $tmp.*
}
status=0 # success is the default!
signal=$PCP_BINADM_DIR/pmsignal
username=`id -u -n`
trap "_cleanup; exit \$status" 0 1 2 3 15
# real QA test starts here
echo
echo "=== empty configuration file, key server not required"
echo > $tmp.pmproxy.conf
pmproxyport=`_find_free_port`
pmproxy -f -U $username -x $tmp.err -l $tmp.pmproxy.log -p $pmproxyport -s $tmp.pmproxy.socket -c $tmp.pmproxy.conf &
pmproxy_pid=$!
# check pmproxy has started and is available for requests
pmcd_wait -h localhost@localhost:$pmproxyport -v -t 5sec
grep -o "Key.*" $tmp.pmproxy.log
cat $tmp.pmproxy.log >>$seq_full
$signal -s TERM $pmproxy_pid
pmproxy_pid=""
echo
echo "=== configuration file with pmseries REST API enabled, key server is required"
cat <<EOF > $tmp.pmproxy.conf
[pmseries]
enabled = true
EOF
pmproxyport=`_find_free_port`
pmproxy -f -U $username -x $tmp.err -l $tmp.pmproxy.log -p $pmproxyport -s $tmp.pmproxy.socket -c $tmp.pmproxy.conf &
pmproxy_pid=$!
# check pmproxy has started and is available for requests
pmcd_wait -h localhost@localhost:$pmproxyport -v -t 5sec
grep -o "Key.*" $tmp.pmproxy.log
cat $tmp.pmproxy.log >>$seq_full
$signal -s TERM $pmproxy_pid
pmproxy_pid=""
# success, all done
exit
|