parent
44eac3c819
commit
4e21dd78e4
|
@ -522,7 +522,7 @@ module Vagrant
|
||||||
@logger.info("Expected checksum: #{checksum}")
|
@logger.info("Expected checksum: #{checksum}")
|
||||||
|
|
||||||
actual = FileChecksum.new(path, checksum_klass).checksum
|
actual = FileChecksum.new(path, checksum_klass).checksum
|
||||||
if actual != checksum
|
if actual.casecmp(checksum) != 0
|
||||||
raise Errors::BoxChecksumMismatch,
|
raise Errors::BoxChecksumMismatch,
|
||||||
actual: actual,
|
actual: actual,
|
||||||
expected: checksum
|
expected: checksum
|
||||||
|
|
|
@ -207,6 +207,28 @@ describe Vagrant::Action::Builtin::BoxAdd, :skip_windows do
|
||||||
to raise_error(Vagrant::Errors::BoxChecksumMismatch)
|
to raise_error(Vagrant::Errors::BoxChecksumMismatch)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "does not raise an error if the checksum has different case" do
|
||||||
|
box_path = iso_env.box2_file(:virtualbox)
|
||||||
|
|
||||||
|
box = double(
|
||||||
|
name: "foo",
|
||||||
|
version: "1.2.3",
|
||||||
|
provider: "virtualbox",
|
||||||
|
)
|
||||||
|
|
||||||
|
env[:box_name] = box.name
|
||||||
|
env[:box_url] = box_path.to_s
|
||||||
|
env[:box_checksum] = checksum(box_path)
|
||||||
|
env[:box_checksum_type] = "sha1"
|
||||||
|
|
||||||
|
# Convert to a different case
|
||||||
|
env[:box_checksum].upcase!
|
||||||
|
|
||||||
|
expect(box_collection).to receive(:add).and_return(box)
|
||||||
|
|
||||||
|
expect { subject.call(env) }.to_not raise_error
|
||||||
|
end
|
||||||
|
|
||||||
it "raises an error if the box path doesn't exist" do
|
it "raises an error if the box path doesn't exist" do
|
||||||
box_path = iso_env.box2_file(:virtualbox)
|
box_path = iso_env.box2_file(:virtualbox)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue