LEFT | RIGHT |
(no file at all) | |
1 package main_test | 1 package main_test |
2 | 2 |
3 import ( | 3 import ( |
4 "flag" | 4 "flag" |
5 . "launchpad.net/gocheck" | 5 . "launchpad.net/gocheck" |
6 main "launchpad.net/juju/go/cmd/jujud" | 6 main "launchpad.net/juju/go/cmd/jujud" |
7 "os" | 7 "os" |
8 "os/exec" | 8 "os/exec" |
9 "strings" | 9 "strings" |
10 "testing" | 10 "testing" |
(...skipping 20 matching lines...) Expand all Loading... |
31 ps := exec.Command(os.Args[0], args...) | 31 ps := exec.Command(os.Args[0], args...) |
32 output, err := ps.CombinedOutput() | 32 output, err := ps.CombinedOutput() |
33 c.Assert(err, ErrorMatches, "exit status 2") | 33 c.Assert(err, ErrorMatches, "exit status 2") |
34 lines := strings.Split(string(output), "\n") | 34 lines := strings.Split(string(output), "\n") |
35 c.Assert(lines[0], Equals, msg) | 35 c.Assert(lines[0], Equals, msg) |
36 } | 36 } |
37 | 37 |
38 func (s *MainSuite) TestParseErrors(c *C) { | 38 func (s *MainSuite) TestParseErrors(c *C) { |
39 // Check all the obvious parse errors | 39 // Check all the obvious parse errors |
40 checkMessage(c, "no command specified") | 40 checkMessage(c, "no command specified") |
41 » checkMessage(c, "unrecognised command: cavitate", "cavitate") | 41 » checkMessage(c, "unrecognised command: jujud cavitate", "cavitate") |
42 msgf := "flag provided but not defined: --cheese" | 42 msgf := "flag provided but not defined: --cheese" |
43 checkMessage(c, msgf, "--cheese", "cavitate") | 43 checkMessage(c, msgf, "--cheese", "cavitate") |
44 | 44 |
45 cmds := []string{"initzk", "unit", "machine", "provisioning"} | 45 cmds := []string{"initzk", "unit", "machine", "provisioning"} |
46 msgz := `invalid value "localhost:2181,zk" for flag --zookeeper-servers:
"zk" is not a valid zookeeper address` | 46 msgz := `invalid value "localhost:2181,zk" for flag --zookeeper-servers:
"zk" is not a valid zookeeper address` |
47 for _, cmd := range cmds { | 47 for _, cmd := range cmds { |
48 checkMessage(c, msgf, cmd, "--cheese") | 48 checkMessage(c, msgf, cmd, "--cheese") |
49 checkMessage(c, msgz, cmd, "--zookeeper-servers", "localhost:218
1,zk") | 49 checkMessage(c, msgz, cmd, "--zookeeper-servers", "localhost:218
1,zk") |
50 } | 50 } |
51 | 51 |
(...skipping 11 matching lines...) Expand all Loading... |
63 checkMessage(c, msga, "machine", | 63 checkMessage(c, msga, "machine", |
64 "--zookeeper-servers", "zk:2181", | 64 "--zookeeper-servers", "zk:2181", |
65 "--session-file", "sf", | 65 "--session-file", "sf", |
66 "--machine-id", "42", | 66 "--machine-id", "42", |
67 "toastie") | 67 "toastie") |
68 checkMessage(c, msga, "provisioning", | 68 checkMessage(c, msga, "provisioning", |
69 "--zookeeper-servers", "127.0.0.1:2181", | 69 "--zookeeper-servers", "127.0.0.1:2181", |
70 "--session-file", "sf", | 70 "--session-file", "sf", |
71 "toastie") | 71 "toastie") |
72 } | 72 } |
LEFT | RIGHT |