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

Side by Side Diff: state/megawatcher_internal_test.go

Issue 8256043: state: add machine status; refractor unit status (Closed)
Patch Set: state: add machine status; refractor unit status Created 12 years 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 | « state/machine_test.go ('k') | state/open.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 state 1 package state
2 2
3 import ( 3 import (
4 "container/list" 4 "container/list"
5 "errors" 5 "errors"
6 "fmt" 6 "fmt"
7 "labix.org/v2/mgo" 7 "labix.org/v2/mgo"
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/state/api/params" 10 "launchpad.net/juju-core/state/api/params"
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 m, err := s.State.AddMachine("series", JobHostUnits) 768 m, err := s.State.AddMachine("series", JobHostUnits)
769 c.Assert(err, IsNil) 769 c.Assert(err, IsNil)
770 c.Assert(m.Tag(), Equals, fmt.Sprintf("machine-%d", i+1)) 770 c.Assert(m.Tag(), Equals, fmt.Sprintf("machine-%d", i+1))
771 771
772 add(&params.UnitInfo{ 772 add(&params.UnitInfo{
773 Name: fmt.Sprintf("wordpress/%d", i), 773 Name: fmt.Sprintf("wordpress/%d", i),
774 Service: wordpress.Name(), 774 Service: wordpress.Name(),
775 Series: m.Series(), 775 Series: m.Series(),
776 MachineId: m.Id(), 776 MachineId: m.Id(),
777 Ports: []params.Port{}, 777 Ports: []params.Port{},
778 Status: params.UnitPending,
779 }) 778 })
780 pairs := map[string]string{"name": fmt.Sprintf("bar %d", i)} 779 pairs := map[string]string{"name": fmt.Sprintf("bar %d", i)}
781 err = wu.SetAnnotations(pairs) 780 err = wu.SetAnnotations(pairs)
782 c.Assert(err, IsNil) 781 c.Assert(err, IsNil)
783 add(&params.AnnotationInfo{ 782 add(&params.AnnotationInfo{
784 GlobalKey: fmt.Sprintf("u#wordpress/%d", i), 783 GlobalKey: fmt.Sprintf("u#wordpress/%d", i),
785 Tag: fmt.Sprintf("unit-wordpress-%d", i), 784 Tag: fmt.Sprintf("unit-wordpress-%d", i),
786 Annotations: pairs, 785 Annotations: pairs,
787 }) 786 })
788 787
(...skipping 22 matching lines...) Expand all
811 c.Assert(err, IsNil) 810 c.Assert(err, IsNil)
812 c.Assert(lu.IsPrincipal(), Equals, false) 811 c.Assert(lu.IsPrincipal(), Equals, false)
813 deployer, ok = lu.DeployerTag() 812 deployer, ok = lu.DeployerTag()
814 c.Assert(ok, Equals, true) 813 c.Assert(ok, Equals, true)
815 c.Assert(deployer, Equals, fmt.Sprintf("unit-wordpress-%d", i)) 814 c.Assert(deployer, Equals, fmt.Sprintf("unit-wordpress-%d", i))
816 add(&params.UnitInfo{ 815 add(&params.UnitInfo{
817 Name: fmt.Sprintf("logging/%d", i), 816 Name: fmt.Sprintf("logging/%d", i),
818 Service: "logging", 817 Service: "logging",
819 Series: "series", 818 Series: "series",
820 Ports: []params.Port{}, 819 Ports: []params.Port{},
821 Status: params.UnitPending,
822 }) 820 })
823 } 821 }
824 return 822 return
825 } 823 }
826 824
827 func serviceCharmURL(svc *Service) *charm.URL { 825 func serviceCharmURL(svc *Service) *charm.URL {
828 url, _ := svc.CharmURL() 826 url, _ := svc.CharmURL()
829 return url 827 return url
830 } 828 }
831 829
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 delete(b.entities, id) 1368 delete(b.entities, id)
1371 b.txnRevno++ 1369 b.txnRevno++
1372 if b.watchc != nil { 1370 if b.watchc != nil {
1373 b.watchc <- watcher.Change{ 1371 b.watchc <- watcher.Change{
1374 C: id.collection, 1372 C: id.collection,
1375 Id: id.id, 1373 Id: id.id,
1376 Revno: -1, 1374 Revno: -1,
1377 } 1375 }
1378 } 1376 }
1379 } 1377 }
OLDNEW
« no previous file with comments | « state/machine_test.go ('k') | state/open.go » ('j') | no next file with comments »

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