-
Notifications
You must be signed in to change notification settings - Fork 287
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
List all gear units including dead ones #262
Conversation
# XXX: Real units take a while to start up and die. I need to a way | ||
# to check for the death of a unit when running these tests against | ||
# the real GearClient (perhaps by calling `systemctl status`) but | ||
# not when running unit tests against FakeGearClient. |
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.
Poll docker until the process goes away, maybe?
Address and merge, or put up for review if you're still not sure about the testing mechanism. |
Thanks @itamarst
Not sure whether I need tests for other previously unlisted states given the comment in openshift/geard#228 (comment) Putting up for another review because I've changed quite a lot. |
I'm also not sure exactly which "stopped" units were already being listed, prior to this change. In http://lists.openshift.redhat.com/openshift-archives/users/2014-July/msg00006.html the implication is that units that "stop cleanly" wouldn't normally be listed, but actually we've already got a test for units that have been explicitly stopped via the Gear API. I guess in that case (that test) the systemd unit exits with a non-zero code: |
Ok. I'm going to merge after discussion with @itamarst
|
I've added the
?all=1
to the gear list url and added a test which demonstrates the effect.But I'm not entirely sure which extra states are included by making that change.
For example
failed
units (eg units created with a non-existent docker image name) are listed anyway.I'm also not sure how units get into the
dead
state. The example in my test (and the example that @itamarst used in #208 (comment)) recreate the dead state by creating a gear unit using the busybox image which exits immediately with a 0 status code. I'd have thought that systemd would attempt to restart such units a few times before marking them failed, but that doesn't seem to happen.I also need some guidance around how to wait for the unit-under-test to reach the
dead
state. I can test the current state usingsystemctl
, but that won't make any sense when running these tests against the FakeGearClient.Perhaps this particular test should be move to the implementation specific
flocker.node.functional.test_gear.GearClientTests
case.Fixes: #208