chore: add more tests (#2866)
* chore: add more tests * chore: add more tests * chore: fix test failure
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user