hawkular-client 2.2.1 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.rdoc +12 -0
  3. data/README.rdoc +5 -3
  4. data/Rakefile +8 -0
  5. data/hawkularclient.gemspec +1 -1
  6. data/lib/hawkular/base_client.rb +19 -1
  7. data/lib/hawkular/hawkular_client.rb +1 -1
  8. data/lib/hawkular/hawkular_client_utils.rb +1 -0
  9. data/lib/hawkular/inventory/entities.rb +234 -0
  10. data/lib/hawkular/inventory/inventory_api.rb +92 -311
  11. data/lib/hawkular/metrics/metric_api.rb +23 -10
  12. data/lib/hawkular/metrics/metrics_client.rb +14 -0
  13. data/lib/hawkular/operations/operations_api.rb +8 -2
  14. data/lib/hawkular/version.rb +1 -1
  15. data/spec/README.rdoc +62 -0
  16. data/spec/integration/alerts_spec.rb +18 -14
  17. data/spec/integration/hawkular_client_spec.rb +53 -14
  18. data/spec/integration/inventory_spec.rb +91 -44
  19. data/spec/integration/metric_spec.rb +574 -420
  20. data/spec/integration/operations_spec.rb +78 -5
  21. data/spec/integration/tokens_spec.rb +8 -4
  22. data/spec/spec_helper.rb +73 -13
  23. data/spec/unit/base_spec.rb +30 -1
  24. data/spec/unit/client_spec.rb +21 -9
  25. data/spec/vcr_cassettes/HawkularClient/Should_err_on_bad_credentials.yml +42 -0
  26. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_both_create_and_delete_feed.yml +64 -34
  27. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_both_list_WildFlys.yml +27 -43
  28. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_both_list_types_with_bad_feed.yml +12 -8
  29. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_list_same_types_when_param_is_given.yml +144 -64
  30. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_list_the_same_feeds.yml +26 -14
  31. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_list_the_same_resource_types.yml +20 -158
  32. data/spec/vcr_cassettes/HawkularClient/and_Operations_client/Should_both_work_the_same_way.yml +40 -30
  33. data/spec/vcr_cassettes/{Tenants/Should_Get_Tenant_For_Explicit_Credentials.yml → HawkularClient/and_Operations_client/Should_work_initializing_with_URI.yml} +18 -20
  34. data/spec/vcr_cassettes/HawkularClient/and_Operations_client_Should_both_work_the_same_way.json +8 -8
  35. data/spec/vcr_cassettes/HawkularClient/and_Operations_client_Should_work_initializing_with_URI.json +9 -0
  36. data/spec/vcr_cassettes/HawkularClient/and_URIs_as_input/Should_work_with_URI.yml +77 -20
  37. data/spec/vcr_cassettes/HawkularClient/and_URIs_as_input/Should_work_with_URI_on_metrics_client.yml +3 -3
  38. data/spec/vcr_cassettes/Inventory/Connection/Should_err_on_bad_credentials.yml +42 -0
  39. data/spec/vcr_cassettes/Inventory/Tenants/Should_Get_Tenant_For_Explicit_Credentials.yml +59 -12
  40. data/spec/vcr_cassettes/Inventory/Tenants/Should_Get_Tenant_For_Implicit_Credentials.yml +59 -12
  41. data/spec/vcr_cassettes/Inventory/{Helpers → inventory_0_17/Helpers}/create_url.yml +9 -7
  42. data/spec/vcr_cassettes/Inventory/{Templates/Should_list_feeds_when_using_SSL_without_certificate.yml → inventory_0_17/Helpers/get_feeds.yml} +23 -21
  43. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Client_should_listen_on_various_inventory_events.json +47 -0
  44. data/spec/vcr_cassettes/Inventory/{Templates → inventory_0_17/Templates}/Client_should_listen_on_various_inventory_events.yml +48 -40
  45. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Helpers/generate_some_events_for_websocket.yml +397 -0
  46. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_List_datasources_with_no_props.yml +129 -0
  47. data/spec/vcr_cassettes/Inventory/{Templates → inventory_0_17/Templates}/Should_create_a_feed.yml +13 -10
  48. data/spec/vcr_cassettes/Inventory/{Templates → inventory_0_17/Templates}/Should_create_a_feed_again.yml +40 -29
  49. data/spec/vcr_cassettes/Inventory/{Templates → inventory_0_17/Templates}/Should_create_a_nested_resource_and_metric_on_it.yml +193 -237
  50. data/spec/vcr_cassettes/Inventory/{Templates/Should_create_and_get_a_resource.yml → inventory_0_17/Templates/Should_create_a_resource.yml} +86 -172
  51. data/spec/vcr_cassettes/Inventory/{Templates → inventory_0_17/Templates}/Should_create_a_resource_with_metric.yml +296 -158
  52. data/spec/vcr_cassettes/Inventory/{Templates → inventory_0_17/Templates}/Should_create_a_resourcetype.yml +38 -29
  53. data/spec/vcr_cassettes/Inventory/{Templates → inventory_0_17/Templates}/Should_create_and_delete_feed.yml +42 -27
  54. data/spec/vcr_cassettes/Inventory/{Templates/Should_create_a_resource.yml → inventory_0_17/Templates/Should_create_and_get_a_resource.yml} +109 -89
  55. data/spec/vcr_cassettes/Inventory/{Templates → inventory_0_17/Templates}/Should_list_URLs.yml +20 -17
  56. data/spec/vcr_cassettes/Inventory/{Templates → inventory_0_17/Templates}/Should_list_WildFlys.yml +19 -12
  57. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_list_WildFlys_with_props.yml +131 -0
  58. data/spec/vcr_cassettes/Inventory/{Helpers/get_feeds.yml → inventory_0_17/Templates/Should_list_all_the_resource_types.yml} +14 -11
  59. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_list_children_of_WildFly.yml +315 -0
  60. data/spec/vcr_cassettes/Inventory/{Templates → inventory_0_17/Templates}/Should_list_children_of_nested_resource.yml +45 -30
  61. data/spec/vcr_cassettes/Inventory/{Templates → inventory_0_17/Templates}/Should_list_feeds.yml +16 -10
  62. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_list_feeds_when_using_SSL_without_certificate.yml +60 -0
  63. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_list_heap_metrics_for_WildFlys.yml +935 -0
  64. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_list_metrics_for_WildFlys.yml +357 -0
  65. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_list_metrics_of_given_metric_type.yml +122 -0
  66. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_list_metrics_of_given_resource_type.yml +292 -0
  67. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource.yml +235 -0
  68. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource_type.yml +121 -0
  69. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_list_recursive_children_of_WildFly.yml +1099 -0
  70. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_list_relationships_of_WildFly.yml +377 -0
  71. data/spec/vcr_cassettes/Inventory/{Templates → inventory_0_17/Templates}/Should_list_resources_for_feed.yml +19 -9
  72. data/spec/vcr_cassettes/Inventory/{Templates → inventory_0_17/Templates}/Should_list_types_with_bad_feed.yml +10 -8
  73. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_list_types_with_feed.yml +164 -0
  74. data/spec/vcr_cassettes/Inventory/{Templates → inventory_0_17/Templates}/Should_not_find_an_unknown_resource.yml +12 -10
  75. data/spec/vcr_cassettes/Inventory/{Templates → inventory_0_17/Templates}/Should_return_config_data_of_given_nested_resource.yml +17 -11
  76. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_return_config_data_of_given_resource.yml +66 -0
  77. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_return_the_version.yml +48 -0
  78. data/spec/vcr_cassettes/Metric_ID_with_special_characters/Get_metric_definition_by_id.yml +49 -0
  79. data/spec/vcr_cassettes/Metric_ID_with_special_characters/Retrieve_metric_rate_points.yml +88 -0
  80. data/spec/vcr_cassettes/Metric_ID_with_special_characters/Should_create_Availability_definition.yml +97 -0
  81. data/spec/vcr_cassettes/Metric_ID_with_special_characters/Should_create_Counter_definition.yml +97 -0
  82. data/spec/vcr_cassettes/Metric_ID_with_special_characters/Should_create_gauge_definition.yml +97 -0
  83. data/spec/vcr_cassettes/Metric_ID_with_special_characters/Should_push_metric_data_to_existing_gauge.yml +48 -0
  84. data/spec/vcr_cassettes/Metric_ID_with_special_characters/Should_update_tags_for_Availability_definition.yml +140 -0
  85. data/spec/vcr_cassettes/Metric_ID_with_special_characters/Should_update_tags_for_gauge_definition.yml +140 -0
  86. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +95 -0
  87. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +95 -0
  88. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Availability_metrics/Should_group_contiguous_values.yml +93 -0
  89. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +138 -0
  90. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +230 -0
  91. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +95 -0
  92. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +95 -0
  93. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +230 -0
  94. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +314 -0
  95. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +269 -0
  96. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +138 -0
  97. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +95 -0
  98. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +95 -0
  99. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +269 -0
  100. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +138 -0
  101. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Gauge_metrics/Should_return_periods.yml +93 -0
  102. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +230 -0
  103. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +330 -0
  104. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +300 -0
  105. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +273 -0
  106. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/No_Tenant/Should_fail.yml +48 -0
  107. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Simple/Should_be_Cool.yml +48 -0
  108. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Status/Should_return_the_version.yml +42 -0
  109. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Tenants/Should_create_and_return_tenant.yml +95 -0
  110. data/spec/vcr_cassettes/{Availability_metrics → Metrics/metrics_0_8_0/Templates/Availability_metrics}/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +5 -9
  111. data/spec/vcr_cassettes/{Availability_metrics → Metrics/metrics_0_8_0/Templates/Availability_metrics}/Should_create_and_return_Availability_using_Hash_parameter.yml +5 -9
  112. data/spec/vcr_cassettes/{Availability_metrics → Metrics/metrics_0_8_0/Templates/Availability_metrics}/Should_push_metric_data_to_non-existing_Availability.yml +9 -15
  113. data/spec/vcr_cassettes/{Availability_metrics → Metrics/metrics_0_8_0/Templates/Availability_metrics}/Should_update_tags_for_Availability_definition.yml +11 -21
  114. data/spec/vcr_cassettes/{Counter_metrics → Metrics/metrics_0_8_0/Templates/Counter_metrics}/Should_create_and_return_counter_using_Hash_parameter.yml +5 -9
  115. data/spec/vcr_cassettes/{Counter_metrics → Metrics/metrics_0_8_0/Templates/Counter_metrics}/Should_create_counter_definition_using_MetricDefinition_parameter.yml +5 -9
  116. data/spec/vcr_cassettes/Metrics/metrics_0_8_0/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +200 -0
  117. data/spec/vcr_cassettes/{Counter_metrics → Metrics/metrics_0_8_0/Templates/Counter_metrics}/Should_push_metric_data_to_existing_counter.yml +16 -28
  118. data/spec/vcr_cassettes/{Counter_metrics → Metrics/metrics_0_8_0/Templates/Counter_metrics}/Should_push_metric_data_to_non-existing_counter.yml +9 -15
  119. data/spec/vcr_cassettes/{Gauge_metrics → Metrics/metrics_0_8_0/Templates/Gauge_metrics}/Should_create_gauge_definition_using_Hash.yml +5 -9
  120. data/spec/vcr_cassettes/{Gauge_metrics → Metrics/metrics_0_8_0/Templates/Gauge_metrics}/Should_create_gauge_definition_using_MetricDefinition.yml +6 -10
  121. data/spec/vcr_cassettes/{Gauge_metrics → Metrics/metrics_0_8_0/Templates/Gauge_metrics}/Should_push_metric_data_to_existing_gauge.yml +18 -30
  122. data/spec/vcr_cassettes/{Gauge_metrics → Metrics/metrics_0_8_0/Templates/Gauge_metrics}/Should_push_metric_data_to_non-existing_gauge.yml +9 -15
  123. data/spec/vcr_cassettes/{Gauge_metrics → Metrics/metrics_0_8_0/Templates/Gauge_metrics}/Should_return_periods.yml +6 -10
  124. data/spec/vcr_cassettes/{Gauge_metrics → Metrics/metrics_0_8_0/Templates/Gauge_metrics}/Should_update_tags_for_gauge_definition.yml +11 -21
  125. data/spec/vcr_cassettes/{Mixed_metrics → Metrics/metrics_0_8_0/Templates/Mixed_metrics}/Should_send_mixed_metric_request.yml +19 -33
  126. data/spec/vcr_cassettes/{Mixed_metrics → Metrics/metrics_0_8_0/Templates/Mixed_metrics}/Should_send_mixed_metric_request_of_a_single_type.yml +19 -31
  127. data/spec/vcr_cassettes/Metrics/metrics_0_8_0/Templates/Simple/Should_be_Cool.yml +82 -0
  128. data/spec/vcr_cassettes/Metrics/{Status.yml → metrics_0_8_0/Templates/Status/Should_return_the_version.yml} +6 -8
  129. data/spec/vcr_cassettes/{Tenants → Metrics/metrics_0_8_0/Templates/Tenants}/Should_create_and_return_tenant.yml +12 -8
  130. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +95 -0
  131. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +95 -0
  132. data/spec/vcr_cassettes/{Availability_metrics → Metrics/metrics_services/Templates/Availability_metrics}/Should_group_contiguous_values.yml +7 -7
  133. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +138 -0
  134. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +230 -0
  135. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +95 -0
  136. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +95 -0
  137. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +230 -0
  138. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +314 -0
  139. data/spec/vcr_cassettes/{Counter_metrics/Should_get_metrics_with_limit_and_order.yml → Metrics/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml} +72 -61
  140. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +138 -0
  141. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +95 -0
  142. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +95 -0
  143. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +269 -0
  144. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +138 -0
  145. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Gauge_metrics/Should_return_periods.yml +93 -0
  146. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory.yml +48 -0
  147. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory_def.yml +49 -0
  148. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +230 -0
  149. data/spec/vcr_cassettes/{Mixed_metrics → Metrics/metrics_services/Templates/Mixed_metrics}/Should_requests_raw_data_for_multiple_metrics.yml +25 -25
  150. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +300 -0
  151. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +273 -0
  152. data/spec/vcr_cassettes/{No_Tenant → Metrics/metrics_services/Templates/No_Tenant}/Should_fail.yml +16 -10
  153. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Simple/Should_be_Cool.yml +48 -0
  154. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Status/Should_return_the_version.yml +42 -0
  155. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Tenants/Should_create_and_return_tenant.yml +95 -0
  156. data/spec/vcr_cassettes/{Counter_metrics → New_API_Counter_metrics}/Should_get_metrics_as_bucketed_results.yml +73 -33
  157. data/spec/vcr_cassettes/New_API_Mixed_metrics/Should_send_mixed_metric_request.yml +300 -0
  158. data/spec/vcr_cassettes/Operation/Helpers/get_feed.yml +17 -11
  159. data/spec/vcr_cassettes/Operation/Helpers/get_tenant.yml +13 -11
  160. data/spec/vcr_cassettes/Operation/Operation/Add_JDBC_driver_should_add_the_driver.json +2 -2
  161. data/spec/vcr_cassettes/Operation/Operation/Add_datasource_should_be_doable.json +2 -2
  162. data/spec/vcr_cassettes/Operation/Operation/Add_deployment_should_be_doable.json +2 -2
  163. data/spec/vcr_cassettes/Operation/Operation/Redeploy_can_be_run_multiple_times_in_parallel.json +4 -4
  164. data/spec/vcr_cassettes/Operation/Operation/Redeploy_should_be_performed_and_eventually_respond_with_success.json +2 -2
  165. data/spec/vcr_cassettes/Operation/Operation/Redeploy_should_not_be_performed_if_resource_path_is_wrong.json +2 -2
  166. data/spec/vcr_cassettes/Operation/Operation/Remove_JDBC_driver_should_be_performed_and_eventually_respond_with_success.json +2 -2
  167. data/spec/vcr_cassettes/Operation/Operation/Remove_datasource_should_be_performed_and_eventually_respond_with_success.json +2 -2
  168. data/spec/vcr_cassettes/Operation/Operation/Remove_deployment_should_be_performed_and_eventually_respond_with_success.json +2 -2
  169. data/spec/vcr_cassettes/Operation/Operation/Undeploy_should_be_performed_and_eventually_respond_with_success.json +2 -2
  170. data/spec/vcr_cassettes/Operation/Websocket_connection/should_bail_with_hash_property_error_because_no_callback_at_all.json +9 -0
  171. data/spec/vcr_cassettes/Operation/Websocket_connection/should_bail_with_hash_property_error_because_no_error-callback_.json +9 -0
  172. data/spec/vcr_cassettes/Operation/Websocket_connection/should_run_into_error_callback_because_bad_hash_parameters.json +13 -0
  173. metadata +259 -139
  174. data/spec/vcr_cassettes/Gauge_metrics/Platform_mem.yml +0 -44
  175. data/spec/vcr_cassettes/Gauge_metrics/Platform_mem_def.yml +0 -45
  176. data/spec/vcr_cassettes/Inventory/Helpers/generate_some_events_for_websocket.yml +0 -4446
  177. data/spec/vcr_cassettes/Inventory/Templates/Client_should_listen_on_various_inventory_events.json +0 -47
  178. data/spec/vcr_cassettes/Inventory/Templates/Helpers/generate_some_events_for_websocket.yml +0 -542
  179. data/spec/vcr_cassettes/Inventory/Templates/Should_List_datasources_with_no_props.yml +0 -174
  180. data/spec/vcr_cassettes/Inventory/Templates/Should_list_WildFlys_with_props.yml +0 -115
  181. data/spec/vcr_cassettes/Inventory/Templates/Should_list_all_the_resource_types.yml +0 -126
  182. data/spec/vcr_cassettes/Inventory/Templates/Should_list_children_of_WildFly.yml +0 -308
  183. data/spec/vcr_cassettes/Inventory/Templates/Should_list_heap_metrics_for_WildFlys.yml +0 -712
  184. data/spec/vcr_cassettes/Inventory/Templates/Should_list_metrics_for_WildFlys.yml +0 -278
  185. data/spec/vcr_cassettes/Inventory/Templates/Should_list_metrics_of_given_metric_type.yml +0 -530
  186. data/spec/vcr_cassettes/Inventory/Templates/Should_list_metrics_of_given_resource_type.yml +0 -278
  187. data/spec/vcr_cassettes/Inventory/Templates/Should_list_operation_definitions_of_given_resource.yml +0 -185
  188. data/spec/vcr_cassettes/Inventory/Templates/Should_list_operation_definitions_of_given_resource_type.yml +0 -126
  189. data/spec/vcr_cassettes/Inventory/Templates/Should_list_recursive_children_of_WildFly.yml +0 -2369
  190. data/spec/vcr_cassettes/Inventory/Templates/Should_list_relationships_of_WildFly.yml +0 -415
  191. data/spec/vcr_cassettes/Inventory/Templates/Should_list_types_with_feed.yml +0 -124
  192. data/spec/vcr_cassettes/Inventory/Templates/Should_return_config_data_of_given_resource.yml +0 -57
  193. data/spec/vcr_cassettes/Simple/Should_be_Cool.yml +0 -208
  194. data/spec/vcr_cassettes/Tenants/Should_Get_Tenant_For_Implicit_Credentials.yml +0 -50
