#
# dctp.pl
#
use strict;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;

my $node = PostgreSQL::Test::Cluster->new('dctp');

$node->init();

$node->append_conf(
    'postgresql.conf',
    "shared_preload_libraries = 'pg_dctp'"
);

$node->start;

my $error;
eval { 
    $node->safe_psql(
    'postgres',
        q{CREATE USER regress PASSWORD 'abc123'}
    );
};
$error = $@;
ok($error,'CREATE USER ... PASSWORD is not allowed with non encrypted password');

my $result = $node->safe_psql('postgres', 'CREATE USER test');
is($result, '', 'CREATE user test OK without password');
eval {
    $node->safe_psql(
    'postgres',
        q{ALTER USER test PASSWORD 'abc123'}
    );
};
$error = $@;
ok($error,'ALTER USER ... PASSWORD is not allowed with non encrypted password');

$node->stop('fast');

done_testing();
