~ubuntu-cloud-archive/ubuntu/precise/juju-core/precise-ctools

« back to all changes in this revision

Viewing changes to src/launchpad.net/juju-core/worker/localstorage/config_test.go

  • Committer: Scott Moser
  • Date: 2014-02-26 16:17:47 UTC
  • mfrom: (24.1.5 trusty-proposed)
  • Revision ID: smoser@ubuntu.com-20140226161747-dk6h7wp288370ave
* New upstream point release (LP: #1271941, #834930, #1240667, #1274210):
  - https://launchpad.net/juju-core/trunk/1.17.3
* No change rebuild with gccgo-4.9 as default gccgo. 
* d/control,rules,juju-core.{postinst,prerm}.in: Drop build of gccgo built
  binaries for architectures supported by golang gc.
* d/juju-core.postinst.in: Drop --force option when installing alternatives.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
}
22
22
 
23
23
type localStorageConfig struct {
24
 
        storageDir        string
25
 
        storageAddr       string
26
 
        sharedStorageDir  string
27
 
        sharedStorageAddr string
 
24
        storageDir  string
 
25
        storageAddr string
28
26
}
29
27
 
30
28
func (c *localStorageConfig) StorageDir() string {
35
33
        return c.storageAddr
36
34
}
37
35
 
38
 
func (c *localStorageConfig) SharedStorageDir() string {
39
 
        return c.sharedStorageDir
40
 
}
41
 
 
42
 
func (c *localStorageConfig) SharedStorageAddr() string {
43
 
        return c.sharedStorageAddr
44
 
}
45
 
 
46
36
type localTLSStorageConfig struct {
47
37
        localStorageConfig
48
38
        caCertPEM []byte
72
62
        m, err := localstorage.StoreConfig(&config)
73
63
        c.Assert(err, gc.IsNil)
74
64
        c.Assert(m, gc.DeepEquals, map[string]string{
75
 
                localstorage.StorageDir:        "",
76
 
                localstorage.StorageAddr:       "",
77
 
                localstorage.SharedStorageDir:  "",
78
 
                localstorage.SharedStorageAddr: "",
 
65
                localstorage.StorageDir:  "",
 
66
                localstorage.StorageAddr: "",
79
67
        })
80
68
 
81
69
        config.storageDir = "a"
82
70
        config.storageAddr = "b"
83
 
        config.sharedStorageDir = "c"
84
 
        config.sharedStorageAddr = "d"
85
71
        m, err = localstorage.StoreConfig(&config)
86
72
        c.Assert(err, gc.IsNil)
87
73
        c.Assert(m, gc.DeepEquals, map[string]string{
88
 
                localstorage.StorageDir:        config.storageDir,
89
 
                localstorage.StorageAddr:       config.storageAddr,
90
 
                localstorage.SharedStorageDir:  config.sharedStorageDir,
91
 
                localstorage.SharedStorageAddr: config.sharedStorageAddr,
 
74
                localstorage.StorageDir:  config.storageDir,
 
75
                localstorage.StorageAddr: config.storageAddr,
92
76
        })
93
77
}
94
78
 
97
81
        m, err := localstorage.StoreConfig(&config)
98
82
        c.Assert(err, gc.IsNil)
99
83
        c.Assert(m, gc.DeepEquals, map[string]string{
100
 
                localstorage.StorageDir:        "",
101
 
                localstorage.StorageAddr:       "",
102
 
                localstorage.SharedStorageDir:  "",
103
 
                localstorage.SharedStorageAddr: "",
 
84
                localstorage.StorageDir:  "",
 
85
                localstorage.StorageAddr: "",
104
86
        })
105
87
 
106
88
        config.storageDir = "a"
107
89
        config.storageAddr = "b"
108
 
        config.sharedStorageDir = "c"
109
 
        config.sharedStorageAddr = "d"
110
90
        config.caCertPEM = []byte("heyhey")
111
91
        config.caKeyPEM = []byte("hoho")
112
92
        config.hostnames = []string{"easy", "as", "1.2.3"}
114
94
        m, err = localstorage.StoreConfig(&config)
115
95
        c.Assert(err, gc.IsNil)
116
96
        c.Assert(m, gc.DeepEquals, map[string]string{
117
 
                localstorage.StorageDir:        config.storageDir,
118
 
                localstorage.StorageAddr:       config.storageAddr,
119
 
                localstorage.SharedStorageDir:  config.sharedStorageDir,
120
 
                localstorage.SharedStorageAddr: config.sharedStorageAddr,
121
 
                localstorage.StorageCACert:     string(config.caCertPEM),
122
 
                localstorage.StorageCAKey:      string(config.caKeyPEM),
123
 
                localstorage.StorageHostnames:  mustMarshalYAML(c, config.hostnames),
124
 
                localstorage.StorageAuthKey:    config.authkey,
 
97
                localstorage.StorageDir:       config.storageDir,
 
98
                localstorage.StorageAddr:      config.storageAddr,
 
99
                localstorage.StorageCACert:    string(config.caCertPEM),
 
100
                localstorage.StorageCAKey:     string(config.caKeyPEM),
 
101
                localstorage.StorageHostnames: mustMarshalYAML(c, config.hostnames),
 
102
                localstorage.StorageAuthKey:   config.authkey,
125
103
        })
126
104
}
127
105