You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "everfid-ever (via GitHub)" <gi...@apache.org> on 2025/11/06 11:03:34 UTC

[PR] test: improve test coverage for pkg/discovery/mock [incubator-seata-go]

everfid-ever opened a new pull request, #984:
URL: https://github.com/apache/incubator-seata-go/pull/984

   **Which issue(s) this PR fixes**:
   
   Fixes #947 


-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] test: improve test coverage for pkg/discovery/mock [incubator-seata-go]

Posted by "slievrly (via GitHub)" <gi...@apache.org>.
slievrly merged PR #984:
URL: https://github.com/apache/incubator-seata-go/pull/984


-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] test: improve test coverage for pkg/discovery/mock [incubator-seata-go]

Posted by "FinnTew (via GitHub)" <gi...@apache.org>.
FinnTew commented on code in PR #984:
URL: https://github.com/apache/incubator-seata-go/pull/984#discussion_r2501754054


##########
pkg/discovery/mock/mock_etcd_client_test.go:
##########
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package mock
+
+import (
+	"context"
+	"errors"
+	"testing"
+
+	"github.com/golang/mock/gomock"
+	"github.com/stretchr/testify/assert"
+	clientv3 "go.etcd.io/etcd/client/v3"
+)
+
+func TestNewMockEtcdClient_BasicUsage(t *testing.T) {
+	ctrl := gomock.NewController(t)
+	defer ctrl.Finish()
+
+	mockClient := NewMockEtcdClient(ctrl)
+	assert.NotNil(t, mockClient)
+	assert.NotNil(t, mockClient.EXPECT())
+}
+
+func TestMockEtcdClient_Methods(t *testing.T) {

Review Comment:
   Would organizing test cases in the following way be better?
   ```go
   tests := []struct {
   		name           string
   		key            string
   		expectedResp   *clientv3.GetResponse
   		...
   }{
           ...
   }
   
   for _, tt := range tests {
       ...
   }
   ```



-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] test: improve test coverage for pkg/discovery/mock [incubator-seata-go]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #984:
URL: https://github.com/apache/incubator-seata-go/pull/984#issuecomment-3496613277

   ## [Codecov](https://app.codecov.io/gh/apache/incubator-seata-go/pull/984?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 48.84%. Comparing base ([`0747d09`](https://app.codecov.io/gh/apache/incubator-seata-go/commit/0747d09d6e290c8e29aa2d37a3561f7d008e889b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`49e28bc`](https://app.codecov.io/gh/apache/incubator-seata-go/commit/49e28bc3fc02872d486d78a0a5bce4d3c9feb393?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #984      +/-   ##
   ==========================================
   + Coverage   48.49%   48.84%   +0.34%     
   ==========================================
     Files         199      200       +1     
     Lines       12329    12432     +103     
   ==========================================
   + Hits         5979     6072      +93     
   - Misses       5880     5885       +5     
   - Partials      470      475       +5     
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/incubator-seata-go/pull/984?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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org