-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add healthcheck to tests #142
Conversation
Thanks for looking into improvements for the tests! I think this is a good approach 👍 . The alternative would be to have another This way we can check Have you checked already which of the stores need a check passed in the run command, and which provide one already in the image? Depending on that maybe we can do all at once in a single PR? |
none of those have healcheck:
yes, that is the idea, exactly. just need to add healthchecks to all the above |
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. @@ Coverage Diff @@
## master #142 +/- ##
=======================================
Coverage 65.26% 65.26%
=======================================
Files 25 25
Lines 2096 2096
=======================================
Hits 1368 1368
Misses 601 601
Partials 127 127 📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
8a07c2c
to
a6e7998
Compare
left to fix 4 dockers:
current problems:
|
Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
@philippgille I think is is ready to merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding so many health checks already! I think we can add some more:
- Consul:
curl http://localhost:8500/v1/health/state/passing | grep serfHealth
- Memcached is a bit more complex:
dockerCmd = `docker run -d --rm --name memcached -p 11211:11211 -u root --health-cmd='echo stats | nc -w 1 localhost 11211' memcached bash -c 'apt update && apt install -y netcat && docker-entrypoint.sh memcached -u memcache'`
And then we can also replace the time.Sleep(10 * time.Second)
to loop over the docker inspect ...
, right? And we can detect the containers that don't have a healthcheck by looking at the inspect output, which is empty (instead of starting
/healthy
) I guess, and then we do a single 10s sleep, or so?
do you think the existing PR is mergable or you want to resolve those 3 above first ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bitnami/consul
doesn;t have curl
I tested it locally with bitnami/consul
and it had curl (otherwise I wouldn't have suggested it), but just checked again and it was a cached image from 2022-05-08. The latest one indeed doesn't have it anymore.
- i don't like running
apt install
during runtime...
I wouldn't do it for a container that's running in production, but for tests in CI I think it's fine.
- agree once we have healthchecks, removing sleep and waiting for health ready status
I think we can already benefit from it, without waiting on all containers having a health check.
do you think the existing PR is mergable or you want to resolve those 3 above first ?
OK 👌 , I'll handle the remaining tasks in follow-up PRs.
Thanks a lot for the contribution!
for this TODO:
gokv/magefiles/test.go
Line 125 in bfdf6b8
this is how it looks like now with new addition, note
healthy
:Signed-off-by: Boris Glimcher Boris.Glimcher@emc.com