LEFT | RIGHT |
1 package main | 1 package main |
2 | 2 |
3 import ( | 3 import ( |
4 "bytes" | 4 "bytes" |
5 "encoding/json" | 5 "encoding/json" |
6 "fmt" | 6 "fmt" |
7 . "launchpad.net/gocheck" | 7 . "launchpad.net/gocheck" |
8 "launchpad.net/goyaml" | 8 "launchpad.net/goyaml" |
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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 }, | 275 }, |
276 }, | 276 }, |
277 }, | 277 }, |
278 "dummy-service": M{ | 278 "dummy-service": M{ |
279 "charm": "local:series/dummy-1
", | 279 "charm": "local:series/dummy-1
", |
280 "exposed": false, | 280 "exposed": false, |
281 "units": M{ | 281 "units": M{ |
282 "dummy-service/0": M{ | 282 "dummy-service/0": M{ |
283 "machine":
"1", | 283 "machine":
"1", |
284 "agent-state":
"down", | 284 "agent-state":
"down", |
285 » » » » » » » » "agent-state-inf
o": "started", | 285 » » » » » » » » "agent-state-inf
o": "(started)", |
286 }, | 286 }, |
287 }, | 287 }, |
288 }, | 288 }, |
289 }, | 289 }, |
290 }, | 290 }, |
291 }, | 291 }, |
292 | 292 |
293 addMachine{"3", state.JobHostUnits}, | 293 addMachine{"3", state.JobHostUnits}, |
294 startMachine{"3"}, | 294 startMachine{"3"}, |
295 // Simulate some status with info, while the agent is down. | 295 // Simulate some status with info, while the agent is down. |
296 setMachineStatus{"3", params.MachineStopped, "Really?"}, | 296 setMachineStatus{"3", params.MachineStopped, "Really?"}, |
297 addMachine{"4", state.JobHostUnits}, | 297 addMachine{"4", state.JobHostUnits}, |
298 startAliveMachine{"4"}, | 298 startAliveMachine{"4"}, |
299 setMachineStatus{"4", params.MachineError, "Beware the red toys"
}, | 299 setMachineStatus{"4", params.MachineError, "Beware the red toys"
}, |
300 expect{ | 300 expect{ |
301 "add two more machine, one with a dead agent, one in err
or state", | 301 "add two more machine, one with a dead agent, one in err
or state", |
302 M{ | 302 M{ |
303 "machines": M{ | 303 "machines": M{ |
304 "0": machine0, | 304 "0": machine0, |
305 "1": machine1, | 305 "1": machine1, |
306 "2": machine2, | 306 "2": machine2, |
307 "3": M{ | 307 "3": M{ |
308 "dns-name": "dummyenv-3.
dns", | 308 "dns-name": "dummyenv-3.
dns", |
309 "instance-id": "dummyenv-3"
, | 309 "instance-id": "dummyenv-3"
, |
310 "agent-state": "down", | 310 "agent-state": "down", |
311 » » » » » » "agent-state-info": "stopped: Re
ally?", | 311 » » » » » » "agent-state-info": "(stopped: R
eally?)", |
312 }, | 312 }, |
313 "4": M{ | 313 "4": M{ |
314 "dns-name": "dummyenv-4.
dns", | 314 "dns-name": "dummyenv-4.
dns", |
315 "instance-id": "dummyenv-4"
, | 315 "instance-id": "dummyenv-4"
, |
316 "agent-state": "error", | 316 "agent-state": "error", |
317 "agent-state-info": "Beware the
red toys", | 317 "agent-state-info": "Beware the
red toys", |
318 }, | 318 }, |
319 }, | 319 }, |
320 "services": M{ | 320 "services": M{ |
321 "exposed-service": M{ | 321 "exposed-service": M{ |
322 "charm": "local:series/dummy-1
", | 322 "charm": "local:series/dummy-1
", |
323 "exposed": true, | 323 "exposed": true, |
324 "units": M{ | 324 "units": M{ |
325 "exposed-service/0": M{ | 325 "exposed-service/0": M{ |
326 "machine":
"2", | 326 "machine":
"2", |
327 "agent-state":
"error", | 327 "agent-state":
"error", |
328 "agent-state-inf
o": "You Require More Vespene Gas", | 328 "agent-state-inf
o": "You Require More Vespene Gas", |
329 }, | 329 }, |
330 }, | 330 }, |
331 }, | 331 }, |
332 "dummy-service": M{ | 332 "dummy-service": M{ |
333 "charm": "local:series/dummy-1
", | 333 "charm": "local:series/dummy-1
", |
334 "exposed": false, | 334 "exposed": false, |
335 "units": M{ | 335 "units": M{ |
336 "dummy-service/0": M{ | 336 "dummy-service/0": M{ |
337 "machine":
"1", | 337 "machine":
"1", |
338 "agent-state":
"down", | 338 "agent-state":
"down", |
339 » » » » » » » » "agent-state-inf
o": "started", | 339 » » » » » » » » "agent-state-inf
o": "(started)", |
340 }, | 340 }, |
341 }, | 341 }, |
342 }, | 342 }, |
343 }, | 343 }, |
344 }, | 344 }, |
345 }, | 345 }, |
346 ), | 346 ), |
347 } | 347 } |
348 | 348 |
349 // TODO(dfc) test failing components by destructively mutating the state under t
he hood | 349 // TODO(dfc) test failing components by destructively mutating the state under t
he hood |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 for i, t := range statusTests { | 545 for i, t := range statusTests { |
546 c.Log("test %d: %s", i, t.summary) | 546 c.Log("test %d: %s", i, t.summary) |
547 func() { | 547 func() { |
548 // Prepare context and run all steps to setup. | 548 // Prepare context and run all steps to setup. |
549 ctx := s.newContext() | 549 ctx := s.newContext() |
550 defer s.resetContext(c, ctx) | 550 defer s.resetContext(c, ctx) |
551 ctx.run(c, t.steps) | 551 ctx.run(c, t.steps) |
552 }() | 552 }() |
553 } | 553 } |
554 } | 554 } |
LEFT | RIGHT |