Skip to content

Commit

Permalink
Adjust tests for PostgreSQL-10
Browse files Browse the repository at this point in the history
  • Loading branch information
larskanis committed Oct 23, 2017
1 parent 9ab1891 commit fe24a71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion spec/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def teardown_testing_db( conn )

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|
Expand Down
13 changes: 9 additions & 4 deletions spec/pg/connection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
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
Expand Down Expand Up @@ -1537,9 +1537,14 @@
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
Expand Down

0 comments on commit fe24a71

Please sign in to comment.