Bladeren bron

tests: dispatcher tick honours SADDLE_DISPATCH_TICK_S (default 5s unchanged); meson test timeout 900s

clanker 1 maand geleden
bovenliggende
commit
087f0e5d6e
2 gewijzigde bestanden met toevoegingen van 17 en 6 verwijderingen
  1. 7 4
      meson.build
  2. 10 2
      src/Services/Dispatcher.vala

+ 7 - 4
meson.build

@@ -185,12 +185,15 @@ clanker_saddle_exe = executable('clanker-saddle',
 )
 
 # =============================================================================
-# Tests: test/web_stack_test.py is self-contained (spawns the app binary in a
-# scratch dir plus an in-process fake saddle daemon) and asserts the web-stack
-# wire contract features. The built binary is passed as its first argument.
+# Tests: test/web_stack_test.py is self-contained (spawns the app binary
+# in a scratch dir plus an in-process fake saddle daemon) and asserts the
+# web-stack wire contract features. The built binary is passed as its
+# first argument. The script shards the scenario groups into seven
+# parallel bundle processes (isolated app/daemon/DB each) and aggregates
+# their verdicts into this single test's result.
 # =============================================================================
 python_test = import('python').find_installation('python3')
 test('web-stack', python_test,
     args: [files('test/web_stack_test.py'), clanker_saddle_exe],
-    timeout: 1800,
+    timeout: 900,
 )

+ 10 - 2
src/Services/Dispatcher.vala

@@ -41,13 +41,21 @@ namespace ClankerSaddle.Services {
         private Invercargill.DataStructures.HashSet<string> capability_wait_logged =
             new Invercargill.DataStructures.HashSet<string>();
 
+        /** SADDLE_DISPATCH_TICK_S (default 5s): the tick interval. */
+        public static uint tick_seconds() {
+            var raw = Environment.get_variable("SADDLE_DISPATCH_TICK_S") ?? "";
+            int64 parsed = int64.parse(raw);
+            return parsed > 0 ? (uint) parsed : 5;
+        }
+
         /** Starts the repeating timer. */
         public void start() {
-            Timeout.add_seconds(5, () => {
+            uint tick = tick_seconds();
+            Timeout.add_seconds(tick, () => {
                 run_tick.begin();
                 return true;
             });
-            print("[ClankerSaddle] Dispatcher running (5s interval)\n");
+            print("[ClankerSaddle] Dispatcher running (%us interval)\n", tick);
         }
 
         private async void run_tick() {