Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
BuonOmo committed Sep 5, 2024
1 parent b774ae2 commit d1a4e1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 81 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ jobs:
fail-fast: false
matrix:
# https://ruby-lang.org/en/downloads/branches
ruby: ["3.3"]
ruby: ["3.3", "3.2", "3.1"]
# https://www.postgresql.org/support/versioning/
pg: [16-master]
pg: [12-master, 13-master, 14-master, 15-master, 16-master]
steps:
- name: Set Up Actions
uses: actions/checkout@v4
Expand All @@ -72,4 +72,4 @@ jobs:
PGHOST: 127.0.0.1
PGUSER: postgres
PGPASSWORD: postgres
TESTOPTS: --verbose --name=/PostgresqlHstoreTest/
TESTOPTS: --verbose --profile=3
78 changes: 0 additions & 78 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,42 +80,9 @@ def time_it
end
end


# module DebugSlowTests
# def wrap_the_thing(name)
# rv = nil
# t0 = Minitest.clock_time
# profile = StackProf.run(mode: :wall, interval: 1000) do
# rv = yield
# end
# puts
# puts "#{name} took #{Minitest.clock_time - t0} seconds"
# puts
# pp SpatialModel.lease_connection.instance_variable_get(:@raw_connection).conninfo_hash
# puts
# StackProf::Report.new(profile).print_text
# rv
# end
# def enable_extension!(...)
# wrap_the_thing(__method__) do
# super
# end
# end

# def disable_extension!(...)
# wrap_the_thing(__method__) do
# super
# end
# end
# end



module ActiveRecord
class TestCase
include TestTimeoutHelper
# include DebugSlowTests
# extend DebugSlowTests

def factory(srid: 3785)
RGeo::Cartesian.preferred_factory(srid: srid)
Expand All @@ -135,48 +102,3 @@ def reset_spatial_store
end
end
end

# conn = SpatialModel.lease_connection.instance_variable_get(:@raw_connection)
# $count = conn.conninfo_hash[:port].count(",")+1

# TracePoint.trace(:call) do |tp|
# conn = SpatialModel.lease_connection.instance_variable_get(:@raw_connection)
# count = conn.conninfo_hash[:port].count(",")+1
# next if count == $count

# $count = count
# puts "port(count=#{count}): #{conn.conninfo_hash[:port][0, 100]}"
# end

module DebugReset
def reset

iopts = conninfo_hash.compact
puts "host count before: #{iopts[:host].count(",") + 1}"
if iopts[:host] && !iopts[:host].empty? && PG.library_version >= 100000
iopts = self.class.send(:resolve_hosts, iopts)
end
puts "host count after: #{iopts[:host].count(",") + 1}"
conninfo = self.class.parse_connect_args( iopts );
reset_start2(conninfo)
async_connect_or_reset(:reset_poll)
self
end
end

module DebugResolve
def resolve_hosts(iopts)
host = iopts[:host]
host = host[0, 97] + "..." if host.length > 100
puts "resolve_hosts, hosts: #{host.inspect}"

port = iopts[:port]
port = port[0, 97] + "..." if port.length > 100
puts "resolve_hosts, ports: #{port.inspect}"

super
end
end

PG::Connection.prepend(DebugReset)
PG::Connection.singleton_class.prepend(DebugResolve)

0 comments on commit d1a4e1e

Please sign in to comment.