Files
openlan/pkg/cache/store_test.go
2025-04-21 10:45:08 +08:00

32 lines
565 B
Go

package cache
import (
"fmt"
"testing"
"github.com/luscis/openlan/pkg/config"
"github.com/luscis/openlan/pkg/libol"
"github.com/luscis/openlan/pkg/models"
"github.com/stretchr/testify/assert"
)
type SocketClientMock struct {
libol.SocketClientImpl
}
func (s *SocketClientMock) String() string {
return "fake"
}
func TestInit(t *testing.T) {
cfg := &config.Perf{}
cfg.Correct()
Init(cfg)
fmt.Println(Access)
Access.Add(&models.Access{
UUID: "fake",
Client: &SocketClientMock{},
})
assert.Equal(t, 1, Access.Clients.Len(), "MUST be same")
}