Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Fellows committed Feb 5, 2020
1 parent cdc7464 commit a3bb53c
Show file tree
Hide file tree
Showing 193 changed files with 71,770 additions and 34,254 deletions.
2 changes: 1 addition & 1 deletion client/publish_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type PublishService struct {
// --provider-app-version
// --custom-provider-headers
func (v *PublishService) NewService(args []string) Service {
log.Printf("[DEBUG] starting verification service with args: %v\n", args)
log.Printf("[DEBUG] starting publish service with args: %v\n", args)

v.Args = []string{
"publish",
Expand Down
1 change: 1 addition & 0 deletions dsl/pact.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ func (p *Pact) VerifyProviderRaw(request types.VerifyRequest) ([]types.ProviderV
Provider: request.Provider,
ProviderStatesSetupURL: setupURL,
CustomProviderHeaders: request.CustomProviderHeaders,
ConsumerVersionSelectors: request.ConsumerVersionSelectors,
}

if request.Provider == "" {
Expand Down
7 changes: 5 additions & 2 deletions examples/consumer/goconsumer/user_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,22 @@ func TestMain(m *testing.M) {
pact.Teardown()

// Enable when running E2E/integration tests before a release
version := "1.0.0"
version := "1.0.1"
if os.Getenv("TRAVIS_BUILD_NUMBER") != "" {
version = fmt.Sprintf("1.0.%s-%d", os.Getenv("TRAVIS_BUILD_NUMBER"), time.Now().Unix())
}

// Publish the Pacts...
p := dsl.Publisher{}
p := dsl.Publisher{
LogLevel: "DEBUG",
}

err := p.Publish(types.PublishRequest{
PactURLs: []string{filepath.FromSlash(fmt.Sprintf("%s/jmarie-loginprovider.json", pactDir))},
PactBroker: fmt.Sprintf("%s://%s", os.Getenv("PACT_BROKER_PROTO"), os.Getenv("PACT_BROKER_URL")),
ConsumerVersion: version,
Tags: []string{"dev", "prod"},
BrokerToken: os.Getenv("PACT_BROKER_TOKEN"),
BrokerUsername: os.Getenv("PACT_BROKER_USERNAME"),
BrokerPassword: os.Getenv("PACT_BROKER_PASSWORD"),
})
Expand Down
46 changes: 29 additions & 17 deletions examples/gin/provider/user_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,43 @@ func TestExample_GinProvider(t *testing.T) {
pact := createPact()

// Verify the Provider - Latest Published Pacts for any known consumers
_, err := pact.VerifyProvider(t, types.VerifyRequest{
ProviderBaseURL: fmt.Sprintf("http://127.0.0.1:%d", port),
BrokerURL: fmt.Sprintf("%s://%s", os.Getenv("PACT_BROKER_PROTO"), os.Getenv("PACT_BROKER_URL")),
BrokerToken: os.Getenv("PACT_BROKER_TOKEN"),
PublishVerificationResults: true,
ProviderVersion: "1.0.0",
StateHandlers: stateHandlers,
RequestFilter: fixBearerToken,
AllowPending: false,
})

if err != nil {
t.Fatal(err)
}
// _, err := pact.VerifyProvider(t, types.VerifyRequest{
// ProviderBaseURL: fmt.Sprintf("http://127.0.0.1:%d", port),
// BrokerURL: fmt.Sprintf("%s://%s", os.Getenv("PACT_BROKER_PROTO"), os.Getenv("PACT_BROKER_URL")),
// BrokerToken: os.Getenv("PACT_BROKER_TOKEN"),
// BrokerUsername: os.Getenv("PACT_BROKER_USERNAME"),
// BrokerPassword: os.Getenv("PACT_BROKER_PASSWORD"),
// PublishVerificationResults: true,
// ProviderVersion: "1.0.0",
// StateHandlers: stateHandlers,
// RequestFilter: fixBearerToken,
// AllowPending: false,
// })

// if err != nil {
// t.Fatal(err)
// }

// Verify the Provider - Tag-based Published Pacts for any known consumers
_, err = pact.VerifyProvider(t, types.VerifyRequest{
_, err := pact.VerifyProvider(t, types.VerifyRequest{
ProviderBaseURL: fmt.Sprintf("http://127.0.0.1:%d", port),
BrokerURL: fmt.Sprintf("%s://%s", os.Getenv("PACT_BROKER_PROTO"), os.Getenv("PACT_BROKER_URL")),
Tags: []string{"prod"},
ConsumerVersionSelectors: []types.ConsumerVersionSelector{
types.ConsumerVersionSelector{
Tag: "dev",
Pacticipant: "jmarie",
// All: true,
// Latest: true,
},
},
BrokerToken: os.Getenv("PACT_BROKER_TOKEN"),
BrokerUsername: os.Getenv("PACT_BROKER_USERNAME"),
BrokerPassword: os.Getenv("PACT_BROKER_PASSWORD"),
PublishVerificationResults: true,
ProviderVersion: "1.0.0",
StateHandlers: stateHandlers,
RequestFilter: fixBearerToken,
AllowPending: false,
EnablePending: true,
})

if err != nil {
Expand Down Expand Up @@ -149,5 +160,6 @@ func createPact() dsl.Pact {
LogDir: logDir,
PactDir: pactDir,
DisableToolValidityCheck: true,
LogLevel: "DEBUG",
}
}
1 change: 1 addition & 0 deletions types/consumer_version_selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "fmt"
// 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"`
Expand Down
6 changes: 3 additions & 3 deletions types/verify_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ type VerifyRequest struct {
CustomTLSConfig *tls.Config

// Allow pending pacts to be included in verification (see pact.io/pending)
AllowPending bool
EnablePending bool

// Verbose increases verbosity of output
// Deprecated
Expand Down Expand Up @@ -135,7 +135,7 @@ func (v *VerifyRequest) Validate() error {
return fmt.Errorf("invalid consumer version selector specified: %v", err)
}

v.Args = append(v.Args, "--consumer-version-selector", string(body))
v.Args = append(v.Args, "--consumer-version-selector", fmt.Sprintf("'%s'", string(body)))
}
}

Expand Down Expand Up @@ -205,7 +205,7 @@ func (v *VerifyRequest) Validate() error {
v.Args = append(v.Args, "--provider-version-tag", tag)
}

if v.AllowPending {
if v.EnablePending {
v.Args = append(v.Args, "--enable-pending")
}

Expand Down
1 change: 1 addition & 0 deletions vendor/github.com/hashicorp/go-version/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 25 additions & 4 deletions vendor/github.com/hashicorp/go-version/version.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified vendor/github.com/ugorji/go/codec/test.py
100755 → 100644
Empty file.
Loading

0 comments on commit a3bb53c

Please sign in to comment.