address review feedback

This commit is contained in:
Michael Vogt
2018-01-09 16:08:35 +01:00
parent 0e3e82e363
commit ba6de1fb2c
4 changed files with 9 additions and 8 deletions

View File

@@ -30,7 +30,7 @@ import (
var (
cmdBucketKey = []byte("Commands")
pkgBucketKey = []byte("Pkgs")
pkgBucketKey = []byte("Snaps")
)
type writer struct {
@@ -150,8 +150,9 @@ func (t *writer) done(commit bool) error {
return e1
}
// Dump returns the whole database as a map. For use in testing and debugging.
func Dump() (map[string][]string, error) {
// DumpCommands returns the whole database as a map. For use in
// testing and debugging.
func DumpCommands() (map[string][]string, error) {
db, err := bolt.Open(dirs.SnapCommandsDB, 0600, &bolt.Options{
ReadOnly: true,
Timeout: 1 * time.Second,

View File

@@ -125,8 +125,8 @@ func (s *cmdfinderSuite) TestFindMisspelledCommandMiss(c *C) {
c.Check(cmds, HasLen, 0)
}
func (s *cmdfinderSuite) TestDump(c *C) {
cmds, err := advisor.Dump()
func (s *cmdfinderSuite) TestDumpCommands(c *C) {
cmds, err := advisor.DumpCommands()
c.Assert(err, IsNil)
c.Check(cmds, DeepEquals, map[string][]string{
"foo": {"foo"},

View File

@@ -99,7 +99,7 @@ func (s *catalogRefreshTestSuite) TestCatalogRefresh(c *C) {
c.Check(string(content), Equals, "pkg1\npkg2")
c.Check(osutil.FileExists(dirs.SnapCommandsDB), Equals, true)
dump, err := advisor.Dump()
dump, err := advisor.DumpCommands()
c.Assert(err, IsNil)
c.Check(dump, DeepEquals, map[string][]string{
"foo": {"foo"},

View File

@@ -2688,7 +2688,7 @@ const mockNamesJSON = `
"package_name": "foo"
}
]
q }
}
}`
func (t *remoteRepoTestSuite) TestUbuntuStoreSnapCommandsOnClassic(c *C) {
@@ -2742,7 +2742,7 @@ func (t *remoteRepoTestSuite) testUbuntuStoreSnapCommands(c *C, onClassic bool)
db.Commit()
c.Check(bufNames.String(), Equals, "bar\nfoo\n")
dump, err := advisor.Dump()
dump, err := advisor.DumpCommands()
c.Assert(err, IsNil)
c.Check(dump, DeepEquals, map[string][]string{
"foo": {"foo"},