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()
Exemplo n.º 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 = []
Exemplo n.º 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 = []
Exemplo n.º 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()
Exemplo n.º 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"))
Exemplo n.º 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"))
Exemplo n.º 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 = []
Exemplo n.º 10
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 = []
Exemplo n.º 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 = []
Exemplo n.º 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 = []
Exemplo n.º 13
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 = []
Exemplo n.º 14
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 = []
Exemplo n.º 15
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 = []
Exemplo n.º 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 = []
Exemplo n.º 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'
Exemplo n.º 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'
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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'
Exemplo n.º 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'