Merge lp:~chipaca/snappy/update-qualified-name into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by John Lenton
Status: Merged
Approved by: John Lenton
Approved revision: 714
Merged at revision: 713
Proposed branch: lp:~chipaca/snappy/update-qualified-name
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Diff against target: 57 lines (+29/-4)
2 files modified
snappy/parts.go (+6/-4)
snappy/parts_test.go (+23/-0)
To merge this branch: bzr merge lp:~chipaca/snappy/update-qualified-name
Reviewer Review Type Date Requested Status
Michael Vogt (community) Approve
Review via email: mp+272091@code.launchpad.net

Commit message

Make the updates call use the qualified name.

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'snappy/parts.go'
2--- snappy/parts.go 2015-09-14 23:19:11 +0000
3+++ snappy/parts.go 2015-09-23 11:54:14 +0000
4@@ -249,13 +249,15 @@
5 // ActiveSnapNamesByType returns all installed snap names with the given type
6 var ActiveSnapNamesByType = activeSnapNamesByTypeImpl
7
8-func activeSnapNamesByTypeImpl(snapTs ...pkg.Type) (res []string, err error) {
9+func activeSnapNamesByTypeImpl(snapTs ...pkg.Type) ([]string, error) {
10 installed, err := ActiveSnapsByType(snapTs...)
11- for _, part := range installed {
12- res = append(res, part.Name())
13+ res := make([]string, len(installed))
14+
15+ for i, part := range installed {
16+ res[i] = QualifiedName(part)
17 }
18
19- return res, nil
20+ return res, err
21 }
22
23 // ActiveSnapByName returns all active snaps with the given name
24
25=== modified file 'snappy/parts_test.go'
26--- snappy/parts_test.go 2015-09-14 23:19:11 +0000
27+++ snappy/parts_test.go 2015-09-23 11:54:14 +0000
28@@ -57,6 +57,29 @@
29 c.Assert(parts[0].Name(), Equals, "framework1")
30 }
31
32+func (s *SnapTestSuite) TestActiveSnapNamesByType(c *C) {
33+ yamlPath, err := makeInstalledMockSnap(s.tempdir, `name: app
34+version: 1.10
35+vendor: example.com`)
36+ c.Assert(err, IsNil)
37+ makeSnapActive(yamlPath)
38+
39+ yamlPath, err = makeInstalledMockSnap(s.tempdir, `name: fwk
40+version: 1.0
41+type: framework
42+vendor: example.com`)
43+ c.Assert(err, IsNil)
44+ makeSnapActive(yamlPath)
45+
46+ names, err := ActiveSnapNamesByType(pkg.TypeApp)
47+ c.Check(err, IsNil)
48+ c.Check(names, DeepEquals, []string{"app." + testOrigin})
49+
50+ names, err = ActiveSnapNamesByType(pkg.TypeFramework)
51+ c.Check(err, IsNil)
52+ c.Check(names, DeepEquals, []string{"fwk"})
53+}
54+
55 func (s *SnapTestSuite) TestMetaRepositoryDetails(c *C) {
56 _, err := makeInstalledMockSnap(s.tempdir, "")
57 c.Assert(err, IsNil)

Subscribers

People subscribed via source and target branches