Sandbox-Test: die Prozessgrenze zaehlt nur die Sandbox (#654)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b74177c142
commit
6204f1247c
@@ -195,6 +195,17 @@ public sealed class SandboxEscapeTests : IDisposable
|
||||
(result.StandardError + result.StandardOutput).ShouldMatch("(?i)(fork|resource temporarily unavailable|cannot)");
|
||||
}
|
||||
|
||||
[SandboxFact]
|
||||
public async Task The_limit_counts_the_sandbox_not_the_instances_threads()
|
||||
{
|
||||
// The instance itself runs hundreds of threads under the same user. Were those counted,
|
||||
// the first fork would fail; five of ten must go.
|
||||
var result = await Sh("i=0; while [ $i -lt 5 ]; do sleep 1 & i=$((i+1)); done; wait; echo started $i",
|
||||
new SandboxLimits { Timeout = TimeSpan.FromSeconds(20), MaxProcesses = 10 });
|
||||
|
||||
result.StandardOutput.ShouldContain("started 5", customMessage: result.StandardError);
|
||||
}
|
||||
|
||||
[SandboxFact]
|
||||
public async Task The_programs_exit_code_comes_back()
|
||||
=> (await Sh("exit 3")).ExitCode.ShouldBe(3);
|
||||
|
||||
Reference in New Issue
Block a user