wavefront-cli 8.5.1 → 10.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) 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 -4
  5. data/Gemfile +10 -0
  6. data/HISTORY.md +17 -0
  7. data/README.md +4 -2
  8. data/lib/wavefront-cli/base.rb +4 -4
  9. data/lib/wavefront-cli/commands/base.rb +13 -10
  10. data/lib/wavefront-cli/commands/config.rb +3 -7
  11. data/lib/wavefront-cli/commands/derivedmetric.rb +1 -1
  12. data/lib/wavefront-cli/commands/metric.rb +3 -3
  13. data/lib/wavefront-cli/commands/metricspolicy.rb +33 -0
  14. data/lib/wavefront-cli/commands/query.rb +5 -5
  15. data/lib/wavefront-cli/commands/write.rb +12 -12
  16. data/lib/wavefront-cli/config.rb +31 -35
  17. data/lib/wavefront-cli/constants.rb +3 -2
  18. data/lib/wavefront-cli/controller.rb +19 -15
  19. data/lib/wavefront-cli/display/base.rb +2 -2
  20. data/lib/wavefront-cli/display/cluster.rb +21 -0
  21. data/lib/wavefront-cli/display/metricspolicy.rb +15 -0
  22. data/lib/wavefront-cli/display/printer/long.rb +11 -17
  23. data/lib/wavefront-cli/display/printer/sparkline.rb +3 -3
  24. data/lib/wavefront-cli/display/query.rb +1 -1
  25. data/lib/wavefront-cli/display/write.rb +2 -1
  26. data/lib/wavefront-cli/event.rb +2 -2
  27. data/lib/wavefront-cli/exception_handler.rb +8 -1
  28. data/lib/wavefront-cli/helpers/load_file.rb +2 -2
  29. data/lib/wavefront-cli/maintenancewindow.rb +1 -1
  30. data/lib/wavefront-cli/metricspolicy.rb +42 -0
  31. data/lib/wavefront-cli/opt_handler.rb +2 -3
  32. data/lib/wavefront-cli/output/csv/query.rb +3 -3
  33. data/lib/wavefront-cli/output/hcl/base.rb +4 -4
  34. data/lib/wavefront-cli/output/hcl/dashboard.rb +7 -7
  35. data/lib/wavefront-cli/output/hcl/stdlib/array.rb +1 -1
  36. data/lib/wavefront-cli/output/wavefront/query.rb +7 -7
  37. data/lib/wavefront-cli/stdlib/array.rb +1 -1
  38. data/lib/wavefront-cli/stdlib/string.rb +5 -5
  39. data/lib/wavefront-cli/usage.rb +1 -1
  40. data/lib/wavefront-cli/version.rb +1 -1
  41. data/lib/wavefront-cli/write.rb +15 -19
  42. data/spec/constants.rb +5 -6
  43. data/spec/support/command_base.rb +13 -1
  44. data/spec/support/minitest_assertions.rb +14 -10
  45. data/spec/support/output_tester.rb +2 -2
  46. data/spec/support/supported_commands.rb +3 -1
  47. data/spec/test_mixins/import.rb +2 -2
  48. data/spec/test_mixins/search.rb +9 -7
  49. data/spec/test_mixins/set.rb +1 -1
  50. data/spec/wavefront-cli/account_spec.rb +6 -4
  51. data/spec/wavefront-cli/alert_spec.rb +29 -6
  52. data/spec/wavefront-cli/base_spec.rb +1 -1
  53. data/spec/wavefront-cli/commands/base_spec.rb +3 -3
  54. data/spec/wavefront-cli/commands/config_spec.rb +6 -6
  55. data/spec/wavefront-cli/config_spec.rb +84 -44
  56. data/spec/wavefront-cli/controller_spec.rb +4 -2
  57. data/spec/wavefront-cli/dashboard_spec.rb +1 -1
  58. data/spec/wavefront-cli/derivedmetric_spec.rb +9 -7
  59. data/spec/wavefront-cli/display/base_spec.rb +1 -1
  60. data/spec/wavefront-cli/display/printer/long_spec.rb +6 -4
  61. data/spec/wavefront-cli/display/printer/terse_spec.rb +2 -2
  62. data/spec/wavefront-cli/event_spec.rb +14 -11
  63. data/spec/wavefront-cli/event_store_spec.rb +17 -13
  64. data/spec/wavefront-cli/externallink_spec.rb +5 -3
  65. data/spec/wavefront-cli/maintenancewindow_spec.rb +25 -19
  66. data/spec/wavefront-cli/message_spec.rb +3 -3
  67. data/spec/wavefront-cli/metricspolicy_spec.rb +30 -0
  68. data/spec/wavefront-cli/opt_handler_spec.rb +2 -2
  69. data/spec/wavefront-cli/output/csv/query_spec.rb +1 -1
  70. data/spec/wavefront-cli/output/csv_spec.rb +1 -1
  71. data/spec/wavefront-cli/output/hcl_spec.rb +1 -1
  72. data/spec/wavefront-cli/output/helpers.rb +1 -1
  73. data/spec/wavefront-cli/output/json_spec.rb +1 -1
  74. data/spec/wavefront-cli/output/ruby_spec.rb +1 -1
  75. data/spec/wavefront-cli/output/wavefront/query_spec.rb +1 -1
  76. data/spec/wavefront-cli/output/wavefront_spec.rb +1 -1
  77. data/spec/wavefront-cli/output/yaml_spec.rb +1 -1
  78. data/spec/wavefront-cli/proxy_spec.rb +1 -1
  79. data/spec/wavefront-cli/query_spec.rb +2 -2
  80. data/spec/wavefront-cli/role_spec.rb +4 -3
  81. data/spec/wavefront-cli/serviceaccount_spec.rb +7 -5
  82. data/spec/wavefront-cli/stdlib/array_spec.rb +1 -1
  83. data/spec/wavefront-cli/stdlib/string_spec.rb +4 -2
  84. data/spec/wavefront-cli/usage_spec.rb +2 -2
  85. data/spec/wavefront-cli/{write_spec.rb → write_class_spec.rb} +2 -15
  86. data/wavefront-cli.gemspec +4 -16
  87. metadata +17 -259
  88. data/spec/spec_helper.rb +0 -113
