Server IP : 127.0.0.2 / Your IP : 18.116.60.81 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/postgresql-common/t/ |
Upload File : |
# Check for proper ENOSPC handling use strict; require File::Temp; use lib 't'; use TestLib; use Test::More tests => 26; # we are using unshare here, won't work with systemd $ENV{_SYSTEMCTL_SKIP_REDIRECT} = 1; my $outref; # check that a failed pg_createcluster leaves no cruft behind: try creating a # cluster on a 10 MB tmpfs my $cmd = <<EOF; exec 2>&1 set -e mount --make-rprivate / 2> /dev/null || : mkdir -p /var/lib/postgresql trap "umount /var/lib/postgresql" 0 HUP INT QUIT ILL ABRT PIPE TERM mount -t tmpfs -o size=10000000 none /var/lib/postgresql # this is supposed to fail LC_MESSAGES=C pg_createcluster $MAJORS[-1] test && exit 1 || true echo -n "ls>" # should not output anything ls /etc/postgresql ls /var/lib/postgresql echo "<ls" EOF my $result; $result = exec_as 'root', "echo '$cmd' | unshare -m sh", $outref; is $result, 0, 'script failed'; like $$outref, qr/No space left on device/i, 'pg_createcluster fails due to insufficient disk space'; like $$outref, qr/\nls><ls\n/, 'does not leave files behind'; check_clean; # check disk full conditions on startup my $cmd = <<EOF; set -e mount --make-rprivate / 2> /dev/null || : export LC_MESSAGES=C dirs="/etc/postgresql /var/lib/postgresql /var/log/postgresql" mkdir -p \$dirs trap "umount \$dirs" 0 HUP INT QUIT ILL ABRT PIPE TERM mount -t tmpfs -o size=1000000 none /etc/postgresql mount -t tmpfs -o size=50000000 none /var/lib/postgresql mount -t tmpfs -o size=1000000 none /var/log/postgresql pg_createcluster $MAJORS[-1] test # fill up /var/lib/postgresql ! cat < /dev/zero > /var/lib/postgresql/cruft 2>/dev/null echo '-- full lib --' ! pg_ctlcluster $MAJORS[-1] test start echo '-- end full lib --' echo '-- full lib log --' cat /var/log/postgresql/postgresql-$MAJORS[-1]-test.log echo '-- end full lib log --' rm /var/lib/postgresql/cruft pg_dropcluster $MAJORS[-1] test --stop EOF $result = exec_as 'root', "echo '$cmd' | unshare -m sh", $outref; is $result, 0, 'script failed'; like $$outref, qr/^-- full lib --.*No space left on device.*^-- end full lib --/ims, 'pg_ctlcluster prints error message'; like $$outref, qr/^-- full lib log --.*No space left on device.*^-- end full lib log --/ims, 'log file has error message'; check_clean; # vim: filetype=perl