statsd-instrument 3.0.0.pre1 → 3.0.0.pre2

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
  SHA256:
3
- metadata.gz: ec03c4f1452d2b5bca53c83faf68955d8095ad75ed0484103091789764e02233
4
- data.tar.gz: 6037bd8e41bfc3b7d726c9f1120d10ce202a206dbfdd1e3368d550ed90f0bcc9
3
+ metadata.gz: 9d300be8b2e40d3b175eff237d7991949c962b284603c8e16852247171177965
4
+ data.tar.gz: d3e43a58dec356b4606be2c0c39321db12223672f7caa02dd2b09331ebae9b02
5
5
  SHA512:
6
- metadata.gz: f282acf3e05dac8b66eddc5b2fb8e11501543bc2125c92d7154835bd832304d706e35dc831c7c4ea879f05f4f1b0568b67bd19e4a657ef45c8272c81aa29b0af
7
- data.tar.gz: 65546513cc2e0fb9ea06ab220d63102ba354963397c96ae8d81983d3b9178ca8ca03ed1536c29a8d2938b125e7644a37cdc40c0707d9eab1ccca2298bd3b6ad1
6
+ metadata.gz: f269fec546184d3cee07a3cb365babb87bc739c126985bb9218a63f3ec86a58bf22e0f4cbf73fade2f1618cca58b9c32c9d442ebf29f3d81ca0bcfbfc1e024b1
7
+ data.tar.gz: 0ee20bb6244d8403cd8c4441e9d35cafbff82c8d58b76b7c53a91c2b3d510944769a945f5a151d1b760e6d1799789c79248102a34734806eaaeded24394f8238
@@ -4,24 +4,17 @@ on: push
4
4
 
5
5
  jobs:
6
6
  test:
7
- name: Ruby ${{ matrix.ruby }} on ${{ matrix.platform }}
8
- runs-on: ${{ matrix.platform }}
7
+ name: Ruby ${{ matrix.ruby }} on ubuntu-18.04
8
+ runs-on: ubuntu-18.04
9
9
  strategy:
10
10
  fail-fast: false
11
11
  matrix:
12
- # Windows started failing on the following command for some reason.
13
- #
14
- # gem install bundler && bundle install --jobs 4 --retry 3
15
- # ~~
16
- # The token '&&' is not a valid statement separator in this version.
17
- #
18
- # Temporarily disable Windows builds to unblock CI.
19
- #
20
- # platform: [ubuntu-18.04, windows-2019, macOS-10.14]
21
- platform: [ubuntu-18.04, macOS-10.14]
12
+ # Windows on macOS builds started failing, so they are disabled for noew
13
+
22
14
  ruby: [2.3, 2.4, 2.5, 2.6]
15
+ # platform: [windows-2019, macOS-10.14, ubuntu-18.04]
23
16
 
24
- exclude:
17
+ # exclude:
25
18
  # The Windows environment does not support older Ruby versions. We only test against the latest version
26
19
  # - platform: windows-2019
27
20
  # ruby: 2.3
@@ -31,12 +24,12 @@ jobs:
31
24
  # ruby: 2.5
32
25
 
33
26
  # On macOS, we only test against the Ruby version macOS ships with (2.3)
34
- - platform: macOS-10.14
35
- ruby: 2.4
36
- - platform: macOS-10.14
37
- ruby: 2.5
38
- - platform: macOS-10.14
39
- ruby: 2.6
27
+ # - platform: macOS-10.14
28
+ # ruby: 2.4
29
+ # - platform: macOS-10.14
30
+ # ruby: 2.5
31
+ # - platform: macOS-10.14
32
+ # ruby: 2.6
40
33
 
41
34
  steps:
42
35
  - uses: actions/checkout@v1
@@ -8,6 +8,17 @@ section below.
8
8
 
9
9
  _Nothing yet_
10
10
 
11
+ ## Version 2.9.2
12
+
13
+ - Allow providing a value as second positional argument to `assert_statsd_*`
14
+ methods, rather than as keyword argument. This matches the arguments to the
15
+ StatsD metric call.
16
+ ``` ruby
17
+ assert_statsd_increment('batch_size', 10) do
18
+ StatsD.increment('batch_size', 10)
19
+ end
20
+ ```
21
+
11
22
  ## Version 2.9.1
12
23
 
13
24
  - The `VOID` object being returned by metric methods (e.g. `StatsD.increment`)
@@ -71,8 +71,8 @@ module StatsD::Instrument::Assertions
71
71
  # @return [void]
72
72
  # @raise [Minitest::Assertion] If an exception occurs, or if the metric did
73
73
  # not occur as specified during the execution the block.
74
- def assert_statsd_increment(metric_name, datagrams: nil, client: nil, **options, &block)
75
- expectation = StatsD::Instrument::Expectation.increment(metric_name, **options)
74
+ def assert_statsd_increment(metric_name, value = nil, datagrams: nil, client: nil, **options, &block)
75
+ expectation = StatsD::Instrument::Expectation.increment(metric_name, value, **options)
76
76
  assert_statsd_expectation(expectation, datagrams: datagrams, client: client, &block)
