Skip to content

Commit

Permalink
add a test for lxd-support
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Strandboge committed Oct 14, 2016
1 parent 7331dcd commit 1731524
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions interfaces/builtin/basedeclaration_test.go
Expand Up @@ -199,17 +199,44 @@ func (s *baseDeclSuite) TestAutoConnectionContent(c *C) {
}

func (s *baseDeclSuite) TestAutoConnectionLxdSupport(c *C) {
// by default, don't auto-connect
cand := s.connectCand(c, "lxd-support", "", "")
err := cand.CheckAutoConnect()
c.Check(err, NotNil)
c.Check(err, IsNil)

// allow auto-connect to particular snap id
plugsSlots := `
slots:
docker-support:
allow-auto-connection:
plug-snap-id:
- J60k4JY0HppjwOjW8dZdYc8obXKxujRu
`

// TODO: have the real snap-decl allow things and not the base-decl
lxdDecl := s.mockSnapDecl(c, "lxd", "J60k4JY0HppjwOjW8dZdYc8obXKxujRu", "canonical", "")
lxdDecl := s.mockSnapDecl(c, "lxd", "J60k4JY0HppjwOjW8dZdYc8obXKxujRu", "canonical", plugsSlots)
cand.PlugSnapDeclaration = lxdDecl
err = cand.CheckAutoConnect()
c.Check(err, IsNil)
}

// FIXME: this should fail but doesn't
func (s *baseDeclSuite) TestAutoConnectionLxdSupportNoMatch(c *C) {
cand := s.connectCand(c, "lxd-support", "", "")
// don't allow auto-connect to non-matching snap id
plugsSlots := `
slots:
docker-support:
allow-auto-connection:
plug-snap-id:
- nonmatchingnonmatchingnonmatchin
`

lxdDecl := s.mockSnapDecl(c, "lxd", "J60k4JY0HppjwOjW8dZdYc8obXKxujRu", "canonical", plugsSlots)
cand.PlugSnapDeclaration = lxdDecl
err := cand.CheckAutoConnect()
c.Check(err, NotNil)
}

// describe installation rules for slots succinctly for cross-checking,
// if an interface is not mentioned here a slot of its type can only
// be installed by a core snap (and this was taken care by
Expand Down

0 comments on commit 1731524

Please sign in to comment.