@@ -2,13 +2,11 @@
2
2
 
3
3
  require 'pathname'
4
4
  require 'date'
5
-
6
5
  require_relative 'lib/wavefront-cli/version'
7
6
 
8
7
  Gem::Specification.new do |gem|
9
8
  gem.name = 'wavefront-cli'
10
9
  gem.version = WF_CLI_VERSION
11
- gem.date = Date.today.to_s
12
10
 
13
11
  gem.summary = 'CLI for Wavefront API v2'
14
12
  gem.description = 'CLI for Wavefront (wavefront.com) API v2 '
@@ -21,22 +19,12 @@ Gem::Specification.new do |gem|
21
19
  gem.bindir = 'bin'
22
20
  gem.files = `git ls-files`.split("\n")
23
21
  gem.executables = 'wf'
24
- gem.test_files = gem.files.grep(/^spec/)
25
22
  gem.require_paths = %w[lib]
26
23
 
27
- gem.add_runtime_dependency 'docopt', '~> 0.6.0'
24
+ gem.add_runtime_dependency 'docopt', '~> 0.6'
28
25
  gem.add_runtime_dependency 'inifile', '~> 3.0'
29
- gem.add_runtime_dependency 'wavefront-sdk', '~> 5.4', '>= 5.4.2'
30
-
31
- gem.add_development_dependency 'minitest', '~> 5.14'
32
- gem.add_development_dependency 'rake', '~> 13.0'
33
- gem.add_development_dependency 'rubocop', '~> 1.9'
34
- gem.add_development_dependency 'rubocop-minitest', '~> 0.10'
35
- gem.add_development_dependency 'rubocop-performance', '~> 1.3'
36
- gem.add_development_dependency 'rubocop-rake', '~> 0.5'
37
- gem.add_development_dependency 'spy', '~> 1.0.0'
38
- gem.add_development_dependency 'webmock', '~> 3.8'
39
- gem.add_development_dependency 'yard', '~> 0.9.5'
26
+ gem.add_runtime_dependency 'wavefront-sdk', '~> 8.0'
40
27
 
