Assign a random testing port.
That fixes below error as much as possible. https://github.com/ged/ruby-pg/pull/39 Related: rhbz#1688758
This commit is contained in:
parent
366f9b2810
commit
14c5c5b32f
40
rubygem-pg-1.1.4-add-feature-to-set-testing-port.patch
Normal file
40
rubygem-pg-1.1.4-add-feature-to-set-testing-port.patch
Normal file
@ -0,0 +1,40 @@
|
||||
diff --git a/spec/helpers.rb b/spec/helpers.rb
|
||||
index 4362750..9b064ea 100755
|
||||
--- a/spec/helpers.rb
|
||||
+++ b/spec/helpers.rb
|
||||
@@ -199,8 +199,8 @@ module PG::TestingHelpers
|
||||
@test_pgdata = TEST_DIRECTORY + 'data'
|
||||
@test_pgdata.mkpath
|
||||
|
||||
- @port = 54321
|
||||
- ENV['PGPORT'] = @port.to_s
|
||||
+ ENV['PGPORT'] ||= "54321"
|
||||
+ @port = ENV['PGPORT'].to_i
|
||||
ENV['PGHOST'] = 'localhost'
|
||||
@conninfo = "host=localhost port=#{@port} dbname=test"
|
||||
|
||||
diff --git a/spec/pg/connection_spec.rb b/spec/pg/connection_spec.rb
|
||||
index a1d7e42..1f6cd8d 100755
|
||||
--- a/spec/pg/connection_spec.rb
|
||||
+++ b/spec/pg/connection_spec.rb
|
||||
@@ -241,7 +241,7 @@ describe PG::Connection do
|
||||
expect( @conn.db ).to eq( "test" )
|
||||
expect( @conn.user ).to be_a_kind_of( String )
|
||||
expect( @conn.pass ).to eq( "" )
|
||||
- expect( @conn.port ).to eq( 54321 )
|
||||
+ expect( @conn.port ).to eq( @port )
|
||||
expect( @conn.tty ).to eq( "" )
|
||||
expect( @conn.options ).to eq( "" )
|
||||
end
|
||||
@@ -741,7 +741,7 @@ describe PG::Connection do
|
||||
it "can return the default connection options as a Hash" do
|
||||
expect( described_class.conndefaults_hash ).to be_a( Hash )
|
||||
expect( described_class.conndefaults_hash ).to include( :user, :password, :dbname, :host, :port )
|
||||
- expect( ['5432', '54321'] ).to include( described_class.conndefaults_hash[:port] )
|
||||
+ expect( ['5432', '54321', @port.to_s] ).to include( described_class.conndefaults_hash[:port] )
|
||||
expect( @conn.conndefaults_hash ).to eq( described_class.conndefaults_hash )
|
||||
end
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
Name: rubygem-%{gem_name}
|
||||
Version: 1.0.0
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: A Ruby interface to the PostgreSQL RDBMS
|
||||
# Upstream license clarification (https://bitbucket.org/ged/ruby-pg/issue/72/)
|
||||
#
|
||||
@ -16,6 +16,9 @@ Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
|
||||
# Disable RPATH.
|
||||
# https://bitbucket.org/ged/ruby-pg/issue/183
|
||||
Patch0: rubygem-pg-0.17.1-remove-rpath.patch
|
||||
# Add feature to set testing port.
|
||||
# https://github.com/ged/ruby-pg/commit/104ec67
|
||||
Patch1: rubygem-pg-1.1.4-add-feature-to-set-testing-port.patch
|
||||
BuildRequires: ruby(release)
|
||||
BuildRequires: rubygems-devel
|
||||
BuildRequires: ruby-devel
|
||||
@ -43,6 +46,7 @@ Documentation for %{name}.
|
||||
%setup -q -n %{gem_name}-%{version}
|
||||
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
%build
|
||||
# Create the gem as gem install only works on a gem file
|
||||
@ -86,7 +90,9 @@ done
|
||||
pushd .%{gem_instdir}
|
||||
# Set --verbose to show detail log by $VERBOSE.
|
||||
# See https://github.com/ged/ruby-pg/blob/master/spec/helpers.rb $VERBOSE
|
||||
ruby -S --verbose \
|
||||
# Assign a random port to consider a case of multi builds in parallel in a host.
|
||||
# https://github.com/ged/ruby-pg/pull/39
|
||||
PGPORT="$((54321 + ${RANDOM} % 1000))" ruby -S --verbose \
|
||||
rspec -I$(dirs +1)%{gem_extdir_mri} -f d spec
|
||||
popd
|
||||
|
||||
@ -115,6 +121,9 @@ popd
|
||||
%{gem_instdir}/spec
|
||||
|
||||
%changelog
|
||||
* Thu May 23 2019 Jun Aruga <jaruga@redhat.com> - 1.0.0-2
|
||||
- Assign a random testing port.
|
||||
|
||||
* Tue Feb 13 2018 Vít Ondruch <vondruch@redhat.com> - 1.0.0-1
|
||||
- Update to pg 1.0.0.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user