wavefront-sdk 3.3.3 → 3.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -17
  3. data/Gemfile +2 -0
  4. data/HISTORY.md +4 -0
  5. data/Rakefile +2 -0
  6. data/lib/wavefront-sdk/alert.rb +5 -2
  7. data/lib/wavefront-sdk/api_mixins/acl.rb +3 -0
  8. data/lib/wavefront-sdk/api_mixins/tag.rb +2 -0
  9. data/lib/wavefront-sdk/api_mixins/user.rb +4 -0
  10. data/lib/wavefront-sdk/apitoken.rb +2 -0
  11. data/lib/wavefront-sdk/cloudintegration.rb +4 -0
  12. data/lib/wavefront-sdk/core/api.rb +3 -0
  13. data/lib/wavefront-sdk/core/api_caller.rb +16 -10
  14. data/lib/wavefront-sdk/core/exception.rb +2 -0
  15. data/lib/wavefront-sdk/core/logger.rb +6 -3
  16. data/lib/wavefront-sdk/core/response.rb +6 -3
  17. data/lib/wavefront-sdk/credentials.rb +5 -2
  18. data/lib/wavefront-sdk/dashboard.rb +3 -0
  19. data/lib/wavefront-sdk/defs/constants.rb +3 -1
  20. data/lib/wavefront-sdk/defs/version.rb +3 -1
  21. data/lib/wavefront-sdk/derivedmetric.rb +3 -0
  22. data/lib/wavefront-sdk/distribution.rb +36 -16
  23. data/lib/wavefront-sdk/event.rb +16 -12
  24. data/lib/wavefront-sdk/externallink.rb +3 -0
  25. data/lib/wavefront-sdk/integration.rb +2 -0
  26. data/lib/wavefront-sdk/maintenancewindow.rb +4 -1
  27. data/lib/wavefront-sdk/message.rb +2 -0
  28. data/lib/wavefront-sdk/metric.rb +3 -0
  29. data/lib/wavefront-sdk/metric_helper.rb +6 -4
  30. data/lib/wavefront-sdk/notificant.rb +3 -0
  31. data/lib/wavefront-sdk/paginator/base.rb +5 -0
  32. data/lib/wavefront-sdk/paginator/delete.rb +2 -0
  33. data/lib/wavefront-sdk/paginator/get.rb +2 -0
  34. data/lib/wavefront-sdk/paginator/post.rb +2 -0
  35. data/lib/wavefront-sdk/paginator/put.rb +2 -0
  36. data/lib/wavefront-sdk/proxy.rb +2 -0
  37. data/lib/wavefront-sdk/query.rb +6 -3
  38. data/lib/wavefront-sdk/report.rb +2 -0
  39. data/lib/wavefront-sdk/savedsearch.rb +4 -0
  40. data/lib/wavefront-sdk/search.rb +4 -1
  41. data/lib/wavefront-sdk/settings.rb +2 -0
  42. data/lib/wavefront-sdk/source.rb +3 -0
  43. data/lib/wavefront-sdk/stdlib/array.rb +2 -0
  44. data/lib/wavefront-sdk/stdlib/hash.rb +5 -1
  45. data/lib/wavefront-sdk/stdlib/string.rb +2 -0
  46. data/lib/wavefront-sdk/support/mixins.rb +5 -1
  47. data/lib/wavefront-sdk/support/parse_time.rb +3 -0
  48. data/lib/wavefront-sdk/types/status.rb +4 -0
  49. data/lib/wavefront-sdk/user.rb +18 -8
  50. data/lib/wavefront-sdk/usergroup.rb +3 -0
  51. data/lib/wavefront-sdk/validators.rb +28 -0
  52. data/lib/wavefront-sdk/webhook.rb +3 -0
  53. data/lib/wavefront-sdk/write.rb +43 -28
  54. data/lib/wavefront-sdk/writers/api.rb +2 -0
  55. data/lib/wavefront-sdk/writers/core.rb +21 -4
  56. data/lib/wavefront-sdk/writers/http.rb +9 -2
  57. data/lib/wavefront-sdk/writers/socket.rb +11 -9
  58. data/lib/wavefront-sdk/writers/summary.rb +2 -0
  59. data/lib/wavefront-sdk/writers/unix.rb +10 -7
  60. data/lib/wavefront_sdk.rb +3 -1
  61. data/spec/.rubocop.yml +10 -14
  62. data/spec/constants.rb +10 -8
  63. data/spec/spec_helper.rb +2 -0
  64. data/spec/support/bad_mocket.rb +2 -0
  65. data/spec/support/hash.rb +2 -0
  66. data/spec/support/minitest_assertions.rb +2 -0
  67. data/spec/support/mocket.rb +2 -0
  68. data/spec/test_mixins/acl.rb +2 -0
  69. data/spec/test_mixins/general.rb +2 -0
  70. data/spec/test_mixins/tag.rb +2 -0
  71. data/spec/test_mixins/update_keys.rb +2 -0
  72. data/spec/wavefront-sdk/alert_spec.rb +10 -9
  73. data/spec/wavefront-sdk/api_mixins/user_mixins_spec.rb +1 -0
  74. data/spec/wavefront-sdk/apitoken_spec.rb +1 -0
  75. data/spec/wavefront-sdk/cloudintegration_spec.rb +2 -1
  76. data/spec/wavefront-sdk/core/api_caller_spec.rb +1 -0
  77. data/spec/wavefront-sdk/core/api_spec.rb +1 -0
  78. data/spec/wavefront-sdk/core/logger_spec.rb +1 -0
  79. data/spec/wavefront-sdk/core/response_spec.rb +4 -3
  80. data/spec/wavefront-sdk/credentials_spec.rb +1 -0
  81. data/spec/wavefront-sdk/dashboard_spec.rb +1 -0
  82. data/spec/wavefront-sdk/derivedmetric_spec.rb +1 -0
  83. data/spec/wavefront-sdk/distribution_spec.rb +6 -5
  84. data/spec/wavefront-sdk/event_spec.rb +8 -7
  85. data/spec/wavefront-sdk/externallink_spec.rb +5 -4
  86. data/spec/wavefront-sdk/integration_spec.rb +1 -0
  87. data/spec/wavefront-sdk/maintenancewindow_spec.rb +6 -5
  88. data/spec/wavefront-sdk/message_spec.rb +2 -1
  89. data/spec/wavefront-sdk/metric_helper_spec.rb +10 -9
  90. data/spec/wavefront-sdk/metric_spec.rb +1 -0
  91. data/spec/wavefront-sdk/notificant_spec.rb +1 -0
  92. data/spec/wavefront-sdk/paginator/base_spec.rb +1 -0
  93. data/spec/wavefront-sdk/paginator/post_spec.rb +1 -0
  94. data/spec/wavefront-sdk/proxy_spec.rb +1 -0
  95. data/spec/wavefront-sdk/query_spec.rb +1 -0
  96. data/spec/wavefront-sdk/report_spec.rb +1 -0
  97. data/spec/wavefront-sdk/resources/dummy_points.rb +10 -8
  98. data/spec/wavefront-sdk/savedsearch_spec.rb +1 -0
  99. data/spec/wavefront-sdk/search_spec.rb +5 -4
  100. data/spec/wavefront-sdk/settings_spec.rb +1 -0
  101. data/spec/wavefront-sdk/source_spec.rb +3 -2
  102. data/spec/wavefront-sdk/stdlib/array_spec.rb +1 -0
  103. data/spec/wavefront-sdk/stdlib/hash_spec.rb +1 -0
  104. data/spec/wavefront-sdk/stdlib/string_spec.rb +1 -0
  105. data/spec/wavefront-sdk/support/mixins_spec.rb +1 -0
  106. data/spec/wavefront-sdk/support/parse_time_spec.rb +1 -2
  107. data/spec/wavefront-sdk/user_spec.rb +1 -0
  108. data/spec/wavefront-sdk/usergroup_spec.rb +2 -1
  109. data/spec/wavefront-sdk/validators_spec.rb +1 -2
  110. data/spec/wavefront-sdk/webhook_spec.rb +7 -6
  111. data/spec/wavefront-sdk/write_spec.rb +50 -30
  112. data/spec/wavefront-sdk/writers/api_spec.rb +1 -0
  113. data/spec/wavefront-sdk/writers/core_spec.rb +1 -0
  114. data/spec/wavefront-sdk/writers/http_spec.rb +2 -1
  115. data/spec/wavefront-sdk/writers/socket_spec.rb +1 -0
  116. data/spec/wavefront-sdk/writers/summary_spec.rb +1 -0
  117. data/wavefront-sdk.gemspec +4 -2
  118. metadata +6 -6
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Wavefront
2
4
  module Writer
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'socket'
2
4
  require_relative 'core'