41
- gem.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
28
+ gem.required_ruby_version = Gem::Requirement.new('>= 3.0.0')
29
+ gem.metadata['rubygems_mfa_required'] = 'true'
42
30
  end
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: 8.5.1
4
+ version: 10.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Fisher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-29 00:00:00.000000000 Z
11
+ date: 2024-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.6.0
19
+ version: '0.6'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.6.0
26
+ version: '0.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: inifile
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,146 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '5.4'
48
- - - ">="
49
- - !ruby/object:Gem::Version
50
- version: 5.4.2
47
+ version: '8.0'
51
48
  type: :runtime
52
49
  prerelease: false
53
50
  version_requirements: !ruby/object:Gem::Requirement
54
51
  requirements:
55
52
  - - "~>"
56
53
  - !ruby/object:Gem::Version
57
- version: '5.4'
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: 5.4.2
61
- - !ruby/object:Gem::Dependency
62
- name: minitest
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '5.14'
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '5.14'
75
- - !ruby/object:Gem::Dependency
76
- name: rake
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '13.0'
82
- type: :development
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '13.0'
89
- - !ruby/object:Gem::Dependency
90
- name: rubocop
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - "~>"
94
- - !ruby/object:Gem::Version
95
- version: '1.9'
96
- type: :development
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: '1.9'
103
- - !ruby/object:Gem::Dependency
104
- name: rubocop-minitest
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: '0.10'
110
- type: :development
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - "~>"
115
- - !ruby/object:Gem::Version
116
- version: '0.10'
117
- - !ruby/object:Gem::Dependency
118
- name: rubocop-performance
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - "~>"
122
- - !ruby/object:Gem::Version
123
- version: '1.3'
124
- type: :development
125
- prerelease: false
126
- version_requirements: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - "~>"
129
- - !ruby/object:Gem::Version
130
- version: '1.3'
131
- - !ruby/object:Gem::Dependency
132
- name: rubocop-rake
133
- requirement: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - "~>"
136
- - !ruby/object:Gem::Version
137
- version: '0.5'
138
- type: :development
139
- prerelease: false
140
- version_requirements: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - "~>"
143
- - !ruby/object:Gem::Version
144
- version: '0.5'
145
- - !ruby/object:Gem::Dependency
146
- name: spy
147
- requirement: !ruby/object:Gem::Requirement
148
- requirements:
149
- - - "~>"
150
- - !ruby/object:Gem::Version
151
- version: 1.0.0
152
- type: :development
153
- prerelease: false
154
- version_requirements: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - "~>"
157
- - !ruby/object:Gem::Version
158
- version: 1.0.0
159
- - !ruby/object:Gem::Dependency
160
- name: webmock
161
- requirement: !ruby/object:Gem::Requirement
162
- requirements:
163
- - - "~>"
164
- - !ruby/object:Gem::Version
165
- version: '3.8'
166
- type: :development
167
- prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- requirements:
170
- - - "~>"
171
- - !ruby/object:Gem::Version
172
- version: '3.8'
173
- - !ruby/object:Gem::Dependency
174
- name: yard
175
- requirement: !ruby/object:Gem::Requirement
176
- requirements:
177
- - - "~>"
178
- - !ruby/object:Gem::Version
179
- version: 0.9.5
180
- type: :development
181
- prerelease: false
182
- version_requirements: !ruby/object:Gem::Requirement
183
- requirements:
184
- - - "~>"
185
- - !ruby/object:Gem::Version
186
- version: 0.9.5
54
+ version: '8.0'
187
55
  description: 'CLI for Wavefront (wavefront.com) API v2 '
