Skip to content

Commit

Permalink
Update tests and documentation for PostgreSQL 10.
Browse files Browse the repository at this point in the history
  • Loading branch information
dwsteele committed Oct 3, 2017
1 parent 0bff1be commit 268b32d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ A `Vagrantfile` has been included in the test directory which gives the exact st
```
/pgaudit_analyze/test/test.pl
```
Regression tests will be run on PostgreSQL 9.6 by default. Specify `--pgsql-bin=/usr/pgsql-9.5/bin` to run tests on PostgreSQL 9.5.
Regression tests will be run on PostgreSQL 10 by default. Specify `--pgsql-bin=/usr/pgsql-9.6/bin` to run tests on PostgreSQL 9.6 and use the same pattern for 9.5 testing.

## Caveats

Expand Down
14 changes: 11 additions & 3 deletions test/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,33 @@ Vagrant.configure(2) do |config|
config.vm.box = "bento/centos-7.3"

config.vm.provider :virtualbox do |vb|
vb.name = "pgaudit-centos7-test"
vb.name = "pgaudit-analyze-centos7-test"
end

# Provision the VM
config.vm.provision "shell", inline: <<-SHELL
# Install PostgreSQL
rpm -ivh http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-3.noarch.rpm
yum install -y postgresql95-server postgresql95-devel
rpm -ivh http://yum.postgresql.org/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
yum install -y postgresql95-server postgresql96-server
yum install -y postgresql96-server postgresql96-devel
rpm -ivh https://yum.postgresql.org/testing/10/redhat/rhel-7-x86_64/pgdg-centos10-10-1.noarch.rpm
yum install -y postgresql10-server postgresql10-devel
# Compile & install pgaudit
yum install -y postgresql95-devel postgresql96-devel gcc openssl-devel git
yum install -y gcc openssl-devel git
git clone https://github.com/pgaudit/pgaudit.git -b REL9_5_STABLE pgaudit-9.5
bash -c 'export PATH="$PATH:/usr/pgsql-9.5/bin" && make -C pgaudit-9.5 install USE_PGXS=1'
git clone https://github.com/pgaudit/pgaudit.git -b REL9_6_STABLE pgaudit-9.6
bash -c 'export PATH="$PATH:/usr/pgsql-9.6/bin" && make -C pgaudit-9.6 install USE_PGXS=1'
git clone https://github.com/pgaudit/pgaudit.git -b dev-pg10 pgaudit-10
bash -c 'export PATH="$PATH:/usr/pgsql-10/bin" && make -C pgaudit-10 install USE_PGXS=1'
# Install EPEL
yum install -y epel-release
Expand Down
8 changes: 5 additions & 3 deletions test/test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ =head1 SYNOPSIS
####################################################################################################################################
# Command line parameters
####################################################################################################################################
my $strPgSqlBin = '/usr/pgsql-9.6/bin'; # Path of PG binaries to use for this test
my $strPgSqlBin = '/usr/pgsql-10/bin'; # Path of PG binaries to use for this test
my $strTestPath = 'test'; # Path where testing will occur
my $strPgLogPath = 'log'; # Path where pg logs will be stored
my $strUser = getpwuid($>); # PG user name
my $strHost = '/tmp'; # PG default host
my $strDatabase = 'postgres'; # PG database
Expand Down Expand Up @@ -386,6 +387,7 @@ sub pgStart
" -c log_error_verbosity=verbose" .
" -c log_connections=on" .
" -c log_destination=csvlog" .
" -c log_directory=${strPgLogPath}" .
($bNotice ? " -c pgaudit.log_level=notice" : '') .
" -c pgaudit.role=auditor" .
" -c logging_collector=on" .
Expand Down Expand Up @@ -429,7 +431,7 @@ sub pgPsql
# Start pgaudit_analyze
my $pId = IPC::Open3::open3(undef, undef, undef,
"${strBasePath}/bin/pgaudit_analyze --port=${iPort} --socket-path=/tmp" .
" --log-file=${strTestPath}/pgaudit_analyze.log ${strTestPath}/pg_log");
" --log-file=${strTestPath}/pgaudit_analyze.log ${strTestPath}/${strPgLogPath}");

use constant LOCALHOST => '127.0.0.1';

Expand Down Expand Up @@ -727,7 +729,7 @@ sub pgPsql
&log("\nTEST: Verify 'unable to open pgAudit Analyze log file'\n");
eval
{
capture("${strBasePath}/bin/pgaudit_analyze --log-file=/var/log/pgaudit_analyze.log ${strTestPath}/pg_log");
capture("${strBasePath}/bin/pgaudit_analyze --log-file=/var/log/pgaudit_analyze.log ${strTestPath}/${strPgLogPath}");
};
if ($@)
{
Expand Down

0 comments on commit 268b32d

Please sign in to comment.