X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Farchive%2Fspec%2Fdefines%2Fartifactory_spec.rb;fp=3rdparty%2Fmodules%2Farchive%2Fspec%2Fdefines%2Fartifactory_spec.rb;h=4fa2b456a236d75a9bcaa85f9c1676143eac2d69;hb=ce70d6baf887ae03a2a6a7f5e73eb2e2c3dea208;hp=0000000000000000000000000000000000000000;hpb=0ba93256399fbad7ed8fabfa39c24dd47169dde3;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/archive/spec/defines/artifactory_spec.rb b/3rdparty/modules/archive/spec/defines/artifactory_spec.rb new file mode 100644 index 000000000..4fa2b456a --- /dev/null +++ b/3rdparty/modules/archive/spec/defines/artifactory_spec.rb @@ -0,0 +1,68 @@ +require 'spec_helper' + +describe 'archive::artifactory' do + let(:facts) { { os: { family: 'RedHat' }, puppetversion: '4.4.0' } } + + # Mock Puppet V4 API ruby function with a puppet language function equivalent + let(:pre_condition) do + 'function archive::artifactory_checksum($url,$type) { return \'0d4f4b4b039c10917cfc49f6f6be71e4\' }' + end + + context 'artifactory archive with defaults' do + let(:title) { '/opt/app/example.zip' } + let(:params) do + { + url: 'http://home.lan:8081/artifactory/path/example.zip' + } + end + + it do + is_expected.to contain_archive('/opt/app/example.zip').with( + path: '/opt/app/example.zip', + source: 'http://home.lan:8081/artifactory/path/example.zip', + checksum: '0d4f4b4b039c10917cfc49f6f6be71e4', + checksum_type: 'sha1' + ) + end + + it do + is_expected.to contain_file('/opt/app/example.zip').with( + owner: '0', + group: '0', + mode: '0640', + require: 'Archive[/opt/app/example.zip]' + ) + end + end + + context 'artifactory archive with path' do + let(:title) { 'example.zip' } + let(:params) do + { + archive_path: '/opt/app', + url: 'http://home.lan:8081/artifactory/path/example.zip', + owner: 'app', + group: 'app', + mode: '0400' + } + end + + it do + is_expected.to contain_archive('/opt/app/example.zip').with( + path: '/opt/app/example.zip', + source: 'http://home.lan:8081/artifactory/path/example.zip', + checksum: '0d4f4b4b039c10917cfc49f6f6be71e4', + checksum_type: 'sha1' + ) + end + + it do + is_expected.to contain_file('/opt/app/example.zip').with( + owner: 'app', + group: 'app', + mode: '0400', + require: 'Archive[/opt/app/example.zip]' + ) + end + end +end