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

Side by Side Diff: cmd/jujud/machine_test.go

Issue 9771043: api: allow shorter dialing time
Patch Set: api: allow shorter dialing time Created 11 years, 10 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
OLDNEW
1 // Copyright 2012, 2013 Canonical Ltd. 1 // Copyright 2012, 2013 Canonical Ltd.
2 // Licensed under the AGPLv3, see LICENCE file for details. 2 // Licensed under the AGPLv3, see LICENCE file for details.
3 3
4 package main 4 package main
5 5
6 import ( 6 import (
7 "fmt" 7 "fmt"
8 . "launchpad.net/gocheck" 8 . "launchpad.net/gocheck"
9 "launchpad.net/juju-core/charm" 9 "launchpad.net/juju-core/charm"
10 "launchpad.net/juju-core/cmd" 10 "launchpad.net/juju-core/cmd"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 Addrs: []string{fmt.Sprintf("localhost:%d", port)}, 260 Addrs: []string{fmt.Sprintf("localhost:%d", port)},
261 CACert: []byte(testing.CACert), 261 CACert: []byte(testing.CACert),
262 Tag: m.Tag(), 262 Tag: m.Tag(),
263 Password: "machine-api-password", 263 Password: "machine-api-password",
264 } 264 }
265 conf.StateServerCert = []byte(testing.ServerCert) 265 conf.StateServerCert = []byte(testing.ServerCert)
266 conf.StateServerKey = []byte(testing.ServerKey) 266 conf.StateServerKey = []byte(testing.ServerKey)
267 conf.APIPort = port 267 conf.APIPort = port
268 } 268 }
269 269
270 var fastDialOpts = api.DialOpts{}
271
270 func (s *MachineSuite) TestServeAPI(c *C) { 272 func (s *MachineSuite) TestServeAPI(c *C) {
271 stm, conf, _ := s.primeAgent(c, state.JobServeAPI) 273 stm, conf, _ := s.primeAgent(c, state.JobServeAPI)
272 addAPIInfo(conf, stm) 274 addAPIInfo(conf, stm)
273 err := conf.Write() 275 err := conf.Write()
274 c.Assert(err, IsNil) 276 c.Assert(err, IsNil)
275 a := s.newAgent(c, stm) 277 a := s.newAgent(c, stm)
276 done := make(chan error) 278 done := make(chan error)
277 go func() { 279 go func() {
278 done <- a.Run(nil) 280 done <- a.Run(nil)
279 }() 281 }()
280 282
281 » st, err := api.Open(conf.APIInfo) 283 » st, err := api.Open(conf.APIInfo, fastDialOpts)
282 c.Assert(err, IsNil) 284 c.Assert(err, IsNil)
283 defer st.Close() 285 defer st.Close()
284 286
285 m, err := st.Machine(stm.Id()) 287 m, err := st.Machine(stm.Id())
286 c.Assert(err, IsNil) 288 c.Assert(err, IsNil)
287 289
288 instId, ok := m.InstanceId() 290 instId, ok := m.InstanceId()
289 c.Assert(ok, Equals, true) 291 c.Assert(ok, Equals, true)
290 c.Assert(instId, Equals, "ardbeg-0") 292 c.Assert(instId, Equals, "ardbeg-0")
291 293
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 } 355 }
354 356
355 func (s *MachineSuite) TestChangePasswordChanging(c *C) { 357 func (s *MachineSuite) TestChangePasswordChanging(c *C) {
356 c.Skip("state password changing is on hold for the moment") 358 c.Skip("state password changing is on hold for the moment")
357 m, _, _ := s.primeAgent(c, state.JobHostUnits) 359 m, _, _ := s.primeAgent(c, state.JobHostUnits)
358 newAgent := func() runner { 360 newAgent := func() runner {
359 return s.newAgent(c, m) 361 return s.newAgent(c, m)
360 } 362 }
361 s.testAgentPasswordChanging(c, m, newAgent) 363 s.testAgentPasswordChanging(c, m, newAgent)
362 } 364 }
OLDNEW
« no previous file with comments | « [revision details] ('k') | environs/agent/agent.go » ('j') | environs/agent/agent.go » ('J')

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