wavefront-sdk 5.3.0 → 5.3.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
  SHA256:
3
- metadata.gz: 9589c220f3c1cb86c7e3c4e3f051315508358580656e61e61d716a756568e9a4
4
- data.tar.gz: 03b24e65b9617170af9b03eadae0d7cbd9d78cea99f1be60f8452ef79989d81d
3
+ metadata.gz: 0fc4311b2322403ef715d9a62c5f84712accb5ed1ee9e5350e0bbcb6237fe631
4
+ data.tar.gz: f2fb99d1f35d601a619f0e7135f8b22ea0b22d0697752af5a265132d867216bb
5
5
  SHA512:
6
- metadata.gz: 9ea8ef64251bb430053390d991a16024f1d1545524fe36479a5369c94dcf87669bb77a1cfab92395e2cdd6e23d10fa6c38738fe7227a6e572e0630f35830afca
7
- data.tar.gz: b85aa3b9a03e338b4db8fc702bb0b03532d1eaa7618e044f10a7dbc9a973ffebdeaa4891f4a02c717e7c59db280cee551b8765d6cf8dee2f8fe630f6d5bb4201
6
+ metadata.gz: a2e79e3ce013f9fcdc3e28d7e111c586746e65ae341b0187b44b3908d29d81ae9aa8f0723d8eeea239c27f9976b232aa2acf2ecda92b797b0c45f25dc9e9c612
7
+ data.tar.gz: 20f3124667013b4f1212df12c6e04c235e7dfda24e3f0ac9a87ba4c4a4884d96d11f1a855d460f8026d65d8a35754d7a2f5d0bf705f13456dea066d0faee7822
@@ -0,0 +1,32 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ matrix:
21
+ ruby-version: [2.4.10, 2.5.8, 2.6.6, 2.7.2]
22
+ steps:
23
+ - uses: actions/checkout@v2
24
+ - name: Set up Ruby
25
+ uses: ruby/setup-ruby@v1
26
+ with:
27
+ ruby-version: ${{ matrix.ruby-version }}
28
+ bundler-cache: true
29
+ - name: Install dependencies
30
+ run: bundle install
31
+ - name: Run tests
32
+ run: bundle exec rake
data/HISTORY.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.3.1 (2020-12-11)
4
+ * Fix error when renaming ingestion policies, and improve testing which should
5
+ have caught the problem in the first place.
6
+
3
7
  ## 5.3.0 (2020-10-10)
4
8
  * Add `Wavefront::Proxy#shutdown` which can shut down a proxy via the API.
5
9
 
@@ -128,5 +128,9 @@ module Wavefront
128
128
  wf_aws_external_id?(external_id)
129
129
  api.get(['awsExternalId', external_id].uri_concat)
130
130
  end
131
+
132
+ def update_keys
133
+ %i[name]
134
+ end
131
135
  end
132
136
  end
@@ -81,9 +81,9 @@ module Wavefront
81
81
  (time.to_f * 1000).round
82
82
  end
83
83
 
84
- # doing a PUT to update an object requires only a certain subset of
84
+ # Doing a PUT to update an object requires only a certain subset of
85
85
  # the keys returned by #describe(). This method takes the
86
- # existing description of an object and turns it into a new has
86
+ # existing description of an object and turns it into a new hash
87
87
  # which can be PUT.
88
88
  #
89
89
  # @param old [Hash] a hash of the existing object
@@ -2,5 +2,5 @@
2
2
 
3
3
  require 'pathname'
4
4
 
5
- WF_SDK_VERSION = '5.3.0'
5
+ WF_SDK_VERSION = '5.3.1'
6
6
  WF_SDK_LOCATION = Pathname.new(__dir__).parent.parent.parent
@@ -112,11 +112,9 @@ module Wavefront
112
112
  wf_derivedmetric_id?(id)
113
113
  end
114
114
 
115
- private
116
-
117
115
  def update_keys
118
- %i[id name query tags additionalInformation
119
- includeObsoleteMetrics processRateMinutes minutes]
116
+ %i[name query tags additionalInformation includeObsoleteMetrics
117
+ processRateMinutes minutes]
120
118
  end
