wavefront-cli 4.2.1 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +1 -0
- data/.rubocop.yml +1 -14
- data/.travis.yml +4 -4
- data/Gemfile +2 -0
- data/HISTORY.md +82 -60
- data/Rakefile +2 -0
- data/bin/wf +1 -0
- data/lib/wavefront-cli/alert.rb +13 -5
- data/lib/wavefront-cli/apitoken.rb +2 -0
- data/lib/wavefront-cli/base.rb +95 -47
- data/lib/wavefront-cli/cloudintegration.rb +6 -0
- data/lib/wavefront-cli/command_mixins/acl.rb +6 -1
- data/lib/wavefront-cli/command_mixins/tag.rb +2 -0
- data/lib/wavefront-cli/commands/.rubocop.yml +3 -4
- data/lib/wavefront-cli/commands/alert.rb +2 -1
- data/lib/wavefront-cli/commands/apitoken.rb +6 -0
- data/lib/wavefront-cli/commands/base.rb +30 -21
- data/lib/wavefront-cli/commands/cloudintegration.rb +2 -0
- data/lib/wavefront-cli/commands/config.rb +2 -0
- data/lib/wavefront-cli/commands/dashboard.rb +2 -0
- data/lib/wavefront-cli/commands/derivedmetric.rb +2 -0
- data/lib/wavefront-cli/commands/event.rb +3 -1
- data/lib/wavefront-cli/commands/integration.rb +2 -1
- data/lib/wavefront-cli/commands/link.rb +2 -0
- data/lib/wavefront-cli/commands/message.rb +2 -0
- data/lib/wavefront-cli/commands/metric.rb +2 -0
- data/lib/wavefront-cli/commands/notificant.rb +2 -0
- data/lib/wavefront-cli/commands/proxy.rb +2 -0
- data/lib/wavefront-cli/commands/query.rb +2 -0
- data/lib/wavefront-cli/commands/savedsearch.rb +2 -0
- data/lib/wavefront-cli/commands/serviceaccount.rb +58 -0
- data/lib/wavefront-cli/commands/settings.rb +2 -0
- data/lib/wavefront-cli/commands/source.rb +3 -1
- data/lib/wavefront-cli/commands/user.rb +4 -1
- data/lib/wavefront-cli/commands/usergroup.rb +3 -0
- data/lib/wavefront-cli/commands/webhook.rb +2 -0
- data/lib/wavefront-cli/commands/window.rb +2 -0
- data/lib/wavefront-cli/commands/write.rb +2 -0
- data/lib/wavefront-cli/config.rb +23 -12
- data/lib/wavefront-cli/constants.rb +10 -4
- data/lib/wavefront-cli/controller.rb +53 -22
- data/lib/wavefront-cli/dashboard.rb +3 -0
- data/lib/wavefront-cli/derivedmetric.rb +12 -11
- data/lib/wavefront-cli/display/alert.rb +7 -4
- data/lib/wavefront-cli/display/apitoken.rb +2 -0
- data/lib/wavefront-cli/display/base.rb +34 -8
- data/lib/wavefront-cli/display/cloudintegration.rb +4 -2
- data/lib/wavefront-cli/display/dashboard.rb +2 -0
- data/lib/wavefront-cli/display/derivedmetric.rb +2 -0
- data/lib/wavefront-cli/display/distribution.rb +2 -0
- data/lib/wavefront-cli/display/event.rb +2 -0
- data/lib/wavefront-cli/display/externallink.rb +2 -0
- data/lib/wavefront-cli/display/integration.rb +2 -0
- data/lib/wavefront-cli/display/maintenancewindow.rb +2 -0
- data/lib/wavefront-cli/display/message.rb +7 -3
- data/lib/wavefront-cli/display/metric.rb +3 -1
- data/lib/wavefront-cli/display/notificant.rb +3 -1
- data/lib/wavefront-cli/display/printer/long.rb +36 -11
- data/lib/wavefront-cli/display/printer/sparkline.rb +3 -0
- data/lib/wavefront-cli/display/printer/terse.rb +6 -1
- data/lib/wavefront-cli/display/proxy.rb +2 -0
- data/lib/wavefront-cli/display/query.rb +35 -24
- data/lib/wavefront-cli/display/savedsearch.rb +2 -0
- data/lib/wavefront-cli/display/serviceaccount.rb +60 -0
- data/lib/wavefront-cli/display/settings.rb +2 -0
- data/lib/wavefront-cli/display/source.rb +18 -4
- data/lib/wavefront-cli/display/user.rb +56 -10
- data/lib/wavefront-cli/display/usergroup.rb +25 -19
- data/lib/wavefront-cli/display/webhook.rb +2 -0
- data/lib/wavefront-cli/display/write.rb +6 -2
- data/lib/wavefront-cli/event.rb +83 -62
- data/lib/wavefront-cli/exception.rb +3 -0
- data/lib/wavefront-cli/externallink.rb +6 -4
- data/lib/wavefront-cli/integration.rb +2 -0
- data/lib/wavefront-cli/maintenancewindow.rb +28 -17
- data/lib/wavefront-cli/message.rb +4 -0
- data/lib/wavefront-cli/metric.rb +4 -1
- data/lib/wavefront-cli/notificant.rb +2 -0
- data/lib/wavefront-cli/opt_handler.rb +2 -0
- data/lib/wavefront-cli/output/base.rb +8 -3
- data/lib/wavefront-cli/output/csv.rb +2 -0
- data/lib/wavefront-cli/output/csv/base.rb +2 -0
- data/lib/wavefront-cli/output/csv/query.rb +14 -7
- data/lib/wavefront-cli/output/hcl.rb +2 -0
- data/lib/wavefront-cli/output/hcl/alert.rb +2 -0
- data/lib/wavefront-cli/output/hcl/base.rb +10 -4
- data/lib/wavefront-cli/output/hcl/dashboard.rb +17 -8
- data/lib/wavefront-cli/output/hcl/notificant.rb +2 -0
- data/lib/wavefront-cli/output/hcl/stdlib/array.rb +2 -0
- data/lib/wavefront-cli/output/hcl/stdlib/string.rb +2 -0
- data/lib/wavefront-cli/output/json.rb +2 -0
- data/lib/wavefront-cli/output/ruby.rb +2 -0
- data/lib/wavefront-cli/output/wavefront.rb +2 -0
- data/lib/wavefront-cli/output/wavefront/query.rb +7 -4
- data/lib/wavefront-cli/output/yaml.rb +2 -0
- data/lib/wavefront-cli/proxy.rb +15 -3
- data/lib/wavefront-cli/query.rb +14 -12
- data/lib/wavefront-cli/savedsearch.rb +2 -0
- data/lib/wavefront-cli/serviceaccount.rb +179 -0
- data/lib/wavefront-cli/settings.rb +2 -0
- data/lib/wavefront-cli/source.rb +2 -0
- data/lib/wavefront-cli/stdlib/array.rb +3 -0
- data/lib/wavefront-cli/stdlib/string.rb +17 -11
- data/lib/wavefront-cli/user.rb +10 -4
- data/lib/wavefront-cli/usergroup.rb +4 -2
- data/lib/wavefront-cli/version.rb +3 -1
- data/lib/wavefront-cli/webhook.rb +2 -0
- data/lib/wavefront-cli/write.rb +80 -46
- data/spec/.rubocop.yml +3 -16
- data/spec/constants.rb +21 -0
- data/spec/spec_helper.rb +8 -422
- data/spec/support/command_base.rb +82 -0
- data/spec/support/minitest_assertions.rb +262 -0
- data/spec/support/output_tester.rb +32 -0
- data/spec/support/supported_commands.rb +19 -0
- data/spec/test_mixins/acl.rb +169 -0
- data/spec/test_mixins/delete.rb +25 -0
- data/spec/test_mixins/deleteundelete.rb +106 -0
- data/spec/test_mixins/describe.rb +24 -0
- data/spec/test_mixins/dump.rb +43 -0
- data/spec/test_mixins/general.rb +11 -0
- data/spec/test_mixins/history.rb +35 -0
- data/spec/test_mixins/import.rb +65 -0
- data/spec/test_mixins/list.rb +29 -0
- data/spec/test_mixins/search.rb +98 -0
- data/spec/test_mixins/set.rb +47 -0
- data/spec/test_mixins/tag.rb +99 -0
- data/spec/wavefront-cli/alert_spec.rb +288 -111
- data/spec/wavefront-cli/apitoken_spec.rb +53 -24
- data/spec/wavefront-cli/base_spec.rb +9 -27
- data/spec/wavefront-cli/cloudintegration_spec.rb +65 -29
- data/spec/wavefront-cli/commands/alert_spec.rb +1 -0
- data/spec/wavefront-cli/commands/base_spec.rb +15 -13
- data/spec/wavefront-cli/commands/cloudintegration_spec.rb +1 -0
- data/spec/wavefront-cli/commands/config_spec.rb +3 -0
- data/spec/wavefront-cli/commands/dashboard_spec.rb +1 -0
- data/spec/wavefront-cli/commands/derivedmetric_spec.rb +1 -0
- data/spec/wavefront-cli/commands/event_spec.rb +1 -0
- data/spec/wavefront-cli/commands/link_spec.rb +1 -0
- data/spec/wavefront-cli/commands/message_spec.rb +1 -0
- data/spec/wavefront-cli/commands/metric_spec.rb +1 -0
- data/spec/wavefront-cli/commands/proxy_spec.rb +1 -0
- data/spec/wavefront-cli/commands/query_spec.rb +1 -0
- data/spec/wavefront-cli/commands/webhook_spec.rb +1 -0
- data/spec/wavefront-cli/commands/window_spec.rb +1 -0
- data/spec/wavefront-cli/commands/write_spec.rb +1 -0
- data/spec/wavefront-cli/config_spec.rb +25 -14
- data/spec/wavefront-cli/controller_spec.rb +13 -3
- data/spec/wavefront-cli/dashboard_spec.rb +125 -76
- data/spec/wavefront-cli/derivedmetric_spec.rb +83 -67
- data/spec/wavefront-cli/display/base_spec.rb +5 -7
- data/spec/wavefront-cli/display/printer/long_spec.rb +20 -16
- data/spec/wavefront-cli/display/printer/terse_spec.rb +5 -4
- data/spec/wavefront-cli/event_spec.rb +360 -18
- data/spec/wavefront-cli/externallink_spec.rb +92 -58
- data/spec/wavefront-cli/integration_spec.rb +129 -31
- data/spec/wavefront-cli/maintenancewindow_spec.rb +270 -32
- data/spec/wavefront-cli/message_spec.rb +73 -30
- data/spec/wavefront-cli/metric_spec.rb +60 -22
- data/spec/wavefront-cli/notificant_spec.rb +45 -32
- data/spec/wavefront-cli/opt_handler_spec.rb +4 -1
- data/spec/wavefront-cli/output/csv/query_spec.rb +21 -19
- data/spec/wavefront-cli/output/csv_spec.rb +5 -2
- data/spec/wavefront-cli/output/hcl_spec.rb +5 -2
- data/spec/wavefront-cli/output/helpers.rb +18 -0
- data/spec/wavefront-cli/output/json_spec.rb +3 -1
- data/spec/wavefront-cli/output/ruby_spec.rb +3 -1
- data/spec/wavefront-cli/output/wavefront/query_spec.rb +3 -1
- data/spec/wavefront-cli/output/wavefront_spec.rb +6 -4
- data/spec/wavefront-cli/output/yaml_spec.rb +3 -1
- data/spec/wavefront-cli/proxy_spec.rb +49 -27
- data/spec/wavefront-cli/query_spec.rb +174 -92
- data/spec/wavefront-cli/resources/responses/query.json +1 -0
- data/spec/wavefront-cli/resources/updates/alert.json +15 -0
- data/spec/wavefront-cli/resources/updates/dashboard.json +1 -0
- data/spec/wavefront-cli/savedsearch_spec.rb +35 -18
- data/spec/wavefront-cli/serviceaccount_spec.rb +399 -0
- data/spec/wavefront-cli/settings_spec.rb +42 -11
- data/spec/wavefront-cli/source_spec.rb +120 -23
- data/spec/wavefront-cli/stdlib/array_spec.rb +2 -1
- data/spec/wavefront-cli/stdlib/string_spec.rb +9 -6
- data/spec/wavefront-cli/user_spec.rb +278 -108
- data/spec/wavefront-cli/usergroup_spec.rb +152 -102
- data/spec/wavefront-cli/webhook_spec.rb +30 -15
- data/spec/wavefront-cli/write_spec.rb +25 -1
- data/wavefront-cli.gemspec +5 -3
- metadata +65 -21
- data/spec/wavefront-cli/commands/spec_helper.rb +0 -3
- data/spec/wavefront-cli/display/spec_helper.rb +0 -3
@@ -1,33 +1,76 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
4
|
+
require_relative '../support/command_base'
|
5
|
+
require_relative '../../lib/wavefront-cli/message'
|
6
|
+
|
7
|
+
# Ensure 'message' commands produce the correct API calls.
|
8
|
+
#
|
9
|
+
class MessageEndToEndTest < EndToEndTest
|
10
|
+
def test_list
|
11
|
+
quietly do
|
12
|
+
assert_cmd_gets('list',
|
13
|
+
'/api/v2/message?limit=100&offset=0&unreadOnly=true')
|
14
|
+
assert_cmd_gets('list -l',
|
15
|
+
'/api/v2/message?limit=100&offset=0&unreadOnly=true')
|
16
|
+
end
|
17
|
+
|
18
|
+
assert_noop('list',
|
19
|
+
'uri: GET https://default.wavefront.com/api/v2/message',
|
20
|
+
'params: ' + {
|
21
|
+
offset: 0, limit: 100, unreadOnly: true
|
22
|
+
}.to_s)
|
23
|
+
|
24
|
+
assert_abort_on_missing_creds('list')
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_list_offsets
|
28
|
+
quietly do
|
29
|
+
assert_cmd_gets('list --offset 2 --limit 3',
|
30
|
+
'/api/v2/message?limit=3&offset=2&unreadOnly=true')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_list_all
|
35
|
+
quietly do
|
36
|
+
assert_cmd_gets('list -a',
|
37
|
+
'/api/v2/message?limit=100&offset=0&unreadOnly=false')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_read
|
42
|
+
# TODO: add a proper chained test like we have for
|
43
|
+
# MaintenanceWindow#close, when there's some sample data to work
|
44
|
+
# with. i.e. next time Wavefront send me a message
|
45
|
+
assert_cannot_noop("read #{id}")
|
46
|
+
assert_abort_on_missing_creds("read #{id}")
|
47
|
+
assert_usage('read')
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_mark
|
51
|
+
quietly do
|
52
|
+
assert_cmd_posts("mark #{id}", "/api/v2/message/#{id}/read")
|
53
|
+
end
|
54
|
+
|
55
|
+
assert_noop("mark #{id}",
|
56
|
+
'uri: POST https://default.wavefront.com/api/v2/' \
|
57
|
+
"message/#{id}/read",
|
58
|
+
'body: null')
|
59
|
+
assert_abort_on_missing_creds("mark #{id}")
|
60
|
+
assert_usage('mark')
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def id
|
66
|
+
'CLUSTER::IHjNaHM9'
|
67
|
+
end
|
68
|
+
|
69
|
+
def invalid_id
|
70
|
+
'(>_<)'
|
71
|
+
end
|
72
|
+
|
73
|
+
def cmd_word
|
74
|
+
'message'
|
75
|
+
end
|
33
76
|
end
|
@@ -1,25 +1,63 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
4
|
+
require_relative '../support/command_base'
|
5
|
+
require_relative '../../lib/wavefront-cli/metric'
|
6
|
+
|
7
|
+
# Ensure 'metric' commands produce the correct API calls.
|
8
|
+
#
|
9
|
+
class MetricEndToEndTest < EndToEndTest
|
10
|
+
def test_describe
|
11
|
+
out, err = capture_io do
|
12
|
+
assert_raises(SystemExit) do
|
13
|
+
assert_cmd_gets("describe #{id}",
|
14
|
+
"/api/v2/chart/metric/detail?m=#{id}")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
assert_empty(err)
|
19
|
+
assert_equal("Did not find metric 'dev.cli.test'.", out.strip)
|
20
|
+
|
21
|
+
assert_invalid_id("describe #{invalid_id}")
|
22
|
+
assert_usage('describe')
|
23
|
+
assert_abort_on_missing_creds("describe #{id}")
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_describe_with_globs
|
27
|
+
out, err = capture_io do
|
28
|
+
assert_raises(SystemExit) do
|
29
|
+
assert_cmd_gets("describe -g ptn1 -g ptn2 #{id}",
|
30
|
+
"/api/v2/chart/metric/detail?m=#{id}&h=ptn1&h=ptn2")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
assert_empty(err)
|
35
|
+
assert_equal("Did not find metric 'dev.cli.test'.", out.strip)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_describe_with_glob_and_offset
|
39
|
+
out, err = capture_io do
|
40
|
+
assert_raises(SystemExit) do
|
41
|
+
assert_cmd_gets("describe -g ptn1 -o 5 #{id}",
|
42
|
+
"/api/v2/chart/metric/detail?m=#{id}&h=ptn1&c=5")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
assert_empty(err)
|
47
|
+
assert_equal("Did not find metric 'dev.cli.test'.", out.strip)
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def id
|
53
|
+
'dev.cli.test'
|
54
|
+
end
|
55
|
+
|
56
|
+
def invalid_id
|
57
|
+
'(>_<)'
|
58
|
+
end
|
59
|
+
|
60
|
+
def cmd_word
|
61
|
+
'metric'
|
62
|
+
end
|
25
63
|
end
|
@@ -1,39 +1,52 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
4
|
+
require_relative '../support/command_base'
|
5
|
+
require_relative '../../lib/wavefront-cli/notificant'
|
6
|
+
|
7
|
+
# Ensure 'notificant' commands produce the correct API calls.
|
8
|
+
#
|
9
|
+
class NotificantEndToEndTest < EndToEndTest
|
10
|
+
include WavefrontCliTest::Delete
|
11
|
+
include WavefrontCliTest::Describe
|
12
|
+
include WavefrontCliTest::Dump
|
13
|
+
# include WavefrontCliTest::Import
|
14
|
+
include WavefrontCliTest::List
|
15
|
+
include WavefrontCliTest::Search
|
16
|
+
include WavefrontCliTest::Set
|
17
|
+
|
18
|
+
def test_test
|
19
|
+
assert_repeated_output("Testing notificant '#{id}'.") do
|
20
|
+
assert_cmd_posts("test #{id}", "/api/v2/notificant/test/#{id}")
|
21
|
+
end
|
22
|
+
|
23
|
+
assert_noop("test #{id}",
|
24
|
+
'uri: POST https://default.wavefront.com/api/v2/' \
|
25
|
+
"notificant/test/#{id}", 'body: null')
|
26
|
+
assert_invalid_id("test #{invalid_id}")
|
27
|
+
assert_usage('test')
|
28
|
+
assert_abort_on_missing_creds("test #{id}")
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def id
|
34
|
+
'9wltLtYXsP8Je2kI'
|
35
|
+
end
|
36
|
+
|
37
|
+
def invalid_id
|
38
|
+
'__BAD__'
|
39
|
+
end
|
40
|
+
|
41
|
+
def cmd_word
|
42
|
+
'notificant'
|
43
|
+
end
|
28
44
|
|
29
|
-
|
30
|
-
|
31
|
-
import_tester(:notificant,
|
32
|
-
%i[method title creatorId triggers template],
|
33
|
-
%i[id])
|
45
|
+
def set_key
|
46
|
+
'title'
|
34
47
|
end
|
35
48
|
|
36
|
-
def
|
37
|
-
|
49
|
+
def import_fields
|
50
|
+
%i[method title creatorId triggers template]
|
38
51
|
end
|
39
52
|
end
|
@@ -1,6 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
|
4
|
+
require 'minitest/autorun'
|
5
|
+
require_relative '../constants'
|
6
|
+
require_relative '../../lib/wavefront-cli/exception'
|
4
7
|
require_relative '../../lib/wavefront-cli/opt_handler'
|
5
8
|
|
6
9
|
# Some of these tests will be skipped if you have a ~/.wavefront
|
@@ -1,6 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
|
4
|
+
require 'minitest/autorun'
|
5
|
+
require_relative '../helpers'
|
4
6
|
require_relative '../../../../lib/wavefront-cli/output/csv/query'
|
5
7
|
|
6
8
|
# Test CSV output
|
@@ -59,35 +61,35 @@ class WavefrontOutputCsvTest < MiniTest::Test
|
|
59
61
|
def test_map_row_to_csv
|
60
62
|
assert_equal(',,,,,,,,,,', wfq.map_row_to_csv(merp: 1))
|
61
63
|
assert_equal('test.path,1,1544529523,testsource,,"unit test",,,,,',
|
62
|
-
wfq.map_row_to_csv(path:
|
63
|
-
value:
|
64
|
-
timestamp:
|
65
|
-
source:
|
64
|
+
wfq.map_row_to_csv(path: 'test.path',
|
65
|
+
value: 1,
|
66
|
+
timestamp: 1_544_529_523,
|
67
|
+
source: 'testsource',
|
66
68
|
environment: 'unit test'))
|
67
69
|
assert_equal('"test.path","1","1544529523","testsource",,"unit test",,,,,',
|
68
|
-
wfqq.map_row_to_csv(path:
|
69
|
-
value:
|
70
|
-
timestamp:
|
71
|
-
source:
|
70
|
+
wfqq.map_row_to_csv(path: 'test.path',
|
71
|
+
value: 1,
|
72
|
+
timestamp: 1_544_529_523,
|
73
|
+
source: 'testsource',
|
72
74
|
environment: 'unit test'))
|
73
75
|
end
|
74
76
|
|
75
77
|
def test_csv_format
|
76
|
-
assert_equal({ path:
|
77
|
-
value:
|
78
|
-
timestamp:
|
79
|
-
source:
|
78
|
+
assert_equal({ path: 'test.path',
|
79
|
+
value: 1,
|
80
|
+
timestamp: 1_544_529_523,
|
81
|
+
source: 'testsource',
|
80
82
|
environment: 'test',
|
81
|
-
dc:
|
83
|
+
dc: 'travis' },
|
82
84
|
wfq.csv_format('test.path', 1, 1_544_529_523, 'testsource',
|
83
85
|
environment: 'test', dc: 'travis'))
|
84
86
|
|
85
|
-
assert_equal({ path:
|
86
|
-
value:
|
87
|
-
timestamp:
|
88
|
-
source:
|
87
|
+
assert_equal({ path: 'test.path',
|
88
|
+
value: 1,
|
89
|
+
timestamp: 1_544_529_523,
|
90
|
+
source: 'testsource',
|
89
91
|
environment: 'environment=test',
|
90
|
-
dc:
|
92
|
+
dc: 'dc=travis' },
|
91
93
|
wft.csv_format('test.path', 1, 1_544_529_523, 'testsource',
|
92
94
|
environment: 'test', dc: 'travis'))
|
93
95
|
end
|
@@ -1,6 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
|
4
|
+
require 'minitest/autorun'
|
5
|
+
require_relative 'helpers'
|
6
|
+
require_relative '../../support/supported_commands'
|
4
7
|
require_relative '../../../lib/wavefront-cli/output/csv'
|
5
8
|
|
6
9
|
# Test the CSV instantiation of the base class
|
@@ -35,7 +38,7 @@ class CsvOutputBaseTest < MiniTest::Test
|
|
35
38
|
assert klass.respond_to?(:run)
|
36
39
|
end
|
37
40
|
|
38
|
-
(
|
41
|
+
(SupportedCommands.new.all - supported_commands).each do |cmd|
|
39
42
|
wfo = WavefrontOutput::Csv.new(load_query_response, class: cmd)
|
40
43
|
assert_raises(LoadError) { wfo.command_class }
|
41
44
|
end
|
@@ -1,6 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
|
4
|
+
require 'minitest/autorun'
|
5
|
+
require_relative 'helpers'
|
6
|
+
require_relative '../../support/supported_commands'
|
4
7
|
require_relative '../../../lib/wavefront-cli/output/hcl'
|
5
8
|
|
6
9
|
# Test HCL stuff
|
@@ -35,7 +38,7 @@ class WavefrontOutputBaseTest < MiniTest::Test
|
|
35
38
|
assert klass.respond_to?(:run)
|
36
39
|
end
|
37
40
|
|
38
|
-
(
|
41
|
+
(SupportedCommands.new.all - supported_commands).each do |cmd|
|
39
42
|
wfo = WavefrontOutput::Hcl.new(load_query_response, class: cmd)
|
40
43
|
assert_raises(LoadError) { wfo.command_class }
|
41
44
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require_relative '../../constants'
|
5
|
+
|
6
|
+
# Load in a canned query response
|
7
|
+
#
|
8
|
+
def load_query_response
|
9
|
+
load_file('sample_query_response.json')
|
10
|
+
end
|
11
|
+
|
12
|
+
def load_raw_query_response
|
13
|
+
load_file('sample_raw_query_response.json')
|
14
|
+
end
|
15
|
+
|
16
|
+
def load_file(file)
|
17
|
+
JSON.parse(IO.read(RES_DIR + file), symbolize_names: true)
|
18
|
+
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
|
4
|
+
require 'minitest/autorun'
|
5
|
+
require_relative 'helpers'
|
4
6
|
require_relative '../../../lib/wavefront-cli/output/ruby'
|
5
7
|
|
6
8
|
# We can't really test this without `eval`-ing the output, and
|
@@ -1,6 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
|
4
|
+
require 'minitest/autorun'
|
5
|
+
require_relative '../helpers'
|
4
6
|
require_relative '../../../../lib/wavefront-cli/output/wavefront/query'
|
5
7
|
|
6
8
|
# Test Wavefront wire-format output
|