Skip to content

Commit

Permalink
fix ae_result value.
Browse files Browse the repository at this point in the history
  • Loading branch information
tinaafitz committed Oct 23, 2015
1 parent e9c22b5 commit f142b50
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 52 deletions.
19 changes: 9 additions & 10 deletions spec/automation/unit/method_validation/calculate_limits_spec.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
require "spec_helper"
include QuotaHelper

def run_automate_method(provision_request)
attrs = []
attrs << "MiqProvisionRequest::miq_provision_request=#{provision_request.id}&" \
"MiqRequest::miq_request=#{provision_request.id}&" \
"Tenant::quota_source=#{@tenant.id}&max_cpu=3&max_vms=2&quota_source_type=tenant" if provision_request
MiqAeEngine.instantiate("/ManageIQ/system/request/Call_instance?namespace=System/CommonMethods&" \
"class=QuotaMethods&instance=limits&#{attrs.join('&')}", @user)
end

describe "Quota Validation" do
def run_automate_method(provision_request)
attrs = []
attrs << "MiqProvisionRequest::miq_provision_request=#{provision_request.id}&" \
"MiqRequest::miq_request=#{provision_request.id}&" \
"Tenant::quota_source=#{@tenant.id}&max_cpu=3&max_vms=2&quota_source_type=tenant" if provision_request
MiqAeEngine.instantiate("/ManageIQ/system/request/Call_instance?namespace=System/CommonMethods&" \
"class=QuotaMethods&instance=limits&#{attrs.join('&')}", @user)
end

before do
setup_model
setup_tags
Expand All @@ -20,7 +20,6 @@ def run_automate_method(provision_request)
ws = run_automate_method(@miq_provision_request)
root = ws.root
expect(root['quota_source']).to be_kind_of(MiqAeMethodService::MiqAeServiceTenant)
expect(root['ae_result']).to be_nil
expect(root['quota_limit_max'][:storage]).to eq(4096)
expect(root['quota_limit_max'][:cpu]).to eq(2)
expect(root['quota_limit_max'][:vms]).to eq(4)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
require "spec_helper"
include QuotaHelper

def run_automate_method(prov_req)
attrs = []
attrs << "MiqProvisionRequest::miq_provision_request=#{@miq_provision_request.id}&" \
"MiqRequest::miq_request=#{@miq_provision_request.id}&Tenant::quota_source=#{@tenant.id}" if prov_req
MiqAeEngine.instantiate("/ManageIQ/system/request/Call_Instance?namespace=System/CommonMethods&" \
"class=QuotaMethods&instance=requested&#{attrs.join('&')}", @user)
end

describe "Quota Validation" do
def run_automate_method(prov_req)
attrs = []
attrs << "MiqProvisionRequest::miq_provision_request=#{@miq_provision_request.id}&" \
"MiqRequest::miq_request=#{@miq_provision_request.id}&Tenant::quota_source=#{@tenant.id}" if prov_req
MiqAeEngine.instantiate("/ManageIQ/system/request/Call_Instance?namespace=System/CommonMethods&" \
"class=QuotaMethods&instance=requested&#{attrs.join('&')}", @user)
end

before do
setup_model
end
Expand All @@ -18,7 +18,6 @@ def run_automate_method(prov_req)
ws = run_automate_method(@miq_provision_request)
root = ws.root
expect(root['quota_source']).to be_kind_of(MiqAeMethodService::MiqAeServiceTenant)
expect(root['ae_result']).to be_nil
expect(root['quota_requested'][:storage]).to eq(512)
expect(root['quota_requested'][:cpu]).to eq(2)
expect(root['quota_requested'][:vms]).to eq(1)
Expand Down
17 changes: 8 additions & 9 deletions spec/automation/unit/method_validation/calculate_used_spec.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
require "spec_helper"
include QuotaHelper

def run_automate_method(prov_req)
attrs = []
attrs << "MiqProvisionRequest::miq_provision_request=#{@miq_provision_request.id}&" \
"MiqRequest::miq_request=#{@miq_provision_request.id}&Tenant::quota_source=#{@tenant.id}" if prov_req
MiqAeEngine.instantiate("/ManageIQ/system/request/Call_Instance?namespace=System/CommonMethods&" \
"class=QuotaMethods&instance=used&#{attrs.join('&')}", @user)
end

