wavefront-sdk 3.6.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +43 -2
- data/.travis.yml +5 -5
- data/HISTORY.md +32 -0
- data/README.md +4 -3
- data/lib/wavefront-sdk/account.rb +303 -0
- data/lib/wavefront-sdk/api_mixins/user.rb +20 -0
- data/lib/wavefront-sdk/core/api_caller.rb +50 -7
- data/lib/wavefront-sdk/core/exception.rb +6 -0
- data/lib/wavefront-sdk/core/response.rb +2 -1
- data/lib/wavefront-sdk/defs/version.rb +1 -3
- data/lib/wavefront-sdk/ingestionpolicy.rb +85 -0
- data/lib/wavefront-sdk/paginator/base.rb +21 -15
- data/lib/wavefront-sdk/query.rb +0 -1
- data/lib/wavefront-sdk/role.rb +104 -0
- data/lib/wavefront-sdk/spy.rb +126 -0
- data/lib/wavefront-sdk/stdlib/array.rb +1 -1
- data/lib/wavefront-sdk/stdlib/time.rb +13 -0
- data/lib/wavefront-sdk/support/mixins.rb +1 -1
- data/lib/wavefront-sdk/unstable/README.md +4 -0
- data/lib/wavefront-sdk/unstable/chart.rb +90 -0
- data/lib/wavefront-sdk/unstable/unstable.rb +9 -0
- data/lib/wavefront-sdk/usage.rb +31 -0
- data/lib/wavefront-sdk/user.rb +41 -0
- data/lib/wavefront-sdk/usergroup.rb +17 -16
- data/lib/wavefront-sdk/validators.rb +65 -7
- data/lib/wavefront-sdk/write.rb +13 -3
- data/spec/.rubocop.yml +42 -1
- data/spec/spec_helper.rb +4 -0
- data/spec/support/minitest_assertions.rb +4 -4
- data/spec/wavefront-sdk/account_spec.rb +238 -0
- data/spec/wavefront-sdk/core/api_caller_spec.rb +43 -0
- data/spec/wavefront-sdk/ingestionpolicy_spec.rb +43 -0
- data/spec/wavefront-sdk/metric_helper_spec.rb +1 -1
- data/spec/wavefront-sdk/role_spec.rb +68 -0
- data/spec/wavefront-sdk/spy_spec.rb +113 -0
- data/spec/wavefront-sdk/unstable/chart_spec.rb +39 -0
- data/spec/wavefront-sdk/usage_spec.rb +33 -0
- data/spec/wavefront-sdk/user_spec.rb +20 -0
- data/spec/wavefront-sdk/usergroup_spec.rb +21 -11
- data/spec/wavefront-sdk/validators_spec.rb +52 -6
- data/wavefront-sdk.gemspec +4 -4
- metadata +30 -9
@@ -118,7 +118,7 @@ class WavefrontMetricHelperTest < MiniTest::Test
|
|
118
118
|
assert_equal(1, out.select do |o|
|
119
119
|
o[:value] == [[2, 10.0], [1, 11.0],
|
120
120
|
[1, 12.0]]
|
121
|
-
end
|
121
|
+
end.size)
|
122
122
|
assert_equal(1, out.select { |o| o[:tags] == WH_TAGS }.size)
|
123
123
|
assert_equal(3, out.select { |o| o[:path] == 'test.dist1' }.size)
|
124
124
|
end
|
@@ -0,0 +1,68 @@
|
|
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 Wavefront::Role
|
8
|
+
#
|
9
|
+
class WavefrontRoleTest < WavefrontTestBase
|
10
|
+
include WavefrontTest::Create
|
11
|
+
include WavefrontTest::Delete
|
12
|
+
include WavefrontTest::Describe
|
13
|
+
include WavefrontTest::List
|
14
|
+
include WavefrontTest::Update
|
15
|
+
|
16
|
+
def test_add_assignees
|
17
|
+
assert_posts("/api/v2/role/#{id}/addAssignees", assignees.to_json) do
|
18
|
+
wf.add_assignees(id, assignees)
|
19
|
+
end
|
20
|
+
|
21
|
+
assert_raises(Wavefront::Exception::InvalidRoleId) do
|
22
|
+
wf.add_assignees(invalid_id, assignees)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_remove_assignees
|
27
|
+
assert_posts("/api/v2/role/#{id}/removeAssignees", assignees.to_json) do
|
28
|
+
wf.remove_assignees(id, assignees)
|
29
|
+
end
|
30
|
+
|
31
|
+
assert_raises(Wavefront::Exception::InvalidRoleId) do
|
32
|
+
wf.remove_assignees(invalid_id, assignees)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def api_class
|
39
|
+
:role
|
40
|
+
end
|
41
|
+
|
42
|
+
def id
|
43
|
+
'f8dc0c14-91a0-4ca9-8a2a-7d47f4db4672'
|
44
|
+
end
|
45
|
+
|
46
|
+
def roles
|
47
|
+
%w[f8dc0c14-91a0-4ca9-8a2a-7d47f4db4672
|
48
|
+
2659191e-aad4-4302-a94e-9667e1517127]
|
49
|
+
end
|
50
|
+
|
51
|
+
def assignees
|
52
|
+
roles.push('sa::test')
|
53
|
+
end
|
54
|
+
|
55
|
+
def invalid_id
|
56
|
+
'__BAD_ID__'
|
57
|
+
end
|
58
|
+
|
59
|
+
def payload
|
60
|
+
{ name: 'test role',
|
61
|
+
permissions: %w[alerts_management events_management],
|
62
|
+
description: 'dummy role for unit tests' }
|
63
|
+
end
|
64
|
+
|
65
|
+
def permission
|
66
|
+
'alerts_management'
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative '../spec_helper'
|
5
|
+
require_relative '../../lib/wavefront-sdk/spy'
|
6
|
+
|
7
|
+
# Unit tests for Spy class
|
8
|
+
#
|
9
|
+
class WavefrontSpyTest < MiniTest::Test
|
10
|
+
attr_reader :wf
|
11
|
+
|
12
|
+
def setup
|
13
|
+
@wf = Wavefront::Spy.new(CREDS)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_points
|
17
|
+
capture_io do
|
18
|
+
assert_gets('/api/spy/points?sampling=0.01') { wf.points }
|
19
|
+
assert_gets('/api/spy/points?sampling=0.05') { wf.points(0.05) }
|
20
|
+
|
21
|
+
assert_gets('/api/spy/points?sampling=0.05&metric=my_prefix') do
|
22
|
+
wf.points(0.05, prefix: 'my_prefix')
|
23
|
+
end
|
24
|
+
|
25
|
+
assert_gets('/api/spy/points?sampling=0.05&metric=my_prefix&host=h1') do
|
26
|
+
wf.points(0.05, prefix: 'my_prefix', host: 'h1')
|
27
|
+
end
|
28
|
+
|
29
|
+
assert_gets('/api/spy/points?sampling=0.02&metric=my_prefix&' \
|
30
|
+
'pointTagKey=mytag') do
|
31
|
+
wf.points(0.02, prefix: 'my_prefix', tag_key: 'mytag')
|
32
|
+
end
|
33
|
+
|
34
|
+
assert_gets('/api/spy/points?sampling=0.02&metric=my_prefix&' \
|
35
|
+
'pointTagKey=tag1&pointTagKey=tag2') do
|
36
|
+
wf.points(0.02, prefix: 'my_prefix', tag_key: %w[tag1 tag2])
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_histograms
|
42
|
+
capture_io do
|
43
|
+
assert_gets('/api/spy/histograms?sampling=0.01') { wf.histograms }
|
44
|
+
assert_gets('/api/spy/histograms?sampling=0.05') { wf.histograms(0.05) }
|
45
|
+
|
46
|
+
assert_gets('/api/spy/histograms?sampling=0.05&histogram=my_prefix') do
|
47
|
+
wf.histograms(0.05, prefix: 'my_prefix')
|
48
|
+
end
|
49
|
+
|
50
|
+
assert_gets(
|
51
|
+
'/api/spy/histograms?sampling=0.05&histogram=my_prefix&host=h1'
|
52
|
+
) do
|
53
|
+
wf.histograms(0.05, prefix: 'my_prefix', host: 'h1')
|
54
|
+
end
|
55
|
+
|
56
|
+
assert_gets('/api/spy/histograms?sampling=0.02&histogram=my_prefix&' \
|
57
|
+
'histogramTagKey=the_tag') do
|
58
|
+
wf.histograms(0.02, prefix: 'my_prefix', tag_key: 'the_tag')
|
59
|
+
end
|
60
|
+
|
61
|
+
assert_gets('/api/spy/histograms?sampling=0.02&histogram=my_prefix&' \
|
62
|
+
'histogramTagKey=tag1&histogramTagKey=tag2') do
|
63
|
+
wf.histograms(0.02, prefix: 'my_prefix', tag_key: %w[tag1 tag2])
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_spans
|
69
|
+
capture_io do
|
70
|
+
assert_gets('/api/spy/spans?sampling=0.01') { wf.spans }
|
71
|
+
assert_gets('/api/spy/spans?sampling=0.05') { wf.spans(0.05) }
|
72
|
+
|
73
|
+
assert_gets('/api/spy/spans?sampling=0.05&name=my_prefix') do
|
74
|
+
wf.spans(0.05, prefix: 'my_prefix')
|
75
|
+
end
|
76
|
+
|
77
|
+
assert_gets(
|
78
|
+
'/api/spy/spans?sampling=0.05&name=my_prefix&host=h1'
|
79
|
+
) do
|
80
|
+
wf.spans(0.05, prefix: 'my_prefix', host: 'h1')
|
81
|
+
end
|
82
|
+
|
83
|
+
assert_gets('/api/spy/spans?sampling=0.02&name=my_prefix&' \
|
84
|
+
'spanTagKey=the_tag') do
|
85
|
+
wf.spans(0.02, prefix: 'my_prefix', tag_key: 'the_tag')
|
86
|
+
end
|
87
|
+
|
88
|
+
assert_gets('/api/spy/spans?sampling=0.02&name=my_prefix&' \
|
89
|
+
'spanTagKey=tag1&spanTagKey=tag2') do
|
90
|
+
wf.spans(0.02, prefix: 'my_prefix', tag_key: %w[tag1 tag2])
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_ids
|
96
|
+
capture_io do
|
97
|
+
assert_gets('/api/spy/ids?sampling=0.01') { wf.ids }
|
98
|
+
assert_gets('/api/spy/ids?sampling=0.05') { wf.ids(0.05) }
|
99
|
+
|
100
|
+
assert_gets('/api/spy/ids?sampling=0.05&type=METRIC') do
|
101
|
+
wf.ids(0.05, type: 'METRIC')
|
102
|
+
end
|
103
|
+
|
104
|
+
assert_gets('/api/spy/ids?sampling=0.05&type=SPAN&name=my_prefix') do
|
105
|
+
wf.ids(0.05, type: 'SPAN', prefix: 'my_prefix')
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def dummy_response
|
111
|
+
DUMMY_RESPONSE
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative '../../spec_helper'
|
5
|
+
require_relative '../../../lib/wavefront-sdk/unstable/chart'
|
6
|
+
|
7
|
+
# Unit tests for Chart class
|
8
|
+
#
|
9
|
+
class WavefrontChartTest < MiniTest::Test
|
10
|
+
attr_reader :wf
|
11
|
+
|
12
|
+
def setup
|
13
|
+
@wf = Wavefront::Unstable::Chart.new(CREDS)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_all_metrics
|
17
|
+
assert_gets('/chart/metrics/all?l=100&q=&trie=true') do
|
18
|
+
wf.metrics_under('')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_metrics_under
|
23
|
+
assert_gets('/chart/metrics/all?l=100&q=test.path&trie=true') do
|
24
|
+
wf.metrics_under('test.path')
|
25
|
+
end
|
26
|
+
|
27
|
+
assert_gets('/chart/metrics/all?l=10&q=test.path&trie=true') do
|
28
|
+
wf.metrics_under('test.path', nil, 10)
|
29
|
+
end
|
30
|
+
|
31
|
+
assert_gets('/chart/metrics/all?l=100&p=last.one&q=test.path&trie=true') do
|
32
|
+
wf.metrics_under('test.path', 'last.one')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def dummy_response
|
37
|
+
{ metrics: ['test data'] }.to_json
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,33 @@
|
|
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 Usage class
|
8
|
+
#
|
9
|
+
class WavefrontUsageTest < WavefrontTestBase
|
10
|
+
def test_export_csv
|
11
|
+
assert_raises(ArgumentError) { wf.export_csv }
|
12
|
+
|
13
|
+
assert_gets("/api/v2/usage/exportcsv?startTime=#{t_start}") do
|
14
|
+
wf.export_csv(t_start)
|
15
|
+
end
|
16
|
+
|
17
|
+
assert_gets(
|
18
|
+
"/api/v2/usage/exportcsv?startTime=#{t_start}&endTime=#{t_end}"
|
19
|
+
) do
|
20
|
+
wf.export_csv(t_start, t_end)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def t_start
|
27
|
+
1_577_890_000
|
28
|
+
end
|
29
|
+
|
30
|
+
def t_end
|
31
|
+
1_577_899_999
|
32
|
+
end
|
33
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
require 'logger'
|
4
5
|
require_relative '../spec_helper'
|
5
6
|
require_relative '../test_mixins/general'
|
6
7
|
|
@@ -13,6 +14,13 @@ class WavefrontUserTest < WavefrontTestBase
|
|
13
14
|
include WavefrontTest::Describe
|
14
15
|
include WavefrontTest::Update
|
15
16
|
|
17
|
+
# Override the parent constructor so we can suppress all the 'deprecated'
|
18
|
+
# log messages
|
19
|
+
#
|
20
|
+
def setup
|
21
|
+
@wf = Wavefront::User.new(CREDS, logger: Logger.new('/dev/null'))
|
22
|
+
end
|
23
|
+
|
16
24
|
def test_list
|
17
25
|
assert_gets('/api/v2/user') { wf.list }
|
18
26
|
end
|
@@ -110,6 +118,14 @@ class WavefrontUserTest < WavefrontTestBase
|
|
110
118
|
assert_raises(ArgumentError) { wf.business_functions }
|
111
119
|
end
|
112
120
|
|
121
|
+
def test_validate_users
|
122
|
+
assert_posts('/api/v2/user/validateUsers', id_list.to_json) do
|
123
|
+
wf.validate_users(id_list)
|
124
|
+
end
|
125
|
+
|
126
|
+
assert_raises(ArgumentError) { wf.validate_users }
|
127
|
+
end
|
128
|
+
|
113
129
|
def test_response_shim
|
114
130
|
(RESOURCE_DIR + 'user_responses').each_child do |input|
|
115
131
|
# Ugly hack for the 202 in the 'create' file
|
@@ -156,4 +172,8 @@ class WavefrontUserTest < WavefrontTestBase
|
|
156
172
|
def payload
|
157
173
|
{ emailAddress: id, groups: %w[browse] }
|
158
174
|
end
|
175
|
+
|
176
|
+
def id_list
|
177
|
+
%w[id1 id2 id3]
|
178
|
+
end
|
159
179
|
end
|
@@ -7,7 +7,8 @@ require_relative '../test_mixins/general'
|
|
7
7
|
# Unit tests for WavefrontUserGroup
|
8
8
|
#
|
9
9
|
class WavefrontUserGroupTest < WavefrontTestBase
|
10
|
-
attr_reader :users, :groups, :permission, :invalid_groups, :invalid_users
|
10
|
+
attr_reader :users, :groups, :permission, :invalid_groups, :invalid_users,
|
11
|
+
:roles, :invalid_roles
|
11
12
|
|
12
13
|
include WavefrontTest::Create
|
13
14
|
include WavefrontTest::Delete
|
@@ -39,22 +40,28 @@ class WavefrontUserGroupTest < WavefrontTestBase
|
|
39
40
|
assert_invalid_id { wf.remove_users_from_group(invalid_id, users) }
|
40
41
|
end
|
41
42
|
|
42
|
-
def
|
43
|
-
assert_posts("/api/v2/usergroup
|
44
|
-
|
45
|
-
wf.grant(permission, groups)
|
43
|
+
def test_add_roles_to_group
|
44
|
+
assert_posts("/api/v2/usergroup/#{id}/addRoles", roles.to_json) do
|
45
|
+
wf.add_roles_to_group(id, roles)
|
46
46
|
end
|
47
47
|
|
48
|
-
|
48
|
+
assert_raises(Wavefront::Exception::InvalidRoleId) do
|
49
|
+
wf.add_roles_to_group(id, invalid_roles)
|
50
|
+
end
|
51
|
+
|
52
|
+
assert_invalid_id { wf.add_roles_to_group(invalid_id, roles) }
|
49
53
|
end
|
50
54
|
|
51
|
-
def
|
52
|
-
assert_posts("/api/v2/usergroup
|
53
|
-
|
54
|
-
|
55
|
+
def test_remove_roles_from_group
|
56
|
+
assert_posts("/api/v2/usergroup/#{id}/removeRoles", roles.to_json) do
|
57
|
+
wf.remove_roles_from_group(id, roles)
|
58
|
+
end
|
59
|
+
|
60
|
+
assert_raises(Wavefront::Exception::InvalidRoleId) do
|
61
|
+
wf.remove_roles_from_group(id, invalid_roles)
|
55
62
|
end
|
56
63
|
|
57
|
-
assert_invalid_id { wf.
|
64
|
+
assert_invalid_id { wf.remove_roles_from_group(invalid_id, roles) }
|
58
65
|
end
|
59
66
|
|
60
67
|
def setup_fixtures
|
@@ -63,7 +70,10 @@ class WavefrontUserGroupTest < WavefrontTestBase
|
|
63
70
|
@groups = %w[f8dc0c14-91a0-4ca9-8a2a-7d47f4db4672
|
64
71
|
2659191e-aad4-4302-a94e-9667e1517127]
|
65
72
|
@users = %w[someone@somewhere.com other@elsewhere.net]
|
73
|
+
@roles = %w[abcdef14-91a0-4ca9-8a2a-7d47f4db4672
|
74
|
+
fedcba1e-aad4-4302-a94e-9667e1517127]
|
66
75
|
@invalid_users = ['bad' * 500, '']
|
76
|
+
@invalid_roles = ['some nonsense']
|
67
77
|
end
|
68
78
|
|
69
79
|
private
|
@@ -323,19 +323,19 @@ class WavefrontValidatorsTest < MiniTest::Test
|
|
323
323
|
end
|
324
324
|
end
|
325
325
|
|
326
|
-
def
|
326
|
+
def test_wf_notificant_id
|
327
327
|
good = %w[CHTo47HvsPzSaGhh]
|
328
328
|
bad = ['CTo47HvsPzSaGhh', [], {}, nil, 'bad id']
|
329
329
|
good_and_bad('wf_notificant_id?', 'InvalidNotificantId', good, bad)
|
330
330
|
end
|
331
331
|
|
332
|
-
def
|
332
|
+
def test_wf_integration_id
|
333
333
|
good = %w[aws tutorial elasticsearch cassandra go]
|
334
334
|
bad = ['CTo47HvsPzSaGhh', [], {}, nil, 'bad id']
|
335
335
|
good_and_bad('wf_integration_id?', 'InvalidIntegrationId', good, bad)
|
336
336
|
end
|
337
337
|
|
338
|
-
def
|
338
|
+
def test_wf_apitoken_id
|
339
339
|
good = %w[2bfdcac7-1c9c-4c4b-9b56-c41c22c586dc
|
340
340
|
17db4cc1-65f6-40a8-a1fa-6fcae460c4bd
|
341
341
|
fca312fb-5ff4-420d-862d-5d6d99ed6bcf
|
@@ -345,24 +345,70 @@ class WavefrontValidatorsTest < MiniTest::Test
|
|
345
345
|
good_and_bad('wf_apitoken_id?', 'InvalidApiTokenId', good, bad)
|
346
346
|
end
|
347
347
|
|
348
|
-
def
|
348
|
+
def test_wf_distribution_interval
|
349
349
|
good = %i[m h d]
|
350
350
|
bad = ['m', [], {}, nil, 'bad id', :x, 'p']
|
351
351
|
good_and_bad('wf_distribution_interval?',
|
352
352
|
'InvalidDistributionInterval', good, bad)
|
353
353
|
end
|
354
354
|
|
355
|
-
def
|
355
|
+
def test_wf_serviceaccount_id
|
356
356
|
good = %w[sa::my-id sa::ID]
|
357
357
|
bad = %w[sc:id fca312fb-5ff4-420d-862d-5d6d99ed6bcf]
|
358
358
|
good_and_bad('wf_serviceaccount_id?',
|
359
359
|
'InvalidServiceAccountId', good, bad)
|
360
360
|
end
|
361
361
|
|
362
|
-
def
|
362
|
+
def test_wf_permission
|
363
363
|
good = %w[events_management external_links_management]
|
364
364
|
bad = ['events management', 'event_management', 'EVENT_MANAGEMENT']
|
365
365
|
good_and_bad('wf_permission?',
|
366
366
|
'InvalidPermission', good, bad)
|
367
367
|
end
|
368
|
+
|
369
|
+
def test_wf_ingestionpolicy_id
|
370
|
+
good = %w[another-ingestion-policy-1579538401492
|
371
|
+
testpolicy-1579537565010
|
372
|
+
213452-34-_-0-4-ingestion-policy-1579538556267
|
373
|
+
yet_another-ingestion-policy-1579538414190]
|
374
|
+
|
375
|
+
bad = %w[fa312fb-5ff4-420d-862d-5d6d99ed6bcf thing 123]
|
376
|
+
good_and_bad('wf_ingestionpolicy_id?',
|
377
|
+
'InvalidIngestionPolicyId',
|
378
|
+
good,
|
379
|
+
bad)
|
380
|
+
end
|
381
|
+
|
382
|
+
def test_wf_account_id
|
383
|
+
good = %w[sa::my-id sa::ID Some.User@example.com
|
384
|
+
general99+specific@somewhere.net someone@somewhere.com a user
|
385
|
+
user-name]
|
386
|
+
bad = ['', [], {}, 'a' * 1000]
|
387
|
+
good_and_bad('wf_account_id?', 'InvalidAccountId', good, bad)
|
388
|
+
end
|
389
|
+
|
390
|
+
def test_wf_managedcluster_id
|
391
|
+
good = %w[test-cluster other-cluster cluster]
|
392
|
+
bad = ['', [], {}, 'a' * 1000, '£"^WR"!']
|
393
|
+
good_and_bad('wf_monitoredcluster_id?',
|
394
|
+
'InvalidMonitoredClusterId',
|
395
|
+
good,
|
396
|
+
bad)
|
397
|
+
end
|
398
|
+
|
399
|
+
def test_wf_sampling_value
|
400
|
+
good = [0, 0.01, 0.003, 0.05]
|
401
|
+
bad = ['a', 0.1, 0.99, 1, -1, 1.1]
|
402
|
+
good_and_bad('wf_sampling_value?', 'InvalidSamplingValue', good, bad)
|
403
|
+
end
|
404
|
+
|
405
|
+
def test_wf_role_id
|
406
|
+
good = %w[2bfdcac7-1c9c-4c4b-9b56-c41c22c586dc
|
407
|
+
17db4cc1-65f6-40a8-a1fa-6fcae460c4bd
|
408
|
+
fca312fb-5ff4-420d-862d-5d6d99ed6bcf
|
409
|
+
3a1957e0-459e-49e5-9209-3888a4e8ac5b]
|
410
|
+
|
411
|
+
bad = %w[fa312fb-5ff4-420d-862d-5d6d99ed6bcf thing 123]
|
412
|
+
good_and_bad('wf_role_id?', 'InvalidRoleId', good, bad)
|
413
|
+
end
|
368
414
|
end
|