wavefront-sdk 6.0.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +4 -4
  3. data/.github/workflows/test.yml +2 -2
  4. data/.rubocop.yml +1 -3
  5. data/Gemfile +11 -0
  6. data/HISTORY.md +32 -4
  7. data/README.md +3 -3
  8. data/lib/wavefront-sdk/accesspolicy.rb +37 -0
  9. data/lib/wavefront-sdk/account.rb +28 -0
  10. data/lib/wavefront-sdk/alert.rb +29 -10
  11. data/lib/wavefront-sdk/api_mixins/tag.rb +12 -12
  12. data/lib/wavefront-sdk/apitoken.rb +29 -2
  13. data/lib/wavefront-sdk/cloudintegration.rb +10 -8
  14. data/lib/wavefront-sdk/cluster.rb +18 -0
  15. data/lib/wavefront-sdk/core/api_caller.rb +3 -9
  16. data/lib/wavefront-sdk/core/exception.rb +4 -0
  17. data/lib/wavefront-sdk/core/response.rb +1 -1
  18. data/lib/wavefront-sdk/credentials.rb +2 -2
  19. data/lib/wavefront-sdk/dashboard.rb +7 -6
  20. data/lib/wavefront-sdk/defs/version.rb +1 -1
  21. data/lib/wavefront-sdk/derivedmetric.rb +7 -6
  22. data/lib/wavefront-sdk/event.rb +5 -5
  23. data/lib/wavefront-sdk/externallink.rb +3 -3
  24. data/lib/wavefront-sdk/ingestionpolicy.rb +32 -5
  25. data/lib/wavefront-sdk/integration.rb +14 -4
  26. data/lib/wavefront-sdk/internals.rb +93 -0
  27. data/lib/wavefront-sdk/maintenancewindow.rb +4 -4
  28. data/lib/wavefront-sdk/message.rb +1 -1
  29. data/lib/wavefront-sdk/metric.rb +2 -2
  30. data/lib/wavefront-sdk/metric_helper.rb +1 -1
  31. data/lib/wavefront-sdk/metricspolicy.rb +3 -3
  32. data/lib/wavefront-sdk/monitoredapplication.rb +55 -0
  33. data/lib/wavefront-sdk/notificant.rb +4 -4
  34. data/lib/wavefront-sdk/paginator/base.rb +1 -1
  35. data/lib/wavefront-sdk/proxy.rb +26 -4
  36. data/lib/wavefront-sdk/role.rb +2 -2
  37. data/lib/wavefront-sdk/savedsearch.rb +4 -4
  38. data/lib/wavefront-sdk/search.rb +9 -7
  39. data/lib/wavefront-sdk/source.rb +6 -6
  40. data/lib/wavefront-sdk/spansamplingpolicy.rb +126 -0
  41. data/lib/wavefront-sdk/stdlib/string.rb +1 -1
  42. data/lib/wavefront-sdk/support/mixins.rb +1 -1
  43. data/lib/wavefront-sdk/support/parse_time.rb +1 -1
  44. data/lib/wavefront-sdk/user.rb +5 -5
  45. data/lib/wavefront-sdk/usergroup.rb +2 -2
  46. data/lib/wavefront-sdk/validators.rb +31 -8
  47. data/lib/wavefront-sdk/webhook.rb +3 -3
  48. data/lib/wavefront-sdk/write.rb +1 -0
  49. data/lib/wavefront-sdk/writers/api.rb +31 -8
  50. data/lib/wavefront-sdk/writers/core.rb +1 -1
  51. data/lib/wavefront_sdk.rb +1 -1
  52. data/spec/constants.rb +2 -2
  53. data/spec/spec_helper.rb +1 -1
  54. data/spec/wavefront-sdk/accesspolicy_spec.rb +53 -0
  55. data/spec/wavefront-sdk/account_spec.rb +32 -1
  56. data/spec/wavefront-sdk/alert_spec.rb +17 -0
  57. data/spec/wavefront-sdk/api_mixins/user_mixins_spec.rb +1 -1
  58. data/spec/wavefront-sdk/apitoken_spec.rb +12 -0
  59. data/spec/wavefront-sdk/cluster_spec.rb +13 -0
  60. data/spec/wavefront-sdk/core/api_caller_spec.rb +1 -1
  61. data/spec/wavefront-sdk/core/api_spec.rb +2 -2
  62. data/spec/wavefront-sdk/core/logger_spec.rb +1 -1
  63. data/spec/wavefront-sdk/core/response_spec.rb +1 -1
  64. data/spec/wavefront-sdk/credentials_spec.rb +11 -15
  65. data/spec/wavefront-sdk/distribution_spec.rb +1 -1
  66. data/spec/wavefront-sdk/ingestionpolicy_spec.rb +11 -0
  67. data/spec/wavefront-sdk/integration_spec.rb +4 -0
  68. data/spec/wavefront-sdk/internals_spec.rb +62 -0
  69. data/spec/wavefront-sdk/metric_helper_spec.rb +1 -1
  70. data/spec/wavefront-sdk/metricspolicy_spec.rb +3 -3
  71. data/spec/wavefront-sdk/misc_spec.rb +3 -3
  72. data/spec/wavefront-sdk/monitoredapplication_spec.rb +35 -0
  73. data/spec/wavefront-sdk/paginator/base_spec.rb +1 -1
  74. data/spec/wavefront-sdk/paginator/post_spec.rb +1 -1
  75. data/spec/wavefront-sdk/proxy_spec.rb +14 -0
  76. data/spec/wavefront-sdk/resources/swagger.spec.gz +0 -0
  77. data/spec/wavefront-sdk/savedsearch_spec.rb +2 -2
  78. data/spec/wavefront-sdk/spansamplingpolicy_spec.rb +47 -0
  79. data/spec/wavefront-sdk/spy_spec.rb +1 -1
  80. data/spec/wavefront-sdk/stdlib/array_spec.rb +1 -1
  81. data/spec/wavefront-sdk/stdlib/hash_spec.rb +1 -1
  82. data/spec/wavefront-sdk/stdlib/string_spec.rb +1 -1
  83. data/spec/wavefront-sdk/support/mixins_spec.rb +1 -1
  84. data/spec/wavefront-sdk/support/parse_time_spec.rb +1 -1
  85. data/spec/wavefront-sdk/unstable/chart_spec.rb +1 -1
  86. data/spec/wavefront-sdk/usage_spec.rb +0 -1
  87. data/spec/wavefront-sdk/user_spec.rb +2 -2
  88. data/spec/wavefront-sdk/validators_spec.rb +17 -1
  89. data/spec/wavefront-sdk/write_spec.rb +1 -1
  90. data/spec/wavefront-sdk/writers/api_spec.rb +1 -1
  91. data/spec/wavefront-sdk/writers/core_spec.rb +1 -1
  92. data/spec/wavefront-sdk/writers/http_spec.rb +1 -1
  93. data/spec/wavefront-sdk/writers/proxy_spec.rb +1 -1
  94. data/spec/wavefront-sdk/writers/socket_spec.rb +1 -1
  95. data/spec/wavefront-sdk/writers/summary_spec.rb +1 -1
  96. data/wavefront-sdk.gemspec +4 -15
  97. metadata +22 -224
