hawkular-client 2.6.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.rdoc +5 -2
  3. data/lib/hawkular/hawkular_client.rb +1 -1
  4. data/lib/hawkular/inventory/inventory_api.rb +2 -1
  5. data/lib/hawkular/metrics/metric_api.rb +4 -1
  6. data/lib/hawkular/operations/operations_api.rb +7 -4
  7. data/lib/hawkular/version.rb +1 -1
  8. data/spec/integration/inventory_spec.rb +516 -466
  9. data/spec/integration/metric_spec.rb +612 -561
  10. data/spec/integration/operations_spec.rb +425 -504
  11. data/spec/spec_helper.rb +73 -19
  12. data/spec/vcr_cassettes/Inventory/{Connection → NonSecure/Connection/Templates}/Should_err_on_bad_credentials.yml +6 -4
  13. data/spec/vcr_cassettes/Inventory/{Tenants → NonSecure/Tenants/Templates}/Should_Get_Tenant_For_Explicit_Credentials.yml +13 -9
  14. data/spec/vcr_cassettes/Inventory/{Tenants → NonSecure/Tenants/Templates}/Should_Get_Tenant_For_Implicit_Credentials.yml +13 -9
  15. data/spec/vcr_cassettes/Inventory/{inventory_0_17/Templates → NonSecure/inventory_0_17}/Client_should_listen_on_various_inventory_events.json +5 -5
  16. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Client_should_listen_on_various_inventory_events.yml +21 -13
  17. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17/Templates}/Helpers/create_url.yml +12 -10
  18. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Helpers/generate_some_events_for_websocket.yml +51 -37
  19. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17/Templates}/Helpers/get_feeds.yml +11 -9
  20. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_List_datasources_with_no_props.yml +11 -7
  21. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_create_a_feed.yml +6 -4
  22. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_create_a_feed_again.yml +16 -10
  23. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_nested_resource_and_metric_on_it.yml +664 -0
  24. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_create_a_resource.yml +31 -19
  25. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_create_a_resource_with_metric.yml +77 -49
  26. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_create_a_resourcetype.yml +16 -10
  27. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_create_and_delete_feed.yml +19 -13
  28. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_and_get_a_resource.yml +420 -0
  29. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_get_resource_with_its_configurations.yml +132 -0
  30. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_have_the_same_requested_metric_type_id.yml +8 -8
  31. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_URLs.yml +29 -7
  32. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_WildFlys.yml +10 -8
  33. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_WildFlys_with_props.yml +24 -17
  34. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_all_the_resource_types.yml +6 -4
  35. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_children_of_WildFly.yml +31 -13
  36. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_children_of_nested_resource.yml +16 -10
  37. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_feeds.yml +9 -7
  38. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_heap_metrics_for_WildFlys.yml +196 -188
  39. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_metrics_for_WildFlys.yml +72 -68
  40. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_metrics_of_given_metric_type.yml +12 -44
  41. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_metrics_of_given_resource_type.yml +63 -61
  42. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_operation_definitions_of_given_resource.yml +220 -156
  43. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_operation_definitions_of_given_resource_type.yml +200 -140
  44. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_recursive_children_of_WildFly.yml +30 -12
  45. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_relationships_of_WildFly.yml +129 -113
  46. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_resources_for_feed.yml +12 -10
  47. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_types_with_bad_feed.yml +6 -4
  48. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_types_with_feed.yml +7 -5
  49. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_not_find_an_unknown_resource.yml +6 -4
  50. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_return_config_data_of_given_nested_resource.yml +6 -4
  51. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_return_config_data_of_given_resource.yml +15 -10
  52. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_return_the_version.yml +8 -6
  53. data/spec/vcr_cassettes/Inventory/Secure/Connection/Templates/Should_err_on_bad_credentials.yml +44 -0
  54. data/spec/vcr_cassettes/Inventory/Secure/Tenants/Templates/Should_Get_Tenant_For_Explicit_Credentials.yml +101 -0
  55. data/spec/vcr_cassettes/Inventory/Secure/Tenants/Templates/Should_Get_Tenant_For_Implicit_Credentials.yml +101 -0
  56. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Client_should_listen_on_various_inventory_events.json +47 -0
  57. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Client_should_listen_on_various_inventory_events.yml +207 -0
  58. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Helpers/create_url.yml +52 -0
  59. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Helpers/generate_some_events_for_websocket.yml +411 -0
  60. data/spec/vcr_cassettes/Inventory/{inventory_0_17/Templates/Should_list_feeds_when_using_SSL_without_certificate.yml → Secure/inventory_0_17/Templates/Helpers/get_feeds.yml} +13 -11
  61. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_List_datasources_with_no_props.yml +133 -0
  62. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_feed.yml +59 -0
  63. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_feed_again.yml +181 -0
  64. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → Secure/inventory_0_17}/Templates/Should_create_a_nested_resource_and_metric_on_it.yml +108 -150
  65. data/spec/vcr_cassettes/Inventory/{inventory_0_17/Templates/Should_create_and_get_a_resource.yml → Secure/inventory_0_17/Templates/Should_create_a_resource.yml} +45 -87
  66. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_resource_with_metric.yml +846 -0
  67. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_resourcetype.yml +169 -0
  68. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_and_delete_feed.yml +166 -0
  69. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_and_get_a_resource.yml +420 -0
  70. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_get_resource_with_its_configurations.yml +132 -0
  71. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_have_the_same_requested_metric_type_id.yml +73 -0
  72. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_URLs.yml +90 -0
  73. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_WildFlys.yml +70 -0
  74. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_WildFlys_with_props.yml +138 -0
  75. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_all_the_resource_types.yml +59 -0
  76. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_children_of_WildFly.yml +333 -0
  77. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_children_of_nested_resource.yml +180 -0
  78. data/spec/vcr_cassettes/{Operation/Helpers/get_feed.yml → Inventory/Secure/inventory_0_17/Templates/Should_list_feeds.yml} +13 -11
  79. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_heap_metrics_for_WildFlys.yml +943 -0
  80. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_metrics_for_WildFlys.yml +361 -0
  81. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_metrics_of_given_metric_type.yml +90 -0
  82. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_metrics_of_given_resource_type.yml +294 -0
  83. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource.yml +871 -0
  84. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource_type.yml +740 -0
  85. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_recursive_children_of_WildFly.yml +1117 -0
  86. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_relationships_of_WildFly.yml +393 -0
  87. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_resources_for_feed.yml +84 -0
  88. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_types_with_bad_feed.yml +55 -0
  89. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_types_with_feed.yml +166 -0
  90. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_not_find_an_unknown_resource.yml +59 -0
  91. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_return_config_data_of_given_nested_resource.yml +66 -0
  92. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_return_config_data_of_given_resource.yml +71 -0
  93. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_return_the_version.yml +50 -0
  94. data/spec/vcr_cassettes/Inventory/Templates/Should_list_feeds_when_using_SSL_without_certificate.yml +114 -0
  95. data/spec/vcr_cassettes/{Metric_ID_with_special_characters → Metrics/NonSecure/ID_with_special_characters/Templates}/Get_metric_definition_by_id.yml +10 -8
  96. data/spec/vcr_cassettes/{Metric_ID_with_special_characters → Metrics/NonSecure/ID_with_special_characters/Templates}/Retrieve_metric_rate_points.yml +18 -14
  97. data/spec/vcr_cassettes/{Metric_ID_with_special_characters → Metrics/NonSecure/ID_with_special_characters/Templates}/Should_create_Availability_definition.yml +18 -14
  98. data/spec/vcr_cassettes/{Metric_ID_with_special_characters → Metrics/NonSecure/ID_with_special_characters/Templates}/Should_create_Counter_definition.yml +18 -14
  99. data/spec/vcr_cassettes/{Metric_ID_with_special_characters → Metrics/NonSecure/ID_with_special_characters/Templates}/Should_create_gauge_definition.yml +18 -14
  100. data/spec/vcr_cassettes/{Metric_ID_with_special_characters → Metrics/NonSecure/ID_with_special_characters/Templates}/Should_push_metric_data_to_existing_gauge.yml +9 -7
  101. data/spec/vcr_cassettes/{Metric_ID_with_special_characters → Metrics/NonSecure/ID_with_special_characters/Templates}/Should_update_tags_for_Availability_definition.yml +28 -22
  102. data/spec/vcr_cassettes/{Metric_ID_with_special_characters → Metrics/NonSecure/ID_with_special_characters/Templates}/Should_update_tags_for_gauge_definition.yml +28 -22
  103. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +12 -8
  104. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +14 -10
  105. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Availability_metrics/Should_group_contiguous_values.yml +10 -6
  106. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +19 -13
  107. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +31 -21
  108. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +14 -10
  109. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +12 -8
  110. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +28 -18
  111. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +38 -24
  112. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +32 -20
  113. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +19 -13
  114. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +14 -10
  115. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +12 -8
  116. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +32 -20
  117. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +19 -13
  118. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Gauge_metrics/Should_return_periods.yml +10 -6
  119. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +31 -21
  120. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +48 -52
  121. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +39 -25
  122. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +36 -24
  123. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/No_Tenant/Should_fail.yml +6 -4
  124. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Simple/Should_be_Cool.yml +2 -2
  125. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Status/Should_return_the_version.yml +5 -3
  126. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Tenants/Should_create_and_return_tenant.yml +99 -0
  127. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +0 -0
  128. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +3 -3
  129. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +0 -0
  130. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +0 -0
  131. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +3 -3
  132. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +0 -0
  133. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -0
  134. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +0 -0
  135. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +0 -0
  136. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +3 -3
  137. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +0 -0
  138. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +0 -0
  139. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +0 -0
  140. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Gauge_metrics/Should_return_periods.yml +0 -0
  141. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +0 -0
  142. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +0 -0
  143. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +0 -0
  144. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Simple/Should_be_Cool.yml +0 -0
  145. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Status/Should_return_the_version.yml +0 -0
  146. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Tenants/Should_create_and_return_tenant.yml +0 -0
  147. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +19 -15
  148. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +21 -17
  149. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Availability_metrics/Should_group_contiguous_values.yml +17 -13
  150. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +29 -23
  151. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +47 -37
  152. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +21 -17
  153. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +19 -15
  154. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +44 -34
  155. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +60 -46
  156. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +51 -39
  157. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +29 -23
  158. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +21 -17
  159. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +19 -15
  160. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +51 -39
  161. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +29 -23
  162. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Gauge_metrics/Should_return_periods.yml +17 -13
  163. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory.yml +50 -0
  164. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Gauge_metrics/Should_return_platform_memory_def.yml +12 -10
  165. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +47 -37
  166. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_fetch_rate_stats_for_mixed_metric.yml +328 -0
  167. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Mixed_metrics/Should_fetch_stats_for_mixed_metric.yml +32 -32
  168. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +70 -74
  169. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +61 -47
  170. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +55 -43
  171. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/No_Tenant/Should_fail.yml +9 -7
  172. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Simple/Should_be_Cool.yml +3 -3
  173. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Status/Should_return_the_version.yml +10 -8
  174. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Tenants/Should_create_and_return_tenant.yml +99 -0
  175. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Get_metric_definition_by_id.yml +51 -0
  176. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Retrieve_metric_rate_points.yml +92 -0
  177. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_create_Availability_definition.yml +101 -0
  178. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_create_Counter_definition.yml +101 -0
  179. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_create_gauge_definition.yml +101 -0
  180. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_push_metric_data_to_existing_gauge.yml +50 -0
  181. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_update_tags_for_Availability_definition.yml +146 -0
  182. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_update_tags_for_gauge_definition.yml +146 -0
  183. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +99 -0
  184. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +99 -0
  185. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_group_contiguous_values.yml +97 -0
  186. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +144 -0
  187. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +240 -0
  188. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +99 -0
  189. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +99 -0
  190. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +240 -0
  191. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +328 -0
  192. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +281 -0
  193. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +144 -0
  194. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +99 -0
  195. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +99 -0
  196. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +281 -0
  197. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +144 -0
  198. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_return_periods.yml +97 -0
  199. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +240 -0
  200. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +326 -0
  201. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +314 -0
  202. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +285 -0
  203. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/No_Tenant/Should_fail.yml +50 -0
  204. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Simple/Should_be_Cool.yml +48 -0
  205. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Status/Should_return_the_version.yml +44 -0
  206. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Tenants/Should_create_and_return_tenant.yml +99 -0
  207. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +99 -0
  208. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +99 -0
  209. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_group_contiguous_values.yml +97 -0
  210. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +144 -0
  211. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +240 -0
  212. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +99 -0
  213. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +99 -0
  214. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +240 -0
  215. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +328 -0
  216. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +281 -0
  217. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +144 -0
  218. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +99 -0
  219. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +99 -0
  220. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +281 -0
  221. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +144 -0
  222. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_return_periods.yml +97 -0
  223. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory.yml +50 -0
  224. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory_def.yml +51 -0
  225. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +240 -0
  226. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_fetch_stats_for_mixed_metric.yml +364 -0
  227. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +326 -0
  228. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +314 -0
  229. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +285 -0
  230. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/No_Tenant/Should_fail.yml +50 -0
  231. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Simple/Should_be_Cool.yml +48 -0
  232. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Status/Should_return_the_version.yml +44 -0
  233. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Tenants/Should_create_and_return_tenant.yml +99 -0
  234. data/spec/vcr_cassettes/Operation/NonSecure/Helpers/Templates/get_feed.yml +61 -0
  235. data/spec/vcr_cassettes/Operation/{Helpers → NonSecure/Helpers/Templates}/get_tenant.yml +8 -5
  236. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_JDBC_driver_should_add_the_driver.json +23 -0
  237. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_datasource_should_be_doable.json +23 -0
  238. data/spec/vcr_cassettes/Operation/{Operation → NonSecure/Operation}/Add_deployment_should_be_doable.json +4 -7
  239. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Disable_should_be_performed_and_eventually_respond_with_success.json +23 -0
  240. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Remove_JDBC_driver_should_be_performed_and_eventually_respond_with_success.json +23 -0
  241. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Remove_datasource_should_be_performed_and_eventually_respond_with_success.json +23 -0
  242. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Restart_can_be_run_multiple_times_in_parallel.json +32 -0
  243. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Restart_should_be_performed_and_eventually_respond_with_success.json +23 -0
  244. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Restart_should_not_be_performed_if_resource_path_is_wrong.json +23 -0
  245. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Undeploy_deployment_should_be_performed_and_eventually_respond_with_success.json +23 -0
  246. data/spec/vcr_cassettes/Operation/{Operation → NonSecure/Operation}/should_not_be_possible_to_perform_on_closed_client.json +1 -1
  247. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_bail_with_hash_property_error_because_no_callback_at_all.json +9 -0
  248. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_bail_with_hash_property_error_because_no_error-callback_.json +9 -0
  249. data/spec/vcr_cassettes/Operation/{Websocket_connection → NonSecure/Websocket_connection}/should_bail_with_no_host.json +0 -0
  250. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_be_established.json +9 -0
  251. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_be_established_via_entrypoint.json +9 -0
  252. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_run_into_error_callback.json +18 -0
  253. data/spec/vcr_cassettes/Operation/{Websocket_connection → NonSecure/Websocket_connection}/should_run_into_error_callback_because_bad_hash_parameters.json +1 -1
  254. data/spec/vcr_cassettes/Operation/Secure/Helpers/Templates/get_feed.yml +61 -0
  255. data/spec/vcr_cassettes/Operation/Secure/Helpers/Templates/get_tenant.yml +55 -0
  256. data/spec/vcr_cassettes/Operation/Secure/Operation/Add_JDBC_driver_should_add_the_driver.json +23 -0
  257. data/spec/vcr_cassettes/Operation/Secure/Operation/Add_datasource_should_be_doable.json +23 -0
  258. data/spec/vcr_cassettes/Operation/Secure/Operation/Add_deployment_should_be_doable.json +23 -0
  259. data/spec/vcr_cassettes/Operation/Secure/Operation/Disable_should_be_performed_and_eventually_respond_with_success.json +23 -0
  260. data/spec/vcr_cassettes/Operation/Secure/Operation/Remove_JDBC_driver_should_be_performed_and_eventually_respond_with_success.json +23 -0
  261. data/spec/vcr_cassettes/Operation/Secure/Operation/Remove_datasource_should_be_performed_and_eventually_respond_with_success.json +23 -0
  262. data/spec/vcr_cassettes/Operation/Secure/Operation/Restart_can_be_run_multiple_times_in_parallel.json +32 -0
  263. data/spec/vcr_cassettes/Operation/Secure/Operation/Restart_should_be_performed_and_eventually_respond_with_success.json +23 -0
  264. data/spec/vcr_cassettes/Operation/Secure/Operation/Restart_should_not_be_performed_if_resource_path_is_wrong.json +23 -0
  265. data/spec/vcr_cassettes/Operation/Secure/Operation/Undeploy_deployment_should_be_performed_and_eventually_respond_with_success.json +23 -0
  266. data/spec/vcr_cassettes/Operation/Secure/Operation/should_not_be_possible_to_perform_on_closed_client.json +12 -0
  267. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_bail_with_hash_property_error_because_no_callback_at_all.json +9 -0
  268. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_bail_with_hash_property_error_because_no_error-callback_.json +9 -0
  269. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_bail_with_no_host.json +3 -0
  270. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_be_established.json +9 -0
  271. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_be_established_via_entrypoint.json +9 -0
  272. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_run_into_error_callback.json +18 -0
  273. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_run_into_error_callback_because_bad_hash_parameters.json +13 -0
  274. metadata +526 -282
  275. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Tenants/Should_create_and_return_tenant.yml +0 -95
  276. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory.yml +0 -48
  277. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Tenants/Should_create_and_return_tenant.yml +0 -95
  278. data/spec/vcr_cassettes/Operation/Operation/Add_JDBC_driver_should_add_the_driver.json +0 -26
  279. data/spec/vcr_cassettes/Operation/Operation/Add_datasource_should_be_doable.json +0 -26
  280. data/spec/vcr_cassettes/Operation/Operation/Disable_should_be_performed_and_eventually_respond_with_success.json +0 -26
  281. data/spec/vcr_cassettes/Operation/Operation/Remove_JDBC_driver_should_be_performed_and_eventually_respond_with_success.json +0 -26
  282. data/spec/vcr_cassettes/Operation/Operation/Remove_datasource_should_be_performed_and_eventually_respond_with_success.json +0 -26
  283. data/spec/vcr_cassettes/Operation/Operation/Restart_can_be_run_multiple_times_in_parallel.json +0 -40
  284. data/spec/vcr_cassettes/Operation/Operation/Restart_should_be_performed_and_eventually_respond_with_success.json +0 -26
  285. data/spec/vcr_cassettes/Operation/Operation/Restart_should_not_be_performed_if_resource_path_is_wrong.json +0 -26
  286. data/spec/vcr_cassettes/Operation/Operation/Undeploy_deployment_should_be_performed_and_eventually_respond_with_success.json +0 -26
  287. data/spec/vcr_cassettes/Operation/Websocket_connection/should_bail_with_hash_property_error_because_no_callback_at_all.json +0 -9
  288. data/spec/vcr_cassettes/Operation/Websocket_connection/should_bail_with_hash_property_error_because_no_error-callback_.json +0 -9
  289. data/spec/vcr_cassettes/Operation/Websocket_connection/should_be_established.json +0 -9
  290. data/spec/vcr_cassettes/Operation/Websocket_connection/should_be_established_via_entrypoint.json +0 -9
  291. data/spec/vcr_cassettes/Operation/Websocket_connection/should_run_into_error_callback.json +0 -13
