Skip to content

[History Server][CI] add unit tests for the list API filters - #5238

Open
wuallen57730 wants to merge 1 commit into
ray-project:masterfrom
wuallen57730:historyserver-filter-unit-tests
Open

[History Server][CI] add unit tests for the list API filters#5238
wuallen57730 wants to merge 1 commit into
ray-project:masterfrom
wuallen57730:historyserver-filter-unit-tests

Conversation

@wuallen57730

Copy link
Copy Markdown

Why are these changes needed?

This PR worked on unit tests for historyserver/pkg/utils/filter.go.

It adds table-driven tests for the query parameter parsing (ParseOptionsFromReq, getFiltersFromReq, parsePredicate) and the filtering itself (ApplyTaskFilters, ApplyFilter), covering the defaults, the limit bounds, the rejection paths, and the ordering and truncation that the list endpoints rely on. No production code is changed.

Code coverage result

Code coverage of pkg/utils/filter.go is increased from 0.0% to 98.8% (83 of 84 statements). Overall code coverage of pkg/utils is increased from 27.3% to 46.2%.

The one uncovered statement is default: unsupported type %T in the parse closure, which is unreachable because the closure is only called with *int and *bool.

Related issue number

Part of #5222

Labels

  • If this PR has user-facing changes that require documentation updates at release time, I have added the doc-updates-required label.
  • If this PR contains breaking changes, I have added the breaking-change label.

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested 🙁

Tests run

go test -count=1 -race ./pkg/utils/

Signed-off-by: wuallen57730 <yuwu11926@gmail.com>
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