77
77
  end
78
78
 
@@ -83,8 +83,8 @@ module StatsD::Instrument::Assertions
83
83
  # @yield (see #assert_statsd_increment)
84
84
  # @return [void]
85
85
  # @raise (see #assert_statsd_increment)
86
- def assert_statsd_measure(metric_name, datagrams: nil, client: nil, **options, &block)
87
- expectation = StatsD::Instrument::Expectation.measure(metric_name, **options)
86
+ def assert_statsd_measure(metric_name, value = nil, datagrams: nil, client: nil, **options, &block)
87
+ expectation = StatsD::Instrument::Expectation.measure(metric_name, value, **options)
88
88
  assert_statsd_expectation(expectation, datagrams: datagrams, client: client, &block)
89
89
  end
90
90
 
@@ -95,8 +95,8 @@ module StatsD::Instrument::Assertions
95
95
  # @yield (see #assert_statsd_increment)
96
96
  # @return [void]
97
97
  # @raise (see #assert_statsd_increment)
98
- def assert_statsd_gauge(metric_name, datagrams: nil, client: nil, **options, &block)
99
- expectation = StatsD::Instrument::Expectation.gauge(metric_name, **options)
98
+ def assert_statsd_gauge(metric_name, value = nil, datagrams: nil, client: nil, **options, &block)
99
+ expectation = StatsD::Instrument::Expectation.gauge(metric_name, value, **options)
100
100
  assert_statsd_expectation(expectation, datagrams: datagrams, client: client, &block)
101
101
  end
102
102
 
@@ -107,8 +107,8 @@ module StatsD::Instrument::Assertions
107
107
  # @yield (see #assert_statsd_increment)
108
108
  # @return [void]
109
109
  # @raise (see #assert_statsd_increment)
110
- def assert_statsd_histogram(metric_name, datagrams: nil, client: nil, **options, &block)
111
- expectation = StatsD::Instrument::Expectation.histogram(metric_name, **options)
110
+ def assert_statsd_histogram(metric_name, value = nil, datagrams: nil, client: nil, **options, &block)
111
+ expectation = StatsD::Instrument::Expectation.histogram(metric_name, value, **options)
112
112
  assert_statsd_expectation(expectation, datagrams: datagrams, client: client, &block)
113
113
  end
114
114
 
@@ -119,8 +119,8 @@ module StatsD::Instrument::Assertions
119
119
  # @yield (see #assert_statsd_increment)
120
120
  # @return [void]
121
121
  # @raise (see #assert_statsd_increment)
122
- def assert_statsd_distribution(metric_name, datagrams: nil, client: nil, **options, &block)
123
- expectation = StatsD::Instrument::Expectation.distribution(metric_name, **options)
122
+ def assert_statsd_distribution(metric_name, value = nil, datagrams: nil, client: nil, **options, &block)
123
+ expectation = StatsD::Instrument::Expectation.distribution(metric_name, value, **options)
124
124
  assert_statsd_expectation(expectation, datagrams: datagrams, client: client, &block)
125
125
  end
126
126
 
@@ -131,8 +131,8 @@ module StatsD::Instrument::Assertions
131
131
  # @yield (see #assert_statsd_increment)
132
132
  # @return [void]
133
133
  # @raise (see #assert_statsd_increment)
134
- def assert_statsd_set(metric_name, datagrams: nil, client: nil, **options, &block)
135
- expectation = StatsD::Instrument::Expectation.set(metric_name, **options)
134
+ def assert_statsd_set(metric_name, value = nil, datagrams: nil, client: nil, **options, &block)
135
+ expectation = StatsD::Instrument::Expectation.set(metric_name, value, **options)
136
136
  assert_statsd_expectation(expectation, datagrams: datagrams, client: client, &block)
137
137
  end
138
138
 
@@ -143,8 +143,8 @@ module StatsD::Instrument::Assertions
143
143
  # @yield (see #assert_statsd_increment)
144
144
  # @return [void]
145
145
  # @raise (see #assert_statsd_increment)
146
- def assert_statsd_key_value(metric_name, datagrams: nil, client: nil, **options, &block)
147
- expectation = StatsD::Instrument::Expectation.key_value(metric_name, **options)
146
+ def assert_statsd_key_value(metric_name, value = nil, datagrams: nil, client: nil, **options, &block)
147
+ expectation = StatsD::Instrument::Expectation.key_value(metric_name, value, **options)
148
148
  assert_statsd_expectation(expectation, datagrams: datagrams, client: client, &block)
149
149
  end
150
150
 
@@ -3,32 +3,32 @@
3
3
  # @private
4
4
  class StatsD::Instrument::Expectation
5
5
  class << self
6
- def increment(name, **options)
7
- new(type: :c, name: name, **options)
6
+ def increment(name, value = nil, **options)
7
+ new(type: :c, name: name, value: value, **options)
8
8
  end
9
9
 
