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

Delta Between Two Patch Sets: state/api/params/params_test.go

Issue 8811043: Add Life to Service API information
Left Patch Set: Created 11 years, 12 months ago
Right Patch Set: Add Life to Service API information Created 11 years, 12 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/api/params/params.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 package params_test 1 package params_test
2 2
3 import ( 3 import (
4 "encoding/json" 4 "encoding/json"
5 . "launchpad.net/gocheck" 5 . "launchpad.net/gocheck"
6 "launchpad.net/juju-core/charm" 6 "launchpad.net/juju-core/charm"
7 "launchpad.net/juju-core/constraints" 7 "launchpad.net/juju-core/constraints"
8 "launchpad.net/juju-core/state"
8 "launchpad.net/juju-core/state/api/params" 9 "launchpad.net/juju-core/state/api/params"
9 "testing" 10 "testing"
10 ) 11 )
11 12
12 // TestPackage integrates the tests into gotest. 13 // TestPackage integrates the tests into gotest.
13 func TestPackage(t *testing.T) { 14 func TestPackage(t *testing.T) {
14 TestingT(t) 15 TestingT(t)
15 } 16 }
16 17
17 type MarshalSuite struct{} 18 type MarshalSuite struct{}
(...skipping 17 matching lines...) Expand all
35 }, 36 },
36 }, 37 },
37 json: `["machine","change",{"Id":"Benji","InstanceId":"Shazam","Status": "error","StatusInfo":"foo"}]`, 38 json: `["machine","change",{"Id":"Benji","InstanceId":"Shazam","Status": "error","StatusInfo":"foo"}]`,
38 }, { 39 }, {
39 about: "ServiceInfo Delta", 40 about: "ServiceInfo Delta",
40 value: params.Delta{ 41 value: params.Delta{
41 Entity: &params.ServiceInfo{ 42 Entity: &params.ServiceInfo{
42 Name: "Benji", 43 Name: "Benji",
43 Exposed: true, 44 Exposed: true,
44 CharmURL: "cs:series/name", 45 CharmURL: "cs:series/name",
45 » » » Life: "dying", 46 » » » Life: state.Dying.String(),
dave_cheney.net 2013/04/17 00:25:02 please use state.Dying.String() here, so we can ca
46 Constraints: constraints.MustParse("arch=arm mem=1024M") , 47 Constraints: constraints.MustParse("arch=arm mem=1024M") ,
47 Config: map[string]interface{}{ 48 Config: map[string]interface{}{
48 "hello": "goodbye", 49 "hello": "goodbye",
49 "foo": false, 50 "foo": false,
50 }, 51 },
51 }, 52 },
52 }, 53 },
53 json: `["service","change",{"CharmURL": "cs:series/name","Name":"Benji", "Exposed":true,"Life":"dying","Constraints":{"arch":"arm", "mem": 1024},"Config" : {"hello":"goodbye","foo":false}}]`, 54 json: `["service","change",{"CharmURL": "cs:series/name","Name":"Benji", "Exposed":true,"Life":"dying","Constraints":{"arch":"arm", "mem": 1024},"Config" : {"hello":"goodbye","foo":false}}]`,
54 }, { 55 }, {
55 about: "UnitInfo Delta", 56 about: "UnitInfo Delta",
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 142
142 func (s *MarshalSuite) TestDeltaMarshalJSONUnknownOperation(c *C) { 143 func (s *MarshalSuite) TestDeltaMarshalJSONUnknownOperation(c *C) {
143 err := json.Unmarshal([]byte(`["relation","masticate",{}]`), new(params. Delta)) 144 err := json.Unmarshal([]byte(`["relation","masticate",{}]`), new(params. Delta))
144 c.Check(err, ErrorMatches, `Unexpected operation "masticate"`) 145 c.Check(err, ErrorMatches, `Unexpected operation "masticate"`)
145 } 146 }
146 147
147 func (s *MarshalSuite) TestDeltaMarshalJSONUnknownEntity(c *C) { 148 func (s *MarshalSuite) TestDeltaMarshalJSONUnknownEntity(c *C) {
148 err := json.Unmarshal([]byte(`["qwan","change",{}]`), new(params.Delta)) 149 err := json.Unmarshal([]byte(`["qwan","change",{}]`), new(params.Delta))
149 c.Check(err, ErrorMatches, `Unexpected entity name "qwan"`) 150 c.Check(err, ErrorMatches, `Unexpected entity name "qwan"`)
150 } 151 }
LEFTRIGHT

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