Пример #1
0
func (s *S) TestInjectEnvironsForward(c *gocheck.C) {
	app := testing.NewFakeApp("myapp", "python", 1)
	context := action.FWContext{Params: []interface{}{app}}
	_, err := injectEnvirons.Forward(context)
	c.Assert(err, gocheck.IsNil)
	time.Sleep(6e9)
	c.Assert(app.GetCommands(), gocheck.DeepEquals, []string{"serialize", "restart"})
}
Пример #2
0
func (s *S) TestDeploy(c *gocheck.C) {
	go s.stopContainers(1)
	err := newImage("tsuru/python", s.server.URL())
	c.Assert(err, gocheck.IsNil)
	fexec := &etesting.FakeExecutor{}
	setExecut(fexec)
	defer setExecut(nil)
	p := dockerProvisioner{}
	app := testing.NewFakeApp("cribcaged", "python", 1)
	p.Provision(app)
	defer p.Destroy(app)
	w := writer{b: make([]byte, 2048)}
	err = p.Deploy(app, "master", &w)
	c.Assert(err, gocheck.IsNil)
	w.b = nil
	defer p.Destroy(app)
	time.Sleep(6e9)
	q, err := getQueue()
	message, err := q.Get(1e6)
	c.Assert(err, gocheck.IsNil)
	defer message.Delete()
	c.Assert(app.GetCommands(), gocheck.DeepEquals, []string{"serialize", "restart"})
	c.Assert(app.HasLog("tsuru", "Restarting app..."), gocheck.Equals, true)
}