Add tests to verify percentile counts.

This commit is contained in:
Mike Heffner 2013-12-10 18:21:58 -05:00
Родитель 750ce576a3
Коммит cd47d32c53
1 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -90,12 +90,13 @@ module.exports = {
test.done();
},
timers_single_time_multiple_percentiles: function(test) {
test.expect(6);
test.expect(7);
this.metrics.timers['a'] = [100];
this.metrics.timer_counters['a'] = 1;
this.metrics.pctThreshold = [90, 80];
pm.process_metrics(this.metrics, 100, this.time_stamp, function(){});
timer_data = this.metrics.timer_data['a'];
test.equal(1, timer_data.count_90);
test.equal(100, timer_data.mean_90);
test.equal(100, timer_data.upper_90);
test.equal(100, timer_data.sum_90);
@ -105,27 +106,32 @@ module.exports = {
test.done();
},
timers_multiple_times_single_percentiles: function(test) {
test.expect(3);
test.expect(4);
this.metrics.timers['a'] = [100, 200, 300];
this.metrics.timer_counters['a'] = 3;
this.metrics.pctThreshold = [90];
pm.process_metrics(this.metrics, 100, this.time_stamp, function(){});
timer_data = this.metrics.timer_data['a'];
test.equal(3, timer_data.count_90);
test.equal(200, timer_data.mean_90);
test.equal(300, timer_data.upper_90);
test.equal(600, timer_data.sum_90);
test.done();
},
timers_multiple_times_multiple_percentiles: function(test) {
test.expect(6);
test.expect(9);
this.metrics.timers['a'] = [100, 200, 300];
this.metrics.timer_counters['a'] = 3;
this.metrics.pctThreshold = [90, 80];
pm.process_metrics(this.metrics, 100, this.time_stamp, function(){});
timer_data = this.metrics.timer_data['a'];
test.equal(3, timer_data.count);
test.equal(3, timer_data.count_90);
test.equal(200, timer_data.mean_90);
test.equal(300, timer_data.upper_90);
test.equal(600, timer_data.sum_90);
test.equal(2, timer_data.count_80);
test.equal(150, timer_data.mean_80);
test.equal(200, timer_data.upper_80);
test.equal(300, timer_data.sum_80);