Skip to content

int-cli/TestSearchCmdOptions: fix#39243

Merged
thaJeztah merged 1 commit intomoby:masterfrom
kolyshkin:TestSearchCmdOptions
May 21, 2019
Merged

int-cli/TestSearchCmdOptions: fix#39243
thaJeztah merged 1 commit intomoby:masterfrom
kolyshkin:TestSearchCmdOptions

Conversation

@kolyshkin
Copy link
Contributor

@kolyshkin kolyshkin commented May 21, 2019

Sometimes this test fails (allegedly due to problems with Docker Hub, see #26633),
but it fails later than it should, for example:

01:20:34.845 assertion failed: expression is false: strings.Count(outSearchCmdStars, "[OK]") <= strings.Count(outSearchCmd, "[OK]"): The quantity of images with stars should be less than that of all images: <...>

This, with non-empty list of images following, means that the initial
docker search busybox command returned not enough results. So, add
a check that docker search busybox returns something.

While at it,

  • raise the number of stars to 10;
  • simplify check for number of lines (no need to count [OK]'s);
  • improve error message.

@codecov
Copy link

codecov bot commented May 21, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@9808f60). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master   #39243   +/-   ##
=========================================
  Coverage          ?   37.05%           
=========================================
  Files             ?      612           
  Lines             ?    45487           
  Branches          ?        0           
=========================================
  Hits              ?    16857           
  Misses            ?    26342           
  Partials          ?     2288

@kolyshkin kolyshkin changed the title [DO NOT MERGE] int-cli/TestSearchCmdOptions: fix int-cli/TestSearchCmdOptions: fix May 21, 2019
Sometimes this test fails (allegedly due to problems with Docker Hub),
but it fails later than it should, for example:

> 01:20:34.845 assertion failed: expression is false: strings.Count(outSearchCmdStars, "[OK]") <= strings.Count(outSearchCmd, "[OK]"): The quantity of images with stars should be less than that of all images: <...>

This, with non-empty list of images following, means that the initial
`docker search busybox` command returned not enough results. So, add
a check that `docker search busybox` returns something.

While at it,
 * raise the number of stars to 10;
 * simplify check for number of lines (no need to count [OK]'s);
 * improve error message.

Signed-off-by: Kir Kolyshkin <[email protected]>
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I think (most of) these tests could be converted to a unit test (i.e., just verify we create the expected request, and filtering could be done with a fixture response), because right now we're mainly testing if Docker Hub works 🤷‍♂

@thaJeztah
Copy link
Member

Test passed on Janky and experimental;

09:49:16 PASS: docker_cli_search_test.go:47: DockerSuite.TestSearchCmdOptions	4.119s

@thaJeztah
Copy link
Member

Power and s390 also passed on that test; bringing this one in to unblock CI

@thaJeztah thaJeztah merged commit 850b5d9 into moby:master May 21, 2019
@thaJeztah thaJeztah added this to the 20.03.0 milestone Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants