spec/shared/lib/mrss/server_version_registry.rb in mongoid-7.2.6 vs spec/shared/lib/mrss/server_version_registry.rb in mongoid-7.3.0

- old
+ new

@@ -46,27 +46,22 @@ raise MissingDownloadUrl, "No download for #{arch} for #{version['version']}" end url = dl['archive']['url'] end rescue MissingDownloadUrl - if %w(2.6 3.0).include?(desired_version) && arch == 'ubuntu1604' - # 2.6 and 3.0 are only available for ubuntu1204 and ubuntu1404. - # Those ubuntus have ancient Pythons that don't work due to not - # implementing recent TLS protocols. - # Because of this we test on ubuntu1604 which has a newer Python. - # But we still need to retrieve ubuntu1404-targeting builds. - url = self.class.new('3.2', arch).download_url - unless url.include?('3.2.') - raise 'URL not in expected format' + if %w(4.7 4.7.0).include?(desired_version) + # 4.7.0 has no advertised downloads but it is downloadable and + # we do need it. Dirty hack below. + registry = self.class.new('4.4.3', arch) + registry.download_url.sub('4.4.3', '4.7.0').tap do |url| + # Sanity check - ensure the URL we hacked up is a valid one + io = uri_open(url) + begin + io.read(1) + ensure + io.close + end end - url = case desired_version - when '2.6' - url.sub(/\b3\.2\.\d+/, '2.6.12') - when '3.0' - url.sub(/\b3\.2\.\d+/, '3.0.15') - else - raise NotImplementedError - end.sub('ubuntu1604', 'ubuntu1404') else raise end end