From 145fc5f58f6811b83b00e92ba755664b4278c6dd Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Fri, 10 Dec 2021 11:53:07 +0100 Subject: bootstrap: Use ticker to get rid of test timeouts The bootstrapping tests still need to use timeouts because of the grace period, which is the duration we give the server to exit before we force the upgrade. Convert the interface to instead accept tickers such that we can get rid of using timeouts in our tests. --- cmd/praefect/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cmd/praefect') diff --git a/cmd/praefect/main.go b/cmd/praefect/main.go index 56f56ab9a..d444aff88 100644 --- a/cmd/praefect/main.go +++ b/cmd/praefect/main.go @@ -514,7 +514,10 @@ func run( logger.Warn(`Repository cleanup background task disabled as "repositories_cleanup.run_interval" is not set or 0.`) } - return b.Wait(conf.GracefulStopTimeout.Duration(), srvFactory.GracefulStop) + gracefulStopTicker := helper.NewTimerTicker(conf.GracefulStopTimeout.Duration()) + defer gracefulStopTicker.Stop() + + return b.Wait(gracefulStopTicker, srvFactory.GracefulStop) } func getStarterConfigs(conf config.Config) ([]starter.Config, error) { -- cgit v1.2.3