Files
TradarrV2/backend/cmd/server/laya_composition_test.go
Blomios 1123360914 feat(laya): integrate HTTP ranking service
Add the pinned Laya HTTP ranker and production composition, configure the CPU Compose service and cache, and document operations. Cover protocol validation, generation orchestration, sanitized logging, and Compose wiring.

Refs #17

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-22 00:55:18 +01:00

41 lines
986 B
Go

package main
import (
"go/ast"
"go/parser"
"go/token"
"testing"
)
// Keep the executable's production composition wired through server.Dependencies,
// rather than relying only on unit tests that inject a fake ranker.
func TestProductionCompositionSuppliesLayaRankerToServerDependencies(t *testing.T) {
file, err := parser.ParseFile(token.NewFileSet(), "main.go", nil, 0)
if err != nil {
t.Fatal(err)
}
found := false
ast.Inspect(file, func(node ast.Node) bool {
literal, ok := node.(*ast.CompositeLit)
if !ok {
return true
}
selector, ok := literal.Type.(*ast.SelectorExpr)
if !ok || selector.Sel.Name != "Dependencies" {
return true
}
for _, element := range literal.Elts {
kv, ok := element.(*ast.KeyValueExpr)
if ok {
if key, ok := kv.Key.(*ast.Ident); ok && key.Name == "LayaRanker" {
found = true
}
}
}
return true
})
if !found {
t.Fatal("cmd/server main does not pass a LayaRanker through server.Dependencies")
}
}