Prevent LDAP and SSL tests from running without support in build

Add checks in each test file that the build supports the feature,
otherwise skip all the tests.  Before, if someone were to (accidentally)
invoke these tests without build support, they would fail in confusing
ways.

based on patch from Michael Paquier <michael@paquier.xyz>
This commit is contained in:
Peter Eisentraut 2018-03-03 08:52:21 -05:00
parent fdb34824e0
commit ff18115ae9
5 changed files with 34 additions and 3 deletions

View File

@ -13,6 +13,8 @@ subdir = src/test/ldap
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
export with_ldap
check:
$(prove_check)

View File

@ -2,7 +2,16 @@ use strict;
use warnings;
use TestLib;
use PostgresNode;
use Test::More tests => 19;
use Test::More;
if ($ENV{with_ldap} eq 'yes')
{
plan tests => 19;
}
else
{
plan skip_all => 'LDAP not supported by this build';
}
my ($slapd, $ldap_bin_dir, $ldap_schema_dir);

View File

@ -13,6 +13,8 @@ subdir = src/test/ssl
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
export with_openssl
CERTIFICATES := server_ca server-cn-and-alt-names \
server-cn-only server-single-alt-name server-multiple-alt-names \
server-no-names server-revoked server-ss \

View File

@ -2,10 +2,19 @@ use strict;
use warnings;
use PostgresNode;
use TestLib;
use Test::More tests => 62;
use Test::More;
use ServerSetup;
use File::Copy;
if ($ENV{with_openssl} eq 'yes')
{
plan tests => 62;
}
else
{
plan skip_all => 'SSL not supported by this build';
}
#### Some configuration
# This is the hostname used to connect to the server. This cannot be a

View File

@ -4,10 +4,19 @@ use strict;
use warnings;
use PostgresNode;
use TestLib;
use Test::More tests => 6;
use Test::More;
use ServerSetup;
use File::Copy;
if ($ENV{with_openssl} eq 'yes')
{
plan tests => 6;
}
else
{
plan skip_all => 'SSL not supported by this build';
}
# This is the hostname used to connect to the server.
my $SERVERHOSTADDR = '127.0.0.1';