Skip to content

Commit

Permalink
feat(verifier): support fallback_branch & matching_tag consumer versi…
Browse files Browse the repository at this point in the history
…on selectors

relates to pact-foundation#195
cross tracking issue for ruby/rust cores pact-foundation/docs.pact.io#171
  • Loading branch information
YOU54F committed Jun 9, 2024
1 parent 5699cab commit 62b28c1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions rust/pact_verifier/src/pact_broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,12 @@ pub struct ConsumerVersionSelector {
pub branch: Option<String>,
/// Applications that match the the provider version branch sent during verification
pub matching_branch: Option<bool>,
/// the name of the branch to fallback to if the specified branch does not exist.
/// Use of this property is discouraged as it may allow a pact to pass on a feature branch while breaking backwards compatibility with the main branch, which is generally not desired.
/// It is better to use two separate consumer version selectors, one with the main branch name, and one with the feature branch name, rather than use this property
pub fallback_branch: Option<String>,
/// Applications that match the the provider version tag sent during verification
pub matching_tag: Option<bool>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
Expand Down Expand Up @@ -1826,6 +1832,8 @@ mod tests {
main_branch: None,
matching_branch: None,
environment: None,
fallback_branch: None,
matching_tag: None
}), None).await;

match &result {
Expand Down Expand Up @@ -1925,6 +1933,8 @@ mod tests {
main_branch: None,
matching_branch: None,
environment: None,
fallback_branch: None,
matching_tag: None
}), None).await;

match result {
Expand Down Expand Up @@ -2026,6 +2036,8 @@ mod tests {
main_branch: None,
matching_branch: None,
environment: None,
fallback_branch: None,
matching_tag: None
}),
None
).await;
Expand Down
2 changes: 2 additions & 0 deletions rust/pact_verifier/src/selectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ pub fn consumer_tags_to_selectors(tags: Vec<&str>) -> Vec<ConsumerVersionSelecto
main_branch: None,
environment: None,
matching_branch: None,
fallback_branch: None,
matching_tag: None,
}
}).collect()
}

0 comments on commit 62b28c1

Please sign in to comment.