Skip to content

Commit

Permalink
Allowing the package_source to be an Httpurl (with tests)
Browse files Browse the repository at this point in the history
  • Loading branch information
Julio Guevara authored and ekohl committed Mar 3, 2018
1 parent b0fac12 commit 96a5141
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@
Optional[String] $dir_owner = $puppet::params::dir_owner,
Optional[String] $dir_group = $puppet::params::dir_group,
Optional[String] $package_provider = $puppet::params::package_provider,
Optional[Stdlib::Absolutepath] $package_source = $puppet::params::package_source,
Optional[Variant[Stdlib::Absolutepath, Stdlib::Httpurl]] $package_source = $puppet::params::package_source,
Integer[0, 65535] $port = $puppet::params::port,
Boolean $listen = $puppet::params::listen,
Array[String] $listen_to = $puppet::params::listen_to,
Expand Down
40 changes: 40 additions & 0 deletions spec/classes/puppet_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,46 @@

it { should contain_puppet__config__main('ca_port').with_value(8140) }
end

describe 'with package_source => Httpurl' do
let :params do {
:package_source => 'https://example.com:123/test'
} end

if facts[:osfamily] != 'windows'
it { is_expected.to compile }
end
end

describe 'with package_source => Unixpath' do
let :params do {
:package_source => '/test/folder/path/source.rpm'
} end

if facts[:osfamily] != 'windows'
it { is_expected.to compile }
end
end

describe 'with package_source => Windowspath' do
let :params do {
:package_source => 'C:\test\folder\path\source.exe'
} end

if facts[:osfamily] != 'windows'
it { is_expected.to compile }
end
end

describe 'with package_source => foo' do
let :params do {
:package_source => 'foo'
} end

if facts[:osfamily] != 'windows'
it { is_expected.not_to compile }
end
end
end
end
end

0 comments on commit 96a5141

Please sign in to comment.