Skip to content

Commit

Permalink
indexes COMPLETED_FAILED status too
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Nov 7, 2024
1 parent 3cf66d2 commit cc74b39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/indexing_jobs_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
6 changes: 5 additions & 1 deletion spec/lib/indexing_jobs_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cc74b39

Please sign in to comment.