Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3180)

Side by Side Diff: cmd/juju/ssh_test.go

Issue 6944058: state: machines now have Jobs not Workers
Patch Set: state: machines now have Jobs not Workers Created 12 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « [revision details] ('k') | cmd/juju/status_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package main 1 package main
2 2
3 import ( 3 import (
4 "bytes" 4 "bytes"
5 "fmt" 5 "fmt"
6 . "launchpad.net/gocheck" 6 . "launchpad.net/gocheck"
7 "launchpad.net/juju-core/charm" 7 "launchpad.net/juju-core/charm"
8 "launchpad.net/juju-core/cmd" 8 "launchpad.net/juju-core/cmd"
9 "launchpad.net/juju-core/juju/testing" 9 "launchpad.net/juju-core/juju/testing"
10 "launchpad.net/juju-core/state" 10 "launchpad.net/juju-core/state"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 code := cmd.Main(&SSHCommand{}, ctx, t.args) 110 code := cmd.Main(&SSHCommand{}, ctx, t.args)
111 c.Check(code, Equals, 0) 111 c.Check(code, Equals, 0)
112 c.Check(ctx.Stderr.(*bytes.Buffer).String(), Equals, "") 112 c.Check(ctx.Stderr.(*bytes.Buffer).String(), Equals, "")
113 c.Check(ctx.Stdout.(*bytes.Buffer).String(), Equals, t.result) 113 c.Check(ctx.Stdout.(*bytes.Buffer).String(), Equals, t.result)
114 } 114 }
115 } 115 }
116 116
117 func (s *SSHCommonSuite) makeMachines(n int, c *C) []*state.Machine { 117 func (s *SSHCommonSuite) makeMachines(n int, c *C) []*state.Machine {
118 var machines = make([]*state.Machine, n) 118 var machines = make([]*state.Machine, n)
119 for i := 0; i < n; i++ { 119 for i := 0; i < n; i++ {
120 » » m, err := s.State.AddMachine(state.MachinerWorker) 120 » » m, err := s.State.AddMachine(state.JobHostUnits)
121 c.Assert(err, IsNil) 121 c.Assert(err, IsNil)
122 // must set an instance id as the ssh command uses that as a sig nal the machine 122 // must set an instance id as the ssh command uses that as a sig nal the machine
123 // has been provisioned 123 // has been provisioned
124 inst, err := s.Conn.Environ.StartInstance(m.Id(), testing.Invali dStateInfo(m.Id()), nil) 124 inst, err := s.Conn.Environ.StartInstance(m.Id(), testing.Invali dStateInfo(m.Id()), nil)
125 c.Assert(err, IsNil) 125 c.Assert(err, IsNil)
126 c.Assert(m.SetInstanceId(inst.Id()), IsNil) 126 c.Assert(m.SetInstanceId(inst.Id()), IsNil)
127 machines[i] = m 127 machines[i] = m
128 } 128 }
129 return machines 129 return machines
130 } 130 }
131 131
132 func (s *SSHCommonSuite) addUnit(srv *state.Service, m *state.Machine, c *C) { 132 func (s *SSHCommonSuite) addUnit(srv *state.Service, m *state.Machine, c *C) {
133 u, err := srv.AddUnit() 133 u, err := srv.AddUnit()
134 c.Assert(err, IsNil) 134 c.Assert(err, IsNil)
135 err = u.AssignToMachine(m) 135 err = u.AssignToMachine(m)
136 c.Assert(err, IsNil) 136 c.Assert(err, IsNil)
137 // fudge unit.SetPublicAddress 137 // fudge unit.SetPublicAddress
138 id, err := m.InstanceId() 138 id, err := m.InstanceId()
139 c.Assert(err, IsNil) 139 c.Assert(err, IsNil)
140 insts, err := s.Conn.Environ.Instances([]state.InstanceId{id}) 140 insts, err := s.Conn.Environ.Instances([]state.InstanceId{id})
141 c.Assert(err, IsNil) 141 c.Assert(err, IsNil)
142 addr, err := insts[0].WaitDNSName() 142 addr, err := insts[0].WaitDNSName()
143 c.Assert(err, IsNil) 143 c.Assert(err, IsNil)
144 err = u.SetPublicAddress(addr) 144 err = u.SetPublicAddress(addr)
145 c.Assert(err, IsNil) 145 c.Assert(err, IsNil)
146 } 146 }
OLDNEW
« no previous file with comments | « [revision details] ('k') | cmd/juju/status_test.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b