@@ -34,9 +34,10 @@ module Hawkular::Metrics
34
34
  gauges.each { |g| default_timestamp g[:data] }
35
35
  counters.each { |g| default_timestamp g[:data] }
36
36
  availabilities.each { |g| default_timestamp g[:data] }
37
-
38
37
  data = { gauges: gauges, counters: counters, availabilities: availabilities }
39
- http_post('/metrics/data', data)
38
+ path = '/metrics/'
39
+ @legacy_api ? path << 'data' : path << 'raw'
40
+ http_post(path, data)
40
41
  end
41
42
 
42
43
  # Base class for accessing metric definition and data of all
@@ -50,6 +51,7 @@ module Hawkular::Metrics
50
51
  @client = client
51
52
  @type = metric_type
52
53
  @resource = resource
54
+ @legacy_api = client.legacy_api
53
55
  end
54
56
 
55
57
  # Create new metric definition
@@ -79,14 +81,15 @@ module Hawkular::Metrics
79
81
  # @param id [String]
80
82
  # @return [MetricDefinition]
81
83
  def get(id)
82
- the_id = @client.hawk_escape id
84
+ the_id = ERB::Util.url_encode id
83
85
  Hawkular::Metrics::MetricDefinition.new(@client.http_get("/#{@resource}/#{the_id}"))
