Skip to content

test(config): add unit tests for BuildNameFilterFn#10018

Open
shihyunhuang wants to merge 3 commits into
mudler:masterfrom
shihyunhuang:test/model-config-name-filter
Open

test(config): add unit tests for BuildNameFilterFn#10018
shihyunhuang wants to merge 3 commits into
mudler:masterfrom
shihyunhuang:test/model-config-name-filter

Conversation

@shihyunhuang
Copy link
Copy Markdown

@shihyunhuang shihyunhuang commented May 26, 2026

Description
This PR adds unit tests for BuildNameFilterFn in core/config/model_config_filter.go.
BuildNameFilterFn is called by the GET /v1/models endpoint to filter the model list by name regex. Despite being used across several API handlers, the function had no test coverage.
The three test cases cover:

  • Empty filter string returns a pass-all filter (no error)
  • Invalid regex returns an error and a nil function (prevents panic in callers)
  • Valid regex correctly matches models by name

Notes for Reviewers
No behaviour changes — tests only. The new file is core/config/model_config_filter_test.go.

Signed commits

  • Yes, I signed my commits.

@shihyunhuang shihyunhuang marked this pull request as draft May 26, 2026 20:38
@shihyunhuang shihyunhuang marked this pull request as ready for review May 26, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant