test/plugin/test_in_cloudwatch.rb in fluent-plugin-cloudwatch-1.0.0 vs test/plugin/test_in_cloudwatch.rb in fluent-plugin-cloudwatch-1.1.0

- old
+ new

@@ -3,23 +3,63 @@ class CloudwatchInputTest < Test::Unit::TestCase def setup Fluent::Test.setup end - CONFIG = %[ + ### for RDS + CONFIG_RDS = %[ + tag cloudwatch + aws_key_id test_key_id + aws_sec_key test_sec_key + cw_endpoint test_cloud_watch_endpoint + namespace AWS/RDS + metric_name CPUUtilization,FreeStorageSpace,DiskQueueDepth,FreeableMemory,SwapUsage,ReadIOPS,ReadLatency,ReadThroughput,WriteIOPS,WriteLatency,WriteThroughput + dimensions_name DBInstanceIdentifier + dimensions_value rds01 ] - def create_driver(conf = CONFIG, tag = 'test') + def create_driver_rds(conf = CONFIG_RDS) Fluent::Test::InputTestDriver.new(Fluent::CloudwatchInput).configure(conf) end - def test_configure + def test_configure_rds + d = create_driver_rds + assert_equal 'cloudwatch', d.instance.tag + assert_equal 'test_key_id', d.instance.aws_key_id + assert_equal 'test_sec_key', d.instance.aws_sec_key + assert_equal 'test_cloud_watch_endpoint', d.instance.cw_endpoint + assert_equal 'AWS/RDS', d.instance.namespace + assert_equal 'CPUUtilization,FreeStorageSpace,DiskQueueDepth,FreeableMemory,SwapUsage,ReadIOPS,ReadLatency,ReadThroughput,WriteIOPS,WriteLatency,WriteThroughput', d.instance.metric_name + assert_equal 'DBInstanceIdentifier', d.instance.dimensions_name + assert_equal 'rds01', d.instance.dimensions_value end - def test_format - d = create_driver + + ### for EC2 + CONFIG_ECTWO = %[ + tag cloudwatch + aws_key_id test_key_id + aws_sec_key test_sec_key + cw_endpoint test_cloud_watch_endpoint + namespace AWS/EC2 + metric_name CPUUtilization,FreeStorageSpace,DiskQueueDepth,FreeableMemory,SwapUsage,ReadIOPS,ReadLatency,ReadThroughput,WriteIOPS,WriteLatency,WriteThroughput + dimensions_name InstanceId + dimensions_value ec2-01 + ] + + def create_driver_ectwo(conf = CONFIG_ECTWO) + Fluent::Test::InputTestDriver.new(Fluent::CloudwatchInput).configure(conf) end - def test_write - d = create_driver + def test_configure_ectwo + d = create_driver_ectwo + assert_equal 'cloudwatch', d.instance.tag + assert_equal 'test_key_id', d.instance.aws_key_id + assert_equal 'test_sec_key', d.instance.aws_sec_key + assert_equal 'test_cloud_watch_endpoint', d.instance.cw_endpoint + assert_equal 'AWS/EC2', d.instance.namespace + assert_equal 'CPUUtilization,FreeStorageSpace,DiskQueueDepth,FreeableMemory,SwapUsage,ReadIOPS,ReadLatency,ReadThroughput,WriteIOPS,WriteLatency,WriteThroughput', d.instance.metric_name + assert_equal 'InstanceId', d.instance.dimensions_name + assert_equal 'ec2-01', d.instance.dimensions_value end + end