hawkular-client 2.7.0 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +19 -2
  3. data/.travis/wait_for_services.rb +23 -0
  4. data/CHANGES.rdoc +11 -0
  5. data/docker-compose.yml +15 -0
  6. data/lib/hawkular/alerts/alerts_api.rb +24 -0
  7. data/lib/hawkular/base_client.rb +7 -0
  8. data/lib/hawkular/inventory/entities.rb +3 -0
  9. data/lib/hawkular/metrics/metric_api.rb +38 -3
  10. data/lib/hawkular/metrics/metrics_client.rb +3 -0
  11. data/lib/hawkular/metrics/tenant_api.rb +2 -2
  12. data/lib/hawkular/version.rb +1 -1
  13. data/spec/integration/alert-resources/alerts-test-data.json +40 -0
  14. data/spec/integration/alert-resources/events-test-data.json +78 -0
  15. data/spec/integration/alert-resources/triggers-test-data.json +66 -0
  16. data/spec/integration/alerts_spec.rb +192 -83
  17. data/spec/integration/hello-world-definitions.json +1 -2
  18. data/spec/integration/inventory_spec.rb +18 -5
  19. data/spec/integration/metric_spec.rb +201 -40
  20. data/spec/integration/operations_spec.rb +45 -1
  21. data/spec/spec_helper.rb +25 -6
  22. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_acknowledge_an_alert.yml +205 -0
  23. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_fetch_single_alert.yml +108 -0
  24. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_alerts.yml +59 -0
  25. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_alerts_for_trigger.yml +58 -0
  26. data/spec/vcr_cassettes/Alert/Alerts/{Should_list_alerts_for_unknown_trigger.yml → Templates/Should_list_alerts_for_unknown_trigger.yml} +13 -9
  27. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_open_alerts.yml +59 -0
  28. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_resolve_an_alert.yml +207 -0
  29. data/spec/vcr_cassettes/Alert/Alerts/Templates/setup.yml +255 -0
  30. data/spec/vcr_cassettes/Alert/Alerts/Templates/setup_cleanup.yml +302 -0
  31. data/spec/vcr_cassettes/Alert/EndToEnd/Templates/Should_create_and_fire_a_trigger.yml +527 -0
  32. data/spec/vcr_cassettes/{Metrics/NonSecure/metrics_0_16_0/Templates/Gauge_metrics/Should_return_periods.yml → Alert/Events/Templates/Should_create_an_event.yml} +22 -18
  33. data/spec/vcr_cassettes/{Metrics/NonSecure/metrics_0_16_0/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml → Alert/Events/Templates/Should_delete_an_event.yml} +28 -24
  34. data/spec/vcr_cassettes/Alert/Events/Templates/Should_list_events.yml +91 -0
  35. data/spec/vcr_cassettes/Alert/Events/Templates/Should_list_events_using_criteria.yml +60 -0
  36. data/spec/vcr_cassettes/Alert/Events/{Should_not_list_events_using_criteria.yml → Templates/Should_not_list_events_using_criteria.yml} +14 -13
  37. data/spec/vcr_cassettes/Alert/Events/Templates/setup.yml +615 -0
  38. data/spec/vcr_cassettes/Alert/Events/Templates/setup_cleanup.yml +567 -0
  39. data/spec/vcr_cassettes/Alert/Groups/{Should_operate_a_complex_group_trigger.yml → Templates/Should_operate_a_complex_group_trigger.yml} +508 -352
  40. data/spec/vcr_cassettes/{Alerts → Alert/Templates}/Should_return_the_version.yml +10 -8
  41. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers.yml +55 -0
  42. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers_for_ID.yml +56 -0
  43. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers_for_Tag.yml +56 -0
  44. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers_for_Tags.yml +56 -0
  45. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_bulk_load_triggers.yml +243 -0
  46. data/spec/vcr_cassettes/Alert/Triggers/{Should_create_a_basic_trigger_with_action.yml → Templates/Should_create_a_basic_trigger_with_action.yml} +107 -76
  47. data/spec/vcr_cassettes/Alert/Triggers/{Should_create_a_firing_ALL_ANY_trigger.yml → Templates/Should_create_a_firing_ALL_ANY_trigger.yml} +81 -61
  48. data/spec/vcr_cassettes/{Metrics/NonSecure/metrics_0_16_0/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml → Alert/Triggers/Templates/Should_create_an_action.yml} +32 -30
  49. data/spec/vcr_cassettes/{Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml → Alert/Triggers/Templates/Should_get_a_single_Trigger_with_conditions.yml} +29 -29
  50. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_get_a_single_metric_Trigger.yml +50 -0
  51. data/spec/vcr_cassettes/Alert/Triggers/{Should_get_the_action_definitions.yml → Templates/Should_get_the_action_definitions.yml} +46 -73
  52. data/spec/vcr_cassettes/Alert/Triggers/{Should_not_create_an_action_for_unknown_plugin.yml → Templates/Should_not_create_an_action_for_unknown_plugin.yml} +12 -8
  53. data/spec/vcr_cassettes/{Metrics/NonSecure/metrics_0_16_0/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml → Alert/Triggers/Templates/Should_not_create_an_action_for_unknown_properties.yml} +27 -26
  54. data/spec/vcr_cassettes/Alert/Triggers/Templates/setup.yml +52 -0
  55. data/spec/vcr_cassettes/{Metrics/NonSecure/metrics_0_16_0/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml → Alert/Triggers/Templates/setup_cleanup.yml} +51 -51
  56. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_metrics_of_given_metric_type.yml +29 -25
  57. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Get_metric_definition_by_id.yml +3 -3
  58. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Retrieve_metric_rate_points.yml +5 -5
  59. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_create_Availability_definition.yml +4 -4
  60. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_create_Counter_definition.yml +4 -4
  61. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_create_gauge_definition.yml +4 -4
  62. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_push_metric_data_to_existing_gauge.yml +4 -4
  63. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_update_tags_for_Availability_definition.yml +6 -6
  64. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_update_tags_for_gauge_definition.yml +8 -8
  65. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/setup_client.yml +44 -0
  66. data/spec/vcr_cassettes/Metrics/NonSecure/{metrics_0_16_0/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml → metrics_services/Templates/All_Tags_for_metrics/Should_fetch_all_metric_tags_for_metrics_definitions.yml} +159 -53
  67. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_group_contiguous_values.yml +47 -6
  68. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +12 -12
  69. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/setup_client.yml +44 -0
  70. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +17 -17
  71. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +23 -23
  72. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +19 -19
  73. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +12 -12
  74. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/setup_client.yml +44 -0
  75. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +19 -19
  76. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +12 -12
  77. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_return_periods.yml +5 -5
  78. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory.yml +151 -5
  79. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory_def.yml +152 -6
  80. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/setup_client.yml +44 -0
  81. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_fetch_rate_stats_for_mixed_metric.yml +33 -33
  82. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_fetch_stats_for_mixed_metric.yml +31 -32
  83. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +108 -20
  84. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +26 -26
  85. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +27 -27
  86. data/spec/vcr_cassettes/Metrics/NonSecure/{metrics_0_16_0/Templates/Status/Should_return_the_version.yml → metrics_services/Templates/Mixed_metrics/setup_client.yml} +3 -3
  87. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/No_Tenant/Should_fail.yml +43 -4
  88. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Status/Should_return_the_version.yml +44 -3
  89. data/spec/vcr_cassettes/Metrics/NonSecure/{metrics_0_16_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml → metrics_services/Templates/String_metrics/Should_create_string_definition_using_Hash.yml} +9 -9
  90. data/spec/vcr_cassettes/Metrics/NonSecure/{metrics_0_16_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml → metrics_services/Templates/String_metrics/Should_create_string_definition_using_MetricDefinition.yml} +9 -9
  91. data/spec/vcr_cassettes/Metrics/NonSecure/{metrics_0_16_0/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml → metrics_services/Templates/String_metrics/Should_push_metric_data_to_existing_string.yml} +27 -27
  92. data/spec/vcr_cassettes/Metrics/NonSecure/{metrics_0_16_0/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml → metrics_services/Templates/String_metrics/Should_push_metric_data_to_non-existing_string.yml} +15 -15
  93. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/String_metrics/setup_client.yml +44 -0
  94. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Tags_Metrics/setup_client.yml +44 -0
  95. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Tenants/Should_create_and_return_tenant.yml +10 -6
  96. data/spec/vcr_cassettes/Metrics/{Secure/metrics_0_16_0/Templates/Status/Should_return_the_version.yml → NonSecure/metrics_services/Templates/Tenants/setup_client.yml} +5 -5
  97. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/setup_client.yml +44 -0
  98. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +80 -33
  99. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_XA_datasource_should_be_doable.json +23 -0
  100. data/spec/vcr_cassettes/Operation/NonSecure/Operation/{Add_datasource_should_be_doable.json → Add_non-XA_datasource_should_be_doable.json} +0 -0
  101. metadata +111 -156
  102. data/spec/vcr_cassettes/Alert/Alerts/Should_acknowledge_an_alert.yml +0 -183
  103. data/spec/vcr_cassettes/Alert/Alerts/Should_fetch_single_alert.yml +0 -69
  104. data/spec/vcr_cassettes/Alert/Alerts/Should_list_alerts.yml +0 -85
  105. data/spec/vcr_cassettes/Alert/Alerts/Should_list_alerts_for_trigger.yml +0 -142
  106. data/spec/vcr_cassettes/Alert/Alerts/Should_resolve_an_alert.yml +0 -181
  107. data/spec/vcr_cassettes/Alert/Alerts/Should_resolve_an_alert2.yml +0 -49
  108. data/spec/vcr_cassettes/Alert/EndToEnd/Should_create_and_fire_a_trigger.yml +0 -1187
  109. data/spec/vcr_cassettes/Alert/Events/Should_create_an_event.yml +0 -50
  110. data/spec/vcr_cassettes/Alert/Events/Should_list_events.yml +0 -101
  111. data/spec/vcr_cassettes/Alert/Events/Should_list_events_using_criteria.yml +0 -79
  112. data/spec/vcr_cassettes/Alert/Triggers/Should_List_Triggers.yml +0 -62
  113. data/spec/vcr_cassettes/Alert/Triggers/Should_List_Triggers_for_ID.yml +0 -55
  114. data/spec/vcr_cassettes/Alert/Triggers/Should_List_Triggers_for_Tag.yml +0 -68
  115. data/spec/vcr_cassettes/Alert/Triggers/Should_List_Triggers_for_Tags.yml +0 -68
  116. data/spec/vcr_cassettes/Alert/Triggers/Should_bulk_load_triggers.yml +0 -225
  117. data/spec/vcr_cassettes/Alert/Triggers/Should_create_an_action.yml +0 -134
  118. data/spec/vcr_cassettes/Alert/Triggers/Should_create_an_action_for_webhooks.yml +0 -220
  119. data/spec/vcr_cassettes/Alert/Triggers/Should_get_a_single_Trigger_with_conditions.yml +0 -138
  120. data/spec/vcr_cassettes/Alert/Triggers/Should_get_a_single_metric_Trigger.yml +0 -50
  121. data/spec/vcr_cassettes/Alert/Triggers/Should_not_create_an_action_for_unknown_properties.yml +0 -134
  122. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +0 -99
  123. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Availability_metrics/Should_group_contiguous_values.yml +0 -97
  124. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +0 -240
  125. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +0 -99
  126. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +0 -99
  127. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -240
  128. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +0 -281
  129. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +0 -240
  130. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +0 -326
  131. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +0 -314
  132. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/No_Tenant/Should_fail.yml +0 -50
  133. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Simple/Should_be_Cool.yml +0 -48
  134. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Tenants/Should_create_and_return_tenant.yml +0 -99
  135. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +0 -99
  136. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +0 -99
  137. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_group_contiguous_values.yml +0 -97
  138. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +0 -240
  139. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +0 -99
  140. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +0 -99
  141. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -240
  142. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +0 -328
  143. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +0 -281
  144. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +0 -144
  145. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +0 -99
  146. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +0 -99
  147. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +0 -281
  148. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +0 -144
  149. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_return_periods.yml +0 -97
  150. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +0 -240
  151. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +0 -326
  152. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +0 -314
  153. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +0 -285
  154. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/No_Tenant/Should_fail.yml +0 -50
  155. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Simple/Should_be_Cool.yml +0 -48
  156. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Tenants/Should_create_and_return_tenant.yml +0 -99
