2023-03-28 18:39:22 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2022-03-27 10:59:30 +00:00
|
|
|
package dataplane
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"google.golang.org/grpc"
|
2022-11-07 16:34:30 +00:00
|
|
|
|
|
|
|
"github.com/hashicorp/consul/agent/grpc-external/testutils"
|
|
|
|
"github.com/hashicorp/consul/proto-public/pbdataplane"
|
2022-03-27 10:59:30 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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
|
|
|
|
2022-11-07 16:34:30 +00:00
|
|
|
//nolint:staticcheck
|
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)
|
|
|
|
}
|