From 97ac3de5b9976d7dbadb9fd8737844e1fb151dc5 Mon Sep 17 00:00:00 2001
From: Jelte Fennema-Nio <postgres@jeltef.nl>
Date: Mon, 20 Jul 2026 23:52:44 +0200
Subject: [PATCH v1 02/12] meson: Deduplicate test timeout into a variable

The 1000 second test timeout was hardcoded in five places: once for each
test kind in the top-level meson.build, plus explicit overrides in the
regress and isolation suite definitions. This defines it once as
`test_timeout` and reuses that definition everywhere.
---
 meson.build                    | 8 ++++++--
 src/test/isolation/meson.build | 2 +-
 src/test/regress/meson.build   | 2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/meson.build b/meson.build
index 74bf7b9f714..c303598a0a4 100644
--- a/meson.build
+++ b/meson.build
@@ -3375,6 +3375,10 @@ tests = []
 
 # Default options for targets
 
+# Test timeout for all regress, isolation, TAP suites. Can be raised for an
+# individual test by setting the 'timeout' key in its test_kwargs.
+test_timeout = 1000
+
 # First identify rpaths
 bin_install_rpaths = []
 lib_install_rpaths = []
@@ -4028,7 +4032,7 @@ foreach test_dir : tests
       test_kwargs = {
         'protocol': 'tap',
         'priority': 10,
-        'timeout': 1000,
+        'timeout': test_timeout,
         'depends': test_deps + t.get('deps', []),
         'env': env,
       } + t.get('test_kwargs', {})
@@ -4101,7 +4105,7 @@ foreach test_dir : tests
       test_kwargs = {
         'protocol': 'tap',
         'suite': test_group,
-        'timeout': 1000,
+        'timeout': test_timeout,
         'depends': test_deps + t.get('deps', []),
         'env': env,
       } + t.get('test_kwargs', {})
diff --git a/src/test/isolation/meson.build b/src/test/isolation/meson.build
index c55b8d71848..15c684c01ec 100644
--- a/src/test/isolation/meson.build
+++ b/src/test/isolation/meson.build
@@ -67,7 +67,7 @@ tests += {
     'schedule': files('isolation_schedule'),
     'test_kwargs': {
       'priority': 40,
-      'timeout': 1000,
+      'timeout': test_timeout,
     },
     'dbname': 'isolation_regression',
   },
diff --git a/src/test/regress/meson.build b/src/test/regress/meson.build
index a5f2222e83a..3d0c973e659 100644
--- a/src/test/regress/meson.build
+++ b/src/test/regress/meson.build
@@ -52,7 +52,7 @@ tests += {
     'schedule': files('parallel_schedule'),
     'test_kwargs': {
       'priority': 50,
-      'timeout': 1000,
+      'timeout': test_timeout,
     },
     'dbname': 'regression',
   },
-- 
2.54.0

