harness 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45b1ba669c00fddf944318514aaae8cc3184d43a
4
- data.tar.gz: 7aab2e9ccd8d860dff8eab3ce29ed1aba54e8c20
3
+ metadata.gz: 331d4b6080058b3d3691dbba570c2fd997a07d6b
4
+ data.tar.gz: 305a235a8ab89e07bd091dc381876ff9c4a7e656
5
5
  SHA512:
6
- metadata.gz: e1b748e7ecbcf4a6c29da4b05835b60c1303865bacc4c0c6e9355399d25103e25624623394104a7b3f74f67b6f4ac264773dd4e1e5e30908b71056e381611914
7
- data.tar.gz: 83bcf438c22c5a36a9b79cd1a4bb1449ab16dc11e698bff1ab85b6b82c6d9d04e31c82c23b08f9ad9b510846908ab5727272da1da66c5239b5634f474cc38f46
6
+ metadata.gz: ba1e3dbeeeafcdb43c21099b98ccda432c660b23d1f3cf130450a2c924d0894c527e5f66b94799c1e38d2025f3bc31b1ccf1638d667976b2c624805362b6f743
7
+ data.tar.gz: a6810d20de6134b3c1c43ff2aacec5d1e273248aaa6be557c771490f8c3da06fdd65f1cb5d6533683b0827378fc7891bee0c84bf74a60cbb7a035c897721ce87
@@ -76,10 +76,14 @@ module Harness
76
76
  end
77
77
 
78
78
  def self.reset_counters!
79
- redis.smembers('counters').each do |counter|
79
+ counters.each do |counter|
80
80
  redis.set counter, 0
81
81
  end
82
82
  end
83
+
84
+ def self.counters
85
+ redis.keys "counters/*"
86
+ end
83
87
  end
84
88
 
85
89
  require 'harness/measurement'
@@ -13,16 +13,14 @@ module Harness
13
13
 
14
14
  counter.id ||= event.name
15
15
 
16
- Harness.redis.sadd 'counters', counter.id
17
-
18
16
  if event.payload[:counter].is_a? Fixnum
19
17
  counter.value = event.payload[:counter]
20
18
  end
21
19
 
22
20
  if counter.value
23
- Harness.redis.set counter.id, counter.value
21
+ Harness.redis.set "counters/#{counter.id}", counter.value
24
22
  else
25
- counter.value = Harness.redis.incr(counter.id).to_i
23
+ counter.value = Harness.redis.incr("counters/#{counter.id}").to_i
26
24
  end
27
25
 
28
26
  counter
@@ -1,3 +1,3 @@
1
1
  module Harness
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
@@ -4,8 +4,7 @@ class CountersWithRedis < IntegrationTest
4
4
  def test_stores_name_in_redis
5
5
  instrument "event-counter", :counter => true
6
6
 
7
- assert_includes redis.smembers('counters'), 'event-counter'
8
- assert_equal 1, redis.get('event-counter').to_i
7
+ assert_equal 1, redis.get('counters/event-counter').to_i
9
8
 
10
9
  assert_counter_logged "event-counter"
11
10
  end
@@ -13,9 +12,9 @@ class CountersWithRedis < IntegrationTest
13
12
  def test_increments_counter_each_instrument
14
13
  instrument "event-counter", :counter => true
15
14
  assert_counter_logged "event-counter"
15
+
16
16
  counters.clear
17
17
 
18
- assert_empty counters
19
18
  instrument "event-counter", :counter => true
20
19
  assert_counter_logged "event-counter"
21
20
 
@@ -25,8 +24,6 @@ class CountersWithRedis < IntegrationTest
25
24
  def test_sets_given_value_in_redis_with_shortform
26
25
  instrument "event-counter", :counter => 10
27
26
 
28
- assert_equal 10, redis.get("event-counter").to_i
29
-
30
27
  counters.clear
31
28
 
32
29
  instrument "event-counter", :counter => true
@@ -38,7 +35,7 @@ class CountersWithRedis < IntegrationTest
38
35
  def test_sets_given_value_in_redis_with_longform
39
36
  instrument "event-counter", :counter => { :value => 10 }
40
37
 
41
- assert_equal 10, redis.get("event-counter").to_i
38
+ assert_equal 10, redis.get("counters/event-counter").to_i
42
39
 
43
40
  counters.clear
44
41
 
@@ -52,29 +49,19 @@ class CountersWithRedis < IntegrationTest
52
49
  instrument "event-counter", :counter => true
53
50
  instrument "event-counter2", :counter => true
54
51
 
55
- assert_equal 1, redis.get("event-counter").to_i
56
- assert_equal 1, redis.get("event-counter2").to_i
52
+ assert_equal 1, redis.get("counters/event-counter").to_i
53
+ assert_equal 1, redis.get("counters/event-counter2").to_i
57
54
 
58
55
  Harness.reset_counters!
59
56
 
60
- assert_equal 0, redis.get("event-counter").to_i
61
- assert_equal 0, redis.get("event-counter2").to_i
57
+ assert_equal 0, redis.get("counters/event-counter").to_i
58
+ assert_equal 0, redis.get("counters/event-counter2").to_i
62
59
 
63
60
  counters.clear
64
61
  instrument "event-counter", :counter => true
65
62
  assert_counter_logged 'event-counter'
66
63
 
67
64
  assert_equal 1, counters.first.value
68
- assert_equal 1, redis.get("event-counter").to_i
69
- end
70
-
71
- def test_resets_counters_resets_meters
72
- instrument "event-counter", :counter => true
73
-
74
- assert_equal 1, redis.get("event-counter").to_i
75
-
76
- Harness.reset_counters!
77
-
78
- assert_equal 0, redis.get("event-counter").to_i
65
+ assert_equal 1, redis.get("counters/event-counter").to_i
79
66
  end
80
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ahawkins