tests: add an helper to start/stop components

This commit is contained in:
Vincent Bernat
2022-04-13 16:59:01 +02:00
parent b44836aa97
commit ce9bd6a4da
18 changed files with 141 additions and 225 deletions

View File

@@ -7,6 +7,7 @@ import (
"gopkg.in/tomb.v2"
"akvorado/common/helpers"
"akvorado/common/reporter"
)
@@ -16,7 +17,7 @@ func TestTerminate(t *testing.T) {
if err != nil {
t.Fatalf("New() error:\n%+v", err)
}
c.Start()
helpers.StartStop(t, c)
select {
case <-c.Terminated():
@@ -75,7 +76,7 @@ func TestTombTracking(t *testing.T) {
}
c.Track(&tomb, "tomb")
c.Start()
helpers.StartStop(t, c)
ch := make(chan bool)
tomb.Go(func() error {