Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #17842 - Adds 'type = compute_resource' to Audit search #4131

Merged
merged 1 commit into from
Dec 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/models/concerns/audit_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ module AuditExtensions
scoped_search :on => :action, :complete_value => { :create => 'create', :update => 'update', :delete => 'destroy' }
scoped_search :on => :auditable_type, :complete_value => { :host => 'Host', :parameter => 'Parameter', :architecture => 'Architecture',
:puppetclass => 'Puppetclass', :os => 'Operatingsystem', :hostgroup => 'Hostgroup',
:template => "ProvisioningTemplate", :lookupvalue => 'LookupValue',
:ssh_key => 'KeyPair'}, :rename => :type
:template => "ProvisioningTemplate", :override_value => 'LookupValue',
:ssh_key => 'KeyPair', :compute_resource => 'ComputeResource'}, :rename => :type

scoped_search :relation => :search_parameters, :on => :name, :complete_value => true, :rename => :parameter, :only_explicit => true
scoped_search :relation => :search_templates, :on => :name, :complete_value => true, :rename => :template, :only_explicit => true
Expand Down
7 changes: 6 additions & 1 deletion test/models/concerns/audit_extensions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ def setup
test "search for type=lookupvalue in audit" do
key = lookup_keys(:three)
FactoryGirl.create :lookup_value, :lookup_key_id => key.id, :value => false, :match => "hostgroup=Common"
refute_empty Audit.search_for("type = lookupvalue")
refute_empty Audit.search_for("type = override_value")
end

test "search for type=compute_resource in audit" do
FactoryGirl.create(:ec2_cr)
refute_empty Audit.search_for("type = compute_resource")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert_empty before the creation please to make sure that it isn't empty because the creation added an entry.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not care if it is empty... I just want to ensure I have at least one when I search.
The purpose of this test is to ensure I can seach Audit by type=compute_resource

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also would be nice to show that you search for different compute resource types ?(e.g. that STI works correctly).

end
end