1
0
Fork 0
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:
Sebastiaan van Stijn 2022-03-02 18:56:06 +01:00
parent 2d45b5ddbc
commit bdb878ab2c
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
10 changed files with 21 additions and 21 deletions

View file

@ -115,7 +115,7 @@ type invalidFilter struct {
}
func (e invalidFilter) Error() string {
msg := "Invalid filter '" + e.filter
msg := "invalid filter '" + e.filter
if e.value != nil {
msg += fmt.Sprintf("=%s", e.value)
}

View file

@ -46,31 +46,31 @@ func TestSearchRegistryForImagesErrors(t *testing.T) {
},
{
filtersArgs: `{"type":{"custom":true}}`,
expectedError: "Invalid filter 'type'",
expectedError: "invalid filter 'type'",
},
{
filtersArgs: `{"is-automated":{"invalid":true}}`,
expectedError: "Invalid filter 'is-automated=[invalid]'",
expectedError: "invalid filter 'is-automated=[invalid]'",
},
{
filtersArgs: `{"is-automated":{"true":true,"false":true}}`,
expectedError: "Invalid filter 'is-automated",
expectedError: "invalid filter 'is-automated",
},
{
filtersArgs: `{"is-official":{"invalid":true}}`,
expectedError: "Invalid filter 'is-official=[invalid]'",
expectedError: "invalid filter 'is-official=[invalid]'",
},
{
filtersArgs: `{"is-official":{"true":true,"false":true}}`,
expectedError: "Invalid filter 'is-official",
expectedError: "invalid filter 'is-official",
},
{
filtersArgs: `{"stars":{"invalid":true}}`,
expectedError: "Invalid filter 'stars=invalid'",
expectedError: "invalid filter 'stars=invalid'",
},
{
filtersArgs: `{"stars":{"1":true,"invalid":true}}`,
expectedError: "Invalid filter 'stars=invalid'",
expectedError: "invalid filter 'stars=invalid'",
},
}
for index, e := range errorCases {

View file

@ -12,7 +12,7 @@ type invalidFilter struct {
}
func (e invalidFilter) Error() string {
msg := "Invalid filter '" + e.filter
msg := "invalid filter '" + e.filter
if e.value != nil {
msg += fmt.Sprintf("=%s", e.value)
}

View file

@ -91,7 +91,7 @@ func TestListInvalidFilter(t *testing.T) {
_, err = d.Containers(&types.ContainerListOptions{
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) {

View file

@ -68,7 +68,7 @@ func (s *DockerSuite) TestImagesOrderedByCreationDate(c *testing.T) {
func (s *DockerSuite) TestImagesErrorWithInvalidFilterNameTest(c *testing.T) {
out, _, err := dockerCmdWithError("images", "-f", "FOO=123")
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) {
@ -252,7 +252,7 @@ func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *testing.T)
func (s *DockerSuite) TestImagesWithIncorrectFilter(c *testing.T) {
out, _, err := dockerCmdWithError("images", "-f", "dangling=invalid")
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) {

View file

@ -203,7 +203,7 @@ func (s *DockerSuite) TestPsListContainersFilterStatus(c *testing.T) {
assert.Equal(c, RemoveOutputForExistingElements(containerOut, existingContainers), secondID)
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") {
err = "Unrecognised filter value for status: rubbish"
}

View file

@ -17,19 +17,19 @@ func (s *DockerSuite) TestSearchOnCentralRegistry(c *testing.T) {
func (s *DockerSuite) TestSearchStarsOptionWithWrongParameter(c *testing.T) {
out, _, err := dockerCmdWithError("search", "--filter", "stars=a", "busybox")
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")
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")
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")
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) {

View file

@ -166,13 +166,13 @@ func (s *DockerSuite) TestVolumeCLILsFilterDangling(c *testing.T) {
func (s *DockerSuite) TestVolumeCLILsErrorWithInvalidFilterName(c *testing.T) {
out, _, err := dockerCmdWithError("volume", "ls", "-f", "FOO=123")
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) {
out, _, err := dockerCmdWithError("volume", "ls", "-f", "dangling=invalid")
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) {

View file

@ -32,7 +32,7 @@ type invalidFilter struct {
}
func (e invalidFilter) Error() string {
msg := "Invalid filter '" + e.filter
msg := "invalid filter '" + e.filter
if len(e.value) > 0 {
msg += fmt.Sprintf("=%s", e.value)
}

View file

@ -101,7 +101,7 @@ type invalidFilter struct {
}
func (e invalidFilter) Error() string {
msg := "Invalid filter '" + e.filter
msg := "invalid filter '" + e.filter
if e.value != nil {
msg += fmt.Sprintf("=%s", e.value)
}