Skip to content

Commit d08c3cd

Browse files
committed
x
1 parent 9d8e11e commit d08c3cd

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

internal/health/health.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ func IsReady() bool {
4848
return defaultHealthManager.IsReady()
4949
}
5050

51+
// MarkReady sets components status to ready.
52+
func MarkReady() {
53+
defaultHealthManager.MarkReady()
54+
}
55+
5156
// CreateHttpHandler create health http handler base on given probe.
5257
func CreateHttpHandler(healthResponse string) http.HandlerFunc {
5358
return func(w http.ResponseWriter, _ *http.Request) {

zrpc/internal/rpcpubserver_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ import (
44
"testing"
55

66
"github.com/stretchr/testify/assert"
7+
"google.golang.org/grpc"
8+
79
"github.com/zeromicro/go-zero/core/discov"
810
"github.com/zeromicro/go-zero/core/netx"
11+
"github.com/zeromicro/go-zero/internal/health"
912
)
1013

1114
func TestNewRpcPubServer(t *testing.T) {
@@ -15,8 +18,11 @@ func TestNewRpcPubServer(t *testing.T) {
1518
ID: 10,
1619
}, "")
1720
assert.NoError(t, err)
21+
health.MarkReady()
1822
assert.NotPanics(t, func() {
19-
s.Start(nil)
23+
s.Start(func(server *grpc.Server) {
24+
25+
})
2026
})
2127
}
2228

0 commit comments

Comments
 (0)