func (s *ConfigSuite) TestReadNotExistingDefaultEnvironment(c *C) { // Test reading a not existing environment. defer golxc.SetConfPath(golxc.SetConfPath(filepath.Join(c.MkDir(), "foo"))) _, err := golxc.ReadConf() c.Assert(err, ErrorMatches, "open .*: no such file or directory") }
func (s *NetworkSuite) TestNotExistingNetworkAttributes(c *C) { // Test reading of network attributes from a not existing environment. defer golxc.SetConfPath(golxc.SetConfPath(filepath.Join(c.MkDir(), "foo"))) _, _, err := golxc.NetworkAttributes() c.Assert(err, ErrorMatches, "open .*: no such file or directory") }
func (s *ConfigSuite) TestReadConf(c *C) { // Test reading the configuration. cf := filepath.Join(c.MkDir(), "lxc-test") c.Assert(ioutil.WriteFile(cf, []byte(lxcfile), 0555), IsNil) defer golxc.SetConfPath(golxc.SetConfPath(cf)) conf, err := golxc.ReadConf() c.Assert(err, IsNil) c.Assert(conf, DeepEquals, lxcconf) }
func (s *ConfigSuite) TestNetworkAttributes(c *C) { // Test reading the network attribute form an environment. cf := filepath.Join(c.MkDir(), "lxc-test") c.Assert(ioutil.WriteFile(cf, []byte(lxcfile), 0555), IsNil) defer golxc.SetConfPath(golxc.SetConfPath(cf)) addr, bridge, err := golxc.NetworkAttributes() c.Assert(err, IsNil) c.Assert(addr, Equals, "10.0.9.1") c.Assert(bridge, Equals, "lxcbr9") }