MCPcopy
hub / github.com/mudler/LocalAI / runAdmission

Function runAdmission

core/http/middleware/admission_test.go:39–47  ·  view source on GitHub ↗
(lim *admission.Limiter, store *recordingStore, cfg *config.ModelConfig, handler echo.HandlerFunc)

Source from the content-addressed store, hash-verified

37func (r *recordingStore) Close() error { return nil }
38
39func runAdmission(lim *admission.Limiter, store *recordingStore, cfg *config.ModelConfig, handler echo.HandlerFunc) (*httptest.ResponseRecorder, error) {
40 req := httptest.NewRequest(http.MethodPost, "/v1/chat/completions", strings.NewReader("{}"))
41 rec := httptest.NewRecorder()
42 c := echo.New().NewContext(req, rec)
43 c.Set(CONTEXT_LOCALS_KEY_MODEL_CONFIG, cfg)
44 mw := AdmissionControl(lim, store)
45 err := mw(handler)(c)
46 return rec, err
47}
48
49var _ = Describe("Admission", func() {
50 It("allows when under limit", func() {

Callers 1

admission_test.goFile · 0.85

Calls 3

AdmissionControlFunction · 0.85
mwFunction · 0.85
SetMethod · 0.65

Tested by

no test coverage detected