diff --git a/engine/tpexporter.go b/engine/tpexporter.go index d19f27412..90f522690 100644 --- a/engine/tpexporter.go +++ b/engine/tpexporter.go @@ -105,10 +105,10 @@ func (self *TPExporter) Run() error { self.removeFiles() return err } - if self.compress { - if err := self.zipWritter.Close(); err != nil { - return err - } + } + if self.compress { + if err := self.zipWritter.Close(); err != nil { + return err } } return nil diff --git a/general_tests/tutorial_local_test.go b/general_tests/tutorial_local_test.go index b2db0abc4..914fed96d 100644 --- a/general_tests/tutorial_local_test.go +++ b/general_tests/tutorial_local_test.go @@ -124,4 +124,13 @@ func TestTutLclLoadTariffPlanFromFolder(t *testing.T) { t.Error(reply) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups + +} + +func TestShutdown (t *testing.T) { + if !*testLocal { + return + } + exec.Command("pkill", "cgr-engine").Run() // Just to make sure another one is not running, bit brutal maybe we can fine tune it + time.Sleep(time.Duration(*waitRater) * time.Millisecond) }