diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a1ed65ebd26..2063c1f31be 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,6 +17,7 @@ jobs: matrix: ruby-version: - '2.7' + - '3.0' test-suite: - vmdb - security diff --git a/Gemfile b/Gemfile index cbb1dbc19ce..b2c4759af09 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ -raise "Ruby versions < 2.6.0 are unsupported!" if RUBY_VERSION < "2.6.0" -raise "Ruby versions >= 3.0.0 are unsupported!" if RUBY_VERSION >= "3.0.0" +raise "Ruby versions < 2.7.0 are unsupported!" if RUBY_VERSION < "2.7.0" +raise "Ruby versions >= 3.1.0 are unsupported!" if RUBY_VERSION >= "3.1.0" source 'https://rubygems.org' @@ -72,6 +72,7 @@ gem "ripper_ruby_parser", "~>1.5.1", :require => false gem "ruby-progressbar", "~>1.7.0", :require => false gem "rubyzip", "~>2.0.0", :require => false gem "rugged", "~>1.5.0", :require => false +gem "ruport", "~>1.8.0" gem "snmp", "~>1.2.0", :require => false gem "sprockets", "~>3.7.2", :require => false gem "sync", "~>0.5", :require => false @@ -85,7 +86,6 @@ gem "mime-types", "~>3.0", :require => false, # Modified gems (forked on Github) gem "handsoap", "=0.2.5.5", :require => false, :source => "https://rubygems.manageiq.org" # for manageiq-gems-pending only -gem "ruport", "=1.7.0.3", :source => "https://rubygems.manageiq.org" # In 1.9.3: Time.parse uses british version dd/mm/yyyy instead of american version mm/dd/yyyy # american_date fixes this to be compatible with 1.8.7 until all callers can be converted to the 1.9.3 format prior to parsing. @@ -257,7 +257,7 @@ group :ui_dependencies do # Added to Bundler.require in config/application.rb manageiq_plugin "manageiq-decorators" manageiq_plugin "manageiq-ui-classic" # Modified gems (forked on Github) - gem "jquery-rjs", "=0.1.1.2", :source => "https://rubygems.manageiq.org" + gem "jquery-rjs", "=0.1.1.3", :source => "https://rubygems.manageiq.org" end group :web_server, :manageiq_default do diff --git a/spec/lib/acts_as_ar_model_spec.rb b/spec/lib/acts_as_ar_model_spec.rb index 935c507cf12..e043bbe1906 100644 --- a/spec/lib/acts_as_ar_model_spec.rb +++ b/spec/lib/acts_as_ar_model_spec.rb @@ -61,7 +61,7 @@ end it "supports where (as an example)" do - expect(base_class).to receive(:find).with(:all, :conditions => {:id => 5}).and_return([]) + expect(base_class).to receive(:find).with(:all, {:conditions => {:id => 5}}).and_return([]) expect(base_class.all.where(:id => 5).to_a).to eq([]) end end diff --git a/spec/lib/rbac/filterer_spec.rb b/spec/lib/rbac/filterer_spec.rb index 873b7f7201d..f873ac107f4 100644 --- a/spec/lib/rbac/filterer_spec.rb +++ b/spec/lib/rbac/filterer_spec.rb @@ -652,7 +652,7 @@ def combine_filtered_ids(user_filtered_ids, belongsto_filtered_ids, managed_filt end it "includes references" do - expect(subject).to receive(:include_references).with(anything, ::Vm, nil, :host => {}) + expect(subject).to receive(:include_references).with(anything, ::Vm, nil, {:host => {}}) .and_call_original expect(subject).to receive(:warn).never results @@ -2482,7 +2482,7 @@ def get_rbac_results_for_and_expect_objects(klass, expected_objects) end it "support aaarm object" do - expect(VimPerformanceTrend).to receive(:find).with(:all, :include => {:a => {}}).and_return([:good]) + expect(VimPerformanceTrend).to receive(:find).with(:all, {:include => {:a => {}}}).and_return([:good]) expect(described_class.filtered(VimPerformanceTrend, :include_for_find => {:a => {}}).to_a).to match_array([:good]) end diff --git a/spec/models/authenticator/database_spec.rb b/spec/models/authenticator/database_spec.rb index 6012de54698..4f59b1c15e1 100644 --- a/spec/models/authenticator/database_spec.rb +++ b/spec/models/authenticator/database_spec.rb @@ -39,16 +39,16 @@ def authenticate end it "records two successful audit entries" do - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_database', - :userid => 'alice', - :message => "User alice successfully validated by EVM", - ) - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_database', - :userid => 'alice', - :message => "Authentication successful for user alice", - ) + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_database', + :userid => 'alice', + :message => "User alice successfully validated by EVM", + }) + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_database', + :userid => 'alice', + :message => "Authentication successful for user alice", + }) expect(AuditEvent).not_to receive(:failure) authenticate end @@ -92,11 +92,11 @@ def authenticate end it "records one failing audit entry" do - expect(AuditEvent).to receive(:failure).with( - :event => 'authenticate_database', - :userid => 'alice', - :message => "Authentication failed for userid alice", - ) + expect(AuditEvent).to receive(:failure).with({ + :event => 'authenticate_database', + :userid => 'alice', + :message => "Authentication failed for userid alice", + }) expect(AuditEvent).not_to receive(:success) authenticate rescue nil end @@ -122,11 +122,11 @@ def authenticate end it "records one failing audit entry" do - expect(AuditEvent).to receive(:failure).with( - :event => 'authenticate_database', - :userid => 'bob', - :message => "Authentication failed for userid bob", - ) + expect(AuditEvent).to receive(:failure).with({ + :event => 'authenticate_database', + :userid => 'bob', + :message => "Authentication failed for userid bob", + }) expect(AuditEvent).not_to receive(:success) authenticate rescue nil end @@ -146,16 +146,16 @@ def authenticate end it "records two successful audit entries" do - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_database', - :userid => 'vincent', - :message => "User vincent successfully validated by EVM", - ) - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_database', - :userid => 'vincent', - :message => "Authentication successful for user vincent", - ) + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_database', + :userid => 'vincent', + :message => "User vincent successfully validated by EVM", + }) + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_database', + :userid => 'vincent', + :message => "Authentication successful for user vincent", + }) expect(AuditEvent).not_to receive(:failure) authenticate end diff --git a/spec/models/authenticator/httpd_spec.rb b/spec/models/authenticator/httpd_spec.rb index b4cc71ee06a..4a00e541c44 100644 --- a/spec/models/authenticator/httpd_spec.rb +++ b/spec/models/authenticator/httpd_spec.rb @@ -181,16 +181,16 @@ def authenticate end it "records two successful audit entries" do - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_httpd', - :userid => username, - :message => "User alice successfully validated by External httpd", - ).and_call_original - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_httpd', - :userid => username, - :message => "Authentication successful for user alice", - ).and_call_original + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_httpd', + :userid => username, + :message => "User alice successfully validated by External httpd", + }).and_call_original + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_httpd', + :userid => username, + :message => "Authentication successful for user alice", + }).and_call_original expect(AuditEvent).not_to receive(:failure) authenticate end @@ -209,16 +209,16 @@ def authenticate end it "records two successful audit entries" do - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_httpd', - :userid => username, - :message => "User alice successfully validated by External httpd", - ).and_call_original - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_httpd', - :userid => username, - :message => "Authentication successful for user alice", - ).and_call_original + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_httpd', + :userid => username, + :message => "User alice successfully validated by External httpd", + }).and_call_original + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_httpd', + :userid => username, + :message => "Authentication successful for user alice", + }).and_call_original expect(AuditEvent).not_to receive(:failure) authenticate end @@ -254,16 +254,16 @@ def authenticate end it "records two successful audit entries" do - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_httpd', - :userid => 'häåğēn.däzş', - :message => "User häåğēn.däzş successfully validated by External httpd", - ).and_call_original - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_httpd', - :userid => 'häåğēn.däzş', - :message => "Authentication successful for user häåğēn.däzş", - ).and_call_original + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_httpd', + :userid => 'häåğēn.däzş', + :message => "User häåğēn.däzş successfully validated by External httpd", + }).and_call_original + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_httpd', + :userid => 'häåğēn.däzş', + :message => "Authentication successful for user häåğēn.däzş", + }).and_call_original expect(AuditEvent).not_to receive(:failure) authenticate end @@ -282,16 +282,16 @@ def authenticate end it "records two successful audit entries" do - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_httpd', - :userid => 'häåğēn.däzş', - :message => "User häåğēn.däzş successfully validated by External httpd", - ).and_call_original - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_httpd', - :userid => 'häåğēn.däzş', - :message => "Authentication successful for user häåğēn.däzş", - ).and_call_original + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_httpd', + :userid => 'häåğēn.däzş', + :message => "User häåğēn.däzş successfully validated by External httpd", + }).and_call_original + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_httpd', + :userid => 'häåğēn.däzş', + :message => "Authentication successful for user häåğēn.däzş", + }).and_call_original expect(AuditEvent).not_to receive(:failure) authenticate end @@ -316,11 +316,11 @@ def authenticate end it "records one failing audit entry" do - expect(AuditEvent).to receive(:failure).with( - :event => 'authenticate_httpd', - :userid => '', - :message => "Authentication failed for userid ", - ).and_call_original + expect(AuditEvent).to receive(:failure).with({ + :event => 'authenticate_httpd', + :userid => '', + :message => "Authentication failed for userid ", + }).and_call_original expect(AuditEvent).not_to receive(:success) authenticate rescue nil end @@ -329,11 +329,11 @@ def authenticate let(:headers) { super().merge('X-External-Auth-Error' => 'because reasons') } it "reflects in the audit message" do - expect(AuditEvent).to receive(:failure).with( - :event => 'authenticate_httpd', - :userid => '', - :message => "Authentication failed for userid : because reasons", - ).and_call_original + expect(AuditEvent).to receive(:failure).with({ + :event => 'authenticate_httpd', + :userid => '', + :message => "Authentication failed for userid : because reasons", + }).and_call_original authenticate rescue nil end end @@ -342,11 +342,11 @@ def authenticate let(:headers) { super().merge('X-External-Auth-Error' => 'töø dëlıçiouş') } it "reflects in the audit message" do - expect(AuditEvent).to receive(:failure).with( - :event => 'authenticate_httpd', - :userid => '', - :message => "Authentication failed for userid : töø dëlıçiouş", - ).and_call_original + expect(AuditEvent).to receive(:failure).with({ + :event => 'authenticate_httpd', + :userid => '', + :message => "Authentication failed for userid : töø dëlıçiouş", + }).and_call_original authenticate rescue nil end end @@ -360,11 +360,11 @@ def authenticate end it "records one failing audit entry" do - expect(AuditEvent).to receive(:failure).with( - :event => 'authenticate_httpd', - :userid => '', - :message => "Authentication failed for userid ", - ).and_call_original + expect(AuditEvent).to receive(:failure).with({ + :event => 'authenticate_httpd', + :userid => '', + :message => "Authentication failed for userid ", + }).and_call_original expect(AuditEvent).not_to receive(:success) authenticate rescue nil end @@ -373,11 +373,11 @@ def authenticate let(:headers) { super().merge('X-External-Auth-Error' => 'because reasons') } it "reflects in the audit message" do - expect(AuditEvent).to receive(:failure).with( - :event => 'authenticate_httpd', - :userid => '', - :message => "Authentication failed for userid : because reasons", - ).and_call_original + expect(AuditEvent).to receive(:failure).with({ + :event => 'authenticate_httpd', + :userid => '', + :message => "Authentication failed for userid : because reasons", + }).and_call_original authenticate rescue nil end end @@ -386,11 +386,11 @@ def authenticate let(:headers) { super().merge('X-External-Auth-Error' => 'töø dëlıçiouş') } it "reflects in the audit message" do - expect(AuditEvent).to receive(:failure).with( - :event => 'authenticate_httpd', - :userid => '', - :message => "Authentication failed for userid : töø dëlıçiouş", - ).and_call_original + expect(AuditEvent).to receive(:failure).with({ + :event => 'authenticate_httpd', + :userid => '', + :message => "Authentication failed for userid : töø dëlıçiouş", + }).and_call_original authenticate rescue nil end end @@ -495,16 +495,16 @@ def authenticate end it "records one successful and one failing audit entry" do - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_httpd', - :userid => 'bob', - :message => "User bob successfully validated by External httpd", - ).and_call_original - expect(AuditEvent).to receive(:failure).with( - :event => 'authenticate_httpd', - :userid => 'bob', - :message => "User bob authenticated but not defined in EVM", - ).and_call_original + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_httpd', + :userid => 'bob', + :message => "User bob successfully validated by External httpd", + }).and_call_original + expect(AuditEvent).to receive(:failure).with({ + :event => 'authenticate_httpd', + :userid => 'bob', + :message => "User bob authenticated but not defined in EVM", + }).and_call_original authenticate rescue nil end it "logs the failure" do @@ -523,22 +523,22 @@ def authenticate end it "records three successful audit entries" do - expect(AuditEvent).to receive(:success).with( - :event => 'authorize', - :userid => 'bob', - :message => "User creation successful for User: Bob Builderson with ID: bob@example.com", - ).and_call_original - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_httpd', - :userid => 'bob', - :message => "User bob successfully validated by External httpd", - ).and_call_original - - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_httpd', - :userid => 'bob', - :message => "Authentication successful for user bob", - ).and_call_original + expect(AuditEvent).to receive(:success).with({ + :event => 'authorize', + :userid => 'bob', + :message => "User creation successful for User: Bob Builderson with ID: bob@example.com", + }).and_call_original + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_httpd', + :userid => 'bob', + :message => "User bob successfully validated by External httpd", + }).and_call_original + + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_httpd', + :userid => 'bob', + :message => "Authentication successful for user bob", + }).and_call_original expect(AuditEvent).not_to receive(:failure) authenticate end @@ -564,26 +564,26 @@ def authenticate end it "records three successful audit entries plus one failure" do - expect(AuditEvent).to receive(:success).with( - :event => 'authorize', - :userid => 'bob', - :message => "User creation successful for User: Bob Builderson with ID: bob@example.com", - ).and_call_original - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_httpd', - :userid => 'bob', - :message => "User bob successfully validated by External httpd", - ).and_call_original - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_httpd', - :userid => 'bob', - :message => "Authentication successful for user bob", - ).and_call_original - expect(AuditEvent).to receive(:failure).with( - :event => 'authorize', - :userid => 'bob', - :message => "Authentication failed for userid bob@example.com, unable to match user's group membership to an EVM role", - ).and_call_original + expect(AuditEvent).to receive(:success).with({ + :event => 'authorize', + :userid => 'bob', + :message => "User creation successful for User: Bob Builderson with ID: bob@example.com", + }).and_call_original + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_httpd', + :userid => 'bob', + :message => "User bob successfully validated by External httpd", + }).and_call_original + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_httpd', + :userid => 'bob', + :message => "Authentication successful for user bob", + }).and_call_original + expect(AuditEvent).to receive(:failure).with({ + :event => 'authorize', + :userid => 'bob', + :message => "Authentication failed for userid bob@example.com, unable to match user's group membership to an EVM role", + }).and_call_original authenticate end @@ -687,16 +687,16 @@ def authenticate let(:config) { {:httpd_role => true} } it "records two successful audit entries" do - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_httpd', - :userid => username, - :message => "User testuser successfully validated by External httpd", - ).and_call_original - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_httpd', - :userid => username, - :message => "Authentication successful for user testuser", - ).and_call_original + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_httpd', + :userid => username, + :message => "User testuser successfully validated by External httpd", + }).and_call_original + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_httpd', + :userid => username, + :message => "Authentication successful for user testuser", + }).and_call_original expect(AuditEvent).not_to receive(:failure) authenticate end diff --git a/spec/models/authenticator/ldap_spec.rb b/spec/models/authenticator/ldap_spec.rb index ae3251cbc41..62cf79e83a5 100644 --- a/spec/models/authenticator/ldap_spec.rb +++ b/spec/models/authenticator/ldap_spec.rb @@ -209,16 +209,16 @@ def authenticate end it "records two successful audit entries" do - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_ldap', - :userid => 'alice', - :message => "User alice successfully validated by LDAP", - ) - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_ldap', - :userid => 'alice', - :message => "Authentication successful for user alice", - ) + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_ldap', + :userid => 'alice', + :message => "User alice successfully validated by LDAP", + }) + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_ldap', + :userid => 'alice', + :message => "Authentication successful for user alice", + }) expect(AuditEvent).not_to receive(:failure) authenticate end @@ -254,16 +254,16 @@ def authenticate end it "records three successful audit entries" do - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_ldap', - :userid => 'alice', - :message => "User alice successfully validated by LDAP", - ) - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_ldap', - :userid => 'alice', - :message => "Authentication successful for user alice", - ) + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_ldap', + :userid => 'alice', + :message => "User alice successfully validated by LDAP", + }) + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_ldap', + :userid => 'alice', + :message => "Authentication successful for user alice", + }) expect(AuditEvent).not_to receive(:failure) authenticate end @@ -310,11 +310,11 @@ def authenticate end it "records one failing audit entry" do - expect(AuditEvent).to receive(:failure).with( - :event => 'authenticate_ldap', - :userid => 'alice', - :message => "Authentication failed for userid alice", - ) + expect(AuditEvent).to receive(:failure).with({ + :event => 'authenticate_ldap', + :userid => 'alice', + :message => "Authentication failed for userid alice", + }) expect(AuditEvent).not_to receive(:success) authenticate rescue nil end @@ -339,11 +339,11 @@ def authenticate end it "records one failing audit entry" do - expect(AuditEvent).to receive(:failure).with( - :event => 'authenticate_ldap', - :userid => 'bob', - :message => "Authentication failed for userid bob", - ) + expect(AuditEvent).to receive(:failure).with({ + :event => 'authenticate_ldap', + :userid => 'bob', + :message => "Authentication failed for userid bob", + }) expect(AuditEvent).not_to receive(:success) authenticate rescue nil end @@ -360,16 +360,16 @@ def authenticate end it "records one successful and one failing audit entry" do - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_ldap', - :userid => 'bob', - :message => "User bob successfully validated by LDAP", - ) - expect(AuditEvent).to receive(:failure).with( - :event => 'authenticate_ldap', - :userid => 'bob', - :message => "User bob authenticated but not defined in EVM", - ) + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_ldap', + :userid => 'bob', + :message => "User bob successfully validated by LDAP", + }) + expect(AuditEvent).to receive(:failure).with({ + :event => 'authenticate_ldap', + :userid => 'bob', + :message => "User bob authenticated but not defined in EVM", + }) authenticate rescue nil end it "logs the failure" do @@ -386,16 +386,16 @@ def authenticate end it "records two successful audit entries" do - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_ldap', - :userid => 'bob', - :message => "User bob successfully validated by LDAP", - ) - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_ldap', - :userid => 'bob', - :message => "Authentication successful for user bob", - ) + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_ldap', + :userid => 'bob', + :message => "User bob successfully validated by LDAP", + }) + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_ldap', + :userid => 'bob', + :message => "Authentication successful for user bob", + }) expect(AuditEvent).not_to receive(:failure) authenticate end @@ -424,21 +424,21 @@ def authenticate end it "records three successful audit entries" do - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_ldap', - :userid => 'bob', - :message => "User bob successfully validated by LDAP", - ) - expect(AuditEvent).to receive(:success).with( - :event => 'authorize', - :userid => 'bob', - :message => "User creation successful for User: Bob Builderson with ID: bob", - ) - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_ldap', - :userid => 'bob', - :message => "Authentication successful for user bob", - ) + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_ldap', + :userid => 'bob', + :message => "User bob successfully validated by LDAP", + }) + expect(AuditEvent).to receive(:success).with({ + :event => 'authorize', + :userid => 'bob', + :message => "User creation successful for User: Bob Builderson with ID: bob", + }) + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_ldap', + :userid => 'bob', + :message => "Authentication successful for user bob", + }) expect(AuditEvent).not_to receive(:failure) authenticate end @@ -464,26 +464,26 @@ def authenticate end it "records three successful audit entries plus one failure" do - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_ldap', - :userid => 'bob', - :message => "User bob successfully validated by LDAP", - ) - expect(AuditEvent).to receive(:success).with( - :event => 'authorize', - :userid => 'bob', - :message => "User creation successful for User: Bob Builderson with ID: bob", - ) - expect(AuditEvent).to receive(:success).with( - :event => 'authenticate_ldap', - :userid => 'bob', - :message => "Authentication successful for user bob", - ) - expect(AuditEvent).to receive(:failure).with( - :event => 'authorize', - :userid => 'bob', - :message => "Authentication failed for userid bob, unable to match user's group membership to an EVM role", - ) + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_ldap', + :userid => 'bob', + :message => "User bob successfully validated by LDAP", + }) + expect(AuditEvent).to receive(:success).with({ + :event => 'authorize', + :userid => 'bob', + :message => "User creation successful for User: Bob Builderson with ID: bob", + }) + expect(AuditEvent).to receive(:success).with({ + :event => 'authenticate_ldap', + :userid => 'bob', + :message => "Authentication successful for user bob", + }) + expect(AuditEvent).to receive(:failure).with({ + :event => 'authorize', + :userid => 'bob', + :message => "Authentication failed for userid bob, unable to match user's group membership to an EVM role", + }) authenticate end diff --git a/spec/models/firmware_registry_spec.rb b/spec/models/firmware_registry_spec.rb index 61eacbce6e1..5d6b5f836f9 100644 --- a/spec/models/firmware_registry_spec.rb +++ b/spec/models/firmware_registry_spec.rb @@ -72,7 +72,7 @@ it 'creates registry and triggers refresh' do expect(FirmwareRegistry::RestApiDepot).to receive(:validate_options) { |options| options } - expect(FirmwareRegistry::RestApiDepot).to receive(:do_create_firmware_registry).with(:a => 'A').and_return(registry) + expect(FirmwareRegistry::RestApiDepot).to receive(:do_create_firmware_registry).with({:a => 'A'}).and_return(registry) expect(registry).to receive(:sync_fw_binaries_queue) described_class.create_firmware_registry(:type => 'FirmwareRegistry::RestApiDepot', :a => 'A') end diff --git a/spec/models/manageiq/providers/inventory/persister/local_db_finders_spec.rb b/spec/models/manageiq/providers/inventory/persister/local_db_finders_spec.rb index 54936ca33d8..2df28d0037e 100644 --- a/spec/models/manageiq/providers/inventory/persister/local_db_finders_spec.rb +++ b/spec/models/manageiq/providers/inventory/persister/local_db_finders_spec.rb @@ -114,7 +114,7 @@ ] ) ) - network2 = persister.networks.find(:hardware => lazy_find_hardware2, :description => "public") + network2 = persister.networks.find({:hardware => lazy_find_hardware2, :description => "public"}) expect(persister.networks.index_proxy.send(:local_db_indexes)[:manager_ref].send(:index).keys).to( match_array( [ @@ -123,7 +123,7 @@ ] ) ) - network60 = persister.networks.find(:hardware => lazy_find_hardware60, :description => "public") + network60 = persister.networks.find({:hardware => lazy_find_hardware60, :description => "public"}) expect(persister.networks.index_proxy.send(:local_db_indexes)[:manager_ref].send(:index).keys).to( match_array( [ @@ -258,7 +258,7 @@ :stack => lazy_find_stack_1_11, :ems_ref => orchestration_stack_resource_data("1_11_1")[:ems_ref] }, - {:ref => :by_stack_and_ems_ref} + :ref => :by_stack_and_ems_ref ) # Assert all references are one by one @@ -345,7 +345,7 @@ ) ) - vm1 = persister.vms.find({:name => vm_data(1)[:name]}, {:ref => :by_name}) + vm1 = persister.vms.find({:name => vm_data(1)[:name]}, :ref => :by_name) expect(vm1[:ems_ref]).to eq "vm_ems_ref_1" expect(persister.vms.index_proxy.send(:local_db_indexes)[:by_name].send(:index).keys).to( @@ -369,7 +369,7 @@ ) ) - vm1 = persister.vms.find({:uid_ems => vm_data(1)[:uid_ems], :name => vm_data(1)[:name]}, {:ref => :by_uid_ems_and_name}) + vm1 = persister.vms.find({:uid_ems => vm_data(1)[:uid_ems], :name => vm_data(1)[:name]}, :ref => :by_uid_ems_and_name) expect(vm1[:ems_ref]).to eq "vm_ems_ref_1" expect(persister.vms.index_proxy.send(:local_db_indexes)[:by_uid_ems_and_name].send(:index).keys).to( diff --git a/spec/models/miq_provision_configured_system_request_spec.rb b/spec/models/miq_provision_configured_system_request_spec.rb index b25e88176c0..f4a2dd5e9c8 100644 --- a/spec/models/miq_provision_configured_system_request_spec.rb +++ b/spec/models/miq_provision_configured_system_request_spec.rb @@ -19,7 +19,7 @@ describe '.new_request_task' do it 'returns subclassed task' do - expect(ManageIQ::Providers::Foreman::ConfigurationManager::ProvisionTask).to receive(:new).with(:request_type =>'ATTRS') + expect(ManageIQ::Providers::Foreman::ConfigurationManager::ProvisionTask).to receive(:new).with({:request_type =>'ATTRS'}) described_class.new_request_task(:request_type =>'ATTRS') end end diff --git a/spec/models/miq_provision_spec.rb b/spec/models/miq_provision_spec.rb index b4dbd247050..c730fe5f6f4 100644 --- a/spec/models/miq_provision_spec.rb +++ b/spec/models/miq_provision_spec.rb @@ -197,18 +197,18 @@ :method_name => :execute_callback } allow(@pr).to receive(:approved?).and_return(true) - expect(MiqQueue).to receive(:put).with( - :class_name => 'MiqProvision', - :instance_id => @vm_prov.id, - :method_name => 'execute', - :role => 'ems_operations', - :tracking_label => tracking_label, - :msg_timeout => MiqQueue::TIMEOUT, - :queue_name => @vm_prov.my_queue_name, - :zone => @vm_prov.my_zone, - :deliver_on => nil, - :miq_callback => miq_callback - ) + expect(MiqQueue).to receive(:put).with({ + :class_name => 'MiqProvision', + :instance_id => @vm_prov.id, + :method_name => 'execute', + :role => 'ems_operations', + :tracking_label => tracking_label, + :msg_timeout => MiqQueue::TIMEOUT, + :queue_name => @vm_prov.my_queue_name, + :zone => @vm_prov.my_zone, + :deliver_on => nil, + :miq_callback => miq_callback + }) @vm_prov.execute_queue end end diff --git a/spec/models/mixins/per_ems_worker_mixin_spec.rb b/spec/models/mixins/per_ems_worker_mixin_spec.rb index d6228bb00c1..a73172fcecd 100644 --- a/spec/models/mixins/per_ems_worker_mixin_spec.rb +++ b/spec/models/mixins/per_ems_worker_mixin_spec.rb @@ -34,12 +34,12 @@ context ".start_worker_for_ems" do it "works when queue name is passed" do queue_name = "foo" - expect(@worker_class).to receive(:start_worker).with(:queue_name => queue_name) + expect(@worker_class).to receive(:start_worker).with({:queue_name => queue_name}) @worker_class.start_worker_for_ems(queue_name) end it "works when ems is passed" do - expect(@worker_class).to receive(:start_worker).with(:queue_name => @ems_queue_name) + expect(@worker_class).to receive(:start_worker).with({:queue_name => @ems_queue_name}) @worker_class.start_worker_for_ems(@ems) end end diff --git a/spec/models/orchestration_stack/retirement_management_spec.rb b/spec/models/orchestration_stack/retirement_management_spec.rb index 6002309f18a..47641e5d064 100644 --- a/spec/models/orchestration_stack/retirement_management_spec.rb +++ b/spec/models/orchestration_stack/retirement_management_spec.rb @@ -189,7 +189,7 @@ :type => "OrchestrationStack", } - expect(MiqEvent).to receive(:raise_evm_event).with(@stack, event_name, event_hash, :zone => @zone.name) + expect(MiqEvent).to receive(:raise_evm_event).with(@stack, event_name, event_hash, {:zone => @zone.name}) @stack.raise_retirement_event(event_name) end @@ -201,7 +201,7 @@ :type => "OrchestrationStack", } - expect(MiqEvent).to receive(:raise_evm_event).with(@stack, event_name, event_hash, :zone => @zone.name, :user_id => user.id, :group_id => user.current_group.id, :tenant_id => user.current_tenant.id) + expect(MiqEvent).to receive(:raise_evm_event).with(@stack, event_name, event_hash, {:zone => @zone.name, :user_id => user.id, :group_id => user.current_group.id, :tenant_id => user.current_tenant.id}) @stack.raise_retirement_event(event_name, user.userid) end diff --git a/spec/models/physical_server_provision_request_spec.rb b/spec/models/physical_server_provision_request_spec.rb index b4d01f560b4..e1c6a363243 100644 --- a/spec/models/physical_server_provision_request_spec.rb +++ b/spec/models/physical_server_provision_request_spec.rb @@ -34,7 +34,7 @@ context 'when source is ok' do it do - expect(task).to receive(:new).with(:source_id => server.id) + expect(task).to receive(:new).with({:source_id => server.id}) described_class.new_request_task(:source_id => server.id) end end diff --git a/spec/models/resource_action_workflow_spec.rb b/spec/models/resource_action_workflow_spec.rb index d9b83080775..ea36cc511c7 100644 --- a/spec/models/resource_action_workflow_spec.rb +++ b/spec/models/resource_action_workflow_spec.rb @@ -73,12 +73,12 @@ it "creates requests" do EvmSpecHelper.local_miq_server expect(subject).to receive(:make_request).and_call_original - expect(AuditEvent).to receive(:success).with( - :event => "service_reconfigure_request_created", - :target_class => "Service", - :userid => admin.userid, - :message => "Service Reconfigure requested by <#{admin.userid}> for Service:[#{target.id}]" - ) + expect(AuditEvent).to receive(:success).with({ + :event => "service_reconfigure_request_created", + :target_class => "Service", + :userid => admin.userid, + :message => "Service Reconfigure requested by <#{admin.userid}> for Service:[#{target.id}]" + }) expect(dialog_fields(@dialog)).to eq("field_1" => nil, "field_2" => nil) response = subject.submit_request(data) expect(response).to include(:errors => []) @@ -143,12 +143,12 @@ it "creates requests" do EvmSpecHelper.local_miq_server expect(subject).to receive(:make_request).and_call_original - expect(AuditEvent).to receive(:success).with( - :event => "service_reconfigure_request_created", - :target_class => "Service", - :userid => admin.userid, - :message => "Service Reconfigure requested by <#{admin.userid}> for Service:[#{target.id}]" - ) + expect(AuditEvent).to receive(:success).with({ + :event => "service_reconfigure_request_created", + :target_class => "Service", + :userid => admin.userid, + :message => "Service Reconfigure requested by <#{admin.userid}> for Service:[#{target.id}]" + }) response = subject.submit_request(data) expect(dialog_fields(@dialog)).to eq("field_1" => "new_value", "field_2" => nil) expect(response).to include(:errors => []) diff --git a/spec/models/service/retirement_management_spec.rb b/spec/models/service/retirement_management_spec.rb index 5fb6e031b70..8135715f50d 100644 --- a/spec/models/service/retirement_management_spec.rb +++ b/spec/models/service/retirement_management_spec.rb @@ -263,14 +263,14 @@ it "with string user" do event_name = 'foo' event_hash = {:userid => "admin", :service => @service, :type => "Service"} - expect(MiqEvent).to receive(:raise_evm_event).with(@service, event_name, event_hash, :user_id => User.find_by(:userid => "admin").id, :group_id => User.find_by(:userid => "admin").current_group.id, :tenant_id => User.find_by(:userid => "admin").current_tenant.id) + expect(MiqEvent).to receive(:raise_evm_event).with(@service, event_name, event_hash, {:user_id => User.find_by(:userid => "admin").id, :group_id => User.find_by(:userid => "admin").current_group.id, :tenant_id => User.find_by(:userid => "admin").current_tenant.id}) @service.raise_retirement_event(event_name, "admin") end it "with user object" do event_name = 'foo' event_hash = {:userid => user, :service => @service, :type => "Service"} - expect(MiqEvent).to receive(:raise_evm_event).with(@service, event_name, event_hash, :user_id => user.id, :group_id => user.current_group.id, :tenant_id => user.current_tenant.id) + expect(MiqEvent).to receive(:raise_evm_event).with(@service, event_name, event_hash, {:user_id => user.id, :group_id => user.current_group.id, :tenant_id => user.current_tenant.id}) @service.raise_retirement_event(event_name, user) end diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb index 9e97df5e3ce..0d8bf3121a7 100644 --- a/spec/models/service_spec.rb +++ b/spec/models/service_spec.rb @@ -927,7 +927,7 @@ def create_deep_tree "dialog_options", User.current_user, ra, - :target => service, :reconfigure => true + {:target => service, :reconfigure => true} ) service.reconfigure_dialog end diff --git a/spec/models/service_template_provision_task_spec.rb b/spec/models/service_template_provision_task_spec.rb index 9d65bdc1f91..d53f7ce3461 100644 --- a/spec/models/service_template_provision_task_spec.rb +++ b/spec/models/service_template_provision_task_spec.rb @@ -149,16 +149,17 @@ def service_resource_id(index, scaling_max) } allow(@request).to receive(:approved?).and_return(true) allow(MiqServer).to receive(:my_zone).and_return('a_zone') - expect(MiqQueue).to receive(:put).with( - :class_name => 'ServiceTemplateProvisionTask', - :instance_id => @task_0.id, - :method_name => 'execute', - :role => 'ems_operations', - :queue_name => nil, - :zone => 'a_zone', - :tracking_label => tracking_label, - :deliver_on => nil, - :miq_callback => miq_callback) + expect(MiqQueue).to receive(:put).with({ + :class_name => 'ServiceTemplateProvisionTask', + :instance_id => @task_0.id, + :method_name => 'execute', + :role => 'ems_operations', + :queue_name => nil, + :zone => 'a_zone', + :tracking_label => tracking_label, + :deliver_on => nil, + :miq_callback => miq_callback + }) @task_0.execute_queue end diff --git a/spec/models/service_template_spec.rb b/spec/models/service_template_spec.rb index 30cd5260c5a..e4535b4dd77 100644 --- a/spec/models/service_template_spec.rb +++ b/spec/models/service_template_spec.rb @@ -981,18 +981,18 @@ it "provisions a service template without errors" do expect(resource_action_workflow).to receive(:validate_dialog).and_return([]) expect(resource_action_workflow).to receive(:make_request).and_return(miq_request) - expect(resource_action_workflow).to receive(:request_options=).with( - :init_defaults => true, :provision_workflow => true - ) + expect(resource_action_workflow).to receive(:request_options=).with({ + :init_defaults => true, :provision_workflow => true + }) expect(service_template.provision_request(user, arg1, arg2)).to eq(miq_request) end it "provisions a service template with errors" do expect(resource_action_workflow).to receive(:validate_dialog).and_return(%w(Error1 Error2)) - expect(resource_action_workflow).to receive(:request_options=).with( - :init_defaults => true, :provision_workflow => true - ) + expect(resource_action_workflow).to receive(:request_options=).with({ + :init_defaults => true, :provision_workflow => true + }) expect { service_template.provision_request(user, arg1, arg2) }.to raise_error(RuntimeError) end @@ -1004,18 +1004,18 @@ it "provisions a service template without errors" do expect(resource_action_workflow).to receive(:validate_dialog).and_return([]) expect(resource_action_workflow).to receive(:make_request).and_return(miq_request) - expect(resource_action_workflow).to receive(:request_options=).with( - :initiator => 'control', :submit_workflow => true - ) + expect(resource_action_workflow).to receive(:request_options=).with({ + :initiator => 'control', :submit_workflow => true + }) expect(service_template.provision_request(user, arg1, arg2)).to eq(miq_request) end it "provisions a service template with errors" do expect(resource_action_workflow).to receive(:validate_dialog).and_return(%w(Error1 Error2)) - expect(resource_action_workflow).to receive(:request_options=).with( - :initiator => 'control', :submit_workflow => true - ) + expect(resource_action_workflow).to receive(:request_options=).with({ + :initiator => 'control', :submit_workflow => true + }) expect { service_template.provision_request(user, arg1, arg2) }.to raise_error(RuntimeError) end @@ -1027,9 +1027,9 @@ it "provisions a service template without errors" do expect(resource_action_workflow).to receive(:validate_dialog).and_return([]) expect(resource_action_workflow).to receive(:make_request).and_return(miq_request) - expect(resource_action_workflow).to receive(:request_options=).with( - :initiator => 'control', :submit_workflow => true, :parent_id => miq_automation_request.id - ) + expect(resource_action_workflow).to receive(:request_options=).with({ + :initiator => 'control', :submit_workflow => true, :parent_id => miq_automation_request.id + }) expect(service_template.provision_request(user, arg1, arg2)).to eq(miq_request) expect(miq_request.parent).to eq(miq_automation_request) @@ -1037,9 +1037,9 @@ it "provisions a service template with errors" do expect(resource_action_workflow).to receive(:validate_dialog).and_return(%w[Error1 Error2]) - expect(resource_action_workflow).to receive(:request_options=).with( - :initiator => 'control', :submit_workflow => true, :parent_id => miq_automation_request.id - ) + expect(resource_action_workflow).to receive(:request_options=).with({ + :initiator => 'control', :submit_workflow => true, :parent_id => miq_automation_request.id + }) expect { service_template.provision_request(user, arg1, arg2) }.to raise_error(RuntimeError) end @@ -1051,18 +1051,18 @@ it "provisions a service template without errors" do expect(resource_action_workflow).to receive(:validate_dialog).and_return([]) expect(resource_action_workflow).to receive(:make_request).and_return(miq_request) - expect(resource_action_workflow).to receive(:request_options=).with( - :initiator => 'control', :provision_workflow => true - ) + expect(resource_action_workflow).to receive(:request_options=).with({ + :initiator => 'control', :provision_workflow => true + }) expect(service_template.provision_request(user, arg1, arg2)).to eq(miq_request) end it "provisions a service template with errors" do expect(resource_action_workflow).to receive(:validate_dialog).and_return(%w(Error1 Error2)) - expect(resource_action_workflow).to receive(:request_options=).with( - :initiator => 'control', :provision_workflow => true - ) + expect(resource_action_workflow).to receive(:request_options=).with({ + :initiator => 'control', :provision_workflow => true + }) expect { service_template.provision_request(user, arg1, arg2) }.to raise_error(RuntimeError) end @@ -1072,14 +1072,14 @@ it "provisions a service template without errors" do expect(resource_action_workflow).to receive(:validate_dialog).and_return([]) expect(resource_action_workflow).to receive(:make_request).and_return(miq_request) - expect(resource_action_workflow).to receive(:request_options=).with(:provision_workflow => true) + expect(resource_action_workflow).to receive(:request_options=).with({:provision_workflow => true}) expect(service_template.provision_request(user, arg1)).to eq(miq_request) end it "provisions a service template with errors" do expect(resource_action_workflow).to receive(:validate_dialog).and_return(%w(Error1 Error2)) - expect(resource_action_workflow).to receive(:request_options=).with(:provision_workflow => true) + expect(resource_action_workflow).to receive(:request_options=).with({:provision_workflow => true}) expect { service_template.provision_request(user, arg1) }.to raise_error(RuntimeError) end diff --git a/spec/models/vm/retirement_management_spec.rb b/spec/models/vm/retirement_management_spec.rb index 49d7f64fff5..3dd48f27669 100644 --- a/spec/models/vm/retirement_management_spec.rb +++ b/spec/models/vm/retirement_management_spec.rb @@ -153,7 +153,7 @@ event_name = 'request_vm_retire' event_hash = {:userid => nil, :vm => @vm, :host => @vm.host, :type => "ManageIQ::Providers::Vmware::InfraManager::Vm"} - expect(MiqEvent).to receive(:raise_evm_event).with(@vm, event_name, event_hash, :zone => @zone.name).once + expect(MiqEvent).to receive(:raise_evm_event).with(@vm, event_name, event_hash, {:zone => @zone.name}).once @vm.retire_now end @@ -326,7 +326,7 @@ event_name = 'foo' event_hash = {:userid => nil, :vm => @vm, :host => @vm.host, :type => "ManageIQ::Providers::Vmware::InfraManager::Vm"} - expect(MiqEvent).to receive(:raise_evm_event).with(@vm, event_name, event_hash, :zone => @zone.name).once + expect(MiqEvent).to receive(:raise_evm_event).with(@vm, event_name, event_hash, {:zone => @zone.name}).once @vm.raise_retirement_event(event_name) end diff --git a/spec/models/vm_or_template/operations/configuration_spec.rb b/spec/models/vm_or_template/operations/configuration_spec.rb index ea052e0f2dc..36626eb0f0c 100644 --- a/spec/models/vm_or_template/operations/configuration_spec.rb +++ b/spec/models/vm_or_template/operations/configuration_spec.rb @@ -21,7 +21,7 @@ context "when storage exists" do it "adds a disk on the storage" do - expect(vm).to receive(:raw_add_disk).with(disk_name, disk_size, :datastore => storage_name).once + expect(vm).to receive(:raw_add_disk).with(disk_name, disk_size, {:datastore => storage_name}).once vm.add_disk(disk_name, disk_size, :datastore => storage_name) end end diff --git a/spec/tools/fix_auth/fix_auth_spec.rb b/spec/tools/fix_auth/fix_auth_spec.rb index f8a71f9f67f..34546c67f55 100644 --- a/spec/tools/fix_auth/fix_auth_spec.rb +++ b/spec/tools/fix_auth/fix_auth_spec.rb @@ -6,13 +6,13 @@ describe "#fix_database_yml" do it "supports --hardcode" do subject = described_class.new(:password => 'newpass', :root => '/', :databaseyml => true) - expect(FixAuth::FixDatabaseYml).to receive(:run).with(:hardcode => 'newpass') + expect(FixAuth::FixDatabaseYml).to receive(:run).with({:hardcode => 'newpass'}) subject.fix_database_yml end it "supports --password as an alias of --hardcode" do subject = described_class.new(:hardcode => 'newpass', :root => '/', :databaseyml => true) - expect(FixAuth::FixDatabaseYml).to receive(:run).with(:hardcode => 'newpass') + expect(FixAuth::FixDatabaseYml).to receive(:run).with({:hardcode => 'newpass'}) subject.fix_database_yml end end