121
119
  end
122
120
  end
@@ -81,5 +81,9 @@ module Wavefront
81
81
  api.put(id, hash_for_update(describe(id).response, body),
82
82
  'application/json')
83
83
  end
84
+
85
+ def update_keys
86
+ %i[name]
87
+ end
84
88
  end
85
89
  end
@@ -83,8 +83,6 @@ module Wavefront
83
83
  api.post(['test', id].uri_concat, nil)
84
84
  end
85
85
 
86
- private
87
-
88
86
  def update_keys
89
87
  %i[id contentType method description title template triggers
90
88
  recipient customHttpHeaders emailSubject isHtmlContent]
@@ -80,5 +80,9 @@ module Wavefront
80
80
  api.get(['type', entitytype].uri_concat, offset: offset,
81
81
  limit: limit)
82
82
  end
83
+
84
+ def update_keys
85
+ %i[query entityType]
86
+ end
83
87
  end
84
88
  end
@@ -297,6 +297,10 @@ module Wavefront
297
297
  raise NoMethodError
298
298
  end
299
299
 
300
+ def update_keys
301
+ %i[identifier groups userGroups]
302
+ end
303
+
300
304
  private
301
305
 
302
306
  def response_looks_right?(body_obj)
@@ -311,9 +315,5 @@ module Wavefront
311
315
 
312
316
  items.fetch(:message, 'no message from API')
313
317
  end
314
-
315
- def update_keys
316
- %i[identifier groups userGroups]
317
- end
318
318
  end
319
319
  end
@@ -65,6 +65,7 @@ module WavefrontTest
65
65
  module Update
66
66
  def test_update
67
67
  [payload].flatten.each do |p|
68
+ # passes payload through as-is
68
69
  assert_puts("/api/v2/#{api_class}/#{id}", p) do
69
70
  wf.update(id, p, false)
70
71
  end
@@ -73,6 +74,11 @@ module WavefrontTest
73
74
  assert_raises(ArgumentError) { wf.update }
74
75
  end
75
76
  end
77
+
78
+ def test_update_keys
79
+ assert_instance_of Array, wf.update_keys
80
+ assert(wf.update_keys.all? { |k| k.is_a?(Symbol) })
81
+ end
76
82
  end
77
83
 
78
84
  module Clone
@@ -4,7 +4,6 @@
4
4
  require_relative '../spec_helper'
5
5
  require_relative '../test_mixins/acl'
6
6
  require_relative '../test_mixins/tag'
7
- require_relative '../test_mixins/update_keys'
8
7
  require_relative '../test_mixins/general'
9
8
 
10
9
  # Unit tests for Alert class
@@ -20,7 +19,6 @@ class WavefrontAlertTest < WavefrontTestBase
20
19
  include WavefrontTest::List
21
20
  include WavefrontTest::Tag
22
21
  include WavefrontTest::Update
23
- include WavefrontTest::UpdateKeys
24
22
 
25
23
  def test_snooze
26
24
  assert_posts("/api/v2/alert/#{id}/snooze") { wf.snooze(id) }
@@ -23,7 +23,15 @@ class WavefrontCoreApiTest < MiniTest::Test
23
23
 
24
24
  def test_hash_for_update
25
25
  wf.instance_variable_set('@update_keys', %i[k1 k2])
26
- body = { k1: 'ov1', k2: 'ov2', k3: 'ov3' }
26
+ body = { k1: 'ov1',
27
+ k2: 'ov2',
28
+ k3: 'ov3',
29
+ customerId: 'test',
30
+ creatorId: 'someone@example.com',
31
+ createUserId: 'someone@example.com',
32
+ updateUserId: 'someone@example.com',
33
+ createdEpochMillis: 1_607_691_387_023,
34
+ updatedEpochMillis: 1_607_691_387_023 }
27
35
  upd = { k2: 'nv1' }
28
36
  assert_equal({ k1: 'ov1', k2: 'nv1' }, wf.hash_for_update(body, upd))
29
37
  end
