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

« back to all changes in this revision

Viewing changes to state/machine_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:
16
16
        "launchpad.net/juju-core/state/testing"
17
17
        coretesting "launchpad.net/juju-core/testing"
18
18
        jc "launchpad.net/juju-core/testing/checkers"
19
 
        "launchpad.net/juju-core/tools"
20
19
        "launchpad.net/juju-core/version"
21
20
)
22
21
 
429
428
        oldTools, _ := m0.AgentTools()
430
429
        m1, err := s.State.Machine(m0.Id())
431
430
        c.Assert(err, gc.IsNil)
432
 
        err = m0.SetAgentTools(&tools.Tools{
433
 
                URL:     "foo",
434
 
                Version: version.MustParseBinary("0.0.3-series-arch"),
435
 
                Size:    10,
436
 
                SHA256:  "1234",
437
 
        })
 
431
        err = m0.SetAgentVersion(version.MustParseBinary("0.0.3-series-arch"))
438
432
        c.Assert(err, gc.IsNil)
439
433
        newTools, _ := m0.AgentTools()
440
434
 
594
588
        wc.AssertOneChange()
595
589
 
596
590
        // Make two changes, check one event.
597
 
        err = machine.SetAgentTools(&tools.Tools{
598
 
                URL:     "foo",
599
 
                Version: version.MustParseBinary("0.0.3-series-arch"),
600
 
                Size:    10,
601
 
                SHA256:  "1234",
602
 
        })
 
591
        err = machine.SetAgentVersion(version.MustParseBinary("0.0.3-series-arch"))
603
592
        c.Assert(err, gc.IsNil)
604
593
        err = machine.Destroy()
605
594
        c.Assert(err, gc.IsNil)