3 # Exercise container switching using the webapi _store method.
5 # Copyright (c) 2015 Red Hat. All Rights Reserved.
9 echo "QA output created by $seq"
16 _check_docker_images busybox
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!
27 webargs
="-U $username"
28 webport
=`_find_free_port`
32 if [ -n "$container" ]
34 echo "== removing container" |
tee -a $seq.full
35 _remove_docker_containers
$container
38 if [ "X$webpid" != "X" ]; then
39 $signal -s TERM
$webpid
45 trap "_cleanup; exit \$status" 0 1 2 3 15
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" \
58 # real QA test starts here
59 $PCP_BINADM_DIR/pmwebd
$webargs -p $webport -l $tmp.out
-v -t5 &
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