chore: add more tests (#3014)

This commit is contained in:
Kevin Wan
2023-03-11 14:57:56 +08:00
committed by GitHub
parent 544aa7c432
commit f77e2c9cfa
6 changed files with 74 additions and 20 deletions

View File

@@ -2,7 +2,6 @@ package clientinterceptors
import (
"context"
"github.com/zeromicro/go-zero/core/lang"
"io"
ztrace "github.com/zeromicro/go-zero/core/trace"
@@ -95,7 +94,7 @@ type (
Finished chan error
desc *grpc.StreamDesc
events chan streamEvent
eventsDone chan lang.PlaceholderType
eventsDone chan struct{}
receivedMessageID int
sentMessageID int
}

View File

@@ -26,8 +26,8 @@ func NewRpcPubServer(etcd discov.EtcdConf, listenOn string, middlewares ServerMi
pubOpts = append(pubOpts, discov.WithPubEtcdTLS(etcd.CertFile, etcd.CertKeyFile,
etcd.CACertFile, etcd.InsecureSkipVerify))
}
if etcd.HasServerID() {
pubOpts = append(pubOpts, discov.WithId(etcd.ServerID))
if etcd.HasID() {
pubOpts = append(pubOpts, discov.WithId(etcd.ID))
}
pubClient := discov.NewPublisher(etcd.Hosts, etcd.Key, pubListenOn, pubOpts...)
return pubClient.KeepAlive()

View File

@@ -12,6 +12,7 @@ func TestNewRpcPubServer(t *testing.T) {
s, err := NewRpcPubServer(discov.EtcdConf{
User: "user",
Pass: "pass",
ID: 10,
}, "", ServerMiddlewaresConf{})
assert.NoError(t, err)
assert.NotPanics(t, func() {