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

Side by Side Diff: environs/openstack/config_test.go

Issue 6912047: environs/openstack: fix tests
Patch Set: environs/openstack: fix tests Created 11 years, 3 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:
View unified diff | Download patch
« no previous file with comments | « [revision details] ('k') | environs/openstack/local_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package openstack 1 package openstack
2 2
3 import ( 3 import (
4 . "launchpad.net/gocheck" 4 . "launchpad.net/gocheck"
5 "launchpad.net/goyaml" 5 "launchpad.net/goyaml"
6 "launchpad.net/juju-core/environs" 6 "launchpad.net/juju-core/environs"
7 "launchpad.net/juju-core/environs/config" 7 "launchpad.net/juju-core/environs/config"
8 coretesting "launchpad.net/juju-core/testing" 8 coretesting "launchpad.net/juju-core/testing"
9 "os" 9 "os"
10 "testing" 10 "testing"
11 ) 11 )
12 12
13 type ConfigSuite struct { 13 type ConfigSuite struct {
14 savedVars map[string]string 14 savedVars map[string]string
15 } 15 }
16 16
17 var envVars = map[string]string{ 17 var envVars = map[string]string{
18 "OS_USERNAME": "testuser", 18 "OS_USERNAME": "testuser",
19 "OS_PASSWORD": "testpass", 19 "OS_PASSWORD": "testpass",
20 "OS_TENANT_NAME": "testtenant", 20 "OS_TENANT_NAME": "testtenant",
21 "OS_AUTH_URL": "http://somehost", 21 "OS_AUTH_URL": "http://somehost",
22 "OS_REGION_NAME": "testreg", 22 "OS_REGION_NAME": "testreg",
23 } 23 }
24 24
25 var _ = Suite(&ConfigSuite{}) 25 var _ = Suite(&ConfigSuite{})
26 26
27 func Test(t *testing.T) {
28 TestingT(t)
29 }
30
31 // configTest specifies a config parsing test, checking that env when 27 // configTest specifies a config parsing test, checking that env when
32 // parsed as the openstack section of a config file matches 28 // parsed as the openstack section of a config file matches
33 // baseConfigResult when mutated by the mutate function, or that the 29 // baseConfigResult when mutated by the mutate function, or that the
34 // parse matches the given error. 30 // parse matches the given error.
35 type configTest struct { 31 type configTest struct {
36 summary string 32 summary string
37 config attrs 33 config attrs
38 change attrs 34 change attrs
39 region string 35 region string
40 controlBucket string 36 controlBucket string
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 c.Logf("test %d: %s (%v)", i, t.summary, t.config) 248 c.Logf("test %d: %s (%v)", i, t.summary, t.config)
253 t.check(c) 249 t.check(c)
254 } 250 }
255 } 251 }
256 252
257 func (s *ConfigSuite) TestMissingRegion(c *C) { 253 func (s *ConfigSuite) TestMissingRegion(c *C) {
258 os.Setenv("OS_REGION_NAME", "") 254 os.Setenv("OS_REGION_NAME", "")
259 os.Setenv("NOVA_REGION_NAME", "") 255 os.Setenv("NOVA_REGION_NAME", "")
260 test := configTests[0] 256 test := configTests[0]
261 delete(test.config, "region") 257 delete(test.config, "region")
262 » test.err = ".*environment has no region" 258 » test.err = "required environment variable not set for credentials attrib ute: Region"
263 test.check(c) 259 test.check(c)
264 } 260 }
265 261
266 func (s *ConfigSuite) TestMissingUsername(c *C) { 262 func (s *ConfigSuite) TestMissingUsername(c *C) {
267 os.Setenv("OS_USERNAME", "") 263 os.Setenv("OS_USERNAME", "")
268 os.Setenv("NOVA_USERNAME", "") 264 os.Setenv("NOVA_USERNAME", "")
269 test := configTests[0] 265 test := configTests[0]
270 test.err = "required environment variable not set for credentials attrib ute: User" 266 test.err = "required environment variable not set for credentials attrib ute: User"
271 test.check(c) 267 test.check(c)
272 } 268 }
(...skipping 13 matching lines...) Expand all
286 test.err = "required environment variable not set for credentials attrib ute: TenantName" 282 test.err = "required environment variable not set for credentials attrib ute: TenantName"
287 test.check(c) 283 test.check(c)
288 } 284 }
289 285
290 func (s *ConfigSuite) TestMissingAuthUrl(c *C) { 286 func (s *ConfigSuite) TestMissingAuthUrl(c *C) {
291 os.Setenv("OS_AUTH_URL", "") 287 os.Setenv("OS_AUTH_URL", "")
292 test := configTests[0] 288 test := configTests[0]
293 test.err = "required environment variable not set for credentials attrib ute: URL" 289 test.err = "required environment variable not set for credentials attrib ute: URL"
294 test.check(c) 290 test.check(c)
295 } 291 }
OLDNEW
« no previous file with comments | « [revision details] ('k') | environs/openstack/local_test.go » ('j') | no next file with comments »

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