Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.145.45.223
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/share/postgresql-common/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/share/postgresql-common/t/130_nonroot_admin.t
# Check that cluster administration works as non-root if the invoker has
# sufficient permissions on directories.

use strict; 

use lib 't';
use TestLib;

my $version = $MAJORS[-1];
my $oldversion = $MAJORS[0];

use Test::More tests => 22;
use PgCommon;

my $testuser = 'postgres';

# pg_createcluster and pg_ctlcluster
is ((exec_as $testuser, "pg_createcluster $version main --start"), 0,
    "pg_createcluster succeeds as user $testuser with appropriate owner permissions");

like_program_out $testuser, 'pg_lsclusters -h', 0, qr/^$version\s+main.*online/m;
like_program_out 'postgres', 'psql -Atl', 0, qr/template1.*UTF8/;

# pg_dropcluster
is ((exec_as $testuser, "pg_dropcluster $version main --stop"), 0,
    "pg_dropcluster succeeds as user $testuser with appropriate directory owner permissions");

# pg_upgradecluster
SKIP: {
    skip 'Only one major version installed, skipping pg_upgradecluster tests', 8 if ($oldversion eq $version);

    is ((exec_as $testuser, "pg_createcluster $oldversion main --start"), 0,
        "pg_createcluster succeeds as user $testuser with appropriate group permissions");
    my $outref;
    is ((exec_as $testuser, "pg_upgradecluster -v $version $oldversion main", $outref, 0), 0, 
        "pg_upgradecluster succeeds as user $testuser");
    like $$outref, qr/Starting upgraded cluster/, 'pg_upgradecluster reported cluster startup';
    like $$outref, qr/Success. Please check/, 'pg_upgradecluster reported successful operation';

    like_program_out $testuser, 'pg_lsclusters -h', 0,
        qr/^$oldversion\s+main.*down.*\n^$version\s+main.*online/m;

    # clean up
    is ((exec_as $testuser, "pg_dropcluster $oldversion main"), 0);
    is ((exec_as $testuser, "pg_dropcluster $version main --stop"), 0);
}

check_clean;

# vim: filetype=perl

Anon7 - 2022
AnonSec Team