Skip to content

Commit

Permalink
daemon, tests/main/component-sideload: support sideloading multiple s…
Browse files Browse the repository at this point in the history
…naps and components at the same time (#14846)

* daemon, tests/main/component-sideload: support sideloading multiple snaps and components at the same time

* daemon: add doc comment for uploadedOrInstalledSnapInfoMatcher

* daemon: fix typo
  • Loading branch information
andrewphelpsj authored Dec 18, 2024
1 parent 0af87d5 commit 2d3d2a1
Show file tree
Hide file tree
Showing 7 changed files with 607 additions and 178 deletions.
4 changes: 2 additions & 2 deletions daemon/api_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ func startOfflineRemodelChange(st *state.State, newModel *asserts.Model,
for _, psi := range slInfo.snaps {
// Move file to the same name of what a downloaded one would have
dest := filepath.Join(dirs.SnapBlobDir,
fmt.Sprintf("%s_%s.snap", psi.sideInfo.RealName, psi.sideInfo.Revision))
fmt.Sprintf("%s_%s.snap", psi.info.RealName, psi.info.Revision))
os.Rename(psi.tmpPath, dest)
// Avoid trying to remove a file that does not exist anymore
*pathsToNotRemove = append(*pathsToNotRemove, psi.tmpPath)

sideInfos = append(sideInfos, psi.sideInfo)
sideInfos = append(sideInfos, &psi.info.SideInfo)
paths = append(paths, dest)
}

Expand Down
8 changes: 6 additions & 2 deletions daemon/api_model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,12 @@ func (s *modelSuite) testPostOfflineRemodel(c *check.C, params *testPostOfflineR
return chg, nil
})()

sis := []*snap.SideInfo{{RealName: snapName, Revision: snap.Revision{N: snapRev}}}
defer daemon.MockSideloadSnapsInfo(sis)()
infos := []*snap.Info{{SideInfo: snap.SideInfo{
RealName: snapName,
Revision: snap.R(snapRev),
}}}

defer daemon.MockSideloadSnapsInfo(infos)()

// create a valid model assertion
c.Assert(err, check.IsNil)
Expand Down
Loading

0 comments on commit 2d3d2a1

Please sign in to comment.