Skip to content

Commit

Permalink
feat(clean): log automatically added selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jan 13, 2023
1 parent 9c08716 commit 135c1c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/pact_broker/tasks/clean_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ def output string, payload = {}

def add_defaults_to_keep_selectors
if keep_version_selectors.none?(&:currently_deployed?)
output("Automatically adding #{ { deployed: true} } to keep version selectors")
keep_version_selectors << PactBroker::DB::Clean::Selector.new(deployed: true)
end

if keep_version_selectors.none?(&:currently_supported?)
output("Automatically adding #{ { released: true} } to keep version selectors")
keep_version_selectors << PactBroker::DB::Clean::Selector.new(released: true)
end
end
Expand Down
5 changes: 5 additions & 0 deletions tasks/test_db.rake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ end
PactBroker::DB::CleanTask.new do | task |
ENV["RACK_ENV"] ||= "test"
require_relative "../spec/support/test_database"
require "semantic_logger"
task.database_connection = ::PactBroker::TestDatabase.connection_for_test_database
task.keep_version_selectors = [ { latest: true} ]
task.logger = SemanticLogger["clean"]
SemanticLogger.default_level = :info
SemanticLogger.add_appender(io: $stdout)
end

PactBroker::DB::DeleteOverwrittenDataTask.new do | task |
Expand Down

0 comments on commit 135c1c0

Please sign in to comment.