spec/integration/hawkular_client_spec.rb in hawkular-client-2.8.0 vs spec/integration/hawkular_client_spec.rb in hawkular-client-2.9.0
- old
+ new
@@ -1,7 +1,8 @@
-require "#{File.dirname(__FILE__)}/../vcr/vcr_setup"
-require "#{File.dirname(__FILE__)}/../spec_helper"
+require_relative '../vcr/vcr_setup'
+require_relative '../spec_helper'
+
require 'securerandom'
# examples that tests the main client which delegates all the calls to Hawkular component clients
module Hawkular::Client::RSpec
HOST = 'http://localhost:8080'
@@ -14,10 +15,12 @@
}
::RSpec::Mocks.with_temporary_scope do
mock_inventory_client '0.17.2.Final'
mock_metrics_version
@hawkular_client = Hawkular::Client.new(entrypoint: HOST, credentials: @creds, options: { tenant: 'hawkular' })
+ @hawkular_client.inventory
+ @hawkular_client.metrics
end
@state = {
hostname: 'localhost.localdomain',
feed: nil
}
@@ -28,11 +31,11 @@
@creds = {
username: '-XX-X-jdoe-X',
password: 'password'
}
expect do
- Hawkular::Client.new(entrypoint: HOST, credentials: @creds)
+ Hawkular::Client.new(entrypoint: HOST, credentials: @creds).inventory_list_feeds
end.to raise_error(Hawkular::BaseClient::HawkularException, 'Unauthorized')
end
end
it 'Should fail when calling method with unknown prefix' do
@@ -81,13 +84,13 @@
context 'and Inventory client', vcr: { decode_compressed_response: true } do
before(:all) do
::RSpec::Mocks.with_temporary_scope do
mock_inventory_client '0.17.2.Final'
- @client = Hawkular::Inventory::InventoryClient.create(entrypoint: HOST,
- credentials: @creds,
- options: { tenant: 'hawkular' })
+ @client = Hawkular::Inventory::Client.create(entrypoint: HOST,
+ credentials: @creds,
+ options: { tenant: 'hawkular' })
end
end
it 'Should list the same feeds' do
feeds1 = @client.list_feeds
@@ -247,10 +250,10 @@
operationName: 'Redeploy',
resourcePath: path.to_s
}
actual_data = {}
- client = Hawkular::Operations::OperationsClient.new(entrypoint: HOST, credentials: @creds)
+ client = Hawkular::Operations::Client.new(entrypoint: HOST, credentials: @creds)
client.invoke_generic_operation(redeploy) do |on|
on.success do |data|
actual_data[:data] = data
end
on.failure do |error|