Skip to content

Commit

Permalink
fixed regex to find files with numbers at the end
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Apr 29, 2022
1 parent da3386c commit 4b6a2cc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions .env-dev-values
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ ALMA_FILES_USER="alma"
ALMA_FILES_HOST="sftp"
SSH_KEY_PATH="/etc/secret-volume/id_rsa"
REINDEX_ON="true"
DAILY_INDEX_ON="true"
4 changes: 2 additions & 2 deletions lib/indexing_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def job_name
end

def file_name_pattern
/_new\.tar/
/_new_?\d*\.tar/
end
end

Expand All @@ -46,6 +46,6 @@ def job_name
end

def file_name_pattern
/_delete\.tar/
/_delete_?\d*\.tar/
end
end
10 changes: 6 additions & 4 deletions spec/lib/indexing_jobs_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
@files = [
"file_#{@job_id_from_data}_new.tar.gz",
"file_#{@job_id_from_data}_delete.tar.gz",
"file_#{@job_id_from_data}_new_22.tar.gz",
"file_#{@job_id_from_data}_delete_1.tar.gz",
"file_new.tar.gz"
]
@sftp_double = instance_double(SFTP, ls: @files)
Expand Down Expand Up @@ -58,13 +60,13 @@
end
context "run" do
it "logs actions summary" do
expect(@logger_double).to receive(:info).with("1 file(s) for IndexIt job")
expect(@logger_double).to receive(:info).with("1 file(s) for DeleteIt job")
expect(@logger_double).to receive(:info).with("2 file(s) for IndexIt job")
expect(@logger_double).to receive(:info).with("2 file(s) for DeleteIt job")
subject.run
end
it "sends the correct arguments to push_indexing_jobs" do
expect(@push_bulk_double).to receive(:push_bulk).with("IndexIt", [@files[0]], ENV.fetch("REINDEX_SOLR_URL"))
expect(@push_bulk_double).to receive(:push_bulk).with("DeleteIt", [@files[1]], ENV.fetch("REINDEX_SOLR_URL"))
expect(@push_bulk_double).to receive(:push_bulk).with("IndexIt", [@files[0], @files[2]], ENV.fetch("REINDEX_SOLR_URL"))
expect(@push_bulk_double).to receive(:push_bulk).with("DeleteIt", [@files[1], @files[3]], ENV.fetch("REINDEX_SOLR_URL"))
subject.run
end
end
Expand Down

0 comments on commit 4b6a2cc

Please sign in to comment.