썸네일 API 테스트를 호스트 ffmpeg 의존 제거(ServerOptions.FfmpegPath 주입, 가짜 러너 .jpg 출력만 기록) — PATH 에서 ffmpeg 사라져도 결정적 GREEN

This commit is contained in:
Yun Chan 2026-08-16 18:43:42 +09:00
parent c4dba66c15
commit 5a0ce730b2
3 changed files with 6 additions and 2 deletions

View file

@ -98,7 +98,7 @@ public sealed class ServerHost : IAsyncDisposable
// ── 라이브러리 / 스트리밍 ──
// ── 라이브러리 + 썸네일/해상도(M2) ──
var thumbnailer = options.Thumbnailer ?? ServerOptionsDefaults.DefaultThumbnailer();
var ffmpeg = VideoDownloader.Core.Platform.DesktopMediaMuxer.Default.ResolveFfmpeg(new VideoDownloader.Core.Config.AppConfig());
var ffmpeg = options.FfmpegPath ?? VideoDownloader.Core.Platform.DesktopMediaMuxer.Default.ResolveFfmpeg(new VideoDownloader.Core.Config.AppConfig());
app.MapGet("/api/library", async (HttpContext ctx) =>
{
var items = MediaLibrary.List(options.LibraryFolder);

View file

@ -24,6 +24,8 @@ public sealed class ServerOptions
public string DeviceName { get; init; } = Environment.MachineName;
/// <summary>썸네일/해상도 생성기(기본: DesktopProcessRunner 기반 ffmpeg). 테스트 주입 가능.</summary>
public Thumbnailer? Thumbnailer { get; init; }
/// <summary>ffmpeg 경로 오버라이드(기본: 설정→PATH 탐색). 호스트 ffmpeg 없는 환경 테스트용.</summary>
public string? FfmpegPath { get; init; }
}
/// <summary>기본 썸네일러 팩토리.</summary>

View file

@ -167,7 +167,8 @@ public class RemoteServerE2ETests : IDisposable
{
Behavior = (spec, _, _) =>
{
File.WriteAllBytes(spec.Args[^1], new byte[] { 0xFF, 0xD8, 0xFF, 0xE0, 0x01 });
if (spec.Args[^1].EndsWith(".jpg", StringComparison.OrdinalIgnoreCase)) // 해상도 프로브(미디어 경로)는 미오염
File.WriteAllBytes(spec.Args[^1], new byte[] { 0xFF, 0xD8, 0xFF, 0xE0, 0x01 });
return Task.FromResult(new VideoDownloader.Core.Platform.ProcessResult(0, "", ""));
},
};
@ -177,6 +178,7 @@ public class RemoteServerE2ETests : IDisposable
Port = 0, Token = "thumb-token", LibraryFolder = _libDir,
Queue = new FakeQueue(),
Thumbnailer = new Thumbnailer(fake),
FfmpegPath = "ffmpeg", // 호스트 ffmpeg 무관(가짜 러너가 프로세스를 대신함)
});
using var http = new HttpClient { BaseAddress = new Uri($"http://127.0.0.1:{server.Port}") };