コード例 #1
0
func (s *VESuite) SetUpSuite(c *C) {
	log.Init([]*log.LogConfig{&log.LogConfig{Name: "console"}})

	s.etcdNodes = os.Getenv("VULCAND_TEST_ETCD_NODES")
	if s.etcdNodes == "" {
		c.Skip("This test requires running Etcd, please provide url via VULCAND_TEST_ETCD_NODES environment variable")
		return
	}
	s.client = etcd.NewClient(strings.Split(s.etcdNodes, ","))

	s.etcdPrefix = os.Getenv("VULCAND_TEST_ETCD_PREFIX")
	if s.etcdPrefix == "" {
		c.Skip("This test requires Etcd prefix, please provide url via VULCAND_TEST_ETCD_PREFIX environment variable")
		return
	}

	s.apiUrl = os.Getenv("VULCAND_TEST_API_URL")
	if s.apiUrl == "" {
		c.Skip("This test requires running vulcand daemon, provide API url via VULCAND_TEST_API_URL environment variable")
		return
	}

	s.serviceUrl = os.Getenv("VULCAND_TEST_SERVICE_URL")
	if s.serviceUrl == "" {
		c.Skip("This test requires running vulcand daemon, provide API url via VULCAND_TEST_SERVICE_URL environment variable")
		return
	}
}
コード例 #2
0
ファイル: leader_test.go プロジェクト: davemkirk/vulcand
func (s *LeaderSuite) SetUpSuite(c *C) {
	machines := []string{"http://127.0.0.1:4001"}
	s.client = etcd.NewClient(machines)
	s.registry = NewLeaderRegistry("customkey", "groupid", 15)
	s.masterRegistration = &AppRegistration{Name: "name", Host: "master", Port: 12345}
	s.slaveRegistration = &AppRegistration{Name: "name", Host: "slave", Port: 67890}
	s.handlerRegistration = &HandlerRegistration{
		Name:        "name",
		Host:        "host",
		Path:        "/path/to/server",
		Methods:     []string{"PUT"},
		Middlewares: []middleware.Middleware{middleware.Middleware{Type: "test", ID: "id", Spec: "hi"}},
	}
}
コード例 #3
0
ファイル: lb_test.go プロジェクト: davemkirk/vulcand
func (s *LBRegistrySuite) SetUpSuite(c *C) {
	machines := []string{"http://127.0.0.1:4001"}
	s.client = etcd.NewClient(machines)
	s.client.Delete("customkey", true)

	s.registry, _ = NewLBRegistry("customkey", 15)
	s.appRegistration = &AppRegistration{Name: "name", Host: "host", Port: 12345}
	s.handlerRegistration = &HandlerRegistration{
		Name:        "name",
		Host:        "host",
		Path:        "/path/to/server",
		Methods:     []string{"PUT"},
		Middlewares: []middleware.Middleware{middleware.Middleware{Type: "test", ID: "id", Spec: "hi"}},
	}
}
コード例 #4
0
ファイル: etcd.go プロジェクト: davemkirk/vulcand
func (n *ng) reconnect() error {
	n.Close()
	var client *etcd.Client
	if n.options.EtcdCertFile == "" && n.options.EtcdKeyFile == "" {
		client = etcd.NewClient(n.nodes)
	} else {
		var err error
		if client, err = etcd.NewTLSClient(n.nodes, n.options.EtcdCertFile, n.options.EtcdKeyFile, n.options.EtcdCaFile); err != nil {
			return err
		}
	}
	if err := client.SetConsistency(n.options.EtcdConsistency); err != nil {
		return err
	}
	n.client = client
	return nil
}
コード例 #5
0
ファイル: systest_test.go プロジェクト: davemkirk/vulcand
func (s *VESuite) SetUpSuite(c *C) {
	log.Init([]*log.LogConfig{&log.LogConfig{Name: "console"}})

	etcdNodes := os.Getenv("VULCAND_TEST_ETCD_NODES")
	if etcdNodes == "" {
		c.Skip("This test requires running Etcd, please provide url via VULCAND_TEST_ETCD_NODES environment variable")
		return
	}
	s.etcdNodes = strings.Split(etcdNodes, ",")
	s.client = etcd.NewClient(s.etcdNodes)

	s.etcdPrefix = os.Getenv("VULCAND_TEST_ETCD_PREFIX")
	if s.etcdPrefix == "" {
		c.Skip("This test requires Etcd prefix, please provide url via VULCAND_TEST_ETCD_PREFIX environment variable")
		return
	}

	s.apiUrl = os.Getenv("VULCAND_TEST_API_URL")
	if s.apiUrl == "" {
		c.Skip("This test requires running vulcand daemon, provide API url via VULCAND_TEST_API_URL environment variable")
		return
	}

	s.serviceUrl = os.Getenv("VULCAND_TEST_SERVICE_URL")
	if s.serviceUrl == "" {
		c.Skip("This test requires running vulcand daemon, provide API url via VULCAND_TEST_SERVICE_URL environment variable")
		return
	}

	s.sealKey = os.Getenv("VULCAND_TEST_SEAL_KEY")
	if s.sealKey == "" {
		c.Skip("This test requires running vulcand daemon, provide API url via VULCAND_TEST_SEAL_KEY environment variable")
		return
	}

	key, err := secret.KeyFromString(s.sealKey)
	c.Assert(err, IsNil)

	box, err := secret.NewBox(key)
	c.Assert(err, IsNil)

	s.box = box
}
コード例 #6
0
ファイル: client_test.go プロジェクト: davemkirk/vulcand
func (s *ClientSuite) SetUpSuite(c *C) {
	machines := []string{"http://127.0.0.1:4001"}
	s.etcd = etcd.NewClient(machines)
	s.client = NewClient("clienttest")
}
コード例 #7
0
ファイル: client.go プロジェクト: davemkirk/vulcand
func NewClient(key string) *Client {
	etcd := etcd.NewClient([]string{etcdMachine})

	return &Client{Key: key, etcd: etcd}
}
コード例 #8
0
ファイル: registry.go プロジェクト: davemkirk/vulcand
func NewRegistry(config Config) *Registry {
	return &Registry{
		etcdClient: etcd.NewClient([]string{"http://127.0.0.1:4001"}),
		config:     config,
	}
}