Skip to content

Commit

Permalink
Adapt Rails tests to model changes
Browse files Browse the repository at this point in the history
* Split quota stubbing in utilization and missing hosts for better testing
* Adapt ResourceQuota Tests and leverage new factory option
  :with_existing_host_resources
* Adapt Host::Managed tests and add host_resources cases
  • Loading branch information
bastian-src committed Nov 19, 2024
1 parent cb7883e commit ff9fa39
Show file tree
Hide file tree
Showing 4 changed files with 284 additions and 189 deletions.
4 changes: 2 additions & 2 deletions test/controllers/api/v2/resource_quotas_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def setup

test 'should show utilization' do
exp_utilization = { cpu_cores: 10, memory_mb: 20 }
stub_quota_utilization(exp_utilization, {})
stub_quota_utilization(exp_utilization)
get :utilization, params: { resource_quota_id: @quota.id }, session: set_session_user
assert_response :success
show_response = ActiveSupport::JSON.decode(@response.body)
Expand All @@ -134,7 +134,7 @@ def setup

test 'should show missing_hosts' do
exp_missing_hosts = { 'some_host' => %i[cpu_cores memory_mb] }
stub_quota_utilization({}, exp_missing_hosts)
stub_quota_missing_hosts(exp_missing_hosts)
get :missing_hosts, params: { resource_quota_id: @quota.id }, session: set_session_user
assert_response :success
show_response = ActiveSupport::JSON.decode(@response.body)
Expand Down
Loading

0 comments on commit ff9fa39

Please sign in to comment.