mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
filters: lowercase error
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
2d45b5ddbc
commit
bdb878ab2c
10 changed files with 21 additions and 21 deletions
|
@ -115,7 +115,7 @@ type invalidFilter struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e invalidFilter) Error() string {
|
func (e invalidFilter) Error() string {
|
||||||
msg := "Invalid filter '" + e.filter
|
msg := "invalid filter '" + e.filter
|
||||||
if e.value != nil {
|
if e.value != nil {
|
||||||
msg += fmt.Sprintf("=%s", e.value)
|
msg += fmt.Sprintf("=%s", e.value)
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,31 +46,31 @@ func TestSearchRegistryForImagesErrors(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
filtersArgs: `{"type":{"custom":true}}`,
|
filtersArgs: `{"type":{"custom":true}}`,
|
||||||
expectedError: "Invalid filter 'type'",
|
expectedError: "invalid filter 'type'",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
filtersArgs: `{"is-automated":{"invalid":true}}`,
|
filtersArgs: `{"is-automated":{"invalid":true}}`,
|
||||||
expectedError: "Invalid filter 'is-automated=[invalid]'",
|
expectedError: "invalid filter 'is-automated=[invalid]'",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
filtersArgs: `{"is-automated":{"true":true,"false":true}}`,
|
filtersArgs: `{"is-automated":{"true":true,"false":true}}`,
|
||||||
expectedError: "Invalid filter 'is-automated",
|
expectedError: "invalid filter 'is-automated",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
filtersArgs: `{"is-official":{"invalid":true}}`,
|
filtersArgs: `{"is-official":{"invalid":true}}`,
|
||||||
expectedError: "Invalid filter 'is-official=[invalid]'",
|
expectedError: "invalid filter 'is-official=[invalid]'",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
filtersArgs: `{"is-official":{"true":true,"false":true}}`,
|
filtersArgs: `{"is-official":{"true":true,"false":true}}`,
|
||||||
expectedError: "Invalid filter 'is-official",
|
expectedError: "invalid filter 'is-official",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
filtersArgs: `{"stars":{"invalid":true}}`,
|
filtersArgs: `{"stars":{"invalid":true}}`,
|
||||||
expectedError: "Invalid filter 'stars=invalid'",
|
expectedError: "invalid filter 'stars=invalid'",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
filtersArgs: `{"stars":{"1":true,"invalid":true}}`,
|
filtersArgs: `{"stars":{"1":true,"invalid":true}}`,
|
||||||
expectedError: "Invalid filter 'stars=invalid'",
|
expectedError: "invalid filter 'stars=invalid'",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for index, e := range errorCases {
|
for index, e := range errorCases {
|
||||||
|
|
|
@ -12,7 +12,7 @@ type invalidFilter struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e invalidFilter) Error() string {
|
func (e invalidFilter) Error() string {
|
||||||
msg := "Invalid filter '" + e.filter
|
msg := "invalid filter '" + e.filter
|
||||||
if e.value != nil {
|
if e.value != nil {
|
||||||
msg += fmt.Sprintf("=%s", e.value)
|
msg += fmt.Sprintf("=%s", e.value)
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ func TestListInvalidFilter(t *testing.T) {
|
||||||
_, err = d.Containers(&types.ContainerListOptions{
|
_, err = d.Containers(&types.ContainerListOptions{
|
||||||
Filters: f,
|
Filters: f,
|
||||||
})
|
})
|
||||||
assert.Assert(t, is.Error(err, "Invalid filter 'invalid'"))
|
assert.Assert(t, is.Error(err, "invalid filter 'invalid'"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNameFilter(t *testing.T) {
|
func TestNameFilter(t *testing.T) {
|
||||||
|
|
|
@ -68,7 +68,7 @@ func (s *DockerSuite) TestImagesOrderedByCreationDate(c *testing.T) {
|
||||||
func (s *DockerSuite) TestImagesErrorWithInvalidFilterNameTest(c *testing.T) {
|
func (s *DockerSuite) TestImagesErrorWithInvalidFilterNameTest(c *testing.T) {
|
||||||
out, _, err := dockerCmdWithError("images", "-f", "FOO=123")
|
out, _, err := dockerCmdWithError("images", "-f", "FOO=123")
|
||||||
assert.ErrorContains(c, err, "")
|
assert.ErrorContains(c, err, "")
|
||||||
assert.Assert(c, strings.Contains(out, "Invalid filter"))
|
assert.Assert(c, strings.Contains(out, "invalid filter"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestImagesFilterLabelMatch(c *testing.T) {
|
func (s *DockerSuite) TestImagesFilterLabelMatch(c *testing.T) {
|
||||||
|
@ -252,7 +252,7 @@ func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *testing.T)
|
||||||
func (s *DockerSuite) TestImagesWithIncorrectFilter(c *testing.T) {
|
func (s *DockerSuite) TestImagesWithIncorrectFilter(c *testing.T) {
|
||||||
out, _, err := dockerCmdWithError("images", "-f", "dangling=invalid")
|
out, _, err := dockerCmdWithError("images", "-f", "dangling=invalid")
|
||||||
assert.ErrorContains(c, err, "")
|
assert.ErrorContains(c, err, "")
|
||||||
assert.Assert(c, strings.Contains(out, "Invalid filter"))
|
assert.Assert(c, strings.Contains(out, "invalid filter"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestImagesEnsureOnlyHeadsImagesShown(c *testing.T) {
|
func (s *DockerSuite) TestImagesEnsureOnlyHeadsImagesShown(c *testing.T) {
|
||||||
|
|
|
@ -203,7 +203,7 @@ func (s *DockerSuite) TestPsListContainersFilterStatus(c *testing.T) {
|
||||||
assert.Equal(c, RemoveOutputForExistingElements(containerOut, existingContainers), secondID)
|
assert.Equal(c, RemoveOutputForExistingElements(containerOut, existingContainers), secondID)
|
||||||
|
|
||||||
result := cli.Docker(cli.Args("ps", "-a", "-q", "--filter=status=rubbish"), cli.WithTimeout(time.Second*60))
|
result := cli.Docker(cli.Args("ps", "-a", "-q", "--filter=status=rubbish"), cli.WithTimeout(time.Second*60))
|
||||||
err := "Invalid filter 'status=rubbish'"
|
err := "invalid filter 'status=rubbish'"
|
||||||
if versions.LessThan(testEnv.DaemonAPIVersion(), "1.32") {
|
if versions.LessThan(testEnv.DaemonAPIVersion(), "1.32") {
|
||||||
err = "Unrecognised filter value for status: rubbish"
|
err = "Unrecognised filter value for status: rubbish"
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,19 +17,19 @@ func (s *DockerSuite) TestSearchOnCentralRegistry(c *testing.T) {
|
||||||
func (s *DockerSuite) TestSearchStarsOptionWithWrongParameter(c *testing.T) {
|
func (s *DockerSuite) TestSearchStarsOptionWithWrongParameter(c *testing.T) {
|
||||||
out, _, err := dockerCmdWithError("search", "--filter", "stars=a", "busybox")
|
out, _, err := dockerCmdWithError("search", "--filter", "stars=a", "busybox")
|
||||||
assert.ErrorContains(c, err, "", out)
|
assert.ErrorContains(c, err, "", out)
|
||||||
assert.Assert(c, strings.Contains(out, "Invalid filter"), "couldn't find the invalid filter warning")
|
assert.Assert(c, strings.Contains(out, "invalid filter"), "couldn't find the invalid filter warning")
|
||||||
|
|
||||||
out, _, err = dockerCmdWithError("search", "-f", "stars=a", "busybox")
|
out, _, err = dockerCmdWithError("search", "-f", "stars=a", "busybox")
|
||||||
assert.ErrorContains(c, err, "", out)
|
assert.ErrorContains(c, err, "", out)
|
||||||
assert.Assert(c, strings.Contains(out, "Invalid filter"), "couldn't find the invalid filter warning")
|
assert.Assert(c, strings.Contains(out, "invalid filter"), "couldn't find the invalid filter warning")
|
||||||
|
|
||||||
out, _, err = dockerCmdWithError("search", "-f", "is-automated=a", "busybox")
|
out, _, err = dockerCmdWithError("search", "-f", "is-automated=a", "busybox")
|
||||||
assert.ErrorContains(c, err, "", out)
|
assert.ErrorContains(c, err, "", out)
|
||||||
assert.Assert(c, strings.Contains(out, "Invalid filter"), "couldn't find the invalid filter warning")
|
assert.Assert(c, strings.Contains(out, "invalid filter"), "couldn't find the invalid filter warning")
|
||||||
|
|
||||||
out, _, err = dockerCmdWithError("search", "-f", "is-official=a", "busybox")
|
out, _, err = dockerCmdWithError("search", "-f", "is-official=a", "busybox")
|
||||||
assert.ErrorContains(c, err, "", out)
|
assert.ErrorContains(c, err, "", out)
|
||||||
assert.Assert(c, strings.Contains(out, "Invalid filter"), "couldn't find the invalid filter warning")
|
assert.Assert(c, strings.Contains(out, "invalid filter"), "couldn't find the invalid filter warning")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestSearchCmdOptions(c *testing.T) {
|
func (s *DockerSuite) TestSearchCmdOptions(c *testing.T) {
|
||||||
|
|
|
@ -166,13 +166,13 @@ func (s *DockerSuite) TestVolumeCLILsFilterDangling(c *testing.T) {
|
||||||
func (s *DockerSuite) TestVolumeCLILsErrorWithInvalidFilterName(c *testing.T) {
|
func (s *DockerSuite) TestVolumeCLILsErrorWithInvalidFilterName(c *testing.T) {
|
||||||
out, _, err := dockerCmdWithError("volume", "ls", "-f", "FOO=123")
|
out, _, err := dockerCmdWithError("volume", "ls", "-f", "FOO=123")
|
||||||
assert.ErrorContains(c, err, "")
|
assert.ErrorContains(c, err, "")
|
||||||
assert.Assert(c, strings.Contains(out, "Invalid filter"))
|
assert.Assert(c, strings.Contains(out, "invalid filter"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestVolumeCLILsWithIncorrectFilterValue(c *testing.T) {
|
func (s *DockerSuite) TestVolumeCLILsWithIncorrectFilterValue(c *testing.T) {
|
||||||
out, _, err := dockerCmdWithError("volume", "ls", "-f", "dangling=invalid")
|
out, _, err := dockerCmdWithError("volume", "ls", "-f", "dangling=invalid")
|
||||||
assert.ErrorContains(c, err, "")
|
assert.ErrorContains(c, err, "")
|
||||||
assert.Assert(c, strings.Contains(out, "Invalid filter"))
|
assert.Assert(c, strings.Contains(out, "invalid filter"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestVolumeCLIRm(c *testing.T) {
|
func (s *DockerSuite) TestVolumeCLIRm(c *testing.T) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ type invalidFilter struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e invalidFilter) Error() string {
|
func (e invalidFilter) Error() string {
|
||||||
msg := "Invalid filter '" + e.filter
|
msg := "invalid filter '" + e.filter
|
||||||
if len(e.value) > 0 {
|
if len(e.value) > 0 {
|
||||||
msg += fmt.Sprintf("=%s", e.value)
|
msg += fmt.Sprintf("=%s", e.value)
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ type invalidFilter struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e invalidFilter) Error() string {
|
func (e invalidFilter) Error() string {
|
||||||
msg := "Invalid filter '" + e.filter
|
msg := "invalid filter '" + e.filter
|
||||||
if e.value != nil {
|
if e.value != nil {
|
||||||
msg += fmt.Sprintf("=%s", e.value)
|
msg += fmt.Sprintf("=%s", e.value)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue