Centralize execution setting and session validation
This commit is contained in:
@@ -406,6 +406,41 @@ model: second
|
||||
})
|
||||
}
|
||||
|
||||
func TestProfileRepositoriesRejectInvalidExecutionSettings(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
t.Run("operating-system filesystem", func(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
writeProfileTestFile(t, filepath.Join(dir, "invalid.yaml"), `
|
||||
id: invalid
|
||||
endpoint: http://localhost:8000/v1
|
||||
model: model
|
||||
temperature: .nan
|
||||
`)
|
||||
|
||||
_, err := NewFilesystemRepository(dir).GetProfile(ctx, "invalid")
|
||||
if !errors.Is(err, ErrInvalidProfile) {
|
||||
t.Fatalf("expected ErrInvalidProfile, got %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("fs.FS", func(t *testing.T) {
|
||||
repo := NewFSRepository(fstest.MapFS{
|
||||
"profiles/invalid.yaml": profileMapFile(`
|
||||
id: invalid
|
||||
endpoint: http://localhost:8000/v1
|
||||
model: model
|
||||
top_p: .inf
|
||||
`),
|
||||
}, "profiles")
|
||||
|
||||
_, err := repo.GetProfile(ctx, "invalid")
|
||||
if !errors.Is(err, ErrInvalidProfile) {
|
||||
t.Fatalf("expected ErrInvalidProfile, got %v", err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestOverlayRepository(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
primaryProfile := &domain.ExecutionProfile{ID: "shared", Endpoint: "http://primary", Model: "primary"}
|
||||
|
||||
Reference in New Issue
Block a user