wavefront-cli 2.1.4 → 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +1147 -0
- data/README.md +1 -1
- data/lib/wavefront-cli/alert.rb +2 -3
- data/lib/wavefront-cli/base.rb +27 -20
- data/lib/wavefront-cli/commands/alert.rb +0 -1
- data/lib/wavefront-cli/commands/event.rb +3 -2
- data/lib/wavefront-cli/commands/query.rb +0 -1
- data/lib/wavefront-cli/commands/window.rb +0 -1
- data/lib/wavefront-cli/commands/write.rb +0 -1
- data/lib/wavefront-cli/constants.rb +0 -1
- data/lib/wavefront-cli/controller.rb +5 -5
- data/lib/wavefront-cli/display/alert.rb +3 -5
- data/lib/wavefront-cli/display/dashboard.rb +3 -3
- data/lib/wavefront-cli/display/webhook.rb +2 -2
- data/lib/wavefront-cli/display/write.rb +1 -1
- data/lib/wavefront-cli/event.rb +67 -53
- data/lib/wavefront-cli/integration.rb +0 -1
- data/lib/wavefront-cli/maintenancewindow.rb +36 -20
- data/lib/wavefront-cli/opt_handler.rb +1 -1
- data/lib/wavefront-cli/query.rb +44 -27
- data/lib/wavefront-cli/string.rb +13 -25
- data/lib/wavefront-cli/version.rb +1 -1
- data/lib/wavefront-cli/write.rb +2 -7
- data/spec/.rubocop.yml +16 -0
- data/spec/spec_helper.rb +55 -55
- data/spec/wavefront-cli/alert_spec.rb +8 -8
- data/spec/wavefront-cli/base_spec.rb +1 -1
- data/spec/wavefront-cli/cloudintegration_spec.rb +6 -6
- data/spec/wavefront-cli/commands/base_spec.rb +0 -2
- data/spec/wavefront-cli/controller_spec.rb +5 -5
- data/spec/wavefront-cli/dashboard_spec.rb +8 -8
- data/spec/wavefront-cli/display/base_spec.rb +22 -23
- data/spec/wavefront-cli/display/printer/long_spec.rb +30 -28
- data/spec/wavefront-cli/event_spec.rb +8 -8
- data/spec/wavefront-cli/externallink_spec.rb +6 -6
- data/spec/wavefront-cli/maintanancewindow_spec.rb +8 -9
- data/spec/wavefront-cli/opt_handler_spec.rb +4 -5
- data/spec/wavefront-cli/proxy_spec.rb +8 -8
- data/spec/wavefront-cli/savedsearch_spec.rb +6 -6
- data/spec/wavefront-cli/source_spec.rb +8 -8
- data/spec/wavefront-cli/string_spec.rb +2 -3
- data/spec/wavefront-cli/webhook_spec.rb +8 -8
- data/wavefront-cli.gemspec +3 -3
- metadata +20 -5
@@ -8,8 +8,8 @@ require_relative(File.join('../../../lib/wavefront-cli/display',
|
|
8
8
|
.to_s.sub('_spec.rb', '')))
|
9
9
|
require_relative './spec_helper'
|
10
10
|
|
11
|
-
S_DATA = Map.new
|
12
|
-
S_OPTIONS = { '<id>': 'abc123' }
|
11
|
+
S_DATA = Map.new
|
12
|
+
S_OPTIONS = { '<id>': 'abc123' }.freeze
|
13
13
|
|
14
14
|
# Test base class for display methods
|
15
15
|
#
|
@@ -21,16 +21,15 @@ class WavefrontDisplayBaseTest < MiniTest::Test
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_put_id_first
|
24
|
-
assert_equal(wf.put_id_first(
|
25
|
-
|
26
|
-
assert_equal(wf.put_id_first(
|
27
|
-
|
28
|
-
assert_equal(wf.put_id_first(
|
29
|
-
|
24
|
+
assert_equal(wf.put_id_first(k1: 1, k2: 2, id: 3, k4: 4),
|
25
|
+
id: 3, k1: 1, k2: 2, k4: 4)
|
26
|
+
assert_equal(wf.put_id_first(id: 3, k1: 1, k2: 2, k4: 4),
|
27
|
+
id: 3, k1: 1, k2: 2, k4: 4)
|
28
|
+
assert_equal(wf.put_id_first(k2: 1, k1: 2, k4: 4),
|
29
|
+
k2: 1, k1: 2, k4: 4)
|
30
30
|
end
|
31
31
|
|
32
|
-
def test_run
|
33
|
-
end
|
32
|
+
def test_run; end
|
34
33
|
|
35
34
|
def test_friendly_name
|
36
35
|
assert_equal(wf.friendly_name, 'base')
|
@@ -82,11 +81,11 @@ class WavefrontDisplayBaseTest < MiniTest::Test
|
|
82
81
|
assert_output("No tags set on base 'abc123'.\n") { wf.do_tags }
|
83
82
|
|
84
83
|
assert_output("tag1\ntag2\n") do
|
85
|
-
WavefrontDisplay::Base.new(%w
|
84
|
+
WavefrontDisplay::Base.new(%w[tag1 tag2], S_OPTIONS).do_tags
|
86
85
|
end
|
87
86
|
|
88
87
|
assert_output("tag1\n") do
|
89
|
-
WavefrontDisplay::Base.new(%w
|
88
|
+
WavefrontDisplay::Base.new(%w[tag1], S_OPTIONS).do_tags
|
90
89
|
end
|
91
90
|
end
|
92
91
|
|
@@ -102,7 +101,7 @@ class WavefrontDisplayBaseTest < MiniTest::Test
|
|
102
101
|
wf = WavefrontDisplay::Base.new(data)
|
103
102
|
wf.drop_fields(:k1)
|
104
103
|
assert_equal(wf.instance_variable_get(:@data),
|
105
|
-
|
104
|
+
k2: Time.now.to_i, k3: Time.now.to_i)
|
106
105
|
end
|
107
106
|
|
108
107
|
def test_drop_fields_3
|
@@ -120,41 +119,41 @@ class WavefrontDisplayBaseTest < MiniTest::Test
|
|
120
119
|
end
|
121
120
|
|
122
121
|
def test_readable_time_2
|
123
|
-
data = { k1: 'string', k2:
|
122
|
+
data = { k1: 'string', k2: 1_499_426_615, k3: 1_499_426_615 }
|
124
123
|
wf = WavefrontDisplay::Base.new(data)
|
125
124
|
wf.readable_time(:k2)
|
126
125
|
x = wf.data
|
127
126
|
assert x.is_a?(Hash)
|
128
127
|
assert_equal(x.size, 3)
|
129
|
-
assert_equal(x.keys, %i
|
128
|
+
assert_equal(x.keys, %i[k1 k2 k3])
|
130
129
|
assert_equal(x[:k1], 'string')
|
131
130
|
assert_match(/^20\d\d-[01]\d-[0-3]\d [0-2]\d:[0-5]\d:[0-5]\d$/, x[:k2])
|
132
|
-
assert_equal(x[:k3],
|
131
|
+
assert_equal(x[:k3], 1_499_426_615)
|
133
132
|
end
|
134
133
|
|
135
|
-
def
|
136
|
-
data = { k1: 'string', k2:
|
134
|
+
def test_readable_time_3
|
135
|
+
data = { k1: 'string', k2: 1_499_426_615, k3: 1_499_426_615 }
|
137
136
|
wf = WavefrontDisplay::Base.new(data)
|
138
137
|
wf.readable_time(:k2, :k3)
|
139
138
|
x = wf.data
|
140
139
|
assert x.is_a?(Hash)
|
141
140
|
assert_equal(x.size, 3)
|
142
|
-
assert_equal(x.keys, %i
|
141
|
+
assert_equal(x.keys, %i[k1 k2 k3])
|
143
142
|
assert_equal(x[:k1], 'string')
|
144
143
|
assert_match(/^20\d\d-[01]\d-[0-3]\d [0-2]\d:[0-5]\d:[0-5]\d$/, x[:k2])
|
145
144
|
assert_match(/^20\d\d-[01]\d-[0-3]\d [0-2]\d:[0-5]\d:[0-5]\d$/, x[:k3])
|
146
145
|
end
|
147
146
|
|
148
147
|
def test_human_time
|
149
|
-
assert_raises(ArgumentError) { wf.human_time([1,2,3]) }
|
148
|
+
assert_raises(ArgumentError) { wf.human_time([1, 2, 3]) }
|
150
149
|
assert_raises(ArgumentError) { wf.human_time(123) }
|
151
|
-
assert_raises(ArgumentError) { wf.human_time(
|
152
|
-
assert_equal('2017-07-07 11:23:35', wf.human_time(
|
150
|
+
assert_raises(ArgumentError) { wf.human_time(12_345_678_901_234) }
|
151
|
+
assert_equal('2017-07-07 11:23:35', wf.human_time(1_499_426_615, true))
|
153
152
|
assert_match(/^20\d\d-[01]\d-[0-3]\d [0-2]\d:[0-5]\d:[0-5]\d.\d{3}$/,
|
154
153
|
wf.human_time(DateTime.now.strftime('%Q')))
|
155
154
|
assert_match(/^20\d\d-[01]\d-[0-3]\d [0-2]\d:[0-5]\d:[0-5]\d$/,
|
156
155
|
wf.human_time(Time.now.to_i))
|
157
|
-
assert_equal('2017-07-07 11:23:35.123', wf.human_time(
|
156
|
+
assert_equal('2017-07-07 11:23:35.123', wf.human_time(1_499_426_615_123,
|
158
157
|
true))
|
159
158
|
end
|
160
159
|
end
|
@@ -3,6 +3,8 @@
|
|
3
3
|
require_relative '../../../../lib/wavefront-cli/display/printer/long'
|
4
4
|
require_relative '../spec_helper'
|
5
5
|
|
6
|
+
# Test verbose printing stuff
|
7
|
+
#
|
6
8
|
class WavefrontDisplayPrinterLong < MiniTest::Test
|
7
9
|
attr_reader :wf
|
8
10
|
|
@@ -27,17 +29,35 @@ class WavefrontDisplayPrinterLong < MiniTest::Test
|
|
27
29
|
assert_equal(' key value', wf.mk_line('key', 'value'))
|
28
30
|
end
|
29
31
|
|
32
|
+
def test_mk_line_3
|
33
|
+
wf.instance_variable_set(:@kw, 7)
|
34
|
+
wf.instance_variable_set(:@indent_str, ' ')
|
35
|
+
assert_equal(' key value', wf.mk_line('key', 'value'))
|
36
|
+
assert_equal(' value', wf.mk_line(nil, 'value'))
|
37
|
+
assert_equal(' value', wf.mk_line('', 'value'))
|
38
|
+
assert_equal(" key a long string which must be\n" \
|
39
|
+
' folded once',
|
40
|
+
wf.mk_line('key', 'a long string which must be ' \
|
41
|
+
'folded once', 40))
|
42
|
+
assert_equal(" key a very long string whose very length\n" \
|
43
|
+
" means that the method is going to\n" \
|
44
|
+
' have to fold it twice',
|
45
|
+
wf.mk_line('key', 'a very long string whose very ' \
|
46
|
+
'length means that the method is going to ' \
|
47
|
+
'have to fold it twice', 49))
|
48
|
+
end
|
49
|
+
|
30
50
|
def test_mk_indent
|
31
51
|
wf.mk_indent(2)
|
32
52
|
assert_equal(wf.instance_variable_get(:@indent_str), ' ')
|
33
53
|
end
|
34
54
|
|
35
55
|
def test_preen_fields
|
36
|
-
assert_equal(wf.preen_fields({k1: 1, k2: 2}, [:k1]),
|
37
|
-
assert_equal(wf.preen_fields(
|
38
|
-
assert_equal(wf.preen_fields({k1: 1, k2: 2}, [:k3]), {})
|
39
|
-
assert_equal(wf.preen_fields({k1: 1, k2: 2}, [
|
40
|
-
|
56
|
+
assert_equal(wf.preen_fields({ k1: 1, k2: 2 }, [:k1]), k1: 1)
|
57
|
+
assert_equal(wf.preen_fields(k1: 1, k2: 2), k1: 1, k2: 2)
|
58
|
+
assert_equal(wf.preen_fields({ k1: 1, k2: 2 }, [:k3]), {})
|
59
|
+
assert_equal(wf.preen_fields({ k1: 1, k2: 2 }, %i[k1 k2]),
|
60
|
+
k1: 1, k2: 2)
|
41
61
|
end
|
42
62
|
|
43
63
|
def test_preen_value
|
@@ -59,14 +79,14 @@ class WavefrontDisplayPrinterLong < MiniTest::Test
|
|
59
79
|
def test_parse_line_1
|
60
80
|
assert_nil wf.parse_line(:k, [])
|
61
81
|
spy = Spy.on(wf, :add_hash)
|
62
|
-
wf.parse_line('key',
|
63
|
-
assert spy.has_been_called_with?('key',
|
82
|
+
wf.parse_line('key', k1: 1, k2: 2)
|
83
|
+
assert spy.has_been_called_with?('key', k1: 1, k2: 2)
|
64
84
|
end
|
65
85
|
|
66
86
|
def test_parse_line_2
|
67
87
|
spy = Spy.on(wf, :add_array)
|
68
|
-
wf.parse_line('key', [1,2,3,4])
|
69
|
-
assert spy.has_been_called_with?('key', [1,2,3,4])
|
88
|
+
wf.parse_line('key', [1, 2, 3, 4])
|
89
|
+
assert spy.has_been_called_with?('key', [1, 2, 3, 4])
|
70
90
|
end
|
71
91
|
|
72
92
|
def test_parse_line_3
|
@@ -77,7 +97,7 @@ class WavefrontDisplayPrinterLong < MiniTest::Test
|
|
77
97
|
|
78
98
|
def test_add_array
|
79
99
|
spy = Spy.on(wf, :add_line)
|
80
|
-
wf.add_array('key', %w
|
100
|
+
wf.add_array('key', %w[value1 value2 value3 value4])
|
81
101
|
assert spy.has_been_called_with?('key', 'value1')
|
82
102
|
assert spy.has_been_called_with?(nil, 'value2')
|
83
103
|
assert spy.has_been_called_with?(nil, 'value3')
|
@@ -116,22 +136,4 @@ class WavefrontDisplayPrinterLong < MiniTest::Test
|
|
116
136
|
assert tc_spy.has_been_called_with?([hash], 6)
|
117
137
|
refute hr_spy.has_been_called?
|
118
138
|
end
|
119
|
-
|
120
|
-
def test_mk_line_1
|
121
|
-
wf.instance_variable_set(:@kw, 7)
|
122
|
-
wf.instance_variable_set(:@indent_str, ' ')
|
123
|
-
assert_equal(' key value', wf.mk_line('key', 'value'))
|
124
|
-
assert_equal(' value', wf.mk_line(nil, 'value'))
|
125
|
-
assert_equal(' value', wf.mk_line('', 'value'))
|
126
|
-
assert_equal(" key a long string which must be\n" \
|
127
|
-
' folded once',
|
128
|
-
wf.mk_line('key', 'a long string which must be ' \
|
129
|
-
'folded once', 40))
|
130
|
-
assert_equal(" key a very long string whose very length\n" \
|
131
|
-
" means that the method is going to\n" \
|
132
|
-
" have to fold it twice",
|
133
|
-
wf.mk_line('key', 'a very long string whose very ' \
|
134
|
-
'length means that the method is going to ' \
|
135
|
-
'have to fold it twice', 49))
|
136
|
-
end
|
137
139
|
end
|
@@ -17,12 +17,12 @@ describe "#{word} command" do
|
|
17
17
|
method: :post, path: "/api/v2/#{word}/#{id}/close")
|
18
18
|
tag_tests(word, id, bad_id)
|
19
19
|
cmd_to_call(word, "search -o 11 id=#{id}",
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
20
|
+
method: :post, path: "/api/v2/search/#{word}",
|
21
|
+
body: { limit: 10,
|
22
|
+
offset: '11',
|
23
|
+
query: [{ key: 'id',
|
24
|
+
value: id,
|
25
|
+
matchingMethod: 'EXACT' }],
|
26
|
+
sort: { field: 'id', ascending: true } },
|
27
|
+
headers: JSON_POST_HEADERS)
|
28
28
|
end
|
@@ -16,12 +16,12 @@ describe "#{word} command" do
|
|
16
16
|
{ method: :delete, path: "/api/v2/extlink/#{id}" }, k)
|
17
17
|
invalid_ids(word, ["describe #{bad_id}", "delete #{bad_id}"])
|
18
18
|
cmd_to_call(word, "search -L 100 id~#{id}",
|
19
|
-
{ method: :post, path:
|
20
|
-
body: { limit:
|
19
|
+
{ method: :post, path: '/api/v2/search/externallink',
|
20
|
+
body: { limit: '100',
|
21
21
|
offset: 0,
|
22
|
-
query: [{key: 'id',
|
23
|
-
|
24
|
-
|
25
|
-
sort: {field: 'id', ascending: true}},
|
22
|
+
query: [{ key: 'id',
|
23
|
+
value: id,
|
24
|
+
matchingMethod: 'CONTAINS' }],
|
25
|
+
sort: { field: 'id', ascending: true } },
|
26
26
|
headers: JSON_POST_HEADERS }, WavefrontCli::ExternalLink)
|
27
27
|
end
|
@@ -19,19 +19,18 @@ describe "#{word} command" do
|
|
19
19
|
cmd_to_call(word, "search -o 100 id=#{id}",
|
20
20
|
{ method: :post, path: '/api/v2/search/maintenancewindow',
|
21
21
|
body: { limit: 10,
|
22
|
-
offset:
|
23
|
-
query: [{key: 'id',
|
24
|
-
|
25
|
-
|
26
|
-
sort: {field: 'id', ascending: true}},
|
22
|
+
offset: '100',
|
23
|
+
query: [{ key: 'id',
|
24
|
+
value: id,
|
25
|
+
matchingMethod: 'EXACT' }],
|
26
|
+
sort: { field: 'id', ascending: true } },
|
27
27
|
headers: JSON_POST_HEADERS },
|
28
|
-
|
28
|
+
WavefrontCli::MaintenanceWindow)
|
29
29
|
|
30
30
|
cmd_to_call(word, 'create -d testing -H shark tester',
|
31
31
|
{ method: :post, path: '/api/v2/maintenancewindow',
|
32
32
|
body: {
|
33
|
-
|
33
|
+
},
|
34
34
|
headers: JSON_POST_HEADERS },
|
35
|
-
|
36
|
-
|
35
|
+
WavefrontCli::MaintenanceWindow)
|
37
36
|
end
|
@@ -7,7 +7,6 @@ require_relative '../../lib/wavefront-cli/opt_handler'
|
|
7
7
|
# always done in the constructor
|
8
8
|
#
|
9
9
|
class OptHandlerTest < MiniTest::Test
|
10
|
-
|
11
10
|
# This one has to be kind of vague because I have a config file on
|
12
11
|
# the box I develop on, which will always be picked up. Other
|
13
12
|
# tests are more specific
|
@@ -63,7 +62,7 @@ class OptHandlerTest < MiniTest::Test
|
|
63
62
|
assert_equal(o[:config], CF)
|
64
63
|
assert_equal(o[:endpoint], 'default.wavefront.com')
|
65
64
|
assert_equal(o[:proxy], 'wavefront.localnet')
|
66
|
-
assert_output(
|
65
|
+
assert_output('') { WavefrontCli::OptHandler.new(opts) }
|
67
66
|
end
|
68
67
|
|
69
68
|
def test_alt_config_env
|
@@ -78,12 +77,12 @@ class OptHandlerTest < MiniTest::Test
|
|
78
77
|
assert_equal(o[:config], CF)
|
79
78
|
assert_equal(o[:endpoint], 'other.wavefront.com')
|
80
79
|
assert_equal(o[:proxy], 'otherwf.localnet')
|
81
|
-
assert_output(
|
80
|
+
assert_output('') { WavefrontCli::OptHandler.new(opts) }
|
82
81
|
ENV['WAVEFRONT_TOKEN'] = nil
|
83
82
|
ENV['WAVEFRONT_ENDPOINT'] = nil
|
84
83
|
end
|
85
84
|
|
86
|
-
def
|
85
|
+
def test_alt_config_env_2
|
87
86
|
ENV['WAVEFRONT_TOKEN'] = nil
|
88
87
|
ENV['WAVEFRONT_ENDPOINT'] = 'myendpoint.wavefront.com'
|
89
88
|
opts = { config: CF, profile: 'other' }
|
@@ -95,7 +94,7 @@ class OptHandlerTest < MiniTest::Test
|
|
95
94
|
assert_equal(o[:config], CF)
|
96
95
|
assert_equal(o[:endpoint], 'myendpoint.wavefront.com')
|
97
96
|
assert_equal(o[:proxy], 'otherwf.localnet')
|
98
|
-
assert_output(
|
97
|
+
assert_output('') { WavefrontCli::OptHandler.new(opts) }
|
99
98
|
ENV['WAVEFRONT_TOKEN'] = nil
|
100
99
|
ENV['WAVEFRONT_ENDPOINT'] = nil
|
101
100
|
end
|
@@ -24,12 +24,12 @@ describe "#{word} command" do
|
|
24
24
|
"undelete #{bad_id}", "rename #{bad_id} newname"])
|
25
25
|
invalid_something(word, ["rename #{id} '(>_<)'"], 'proxy name')
|
26
26
|
cmd_to_call(word, "search -o 10 id=#{id}",
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
method: :post, path: "/api/v2/search/#{word}",
|
28
|
+
body: { limit: 10,
|
29
|
+
offset: '10',
|
30
|
+
query: [{ key: 'id',
|
31
|
+
value: id,
|
32
|
+
matchingMethod: 'EXACT' }],
|
33
|
+
sort: { field: 'id', ascending: true } },
|
34
|
+
headers: JSON_POST_HEADERS)
|
35
35
|
end
|
@@ -16,12 +16,12 @@ describe "#{word} command" do
|
|
16
16
|
{ method: :delete, path: "/api/v2/#{word}/#{id}" }, k)
|
17
17
|
invalid_ids(word, ["describe #{bad_id}", "delete #{bad_id}"])
|
18
18
|
cmd_to_call(word, "search -L 100 id~#{id}",
|
19
|
-
{ method: :post, path:
|
20
|
-
body: { limit:
|
19
|
+
{ method: :post, path: '/api/v2/search/savedsearch',
|
20
|
+
body: { limit: '100',
|
21
21
|
offset: 0,
|
22
|
-
query: [{key: 'id',
|
23
|
-
|
24
|
-
|
25
|
-
sort: {field: 'id', ascending: true}},
|
22
|
+
query: [{ key: 'id',
|
23
|
+
value: id,
|
24
|
+
matchingMethod: 'CONTAINS' }],
|
25
|
+
sort: { field: 'id', ascending: true } },
|
26
26
|
headers: JSON_POST_HEADERS }, WavefrontCli::SavedSearch)
|
27
27
|
end
|
@@ -19,12 +19,12 @@ describe "#{word} command" do
|
|
19
19
|
invalid_ids(word, ["describe #{bad_id}", "clear #{bad_id}"])
|
20
20
|
tag_tests(word, id, bad_id)
|
21
21
|
cmd_to_call(word, "search -f json id^#{id}",
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
method: :post, path: "/api/v2/search/#{word}",
|
23
|
+
body: { limit: 10,
|
24
|
+
offset: 0,
|
25
|
+
query: [{ key: 'id',
|
26
|
+
value: id,
|
27
|
+
matchingMethod: 'STARTSWITH' }],
|
28
|
+
sort: { field: 'id', ascending: true } },
|
29
|
+
headers: JSON_POST_HEADERS)
|
30
30
|
end
|
@@ -37,10 +37,9 @@ class StringTest < MiniTest::Test
|
|
37
37
|
def test_to_seconds
|
38
38
|
assert_equal(14, '14s'.to_seconds)
|
39
39
|
assert_equal(300, '5m'.to_seconds)
|
40
|
-
assert_equal(
|
41
|
-
assert_equal(
|
40
|
+
assert_equal(10_800, '3h'.to_seconds)
|
41
|
+
assert_equal(1_209_600, '2w'.to_seconds)
|
42
42
|
assert_raises(ArgumentError) { 'm'.to_seconds }
|
43
43
|
assert_raises(ArgumentError) { '3m5s'.to_seconds }
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
@@ -15,12 +15,12 @@ describe "#{word} command" do
|
|
15
15
|
path: "/api/v2/#{word}/#{id}")
|
16
16
|
invalid_ids(word, ["describe #{bad_id}", "delete #{bad_id}"])
|
17
17
|
cmd_to_call(word, "search -o 100 -L 100 id~#{id}",
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
method: :post, path: "/api/v2/search/#{word}",
|
19
|
+
body: { limit: '100',
|
20
|
+
offset: '100',
|
21
|
+
query: [{ key: 'id',
|
22
|
+
value: id,
|
23
|
+
matchingMethod: 'CONTAINS' }],
|
24
|
+
sort: { field: 'id', ascending: true } },
|
25
|
+
headers: JSON_POST_HEADERS)
|
26
26
|
end
|
data/wavefront-cli.gemspec
CHANGED
@@ -23,14 +23,14 @@ Gem::Specification.new do |gem|
|
|
23
23
|
gem.require_paths = %w(lib)
|
24
24
|
|
25
25
|
gem.add_dependency 'docopt', '~> 0.6.0'
|
26
|
-
gem.
|
26
|
+
gem.add_runtime_dependency 'wavefront-sdk', '~> 1.2', '>= 1.2.1'
|
27
27
|
|
28
28
|
gem.add_development_dependency 'bundler', '~> 1.3'
|
29
29
|
gem.add_development_dependency 'rake', '~> 12.0'
|
30
30
|
gem.add_development_dependency 'yard', '~> 0.9.5'
|
31
|
-
gem.add_development_dependency 'rubocop', '~> 0.
|
31
|
+
gem.add_development_dependency 'rubocop', '~> 0.51.0'
|
32
32
|
gem.add_development_dependency 'webmock', '~> 3.0'
|
33
|
-
gem.add_development_dependency 'minitest', '~> 5.8.0'
|
33
|
+
gem.add_development_dependency 'minitest', '~> 5.8', '>= 5.8.0'
|
34
34
|
gem.add_development_dependency 'spy', '~> 0.4.0'
|
35
35
|
|
36
36
|
gem.required_ruby_version = Gem::Requirement.new('>= 2.2.0')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wavefront-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Fisher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|
@@ -28,6 +28,9 @@ dependencies:
|
|
28
28
|
name: wavefront-sdk
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.2'
|
31
34
|
- - ">="
|
32
35
|
- !ruby/object:Gem::Version
|
33
36
|
version: 1.2.1
|
@@ -35,6 +38,9 @@ dependencies:
|
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1.2'
|
38
44
|
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
40
46
|
version: 1.2.1
|
@@ -86,14 +92,14 @@ dependencies:
|
|
86
92
|
requirements:
|
87
93
|
- - "~>"
|
88
94
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
95
|
+
version: 0.51.0
|
90
96
|
type: :development
|
91
97
|
prerelease: false
|
92
98
|
version_requirements: !ruby/object:Gem::Requirement
|
93
99
|
requirements:
|
94
100
|
- - "~>"
|
95
101
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
102
|
+
version: 0.51.0
|
97
103
|
- !ruby/object:Gem::Dependency
|
98
104
|
name: webmock
|
99
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,6 +119,9 @@ dependencies:
|
|
113
119
|
requirement: !ruby/object:Gem::Requirement
|
114
120
|
requirements:
|
115
121
|
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '5.8'
|
124
|
+
- - ">="
|
116
125
|
- !ruby/object:Gem::Version
|
117
126
|
version: 5.8.0
|
118
127
|
type: :development
|
@@ -120,6 +129,9 @@ dependencies:
|
|
120
129
|
version_requirements: !ruby/object:Gem::Requirement
|
121
130
|
requirements:
|
122
131
|
- - "~>"
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '5.8'
|
134
|
+
- - ">="
|
123
135
|
- !ruby/object:Gem::Version
|
124
136
|
version: 5.8.0
|
125
137
|
- !ruby/object:Gem::Dependency
|
@@ -145,6 +157,7 @@ extra_rdoc_files: []
|
|
145
157
|
files:
|
146
158
|
- ".codeclimate.yml"
|
147
159
|
- ".gitignore"
|
160
|
+
- ".rubocop.yml"
|
148
161
|
- ".travis.yml"
|
149
162
|
- Gemfile
|
150
163
|
- LICENSE.txt
|
@@ -214,6 +227,7 @@ files:
|
|
214
227
|
- lib/wavefront-cli/version.rb
|
215
228
|
- lib/wavefront-cli/webhook.rb
|
216
229
|
- lib/wavefront-cli/write.rb
|
230
|
+
- spec/.rubocop.yml
|
217
231
|
- spec/spec_helper.rb
|
218
232
|
- spec/wavefront-cli/alert_spec.rb
|
219
233
|
- spec/wavefront-cli/base_spec.rb
|
@@ -275,11 +289,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
275
289
|
version: '0'
|
276
290
|
requirements: []
|
277
291
|
rubyforge_project:
|
278
|
-
rubygems_version: 2.7.
|
292
|
+
rubygems_version: 2.7.3
|
279
293
|
signing_key:
|
280
294
|
specification_version: 4
|
281
295
|
summary: CLI for Wavefront API v2
|
282
296
|
test_files:
|
297
|
+
- spec/.rubocop.yml
|
283
298
|
- spec/spec_helper.rb
|
284
299
|
- spec/wavefront-cli/alert_spec.rb
|
285
300
|
- spec/wavefront-cli/base_spec.rb
|