diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 803aac595..7b11eceae 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,6 +25,10 @@ jobs: --health-retries 5" ports: - 5432:5432 + vcsim: + image: vmware/vcsim + ports: + - 8989:8989 env: PGHOST: localhost PGPASSWORD: smartvm diff --git a/spec/models/manageiq/providers/vmware/infra_manager_spec.rb b/spec/models/manageiq/providers/vmware/infra_manager_spec.rb index 44c86e988..76fec0b75 100644 --- a/spec/models/manageiq/providers/vmware/infra_manager_spec.rb +++ b/spec/models/manageiq/providers/vmware/infra_manager_spec.rb @@ -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 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0add26cf6..3e7cce125 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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')