Skip to content

Commit

Permalink
Merge pull request #175 from antklim/feature/new-consumer-version-sel…
Browse files Browse the repository at this point in the history
…ectors

Added consumer version selectors
  • Loading branch information
mefellows authored Aug 9, 2021
2 parents 6022d1c + de0bb5e commit f450f72
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
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

0 comments on commit f450f72

Please sign in to comment.