@@ -38,8 +38,7 @@
38
38
  "actionId": "notify-to-admins",
39
39
  "properties": {
40
40
  "to": "admins@hawkular.org",
41
- "cc": "developers@hawkular.org",
42
- "description": "Notify by email to Admins with cc to Developers"
41
+ "cc": "developers@hawkular.org"
43
42
  }
44
43
  }
45
44
  ]
@@ -38,7 +38,7 @@ module Hawkular::Inventory::RSpec
38
38
  it 'Should Get Tenant For Explicit Credentials' do
39
39
  # get the client for given endpoint for given credentials
40
40
  creds = credentials
41
- mock_inventory_client(VERSION) unless ENV['VCR_UPDATE'] == '1'
41
+ mock_inventory_client(VERSION) unless ENV['VCR_UPDATE'] == '1' || ENV['VCR_OFF'] == '1'
42
42
  options = { tenant: 'hawkular' }
43
43
  client = setup_inventory_client entrypoint, options
44
44
  tenant = client.get_tenant(creds)
@@ -47,7 +47,7 @@ module Hawkular::Inventory::RSpec
47
47
 
48
48
  it 'Should Get Tenant For Implicit Credentials' do
49
49
  creds = credentials
50
- mock_inventory_client(VERSION) unless ENV['VCR_UPDATE'] == '1'
50
+ mock_inventory_client(VERSION) unless ENV['VCR_UPDATE'] == '1' || ENV['VCR_OFF'] == '1'
51
51
  options = { tenant: 'hawkular' }
