diff options
Diffstat (limited to 'spec/functional/event_loggers/windows_eventlog_spec.rb')
-rw-r--r-- | spec/functional/event_loggers/windows_eventlog_spec.rb | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/spec/functional/event_loggers/windows_eventlog_spec.rb b/spec/functional/event_loggers/windows_eventlog_spec.rb index 0723e7b984..cfab3763e1 100644 --- a/spec/functional/event_loggers/windows_eventlog_spec.rb +++ b/spec/functional/event_loggers/windows_eventlog_spec.rb @@ -16,11 +16,11 @@ # limitations under the License. # -require 'spec_helper' -require 'securerandom' -require 'chef/event_loggers/windows_eventlog' +require "spec_helper" +require "securerandom" +require "chef/event_loggers/windows_eventlog" if Chef::Platform.windows? and not Chef::Platform::windows_server_2003? - require 'win32/eventlog' + require "win32/eventlog" include Win32 end @@ -31,45 +31,45 @@ describe Chef::EventLoggers::WindowsEventLogger, :windows_only, :not_supported_o let(:logger) { Chef::EventLoggers::WindowsEventLogger.new } let(:flags) { nil } let(:node) { nil } - let(:run_status) { double('Run Status', {run_id: run_id, elapsed_time: elapsed_time }) } + let(:run_status) { double("Run Status", {run_id: run_id, elapsed_time: elapsed_time }) } let(:event_log) { EventLog.new("Application") } let!(:offset) { event_log.read_last_event.record_number } - let(:mock_exception) { double('Exception', {message: SecureRandom.uuid, backtrace:[SecureRandom.uuid, SecureRandom.uuid]})} + let(:mock_exception) { double("Exception", {message: SecureRandom.uuid, backtrace:[SecureRandom.uuid, SecureRandom.uuid]})} - it 'is available' do + it "is available" do expect(Chef::EventLoggers::WindowsEventLogger.available?).to be_truthy end - it 'writes run_start event with event_id 10000 and contains version' do + it "writes run_start event with event_id 10000 and contains version" do logger.run_start(version) - expect(event_log.read(flags, offset).any? { |e| e.source == 'Chef' && e.event_id == 10000 && + expect(event_log.read(flags, offset).any? { |e| e.source == "Chef" && e.event_id == 10000 && e.string_inserts[0].include?(version)}).to be_truthy end - it 'writes run_started event with event_id 10001 and contains the run_id' do + it "writes run_started event with event_id 10001 and contains the run_id" do logger.run_started(run_status) - expect(event_log.read(flags, offset).any? { |e| e.source == 'Chef' && e.event_id == 10001 && + expect(event_log.read(flags, offset).any? { |e| e.source == "Chef" && e.event_id == 10001 && e.string_inserts[0].include?(run_id)}).to be_truthy end - it 'writes run_completed event with event_id 10002 and contains the run_id and elapsed time' do + it "writes run_completed event with event_id 10002 and contains the run_id and elapsed time" do logger.run_started(run_status) logger.run_completed(node) - expect(event_log.read(flags, offset).any? { |e| e.source == 'Chef' && e.event_id == 10002 && + expect(event_log.read(flags, offset).any? { |e| e.source == "Chef" && e.event_id == 10002 && e.string_inserts[0].include?(run_id) && e.string_inserts[1].include?(elapsed_time.to_s) }).to be_truthy end - it 'writes run_failed event with event_id 10003 and contains the run_id, elapsed time, and exception info' do + it "writes run_failed event with event_id 10003 and contains the run_id, elapsed time, and exception info" do logger.run_started(run_status) logger.run_failed(mock_exception) expect(event_log.read(flags, offset).any? do |e| - e.source == 'Chef' && e.event_id == 10003 && + e.source == "Chef" && e.event_id == 10003 && e.string_inserts[0].include?(run_id) && e.string_inserts[1].include?(elapsed_time.to_s) && e.string_inserts[2].include?(mock_exception.class.name) && @@ -79,11 +79,11 @@ describe Chef::EventLoggers::WindowsEventLogger, :windows_only, :not_supported_o end).to be_truthy end - it 'writes run_failed event with event_id 10003 even when run_status is not set' do + it "writes run_failed event with event_id 10003 even when run_status is not set" do logger.run_failed(mock_exception) expect(event_log.read(flags, offset).any? do |e| - e.source == 'Chef' && e.event_id == 10003 && + e.source == "Chef" && e.event_id == 10003 && e.string_inserts[0].include?("UNKNOWN") && e.string_inserts[1].include?("UNKNOWN") && e.string_inserts[2].include?(mock_exception.class.name) && |