def test_read():
    """
    Tests the read() method of the collectd plugin. This codepath exercises
    most of the code in the plugin.
    """
    couchbase.config(mock_config_nodes)
    couchbase.config(mock_config_bucket)
    couchbase.read()
예제 #2
0
def test_config_unsupported_collect_target_fail():
    """
    Check for exception when required params are not specified
    """
    with pytest.raises(ValueError):
        couchbase.config(fail_mock_config_unsupported_collect_target)

    couchbase.CONFIGS = []
예제 #3
0
def test_config_nodes_fail():
    """
    Check for exception when required params are not specified
    """
    with pytest.raises(ValueError):
        couchbase.config(fail_mock_config_required_params)

    couchbase.CONFIGS = []
def test_config_nodes_fail():
    """
    Check for exception when required params are not specified
    """
    with pytest.raises(ValueError):
        couchbase.config(fail_mock_config_required_params)

    couchbase.CONFIGS = []
def test_config_unsupported_collect_target_fail():
    """
    Check for exception when required params are not specified
    """
    with pytest.raises(ValueError):
        couchbase.config(fail_mock_config_unsupported_collect_target)

    couchbase.CONFIGS = []
예제 #6
0
def test_read():
    """
    Tests the read() method of the collectd plugin. This codepath exercises
    most of the code in the plugin.
    """
    couchbase.config(mock_config_nodes)
    couchbase.config(mock_config_bucket)
    couchbase.read()
예제 #7
0
def test_read():
    """
    Tests the read() method of the collectd plugin. This codepath exercises
    most of the code in the plugin.
    """
    couchbase.read_node_stats(
        couchbase.config(mock_config_nodes, testing="yes"))
    couchbase.read_bucket_stats(
        couchbase.config(mock_config_bucket, testing="yes"))
예제 #8
0
def test_read():
    """
    Tests the read() method of the collectd plugin. This codepath exercises
    most of the code in the plugin.
    """
    couchbase.read_node_stats(couchbase.config(mock_config_nodes,
                                               testing="yes"))
    couchbase.read_bucket_stats(couchbase.config(mock_config_bucket,
                                                 testing="yes"))
예제 #9
0
def test_config_bucket_fail():
    """
    Check for exception when bucket name param (CollectBucket)
    are not specified
    """
    with pytest.raises(ValueError):
        couchbase.config(fail_mock_config_required_params_for_bucket)

    couchbase.CONFIGS = []
def test_config_bucket_fail():
    """
    Check for exception when bucket name param (CollectBucket)
    are not specified
    """
    with pytest.raises(ValueError):
        couchbase.config(fail_mock_config_required_params_for_bucket)

    couchbase.CONFIGS = []
예제 #11
0
def test_config_bucket():
    """
    Check read params from config included bucket configuration
    """

    couchbase.config(mock_config_bucket)
    assert couchbase.CONFIGS[0]['plugin_config']['CollectTarget'] == 'BUCKET'
    assert couchbase.CONFIGS[0]['plugin_config']['Host'] == 'localhost'
    assert couchbase.CONFIGS[0]['plugin_config']['Port'] == '8091'
    assert couchbase.CONFIGS[0]['collect_mode'] == 'detailed'
    assert couchbase.CONFIGS[0]['interval'] == '10'
    assert couchbase.CONFIGS[0]['collect_bucket'] == 'default'
    assert couchbase.CONFIGS[0]['username'] == 'username'
    assert couchbase.CONFIGS[0]['password'] == 'password'

    assert couchbase.CONFIGS[0]['api_urls']['bucket'] is not None
    assert couchbase.CONFIGS[0]['api_urls']['bucket_stat'] is not None
    couchbase.CONFIGS = []