@@ -2,6 +2,9 @@ require "#{File.dirname(__FILE__)}/../vcr/vcr_setup"
2
2
  require "#{File.dirname(__FILE__)}/../spec_helper"
3
3
  require 'securerandom'
4
4
 
5
+ SKIP_SECURE_CONTEXT = ENV['SKIP_SECURE_CONTEXT'] || '1'
6
+ SKIP_SECURE_CONTEXT.freeze
7
+
5
8
  # examples related to Hawkular Metrics
6
9
 
7
10
  # time constants
@@ -13,670 +16,718 @@ v8_context = :metrics_0_8_0
13
16
  services_context = :metrics_services
14
17
  v16_context = :metrics_0_16_0
15
18
 
16
- [v8_context, services_context, v16_context].each do |metrics_context|
17
- if ENV['SKIP_V8_METRICS'] == '1' && metrics_context == v8_context
18
- puts 'skipping v8 metrics'
19
- next
20
- end
21
- if ENV['SKIP_SERVICES_METRICS'] == '1' && metrics_context == services_context
22
- puts 'skipping services metrics'
23
- next
24
- end
19
+ # ssl contexts
20
+ SECURE_CONTEXT = :Secure
21
+ NON_SECURE_CONTEXT = :NonSecure
25
22
 
26
- describe "#{metrics_context}" do
27
- let(:cassette_name) do |example|
28
- if example.respond_to?(:example_group) && !example.example_group.description.start_with?(metrics_context.to_s)
29
- example.example_group.description + '/'
30
- else
31
- ''
32
- end + example.description
23
+ security_contexts = [NON_SECURE_CONTEXT, SECURE_CONTEXT].freeze
24
+ vcr_test_tenant_postfix = "-vcr-tenant-#{SecureRandom.uuid}".freeze
25
+
26
+ security_contexts.each do |security_context|
27
+ next if security_context == SECURE_CONTEXT && SKIP_SECURE_CONTEXT == '1'
28
+
29
+ [v8_context, services_context, v16_context].each do |metrics_context|
30
+ if ENV['SKIP_V8_METRICS'] == '1' && metrics_context == v8_context
31
+ puts 'skipping v8 metrics'
32
+ next
33
+ end
34
+ if ENV['SKIP_SERVICES_METRICS'] == '1' && metrics_context == services_context
35
+ puts 'skipping services metrics'
36
+ next
33
37
  end
