Files
ds-galo/backend/internal/video/toolchain_test.go
T
iu d38ede0201 feat(video): add video upload with remux/transcode playback
Add video as a media kind in photos: streaming upload with per-kind
limits, ffprobe metadata, poster frame reusing the image variant
pipeline, and a playback object (remux when web-compatible, else
h264/yuv420p/aac transcode). Video jobs run on a separate pool with a
long lease. Frontend gains a video viewer, grid badge/duration and
video upload.
2026-10-11 20:37:53 +03:00

46 lines
1.0 KiB
Go

package video
import (
"os"
"testing"
"galo/internal/config"
)
func TestDetectUnavailable(t *testing.T) {
tc := Detect(config.Video{
FFmpegPath: "definitely-missing-ffmpeg-xyz",
FFprobePath: "definitely-missing-ffprobe-xyz",
})
if tc.Available() {
t.Fatalf("expected unavailable toolchain, got %+v", tc)
}
}
func TestDetectAvailable(t *testing.T) {
self, err := os.Executable()
if err != nil {
t.Fatalf("executable: %v", err)
}
tc := Detect(config.Video{FFmpegPath: self, FFprobePath: self, TempDir: "/tmp"})
if !tc.Available() {
t.Fatalf("expected available toolchain, got %+v", tc)
}
if tc.FFmpegPath() != self || tc.FFprobePath() != self {
t.Fatalf("paths = %q %q", tc.FFmpegPath(), tc.FFprobePath())
}
if tc.TempDir() != "/tmp" {
t.Fatalf("temp dir = %q", tc.TempDir())
}
}
func TestNilToolchain(t *testing.T) {
var tc *Toolchain
if tc.Available() {
t.Fatal("nil toolchain must be unavailable")
}
if tc.FFmpegPath() != "" || tc.FFprobePath() != "" || tc.TempDir() != "" {
t.Fatal("nil toolchain accessors must be empty")
}
}