many: fetch & cache remote snaps and sections; complete from there #3748

Closed
wants to merge 7 commits into
from

overlord/snapstate: always dirs.SetRootDir(c.MkDir()) in tests

  • Loading branch information...
commit 90a8ca941f6f322e7aa7150bc7bba738708e06cb @chipaca chipaca committed Aug 23, 2017
@@ -61,7 +61,7 @@ func (b *witnessRestartReqStateBackend) RequestRestart(t state.RestartType) {
func (b *witnessRestartReqStateBackend) EnsureBefore(time.Duration) {}
func (s *linkSnapSuite) SetUpTest(c *C) {
- dirs.SnapCookieDir = c.MkDir()
+ dirs.SetRootDir(c.MkDir())
s.stateBackend = &witnessRestartReqStateBackend{}
s.fakeBackend = &fakeSnappyBackend{}
@@ -182,7 +182,7 @@ func (s *linkSnapSuite) TestDoLinkSnapTryToCleanupOnError(c *C) {
Channel: "beta",
})
- s.fakeBackend.linkSnapFailTrigger = filepath.Join(dirs.StripRootDir(dirs.SnapMountDir), "foo/35")
+ s.fakeBackend.linkSnapFailTrigger = filepath.Join(dirs.SnapMountDir, "foo/35")
s.state.NewChange("dummy", "...").AddTask(t)
s.state.Unlock()
@@ -204,11 +204,11 @@ func (s *linkSnapSuite) TestDoLinkSnapTryToCleanupOnError(c *C) {
},
{
op: "link-snap.failed",
- name: filepath.Join(dirs.StripRootDir(dirs.SnapMountDir), "foo/35"),
+ name: filepath.Join(dirs.SnapMountDir, "foo/35"),
},
{
op: "unlink-snap",
- name: filepath.Join(dirs.StripRootDir(dirs.SnapMountDir), "foo/35"),
+ name: filepath.Join(dirs.SnapMountDir, "foo/35"),
},
})
}
@@ -44,8 +44,8 @@ type mountSnapSuite struct {
var _ = Suite(&mountSnapSuite{})
func (s *mountSnapSuite) SetUpTest(c *C) {
- oldDir := dirs.SnapCookieDir
- dirs.SnapCookieDir = c.MkDir()
+ oldDir := dirs.GlobalRootDir
+ dirs.SetRootDir(c.MkDir())
s.fakeBackend = &fakeSnappyBackend{}
s.state = state.New(nil)
@@ -60,7 +60,7 @@ func (s *mountSnapSuite) SetUpTest(c *C) {
reset1 := snapstate.MockReadInfo(s.fakeBackend.ReadInfo)
s.reset = func() {
reset1()
- dirs.SnapCookieDir = oldDir
+ dirs.SetRootDir(oldDir)
}
}
@@ -138,7 +138,7 @@ func (s *mountSnapSuite) TestDoUndoMountSnap(c *C) {
c.Check(s.fakeBackend.ops, DeepEquals, fakeOps{
{
op: "current",
- old: filepath.Join(dirs.StripRootDir(dirs.SnapMountDir), "core/1"),
+ old: filepath.Join(dirs.SnapMountDir, "core/1"),
},
{
op: "setup-snap",
@@ -147,7 +147,7 @@ func (s *mountSnapSuite) TestDoUndoMountSnap(c *C) {
},
{
op: "undo-setup-snap",
- name: filepath.Join(dirs.StripRootDir(dirs.SnapMountDir), "core/2"),
+ name: filepath.Join(dirs.SnapMountDir, "core/2"),
stype: "os",
},
})
@@ -40,7 +40,7 @@ type prepareSnapSuite struct {
var _ = Suite(&prepareSnapSuite{})
func (s *prepareSnapSuite) SetUpTest(c *C) {
- dirs.SnapCookieDir = c.MkDir()
+ dirs.SetRootDir(c.MkDir())
s.fakeBackend = &fakeSnappyBackend{}
s.state = state.New(nil)
Oops, something went wrong.