Skip to content

Commit

Permalink
test for adding new servers to keyring
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross committed Oct 20, 2022
1 parent e8a0ec1 commit 1c31df7
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions nomad/encrypter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ func TestEncrypter_Restore(t *testing.T) {
}
}

// TestKeyringReplicator exercises key replication between servers
func TestKeyringReplicator(t *testing.T) {
// TestEncrypter_KeyringReplication exercises key replication between servers
func TestEncrypter_KeyringReplication(t *testing.T) {

ci.Parallel(t)

Expand Down Expand Up @@ -267,6 +267,31 @@ func TestKeyringReplicator(t *testing.T) {
require.Eventually(t, checkReplicationFn(keyID3),
time.Second*5, time.Second,
"expected keys to be replicated to followers after election")

// Scenario: new members join the cluster

srv4, cleanupSRV4 := TestServer(t, func(c *Config) {
c.BootstrapExpect = 0
c.NumSchedulers = 0
})
defer cleanupSRV4()
srv5, cleanupSRV5 := TestServer(t, func(c *Config) {
c.BootstrapExpect = 0
c.NumSchedulers = 0
})
defer cleanupSRV5()

TestJoin(t, srv4, srv5)
TestJoin(t, srv5, srv1)
servers = []*Server{srv1, srv2, srv3, srv4, srv5}

testutil.WaitForLeader(t, srv4.RPC)
testutil.WaitForLeader(t, srv5.RPC)

require.Eventually(t, checkReplicationFn(keyID3),
time.Second*5, time.Second,
"expected new servers to get replicated keys")

}

func TestEncrypter_EncryptDecrypt(t *testing.T) {
Expand Down

0 comments on commit 1c31df7

Please sign in to comment.