~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/cmd/plugins/juju-metadata/toolsmetadata_test.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
        "github.com/juju/juju/cmd/modelcmd"
22
22
        "github.com/juju/juju/environs"
23
23
        "github.com/juju/juju/environs/config"
24
 
        "github.com/juju/juju/environs/configstore"
25
24
        "github.com/juju/juju/environs/tools"
26
25
        toolstesting "github.com/juju/juju/environs/tools/testing"
27
26
        "github.com/juju/juju/juju"
29
28
        "github.com/juju/juju/jujuclient/jujuclienttesting"
30
29
        "github.com/juju/juju/provider/dummy"
31
30
        coretesting "github.com/juju/juju/testing"
32
 
        "github.com/juju/juju/version"
 
31
        jujuversion "github.com/juju/juju/version"
33
32
)
34
33
 
35
34
type ToolsMetadataSuite struct {
47
46
                loggo.ResetLoggers()
48
47
        })
49
48
        cfg, err := config.New(config.UseDefaults, map[string]interface{}{
50
 
                "name":      "erewhemos",
51
 
                "type":      "dummy",
52
 
                "conroller": true,
 
49
                "name":            "erewhemos",
 
50
                "type":            "dummy",
 
51
                "uuid":            coretesting.ModelTag.Id(),
 
52
                "controller-uuid": coretesting.ModelTag.Id(),
 
53
                "conroller":       true,
53
54
        })
54
55
        c.Assert(err, jc.ErrorIsNil)
55
56
        env, err := environs.Prepare(
56
57
                modelcmd.BootstrapContextNoVerify(coretesting.Context(c)),
57
 
                configstore.NewMem(), jujuclienttesting.NewMemStore(), cfg.Name(),
58
 
                environs.PrepareForBootstrapParams{Config: cfg},
 
58
                jujuclienttesting.NewMemStore(),
 
59
                environs.PrepareParams{
 
60
                        ControllerName: cfg.Name(),
 
61
                        BaseConfig:     cfg.AllAttrs(),
 
62
                        CloudName:      "dummy",
 
63
                },
59
64
        )
60
65
        c.Assert(err, jc.ErrorIsNil)
61
66
        s.env = env
68
73
 
69
74
var currentVersionStrings = []string{
70
75
        // only these ones will make it into the JSON files.
71
 
        version.Current.String() + "-quantal-amd64",
72
 
        version.Current.String() + "-quantal-armhf",
73
 
        version.Current.String() + "-quantal-i386",
 
76
        jujuversion.Current.String() + "-quantal-amd64",
 
77
        jujuversion.Current.String() + "-quantal-armhf",
 
78
        jujuversion.Current.String() + "-quantal-i386",
74
79
}
75
80
 
76
81
var versionStrings = append([]string{
77
 
        fmt.Sprintf("%d.12.0-precise-amd64", version.Current.Major),
78
 
        fmt.Sprintf("%d.12.0-precise-i386", version.Current.Major),
79
 
        fmt.Sprintf("%d.12.0-raring-amd64", version.Current.Major),
80
 
        fmt.Sprintf("%d.12.0-raring-i386", version.Current.Major),
81
 
        fmt.Sprintf("%d.13.0-precise-amd64", version.Current.Major+1),
 
82
        fmt.Sprintf("%d.12.0-precise-amd64", jujuversion.Current.Major),
 
83
        fmt.Sprintf("%d.12.0-precise-i386", jujuversion.Current.Major),
 
84
        fmt.Sprintf("%d.12.0-raring-amd64", jujuversion.Current.Major),
 
85
        fmt.Sprintf("%d.12.0-raring-i386", jujuversion.Current.Major),
 
86
        fmt.Sprintf("%d.13.0-precise-amd64", jujuversion.Current.Major+1),
82
87
}, currentVersionStrings...)
83
88
 
84
89
var expectedOutputCommon = makeExpectedOutputCommon()
312
317
}
313
318
 
314
319
func (s *ToolsMetadataSuite) TestPatchLevels(c *gc.C) {
315
 
        currentVersion := version.Current
 
320
        currentVersion := jujuversion.Current
316
321
        currentVersion.Build = 0
317
322
        versionStrings := []string{
318
323
                currentVersion.String() + "-precise-amd64",