From 5074a36d237b09351dd26d6cd0535c41a89608b9 Mon Sep 17 00:00:00 2001 From: Ben Hoyt Date: Mon, 9 May 2022 16:37:34 +1200 Subject: [PATCH] Rename change to "recover-service" (to distinguish from "recover-check") See https://github.com/canonical/pebble/pull/119 --- internal/overlord/servstate/handlers.go | 2 +- internal/overlord/servstate/manager_test.go | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/overlord/servstate/handlers.go b/internal/overlord/servstate/handlers.go index e7302bb63..f7c946fb7 100644 --- a/internal/overlord/servstate/handlers.go +++ b/internal/overlord/servstate/handlers.go @@ -508,7 +508,7 @@ func (s *serviceData) openRecoverChange() { st.Lock() defer st.Unlock() - s.recoverChange = st.NewChange("recover", fmt.Sprintf("Recover service %q", s.config.Name)) + s.recoverChange = st.NewChange("recover-service", fmt.Sprintf("Recover service %q", s.config.Name)) } func calculateNextBackoff(config *plan.Service, current time.Duration) time.Duration { diff --git a/internal/overlord/servstate/manager_test.go b/internal/overlord/servstate/manager_test.go index a8afeb448..95e369819 100644 --- a/internal/overlord/servstate/manager_test.go +++ b/internal/overlord/servstate/manager_test.go @@ -891,13 +891,13 @@ services: c.Assert(svc.Current, Equals, servstate.StatusActive) c.Check(s.logBufferString(), Matches, `2.* \[test2\] test2\n`) - // Ensure it has recorded the "recover" change correctly. + // Ensure it has recorded the "recover-service" change correctly. func() { s.st.Lock() defer s.st.Unlock() var changes []*state.Change for _, chg := range s.st.Changes() { - if chg.Kind() == "recover" { + if chg.Kind() == "recover-service" { changes = append(changes, chg) } } @@ -929,12 +929,12 @@ services: c.Assert(svc.Current, Equals, servstate.StatusActive) c.Check(s.logBufferString(), Matches, `2.* \[test2\] test2\n`) - // Ensure it has recorded the "recover" changes correctly. + // Ensure it has recorded the "recover-service" changes correctly. s.st.Lock() defer s.st.Unlock() var changes []*state.Change for _, chg := range s.st.Changes() { - if chg.Kind() == "recover" { + if chg.Kind() == "recover-service" { changes = append(changes, chg) } } @@ -981,12 +981,12 @@ services: return svc.Current == servstate.StatusInactive }) - // Ensure it has recorded the "recover" change correctly. + // Ensure it has recorded the "recover-service" change correctly. s.st.Lock() defer s.st.Unlock() var changes []*state.Change for _, chg := range s.st.Changes() { - if chg.Kind() == "recover" { + if chg.Kind() == "recover-service" { changes = append(changes, chg) } } @@ -1084,12 +1084,12 @@ checks: c.Assert(svc.Current, Equals, servstate.StatusActive) c.Assert(s.manager.BackoffNum("test2"), Equals, 1) - // Ensure it has recorded the "recover" change correctly. + // Ensure it has recorded the "recover-service" change correctly. s.st.Lock() defer s.st.Unlock() var changes []*state.Change for _, chg := range s.st.Changes() { - if chg.Kind() == "recover" { + if chg.Kind() == "recover-service" { changes = append(changes, chg) } } @@ -1178,12 +1178,12 @@ checks: c.Assert(checks[0].Status, Equals, checkstate.CheckStatusDown) c.Assert(checks[0].LastError, Matches, ".* executable file not found .*") - // Ensure it has recorded the "recover" change correctly. + // Ensure it has recorded the "recover-service" change correctly. s.st.Lock() defer s.st.Unlock() var changes []*state.Change for _, chg := range s.st.Changes() { - if chg.Kind() == "recover" { + if chg.Kind() == "recover-service" { changes = append(changes, chg) } }