-
Notifications
You must be signed in to change notification settings - Fork 814
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
[etcd] service check & test #1379
Conversation
degemer
commented
Feb 18, 2015
- send a service check on success and on failure (previously only on failure)
- add a basic test copied from fluentd one
@@ -112,4 +112,5 @@ def get_json(self, url, timeout): | |||
tags = ["url:{}".format(url)]) | |||
return None | |||
|
|||
self.service_check(self.SERVICE_CHECK_NAME, AgentCheck.OK, tags=["url:{}".format(url)]) |
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.
Watchout, you'll end up sending two statuses per iteration, one for get_self_metrics and one for get_store_metrics.
Can you ensure to only send one status per iteration per instance ?
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.
You need to use {0}
otherwise this is not python 2.6 comptible
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.
@remh: indeed, fixed now.
@LeoCavaille: also fixed. (and thanks for the explanation)
eaccce4
to
929d73b
Compare
Finally send one and only one service_checks, thanks to @remh . |
And not only CRITICAL when unable to get metrics. This is needed as the service check won't appear on the monitor screen otherwise. Fix python2.6 compatibility issue: "{}".format()
929d73b
to
546668b
Compare
end | ||
|
||
task :cleanup => ['ci:common:cleanup'] do | ||
sh %(rm -rf $VOLATILE_DIR/etcd* || echo 'etcd not running') |
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.
You don't need to clean up VOLATILE_DIR
it's already taken care of by the common cleanup task.
However, you might want to kill the etcd daemon you launched in the before_script
stage, either by using a pidfile if you can have one or by using an appropriate kill command.
Copied from the apache/riackcs tests, using the AgentCheckTest.
546668b
to
3f537dc
Compare
Add assertServiceCheck (same principle than assertMetrics) in AgentCheckTest. If service_checks does not exist, retrieve latest data from AgentCheckTest.check.
9f6fa62
to
ad405a2
Compare
Because of the changes in AgentCheckTest, old test was failing (because of the new error catch and reraise in run_check). It now uses assertServiceCheck.
LGTM 👍 |
[etcd] service check & test
Changes Unknown when pulling af75929 on quentin/etcd-service_check into * on master*. |
Changes Unknown when pulling af75929 on quentin/etcd-service_check into * on master*. |