From ea704306a0abeb68b381f95f85c228c2690374f6 Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Wed, 20 Sep 2017 00:45:07 +0900 Subject: [PATCH] fix test --- .../cloudwatch/specs/datasource_specs.ts | 54 +++---------------- 1 file changed, 8 insertions(+), 46 deletions(-) diff --git a/public/app/plugins/datasource/cloudwatch/specs/datasource_specs.ts b/public/app/plugins/datasource/cloudwatch/specs/datasource_specs.ts index a326a49e1de..15eafadbb8f 100644 --- a/public/app/plugins/datasource/cloudwatch/specs/datasource_specs.ts +++ b/public/app/plugins/datasource/cloudwatch/specs/datasource_specs.ts @@ -336,24 +336,20 @@ describe('CloudWatchDatasource', function() { describeMetricFindQuery('dimension_values(us-east-1,AWS/EC2,CPUUtilization,InstanceId)', scenario => { scenario.setup(() => { scenario.requestResponse = { - Metrics: [ - { - Namespace: 'AWS/EC2', - MetricName: 'CPUUtilization', - Dimensions: [ - { - Name: 'InstanceId', - Value: 'i-12345678' - } + results: { + metricFindQuery: { + tables: [ + { rows: [['i-12345678', 'i-12345678']] } ] } - ] + } }; }); it('should call __ListMetrics and return result', () => { - expect(scenario.result[0].text).to.be('i-12345678'); - expect(scenario.request.data.action).to.be('ListMetrics'); + expect(scenario.result[0].text).to.contain('i-12345678'); + expect(scenario.request.queries[0].type).to.be('metricFindQuery'); + expect(scenario.request.queries[0].subtype).to.be('dimension_values'); }); }); @@ -433,38 +429,4 @@ describe('CloudWatchDatasource', function() { } }); - describeMetricFindQuery('ec2_instance_attribute(us-east-1, Tags.Name, { "tag:team": [ "sysops" ] })', scenario => { - scenario.setup(() => { - scenario.requestResponse = { - Reservations: [ - { - Instances: [ - { - Tags: [ - { Key: 'InstanceId', Value: 'i-123456' }, - { Key: 'Name', Value: 'Sysops Dev Server' }, - { Key: 'env', Value: 'dev' }, - { Key: 'team', Value: 'sysops' } - ] - }, - { - Tags: [ - { Key: 'InstanceId', Value: 'i-789012' }, - { Key: 'Name', Value: 'Sysops Staging Server' }, - { Key: 'env', Value: 'staging' }, - { Key: 'team', Value: 'sysops' } - ] - } - ] - } - ] - }; - }); - - it('should return the "Name" tag for each instance', function() { - expect(scenario.result[0].text).to.be('Sysops Dev Server'); - expect(scenario.result[1].text).to.be('Sysops Staging Server'); - }); - }); - });