|
22 | 22 | 'env' => ['MY_ENV=1', 'MY_ENV2=2'],
|
23 | 23 | 'label' => ['com.example.foo="bar"', 'bar=baz'],
|
24 | 24 | 'mounts' => ['type=bind,src=/tmp/a,dst=/tmp/a', 'type=bind,src=/tmp/b,dst=/tmp/b,readonly'],
|
| 25 | + 'networks' => ['overlay'], |
25 | 26 | } }
|
26 | 27 | it { is_expected.to compile.with_all_deps }
|
27 | 28 | it { should contain_exec('test_service docker service create').with_command(/docker service create/) }
|
28 | 29 | it { should contain_exec('test_service docker service create').with_command(/--env MY_ENV=1/) }
|
29 | 30 | it { should contain_exec('test_service docker service create').with_command(/--label bar=baz/) }
|
30 | 31 | it { should contain_exec('test_service docker service create').with_command(/--mount type=bind,src=\/tmp\/b,dst=\/tmp\/b,readonly/) }
|
| 32 | + it { should contain_exec('test_service docker service create').with_command(/--network overlay/) } |
31 | 33 |
|
32 | 34 | context 'multiple services declaration' do
|
33 | 35 | let(:pre_condition) {
|
|
42 | 44 | it { should contain_exec('test_service_2 docker service create').with_command(/docker service create/) }
|
43 | 45 | end
|
44 | 46 |
|
45 |
| - context 'multiple publish ports' do |
| 47 | + context 'multiple publish ports and multiple networks' do |
46 | 48 | let(:pre_condition) {
|
47 | 49 | "
|
48 | 50 | docker::services { 'test_service_3':
|
49 | 51 | service_name => 'foo_3',
|
50 | 52 | image => 'foo:bar',
|
51 | 53 | publish => ['80:8080', '9000:9000' ],
|
| 54 | + networks => ['foo_1', 'foo_2'], |
52 | 55 | }
|
53 | 56 | "
|
54 | 57 | }
|
55 | 58 | it { should contain_exec('test_service_3 docker service create').with_command(/--publish 80:8080/) }
|
56 | 59 | it { should contain_exec('test_service_3 docker service create').with_command(/--publish 9000:9000/) }
|
| 60 | + it { should contain_exec('test_service_3 docker service create').with_command(/--network foo_1/) } |
| 61 | + it { should contain_exec('test_service_3 docker service create').with_command(/--network foo_2/) } |
57 | 62 | end
|
58 | 63 | end
|
59 | 64 |
|
|
0 commit comments