Skip to content

Commit

Permalink
Merge branch 'main' into updates/go-discover
Browse files Browse the repository at this point in the history
  • Loading branch information
fdr2 committed Nov 8, 2022
2 parents 1a823d9 + a3f57cc commit b6ae489
Show file tree
Hide file tree
Showing 261 changed files with 6,570 additions and 3,663 deletions.
3 changes: 3 additions & 0 deletions .changelog/15083.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
connect: fixed bug where endpoint updates for new xDS clusters could block for 15s before being sent to Envoy.
```
3 changes: 3 additions & 0 deletions .changelog/15233.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note: improvement
integ test: fix flakiness due to test condition from retry app endoint
```
3 changes: 3 additions & 0 deletions .changelog/15272.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
proxycfg(mesh-gateway): Fix issue where deregistered services are not removed from mesh-gateway clusters.
```
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ jobs:
# tput complains if this isn't set to something.
TERM: ansi
- store_artifacts:
path: ./test/integration/consul-container/upgrade/workdir/logs
path: ./test/integration/consul-container/test/upgrade/workdir/logs
destination: container-logs
- store_test_results:
path: *TEST_RESULTS_DIR
Expand Down
12 changes: 8 additions & 4 deletions agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,9 @@ func TestAgent_HTTPMaxHeaderBytes(t *testing.T) {
},
Cache: cache.New(cache.Options{}),
}
bd, err = initEnterpriseBaseDeps(bd, nil)

cfg := config.RuntimeConfig{BuildDate: time.Date(2000, 1, 1, 0, 0, 1, 0, time.UTC)}
bd, err = initEnterpriseBaseDeps(bd, &cfg)
require.NoError(t, err)

a, err := New(bd)
Expand Down Expand Up @@ -5418,7 +5420,8 @@ func TestAgent_ListenHTTP_MultipleAddresses(t *testing.T) {
Cache: cache.New(cache.Options{}),
}

bd, err = initEnterpriseBaseDeps(bd, nil)
cfg := config.RuntimeConfig{BuildDate: time.Date(2000, 1, 1, 0, 0, 1, 0, time.UTC)}
bd, err = initEnterpriseBaseDeps(bd, &cfg)
require.NoError(t, err)

agent, err := New(bd)
Expand Down Expand Up @@ -6003,7 +6006,7 @@ func TestAgent_startListeners(t *testing.T) {
Cache: cache.New(cache.Options{}),
}

bd, err := initEnterpriseBaseDeps(bd, nil)
bd, err := initEnterpriseBaseDeps(bd, &config.RuntimeConfig{})
require.NoError(t, err)

agent, err := New(bd)
Expand Down Expand Up @@ -6134,7 +6137,8 @@ func TestAgent_startListeners_scada(t *testing.T) {
Cache: cache.New(cache.Options{}),
}

bd, err := initEnterpriseBaseDeps(bd, nil)
cfg := config.RuntimeConfig{BuildDate: time.Date(2000, 1, 1, 0, 0, 1, 0, time.UTC)}
bd, err := initEnterpriseBaseDeps(bd, &cfg)
require.NoError(t, err)

agent, err := New(bd)
Expand Down
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
402 changes: 201 additions & 201 deletions agent/config/config.go

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions agent/consul/fsm/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ func TestFSM_SnapshotRestore_OSS(t *testing.T) {
require.NoError(t, fsm.state.PeeringWrite(31, &pbpeering.PeeringWriteRequest{
Peering: &pbpeering.Peering{
ID: "1fabcd52-1d46-49b0-b1d8-71559aee47f5",
Name: "baz",
Name: "qux",
},
SecretsRequest: &pbpeering.SecretsWriteRequest{
PeerID: "1fabcd52-1d46-49b0-b1d8-71559aee47f5",
Expand Down Expand Up @@ -821,12 +821,12 @@ func TestFSM_SnapshotRestore_OSS(t *testing.T) {

// Verify peering is restored
idx, prngRestored, err := fsm2.state.PeeringRead(nil, state.Query{
Value: "baz",
Value: "qux",
})
require.NoError(t, err)
require.Equal(t, uint64(31), idx)
require.Equal(t, uint64(32), idx) // This is the index of the PTB write, which updates the peering
require.NotNil(t, prngRestored)
require.Equal(t, "baz", prngRestored.Name)
require.Equal(t, "qux", prngRestored.Name)

// Verify peering secrets are restored
secretsRestored, err := fsm2.state.PeeringSecretsRead(nil, "1fabcd52-1d46-49b0-b1d8-71559aee47f5")
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
Loading

0 comments on commit b6ae489

Please sign in to comment.