2018-02-15 10:24:26 -05:00
|
|
|
package daemon
|
|
|
|
|
2018-02-15 10:44:00 -05:00
|
|
|
import (
|
2018-02-15 10:24:26 -05:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/docker/docker/api/types"
|
|
|
|
"github.com/docker/docker/api/types/filters"
|
2018-02-15 10:44:00 -05:00
|
|
|
"github.com/docker/docker/container"
|
2018-06-11 09:32:11 -04:00
|
|
|
"gotest.tools/assert"
|
|
|
|
is "gotest.tools/assert/cmp"
|
2018-02-15 10:24:26 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestListInvalidFilter(t *testing.T) {
|
|
|
|
db, err := container.NewViewDB()
|
|
|
|
assert.Assert(t, err == nil)
|
|
|
|
d := &Daemon{
|
|
|
|
containersReplica: db,
|
|
|
|
}
|
|
|
|
|
|
|
|
f := filters.NewArgs(filters.Arg("invalid", "foo"))
|
|
|
|
|
|
|
|
_, err = d.Containers(&types.ContainerListOptions{
|
|
|
|
Filters: f,
|
|
|
|
})
|
|
|
|
assert.Assert(t, is.Error(err, "Invalid filter 'invalid'"))
|
2018-02-15 10:44:00 -05:00
|
|
|
}
|