188
56
  email: services@id264.net
189
57
  executables:
@@ -224,6 +92,7 @@ files:
224
92
  - lib/wavefront-cli/commands/link.rb
225
93
  - lib/wavefront-cli/commands/message.rb
226
94
  - lib/wavefront-cli/commands/metric.rb
95
+ - lib/wavefront-cli/commands/metricspolicy.rb
227
96
  - lib/wavefront-cli/commands/notificant.rb
228
97
  - lib/wavefront-cli/commands/proxy.rb
229
98
  - lib/wavefront-cli/commands/query.rb
@@ -248,6 +117,7 @@ files:
248
117
  - lib/wavefront-cli/display/apitoken.rb
249
118
  - lib/wavefront-cli/display/base.rb
250
119
  - lib/wavefront-cli/display/cloudintegration.rb
120
+ - lib/wavefront-cli/display/cluster.rb
251
121
  - lib/wavefront-cli/display/dashboard.rb
252
122
  - lib/wavefront-cli/display/derivedmetric.rb
253
123
  - lib/wavefront-cli/display/distribution.rb
@@ -258,6 +128,7 @@ files:
258
128
  - lib/wavefront-cli/display/maintenancewindow.rb
259
129
  - lib/wavefront-cli/display/message.rb
260
130
  - lib/wavefront-cli/display/metric.rb
131
+ - lib/wavefront-cli/display/metricspolicy.rb
261
132
  - lib/wavefront-cli/display/notificant.rb
262
133
  - lib/wavefront-cli/display/printer/long.rb
263
134
  - lib/wavefront-cli/display/printer/sparkline.rb
@@ -285,6 +156,7 @@ files:
285
156
  - lib/wavefront-cli/maintenancewindow.rb
286
157
  - lib/wavefront-cli/message.rb
287
158
  - lib/wavefront-cli/metric.rb
159
+ - lib/wavefront-cli/metricspolicy.rb
288
160
  - lib/wavefront-cli/notificant.rb
289
161
  - lib/wavefront-cli/opt_handler.rb
290
162
  - lib/wavefront-cli/output/base.rb
@@ -321,7 +193,6 @@ files:
321
193
  - lib/wavefront-cli/write.rb
322
194
  - spec/.rubocop.yml
323
195
  - spec/constants.rb
324
- - spec/spec_helper.rb
325
196
  - spec/support/command_base.rb
326
197
  - spec/support/minitest_assertions.rb
327
198
  - spec/support/output_tester.rb
@@ -372,6 +243,7 @@ files:
372
243
  - spec/wavefront-cli/maintenancewindow_spec.rb
373
244
  - spec/wavefront-cli/message_spec.rb
374
245
  - spec/wavefront-cli/metric_spec.rb
246
+ - spec/wavefront-cli/metricspolicy_spec.rb
375
247
  - spec/wavefront-cli/notificant_spec.rb
376
248
  - spec/wavefront-cli/opt_handler_spec.rb
377
249
  - spec/wavefront-cli/output/csv/query_spec.rb
@@ -433,12 +305,13 @@ files:
433
305
  - spec/wavefront-cli/usage_spec.rb
434
306
  - spec/wavefront-cli/usergroup_spec.rb
435
307
  - spec/wavefront-cli/webhook_spec.rb
436
- - spec/wavefront-cli/write_spec.rb
308
+ - spec/wavefront-cli/write_class_spec.rb
437
309
  - wavefront-cli.gemspec
438
310
  homepage: https://github.com/snltd/wavefront-cli
439
311
  licenses:
440
312
  - BSD-2-Clause
441
- metadata: {}
313
+ metadata:
314
+ rubygems_mfa_required: 'true'
442
315
  post_install_message:
443
316
  rdoc_options: []
444
317
  require_paths:
@@ -447,130 +320,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
447
320
  requirements:
448
321
  - - ">="
