Drop unused condition check
[pcp.git] / qa / 1032
blob63e995eb87b38a3b72c059a2b59f70170cf55382
1 #!/bin/sh
2 # PCP QA Test No. 1032
3 # Exercise container switching using the webapi _store method.
5 # Copyright (c) 2015 Red Hat. All Rights Reserved.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 . ./common.webapi
12 . ./common.python
13 . ./common.docker
15 _check_containers
16 _check_docker_images busybox
18 _check_pmwebd
19 _check_requests_json
21 $sudo rm -rf $tmp $tmp.* $seq.full
23 pyscript=src/test_webcontainers.py
24 signal=$PCP_BINADM_DIR/pmsignal
25 status=1 # failure is the default!
26 username=`id -u -n`
27 webargs="-U $username"
28 webport=`_find_free_port`
30 _cleanup()
32 if [ -n "$container" ]
33 then
34 echo "== removing container" | tee -a $seq.full
35 _remove_docker_containers $container
36 container=""
38 if [ "X$webpid" != "X" ]; then
39 $signal -s TERM $webpid
40 webpid=""
42 $sudo rm -f $tmp.*
45 trap "_cleanup; exit \$status" 0 1 2 3 15
47 _filter()
49 sed \
50 -e 's/\#[0-9][0-9]*/#CONTEXT/g' \
51 -e "s/$container/CONTAINER ID/g" \
52 -e "s/$container_hostname/CONTAINER HOST/g" \
53 -e "s/$localhost_hostname/LOCALHOST HOST/g" \
54 -e "/ pmcd.client.container\[\]/d" \
55 # end
58 # real QA test starts here
59 $PCP_BINADM_DIR/pmwebd $webargs -p $webport -l $tmp.out -v -t5 &
60 webpid=$!
61 echo "pid=$webpid" >>$seq.full
63 container=`$docker run -d busybox sleep 15`
64 echo "container=$container" >> $seq.full
66 pmprobe --values --container=$container pmcd.hostname > $tmp.cont
67 pmprobe --values pmcd.hostname > $tmp.host
68 eval container_hostname=`awk '{ print $3 }' $tmp.cont`
69 eval localhost_hostname=`awk '{ print $3 }' $tmp.host`
70 echo "localhost_hostname=$localhost_hostname" >> $seq.full
71 echo "container_hostname=$container_hostname" >> $seq.full
73 _wait_for_pmwebd_logfile $tmp.out $webport
74 $python $pyscript --port $webport $container | _filter
76 # success, all done
77 status=0
78 exit