84
86
  end
85
87
 
86
88
  # update tags for given metric definition
87
89
  # @param metric_definition [MetricDefinition]
88
90
  def update_tags(metric_definition)
89
- @client.http_put("/#{@resource}/#{metric_definition.id}/tags", metric_definition.hash[:tags])
91
+ metric_definition_id = ERB::Util.url_encode metric_definition.id
92
+ @client.http_put("/#{@resource}/#{metric_definition_id}/tags", metric_definition.hash[:tags])
90
93
  end
91
94
 
92
95
  # Push metric data
@@ -104,9 +107,10 @@ module Hawkular::Metrics
104
107
  # {:value => 99.9, :tags => {:tagName => "myMax"}}])
105
108
  def push_data(id, data)
106
109
  data = [data] unless data.is_a?(Array)
107
-
110
+ uri = "/#{@resource}/#{ERB::Util.url_encode(id)}/"
111
+ @legacy_api ? uri << 'data' : uri << 'raw'
108
112
  @client.default_timestamp data
109
- @client.http_post("/#{@resource}/#{id}/data", data)
113
+ @client.http_post(uri, data)
110
114
  end
111
115
 
112
116
  # Retrieve metric datapoints
@@ -149,7 +153,9 @@ module Hawkular::Metrics
149
153
  def get_data_by_tags(tags, starts: nil, ends: nil, bucketDuration: nil)