52
52
  client = setup_inventory_client entrypoint, options
53
53
  tenant = client.get_tenant(creds)
@@ -109,6 +109,12 @@ module Hawkular::Inventory::RSpec
109
109
  @state[:feed_uuid] = feeds[0]
110
110
  end
111
111
 
112
+ record("Inventory/#{security_context}/inventory_#{x}_#{y}", @state.clone, 'Helpers/wait_for_wildfly') do
113
+ wait_while do
114
+ @client.list_resources_for_feed(@state[:feed_uuid]).length < 2
115
+ end
116
+ end if ENV['RUN_ON_LIVE_SERVER'] == '1'
117
+
112
118
  # create 1 URL resource and its metrics
113
119
  record("Inventory/#{security_context}/inventory_#{x}_#{y}", @state.clone, 'Helpers/create_url') do
114
120
  headers = {}
@@ -314,7 +320,7 @@ module Hawkular::Inventory::RSpec
314
320
  it 'Should list metrics of given metric type' do
315
321
  type_path = Hawkular::Inventory::CanonicalPath.new(
316
322
  feed_id: feed_id,
317
- metric_type_id: hawk_escape_id('Total Space'))
323
+ metric_type_id: hawk_escape_id('Platform_File Store_Total Space'))
318
324
  metrics = @client.list_metrics_for_metric_type(type_path)
