Merge pull request #13320 from hashicorp/box-collection-sort-nils
Fix box collection sorting
This commit is contained in:
commit
dff90bbf74
@ -299,7 +299,12 @@ module Vagrant
|
|||||||
end
|
end
|
||||||
# Sort the list to group like providers and properly ordered versions
|
# Sort the list to group like providers and properly ordered versions
|
||||||
results.sort_by! do |box_result|
|
results.sort_by! do |box_result|
|
||||||
[box_result[0], box_result[2], Gem::Version.new(box_result[1]), box_result[3]]
|
[
|
||||||
|
box_result[0],
|
||||||
|
box_result[2],
|
||||||
|
Gem::Version.new(box_result[1]),
|
||||||
|
box_result[3] || :""
|
||||||
|
]
|
||||||
end
|
end
|
||||||
results
|
results
|
||||||
end
|
end
|
||||||
|
|||||||
@ -111,6 +111,17 @@ describe Vagrant::BoxCollection, :skip_windows, :bsdtar do
|
|||||||
end.not_to raise_error
|
end.not_to raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with architectures defined" do
|
||||||
|
before do
|
||||||
|
environment.box3("foo-VAGRANTSLASH-bar", "1.0", :virtualbox, architecture: :arm64)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should sort boxes by name" do
|
||||||
|
result = subject.all.map(&:first).uniq
|
||||||
|
expect(result).to eq(["bar", "foo", "foo/bar", "foo:colon"])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it "should sort boxes by version" do
|
it "should sort boxes by version" do
|
||||||
box_list = subject.all.find_all do |box_info|
|
box_list = subject.all.find_all do |box_info|
|
||||||
box_info[0] == "foo" && box_info[2].to_s == "virtualbox"
|
box_info[0] == "foo" && box_info[2].to_s == "virtualbox"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user