~juju-qa/ubuntu/yakkety/juju/juju-1.25.8

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/container/kvm/libvert_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-12-02 17:28:37 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161202172837-jkrbdlyjcxtrii2n
Initial commit of 1.25.6

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 kvm_test
 
5
 
 
6
import (
 
7
        "fmt"
 
8
        "runtime"
 
9
        "strings"
 
10
 
 
11
        "github.com/juju/testing"
 
12
        jc "github.com/juju/testing/checkers"
 
13
        gc "gopkg.in/check.v1"
 
14
 
 
15
        "github.com/juju/juju/container/kvm"
 
16
        coretesting "github.com/juju/juju/testing"
 
17
)
 
18
 
 
19
type LibVertSuite struct {
 
20
        coretesting.BaseSuite
 
21
        ContainerDir string
 
22
        RemovedDir   string
 
23
}
 
24
 
 
25
var _ = gc.Suite(&LibVertSuite{})
 
26
 
 
27
func (s *LibVertSuite) SetUpTest(c *gc.C) {
 
28
        s.BaseSuite.SetUpTest(c)
 
29
        // Skip if not linux
 
30
        if runtime.GOOS != "linux" {
 
31
                c.Skip("not running linux")
 
32
        }
 
33
}
 
34
 
 
35
// Test that the call to SyncImages utilizes the defined source
 
36
func (s *LibVertSuite) TestSyncImagesUtilizesSimpleStreamsSource(c *gc.C) {
 
37
 
 
38
        const simpStreamsBinName = "uvt-simplestreams-libvirt"
 
39
        testing.PatchExecutableAsEchoArgs(c, s, simpStreamsBinName)
 
40
 
 
41
        const (
 
42
                series = "mocked-series"
 
43
                arch   = "mocked-arch"
 
44
                source = "mocked-url"
 
45
        )
 
46
        err := kvm.SyncImages(series, arch, source)
 
47
        c.Assert(err, jc.ErrorIsNil)
 
48
 
 
49
        expectedArgs := strings.Split(
 
50
                fmt.Sprintf(
 
51
                        "sync arch=%s release=%s --source=%s",
 
52
                        arch,
 
53
                        series,
 
54
                        source,
 
55
                ),
 
56
                " ",
 
57
        )
 
58
 
 
59
        testing.AssertEchoArgs(c, simpStreamsBinName, expectedArgs...)
 
60
}