Fix failed tests for PostgreSQL-10.
This commit is contained in:
parent
04b1c7055c
commit
01ad574b30
57
rubygem-pg-0.21.0-adjust-tests-for-postgresql-10.patch
Normal file
57
rubygem-pg-0.21.0-adjust-tests-for-postgresql-10.patch
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
From 55ca6dd8c1e0925f617b8f9e9042cbea01cf0eb8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lars Kanis <kanis@comcard.de>
|
||||||
|
Date: Mon, 23 Oct 2017 13:02:45 +0200
|
||||||
|
Subject: [PATCH] Adjust tests for PostgreSQL-10
|
||||||
|
|
||||||
|
---
|
||||||
|
spec/helpers.rb | 2 +-
|
||||||
|
spec/pg/connection_spec.rb | 13 +++++++++----
|
||||||
|
2 files changed, 10 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/spec/helpers.rb b/spec/helpers.rb
|
||||||
|
index d13df5e..e9856de 100755
|
||||||
|
--- a/spec/helpers.rb
|
||||||
|
+++ b/spec/helpers.rb
|
||||||
|
@@ -251,7 +251,7 @@ module PG::TestingHelpers
|
||||||
|
|
||||||
|
def check_for_lingering_connections( conn )
|
||||||
|
conn.exec( "SELECT * FROM pg_stat_activity" ) do |res|
|
||||||
|
- conns = res.find_all {|row| row['pid'].to_i != conn.backend_pid }
|
||||||
|
+ conns = res.find_all {|row| row['pid'].to_i != conn.backend_pid && ["client backend", nil].include?(row["backend_type"]) }
|
||||||
|
unless conns.empty?
|
||||||
|
puts "Lingering connections remain:"
|
||||||
|
conns.each do |row|
|
||||||
|
diff --git a/spec/pg/connection_spec.rb b/spec/pg/connection_spec.rb
|
||||||
|
index d055673..0924ca4 100755
|
||||||
|
--- a/spec/pg/connection_spec.rb
|
||||||
|
+++ b/spec/pg/connection_spec.rb
|
||||||
|
@@ -219,7 +219,7 @@ describe PG::Connection do
|
||||||
|
described_class.connect(@conninfo).finish
|
||||||
|
sleep 0.5
|
||||||
|
res = @conn.exec(%[SELECT COUNT(*) AS n FROM pg_stat_activity
|
||||||
|
- WHERE usename IS NOT NULL])
|
||||||
|
+ WHERE usename IS NOT NULL AND application_name != ''])
|
||||||
|
# there's still the global @conn, but should be no more
|
||||||
|
expect( res[0]['n'] ).to eq( '1' )
|
||||||
|
end
|
||||||
|
@@ -1524,9 +1524,14 @@ describe PG::Connection do
|
||||||
|
end
|
||||||
|
|
||||||
|
it "shouldn't type map params unless requested" do
|
||||||
|
- expect{
|
||||||
|
- @conn.exec_params( "SELECT $1", [5] )
|
||||||
|
- }.to raise_error(PG::IndeterminateDatatype)
|
||||||
|
+ if @conn.server_version < 100000
|
||||||
|
+ expect{
|
||||||
|
+ @conn.exec_params( "SELECT $1", [5] )
|
||||||
|
+ }.to raise_error(PG::IndeterminateDatatype)
|
||||||
|
+ else
|
||||||
|
+ # PostgreSQL-10 maps to TEXT type (OID 25)
|
||||||
|
+ expect( @conn.exec_params( "SELECT $1", [5] ).ftype(0)).to eq(25)
|
||||||
|
+ end
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should raise an error on invalid encoder to put_copy_data" do
|
||||||
|
--
|
||||||
|
2.14.3
|
||||||
|
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
Name: rubygem-%{gem_name}
|
Name: rubygem-%{gem_name}
|
||||||
Version: 0.21.0
|
Version: 0.21.0
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: A Ruby interface to the PostgreSQL RDBMS
|
Summary: A Ruby interface to the PostgreSQL RDBMS
|
||||||
# Upstream license clarification (https://bitbucket.org/ged/ruby-pg/issue/72/)
|
# 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.
|
# Disable RPATH.
|
||||||
# https://bitbucket.org/ged/ruby-pg/issue/183
|
# https://bitbucket.org/ged/ruby-pg/issue/183
|
||||||
Patch0: rubygem-pg-0.17.1-remove-rpath.patch
|
Patch0: rubygem-pg-0.17.1-remove-rpath.patch
|
||||||
|
# Fix tests for PostgreSQL-10.
|
||||||
|
# https://github.com/ged/ruby-pg/commit/fe24a71
|
||||||
|
Patch1: rubygem-pg-0.21.0-adjust-tests-for-postgresql-10.patch
|
||||||
BuildRequires: ruby(release)
|
BuildRequires: ruby(release)
|
||||||
BuildRequires: rubygems-devel
|
BuildRequires: rubygems-devel
|
||||||
BuildRequires: ruby-devel
|
BuildRequires: ruby-devel
|
||||||
@ -78,16 +81,23 @@ for file in `find %{buildroot}%{gem_libdir} -type f -name "*.rb"`; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Fix spec shebangs.
|
# Fix spec shebangs.
|
||||||
# https://bitbucket.org/ged/ruby-pg/issue/74/
|
# https://bitbucket.org/ged/ruby-pg/issues/269/
|
||||||
for file in `find %{buildroot}%{gem_instdir}/spec -type f ! -perm /a+x -name "*.rb"`; do
|
for file in `find %{buildroot}%{gem_instdir}/spec -type f -name "*.rb"`; do
|
||||||
[ ! -z "`head -n 1 $file | grep \"^#!/\"`" ] \
|
if [ ! -z "`head -n 1 $file | grep \"^#!/\"`" ]; then
|
||||||
&& sed -i -e 's/^#!\/usr\/bin\/env spec/#!\/usr\/bin\/env rspec/' $file \
|
sed -i '/^#!\/usr\/bin\/env/ d' $file
|
||||||
&& chmod -v 755 $file
|
chmod -v 644 $file
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
%check
|
%check
|
||||||
pushd .%{gem_instdir}
|
pushd .%{gem_instdir}
|
||||||
rspec -I$(dirs +1)%{gem_extdir_mri} spec
|
cat "%{PATCH1}" | patch -p1
|
||||||
|
# Set LANG to prevent encoding warnings. See spec/pg/connection_spec.rb
|
||||||
|
# test case: "receives properly encoded messages in the notice callbacks".
|
||||||
|
# Set --verbose to show detail log by $VERBOSE.
|
||||||
|
# See https://github.com/ged/ruby-pg/blob/master/spec/helpers.rb $VERBOSE
|
||||||
|
LANG=en_US.UTF-8 ruby -S --verbose \
|
||||||
|
rspec -I$(dirs +1)%{gem_extdir_mri} -f d spec
|
||||||
popd
|
popd
|
||||||
|
|
||||||
%files
|
%files
|
||||||
@ -115,6 +125,9 @@ popd
|
|||||||
%{gem_instdir}/spec
|
%{gem_instdir}/spec
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Dec 08 2017 Jun Aruga <jaruga@redhat.com> - 0.21.0-2
|
||||||
|
- Fix failed tests for PostgreSQL-10.
|
||||||
|
|
||||||
* Thu Aug 17 2017 Vít Ondruch <vondruch@redhat.com> - 0.21.0-1
|
* Thu Aug 17 2017 Vít Ondruch <vondruch@redhat.com> - 0.21.0-1
|
||||||
- Update to pg 1.21.0.
|
- Update to pg 1.21.0.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user