openyurtio / yurt-app-manager

The workload controller manager from NodePool level in OpenYurt cluster
Apache License 2.0
6 stars 1 forks source link

add yurtingress controller unit test #85

Closed rudolf-chy closed 2 years ago

rudolf-chy commented 2 years ago

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line: /kind bug /kind documentation /kind enhancement /kind good-first-issue /kind feature /kind question /kind design /sig ai /sig iot /sig network /sig storage /sig storage

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

other Note

zzguang commented 2 years ago

@Rudolf1998 , the current unit test coverage is only about 18.8% basing on your PR, which can not meet the 70% target, could you please optimize it to improve the ratio? thanks! $go test ./pkg/yurtappmanager/controller/yurtingress/... --covermode=count ok github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/controller/yurtingress (cached) coverage: 18.8% of statements

kadisi commented 2 years ago

@Rudolf1998 , the current unit test coverage is only about 18.8% basing on your PR, which can not meet the 70% target, could you please optimize it to improve the ratio? thanks! $go test ./pkg/yurtappmanager/controller/yurtingress/... --covermode=count ok github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/controller/yurtingress (cached) coverage: 18.8% of statements

@zzguang I think 70% test coverage for the entire yurt-app-managerrepo is enough, and some unit tests will need mock tests, which we can implement uniformly later.

zzguang commented 2 years ago

@Rudolf1998 , the current unit test coverage is only about 18.8% basing on your PR, which can not meet the 70% target, could you please optimize it to improve the ratio? thanks! $go test ./pkg/yurtappmanager/controller/yurtingress/... --covermode=count ok github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/controller/yurtingress (cached) coverage: 18.8% of statements

@zzguang I think 70% test coverage for the entire yurt-app-managerrepo is enough, and some unit tests will need mock tests, which we can implement uniformly later.

Okay, agree with you to implement the mock test in future.

kadisi commented 2 years ago

/approve

zzguang commented 2 years ago

/lgtm

codecov[bot] commented 2 years ago

Codecov Report

Merging #85 (12f13bc) into master (4fd0202) will increase coverage by 1.55%. The diff coverage is n/a.

@@            Coverage Diff            @@
##           master     #85      +/-   ##
=========================================
+ Coverage    7.78%   9.34%   +1.55%     
=========================================
  Files          17      18       +1     
  Lines        1901    2258     +357     
=========================================
+ Hits          148     211      +63     
- Misses       1724    2010     +286     
- Partials       29      37       +8     
Flag Coverage Δ
unittests 9.34% <ø> (+1.55%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...r/controller/yurtingress/yurtingress_controller.go 17.64% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

kadisi commented 2 years ago

@Rudolf1998 please check ci/golangci-lint error info .

zzguang commented 2 years ago

/lgtm

Congrool commented 2 years ago

Fixes #76

zzguang commented 2 years ago

/approve

openyurt-bot commented 2 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kadisi, Rudolf1998, zzguang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/openyurtio/yurt-app-manager/blob/master/OWNERS)~~ [kadisi,zzguang] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment