Fix missing host setting and fix tests
This commit is contained in:
@@ -17,6 +17,7 @@ func Home(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
if s.Stack != "" {
|
||||
s.Host = r.Host
|
||||
go core.SessionDeployStack(s)
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ func SessionSetup(rw http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
s.Host = req.Host
|
||||
err := core.SessionSetup(s, body)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
|
||||
@@ -234,7 +234,7 @@ func TestInstanceAllowedImages(t *testing.T) {
|
||||
|
||||
p := NewPWD(dock, tasks, broadcast, storage)
|
||||
|
||||
expectedImages := []string{config.GetDindImageName(), "franela/dind:overlay2-dev"}
|
||||
expectedImages := []string{config.GetDindImageName(), "franela/dind:overlay2-dev", "franela/ucp:2.4.1"}
|
||||
|
||||
assert.Equal(t, expectedImages, p.InstanceAllowedImages())
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ type Session struct {
|
||||
Stack string `json:"stack"`
|
||||
StackName string `json:"stack_name"`
|
||||
ImageName string `json:"image_name"`
|
||||
Host string `json:"host"`
|
||||
closingTimer *time.Timer `json:"-"`
|
||||
scheduled bool `json:"-"`
|
||||
clients []*Client `json:"-"`
|
||||
@@ -163,7 +164,7 @@ func (p *pwd) SessionDeployStack(s *Session) error {
|
||||
|
||||
s.Ready = false
|
||||
p.broadcast.BroadcastTo(s.Id, "session ready", false)
|
||||
i, err := p.InstanceNew(s, InstanceConfig{ImageName: s.ImageName})
|
||||
i, err := p.InstanceNew(s, InstanceConfig{ImageName: s.ImageName, Host: s.Host})
|
||||
if err != nil {
|
||||
log.Printf("Error creating instance for stack [%s]: %s\n", s.Stack, err)
|
||||
return err
|
||||
@@ -249,6 +250,7 @@ func (p *pwd) SessionSetup(session *Session, conf SessionSetupConf) error {
|
||||
instanceConf := InstanceConfig{
|
||||
ImageName: conf.Image,
|
||||
Hostname: conf.Hostname,
|
||||
Host: session.Host,
|
||||
}
|
||||
i, err := p.InstanceNew(session, instanceConf)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user