319
325
 
320
326
  expect(metrics.size).to be >= 2
@@ -592,7 +598,14 @@ module Hawkular::Inventory::RSpec
592
598
  end
593
599
 
594
600
  # wait for the data
595
- sleep 5 if !WebSocketVCR.cassette || WebSocketVCR.cassette.recording?
601
+ wait_while do
602
+ [
603
+ !hash_include_all(new_resource_events, [id_1, id_2]),
604
+ !registered_feed_events.key?(new_feed_id),
605
+ !deleted_feed_events.key?(new_feed_id),
606
+ !new_resource_types_events.key?(resource_type_id)
607
+ ].any?
608
+ end
596
609
  [feed_deleted_closable, resource_type_closable, feeds_closable].each(&:close)
597
610
  expect(new_resource_events[id_1]).not_to be_nil
598
611
  expect(new_resource_events[id_1].properties['version']).to eq(1.0)
@@ -630,5 +643,5 @@ module Hawkular::Inventory::RSpec
630
643
  expect(feeds.size).to be(1)
631
644
  end
632
645
  end
633
- end
646
+ end unless ENV['SKIP_SSL_WITHOUT_CERTIFICATE_TEST'] == '1'
634
647
  end
@@ -9,12 +9,10 @@ SKIP_SECURE_CONTEXT.freeze
9
9
 
10
10
  # time constants
11
11
  t4h = 4 * 60 * 60 * 1000
12
- v16_version_string = '0.16.0.Final'
13
12
 
14
13
  # test contexts
15
14
  v8_context = :metrics_0_8_0
