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

Delta Between Two Patch Sets: environs/maas/environ_test.go

Issue 12859043: Add an os-disk constraint
Left Patch Set: Add an os-disk constraint Created 11 years, 7 months ago
Right Patch Set: Add an os-disk constraint Created 11 years, 7 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/maas/environ.go ('k') | environs/openstack/image.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 maas 4 package maas
5 5
6 import ( 6 import (
7 "encoding/base64" 7 "encoding/base64"
8 "fmt" 8 "fmt"
9 "net/url" 9 "net/url"
10 10
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 func (*environSuite) TestConvertConstraints(c *gc.C) { 337 func (*environSuite) TestConvertConstraints(c *gc.C) {
338 var testValues = []struct { 338 var testValues = []struct {
339 constraints constraints.Value 339 constraints constraints.Value
340 expectedResult url.Values 340 expectedResult url.Values
341 }{ 341 }{
342 {constraints.Value{Arch: stringp("arm")}, url.Values{"arch": {"a rm"}}}, 342 {constraints.Value{Arch: stringp("arm")}, url.Values{"arch": {"a rm"}}},
343 {constraints.Value{CpuCores: uint64p(4)}, url.Values{"cpu_count" : {"4"}}}, 343 {constraints.Value{CpuCores: uint64p(4)}, url.Values{"cpu_count" : {"4"}}},
344 {constraints.Value{Mem: uint64p(1024)}, url.Values{"mem": {"1024 "}}}, 344 {constraints.Value{Mem: uint64p(1024)}, url.Values{"mem": {"1024 "}}},
345 // CpuPower is ignored. 345 // CpuPower is ignored.
346 {constraints.Value{CpuPower: uint64p(1024)}, url.Values{}}, 346 {constraints.Value{CpuPower: uint64p(1024)}, url.Values{}},
347 » » {constraints.Value{Arch: stringp("arm"), CpuCores: uint64p(4), M em: uint64p(1024), CpuPower: uint64p(1024)}, url.Values{"arch": {"arm"}, "cpu_co unt": {"4"}, "mem": {"1024"}}}, 347 » » // RootDisk is ignored.
348 » » {constraints.Value{RootDisk: uint64p(8192)}, url.Values{}},
349 » » {constraints.Value{Arch: stringp("arm"), CpuCores: uint64p(4), M em: uint64p(1024), CpuPower: uint64p(1024), RootDisk: uint64p(8192)}, url.Values {"arch": {"arm"}, "cpu_count": {"4"}, "mem": {"1024"}}},
348 } 350 }
349 for _, test := range testValues { 351 for _, test := range testValues {
350 c.Check(convertConstraints(test.constraints), gc.DeepEquals, tes t.expectedResult) 352 c.Check(convertConstraints(test.constraints), gc.DeepEquals, tes t.expectedResult)
351 } 353 }
352 } 354 }
353 355
354 func (suite *environSuite) getInstance(systemId string) *maasInstance { 356 func (suite *environSuite) getInstance(systemId string) *maasInstance {
355 input := `{"system_id": "` + systemId + `"}` 357 input := `{"system_id": "` + systemId + `"}`
356 node := suite.testMAASObject.TestServer.NewNode(input) 358 node := suite.testMAASObject.TestServer.NewNode(input)
357 return &maasInstance{&node, suite.environ} 359 return &maasInstance{&node, suite.environ}
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 464
463 func (suite *environSuite) TestBootstrapIntegratesWithEnvirons(c *gc.C) { 465 func (suite *environSuite) TestBootstrapIntegratesWithEnvirons(c *gc.C) {
464 suite.setupFakeTools(c) 466 suite.setupFakeTools(c)
465 env := suite.makeEnviron() 467 env := suite.makeEnviron()
466 suite.testMAASObject.TestServer.NewNode(`{"system_id": "bootstrapnode", "hostname": "host"}`) 468 suite.testMAASObject.TestServer.NewNode(`{"system_id": "bootstrapnode", "hostname": "host"}`)
467 469
468 // environs.Bootstrap calls Environ.Bootstrap. This works. 470 // environs.Bootstrap calls Environ.Bootstrap. This works.
469 err := environs.Bootstrap(env, constraints.Value{}) 471 err := environs.Bootstrap(env, constraints.Value{})
470 c.Assert(err, gc.IsNil) 472 c.Assert(err, gc.IsNil)
471 } 473 }
LEFTRIGHT

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