瀏覽代碼

fix prometheus annotation, reflect API change

Mitsuhiro Tanda 10 年之前
父節點
當前提交
ee84d4371b
共有 1 個文件被更改,包括 12 次插入6 次删除
  1. 12 6
      public/app/plugins/datasource/prometheus/specs/datasource_specs.ts

+ 12 - 6
public/app/plugins/datasource/prometheus/specs/datasource_specs.ts

@@ -162,11 +162,17 @@ describe('PrometheusDatasource', function() {
     var urlExpected = 'proxied/api/v1/query_range?query=' +
                       encodeURIComponent('ALERTS{alertstate="firing"}') +
                       '&start=1443438675&end=1443460275&step=60s';
-    var annotation = {
-      expr: 'ALERTS{alertstate="firing"}',
-      tagKeys: 'job',
-      titleFormat: '{{alertname}}',
-      textFormat: '{{instance}}'
+    var options = {
+      annotation: {
+        expr: 'ALERTS{alertstate="firing"}',
+        tagKeys: 'job',
+        titleFormat: '{{alertname}}',
+        textFormat: '{{instance}}'
+      },
+      range: {
+        from: moment(1443438674760),
+        to: moment(1443460274760)
+      }
     };
     var response = {
       status: "success",
@@ -180,7 +186,7 @@ describe('PrometheusDatasource', function() {
     };
     beforeEach(function() {
       ctx.$httpBackend.expect('GET', urlExpected).respond(response);
-      ctx.ds.annotationQuery(annotation, {from: moment(1443438674760), to: moment(1443460274760)}).then(function(data) { results = data; });
+      ctx.ds.annotationQuery(options).then(function(data) { results = data; });
       ctx.$httpBackend.flush();
     });
     it('should return annotation list', function() {