~rogpeppe/juju-core/azure

« back to all changes in this revision

Viewing changes to constraints/constraints_test.go

[r=wallyworld] New assignment policy is AssignCleanEmpty

Add container support to AssignClean(Empty) policies and make
the default policy AssignCleanEmpty. This allows manual deployment
of charms into existing clean and empty containers/instances, with
the fallback that a new container/instance is created if none are
available. The system behaves the same as previously if a simple
bootstrap and deploy is performed, but if add-machine is used to
create some containers/instances, then those are no longer ignored.

https://codereview.appspot.com/11019044/

Show diffs side-by-side

added added

removed removed

Lines of Context:
401
401
                c.Assert(initial.WithFallbacks(fallbacks), DeepEquals, final)
402
402
        }
403
403
}
 
404
 
 
405
var hasContainerTests = []struct {
 
406
        constraints  string
 
407
        hasContainer bool
 
408
}{
 
409
        {
 
410
                hasContainer: false,
 
411
        }, {
 
412
                constraints:  "container=lxc",
 
413
                hasContainer: true,
 
414
        }, {
 
415
                constraints:  "container=none",
 
416
                hasContainer: false,
 
417
        },
 
418
}
 
419
 
 
420
func (s *ConstraintsSuite) TestHasContainer(c *C) {
 
421
        for i, t := range hasContainerTests {
 
422
                c.Logf("test %d", i)
 
423
                cons := constraints.MustParse(t.constraints)
 
424
                c.Assert(cons.HasContainer(), Equals, t.hasContainer)
 
425
        }
 
426
}