示例#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)
}
示例#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)
}
示例#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)
}
示例#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")
}
示例#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)
}