Skip to content

[History Server] Add unit tests for uncovered pure functions #5222

Description

@win5923

Description

Increase History Server test coverage by adding unit tests for pure functions.

Each item should be a small, self-contained change consisting primarily of a add or extend _test.go file with table-driven test cases. No production code changes are expected.

Reproducing the numbers

Measured on master @ eed5b24:

cd historyserver
go test -coverprofile=cover.out ./pkg/... ./cmd/...

# total
go tool cover -func=cover.out | tail -1
# -> total:  (statements)  40.6%

# line-level HTML report, useful for picking the branches worth pinning
go tool cover -html=cover.out

Current coverage by package

Package Coverage
pkg/storage/clustermetadata 97.9%
pkg/storage/clusterlogs 96.6%
pkg/eventserver 64.3%
pkg/collector/eventcollector 62.6%
pkg/compression 62.1%
pkg/storage/gcs 59.8%
pkg/collector/logcollector 40.2%
pkg/historyserver 39.5%
pkg/eventserver/types 29.7%
pkg/utils 27.1%
pkg/storage/s3 0.0%
pkg/storage/azureblob 0.0%
pkg/storage/aliyunoss/ray 0.0%
total 40.6%

Files that need test cases

Each item is independent.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions