2022-03-27 10:59:30 +00:00
|
|
|
package dataplane
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
2022-07-13 15:33:48 +00:00
|
|
|
"github.com/hashicorp/consul/agent/grpc-external/testutils"
|
2022-03-27 10:59:30 +00:00
|
|
|
"github.com/hashicorp/consul/proto-public/pbdataplane"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
)
|
|
|
|
|
|
|
|
func testClient(t *testing.T, server *Server) pbdataplane.DataplaneServiceClient {
|
|
|
|
t.Helper()
|
|
|
|
|
2022-04-21 16:56:18 +00:00
|
|
|
addr := testutils.RunTestServer(t, server)
|
2022-03-27 10:59:30 +00:00
|
|
|
|
|
|
|
conn, err := grpc.DialContext(context.Background(), addr.String(), grpc.WithInsecure())
|
|
|
|
require.NoError(t, err)
|
|
|
|
t.Cleanup(func() {
|
|
|
|
require.NoError(t, conn.Close())
|
|
|
|
})
|
|
|
|
|
|
|
|
return pbdataplane.NewDataplaneServiceClient(conn)
|
|
|
|
}
|