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

Delta Between Two Patch Sets: state/machine_test.go

Issue 13430044: state: added status data to status doc
Left Patch Set: state: added status data to status doc Created 11 years, 6 months ago
Right Patch Set: state: added status data to status doc Created 11 years, 6 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « state/machine.go ('k') | state/megawatcher.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 state_test 4 package state_test
5 5
6 import ( 6 import (
7 "sort" 7 "sort"
8 8
9 gc "launchpad.net/gocheck" 9 gc "launchpad.net/gocheck"
10 10
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 425
426 func (s *MachineSuite) TestMachineRefresh(c *gc.C) { 426 func (s *MachineSuite) TestMachineRefresh(c *gc.C) {
427 m0, err := s.State.AddMachine("series", state.JobHostUnits) 427 m0, err := s.State.AddMachine("series", state.JobHostUnits)
428 c.Assert(err, gc.IsNil) 428 c.Assert(err, gc.IsNil)
429 oldTools, _ := m0.AgentTools() 429 oldTools, _ := m0.AgentTools()
430 m1, err := s.State.Machine(m0.Id()) 430 m1, err := s.State.Machine(m0.Id())
431 c.Assert(err, gc.IsNil) 431 c.Assert(err, gc.IsNil)
432 err = m0.SetAgentTools(&tools.Tools{ 432 err = m0.SetAgentTools(&tools.Tools{
433 URL: "foo", 433 URL: "foo",
434 Version: version.MustParseBinary("0.0.3-series-arch"), 434 Version: version.MustParseBinary("0.0.3-series-arch"),
435 Size: 10,
436 SHA256: "1234",
435 }) 437 })
436 c.Assert(err, gc.IsNil) 438 c.Assert(err, gc.IsNil)
437 newTools, _ := m0.AgentTools() 439 newTools, _ := m0.AgentTools()
438 440
439 m1Tools, _ := m1.AgentTools() 441 m1Tools, _ := m1.AgentTools()
440 c.Assert(m1Tools, gc.DeepEquals, oldTools) 442 c.Assert(m1Tools, gc.DeepEquals, oldTools)
441 err = m1.Refresh() 443 err = m1.Refresh()
442 c.Assert(err, gc.IsNil) 444 c.Assert(err, gc.IsNil)
443 m1Tools, _ = m1.AgentTools() 445 m1Tools, _ = m1.AgentTools()
444 c.Assert(*m1Tools, gc.Equals, *newTools) 446 c.Assert(*m1Tools, gc.Equals, *newTools)
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 machine, err := s.State.Machine(s.machine.Id()) 590 machine, err := s.State.Machine(s.machine.Id())
589 c.Assert(err, gc.IsNil) 591 c.Assert(err, gc.IsNil)
590 err = machine.SetProvisioned("m-foo", "fake_nonce", nil) 592 err = machine.SetProvisioned("m-foo", "fake_nonce", nil)
591 c.Assert(err, gc.IsNil) 593 c.Assert(err, gc.IsNil)
592 wc.AssertOneChange() 594 wc.AssertOneChange()
593 595
594 // Make two changes, check one event. 596 // Make two changes, check one event.
595 err = machine.SetAgentTools(&tools.Tools{ 597 err = machine.SetAgentTools(&tools.Tools{
596 URL: "foo", 598 URL: "foo",
597 Version: version.MustParseBinary("0.0.3-series-arch"), 599 Version: version.MustParseBinary("0.0.3-series-arch"),
600 Size: 10,
601 SHA256: "1234",
598 }) 602 })
599 c.Assert(err, gc.IsNil) 603 c.Assert(err, gc.IsNil)
600 err = machine.Destroy() 604 err = machine.Destroy()
601 c.Assert(err, gc.IsNil) 605 c.Assert(err, gc.IsNil)
602 wc.AssertOneChange() 606 wc.AssertOneChange()
603 607
604 // Stop, check closed. 608 // Stop, check closed.
605 testing.AssertStop(c, w) 609 testing.AssertStop(c, w)
606 wc.AssertClosed() 610 wc.AssertClosed()
607 611
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 addresses := []instance.Address{ 1057 addresses := []instance.Address{
1054 instance.NewAddress("127.0.0.1"), 1058 instance.NewAddress("127.0.0.1"),
1055 instance.NewAddress("8.8.8.8"), 1059 instance.NewAddress("8.8.8.8"),
1056 } 1060 }
1057 err = machine.SetAddresses(addresses) 1061 err = machine.SetAddresses(addresses)
1058 c.Assert(err, gc.IsNil) 1062 c.Assert(err, gc.IsNil)
1059 err = machine.Refresh() 1063 err = machine.Refresh()
1060 c.Assert(err, gc.IsNil) 1064 c.Assert(err, gc.IsNil)
1061 c.Assert(machine.Addresses(), gc.DeepEquals, addresses) 1065 c.Assert(machine.Addresses(), gc.DeepEquals, addresses)
1062 } 1066 }
LEFTRIGHT

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