mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-31 04:30:44 +00:00
Commands * search should exit with failure on no results. #213
This commit is contained in:
@@ -96,6 +96,10 @@ func aptlySnapshotMirrorRepoSearch(cmd *commander.Command, args []string) error
|
|||||||
return fmt.Errorf("unable to search: %s", err)
|
return fmt.Errorf("unable to search: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if result.Len() == 0 {
|
||||||
|
return fmt.Errorf("no results")
|
||||||
|
}
|
||||||
|
|
||||||
result.ForEach(func(p *deb.Package) error {
|
result.ForEach(func(p *deb.Package) error {
|
||||||
context.Progress().Printf("%s\n", p)
|
context.Progress().Printf("%s\n", p)
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
ERROR: no results
|
||||||
@@ -37,3 +37,13 @@ class SearchSnapshot4Test(BaseTest):
|
|||||||
fixtureCmds = ["aptly snapshot create wheezy-main from mirror wheezy-main"]
|
fixtureCmds = ["aptly snapshot create wheezy-main from mirror wheezy-main"]
|
||||||
outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n")))
|
outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n")))
|
||||||
runCmd = "aptly snapshot search -with-deps wheezy-main 'Name (nginx)'"
|
runCmd = "aptly snapshot search -with-deps wheezy-main 'Name (nginx)'"
|
||||||
|
|
||||||
|
|
||||||
|
class SearchSnapshot5Test(BaseTest):
|
||||||
|
"""
|
||||||
|
search snapshot: no results
|
||||||
|
"""
|
||||||
|
fixtureDB = True
|
||||||
|
fixtureCmds = ["aptly snapshot create wheezy-main from mirror wheezy-main"]
|
||||||
|
runCmd = "aptly snapshot search -with-deps wheezy-main 'Name (no-such-package)'"
|
||||||
|
expectedCode = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user