MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / newProxy2Server

Function newProxy2Server

IceFireDB-Redis-Proxy/test/server/proxy.go:55–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53}
54
55func newProxy2Server() *ProxyTest {
56 ms, err := miniredis.Run()
57 if err != nil {
58 panic(err)
59 }
60 viper.SetConfigType("yaml")
61 err = viper.ReadConfig(bytes.NewBuffer(_yamlConfig))
62 if err != nil {
63 panic(err)
64 }
65
66 err = config.InitConfig()
67 if err != nil {
68 panic(err)
69 }
70 // config.Get().RedisDB.Type = config.TypeNode
71 // config.Get().RedisDB.StartNodes = ms.Addr()
72
73 p, err := proxy.New()
74 if err != nil {
75 log.Printf("failed to create proxy: %v", err)
76 return nil
77 }
78 ctx, cancel := context.WithCancel(context.Background())
79 errSignal := make(chan error)
80 go func() {
81 p.Run(ctx, errSignal)
82 }()
83 <-errSignal
84
85 return &ProxyTest{minis: ms, proxy: p, cancel: cancel}
86}
87
88func (pt *ProxyTest) Close() {
89 pt.cancel()

Callers 1

proxy.goFile · 0.70

Calls 3

InitConfigFunction · 0.92
NewFunction · 0.92
RunMethod · 0.45

Tested by

no test coverage detected