Skip to content

Commit f5392ab

Browse files
authored
Stabilize Docker entrypoint test timeout (#5132) (#5150)
1 parent 53a0a2d commit f5392ab

3 files changed

Lines changed: 22 additions & 4 deletions

File tree

TESTING_GUIDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ Candidate-ordered parallel-index recovery tests must prove that the fatal result
397397
TypeScript and Java language-alias filtering share one multi-language database because unique query markers isolate each language result.
398398
Kotlin backtick and Java Unicode-escape canonicalization share the path-filtered C# verbatim canonical fixture rather than creating separate databases.
399399
`TrimmedCliTestHelper` owns trimmed publish setup and published CLI subprocess execution. Use its shared non-single-file publish for published CLI smoke coverage so a test process pays that publish cost once; keep single-file tests on an explicit per-test publish because they verify a distinct apphost shape. Published CLI smoke tests run only on the `net8.0` test target because the production CLI targets `net8.0`; focused in-process tests keep cross-target behavior covered without repeating the expensive publish on `net9.0`.
400-
Installer snippet and Docker entrypoint script coverage use `ProductionCliFactAttribute` / `ProductionCliTheoryAttribute`, run only on the `net8.0` test target, and are skipped during discovery on Windows because they require a Unix shell. This avoids constructing per-test temporary installer fixtures for cases that cannot execute on that platform.
400+
Installer snippet and Docker entrypoint script coverage use `ProductionCliFactAttribute` / `ProductionCliTheoryAttribute`, run only on the `net8.0` test target, and are skipped during discovery on Windows because they require a Unix shell. This avoids constructing per-test temporary installer fixtures for cases that cannot execute on that platform. The Docker entrypoint fixture keeps a bounded 30-second process deadline so concurrent full-suite scheduling contention does not turn a sub-second shell contract into a false timeout; timeout still kills the fixture process tree.
401401
`RunBuiltCli` / `RunCliInSubprocess` subprocess coverage, including timeout-guarded subprocess probes, uses `ProductionRuntimeFactAttribute` / `ProductionRuntimeTheoryAttribute` and runs only on the `net8.0` test target when the subprocess resolves to the production `net8.0` CLI; keep direct in-process command-runner tests cross-target.
402402
When a production-runtime test only needs the built CLI to create an indexed fixture, keep that subprocess boundary on the indexing step and run query assertions, including count/path/format variants, in-process through the command runner helpers unless the assertion depends on process-boundary behavior.
403403
Full-scan scheduling coverage that only needs one active post-extraction hook uses the compact `CodeIndex.HookIsolationFixture` assembly. Do not copy the full test assembly into that fixture when hook contents are not part of the assertion.
@@ -1498,7 +1498,7 @@ dotnet test --filter "FullyQualifiedName~GitHelperTests"
14981498
TypeScriptとJavaのlanguage-alias filteringは、固有query markerで各言語結果を分離できるため1つのmulti-language databaseを共有してください。
14991499
Kotlin backtickとJava Unicode-escape canonicalizationは別databaseを作らず、path-filtered C# verbatim canonical fixtureを共有してください。
15001500
`TrimmedCliTestHelper` が trimmed publish setup と published CLI subprocess execution を所有します。published CLI smoke coverage は共有の non-single-file publish を使い、test process あたり 1 回の publish cost に抑えてください。single-file test は apphost shape が別なので、明示的な per-test publish のままにします。published CLI smoke test は production CLI が `net8.0` target であることに合わせて `net8.0` test target でのみ実行し、`net9.0` では高コストな publish を繰り返さず focused な in-process test で cross-target behavior を維持します。
1501-
installer snippet と Docker entrypoint script coverage は `ProductionCliFactAttribute` / `ProductionCliTheoryAttribute` を使い、これらの shell script が target framework 非依存で production CLI が `net8.0` target であることに合わせて `net8.0` test target でのみ実行し、Unix shellを使えないWindowsではdiscovery時にskipします。実行不能なcaseごとのtemporary installer fixture構築を避けてください。
1501+
installer snippet と Docker entrypoint script coverage は `ProductionCliFactAttribute` / `ProductionCliTheoryAttribute` を使い、これらの shell script が target framework 非依存で production CLI が `net8.0` target であることに合わせて `net8.0` test target でのみ実行し、Unix shellを使えないWindowsではdiscovery時にskipします。実行不能なcaseごとのtemporary installer fixture構築を避けてください。Docker entrypoint fixture は有界な30秒のprocess deadlineを使い、同時実行されるfull-suiteのscheduler競合で1秒未満のshell契約が誤ってtimeoutにならないようにします。timeout時は引き続きfixtureのprocess treeをkillします。
15021502
`RunBuiltCli` / `RunCliInSubprocess` subprocess coverage は、timeout guard 付きの subprocess probe も含め、subprocess が production `net8.0` CLI に解決される場合は `ProductionRuntimeFactAttribute` / `ProductionRuntimeTheoryAttribute` を使って `net8.0` test target でのみ実行し、direct in-process command-runner test は cross-target のままにします。
15031503
production-runtime test が built CLI を indexed fixture の作成にだけ必要とする場合は、subprocess boundary を indexing step に残し、count/path/format variant も含め、process boundary の挙動に依存する assertion を除いて query assertion を command runner helper 経由で in-process 実行してください。
15041504
activeなpost-extraction hookが1件あれば十分なfull-scan scheduling coverageでは、小型の`CodeIndex.HookIsolationFixture` assemblyを使います。hook内容自体がassertion対象でない場合に巨大なtest assemblyをfixtureへcopyしないでください。
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
category: fixed
3+
issues:
4+
- 5132
5+
affected:
6+
- tests/CodeIndex.Tests/ReleaseWorkflowDockerContractTests.cs
7+
- TESTING_GUIDE.md
8+
---
9+
10+
## English
11+
12+
- **Docker entrypoint contract tests now tolerate normal full-suite contention (#5132)** — the fixture keeps a bounded 30-second process deadline, preventing a load-sensitive false timeout while still killing a genuinely stuck process tree.
13+
14+
## 日本語
15+
16+
- **Docker entrypoint 契約テストが通常の full-suite 競合を許容するようになりました (#5132)** — fixture は有界な30秒の process deadline を使い、負荷依存の誤った timeout を防ぎつつ、実際に停止した process tree は引き続き kill します。

tests/CodeIndex.Tests/ReleaseWorkflowDockerContractTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ namespace CodeIndex.Tests;
66

77
public partial class ReleaseWorkflowTests
88
{
9+
private static readonly TimeSpan DockerEntrypointFixtureTimeout = TimeSpan.FromSeconds(30);
10+
911
[Fact]
1012
public void ReleaseWorkflow_DockerfileDocumentsSdkRuntimeSplit()
1113
{
@@ -157,10 +159,10 @@ private static (int ExitCode, string Stdout, string Stderr) RunDockerEntrypoint(
157159
process.StartInfo.Environment["CDIDX_RUN_GID"] = targetGid;
158160

159161
process.Start();
160-
if (!process.WaitForExit(5000))
162+
if (!process.WaitForExit((int)DockerEntrypointFixtureTimeout.TotalMilliseconds))
161163
{
162164
process.Kill(entireProcessTree: true);
163-
throw new TimeoutException("docker-entrypoint.sh fixture did not exit within 5 seconds.");
165+
throw new TimeoutException($"docker-entrypoint.sh fixture did not exit within {DockerEntrypointFixtureTimeout.TotalSeconds:0} seconds.");
164166
}
165167

166168
return (process.ExitCode, process.StandardOutput.ReadToEnd(), process.StandardError.ReadToEnd());

0 commit comments

Comments
 (0)