Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1619)

Delta Between Two Patch Sets: environs/instances/image_test.go

Issue 9738043: cmd/jujud: do not change password
Left Patch Set: cmd/jujud: do not change password Created 11 years, 10 months ago
Right Patch Set: cmd/jujud: do not change password Created 11 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « environs/instances/image.go ('k') | environs/interface.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2013 Canonical Ltd. 1 // Copyright 2013 Canonical Ltd.
2 // Licensed under the AGPLv3, see LICENCE file for details. 2 // Licensed under the AGPLv3, see LICENCE file for details.
3 3
4 package instances 4 package instances
5 5
6 import ( 6 import (
7 . "launchpad.net/gocheck" 7 . "launchpad.net/gocheck"
8 "launchpad.net/juju-core/constraints" 8 "launchpad.net/juju-core/constraints"
9 "launchpad.net/juju-core/environs/imagemetadata" 9 "launchpad.net/juju-core/environs/imagemetadata"
10 coretesting "launchpad.net/juju-core/testing" 10 coretesting "launchpad.net/juju-core/testing"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 var pv = "pv" 156 var pv = "pv"
157 var findInstanceSpecTests = []instanceSpecTestParams{ 157 var findInstanceSpecTests = []instanceSpecTestParams{
158 { 158 {
159 desc: "image exists in metadata", 159 desc: "image exists in metadata",
160 region: "test", 160 region: "test",
161 imageId: "ami-00000033", 161 imageId: "ami-00000033",
162 instanceTypes: []InstanceType{ 162 instanceTypes: []InstanceType{
163 {Id: "1", Name: "it-1", Arches: []string{"amd64"}, VType : &pv, Mem: 512}, 163 {Id: "1", Name: "it-1", Arches: []string{"amd64"}, VType : &pv, Mem: 512},
164 }, 164 },
165 instanceTypeId: "1",
166 instanceTypeName: "it-1",
167 }, 165 },
168 { 166 {
169 desc: "multiple images exists in metadata, use most recent", 167 desc: "multiple images exists in metadata, use most recent",
170 region: "test", 168 region: "test",
171 imageId: "ami-00000035", 169 imageId: "ami-00000035",
172 instanceTypes: []InstanceType{ 170 instanceTypes: []InstanceType{
173 » » » {Id: "1", Name: "it-1", Arches: []string{"amd64"}, VType : &hvm, Mem: 512}, 171 » » » {Id: "1", Name: "it-1", Arches: []string{"amd64"}, VType : &hvm, Mem: 512, CpuCores: 2},
174 }, 172 },
175 instanceTypeId: "1",
176 instanceTypeName: "it-1",
177 }, 173 },
178 { 174 {
179 desc: "no image exists in metadata", 175 desc: "no image exists in metadata",
180 region: "invalid-region", 176 region: "invalid-region",
181 err: `no "precise" images in invalid-region with arches \[amd 64 arm\]`, 177 err: `no "precise" images in invalid-region with arches \[amd 64 arm\]`,
182 }, 178 },
183 { 179 {
184 desc: "no valid instance types", 180 desc: "no valid instance types",
185 region: "test", 181 region: "test",
186 instanceTypes: []InstanceType{}, 182 instanceTypes: []InstanceType{},
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 Constraints: constraints.MustParse(t.constraints), 217 Constraints: constraints.MustParse(t.constraints),
222 }, t.instanceTypes) 218 }, t.instanceTypes)
223 if t.err != "" { 219 if t.err != "" {
224 c.Check(err, ErrorMatches, t.err) 220 c.Check(err, ErrorMatches, t.err)
225 continue 221 continue
226 } 222 }
227 if !c.Check(err, IsNil) { 223 if !c.Check(err, IsNil) {
228 continue 224 continue
229 } 225 }
230 c.Check(spec.Image.Id, Equals, t.imageId) 226 c.Check(spec.Image.Id, Equals, t.imageId)
231 » » c.Check(spec.InstanceTypeId, Equals, t.instanceTypeId) 227 » » if len(t.instanceTypes) == 1 {
232 » » c.Check(spec.InstanceTypeName, Equals, t.instanceTypeName) 228 » » » c.Check(spec.InstanceType, DeepEquals, t.instanceTypes[0 ])
229 » » }
233 } 230 }
234 } 231 }
235 232
236 var imageMatchtests = []struct { 233 var imageMatchtests = []struct {
237 image Image 234 image Image
238 itype InstanceType 235 itype InstanceType
239 match bool 236 match bool
240 }{ 237 }{
241 { 238 {
242 image: Image{Arch: "amd64"}, 239 image: Image{Arch: "amd64"},
(...skipping 19 matching lines...) Expand all
262 itype: InstanceType{Arches: []string{"amd64"}, VType: &hvm}, 259 itype: InstanceType{Arches: []string{"amd64"}, VType: &hvm},
263 }, 260 },
264 } 261 }
265 262
266 func (s *imageSuite) TestImageMatch(c *C) { 263 func (s *imageSuite) TestImageMatch(c *C) {
267 for i, t := range imageMatchtests { 264 for i, t := range imageMatchtests {
268 c.Logf("test %d", i) 265 c.Logf("test %d", i)
269 c.Check(t.image.match(t.itype), Equals, t.match) 266 c.Check(t.image.match(t.itype), Equals, t.match)
270 } 267 }
271 } 268 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b