|
228 | 228 | end |
229 | 229 | end |
230 | 230 |
|
| 231 | + context "deleting a pipeline" do |
| 232 | + context "when pipeline is in registry" do |
| 233 | + before :each do |
| 234 | + subject.create_pipeline(pipeline_id, pipeline) { true } |
| 235 | + end |
| 236 | + |
| 237 | + it "should not delete pipeline if pipeline is not terminated" do |
| 238 | + expect(pipeline).to receive(:finished_execution?).and_return(false) |
| 239 | + expect(LogStash::PipelinesRegistry).to receive(:logger).and_return(logger) |
| 240 | + expect(logger).to receive(:info) |
| 241 | + expect(subject.delete_pipeline(pipeline_id)).to be_falsey |
| 242 | + expect(subject.get_pipeline(pipeline_id)).not_to be_nil |
| 243 | + end |
| 244 | + |
| 245 | + it "should delete pipeline if pipeline is terminated" do |
| 246 | + expect(pipeline).to receive(:finished_execution?).and_return(true) |
| 247 | + expect(LogStash::PipelinesRegistry).to receive(:logger).and_return(logger) |
| 248 | + expect(logger).to receive(:info) |
| 249 | + expect(subject.delete_pipeline(pipeline_id)).to be_truthy |
| 250 | + expect(subject.get_pipeline(pipeline_id)).to be_nil |
| 251 | + end |
| 252 | + |
| 253 | + it "should recreate pipeline if pipeline is delete and create again" do |
| 254 | + expect(pipeline).to receive(:finished_execution?).and_return(true) |
| 255 | + expect(LogStash::PipelinesRegistry).to receive(:logger).and_return(logger) |
| 256 | + expect(logger).to receive(:info) |
| 257 | + expect(subject.delete_pipeline(pipeline_id)).to be_truthy |
| 258 | + expect(subject.get_pipeline(pipeline_id)).to be_nil |
| 259 | + subject.create_pipeline(pipeline_id, pipeline) { true } |
| 260 | + expect(subject.get_pipeline(pipeline_id)).not_to be_nil |
| 261 | + end |
| 262 | + end |
| 263 | + |
| 264 | + context "when pipeline is not in registry" do |
| 265 | + it "should log error" do |
| 266 | + expect(LogStash::PipelinesRegistry).to receive(:logger).and_return(logger) |
| 267 | + expect(logger).to receive(:error) |
| 268 | + expect(subject.delete_pipeline(pipeline_id)).to be_falsey |
| 269 | + end |
| 270 | + end |
| 271 | + end |
| 272 | + |
231 | 273 | context "pipelines collections" do |
232 | 274 | context "with a non terminated pipelines" do |
233 | 275 | before :each do |
|
0 commit comments