Project

General

Profile

« Previous | Next » 

Revision 555c3d0f

Added by Bernhard Suttner about 1 month ago

Fixes #36830 - transform_vars on preseed_path

Co-Authored-by: quartsize

View differences:

app/models/operatingsystems/debian.rb
end
def preseed_path(medium_provider)
medium_provider.medium_uri.select(:path, :query).compact.join('?')
medium_provider.medium_uri(&method(:transform_vars)).select(:path, :query).compact.join('?')
end
def boot_file_sources(medium_provider, &block)
test/models/operatingsystems/debian_test.rb
require 'test_helper'
class DebianTest < ActiveSupport::TestCase
let(:operatingsystem) { FactoryBot.create(:debian7_1) }
let(:medium) { FactoryBot.create(:medium, path: "http://ftp.at.debian.org/debian") }
let(:mock_entity) do
OpenStruct.new(
operatingsystem: operatingsystem,
architecture: architecture,
medium: medium
)
end
let(:medium_provider) { MediumProviders::Default.new(mock_entity) }
context 'Debian on Intel x86_64' do
let(:architecture) { architectures(:x86_64) }
describe '#bootfile' do
test 'returns the bootfile' do
assert_includes operatingsystem.bootfile(medium_provider, :kernel), 'linux'
assert_includes operatingsystem.bootfile(medium_provider, :initrd), 'initrd.gz'
end
end
describe '#boot_file_sources' do
test 'returns all boot file sources' do
expected = {
kernel: 'http://ftp.at.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux',
initrd: 'http://ftp.at.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz',
}
assert_equal expected, operatingsystem.boot_file_sources(medium_provider)
end
end
describe '#mediumpath' do
test 'generates medium path url' do
assert_equal 'http://ftp.at.debian.org/debian', operatingsystem.mediumpath(medium_provider)
end
end
describe '#url_for_boot' do
test 'generates kernel url' do
assert_equal 'http://ftp.at.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux', operatingsystem.url_for_boot(medium_provider, :kernel)
end
test 'generates initrd url' do
assert_equal 'http://ftp.at.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz', operatingsystem.url_for_boot(medium_provider, :initrd)
end
end
describe '#preseed_path' do
test 'returns preseed_path' do
assert_equal '/debian', operatingsystem.preseed_path(medium_provider)
end
end
describe '#preseed_path' do
let(:medium) { FactoryBot.create(:medium, path: "http://ftp.at.debian.org/debian/$arch") }
test 'returns preseed_path with arch transformation' do
assert_equal '/debian/amd64', operatingsystem.preseed_path(medium_provider)
end
end
end
end

Also available in: Unified diff