Merge lp://staging/~niemeyer/juju-core/drop-resolved-error-result into lp://staging/~juju/juju-core/trunk
Proposed by
Gustavo Niemeyer
Status: | Merged |
---|---|
Merged at revision: | 566 |
Proposed branch: | lp://staging/~niemeyer/juju-core/drop-resolved-error-result |
Merge into: | lp://staging/~juju/juju-core/trunk |
Diff against target: |
55 lines (+16/-10) 2 files modified
state/unit.go (+2/-2) state/unit_test.go (+14/-8) |
To merge this branch: | bzr merge lp://staging/~niemeyer/juju-core/drop-resolved-error-result |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
The Go Language Gophers | Pending | ||
Review via email: mp+126110@code.staging.launchpad.net |
Description of the change
state: drop error result from Unit.Resolved
To post a comment you must log in.
Reviewers: mp+126110_ code.launchpad. net,
Message:
Please take a look.
Description:
state: drop error result from Unit.Resolved
https:/ /code.launchpad .net/~niemeyer/ juju-core/ drop-resolved- error-result/ +merge/ 126110
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/6570043/
Affected files:
A [revision details]
M state/unit.go
M state/unit_test.go
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: state/unit.go
=== modified file 'state/unit.go'
--- state/unit.go 2012-09-24 14:37:22 +0000
+++ state/unit.go 2012-09-24 21:31:51 +0000
@@ -172,8 +172,8 @@
}
// Resolved returns the resolved mode for the unit.
-func (u *Unit) Resolved() (mode ResolvedMode, err error) {
- return u.doc.Resolved, nil
+func (u *Unit) Resolved() ResolvedMode {
+ return u.doc.Resolved
}
// IsPrincipal returns whether the unit is deployed in its own container,
Index: state/unit_test.go unit_test. go'
=== modified file 'state/
--- state/unit_test.go 2012-09-24 14:37:22 +0000
+++ state/unit_test.go 2012-09-24 21:31:51 +0000
@@ -184,23 +184,29 @@
}
func (s *UnitSuite) TestGetSetClear Resolved( c *C) {
- setting, err := s.unit.Resolved()
- c.Assert(err, IsNil)
- c.Assert(setting, Equals, state.ResolvedNone)
+ mode := s.unit.Resolved()
+ c.Assert(mode, Equals, state.ResolvedNone)
- err = s.unit. SetResolved( state.ResolvedN oHooks) SetResolved( state.ResolvedN oHooks) SetResolved( state.ResolvedN oHooks) oHooks) oHooks) oHooks)
+ err := s.unit.
c.Assert(err, IsNil)
err = s.unit.
c.Assert(err, ErrorMatches, `cannot set resolved mode for
unit "wordpress/0": already resolved`)
- retry, err := s.unit.Resolved()
+
+ mode = s.unit.Resolved()
+ c.Assert(mode, Equals, state.ResolvedN
+ err = s.unit.Refresh()
c.Assert(err, IsNil)
- c.Assert(retry, Equals, state.ResolvedN
+ mode = s.unit.Resolved()
+ c.Assert(mode, Equals, state.ResolvedN
err = s.unit. ClearResolved( ) ClearResolved( )
c.Assert(err, IsNil)
- setting, err = s.unit.Resolved()
+ mode = s.unit.Resolved()
+ c.Assert(mode, Equals, state.ResolvedNone)
+ err = s.unit.Refresh()
c.Assert(err, IsNil)
- c.Assert(setting, Equals, state.ResolvedNone)
+ mode = s.unit.Resolved()
+ c.Assert(mode, Equals, state.ResolvedNone)
err = s.unit.
c.Assert(err, IsNil)