2018-04-13 14:15:14 +02:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
# not use this file except in compliance with the License. You may obtain
|
|
|
|
# a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
|
2014-02-28 10:19:02 -07:00
|
|
|
import unittest
|
|
|
|
from tests.common import load_check
|
2014-04-30 16:21:39 -06:00
|
|
|
from nose.plugins.skip import SkipTest
|
|
|
|
|
2014-02-28 10:19:02 -07:00
|
|
|
|
|
|
|
class CouchDBTestCase(unittest.TestCase):
|
|
|
|
|
|
|
|
def testMetrics(self):
|
2014-04-30 16:21:39 -06:00
|
|
|
raise SkipTest('Require CouchDB')
|
2014-02-28 10:19:02 -07:00
|
|
|
config = {
|
|
|
|
'instances': [{
|
|
|
|
'server': 'http://localhost:5984',
|
|
|
|
}]
|
|
|
|
}
|
2014-05-06 09:55:15 -06:00
|
|
|
agent_config = {
|
2014-02-28 10:19:02 -07:00
|
|
|
'version': '0.1',
|
|
|
|
'api_key': 'toto'
|
|
|
|
}
|
|
|
|
|
2014-05-06 09:55:15 -06:00
|
|
|
self.check = load_check('couch', config, agent_config)
|
2014-02-28 10:19:02 -07:00
|
|
|
|
|
|
|
self.check.check(config['instances'][0])
|
|
|
|
|
|
|
|
metrics = self.check.get_metrics()
|
2014-07-02 11:24:50 -07:00
|
|
|
self.assertTrue(isinstance(metrics, list), metrics)
|
2014-02-28 10:19:02 -07:00
|
|
|
self.assertTrue(len(metrics) > 3)
|
2014-07-01 14:27:12 -07:00
|
|
|
self.assertTrue(
|
|
|
|
len([k for k in metrics if "instance:http://localhost:5984" in k[3]['dimensions']]) > 3)
|