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

« back to all changes in this revision

Viewing changes to environs/testing/tools.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:
55
55
// the obtained tools may not have size and checksum set.
56
56
func CheckTools(c *gc.C, obtained, expected *coretools.Tools) {
57
57
        c.Assert(obtained.Version, gc.Equals, expected.Version)
58
 
        c.Assert(obtained.URL, gc.Equals, expected.URL)
59
 
        // TODO(wallyworld) - 2013-09-24 bug=1229512
60
 
        // When tools are located using the legacy code (prior to simplestreams),
61
 
        // the size and checksum information is not known.
 
58
        // TODO(dimitern) 2013-10-02 bug #1234217
 
59
        // Are these used at at all? If not we should drop them.
 
60
        if obtained.URL != "" {
 
61
                c.Assert(obtained.URL, gc.Equals, expected.URL)
 
62
        }
62
63
        if obtained.Size > 0 {
63
64
                c.Assert(obtained.Size, gc.Equals, expected.Size)
64
65
                c.Assert(obtained.SHA256, gc.Equals, expected.SHA256)
68
69
// CheckUpgraderReadyError ensures the obtained and expected errors are equal, allowing for the fact that
69
70
// the error's tools attributes may not have size and checksum set.
70
71
func CheckUpgraderReadyError(c *gc.C, obtained error, expected *upgrader.UpgradeReadyError) {
71
 
        // TODO(wallyworld) - 2013-09-24 bug=1229512
72
 
        // When tools are located using the legacy code (prior to simplestreams),
73
 
        // the size and checksum information is not known.
74
72
        c.Assert(obtained, gc.FitsTypeOf, &upgrader.UpgradeReadyError{})
75
73
        err := obtained.(*upgrader.UpgradeReadyError)
76
74
        c.Assert(err.AgentName, gc.Equals, expected.AgentName)