16
15
  services_context = :metrics_services
17
- v16_context = :metrics_0_16_0
18
16
 
19
17
  # ssl contexts
20
18
  SECURE_CONTEXT = :Secure
@@ -26,7 +24,7 @@ vcr_test_tenant_postfix = "-vcr-tenant-#{SecureRandom.uuid}".freeze
26
24
  security_contexts.each do |security_context|
27
25
  next if security_context == SECURE_CONTEXT && SKIP_SECURE_CONTEXT == '1'
28
26
 
29
- [v8_context, services_context, v16_context].each do |metrics_context|
27
+ [v8_context, services_context].each do |metrics_context|
30
28
  if ENV['SKIP_V8_METRICS'] == '1' && metrics_context == v8_context
31
29
  puts 'skipping v8 metrics'
32
30
  next
@@ -39,7 +37,6 @@ security_contexts.each do |security_context|
39
37
  next if security_context == SECURE_CONTEXT && metrics_context == v8_context
40
38
 
41
39
  setup_options = {
42
- mocked_version: metrics_context == :metrics_services ? nil : v16_version_string,
43
40
  type: security_context
44
41
  }.freeze
45
42
 
@@ -54,8 +51,12 @@ security_contexts.each do |security_context|
54
51
  end + example.description
55
52
  end
56
53
 
54
+ before(:all) do
55
+ @admin_token = ENV['ADMIN_TOKEN'] || SecureRandom.uuid
56
+ end
57
+
57
58
  let(:vcr_bindings) do
58
- { id: @random_id, vcr_test_tenant: vcr_test_tenant }
59
+ { id: @random_id, vcr_test_tenant: vcr_test_tenant, admin_token: @admin_token }
59
60
  end
60
61
 
61
62
  around(:each) do |example|
@@ -84,12 +85,17 @@ security_contexts.each do |security_context|
84
85
  end
85
86
  end
86
87
 
87
- describe 'Tenants', run_for: [v8_context, services_context, v16_context] do
88
+ describe 'Tenants', run_for: [v8_context, services_context] do
88
89
  before(:all) do
89
- if metrics_context == v8_context
90
- setup_v8_client
91
- else
92
- setup_client(setup_options)
90
+ options = setup_options.merge admin_token: @admin_token
91
+ record("Metrics/#{security_context}/#{metrics_context}",
92
+ options,
93
+ 'Tenants/setup_client') do
94
+ if metrics_context == v8_context
95
+ setup_v8_client
96
+ else
97
+ setup_client(options)
98
+ end
93
99
  end
94
100
  end
95
101
 
@@ -101,7 +107,7 @@ security_contexts.each do |security_context|
101
107
  end
102
108
  end
103
109
 
104
- describe 'No Tenant', run_for: [services_context, v16_context] do
110
+ describe 'No Tenant', run_for: [services_context] do
105
111
  it 'Should fail' do
106
112
  setup_client_without_tenant(setup_options)
107
113
  begin
@@ -114,22 +120,28 @@ security_contexts.each do |security_context|
114
120
  end
115
121
  end
116
122
 
117
- describe 'Mixed metrics', run_for: [v8_context, services_context, v16_context] do
123
+ describe 'Mixed metrics', run_for: [v8_context, services_context] do
118
124
  before(:all) do
119
- if metrics_context == v8_context
120
- setup_v8_client tenant: vcr_test_tenant
121
- else
122
- setup_client(setup_options)
125
+ options = setup_options.merge(tenant: vcr_test_tenant)
126
+ record("Metrics/#{security_context}/#{metrics_context}",
127
+ options,
128
+ 'Mixed_metrics/setup_client') do
129
+ if metrics_context == v8_context
130
+ setup_v8_client tenant: vcr_test_tenant
131
+ else
132
+ setup_client(setup_options)
133
+ end
123
134
  end
124
135
  end
125
136
 
126
- it 'Should requests raw data for multiple metrics', :skip_auto_vcr, run_for: [services_context, v16_context] do
137
+ it 'Should requests raw data for multiple metrics', :skip_auto_vcr, run_for: [services_context] do
127
138
  id1 = SecureRandom.uuid
128
139
  id2 = SecureRandom.uuid
129
140
  id3 = SecureRandom.uuid
141
+ id4 = SecureRandom.uuid
130
142
 
