lib/versioner: Hack to make test coverage stable from run to run

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3485
This commit is contained in:
Jakob Borg
2016-08-08 18:27:55 +00:00
parent c2d8c07137
commit dcbf68e104
2 changed files with 12 additions and 0 deletions

View File

@@ -35,6 +35,8 @@ type Staggered struct {
mutex sync.Mutex
}
var testCleanDone chan struct{}
func NewStaggered(folderID, folderPath string, params map[string]string) Versioner {
maxAge, err := strconv.ParseInt(params["maxAge"], 10, 0)
if err != nil {
@@ -72,6 +74,9 @@ func NewStaggered(folderID, folderPath string, params map[string]string) Version
go func() {
s.clean()
if testCleanDone != nil {
close(testCleanDone)
}
for _ = range time.Tick(time.Duration(cleanInterval) * time.Second) {
s.clean()
}