test(worker): adapt planning tests to git-backed worktree flow
Update constructor calls (6-arg), seed AppSettings with sibling strategy, git-init working dirs via GitRepoFixture.InitRepoWithInitialCommit, and replace McpConfigPath assertions with worktree-path / .mcp.json checks. Also fixes PlanningHubTests which had the same 3-arg constructor. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using ClaudeDo.Data;
|
||||
using ClaudeDo.Data.Git;
|
||||
using ClaudeDo.Data.Models;
|
||||
using ClaudeDo.Data.Repositories;
|
||||
using ClaudeDo.Worker.Config;
|
||||
using ClaudeDo.Worker.Hub;
|
||||
using ClaudeDo.Worker.Planning;
|
||||
using ClaudeDo.Worker.Tests.Infrastructure;
|
||||
@@ -60,7 +62,11 @@ public sealed class PlanningEndToEndTests : IDisposable
|
||||
_lists = new ListRepository(_ctx);
|
||||
|
||||
var root = Path.Combine(Path.GetTempPath(), $"cd_e2e_{Guid.NewGuid():N}");
|
||||
_manager = new PlanningSessionManager(_tasks, _lists, root);
|
||||
var git = new GitService();
|
||||
var cfg = new WorkerConfig { CentralWorktreeRoot = Path.Combine(root, "central") };
|
||||
var settingsRepo = new AppSettingsRepository(_ctx);
|
||||
settingsRepo.UpdateAsync(new AppSettingsEntity { WorktreeStrategy = "sibling" }).GetAwaiter().GetResult();
|
||||
_manager = new PlanningSessionManager(_tasks, _lists, settingsRepo, git, cfg, root);
|
||||
|
||||
_httpContext = new DefaultHttpContext();
|
||||
_accessor = new PlanningMcpContextAccessor(new E2EFakeHttpContextAccessor { HttpContext = _httpContext });
|
||||
@@ -74,7 +80,8 @@ public sealed class PlanningEndToEndTests : IDisposable
|
||||
public async Task StartThenCreateThenFinalize_FullFlow()
|
||||
{
|
||||
var listId = Guid.NewGuid().ToString();
|
||||
var wd = Path.GetTempPath();
|
||||
var wd = Path.Combine(Path.GetTempPath(), $"cd_e2e_wd_{Guid.NewGuid():N}");
|
||||
GitRepoFixture.InitRepoWithInitialCommit(wd);
|
||||
await _lists.AddAsync(new ListEntity { Id = listId, Name = "L", WorkingDir = wd, CreatedAt = DateTime.UtcNow });
|
||||
|
||||
var parent = new TaskEntity
|
||||
@@ -89,7 +96,7 @@ public sealed class PlanningEndToEndTests : IDisposable
|
||||
await _tasks.AddAsync(parent);
|
||||
|
||||
var startCtx = await _manager.StartAsync(parent.Id, CancellationToken.None);
|
||||
Assert.True(File.Exists(startCtx.Files.McpConfigPath));
|
||||
Assert.True(File.Exists(Path.Combine(startCtx.WorktreePath, ".mcp.json")));
|
||||
|
||||
// Wire the ambient context so _svc reads the correct parent
|
||||
_httpContext.Items["PlanningContext"] = new PlanningMcpContext { ParentTaskId = parent.Id };
|
||||
|
||||
Reference in New Issue
Block a user