Example #1
0
func (s *MySuite) TestStackCreate(c *C) {
	err := stack.CreateCmd("test", s.StackFile)
	c.Assert(err, IsNil)
	data, _ := ioutil.ReadFile(stack.DefinitionFilePath("test"))
	c.Assert(string(data), Equals, s.Data)
	err = stack.CreateCmd("test", s.StackFile)
	c.Assert(err, NotNil)
}
Example #2
0
func (s *MySuite) TestStackRemove(c *C) {
	err := stack.CreateCmd("test", s.StackFile)
	c.Assert(err, IsNil)
	err = stack.RemoveCmd("test")
	c.Assert(err, IsNil)
	filePath := stack.DefinitionFilePath("test")
	_, err = os.Stat(filePath)
	c.Assert(err, NotNil)
	err = stack.RemoveCmd("test")
	c.Assert(err, NotNil)
}
Example #3
0
func (s *MySuite) TestStackUpdate(c *C) {
	err := stack.CreateCmd("test", s.StackFile)
	c.Assert(err, IsNil)
	data := `web:
    image: ubuntu
    privileged: true
`
	err = ioutil.WriteFile(s.StackFile, []byte(data), 0644)
	if err != nil {
		log.Fatal(err)
	}
	err = stack.UpdateCmd("test", s.StackFile)
	c.Assert(err, IsNil)
	content, err := ioutil.ReadFile(stack.DefinitionFilePath("test"))
	if err != nil {
		log.Fatal(err)
	}
	c.Assert(string(content), Equals, data)
	err = stack.UpdateCmd("test2", s.StackFile)
	c.Assert(err, NotNil)
}