You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "Tsukikage7 (via GitHub)" <gi...@apache.org> on 2025/12/20 15:12:51 UTC
[PR] test(logger): add unit tests to improve coverage [dubbo-go]
Tsukikage7 opened a new pull request, #3119:
URL: https://github.com/apache/dubbo-go/pull/3119
- zap: add tests for NewDefault, encoderConfig, text/default format, console and file appenders, invalid level handling (74.1% -> 100%)
- logrus: add tests for text/default format, console and file appenders, valid level handling (95.2% -> 100%)
- logger: add tests for SetLoggerLevel with non-OpsLogger (90.6% -> 93.8%)
### Description
Fixes #1234
### Checklist
- [x] I confirm the target branch is `main`
- [x] Code has passed local testing
- [x] I have added tests that prove my fix is effective or that my feature works
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] test(logger): add unit tests to improve coverage [dubbo-go]
Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks merged PR #3119:
URL: https://github.com/apache/dubbo-go/pull/3119
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] test(logger): add unit tests to improve coverage [dubbo-go]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #3119:
URL: https://github.com/apache/dubbo-go/pull/3119#issuecomment-3678438100
## [Codecov](https://app.codecov.io/gh/apache/dubbo-go/pull/3119?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 37.10%. Comparing base ([`e022ba5`](https://app.codecov.io/gh/apache/dubbo-go/commit/e022ba5163ab632f75840e3fb39ab483f5f867fe?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`8e84276`](https://app.codecov.io/gh/apache/dubbo-go/commit/8e842769d5692fff65ef85ce911aef7a85fcf17a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 2 commits behind head on develop.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## develop #3119 +/- ##
===========================================
+ Coverage 37.05% 37.10% +0.05%
===========================================
Files 460 460
Lines 32997 32997
===========================================
+ Hits 12227 12245 +18
+ Misses 19543 19527 -16
+ Partials 1227 1225 -2
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/dubbo-go/pull/3119?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] test(logger): add unit tests to improve coverage [dubbo-go]
Posted by "Tsukikage7 (via GitHub)" <gi...@apache.org>.
Tsukikage7 commented on PR #3119:
URL: https://github.com/apache/dubbo-go/pull/3119#issuecomment-3677904448
### CI Status Note
The failure in `triple_protocol` tests is unrelated to this PR.
It can be reproduced on the current `main` branch by running:
go test ./protocol/triple/...
This PR only adds unit tests under the `logger` module.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] test(logger): add unit tests to improve coverage [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3119:
URL: https://github.com/apache/dubbo-go/pull/3119#issuecomment-3678798336
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3119) **Quality Gate passed**
Issues
 [34 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3119&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3119&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3119&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3119&metric=new_coverage&view=list)
 [15.9% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3119&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3119)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] test(logger): add unit tests to improve coverage [dubbo-go]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #3119:
URL: https://github.com/apache/dubbo-go/pull/3119#discussion_r2637578678
##########
logger/logger_test.go:
##########
@@ -58,3 +58,34 @@ func TestSetLoggerLevel(t *testing.T) {
t.Fatalf("expected level 'warn', got %q", m.level)
}
}
+
+// simpleLogger implements Logger but NOT OpsLogger
+type simpleLogger struct{}
+
+func (s *simpleLogger) Debug(args ...any) {}
+func (s *simpleLogger) Debugf(template string, args ...any) {}
+func (s *simpleLogger) Info(args ...any) {}
+func (s *simpleLogger) Infof(template string, args ...any) {}
+func (s *simpleLogger) Warn(args ...any) {}
+func (s *simpleLogger) Warnf(template string, args ...any) {}
+func (s *simpleLogger) Error(args ...any) {}
+func (s *simpleLogger) Errorf(template string, args ...any) {}
+func (s *simpleLogger) Fatal(args ...any) {}
+func (s *simpleLogger) Fatalf(fmt string, args ...any) {}
+
+func TestSetLoggerLevel_NotOpsLogger(t *testing.T) {
+ s := &simpleLogger{}
+ SetLogger(s)
+ ok := SetLoggerLevel("debug")
+ if ok {
+ t.Fatalf("expected SetLoggerLevel to return false for non-OpsLogger")
+ }
+}
+
+func TestGetLogger_ReturnsSetLogger(t *testing.T) {
+ s := &simpleLogger{}
+ SetLogger(s)
+ if GetLogger() != s {
+ t.Fatalf("GetLogger should return the logger set by SetLogger")
+ }
+}
Review Comment:
This test duplicates the functionality already covered by TestSetAndGetLogger (lines 42-48). Both tests verify that GetLogger returns the logger set by SetLogger. The only difference is the logger type used (simpleLogger vs mockLogger), but since both implement the Logger interface and the test is not exercising OpsLogger-specific behavior, this test provides redundant coverage. Consider removing this test to avoid duplication.
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] test(logger): add unit tests to improve coverage [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3119:
URL: https://github.com/apache/dubbo-go/pull/3119#issuecomment-3677890469
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3119) **Quality Gate passed**
Issues
 [35 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3119&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3119&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3119&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3119&metric=new_coverage&view=list)
 [15.1% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3119&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3119)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org