func TestScan(t *testing.T) { cfg := config.NewConfigDefault() cfg.DataDir = "/tmp/test_scan" cfg.Addr = "127.0.0.1:11185" os.RemoveAll(cfg.DataDir) s, err := NewApp(cfg) if err != nil { t.Fatal(err) } go s.Run() defer s.Close() c := goredis.NewClient(cfg.Addr, "") c.SetMaxIdleConns(1) defer c.Close() testKVScan(t, c) testHashKeyScan(t, c) testListKeyScan(t, c) testZSetKeyScan(t, c) testSetKeyScan(t, c) }
func (app *App) getMigrateClient(addr string) *goredis.Client { app.migrateM.Lock() mc, ok := app.migrateClients[addr] if !ok { mc = goredis.NewClient(addr, "") app.migrateClients[addr] = mc } app.migrateM.Unlock() return mc }
func newTestLedisClient() { testLedisClient = goredis.NewClient("127.0.0.1:16380", "") testLedisClient.SetMaxIdleConns(4) }
func newTestLedisClientAuth() { testLedisClientAuth = goredis.NewClient("127.0.0.1:20000", "") testLedisClientAuth.SetMaxIdleConns(4) }