test(worker): clean up non-git test tmp dir and assert self-heal setup exit code
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -242,12 +242,17 @@ public sealed class PlanningSessionManagerTests : IDisposable
|
|||||||
var listId = Guid.NewGuid().ToString();
|
var listId = Guid.NewGuid().ToString();
|
||||||
var wd = Path.Combine(Path.GetTempPath(), $"cd_nogit_{Guid.NewGuid():N}");
|
var wd = Path.Combine(Path.GetTempPath(), $"cd_nogit_{Guid.NewGuid():N}");
|
||||||
Directory.CreateDirectory(wd);
|
Directory.CreateDirectory(wd);
|
||||||
|
try
|
||||||
|
{
|
||||||
await _lists.AddAsync(new ListEntity { Id = listId, Name = "NoGit", WorkingDir = wd, CreatedAt = DateTime.UtcNow });
|
await _lists.AddAsync(new ListEntity { Id = listId, Name = "NoGit", WorkingDir = wd, CreatedAt = DateTime.UtcNow });
|
||||||
|
|
||||||
var t = await SeedManualTaskAsync(listId);
|
var t = await SeedManualTaskAsync(listId);
|
||||||
|
|
||||||
await Assert.ThrowsAsync<InvalidOperationException>(() => _sut.StartAsync(t.Id, CancellationToken.None));
|
await Assert.ThrowsAsync<InvalidOperationException>(() => _sut.StartAsync(t.Id, CancellationToken.None));
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
try { Directory.Delete(wd, recursive: true); } catch { /* best effort */ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task StartAsync_SelfHealsWhenBranchAlreadyExists()
|
public async Task StartAsync_SelfHealsWhenBranchAlreadyExists()
|
||||||
@@ -264,6 +269,7 @@ public sealed class PlanningSessionManagerTests : IDisposable
|
|||||||
procInfo.ArgumentList.Add(head);
|
procInfo.ArgumentList.Add(head);
|
||||||
var p = System.Diagnostics.Process.Start(procInfo)!;
|
var p = System.Diagnostics.Process.Start(procInfo)!;
|
||||||
p.WaitForExit();
|
p.WaitForExit();
|
||||||
|
Assert.True(p.ExitCode == 0, $"git branch setup failed with exit {p.ExitCode}");
|
||||||
|
|
||||||
var ctx = await _sut.StartAsync(parent.Id, CancellationToken.None);
|
var ctx = await _sut.StartAsync(parent.Id, CancellationToken.None);
|
||||||
Assert.True(Directory.Exists(ctx.WorktreePath));
|
Assert.True(Directory.Exists(ctx.WorktreePath));
|
||||||
|
|||||||
Reference in New Issue
Block a user