3
5
 
@@ -20,13 +22,7 @@ module Wavefront
20
22
  end
21
23
 
22
24
  logger.log("Connecting to #{creds[:socket]}.", :debug)
23
-
24
- begin
25
- @conn = UNIXSocket.new(creds[:socket])
26
- rescue StandardError => e
27
- logger.log(e, :error)
28
- raise Wavefront::Exception::InvalidEndpoint
29
- end
25
+ open_socket(creds[:socket])
30
26
  end
31
27
 
32
28
  def close
@@ -45,6 +41,13 @@ module Wavefront
45
41
 
46
42
  private
47
43
 
44
+ def open_socket(socket)
45
+ @conn = UNIXSocket.new(socket)
46
+ rescue StandardError => e
47
+ logger.log(e, :error)
48
+ raise Wavefront::Exception::InvalidEndpoint
49
+ end
50
+
48
51
  # @param point [String] point or points in native Wavefront
49
52
  # format.
50
53
  #
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Automatically load all SDK classes.
2
4
  #
3
5
  require 'pathname'
4
6
 
5
- libdir = Pathname.new(__FILE__).dirname + 'wavefront-sdk'
7
+ libdir = Pathname.new(__dir__) + 'wavefront-sdk'
6
8
 
7
9
  libdir.children.select { |f| f.extname == '.rb' }.each do |f|
