Ronald 94ec4eb2f4
copyright headers for agent folder (#16704)
* copyright headers for agent folder

* Ignore test data files

* fix proto files and remove headers in agent/uiserver folder

* ignore deep-copy files
2023-03-28 14:39:22 -04:00

34 lines
566 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package testutils
import (
"net"
"testing"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
)
type GRPCService interface {
Register(*grpc.Server)
}
func RunTestServer(t *testing.T, services ...GRPCService) net.Addr {
t.Helper()
lis, err := net.Listen("tcp", "127.0.0.1:0")
require.NoError(t, err)
grpcServer := grpc.NewServer()
for _, svc := range services {
svc.Register(grpcServer)
}
go grpcServer.Serve(lis)
t.Cleanup(grpcServer.Stop)
return lis.Addr()
}