150
154
  params = { tags: tags_param(tags), start: starts,
151
155
  end: ends, bucketDuration: bucketDuration }
152
- resp = @client.http_get("/#{@resource}/data/?" + encode_params(params))
156
+ path = "/#{@resource}/"
157
+ @legacy_api ? path << 'data/?' : path << 'stats/?'
158
+ resp = @client.http_get(path + encode_params(params))
153
159
  resp.is_a?(Array) ? resp : [] # API returns no content (empty Hash) instead of empty array
154
160
  end
155
161
 
@@ -164,8 +170,14 @@ module Hawkular::Metrics
164
170
  private
165
171
 
166
172
  def get_data_helper(id, params)
167
- resp = @client.http_get("/#{@resource}/#{ERB::Util.url_encode(id)}/data/?" +
168
- encode_params(params))
173
+ path = "/#{@resource}/#{ERB::Util.url_encode(id)}/"
174
+ if @legacy_api
175
+ path << 'data/?'
176
+ else
177
+ (params[:bucketDuration].nil? && params[:buckets].nil?) ? path << 'raw/?' : path << 'stats/?'
178
+ end
179
+ path << encode_params(params)
180
+ resp = @client.http_get(path)
169
181
  resp.is_a?(Array) ? resp : [] # API returns no content (empty Hash) instead of empty array