8
10
  require_relative f
@@ -1,17 +1,13 @@
1
- AllCops:
2
- TargetRubyVersion: 2.2
3
- #
4
- #
5
- # Allow long blocks of tests
6
- #
7
- Metrics/BlockLength:
8
- Max: 120
9
-
10
- Metrics/MethodLength:
11
- Max: 80
12
-
1
+ # Offense count: 64
13
2
  Metrics/AbcSize:
14
- Max: 80
3
+ Max: 64
15
4
 
5
+ # Offense count: 5
6
+ # Configuration parameters: CountComments.
16
7
  Metrics/ClassLength:
17
- Max: 300
8
+ Max: 279
9
+
10
+ # Offense count: 46
11
+ # Configuration parameters: CountComments, ExcludedMethods.
12
+ Metrics/MethodLength:
13
+ Max: 39
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # rubocop:disable Style/MutableConstant
2
4
  CREDS = { endpoint: 'test.example.com',
3
- token: '0123456789-ABCDEF' }
5
+ token: '0123456789-ABCDEF' }
4
6
  # rubocop:enable Style/MutableConstant
5
7
 
6
8
  W_CREDS = { proxy: 'wavefront', port: 2878 }.freeze
@@ -15,16 +17,16 @@ JSON_POST_HEADERS = {
15
17
 
16
18
  DUMMY_RESPONSE = '{"status":{"result":"OK","message":"","code":200},' \
17
19
  '"response":{"items":[{"name":"test data"}],"offset":0,' \
18
- '"limit":100,"totalItems":3,"moreItems":false}}'.freeze
20
+ '"limit":100,"totalItems":3,"moreItems":false}}'
19
21
 
20
22
  RESOURCE_DIR = (Pathname.new(__FILE__).dirname +
21
23
  'wavefront-sdk' + 'resources').freeze
22
24
 
23
- U_ACL_1 = 'someone@example.com'.freeze
24
- U_ACL_2 = 'other@elsewhere.com'.freeze
25
- GRP_ACL = 'f8dc0c14-91a0-4ca9-8a2a-7d47f4db4672'.freeze
25
+ U_ACL_1 = 'someone@example.com'
26
+ U_ACL_2 = 'other@elsewhere.com'
27
+ GRP_ACL = 'f8dc0c14-91a0-4ca9-8a2a-7d47f4db4672'
26
28
 
27
- DEFAULT_HEADERS = { 'Accept': /.*/,
29
+ DEFAULT_HEADERS = { 'Accept': /.*/,
28
30
  'Accept-Encoding': /.*/,
29
- 'Authorization': 'Bearer 0123456789-ABCDEF',
30
- 'User-Agent': /wavefront-sdk \d+\.\d+\.\d+/ }.freeze
31
+ 'Authorization': 'Bearer 0123456789-ABCDEF',
32
+ 'User-Agent': /wavefront-sdk \d+\.\d+\.\d+/ }.freeze
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'simplecov'
2
4
  SimpleCov.start { add_filter '/spec/' }
3
5
  require 'minitest/autorun'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # A mock socket which says things went wrong.
2
4
  #
3
5
  class BadMocket < Mocket
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Extensions to stdlib
2
4
  #
3
5
  class Hash
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Minitest
2
4
  #
3
5
  # Some custom Minitest assertions to simplify testing
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # A mock socket
2
4
  #
3
5
  class Mocket
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module WavefrontTest
2
4
  #
3
5
  # require and include this module to get ACL tests
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module WavefrontTest
2
4
  module List
3
5
  def test_list
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module WavefrontTest
2
4
  #
3
5
  # require and include this module to get tag tests
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module WavefrontTest
2
4
  #
3
5
  # include this into any class which has update keys
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require_relative '../spec_helper'
4
5
  require_relative '../test_mixins/acl'
@@ -125,19 +126,19 @@ class WavefrontAlertTest < WavefrontTestBase
125
126
  end
126
127
 
127
128
  def payload
128
- { name: 'SDK test alert',
129
- target: 'user@example.com',
130
- condition: 'ts("app.errors") > 0',
131
- displayExpression: 'ts("app.errors")',
132
- minutes: 5,
129
+ { name: 'SDK test alert',
130
+ target: 'user@example.com',
131
+ condition: 'ts("app.errors") > 0',
132
+ displayExpression: 'ts("app.errors")',
133
+ minutes: 5,
133
134
  resolveAfterMinutes: 5,
134
- severity: 'INFO' }
135
+ severity: 'INFO' }
135
136
  end
136
137
 
137
138
  def search_payload(value)
138
- { limit: 999,
139
+ { limit: 999,
139
140
  offset: 0,
140
- query: [{ key: 'status', value: value, matchingMethod: 'EXACT' }],
141
- sort: { field: 'status', ascending: true } }
141
+ query: [{ key: 'status', value: value, matchingMethod: 'EXACT' }],
142
+ sort: { field: 'status', ascending: true } }
142
143
  end
143
144
  end
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require_relative '../../spec_helper'
4
5
  require_relative '../../../lib/wavefront-sdk/api_mixins/user'
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require_relative '../spec_helper'
4
5
  require_relative '../test_mixins/general'
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require_relative '../spec_helper'
4
5
  require_relative '../test_mixins/general'
@@ -51,7 +52,7 @@ class WavefrontCloudIntegrationTest < WavefrontTestBase
51
52
  service: 'CLOUDWATCH',
52
53
  cloudWatch: {
53
54
  baseCredentials: {
54
- roleArn: 'arn:aws:iam::<accountid>:role/<rolename>',
55
+ roleArn: 'arn:aws:iam::<accountid>:role/<rolename>',
55
56
  externalId: 'wave123'
56
57
  }
57
58
  },
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require_relative '../../spec_helper'
4
5
  require_relative '../../../lib/wavefront-sdk/core/api_caller'
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require_relative '../../spec_helper'
4
5
  require_relative '../../../lib/wavefront-sdk/core/api'
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'logger'
4
5
  require_relative '../../spec_helper'
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'json'
4
5
  require_relative '../../spec_helper'
@@ -7,13 +8,13 @@ require_relative '../../../lib/wavefront-sdk/core/response'
7
8
 
8
9
  GOOD_RESP = '{"status":{"result":"OK","message":"","code":200},' \
9
10
  '"response":{"items":[{"name":"test agent"}],"offset":0,' \
10
- '"limit":100,"totalItems":3,"moreItems":false}}'.freeze
11
+ '"limit":100,"totalItems":3,"moreItems":false}}'
11
12
 
12
13
  BAD_RESP = "error='not_found'
13
14
  message='resource cannot be found'
14
- trackingId=eca22ddc-848b-4e67-876a-366145c8a759".freeze
15
+ trackingId=eca22ddc-848b-4e67-876a-366145c8a759"
15
16
 
16
- ERR_RESP = { error: 'HTTP 415 Unsupported Media Type',
17
+ ERR_RESP = { error: 'HTTP 415 Unsupported Media Type',
17
18
  trackingId: 'ce231eaf-8d0e-4138-a82d-12725376a3b0' }.to_json
18
19
 
19
20
  # Unit tests for Response class. Also indirectly tests the Status
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'pathname'
4
5
  require_relative '../spec_helper'
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require_relative '../spec_helper'
4
5
  require_relative '../test_mixins/acl'
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require_relative '../spec_helper'
4
5
  require_relative '../test_mixins/general'
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require_relative '../spec_helper'
4
5
  require_relative '../../lib/wavefront-sdk/distribution'
@@ -66,10 +67,10 @@ class WavefrontDistributionTest < MiniTest::Test
66
67
 
67
68
  def distribution
68
69
  { interval: :m,
69
- path: 'test.distribution',
70
- value: [[5, 11], [15, 2.533], [8, -15], [12, 1e6]],
71
- ts: 1_538_865_613,
72
- source: 'minitest',
73
- tags: { tag1: 'val1', tag2: 'val2' } }
70
+ path: 'test.distribution',
71
+ value: [[5, 11], [15, 2.533], [8, -15], [12, 1e6]],
72
+ ts: 1_538_865_613,
73
+ source: 'minitest',
74
+ tags: { tag1: 'val1', tag2: 'val2' } }
74
75
  end
75
76
  end
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require_relative '../spec_helper'
4
5
  require_relative '../test_mixins/general'
@@ -57,16 +58,16 @@ class WavefrontEventTest < WavefrontTestBase
57
58
  end
58
59
 
59
60
  def payload
60
- { name: 'test_event',
61
+ { name: 'test_event',
61
62
  annotations: {
62
63
  severity: 'info',
63
- type: 'SDK test event',
64
- details: 'an imaginary event to test the SDK'
64
+ type: 'SDK test event',
65
+ details: 'an imaginary event to test the SDK'
65
66
  },
66
- hosts: %w[host1 host2],
67
- startTime: 1_493_385_089_000,
68
- endTime: 1_493_385_345_678,
69
- tags: %w[tag1 tag2],
67
+ hosts: %w[host1 host2],
68
+ startTime: 1_493_385_089_000,
69
+ endTime: 1_493_385_345_678,
70
+ tags: %w[tag1 tag2],
70
71
  isEphemeral: false }
71
72
  end
72
73
  end
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require_relative '../spec_helper'
4
5
  require_relative '../test_mixins/general'
@@ -23,11 +24,11 @@ class WavefrontExternalLinkTest < WavefrontTestBase
23
24
  end
24
25
 
25
26
  def payload
26
- [{ name: 'test link',
27
- template: 'https://example.com/link/{{value}}',
27
+ [{ name: 'test link',
28
+ template: 'https://example.com/link/{{value}}',
28
29
  description: 'an imaginary link for unit testing purposes' },
29
- { name: 'test link',
30
- template: 'https://example.com/link/{{value}}' }]
30
+ { name: 'test link',
31
+ template: 'https://example.com/link/{{value}}' }]
31
32
  end
32
33
 
33
34
  def api_class
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require_relative '../spec_helper'
4
5
  require_relative '../test_mixins/general'
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require_relative '../spec_helper'
4
5
  require_relative '../test_mixins/general'
@@ -23,11 +24,11 @@ class WavefrontMaintenanceWindowTest < WavefrontTestBase
23
24
  end
24
25
 
25
26
  def payload
26
- { reason: 'testing SDK',
27
- title: 'test window',
28
- start: Time.now.to_i,
29
- end: Time.now.to_i + 600,
30
- tags: %w[testtag1 testtag2],
27
+ { reason: 'testing SDK',
28
+ title: 'test window',
29
+ start: Time.now.to_i,
30
+ end: Time.now.to_i + 600,
31
+ tags: %w[testtag1 testtag2],
31
32
  hostTags: %w[hosttag1 hosttag2] }
32
33
  end
33
34
  end
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require_relative '../spec_helper'
4
5
 
5
- MESSAGE = 'CLUSTER::IHjNaHM9'.freeze
6
+ MESSAGE = 'CLUSTER::IHjNaHM9'
6
7
 
7
8
  # Unit tests for Message class
8
9
  #
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'minitest/autorun'
4
5
  require_relative '../spec_helper'
@@ -91,9 +92,9 @@ class WavefrontMetricHelperTest < MiniTest::Test
91
92
  end
92
93
 
93
94
  def test_counters_to_wf
94
- input = { ['test.counter1', nil] => 7,
95
+ input = { ['test.counter1', nil] => 7,
95
96
  ['test.counter1', WH_TAGS] => 8,
96
- ['test.counter2', nil] => 9 }
97
+ ['test.counter2', nil] => 9 }
97
98
 
98
99
  out = wf.counters_to_wf(input)
99
100
  assert_instance_of(Array, out)
@@ -109,7 +110,7 @@ class WavefrontMetricHelperTest < MiniTest::Test
109
110
  def test_dists_to_wf
110
111
  input = { ['test.dist1', :m, nil] => [10, 10, 11, 12],
111
112
  ['test.dist1', :m, WH_TAGS] => [123, 456, 789],
112
- ['test.dist1', :h, nil] => [6, 6, 7, 4, 6, 4, 8] }
113
+ ['test.dist1', :h, nil] => [6, 6, 7, 4, 6, 4, 8] }
113
114
 
114
115
  out = wfd.dists_to_wf(input)
115
116
  assert_instance_of(Array, out)
@@ -161,9 +162,9 @@ class WavefrontMetricHelperTest < MiniTest::Test
161
162
  def test_flush_counters
162
163
  assert_nil(wf.flush_counters([]))
163
164
 
164
- input = { ['test.counter1', nil] => 7,
165
+ input = { ['test.counter1', nil] => 7,
165
166
  ['test.counter1', WH_TAGS] => 8,
166
- ['test.counter2', nil] => 9 }
167
+ ['test.counter2', nil] => 9 }
167
168
 
168
169
  mocket = Mocket.new
169
170
  spy = Spy.on(wf.writer.writer, :write).and_return(mocket)
@@ -189,9 +190,9 @@ class WavefrontMetricHelperTest < MiniTest::Test
189
190
  end
190
191
 
191
192
  def test_flush_counters_fail
192
- input = { ['test.counter1', nil] => 7,
193
+ input = { ['test.counter1', nil] => 7,
193
194
  ['test.counter1', WH_TAGS] => 8,
194
- ['test.counter2', nil] => 9 }
195
+ ['test.counter2', nil] => 9 }
195
196
 
196
197
  mocket = BadMocket.new
197
198
  spy = Spy.on(wf.writer.writer, :write).and_return(mocket)
@@ -222,7 +223,7 @@ class WavefrontMetricHelperTest < MiniTest::Test
222
223
 
223
224
  input = { ['test.dist1', :m, nil] => [10, 10, 11, 12],
224
225
  ['test.dist1', :m, WH_TAGS] => [123, 456, 789],
225
- ['test.dist1', :h, nil] => [6, 6, 7, 4, 6, 4, 8] }
226
+ ['test.dist1', :h, nil] => [6, 6, 7, 4, 6, 4, 8] }
226
227
 
227
228
  mocket = Mocket.new
228
229
  spy = Spy.on(wfd.dist_writer.writer, :write).and_return(mocket)
@@ -251,7 +252,7 @@ class WavefrontMetricHelperTest < MiniTest::Test
251
252
  def test_flush_dists_fail
252
253
  input = { ['test.dist1', :m, nil] => [10, 10, 11, 12],
253
254
  ['test.dist1', :m, WH_TAGS] => [123, 456, 789],
254
- ['test.dist1', :h, nil] => [6, 6, 7, 4, 6, 4, 8] }
255
+ ['test.dist1', :h, nil] => [6, 6, 7, 4, 6, 4, 8] }
255
256
 
256
257
  mocket = BadMocket.new
257
258
  spy = Spy.on(wfd.dist_writer.writer, :write).and_return(mocket)