CentaurusInfra / arktos

Arktos for large-scale cloud platform
Apache License 2.0
245 stars 69 forks source link

Task: Create Consolidated UT coverage report of Arktos #578

Open Sindica opened 4 years ago

Sindica commented 4 years ago

What would you like to be added:

Why is this needed:

Sindica commented 4 years ago

./hack/make-rules/test.sh

Line 73: KUBE_COVER=${KUBE_COVER:-n} # set to 'y' to enable coverage collection

Line 266 - 277:

  # If we're not collecting coverage, run all requested tests with one 'go test'
  # command, which is much faster.
  if [[ ! ${KUBE_COVER} =~ ^[yY]$ ]]; then
   kube::log::status "Running tests without code coverage"
...
  fi

Line 296 - 301:

  # ignore paths:
  # vendor/k8s.io/code-generator/cmd/generator: is fragile when run under coverage, so ignore it for now.
  #                            https://github.com/kubernetes/kubernetes/issues/24967
  # vendor/k8s.io/client-go/1.4/rest: causes cover internal errors
  #                            https://github.com/golang/go/issues/16540
  cover_ignore_dirs="vendor/k8s.io/code-generator/cmd/generator|vendor/k8s.io/client-go/1.4/rest"

We should have those folder reported in test coverage.

Sindica commented 4 years ago

Arktos-UT-Coverage-20200812-1.zip This file does not have ignored dirs.

Sindica commented 4 years ago

Coverage report here: https://arktos-ut-report.s3-us-west-2.amazonaws.com/2020-08-12/combined-coverage.html

Sindica commented 4 years ago

Coverage data does not match Goland report. Example: . pkg/cloudfabric-controller/controller_ref_manager.go: 64.3% covered in goland, 35.7% covered in combined report. . pkg/cloudfabric-controller/controller_utils.go: 61.3% covered in goland, 45.8% in combined report. . pkg/cloudfabric-controller/controllerframework/controller_framework.go: 75.7% in goland, 66.3% in combined report.

Sindica commented 4 years ago

Tried to run make test with WHAT=k8s.io/kubernetes/pkg/cloudfabric-controller/controllerframework, got similar coverage data in report & goland.

Sindica commented 4 years ago

I figured out the reason why coverage difference between make test and goland. . When running test coverage from pkg/cloudfabric-controller/controllerframework, make test and goland produce similar coverage data. . When running test coverage from outer folder (pkg/cloudfabric-controller), make test coverage only has coverage data for the root folder and different from goland data is obvious. Goland instead would have all file test coverage and thus have higher coverage number than make test.