File: 1436

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (89 lines) | stat: -rwxr-xr-x 2,426 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
#!/bin/sh
# PCP QA Test No. 1434
# Exercise the PostgreSQL PMDA ./Upgrade script.
#
# Copyright (c) 2019 Red Hat.
#

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

# get standard environment, filters and checks
. ./common.python

[ -d $PCP_PMDAS_DIR/postgresql ] || _notrun "postgresql PMDA is not installed"

_cleanup()
{
    cd $here
    _restore_config "$PCP_PMDAS_DIR/postgresql/pmdapostgresql.conf"
    $sudo rm -rf $tmp $tmp.*
}

status=1	# failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15

_filter()
{
    sed \
	-e "s,$PCP_PMDAS_DIR,PCP_PMDAS_DIR,g" \
	-e "s,$PCP_PYTHON_PROG,PCP_PYTHON_PROG,g" \
    #end
}

# upgrade an existing postgresql install (no change)
cat >$tmp.pmcd.conf.1 <<EOF
postgresql 110 pipe binary $PCP_PYTHON_PROG $PCP_PMDAS_DIR/postgresql/pmdapostgresql.python
EOF

# test upgrade to a down-rev perl postgresql install
cat >$tmp.pmcd.conf.2 <<EOF
postgresql 110 pipe binary perl $PCP_PMDAS_DIR/postgresql/pmdapostgresql.pl
EOF

# upgrade of a single perl postgresql config
cat >$tmp.perl.conf.1 <<EOF
\$database = 'dbi:Pg:dbname=postgres';
\$username = 'postgres';    # DB username for DB login
\$password = '';	    # DBI parameter, typically unused for postgres
\$os_user = '';		    # O/S user to run the PMDA
EOF

# upgrade more complex perl postgresql config
cat >$tmp.perl.conf.2 <<EOF
\$database = 'dbi:Pg:dbname=mydb;host=myhost;port=12345';
\$username = 'myuser';	# DB username for DB login
\$password = 'mypass';	# DBI parameter, typically unused for postgres
\$os_user = 'myosusr';	# O/S user to run the PMDA
EOF

# real QA test starts here
cd $PCP_PMDAS_DIR/postgresql
_save_config "$PCP_PMDAS_DIR/postgresql/pmdapostgresql.conf"

cases=`ls -1 $tmp.pmcd.conf.* | sed -e 's/.*pmcd.conf.//g' | LC_COLLATE=POSIX sort`
for case in $cases
do
    config="$tmp.pmcd.conf.$case"
    PCP_PMCDCONF_PATH=$config; export PCP_PMCDCONF_PATH
    echo "== Upgrade test case $case"
    ./Upgrade
    cat $config | _filter
done

# exercise old perl config upgrades
input="$PCP_PMDAS_DIR/postgresql/postgresql.conf"
output="$PCP_PMDAS_DIR/postgresql/pmdapostgresql.conf"
perlcases=`ls -1 $tmp.perl.conf.* | sed -e 's/.*perl.conf.//g' | LC_COLLATE=POSIX sort`
for perlcase in $perlcases
do
    config="$tmp.perl.conf.$perlcase"
    $sudo mv $config $input
    echo "== Upgrade perl test case $perlcase"
    $sudo ./Upgrade
    $sudo cat $output
done

# success, all done
status=0
exit