예제 #12
0
def test_config_node():
    """
    Check read params from config
    """

    couchbase.config(mock_config_nodes)
    assert couchbase.CONFIGS[0]['plugin_config']['CollectTarget'] == 'NODE'
    assert couchbase.CONFIGS[0]['plugin_config']['Host'] == 'localhost'
    assert couchbase.CONFIGS[0]['plugin_config']['Port'] == '8091'
    assert couchbase.CONFIGS[0]['collect_mode'] == 'detailed'
    assert couchbase.CONFIGS[0]['interval'] == '10'
    assert couchbase.CONFIGS[0]['collect_bucket'] is None
    assert couchbase.CONFIGS[0]['username'] == ''
    assert couchbase.CONFIGS[0]['password'] == ''

    assert couchbase.CONFIGS[0]['api_urls']['node'] is not None

    couchbase.CONFIGS = []
def test_config_field_length():
    """
    Check read params from config included bucket configuration
    """

    couchbase.config(mock_config_field_length)
    assert couchbase.CONFIGS[0]['plugin_config']['CollectTarget'] == 'BUCKET'
    assert couchbase.CONFIGS[0]['plugin_config']['Host'] == 'localhost'
    assert couchbase.CONFIGS[0]['plugin_config']['Port'] == '8091'
    assert couchbase.CONFIGS[0]['collect_mode'] == 'detailed'
    assert couchbase.CONFIGS[0]['interval'] == '10'
    assert couchbase.CONFIGS[0]['collect_bucket'] == 'default'
    assert couchbase.CONFIGS[0]['username'] == 'username'
    assert couchbase.CONFIGS[0]['password'] == 'password'

    assert couchbase.CONFIGS[0]['field_length'] == 1024

    couchbase.CONFIGS = []
def test_config_bucket():
    """
    Check read params from config included bucket configuration
    """

    couchbase.config(mock_config_bucket)
    assert couchbase.CONFIGS[0]['plugin_config']['CollectTarget'] == 'BUCKET'
    assert couchbase.CONFIGS[0]['plugin_config']['Host'] == 'localhost'
    assert couchbase.CONFIGS[0]['plugin_config']['Port'] == '8091'
    assert couchbase.CONFIGS[0]['collect_mode'] == 'detailed'
    assert couchbase.CONFIGS[0]['interval'] == '10'
    assert couchbase.CONFIGS[0]['collect_bucket'] == 'default'
    assert couchbase.CONFIGS[0]['username'] == 'username'
    assert couchbase.CONFIGS[0]['password'] == 'password'

    assert couchbase.CONFIGS[0]['api_urls']['bucket'] is not None
    assert couchbase.CONFIGS[0]['api_urls']['bucket_stat'] is not None
    couchbase.CONFIGS = []
def test_config_node():
    """
    Check read params from config
    """

    couchbase.config(mock_config_nodes)
    assert couchbase.CONFIGS[0]['plugin_config']['CollectTarget'] == 'NODE'
    assert couchbase.CONFIGS[0]['plugin_config']['Host'] == 'localhost'
    assert couchbase.CONFIGS[0]['plugin_config']['Port'] == '8091'
    assert couchbase.CONFIGS[0]['collect_mode'] == 'detailed'
    assert couchbase.CONFIGS[0]['interval'] == '10'
    assert couchbase.CONFIGS[0]['collect_bucket'] is None
    assert couchbase.CONFIGS[0]['username'] == ''
    assert couchbase.CONFIGS[0]['password'] == ''

    assert couchbase.CONFIGS[0]['api_urls']['node'] is not None

    couchbase.CONFIGS = []
예제 #16
0
def test_config_field_length():
    """
    Check read params from config included bucket configuration
    """

    couchbase.config(mock_config_field_length)
    assert couchbase.CONFIGS[0]['plugin_config']['CollectTarget'] == 'BUCKET'
    assert couchbase.CONFIGS[0]['plugin_config']['Host'] == 'localhost'
    assert couchbase.CONFIGS[0]['plugin_config']['Port'] == '8091'
    assert couchbase.CONFIGS[0]['collect_mode'] == 'detailed'
    assert couchbase.CONFIGS[0]['interval'] == '10'
    assert couchbase.CONFIGS[0]['collect_bucket'] == 'default'
    assert couchbase.CONFIGS[0]['username'] == 'username'
    assert couchbase.CONFIGS[0]['password'] == 'password'

    assert couchbase.CONFIGS[0]['field_length'] == 1024

    couchbase.CONFIGS = []
