-
-
Notifications
You must be signed in to change notification settings - Fork 249
/
Copy pathhealth_test.go
35 lines (27 loc) · 954 Bytes
/
health_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package specific
import (
"context"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/health/grpc_health_v1"
)
var _ = Describe("health-test", func() {
Context("Health", func() {
It("Health: Success", func() {
// Set up a connection to the server.
conn, err := grpc.DialContext(context.Background(), "localhost:3478", grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
Expect(err).ShouldNot(HaveOccurred())
}
Expect(err).ShouldNot(HaveOccurred())
healthClient := grpc_health_v1.NewHealthClient(conn)
res, err := healthClient.Check(context.Background(), &grpc_health_v1.HealthCheckRequest{})
Expect(err).ShouldNot(HaveOccurred())
Expect(res.Status).Should(Equal(grpc_health_v1.HealthCheckResponse_SERVING))
err = conn.Close()
Expect(err).ShouldNot(HaveOccurred())
})
})
})