package service import ( "fmt" "path" "testing" lfcc "git.loafle.net/commons_go/config" crc "git.loafle.net/commons_go/rpc/client" ooccp "git.loafle.net/overflow/overflow_commons_go/config/probe" "git.loafle.net/overflow/overflow_probes/config" "github.com/stretchr/testify/assert" ) func initConfig() { dir, err := lfcc.ABSPathify("../") if nil != err { panic("Config path is not valid") } config.ConfigDir = &dir cfp := path.Join(*config.ConfigDir, ooccp.ConfigFileName) config.ConfigFilePath = &cfp conf := lfcc.New() config.Config = &ooccp.Config{} if err := conf.Load(config.Config, *config.ConfigFilePath); nil != err { panic(fmt.Sprintf("Config is not valid: %v", err)) } } func TestGetClient(t *testing.T) { initConfig() cs := GetService("ContainerService").(*ContainerService) var c crc.Client var err error // // General // c, err = cs.GetClient(ooccp.ContainerGeneralName) // assert.Nil(t, err) // assert.NotNil(t, c) // err = cs.killProcess(ooccp.ContainerGeneralName) // assert.Nil(t, err) // Network c, err = cs.GetClient(ooccp.ContainerNetworkName) assert.Nil(t, err) assert.NotNil(t, c) cs.killProcess(ooccp.ContainerNetworkName) assert.Nil(t, err) // // Discovery // c, err = cs.GetClient(ooccp.ContainerDiscoveryName) // assert.Nil(t, err) // assert.NotNil(t, c) // cs.killProcess(ooccp.ContainerDiscoveryName) // assert.Nil(t, err) }