consumer/provider에 Authorization타입으로 고정

This commit is contained in:
2023-08-30 13:38:13 +09:00
parent a5d66a0249
commit d8458662fd
4 changed files with 43 additions and 37 deletions

View File

@ -10,18 +10,13 @@ import (
"repositories.action2quare.com/ayo/gocommon/logger"
)
type sessioninfo struct {
Platform string
Uid string
}
func TestExpTable(t *testing.T) {
pv, err := NewProvider[sessioninfo](context.Background(), "redis://192.168.8.94:6380/1", 10*time.Second)
pv, err := NewProvider(context.Background(), "redis://192.168.8.94:6380/1", 10*time.Second)
if err != nil {
t.Error(err)
}
cs, err := NewConsumer[sessioninfo](context.Background(), "redis://192.168.8.94:6380/1", 10*time.Second)
cs, err := NewConsumer(context.Background(), "redis://192.168.8.94:6380/1", 10*time.Second)
if err != nil {
t.Error(err)
}
@ -37,13 +32,15 @@ func TestExpTable(t *testing.T) {
}()
time.Sleep(2 * time.Second)
pv.Update(newid1.Hex(), &sessioninfo{
pv.Update(newid1.Hex(), &Authorization{
Account: newid1.Hex(),
Platform: "editor",
Uid: "uid-1",
})
time.Sleep(2 * time.Second)
pv.Update(newid2.Hex(), &sessioninfo{
pv.Update(newid2.Hex(), &Authorization{
Account: newid2.Hex(),
Platform: "editor",
Uid: "uid-2",
})
@ -61,7 +58,7 @@ func TestExpTable(t *testing.T) {
cs.Touch(newid2.Hex())
time.Sleep(2 * time.Second)
cs2, err := NewConsumer[sessioninfo](context.Background(), "redis://192.168.8.94:6380/1", 10*time.Second)
cs2, err := NewConsumer(context.Background(), "redis://192.168.8.94:6380/1", 10*time.Second)
if err != nil {
t.Error(err)
}