github.com/cloudbase/juju-core@v0.0.0-20140504232958-a7271ac7912f/container/lxc/testing/test.go (about) 1 // Copyright 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package testing 5 6 import ( 7 gc "launchpad.net/gocheck" 8 9 "launchpad.net/juju-core/container" 10 "launchpad.net/juju-core/container/lxc" 11 "launchpad.net/juju-core/container/lxc/mock" 12 "launchpad.net/juju-core/testing/testbase" 13 ) 14 15 // TestSuite replaces the lxc factory that the broker uses with a mock 16 // implementation. 17 type TestSuite struct { 18 testbase.LoggingSuite 19 Factory mock.ContainerFactory 20 ContainerDir string 21 RemovedDir string 22 LxcDir string 23 RestartDir string 24 } 25 26 func (s *TestSuite) SetUpTest(c *gc.C) { 27 s.LoggingSuite.SetUpTest(c) 28 s.ContainerDir = c.MkDir() 29 s.PatchValue(&container.ContainerDir, s.ContainerDir) 30 s.RemovedDir = c.MkDir() 31 s.PatchValue(&container.RemovedContainerDir, s.RemovedDir) 32 s.LxcDir = c.MkDir() 33 s.PatchValue(&lxc.LxcContainerDir, s.LxcDir) 34 s.RestartDir = c.MkDir() 35 s.PatchValue(&lxc.LxcRestartDir, s.RestartDir) 36 s.Factory = mock.MockFactory() 37 s.PatchValue(&lxc.LxcObjectFactory, s.Factory) 38 }