170
182
  end
171
183
  end
@@ -189,7 +201,7 @@ module Hawkular::Metrics
189
201
  # client.gauges.get_periods("gauge1", starts: before4h, threshold: 10, operation: "lte")
190
202
  def get_periods(id, starts: nil, ends: nil, threshold: nil, operation: nil)
191
203
  params = { start: starts, end: ends, threshold: threshold, op: operation }
192
- @client.http_get("/#{@resource}/#{id}/periods?" + encode_params(params))
204
+ @client.http_get("/#{@resource}/#{ERB::Util.url_encode(id)}/periods?" + encode_params(params))
193
205
  end
194
206
  end
195
207
 
@@ -209,6 +221,7 @@ module Hawkular::Metrics
209
221
  # @return [Array[Hash]] rate points
210
222
  def get_rate(id, starts: nil, ends: nil, bucket_duration: nil)
211
223
  path = "/#{@resource}/#{ERB::Util.url_encode(id)}/rate"
224
+ path << '/stats' unless bucket_duration.nil? && @legacy_api
212
225
  params = { start: starts, end: ends, bucketDuration: bucket_duration }
213
226
  resp = @client.http_get(path + '?' + encode_params(params))
214
227
  # API returns no content (empty Hash) instead of empty array
@@ -28,6 +28,19 @@ module Hawkular::Metrics
28
28
  # @return [Availability] access counters API
29
29
  attr_reader :avail
30
30
 
31
+ # @return [boolean] if it's using the legacy API or not
32
+ attr_reader :legacy_api
33
+
34
+ def check_version
35
+ version_status_hash = fetch_version_and_status
36
+ fail_version_msg = 'Unable to determine implementation version for metrics'
37
+ fail fail_version_msg if version_status_hash['Implementation-Version'].nil?
38
+ version = version_status_hash['Implementation-Version']
39
+ major, minor = version.scan(/\d+/).map(&:to_i)
40
+ fail fail_version_msg if major.nil? || minor.nil?
41
+ @legacy_api = (major == 0 && minor < 16)
42
+ end
43
+
31
44
  # Construct a new Hawkular Metrics client class.
32
45
  # optional parameters
33
46
  # @param entrypoint [String] Base url of the Hawkular (metrics) server
@@ -43,6 +56,7 @@ module Hawkular::Metrics
43
56
  options = {})
44
57
  entrypoint = normalize_entrypoint_url entrypoint, 'hawkular/metrics'
45
58
  super(entrypoint, credentials, options)
59
+ check_version
46
60
  @tenants = Client::Tenants.new self
47
61
  @counters = Client::Counters.new self
48
62
  @gauges = Client::Gauges.new self
@@ -4,6 +4,8 @@ require 'json'
4
4
 
5
5
  # Adding a method `perform` for each block so that we can write nice callbacks for this client
6
6
  class Proc
7
+ class PerformMethodMissing
8
+ end
7
9
  def perform(callable, result)
8
10
  call(Class.new do
9
11
  method_name = callable.to_sym
@@ -13,7 +15,7 @@ class Proc
13
15
  # rubocop:disable Lint/NestedMethodDefinition
14
16
  # https://github.com/bbatsov/rubocop/issues/2704
15
17
  def method_missing(_method_name, *_args, &_block)
16
- false
18
+ PerformMethodMissing
17
19
  end
18
20
  # rubocop:enable Lint/NestedMethodDefinition
19
21
  end.new)
@@ -215,7 +217,11 @@ module Hawkular::Operations
215
217
  fail 'callback must have the perform method defined. include Hawkular::Operations' unless
216
218
  callback.nil? || callback.respond_to?('perform')
217
219
  params.each do |property|
