Skip to content

Commit

Permalink
Merge pull request #16444 from yrudman/name-of-refresh-task-should-fi…
Browse files Browse the repository at this point in the history
…t-255

Truncate name of refresh task to 255
  • Loading branch information
agrare authored Nov 13, 2017
2 parents 9ed7003 + 37f634d commit f74530d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/ems_refresh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def self.queue_merge(targets, ems, create_task = false)

def self.create_refresh_task(ems, targets)
task_options = {
:action => "EmsRefresh(#{ems.name}) [#{targets}]",
:action => "EmsRefresh(#{ems.name}) [#{targets}]".truncate(255),
:userid => "system"
}

Expand Down
10 changes: 10 additions & 0 deletions spec/models/ems_refresh_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@
expect(task_ids.length).to eq(2)
end
end

describe ".create_refresh_task" do
it "create refresh task and trancates task name to 255 symbols" do
vm = FactoryGirl.create(:vm_vmware, :name => "vm_vmware1", :ext_management_system => @ems)
targets = Array.new(500) { vm }
task_name = described_class.send(:create_refresh_task, @ems, targets).name
expect(task_name.include?(@ems.name)).to eq true
expect(task_name.length).to eq 255
end
end
end

def queue_refresh_and_assert_queue_item(target, expected_targets)
Expand Down

0 comments on commit f74530d

Please sign in to comment.