From 5b01e9ec971b2744c4e1e152076ae4f096e0302c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 22 Oct 2015 16:58:31 -0400 Subject: [PATCH] fix(elasticsearch): minor fix to elasticsearch unit tests so that they work in any timezone, fixes #3010 --- .../plugins/datasource/elasticsearch/specs/datasource_specs.ts | 2 +- .../datasource/elasticsearch/specs/index_pattern_specs.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts b/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts index a5e55abe4dd..584f915a86d 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts @@ -36,7 +36,7 @@ describe('ElasticDatasource', function() { ctx.ds.testDatasource(); ctx.$rootScope.$apply(); - var today = moment().format("YYYY.MM.DD"); + var today = moment.utc().format("YYYY.MM.DD"); expect(requestOptions.url).to.be("http://es.com/asd-" + today + '/_stats'); }); }); diff --git a/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts b/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts index 8f662bb075f..1a19b550f4e 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts @@ -11,7 +11,7 @@ describe('IndexPattern', function() { describe('when getting index for today', function() { it('should return correct index name', function() { var pattern = new IndexPattern('[asd-]YYYY.MM.DD', 'Daily'); - var expected = 'asd-' + moment().format('YYYY.MM.DD'); + var expected = 'asd-' + moment.utc().format('YYYY.MM.DD'); expect(pattern.getIndexForToday()).to.be(expected); });