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