genofire/hs_monolith
genofire
/
hs_monolith
Archived
1
0
Fork 0
This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
hs_monolith/runtime/cache_worker_test.go

27 lines
684 B
Go

package runtime
import (
"testing"
"time"
"github.com/genofire/hs_master-kss-monolith/models"
)
func TestCacheWorker(t *testing.T) {
productExistCache[2] = boolMicroServiceCache{LastCheck: time.Now(), Value: true}
permissionCache["blub"] = &permissionMicroServiceCache{
LastCheck: time.Now(),
session: "blub",
permissions: make(map[Permission]boolMicroServiceCache),
}
CacheConfig = models.CacheWorkerConfig{
Every: models.Duration{Duration: time.Duration(3) * time.Millisecond},
After: models.Duration{Duration: time.Duration(5) * time.Millisecond},
}
cw := NewCacheWorker()
go cw.Start()
time.Sleep(time.Duration(15) * time.Millisecond)
cw.Close()
}