Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added consumer version selectors #175

Merged
merged 1 commit into from
Aug 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions types/consumer_version_selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ import "fmt"
// versions we want to use when configuring verifications
// See https://docs.pact.io/selectors for more
type ConsumerVersionSelector struct {
Pacticipant string `json:"pacticipant"`
Tag string `json:"tag"`
Version string `json:"version"`
Latest bool `json:"latest"`
All bool `json:"all"`
Pacticipant string `json:"pacticipant"`
Tag string `json:"tag"`
Version string `json:"version"`
Latest bool `json:"latest"`
All bool `json:"all"`
Consumer string `json:"consumer"`
DeployedOrReleased bool `json:"deployedOrReleased"`
Deployed bool `json:"deployed"`
Released bool `json:"released"`
Environment string `json:"environment"`
}

// Validate the selector configuration
Expand Down
5 changes: 5 additions & 0 deletions types/consumer_version_selector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ func TestConsumerVersionSelectorValidate(t *testing.T) {
{name: "pacticipant only", selector: ConsumerVersionSelector{Pacticipant: "foo"}, err: true},
{name: "pacticipant and tag", selector: ConsumerVersionSelector{Pacticipant: "foo", Tag: "foo"}, err: false},
{name: "pacticipant, tag and all set", selector: ConsumerVersionSelector{Pacticipant: "foo", Tag: "foo", All: true}, err: false},
{name: "pacticipant, tag, consumer", selector: ConsumerVersionSelector{Pacticipant: "foo", Tag: "foo", Consumer: "bar"}, err: false},
{name: "pacticipant, tag, deployedOrReleased", selector: ConsumerVersionSelector{Pacticipant: "foo", Tag: "foo", DeployedOrReleased: true}, err: false},
{name: "pacticipant, tag, deployed", selector: ConsumerVersionSelector{Pacticipant: "foo", Tag: "foo", Deployed: true}, err: false},
{name: "pacticipant, tag, released", selector: ConsumerVersionSelector{Pacticipant: "foo", Tag: "foo", Released: true}, err: false},
{name: "pacticipant, tag, environment", selector: ConsumerVersionSelector{Pacticipant: "foo", Tag: "foo", Environment: "dev"}, err: false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down