Skip to content

Commit

Permalink
fix(windows): split mock service CLI arg tuples into individual eleme…
Browse files Browse the repository at this point in the history
…nts #9
  • Loading branch information
mefellows committed Feb 20, 2017
1 parent 2c6c84d commit 0dad9cc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
3 changes: 2 additions & 1 deletion daemon/mock_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ func (m *MockService) NewService(args []string) (int, Service) {
log.Println("[DEBUG] starting mock service on port:", port)

m.Args = []string{
fmt.Sprintf("--port %d", port),
"--port",
fmt.Sprintf("%d", port),
}
m.Args = append(m.Args, args...)

Expand Down
6 changes: 3 additions & 3 deletions daemon/mock_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "testing"

func TestMockService_NewService(t *testing.T) {
s := &MockService{}
port, svc := s.NewService([]string{"--foo bar"})
port, svc := s.NewService([]string{"--foo"})

if port <= 0 {
t.Fatalf("Expected non-zero port but got: %d", port)
Expand All @@ -14,7 +14,7 @@ func TestMockService_NewService(t *testing.T) {
t.Fatalf("Expected a non-nil object but got nil")
}

if s.Args[1] != "--foo bar" {
t.Fatalf("Expected '--foo bar' argument to be passed")
if s.Args[2] != "--foo" {
t.Fatalf("Expected '--foo' argument to be passed")
}
}
15 changes: 10 additions & 5 deletions dsl/pact.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,16 @@ func (p *Pact) Setup() *Pact {

if p.Server == nil {
args := []string{
fmt.Sprintf("--pact-specification-version %d", p.SpecificationVersion),
fmt.Sprintf("--pact-dir %s", filepath.FromSlash(p.PactDir)),
fmt.Sprintf("--log %s", filepath.FromSlash(p.LogDir+"/"+"pact.log")),
fmt.Sprintf("--consumer %s", p.Consumer),
fmt.Sprintf("--provider %s", p.Provider),
"--pact-specification-version",
fmt.Sprintf("%d", p.SpecificationVersion),
"--pact-dir",
filepath.FromSlash(p.PactDir),
"--log",
filepath.FromSlash(p.LogDir + "/" + "pact.log"),
"--consumer",
p.Consumer,
"--provider",
p.Provider,
}
client := &PactClient{Port: p.Port}
p.pactClient = client
Expand Down

0 comments on commit 0dad9cc

Please sign in to comment.