@@ -123,8 +123,8 @@ def spatial_factory_store
123123 end
124124end
125125
126- module ARTestCaseHelper
127- def with_cockroachdb_datetime_type ( type )
126+ module SetDatetimeInCockroachDBAdapter
127+ def with_postgresql_datetime_type ( type )
128128 adapter = ActiveRecord ::ConnectionAdapters ::CockroachDBAdapter
129129 adapter . remove_instance_variable ( :@native_database_types ) if adapter . instance_variable_defined? ( :@native_database_types )
130130 datetime_type_was = adapter . datetime_type
@@ -135,9 +135,10 @@ def with_cockroachdb_datetime_type(type)
135135 adapter . datetime_type = datetime_type_was
136136 adapter . remove_instance_variable ( :@native_database_types ) if adapter . instance_variable_defined? ( :@native_database_types )
137137 end
138+ alias :with_cockroachdb_datetime_type :with_postgresql_datetime_type
138139end
139140
140- ActiveRecord ::TestCase . include ( ARTestCaseHelper )
141+ ActiveRecord ::TestCase . prepend ( SetDatetimeInCockroachDBAdapter )
141142
142143module Minitest
143144 module GithubActionReporterExt
@@ -156,6 +157,29 @@ def gh_link(loc)
156157 GithubActionReporter . prepend ( GithubActionReporterExt )
157158end
158159
160+ if ENV [ 'TRACE_LIB' ]
161+ module TraceLibPlugin
162+ def after_setup
163+ super
164+ @tl_plugin__already_showed = { }
165+ @tl_plugin__trace = TracePoint . new ( :call ) do |tp |
166+ next unless tp . path . include? ( "activerecord-cockroachdb-adapter/lib" )
167+ full_path = "#{ tp . path } :#{ tp . lineno } "
168+ next if @tl_plugin__already_showed [ full_path ]
169+ @tl_plugin__already_showed [ full_path ] = true
170+ puts "==> #{ tp . defined_class } ##{ tp . method_id } at #{ full_path } "
171+ end
172+ @tl_plugin__trace . enable
173+ end
174+
175+ def before_teardown
176+ @tl_plugin__trace . disable
177+ super
178+ end
179+ end
180+ MiniTest ::Test . include ( TraceLibPlugin )
181+ end
182+
159183if ENV [ 'AR_LOG' ]
160184 ActiveRecord ::Base . logger = Logger . new ( STDOUT )
161185 ActiveRecord ::Base . logger . level = Logger ::DEBUG
0 commit comments