|
|
|
@ -238,9 +238,9 @@ func Test_MultiNodeClusterBootstrap(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
provider := cluster.NewAddressProviderString(
|
|
|
|
|
[]string{node1.APIAddr, node2.APIAddr, node3.APIAddr})
|
|
|
|
|
node1Bs := cluster.NewBootstrapper(provider, 3, nil)
|
|
|
|
|
node2Bs := cluster.NewBootstrapper(provider, 3, nil)
|
|
|
|
|
node3Bs := cluster.NewBootstrapper(provider, 3, nil)
|
|
|
|
|
node1Bs := cluster.NewBootstrapper(provider, nil)
|
|
|
|
|
node2Bs := cluster.NewBootstrapper(provider, nil)
|
|
|
|
|
node3Bs := cluster.NewBootstrapper(provider, nil)
|
|
|
|
|
|
|
|
|
|
// Have all nodes start a bootstrap basically in parallel,
|
|
|
|
|
// ensure only 1 leader actually gets elected.
|
|
|
|
@ -284,6 +284,21 @@ func Test_MultiNodeClusterBootstrap(t *testing.T) {
|
|
|
|
|
t.Fatalf("failed to find cluster leader: %s", err.Error())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Ensure each node has the same leader!
|
|
|
|
|
leaderAddr, err := leader.WaitForLeader()
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatalf("failed to find cluster leader: %s", err.Error())
|
|
|
|
|
}
|
|
|
|
|
for i, n := range []*Node{node1, node2, node3} {
|
|
|
|
|
addr, err := n.WaitForLeader()
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatalf("failed waiting for a leader on node %d: %s", i, err.Error())
|
|
|
|
|
}
|
|
|
|
|
if exp, got := leaderAddr, addr; exp != got {
|
|
|
|
|
t.Fatalf("node %d has wrong leader, exp %s, got %s", i, exp, got)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Run queries against cluster.
|
|
|
|
|
tests := []struct {
|
|
|
|
|
stmt string
|
|
|
|
@ -388,11 +403,11 @@ func Test_MultiNodeClusterBootstrapLaterJoin(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
provider := cluster.NewAddressProviderString(
|
|
|
|
|
[]string{node1.APIAddr, node2.APIAddr, node3.APIAddr})
|
|
|
|
|
node1Bs := cluster.NewBootstrapper(provider, 3, nil)
|
|
|
|
|
node1Bs := cluster.NewBootstrapper(provider, nil)
|
|
|
|
|
node1Bs.Interval = time.Second
|
|
|
|
|
node2Bs := cluster.NewBootstrapper(provider, 3, nil)
|
|
|
|
|
node2Bs := cluster.NewBootstrapper(provider, nil)
|
|
|
|
|
node2Bs.Interval = time.Second
|
|
|
|
|
node3Bs := cluster.NewBootstrapper(provider, 3, nil)
|
|
|
|
|
node3Bs := cluster.NewBootstrapper(provider, nil)
|
|
|
|
|
node3Bs.Interval = time.Second
|
|
|
|
|
|
|
|
|
|
// Have all nodes start a bootstrap basically in parallel,
|
|
|
|
@ -451,7 +466,7 @@ func Test_MultiNodeClusterBootstrapLaterJoin(t *testing.T) {
|
|
|
|
|
node4 := mustNewNode(false)
|
|
|
|
|
node4.Store.BootstrapExpect = 3
|
|
|
|
|
defer node3.Deprovision()
|
|
|
|
|
node4Bs := cluster.NewBootstrapper(provider, 3, nil)
|
|
|
|
|
node4Bs := cluster.NewBootstrapper(provider, nil)
|
|
|
|
|
node4Bs.Interval = time.Second
|
|
|
|
|
done := func() bool {
|
|
|
|
|
addr, _ := node4.Store.LeaderAddr()
|
|
|
|
@ -486,11 +501,11 @@ func Test_MultiNodeClusterBootstrapLaterJoinHTTPS(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
provider := cluster.NewAddressProviderString(
|
|
|
|
|
[]string{node1.APIAddr, node2.APIAddr, node3.APIAddr})
|
|
|
|
|
node1Bs := cluster.NewBootstrapper(provider, 3, nil)
|
|
|
|
|
node1Bs := cluster.NewBootstrapper(provider, nil)
|
|
|
|
|
node1Bs.Interval = time.Second
|
|
|
|
|
node2Bs := cluster.NewBootstrapper(provider, 3, nil)
|
|
|
|
|
node2Bs := cluster.NewBootstrapper(provider, nil)
|
|
|
|
|
node2Bs.Interval = time.Second
|
|
|
|
|
node3Bs := cluster.NewBootstrapper(provider, 3, nil)
|
|
|
|
|
node3Bs := cluster.NewBootstrapper(provider, nil)
|
|
|
|
|
node3Bs.Interval = time.Second
|
|
|
|
|
|
|
|
|
|
// Have all nodes start a bootstrap basically in parallel,
|
|
|
|
@ -549,7 +564,7 @@ func Test_MultiNodeClusterBootstrapLaterJoinHTTPS(t *testing.T) {
|
|
|
|
|
node4 := mustNewNodeEncrypted(false, true, true)
|
|
|
|
|
node4.Store.BootstrapExpect = 3
|
|
|
|
|
defer node3.Deprovision()
|
|
|
|
|
node4Bs := cluster.NewBootstrapper(provider, 3, nil)
|
|
|
|
|
node4Bs := cluster.NewBootstrapper(provider, nil)
|
|
|
|
|
node4Bs.Interval = time.Second
|
|
|
|
|
done := func() bool {
|
|
|
|
|
addr, _ := node4.Store.LeaderAddr()
|
|
|
|
|