示例#1
0
文件: utils.go 项目: dnaeon/gru
// Creates a new etcd client with recording enabled
func mustNewTestClient(cassette string) *testClient {
	// Start our recorder
	r, err := recorder.New(cassette)
	if err != nil {
		panic(err)
	}

	cfg := etcdclient.Config{
		Endpoints:               []string{"http://127.0.0.1:2379"},
		Transport:               r, // Inject our transport!
		HeaderTimeoutPerRequest: etcdclient.DefaultRequestTimeout,
	}

	klient := client.NewEtcdMinionClient(cfg)

	tc := &testClient{
		client:   klient,
		config:   cfg,
		recorder: r,
	}

	return tc
}
示例#2
0
文件: utils.go 项目: dnaeon/gru
func newEtcdMinionClientFromFlags(c *cli.Context) client.Client {
	cfg := etcdConfigFromFlags(c)
	klient := client.NewEtcdMinionClient(cfg)

	return klient
}