Files
openlan/pkg/cache/store_test.go
2024-06-07 19:25:21 +08:00

32 lines
561 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(Point)
Point.Add(&models.Point{
UUID: "fake",
Client: &SocketClientMock{},
})
assert.Equal(t, 1, Point.Clients.Len(), "MUST be same")
}