|
96 | 96 | ) |
97 | 97 | end |
98 | 98 |
|
99 | | - it 'should exit with error status' do |
| 99 | + it 'should exit with error status due modules in production environment not being found' do |
100 | 100 | expect(@result.exitcode).to eq(-1), OctocatalogDiff::Integration.format_exception(@result) |
101 | | - end |
102 | | - |
103 | | - it 'should raise OctocatalogDiff::CatalogDiff::Cli::Catalogs::CatalogError' do |
104 | 101 | expect(@result.exception).to be_a_kind_of(OctocatalogDiff::CatalogDiff::Cli::Catalogs::CatalogError) |
105 | | - end |
106 | | - |
107 | | - it 'should fail because ::bar could not be located' do |
108 | | - expect(@result.exception.message).to match(/Could not find class ::bar for rspec-node.github.net/) |
| 102 | + expect(@result.exception.message).to match(/Errno::ENOENT: No such file or directory - Environment directory/) |
109 | 103 | end |
110 | 104 | end |
111 | 105 |
|
|
120 | 114 | '--preserve-environments', |
121 | 115 | '--from-environment', 'one', |
122 | 116 | '--to-environment', 'fluffy', |
123 | | - '--create-symlinks', 'modules,sitetest' |
| 117 | + '--create-symlinks', 'modules,site' |
124 | 118 | ] |
125 | 119 | ) |
126 | 120 | end |
127 | 121 |
|
128 | 122 | it 'should error on missing environment' do |
129 | | - expect(@result.exitcode).to eq(2), OctocatalogDiff::Integration.format_exception(@result) |
130 | | - expect(@result.exception).to be_nil, OctocatalogDiff::Integration.format_exception(@result) |
| 123 | + expect(@result.exitcode).to eq(-1), OctocatalogDiff::Integration.format_exception(@result) |
| 124 | + expect(@result.exception).to be_a_kind_of(OctocatalogDiff::CatalogDiff::Cli::Catalogs::CatalogError) |
| 125 | + expect(@result.exception.message).to match(%r{Environment directory .+/environments/fluffy does not exist}) |
131 | 126 | end |
132 | 127 | end |
133 | 128 |
|
134 | 129 | context 'and --create-symlinks set' do |
135 | | - context 'to modules,sitetest' do |
| 130 | + context 'to modules,site' do |
136 | 131 | before(:all) do |
137 | 132 | @result = OctocatalogDiff::Integration.integration( |
138 | 133 | spec_fact_file: 'facts.yaml', |
|
142 | 137 | '--preserve-environments', |
143 | 138 | '--from-environment', 'one', |
144 | 139 | '--to-environment', 'two', |
145 | | - '--create-symlinks', 'modules,sitetest' |
| 140 | + '--create-symlinks', 'modules,site' |
146 | 141 | ] |
147 | 142 | ) |
148 | 143 | end |
|
151 | 146 | expect(@result.exitcode).to eq(2), OctocatalogDiff::Integration.format_exception(@result) |
152 | 147 | expect(@result.exception).to be_nil, OctocatalogDiff::Integration.format_exception(@result) |
153 | 148 | end |
| 149 | + |
| 150 | + it 'should display proper diffs' do |
| 151 | + diffs = @result.diffs |
| 152 | + |
| 153 | + expect( |
| 154 | + OctocatalogDiff::Spec.array_contains_partial_array?( |
| 155 | + diffs, |
| 156 | + ['~', "File\f/tmp/bar\fparameters\fcontent", 'one', 'two'] |
| 157 | + ) |
| 158 | + ).to eq(true) |
| 159 | + |
| 160 | + expect( |
| 161 | + OctocatalogDiff::Spec.array_contains_partial_array?( |
| 162 | + diffs, |
| 163 | + ['~', "File\f/tmp/bar\fparameters\fowner", 'one', 'two'] |
| 164 | + ) |
| 165 | + ).to eq(true) |
| 166 | + |
| 167 | + expect( |
| 168 | + OctocatalogDiff::Spec.array_contains_partial_array?( |
| 169 | + diffs, |
| 170 | + ['~', "File\f/tmp/foo\fparameters\fcontent", 'one', 'two'] |
| 171 | + ) |
| 172 | + ).to eq(true) |
| 173 | + |
| 174 | + expect( |
| 175 | + OctocatalogDiff::Spec.array_contains_partial_array?( |
| 176 | + diffs, |
| 177 | + ['~', "File\f/tmp/sitetest\fparameters\fcontent", 'one', 'two'] |
| 178 | + ) |
| 179 | + ).to eq(true) |
| 180 | + end |
154 | 181 | end |
155 | 182 |
|
156 | 183 | context 'to modules' do |
|
159 | 186 | spec_fact_file: 'facts.yaml', |
160 | 187 | spec_repo: 'preserve-environments', |
161 | 188 | argv: [ |
162 | | - '-n', 'rspec-node.github.net', |
| 189 | + '-n', 'rspec-node.github.net', '--no-parallel', |
163 | 190 | '--retry-failed-catalog', '0', |
164 | 191 | '--preserve-environments', |
165 | 192 | '--from-environment', 'one', |
|
169 | 196 | ) |
170 | 197 | end |
171 | 198 |
|
172 | | - it 'should error on missing sitetest' do |
173 | | - expect(@result.exitcode).to eq(2), OctocatalogDiff::Integration.format_exception(@result) |
174 | | - expect(@result.exception).to be_nil, OctocatalogDiff::Integration.format_exception(@result) |
| 199 | + it 'should error on missing site directory' do |
| 200 | + expect(@result.exitcode).to eq(-1), OctocatalogDiff::Integration.format_exception(@result) |
| 201 | + expect(@result.exception).to be_a_kind_of(OctocatalogDiff::CatalogDiff::Cli::Catalogs::CatalogError) |
| 202 | + expect(@result.exception.message).to match(/Could not find class (::)?sitetest/) |
175 | 203 | end |
176 | 204 | end |
177 | 205 |
|
178 | | - context 'to sitetest' do |
| 206 | + context 'to site' do |
179 | 207 | before(:all) do |
180 | 208 | @result = OctocatalogDiff::Integration.integration( |
181 | 209 | spec_fact_file: 'facts.yaml', |
182 | 210 | spec_repo: 'preserve-environments', |
183 | 211 | argv: [ |
184 | | - '-n', 'rspec-node.github.net', |
| 212 | + '-n', 'rspec-node.github.net', '--no-parallel', |
185 | 213 | '--retry-failed-catalog', '0', |
186 | 214 | '--preserve-environments', |
187 | 215 | '--from-environment', 'one', |
188 | 216 | '--to-environment', 'two', |
189 | | - '--create-symlinks', 'sitetest' |
| 217 | + '--create-symlinks', 'site' |
190 | 218 | ] |
191 | 219 | ) |
192 | 220 | end |
193 | 221 |
|
194 | 222 | it 'should error on missing module' do |
195 | | - expect(@result.exitcode).to eq(2), OctocatalogDiff::Integration.format_exception(@result) |
196 | | - expect(@result.exception).to be_nil, OctocatalogDiff::Integration.format_exception(@result) |
| 223 | + expect(@result.exitcode).to eq(-1), OctocatalogDiff::Integration.format_exception(@result) |
| 224 | + expect(@result.exception).to be_a_kind_of(OctocatalogDiff::CatalogDiff::Cli::Catalogs::CatalogError) |
| 225 | + expect(@result.exception.message).to match(/Could not find class (::)?foo/) |
197 | 226 | end |
198 | 227 | end |
199 | 228 |
|
|
203 | 232 | spec_fact_file: 'facts.yaml', |
204 | 233 | spec_repo: 'preserve-environments', |
205 | 234 | argv: [ |
206 | | - '-n', 'rspec-node.github.net', |
| 235 | + '-n', 'rspec-node.github.net', '--no-parallel', |
207 | 236 | '--retry-failed-catalog', '0', |
208 | 237 | '--preserve-environments', |
209 | 238 | '--from-environment', 'one', |
|
213 | 242 | ) |
214 | 243 | end |
215 | 244 |
|
216 | | - it 'should error on missing symlink' do |
217 | | - expect(@result.exitcode).to eq(2), OctocatalogDiff::Integration.format_exception(@result) |
218 | | - expect(@result.exception).to be_nil, OctocatalogDiff::Integration.format_exception(@result) |
| 245 | + it 'should raise exception due to missing symlink request' do |
| 246 | + expect(@result.exitcode).to eq(-1), OctocatalogDiff::Integration.format_exception(@result) |
| 247 | + expect(@result.exception).to be_a_kind_of(OctocatalogDiff::CatalogDiff::Cli::Catalogs::CatalogError) |
| 248 | + expect(@result.exception.message).to match(%r{Catalog for 'from' \(origin/master\) failed.+ Errno::ENOENT}) |
| 249 | + expect(@result.exception.message).to match(%r{Specified directory .+/preserve-environments/fluffy doesn't exist}) |
219 | 250 | end |
220 | 251 | end |
221 | 252 | end |
|
231 | 262 | '--preserve-environments', |
232 | 263 | '--from-environment', 'one', |
233 | 264 | '--to-environment', 'two', |
234 | | - '--to-create-symlinks', 'modules,sitetest', |
235 | | - '--from-create-symlinks', 'sitetest,modules' |
| 265 | + '--to-create-symlinks', 'modules,site', |
| 266 | + '--from-create-symlinks', 'site,modules' |
236 | 267 | ] |
237 | 268 | ) |
238 | 269 | end |
|
255 | 286 | '--from-environment', 'one', |
256 | 287 | '--to-environment', 'two', |
257 | 288 | '--to-create-symlinks', 'modules', |
258 | | - '--from-create-symlinks', 'modules,sitetest' |
| 289 | + '--from-create-symlinks', 'modules,site' |
259 | 290 | ] |
260 | 291 | ) |
261 | 292 | end |
262 | 293 |
|
263 | | - it 'should error to-catalog missing sitetest' do |
264 | | - expect(@result.exitcode).to eq(2), OctocatalogDiff::Integration.format_exception(@result) |
265 | | - expect(@result.exception).to be_nil, OctocatalogDiff::Integration.format_exception(@result) |
| 294 | + it 'should error on missing site directory' do |
| 295 | + expect(@result.exitcode).to eq(-1), OctocatalogDiff::Integration.format_exception(@result) |
| 296 | + expect(@result.exception).to be_a_kind_of(OctocatalogDiff::CatalogDiff::Cli::Catalogs::CatalogError) |
| 297 | + expect(@result.exception.message).to match(%r{Could not find class (::)?sitetest.+ at .+/environments/two/}) |
266 | 298 | end |
267 | 299 | end |
268 | 300 | end |
|
282 | 314 | ) |
283 | 315 | end |
284 | 316 |
|
285 | | - it 'should error on missing module' do |
286 | | - expect(@result.exitcode).to eq(2), OctocatalogDiff::Integration.format_exception(@result) |
287 | | - expect(@result.exception).to be_nil, OctocatalogDiff::Integration.format_exception(@result) |
| 317 | + it 'should error on missing site directory' do |
| 318 | + expect(@result.exitcode).to eq(-1), OctocatalogDiff::Integration.format_exception(@result) |
| 319 | + expect(@result.exception).to be_a_kind_of(OctocatalogDiff::CatalogDiff::Cli::Catalogs::CatalogError) |
| 320 | + expect(@result.exception.message).to match(/Could not find class (::)?sitetest/) |
288 | 321 | end |
289 | 322 | end |
290 | 323 | end |
|
0 commit comments