38
+ # Secure context not supported for v8
39
+ next if security_context == SECURE_CONTEXT && metrics_context == v8_context
34
40
 
35
- around(:each) do |example|
36
- run_for = example.metadata[:run_for]
37
- if run_for.nil? || run_for.empty? || run_for.include?(metrics_context)
38
- @random_id = SecureRandom.uuid
39
- if example.metadata[:skip_auto_vcr]
40
- example.run
41
+ setup_options = {
42
+ mocked_version: metrics_context == :metrics_services ? nil : v16_version_string,
43
+ type: security_context
44
+ }.freeze
45
+
46
+ describe "#{metrics_context} #{security_context}" do
47
+ vcr_test_tenant = "#{security_context}#{metrics_context}#{vcr_test_tenant_postfix}".freeze
48
+
49
+ let(:cassette_name) do |example|
50
+ if example.respond_to?(:example_group) && !example.example_group.description.start_with?(metrics_context.to_s)
51
+ example.example_group.description + '/'
41
52
  else
42
- record("Metrics/#{metrics_context}", { id: @random_id }, cassette_name, example: example)
43
- end
53
+ ''
54
+ end + example.description
44
55
  end
45
- end
46
-
47
- after(:all) do
48
- require 'fileutils'
49
- FileUtils.rm_rf "#{VCR.configuration.cassette_library_dir}/Metrics/#{metrics_context}/tmp"
50
- end
51
56
 
52
- describe 'Simple' do
53
- it 'Should be Cool' do
54
- url = metrics_context == v8_context ? config['url_v8'] : config['url']
55
- Net::HTTP.get_response(URI(url))
57
+ let(:vcr_bindings) do
58
+ { id: @random_id, vcr_test_tenant: vcr_test_tenant }
56
59
  end
57
- end
58
60
 
59
- describe 'Tenants', run_for: [v8_context, services_context, v16_context] do
60
- before(:all) do
61
- if metrics_context == v8_context
62
- setup_v8_client
63
- else
64
- metrics_context == v16_context ? setup_client(mocked_version: v16_version_string) : setup_client
61
+ around(:each) do |example|
62
+ run_for = example.metadata[:run_for]
63
+ if run_for.nil? || run_for.empty? || run_for.include?(metrics_context)
64
+ @random_id = SecureRandom.uuid
65
+ if example.metadata[:skip_auto_vcr]
66
+ example.run
67
+ else
68
+ record("Metrics/#{security_context}/#{metrics_context}",
69
+ vcr_bindings,
70
+ cassette_name,
71
+ example: example)
72
+ end
65
73
  end
66
74
  end
67
75
 
68
- it 'Should create and return tenant' do
69
- tenant = @random_id
70
- @client.tenants.create(tenant)
71
- created = @client.tenants.query.select { |t| t.id == tenant }
72
- expect(created).not_to be nil
76
+ after(:all) do
77
+ record_cleanup("Metrics/#{security_context}/#{metrics_context}")
73
78
  end
74
- end
75
79
 
76
- describe 'No Tenant', run_for: [services_context, v16_context] do
77
- it 'Should fail' do
78
- setup_client_without_tenant
79
- begin
80
- @client.counters.push_data(@random_id, value: 4)
81
- rescue # rubocop:disable Lint/HandleExceptions
82
- # This is good
83
- else
84
- fail 'The call should have failed due to missing tenant'
80
+ describe 'Simple' do
81
+ it 'Should be Cool' do
82
+ url = metrics_context == v8_context ? entrypoint('v8', 'metrics') : entrypoint(security_context, 'metrics')
83
+ Net::HTTP.get_response(URI(url))
85
84
  end
86
85
  end
87
- end
88
86
 
89
- describe 'Mixed metrics', run_for: [v8_context, services_context, v16_context] do
90
- before(:all) do
91
- if metrics_context == v8_context
92
- setup_v8_client tenant: 'vcr-test-tenant-123'
93
- else
94
- if metrics_context == v16_context
95
- setup_client_new_tenant(mocked_version: v16_version_string)
87
+ describe 'Tenants', run_for: [v8_context, services_context, v16_context] do
88
+ before(:all) do
89
+ if metrics_context == v8_context
90
+ setup_v8_client
96
91
  else
97
- setup_client_new_tenant
92
+ setup_client(setup_options)
98
93
  end
99
94
  end
95
+
96
+ it 'Should create and return tenant' do
97
+ tenant = @random_id
98
+ @client.tenants.create(tenant)
99
+ created = @client.tenants.query.select { |t| t.id == tenant }
100
+ expect(created).not_to be nil
101
+ end
100
102
  end
101
103
 
102
- it 'Should requests raw data for multiple metrics', :skip_auto_vcr, run_for: [services_context, v16_context] do
103
- id1 = SecureRandom.uuid
104
- id2 = SecureRandom.uuid
105
- id3 = SecureRandom.uuid
106
-
107
- ids = [id1, id2, id3]
108
- bindings = { id1: id1, id2: id2, id3: id3 }
109
- example = proc do
110
- if (metrics_context == v16_context)
111
- @client = setup_client(username: 'jdoe', password: 'password', tenant: 'vcr-test',
112
- mocked_version: v16_version_string)
104
+ describe 'No Tenant', run_for: [services_context, v16_context] do
105
+ it 'Should fail' do
106
+ setup_client_without_tenant(setup_options)
107
+ begin
108
+ @client.counters.push_data(@random_id, value: 4)
109
+ rescue # rubocop:disable Lint/HandleExceptions
110
+ # This is good
113
111
  else
114
- @client = setup_client(username: 'jdoe', password: 'password', tenant: 'vcr-test')
112
+ fail 'The call should have failed due to missing tenant'
115
113
  end
114
+ end
115
+ end
116
116
 
117
- expect(@client.counters.raw_data(ids).size).to be 0
118
- expect(@client.gauges.raw_data(ids).size).to be 0
119
- expect(@client.avail.raw_data(ids).size).to be 0
120
-
121
- @client.push_data(
122
- counters: [
123
- { id: id1, data: [{ value: 1 }] },
124
- { id: id2, data: [{ value: 2 }] },
125
- { id: id3, data: [{ value: 3 }] }
126
- ],
127
- availabilities: [
128
- { id: id1, data: [{ value: 'up' }] },
129
- { id: id2, data: [{ value: 'down' }] },
130
- { id: id3, data: [{ value: 'up' }] }
131
- ],
132
- gauges: [
133
- { id: id1, data: [{ value: 1.1 }] },
134
- { id: id2, data: [{ value: 2.2 }] },
135
- { id: id3, data: [{ value: 3.3 }] }
136
- ]
137
- )
117
+ describe 'Mixed metrics', run_for: [v8_context, services_context, v16_context] do
118
+ before(:all) do
119
+ if metrics_context == v8_context
120
+ setup_v8_client tenant: vcr_test_tenant
121
+ else
122
+ setup_client(setup_options)
123
+ end
124
+ end
138
125
 
