Documentation ¶
Overview ¶
Package daemon implements the RPC server side interface to remotely manage external Pact dependencies: The Pact Mock Service and Provider Verification "binaries."
See https://github.com/pact-foundation/pact-provider-verifier and https://github.com/bethesque/pact-mock_service for more on the Ruby "binaries".
NOTE: The ultimate goal here is to replace the Ruby dependencies with a shared library (Pact Reference - (https://github.com/pact-foundation/pact-reference/).
Index ¶
- type Daemon
- func (d Daemon) ListServers(request types.MockServer, reply *types.PactListResponse) error
- func (d Daemon) Shutdown()
- func (d Daemon) StartDaemon(port int, network string, address string)
- func (d Daemon) StartServer(request types.MockServer, reply *types.MockServer) error
- func (d Daemon) StopDaemon(request string, reply *string) error
- func (d Daemon) StopServer(request types.MockServer, reply *types.MockServer) error
- func (d Daemon) VerifyProvider(request types.VerifyRequest, reply *types.CommandResponse) error
- type MockService
- type Service
- type ServiceManager
- type ServiceMock
- type VerificationService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon wraps the commands for the RPC server.
func (Daemon) ListServers ¶
func (d Daemon) ListServers(request types.MockServer, reply *types.PactListResponse) error
ListServers returns a slice of all running types.MockServers.
func (Daemon) Shutdown ¶
func (d Daemon) Shutdown()
Shutdown ensures all services are cleanly destroyed.
func (Daemon) StartDaemon ¶
StartDaemon starts the daemon RPC server.
func (Daemon) StartServer ¶
func (d Daemon) StartServer(request types.MockServer, reply *types.MockServer) error
StartServer starts a mock server and returns a pointer to atypes.MockServer struct.
func (Daemon) StopDaemon ¶
StopDaemon allows clients to programmatically shuts down the running Daemon via RPC.
func (Daemon) StopServer ¶
func (d Daemon) StopServer(request types.MockServer, reply *types.MockServer) error
StopServer stops the given mock server.
func (Daemon) VerifyProvider ¶
func (d Daemon) VerifyProvider(request types.VerifyRequest, reply *types.CommandResponse) error
VerifyProvider runs the Pact Provider Verification Process.
type MockService ¶ added in v0.0.2
type MockService struct {
ServiceManager
}
MockService is a wrapper for the Pact Mock Service.
func (*MockService) NewService ¶ added in v0.0.2
func (m *MockService) NewService(args []string) Service
NewService creates a new MockService with default settings.
type Service ¶
type Service interface { Setup() Stop(pid int) (bool, error) List() map[int]*exec.Cmd Start() *exec.Cmd Run(io.Writer) (*exec.Cmd, error) NewService(args []string) Service }
Service is a process wrapper for 3rd party binaries. It will spawn an instance of the binary and manage the life-cycle and IO of the process.
type ServiceManager ¶
type ServiceManager struct { Command string Args []string Env []string // contains filtered or unexported fields }
ServiceManager is the default implementation of the Service interface.
func (*ServiceManager) List ¶
func (s *ServiceManager) List() map[int]*exec.Cmd
List all Service PIDs.
func (*ServiceManager) Start ¶
func (s *ServiceManager) Start() *exec.Cmd
Start a Service and log its output.
type ServiceMock ¶
type ServiceMock struct { Command string Args []string ServiceStopResult bool ServiceStopError error ServiceList map[int]*exec.Cmd ServiceStartCmd *exec.Cmd ServiceStartCount int ServicePort int ServiceStopCount int ServicesSetupCalled bool // ExecFunc sets the function to run when starting commands ExecFunc func() *exec.Cmd // contains filtered or unexported fields }
ServiceMock is the mock implementation of the Service interface.
func (*ServiceMock) NewService ¶
func (s *ServiceMock) NewService(args []string) Service
NewService creates a new MockService with default settings.
func (*ServiceMock) Start ¶
func (s *ServiceMock) Start() *exec.Cmd
Start a Service and log its output.
type VerificationService ¶
type VerificationService struct {
ServiceManager
}
VerificationService is a wrapper for the Pact Provider Verifier Service.
func (*VerificationService) NewService ¶
func (m *VerificationService) NewService(args []string) Service
NewService creates a new VerificationService with default settings. Arguments allowed:
--provider-base-url --pact-urls --provider-states-url --provider-states-setup-url --broker-username --broker-password --publish_verification_results --provider_app_version