Skip to content

Commit

Permalink
Merge pull request #21 from mlibrary/fix-prune-bug
Browse files Browse the repository at this point in the history
fixed prune bug
  • Loading branch information
niquerio authored Dec 8, 2023
2 parents da660c9 + 093c3fd commit 1f68f50
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 1f68f50

Please sign in to comment.