~wallyworld/juju-core/fast-lxc-everywhere

« back to all changes in this revision

Viewing changes to provider/maas/environ_test.go

  • Committer: Tarmac
  • Author(s): Ian Booth
  • Date: 2014-04-24 12:33:19 UTC
  • mfrom: (2664.1.4 constraints-vocab)
  • Revision ID: tarmac-20140424123319-iifvboa1kjuprj7l
[r=wallyworld] Support constraints vocabs

Add support to constraints validation for
vocabs for each attribute. eg arch and
instance-type can only have well defined
values for each provider. The vocab check
is part of constraints validation.

https://codereview.appspot.com/96730043/

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
        gc "launchpad.net/gocheck"
11
11
        "launchpad.net/gomaasapi"
12
12
 
13
 
        "launchpad.net/juju-core/constraints"
14
13
        "launchpad.net/juju-core/environs/config"
15
14
        "launchpad.net/juju-core/environs/network"
16
15
        envtesting "launchpad.net/juju-core/environs/testing"
244
243
                "ifup eth3.123",
245
244
        })
246
245
}
247
 
 
248
 
func (s *environSuite) TestConstraintsValidator(c *gc.C) {
249
 
        cfg := getSimpleTestConfig(c, nil)
250
 
        env, err := maas.NewEnviron(cfg)
251
 
        c.Assert(err, gc.IsNil)
252
 
        validator := env.ConstraintsValidator()
253
 
        cons := constraints.MustParse("arch=amd64 cpu-power=10 instance-type=foo")
254
 
        unsupported, err := validator.Validate(cons)
255
 
        c.Assert(err, gc.IsNil)
256
 
        c.Assert(unsupported, gc.DeepEquals, []string{"cpu-power", "instance-type"})
257
 
}