~rogpeppe/juju-core/438-local-instance-Addresses

« back to all changes in this revision

Viewing changes to worker/provisioner/lxc-broker_test.go

[r=fwereade],[bug=1234035] Fix upgrade 1.14 -> 1.15

This adds a Tools() API call to provisioner API,
similarly to the upgrader API. Common code factored
out into apiserver/common/tools.go.

SetAgentTools() renamed to SetAgentVersion() in
machine and unit state types. Also renamed a few
types in params to be shorter or better reflect
what are they about. Added DEPRECATE(v1.18) tags
to bits of the API that need cleanup.

Live tested on EC2 - after copying the tools from
/tools/releases/ to /tools/ the upgrade proceeds
and finishes successfully.

https://codereview.appspot.com/14231044/

R=fwereade, jameinel

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
package provisioner_test
5
5
 
6
6
import (
7
 
        "encoding/json"
8
7
        "fmt"
9
8
        "io/ioutil"
10
 
        "os"
11
9
        "path/filepath"
12
10
        "time"
13
11
 
14
12
        gc "launchpad.net/gocheck"
15
13
 
16
14
        "launchpad.net/juju-core/agent"
17
 
        agenttools "launchpad.net/juju-core/agent/tools"
18
15
        "launchpad.net/juju-core/constraints"
19
16
        "launchpad.net/juju-core/container/lxc"
20
17
        "launchpad.net/juju-core/container/lxc/mock"
184
181
func (s *lxcProvisionerSuite) SetUpTest(c *gc.C) {
185
182
        s.CommonProvisionerSuite.SetUpTest(c)
186
183
        s.lxcSuite.SetUpTest(c)
187
 
        // Write the tools file.
188
 
        toolsDir := agenttools.SharedToolsDir(s.DataDir(), version.Current)
189
 
        c.Assert(os.MkdirAll(toolsDir, 0755), gc.IsNil)
190
 
        toolsPath := filepath.Join(toolsDir, "downloaded-tools.txt")
191
 
        testTools := coretools.Tools{Version: version.Current, URL: "http://testing.invalid/tools"}
192
 
        data, err := json.Marshal(testTools)
193
 
        c.Assert(err, gc.IsNil)
194
 
        err = ioutil.WriteFile(toolsPath, data, 0644)
195
 
        c.Assert(err, gc.IsNil)
196
184
 
197
185
        // The lxc provisioner actually needs the machine it is being created on
198
186
        // to be in state, in order to get the watcher.
200
188
        c.Assert(err, gc.IsNil)
201
189
        s.parentMachineId = m.Id()
202
190
        s.APILogin(c, m)
 
191
        err = m.SetAgentVersion(version.Current)
 
192
        c.Assert(err, gc.IsNil)
203
193
 
204
194
        s.events = make(chan mock.Event, 25)
205
195
        s.Factory.AddListener(s.events)