@@ -19,7 +19,7 @@ end
19
19
 
20
20
  # Test Wavefront API caller
21
21
  #
22
- class WavefrontApiCallerTest < MiniTest::Test
22
+ class WavefrontApiCallerTest < Minitest::Test
23
23
  attr_reader :wf, :wf_noop, :uri_base, :headers
24
24
 
25
25
  def setup
@@ -6,7 +6,7 @@ require_relative '../../../lib/wavefront-sdk/core/api'
6
6
 
7
7
  # Test SDK core API class
8
8
  #
9
- class WavefrontCoreApiTest < MiniTest::Test
9
+ class WavefrontCoreApiTest < Minitest::Test
10
10
  attr_reader :wf
11
11
 
12
12
  def setup
@@ -22,7 +22,7 @@ class WavefrontCoreApiTest < MiniTest::Test
22
22
  end
23
23
 
24
24
  def test_hash_for_update
25
- wf.instance_variable_set('@update_keys', %i[k1 k2])
25
+ wf.instance_variable_set(:@update_keys, %i[k1 k2])
26
26
  body = { k1: 'ov1',
27
27
  k2: 'ov2',
28
28
  k3: 'ov3',
@@ -7,7 +7,7 @@ require_relative '../../../lib/wavefront-sdk/core/logger'
7
7
 
8
8
  # Test SDK logger class
9
9
  #
10
- class WavefrontLoggerTest < MiniTest::Test
10
+ class WavefrontLoggerTest < Minitest::Test
11
11
  attr_reader :wfl
12
12
 
13
13
  def setup
@@ -20,7 +20,7 @@ ERR_RESP = { error: 'HTTP 415 Unsupported Media Type',
20
20
  # Unit tests for Response class. Also indirectly tests the Status
21
21
  # type.
22
22
  #
23
- class WavefrontResponseTest < MiniTest::Test
23
+ class WavefrontResponseTest < Minitest::Test
24
24
  attr_reader :wfg, :wfb, :wfe
25
25
 
26
26
  def setup
@@ -5,12 +5,12 @@ require 'pathname'
5
5
  require_relative '../spec_helper'
6
6
  require_relative '../../lib/wavefront-sdk/credentials'
7
7
 
8
- CONF1 = RESOURCE_DIR + 'test.conf'
9
- CONF2 = RESOURCE_DIR + 'test2.conf'
8
+ CONF1 = RESOURCE_DIR.join('test.conf')
9
+ CONF2 = RESOURCE_DIR.join('test2.conf')
10
10
 
11
11
  # Test SDK base class end-to-end
12
12
  #
13
- class WavefrontCredentialsTest < MiniTest::Test
13
+ class WavefrontCredentialsTest < Minitest::Test
14
14
  def test_initialize_1
15
15
  ENV.delete('WAVEFRONT_ENDPOINT')
16
16
  ENV.delete('WAVEFRONT_TOKEN')
@@ -60,15 +60,11 @@ end
60
60
  # Test individual methods. We must override the constructor to do
61
61
  # this.
62
62
  #
63
- # rubocop:disable Lint/MissingSuper
64
- class Giblets < Wavefront::Credentials
65
- def initialize; end
66
- end
67
- # rubocop:enable Lint/MissingSuper
63
+ class Giblets < Wavefront::Credentials; end
68
64
 
69
65
  # And here are the tests
70
66
  #
71
- class GibletsTest < MiniTest::Test
67
+ class GibletsTest < Minitest::Test
72
68
  attr_reader :wf, :raw
73
69
 
74
70
  def setup
@@ -119,9 +115,9 @@ class GibletsTest < MiniTest::Test
119
115
 
120
116
  def test_populate
121
117
  wf.populate(raw)
122
- config = wf.instance_variable_get('@config')
123
- creds = wf.instance_variable_get('@creds')
124
- proxy = wf.instance_variable_get('@proxy')
118
+ config = wf.instance_variable_get(:@config)
119
+ creds = wf.instance_variable_get(:@creds)
120
+ proxy = wf.instance_variable_get(:@proxy)
125
121
 
126
122
  assert_instance_of(Map, config)
127
123
  assert_equal('raw_proxy', config.proxy)
@@ -143,8 +139,8 @@ class GibletsTest < MiniTest::Test
143
139
  assert_equal(3, x.length)
144
140
  x.each { |p| assert_instance_of(Pathname, p) }
145
141
  assert_includes(x, Pathname.new('/etc/wavefront/credentials'))
146
- assert_includes(x, Pathname.new(ENV['HOME']) + '.wavefront')
147
- assert_includes(x, Pathname.new(ENV['HOME']) + '.wavefront.conf')
142
+ assert_includes(x, Pathname.new(Dir.home).join('.wavefront'))
143
+ assert_includes(x, Pathname.new(Dir.home).join('.wavefront.conf'))
148
144
  end
149
145
 
150
146
  def test_cred_files_opts
@@ -197,7 +193,7 @@ class GibletsTest < MiniTest::Test
197
193
  end
198
194
 
199
195
  assert_raises Wavefront::Exception::InvalidConfigFile do
200
- wf.load_profile(RESOURCE_DIR + 'malformed.conf')
196
+ wf.load_profile(RESOURCE_DIR.join('malformed.conf'))
201
197
  end
202
198
  end
203
199
  end
@@ -7,7 +7,7 @@ require_relative '../../lib/wavefront-sdk/distribution'
7
7
  # Most of the distribution methods are inherited from the Write
8
8
  # class so they aren't tested again here.
9
9
  #
10
- class WavefrontDistributionTest < MiniTest::Test
10
+ class WavefrontDistributionTest < Minitest::Test
11
11
  attr_reader :wf
12
12
 
13
13
  def setup
@@ -11,6 +11,17 @@ class WavefrontIngestionPolicyTest < WavefrontTestBase
11
11
  include WavefrontTest::Describe
12
12
  include WavefrontTest::Update
13
13
  include WavefrontTest::Delete
14
+ include WavefrontTest::History
15
+
16
+ def test_revert
17
+ assert_posts("/api/v2/usage/ingestionpolicy/#{id}/revert/5", nil, :json) do
18
+ wf.revert(id, 5)
19
+ end
20
+
21
+ assert_raises(Wavefront::Exception::InvalidVersion) { wf.revert(id, 'v5') }
22
+
23
+ assert_invalid_id { wf.revert(invalid_id, 5) }
24
+ end
14
25
 
15
26
  private
16
27
 
@@ -47,6 +47,10 @@ class WavefrontIntegrationTest < WavefrontTestBase
47
47
  assert_gets('/api/v2/integration/status') { wf.statuses }
48
48
  end
49
49
 
50
+ def test_manifests_min
51
+ assert_gets('/api/v2/integration/manifests/min') { wf.manifests_min }
52
+ end
53
+
50
54
  private
51
55
 
52
56
  def api_class
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'zlib'
5
+ require_relative '../spec_helper'
6
+ require_relative '../../lib/wavefront-sdk/internals'
7
+
8
+ # Tests for internal methods
9
+ #
10
+ class TestInternals < Minitest::Test
11
+ attr_reader :t
12
+
13
+ def setup
14
+ @t = Wavefront::Internals.new
15
+ end
16
+
17
+ def test_sdk_files
18
+ result = t.sdk_files
19
+ assert_instance_of(Array, result)
20
+ assert(result.all?(&:file?))
21
+ assert(result.all? { |f| f.extname == '.rb' })
22
+ end
23
+
24
+ def test_supported_api_paths
25
+ result = t.supported_api_paths
26
+ assert_instance_of(Array, result)
27
+ assert paths_are_good(result)
28
+ end
29
+
30
+ def test_remote_api_paths
31
+ result = t.remote_api_paths(spec_resource)
32
+
33
+ assert paths_are_good(result)
34
+ end
35
+
36
+ def paths_are_good(result)
37
+ verbs = %w[GET PUT POST PATCH DELETE]
38
+
39
+ assert(result.all? do |verb, path|
40
+ verbs.include?(verb) && (path == '/report' ||
41
+ path.match?(%r{^/api/(v2|spy)/}))
42
+ end)
43
+
44
+ assert_includes(result, ['GET', '/api/v2/usage/ingestionpolicy/{id}'])
45
+ assert_includes(result, ['POST', '/api/v2/dashboard/acl/add'])
46
+ assert_includes(result, ['PUT', '/api/v2/dashboard/{id}/tag/{tagValue}'])
47
+
48
+ assert_includes(result, ['POST', '/api/v2/search/derivedmetric'])
49
+ assert_includes(result, ['POST', '/api/v2/search/derivedmetric/deleted'])
50
+ # assert_includes(result,
51
+ # ['POST', '/api/v2/search/derivedmetric/deleted/facets'])
52
+ # assert_includes(result,
53
+ # ['POST', '/api/v2/search/derivedmetric/deleted/{facet}'])
54
+ assert_includes(result, ['POST', '/api/v2/search/derivedmetric/facets'])
55
+ assert_includes(result, ['POST', '/api/v2/search/derivedmetric/{facet}'])
56
+ assert_includes(result, ['POST', '/api/v2/search/event'])
57
+ end
58
+
59
+ def spec_resource
60
+ Zlib::GzipReader.new(File.open(RESOURCE_DIR.join('swagger.spec.gz'))).read
61
+ end
62
+ end
@@ -13,7 +13,7 @@ WH_TAGS = { t1: 'v1', t2: 'v2' }.freeze
13
13
  # Tests for the MetricHelper class.
14
14
  #
15
15
  # rubocop:disable Style/NumericLiterals
16
- class WavefrontMetricHelperTest < MiniTest::Test
16
+ class WavefrontMetricHelperTest < Minitest::Test
17
17
  attr_reader :wf, :wfd
18
18
 
19
19
  def setup
@@ -18,17 +18,17 @@ class WavefrontMetricsPolicyTest < WavefrontTestBase
18
18
  end
19
19
 
20
20
  def test_history
21
- assert_gets('/api/v2/metricspolicy?offset=10&limit=100') do
21
+ assert_gets('/api/v2/metricspolicy/history?offset=10&limit=100') do
22
22
  wf.history(10)
23
23
  end
24
24
 
25
- assert_gets('/api/v2/metricspolicy?offset=12&limit=34') do
25
+ assert_gets('/api/v2/metricspolicy/history?offset=12&limit=34') do
26
26
  wf.history(12, 34)
27
27
  end
28
28
  end
29
29
 
30
30
  def test_revert
31
- assert_posts('/api/v2/metricspolicy/revert/5') do
31
+ assert_posts('/api/v2/metricspolicy/revert/5', nil, :json) do
32
32
  wf.revert(5)
33
33
  end
34
34
 
@@ -6,13 +6,13 @@ require_relative '../../lib/wavefront-sdk/defs/version'
6
6
 
7
7
  # Tests for things that aren't in the SDK itself.
8
8
  #
9
- class WavefrontMiscTest < MiniTest::Test
9
+ class WavefrontMiscTest < Minitest::Test
10
10
  # Check the latest version mentioned in the changelog is the version the SDK
11
11
  # defines itself as.
12
12
  #
13
13
  def test_version_vs_history
14
- history_file = WF_SDK_LOCATION + 'HISTORY.md'
15
- history_vers = IO.read(history_file).match(/^## (\d+\.\d+\.\d+) \(/)
14
+ history_file = WF_SDK_LOCATION.join('HISTORY.md')
15
+ history_vers = File.read(history_file).match(/^## (\d+\.\d+\.\d+) \(/)
16
16
  assert_equal(WF_SDK_VERSION, history_vers.captures.first)
17
17
  end
18
18
  end
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative '../spec_helper'
5
+ require_relative '../test_mixins/general'
6
+
7
+ # Unit tests for Webhook class
8
+ #
9
+ class WavefrontWebhookTest < WavefrontTestBase
10
+ include WavefrontTest::Describe
11
+ include WavefrontTest::List
12
+ include WavefrontTest::Update
13
+
14
+ private
15
+
16
+ def api_class
17
+ 'monitoredapplication'
18
+ end
19
+
20
+ def id
21
+ 'beachshirts'
22
+ end
23
+
24
+ def invalid_id
25
+ '+-+-+-+'
26
+ end
27
+
28
+ def payload
29
+ {
30
+ application: 'beachshirts',
31
+ satisfiedLatencyMillis: 100_000,
32
+ hidden: 'false'
33
+ }
34
+ end
35
+ end
@@ -18,7 +18,7 @@ end
18
18
 
19
19
  # Paginator tests
20
20
  #
21
- class WavefrontPaginatorBaseTest < MiniTest::Test
21
+ class WavefrontPaginatorBaseTest < Minitest::Test
22
22
  attr_reader :wf, :apicaller, :conn
23
23
 
24
24
  def setup
@@ -19,7 +19,7 @@ end
19
19
 
20
20
  # Test POST pagination
21
21
  #
22
- class WavefrontPaginatorPostTest < MiniTest::Test
22
+ class WavefrontPaginatorPostTest < Minitest::Test
23
23
  attr_reader :wf, :apicaller, :conn
24
24
 
25
25
  def setup
@@ -27,6 +27,20 @@ class WavefrontProxyTest < WavefrontTestBase
27
27
  end
28
28
  end
29
29
 
30
+ def test_config
31
+ assert_invalid_id { wf.config(invalid_id) }
32
+
33
+ assert_gets("/api/v2/proxy/#{id}/config") { wf.config(id) }
34
+ end
35
+
36
+ def test_preprocessor_rules
37
+ assert_invalid_id { wf.preprocessor_rules(invalid_id) }
38
+
39
+ assert_gets("/api/v2/proxy/#{id}/preprocessorRules") do
40
+ wf.preprocessor_rules(id)
41
+ end
42
+ end
43
+
30
44
  private
31
45
 
32
46
  def api_class
@@ -54,8 +54,8 @@ class WavefrontSavedSearchTest < WavefrontTestBase
54
54
 
55
55
  def payload
56
56
  { query: {
57
- foo: '{"searchTerms":[{"type":"freetext","value":"foo"}]}'
58
- },
57
+ foo: '{"searchTerms":[{"type":"freetext","value":"foo"}]}'
58
+ },
59
59
  entityType: 'DASHBOARD' }
60
60
  end
61
61
  end
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative '../spec_helper'
5
+ require_relative '../test_mixins/general'
6
+
7
+ # Unit tests for SpanSamplingPolicy class
8
+ #
9
+ class WavefrontSpanSamplingPolicyTest < WavefrontTestBase
10
+ include WavefrontTest::Create
11
+ include WavefrontTest::DeleteUndelete
12
+ include WavefrontTest::Describe
13
+ include WavefrontTest::History
14
+ include WavefrontTest::List
15
+ include WavefrontTest::Update
16
+
17
+ def test_deleted
18
+ assert_gets('/api/v2/spansamplingpolicy/deleted') { wf.deleted }
19
+ end
20
+
21
+ private
22
+
23
+ # used by the things we #include
24
+ #
25
+ def api_class
26
+ 'spansamplingpolicy'
27
+ end
28
+
29
+ def id
30
+ 'test_policy'
31
+ end
32
+
33
+ def invalid_id
34
+ {}
35
+ end
36
+
37
+ def payload
38
+ {
39
+ name: 'Test',
40
+ id: 'test',
41
+ active: false,
42
+ expression: "{{sourceName}}='localhost'",
43
+ description: 'test description',
44
+ samplingPercent: 100
45
+ }
46
+ end
47
+ end
@@ -6,7 +6,7 @@ require_relative '../../lib/wavefront-sdk/spy'
6
6
 
7
7
  # Unit tests for Spy class
8
8
  #
9
- class WavefrontSpyTest < MiniTest::Test
9
+ class WavefrontSpyTest < Minitest::Test
10
10
  attr_reader :wf
11
11
 
12
12
  def setup
@@ -6,7 +6,7 @@ require_relative '../../../lib/wavefront-sdk/stdlib/array'
6
6
 
7
7
  # Test extensions to stdlib's Array class
8
8
  #
9
- class ArrayTest < MiniTest::Test
9
+ class ArrayTest < Minitest::Test
10
10
  def test_uri_concat
11
11
  assert_equal('a/b', %w[a b].uri_concat)
12
12
  assert_equal('/a/b', ['', 'a', 'b'].uri_concat)
@@ -6,7 +6,7 @@ require_relative '../../../lib/wavefront-sdk/stdlib/hash'
6
6
 
7
7
  # Test extensions to stdlib hash class
8
8
  #
9
- class HashTest < MiniTest::Test
9
+ class HashTest < Minitest::Test
10
10
  def test_to_wf_tag
11
11
  assert_equal('', {}.to_wf_tag)
12
12
  assert_equal('gt1="gv1" gt2="gv2"',
@@ -6,7 +6,7 @@ require_relative '../../../lib/wavefront-sdk/stdlib/string'
6
6
 
7
7
  # Test extensions to stdlib's String class
8
8
  #
9
- class StringTest < MiniTest::Test
9
+ class StringTest < Minitest::Test
10
10
  def test_tagescape
11
11
  assert_equal('value', 'value'.tagescape)
12
12
  assert_equal('two words', 'two words'.tagescape)
@@ -7,7 +7,7 @@ require 'spy/integration'
7
7
 
8
8
  # Test SDK mixins
9
9
  #
10
- class WavefrontMixinsTest < MiniTest::Test
10
+ class WavefrontMixinsTest < Minitest::Test
11
11
  include Wavefront::Mixins
12
12
 
13
13
  def test_parse_time
@@ -9,7 +9,7 @@ TSM = 1_517_151_869_523
9
9
 
10
10
  # Test parse_time class
11
11
  #
12
- class WavefrontParseTimeTest < MiniTest::Test
12
+ class WavefrontParseTimeTest < Minitest::Test
13
13
  attr_reader :pts, :ptm
14
14
 
15
15
  def setup
@@ -6,7 +6,7 @@ require_relative '../../../lib/wavefront-sdk/unstable/chart'
6
6
 
7
7
  # Unit tests for Chart class
8
8
  #
9
- class WavefrontChartTest < MiniTest::Test
9
+ class WavefrontChartTest < Minitest::Test
10
10
  attr_reader :wf
11
11
 
12
12
  def setup
@@ -2,7 +2,6 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require_relative '../spec_helper'
5
- require_relative '../test_mixins/general'
6
5
 
7
6
  # Unit tests for Usage class
8
7
  #
@@ -127,10 +127,10 @@ class WavefrontUserTest < WavefrontTestBase
127
127
  end
128
128
 
129
129
  def test_response_shim
130
- (RESOURCE_DIR + 'user_responses').each_child do |input|
130
+ RESOURCE_DIR.join('user_responses').each_child do |input|
131
131
  # Ugly hack for the 202 in the 'create' file
132
132
  status = input.basename.to_s == 'create.json' ? 202 : 200
133
- shimmed = wf.response_shim(IO.read(input), status)
133
+ shimmed = wf.response_shim(File.read(input), status)
134
134
  assert_instance_of(String, shimmed)
135
135
 
136
136
  ret_obj = JSON.parse(shimmed, symbolize_names: true)
@@ -8,7 +8,7 @@ require_relative '../../lib/wavefront-sdk/validators'
8
8
 
9
9
  # Validator tests, obviously. Happy now Rubocop?
10
10
  #
11
- class WavefrontValidatorsTest < MiniTest::Test
11
+ class WavefrontValidatorsTest < Minitest::Test
12
12
  include Wavefront::Validators
13
13
 
14
14
  def good_and_bad(method, exception, good, bad)
@@ -396,6 +396,15 @@ class WavefrontValidatorsTest < MiniTest::Test
396
396
  bad)
397
397
  end
398
398
 
399
+ def test_wf_managedapplication_id
400
+ good = %w[test-app other-app application]
401
+ bad = ['', [], {}, 'a' * 1000, '£"^WR"!']
402
+ good_and_bad('wf_monitoredapplication_id?',
403
+ 'InvalidMonitoredApplicationId',
404
+ good,
405
+ bad)
406
+ end
407
+
399
408
  def test_wf_sampling_value
400
409
  good = [0, 0.01, 0.003, 0.05]
401
410
  bad = ['a', 0.1, 0.99, 1, -1, 1.1]
@@ -427,4 +436,11 @@ class WavefrontValidatorsTest < MiniTest::Test
427
436
  bad = %w[fa312fb-5ff4-420d-862d-5d6d99ed6bcf thing 123]
428
437
  good_and_bad('wf_metricspolicy_id?', 'InvalidMetricsPolicyId', good, bad)
429
438
  end
439
+
440
+ def test_wf_spansamplingpolicy_id
441
+ good = ['My Policy', 'policy', 'etc_etc_etc']
442
+ bad = [Pathname.pwd, nil]
443
+ good_and_bad('wf_spansamplingpolicy_id?', 'InvalidSpanSamplingPolicyId',
444
+ good, bad)
445
+ end
430
446
  end
@@ -11,7 +11,7 @@ require_relative 'resources/dummy_points'
11
11
  # This class is sufficiently different to the API calling classes
12
12
  # that it doesn't use spec helper or inherit anything.
13
13
  #
14
- class WavefrontWriteTest < MiniTest::Test
14
+ class WavefrontWriteTest < Minitest::Test
15
15
  attr_reader :wf, :wf_noop, :wf_tags
16
16
 
17
17
  def setup
@@ -10,7 +10,7 @@ HEADERS = POST_HEADERS.merge('Content-Type': 'application/octet-stream')
10
10
  # The report class test will test that an API call is made. Here all
11
11
  # that's left to test is the #validate_credentials method.
12
12
  #
13
- class WavefrontWriterApiTest < MiniTest::Test
13
+ class WavefrontWriterApiTest < Minitest::Test
14
14
  attr_reader :wf
15
15
 
16
16
  def setup
@@ -30,7 +30,7 @@ end
30
30
 
31
31
  # Test methods common to 'write' and 'report'
32
32
  #
33
- class WavefrontCoreWriteTest < MiniTest::Test
33
+ class WavefrontCoreWriteTest < Minitest::Test
34
34
  attr_reader :wf, :wf_tags
35
35
 
36
36
  def setup
@@ -10,7 +10,7 @@ WH_CREDS = { proxy: 'wavefront-proxy' }.freeze
10
10
 
11
11
  # Test HTTP transport
12
12
  #
13
- class WavefrontWriterSocketTest < MiniTest::Test
13
+ class WavefrontWriterSocketTest < Minitest::Test
14
14
  attr_reader :wf
15
15
 
16
16
  def setup
@@ -15,7 +15,7 @@ WS_CREDS = { proxy: 'wavefront-proxy' }.freeze
15
15
 
16
16
  # The Proxy class writes to a proxy TCP socket
17
17
  #
18
- class WavefrontWriterSocketTest < MiniTest::Test
18
+ class WavefrontWriterSocketTest < Minitest::Test
19
19
  attr_reader :wf, :wf_noop
20
20
 
21
21
  def setup
@@ -17,7 +17,7 @@ WU_CREDS = { socket: UNIX_SOCK }.freeze
17
17
 
18
18
  # Test UNIX Datagram socket writing
19
19
  #
20
- class WavefrontWriterUnixTest < MiniTest::Test
20
+ class WavefrontWriterUnixTest < Minitest::Test
21
21
  attr_reader :wf, :wf_noop
22
22
 
23
23
  def setup
@@ -6,7 +6,7 @@ require_relative '../../spec_helper'
6
6
 
7
7
  # Tests for summarizer
8
8
  #
9
- class WavefronWriterSummaryTest < MiniTest::Test
9
+ class WavefronWriterSummaryTest < Minitest::Test
10
10
  attr_reader :wf
11
11
 
12
12
  def setup
@@ -17,25 +17,14 @@ Gem::Specification.new do |gem|
17
17
  gem.license = 'BSD-2-Clause'
18
18
 
19
19
  gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
20
- gem.test_files = gem.files.grep(/^spec/)
21
20
  gem.require_paths = %w[lib]
22
21
  gem.bindir = 'bin'
23
22
 
24
- gem.add_dependency 'addressable', '~> 2.7'
25
- gem.add_dependency 'faraday', '~> 1.1'
23
+ gem.add_dependency 'addressable', '~> 2.8'
24
+ gem.add_dependency 'faraday', '~> 2.7'
26
25
  gem.add_dependency 'inifile', '~> 3.0'
27
26
  gem.add_dependency 'map', '~> 6.6'
28
27
 
29
- gem.add_development_dependency 'minitest', '~> 5.14'
30
- gem.add_development_dependency 'rake', '~> 13.0'
31
- gem.add_development_dependency 'rubocop', '~> 1.17'
32
- gem.add_development_dependency 'rubocop-minitest', '~> 0.10'
33
- gem.add_development_dependency 'rubocop-performance', '~> 1.3'
34
- gem.add_development_dependency 'rubocop-rake', '~> 0.5'
35
- gem.add_development_dependency 'simplecov', '~> 0.18'
36
- gem.add_development_dependency 'spy', '1.0.0'
37
- gem.add_development_dependency 'webmock', '~> 3.9'
38
- gem.add_development_dependency 'yard', '~> 0.9'
39
-
40
- gem.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
28
+ gem.required_ruby_version = Gem::Requirement.new('>= 3.0')
29
+ gem.metadata['rubygems_mfa_required'] = 'true'
41
30
  end