139
- c_metrics = @client.counters.raw_data(ids)
140
- g_metrics = @client.gauges.raw_data(ids)
141
- a_metrics = @client.avail.raw_data(ids)
126
+ it 'Should requests raw data for multiple metrics', :skip_auto_vcr, run_for: [services_context, v16_context] do
127
+ id1 = SecureRandom.uuid
128
+ id2 = SecureRandom.uuid
129
+ id3 = SecureRandom.uuid
130
+
131
+ ids = [id1, id2, id3]
132
+ bindings = { id1: id1, id2: id2, id3: id3 }
133
+ example = proc do
134
+ @client = setup_client(setup_options.merge tenant: vcr_test_tenant)
135
+
136
+ expect(@client.counters.raw_data(ids).size).to be 0
137
+ expect(@client.gauges.raw_data(ids).size).to be 0
138
+ expect(@client.avail.raw_data(ids).size).to be 0
139
+
140
+ @client.push_data(
141
+ counters: [
142
+ { id: id1, data: [{ value: 1 }] },
143
+ { id: id2, data: [{ value: 2 }] },
144
+ { id: id3, data: [{ value: 3 }] }
145
+ ],
146
+ availabilities: [
147
+ { id: id1, data: [{ value: 'up' }] },
148
+ { id: id2, data: [{ value: 'down' }] },
149
+ { id: id3, data: [{ value: 'up' }] }
150
+ ],
151
+ gauges: [
152
+ { id: id1, data: [{ value: 1.1 }] },
153
+ { id: id2, data: [{ value: 2.2 }] },
154
+ { id: id3, data: [{ value: 3.3 }] }
155
+ ]
156
+ )
157
+
158
+ c_metrics = @client.counters.raw_data(ids)
159
+ g_metrics = @client.gauges.raw_data(ids)
160
+ a_metrics = @client.avail.raw_data(ids)
161
+
162
+ expect(c_metrics.size).to be 3
163
+ expect(c_metrics).to include(
164
+ { 'id' => id1, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 1 }] },
165
+ { 'id' => id2, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 2 }] },
166
+ { 'id' => id3, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 3 }] }
167
+ )
168
+
169
+ expect(g_metrics.size).to be 3
170
+ expect(g_metrics).to include(
171
+ { 'id' => id1, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 1.1 }] },
172
+ { 'id' => id2, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 2.2 }] },
173
+ { 'id' => id3, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 3.3 }] }
174
+ )
175
+
176
+ expect(a_metrics.size).to be 3
177
+ expect(a_metrics).to include(
178
+ { 'id' => id1, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 'up' }] },
179
+ { 'id' => id2, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 'down' }] },
180
+ { 'id' => id3, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 'up' }] }
181
+ )
182
+ end
183
+ record("Metrics/#{security_context}/#{metrics_context}",
184
+ vcr_bindings.merge(bindings),
185
+ cassette_name,
186
+ example: example)
187
+ end
142
188
 
143
- expect(c_metrics.size).to be 3
144
- expect(c_metrics).to include(
145
- { 'id' => id1, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 1 }] },
146
- { 'id' => id2, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 2 }] },
147
- { 'id' => id3, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 3 }] }
148
- )
189
+ it 'Should send mixed metric request of a single type' do
190
+ @client.push_data(counters: [{ id: @random_id, data: [{ value: 1 }] }])
191
+ data = @client.counters.get_data(@random_id)
192
+ expect(data.size).to be 1
149
193
 
150
- expect(g_metrics.size).to be 3
151
- expect(g_metrics).to include(
152
- { 'id' => id1, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 1.1 }] },
153
- { 'id' => id2, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 2.2 }] },
154
- { 'id' => id3, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 3.3 }] }
155
- )
194
+ @client.push_data(availabilities: [{ id: @random_id, data: [{ value: 'down' }] }])
195
+ data = @client.avail.get_data(@random_id)
196
+ expect(data.size).to be 1
156
197
 
157
- expect(a_metrics.size).to be 3
158
- expect(a_metrics).to include(
159
- { 'id' => id1, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 'up' }] },
160
- { 'id' => id2, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 'down' }] },
161
- { 'id' => id3, 'data' => [{ 'timestamp' => a_kind_of(Integer), 'value' => 'up' }] }
162
- )
198
+ @client.push_data(gauges: [{ id: @random_id, data: [{ value: 1.1 }] }])
199
+ data = @client.gauges.get_data(@random_id)
200
+ expect(data.size).to be 1
163
201
  end
164
202
 
165
- record("Metrics/#{metrics_context}", bindings, cassette_name, example: example)
166
- end
167
-
168
- it 'Should send mixed metric request of a single type' do
169
- @client.push_data(counters: [{ id: @random_id, data: [{ value: 1 }] }])
170
- data = @client.counters.get_data(@random_id)
171
- expect(data.size).to be 1
172
-
173
- @client.push_data(availabilities: [{ id: @random_id, data: [{ value: 'down' }] }])
174
- data = @client.avail.get_data(@random_id)
175
- expect(data.size).to be 1
203
+ it 'Should send mixed metric request' do
204
+ expect(@client.counters.get_data(@random_id).size).to be 0
205
+ expect(@client.gauges.get_data(@random_id).size).to be 0
206
+ expect(@client.avail.get_data(@random_id).size).to be 0
176
207
 
177
- @client.push_data(gauges: [{ id: @random_id, data: [{ value: 1.1 }] }])
178
- data = @client.gauges.get_data(@random_id)
179
- expect(data.size).to be 1
180
- end
208
+ @client.push_data(
209
+ counters: [{ id: @random_id, data: [{ value: 1 }] }],
210
+ availabilities: [{ id: @random_id, data: [{ value: 'down' }] }],
211
+ gauges: [{ id: @random_id, data: [{ value: 1.1 }] }]
212
+ )
181
213
 
182
- it 'Should send mixed metric request' do
183
- expect(@client.counters.get_data(@random_id).size).to be 0
184
- expect(@client.gauges.get_data(@random_id).size).to be 0
185
- expect(@client.avail.get_data(@random_id).size).to be 0
214
+ expect(@client.counters.get_data(@random_id).size).to be 1
215
+ expect(@client.gauges.get_data(@random_id).size).to be 1
216
+ expect(@client.avail.get_data(@random_id).size).to be 1
217
+ end
186
218
 
187
- @client.push_data(
188
- counters: [{ id: @random_id, data: [{ value: 1 }] }],
189
- availabilities: [{ id: @random_id, data: [{ value: 'down' }] }],
190
- gauges: [{ id: @random_id, data: [{ value: 1.1 }] }]
191
- )
219
+ it 'Should fetch stats for mixed metric', run_for: [services_context] do
220
+ expect(@client.counters.get_data(@random_id).size).to be 0
221
+ expect(@client.gauges.get_data(@random_id).size).to be 0
222
+ expect(@client.avail.get_data(@random_id).size).to be 0
192
223
 
193
- expect(@client.counters.get_data(@random_id).size).to be 1
194
- expect(@client.gauges.get_data(@random_id).size).to be 1
195
- expect(@client.avail.get_data(@random_id).size).to be 1
196
- end
224
+ @client.push_data(
225
+ counters: [{ id: @random_id, data: [{ value: 1 }] }],
226
+ availabilities: [{ id: @random_id, data: [{ value: 'down' }] }],
227
+ gauges: [{ id: @random_id, data: [{ value: 1.1 }] }]
228
+ )
197
229
 
198
- it 'Should fetch stats for mixed metric', run_for: [services_context] do
199
- expect(@client.counters.get_data(@random_id).size).to be 0
200
- expect(@client.gauges.get_data(@random_id).size).to be 0
201
- expect(@client.avail.get_data(@random_id).size).to be 0
202
-
203
- @client.push_data(
204
- counters: [{ id: @random_id, data: [{ value: 1 }] }],
205
- availabilities: [{ id: @random_id, data: [{ value: 'down' }] }],
206
- gauges: [{ id: @random_id, data: [{ value: 1.1 }] }]
207
- )
208
-
209
- timestamps = []
210
- timestamps.push(@client.counters.get_data(@random_id).first['timestamp'])
211
- timestamps.push(@client.gauges.get_data(@random_id).first['timestamp'])
212
- timestamps.push(@client.avail.get_data(@random_id).first['timestamp'])
213
-
214
- stats = @client.query_stats(
215
- gauge_ids: [@random_id],
216
- counter_ids: [@random_id],
217
- avail_ids: [@random_id],
218
- starts: timestamps.min,
219
- ends: timestamps.max + 1,
220
- bucket_duration: "#{timestamps.max - timestamps.min + 1}ms"
221
- )
222
-
223
- expect(stats.size).to be 3
224
- expect(stats['gauge'][@random_id].first['avg']).to be 1.1
225
- expect(stats['counter'][@random_id].first['avg']).to be 1.0
226
- expect(stats['availability'][@random_id].first['downtimeCount']).to be 1
227
- end
228
- end
230
+ timestamps = []
231
+ timestamps.push(@client.counters.get_data(@random_id).first['timestamp'])
232
+ timestamps.push(@client.gauges.get_data(@random_id).first['timestamp'])
233
+ timestamps.push(@client.avail.get_data(@random_id).first['timestamp'])
234
+
235
+ stats = @client.query_stats(
236
+ gauge_ids: [@random_id],
237
+ counter_ids: [@random_id],
238
+ avail_ids: [@random_id],
239
+ starts: timestamps.min,
240
+ ends: timestamps.max + 1,
241
+ bucket_duration: "#{timestamps.max - timestamps.min + 1}ms"
242
+ )
229
243
 
