Exemple #1
0
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")
}
Exemple #2
0
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)
}