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.
2017-04-07 11:56:28 +02:00
|
|
|
package runtime
|
2017-04-05 20:23:29 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
"time"
|
2017-04-07 11:56:28 +02:00
|
|
|
|
|
|
|
"github.com/genofire/hs_master-kss-monolith/models"
|
2017-04-05 20:23:29 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
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),
|
|
|
|
}
|
2017-04-07 11:56:28 +02:00
|
|
|
CacheConfig = models.CacheWorkerConfig{
|
|
|
|
Every: models.Duration{Duration: time.Duration(3) * time.Millisecond},
|
|
|
|
After: models.Duration{Duration: time.Duration(5) * time.Millisecond},
|
2017-04-05 20:23:29 +02:00
|
|
|
}
|
|
|
|
cw := NewCacheWorker()
|
|
|
|
go cw.Start()
|
|
|
|
time.Sleep(time.Duration(15) * time.Millisecond)
|
|
|
|
cw.Close()
|
|
|
|
}
|