From 0dad9cccd6ca73fbe8510bd08b452d70d232c3eb Mon Sep 17 00:00:00 2001 From: Matt Fellows Date: Mon, 20 Feb 2017 18:04:27 +1100 Subject: [PATCH] fix(windows): split mock service CLI arg tuples into individual elements #9 --- daemon/mock_service.go | 3 ++- daemon/mock_service_test.go | 6 +++--- dsl/pact.go | 15 ++++++++++----- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/daemon/mock_service.go b/daemon/mock_service.go index b55b7aa7d..a5b4b295e 100644 --- a/daemon/mock_service.go +++ b/daemon/mock_service.go @@ -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...) diff --git a/daemon/mock_service_test.go b/daemon/mock_service_test.go index 110855e13..91e6937bb 100644 --- a/daemon/mock_service_test.go +++ b/daemon/mock_service_test.go @@ -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) @@ -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") } } diff --git a/dsl/pact.go b/dsl/pact.go index 81f55026d..2ef463895 100644 --- a/dsl/pact.go +++ b/dsl/pact.go @@ -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