10
- def measure(name, **options)
11
- new(type: :ms, name: name, **options)
10
+ def measure(name, value = nil, **options)
11
+ new(type: :ms, name: name, value: value, **options)
12
12
  end
13
13
 
14
- def gauge(name, **options)
15
- new(type: :g, name: name, **options)
14
+ def gauge(name, value = nil, **options)
15
+ new(type: :g, name: name, value: value, **options)
16
16
  end
17
17
 
18
- def set(name, **options)
19
- new(type: :s, name: name, **options)
18
+ def set(name, value = nil, **options)
19
+ new(type: :s, name: name, value: value, **options)
20
20
  end
21
21
 
22
- def key_value(name, **options)
23
- new(type: :kv, name: name, **options)
22
+ def key_value(name, value = nil, **options)
23
+ new(type: :kv, name: name, value: value, **options)
24
24
  end
25
25
 
26
- def distribution(name, **options)
27
- new(type: :d, name: name, **options)
26
+ def distribution(name, value = nil, **options)
27
+ new(type: :d, name: name, value: value, **options)
28
28
  end
29
29
 
30
- def histogram(name, **options)
31
- new(type: :h, name: name, **options)
30
+ def histogram(name, value = nil, **options)
31
+ new(type: :h, name: name, value: value, **options)
32
32
  end
33
33
  end
34
34
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module StatsD
4
4
  module Instrument
5
- VERSION = "3.0.0.pre1"
5
+ VERSION = "3.0.0.pre2"
6
6
  end
7
7
  end
@@ -132,43 +132,55 @@ class AssertionsTest < Minitest::Test
132
132
  end
133
133
 
134
134
  def test_assert_statsd_gauge_call_with_numeric_value
135
- @test_case.assert_statsd_gauge('gauge', value: 42) do
135
+ @test_case.assert_statsd_gauge('gauge', 42) do
136
136
  StatsD.gauge('gauge', 42)
137
137
  end
138
138
 
139
- @test_case.assert_statsd_gauge('gauge', value: '42') do
139
+ @test_case.assert_statsd_gauge('gauge', '42') do
140
140
  StatsD.gauge('gauge', 42)
141
141
  end
142
142
 
143
143
  assert_raises(Minitest::Assertion) do
144
- @test_case.assert_statsd_gauge('gauge', value: 42) do
144
+ @test_case.assert_statsd_gauge('gauge', 42) do
145
145
  StatsD.gauge('gauge', 45)
146
146
  end
147
147
  end
148
+
149
+ @test_case.assert_statsd_gauge('gauge', value: 42) do
150
+ StatsD.gauge('gauge', 42)
151
+ end
148
152
  end
149
153
 
150
154
  def test_assert_statsd_set_call_with_string_value
151
- @test_case.assert_statsd_set('set', value: 12345) do
155
+ @test_case.assert_statsd_set('set', 12345) do
152
156
  StatsD.set('set', '12345')
153
157
  end
154
158
 
155
- @test_case.assert_statsd_set('set', value: '12345') do
159
+ @test_case.assert_statsd_set('set', '12345') do
156
160
  StatsD.set('set', '12345')
157
161
  end
158
162
 
159
- @test_case.assert_statsd_set('set', value: 12345) do
163
+ @test_case.assert_statsd_set('set', 12345) do
160
164
  StatsD.set('set', 12345)
161
165
  end
162
166
 
163
- @test_case.assert_statsd_set('set', value: '12345') do
167
+ @test_case.assert_statsd_set('set', '12345') do
164
168
  StatsD.set('set', 12345)
165
169
  end
166
170
 
167
171
  assert_raises(Minitest::Assertion) do
168
- @test_case.assert_statsd_set('set', value: '42') do
172
+ @test_case.assert_statsd_set('set', '42') do
169
173
  StatsD.set('set', 45)
170
174
  end
171
175
  end
176
+
177
+ @test_case.assert_statsd_set('set', value: 12345) do
178
+ StatsD.set('set', '12345')
179
+ end
180
+
181
+ @test_case.assert_statsd_set('set', 'wrong_value', value: 12345) do
182
+ StatsD.set('set', '12345')
183
+ end
172
184
  end
173
185
 
174
186
  def test_tags_will_match_subsets
@@ -285,7 +297,7 @@ class AssertionsTest < Minitest::Test
285
297
  end
286
298
 
287
299
  foo_1_metric = StatsD::Instrument::Expectation.increment('counter', times: 2, tags: ['foo:1'])
288
- foo_2_metric = StatsD::Instrument::Expectation.increment('counter', tags: ['foo:2'])
300
+ foo_2_metric = StatsD::Instrument::Expectation.increment('counter', 1, tags: ['foo:2'])
289
301
  @test_case.assert_statsd_expectations([foo_1_metric, foo_2_metric]) do
290
302
  StatsD.increment('counter', tags: { foo: 1 })
291
303
  StatsD.increment('counter', tags: { foo: 1 })
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statsd-instrument
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.pre1
4
+ version: 3.0.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Storimer
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-11-01 00:00:00.000000000 Z
13
+ date: 2019-11-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake