File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -184,3 +184,34 @@ def check_switch_extension_with_background_worker(
184184 assert ext_version .endswith (f"{ self .extension_name } -{ last_version } .so" ), (
185185 f"Expected { self .extension_name } version { last_version } , but found { ext_version } "
186186 )
187+
188+ def check_pg_regress (self , pg_regress : Path , pg_version : str , test_name : str ):
189+ """Run pg_regress tests for the extension on a given PostgreSQL version.
190+
191+ Args:
192+ pg_regress: Path to the pg_regress binary
193+ pg_version: PostgreSQL version to test (e.g., "14", "15")
194+ test_name: SQL test file to run with pg_regress
195+ """
196+ sql_file = self .sql_test_dir / "sql" / f"{ test_name } .sql"
197+ if not sql_file .exists ():
198+ # check if we have a postgres version specific sql file
199+ test_name = f"z_{ pg_version } _{ test_name } "
200+ sql_file = self .sql_test_dir / "sql" / f"{ test_name } .sql"
201+ if not sql_file .exists ():
202+ print (f"Skipping pg_regress test for { pg_version } , no sql file found" )
203+ return
204+ try :
205+ print (
206+ self .vm .succeed (
207+ f"""sudo -u postgres { pg_regress } --inputdir={ self .sql_test_dir } --debug --use-existing --dbname=postgres --outputdir=/tmp/regression_output_{ pg_version } "{ test_name } " """
208+ )
209+ )
210+ except :
211+ print ("Error running pg_regress, diff:" )
212+ print (
213+ self .vm .succeed (
214+ f"cat /tmp/regression_output_{ pg_version } /regression.diffs"
215+ )
216+ )
217+ raise
You can’t perform that action at this time.
0 commit comments