diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2016-02-01 21:24:44 -0800 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2016-02-02 08:18:59 -0800 |
commit | 89f8987c8aa21223e7f93f174f889ce4a679d9b6 (patch) | |
tree | 68ad5ddc4eca8a6d85437b167a7344b2d0abc700 /spec | |
parent | 9bfa322ba060d2fb691eac98028d9afaf78f5cac (diff) | |
download | chef-89f8987c8aa21223e7f93f174f889ce4a679d9b6.tar.gz |
Make windows event log tests faster
Using SecureRandom is slow if it is not initialized.
Random is good enough for this test.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/functional/event_loggers/windows_eventlog_spec.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/spec/functional/event_loggers/windows_eventlog_spec.rb b/spec/functional/event_loggers/windows_eventlog_spec.rb index cfab3763e1..eab58adede 100644 --- a/spec/functional/event_loggers/windows_eventlog_spec.rb +++ b/spec/functional/event_loggers/windows_eventlog_spec.rb @@ -25,16 +25,21 @@ if Chef::Platform.windows? and not Chef::Platform::windows_server_2003? end describe Chef::EventLoggers::WindowsEventLogger, :windows_only, :not_supported_on_win2k3 do - let(:run_id) { SecureRandom.uuid } - let(:version) { SecureRandom.uuid } - let(:elapsed_time) { SecureRandom.random_number(100) } + def rand + random.rand(1<<32).to_s + end + + let(:random) { Random.new } + let(:run_id) { rand } + let(:version) { rand } + let(:elapsed_time) { rand } 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(: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: rand, backtrace:[rand, rand]})} it "is available" do expect(Chef::EventLoggers::WindowsEventLogger.available?).to be_truthy |