forked from puppetlabs/puppetlabs-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompose_windows_spec.rb
87 lines (71 loc) · 2.47 KB
/
compose_windows_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
require 'spec_helper'
describe 'docker::compose', type: :class do
let(:facts) do
{
architecture: 'amd64',
osfamily: 'windows',
operatingsystem: 'windows',
kernel: 'windows',
kernelrelease: '10.0.14393',
operatingsystemrelease: '2016',
operatingsystemmajrelease: '2016',
docker_program_data_path: 'C:/ProgramData',
docker_program_files_path: 'C:/Program Files',
docker_systemroot: 'C:/Windows',
docker_user_temp_path: 'C:/Users/Administrator/AppData/Local/Temp',
os: { family: 'windows', name: 'windows', release: { major: '2016', full: '2016' } },
}
end
it { is_expected.to compile }
context 'with defaults for all parameters' do
it { is_expected.to compile.with_all_deps }
it {
is_expected.to contain_file('C:/Program Files/Docker/docker-compose.exe').with(
'ensure' => 'link',
'target' => 'C:/Program Files/Docker/docker-compose-1.21.2.exe',
'require' => 'Exec[Install Docker Compose 1.21.2]',
)
}
end
context 'with ensure => absent' do
let(:params) { { ensure: 'absent' } }
it { is_expected.to contain_file('C:/Program Files/Docker/docker-compose-1.21.2.exe').with_ensure('absent') }
it { is_expected.to contain_file('C:/Program Files/Docker/docker-compose.exe').with_ensure('absent') }
end
context 'when no proxy is provided' do
let(:params) { { version: '1.7.0' } }
it { is_expected.to contain_exec('Install Docker Compose 1.7.0') }
end
context 'when proxy is provided' do
let(:params) do
{ proxy: 'http://proxy.example.org:3128/',
version: '1.7.0' }
end
it { is_expected.to compile }
it { is_expected.to contain_exec('Install Docker Compose 1.7.0') }
end
context 'when proxy is not a http proxy' do
let(:params) { { proxy: 'this is not a URL' } }
it do
expect {
is_expected.to compile
}.to raise_error(%r{does not match})
end
end
context 'when proxy contains username and password' do
let(:params) do
{ proxy: 'http://user:[email protected]:3128/',
version: '1.7.0' }
end
it { is_expected.to compile }
it { is_expected.to contain_exec('Install Docker Compose 1.7.0') }
end
context 'when proxy IP is provided' do
let(:params) do
{ proxy: 'http://10.10.10.10:3128/',
version: '1.7.0' }
end
it { is_expected.to compile }
it { is_expected.to contain_exec('Install Docker Compose 1.7.0') }
end
end