|
6 | 6 | before(:all) { setup_puppet_on default } |
7 | 7 | after(:all) { teardown_puppet_on default } |
8 | 8 |
|
9 | | - it 'works idempotently with no errors' do |
10 | | - pp = <<-EOS |
11 | | - class { 'puppet_agent': package_version => '5.5.21', collection => 'puppet5' } |
12 | | - EOS |
13 | | - |
14 | | - apply_manifest(pp, catch_failures: true) |
15 | | - wait_for_finish_on default |
16 | | - configure_agent_on default |
17 | | - # Run three times to ensure idempotency if upgrading with the package resource (MODULES-10666) |
18 | | - unless %r{solaris-10|aix|osx|windows}i.match?(default['platform']) |
19 | | - apply_manifest(pp, expect_changes: true) |
20 | | - wait_for_finish_on default |
21 | | - end |
22 | | - apply_manifest(pp, catch_changes: true) |
23 | | - end |
24 | | - |
25 | 9 | describe package(package_name(default)) do |
26 | 10 | it { is_expected.to be_installed } |
27 | 11 | end |
@@ -117,43 +101,4 @@ class { 'puppet_agent': service_names => [] } |
117 | 101 | it { is_expected.not_to be_running } |
118 | 102 | end |
119 | 103 | end |
120 | | - |
121 | | - unless %r{windows}i.match?(default['platform']) |
122 | | - unless %r{solaris-10|aix|osx|windows}i.match?(default['platform']) |
123 | | - context 'on platforms managed with the package resource' do |
124 | | - before(:all) { setup_puppet_on default } |
125 | | - |
126 | | - after(:all) do |
127 | | - on default, 'rm -f /tmp/a' |
128 | | - teardown_puppet_on default |
129 | | - end |
130 | | - |
131 | | - let(:manifest) do |
132 | | - <<-EOS |
133 | | - class { 'puppet_agent': package_version => '5.5.21', collection => 'puppet5', before => File['/tmp/a'] } |
134 | | - file { '/tmp/a': ensure => 'present' } |
135 | | - EOS |
136 | | - end |
137 | | - |
138 | | - it 'upgrades the agent on the first run' do |
139 | | - # First run should upgrade the agent |
140 | | - apply_manifest(manifest, expect_changes: true) |
141 | | - configure_agent_on default |
142 | | - expect(package(package_name(default))).to be_installed |
143 | | - expect(file('/tmp/a')).not_to exist |
144 | | - end |
145 | | - |
146 | | - it 'evaluates remanining resources on the second run' do |
147 | | - # Second run should apply the file resource |
148 | | - apply_manifest(manifest, expect_changes: true) |
149 | | - expect(file('/tmp/a')).to exist |
150 | | - end |
151 | | - |
152 | | - it 'does nothing on future runs' do |
153 | | - # Third run should not do anything |
154 | | - apply_manifest(manifest, catch_changes: true) |
155 | | - end |
156 | | - end |
157 | | - end |
158 | | - end |
159 | 104 | end |
0 commit comments