list-images: add --datadir override for e.g. custom repositories
This commit adds a `--datadir` override that allows overriding the default search paths for e.g. the custom repositories. In practise only repository overrides are supported because that is the only data stored there.
This commit is contained in:
parent
56f9c6969c
commit
2719f3f727
6 changed files with 54 additions and 14 deletions
|
|
@ -96,3 +96,15 @@ func TestBadCmdErrorsNoExtraCobraNoise(t *testing.T) {
|
|||
// no extra output from cobra
|
||||
assert.Equal(t, "", fakeStderr.String())
|
||||
}
|
||||
|
||||
func TestListImagesOverrideDatadir(t *testing.T) {
|
||||
restore := main.MockOsArgs([]string{"--datadir=/this/path/does/not/exist", "list-images"})
|
||||
defer restore()
|
||||
|
||||
var fakeStdout bytes.Buffer
|
||||
restore = main.MockOsStdout(&fakeStdout)
|
||||
defer restore()
|
||||
|
||||
err := main.Run()
|
||||
assert.EqualError(t, err, `no repositories found in the given paths: [/this/path/does/not/exist]`)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue