Skip to content

Commit d740bc0

Browse files
authored
Merge pull request #252 from authzed/flesh-out-tests
Flesh out client tests
2 parents 3014bbf + 8af9101 commit d740bc0

File tree

5 files changed

+420
-29
lines changed

5 files changed

+420
-29
lines changed

.github/workflows/build.yaml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/test.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ on:
66
- "main"
77
pull_request:
88
branches: ["*"]
9+
# NOTE: this is required for checks to be run in the
10+
# merge queue.
11+
merge_group:
12+
types:
13+
- "checks_requested"
914
jobs:
1015
tests:
1116
name: "Unit and Integration Tests"

v1/client.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,18 @@ import (
1111
//
1212
// Clients are backed by a gRPC client and as such are thread-safe.
1313
type Client struct {
14+
// Provide a handle on the underlying connection to enable cleanup
15+
// behaviors (among others)
16+
conn *grpc.ClientConn
1417
v1.SchemaServiceClient
1518
v1.PermissionsServiceClient
1619
v1.WatchServiceClient
1720
}
1821

22+
func (c *Client) Close() error {
23+
return c.conn.Close()
24+
}
25+
1926
// ClientWithExperimental represents and open connection to Authzed with
2027
// experimental services available.
2128
//
@@ -34,6 +41,7 @@ func NewClient(endpoint string, opts ...grpc.DialOption) (*Client, error) {
3441
}
3542

3643
return &Client{
44+
conn,
3745
v1.NewSchemaServiceClient(conn),
3846
v1.NewPermissionsServiceClient(conn),
3947
v1.NewWatchServiceClient(conn),
@@ -50,6 +58,7 @@ func NewClientWithExperimentalAPIs(endpoint string, opts ...grpc.DialOption) (*C
5058

5159
return &ClientWithExperimental{
5260
Client{
61+
conn,
5362
v1.NewSchemaServiceClient(conn),
5463
v1.NewPermissionsServiceClient(conn),
5564
v1.NewWatchServiceClient(conn),

0 commit comments

Comments
 (0)