File: 1192

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 (97 lines) | stat: -rwxr-xr-x 2,391 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
#!/bin/sh
# PCP QA Test No. 1192
# Exercise podman container detection and metrics.
#
# Copyright (c) 2018 Red Hat.  All Rights Reserved.
#

seq=`basename $0`
echo "QA output created by $seq"

. ./common.containers

_check_containers
_check_podman_binary
_check_podman_images busybox

_cleanup()
{
    if [ -n "$container" ]
    then
        echo "== removing container" | tee -a $seq.full
        _remove_podman_containers $container
        container=""
    fi 
    rm -rf $tmp.*
}

status=1	# failure is the default!
$sudo rm -rf $tmp.* $seq.full
trap "_cleanup; exit \$status" 0 1 2 3 15

_filter_pminfo()
{
    # filter ip_vti tunnel type connections that may exist on (some) machines
    tee -a $here/$seq.full >$tmp.tmp
    sed <$tmp.tmp \
	-e '/ip_vti/d' \
	-e '2q' \
    # end
    sed <$tmp.tmp \
	-e '1,2d' \
	-e 's/\[[0-9][0-9]* or ".*"\]/[INST or NAME]/' \
	-e 's/value [-?0-9.e+][-?0-9.e+]*/value NUMBER/' \
	-e 's/value ".*"$/value STRING/' \
    | LC_COLLATE=POSIX sort \
    | uniq
}

# real QA test starts here
container=`$sudo $podman run -d busybox sleep 15`
echo "== container: $container" >> $seq.full

echo "== kernel PMDA" | tee -a $seq.full
# expect 2 interfaces (lo/eth0) # mounts different.
metrics="network.interface.in.bytes" # filesys.used
for m in $metrics
do
    pminfo --fetch --container=$container $m | _filter_pminfo
done
echo

echo "== procfs PMDA" | tee -a $seq.full
# expect values for a single process (sleep) and one cgroup
metrics="proc.memory.rss cgroup.memory.stat.rss"
for m in $metrics
do
    pminfo --fetch --container=$container $m | _filter_pminfo
done
echo

echo "== pmcd PMDA" | tee -a $seq.full
# expect a different hostname to local hostname
pmprobe --values --container=$container pmcd.hostname > $tmp.chost
pmprobe --values pmcd.hostname > $tmp.host
container_hostname=`awk '{ print $3 }' $tmp.chost`
localhost_hostname=`awk '{ print $3 }' $tmp.host`

cat $tmp.chost $tmp.host >> $seq.full
echo container hostname: $container_hostname >> $seq.full
echo localhost hostname: $localhost_hostname >> $seq.full

if [ $container_hostname != $localhost_hostname ]
then
    echo
    echo "OK: host and container names are different"
    echo
else
    echo "FAIL: hostnames match when they should not"
    echo "localhost: $localhost_hostname"
    echo "container: $container_hostname"
    status=1
    exit
fi

# success, all done
status=0
exit