@@ -4,7 +4,6 @@
4
4
  require_relative '../spec_helper'
5
5
  require_relative '../test_mixins/acl'
6
6
  require_relative '../test_mixins/tag'
7
- require_relative '../test_mixins/update_keys'
8
7
  require_relative '../test_mixins/general'
9
8
 
10
9
  # Unit tests for dashboard class
@@ -18,7 +17,6 @@ class WavefrontDashboardTest < WavefrontTestBase
18
17
  include WavefrontTest::List
19
18
  include WavefrontTest::Tag
20
19
  include WavefrontTest::Update
21
- include WavefrontTest::UpdateKeys
22
20
 
23
21
  def test_favorite
24
22
  assert_posts("/api/v2/dashboard/#{id}/favorite") { wf.favorite(id) }
@@ -10,6 +10,7 @@ class WavefrontNotificantTest < WavefrontTestBase
10
10
  include WavefrontTest::List
11
11
  include WavefrontTest::Delete
12
12
  include WavefrontTest::Describe
13
+ include WavefrontTest::Update
13
14
 
14
15
  def test_test
15
16
  assert_posts("/api/v2/notificant/test/#{id}") { wf.test(id) }
@@ -29,4 +30,30 @@ class WavefrontNotificantTest < WavefrontTestBase
29
30
  def invalid_id
30
31
  '---rubbish---'
31
32
  end
33
+
34
+ def payload
35
+ JSON.parse(%(
36
+ {
37
+ "method": "PAGERDUTY",
38
+ "id": "PE0BEkf4r123yooO",
39
+ "contentType": "",
40
+ "description": "Test target",
41
+ "customerId": "sysdef",
42
+ "title": "Terraform Test Target",
43
+ "recipient": "12345678910111213141516171819202",
44
+ "creatorId": "someone@example.com",
45
+ "updaterId": "someone@example.com",
46
+ "createdEpochMillis": 1604513812010,
47
+ "updatedEpochMillis": 1604513812010,
48
+ "template": "{}",
49
+ "triggers": [
50
+ "ALERT_OPENED",
51
+ "ALERT_RESOLVED"
52
+ ],
53
+ "customHttpHeaders": {},
54
+ "emailSubject": "",
55
+ "isHtmlContent": false
56
+ }
57
+ ), symbolize_names: true)
58
+ end
32
59
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wavefront-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.0
4
+ version: 5.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Fisher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-31 00:00:00.000000000 Z
11
+ date: 2020-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -171,6 +171,7 @@ extensions: []
171
171
  extra_rdoc_files: []
172
172
  files:
173
173
  - ".codeclimate.yml"
174
+ - ".github/workflows/ruby.yml"
174
175
  - ".gitignore"
175
176
  - ".rubocop.yml"
176
177
  - ".travis.yml"
@@ -254,7 +255,6 @@ files:
254
255
  - spec/test_mixins/acl.rb
255
256
  - spec/test_mixins/general.rb
256
257
  - spec/test_mixins/tag.rb
257
- - spec/test_mixins/update_keys.rb
258
258
  - spec/wavefront-sdk/account_spec.rb
259
259
  - spec/wavefront-sdk/alert_spec.rb
260
260
  - spec/wavefront-sdk/api_mixins/user_mixins_spec.rb
@@ -352,7 +352,6 @@ test_files:
352
352
  - spec/test_mixins/acl.rb
353
353
  - spec/test_mixins/general.rb
354
354
  - spec/test_mixins/tag.rb
355
- - spec/test_mixins/update_keys.rb
356
355
  - spec/wavefront-sdk/account_spec.rb
357
356
  - spec/wavefront-sdk/alert_spec.rb
358
357
  - spec/wavefront-sdk/api_mixins/user_mixins_spec.rb
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module WavefrontTest
4
- #
5
- # include this into any class which has update keys
6
- #
7
- module UpdateKeys
8
- def test_update_keys
9
- assert_instance_of Array, wf.update_keys
10
- assert(wf.update_keys.all? { |k| k.is_a?(Symbol) })
11
- end
12
- end
13
- end