Skip to content

Commit

Permalink
WIP test connecting to live vcsim
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Aug 27, 2024
1 parent d48e65e commit 08958ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
13 changes: 1 addition & 12 deletions spec/models/manageiq/providers/vmware/infra_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,11 @@
end

context ".verify_credentials" do
let(:verify_params) { {"endpoints" => {"default" => {"hostname" => "vcenter"}}, "authentications" => {"default" => {"username" => "root", "password" => "vmware"}}} }
let(:verify_params) { {"endpoints" => {"default" => {"hostname" => "localhost", "port" => 8989}}, "authentications" => {"default" => {"username" => "root", "password" => "vmware"}}} }
let(:current_time) { Time.now.utc.to_s }
let(:is_virtual_center) { true }
let(:api_version) { '6.5.0' }

before do
miq_vim = double("VMwareWebService/MiqVim")
allow(miq_vim).to receive(:isVirtualCenter).and_return(is_virtual_center)
allow(miq_vim).to receive(:currentTime).and_return(current_time)
allow(miq_vim).to receive(:apiVersion).and_return(api_version)
allow(miq_vim).to receive(:disconnect)

require "VMwareWebService/MiqVim"
expect(MiqVim).to receive(:new).and_return(miq_vim)
end

context "virtual-center" do
it "is successful" do
expect(described_class.verify_credentials(verify_params)).to be_truthy
Expand Down
6 changes: 6 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
end

VCR.configure do |config|
# Allow connections to a local vcsim
config.ignore_request do |req|
uri = URI(req.uri)
uri.host == "localhost" && uri.port = 8989
end

config.ignore_hosts 'codeclimate.com' if ENV['CI']
config.cassette_library_dir = File.join(ManageIQ::Providers::Vmware::Engine.root, 'spec/vcr_cassettes')

Expand Down

0 comments on commit 08958ed

Please sign in to comment.