Skip to content

Commit

Permalink
Merge pull request #17899 from lfu/ansible_reporting2
Browse files Browse the repository at this point in the history
Populate timestamp of CustomButtonEvent.
  • Loading branch information
gmcculloug committed Aug 24, 2018
2 parents 1da0196 + 54c0388 commit 8cbdcbf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/models/custom_button.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def publish_event(source, target, args)
:user_id => args[:user_id],
:group_id => args[:miq_group_id],
:tenant_id => args[:tenant_id],
:timestamp => Time.now.utc,
:full_data => {
:args => args,
:automate_entry_point => resource_action.ae_path,
Expand Down
5 changes: 4 additions & 1 deletion spec/models/custom_button_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,10 @@
%i(invoke invoke_async).each do |method|
describe "##{method}" do
it "publishes CustomButtonEvent" do
User.with_user(user) { custom_button.send(method, vm, 'UI') }
Timecop.freeze(Time.now.utc) do
User.with_user(user) { custom_button.send(method, vm, 'UI') }
expect(CustomButtonEvent.first.timestamp).to be_within(0.01).of(Time.now.utc)
end

expect(CustomButtonEvent.count).to eq(1)
expect(CustomButtonEvent.first).to have_attributes(
Expand Down

0 comments on commit 8cbdcbf

Please sign in to comment.