Beispiel #1
0
func (s *ensureLockDirSuite) TestIdempotent(c *gc.C) {
	err := upgrades.EnsureLockDirExistsAndUbuntuWritable(s.ctx)
	c.Assert(err, gc.IsNil)

	err = upgrades.EnsureLockDirExistsAndUbuntuWritable(s.ctx)
	c.Assert(err, gc.IsNil)

	c.Assert(s.lockdir, jc.IsDirectory)
	s.assertChownCalled(c)
}
Beispiel #2
0
func (s *ensureLockDirSuite) TestNoChownIfNoHome(c *gc.C) {
	s.PatchValue(upgrades.UbuntuHome, filepath.Join(s.home, "not-exist"))
	err := upgrades.EnsureLockDirExistsAndUbuntuWritable(s.ctx)
	c.Assert(err, gc.IsNil)

	c.Assert(s.lockdir, jc.IsDirectory)
	s.assertNoChownCalled(c)
}