~ubuntu-branches/ubuntu/trusty/juju-core/trusty

« back to all changes in this revision

Viewing changes to src/launchpad.net/juju-core/worker/environ_test.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-03-24 16:05:44 UTC
  • mfrom: (1.1.20)
  • Revision ID: package-import@ubuntu.com-20140324160544-g8lsfufby18d5fj4
Tags: 1.17.6-0ubuntu1
* New upstream point release, including fixes for:
  - br0 not bought up by cloud-init with MAAS provider (LP: #1271144).
  - ppc64el enablement for juju/lxc (LP: #1273769).
  - juju userdata should not restart networking (LP: #1248283).
  - error detecting hardware characteristics (LP: #1276909).
  - juju instances not including the default security group (LP: #1129720).
  - juju bootstrap does not honor https_proxy (LP: #1240260).
* d/control,rules: Drop BD on bash-completion, install bash-completion
  direct from upstream source code.
* d/rules: Set HOME prior to generating man pages.
* d/control: Drop alternative dependency on mongodb-server; juju now only
  works on trusty with juju-mongodb.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
}
47
47
 
48
48
func (s *waitForEnvironSuite) TestInvalidConfig(c *gc.C) {
 
49
        var oldType string
 
50
        oldType = s.Conn.Environ.Config().AllAttrs()["type"].(string)
 
51
 
49
52
        // Create an invalid config by taking the current config and
50
53
        // tweaking the provider type.
51
 
        var oldType string
52
 
        testing.ChangeEnvironConfig(c, s.State, func(attrs coretesting.Attrs) coretesting.Attrs {
53
 
                oldType = attrs["type"].(string)
54
 
                return attrs.Merge(coretesting.Attrs{"type": "unknown"})
55
 
        })
56
 
        w := s.State.WatchForEnvironConfigChanges()
 
54
        info := s.StateInfo(c)
 
55
        opts := state.DefaultDialOpts()
 
56
        st2, err := state.Open(info, opts, state.Policy(nil))
 
57
        c.Assert(err, gc.IsNil)
 
58
        defer st2.Close()
 
59
        err = st2.UpdateEnvironConfig(map[string]interface{}{"type": "unknown"}, nil, nil)
 
60
        c.Assert(err, gc.IsNil)
 
61
 
 
62
        w := st2.WatchForEnvironConfigChanges()
57
63
        defer stopWatcher(c, w)
58
64
        done := make(chan environs.Environ)
59
65
        go func() {
60
 
                env, err := worker.WaitForEnviron(w, s.State, nil)
 
66
                env, err := worker.WaitForEnviron(w, st2, nil)
61
67
                c.Check(err, gc.IsNil)
62
68
                done <- env
63
69
        }()
64
70
        // Wait for the loop to process the invalid configuratrion
65
71
        <-worker.LoadedInvalid
66
72
 
67
 
        testing.ChangeEnvironConfig(c, s.State, func(attrs coretesting.Attrs) coretesting.Attrs {
68
 
                return attrs.Merge(coretesting.Attrs{
69
 
                        "type":   oldType,
70
 
                        "secret": "environ_test",
71
 
                })
72
 
        })
 
73
        st2.UpdateEnvironConfig(map[string]interface{}{
 
74
                "type":   oldType,
 
75
                "secret": "environ_test",
 
76
        }, nil, nil)
73
77
 
74
78
        env := <-done
75
79
        c.Assert(env, gc.NotNil)