218
- fail "Hash property #{property} must be specified" if hash[property].nil?
220
+ next unless hash[property].nil?
221
+ err_callback = 'You need to specify error callback'
222
+ err_message = "Hash property #{property} must be specified"
223
+ fail(ArgumentError, err_callback) if callback.nil?
224
+ fail(ArgumentError, err_callback) if callback.perform(:failure, err_message).equal? Proc::PerformMethodMissing
219
225
  end
220
226
  end
221
227
 
@@ -4,5 +4,5 @@
4
4
  # @see https://github.com/hawkular
5
5
  module Hawkular
6
6
  # Version of the Hawkular Ruby Gem
7
- VERSION = '2.2.1'
7
+ VERSION = '2.3.0'.freeze
8
8
  end
data/spec/README.rdoc ADDED
@@ -0,0 +1,62 @@
1
+ = Test suite
2
+ Read me if you want more information about the test suite and VCR cassettes.
3
+
4
+ == Running all the tests
5
+
6
+ bundle exec rake test
7
+ or shorter
8
+ rspec
9
+
10
+ == Running individual tests
11
+
12
+ Run all the tests for metrics
13
+ rspec ./spec/integration/metric_spec.rb
14
+
15
+ Run one particular test:
16
+ that starts on line 74
17
+ rspec ./spec/integration/metric_spec.rb:74
18
+
19
+ that contains a description 'push metric data to existing counter'
20
+ rspec -e 'push metric data to existing counter' ./spec/integration/metric_spec.rb:74
21
+
22
+ == VCRs
23
+ By default, all the interaction over HTTP is done via the VCR testing suite. So no real calls to the server side are made, but the communication is read from +.yml+ files, called cassettes. This allows the whole testsuite to run very quickly, whitout the need for the server to be up. Obviously, the drawback is that the data may be stale. To re-record the VCR cassettes, one can run the +rspec+ with environment property <code>VCR_UPDATE=1</code>.
24
+
25
+ For inventory and metrics specs, there is a support for templating the VCR cassettes. This means that some data that vary in different hawkular-services server starts may be parametrized, because there is no point in checking if the +feed_id+ is really the desired uuid or the timestamp is really the xyz. Good thing about it is that when re-recording the cassette and the api is the same, it'll remain the same up to the minor stuff like +recorded_at:+ fields. An example of the VCR template can be seen {here}[link:https://git.io/vKm99]. This is all done under the hood by using the around interceptors ({here}[link:https://git.io/vKmHE] and {here}[link:https://git.io/vKmH7]) and the helper methods in +spec_helper.rb+.
26
+
27
+ Parametrization of the cassette is basically replacing the raw data in it by its reference, so for instance following pseudo-code:
28
+
29
+ parametrize('Hello, asdfasdf', {id: 'asdfasdf'})
30
+
31
+ would provide
32
+ Hello, <%= id%>
33
+ in the resulting cassette.
34
+
35
+ For inventory, the data that is parametrized in the VCR cassettes needs to be in the +@state+ hash, while for the metrics it's only the +@random_id+ field that's an random (for each test case) uuid. This will be probably unified in the future and will be the same across all the components.
36
+
37
+ If you need to override the default behavior and use your own data during the parametrization, this can be done the following way (https://git.io/vKmQF):
38
+
39
+ it 'Should push metric data to existing gauge', :skip_auto_vcr do
40
+ now = @client.now
41
+ ends = now - t4h
42
+ starts = now - (2 * t4h)
43
+ ...
44
+ bindings = { id: @random_id, ends: ends, starts: starts, ... }
45
+ example = proc do
46
+ # do all the asserts
47
+ end
48
+ record("Metrics/#{metrics_context}", bindings, cassette_name, example: example)
49
+ end
50
+
51
+ In the example above, whenever the values of +starts+, +ends+ or +@random_id+ appear in the cassette, it'll be replaced by its reference => parametrized. This process is done only if the <code>VCR_UPDATE=1</code> is passed to the +rspec+. Otherwise, the templates will be just used (not created). This allows the fact that one template can be used for whole set of different calls if we abstract from the (volatile) data that doesn't matter, like generated ids or timestamps.
52
+
53
+ === Metrics VCRs
54
+ Currently, the metrics sub-client is special, because we keep the VCR cassettes for +hawkular-metrics+ in version <code>0.8.0.Final</code> as well as for metrics that are part of the hawkular-services. Thus, there is a support for so called "metric contexts" in the {spec file}[https://git.io/vKmBa]. By default, all the test-suite is run for all the metric contexts. Some tests can have a tag on them that they make sense only for certain context. This is done by using the <code>run_for: [services_context] </code> tag (see {example}[https://git.io/vKm5M]). If it's omitted, the test case is meant to run in all the contexts.
55
+
56
+ When re-recording the templates, it's handy to update only one metrics context. To do that, you can use the env variables:
57
+ SKIP_V8_METRICS=1
58
+ or
59
+ SKIP_SERVICES_METRICS=1
60
+ To skip the suite for v8 metrics or the services one, respectively.
61
+
62
+ Good thing about this approach is that we can store the historical data in its own directories and not override over and over the some methods and end up with an inconsistent state, where some methods are captured in state +t+ and some in state <code>t+1</code>. Here is how it looks like: https://git.io/vKmdb In the future, we will be fixing also the version of the hawkular-services.
@@ -208,7 +208,7 @@ module Hawkular::Alerts::RSpec
208
208
 
209
209
  describe 'Alert/Groups', vcr: { decode_compressed_response: true } do
210
210
  before(:each) do
211
- @client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds)
211
+ @client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds, options)
212
212
  end
213
213
 
214
214
  it 'Should operate a complex group trigger' do
