OLD | NEW |
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 "net/url" | 7 "net/url" |
8 | 8 |
9 . "launchpad.net/gocheck" | 9 . "launchpad.net/gocheck" |
10 "launchpad.net/goyaml" | 10 "launchpad.net/goyaml" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 "agent-version": "0.0.0"
, | 241 "agent-version": "0.0.0"
, |
242 "machine": 1, | 242 "machine": 1, |
243 "status": "pendin
g", | 243 "status": "pendin
g", |
244 }, | 244 }, |
245 }, | 245 }, |
246 }, | 246 }, |
247 }, | 247 }, |
248 }, | 248 }, |
249 }, | 249 }, |
250 | 250 |
251 » // TODO(dfc) test failing components by destructively mutating zk under
the hood | 251 » // TODO(dfc) test failing components by destructively mutating the state
under the hood |
252 } | 252 } |
253 | 253 |
254 func (s *StatusSuite) testStatus(format string, marshal func(v interface{}) ([]b
yte, error), unmarshal func(data []byte, v interface{}) error, c *C) { | 254 func (s *StatusSuite) testStatus(format string, marshal func(v interface{}) ([]b
yte, error), unmarshal func(data []byte, v interface{}) error, c *C) { |
255 for _, t := range statusTests { | 255 for _, t := range statusTests { |
256 c.Logf("testing %s: %s", format, t.title) | 256 c.Logf("testing %s: %s", format, t.title) |
257 t.prepare(s.State, s.Conn, c) | 257 t.prepare(s.State, s.Conn, c) |
258 ctx := &cmd.Context{c.MkDir(), &bytes.Buffer{}, &bytes.Buffer{},
&bytes.Buffer{}} | 258 ctx := &cmd.Context{c.MkDir(), &bytes.Buffer{}, &bytes.Buffer{},
&bytes.Buffer{}} |
259 code := cmd.Main(&StatusCommand{}, ctx, []string{"--format", for
mat}) | 259 code := cmd.Main(&StatusCommand{}, ctx, []string{"--format", for
mat}) |
260 c.Check(code, Equals, 0) | 260 c.Check(code, Equals, 0) |
261 c.Assert(ctx.Stderr.(*bytes.Buffer).String(), Equals, "") | 261 c.Assert(ctx.Stderr.(*bytes.Buffer).String(), Equals, "") |
(...skipping 17 matching lines...) Expand all Loading... |
279 } | 279 } |
280 } | 280 } |
281 | 281 |
282 func (s *StatusSuite) TestYamlStatus(c *C) { | 282 func (s *StatusSuite) TestYamlStatus(c *C) { |
283 s.testStatus("yaml", goyaml.Marshal, goyaml.Unmarshal, c) | 283 s.testStatus("yaml", goyaml.Marshal, goyaml.Unmarshal, c) |
284 } | 284 } |
285 | 285 |
286 func (s *StatusSuite) TestJsonStatus(c *C) { | 286 func (s *StatusSuite) TestJsonStatus(c *C) { |
287 s.testStatus("json", json.Marshal, json.Unmarshal, c) | 287 s.testStatus("json", json.Marshal, json.Unmarshal, c) |
288 } | 288 } |
OLD | NEW |