From eaab9cd5bba2b5d3bc94f33c15cee089462089ae Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Wed, 25 Jul 2018 07:11:08 -0700 Subject: [PATCH] Get the checksum file from archive.apache.org Previously, when a mirror was set it was trying to get the checksum from www.us.apache.org which only had the checksums for the three supported versions. --- lib/solr_wrapper/checksum_validator.rb | 6 +----- spec/lib/solr_wrapper/checksum_validator_spec.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 spec/lib/solr_wrapper/checksum_validator_spec.rb diff --git a/lib/solr_wrapper/checksum_validator.rb b/lib/solr_wrapper/checksum_validator.rb index 2593f0a..365cb6f 100644 --- a/lib/solr_wrapper/checksum_validator.rb +++ b/lib/solr_wrapper/checksum_validator.rb @@ -27,11 +27,7 @@ def validate!(file) private def checksumurl(suffix) - if config.default_download_url == config.static_config.archive_download_url - "#{config.default_download_url}.#{suffix}" - else - "http://www.us.apache.org/dist/lucene/solr/#{config.static_config.version}/solr-#{config.static_config.version}.zip.#{suffix}" - end + "http://archive.apache.org/dist/lucene/solr/#{config.static_config.version}/solr-#{config.static_config.version}.zip.#{suffix}" end def checksum_path(suffix) diff --git a/spec/lib/solr_wrapper/checksum_validator_spec.rb b/spec/lib/solr_wrapper/checksum_validator_spec.rb new file mode 100644 index 0000000..5684d52 --- /dev/null +++ b/spec/lib/solr_wrapper/checksum_validator_spec.rb @@ -0,0 +1,14 @@ +require 'spec_helper' + +RSpec.describe SolrWrapper::ChecksumValidator do + let(:validator) { described_class.new(settings) } + let(:settings) { SolrWrapper::Settings.new(config) } + let(:config) { SolrWrapper::Configuration.new(options) } + let(:options) { { version: '6.6.0'} } + + describe '#checksumurl' do + subject { validator.send(:checksumurl, described_class::ALGORITHM) } + + it { is_expected.to eq 'http://archive.apache.org/dist/lucene/solr/6.6.0/solr-6.6.0.zip.sha1' } + end +end