131
143
  ids = [id1, id2, id3]
132
- bindings = { id1: id1, id2: id2, id3: id3 }
144
+ bindings = { id1: id1, id2: id2, id3: id3, id4: id4 }
133
145
  example = proc do
134
146
  @client = setup_client(setup_options.merge tenant: vcr_test_tenant)
135
147
 
@@ -146,7 +158,10 @@ security_contexts.each do |security_context|
146
158
  availabilities: [
147
159
  { id: id1, data: [{ value: 'up' }] },
148
160
  { id: id2, data: [{ value: 'down' }] },
149
- { id: id3, data: [{ value: 'up' }] }
161
+ { id: id3, data: [{ value: 'up' }] },
162
+ { id: id4, data: [{ value: 'up', timestamp: 10_000 },
163
+ { value: 'down', timestamp: 100_000 },
164
+ { value: 'admin', timestamp: 1_000_000 }] }
150
165
  ],
151
166
  gauges: [
152
167
  { id: id1, data: [{ value: 1.1 }] },
@@ -158,7 +173,8 @@ security_contexts.each do |security_context|
158
173
  c_metrics = @client.counters.raw_data(ids)
159
174
  g_metrics = @client.gauges.raw_data(ids)
160
175
  a_metrics = @client.avail.raw_data(ids)
161
-
176
+ # also check the get_data way of fetching avail data, with params
177
+ a_metric = @client.avail.get_data(id4, starts: 100, ends: 2_000_000, distinct: 'true', order: 'ASC')
162
178
  expect(c_metrics.size).to be 3
163
179
  expect(c_metrics).to include(
164
180
  { 'id' => id1, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 1 }] },
@@ -179,6 +195,13 @@ security_contexts.each do |security_context|
179
195
  { 'id' => id2, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 'down' }] },
180
196
  { 'id' => id3, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 'up' }] }
181
197
  )
198
+
199
+ expect(a_metric.size).to be 3
200
+ expect(a_metric).to include(
201
+ { 'timestamp' => 10_000, 'value' => 'up' },
202
+ { 'timestamp' => 100_000, 'value' => 'down' },
203
+ { 'timestamp' => 1_000_000, 'value' => 'admin' }
204
+ )
182
205
  end
