LEFT | RIGHT |
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 "fmt" | 7 "fmt" |
8 "io/ioutil" | 8 "io/ioutil" |
9 "os" | 9 "os" |
10 "path/filepath" | 10 "path/filepath" |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 id3, err := units[0].AssignedMachineId() | 406 id3, err := units[0].AssignedMachineId() |
407 c.Assert(id3, gc.Equals, id0+"/lxc/0") | 407 c.Assert(id3, gc.Equals, id0+"/lxc/0") |
408 | 408 |
409 units, err = s.conn.AddUnits(svc, 1, "lxc:"+id3) | 409 units, err = s.conn.AddUnits(svc, 1, "lxc:"+id3) |
410 c.Assert(err, gc.IsNil) | 410 c.Assert(err, gc.IsNil) |
411 id4, err := units[0].AssignedMachineId() | 411 id4, err := units[0].AssignedMachineId() |
412 c.Assert(id4, gc.Equals, id0+"/lxc/0/lxc/0") | 412 c.Assert(id4, gc.Equals, id0+"/lxc/0/lxc/0") |
413 | 413 |
414 // Check that all but the first colon is left alone. | 414 // Check that all but the first colon is left alone. |
415 _, err = s.conn.AddUnits(svc, 1, "lxc:"+strings.Replace(id3, "/", ":", -
1)) | 415 _, err = s.conn.AddUnits(svc, 1, "lxc:"+strings.Replace(id3, "/", ":", -
1)) |
416 » c.Assert(err, gc.IsNil) | 416 » c.Assert(err, gc.ErrorMatches, `invalid force machine id ".*"`) |
417 } | 417 } |
418 | 418 |
419 // DeployLocalSuite uses a fresh copy of the same local dummy charm for each | 419 // DeployLocalSuite uses a fresh copy of the same local dummy charm for each |
420 // test, because DeployService demands that a charm already exists in state, | 420 // test, because DeployService demands that a charm already exists in state, |
421 // and that's is the simplest way to get one in there. | 421 // and that's is the simplest way to get one in there. |
422 type DeployLocalSuite struct { | 422 type DeployLocalSuite struct { |
423 testing.JujuConnSuite | 423 testing.JujuConnSuite |
424 repo charm.Repository | 424 repo charm.Repository |
425 charm *state.Charm | 425 charm *state.Charm |
426 oldCacheDir string | 426 oldCacheDir string |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 c.Assert(err, gc.ErrorMatches, "cannot determine juju home.*") | 654 c.Assert(err, gc.ErrorMatches, "cannot determine juju home.*") |
655 } | 655 } |
656 | 656 |
657 func (s *InitJujuHomeSuite) TestCacheDir(c *gc.C) { | 657 func (s *InitJujuHomeSuite) TestCacheDir(c *gc.C) { |
658 os.Setenv("JUJU_HOME", "/foo/bar") | 658 os.Setenv("JUJU_HOME", "/foo/bar") |
659 c.Assert(charm.CacheDir, gc.Equals, "") | 659 c.Assert(charm.CacheDir, gc.Equals, "") |
660 err := juju.InitJujuHome() | 660 err := juju.InitJujuHome() |
661 c.Assert(err, gc.IsNil) | 661 c.Assert(err, gc.IsNil) |
662 c.Assert(charm.CacheDir, gc.Equals, "/foo/bar/charmcache") | 662 c.Assert(charm.CacheDir, gc.Equals, "/foo/bar/charmcache") |
663 } | 663 } |
LEFT | RIGHT |