LEFT | RIGHT |
(no file at all) | |
1 package main | 1 package main |
2 | 2 |
3 import ( | 3 import ( |
4 "flag" | 4 "flag" |
5 "fmt" | 5 "fmt" |
6 "io/ioutil" | 6 "io/ioutil" |
7 . "launchpad.net/gocheck" | 7 . "launchpad.net/gocheck" |
8 _ "launchpad.net/juju-core/environs/dummy" | 8 _ "launchpad.net/juju-core/environs/dummy" |
9 "launchpad.net/juju-core/testing" | 9 "launchpad.net/juju-core/testing" |
10 "os" | 10 "os" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 c.Assert(lines[0], Equals, "usage: juju [options] <command> ...") | 82 c.Assert(lines[0], Equals, "usage: juju [options] <command> ...") |
83 assertError(c, lines, "error: flag provided but not defined: --environme
nt") | 83 assertError(c, lines, "error: flag provided but not defined: --environme
nt") |
84 } | 84 } |
85 | 85 |
86 var brokenConfig = ` | 86 var brokenConfig = ` |
87 environments: | 87 environments: |
88 one: | 88 one: |
89 type: dummy | 89 type: dummy |
90 zookeeper: false | 90 zookeeper: false |
91 broken: true | 91 broken: true |
| 92 authorized-keys: i-am-a-key |
92 ` | 93 ` |
93 | 94 |
94 // Induce failure to load environments and hence break Run. | 95 // Induce failure to load environments and hence break Run. |
95 func breakJuju(c *C) (string, func()) { | 96 func breakJuju(c *C) (string, func()) { |
96 home := os.Getenv("HOME") | 97 home := os.Getenv("HOME") |
97 path := c.MkDir() | 98 path := c.MkDir() |
98 os.Setenv("HOME", path) | 99 os.Setenv("HOME", path) |
99 | 100 |
100 jujuDir := filepath.Join(path, ".juju") | 101 jujuDir := filepath.Join(path, ".juju") |
101 err := os.Mkdir(jujuDir, 0777) | 102 err := os.Mkdir(jujuDir, 0777) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 f := strings.Fields(lines[0]) | 160 f := strings.Fields(lines[0]) |
160 if len(f) == 0 { | 161 if len(f) == 0 { |
161 continue | 162 continue |
162 } | 163 } |
163 c.Assert(f, Not(HasLen), 0) | 164 c.Assert(f, Not(HasLen), 0) |
164 names = append(names, f[0]) | 165 names = append(names, f[0]) |
165 } | 166 } |
166 sort.Strings(names) | 167 sort.Strings(names) |
167 c.Assert(names, DeepEquals, commandNames) | 168 c.Assert(names, DeepEquals, commandNames) |
168 } | 169 } |
LEFT | RIGHT |