Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update hcp-scada-provider to fix diamond dependency problem with go-msgpack #15185

Merged
merged 8 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions agent/checks/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func NewGrpcHealthProbe(target string, timeout time.Duration, tlsConfig *tls.Con
if tlsConfig != nil {
dialOptions = append(dialOptions, grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig)))
} else {
//nolint:staticcheck
dialOptions = append(dialOptions, grpc.WithInsecure())
}

Expand Down
22 changes: 22 additions & 0 deletions agent/consul/leader_peering_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func TestLeader_PeeringSync_Lifecycle_ClientDeletion(t *testing.T) {

conn, err := grpc.DialContext(ctx, acceptor.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(acceptor.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -101,6 +102,7 @@ func TestLeader_PeeringSync_Lifecycle_ClientDeletion(t *testing.T) {

conn, err = grpc.DialContext(ctx, dialer.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(dialer.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -187,6 +189,7 @@ func TestLeader_PeeringSync_Lifecycle_UnexportWhileDown(t *testing.T) {

conn, err := grpc.DialContext(ctx, acceptor.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(acceptor.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -221,6 +224,7 @@ func TestLeader_PeeringSync_Lifecycle_UnexportWhileDown(t *testing.T) {

conn, err = grpc.DialContext(ctx, dialer.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(dialer.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -375,6 +379,7 @@ func TestLeader_PeeringSync_Lifecycle_ServerDeletion(t *testing.T) {

conn, err := grpc.DialContext(ctx, acceptor.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(acceptor.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -408,6 +413,7 @@ func TestLeader_PeeringSync_Lifecycle_ServerDeletion(t *testing.T) {

conn, err = grpc.DialContext(ctx, dialer.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(dialer.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -509,6 +515,7 @@ func testLeader_PeeringSync_failsForTLSError(t *testing.T, tokenMutateFn func(to

conn, err := grpc.DialContext(ctx, s1.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(s1.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -551,6 +558,7 @@ func testLeader_PeeringSync_failsForTLSError(t *testing.T, tokenMutateFn func(to

conn, err = grpc.DialContext(ctx, s2.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(s2.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -676,6 +684,7 @@ func TestLeader_Peering_RemoteInfo(t *testing.T) {

conn, err := grpc.DialContext(ctx, acceptingServer.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(acceptingServer.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -711,6 +720,7 @@ func TestLeader_Peering_RemoteInfo(t *testing.T) {

conn, err = grpc.DialContext(ctx, dialingServer.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(dialingServer.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -785,6 +795,7 @@ func TestLeader_Peering_DialerReestablishesConnectionOnError(t *testing.T) {

conn, err := grpc.DialContext(ctx, acceptingServer.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(acceptingServer.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -820,6 +831,7 @@ func TestLeader_Peering_DialerReestablishesConnectionOnError(t *testing.T) {

conn, err = grpc.DialContext(ctx, dialingServer.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(dialingServer.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -1005,6 +1017,7 @@ func TestLeader_Peering_ImportedExportedServicesCount(t *testing.T) {
// Create a peering by generating a token
conn, err := grpc.DialContext(ctx, s1.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(s1.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -1034,6 +1047,7 @@ func TestLeader_Peering_ImportedExportedServicesCount(t *testing.T) {

conn, err = grpc.DialContext(ctx, s2.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(s2.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -1230,6 +1244,7 @@ func TestLeader_Peering_ImportedExportedServicesCount(t *testing.T) {

conn2, err := grpc.DialContext(ctx, s2.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(s2.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -1311,6 +1326,7 @@ func TestLeader_PeeringMetrics_emitPeeringMetrics(t *testing.T) {

conn, err := grpc.DialContext(ctx, s1.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(s1.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -1754,6 +1770,7 @@ func Test_Leader_PeeringSync_ServerAddressUpdates(t *testing.T) {

conn, err := grpc.DialContext(ctx, acceptor.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(acceptor.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -1781,6 +1798,7 @@ func Test_Leader_PeeringSync_ServerAddressUpdates(t *testing.T) {

conn, err = grpc.DialContext(ctx, dialer.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(dialer.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -1894,6 +1912,7 @@ func Test_Leader_PeeringSync_PeerThroughMeshGateways_ServerFallBack(t *testing.T

conn, err := grpc.DialContext(ctx, acceptor.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(acceptor.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -1942,6 +1961,7 @@ func Test_Leader_PeeringSync_PeerThroughMeshGateways_ServerFallBack(t *testing.T

conn, err = grpc.DialContext(ctx, dialer.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(dialer.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -1995,6 +2015,7 @@ func Test_Leader_PeeringSync_PeerThroughMeshGateways_Success(t *testing.T) {

conn, err := grpc.DialContext(ctx, acceptor.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(acceptor.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -2062,6 +2083,7 @@ func Test_Leader_PeeringSync_PeerThroughMeshGateways_Success(t *testing.T) {

conn, err = grpc.DialContext(ctx, dialer.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(dialer.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down
2 changes: 2 additions & 0 deletions agent/consul/peering_backend_oss_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func TestPeeringBackend_RejectsPartition(t *testing.T) {

conn, err := gogrpc.DialContext(ctx, s1.config.RPCAddr.String(),
gogrpc.WithContextDialer(newServerDialer(s1.config.RPCAddr.String())),
//nolint:staticcheck
gogrpc.WithInsecure(),
gogrpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -88,6 +89,7 @@ func TestPeeringBackend_IgnoresDefaultPartition(t *testing.T) {

conn, err := gogrpc.DialContext(ctx, s1.config.RPCAddr.String(),
gogrpc.WithContextDialer(newServerDialer(s1.config.RPCAddr.String())),
//nolint:staticcheck
gogrpc.WithInsecure(),
gogrpc.WithBlock())
require.NoError(t, err)
Expand Down
5 changes: 4 additions & 1 deletion agent/consul/peering_backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (

gogrpc "google.golang.org/grpc"

"github.com/stretchr/testify/require"

"github.com/hashicorp/consul/acl"
"github.com/hashicorp/consul/agent/connect"
"github.com/hashicorp/consul/agent/consul/state"
Expand All @@ -20,7 +22,6 @@ import (
"github.com/hashicorp/consul/sdk/testutil"
"github.com/hashicorp/consul/testrpc"
"github.com/hashicorp/consul/types"
"github.com/stretchr/testify/require"
)

func TestPeeringBackend_ForwardToLeader(t *testing.T) {
Expand Down Expand Up @@ -58,6 +59,7 @@ func TestPeeringBackend_ForwardToLeader(t *testing.T) {
// Dial server2 directly
conn, err := gogrpc.DialContext(ctx, server2.config.RPCAddr.String(),
gogrpc.WithContextDialer(newServerDialer(server2.config.RPCAddr.String())),
//nolint:staticcheck
gogrpc.WithInsecure(),
gogrpc.WithBlock())
require.NoError(t, err)
Expand Down Expand Up @@ -459,6 +461,7 @@ func TestPeerStreamService_ForwardToLeader(t *testing.T) {
// We will dial server2 which should forward to server1
conn, err := gogrpc.DialContext(ctx, server2.config.RPCAddr.String(),
gogrpc.WithContextDialer(newServerDialer(server2.config.RPCAddr.String())),
//nolint:staticcheck
gogrpc.WithInsecure(),
gogrpc.WithBlock())
require.NoError(t, err)
Expand Down
2 changes: 2 additions & 0 deletions agent/consul/prepared_query_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1517,6 +1517,7 @@ func TestPreparedQuery_Execute(t *testing.T) {

conn, err := grpc.DialContext(ctx, s3.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(s3.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand All @@ -1531,6 +1532,7 @@ func TestPreparedQuery_Execute(t *testing.T) {

conn, err = grpc.DialContext(ctx, s1.config.RPCAddr.String(),
grpc.WithContextDialer(newServerDialer(s1.config.RPCAddr.String())),
//nolint:staticcheck
grpc.WithInsecure(),
grpc.WithBlock())
require.NoError(t, err)
Expand Down
1 change: 1 addition & 0 deletions agent/consul/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ func testGRPCIntegrationServer(t *testing.T, cb func(*Config)) (*Server, *grpc.C
_, srv, codec := testACLServerWithConfig(t, cb, false)

grpcAddr := fmt.Sprintf("127.0.0.1:%d", srv.config.GRPCPort)
//nolint:staticcheck
conn, err := grpc.Dial(grpcAddr, grpc.WithInsecure())
require.NoError(t, err)

Expand Down
5 changes: 3 additions & 2 deletions agent/grpc-external/services/acl/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"testing"

mock "github.com/stretchr/testify/mock"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
Expand All @@ -17,7 +17,7 @@ import (
"github.com/hashicorp/consul/acl"
"github.com/hashicorp/consul/agent/consul/authmethod"
"github.com/hashicorp/consul/agent/grpc-external/testutils"
structs "github.com/hashicorp/consul/agent/structs"
"github.com/hashicorp/consul/agent/structs"
"github.com/hashicorp/consul/proto-public/pbacl"
)

Expand Down Expand Up @@ -232,6 +232,7 @@ func TestServer_Login_RPCForwarding(t *testing.T) {
NewLogin: func() Login { return login },
})

//nolint:staticcheck
leaderConn, err := grpc.Dial(testutils.RunTestServer(t, dc2).String(), grpc.WithInsecure())
require.NoError(t, err)

Expand Down
2 changes: 2 additions & 0 deletions agent/grpc-external/services/acl/logout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func TestServer_Logout_RPCForwarding(t *testing.T) {

dc1Conn, err := grpc.Dial(
testutils.RunTestServer(t, dc1).String(),
//nolint:staticcheck
grpc.WithInsecure(),
)
require.NoError(t, err)
Expand Down Expand Up @@ -187,6 +188,7 @@ func TestServer_Logout_GlobalWritesForwardedToPrimaryDC(t *testing.T) {

primaryConn, err := grpc.Dial(
testutils.RunTestServer(t, primary).String(),
//nolint:staticcheck
grpc.WithInsecure(),
)
require.NoError(t, err)
Expand Down
3 changes: 2 additions & 1 deletion agent/grpc-external/services/connectca/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hashicorp/consul/agent/consul/state"
"github.com/hashicorp/consul/agent/consul/stream"
"github.com/hashicorp/consul/agent/grpc-external/testutils"
structs "github.com/hashicorp/consul/agent/structs"
"github.com/hashicorp/consul/agent/structs"
"github.com/hashicorp/consul/proto-public/pbconnectca"
)

Expand Down Expand Up @@ -39,6 +39,7 @@ func testClient(t *testing.T, server *Server) pbconnectca.ConnectCAServiceClient

addr := testutils.RunTestServer(t, server)

//nolint:staticcheck
conn, err := grpc.DialContext(context.Background(), addr.String(), grpc.WithInsecure())
require.NoError(t, err)
t.Cleanup(func() {
Expand Down
5 changes: 3 additions & 2 deletions agent/grpc-external/services/connectca/sign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"

acl "github.com/hashicorp/consul/acl"
resolver "github.com/hashicorp/consul/acl/resolver"
"github.com/hashicorp/consul/acl"
"github.com/hashicorp/consul/acl/resolver"
"github.com/hashicorp/consul/agent/connect"
"github.com/hashicorp/consul/agent/grpc-external/testutils"
"github.com/hashicorp/consul/agent/structs"
Expand Down Expand Up @@ -233,6 +233,7 @@ func TestSign_RPCForwarding(t *testing.T) {
ForwardRPC: noopForwardRPC,
ConnectEnabled: true,
})
//nolint:staticcheck
leaderConn, err := grpc.Dial(testutils.RunTestServer(t, leader).String(), grpc.WithInsecure())
require.NoError(t, err)

Expand Down
6 changes: 4 additions & 2 deletions agent/grpc-external/services/dataplane/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ import (
"context"
"testing"

"github.com/hashicorp/consul/agent/grpc-external/testutils"
"github.com/hashicorp/consul/proto-public/pbdataplane"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"

"github.com/hashicorp/consul/agent/grpc-external/testutils"
"github.com/hashicorp/consul/proto-public/pbdataplane"
)

func testClient(t *testing.T, server *Server) pbdataplane.DataplaneServiceClient {
t.Helper()

addr := testutils.RunTestServer(t, server)

//nolint:staticcheck
conn, err := grpc.DialContext(context.Background(), addr.String(), grpc.WithInsecure())
require.NoError(t, err)
t.Cleanup(func() {
Expand Down
1 change: 1 addition & 0 deletions agent/grpc-external/services/dns/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func testClient(t *testing.T, server *Server) pbdns.DNSServiceClient {

addr := testutils.RunTestServer(t, server)

//nolint:staticcheck
conn, err := grpc.DialContext(context.Background(), addr.String(), grpc.WithInsecure())
require.NoError(t, err)
t.Cleanup(func() {
Expand Down
3 changes: 2 additions & 1 deletion agent/grpc-external/services/serverdiscovery/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

mock "github.com/stretchr/testify/mock"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"

Expand Down Expand Up @@ -79,6 +79,7 @@ func testClient(t *testing.T, server *Server) pbserverdiscovery.ServerDiscoveryS

addr := testutils.RunTestServer(t, server)

//nolint:staticcheck
conn, err := grpc.DialContext(context.Background(), addr.String(), grpc.WithInsecure())
require.NoError(t, err)
t.Cleanup(func() {
Expand Down
1 change: 1 addition & 0 deletions agent/grpc-external/stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func TestServer_EmitsStats(t *testing.T) {
}
})

//nolint:staticcheck
conn, err := grpc.DialContext(ctx, lis.Addr().String(), grpc.WithInsecure())
require.NoError(t, err)
t.Cleanup(func() { conn.Close() })
Expand Down
Loading