예제 #17
0
def test_config_bucket():
    """
    Check read params from config included bucket configuration
    """

    module_config = couchbase.config(mock_config_bucket, testing="yes")
    assert module_config['plugin_config']['CollectTarget'] == 'BUCKET'
    assert module_config['plugin_config']['Host'] == 'localhost'
    assert module_config['plugin_config']['Port'] == '3000'
    assert module_config['collect_mode'] == 'detailed'
    assert module_config['interval'] == '10'
    assert module_config['collect_bucket'] == 'default'
    assert module_config['base_url'] == 'http://localhost:3000'
    assert module_config['cluster_name'] == 'SignalFxTestCouchbaseCluster'
예제 #18
0
def test_config_bucket():
    """
    Check read params from config included bucket configuration
    """

    module_config = couchbase.config(mock_config_bucket, testing="yes")
    assert module_config['plugin_config']['CollectTarget'] == 'BUCKET'
    assert module_config['plugin_config']['Host'] == 'localhost'
    assert module_config['plugin_config']['Port'] == '3000'
    assert module_config['collect_mode'] == 'detailed'
    assert module_config['interval'] == '10'
    assert module_config['collect_bucket'] == 'default'
    assert module_config['base_url'] == 'http://localhost:3000'
    assert module_config['cluster_name'] == 'SignalFxTestCouchbaseCluster'
예제 #19
0
def test_config_field_length():
    """
    Check read params from config included bucket configuration
    """

    module_config = couchbase.config(mock_config_field_length, testing="yes")
    assert module_config['plugin_config']['CollectTarget'] == 'BUCKET'
    assert module_config['plugin_config']['Host'] == 'localhost'
    assert module_config['plugin_config']['Port'] == '3000'
    assert module_config['collect_mode'] == 'detailed'
    assert module_config['interval'] == '10'
    assert module_config['collect_bucket'] == 'default'
    assert module_config['username'] == 'username'
    assert module_config['password'] == 'password'
    assert module_config['field_length'] == 1024
예제 #20
0
def test_config_field_length():
    """
    Check read params from config included bucket configuration
    """

    module_config = couchbase.config(mock_config_field_length, testing="yes")
    assert module_config['plugin_config']['CollectTarget'] == 'BUCKET'
    assert module_config['plugin_config']['Host'] == 'localhost'
    assert module_config['plugin_config']['Port'] == '3000'
    assert module_config['collect_mode'] == 'detailed'
    assert module_config['interval'] == '10'
    assert module_config['collect_bucket'] == 'default'
    assert module_config['username'] == 'username'
    assert module_config['password'] == 'password'
    assert module_config['field_length'] == 1024
예제 #21
0
def test_config_node():
    """
    Check read params from config
    """

    module_config = couchbase.config(mock_config_nodes, testing="yes")
    assert module_config['plugin_config']['CollectTarget'] == 'NODE'
    assert module_config['plugin_config']['Host'] == 'localhost'
    assert module_config['plugin_config']['Port'] == '3000'
    assert module_config['collect_mode'] == 'detailed'
    assert module_config['interval'] == '10'
    assert module_config['username'] == ''
    assert module_config['password'] == ''
    assert module_config['collect_bucket'] is None
    assert module_config['base_url'] == 'http://localhost:3000'
    assert module_config['cluster_name'] == 'SignalFxTestCouchbaseCluster'
예제 #22
0
def test_config_node():
    """
    Check read params from config
    """

    module_config = couchbase.config(mock_config_nodes, testing="yes")
    assert module_config['plugin_config']['CollectTarget'] == 'NODE'
    assert module_config['plugin_config']['Host'] == 'localhost'
    assert module_config['plugin_config']['Port'] == '3000'
    assert module_config['collect_mode'] == 'detailed'
    assert module_config['interval'] == '10'
    assert module_config['username'] == ''
    assert module_config['password'] == ''
    assert module_config['collect_bucket'] is None
    assert module_config['base_url'] == 'http://localhost:3000'
    assert module_config['cluster_name'] == 'SignalFxTestCouchbaseCluster'