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

Side by Side Diff: juju/conn_test.go

Issue 10083047: state: Service ConfigSettings methods
Patch Set: state: Service ConfigSettings methods Created 10 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:
View unified diff | Download patch
« no previous file with comments | « juju/conn.go ('k') | state/api/client.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012, 2013 Canonical Ltd. 1 // Copyright 2012, 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 juju_test 4 package juju_test
5 5
6 import ( 6 import (
7 "io/ioutil" 7 "io/ioutil"
8 . "launchpad.net/gocheck" 8 . "launchpad.net/gocheck"
9 "launchpad.net/juju-core/charm" 9 "launchpad.net/juju-core/charm"
10 "launchpad.net/juju-core/constraints" 10 "launchpad.net/juju-core/constraints"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 s.repo = &charm.LocalRepository{Path: repoPath} 419 s.repo = &charm.LocalRepository{Path: repoPath}
420 s.seriesPath = filepath.Join(repoPath, s.defaultSeries) 420 s.seriesPath = filepath.Join(repoPath, s.defaultSeries)
421 err := os.Mkdir(s.seriesPath, 0777) 421 err := os.Mkdir(s.seriesPath, 0777)
422 c.Assert(err, IsNil) 422 c.Assert(err, IsNil)
423 coretesting.Charms.BundlePath(s.seriesPath, "wordpress") 423 coretesting.Charms.BundlePath(s.seriesPath, "wordpress")
424 s.charmUrl, err = charm.InferURL("local:wordpress", s.defaultSeries) 424 s.charmUrl, err = charm.InferURL("local:wordpress", s.defaultSeries)
425 c.Assert(err, IsNil) 425 c.Assert(err, IsNil)
426 } 426 }
427 427
428 func (s *DeployLocalSuite) TestDeploy(c *C) { 428 func (s *DeployLocalSuite) TestDeploy(c *C) {
429 » charm, err := s.Conn.PutCharm(s.charmUrl, s.repo, false) 429 » ch, err := s.Conn.PutCharm(s.charmUrl, s.repo, false)
430 c.Assert(err, IsNil) 430 c.Assert(err, IsNil)
431 cons := constraints.MustParse("mem=4G") 431 cons := constraints.MustParse("mem=4G")
432 args := juju.DeployServiceParams{ 432 args := juju.DeployServiceParams{
433 ServiceName: "bob", 433 ServiceName: "bob",
434 » » Charm: charm, 434 » » Charm: ch,
435 NumUnits: 3, 435 NumUnits: 3,
436 Constraints: cons, 436 Constraints: cons,
437 ConfigYAML: "bob: {blog-title: aspidistra flagpole}", 437 ConfigYAML: "bob: {blog-title: aspidistra flagpole}",
438 } 438 }
439 svc, err := s.Conn.DeployService(args) 439 svc, err := s.Conn.DeployService(args)
440 c.Assert(err, IsNil) 440 c.Assert(err, IsNil)
441 scons, err := svc.Constraints() 441 scons, err := svc.Constraints()
442 c.Assert(err, IsNil) 442 c.Assert(err, IsNil)
443 c.Assert(scons, DeepEquals, cons) 443 c.Assert(scons, DeepEquals, cons)
444 » config, err := svc.Config() 444 » settings, err := svc.ConfigSettings()
445 c.Assert(err, IsNil) 445 c.Assert(err, IsNil)
446 » c.Assert(config.Map(), DeepEquals, map[string]interface{}{ 446 » c.Assert(settings, DeepEquals, charm.Settings{
447 "blog-title": "aspidistra flagpole", 447 "blog-title": "aspidistra flagpole",
448 }) 448 })
449 449
450 units, err := svc.AllUnits() 450 units, err := svc.AllUnits()
451 c.Assert(err, IsNil) 451 c.Assert(err, IsNil)
452 c.Assert(len(units), Equals, 3) 452 c.Assert(len(units), Equals, 3)
453 for _, unit := range units { 453 for _, unit := range units {
454 mid, err := unit.AssignedMachineId() 454 mid, err := unit.AssignedMachineId()
455 c.Assert(err, IsNil) 455 c.Assert(err, IsNil)
456 machine, err := s.State.Machine(mid) 456 machine, err := s.State.Machine(mid)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 c.Assert(err, ErrorMatches, "cannot determine juju home.*") 500 c.Assert(err, ErrorMatches, "cannot determine juju home.*")
501 } 501 }
502 502
503 func (s *InitJujuHomeSuite) TestCacheDir(c *C) { 503 func (s *InitJujuHomeSuite) TestCacheDir(c *C) {
504 os.Setenv("JUJU_HOME", "/foo/bar") 504 os.Setenv("JUJU_HOME", "/foo/bar")
505 c.Assert(charm.CacheDir, Equals, "") 505 c.Assert(charm.CacheDir, Equals, "")
506 err := juju.InitJujuHome() 506 err := juju.InitJujuHome()
507 c.Assert(err, IsNil) 507 c.Assert(err, IsNil)
508 c.Assert(charm.CacheDir, Equals, "/foo/bar/charmcache") 508 c.Assert(charm.CacheDir, Equals, "/foo/bar/charmcache")
509 } 509 }
OLDNEW
« no previous file with comments | « juju/conn.go ('k') | state/api/client.go » ('j') | no next file with comments »

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