449
322
  - !ruby/object:Gem::Version
450
- version: 2.5.0
323
+ version: 3.0.0
451
324
  required_rubygems_version: !ruby/object:Gem::Requirement
452
325
  requirements:
453
326
  - - ">="
454
327
  - !ruby/object:Gem::Version
455
328
  version: '0'
456
329
  requirements: []
457
- rubygems_version: 3.1.4
330
+ rubygems_version: 3.4.19
458
331
  signing_key:
459
332
  specification_version: 4
460
333
  summary: CLI for Wavefront API v2
461
- test_files:
462
- - spec/.rubocop.yml
463
- - spec/constants.rb
464
- - spec/spec_helper.rb
465
- - spec/support/command_base.rb
466
- - spec/support/minitest_assertions.rb
467
- - spec/support/output_tester.rb
468
- - spec/support/supported_commands.rb
469
- - spec/test_mixins/acl.rb
470
- - spec/test_mixins/delete.rb
471
- - spec/test_mixins/deleteundelete.rb
472
- - spec/test_mixins/describe.rb
473
- - spec/test_mixins/dump.rb
474
- - spec/test_mixins/general.rb
475
- - spec/test_mixins/history.rb
476
- - spec/test_mixins/import.rb
477
- - spec/test_mixins/list.rb
478
- - spec/test_mixins/search.rb
479
- - spec/test_mixins/set.rb
480
- - spec/test_mixins/tag.rb
481
- - spec/wavefront-cli/account_spec.rb
482
- - spec/wavefront-cli/alert_spec.rb
483
- - spec/wavefront-cli/apitoken_spec.rb
484
- - spec/wavefront-cli/base_spec.rb
485
- - spec/wavefront-cli/cloudintegration_spec.rb
486
- - spec/wavefront-cli/commands/alert_spec.rb
487
- - spec/wavefront-cli/commands/base_spec.rb
488
- - spec/wavefront-cli/commands/cloudintegration_spec.rb
489
- - spec/wavefront-cli/commands/config_spec.rb
490
- - spec/wavefront-cli/commands/dashboard_spec.rb
491
- - spec/wavefront-cli/commands/derivedmetric_spec.rb
492
- - spec/wavefront-cli/commands/event_spec.rb
493
- - spec/wavefront-cli/commands/link_spec.rb
494
- - spec/wavefront-cli/commands/message_spec.rb
495
- - spec/wavefront-cli/commands/metric_spec.rb
496
- - spec/wavefront-cli/commands/proxy_spec.rb
497
- - spec/wavefront-cli/commands/query_spec.rb
498
- - spec/wavefront-cli/commands/webhook_spec.rb
499
- - spec/wavefront-cli/commands/window_spec.rb
500
- - spec/wavefront-cli/commands/write_spec.rb
501
- - spec/wavefront-cli/config_spec.rb
502
- - spec/wavefront-cli/controller_spec.rb
503
- - spec/wavefront-cli/dashboard_spec.rb
504
- - spec/wavefront-cli/derivedmetric_spec.rb
505
- - spec/wavefront-cli/display/base_spec.rb
506
- - spec/wavefront-cli/display/printer/long_spec.rb
507
- - spec/wavefront-cli/display/printer/terse_spec.rb
508
- - spec/wavefront-cli/event_spec.rb
509
- - spec/wavefront-cli/event_store_spec.rb
510
- - spec/wavefront-cli/externallink_spec.rb
511
- - spec/wavefront-cli/integration_spec.rb
512
- - spec/wavefront-cli/maintenancewindow_spec.rb
513
- - spec/wavefront-cli/message_spec.rb
514
- - spec/wavefront-cli/metric_spec.rb
515
- - spec/wavefront-cli/notificant_spec.rb
516
- - spec/wavefront-cli/opt_handler_spec.rb
517
- - spec/wavefront-cli/output/csv/query_spec.rb
518
- - spec/wavefront-cli/output/csv_spec.rb
519
- - spec/wavefront-cli/output/hcl_spec.rb
520
- - spec/wavefront-cli/output/helpers.rb
521
- - spec/wavefront-cli/output/json_spec.rb
522
- - spec/wavefront-cli/output/ruby_spec.rb
523
- - spec/wavefront-cli/output/wavefront/query_spec.rb
524
- - spec/wavefront-cli/output/wavefront_spec.rb
525
- - spec/wavefront-cli/output/yaml_spec.rb
526
- - spec/wavefront-cli/proxy_spec.rb
527
- - spec/wavefront-cli/query_spec.rb
528
- - spec/wavefront-cli/resources/display/alert-human-long
529
- - spec/wavefront-cli/resources/display/alert-input.json
530
- - spec/wavefront-cli/resources/display/alerts-human-terse
531
- - spec/wavefront-cli/resources/display/alerts-input.json
532
- - spec/wavefront-cli/resources/display/user-human-long
533
- - spec/wavefront-cli/resources/display/user-human-long-no_sep
534
- - spec/wavefront-cli/resources/display/user-input.json
535
- - spec/wavefront-cli/resources/imports/alert.json
536
- - spec/wavefront-cli/resources/imports/dashboard.json
537
- - spec/wavefront-cli/resources/imports/derivedmetric.json
538
- - spec/wavefront-cli/resources/imports/notificant.json
539
- - spec/wavefront-cli/resources/imports/window.json
540
- - spec/wavefront-cli/resources/malformed.conf
541
- - spec/wavefront-cli/resources/responses/README.md
542
- - spec/wavefront-cli/resources/responses/alert-list.json
543
- - spec/wavefront-cli/resources/responses/backups.json
544
- - spec/wavefront-cli/resources/responses/cloudintegration-list.json
545
- - spec/wavefront-cli/resources/responses/dashboard-list.json
546
- - spec/wavefront-cli/resources/responses/derivedmetric-list.json
547
- - spec/wavefront-cli/resources/responses/event-list.json
548
- - spec/wavefront-cli/resources/responses/integration-list.json
549
- - spec/wavefront-cli/resources/responses/link-list.json
550
- - spec/wavefront-cli/resources/responses/notificant-list.json
551
- - spec/wavefront-cli/resources/responses/proxy-list.json
552
- - spec/wavefront-cli/resources/responses/query-cpu.json
553
- - spec/wavefront-cli/resources/responses/query.json
554
- - spec/wavefront-cli/resources/responses/savedsearch-list.json
555
- - spec/wavefront-cli/resources/responses/usage-export-csv.json
556
- - spec/wavefront-cli/resources/responses/user-validate.json
557
- - spec/wavefront-cli/resources/responses/usergroup-list.json
558
- - spec/wavefront-cli/resources/responses/webhook-list.json
559
- - spec/wavefront-cli/resources/responses/window-list.json
560
- - spec/wavefront-cli/resources/sample_query_response.json
561
- - spec/wavefront-cli/resources/sample_raw_query_response.json
562
- - spec/wavefront-cli/resources/updates/alert.json
563
- - spec/wavefront-cli/resources/updates/dashboard.json
564
- - spec/wavefront-cli/resources/wavefront.conf
565
- - spec/wavefront-cli/role_spec.rb
566
- - spec/wavefront-cli/savedsearch_spec.rb
567
- - spec/wavefront-cli/serviceaccount_spec.rb
568
- - spec/wavefront-cli/settings_spec.rb
569
- - spec/wavefront-cli/source_spec.rb
570
- - spec/wavefront-cli/spy_spec.rb
571
- - spec/wavefront-cli/stdlib/array_spec.rb
572
- - spec/wavefront-cli/stdlib/string_spec.rb
573
- - spec/wavefront-cli/usage_spec.rb
574
- - spec/wavefront-cli/usergroup_spec.rb
575
- - spec/wavefront-cli/webhook_spec.rb
576
- - spec/wavefront-cli/write_spec.rb
334
+ test_files: []
data/spec/spec_helper.rb DELETED
@@ -1,113 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'json'
4
- require 'webmock/minitest'
5
- require 'spy/integration'
6
- require 'inifile'
7
- require 'minitest'
8
- require 'minitest/autorun'
9
- require 'minitest/spec'
10
- require 'pathname'
11
- require_relative '../lib/wavefront-cli/controller'
12
-
13
- unless defined?(CMD)
14
- ROOT = Pathname.new(__FILE__).dirname.parent
15
- CMD = 'wavefront'
16
- ENDPOINT = 'metrics.wavefront.com'
17
- TOKEN = '0123456789-ABCDEF'
18
- RES_DIR = Pathname.new(__FILE__).dirname + 'wavefront-cli' + 'resources'
19
- CF = RES_DIR + 'wavefront.conf'
20
- CF_VAL = IniFile.load(CF)
21
- JSON_POST_HEADERS = {
22
- 'Content-Type': 'application/json', Accept: 'application/json'
23
- }.freeze
24
- BAD_TAG = '*BAD_TAG*'
25
- HOME_CONFIG = Pathname.new(ENV['HOME']) + '.wavefront'
26
- end
27
-
28
- # Object returned by cmd_to_call. Has just enough methods to satisfy
29
- # the SDK
30
- #
31
- class DummyResponse
32
- def more_items?
33
- false
34
- end
35
-
36
- def response
37
- Map.new(items: [])
38
- end
39
-
40
- def empty?
41
- false
42
- end
43
-
44
- def status; end
45
- end
46
-
47
- CANNED_RESPONSE = DummyResponse.new
48
-
49
- # Unit tests
50
- #
51
- class CliMethodTest < MiniTest::Test
52
- attr_reader :wf
53
-
54
- def setup
55
- @wf = cliclass.new({})
56
- end
57
-
58
- def import_tester(word, have_fields, do_not_have_fields = [])
59
- input = wf.load_file(RES_DIR + 'imports' + "#{word}.json")
60
- x = wf.import_to_create(input)
61
- assert_instance_of(Hash, x)
62
- have_fields.each { |f| assert_includes(x.keys, f) }
63
- do_not_have_fields.each { |f| refute_includes(x.keys, f) }
64
- end
65
- end
66
-
67
- # stdlib extensions
68
- #
69
- class Hash
70
- # A quick way to deep-copy a hash.
71
- #
72
- def dup
73
- Marshal.load(Marshal.dump(self))
74
- end
75
- end
76
-
77
- require 'wavefront-sdk/core/response'
78
- require_relative '../lib/wavefront-cli/base'
79
-
80
- # For the given command word, loads up a canned API response and
81
- # feeds it in to the appropriate display class, running the given
82
- # method and returning standard out and standard error.
83
- #
84
- # @param word [String] command word, e.g. 'alert'
85
- # @param method [Symbol] display method to run, e.g. :do_list
86
- # @param klass [Class, Nil] CLI class. Worked out from the command
87
- # word in most cases, but must be overriden for two-word things.
88
- # @return [Array] [stdout, stderr]
89
- #
90
- def command_output(word, method, klass = nil, infile = nil)
91
- infile ||= "#{word}-list.json"
92
- json = IO.read(RES_DIR + 'responses' + infile)
93
- resp = Wavefront::Response.new(json, 200)
94
- klass ||= Object.const_get(format('WavefrontCli::%<class_word>s',
95
- class_word: word.capitalize))
96
- klass = klass.new(format: :human)
97
-
98
- capture_io { klass.display(resp, method) }
99
- end
100
-
101
- def test_list_output(word, klass = nil)
102
- it 'tests terse output' do
103
- out, err = command_output(word, :do_list_brief, klass)
104
- refute_empty(out)
105
- assert_empty(err)
106
- end
107
-
108
- it 'tests long output' do
109
- out, err = command_output(word, :do_list_long, klass)
110
- refute_empty(out)
111
- assert_empty(err)
112
- end
113
- end