test: add management client tests (#89)

* test: add management client tests

* test: add management client Sync test

* fix: engine test

* test: remove engine tests

* test: return engine tests [check]

* test: remove engine tests [check]
This commit is contained in:
Mikhail Bragin
2021-08-16 23:30:51 +02:00
committed by GitHub
parent 2a97053cae
commit e8ca289f4a
6 changed files with 188 additions and 197 deletions
+3 -2
View File
@@ -23,7 +23,7 @@ type Client struct {
}
// NewClient creates a new client to Management service
func NewClient(ctx context.Context, addr string, outPrivateKey wgtypes.Key, tlsEnabled bool) (*Client, error) {
func NewClient(ctx context.Context, addr string, ourPrivateKey wgtypes.Key, tlsEnabled bool) (*Client, error) {
transportOption := grpc.WithInsecure()
@@ -49,7 +49,7 @@ func NewClient(ctx context.Context, addr string, outPrivateKey wgtypes.Key, tlsE
realClient := proto.NewManagementServiceClient(conn)
return &Client{
key: outPrivateKey,
key: ourPrivateKey,
realClient: realClient,
ctx: ctx,
conn: conn,
@@ -62,6 +62,7 @@ func (c *Client) Close() error {
}
// Sync wraps the real client's Sync endpoint call and takes care of retries and encryption/decryption of messages
// Non blocking request (executed in go routine). The result will be sent via msgHandler callback function
func (c *Client) Sync(msgHandler func(msg *proto.SyncResponse) error) {
go func() {