Skip to content

Commit

Permalink
fix(message): set correct default for message Pact write mode. Fixes #96
Browse files Browse the repository at this point in the history
  • Loading branch information
mefellows committed Sep 28, 2018
1 parent 6b222e8 commit 2acf846
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 25 deletions.
9 changes: 4 additions & 5 deletions dsl/pact.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,11 +532,10 @@ func (p *Pact) VerifyMessageConsumerRaw(message *Message, handler MessageConsume

// If no errors, update Message Pact
return p.pactClient.UpdateMessagePact(types.PactMessageRequest{
Message: message,
Consumer: p.Consumer,
Provider: p.Provider,
PactFileWriteMode: p.PactFileWriteMode,
PactDir: p.PactDir,
Message: message,
Consumer: p.Consumer,
Provider: p.Provider,
PactDir: p.PactDir,
})
}

Expand Down
11 changes: 5 additions & 6 deletions examples/messages/consumer/message_pact_consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,10 @@ var logDir = fmt.Sprintf("%s/log", dir)
// Setup the Pact client.
func createPact() dsl.Pact {
return dsl.Pact{
Consumer: "PactGoMessageConsumer",
Provider: "PactGoMessageProvider",
LogDir: logDir,
PactDir: pactDir,
LogLevel: "DEBUG",
PactFileWriteMode: "update",
Consumer: "PactGoMessageConsumer",
Provider: "PactGoMessageProvider",
LogDir: logDir,
PactDir: pactDir,
LogLevel: "DEBUG",
}
}
9 changes: 4 additions & 5 deletions examples/messages/provider/message_pact_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ var logDir = fmt.Sprintf("%s/log", dir)
// Setup the Pact client.
func createPact() dsl.Pact {
return dsl.Pact{
Consumer: "PactGoMessageConsumer",
Provider: "PactGoMessageProvider",
LogDir: logDir,
LogLevel: "DEBUG",
PactFileWriteMode: "update",
Consumer: "PactGoMessageConsumer",
Provider: "PactGoMessageProvider",
LogDir: logDir,
LogLevel: "DEBUG",
}
}
10 changes: 1 addition & 9 deletions types/pact_message_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ type PactMessageRequest struct {
// PactDir is the location of where pacts should be stored
PactDir string

// PactFileWriteMode specifies how to write to the Pact file, for the life
// of a Mock Service.
// "overwrite" will always truncate and replace the pact after each run
// "update" will append to the pact file, which is useful if your tests
// are split over multiple files and instantiations of a Mock Server
// See https://github.com/pact-foundation/pact-ruby/blob/master/documentation/configuration.md#pactfile_write_mode
PactFileWriteMode string

// Args are the arguments sent to to the message service
Args []string
}
Expand All @@ -41,7 +33,7 @@ func (m *PactMessageRequest) Validate() error {
}

m.Args = append(m.Args, []string{
m.PactFileWriteMode,
"update",
string(body),
"--consumer",
m.Consumer,
Expand Down

0 comments on commit 2acf846

Please sign in to comment.