From 2024cf4b5686302eca563a1a90c93dc2a1a67b6f Mon Sep 17 00:00:00 2001 From: Anton Sergeyev Date: Thu, 14 Jun 2018 12:46:29 +0500 Subject: [PATCH] #11607 fixed formatting --- conf/sample.ini | 2 +- pkg/services/cleanup/cleanup_test.go | 11 +++++------ pkg/setting/setting.go | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/conf/sample.ini b/conf/sample.ini index af4e78eed72..87544a5ac39 100644 --- a/conf/sample.ini +++ b/conf/sample.ini @@ -15,7 +15,7 @@ ;data = /var/lib/grafana # Temporary files in `data` directory older than given duration will be removed -temp_data_lifetime = 24h +;temp_data_lifetime = 24h # Directory where grafana can store logs ;logs = /var/log/grafana diff --git a/pkg/services/cleanup/cleanup_test.go b/pkg/services/cleanup/cleanup_test.go index a504e316e75..834fdc424fb 100644 --- a/pkg/services/cleanup/cleanup_test.go +++ b/pkg/services/cleanup/cleanup_test.go @@ -1,10 +1,9 @@ package cleanup import ( - "testing" - "github.com/grafana/grafana/pkg/setting" . "github.com/smartystreets/goconvey/convey" + "testing" "time" ) @@ -21,21 +20,21 @@ func TestCleanUpTmpFiles(t *testing.T) { weekAgo := now.Add(-time.Second * 3600 * 24 * 7) Convey("Should not cleanup recent files", func() { - So(service.shouldCleanupTempFile(secondAgo, now), ShouldBeFalse); + So(service.shouldCleanupTempFile(secondAgo, now), ShouldBeFalse) }) Convey("Should cleanup older files", func() { - So(service.shouldCleanupTempFile(dayAgo, now), ShouldBeTrue); + So(service.shouldCleanupTempFile(dayAgo, now), ShouldBeTrue) }) Convey("After increasing temporary files lifetime, older files should be kept", func() { cfg.TempDataLifetime, _ = time.ParseDuration("1000h") - So(service.shouldCleanupTempFile(weekAgo, now), ShouldBeFalse); + So(service.shouldCleanupTempFile(weekAgo, now), ShouldBeFalse) }) Convey("If lifetime is 0, files should never be cleaned up", func() { cfg.TempDataLifetime = 0 - So(service.shouldCleanupTempFile(weekAgo, now), ShouldBeFalse); + So(service.shouldCleanupTempFile(weekAgo, now), ShouldBeFalse) }) }) diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index 3cb7966d20c..99a2a3ce1c9 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -641,7 +641,7 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error { cfg.ImagesDir = filepath.Join(DataPath, "png") cfg.PhantomDir = filepath.Join(HomePath, "tools/phantomjs") cfg.TempDataLifetime = iniFile.Section("paths").Key("temp_data_lifetime").MustDuration( - time.Duration(time.Second*3600*24), + time.Duration(time.Second * 3600 * 24), ) analytics := iniFile.Section("analytics")