@@ -391,7 +391,7 @@ module Hawkular::Alerts::RSpec
391
391
 
392
392
  describe 'Alert/Alerts', :vcr do
393
393
  it 'Should list alerts' do
394
- client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds)
394
+ client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds, options)
395
395
 
396
396
  alerts = client.list_alerts
397
397
 
@@ -400,7 +400,7 @@ module Hawkular::Alerts::RSpec
400
400
  end
401
401
 
402
402
  it 'Should list alerts for trigger' do
403
- client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds)
403
+ client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds, options)
404
404
 
405
405
  alerts = client.get_alerts_for_trigger '75bfdd05-d03d-481e-bf32-c724c7719d8b~Local_jvm_pheap'
406
406
 
@@ -409,7 +409,7 @@ module Hawkular::Alerts::RSpec
409
409
  end
410
410
 
411
411
  it 'Should list alerts for unknown trigger' do
412
- client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds)
412
+ client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds, options)
413
413
 
414
414
  alerts = client.get_alerts_for_trigger 'does-not-exist'
415
415
 
@@ -418,7 +418,7 @@ module Hawkular::Alerts::RSpec
418
418
  end
419
419
 
420
420
  it 'Should fetch single alert' do
421
- client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds)
421
+ client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds, options)
422
422
 
423
423
  alert = client.get_single_alert(
424
424
  '28026b36-8fe4-4332-84c8-524e173a68bf-snert~Local_jvm_garba-1446977734134')
@@ -429,7 +429,7 @@ module Hawkular::Alerts::RSpec
429
429
  end
430
430
 
431
431
  it 'Should resolve an alert' do
432
- client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds)
432
+ client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds, options)
433
433
 
434
434
  alert_id = '28026b36-8fe4-4332-84c8-524e173a68bf-snert~Local_jvm_garba-1446977734134'
435
435
  alert = client.get_single_alert alert_id
@@ -452,7 +452,7 @@ module Hawkular::Alerts::RSpec
452
452
  # end
453
453
 
454
454
  it 'Should acknowledge an alert' do
455
- client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds)
455
+ client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds, options)
456
456
 
457
457
  alert_id = '28026b36-8fe4-4332-84c8-524e173a68bf-snert~Local_jvm_garba-1446977734134'
458
458
  client.get_single_alert alert_id
@@ -483,7 +483,7 @@ module Hawkular::Alerts::RSpec
483
483
  end
484
484
 
485
485
  it 'Should list events' do
486
- client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds)
486
+ client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds, options)
487
487
 
488
488
  events = client.list_events('thin' => true)
489
489
 
@@ -496,7 +496,7 @@ module Hawkular::Alerts::RSpec
496
496
  start_time = (now - 7_200) * 1000
497
497
  end_time = now * 1000
498
498
 
499
- client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds)
499
+ client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds, options)
500
500
 
501
501
  events = client.list_events('startTime' => start_time, 'endTime' => end_time)
502
502
 
@@ -505,7 +505,7 @@ module Hawkular::Alerts::RSpec
505
505
  end
506
506
 
507
507
  it 'Should not list events using criteria' do
508
- client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds)
508
+ client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds, options)
509
509
 
510
510
  events = client.list_events('startTime' => 0, 'endTime' => 1000)
511
511
 
@@ -519,7 +519,7 @@ module Hawkular::Alerts::RSpec
519
519
  erb: { id: the_id }, record: :none,
520
520
  decode_compressed_response: true
521
521
  ) do
522
- client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds)
522
+ client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds, options)
523
523
 
524
524
  the_event = client.create_event(the_id, 'MyCategory', 'Li la lu',
525
525
  context: { message: 'This is a test' },
@@ -533,7 +533,7 @@ module Hawkular::Alerts::RSpec
533
533
 
534
534
  describe 'Alert/EndToEnd', vcr: { decode_compressed_response: true } do
535
535
  before(:each) do
536
- @client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds)
536
+ @client = Hawkular::Alerts::AlertsClient.new(ALERTS_BASE, creds, options)
537
537
  end
538
538
 
539
539
  it 'Should create and fire a trigger' do
@@ -598,8 +598,12 @@ module Hawkular::Alerts::RSpec
598
598
  expect(trigger.dampenings.size).to be(0)
599
599
 
600
600
  # Trigger is set up - send a metric value to trigger it.
601
- metric_client = Hawkular::Metrics::Client.new('http://localhost:8080/hawkular/metrics',
602
- creds)
601
+ metric_client = nil
602
+ ::RSpec::Mocks.with_temporary_scope do
603
+ mock_metrics_version
604
+ metric_client = Hawkular::Metrics::Client.new('http://localhost:8080/hawkular/metrics',
605
+ creds, options)
606
+ end
603
607
 
604
608
  data_point = { timestamp: Time.now.to_i * 1000, value: 42 }
605
609
  data = [{ id: 'my-metric-id1', data: [data_point] }]
@@ -13,8 +13,9 @@ module Hawkular::Client::RSpec
13
13
  password: 'password'
14
14
  }
15
15
  ::RSpec::Mocks.with_temporary_scope do
16
- mock_inventory_client
17
- @hawkular_client = Hawkular::Client.new(entrypoint: HOST, credentials: @creds)
16
+ mock_inventory_client '0.17.2.Final'
17
+ mock_metrics_version
18
+ @hawkular_client = Hawkular::Client.new(entrypoint: HOST, credentials: @creds, options: { tenant: 'hawkular' })
18
19
  end
