From efc908b9bada29a446d94f58bcc93cd06dd7bb6d Mon Sep 17 00:00:00 2001 From: sneak Date: Thu, 15 Oct 2026 09:04:40 +0000 Subject: [PATCH] Test that an invalid PIXA_MAX_CONCURRENT_PROCESSING aborts startup An empty, fractional, negative or non-numeric value must abort startup naming the variable and the key, never fall back to the default. The config loader already refuses these; this pins it before the default changes (https://git.eeqj.de/sneak/pixa/issues/242). Model: opus-5-5 --- .../config/concurrency_limits_internal_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/internal/config/concurrency_limits_internal_test.go b/internal/config/concurrency_limits_internal_test.go index c5f4b20..867b041 100644 --- a/internal/config/concurrency_limits_internal_test.go +++ b/internal/config/concurrency_limits_internal_test.go @@ -1,6 +1,7 @@ package config import ( + "fmt" "runtime" "testing" ) @@ -160,3 +161,19 @@ func TestConcurrencyLimitsFromEnvironment(t *testing.T) { }) } } + +// TestInvalidMaxConcurrentProcessingFromEnvironmentAbortsStartup checks +// that a PIXA_MAX_CONCURRENT_PROCESSING that is not a whole number of at +// least 1, an empty one included, aborts startup naming the variable and +// the key instead of taking the default. +func TestInvalidMaxConcurrentProcessingFromEnvironmentAbortsStartup(t *testing.T) { + for _, value := range []string{"", " ", "0.5", "half", "-1", "4 images"} { + t.Run(fmt.Sprintf("value %q", value), func(t *testing.T) { + t.Setenv(testMaxConcurrentProcessingVar, value) + + _, err := configFromYAML(t, signingKeyLine) + wantStartupError(t, err, + testMaxConcurrentProcessingVar, keyMaxConcurrentProcessing) + }) + } +}