~themue/juju-core/049-prepare-ec2

« back to all changes in this revision

Viewing changes to environs/jujutest/tests.go

  • Committer: Tarmac
  • Author(s): Roger Peppe, John Arbash Meinel
  • Date: 2013-10-02 12:38:13 UTC
  • mfrom: (1717.1.42 375-dummy-prepare-state-id)
  • Revision ID: tarmac-20131002123813-3tidl1lj00d3a29c
[r=rogpeppe] environs/dummy: add state-id

This makes the dummy provider more like the other
providers in that the Environ does not refer
directly to the bootstrapped state, but is looked
up when operations are performed on it.

This is also a test case for adding attributes at Prepare
time - many tests needed changing to correctly
deal with this.

https://codereview.appspot.com/14207046/

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
 
47
47
// Open opens an instance of the testing environment.
48
48
func (t *Tests) Open(c *gc.C) environs.Environ {
49
 
        e, err := environs.NewFromAttrs(t.TestConfig)
50
 
        c.Assert(err, gc.IsNil, gc.Commentf("opening environ %#v", t.TestConfig))
 
49
        info, err := t.ConfigStore.ReadInfo(t.TestConfig["name"].(string))
 
50
        c.Assert(err, gc.IsNil)
 
51
        cfg, err := config.New(config.NoDefaults, info.BootstrapConfig())
 
52
        c.Assert(err, gc.IsNil)
 
53
        e, err := environs.New(cfg)
 
54
        c.Assert(err, gc.IsNil, gc.Commentf("opening environ %#v", cfg.AllAttrs()))
51
55
        c.Assert(e, gc.NotNil)
52
56
        return e
53
57
}