19
20
  @state = {
20
21
  hostname: 'localhost.localdomain',
@@ -22,6 +23,18 @@ module Hawkular::Client::RSpec
22
23
  }
23
24
  end
24
25
 
26
+ it 'Should err on bad credentials' do
27
+ VCR.use_cassette('HawkularClient/Should err on bad credentials') do
28
+ @creds = {
29
+ username: '-XX-X-jdoe-X',
30
+ password: 'password'
31
+ }
32
+ expect do
33
+ Hawkular::Client.new(entrypoint: HOST, credentials: @creds)
34
+ end.to raise_error(Hawkular::BaseClient::HawkularException, 'Unauthorized')
35
+ end
36
+ end
37
+
25
38
  it 'Should fail when calling method with unknown prefix' do
26
39
  expect { @hawkular_client.ynventori_list_feeds }.to raise_error(RuntimeError)
27
40
  expect { @hawkular_client.list_feeds }.to raise_error(RuntimeError)
@@ -29,39 +42,50 @@ module Hawkular::Client::RSpec
29
42
 
30
43
  it 'Should fail when calling unknown method with known client prefix' do
31
44
  expect { @hawkular_client.inventory_lyst_feeds }.to raise_error(NoMethodError)
45
+ expect { @hawkular_client.metrics_lyst_feeds }.to raise_error(NoMethodError)
46
+ expect { @hawkular_client.alerts_lyst_feeds }.to raise_error(NoMethodError)
47
+ expect { @hawkular_client.tokens_lyst_feeds }.to raise_error(NoMethodError)
32
48
  end
33
49
 
34
50
  context 'and URIs as input', vcr: { decode_compressed_response: true } do
35
51
  it 'Should work with URI' do
36
52
  uri = URI.parse HOST
37
53
  opts = { tenant: 'hawkular' }
38
-
39
- the_client = Hawkular::Client.new(entrypoint: uri, credentials: @creds, options: opts)
40
- expect { the_client.inventory.list_feeds }.to_not raise_error
54
+ ::RSpec::Mocks.with_temporary_scope do
55
+ mock_metrics_version
56
+ the_client = Hawkular::Client.new(entrypoint: uri, credentials: @creds, options: opts)
57
+ expect { the_client.inventory.list_feeds }.to_not raise_error
58
+ end
41
59
  end
42
60
 
43
61
  it 'Should work with URI on metrics client' do
44
62
  uri = URI.parse HOST
45
63
  opts = { tenant: 'hawkular' }
46
-
47
- the_client = Hawkular::Metrics::Client.new(uri, @creds, opts)
48
- expect { the_client.http_get '/status' }.to_not raise_error
64
+ ::RSpec::Mocks.with_temporary_scope do
65
+ mock_metrics_version
66
+ the_client = Hawkular::Metrics::Client.new(uri, @creds, opts)
67
+ expect { the_client.http_get '/status' }.to_not raise_error
68
+ end
49
69
  end
50
70
 
51
71
  it 'Should work with https URI on metrics client' do
52
72
  uri = URI.parse 'https://localhost:8080'
53
73
  opts = { tenant: 'hawkular' }
54
-
55
- the_client = Hawkular::Metrics::Client.new(uri, @creds, opts)
56
- expect !the_client.nil?
74
+ ::RSpec::Mocks.with_temporary_scope do
75
+ mock_metrics_version
76
+ the_client = Hawkular::Metrics::Client.new(uri, @creds, opts)
77
+ expect !the_client.nil?
78
+ end
57
79
  end
58
80
  end
59
81
 
60
82
  context 'and Inventory client', vcr: { decode_compressed_response: true } do
61
83
  before(:all) do
62
84
  ::RSpec::Mocks.with_temporary_scope do
63
- mock_inventory_client
64
- @client = Hawkular::Inventory::InventoryClient.create(entrypoint: HOST, credentials: @creds)
85
+ mock_inventory_client '0.17.2.Final'
86
+ @client = Hawkular::Inventory::InventoryClient.create(entrypoint: HOST,
87
+ credentials: @creds,
88
+ options: { tenant: 'hawkular' })
65
89
  end
66
90
  end
67
91
 
@@ -127,7 +151,10 @@ module Hawkular::Client::RSpec
127
151
  include Hawkular::Metrics::RSpec
128
152
 
129
153
  before(:all) do
130
- @client = Hawkular::Metrics::Client.new(HOST, @creds)
154
+ ::RSpec::Mocks.with_temporary_scope do
155
+ mock_metrics_version
156
+ @client = Hawkular::Metrics::Client.new(HOST, @creds)
157
+ end
131
158
  end
132
159
 
133
160
  it 'Should both work the same way when pushing metric data to non-existing counter' do
@@ -253,6 +280,18 @@ module Hawkular::Client::RSpec
253
280
  end
254
281
  end
255
282
 
283
+ it 'Should work initializing with URI' do
284
+ uri = URI.parse HOST
285
+ opts = { tenant: 'hawkular' }
286
+ WebSocketVCR.record(example, self) do
287
+ ::RSpec::Mocks.with_temporary_scope do
288
+ mock_metrics_version
289
+ the_client = Hawkular::Client.new(entrypoint: uri, credentials: @creds, options: opts)
290
+ expect { the_client.operations }.to_not raise_error
291
+ end
292
+ end
293
+ end
294
+
256
295
  xit 'Should both reuse the websocket connection', :websocket do
257
296
  WebSocketVCR.record(example, self) do
258
297
  end