~rogpeppe/golxc/golxc

« back to all changes in this revision

Viewing changes to golxc_test.go

  • Committer: Roger Peppe
  • Date: 2014-06-02 13:19:29 UTC
  • Revision ID: roger.peppe@canonical.com-20140602131929-b26s9w99c0bhg4qk
use testing.IsolationSuite

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
        "github.com/juju/testing"
13
13
        jc "github.com/juju/testing/checkers"
14
 
        "github.com/juju/testing/logging"
15
14
        . "launchpad.net/gocheck"
16
15
 
17
16
        "launchpad.net/golxc"
356
355
        c.Assert(lc.Unfreeze(), ErrorMatches, "container .* is not frozen")
357
356
}
358
357
 
359
 
type commandArgs struct {
360
 
        logging.LoggingSuite
361
 
}
362
 
 
363
 
var _ = Suite(&commandArgs{})
364
 
 
365
 
func (s *commandArgs) TestCreateArgs(c *C) {
 
358
type commandArgsSuite struct {
 
359
        oldPath string
 
360
        testing.IsolationSuite
 
361
}
 
362
 
 
363
var _ = Suite(&commandArgsSuite{})
 
364
 
 
365
func (s *commandArgsSuite) SetUpSuite(c *C) {
 
366
        s.oldPath = os.Getenv("PATH")
 
367
        s.IsolationSuite.SetUpSuite(c)
 
368
}
 
369
 
 
370
func (s *commandArgsSuite) SetUpTest(c *C) {
 
371
        s.IsolationSuite.SetUpTest(c)
 
372
        os.Setenv("PATH", s.oldPath)
 
373
}
 
374
 
 
375
func (s *commandArgsSuite) TestCreateArgs(c *C) {
366
376
        s.PatchValue(&golxc.ContainerDir, c.MkDir())
367
377
        testing.PatchExecutableAsEchoArgs(c, s, "lxc-create")
368
378
 
383
393
                "--", "template-1", "template-2")
384
394
}
385
395
 
386
 
func (s *commandArgs) TestCloneArgs(c *C) {
 
396
func (s *commandArgsSuite) TestCloneArgs(c *C) {
387
397
        dir := c.MkDir()
388
398
        s.PatchValue(&golxc.ContainerDir, dir)
389
399
        // Patch lxc-info too as clone checks to see if it is running.