@@ -409,8 +409,31 @@ func TestBuildMetrics(t *testing.T) {
409409 ResourceName : "arn:aws:elasticache:us-east-1:123456789012:cluster:redis-cluster" ,
410410 },
411411 {
412- //Check that if there is no data point for the latest timestamp it exports the previous one
413412 MetricName : "NetworkPacketsOut" ,
413+ MetricMigrationParams : model.MetricMigrationParams {
414+ NilToZero : true ,
415+ AddCloudwatchTimestamp : true ,
416+ ExportAllDataPoints : true ,
417+ },
418+ Namespace : "AWS/ElastiCache" ,
419+ Dimensions : []model.Dimension {
420+ {
421+ Name : "CacheClusterId" ,
422+ Value : "redis-cluster" ,
423+ },
424+ },
425+ GetMetricDataResult : & model.GetMetricDataResult {
426+ Statistic : "Average" ,
427+ Datapoints : []model.DatapointWithTimestamp {
428+ model .NewDataPoint (nil , ts ),
429+ model .NewDataPoint (aws .Float64 (5 ), ts .Add (- 1 * time .Minute )),
430+ model .NewDataPoint (aws .Float64 (6 ), ts .Add (- 2 * time .Minute )),
431+ },
432+ },
433+ ResourceName : "arn:aws:elasticache:us-east-1:123456789012:cluster:redis-cluster" ,
434+ },
435+ {
436+ MetricName : "NetworkMaxBytesIn" ,
414437 MetricMigrationParams : model.MetricMigrationParams {
415438 NilToZero : true ,
416439 AddCloudwatchTimestamp : true ,
@@ -530,6 +553,18 @@ func TestBuildMetrics(t *testing.T) {
530553 "dimension_CacheClusterId" : "redis-cluster" ,
531554 },
532555 },
556+ {
557+ Name : "aws_elasticache_network_packets_out_average" ,
558+ Value : 6 ,
559+ Timestamp : ts .Add (- 2 * time .Minute ),
560+ IncludeTimestamp : true ,
561+ Labels : map [string ]string {
562+ "account_id" : "123456789012" ,
563+ "name" : "arn:aws:elasticache:us-east-1:123456789012:cluster:redis-cluster" ,
564+ "region" : "us-east-1" ,
565+ "dimension_CacheClusterId" : "redis-cluster" ,
566+ },
567+ },
533568 },
534569 expectedLabels : map [string ]model.LabelSet {
535570 "aws_elasticache_cpuutilization_average" : {
0 commit comments