|
243 | 243 |
|
244 | 244 | describe "#reduce_exp" do
|
245 | 245 | let(:sql_field) { {"=" => {"field" => "Vm-name", "value" => "foo"}.freeze}.freeze }
|
246 |
| - let(:sql_field_out) { {"=" => {"field" => "Vm-name", "field-field" => MiqExpression::Field.parse("Vm-name"), "value" => "foo"}.freeze}.freeze } |
| 246 | + let(:sql_field_out) { {"=" => {"field" => "Vm-name", "field-field" => MiqExpression::Field.parse("Vm-name"), "value" => "foo", "value-field" => nil}.freeze}.freeze } |
247 | 247 | let(:ruby_field) { {"=" => {"field" => "Vm-platform", "value" => "bar"}.freeze}.freeze }
|
248 |
| - let(:ruby_field_out) { {"=" => {"field" => "Vm-platform", "field-field" => MiqExpression::Field.parse("Vm-platform"), "value" => "bar"}.freeze}.freeze } |
| 248 | + let(:ruby_field_out) { {"=" => {"field" => "Vm-platform", "field-field" => MiqExpression::Field.parse("Vm-platform"), "value" => "bar", "value-field" => nil}.freeze}.freeze } |
249 | 249 |
|
250 | 250 | context "mode: :sql" do
|
251 | 251 | it "(sql AND ruby) => (sql)" do
|
|
3017 | 3017 | end
|
3018 | 3018 | end
|
3019 | 3019 |
|
3020 |
| - describe "#sql_supports_atom?" do |
| 3020 | + describe "#sql_supports_atom? (private)" do |
3021 | 3021 | context "expression key is 'CONTAINS'" do
|
3022 | 3022 | context "operations with 'tag'" do
|
3023 | 3023 | it "returns true for tag of the main model" do
|
|
3166 | 3166 | end
|
3167 | 3167 | end
|
3168 | 3168 |
|
3169 |
| - describe "#field_in_sql?" do |
| 3169 | + describe "#field_in_sql? (private)" do |
3170 | 3170 | it "returns true for model.virtualfield (with sql)" do
|
3171 | 3171 | field = "ManageIQ::Providers::InfraManager::Vm-archived"
|
3172 | 3172 | expression = {"=" => {"field" => field, "value" => "true"}}
|
3173 |
| - expect(described_class.new(expression).field_in_sql?(field, MiqExpression::Field.parse(field))).to eq(true) |
| 3173 | + expect(described_class.new(expression).field_in_sql?(MiqExpression::Field.parse(field))).to eq(true) |
3174 | 3174 | end
|
3175 | 3175 |
|
3176 | 3176 | it "returns false for model.virtualfield (with no sql)" do
|
3177 | 3177 | field = "ManageIQ::Providers::InfraManager::Vm-uncommitted_storage"
|
3178 | 3178 | expression = {"=" => {"field" => field, "value" => "true"}}
|
3179 |
| - expect(described_class.new(expression).field_in_sql?(field, MiqExpression::Field.parse(field))).to eq(false) |
| 3179 | + expect(described_class.new(expression).field_in_sql?(MiqExpression::Field.parse(field))).to eq(false) |
3180 | 3180 | end
|
3181 | 3181 |
|
3182 | 3182 | it "returns false for model.association-virtualfield" do
|
3183 | 3183 | field = "ManageIQ::Providers::InfraManager::Vm.storage-v_used_space_percent_of_total"
|
3184 | 3184 | expression = {">=" => {"field" => field, "value" => "50"}}
|
3185 |
| - expect(described_class.new(expression).field_in_sql?(field, MiqExpression::Field.parse(field))).to eq(false) |
| 3185 | + expect(described_class.new(expression).field_in_sql?(MiqExpression::Field.parse(field))).to eq(false) |
3186 | 3186 | end
|
3187 | 3187 |
|
3188 | 3188 | it "returns true for model-field" do
|
3189 | 3189 | field = "ManageIQ::Providers::InfraManager::Vm-vendor"
|
3190 | 3190 | expression = {"=" => {"field" => field, "value" => "redhat"}}
|
3191 |
| - expect(described_class.new(expression).field_in_sql?(field, MiqExpression::Field.parse(field))).to eq(true) |
| 3191 | + expect(described_class.new(expression).field_in_sql?(MiqExpression::Field.parse(field))).to eq(true) |
3192 | 3192 | end
|
3193 | 3193 |
|
3194 | 3194 | it "returns true for model.association-field" do
|
3195 | 3195 | field = "ManageIQ::Providers::InfraManager::Vm.guest_applications-vendor"
|
3196 | 3196 | expression = {"CONTAINS" => {"field" => field, "value" => "redhat"}}
|
3197 |
| - expect(described_class.new(expression).field_in_sql?(field, MiqExpression::Field.parse(field))).to eq(true) |
| 3197 | + expect(described_class.new(expression).field_in_sql?(MiqExpression::Field.parse(field))).to eq(true) |
3198 | 3198 | end
|
3199 | 3199 |
|
3200 | 3200 | it "returns false if column excluded from processing for adhoc performance metrics" do
|
3201 | 3201 | field = "EmsClusterPerformance-cpu_usagemhz_rate_average"
|
3202 | 3202 | expression = {">=" => {"field" => field, "value" => "0"}}
|
3203 | 3203 | obj = described_class.new(expression)
|
3204 | 3204 | obj.preprocess_options = {:vim_performance_daily_adhoc => true}
|
3205 |
| - expect(obj.field_in_sql?(field, MiqExpression::Field.parse(field))).to eq(false) |
| 3205 | + expect(obj.field_in_sql?(MiqExpression::Field.parse(field))).to eq(false) |
3206 | 3206 | end
|
3207 | 3207 |
|
3208 | 3208 | it "returns true if column not excluded from processing for adhoc performance metrics" do
|
3209 | 3209 | field = "EmsClusterPerformance-derived_cpu_available"
|
3210 | 3210 | expression = {">=" => {"field" => field, "value" => "0"}}
|
3211 | 3211 | obj = described_class.new(expression)
|
3212 | 3212 | obj.preprocess_options = {:vim_performance_daily_adhoc => true}
|
3213 |
| - expect(obj.field_in_sql?(field, MiqExpression::Field.parse(field))).to eq(true) |
| 3213 | + expect(obj.field_in_sql?(MiqExpression::Field.parse(field))).to eq(true) |
3214 | 3214 | end
|
3215 | 3215 | end
|
3216 | 3216 |
|
|
0 commit comments