fixed
instance GetClient
This commit is contained in:
parent
4b602c5b18
commit
837b3070bb
|
@ -45,17 +45,17 @@ func init() {
|
||||||
g_CrawlerMananger.init()
|
g_CrawlerMananger.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetClient(container string) (*grpc.ClientConn, error) {
|
func (c *CrawlerManager)GetClient(container string) (*grpc.ClientConn, error) {
|
||||||
crm := GetInstance()
|
|
||||||
b := crm.checkContainer(&container)
|
b := c.checkContainer(&container)
|
||||||
|
|
||||||
if b == false {
|
if b == false {
|
||||||
err := crm.runAndInitContainer(&container)
|
err := c.runAndInitContainer(&container)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gport := crm.portMap[container]
|
gport := c.portMap[container]
|
||||||
|
|
||||||
return grpc.Dial(address+gport, grpc.WithInsecure())
|
return grpc.Dial(address+gport, grpc.WithInsecure())
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,6 +209,15 @@ func TestInitCM(t *testing.T) {
|
||||||
GetInstance().stopContainerAll()
|
GetInstance().stopContainerAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCallStatus(t *testing.T) {
|
||||||
|
c := "java"
|
||||||
|
GetInstance().runAndInitContainer(&c)
|
||||||
|
|
||||||
|
callStatus(&c)
|
||||||
|
|
||||||
|
GetInstance().stopContainer(&c)
|
||||||
|
}
|
||||||
|
|
||||||
func TestCallAdd(t *testing.T) {
|
func TestCallAdd(t *testing.T) {
|
||||||
//
|
//
|
||||||
c := "java"
|
c := "java"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user