183
206
  record("Metrics/#{security_context}/#{metrics_context}",
184
207
  vcr_bindings.merge(bindings),
@@ -276,10 +299,15 @@ security_contexts.each do |security_context|
276
299
  describe 'Counter metrics' do
277
300
  before(:all) do
278
301
  @tenant = vcr_test_tenant
279
- if metrics_context == v8_context
280
- setup_v8_client tenant: @tenant
281
- else
282
- setup_client(setup_options.merge(tenant: @tenant))
302
+ options = setup_options.merge(tenant: @tenant)
303
+ record("Metrics/#{security_context}/#{metrics_context}",
304
+ options,
305
+ 'Counter_metrics/setup_client') do
306
+ if metrics_context == v8_context
307
+ setup_v8_client tenant: @tenant
308
+ else
309
+ setup_client(setup_options.merge(tenant: @tenant))
310
+ end
283
311
  end
284
312
  end
285
313
 
@@ -329,7 +357,7 @@ security_contexts.each do |security_context|
329
357
  end
330
358
 
331
359
  # limit and order were introduced in 0.11.0 => skipping for 0.8.0
332
- it 'Should get metrics with limit and order', run_for: [services_context, v16_context], skip_auto_vcr: true do
360
+ it 'Should get metrics with limit and order', run_for: [services_context], skip_auto_vcr: true do
333
361
  now = @client.now
334
362
  minus10 = now - 10
335
363
  minus20 = now - 20
@@ -435,10 +463,15 @@ security_contexts.each do |security_context|
435
463
  describe 'Availability metrics' do
436
464
  before(:all) do
437
465
  @tenant = vcr_test_tenant
438
- if metrics_context == v8_context
439
- setup_v8_client tenant: @tenant
440
- else
441
- setup_client(setup_options.merge(tenant: @tenant))
466
+ options = setup_options.merge(tenant: @tenant)
467
+ record("Metrics/#{security_context}/#{metrics_context}",
468
+ options,
469
+ 'Availability_metrics/setup_client') do
470
+ if metrics_context == v8_context
471
+ setup_v8_client tenant: @tenant
472
+ else
473
+ setup_client(setup_options.merge(tenant: @tenant))
474
+ end
442
475
  end
443
476
  end
444
477
 
@@ -462,7 +495,7 @@ security_contexts.each do |security_context|
462
495
  expect { @client.avail.get_data(@random_id, percentiles: 50) }.to raise_error(ArgumentError)
463
496
  end
464
497
 
465
- it 'Should group contiguous values', :skip_auto_vcr, run_for: [services_context, v16_context] do
498
+ it 'Should group contiguous values', :skip_auto_vcr, run_for: [services_context] do
466
499
  now = @client.now
467
500
  minus10 = now - 10
468
501
  minus20 = now - 20
@@ -497,16 +530,31 @@ security_contexts.each do |security_context|
497
530
 
498
531
  describe 'Gauge metrics' do
499
532
  hawkular_tenant_id = 'hawkular'.freeze
500
- hawkular_feed_id = 'af0ea377-80f4-4567-af45-105eaa808b92'.freeze
501
- hawkular_mem_id = "MI~R~[#{hawkular_feed_id}/platform~/OPERATING_SYSTEM=#{hawkular_feed_id}"\
502
- '_OperatingSystem/MEMORY=Memory]~MT~Total Memory'.freeze
533
+
534
+ let(:inventory_client) do
535
+ inventory_entrypoint = entrypoint(security_context, 'inventory')
536
+ setup_inventory_client(inventory_entrypoint, tenant: hawkular_tenant_id)
537
+ end
538
+
539
+ let(:hawkular_feed_id) do
540
+ inventory_client.list_feeds.first
541
+ end
542
+
543
+ let(:hawkular_mem_id) do
544
+ "MI~R~[#{hawkular_feed_id}/platform~/OPERATING_SYSTEM=#{hawkular_feed_id}"\
545
+ '_OperatingSystem/MEMORY=Memory]~MT~Platform_Memory_Total Memory'
546
+ end
503
547
 
504
548
  before(:all) do
505
549
  @tenant = vcr_test_tenant
506
- if metrics_context == v8_context
507
- setup_v8_client tenant: @tenant
508
- else
509
- setup_client(setup_options.merge(tenant: @tenant))
550
+ record("Metrics/#{security_context}/#{metrics_context}",
551
+ setup_options.merge(tenant: @tenant),
552
+ 'Gauge_metrics/setup_client') do
553
+ if metrics_context == v8_context
554
+ setup_v8_client tenant: @tenant
555
+ else
556
+ setup_client(setup_options.merge(tenant: @tenant))
557
+ end
510
558
  end
511
559
  end
512
560
 
@@ -587,7 +635,7 @@ security_contexts.each do |security_context|
587
635
  end
588
636
 
589
637
  it 'Should return platform memory def', :skip_auto_vcr, run_for: [services_context] do
590
- bindings = { mem_id: hawkular_mem_id, tenant: hawkular_tenant_id }
638
+ bindings = { tenant: hawkular_tenant_id }
591
639
  example = proc do
592
640
  if metrics_context == v8_context
593
641
  setup_v8_client tenant: hawkular_tenant_id
@@ -608,7 +656,7 @@ security_contexts.each do |security_context|
608
656
  end
609
657
 
610
658
  it 'Should return platform memory', :skip_auto_vcr, run_for: [services_context] do
611
- bindings = { mem_id: hawkular_mem_id, tenant: hawkular_tenant_id }
659
+ bindings = { tenant: hawkular_tenant_id }
612
660
  example = proc do
613
661
  # this id depends on OS and the feed id
614
662
  if metrics_context == v8_context
@@ -638,6 +686,115 @@ security_contexts.each do |security_context|
638
686
  expect(data).not_to be_nil
639
687
  end
640
688
  end
689
+
690
+ describe 'String metrics', run_for: [services_context] do
691
+ before(:each) do
692
+ @tenant = vcr_test_tenant
693
+ options = setup_options.merge(tenant: @tenant)
694
+ record("Metrics/#{security_context}/#{metrics_context}",
695
+ options,
696
+ 'String_metrics/setup_client') do
697
+ setup_client(options)
698
+ end
699
+ end
700
+
701
+ it 'Should create string definition using MetricDefinition' do
702
+ create_metric_using_md @client.strings, @random_id
703
+ end
704
+
705
+ it 'Should create string definition using Hash' do
706
+ create_metric_using_hash @client.strings, @random_id, @tenant
707
+ end
708
+
709
+ it 'Should push metric data to non-existing string' do
710
+ push_data_to_non_existing_metric @client.strings, { value: 'Hello world' }, @random_id
711
+ end
712
+
713
+ it 'Should push metric data to existing string', :skip_auto_vcr do
714
+ now = @client.now
715
+ ends = now - t4h
716
+ starts = now - (2 * t4h)
717
+ now10 = now - 10
718
+ now20 = now - 20
719
+ now30 = now - 30
720
+ bindings = { id: @random_id, ends: ends, starts: starts, now10: now10, now20: now20, now30: now30 }
721
+ example = proc do
722
+ # create gauge
723
+ @client.strings.create(id: @random_id)
724
+
725
+ # push 3 values with timestamps
726
+ @client.strings.push_data(@random_id,
727
+ [
728
+ { value: 'Value1', timestamp: now30 },
729
+ { value: 'Value2', timestamp: now20 },
730
+ { value: 'Value3', timestamp: now10 }
731
+ ])
732
+
733
+ data = @client.strings.get_data(@random_id)
734
+ expect(data.size).to be 3
735
+
736
+ # push one value without timestamp (which means now)
737
+ @client.strings.push_data(@random_id, value: 'Now')
738
+ data = @client.strings.get_data(@random_id)
739
+ expect(data.size).to be 4
740
+
741
+ # retrieve values from past
742
+ data = @client.strings.get_data(@random_id, starts: starts, ends: ends)
743
+ expect(data.empty?).to be true
744
+ end
745
+ record("Metrics/#{security_context}/#{metrics_context}",
746
+ vcr_bindings.merge(bindings),
747
+ cassette_name,
748
+ example: example)
749
+ end
750
+ end
751
+
752
+ describe 'All Tags for metrics', run_for: [services_context] do
753
+ before(:each) do
754
+ @tenant = 'all_tags_tenant'
755
+ options = setup_options.merge(tenant: @tenant)
756
+ record("Metrics/#{security_context}/#{metrics_context}",
757
+ options,
758
+ 'Tags_Metrics/setup_client') do
759
+ setup_client(options)
760
+ end
761
+ end
762
+
763
+ it 'Should fetch all metric tags for metrics definitions' do
764
+ tags_m1 = {
765
+ tag1: 'value1',
766
+ tag2: 'value2',
767
+ tag3: 'value3'
768
+ }
769
+
770
+ tags_m2 = {
771
+ tag1: 'value1',
772
+ tag4: 'value4',
773
+ tag5: 'value5'
774
+ }
775
+
776
+ tags_m3 = {
777
+ tag1: 'value1',
778
+ tag4: 'value4',
779
+ tag5: 'value5.1'
780
+ }
781
+
782
+ create_metric_using_md @client.gauges, 'metric_1', tags_m1
783
+ create_metric_using_md @client.avail, 'metric_2', tags_m2
784
+ create_metric_using_md @client.counters, 'metric_2', tags_m3
785
+ create_metric_using_md @client.counters, 'metric_3', {}
786
+
787
+ expected_result = [
788
+ { 'tag1' => 'value1' },
789
+ { 'tag2' => 'value2' },
790
+ { 'tag3' => 'value3' },
791
+ { 'tag4' => 'value4' },
792
+ { 'tag5' => 'value5' },
793
+ { 'tag5' => 'value5.1' }
794
+ ]
795
+ expect(@client.tags.to_set).to eql(expected_result.to_set)
796
+ end
797
+ end
641
798
  end
642
799
  end
643
800
 
@@ -646,7 +803,11 @@ security_contexts.each do |security_context|
646
803
  context security_context do
647
804
  describe 'Metric ID with special characters' do
648
805
  before(:all) do
649
- setup_client(type: security_context, tenant: vcr_test_tenant)
806
+ record("Metrics/#{security_context}/ID_with_special_characters",
807
+ { tenant: vcr_test_tenant },
808
+ 'setup_client') do
809
+ setup_client(type: security_context, tenant: vcr_test_tenant)
810
+ end
650
811
  end
651
812
 
652
813
  around(:each) do |example|