Esempio n. 1
0
func stop(path string, controller confab.Controller, agentClient *agent.Client) {
	rpcClient, err := consulagent.NewRPCClient("localhost:8400")
	if err != nil {
		stderr.Printf("error connecting to RPC server: %s", err)
		exit(controller, 1)
	}

	agentClient.ConsulRPCClient = &agent.RPCClient{*rpcClient}
	stderr.Printf("stopping agent")
	controller.StopAgent()
	stderr.Printf("stopped agent")
}
Esempio n. 2
0
func configureServer(controller confab.Controller, agentClient *agent.Client, timeout confab.Timeout) {
	rpcClient, err := consulagent.NewRPCClient("localhost:8400")

	if err != nil {
		stderr.Printf("error connecting to RPC server: %s", err)
		exit(controller, 1)
	}

	agentClient.ConsulRPCClient = &agent.RPCClient{*rpcClient}
	err = controller.ConfigureServer(timeout)
	if err != nil {
		stderr.Printf("error configuring server: %s", err)
		exit(controller, 1)
	}
}
Esempio n. 3
0
				Expect(client.Leave()).To(MatchError("leave error"))
				Expect(consulRPCClient.LeaveCallCount()).To(Equal(1))
				Expect(logger.Messages).To(ContainSequence([]fakes.LoggerMessage{
					{
						Action: "agent-client.leave.leave.request",
					},
					{
						Action: "agent-client.leave.leave.request.failed",
						Error:  errors.New("leave error"),
					},
				}))
			})
		})

		Context("when the RCPClient has never been set", func() {
			It("returns an error", func() {
				client.ConsulRPCClient = nil

				Expect(client.Leave()).To(MatchError("consul rpc client is nil"))
				Expect(logger.Messages).To(ContainSequence([]fakes.LoggerMessage{
					{
						Action: "agent-client.leave.nil-rpc-client",
						Error:  errors.New("consul rpc client is nil"),
					},
				}))
			})
		})
	})
})