The default is the number of CPUs Go uses, so a container with no CPU limit on a host with many CPUs processes one image per CPU at once. These tests fail until the default in the config and in imageprocessor.New is held to 4 (#242). Model: opus-5-5
This commit is contained in:
@@ -32,6 +32,28 @@ func TestOmittedConcurrencyLimitsUseDefaults(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestOmittedMaxConcurrentProcessingIsAtMostFour checks that an omitted
|
||||
// max_concurrent_processing is the number of CPUs Go uses, but never more
|
||||
// than 4, so a container with no CPU limit on a host with many CPUs does not
|
||||
// process one image per CPU at once.
|
||||
func TestOmittedMaxConcurrentProcessingIsAtMostFour(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
c, err := configFromYAML(t, signingKeyLine)
|
||||
if err != nil {
|
||||
t.Fatalf("minimal config should be valid, got error: %v", err)
|
||||
}
|
||||
|
||||
want := min(runtime.GOMAXPROCS(0), 4)
|
||||
t.Logf("GOMAXPROCS %d, MaxConcurrentProcessing %d",
|
||||
runtime.GOMAXPROCS(0), c.MaxConcurrentProcessing)
|
||||
|
||||
if c.MaxConcurrentProcessing != want {
|
||||
t.Errorf("MaxConcurrentProcessing = %d, want %d",
|
||||
c.MaxConcurrentProcessing, want)
|
||||
}
|
||||
}
|
||||
|
||||
// TestExplicitConcurrencyLimitsAreUsed checks that valid values for the
|
||||
// two limits are used as given.
|
||||
func TestExplicitConcurrencyLimitsAreUsed(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user