From 6d858a31100ce7e6927498db5ef45c49d6557ecd Mon Sep 17 00:00:00 2001 From: NickLaMuro Date: Mon, 26 Oct 2020 16:22:25 -0500 Subject: [PATCH] [requests/providers_spec.rb] Jansa approved spec There has been a bit of a saga with these specs: - https://github.com/ManageIQ/manageiq-api/pull/933#issuecomment-715313395 - https://github.com/ManageIQ/manageiq-api/pull/933#issuecomment-716787919 And it mostly ties in with some code that was updated for kasparov and up for `aggregate_vm_cpus`, but wasn't backported to `jansa` (which was probably the right choice). However, it caused the specs to behave differently on the two branches, and thus fail on `jansa`. The nice part about these originally is that these specs very much replicated what we were seeing here: https://github.com/ManageIQ/manageiq-api/issues/923#issuecomment-713160644 But since that isn't valid for both branches, it is better to use specs that are suited for both branches. --- spec/requests/providers_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/requests/providers_spec.rb b/spec/requests/providers_spec.rb index f417bd1307..c0ed0fb5e0 100644 --- a/spec/requests/providers_spec.rb +++ b/spec/requests/providers_spec.rb @@ -1589,6 +1589,8 @@ class DummyProvider; end context 'GET /api/providers' do context "with multiple direct virtual attributes" do + let(:api_attributes) { "name,total_vms,total_vms_and_templates" } + before do api_basic_authorize action_identifier(:providers, :read, :collection_actions, :get) @@ -1609,7 +1611,7 @@ class DummyProvider; end expect { get api_providers_url, :params => { :expand => "resources", - :attributes => "name,aggregate_vm_cpus,total_vms" + :attributes => api_attributes } }.to make_database_queries(:count => 0, :matching => query_match) end @@ -1620,7 +1622,7 @@ class DummyProvider; end expect { get api_providers_url, :params => { :expand => "resources", - :attributes => "name,aggregate_vm_cpus,total_vms" + :attributes => api_attributes } }.to make_database_queries(:count => 3, :matching => query_match) end