Skip to content

Commit

Permalink
interfaces: add test that checks when app set is made with components…
Browse files Browse the repository at this point in the history
… from the wrong snap
  • Loading branch information
andrewphelpsj committed Apr 30, 2024
1 parent 840f080 commit 55c399a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions interfaces/snap_app_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/snapcore/snapd/dirs"
"github.com/snapcore/snapd/interfaces"
"github.com/snapcore/snapd/snap"
"github.com/snapcore/snapd/snap/naming"
"github.com/snapcore/snapd/snap/snaptest"
"github.com/snapcore/snapd/testutil"
. "gopkg.in/check.v1"
Expand Down Expand Up @@ -261,6 +262,14 @@ func (s *snapAppSetSuite) TestInstanceName(c *C) {
c.Check(set.InstanceName(), Equals, "test-snap")
}

func (s *snapAppSetSuite) TestNewAppSetWithWrongComponent(c *C) {
info := snaptest.MockInfo(c, yaml, nil)
_, err := interfaces.NewSnapAppSet(info, []*snap.ComponentInfo{{
Component: naming.NewComponentRef("other-name", "comp"),
}})
c.Assert(err, ErrorMatches, `internal error: snap "test-snap" does not own component "other-name\+comp"`)
}

func appsInMap(apps map[string]*snap.AppInfo) []*snap.AppInfo {
result := make([]*snap.AppInfo, 0, len(apps))
for _, app := range apps {
Expand Down

0 comments on commit 55c399a

Please sign in to comment.