~go-bot/juju-core/trunk

« back to all changes in this revision

Viewing changes to provider/local/lxc_test.go

[r=wallyworld],[bug=1318485] Use lxc clone by default

All providers now support configuring lxc
clone support, not just local provider. The
config attributes which previously were just
for local provider now are available on all
providers:
lxc-clone
lxc-clone-aufs

lxc-clone, if unspecified, will be set to
true if the underlying platform supports it.
The test is for Ubuntu trusty or greater. The
final check is done when the container manager
is created.

1.19.2 used a setting lxc-use-clone. This is now
removed in place of the universal lxc-clone setting.

https://codereview.appspot.com/94410043/

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright 2014 Canonical Ltd.
2
 
// Licensed under the AGPLv3, see LICENCE file for details.
3
 
 
4
 
package local_test
5
 
 
6
 
import (
7
 
        jc "github.com/juju/testing/checkers"
8
 
        gc "launchpad.net/gocheck"
9
 
 
10
 
        "launchpad.net/juju-core/instance"
11
 
        "launchpad.net/juju-core/provider/local"
12
 
        "launchpad.net/juju-core/testing/testbase"
13
 
)
14
 
 
15
 
type lxcTest struct {
16
 
        testbase.LoggingSuite
17
 
}
18
 
 
19
 
var _ = gc.Suite(&lxcTest{})
20
 
 
21
 
func (*lxcTest) TestUseFastLXCForContainer(c *gc.C) {
22
 
        c.Assert(local.UseFastLXC(instance.ContainerType("")), jc.IsFalse)
23
 
        c.Assert(local.UseFastLXC(instance.KVM), jc.IsFalse)
24
 
}
25
 
 
26
 
func (t *lxcTest) TestUseFastLXC(c *gc.C) {
27
 
        for i, test := range []struct {
28
 
                message        string
29
 
                releaseVersion string
30
 
                expected       bool
31
 
        }{{
32
 
                message: "missing release file",
33
 
        }, {
34
 
                message:        "precise release",
35
 
                releaseVersion: "12.04",
36
 
        }, {
37
 
                message:        "trusty release",
38
 
                releaseVersion: "14.04",
39
 
                expected:       true,
40
 
        }, {
41
 
                message:        "unstable unicorn",
42
 
                releaseVersion: "14.10",
43
 
                expected:       true,
44
 
        }, {
45
 
                message:        "jaunty",
46
 
                releaseVersion: "9.10",
47
 
        }} {
48
 
                c.Logf("%v: %v", i, test.message)
49
 
                t.PatchValue(local.ReleaseVersion, func() string { return test.releaseVersion })
50
 
                value := local.UseFastLXC(instance.LXC)
51
 
                c.Assert(value, gc.Equals, test.expected)
52
 
        }
53
 
}