Skip to content

Commit

Permalink
Issue 1758 - Add latest flag when comparing to the main branch so onl…
Browse files Browse the repository at this point in the history
…y the latest contract is checked
  • Loading branch information
ealesjordan authored and rholshausen committed Apr 22, 2024
1 parent adb5285 commit 3fc647a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,7 @@ open class PactBrokerClient(

if (to.mainBranch == true) {
params.add("mainBranch" to "true")
params.add("latest" to "true")
} else if (to.environment.isNullOrEmpty() && to.tag.isNullOrEmpty()) {
params.add("latest" to "true")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,9 @@ class PactBrokerClientSpec extends Specification {
'Test' | '' | new Latest.UseLatest(true) | new To(null, 'env1', false) | [] || 'q[][pacticipant]=Test&latestby=cvp&q[][latest]=true&environment=env1'
'Test' | '' | new Latest.UseLatest(true) | new To('tag1', 'env1', false) | [] || 'q[][pacticipant]=Test&latestby=cvp&q[][latest]=true&environment=env1&latest=true&tag=tag1'
'Test' | '' | new Latest.UseLatest(true) | new To(null, 'env 1', false) | [] || 'q[][pacticipant]=Test&latestby=cvp&q[][latest]=true&environment=env+1'
'Test' | '' | new Latest.UseLatest(true) | new To(null, 'env1', true) | [] || 'q[][pacticipant]=Test&latestby=cvp&q[][latest]=true&environment=env1&mainBranch=true'
'Test' | '' | new Latest.UseLatest(true) | new To('tag1', 'env1', true) | [] || 'q[][pacticipant]=Test&latestby=cvp&q[][latest]=true&environment=env1&latest=true&tag=tag1&mainBranch=true'
'Test' | '' | new Latest.UseLatest(true) | new To(null, 'env 1', true) | [] || 'q[][pacticipant]=Test&latestby=cvp&q[][latest]=true&environment=env+1&mainBranch=true'
'Test' | '' | new Latest.UseLatest(true) | new To(null, 'env1', true) | [] || 'q[][pacticipant]=Test&latestby=cvp&q[][latest]=true&environment=env1&mainBranch=true&latest=true'
'Test' | '' | new Latest.UseLatest(true) | new To('tag1', 'env1', true) | [] || 'q[][pacticipant]=Test&latestby=cvp&q[][latest]=true&environment=env1&latest=true&tag=tag1&mainBranch=true&latest=true'
'Test' | '' | new Latest.UseLatest(true) | new To(null, 'env 1', true) | [] || 'q[][pacticipant]=Test&latestby=cvp&q[][latest]=true&environment=env+1&mainBranch=true&latest=true'
}

@Issue('#1511')
Expand Down

0 comments on commit 3fc647a

Please sign in to comment.