From 1070d04b07506b23fb2de497f2379421097976e6 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Mon, 17 Jul 2017 11:28:45 -0400 Subject: [PATCH] Remove consul context adapter for RenewPeriodic Updated the vendored consul which no longer requires the channel adapter to convert a `chan stuct{}` to a `<-chan struct{}`. Call testutil.NewTestServerConfigT with the new signature. --- backend/remote-state/consul/backend_test.go | 2 +- backend/remote-state/consul/client.go | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/backend/remote-state/consul/backend_test.go b/backend/remote-state/consul/backend_test.go index b75d252511..7c4bf5ee57 100644 --- a/backend/remote-state/consul/backend_test.go +++ b/backend/remote-state/consul/backend_test.go @@ -22,7 +22,7 @@ func newConsulTestServer(t *testing.T) *testutil.TestServer { t.Skip() } - srv := testutil.NewTestServerConfig(t, func(c *testutil.TestServerConfig) { + srv, _ := testutil.NewTestServerConfigT(t, func(c *testutil.TestServerConfig) { c.LogLevel = "warn" if !testing.Verbose() { diff --git a/backend/remote-state/consul/client.go b/backend/remote-state/consul/client.go index a0013cd2cf..fe14e2c0c7 100644 --- a/backend/remote-state/consul/client.go +++ b/backend/remote-state/consul/client.go @@ -367,14 +367,7 @@ func (c *RemoteClient) createSession() (string, error) { log.Println("[INFO] created consul lock session", id) // keep the session renewed - // we need an adapter to convert the session Done() channel to a - // non-directional channel to satisfy the RenewPeriodic signature. - done := make(chan struct{}) - go func() { - <-ctx.Done() - close(done) - }() - go session.RenewPeriodic(lockSessionTTL, id, nil, done) + go session.RenewPeriodic(lockSessionTTL, id, nil, ctx.Done()) return id, nil }