describe "Quota Validation" do
def run_automate_method(prov_req)
attrs = []
attrs << "MiqProvisionRequest::miq_provision_request=#{@miq_provision_request.id}&" \
"MiqRequest::miq_request=#{@miq_provision_request.id}&Tenant::quota_source=#{@tenant.id}" if prov_req
MiqAeEngine.instantiate("/ManageIQ/system/request/Call_Instance?namespace=System/CommonMethods&" \
"class=QuotaMethods&instance=used&#{attrs.join('&')}", @user)
end

before do
setup_model
end
Expand All @@ -18,7 +18,6 @@ def run_automate_method(prov_req)
ws = run_automate_method(@miq_provision_request)
root = ws.root
expect(root['quota_source']).to be_kind_of(MiqAeMethodService::MiqAeServiceTenant)
expect(root['ae_result']).to be_nil
expect(root['quota_used'][:storage]).to eq(0)
expect(root['quota_used'][:cpu]).to eq(0)
expect(root['quota_used'][:vms]).to eq(2)
Expand Down
17 changes: 8 additions & 9 deletions spec/automation/unit/method_validation/quota_source_spec.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
require "spec_helper"
include QuotaHelper

def run_automate_method(provision_request)
attrs = []
attrs << "MiqProvisionRequest::miq_provision_request=#{provision_request.id}&" \
"MiqRequest::miq_request=#{provision_request.id}" if provision_request
MiqAeEngine.instantiate("/ManageIQ/system/request/Call_Instance?namespace=System/CommonMethods&" \
"class=QuotaMethods&instance=quota_source&#{attrs.join('&')}", @user)
end

describe "Quota Validation" do
def run_automate_method(provision_request)
attrs = []
attrs << "MiqProvisionRequest::miq_provision_request=#{provision_request.id}&" \
"MiqRequest::miq_request=#{provision_request.id}" if provision_request
MiqAeEngine.instantiate("/ManageIQ/system/request/Call_Instance?namespace=System/CommonMethods&" \
"class=QuotaMethods&instance=quota_source&#{attrs.join('&')}", @user)
end

before do
setup_model
end
Expand All @@ -18,6 +18,5 @@ def run_automate_method(provision_request)
ws = run_automate_method(@miq_provision_request)
root = ws.root
expect(root['quota_source']).to be_kind_of(MiqAeMethodService::MiqAeServiceTenant)
expect(root['ae_result']).to be_nil
end
end
30 changes: 15 additions & 15 deletions spec/automation/unit/method_validation/validate_quota_spec.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
require "spec_helper"
include QuotaHelper

def run_automate_method(provision_request)
@quota_used = YAML.dump(:storage => 32_768, :vms => 2, :cpu => 2, :memory => 4096)
@quota_requested = YAML.dump(:storage => 10_240, :vms => 1, :cpu => 1, :memory => 1024)
attrs = []
attrs << "MiqProvisionRequest::miq_provision_request=#{@miq_provision_request.id}&" \
"MiqRequest::miq_request=#{@miq_provision_request.id}&" \
"quota_limit_max_yaml=#{@quota_limit_max}&" \
"quota_limit_warn_yaml=#{@quota_limit_warn}&" \
"quota_used_yaml=#{@quota_used}&" \
"Tenant::quota_source=#{@tenant.id}&" \
"quota_requested_yaml=#{@quota_requested}" if provision_request
MiqAeEngine.instantiate("/ManageIQ/system/request/Call_Instance?namespace=System/CommonMethods&" \
"class=QuotaMethods&instance=validate_quota&#{attrs.join('&')}", @user)
end

describe "Quota Validation" do
def run_automate_method(provision_request)
@quota_used = YAML.dump(:storage => 32_768, :vms => 2, :cpu => 2, :memory => 4096)
@quota_requested = YAML.dump(:storage => 10_240, :vms => 1, :cpu => 1, :memory => 1024)
attrs = []
attrs << "MiqProvisionRequest::miq_provision_request=#{@miq_provision_request.id}&" \
"MiqRequest::miq_request=#{@miq_provision_request.id}&" \
"quota_limit_max_yaml=#{@quota_limit_max}&" \
"quota_limit_warn_yaml=#{@quota_limit_warn}&" \
"quota_used_yaml=#{@quota_used}&" \
"Tenant::quota_source=#{@tenant.id}&" \
"quota_requested_yaml=#{@quota_requested}" if provision_request
MiqAeEngine.instantiate("/ManageIQ/system/request/Call_Instance?namespace=System/CommonMethods&" \
"class=QuotaMethods&instance=validate_quota&#{attrs.join('&')}", @user)
end

before do
setup_model
end
Expand Down

0 comments on commit f142b50

Please sign in to comment.