230
- describe 'Counter metrics' do
231
- before(:all) do
232
- @tenant = 'vcr-test-tenant-123'
233
- if metrics_context == v8_context
234
- setup_v8_client tenant: @tenant
235
- else
236
- if metrics_context == v16_context
237
- setup_client_new_tenant(mocked_version: v16_version_string)
238
- else
239
- setup_client_new_tenant
240
- end
244
+ expect(stats.size).to be 3
245
+ expect(stats['gauge'][@random_id].first['avg']).to be 1.1
246
+ expect(stats['counter'][@random_id].first['avg']).to be 1.0
247
+ expect(stats['availability'][@random_id].first['downtimeCount']).to be 1
241
248
  end
242
- end
243
249
 
244
- it 'Should create and return counter using Hash parameter' do
245
- create_metric_using_hash @client.counters, @random_id, @tenant
246
- end
250
+ it 'Should fetch rate stats for mixed metric', run_for: [services_context] do
251
+ expect(@client.counters.get_data(@random_id).size).to be 0
247
252
 
248
- it 'Should create counter definition using MetricDefinition parameter' do
249
- create_metric_using_md @client.counters, @random_id
250
- end
251
-
252
- it 'Should push metric data to existing counter', :skip_auto_vcr do
253
- now = @client.now
254
- minus10 = now - 10
255
- minus20 = now - 20
256
- minus30 = now - 30
257
- minus8h = now - (2 * t4h)
258
- minus4h = now - t4h
259
-
260
- bindings = { id: @random_id, minus10: minus10, minus20: minus20, minus30: minus30,
261
- minus8h: minus8h, minus4h: minus4h }
262
- example = proc do
263
- # create counter
264
- @client.counters.create(id: @random_id)
265
-
266
- # push 3 values with timestamps
267
- @client.counters.push_data(@random_id, [{ value: 1, timestamp: minus30 },
268
- { value: 2, timestamp: minus20 },
269
- { value: 3, timestamp: minus10 }])
253
+ @client.push_data(counters: [{ id: @random_id, data: [{ value: 100.0 }] }])
254
+ @client.push_data(counters: [{ id: @random_id, data: [{ value: 110.0 }] }])
255
+ @client.push_data(counters: [{ id: @random_id, data: [{ value: 130.0 }] }])
256
+ @client.push_data(counters: [{ id: @random_id, data: [{ value: 200.0 }] }])
270
257
 
271
- data = @client.counters.get_data(@random_id)
272
- expect(data.size).to be 3
273
-
274
- # push one value without timestamp (which means now)
275
- @client.counters.push_data(@random_id, value: 4)
276
258
  data = @client.counters.get_data(@random_id)
277
259
  expect(data.size).to be 4
260
+ timestamps = data.map { |d| d['timestamp'] }
261
+
262
+ stats = @client.query_stats(
263
+ counter_ids: [@random_id],
264
+ starts: timestamps.min,
265
+ ends: timestamps.max + 1,
266
+ rates: true,
267
+ bucket_duration: "#{timestamps.max - timestamps.min + 1}ms"
268
+ )
278
269
 
279
- # retrieve values from past
280
- data = @client.counters.get_data(@random_id, starts: minus8h, ends: minus4h)
281
- expect(data.empty?).to be true
270
+ expect(stats.size).to be 2
271
+ expect(stats['counter'][@random_id].size).to be 1
272
+ expect(stats['counter_rate'][@random_id].size).to be 1
282
273
  end
283
- record("Metrics/#{metrics_context}", bindings, cassette_name, example: example)
284
274
  end
285
275
 
286
- # limit and order were introduced in 0.11.0 => skipping for 0.8.0
287
- it 'Should get metrics with limit and order', run_for: [services_context, v16_context], skip_auto_vcr: true do
288
- now = @client.now
289
- minus10 = now - 10
290
- minus20 = now - 20
291
- minus30 = now - 30
292
- minus8h = now - (2 * t4h)
293
- minus4h = now - t4h
294
- bindings = { id: @random_id, minus10: minus10, minus20: minus20, minus30: minus30,
295
- minus8h: minus8h, minus4h: minus4h }
296
-
297
- example = proc do
298
- # create counter
299
- @client.counters.create(id: @random_id)
300
-
301
- # push 3 values with timestamps
302
- @client.counters.push_data(@random_id, [{ value: 1, timestamp: minus30 },
303
- { value: 2, timestamp: minus20 },
304
- { value: 3, timestamp: minus10 }])
276
+ describe 'Counter metrics' do
277
+ before(:all) do
278
+ @tenant = vcr_test_tenant
279
+ if metrics_context == v8_context
280
+ setup_v8_client tenant: @tenant
281
+ else
282
+ setup_client(setup_options.merge(tenant: @tenant))
283
+ end
284
+ end
305
285
 
306
- data = @client.counters.get_data(@random_id)
307
- expect(data.size).to be 3
286
+ it 'Should create and return counter using Hash parameter' do
287
+ create_metric_using_hash @client.counters, @random_id, @tenant
288
+ end
308
289
 
309
- # push one value without timestamp (which means now)
310
- @client.counters.push_data(@random_id, value: 4)
311
- data = @client.counters.get_data(@random_id)
312
- expect(data.size).to be 4
290
+ it 'Should create counter definition using MetricDefinition parameter' do
291
+ create_metric_using_md @client.counters, @random_id
292
+ end
313
293
 
314
- # retrieve values with limit
315
- data = @client.counters.get_data(@random_id, limit: 1, order: 'DESC')
316
- expect(data.size).to be 1
317
- expect(data.first['value']).to be 4
294
+ it 'Should push metric data to existing counter', :skip_auto_vcr do
295
+ now = @client.now
296
+ minus10 = now - 10
297
+ minus20 = now - 20
298
+ minus30 = now - 30
299
+ minus8h = now - (2 * t4h)
300
+ minus4h = now - t4h
301
+
302
+ bindings = { id: @random_id, minus10: minus10, minus20: minus20, minus30: minus30,
303
+ minus8h: minus8h, minus4h: minus4h }
304
+ example = proc do
305
+ # create counter
306
+ @client.counters.create(id: @random_id)
307
+
308
+ # push 3 values with timestamps
309
+ @client.counters.push_data(@random_id, [{ value: 1, timestamp: minus30 },
310
+ { value: 2, timestamp: minus20 },
311
+ { value: 3, timestamp: minus10 }])
312
+
313
+ data = @client.counters.get_data(@random_id)
314
+ expect(data.size).to be 3
315
+
316
+ # push one value without timestamp (which means now)
317
+ @client.counters.push_data(@random_id, value: 4)
318
+ data = @client.counters.get_data(@random_id)
319
+ expect(data.size).to be 4
320
+
321
+ # retrieve values from past
322
+ data = @client.counters.get_data(@random_id, starts: minus8h, ends: minus4h)
323
+ expect(data.empty?).to be true
324
+ end
325
+ record("Metrics/#{security_context}/#{metrics_context}",
326
+ vcr_bindings.merge(bindings),
327
+ cassette_name,
328
+ example: example)
329
+ end
318
330
 
319
- # retrieve values from past
320
- data = @client.counters.get_data(@random_id, starts: minus8h, ends: minus4h)
321
- expect(data.empty?).to be true
331
+ # limit and order were introduced in 0.11.0 => skipping for 0.8.0
332
+ it 'Should get metrics with limit and order', run_for: [services_context, v16_context], skip_auto_vcr: true do
333
+ now = @client.now
334
+ minus10 = now - 10
335
+ minus20 = now - 20
336
+ minus30 = now - 30
337
+ minus8h = now - (2 * t4h)
338
+ minus4h = now - t4h
339
+ bindings = { id: @random_id, minus10: minus10, minus20: minus20, minus30: minus30,
340
+ minus8h: minus8h, minus4h: minus4h }
341
+
342
+ example = proc do
343
+ # create counter
344
+ @client.counters.create(id: @random_id)
345
+
346
+ # push 3 values with timestamps
347
+ @client.counters.push_data(@random_id, [{ value: 1, timestamp: minus30 },
348
+ { value: 2, timestamp: minus20 },
349
+ { value: 3, timestamp: minus10 }])
350
+
351
+ data = @client.counters.get_data(@random_id)
352
+ expect(data.size).to be 3
353
+
354
+ # push one value without timestamp (which means now)
355
+ @client.counters.push_data(@random_id, value: 4)
356
+ data = @client.counters.get_data(@random_id)
357
+ expect(data.size).to be 4
358
+
359
+ # retrieve values with limit
360
+ data = @client.counters.get_data(@random_id, limit: 1, order: 'DESC')
361
+ expect(data.size).to be 1
362
+ expect(data.first['value']).to be 4
363
+
364
+ # retrieve values from past
365
+ data = @client.counters.get_data(@random_id, starts: minus8h, ends: minus4h)
366
+ expect(data.empty?).to be true
367
+ end
368
+ record("Metrics/#{security_context}/#{metrics_context}",
369
+ vcr_bindings.merge(bindings),
370
+ cassette_name,
371
+ example: example)
322
372
  end
323
- record("Metrics/#{metrics_context}", bindings, cassette_name, example: example)
324
- end
325
373
 
