LEFT | RIGHT |
1 package main | 1 package main |
2 | 2 |
3 import ( | 3 import ( |
4 "io/ioutil" | 4 "io/ioutil" |
5 "launchpad.net/gnuflag" | 5 "launchpad.net/gnuflag" |
6 . "launchpad.net/gocheck" | 6 . "launchpad.net/gocheck" |
7 "launchpad.net/juju-core/cmd" | 7 "launchpad.net/juju-core/cmd" |
8 ) | 8 ) |
9 | 9 |
10 type acCreator func() (cmd.Command, *AgentConf) | 10 type acCreator func() (cmd.Command, *AgentConf) |
(...skipping 11 matching lines...) Expand all Loading... |
22 func CheckAgentCommand(c *C, create acCreator, args []string) cmd.Command { | 22 func CheckAgentCommand(c *C, create acCreator, args []string) cmd.Command { |
23 com, _ := create() | 23 com, _ := create() |
24 err := initCmd(com, args) | 24 err := initCmd(com, args) |
25 c.Assert(err, ErrorMatches, "--zookeeper-servers option must be set") | 25 c.Assert(err, ErrorMatches, "--zookeeper-servers option must be set") |
26 args = append(args, "--zookeeper-servers", "zk1:2181,zk2:2181") | 26 args = append(args, "--zookeeper-servers", "zk1:2181,zk2:2181") |
27 | 27 |
28 com, conf := create() | 28 com, conf := create() |
29 c.Assert(initCmd(com, args), IsNil) | 29 c.Assert(initCmd(com, args), IsNil) |
30 c.Assert(conf.StateInfo.Addrs, DeepEquals, []string{"zk1:2181", "zk2:218
1"}) | 30 c.Assert(conf.StateInfo.Addrs, DeepEquals, []string{"zk1:2181", "zk2:218
1"}) |
31 c.Assert(conf.DataDir, Equals, "/var/lib/juju") | 31 c.Assert(conf.DataDir, Equals, "/var/lib/juju") |
32 » args = append(args, "--data-directory", "jd") | 32 » args = append(args, "--data-dir", "jd") |
33 | 33 |
34 com, conf = create() | 34 com, conf = create() |
35 c.Assert(initCmd(com, args), IsNil) | 35 c.Assert(initCmd(com, args), IsNil) |
36 c.Assert(conf.StateInfo.Addrs, DeepEquals, []string{"zk1:2181", "zk2:218
1"}) | 36 c.Assert(conf.StateInfo.Addrs, DeepEquals, []string{"zk1:2181", "zk2:218
1"}) |
37 c.Assert(conf.DataDir, Equals, "jd") | 37 c.Assert(conf.DataDir, Equals, "jd") |
38 return com | 38 return com |
39 } | 39 } |
40 | 40 |
41 // ParseAgentCommand is a utility function that inserts the always-required args | 41 // ParseAgentCommand is a utility function that inserts the always-required args |
42 // before parsing an agent command and returning the result. | 42 // before parsing an agent command and returning the result. |
43 func ParseAgentCommand(ac cmd.Command, args []string) error { | 43 func ParseAgentCommand(ac cmd.Command, args []string) error { |
44 common := []string{ | 44 common := []string{ |
45 "--zookeeper-servers", "zk:2181", | 45 "--zookeeper-servers", "zk:2181", |
46 » » "--data-directory", "jd", | 46 » » "--data-dir", "jd", |
47 } | 47 } |
48 return initCmd(ac, append(common, args...)) | 48 return initCmd(ac, append(common, args...)) |
49 } | 49 } |
LEFT | RIGHT |