stereoscope icon indicating copy to clipboard operation
stereoscope copied to clipboard

Improve test coverage to >= 80%

Open wagoodman opened this issue 5 years ago • 2 comments

Once coverage is at a good threshold, add a quality gate to the pipeline to prevent regression of coverage below a threshold.

wagoodman avatar Jun 03 '20 11:06 wagoodman

Via

$ go test ./... -coverprofile=c.out
$ go tool cover -func c.out

As of today the total coverage is at 48.8%

jonasagx avatar Nov 03 '21 05:11 jonasagx

Thanks @jonasagx --also, the Makefile has the unit tests asserting minimal coverage (right now the quality gate threshold is 45%):

❯ make unit
Running unit tests
go test --race -coverprofile test/results/unit-coverage-details.txt github.com/anchore/stereoscope github.com/anchore/stereoscope/examples github.com/anchore/stereoscope/internal github.com/anchore/stereoscope/internal/bus github.com/anchore/stereoscope/internal/docker github.com/anchore/stereoscope/internal/log github.com/anchore/stereoscope/pkg/event github.com/anchore/stereoscope/pkg/event/parsers github.com/anchore/stereoscope/pkg/file github.com/anchore/stereoscope/pkg/filetree github.com/anchore/stereoscope/pkg/filetree/filenode github.com/anchore/stereoscope/pkg/image github.com/anchore/stereoscope/pkg/image/docker github.com/anchore/stereoscope/pkg/image/oci github.com/anchore/stereoscope/pkg/imagetest github.com/anchore/stereoscope/pkg/logger github.com/anchore/stereoscope/pkg/tree github.com/anchore/stereoscope/pkg/tree/node
?       github.com/anchore/stereoscope  [no test files]
?       github.com/anchore/stereoscope/examples [no test files]
...
ok      github.com/anchore/stereoscope/pkg/tree 0.369s  coverage: 67.9% of statements
?       github.com/anchore/stereoscope/pkg/tree/node    [no test files]
Coverage: 48.8

wagoodman avatar Nov 17 '21 20:11 wagoodman