326
- it 'Should get metrics as bucketed results', :skip_auto_vcr do
327
- now = @client.now
328
- minus5 = now - 5
329
- minus10 = now - 10
330
- minus20 = now - 20
331
- minus30 = now - 30
332
- minus40 = now - 40
333
- minus50 = now - 50
334
- minus60 = now - 60
335
- minus70 = now - 70
336
- minus80 = now - 80
337
- minus90 = now - 90
338
- minus100 = now - 100
339
- minus105 = now - 105
340
- minus110 = now - 110
341
- bindings = { id: @random_id, minus5: minus5, minus10: minus10, minus20: minus20, minus30: minus30,
342
- minus40: minus40, minus50: minus50, minus60: minus60, minus70: minus70, minus80: minus80,
343
- minus90: minus90, minus100: minus100, minus105: minus105, minus110: minus110 }
344
- example = proc do
345
- # create counter
346
- @client.counters.create(id: @random_id)
347
-
348
- # push 10 values with timestamps
349
- @client.counters.push_data(@random_id, [{ value: 110, timestamp: minus110 },
350
- { value: 100, timestamp: minus100 },
351
- { value: 90, timestamp: minus90 },
352
- { value: 80, timestamp: minus80 },
353
- { value: 70, timestamp: minus70 },
354
- { value: 60, timestamp: minus60 },
355
- { value: 50, timestamp: minus50 },
356
- { value: 40, timestamp: minus40 },
357
- { value: 30, timestamp: minus30 },
358
- { value: 20, timestamp: minus20 },
359
- { value: 10, timestamp: minus10 }])
360
- err = 0.001
361
- data = @client.counters.get_data(@random_id, starts: minus105, ends: minus5, buckets: 5)
362
- expect(data.size).to be 5
363
- expect(data.first['avg']).to be_within(err).of(95.0)
364
- expect(data.first['max']).to be_within(err).of(100.0)
365
- expect(data.first['samples']).to be 2
366
-
367
- data = @client.counters.get_data(@random_id, starts: minus105, ends: minus5, buckets: 2)
368
- expect(data.size).to be 2
369
- expect(data.first['avg']).to be_within(err).of(80.0)
370
- expect(data.first['samples']).to be 5
371
-
372
- data = @client.counters.get_data(@random_id, starts: minus105, ends: minus5, bucketDuration: '50ms')
373
- expect(data.size).to be 2
374
- expect(data.first['avg']).to be_within(err).of(80.0)
375
- end
376
- record("Metrics/#{metrics_context}", bindings, cassette_name, example: example)
377
- end
374
+ it 'Should get metrics as bucketed results', :skip_auto_vcr do
375
+ now = @client.now
376
+ minus5 = now - 5
377
+ minus10 = now - 10
378
+ minus20 = now - 20
379
+ minus30 = now - 30
380
+ minus40 = now - 40
381
+ minus50 = now - 50
382
+ minus60 = now - 60
383
+ minus70 = now - 70
384
+ minus80 = now - 80
385
+ minus90 = now - 90
386
+ minus100 = now - 100
387
+ minus105 = now - 105
388
+ minus110 = now - 110
389
+ bindings = { id: @random_id, minus5: minus5, minus10: minus10, minus20: minus20, minus30: minus30,
390
+ minus40: minus40, minus50: minus50, minus60: minus60, minus70: minus70, minus80: minus80,
391
+ minus90: minus90, minus100: minus100, minus105: minus105, minus110: minus110 }
392
+ example = proc do
393
+ # create counter
394
+ @client.counters.create(id: @random_id)
395
+
396
+ # push 10 values with timestamps
397
+ @client.counters.push_data(@random_id, [{ value: 110, timestamp: minus110 },
398
+ { value: 100, timestamp: minus100 },
399
+ { value: 90, timestamp: minus90 },
400
+ { value: 80, timestamp: minus80 },
401
+ { value: 70, timestamp: minus70 },
402
+ { value: 60, timestamp: minus60 },
403
+ { value: 50, timestamp: minus50 },
404
+ { value: 40, timestamp: minus40 },
405
+ { value: 30, timestamp: minus30 },
406
+ { value: 20, timestamp: minus20 },
407
+ { value: 10, timestamp: minus10 }])
408
+ err = 0.001
409
+ data = @client.counters.get_data(@random_id, starts: minus105, ends: minus5, buckets: 5)
410
+ expect(data.size).to be 5
411
+ expect(data.first['avg']).to be_within(err).of(95.0)
412
+ expect(data.first['max']).to be_within(err).of(100.0)
413
+ expect(data.first['samples']).to be 2
414
+
415
+ data = @client.counters.get_data(@random_id, starts: minus105, ends: minus5, buckets: 2)
416
+ expect(data.size).to be 2
417
+ expect(data.first['avg']).to be_within(err).of(80.0)
418
+ expect(data.first['samples']).to be 5
419
+
420
+ data = @client.counters.get_data(@random_id, starts: minus105, ends: minus5, bucketDuration: '50ms')
421
+ expect(data.size).to be 2
422
+ expect(data.first['avg']).to be_within(err).of(80.0)
423
+ end
424
+ record("Metrics/#{security_context}/#{metrics_context}",
425
+ vcr_bindings.merge(bindings),
426
+ cassette_name,
427
+ example: example)
428
+ end
378
429
 
379
- it 'Should push metric data to non-existing counter' do
380
- push_data_to_non_existing_metric @client.counters, { value: 4 }, @random_id
430
+ it 'Should push metric data to non-existing counter' do
431
+ push_data_to_non_existing_metric @client.counters, { value: 4 }, @random_id
432
+ end
381
433
  end
382
- end
383
434
 
384
- describe 'Availability metrics' do
385
- before(:all) do
386
- @tenant = 'vcr-test-tenant-123'
387
- if metrics_context == v8_context
388
- setup_v8_client tenant: @tenant
389
- else
390
- if metrics_context == v16_context
391
- setup_client_new_tenant(mocked_version: v16_version_string)
435
+ describe 'Availability metrics' do
436
+ before(:all) do
437
+ @tenant = vcr_test_tenant
438
+ if metrics_context == v8_context
439
+ setup_v8_client tenant: @tenant
392
440
  else
393
- setup_client_new_tenant
441
+ setup_client(setup_options.merge(tenant: @tenant))
394
442
  end
395
443
  end
396
- end
397
444
 
398
- it 'Should create and return Availability using Hash parameter' do
399
- create_metric_using_hash @client.avail, @random_id, @tenant
400
- end
445
+ it 'Should create and return Availability using Hash parameter' do
446
+ create_metric_using_hash @client.avail, @random_id, @tenant
447
+ end
401
448
 
402
- it 'Should create Availability definition using MetricDefinition parameter' do
403
- create_metric_using_md @client.avail, @random_id
404
- end
449
+ it 'Should create Availability definition using MetricDefinition parameter' do
450
+ create_metric_using_md @client.avail, @random_id
451
+ end
405
452
 
406
- it 'Should push metric data to non-existing Availability' do
407
- push_data_to_non_existing_metric @client.avail, { value: 'UP' }, @random_id
408
- end
453
+ it 'Should push metric data to non-existing Availability' do
454
+ push_data_to_non_existing_metric @client.avail, { value: 'UP' }, @random_id
455
+ end
409
456
 
410
- it 'Should update tags for Availability definition' do
411
- update_metric_by_tags @client.avail, @random_id
412
- end
457
+ it 'Should update tags for Availability definition' do
458
+ update_metric_by_tags @client.avail, @random_id
459
+ end
413
460
 
414
- it 'Should raise ArgumentError, availability does not accept percentiles param' do
415
- expect { @client.avail.get_data(@random_id, percentiles: 50) }.to raise_error(ArgumentError)
416
- end
461
+ it 'Should raise ArgumentError availability does not accept percentiles param' do
462
+ expect { @client.avail.get_data(@random_id, percentiles: 50) }.to raise_error(ArgumentError)
463
+ end
417
464
 
418
- it 'Should group contiguous values', :skip_auto_vcr, run_for: [services_context, v16_context] do
419
- now = @client.now
420
- minus10 = now - 10
421
- minus20 = now - 20
422
- minus30 = now - 30
423
- minus40 = now - 40
424
- minus50 = now - 50
425
- bindings = { id: @random_id, minus10: minus10, minus20: minus20, minus30: minus30, minus40: minus40,
426
- minus50: minus50, now: now }
427
- example = proc do
428
- if (metrics_context == v16_context)
429
- @client = setup_client(username: 'jdoe', password: 'password', tenant: 'vcr-test',
430
- mocked_version: v16_version_string)
431
- else
432
- @client = setup_client(username: 'jdoe', password: 'password', tenant: 'vcr-test')
465
+ it 'Should group contiguous values', :skip_auto_vcr, run_for: [services_context, v16_context] do
466
+ now = @client.now
467
+ minus10 = now - 10
468
+ minus20 = now - 20
469
+ minus30 = now - 30
470
+ minus40 = now - 40
471
+ minus50 = now - 50
472
+ bindings = { id: @random_id, minus10: minus10, minus20: minus20, minus30: minus30, minus40: minus40,
473
+ minus50: minus50, now: now }
474
+ example = proc do
475
+ @client = setup_client(setup_options.merge tenant: vcr_test_tenant)
476
+ @client.avail.push_data(@random_id, [
477
+ { timestamp: minus50, value: 'up' },
478
+ { timestamp: minus40, value: 'up' },
479
+ { timestamp: minus30, value: 'down' },
480
+ { timestamp: minus20, value: 'down' },
481
+ { timestamp: minus10, value: 'down' },
482
+ { timestamp: now, value: 'up' }
483
+ ])
484
+ result = @client.avail.get_data(@random_id, distinct: true, order: 'ASC')
485
+ expect(result).to eq([
486
+ { 'timestamp' => minus50, 'value' => 'up' },
487
+ { 'timestamp' => minus30, 'value' => 'down' },
488
+ { 'timestamp' => now, 'value' => 'up' }
489
+ ])
433
490
  end
