chore: add more tests (#2866)

* chore: add more tests

* chore: add more tests

* chore: fix test failure
This commit is contained in:
Kevin Wan
2023-02-11 14:21:39 +08:00
committed by kevin
parent 89f841c126
commit 04f181f0b4
6 changed files with 48 additions and 6 deletions

View File

@@ -22,10 +22,11 @@ func TestRpcServer(t *testing.T) {
Breaker: true,
}, WithMetrics(metrics), WithRpcHealth(true))
server.SetName("mock")
var wg sync.WaitGroup
var wg, wgDone sync.WaitGroup
var grpcServer *grpc.Server
var lock sync.Mutex
wg.Add(1)
wgDone.Add(1)
go func() {
err := server.Start(func(server *grpc.Server) {
lock.Lock()
@@ -35,6 +36,7 @@ func TestRpcServer(t *testing.T) {
wg.Done()
})
assert.Nil(t, err)
wgDone.Done()
}()
wg.Wait()
@@ -43,6 +45,9 @@ func TestRpcServer(t *testing.T) {
lock.Lock()
grpcServer.GracefulStop()
lock.Unlock()
proc.WrapUp()
wgDone.Wait()
}
func TestRpcServer_WithBadAddress(t *testing.T) {
@@ -58,6 +63,8 @@ func TestRpcServer_WithBadAddress(t *testing.T) {
mock.RegisterDepositServiceServer(server, new(mock.DepositServer))
})
assert.NotNil(t, err)
proc.WrapUp()
}
func TestRpcServer_buildUnaryInterceptor(t *testing.T) {