hawkular-client 2.9.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (340) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.rdoc +27 -0
  3. data/README.rdoc +14 -14
  4. data/lib/hawkular/alerts/alerts_api.rb +43 -7
  5. data/lib/hawkular/client_utils.rb +0 -3
  6. data/lib/hawkular/hawkular_client.rb +1 -1
  7. data/lib/hawkular/inventory/entities.rb +55 -19
  8. data/lib/hawkular/inventory/inventory_api.rb +313 -412
  9. data/lib/hawkular/metrics/metric_api.rb +5 -2
  10. data/lib/hawkular/operations/operations_api.rb +0 -8
  11. data/lib/hawkular/tokens/tokens_api.rb +0 -3
  12. data/lib/hawkular/version.rb +1 -1
  13. metadata +3 -647
  14. data/.coveralls.yml +0 -1
  15. data/.gitignore +0 -56
  16. data/.rubocop.yml +0 -32
  17. data/.travis.yml +0 -20
  18. data/.travis/start_hawkular_services.sh +0 -21
  19. data/.travis/wait_for_services.rb +0 -39
  20. data/.yardopts +0 -1
  21. data/Gemfile +0 -2
  22. data/Rakefile +0 -20
  23. data/api_breaking_changes.rdoc +0 -84
  24. data/docker-compose.yml +0 -17
  25. data/hawkularclient.gemspec +0 -43
  26. data/spec/README.rdoc +0 -62
  27. data/spec/integration/alert-resources/alerts-test-data.json +0 -40
  28. data/spec/integration/alert-resources/events-test-data.json +0 -78
  29. data/spec/integration/alert-resources/triggers-test-data.json +0 -66
  30. data/spec/integration/alerts_spec.rb +0 -774
  31. data/spec/integration/env_config_spec.rb +0 -39
  32. data/spec/integration/hawkular_client_spec.rb +0 -304
  33. data/spec/integration/hello-world-definitions.json +0 -45
  34. data/spec/integration/inventory_spec.rb +0 -680
  35. data/spec/integration/logger_spec.rb +0 -36
  36. data/spec/integration/metric_spec.rb +0 -953
  37. data/spec/integration/operations_spec.rb +0 -591
  38. data/spec/integration/tokens_spec.rb +0 -49
  39. data/spec/resources/driver.jar +0 -0
  40. data/spec/resources/sample.war +0 -0
  41. data/spec/spec_helper.rb +0 -336
  42. data/spec/unit/base_spec.rb +0 -256
  43. data/spec/unit/canonical_path_spec.rb +0 -102
  44. data/spec/unit/client_spec.rb +0 -55
  45. data/spec/unit/deprecations_spec.rb +0 -19
  46. data/spec/vcr/vcr_setup.rb +0 -16
  47. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_acknowledge_an_alert.yml +0 -205
  48. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_add_tags_to_existing_alert.yml +0 -210
  49. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_fetch_single_alert.yml +0 -108
  50. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_alerts.yml +0 -59
  51. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_alerts_for_trigger.yml +0 -58
  52. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_alerts_for_unknown_trigger.yml +0 -50
  53. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_open_alerts.yml +0 -59
  54. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_remove_tags_from_existing_alert.yml +0 -257
  55. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_resolve_an_alert.yml +0 -207
  56. data/spec/vcr_cassettes/Alert/Alerts/Templates/setup.yml +0 -255
  57. data/spec/vcr_cassettes/Alert/Alerts/Templates/setup_cleanup.yml +0 -302
  58. data/spec/vcr_cassettes/Alert/EndToEnd/Templates/Should_create_and_fire_a_trigger.yml +0 -527
  59. data/spec/vcr_cassettes/Alert/Events/Templates/Should_create_an_event.yml +0 -101
  60. data/spec/vcr_cassettes/Alert/Events/Templates/Should_delete_an_event.yml +0 -148
  61. data/spec/vcr_cassettes/Alert/Events/Templates/Should_list_events.yml +0 -91
  62. data/spec/vcr_cassettes/Alert/Events/Templates/Should_list_events_using_criteria.yml +0 -60
  63. data/spec/vcr_cassettes/Alert/Events/Templates/Should_not_list_events_using_criteria.yml +0 -50
  64. data/spec/vcr_cassettes/Alert/Events/Templates/setup.yml +0 -615
  65. data/spec/vcr_cassettes/Alert/Events/Templates/setup_cleanup.yml +0 -567
  66. data/spec/vcr_cassettes/Alert/Groups/Templates/Should_operate_a_complex_group_trigger.yml +0 -1882
  67. data/spec/vcr_cassettes/Alert/Templates/Should_return_the_version.yml +0 -42
  68. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers.yml +0 -55
  69. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers_for_ID.yml +0 -56
  70. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers_for_Tag.yml +0 -56
  71. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers_for_Tags.yml +0 -56
  72. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_bulk_load_triggers.yml +0 -243
  73. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_create_a_basic_trigger_with_action.yml +0 -386
  74. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_create_a_firing_ALL_ANY_trigger.yml +0 -483
  75. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_create_an_action.yml +0 -146
  76. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_get_a_single_Trigger_with_conditions.yml +0 -144
  77. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_get_a_single_metric_Trigger.yml +0 -50
  78. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_get_the_action_definitions.yml +0 -228
  79. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_not_create_an_action_for_unknown_plugin.yml +0 -50
  80. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_not_create_an_action_for_unknown_properties.yml +0 -100
  81. data/spec/vcr_cassettes/Alert/Triggers/Templates/setup.yml +0 -52
  82. data/spec/vcr_cassettes/Alert/Triggers/Templates/setup_cleanup.yml +0 -285
  83. data/spec/vcr_cassettes/HawkularClient/Should_err_on_bad_credentials.yml +0 -42
  84. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_both_create_and_delete_feed.yml +0 -317
  85. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_both_list_WildFlys.yml +0 -103
  86. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_both_list_types_with_bad_feed.yml +0 -103
  87. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_list_same_types_when_param_is_given.yml +0 -325
  88. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_list_the_same_feeds.yml +0 -117
  89. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_list_the_same_resource_types.yml +0 -111
  90. data/spec/vcr_cassettes/HawkularClient/and_Metrics_client/Should_both_create_and_retrieve_tags_for_Availability.yml +0 -155
  91. data/spec/vcr_cassettes/HawkularClient/and_Metrics_client/Should_both_create_and_return_Availability_using_Hash_parameter.yml +0 -155
  92. data/spec/vcr_cassettes/HawkularClient/and_Metrics_client/Should_both_return_the_version.yml +0 -89
  93. data/spec/vcr_cassettes/HawkularClient/and_Metrics_client/Should_both_work_the_same_way_when_pushing_metric_data_to_non-existing_counter.yml +0 -114
  94. data/spec/vcr_cassettes/HawkularClient/and_Operations_client/Should_both_work_the_same_way.yml +0 -158
  95. data/spec/vcr_cassettes/HawkularClient/and_Operations_client/Should_work_initializing_with_URI.yml +0 -48
  96. data/spec/vcr_cassettes/HawkularClient/and_Operations_client_Should_both_work_the_same_way.json +0 -44
  97. data/spec/vcr_cassettes/HawkularClient/and_Operations_client_Should_work_initializing_with_URI.json +0 -9
  98. data/spec/vcr_cassettes/HawkularClient/and_URIs_as_input/Should_work_with_URI.yml +0 -169
  99. data/spec/vcr_cassettes/HawkularClient/and_URIs_as_input/Should_work_with_URI_on_metrics_client.yml +0 -42
  100. data/spec/vcr_cassettes/Inventory/NonSecure/Connection/Templates/Should_err_on_bad_credentials.yml +0 -44
  101. data/spec/vcr_cassettes/Inventory/NonSecure/Tenants/Templates/Should_Get_Tenant_For_Explicit_Credentials.yml +0 -101
  102. data/spec/vcr_cassettes/Inventory/NonSecure/Tenants/Templates/Should_Get_Tenant_For_Implicit_Credentials.yml +0 -101
  103. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Client_should_listen_on_various_inventory_events.json +0 -47
  104. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Client_should_listen_on_various_inventory_events.yml +0 -207
  105. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Helpers/create_url.yml +0 -52
  106. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Helpers/generate_some_events_for_websocket.yml +0 -411
  107. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Helpers/get_feeds.yml +0 -62
  108. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_List_datasources_with_no_props.yml +0 -133
  109. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_feed.yml +0 -59
  110. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_feed_again.yml +0 -181
  111. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_nested_resource_and_metric_on_it.yml +0 -664
  112. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_resource.yml +0 -360
  113. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_resource_with_metric.yml +0 -846
  114. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_resourcetype.yml +0 -169
  115. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_and_delete_feed.yml +0 -166
  116. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_and_get_a_resource.yml +0 -420
  117. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_get_resource_with_its_configurations.yml +0 -132
  118. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_have_a_consistent_behaviour_when_creating_an_already_existing_resource.yml +0 -714
  119. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_have_the_same_requested_metric_type_id.yml +0 -73
  120. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_URLs.yml +0 -90
  121. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_WildFlys.yml +0 -70
  122. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_WildFlys_with_props.yml +0 -138
  123. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_all_the_resource_types.yml +0 -59
  124. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_children_of_WildFly.yml +0 -333
  125. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_children_of_nested_resource.yml +0 -180
  126. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_feeds.yml +0 -62
  127. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_heap_metrics_for_WildFlys.yml +0 -943
  128. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_metrics_for_WildFlys.yml +0 -361
  129. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_metrics_of_given_metric_type.yml +0 -94
  130. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_metrics_of_given_resource_type.yml +0 -294
  131. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource.yml +0 -871
  132. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource_type.yml +0 -740
  133. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_recursive_children_of_WildFly.yml +0 -1117
  134. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_relationships_of_WildFly.yml +0 -393
  135. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_resources_for_feed.yml +0 -84
  136. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_types_with_bad_feed.yml +0 -55
  137. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_types_with_feed.yml +0 -166
  138. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_not_find_an_unknown_resource.yml +0 -59
  139. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_return_config_data_of_given_nested_resource.yml +0 -66
  140. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_return_config_data_of_given_resource.yml +0 -71
  141. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_return_data_from_get_entity.yml +0 -230
  142. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_return_the_version.yml +0 -50
  143. data/spec/vcr_cassettes/Inventory/Secure/Connection/Templates/Should_err_on_bad_credentials.yml +0 -44
  144. data/spec/vcr_cassettes/Inventory/Secure/Tenants/Templates/Should_Get_Tenant_For_Explicit_Credentials.yml +0 -101
  145. data/spec/vcr_cassettes/Inventory/Secure/Tenants/Templates/Should_Get_Tenant_For_Implicit_Credentials.yml +0 -101
  146. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Client_should_listen_on_various_inventory_events.json +0 -47
  147. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Client_should_listen_on_various_inventory_events.yml +0 -207
  148. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Helpers/create_url.yml +0 -52
  149. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Helpers/generate_some_events_for_websocket.yml +0 -411
  150. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Helpers/get_feeds.yml +0 -62
  151. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_List_datasources_with_no_props.yml +0 -133
  152. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_feed.yml +0 -59
  153. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_feed_again.yml +0 -181
  154. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_nested_resource_and_metric_on_it.yml +0 -664
  155. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_resource.yml +0 -360
  156. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_resource_with_metric.yml +0 -846
  157. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_resourcetype.yml +0 -169
  158. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_and_delete_feed.yml +0 -166
  159. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_and_get_a_resource.yml +0 -420
  160. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_get_resource_with_its_configurations.yml +0 -132
  161. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_have_the_same_requested_metric_type_id.yml +0 -73
  162. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_URLs.yml +0 -90
  163. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_WildFlys.yml +0 -70
  164. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_WildFlys_with_props.yml +0 -138
  165. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_all_the_resource_types.yml +0 -59
  166. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_children_of_WildFly.yml +0 -333
  167. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_children_of_nested_resource.yml +0 -180
  168. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_feeds.yml +0 -62
  169. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_heap_metrics_for_WildFlys.yml +0 -943
  170. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_metrics_for_WildFlys.yml +0 -361
  171. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_metrics_of_given_metric_type.yml +0 -90
  172. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_metrics_of_given_resource_type.yml +0 -294
  173. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource.yml +0 -871
  174. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource_type.yml +0 -740
  175. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_recursive_children_of_WildFly.yml +0 -1117
  176. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_relationships_of_WildFly.yml +0 -393
  177. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_resources_for_feed.yml +0 -84
  178. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_types_with_bad_feed.yml +0 -55
  179. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_types_with_feed.yml +0 -166
  180. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_not_find_an_unknown_resource.yml +0 -59
  181. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_return_config_data_of_given_nested_resource.yml +0 -66
  182. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_return_config_data_of_given_resource.yml +0 -71
  183. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_return_the_version.yml +0 -50
  184. data/spec/vcr_cassettes/Inventory/Templates/Should_list_feeds_when_using_SSL_without_certificate.yml +0 -114
  185. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_get_resource_with_its_configurations.yml +0 -132
  186. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Get_metric_definition_by_id.yml +0 -51
  187. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Retrieve_metric_rate_points.yml +0 -92
  188. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_create_Availability_definition.yml +0 -101
  189. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_create_Counter_definition.yml +0 -101
  190. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_create_gauge_definition.yml +0 -101
  191. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_push_metric_data_to_existing_gauge.yml +0 -50
  192. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_update_tags_for_Availability_definition.yml +0 -146
  193. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_update_tags_for_gauge_definition.yml +0 -146
  194. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/setup_client.yml +0 -44
  195. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +0 -83
  196. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +0 -83
  197. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +0 -120
  198. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +0 -200
  199. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +0 -83
  200. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +0 -83
  201. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -200
  202. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +0 -237
  203. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +0 -120
  204. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +0 -83
  205. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +0 -83
  206. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +0 -237
  207. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +0 -120
  208. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_return_periods.yml +0 -81
  209. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +0 -200
  210. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +0 -270
  211. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +0 -237
  212. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Simple/Should_be_Cool.yml +0 -82
  213. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Status/Should_return_the_version.yml +0 -42
  214. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Tenants/Should_create_and_return_tenant.yml +0 -83
  215. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/All_Tags_for_metrics/Should_fetch_all_metric_tags_for_metrics_definitions.yml +0 -434
  216. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/All_Tags_for_metrics/Should_fetch_all_metrics_with_some_tags.yml +0 -1251
  217. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +0 -99
  218. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +0 -99
  219. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_group_contiguous_values.yml +0 -138
  220. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +0 -144
  221. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +0 -240
  222. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/setup_client.yml +0 -44
  223. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +0 -99
  224. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +0 -99
  225. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -240
  226. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +0 -328
  227. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +0 -281
  228. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +0 -144
  229. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/setup_client.yml +0 -44
  230. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +0 -99
  231. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +0 -99
  232. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +0 -281
  233. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +0 -144
  234. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_return_periods.yml +0 -97
  235. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory.yml +0 -196
  236. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory_def.yml +0 -197
  237. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +0 -240
  238. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/setup_client.yml +0 -44
  239. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_fetch_rate_stats_for_mixed_metric.yml +0 -328
  240. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_fetch_stats_for_mixed_metric.yml +0 -363
  241. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +0 -414
  242. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +0 -314
  243. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +0 -285
  244. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/setup_client.yml +0 -44
  245. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/No_Tenant/Should_fail.yml +0 -89
  246. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Simple/Should_be_Cool.yml +0 -48
  247. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Status/Should_return_the_version.yml +0 -85
  248. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/String_metrics/Should_create_string_definition_using_Hash.yml +0 -99
  249. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/String_metrics/Should_create_string_definition_using_MetricDefinition.yml +0 -99
  250. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/String_metrics/Should_push_metric_data_to_existing_string.yml +0 -281
  251. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/String_metrics/Should_push_metric_data_to_non-existing_string.yml +0 -144
  252. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/String_metrics/setup_client.yml +0 -44
  253. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Tags_Metrics/setup_client.yml +0 -44
  254. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Tenants/Should_create_and_return_tenant.yml +0 -103
  255. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Tenants/setup_client.yml +0 -44
  256. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/setup_client.yml +0 -44
  257. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Get_metric_definition_by_id.yml +0 -51
  258. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Retrieve_metric_rate_points.yml +0 -92
  259. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_create_Availability_definition.yml +0 -101
  260. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_create_Counter_definition.yml +0 -101
  261. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_create_gauge_definition.yml +0 -101
  262. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_push_metric_data_to_existing_gauge.yml +0 -50
  263. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_update_tags_for_Availability_definition.yml +0 -146
  264. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_update_tags_for_gauge_definition.yml +0 -146
  265. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +0 -99
  266. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +0 -99
  267. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_group_contiguous_values.yml +0 -97
  268. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +0 -144
  269. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +0 -240
  270. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +0 -99
  271. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +0 -99
  272. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -240
  273. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +0 -328
  274. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +0 -281
  275. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +0 -144
  276. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +0 -99
  277. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +0 -99
  278. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +0 -281
  279. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +0 -144
  280. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_return_periods.yml +0 -97
  281. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory.yml +0 -50
  282. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory_def.yml +0 -51
  283. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +0 -240
  284. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_fetch_stats_for_mixed_metric.yml +0 -364
  285. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +0 -373
  286. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +0 -314
  287. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +0 -285
  288. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/No_Tenant/Should_fail.yml +0 -50
  289. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Simple/Should_be_Cool.yml +0 -48
  290. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Status/Should_return_the_version.yml +0 -44
  291. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Tenants/Should_create_and_return_tenant.yml +0 -99
  292. data/spec/vcr_cassettes/New_API_Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -230
  293. data/spec/vcr_cassettes/New_API_Mixed_metrics/Should_send_mixed_metric_request.yml +0 -300
  294. data/spec/vcr_cassettes/Operation/NonSecure/Helpers/Templates/agent_properties.yml +0 -124
  295. data/spec/vcr_cassettes/Operation/NonSecure/Helpers/Templates/get_feed.yml +0 -61
  296. data/spec/vcr_cassettes/Operation/NonSecure/Helpers/Templates/get_tenant.yml +0 -55
  297. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_JDBC_driver_should_add_the_driver.json +0 -23
  298. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_XA_datasource_should_be_doable.json +0 -23
  299. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_deployment_should_be_doable.json +0 -23
  300. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_non-XA_datasource_should_be_doable.json +0 -23
  301. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Disable_should_be_performed_and_eventually_respond_with_success.json +0 -23
  302. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Remove_JDBC_driver_should_be_performed_and_eventually_respond_with_success.json +0 -23
  303. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Remove_datasource_should_be_performed_and_eventually_respond_with_success.json +0 -23
  304. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Restart_can_be_run_multiple_times_in_parallel.json +0 -32
  305. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Restart_should_be_performed_and_eventually_respond_with_success.json +0 -23
  306. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Restart_should_not_be_performed_if_resource_path_is_wrong.json +0 -23
  307. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Undeploy_deployment_should_be_performed_and_eventually_respond_with_success.json +0 -23
  308. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Update_collection_intervals_should_be_performed_and_eventually_respond_with_success.json +0 -23
  309. data/spec/vcr_cassettes/Operation/NonSecure/Operation/should_not_be_possible_to_perform_on_closed_client.json +0 -12
  310. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_bail_with_hash_property_error_because_no_callback_at_all.json +0 -9
  311. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_bail_with_hash_property_error_because_no_error-callback_.json +0 -9
  312. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_bail_with_no_host.json +0 -3
  313. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_be_established.json +0 -9
  314. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_be_established_via_entrypoint.json +0 -9
  315. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_run_into_error_callback.json +0 -18
  316. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_run_into_error_callback_because_bad_hash_parameters.json +0 -13
  317. data/spec/vcr_cassettes/Operation/Secure/Helpers/Templates/get_feed.yml +0 -61
  318. data/spec/vcr_cassettes/Operation/Secure/Helpers/Templates/get_tenant.yml +0 -55
  319. data/spec/vcr_cassettes/Operation/Secure/Operation/Add_JDBC_driver_should_add_the_driver.json +0 -23
  320. data/spec/vcr_cassettes/Operation/Secure/Operation/Add_datasource_should_be_doable.json +0 -23
  321. data/spec/vcr_cassettes/Operation/Secure/Operation/Add_deployment_should_be_doable.json +0 -23
  322. data/spec/vcr_cassettes/Operation/Secure/Operation/Disable_should_be_performed_and_eventually_respond_with_success.json +0 -23
  323. data/spec/vcr_cassettes/Operation/Secure/Operation/Remove_JDBC_driver_should_be_performed_and_eventually_respond_with_success.json +0 -23
  324. data/spec/vcr_cassettes/Operation/Secure/Operation/Remove_datasource_should_be_performed_and_eventually_respond_with_success.json +0 -23
  325. data/spec/vcr_cassettes/Operation/Secure/Operation/Restart_can_be_run_multiple_times_in_parallel.json +0 -32
  326. data/spec/vcr_cassettes/Operation/Secure/Operation/Restart_should_be_performed_and_eventually_respond_with_success.json +0 -23
  327. data/spec/vcr_cassettes/Operation/Secure/Operation/Restart_should_not_be_performed_if_resource_path_is_wrong.json +0 -23
  328. data/spec/vcr_cassettes/Operation/Secure/Operation/Undeploy_deployment_should_be_performed_and_eventually_respond_with_success.json +0 -23
  329. data/spec/vcr_cassettes/Operation/Secure/Operation/should_not_be_possible_to_perform_on_closed_client.json +0 -12
  330. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_bail_with_hash_property_error_because_no_callback_at_all.json +0 -9
  331. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_bail_with_hash_property_error_because_no_error-callback_.json +0 -9
  332. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_bail_with_no_host.json +0 -3
  333. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_be_established.json +0 -9
  334. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_be_established_via_entrypoint.json +0 -9
  335. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_run_into_error_callback.json +0 -18
  336. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_run_into_error_callback_because_bad_hash_parameters.json +0 -13
  337. data/spec/vcr_cassettes/Tokens/Should_be_able_to_create_a_new_token_for_an_actual_user.yml +0 -57
  338. data/spec/vcr_cassettes/Tokens/Should_be_able_to_list_the_available_tokens.yml +0 -49
  339. data/spec/vcr_cassettes/Tokens/Should_get_a_401_when_attempting_to_create_a_token_with_a_wrong_password.yml +0 -56
  340. data/spec/vcr_cassettes/Tokens/Should_get_a_401_when_attempting_to_create_a_token_without_a_password.yml +0 -55