434
- @client.avail.push_data(@random_id, [
435
- { timestamp: minus50, value: 'up' },
436
- { timestamp: minus40, value: 'up' },
437
- { timestamp: minus30, value: 'down' },
438
- { timestamp: minus20, value: 'down' },
439
- { timestamp: minus10, value: 'down' },
440
- { timestamp: now, value: 'up' }
441
- ])
442
- result = @client.avail.get_data(@random_id, distinct: true, order: 'ASC')
443
- expect(result).to eq([
444
- { 'timestamp' => minus50, 'value' => 'up' },
445
- { 'timestamp' => minus30, 'value' => 'down' },
446
- { 'timestamp' => now, 'value' => 'up' }
447
- ])
448
- end
449
-
450
- record("Metrics/#{metrics_context}", bindings, cassette_name, example: example)
491
+ record("Metrics/#{security_context}/#{metrics_context}",
492
+ vcr_bindings.merge(bindings),
493
+ cassette_name,
494
+ example: example)
495
+ end
451
496
  end
452
- end
453
497
 
454
- describe 'Gauge metrics' do
455
- before(:all) do
456
- @tenant = 'vcr-test-tenant-123'
457
- if metrics_context == v8_context
458
- setup_v8_client tenant: @tenant
459
- else
460
- if metrics_context == v16_context
461
- setup_client_new_tenant(mocked_version: v16_version_string)
498
+ describe 'Gauge metrics' do
499
+ hawkular_tenant_id = 'hawkular'.freeze
500
+ hawkular_feed_id = 'af0ea377-80f4-4567-af45-105eaa808b92'.freeze
501
+ hawkular_mem_id = "MI~R~[#{hawkular_feed_id}/platform~/OPERATING_SYSTEM=#{hawkular_feed_id}"\
502
+ '_OperatingSystem/MEMORY=Memory]~MT~Total Memory'.freeze
503
+
504
+ before(:all) do
505
+ @tenant = vcr_test_tenant
506
+ if metrics_context == v8_context
507
+ setup_v8_client tenant: @tenant
462
508
  else
463
- setup_client_new_tenant
509
+ setup_client(setup_options.merge(tenant: @tenant))
464
510
  end
465
511
  end
466
- end
467
512
 
468
- it 'Should create gauge definition using MetricDefinition' do
469
- create_metric_using_md @client.gauges, @random_id
470
- end
471
-
472
- it 'Should create gauge definition using Hash' do
473
- create_metric_using_hash @client.gauges, @random_id, @tenant
474
- end
475
-
476
- it 'Should push metric data to non-existing gauge' do
477
- push_data_to_non_existing_metric @client.gauges, { value: 3.1415926 }, @random_id
478
- end
513
+ it 'Should create gauge definition using MetricDefinition' do
514
+ create_metric_using_md @client.gauges, @random_id
515
+ end
479
516
 
480
- # let's do the recording manually
481
- it 'Should push metric data to existing gauge', :skip_auto_vcr do
482
- now = @client.now
483
- ends = now - t4h
484
- starts = now - (2 * t4h)
485
- now10 = now - 10
486
- now20 = now - 20
487
- now30 = now - 30
488
- bindings = { id: @random_id, ends: ends, starts: starts, now10: now10, now20: now20, now30: now30 }
489
- example = proc do
490
- # create gauge
491
- @client.gauges.create(id: @random_id)
492
-
493
- # push 3 values with timestamps
494
- @client.gauges.push_data(@random_id,
495
- [{ value: 1, timestamp: now30 },
496
- { value: 2, timestamp: now20 },
497
- { value: 3, timestamp: now10 }])
517
+ it 'Should create gauge definition using Hash' do
518
+ create_metric_using_hash @client.gauges, @random_id, @tenant
519
+ end
498
520
 
499
- data = @client.gauges.get_data(@random_id)
500
- expect(data.size).to be 3
521
+ it 'Should push metric data to non-existing gauge' do
522
+ push_data_to_non_existing_metric @client.gauges, { value: 3.1415926 }, @random_id
523
+ end
501
524
 
502
- # push one value without timestamp (which means now)
503
- @client.gauges.push_data(@random_id, value: 4)
504
- data = @client.gauges.get_data(@random_id)
505
- expect(data.size).to be 4
525
+ # let's do the recording manually
526
+ it 'Should push metric data to existing gauge', :skip_auto_vcr do
527
+ now = @client.now
528
+ ends = now - t4h
529
+ starts = now - (2 * t4h)
530
+ now10 = now - 10
531
+ now20 = now - 20
532
+ now30 = now - 30
533
+ bindings = { id: @random_id, ends: ends, starts: starts, now10: now10, now20: now20, now30: now30 }
534
+ example = proc do
535
+ # create gauge
536
+ @client.gauges.create(id: @random_id)
537
+
538
+ # push 3 values with timestamps
539
+ @client.gauges.push_data(@random_id,
540
+ [{ value: 1, timestamp: now30 },
541
+ { value: 2, timestamp: now20 },
542
+ { value: 3, timestamp: now10 }])
543
+
544
+ data = @client.gauges.get_data(@random_id)
545
+ expect(data.size).to be 3
546
+
547
+ # push one value without timestamp (which means now)
548
+ @client.gauges.push_data(@random_id, value: 4)
549
+ data = @client.gauges.get_data(@random_id)
550
+ expect(data.size).to be 4
551
+
552
+ # retrieve values from past
553
+ data = @client.counters.get_data(@random_id, starts: starts, ends: ends)
554
+ expect(data.empty?).to be true
555
+ end
556
+ record("Metrics/#{security_context}/#{metrics_context}",
557
+ vcr_bindings.merge(bindings),
558
+ cassette_name,
559
+ example: example)
560
+ end
506
561
 
507
- # retrieve values from past
508
- data = @client.counters.get_data(@random_id, starts: starts, ends: ends)
509
- expect(data.empty?).to be true
562
+ it 'Should update tags for gauge definition' do
563
+ update_metric_by_tags @client.gauges, @random_id
510
564
  end
511
- record("Metrics/#{metrics_context}", bindings, cassette_name, example: example)
512
- end
513
565
 
514
- it 'Should update tags for gauge definition' do
515
- update_metric_by_tags @client.gauges, @random_id
516
- end
566
+ it 'Should return periods', :skip_auto_vcr do
567
+ now = @client.now
568
+ before4h = now - t4h
569
+ minus20 = now - 20
570
+ minus30 = now - 30
571
+ bindings = { start: now, before4h: before4h, minus20: minus20, minus30: minus30 }
572
+ example = proc do
573
+ # push 3 values with timestamps
574
+ @client.gauges.push_data(@random_id, [{ value: 1, timestamp: minus30 },
575
+ { value: 2, timestamp: minus20 },
576
+ { value: 3, timestamp: now }])
517
577
 
518
- it 'Should return periods', :skip_auto_vcr do
519
- now = @client.now
520
- before4h = now - t4h
521
- minus20 = now - 20
522
- minus30 = now - 30
523
- bindings = { id: @random_id, start: now, before4h: before4h, minus20: minus20, minus30: minus30 }
524
- example = proc do
525
- # push 3 values with timestamps
526
- @client.gauges.push_data(@random_id, [{ value: 1, timestamp: minus30 },
527
- { value: 2, timestamp: minus20 },
528
- { value: 3, timestamp: now }])
529
-
530
- data = @client.gauges.get_periods(@random_id, operation: 'lte', threshold: 4, starts: before4h)
531
- expect(data.size).to be 1
532
- expect(data[0][0]).to eql(now - 30)
533
- expect(data[0][1]).to eql(now)
578
+ data = @client.gauges.get_periods(@random_id, operation: 'lte', threshold: 4, starts: before4h)
579
+ expect(data.size).to be 1
580
+ expect(data[0][0]).to eql(now - 30)
581
+ expect(data[0][1]).to eql(now)
582
+ end
583
+ record("Metrics/#{security_context}/#{metrics_context}",
584
+ vcr_bindings.merge(bindings),
585
+ cassette_name,
586
+ example: example)
534
587
  end
535
- record("Metrics/#{metrics_context}", bindings, cassette_name, example: example)
536
- end
537
588
 
538
- it 'Should return platform memory def', :skip_auto_vcr, run_for: [services_context] do
539
- # this id depends on OS and the feed id
540
- feed = 'b37ba088-6bfa-4877-83af-b3747696bfb1'
541
- mem_id = "MI~R~[#{feed}/platform~/OPERATING_SYSTEM=#{feed}_OperatingSystem/MEMORY=Memory]~MT~Total Memory"
589
+ it 'Should return platform memory def', :skip_auto_vcr, run_for: [services_context] do
590
+ bindings = { mem_id: hawkular_mem_id, tenant: hawkular_tenant_id }
591
+ example = proc do
592
+ if metrics_context == v8_context
593
+ setup_v8_client tenant: hawkular_tenant_id
594
+ else
595
+ setup_client(setup_options.merge tenant: hawkular_tenant_id)
596
+ end
542
597
 
543
- bindings = { id: @random_id, mem_id: mem_id }
544
- example = proc do
545
- tenant_id = 'hawkular'
546
- if metrics_context == v8_context
547
- setup_v8_client tenant: tenant_id
548
- else
549
- setup_client tenant: tenant_id
550
- end
598
+ data = @client.gauges.get(hawkular_mem_id)
551
599
 
552
- data = @client.gauges.get(mem_id)
600
+ expect(data).not_to be_nil
601
+ expect(data.id).not_to be_nil
602
+ expect(data.tenant_id).to eq(hawkular_tenant_id)
603
+ end
604
+ record("Metrics/#{security_context}/#{metrics_context}",
605
+ vcr_bindings.merge(bindings),
606
+ cassette_name,
607
+ example: example)
608
+ end
553
609
 
