From 535842004c0808858e447b844848110036e613be Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Wed, 21 Feb 2018 10:19:30 -0800 Subject: [PATCH] Test autopilots start/stop idempotency --- agent/consul/autopilot_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/agent/consul/autopilot_test.go b/agent/consul/autopilot_test.go index f7be3273d..ea88dcca3 100644 --- a/agent/consul/autopilot_test.go +++ b/agent/consul/autopilot_test.go @@ -11,6 +11,20 @@ import ( "github.com/hashicorp/serf/serf" ) +func TestAutopilot_IdempotentShutdown(t *testing.T) { + dir1, s1 := testServerWithConfig(t, nil) + defer os.RemoveAll(dir1) + defer s1.Shutdown() + retry.Run(t, func(r *retry.R) { r.Check(waitForLeader(s1)) }) + + s1.autopilot.Start() + s1.autopilot.Start() + s1.autopilot.Start() + s1.autopilot.Stop() + s1.autopilot.Stop() + s1.autopilot.Stop() +} + func TestAutopilot_CleanupDeadServer(t *testing.T) { t.Parallel() for i := 1; i <= 3; i++ {