From b9023077bb3f957f4517686d8139c709d5aa3faa Mon Sep 17 00:00:00 2001 From: Ivan Kripakov Date: Thu, 21 Dec 2023 11:20:30 +0400 Subject: [PATCH] remove test at the moment (is too slow) --- dkron/agent_test.go | 92 --------------------------------------------- 1 file changed, 92 deletions(-) diff --git a/dkron/agent_test.go b/dkron/agent_test.go index a9a33b0d0..78d3d62d2 100644 --- a/dkron/agent_test.go +++ b/dkron/agent_test.go @@ -636,95 +636,3 @@ func Test_selectNodes(t *testing.T) { }) } } - -func Test_clusterWillRecoverAfterIpChange(t *testing.T) { - a1, rfn1 := buildAndRunAgent("test8", []string{}, 3) - defer rfn1() - a2, rfn2 := buildAndRunAgent("test9", []string{a1.bindRPCAddr()[:len(a1.bindRPCAddr())-4] + "8946"}, 3) - defer rfn2() - a3, rfn3 := buildAndRunAgent("test10", []string{a1.bindRPCAddr()[:len(a1.bindRPCAddr())-4] + "8946", a2.bindRPCAddr()[:len(a2.bindRPCAddr())-4] + "8946"}, 3) - defer rfn3() - time.Sleep(2 * time.Second) - assert.True(t, a1.IsLeader() || a2.IsLeader() || a3.IsLeader()) - servers := a1.raft.GetConfiguration().Configuration().Servers - assert.Equal(t, 3, len(servers)) - servers = a2.raft.GetConfiguration().Configuration().Servers - assert.Equal(t, 3, len(servers)) - servers = a3.raft.GetConfiguration().Configuration().Servers - assert.Equal(t, 3, len(servers)) - - _ = a1.Stop() - - time.Sleep(30 * time.Second) - - assert.True(t, !a1.IsLeader() && (a2.IsLeader() || a3.IsLeader())) - - //servers = a2.raft.GetConfiguration().Configuration().Servers - //assert.Equal(t, 2, len(servers)) - //servers = a3.raft.GetConfiguration().Configuration().Servers - //assert.Equal(t, 2, len(servers)) - - _ = a2.Stop() - - time.Sleep(20 * time.Second) - - assert.True(t, !a1.IsLeader() && !a2.IsLeader() && !a3.IsLeader()) - - //servers = a3.raft.GetConfiguration().Configuration().Servers - //assert.Equal(t, 1, len(servers)) - - a1, rfn1 = buildAndRunAgent("test8", []string{a3.bindRPCAddr()[:len(a3.bindRPCAddr())-4] + "8946"}, 3) - defer rfn1() - a2, rfn2 = buildAndRunAgent("test9", []string{a3.bindRPCAddr()[:len(a3.bindRPCAddr())-4] + "8946"}, 3) - defer rfn2() - - time.Sleep(10 * time.Second) - - assert.True(t, a1.IsLeader() || a2.IsLeader() || a3.IsLeader()) - servers = a1.raft.GetConfiguration().Configuration().Servers - assert.Equal(t, 3, len(servers)) - servers = a2.raft.GetConfiguration().Configuration().Servers - assert.Equal(t, 3, len(servers)) - servers = a3.raft.GetConfiguration().Configuration().Servers - assert.Equal(t, 3, len(servers)) -} - -func buildAndRunAgent( - nodeName string, - startJoin []string, - bootstrapExpect int, -) (*Agent, func()) { - - dir, err := os.MkdirTemp("", fmt.Sprintf("test-%s", nodeName)) - if err != nil { - panic(err.Error()) - } - defer os.RemoveAll(dir) - ip, returnFn := testutil.TakeIP() - defer returnFn() - addr := ip.String() - - // Start another agent - c := DefaultConfig() - c.BindAddr = addr - c.StartJoin = startJoin - c.NodeName = nodeName - c.Server = true - c.LogLevel = logLevel - c.BootstrapExpect = bootstrapExpect - c.DevMode = true - c.DataDir = dir - c.RaftMultiplier = 1 - - a2 := NewAgent(c) - err = a2.Start() - if err != nil { - panic(err.Error()) - } - - return a2, func() { - _ = a2.Stop() - returnFn() - _ = os.RemoveAll(dir) - } -}