554
- expect(data).not_to be_nil
555
- expect(data.id).not_to be_nil
556
- expect(data.tenant_id).to eq(tenant_id)
610
+ it 'Should return platform memory', :skip_auto_vcr, run_for: [services_context] do
611
+ bindings = { mem_id: hawkular_mem_id, tenant: hawkular_tenant_id }
612
+ example = proc do
613
+ # this id depends on OS and the feed id
614
+ if metrics_context == v8_context
615
+ setup_v8_client tenant: tenant_id
616
+ else
617
+ setup_client(setup_options.merge tenant: hawkular_tenant_id)
618
+ end
619
+
620
+ data = @client.gauges.get_data(hawkular_mem_id)
621
+ expect(data.size).to be > 2 # needs the services to be running for more than 2 minutes
622
+ end
623
+ record("Metrics/#{security_context}/#{metrics_context}",
624
+ vcr_bindings.merge(bindings),
625
+ cassette_name,
626
+ example: example)
557
627
  end
558
- record("Metrics/#{metrics_context}", bindings, cassette_name, example: example)
559
628
  end
560
629
 
561
- it 'Should return platform memory', :skip_auto_vcr, run_for: [services_context] do
562
- # this id depends on OS and the feed id
563
- feed = 'b37ba088-6bfa-4877-83af-b3747696bfb1'
564
- mem_id = "MI~R~[#{feed}/platform~/OPERATING_SYSTEM=#{feed}_OperatingSystem/MEMORY=Memory]~MT~Total Memory"
565
-
566
- bindings = { id: @random_id, mem_id: mem_id }
567
- example = proc do
568
- tenant_id = 'hawkular'
630
+ describe 'Status' do
631
+ it 'Should return the version' do
569
632
  if metrics_context == v8_context
570
- setup_v8_client tenant: tenant_id
633
+ setup_v8_client
571
634
  else
572
- setup_client tenant: tenant_id
635
+ setup_client setup_options
573
636
  end
574
-
575
- data = @client.gauges.get_data(mem_id)
576
- expect(data.size).to be > 2 # needs the services to be running for more than 2 minutes
637
+ data = @client.fetch_version_and_status
638
+ expect(data).not_to be_nil
577
639
  end
578
- record("Metrics/#{metrics_context}", bindings, cassette_name, example: example)
579
640
  end
580
641
  end
581
-
582
- it 'Status/Should return the version' do
583
- if metrics_context == v8_context
584
- setup_v8_client
585
- else
586
- setup_client
587
- end
588
- data = @client.fetch_version_and_status
589
- expect(data).not_to be_nil
590
- end
591
642
  end
592
- end
593
643
 
594
- describe 'Metric ID with special characters' do
595
- before(:all) do
596
- setup_client(username: 'jdoe', password: 'password', tenant: 'vcr-test')
597
- end
644
+ vcr_test_tenant = "#{security_context}#{vcr_test_tenant_postfix}".freeze
598
645
 
599
- id_gauge = 'MI~R~[8b*}{\'\\14#?/5-7%92e[-c9_.r1//;/74eddf/L=c~~]~MT~ * / Met@ics~Aggre&? ated s Active" Ses;ns'
600
- id_avail = 'AA~R~[8b*}{\'\\14#?/5-7%92[d-c9_.r1///7;:4eddf/L=c~~]~MT~ A * %-Met@ics~Aggre&?ated " Sess{ons'
601
- id_counter = 'AA~R~[8b*}{\'\\14#?/5-7%92[d-c9_.r1///7;:4eddf/L=c~~]~MT~ %-Met@ics~Aggre&?ated " Sess{ons'
646
+ context security_context do
647
+ describe 'Metric ID with special characters' do
648
+ before(:all) do
649
+ setup_client(type: security_context, tenant: vcr_test_tenant)
650
+ end
602
651
 
603
- it 'Should create gauge definition' do
604
- VCR.use_cassette('Metric ID with special characters/Should create gauge definition') do
605
- create_metric_using_md @client.gauges, id_gauge
606
- end
607
- end
652
+ around(:each) do |example|
653
+ record("Metrics/#{security_context}/ID_with_special_characters",
654
+ { vcr_test_tenant: vcr_test_tenant },
655
+ example.description,
656
+ example: example)
657
+ end
608
658
 
609
- it 'Should create Availability definition' do
610
- VCR.use_cassette('Metric ID with special characters/Should create Availability definition') do
611
- create_metric_using_md @client.avail, id_avail
612
- end
613
- end
659
+ after(:all) do
660
+ record_cleanup("Metrics/#{security_context}/ID_with_special_characters")
661
+ end
614
662
 
615
- it 'Should create Counter definition' do
616
- VCR.use_cassette('Metric ID with special characters/Should create Counter definition') do
617
- create_metric_using_md @client.counters, id_counter
618
- end
619
- end
663
+ id_gauge = 'MI~R~[8b*}{\'\\14#?/5-7%92e[-c9_.r1//;/74eddf/L=c~~]~MT~ * /'\
664
+ ' Met@ics~Aggre&? ated s Active" Ses;ns'
665
+ id_avail = 'AA~R~[8b*}{\'\\14#?/5-7%92[d-c9_.r1///7;:4eddf/L=c~~]~MT~ A * %-Met@ics~Aggre&?ated " Sess{ons'
666
+ id_counter = 'AA~R~[8b*}{\'\\14#?/5-7%92[d-c9_.r1///7;:4eddf/L=c~~]~MT~ %-Met@ics~Aggre&?ated " Sess{ons'
620
667
 
621
- it 'Should push metric data to existing gauge' do
622
- VCR.use_cassette('Metric ID with special characters/Should push metric data to existing gauge') do
623
- @client.gauges.push_data(id_gauge, [
624
- { value: 0.1, tags: { tagName: 'myMin' } },
625
- { value: 99.9, tags: { tagName: 'myMax' } }
626
- ])
627
- end
628
- end
668
+ it 'Should create gauge definition' do
669
+ create_metric_using_md @client.gauges, id_gauge
670
+ end
629
671
 
630
- it 'Should update tags for gauge definition' do
631
- VCR.use_cassette('Metric ID with special characters/Should update tags for gauge definition') do
632
- deff = @client.gauges.get(id_gauge)
633
- deff.tags = {
634
- name1: 'value1',
635
- name2: 'value2',
636
- name3: 'value3'
637
- }
638
- @client.gauges.update_tags(deff)
639
- deff_updated = @client.gauges.get(id_gauge)
640
- expected_result = {
641
- 'name1' => 'value1',
642
- 'name2' => 'value2',
643
- 'name3' => 'value3',
644
- 'tag' => 'value'
645
- }
646
- expect(deff_updated.tags).to eq(expected_result)
647
- end
648
- end
672
+ it 'Should create Availability definition' do
673
+ create_metric_using_md @client.avail, id_avail
674
+ end
649
675
 
650
- it 'Should update tags for Availability definition' do
651
- VCR.use_cassette('Metric ID with special characters/Should update tags for Availability definition') do
652
- deff_avail = @client.avail.get(id_avail)
653
- deff_avail.tags = {
654
- name1: 'value1',
655
- name2: 'value2',
656
- name3: 'value3'
657
- }
658
- @client.avail.update_tags(deff_avail)
659
- deff_avail_updated = @client.avail.get(id_avail)
660
- expected_result = {
661
- 'name1' => 'value1',
662
- 'name2' => 'value2',
663
- 'name3' => 'value3',
664
- 'tag' => 'value'
665
- }
666
- expect(deff_avail_updated.tags).to eq(expected_result)
667
- end
668
- end
676
+ it 'Should create Counter definition' do
677
+ create_metric_using_md @client.counters, id_counter
678
+ end
669
679
 
670
- it 'Get metric definition by id' do
671
- VCR.use_cassette('Metric ID with special characters/Get metric definition by id') do
672
- @client.gauges.get(id_gauge)
673
- end
674
- end
680
+ it 'Should push metric data to existing gauge' do
681
+ @client.gauges.push_data(id_gauge, [
682
+ { value: 0.1, tags: { tagName: 'myMin' } },
683
+ { value: 99.9, tags: { tagName: 'myMax' } }
684
+ ])
685
+ end
675
686
 
676
- it 'Retrieve metric rate points' do
677
- VCR.use_cassette('Metric ID with special characters/Retrieve metric rate points') do
678
- @client.gauges.get(id_gauge)
679
- @client.counters.get_rate id_counter
687
+ it 'Should update tags for gauge definition' do
688
+ deff = @client.gauges.get(id_gauge)
689
+ deff.tags = {
690
+ name1: 'value1',
691
+ name2: 'value2',
692
+ name3: 'value3'
693
+ }
694
+ @client.gauges.update_tags(deff)
695
+ deff_updated = @client.gauges.get(id_gauge)
696
+ expected_result = {
697
+ 'name1' => 'value1',
698
+ 'name2' => 'value2',
699
+ 'name3' => 'value3',
700
+ 'tag' => 'value'
701
+ }
702
+ expect(deff_updated.tags).to eq(expected_result)
703
+ end
704
+
705
+ it 'Should update tags for Availability definition' do
706
+ deff_avail = @client.avail.get(id_avail)
707
+ deff_avail.tags = {
708
+ name1: 'value1',
709
+ name2: 'value2',
710
+ name3: 'value3'
711
+ }
712
+ @client.avail.update_tags(deff_avail)
713
+ deff_avail_updated = @client.avail.get(id_avail)
714
+ expected_result = {
715
+ 'name1' => 'value1',
716
+ 'name2' => 'value2',
717
+ 'name3' => 'value3',
718
+ 'tag' => 'value'
719
+ }
720
+ expect(deff_avail_updated.tags).to eq(expected_result)
721
+ end
722
+
723
+ it 'Get metric definition by id' do
724
+ @client.gauges.get(id_gauge)
725
+ end
726
+
727
+ it 'Retrieve metric rate points' do
728
+ @client.gauges.get(id_gauge)
729
+ @client.counters.get_rate id_counter
730
+ end
680
731
  end
681
732
  end
682
733
  end