@@ -1,36 +0,0 @@
1
- require_relative '../spec_helper'
2
- require 'hawkular/logger'
3
-
4
- describe Hawkular::Logger do
5
- let(:file) { Tempfile.new('hawkular_spec') }
6
- subject(:logger) { described_class.new(file) }
7
-
8
- describe '#log' do
9
- before { allow(Hawkular::EnvConfig).to receive(:log_response?) { true } }
10
-
11
- it 'logs the message to a file' do
12
- logger.log('this is a message')
13
- file.flush
14
-
15
- expect(File.read(file)).to include 'this is a message'
16
- end
17
-
18
- it 'does not log anything if the config does not allow it' do
19
- allow(Hawkular::EnvConfig).to receive(:log_response?) { false }
20
-
21
- logger.log('this is a message')
22
- file.flush
23
-
24
- expect(File.read(file)).to be_empty
25
- end
26
-
27
- %w(debug info warn error fatal).each do |priority|
28
- it "allows to log with #{priority} priority" do
29
- logger.log('this is a message', priority)
30
- file.flush
31
-
32
- expect(File.read(file)).to include priority.upcase
33
- end
34
- end
35
- end
36
- end
@@ -1,953 +0,0 @@
1
- require_relative '../vcr/vcr_setup'
2
- require_relative '../spec_helper'
3
-
4
- require 'securerandom'
5
-
6
- SKIP_SECURE_CONTEXT = ENV['SKIP_SECURE_CONTEXT'] || '1'
7
- SKIP_SECURE_CONTEXT.freeze
8
-
9
- # examples related to Hawkular Metrics
10
-
11
- # time constants
12
- t4h = 4 * 60 * 60 * 1000
13
-
14
- # test contexts
15
- v8_context = :metrics_0_8_0
16
- services_context = :metrics_services
17
-
18
- # ssl contexts
19
- SECURE_CONTEXT = :Secure
20
- NON_SECURE_CONTEXT = :NonSecure
21
-
22
- security_contexts = [NON_SECURE_CONTEXT, SECURE_CONTEXT].freeze
23
- vcr_test_tenant_postfix = "-vcr-tenant-#{SecureRandom.uuid}".freeze
24
-
25
- security_contexts.each do |security_context|
26
- next if security_context == SECURE_CONTEXT && SKIP_SECURE_CONTEXT == '1'
27
-
28
- [v8_context, services_context].each do |metrics_context|
29
- if ENV['SKIP_V8_METRICS'] == '1' && metrics_context == v8_context
30
- puts 'skipping v8 metrics'
31
- next
32
- end
33
- if ENV['SKIP_SERVICES_METRICS'] == '1' && metrics_context == services_context
34
- puts 'skipping services metrics'
35
- next
36
- end
37
- # Secure context not supported for v8
38
- next if security_context == SECURE_CONTEXT && metrics_context == v8_context
39
-
40
- setup_options = {
41
- type: security_context
42
- }.freeze
43
-
44
- describe "#{metrics_context} #{security_context}" do
45
- vcr_test_tenant = "#{security_context}#{metrics_context}#{vcr_test_tenant_postfix}".freeze
46
-
47
- let(:cassette_name) do |example|
48
- if example.respond_to?(:example_group) && !example.example_group.description.start_with?(metrics_context.to_s)
49
- example.example_group.description + '/'
50
- else
51
- ''
52
- end + example.description
53
- end
54
-
55
- before(:all) do
56
- @admin_token = ENV['ADMIN_TOKEN'] || SecureRandom.uuid
57
- end
58
-
59
- let(:vcr_bindings) do
60
- { id: @random_id, vcr_test_tenant: vcr_test_tenant, admin_token: @admin_token }
61
- end
62
-
63
- around(:each) do |example|
64
- run_for = example.metadata[:run_for]
65
- if run_for.nil? || run_for.empty? || run_for.include?(metrics_context)
66
- @random_id = SecureRandom.uuid
67
- if example.metadata[:skip_auto_vcr]
68
- example.run
69
- else
70
- record("Metrics/#{security_context}/#{metrics_context}",
71
- vcr_bindings,
72
- cassette_name,
73
- example: example)
74
- end
75
- end
76
- end
77
-
78
- after(:all) do
79
- record_cleanup("Metrics/#{security_context}/#{metrics_context}")
80
- end
81
-
82
- describe 'Simple' do
83
- it 'Should be Cool' do
84
- url = metrics_context == v8_context ? entrypoint('v8', 'metrics') : entrypoint(security_context, 'metrics')
85
- Net::HTTP.get_response(URI(url))
86
- end
87
- end
88
-
89
- describe 'Tenants', run_for: [v8_context, services_context] do
90
- before(:all) do
91
- options = setup_options.merge admin_token: @admin_token
92
- record("Metrics/#{security_context}/#{metrics_context}",
93
- options,
94
- 'Tenants/setup_client') do
95
- if metrics_context == v8_context
96
- setup_v8_client
97
- else
98
- setup_client(options)
99
- end
100
- end
101
- end
102
-
103
- it 'Should create and return tenant' do
104
- tenant = @random_id
105
- @client.tenants.create(tenant)
106
- created = @client.tenants.query.select { |t| t.id == tenant }
107
- expect(created).not_to be nil
108
- end
109
- end
110
-
111
- describe 'No Tenant', run_for: [services_context] do
112
- it 'Should fail' do
113
- setup_client_without_tenant(setup_options)
114
- begin
115
- @client.counters.push_data(@random_id, value: 4)
116
- rescue # rubocop:disable Lint/HandleExceptions
117
- # This is good
118
- else
119
- fail 'The call should have failed due to missing tenant'
120
- end
121
- end
122
- end
123
-
124
- describe 'Mixed metrics', run_for: [v8_context, services_context] do
125
- before(:all) do
126
- options = setup_options.merge(tenant: vcr_test_tenant)
127
- record("Metrics/#{security_context}/#{metrics_context}",
128
- options,
129
- 'Mixed_metrics/setup_client') do
130
- if metrics_context == v8_context
131
- setup_v8_client tenant: vcr_test_tenant
132
- else
133
- setup_client(setup_options)
134
- end
135
- end
136
- end
137
-
138
- it 'Should requests raw data for multiple metrics', :skip_auto_vcr, run_for: [services_context] do
139
- id1 = SecureRandom.uuid
140
- id2 = SecureRandom.uuid
141
- id3 = SecureRandom.uuid
142
- id4 = SecureRandom.uuid
143
-
144
- ids = [id1, id2, id3]
145
- bindings = { id1: id1, id2: id2, id3: id3, id4: id4 }
146
- example = proc do
147
- @client = setup_client(setup_options.merge tenant: vcr_test_tenant)
148
-
149
- expect(@client.counters.raw_data(ids).size).to be 0
150
- expect(@client.gauges.raw_data(ids).size).to be 0
151
- expect(@client.avail.raw_data(ids).size).to be 0
152
-
153
- @client.push_data(
154
- counters: [
155
- { id: id1, data: [{ value: 1 }] },
156
- { id: id2, data: [{ value: 2 }] },
157
- { id: id3, data: [{ value: 3 }] }
158
- ],
159
- availabilities: [
160
- { id: id1, data: [{ value: 'up' }] },
161
- { id: id2, data: [{ value: 'down' }] },
162
- { id: id3, data: [{ value: 'up' }] },
163
- { id: id4, data: [{ value: 'up', timestamp: 10_000 },
164
- { value: 'down', timestamp: 100_000 },
165
- { value: 'admin', timestamp: 1_000_000 }] }
166
- ],
167
- gauges: [
168
- { id: id1, data: [{ value: 1.1 }] },
169
- { id: id2, data: [{ value: 2.2 }] },
170
- { id: id3, data: [{ value: 3.3 }] }
171
- ]
172
- )
173
-
174
- c_metrics = @client.counters.raw_data(ids)
175
- g_metrics = @client.gauges.raw_data(ids)
176
- a_metrics = @client.avail.raw_data(ids)
177
- # also check the get_data way of fetching avail data, with params
178
- a_metric = @client.avail.get_data(id4, starts: 100, ends: 2_000_000, distinct: 'true', order: 'ASC')
179
- expect(c_metrics.size).to be 3
180
- expect(c_metrics).to include(
181
- { 'id' => id1, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 1 }] },
182
- { 'id' => id2, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 2 }] },
183
- { 'id' => id3, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 3 }] }
184
- )
185
-
186
- expect(g_metrics.size).to be 3
187
- expect(g_metrics).to include(
188
- { 'id' => id1, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 1.1 }] },
189
- { 'id' => id2, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 2.2 }] },
190
- { 'id' => id3, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 3.3 }] }
191
- )
192
-
193
- expect(a_metrics.size).to be 3
194
- expect(a_metrics).to include(
195
- { 'id' => id1, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 'up' }] },
196
- { 'id' => id2, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 'down' }] },
197
- { 'id' => id3, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 'up' }] }
198
- )
199
-
200
- expect(a_metric.size).to be 3
201
- expect(a_metric).to include(
202
- { 'timestamp' => 10_000, 'value' => 'up' },
203
- { 'timestamp' => 100_000, 'value' => 'down' },
204
- { 'timestamp' => 1_000_000, 'value' => 'admin' }
205
- )
206
- end
207
- record("Metrics/#{security_context}/#{metrics_context}",
208
- vcr_bindings.merge(bindings),
209
- cassette_name,
210
- example: example)
211
- end
212
-
213
- it 'Should send mixed metric request of a single type' do
214
- @client.push_data(counters: [{ id: @random_id, data: [{ value: 1 }] }])
215
- data = @client.counters.get_data(@random_id)
216
- expect(data.size).to be 1
217
-
218
- @client.push_data(availabilities: [{ id: @random_id, data: [{ value: 'down' }] }])
219
- data = @client.avail.get_data(@random_id)
220
- expect(data.size).to be 1
221
-
222
- @client.push_data(gauges: [{ id: @random_id, data: [{ value: 1.1 }] }])
223
- data = @client.gauges.get_data(@random_id)
224
- expect(data.size).to be 1
225
- end
226
-
227
- it 'Should send mixed metric request' do
228
- expect(@client.counters.get_data(@random_id).size).to be 0
229
- expect(@client.gauges.get_data(@random_id).size).to be 0
230
- expect(@client.avail.get_data(@random_id).size).to be 0
231
-
232
- @client.push_data(
233
- counters: [{ id: @random_id, data: [{ value: 1 }] }],
234
- availabilities: [{ id: @random_id, data: [{ value: 'down' }] }],
235
- gauges: [{ id: @random_id, data: [{ value: 1.1 }] }]
236
- )
237
-
238
- expect(@client.counters.get_data(@random_id).size).to be 1
239
- expect(@client.gauges.get_data(@random_id).size).to be 1
240
- expect(@client.avail.get_data(@random_id).size).to be 1
241
- end
242
-
243
- it 'Should fetch stats for mixed metric', run_for: [services_context] do
244
- expect(@client.counters.get_data(@random_id).size).to be 0
245
- expect(@client.gauges.get_data(@random_id).size).to be 0
246
- expect(@client.avail.get_data(@random_id).size).to be 0
247
-
248
- @client.push_data(
249
- counters: [{ id: @random_id, data: [{ value: 1 }] }],
250
- availabilities: [{ id: @random_id, data: [{ value: 'down' }] }],
251
- gauges: [{ id: @random_id, data: [{ value: 1.1 }] }]
252
- )
253
-
254
- timestamps = []
255
- timestamps.push(@client.counters.get_data(@random_id).first['timestamp'])
256
- timestamps.push(@client.gauges.get_data(@random_id).first['timestamp'])
257
- timestamps.push(@client.avail.get_data(@random_id).first['timestamp'])
258
-
259
- stats = @client.query_stats(
260
- gauge_ids: [@random_id],
261
- counter_ids: [@random_id],
262
- avail_ids: [@random_id],
263
- starts: timestamps.min,
264
- ends: timestamps.max + 1,
265
- bucket_duration: "#{timestamps.max - timestamps.min + 1}ms"
266
- )
267
-
268
- expect(stats.size).to be 3
269
- expect(stats['gauge'][@random_id].first['avg']).to be 1.1
270
- expect(stats['counter'][@random_id].first['avg']).to be 1.0
271
- expect(stats['availability'][@random_id].first['downtimeCount']).to be 1
272
- end
273
-
274
- it 'Should fetch rate stats for mixed metric', run_for: [services_context] do
275
- expect(@client.counters.get_data(@random_id).size).to be 0
276
-
277
- @client.push_data(counters: [{ id: @random_id, data: [{ value: 100.0 }] }])
278
- @client.push_data(counters: [{ id: @random_id, data: [{ value: 110.0 }] }])
279
- @client.push_data(counters: [{ id: @random_id, data: [{ value: 130.0 }] }])
280
- @client.push_data(counters: [{ id: @random_id, data: [{ value: 200.0 }] }])
281
-
282
- data = @client.counters.get_data(@random_id)
283
- expect(data.size).to be 4
284
- timestamps = data.map { |d| d['timestamp'] }
285
-
286
- stats = @client.query_stats(
287
- counter_ids: [@random_id],
288
- starts: timestamps.min,
289
- ends: timestamps.max + 1,
290
- rates: true,
291
- bucket_duration: "#{timestamps.max - timestamps.min + 1}ms"
292
- )
293
-
294
- expect(stats.size).to be 2
295
- expect(stats['counter'][@random_id].size).to be 1
296
- expect(stats['counter_rate'][@random_id].size).to be 1
297
- end
298
- end
299
-
300
- describe 'Counter metrics' do
301
- before(:all) do
302
- @tenant = vcr_test_tenant
303
- options = setup_options.merge(tenant: @tenant)
304
- record("Metrics/#{security_context}/#{metrics_context}",
305
- options,
306
- 'Counter_metrics/setup_client') do
307
- if metrics_context == v8_context
308
- setup_v8_client tenant: @tenant
309
- else
310
- setup_client(setup_options.merge(tenant: @tenant))
311
- end
312
- end
313
- end
314
-
315
- it 'Should create and return counter using Hash parameter' do
316
- create_metric_using_hash @client.counters, @random_id, @tenant
317
- end
318
-
319
- it 'Should create counter definition using MetricDefinition parameter' do
320
- create_metric_using_md @client.counters, @random_id
321
- end
322
-
323
- it 'Should push metric data to existing counter', :skip_auto_vcr do
324
- now = @client.now
325
- minus10 = now - 10
326
- minus20 = now - 20
327
- minus30 = now - 30
328
- minus8h = now - (2 * t4h)
329
- minus4h = now - t4h
330
-
331
- bindings = { id: @random_id, minus10: minus10, minus20: minus20, minus30: minus30,
332
- minus8h: minus8h, minus4h: minus4h }
333
- example = proc do
334
- # create counter
335
- @client.counters.create(id: @random_id)
336
-
337
- # push 3 values with timestamps
338
- @client.counters.push_data(@random_id, [{ value: 1, timestamp: minus30 },
339
- { value: 2, timestamp: minus20 },
340
- { value: 3, timestamp: minus10 }])
341
-
342
- data = @client.counters.get_data(@random_id)
343
- expect(data.size).to be 3
344
-
345
- # push one value without timestamp (which means now)
346
- @client.counters.push_data(@random_id, value: 4)
347
- data = @client.counters.get_data(@random_id)
348
- expect(data.size).to be 4
349
-
350
- # retrieve values from past
351
- data = @client.counters.get_data(@random_id, starts: minus8h, ends: minus4h)
352
- expect(data.empty?).to be true
353
- end
354
- record("Metrics/#{security_context}/#{metrics_context}",
355
- vcr_bindings.merge(bindings),
356
- cassette_name,
357
- example: example)
358
- end
359
-
360
- # limit and order were introduced in 0.11.0 => skipping for 0.8.0
361
- it 'Should get metrics with limit and order', run_for: [services_context], skip_auto_vcr: true do
362
- now = @client.now
363
- minus10 = now - 10
364
- minus20 = now - 20
365
- minus30 = now - 30
366
- minus8h = now - (2 * t4h)
367
- minus4h = now - t4h
368
- bindings = { id: @random_id, minus10: minus10, minus20: minus20, minus30: minus30,
369
- minus8h: minus8h, minus4h: minus4h }
370
-
371
- example = proc do
372
- # create counter
373
- @client.counters.create(id: @random_id)
374
-
375
- # push 3 values with timestamps
376
- @client.counters.push_data(@random_id, [{ value: 1, timestamp: minus30 },
377
- { value: 2, timestamp: minus20 },
378
- { value: 3, timestamp: minus10 }])
379
-
380
- data = @client.counters.get_data(@random_id)
381
- expect(data.size).to be 3
382
-
383
- # push one value without timestamp (which means now)
384
- @client.counters.push_data(@random_id, value: 4)
385
- data = @client.counters.get_data(@random_id)
386
- expect(data.size).to be 4
387
-
388
- # retrieve values with limit
389
- data = @client.counters.get_data(@random_id, limit: 1, order: 'DESC')
390
- expect(data.size).to be 1
391
- expect(data.first['value']).to be 4
392
-
393
- # retrieve values from past
394
- data = @client.counters.get_data(@random_id, starts: minus8h, ends: minus4h)
395
- expect(data.empty?).to be true
396
- end
397
- record("Metrics/#{security_context}/#{metrics_context}",
398
- vcr_bindings.merge(bindings),
399
- cassette_name,
400
- example: example)
401
- end
402
-
403
- it 'Should get metrics as bucketed results', :skip_auto_vcr do
404
- now = @client.now
405
- minus5 = now - 5
406
- minus10 = now - 10
407
- minus20 = now - 20
408
- minus30 = now - 30
409
- minus40 = now - 40
410
- minus50 = now - 50
411
- minus60 = now - 60
412
- minus70 = now - 70
413
- minus80 = now - 80
414
- minus90 = now - 90
415
- minus100 = now - 100
416
- minus105 = now - 105
417
- minus110 = now - 110
418
- bindings = { id: @random_id, minus5: minus5, minus10: minus10, minus20: minus20, minus30: minus30,
419
- minus40: minus40, minus50: minus50, minus60: minus60, minus70: minus70, minus80: minus80,
420
- minus90: minus90, minus100: minus100, minus105: minus105, minus110: minus110 }
421
- example = proc do
422
- # create counter
423
- @client.counters.create(id: @random_id)
424
-
425
- # push 10 values with timestamps
426
- @client.counters.push_data(@random_id, [{ value: 110, timestamp: minus110 },
427
- { value: 100, timestamp: minus100 },
428
- { value: 90, timestamp: minus90 },
429
- { value: 80, timestamp: minus80 },
430
- { value: 70, timestamp: minus70 },
431
- { value: 60, timestamp: minus60 },
432
- { value: 50, timestamp: minus50 },
433
- { value: 40, timestamp: minus40 },
434
- { value: 30, timestamp: minus30 },
435
- { value: 20, timestamp: minus20 },
436
- { value: 10, timestamp: minus10 }])
437
- err = 0.001
438
- data = @client.counters.get_data(@random_id, starts: minus105, ends: minus5, buckets: 5)
439
- expect(data.size).to be 5
440
- expect(data.first['avg']).to be_within(err).of(95.0)
441
- expect(data.first['max']).to be_within(err).of(100.0)
442
- expect(data.first['samples']).to be 2
443
-
444
- data = @client.counters.get_data(@random_id, starts: minus105, ends: minus5, buckets: 2)
445
- expect(data.size).to be 2
446
- expect(data.first['avg']).to be_within(err).of(80.0)
447
- expect(data.first['samples']).to be 5
448
-
449
- data = @client.counters.get_data(@random_id, starts: minus105, ends: minus5, bucketDuration: '50ms')
450
- expect(data.size).to be 2
451
- expect(data.first['avg']).to be_within(err).of(80.0)
452
- end
453
- record("Metrics/#{security_context}/#{metrics_context}",
454
- vcr_bindings.merge(bindings),
455
- cassette_name,
456
- example: example)
457
- end
458
-
459
- it 'Should push metric data to non-existing counter' do
460
- push_data_to_non_existing_metric @client.counters, { value: 4 }, @random_id
461
- end
462
- end
463
-
464
- describe 'Availability metrics' do
465
- before(:all) do
466
- @tenant = vcr_test_tenant
467
- options = setup_options.merge(tenant: @tenant)
468
- record("Metrics/#{security_context}/#{metrics_context}",
469
- options,
470
- 'Availability_metrics/setup_client') do
471
- if metrics_context == v8_context
472
- setup_v8_client tenant: @tenant
473
- else
474
- setup_client(setup_options.merge(tenant: @tenant))
475
- end
476
- end
477
- end
478
-
479
- it 'Should create and return Availability using Hash parameter' do
480
- create_metric_using_hash @client.avail, @random_id, @tenant
481
- end
482
-
483
- it 'Should create Availability definition using MetricDefinition parameter' do
484
- create_metric_using_md @client.avail, @random_id
485
- end
486
-
487
- it 'Should push metric data to non-existing Availability' do
488
- push_data_to_non_existing_metric @client.avail, { value: 'UP' }, @random_id
489
- end
490
-
491
- it 'Should update tags for Availability definition' do
492
- update_metric_by_tags @client.avail, @random_id
493
- end
494
-
495
- it 'Should raise ArgumentError availability does not accept percentiles param' do
496
- expect { @client.avail.get_data(@random_id, percentiles: 50) }.to raise_error(ArgumentError)
497
- end
498
-
499
- it 'Should group contiguous values', :skip_auto_vcr, run_for: [services_context] do
500
- now = @client.now
501
- minus10 = now - 10
502
- minus20 = now - 20
503
- minus30 = now - 30
504
- minus40 = now - 40
505
- minus50 = now - 50
506
- bindings = { id: @random_id, minus10: minus10, minus20: minus20, minus30: minus30, minus40: minus40,
507
- minus50: minus50, now: now }
508
- example = proc do
509
- @client = setup_client(setup_options.merge tenant: vcr_test_tenant)
510
- @client.avail.push_data(@random_id, [
511
- { timestamp: minus50, value: 'up' },
512
- { timestamp: minus40, value: 'up' },
513
- { timestamp: minus30, value: 'down' },
514
- { timestamp: minus20, value: 'down' },
515
- { timestamp: minus10, value: 'down' },
516
- { timestamp: now, value: 'up' }
517
- ])
518
- result = @client.avail.get_data(@random_id, distinct: true, order: 'ASC')
519
- expect(result).to eq([
520
- { 'timestamp' => minus50, 'value' => 'up' },
521
- { 'timestamp' => minus30, 'value' => 'down' },
522
- { 'timestamp' => now, 'value' => 'up' }
523
- ])
524
- end
525
- record("Metrics/#{security_context}/#{metrics_context}",
526
- vcr_bindings.merge(bindings),
527
- cassette_name,
528
- example: example)
529
- end
530
- end
531
-
532
- describe 'Gauge metrics' do
533
- hawkular_tenant_id = 'hawkular'.freeze
534
-
535
- let(:inventory_client) do
536
- inventory_entrypoint = entrypoint(security_context, 'inventory')
537
- setup_inventory_client(inventory_entrypoint, tenant: hawkular_tenant_id)
538
- end
539
-
540
- let(:hawkular_feed_id) do
541
- inventory_client.list_feeds.first
542
- end
543
-
544
- let(:hawkular_mem_id) do
545
- "MI~R~[#{hawkular_feed_id}/platform~/OPERATING_SYSTEM=#{hawkular_feed_id}"\
546
- '_OperatingSystem/MEMORY=Memory]~MT~Platform_Memory_Total Memory'
547
- end
548
-
549
- before(:all) do
550
- @tenant = vcr_test_tenant
551
- record("Metrics/#{security_context}/#{metrics_context}",
552
- setup_options.merge(tenant: @tenant),
553
- 'Gauge_metrics/setup_client') do
554
- if metrics_context == v8_context
555
- setup_v8_client tenant: @tenant
556
- else
557
- setup_client(setup_options.merge(tenant: @tenant))
558
- end
559
- end
560
- end
561
-
562
- it 'Should create gauge definition using MetricDefinition' do
563
- create_metric_using_md @client.gauges, @random_id
564
- end
565
-
566
- it 'Should create gauge definition using Hash' do
567
- create_metric_using_hash @client.gauges, @random_id, @tenant
568
- end
569
-
570
- it 'Should push metric data to non-existing gauge' do
571
- push_data_to_non_existing_metric @client.gauges, { value: 3.1415926 }, @random_id
572
- end
573
-
574
- # let's do the recording manually
575
- it 'Should push metric data to existing gauge', :skip_auto_vcr do
576
- now = @client.now
577
- ends = now - t4h
578
- starts = now - (2 * t4h)
579
- now10 = now - 10
580
- now20 = now - 20
581
- now30 = now - 30
582
- bindings = { id: @random_id, ends: ends, starts: starts, now10: now10, now20: now20, now30: now30 }
583
- example = proc do
584
- # create gauge
585
- @client.gauges.create(id: @random_id)
586
-
587
- # push 3 values with timestamps
588
- @client.gauges.push_data(@random_id,
589
- [{ value: 1, timestamp: now30 },
590
- { value: 2, timestamp: now20 },
591
- { value: 3, timestamp: now10 }])
592
-
593
- data = @client.gauges.get_data(@random_id)
594
- expect(data.size).to be 3
595
-
596
- # push one value without timestamp (which means now)
597
- @client.gauges.push_data(@random_id, value: 4)
598
- data = @client.gauges.get_data(@random_id)
599
- expect(data.size).to be 4
600
-
601
- # retrieve values from past
602
- data = @client.counters.get_data(@random_id, starts: starts, ends: ends)
603
- expect(data.empty?).to be true
604
- end
605
- record("Metrics/#{security_context}/#{metrics_context}",
606
- vcr_bindings.merge(bindings),
607
- cassette_name,
608
- example: example)
609
- end
610
-
611
- it 'Should update tags for gauge definition' do
612
- update_metric_by_tags @client.gauges, @random_id
613
- end
614
-
615
- it 'Should return periods', :skip_auto_vcr do
616
- now = @client.now
617
- before4h = now - t4h
618
- minus20 = now - 20
619
- minus30 = now - 30
620
- bindings = { start: now, before4h: before4h, minus20: minus20, minus30: minus30 }
621
- example = proc do
622
- # push 3 values with timestamps
623
- @client.gauges.push_data(@random_id, [{ value: 1, timestamp: minus30 },
624
- { value: 2, timestamp: minus20 },
625
- { value: 3, timestamp: now }])
626
-
627
- data = @client.gauges.get_periods(@random_id, operation: 'lte', threshold: 4, starts: before4h)
628
- expect(data.size).to be 1
629
- expect(data[0][0]).to eql(now - 30)
630
- expect(data[0][1]).to eql(now)
631
- end
632
- record("Metrics/#{security_context}/#{metrics_context}",
633
- vcr_bindings.merge(bindings),
634
- cassette_name,
635
- example: example)
636
- end
637
-
638
- it 'Should return platform memory def', :skip_auto_vcr, run_for: [services_context] do
639
- bindings = { tenant: hawkular_tenant_id }
640
- example = proc do
641
- if metrics_context == v8_context
642
- setup_v8_client tenant: hawkular_tenant_id
643
- else
644
- setup_client(setup_options.merge tenant: hawkular_tenant_id)
645
- end
646
-
647
- data = @client.gauges.get(hawkular_mem_id)
648
-
649
- expect(data).not_to be_nil
650
- expect(data.id).not_to be_nil
651
- expect(data.tenant_id).to eq(hawkular_tenant_id)
652
- end
653
- record("Metrics/#{security_context}/#{metrics_context}",
654
- vcr_bindings.merge(bindings),
655
- cassette_name,
656
- example: example)
657
- end
658
-
659
- it 'Should return platform memory', :skip_auto_vcr, run_for: [services_context] do
660
- bindings = { tenant: hawkular_tenant_id }
661
- example = proc do
662
- # this id depends on OS and the feed id
663
- if metrics_context == v8_context
664
- setup_v8_client tenant: tenant_id
665
- else
666
- setup_client(setup_options.merge tenant: hawkular_tenant_id)
667
- end
668
-
669
- data = @client.gauges.get_data(hawkular_mem_id)
670
- expect(data.size).to be > 2 # needs the services to be running for more than 2 minutes
671
- end
672
- record("Metrics/#{security_context}/#{metrics_context}",
673
- vcr_bindings.merge(bindings),
674
- cassette_name,
675
- example: example)
676
- end
677
- end
678
-
679
- describe 'Status' do
680
- it 'Should return the version' do
681
- if metrics_context == v8_context
682
- setup_v8_client
683
- else
684
- setup_client setup_options
685
- end
686
- data = @client.fetch_version_and_status
687
- expect(data).not_to be_nil
688
- end
689
- end
690
-
691
- describe 'String metrics', run_for: [services_context] do
692
- before(:each) do
693
- @tenant = vcr_test_tenant
694
- options = setup_options.merge(tenant: @tenant)
695
- record("Metrics/#{security_context}/#{metrics_context}",
696
- options,
697
- 'String_metrics/setup_client') do
698
- setup_client(options)
699
- end
700
- end
701
-
702
- it 'Should create string definition using MetricDefinition' do
703
- create_metric_using_md @client.strings, @random_id
704
- end
705
-
706
- it 'Should create string definition using Hash' do
707
- create_metric_using_hash @client.strings, @random_id, @tenant
708
- end
709
-
710
- it 'Should push metric data to non-existing string' do
711
- push_data_to_non_existing_metric @client.strings, { value: 'Hello world' }, @random_id
712
- end
713
-
714
- it 'Should push metric data to existing string', :skip_auto_vcr do
715
- now = @client.now
716
- ends = now - t4h
717
- starts = now - (2 * t4h)
718
- now10 = now - 10
719
- now20 = now - 20
720
- now30 = now - 30
721
- bindings = { id: @random_id, ends: ends, starts: starts, now10: now10, now20: now20, now30: now30 }
722
- example = proc do
723
- # create gauge
724
- @client.strings.create(id: @random_id)
725
-
726
- # push 3 values with timestamps
727
- @client.strings.push_data(@random_id,
728
- [
729
- { value: 'Value1', timestamp: now30 },
730
- { value: 'Value2', timestamp: now20 },
731
- { value: 'Value3', timestamp: now10 }
732
- ])
733
-
734
- data = @client.strings.get_data(@random_id)
735
- expect(data.size).to be 3
736
-
737
- # push one value without timestamp (which means now)
738
- @client.strings.push_data(@random_id, value: 'Now')
739
- data = @client.strings.get_data(@random_id)
740
- expect(data.size).to be 4
741
-
742
- # retrieve values from past
743
- data = @client.strings.get_data(@random_id, starts: starts, ends: ends)
744
- expect(data.empty?).to be true
745
- end
746
- record("Metrics/#{security_context}/#{metrics_context}",
747
- vcr_bindings.merge(bindings),
748
- cassette_name,
749
- example: example)
750
- end
751
- end
752
-
753
- describe 'All Tags for metrics', run_for: [services_context] do
754
- before(:each) do
755
- @tenant = SecureRandom.uuid
756
- options = setup_options.merge(tenant: @tenant)
757
- record("Metrics/#{security_context}/#{metrics_context}",
758
- options,
759
- 'Tags_Metrics/setup_client') do
760
- setup_client(options)
761
- end
762
- end
763
-
764
- it 'Should fetch all metrics with some tags', :skip_auto_vcr do
765
- id1 = SecureRandom.uuid
766
- id2 = SecureRandom.uuid
767
- id3 = SecureRandom.uuid
768
- id4 = SecureRandom.uuid
769
-
770
- bindings = { id1: id1, id2: id2, id3: id3, id4: id4 }
771
- tag = { miq_metric: true }
772
- example = proc do
773
- create_metric_using_md @client.gauges, id1, tag
774
- create_metric_using_md @client.gauges, id2, tag
775
- create_metric_using_md @client.gauges, id3, tag
776
- create_metric_using_md @client.gauges, id4, tag
777
-
778
- create_metric_using_md @client.avail, id1, tag
779
- create_metric_using_md @client.avail, id2, tag
780
- create_metric_using_md @client.avail, id3, tag
781
- create_metric_using_md @client.avail, id4, tag
782
-
783
- create_metric_using_md @client.counters, id1, tag
784
- create_metric_using_md @client.counters, id2, tag
785
- create_metric_using_md @client.counters, id3, tag
786
- create_metric_using_md @client.counters, id4, tag
787
-
788
- @client.push_data(
789
- counters: [
790
- { id: id1, data: [{ value: 1 }] },
791
- { id: id2, data: [{ value: 2 }] },
792
- { id: id3, data: [{ value: 3 }] }
793
- ],
794
- availabilities: [
795
- { id: id1, data: [{ value: 'up' }] },
796
- { id: id2, data: [{ value: 'down' }] },
797
- { id: id3, data: [{ value: 'up' }] },
798
- { id: id4, data: [{ value: 'up', timestamp: 10_000 },
799
- { value: 'down', timestamp: 100_000 },
800
- { value: 'admin', timestamp: 1_000_000 }] }
801
- ],
802
- gauges: [
803
- { id: id1, data: [{ value: 1.1 }] },
804
- { id: id2, data: [{ value: 2.2 }] },
805
- { id: id3, data: [{ value: 3.3 }] }
806
- ]
807
- )
808
- data = @client.data_by_tags(tag, buckets: 1)
809
-
810
- expect(data.size).to eql(3)
811
- expect(data['gauge'].size).to eql(4)
812
- expect(data['availability'].size).to eql(4)
813
- expect(data['counter'].size).to eql(4)
814
- end
815
-
816
- record("Metrics/#{security_context}/#{metrics_context}",
817
- vcr_bindings.merge(bindings),
818
- cassette_name,
819
- example: example)
820
- end
821
-
822
- it 'Should fetch all metric tags for metrics definitions' do
823
- tags_m1 = {
824
- tag1: 'value1',
825
- tag2: 'value2',
826
- tag3: 'value3'
827
- }
828
-
829
- tags_m2 = {
830
- tag1: 'value1',
831
- tag4: 'value4',
832
- tag5: 'value5'
833
- }
834
-
835
- tags_m3 = {
836
- tag1: 'value1',
837
- tag4: 'value4',
838
- tag5: 'value5.1'
839
- }
840
-
841
- create_metric_using_md @client.gauges, 'metric_1', tags_m1
842
- create_metric_using_md @client.avail, 'metric_2', tags_m2
843
- create_metric_using_md @client.counters, 'metric_2', tags_m3
844
- create_metric_using_md @client.counters, 'metric_3', {}
845
-
846
- expected_result = [
847
- { 'tag1' => 'value1' },
848
- { 'tag2' => 'value2' },
849
- { 'tag3' => 'value3' },
850
- { 'tag4' => 'value4' },
851
- { 'tag5' => 'value5' },
852
- { 'tag5' => 'value5.1' }
853
- ]
854
- expect(@client.tags.to_set).to eql(expected_result.to_set)
855
- end
856
- end
857
- end
858
- end
859
-
860
- vcr_test_tenant = "#{security_context}#{vcr_test_tenant_postfix}".freeze
861
-
862
- context security_context do
863
- describe 'Metric ID with special characters' do
864
- before(:all) do
865
- record("Metrics/#{security_context}/ID_with_special_characters",
866
- { tenant: vcr_test_tenant },
867
- 'setup_client') do
868
- setup_client(type: security_context, tenant: vcr_test_tenant)
869
- end
870
- end
871
-
872
- around(:each) do |example|
873
- record("Metrics/#{security_context}/ID_with_special_characters",
874
- { vcr_test_tenant: vcr_test_tenant },
875
- example.description,
876
- example: example)
877
- end
878
-
879
- after(:all) do
880
- record_cleanup("Metrics/#{security_context}/ID_with_special_characters")
881
- end
882
-
883
- id_gauge = 'MI~R~[8b*}{\'\\14#?/5-7%92e[-c9_.r1//;/74eddf/L=c~~]~MT~ * /'\
884
- ' Met@ics~Aggre&? ated s Active" Ses;ns'
885
- id_avail = 'AA~R~[8b*}{\'\\14#?/5-7%92[d-c9_.r1///7;:4eddf/L=c~~]~MT~ A * %-Met@ics~Aggre&?ated " Sess{ons'
886
- id_counter = 'AA~R~[8b*}{\'\\14#?/5-7%92[d-c9_.r1///7;:4eddf/L=c~~]~MT~ %-Met@ics~Aggre&?ated " Sess{ons'
887
-
888
- it 'Should create gauge definition' do
889
- create_metric_using_md @client.gauges, id_gauge
890
- end
891
-
892
- it 'Should create Availability definition' do
893
- create_metric_using_md @client.avail, id_avail
894
- end
895
-
896
- it 'Should create Counter definition' do
897
- create_metric_using_md @client.counters, id_counter
898
- end
899
-
900
- it 'Should push metric data to existing gauge' do
901
- @client.gauges.push_data(id_gauge, [
902
- { value: 0.1, tags: { tagName: 'myMin' } },
903
- { value: 99.9, tags: { tagName: 'myMax' } }
904
- ])
905
- end
906
-
907
- it 'Should update tags for gauge definition' do
908
- deff = @client.gauges.get(id_gauge)
909
- deff.tags = {
910
- name1: 'value1',
911
- name2: 'value2',
912
- name3: 'value3'
913
- }
914
- @client.gauges.update_tags(deff)
915
- deff_updated = @client.gauges.get(id_gauge)
916
- expected_result = {
917
- 'name1' => 'value1',
918
- 'name2' => 'value2',
919
- 'name3' => 'value3',
920
- 'tag' => 'value'
921
- }
922
- expect(deff_updated.tags).to eq(expected_result)
923
- end
924
-
925
- it 'Should update tags for Availability definition' do
926
- deff_avail = @client.avail.get(id_avail)
927
- deff_avail.tags = {
928
- name1: 'value1',
929
- name2: 'value2',
930
- name3: 'value3'
931
- }
932
- @client.avail.update_tags(deff_avail)
933
- deff_avail_updated = @client.avail.get(id_avail)
934
- expected_result = {
935
- 'name1' => 'value1',
936
- 'name2' => 'value2',
937
- 'name3' => 'value3',
938
- 'tag' => 'value'
939
- }
940
- expect(deff_avail_updated.tags).to eq(expected_result)
941
- end
942
-
943
- it 'Get metric definition by id' do
944
- @client.gauges.get(id_gauge)
945
- end
946
-
947
- it 'Retrieve metric rate points' do
948
- @client.gauges.get(id_gauge)
949
- @client.counters.get_rate id_counter
950
- end
951
- end
952
- end
953
- end