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/models/cache_worker_test.go

25 lines
608 B
Go
Raw Normal View History

package models
import (
"testing"
"time"
)
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 = CacheWorkerConfig{
Every: Duration{Duration: time.Duration(3) * time.Millisecond},
After: Duration{Duration: time.Duration(5) * time.Millisecond},
}
cw := NewCacheWorker()
go cw.Start()
time.Sleep(time.Duration(15) * time.Millisecond)
cw.Close()
}