-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PG-1289: Add testcase to cover PGMajor.PGMinor.PerconaVersion #150
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#!/bin/bash | ||
|
||
export TDE_MODE=1 | ||
export PERCONA_SERVER_VERSION=17.4.1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need the variable for the build command? |
||
|
||
SCRIPT_DIR="$(cd -- "$(dirname "$0")" >/dev/null 2>&1; pwd -P)" | ||
INSTALL_DIR="$SCRIPT_DIR/../../pginst" | ||
|
@@ -12,5 +13,5 @@ if [ "$1" = "debugoptimized" ]; then | |
export CXXFLAGS="-O2" | ||
fi | ||
|
||
./configure --enable-debug --enable-cassert --enable-tap-tests --prefix=$INSTALL_DIR | ||
make install-world -j | ||
./configure --enable-debug --enable-cassert --enable-tap-tests --enable-coverage --prefix=$INSTALL_DIR | ||
make install-world |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The name of this script is misleading, it's not Also it's a duplication of the other script, can't we make this an option to the existing |
||
|
||
set -e | ||
|
||
export TDE_MODE=1 | ||
export PERCONA_SERVER_VERSION=17.4.1 | ||
|
||
SCRIPT_DIR="$(cd -- "$(dirname "$0")" >/dev/null 2>&1; pwd -P)" | ||
source $SCRIPT_DIR/configure-tde-server.sh | ||
|
||
ADD_FLAGS= | ||
|
||
if [ "$1" = "--continue" ]; then | ||
ADD_FLAGS="-k" | ||
fi | ||
|
||
cd $SCRIPT_DIR/../contrib/pg_tde | ||
pwd | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Debug leftover? |
||
EXTRA_REGRESS_OPTS="--extra-setup=$SCRIPT_DIR/tde_setup.sql" make installcheck $ADD_FLAGS |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
set -e | ||
|
||
export TDE_MODE=1 | ||
export PERCONA_SERVER_VERSION=17.4.1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like this repeating.. With this, every time we update the version, we have to replace it at many places. Can't we add it as a file called Also, only the make scripts are updated, the meson scripts are left as-is. |
||
|
||
SCRIPT_DIR="$(cd -- "$(dirname "$0")" >/dev/null 2>&1; pwd -P)" | ||
source $SCRIPT_DIR/configure-tde-server.sh | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,7 @@ DEPS=( | |
# Test pg_tde | ||
python3-pykmip | ||
libhttp-server-simple-perl | ||
lcov | ||
) | ||
|
||
sudo apt-get update | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#!/usr/bin/perl | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file isn't executed at all, no related makefile or meson.build changes. |
||
use strict; | ||
use warnings; | ||
use File::Basename; | ||
use File::Compare; | ||
use File::Copy; | ||
use Test::More; | ||
use lib 't'; | ||
use Env; | ||
use pgtde; | ||
|
||
# Get file name and CREATE out file name and dirs WHERE requried | ||
PGTDE::setup_files_dir(basename($0)); | ||
|
||
# CREATE new PostgreSQL node and do initdb | ||
my $node = PGTDE->pgtde_init_pg(); | ||
my $pgdata = $node->data_dir; | ||
|
||
if (!defined($ENV{PERCONA_SERVER_VERSION})) | ||
{ | ||
plan skip_all => "PERCONA_SERVER_VERSION variable not define in the environment."; | ||
} | ||
|
||
my $percona_expected_server_version = $ENV{PERCONA_SERVER_VERSION}; | ||
|
||
# UPDATE postgresql.conf to include/load pg_tde library | ||
open my $conf, '>>', "$pgdata/postgresql.conf"; | ||
print $conf "shared_preload_libraries = 'pg_tde'\n"; | ||
close $conf; | ||
|
||
# Start server | ||
my $rt_value = $node->start; | ||
ok($rt_value == 1, "Start Server"); | ||
|
||
# CREATE EXTENSION and change out file permissions | ||
my ($cmdret, $stdout, $stderr) = $node->psql('postgres', 'CREATE EXTENSION pg_tde;', extra_params => ['-a']); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need the extension for this test? Why is this test in the extension folder? |
||
ok($cmdret == 0, "CREATE PGTDE EXTENSION"); | ||
PGTDE::append_to_debug_file($stdout); | ||
|
||
# Get PG Server version ( e.g 17.4) from pg_config | ||
my $pg_server_version = `pg_config --version | awk {'print \$2'}`; | ||
$pg_server_version=~ s/^\s+|\s+$//g; | ||
|
||
PGTDE::append_to_debug_file($pg_server_version + "df"); | ||
PGTDE::append_to_debug_file($percona_expected_server_version); | ||
|
||
# Check pg_config output. | ||
my $pg_config_output = `pg_config --version`; | ||
$pg_config_output=~ s/^\s+|\s+$//g; | ||
cmp_ok($pg_config_output,'eq',"PostgreSQL $pg_server_version - Percona Server for PostgreSQL $percona_expected_server_version", "Test pg_config --version output"); | ||
PGTDE::append_to_debug_file("# Test pg_config --version output"); | ||
PGTDE::append_to_debug_file($pg_config_output); | ||
|
||
# Check psql --version output. | ||
my $psql_version_output = `psql --version`; | ||
$psql_version_output=~ s/^\s+|\s+$//g; | ||
cmp_ok($psql_version_output,'eq',"psql (PostgreSQL) $pg_server_version - Percona Server for PostgreSQL $percona_expected_server_version", "Test psql --version output"); | ||
PGTDE::append_to_debug_file("# Test psql --version output"); | ||
PGTDE::append_to_debug_file($psql_version_output); | ||
|
||
# Check postgres --version output. | ||
my $postgres_output = `postgres --version`; | ||
$postgres_output=~ s/^\s+|\s+$//g; | ||
cmp_ok($postgres_output,'eq',"postgres (PostgreSQL) $pg_server_version - Percona Server for PostgreSQL $percona_expected_server_version", "Test postgres --version output"); | ||
PGTDE::append_to_debug_file("# Test postgres --version output"); | ||
PGTDE::append_to_debug_file($postgres_output); | ||
|
||
# Check select version() output. | ||
($cmdret, $stdout, $stderr) = $node->psql('postgres', "select version();", extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=on']); | ||
ok($cmdret == 0, "# Get output of select version();"); | ||
$stdout=~ s/^\s+|\s+$//g; | ||
like($stdout, "/PostgreSQL $pg_server_version - Percona Server for PostgreSQL $percona_expected_server_version/", "# Test select version() output"); | ||
PGTDE::append_to_debug_file("# Test select version() output"); | ||
PGTDE::append_to_debug_file($stdout); | ||
|
||
# DROP EXTENSION | ||
$stdout = $node->safe_psql('postgres', 'DROP EXTENSION pg_tde;', extra_params => ['-a']); | ||
ok($cmdret == 0, "DROP PGTDE EXTENSION"); | ||
PGTDE::append_to_debug_file($stdout); | ||
|
||
# Stop the server | ||
$node->stop; | ||
|
||
# Done testing for this testcase file. | ||
done_testing(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need the variable for the configure command? It is only used by test commands