Refactor more code to use testutils.WasCalled (#13054)

* Refactor more code to use testutils.WasCalled

* incorporate review comments

* Revert watcher_test.go changes

The file is in config package and the other tests use config_test.
So it is not visible.
Этот коммит содержится в:
Agniva De Sarker
2019-11-13 13:41:26 +05:30
коммит произвёл Saturnino Abril
родитель 0c8b580458
Коммит 2db6823f5d
5 изменённых файлов: 30 добавлений и 62 удалений

Просмотреть файл

@@ -8,7 +8,6 @@ import (
"io"
"os"
"path/filepath"
"time"
"github.com/mattermost/mattermost-server/utils/fileutils"
)
@@ -28,15 +27,3 @@ func ReadTestFile(name string) ([]byte, error) {
return data.Bytes(), nil
}
}
// WasCalled reports whether a given callback channel was called
// within the specified time duration or not.
func WasCalled(c chan bool, duration time.Duration) bool {
wasCalled := false
select {
case <-c:
wasCalled = true
case <-time.After(duration):
}
return wasCalled
}