diff options
author | gregor herrmann <gregoa@debian.org> | 2021-03-15 18:25:54 +0100 |
---|---|---|
committer | gregor herrmann <gregoa@debian.org> | 2021-03-15 18:25:54 +0100 |
commit | 5d1212b6905e8b006f725485f8d7e999967f55bb (patch) | |
tree | 4e357a7a2b33791f3a3343421591e7f99362883b | |
parent | 4222648049b27caaff7aea6f177b12153cc55fc5 (diff) | |
parent | be431935ca16ece71a8228f625194826f5c44e49 (diff) |
New upstream version 1.28
-rw-r--r-- | Changes | 4 | ||||
-rw-r--r-- | META.json | 13 | ||||
-rw-r--r-- | META.yml | 9 | ||||
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | lib/Test/PostgreSQL.pm | 17 |
5 files changed, 32 insertions, 19 deletions
@@ -1,5 +1,9 @@ Revision history for Perl extension Test::PostgreSQL. +1.28 2021-03-12T10:50:46Z + - Increment port by random amount when trying to find a good port + - Allow using beta versions + 1.27 2018-10-17T02:06:08Z - Use pg_version attribute to better handle -b and -f psql switches depending on installed PostgreSQL version @@ -4,7 +4,7 @@ "Toby Corkindale, Kazuho Oku, Peter Mottram, Alex Tokarev, plus various contributors." ], "dynamic_config" : 0, - "generated_by" : "Minilla/v3.1.2", + "generated_by" : "Minilla/v3.1.11", "license" : [ "artistic_2" ], @@ -36,7 +36,7 @@ "Software::License" : "0", "Test::CPAN::Meta" : "0", "Test::MinimumVersion::Fast" : "0.04", - "Test::PAUSE::Permissions" : "0.04", + "Test::PAUSE::Permissions" : "0.07", "Test::Pod" : "1.41", "Test::Spellunker" : "v0.2.7" } @@ -67,7 +67,7 @@ "provides" : { "Test::PostgreSQL" : { "file" : "lib/Test/PostgreSQL.pm", - "version" : "1.27" + "version" : "1.28" } }, "release_status" : "stable", @@ -78,7 +78,7 @@ "web" : "https://github.com/TJC/Test-postgresql" } }, - "version" : "1.27", + "version" : "1.28", "x_contributors" : [ "Alex Tokarev <nohuhu@users.noreply.github.com>", "Alex Tokarev <tokarev@cpan.org>", @@ -89,14 +89,17 @@ "Eric Radman <ericshane@eradman.com>", "Matthew Somerville <matthew-github@dracos.co.uk>", "Michal Sedlák <sedlakmichal@gmail.com>", + "Mohammad S Anwar <mohammad.anwar@yahoo.com>", "Paul Williams <kwakwaversal@gmail.com>", "Peter Mottram <peter@sysnix.com>", "Russell Jenkins <russell.jenkins@strategicdata.com.au>", "Russell Jenkins <russellj@strategicdata.com.au>", "Toby <tobyc@strategicdata.com.au>", + "Toby Corkindale <tcorkindale@zendesk.com>", "Toby Corkindale <tjc@wintrmute.net>", + "Veesh Goldman <rabbiveesh@gmail.com>", "root <root@altar.int.qindel.com>" ], - "x_serialization_backend" : "JSON::PP version 2.27400_02", + "x_serialization_backend" : "JSON::PP version 4.04", "x_static_install" : 1 } @@ -8,7 +8,7 @@ build_requires: configure_requires: Module::Build::Tiny: '0.035' dynamic_config: 0 -generated_by: 'Minilla/v3.1.2, CPAN::Meta::Converter version 2.150010' +generated_by: 'Minilla/v3.1.11, CPAN::Meta::Converter version 2.150010' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -27,7 +27,7 @@ no_index: provides: Test::PostgreSQL: file: lib/Test/PostgreSQL.pm - version: '1.27' + version: '1.28' requires: DBD::Pg: '0' DBI: '0' @@ -44,7 +44,7 @@ requires: resources: homepage: https://github.com/TJC/Test-postgresql repository: git://github.com/TJC/Test-postgresql.git -version: '1.27' +version: '1.28' x_contributors: - 'Alex Tokarev <nohuhu@users.noreply.github.com>' - 'Alex Tokarev <tokarev@cpan.org>' @@ -55,12 +55,15 @@ x_contributors: - 'Eric Radman <ericshane@eradman.com>' - 'Matthew Somerville <matthew-github@dracos.co.uk>' - 'Michal Sedlák <sedlakmichal@gmail.com>' + - 'Mohammad S Anwar <mohammad.anwar@yahoo.com>' - 'Paul Williams <kwakwaversal@gmail.com>' - 'Peter Mottram <peter@sysnix.com>' - 'Russell Jenkins <russell.jenkins@strategicdata.com.au>' - 'Russell Jenkins <russellj@strategicdata.com.au>' - 'Toby <tobyc@strategicdata.com.au>' + - 'Toby Corkindale <tcorkindale@zendesk.com>' - 'Toby Corkindale <tjc@wintrmute.net>' + - 'Veesh Goldman <rabbiveesh@gmail.com>' - 'root <root@altar.int.qindel.com>' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' x_static_install: 1 @@ -94,7 +94,7 @@ to try and find it in PostgreSQL directory. Arguments to pass to `initdb` program when creating a new PostgreSQL database cluster for Test::PostgreSQL session. -Defaults to `-U postgres -A trust`. See ["db\_owner"](#db_owner). +Defaults to `-U postgres -A trust`. See ["dbowner"](#dbowner). ## extra\_initdb\_args @@ -154,7 +154,7 @@ instance. Defaults to `-U postgres -d test -h 127.0.0.1 -p $self->port`. -See also ["db\_owner"](#db_owner), ["dbname"](#dbname), ["host"](#host), ["base\_port"](#base_port). +See also ["dbowner"](#dbowner), ["dbname"](#dbname), ["host"](#host), ["base\_port"](#base_port). ## extra\_psql\_args @@ -219,7 +219,7 @@ Builds and returns dsn by using given parameters (if any). Default username is ## uri Builds and returns a connection URI using the given parameters (if any). See -[URI::db](https://metacpan.org/pod/URI::db) for details about the format. +[URI::db](https://metacpan.org/pod/URI%3A%3Adb) for details about the format. Default username is `postgres`, and dbname is `test` (an empty database). @@ -282,7 +282,7 @@ this environment variable to the desired path. For example: export POSTGRES_HOME='/usr/local/pgsql94beta' This is the same idea and variable name which is used by the installer of -[DBD::Pg](https://metacpan.org/pod/DBD::Pg). +[DBD::Pg](https://metacpan.org/pod/DBD%3A%3APg). # AUTHOR diff --git a/lib/Test/PostgreSQL.pm b/lib/Test/PostgreSQL.pm index cc304f7..4195938 100644 --- a/lib/Test/PostgreSQL.pm +++ b/lib/Test/PostgreSQL.pm @@ -13,7 +13,7 @@ use File::Which; use POSIX qw(SIGQUIT SIGKILL WNOHANG getuid setuid); use User::pwent; -our $VERSION = '1.27'; +our $VERSION = '1.28'; our $errstr; # Deprecate use of %Defaults as we want to remove this package global @@ -178,7 +178,7 @@ method _pg_ctl_builder() { if ( $prog ) { # we only use pg_ctl if Pg version is >= 9 my $ret = qx/"$prog" --version/; - if ( $ret =~ /(\d+)(?:\.|devel)/ && $1 >= 9 ) { + if ( $ret =~ /(\d+)(?:\.|devel|beta)/ && $1 >= 9 ) { return $prog; } warn "pg_ctl version earlier than 9"; @@ -390,7 +390,8 @@ method start() { method _find_port_and_launch() { my $tries = 10; my $port = $self->base_port; - # try by incrementing port number + srand(); # Re-seed the RNG in case the caller forked the process + # try by incrementing port number until PostgreSQL starts while (1) { my $good = try { $self->_try_start($port); @@ -399,12 +400,14 @@ method _find_port_and_launch() { catch { # warn "Postgres failed to start on port $port\n"; unless ($tries--) { - die "Failed to start postgres on port $port: $_"; + die "Failed to start postgres after trying 10 potential ports: $_"; } undef; }; return if $good; - $port++; + # Increment port by a random number to avoid clashes with other Test::Postgresql processes + # Keep in mind that this increment is going to be made up to 10 times, so avoid exceeding 64k + $port += int(rand(500)) + 1; } } @@ -814,7 +817,7 @@ to try and find it in PostgreSQL directory. Arguments to pass to C<initdb> program when creating a new PostgreSQL database cluster for Test::PostgreSQL session. -Defaults to C<-U postgres -A trust>. See L</db_owner>. +Defaults to C<-U postgres -A trust>. See L</dbowner>. =head2 extra_initdb_args @@ -874,7 +877,7 @@ instance. Defaults to C<-U postgres -d test -h 127.0.0.1 -p $self-E<gt>port>. -See also L</db_owner>, L</dbname>, L</host>, L</base_port>. +See also L</dbowner>, L</dbname>, L</host>, L</base_port>. =head2 extra_psql_args |