Skip to content

Commit

Permalink
Revert "fix peering tests to work with consul 1.14 binary"
Browse files Browse the repository at this point in the history
This reverts commit 05ac0f9.
  • Loading branch information
ishustava committed Oct 24, 2022
1 parent 05ac0f9 commit a88c944
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,9 @@ func TestReconcile_CreateUpdatePeeringAcceptor(t *testing.T) {
decodedTokenData, err := base64.StdEncoding.DecodeString(string(createdSecret.Data["data"]))
require.NoError(t, err)

require.Contains(t, string(decodedTokenData), "\"CA\":")
require.Contains(t, string(decodedTokenData), "\"CA\":null")
require.Contains(t, string(decodedTokenData), "\"ServerAddresses\"")
require.Contains(t, string(decodedTokenData), "\"ServerName\":\"server.dc1.peering.11111111-2222-3333-4444-555555555555.consul\"")
require.Contains(t, string(decodedTokenData), "\"ServerName\":\"server.dc1.consul\"")
if len(tt.expectedTokenAddresses) > 0 {
for _, addr := range tt.externalAddresses {
require.Contains(t, string(decodedTokenData), addr)
Expand Down Expand Up @@ -1162,6 +1162,7 @@ func TestAcceptorUpdateStatus(t *testing.T) {
require.Equal(t, tt.expStatus.SecretRef.Backend, acceptor.SecretRef().Backend)
require.Equal(t, tt.expStatus.SecretRef.ResourceVersion, acceptor.SecretRef().ResourceVersion)
require.Equal(t, tt.expStatus.Conditions[0].Message, acceptor.Status.Conditions[0].Message)

})
}
}
Expand Down
21 changes: 6 additions & 15 deletions control-plane/connect-inject/peering_dialer_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,8 @@ func TestReconcile_CreateUpdatePeeringDialer(t *testing.T) {

// If the peering is supposed to already exist in Consul, then establish a peering with the existing token, so the peering will exist on the dialing side.
if tt.peeringExists {
retry.Run(t, func(r *retry.R) {
_, _, err = dialerClient.Peerings().Establish(context.Background(), api.PeeringEstablishRequest{PeerName: tt.peeringName, PeeringToken: encodedPeeringToken}, nil)
require.NoError(r, err)
})

_, _, err := dialerClient.Peerings().Establish(context.Background(), api.PeeringEstablishRequest{PeerName: tt.peeringName, PeeringToken: encodedPeeringToken}, nil)
require.NoError(t, err)
k8sObjects = append(k8sObjects, createSecret("dialer-token-old", "default", "token", "old-token"))
// Create a new token to be used by Reconcile(). The original token has already been
// used once to simulate establishing an existing peering.
Expand Down Expand Up @@ -427,12 +424,9 @@ func TestReconcile_VersionAnnotationPeeringDialer(t *testing.T) {

// Create test consul server.
acceptorPeerServer, err := testutil.NewTestServerConfigT(t, func(c *testutil.TestServerConfig) {
// We set different cluster id for the connect CA because the server name,
// typically formatted as server.dc1.peering.<cluster_id>.consul
// We set the datacenter because the server name, typically formatted as "server.<datacenter>.<domain>"
// must be unique on the acceptor and dialer peers.
c.Connect["ca_config"] = map[string]interface{}{
"cluster_id": "00000000-2222-3333-4444-555555555555",
}
c.Datacenter = "acceptor-dc"
})
require.NoError(t, err)
defer acceptorPeerServer.Stop()
Expand Down Expand Up @@ -505,11 +499,8 @@ func TestReconcile_VersionAnnotationPeeringDialer(t *testing.T) {
go watcher.Run()

// Establish a peering with the generated token.
retry.Run(t, func(r *retry.R) {
_, _, err = dialerClient.Peerings().Establish(context.Background(), api.PeeringEstablishRequest{PeerName: "peering", PeeringToken: generatedToken.PeeringToken}, nil)
require.NoError(r, err)
})

_, _, err = dialerClient.Peerings().Establish(context.Background(), api.PeeringEstablishRequest{PeerName: "peering", PeeringToken: generatedToken.PeeringToken}, nil)
require.NoError(t, err)
k8sObjects = append(k8sObjects, createSecret("dialer-token-old", "default", "token", "old-token"))

// Create a new token to be potentially used by Reconcile(). The original token has already been
Expand Down

0 comments on commit a88c944

Please sign in to comment.