The Wayback Machine - https://web.archive.org/web/20260314084443/https://github.com/moby/moby/pull/35940
Skip to content

Fix issue of filter in docker ps where health=starting returns nothing#35940

Merged
vdemeester merged 2 commits intomoby:masterfrom
yongtang:35920-filter-health-starting
Jan 10, 2018
Merged

Fix issue of filter in docker ps where health=starting returns nothing#35940
vdemeester merged 2 commits intomoby:masterfrom
yongtang:35920-filter-health-starting

Conversation

@yongtang
Copy link
Member

@yongtang yongtang commented Jan 5, 2018

- What I did

This fix tries to address the issue raised in 35920 where the filter of docker ps with health=starting always returns nothing.

- How I did it

The issue was that in container view, the human readable string (HealthString() => Health.String()) of health status was used. In case of starting it is "health: starting". However, the filter still uses starting so no match returned.

This fix fixes the issue by using container.Health.Status() instead so that it matches the string (starting) passed by filter.

- How to verify it

An integration test has been added.

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

arhero-rabbits-20161209

This fix fixes #35920.

Signed-off-by: Yong Tang yong.tang.github@outlook.com

…thing

This fix tries to address the issue raised in 35920 where the filter
of `docker ps` with  `health=starting` always returns nothing.

The issue was that in container view, the human readable string (`HealthString()` => `Health.String()`)
of health status was used. In case of starting it is `"health: starting"`.
However, the filter still uses `starting` so no match returned.

This fix fixes the issue by using `container.Health.Status()` instead so that it matches
the string (`starting`) passed by filter.

This fix fixes 35920.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
@yongtang yongtang force-pushed the 35920-filter-health-starting branch from d422a1b to 0bb2b6f Compare January 5, 2018 05:19
Copy link
Member

Choose a reason for hiding this comment

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

I believe this was the only place that (s *State) HealthString() was called, so please remove that method.

Copy link
Member

Choose a reason for hiding this comment

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

This change seems like it could be easily tested with a unit test of transform() instead of an integration test.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
@yongtang yongtang force-pushed the 35920-filter-health-starting branch from 0bb2b6f to f509a54 Compare January 7, 2018 05:11
@yongtang
Copy link
Member Author

yongtang commented Jan 7, 2018

Thanks @dnephin for the review. The PR has been updated with unit test. Please take a look.

Copy link
Member

@dnephin dnephin left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@boaz0 boaz0 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@vdemeester vdemeester merged commit 7c7a7c7 into moby:master Jan 10, 2018
@yongtang yongtang deleted the 35920-filter-health-starting branch January 10, 2018 13:24
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.

Docker ps: filter container by health=starting

6 participants