Class: PactBroker::Pacts::PactsForVerificationRepository
- Inherits:
-
Object
- Object
- PactBroker::Pacts::PactsForVerificationRepository
- Includes:
- Logging, Repositories, Repositories::Helpers
- Defined in:
- lib/pact_broker/pacts/pacts_for_verification_repository.rb
Instance Method Summary collapse
- #find(provider_name, consumer_version_selectors) ⇒ Object
-
#find_wip(provider_name, provider_version_branch, provider_tags_names = [], options = {}) ⇒ Object
To find the work in progress pacts for this verification execution: For each provider tag that will be applied to this verification result (usually there will just be one, but we have to allow for multiple tags), find the head pacts (the pacts that are the latest for their tag) that have been successfully verified against the provider tag.
Methods included from Repositories::Helpers
#mysql?, #name_like, #order_append_ignore_case, #order_ignore_case, #pacticipant_id_for_name, #postgres?, #select_all_qualified, #select_append_all_qualified, #select_for_subquery
Methods included from Repositories
#label_repository, #matrix_repository, #pact_repository, #pacticipant_repository, #tag_repository, #verification_repository, #version_repository, #webhook_repository
Methods included from Logging
Instance Method Details
#find(provider_name, consumer_version_selectors) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/pact_broker/pacts/pacts_for_verification_repository.rb', line 19 def find(provider_name, consumer_version_selectors) selected_pacts = find_pacts_for_which_the_latest_version_of_something_is_required(provider_name, consumer_version_selectors) + find_pacts_for_which_all_versions_for_the_tag_are_required(provider_name, consumer_version_selectors) selected_pacts = selected_pacts + (selected_pacts, provider_name, consumer_version_selectors) merge_selected_pacts(selected_pacts) end |
#find_wip(provider_name, provider_version_branch, provider_tags_names = [], options = {}) ⇒ Object
To find the work in progress pacts for this verification execution: For each provider tag that will be applied to this verification result (usually there will just be one, but we have to allow for multiple tags), find the head pacts (the pacts that are the latest for their tag) that have been successfully verified against the provider tag. Then, find all the head pacts, and remove the ones that have been successfully verified by ALL of the provider tags supplied, and the ones that were published before the include_wip_pacts_since date. Then, for all of the head pacts that are remaining (these are the WIP ones) work out which provider tags they are pending for. Don’t include pact publications that were created before the provider tag was first used (that is, before the provider’s git branch was created).
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/pact_broker/pacts/pacts_for_verification_repository.rb', line 37 def find_wip provider_name, provider_version_branch, = [], = {} # TODO not sure about this return [] if .empty? && provider_version_branch == nil if provider_version_branch return find_wip_pact_versions_for_provider_by_provider_branch(provider_name, provider_version_branch, ) end provider = pacticipant_repository.find_by_name(provider_name) wip_start_date = .fetch(:include_wip_pacts_since) = provider_tag_objects_for(provider, ) = ( provider, , , wip_start_date, :latest_by_consumer_tag) wip_by_consumer_branches = ( provider, , , wip_start_date, :latest_by_consumer_branch) deduplicate_verifiable_pacts( + wip_by_consumer_branches).sort end |