Skip to content

Commit

Permalink
fixed prune bug
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Dec 8, 2023
1 parent da660c9 commit 093c3fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/authority_browse/solr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ def self.verify_reindex(min_records: S.min_authority_browse_record_count)
# than the newest three authority_browse collections.
#
# @return[Nil]
def self.prune_old_collections(collections: list_old_collections(keep: keep), keep: 3)
def self.prune_old_collections(collections_generator: lambda { |keep| AuthorityBrowse::Solr.list_old_collections(keep: keep) }, keep: 3)
collections = collections_generator.call(keep)
S.logger.info "Pruning the following collections: #{collections}"
collections.each do |coll|
coll.delete!
Expand Down
2 changes: 1 addition & 1 deletion spec/integrations/solrcloud_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
expect(col).not_to be_nil
col.aliases.each { |x| x.delete! }
# actual subject
AuthorityBrowse::Solr.prune_old_collections(collections: [col], keep: 0)
AuthorityBrowse::Solr.prune_old_collections(collections_generator: lambda { |keep| [col] }, keep: 0)

expect(S.solrcloud.only_collection_names).not_to include(@today_collection_name)
end
Expand Down

0 comments on commit 093c3fd

Please sign in to comment.