~rogpeppe/juju-core/041-config-agent-version

« back to all changes in this revision

Viewing changes to environs/cloudinit/cloudinit_test.go

  • Committer: Roger Peppe
  • Date: 2012-08-30 12:25:49 UTC
  • mfrom: (443.1.7 juju-core)
  • Revision ID: roger.peppe@canonical.com-20120830122549-jmn0ledsyj1uxhd2
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
                Provisioner:        true,
29
29
                AuthorizedKeys:     "sshkey1",
30
30
                Tools:              newSimpleTools("1.2.3-linux-amd64"),
31
 
                ZooKeeper:          true,
 
31
                StateServer:        true,
32
32
                Config:             map[string]interface{}{"name": "foo", "zookeeper": true},
33
33
        },
34
34
        {
36
36
                ProviderType:   "ec2",
37
37
                Provisioner:    false,
38
38
                AuthorizedKeys: "sshkey1",
39
 
                ZooKeeper:      false,
 
39
                StateServer:    false,
40
40
                Tools:          newSimpleTools("1.2.3-linux-amd64"),
41
41
                StateInfo:      &state.Info{Addrs: []string{"zk1"}},
42
42
        },
62
62
        t.checkScripts(c, "mkdir -p "+environs.VarDir)
63
63
        t.checkScripts(c, "wget.*"+regexp.QuoteMeta(t.cfg.Tools.URL)+".*tar .*xz")
64
64
 
65
 
        if t.cfg.ZooKeeper {
 
65
        if t.cfg.StateServer {
 
66
                // TODO(dfc) remove this after the switch to mstate
66
67
                t.checkPackage(c, "zookeeperd")
 
68
 
 
69
                t.checkPackage(c, "mongodb-server")
67
70
                t.checkScripts(c, "jujud bootstrap-state")
68
71
                t.checkEnvConfig(c)
69
72
                t.checkScripts(c, regexp.QuoteMeta(t.cfg.InstanceIdAccessor))
78
81
                t.checkScripts(c, "jujud provisioning --zookeeper-servers 'localhost"+cloudinit.ZkPortSuffix+"'")
79
82
        }
80
83
 
81
 
        if t.cfg.ZooKeeper {
 
84
        if t.cfg.StateServer {
82
85
                t.checkScripts(c, "jujud machine --zookeeper-servers 'localhost"+cloudinit.ZkPortSuffix+"' .* --machine-id [0-9]+")
83
86
        } else {
84
87
                t.checkScripts(c, "jujud machine --zookeeper-servers '"+strings.Join(t.cfg.StateInfo.Addrs, ",")+"' .* --machine-id [0-9]+")
214
217
        {"negative machine id", func(cfg *cloudinit.MachineConfig) { cfg.MachineId = -1 }},
215
218
        {"missing provider type", func(cfg *cloudinit.MachineConfig) { cfg.ProviderType = "" }},
216
219
        {"missing instance id accessor", func(cfg *cloudinit.MachineConfig) {
217
 
                cfg.ZooKeeper = true
 
220
                cfg.StateServer = true
218
221
                cfg.InstanceIdAccessor = ""
219
222
        }},
220
223
        {"missing zookeeper hosts", func(cfg *cloudinit.MachineConfig) {
221
 
                cfg.ZooKeeper = false
 
224
                cfg.StateServer = false
222
225
                cfg.StateInfo = nil
223
226
        }},
224
227
        {"missing zookeeper hosts", func(cfg *cloudinit.MachineConfig) {
225
 
                cfg.ZooKeeper = false
 
228
                cfg.StateServer = false
226
229
                cfg.StateInfo = &state.Info{}
227
230
        }},
228
231
        {"missing tools", func(cfg *cloudinit.MachineConfig) {
240
243
func (cloudinitSuite) TestCloudInitVerify(c *C) {
241
244
        cfg := &cloudinit.MachineConfig{
242
245
                Provisioner:        true,
243
 
                ZooKeeper:          true,
 
246
                StateServer:        true,
244
247
                InstanceIdAccessor: "$instance_id",
245
248
                ProviderType:       "ec2",
246
249
                MachineId:          99,