From 754b28501f9b03b4822537e81bb5ef05bc32d177 Mon Sep 17 00:00:00 2001 From: Monique Rio Date: Thu, 7 Nov 2024 09:03:53 -0500 Subject: [PATCH] fixes all completed statuses --- lib/indexing_jobs_generator.rb | 2 +- spec/lib/indexing_jobs_generator_spec.rb | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/indexing_jobs_generator.rb b/lib/indexing_jobs_generator.rb index fc4c184..08ffe5b 100644 --- a/lib/indexing_jobs_generator.rb +++ b/lib/indexing_jobs_generator.rb @@ -3,7 +3,7 @@ class IndexingJobsGenerator def self.match?(data) data["action"] == "JOB_END" && data["job_instance"]["name"] == alma_job_name && - data["job_instance"]["status"]["value"] == "COMPLETED_SUCCESS" + ["COMPLETED_SUCCESS","COMPLETED_FAILED"].include?(data["job_instance"]["status"]["value"]) end def initialize(data: nil, job_id: nil, sftp: SFTP.client, logger: Logger.new($stdout), diff --git a/spec/lib/indexing_jobs_generator_spec.rb b/spec/lib/indexing_jobs_generator_spec.rb index ee07a32..ad21fff 100644 --- a/spec/lib/indexing_jobs_generator_spec.rb +++ b/spec/lib/indexing_jobs_generator_spec.rb @@ -89,7 +89,11 @@ end end context ".match?" do - it "matches the correct job" do + it "matches the correct job and success status" do + expect(described_class.match?(@data)).to eq(true) + end + it "matches the correct job and success with errors status" do + @data["job_instance"]["status"]["value"] = "COMPLETED_FAILED" expect(described_class.match?(@data)).to eq(true) end it "does not match when it should not match" do