Ejemplo n.º 1
0
func (s *MySuite) TestClusterList(c *C) {
	err := cluster.CreateCmd("test1", true, true, "pwd", true)
	c.Assert(err, IsNil)
	err = cluster.CreateCmd("test2", true, true, "pwd", true)
	c.Assert(err, IsNil)
	err = cluster.ListCmd()
	c.Assert(err, IsNil)
}
Ejemplo n.º 2
0
func (s *MySuite) TestClusterCreate(c *C) {
	err := cluster.CreateCmd("test", true, true, "pwd", true)
	c.Assert(err, IsNil)
	data, _ := ioutil.ReadFile(cluster.FilePath("test"))
	c.Assert(string(data), Equals, "name: test\nconsul: true\nweave: true\nweavepwd: pwd\ncleanup: true\n")
	err = cluster.CreateCmd("test", true, true, "pwd", true)
	c.Assert(err, NotNil)
}
Ejemplo n.º 3
0
func (s *MySuite) TestClusterRemove(c *C) {
	err := cluster.CreateCmd("test", true, true, "pwd", true)
	c.Assert(err, IsNil)
	err = cluster.RemoveCmd("test")
	c.Assert(err, IsNil)
	filePath := cluster.FilePath("test")
	_, err = os.Stat(filePath)
	c.Assert(err, NotNil)
	err = cluster.RemoveCmd("test")
	c.Assert(err, NotNil)
}
Ejemplo n.º 4
0
func (s *MySuite) TestNodeCreate(c *C) {
	err := node.CreateCmd("test", "127.0.0.1", "/", "/id_rsa", "default", []string{"testing", "staging"})
	c.Assert(err, IsNil)
	data, _ := ioutil.ReadFile(node.FilePath("test"))
	c.Assert(string(data), Equals, "name: test\nurl: tcp://127.0.0.1:2376\ncert: /\nkey: /id_rsa\ncluster: default\ntags:\n- testing\n- staging\n")
	err = node.CreateCmd("test", "127.0.0.1", "/", "/id_rsa", "default", []string{"testing", "staging"})
	c.Assert(err, NotNil)
	err = node.CreateCmd("test2", "127.0.0.1", "/", "/id_rsa", "cluster", []string{"testing", "staging"})
	c.Assert(err, NotNil)
	err = cluster.CreateCmd("cluster", true, true, "pwd", true)
	c.Assert(err, IsNil)
	err = node.CreateCmd("test2", "127.0.0.1", "/", "/id_rsa", "cluster", []string{"testing", "staging"})
	c.Assert(err, IsNil)
	data, _ = ioutil.ReadFile(node.FilePath("test2"))
	c.Assert(string(data), Equals, "name: test2\nurl: tcp://127.0.0.1:2376\ncert: /\nkey: /id_rsa\ncluster: cluster\ntags:\n- testing\n- staging\n")
}
Ejemplo n.º 5
0
func (s *MySuite) TestClusterInspect(c *C) {
	err := cluster.CreateCmd("test", true, true, "pwd", true)
	c.Assert(err, IsNil)
	err = cluster.InspectCmd("test")
	c.Assert(err, IsNil)
}