|
65 | 65 | } |
66 | 66 | end |
67 | 67 |
|
| 68 | + context 'with invalid repos' do |
| 69 | + let :params do |
| 70 | + { |
| 71 | + comment: 'foo', |
| 72 | + location: 'http://debian.mirror.iweb.ca/debian/', |
| 73 | + release: 'sid', |
| 74 | + repos: 'test', |
| 75 | + } |
| 76 | + end |
| 77 | + |
| 78 | + it { is_expected.to raise_error(Puppet::Error, %r{repos parameter must be set to a valid component name, or a comma-separated list of valid component names}) } |
| 79 | + end |
| 80 | + |
| 81 | + context 'with empty string for repos' do |
| 82 | + let :params do |
| 83 | + { |
| 84 | + comment: 'foo', |
| 85 | + location: 'http://debian.mirror.iweb.ca/debian/', |
| 86 | + release: 'sid', |
| 87 | + repos: '', |
| 88 | + } |
| 89 | + end |
| 90 | + |
| 91 | + it { is_expected.to raise_error(Puppet::Error, %r{parameter 'repos' expects a String\[1\] value, got String}) } |
| 92 | + end |
| 93 | + |
68 | 94 | context 'with simple key' do |
69 | 95 | let :params do |
70 | 96 | { |
71 | 97 | comment: 'foo', |
72 | 98 | location: 'http://debian.mirror.iweb.ca/debian/', |
73 | 99 | release: 'sid', |
74 | | - repos: 'testing', |
| 100 | + repos: 'main', |
75 | 101 | key: id, |
76 | 102 | pin: '10', |
77 | 103 | architecture: 'x86_64', |
|
80 | 106 | end |
81 | 107 |
|
82 | 108 | it { |
83 | | - expect(subject).to contain_apt__setting('list-my_source').with(ensure: 'present').with_content(%r{# foo\ndeb \[arch=x86_64 trusted=yes\] http://debian.mirror.iweb.ca/debian/ sid testing\n}) |
| 109 | + expect(subject).to contain_apt__setting('list-my_source').with(ensure: 'present').with_content(%r{# foo\ndeb \[arch=x86_64 trusted=yes\] http://debian.mirror.iweb.ca/debian/ sid main\n}) |
84 | 110 | .without_content(%r{deb-src}) |
85 | 111 | } |
86 | 112 |
|
|
102 | 128 | comment: 'foo', |
103 | 129 | location: 'http://debian.mirror.iweb.ca/debian/', |
104 | 130 | release: 'sid', |
105 | | - repos: 'testing', |
| 131 | + repos: 'main', |
106 | 132 | key: { |
107 | 133 | 'ensure' => 'refreshed', |
108 | 134 | 'id' => id, |
|
118 | 144 | end |
119 | 145 |
|
120 | 146 | it { |
121 | | - expect(subject).to contain_apt__setting('list-my_source').with(ensure: 'present').with_content(%r{# foo\ndeb \[arch=x86_64 trusted=yes\] http://debian.mirror.iweb.ca/debian/ sid testing\n}) |
| 147 | + expect(subject).to contain_apt__setting('list-my_source').with(ensure: 'present').with_content(%r{# foo\ndeb \[arch=x86_64 trusted=yes\] http://debian.mirror.iweb.ca/debian/ sid main\n}) |
122 | 148 | .without_content(%r{deb-src}) |
123 | 149 | } |
124 | 150 |
|
|
421 | 447 | end |
422 | 448 | end |
423 | 449 |
|
| 450 | + context 'with release is not empty string' do |
| 451 | + let(:params) { { location: 'hello.there', release: 'test' } } |
| 452 | + |
| 453 | + it { is_expected.to contain_apt__setting('list-my_source').with_content(%r{hello\.there test main}) } |
| 454 | + end |
| 455 | + |
| 456 | + context 'with release invalid string' do |
| 457 | + let(:params) { { location: 'hello.there', release: '/' } } |
| 458 | + |
| 459 | + it { is_expected.to raise_error(Puppet::Error, %r{release parameter must be set to a valid release name}) } |
| 460 | + end |
| 461 | + |
424 | 462 | context 'with release is empty string' do |
425 | 463 | let(:params) { { location: 'hello.there', release: '' } } |
426 | 464 |
|
427 | | - it { is_expected.to contain_apt__setting('list-my_source').with_content(%r{hello\.there main}) } |
| 465 | + it { is_expected.to raise_error(Puppet::Error, %r{expects a value of type Undef or String\[1\], got String}) } |
428 | 466 | end |
429 | 467 |
|
430 | 468 | context 'with invalid pin' do |
|
0 commit comments